@arcgis/core 4.34.0-next.57 → 4.34.0-next.59

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 (462) hide show
  1. package/Basemap.js +1 -1
  2. package/LICENSE.md +19 -0
  3. package/README.md +2 -18
  4. package/applications/KnowledgeStudio/reshape.d.ts +5 -0
  5. package/applications/KnowledgeStudio/reshape.js +5 -0
  6. package/assets/esri/core/workers/RemoteClient.js +1 -1
  7. package/assets/esri/core/workers/chunks/03fe4164abd12abc7921.js +1 -0
  8. package/assets/esri/core/workers/chunks/{893e5eb5c028c4704317.js → 0427f66b56ec6601deb0.js} +1 -1
  9. package/assets/esri/core/workers/chunks/06b65105b15abf4d0fbf.js +1 -0
  10. package/assets/esri/core/workers/chunks/{02902303e5585a16ebea.js → 0b53bc76d38e85902748.js} +1 -1
  11. package/assets/esri/core/workers/chunks/0cb2f7172190babb4139.js +1 -0
  12. package/assets/esri/core/workers/chunks/0e28cb5d8d89ae29cdd0.js +1 -0
  13. package/assets/esri/core/workers/chunks/{1776ef96c9f4636f8838.js → 138c11b5eca621e51396.js} +1 -1
  14. package/assets/esri/core/workers/chunks/14c6461ffd36319e1d74.js +1 -0
  15. package/assets/esri/core/workers/chunks/1612d1c1d78c122dfef6.js +1 -0
  16. package/assets/esri/core/workers/chunks/17abab49db1813d3e192.js +1 -0
  17. package/assets/esri/core/workers/chunks/182383fd00008606bfaa.js +1 -0
  18. package/assets/esri/core/workers/chunks/18f878ec695617650a96.js +1 -0
  19. package/assets/esri/core/workers/chunks/{d578c3880eaf2dd62324.js → 19e5e011f929b6b940fe.js} +1 -1
  20. package/assets/esri/core/workers/chunks/{57c438bb0da6410df525.js → 1bf17c6548ac4cd5a166.js} +1 -1
  21. package/assets/esri/core/workers/chunks/1c61cf137a989bc52bb8.js +1 -0
  22. package/assets/esri/core/workers/chunks/{043bb97e38e3a54aa2ab.js → 1ed7a8f4a0058d3b69ef.js} +1 -1
  23. package/assets/esri/core/workers/chunks/{dd2b5f115d156b5b212e.js → 22ec2b0a853911692dc8.js} +1 -1
  24. package/assets/esri/core/workers/chunks/232c76f122b1f519e099.js +1 -0
  25. package/assets/esri/core/workers/chunks/{827bebb4bcdde23adc91.js → 251b7f2e295ce191eb62.js} +1 -1
  26. package/assets/esri/core/workers/chunks/27334cda1b877abcba1b.js +1 -0
  27. package/assets/esri/core/workers/chunks/{02a31483e09652a1a1a2.js → 2b7f9a57a2cfbc108673.js} +1 -1
  28. package/assets/esri/core/workers/chunks/{9fef330b241f958b55df.js → 2cd27b06226e30aec5da.js} +1 -1
  29. package/assets/esri/core/workers/chunks/{7c86af4f60cea383ed96.js → 39a1f361bb69073af765.js} +1 -1
  30. package/assets/esri/core/workers/chunks/3a7ac10a6614fe5745f7.js +1 -0
  31. package/assets/esri/core/workers/chunks/{70cf81ec5a901782d2db.js → 3e7c9a43e52ed6a1b018.js} +1 -1
  32. package/assets/esri/core/workers/chunks/{8257352421f453a669e9.js → 3f634580055b30dbfc8e.js} +1 -1
  33. package/assets/esri/core/workers/chunks/{0e8d3d38e9b1f6abf6f2.js → 3fd09a7c05583a57a317.js} +1 -1
  34. package/assets/esri/core/workers/chunks/{52917b753c5ceab0c1f7.js → 4050ddb580d364d9e205.js} +7 -7
  35. package/assets/esri/core/workers/chunks/{8c79945909069733558f.js → 4094cebc4b92c52f4e27.js} +1 -1
  36. package/assets/esri/core/workers/chunks/{82de1b50ae286f1e6c44.js → 451761c7bd2da530e1d0.js} +1 -1
  37. package/assets/esri/core/workers/chunks/{cc748d4f4adb9c584aa4.js → 45aeff2f751f124f8e53.js} +1 -1
  38. package/assets/esri/core/workers/chunks/462b30fc40a5f337ba10.js +1 -0
  39. package/assets/esri/core/workers/chunks/{d20af70b23f175fb5442.js → 48b9ba825856a0c843ff.js} +1 -1
  40. package/assets/esri/core/workers/chunks/497214e9e82b936fc94e.js +1 -0
  41. package/assets/esri/core/workers/chunks/4ac127cefa3aa5e93e78.js +1 -0
  42. package/assets/esri/core/workers/chunks/4b1daffa97fd90a554a0.js +1 -0
  43. package/assets/esri/core/workers/chunks/4d7fcec769369c576847.js +1 -0
  44. package/assets/esri/core/workers/chunks/4dee2f05508e90410f13.js +1 -0
  45. package/assets/esri/core/workers/chunks/516864fb68025acc7db6.js +1 -0
  46. package/assets/esri/core/workers/chunks/{d630fc3acd2552c98dc0.js → 547af4ffbeeccba9d187.js} +1 -1
  47. package/assets/esri/core/workers/chunks/54b43876ae6fb078eb38.js +1 -0
  48. package/assets/esri/core/workers/chunks/{cf699b9bb530b87be14c.js → 58422c616a824ab49218.js} +1 -1
  49. package/assets/esri/core/workers/chunks/589a0e244ef5f1b84ab6.js +1 -0
  50. package/assets/esri/core/workers/chunks/5b7e5ec6aea1f7f9b005.js +1 -0
  51. package/assets/esri/core/workers/chunks/{fe55833c80cf59df9c2b.js → 5cb238318a24b70d5ac3.js} +1 -1
  52. package/assets/esri/core/workers/chunks/{2c7e7895c4dda176220e.js → 5d4b24c864ebb68ae61e.js} +1 -1
  53. package/assets/esri/core/workers/chunks/{88a5e7415f8858c454f7.js → 5de7c2a80bd9c81cefe2.js} +1 -1
  54. package/assets/esri/core/workers/chunks/5e1afea05b624b315d9f.js +1 -0
  55. package/assets/esri/core/workers/chunks/5ed7e139c72cd2b3ddba.js +1 -0
  56. package/assets/esri/core/workers/chunks/6531f33d6710960079e9.js +1 -0
  57. package/assets/esri/core/workers/chunks/{a1ff4c252012d5026133.js → 65eb183b5d001dfc42c8.js} +1 -1
  58. package/assets/esri/core/workers/chunks/{f1b6d6ee03635d985c3e.js → 6688efc71d9d8f4d2559.js} +1 -1
  59. package/assets/esri/core/workers/chunks/{d5faf3ddf9a39de826be.js → 672c04d48aa51f16e9b7.js} +1 -1
  60. package/assets/esri/core/workers/chunks/{1cbd59918c60a1a21494.js → 700b5a536f97233bc4af.js} +1 -1
  61. package/assets/esri/core/workers/chunks/7597ef10d1699e7088e5.js +1 -0
  62. package/assets/esri/core/workers/chunks/781e424a383c71ca904d.js +1 -0
  63. package/assets/esri/core/workers/chunks/79933271a76a1756584f.js +1 -0
  64. package/assets/esri/core/workers/chunks/{17e203e4680c07bd02f1.js → 7aa7aff6d42be7c2d1d2.js} +1 -1
  65. package/assets/esri/core/workers/chunks/{c2f184e9f579152aa29a.js → 7b17f52019762aa21af8.js} +1 -1
  66. package/assets/esri/core/workers/chunks/{549e073fe276363a9896.js → 7db105f6b688b6da8106.js} +1 -1
  67. package/assets/esri/core/workers/chunks/{945c5a477940ebd23a4c.js → 7f0c78bcba0aed3c4eff.js} +1 -1
  68. package/assets/esri/core/workers/chunks/{a249e56a0be8cef33ba8.js → 81eb7785d626aa975033.js} +1 -1
  69. package/assets/esri/core/workers/chunks/{3eb792863a789b97ec58.js → 831a69e5a87e92830fbe.js} +1 -1
  70. package/assets/esri/core/workers/chunks/8374d87176486c1fc90e.js +1 -0
  71. package/assets/esri/core/workers/chunks/83dfaa6e3bd58d544f35.js +1 -0
  72. package/assets/esri/core/workers/chunks/{5691d504ffe5592bc40f.js → 897f9775f06ddbf6486f.js} +1 -1
  73. package/assets/esri/core/workers/chunks/8bbae8ac586e5c0819d2.js +1 -0
  74. package/assets/esri/core/workers/chunks/8c0e11f781607239749d.js +1 -0
  75. package/assets/esri/core/workers/chunks/90540fdfb0c5f68aa959.js +1 -0
  76. package/assets/esri/core/workers/chunks/9280edff80fd87860a5e.js +1 -0
  77. package/assets/esri/core/workers/chunks/{9275313e0f1f521b2658.js → 9325000c87295c473291.js} +1 -1
  78. package/assets/esri/core/workers/chunks/94b9948ec628187c19fc.js +1 -0
  79. package/assets/esri/core/workers/chunks/94f1005222bff1870ef1.js +1 -0
  80. package/assets/esri/core/workers/chunks/{aab349d4624b78ef429f.js → 96102a9296afd1bfe1a9.js} +1 -1
  81. package/assets/esri/core/workers/chunks/981275b6f008431c983a.js +1 -0
  82. package/assets/esri/core/workers/chunks/{4d2473e680324dc17cfa.js → 997a2a1a51039ce7e4e3.js} +1 -1
  83. package/assets/esri/core/workers/chunks/{07d5e0633cc2f765037f.js → 9f4e23bae621ff3ecea3.js} +1 -1
  84. package/assets/esri/core/workers/chunks/{4e2b125e6e3945985a54.js → 9f93513037a6e87433c4.js} +1 -1
  85. package/assets/esri/core/workers/chunks/a16b471c3706ee37f9b6.js +1 -0
  86. package/assets/esri/core/workers/chunks/{989251f5e0d6a08b1afa.js → a17ed7ce97e69466d730.js} +1 -1
  87. package/assets/esri/core/workers/chunks/a2150baf0661e2f28011.js +1 -0
  88. package/assets/esri/core/workers/chunks/a244afea77127e54dd3a.js +1 -0
  89. package/assets/esri/core/workers/chunks/{ab3c018c406dcd81ef9e.js → a2f4b6d8da93f106852c.js} +1 -1
  90. package/assets/esri/core/workers/chunks/a532614aa65fb52dee7b.js +1 -0
  91. package/assets/esri/core/workers/chunks/{3b51b61a7b8a1ef87c9b.js → a700f57af6856cb5313c.js} +1 -1
  92. package/assets/esri/core/workers/chunks/{319fe6a02ec630a827ea.js → a7ea2e3895046e566bc6.js} +1 -1
  93. package/assets/esri/core/workers/chunks/abe60d92e0219ee97036.js +1 -0
  94. package/assets/esri/core/workers/chunks/{a7530dcb08b43e37bbb2.js → ae1cb4c65d72217ae4d4.js} +1 -1
  95. package/assets/esri/core/workers/chunks/af5ae7c36e1178077cbc.js +1 -0
  96. package/assets/esri/core/workers/chunks/{7f80bbbd0897082c1af3.js → b29144ee58b43f769d9a.js} +1 -1
  97. package/assets/esri/core/workers/chunks/b30de4936caa654d7817.js +1 -0
  98. package/assets/esri/core/workers/chunks/{4193691ca076948f4f90.js → b53008c1461dd6bacc63.js} +1 -1
  99. package/assets/esri/core/workers/chunks/{1d234c057a6671acc59f.js → b605dfdfed8ff8eda4f3.js} +1 -1
  100. package/assets/esri/core/workers/chunks/{76ff7ccfe583927918f3.js → b68b54be3d67595a9446.js} +18 -18
  101. package/assets/esri/core/workers/chunks/b6c6f82df3b60c2f831f.js +1 -0
  102. package/assets/esri/core/workers/chunks/{7eda1c400658b6a99be8.js → ba0c7339fa19cc7cbde7.js} +1 -1
  103. package/assets/esri/core/workers/chunks/{fae6030a81cb91a91b69.js → bafd9b0f6e817252cb31.js} +1 -1
  104. package/assets/esri/core/workers/chunks/{c80c032c5b7a11db177a.js → bb2ab663e3e5597f2104.js} +1 -1
  105. package/assets/esri/core/workers/chunks/{724de82d101eb59c2834.js → bd451668c4ce9f7d7128.js} +1 -1
  106. package/assets/esri/core/workers/chunks/{91ede8c62a7b1e8b8023.js → be06c8a58c217a17451b.js} +1 -1
  107. package/assets/esri/core/workers/chunks/bf6b76027c60b4ffa507.js +1 -0
  108. package/assets/esri/core/workers/chunks/{08c0c016787caa169492.js → c24214666d10cb648428.js} +1 -1
  109. package/assets/esri/core/workers/chunks/c34a164a8ece4cb33e81.js +1 -0
  110. package/assets/esri/core/workers/chunks/{a3a23a56df4e5ee86bb2.js → c5fe356fc5b8b7be0d31.js} +1 -1
  111. package/assets/esri/core/workers/chunks/c696615cae5daefa2d98.js +1 -0
  112. package/assets/esri/core/workers/chunks/{e982cf44906eb26164f2.js → c75b0243e5bb84738419.js} +1 -1
  113. package/assets/esri/core/workers/chunks/{64fab4e1e28c06c83403.js → c779c8b98e07fa881c1d.js} +1 -1
  114. package/assets/esri/core/workers/chunks/{4a0257c449f31bdadf26.js → cef9ff811221a7c3812c.js} +1 -1
  115. package/assets/esri/core/workers/chunks/{b1982490762972ae023d.js → d0296368ae143de4d5ce.js} +1 -1
  116. package/assets/esri/core/workers/chunks/{3d5954478864a975e65e.js → d07d3b0e06f12aee4a8b.js} +1 -1
  117. package/assets/esri/core/workers/chunks/{e1472dbf0795d737d6f8.js → d2371f5034b2a32e2523.js} +1 -1
  118. package/assets/esri/core/workers/chunks/{2f65081bfedeab44d6cb.js → d35cadfb78ac9803069b.js} +1 -1
  119. package/assets/esri/core/workers/chunks/{80a69897fa3ce1eaa6e7.js → d707538b150d79050336.js} +1 -1
  120. package/assets/esri/core/workers/chunks/d7ce68667bb355ef8e5d.js +1 -0
  121. package/assets/esri/core/workers/chunks/d823277612f971a9c2f0.js +1 -0
  122. package/assets/esri/core/workers/chunks/d83bdc13c3cad3eee7be.js +1 -0
  123. package/assets/esri/core/workers/chunks/d91b80aa4f847c2e2a33.js +1 -0
  124. package/assets/esri/core/workers/chunks/{a96ac5c68d84122e7751.js → db7678104b18534482e3.js} +1 -1
  125. package/assets/esri/core/workers/chunks/dbcef57073075e9cfdfe.js +1 -0
  126. package/assets/esri/core/workers/chunks/{c4ceb267d4004d8da8cc.js → e0bbfbe1ed39c82f1bd4.js} +1 -1
  127. package/assets/esri/core/workers/chunks/e36d538915261ee0373f.js +1 -0
  128. package/assets/esri/core/workers/chunks/e58c5c8639aa837c84d1.js +1 -0
  129. package/assets/esri/core/workers/chunks/{a24762e976c1459b12de.js → e689a4849f5af3f2f641.js} +1 -1
  130. package/assets/esri/core/workers/chunks/e97250ae8da4bd0d6bc9.js +1 -0
  131. package/assets/esri/core/workers/chunks/{ef85cd0e82d59db8a26f.js → eacc7fccdc3fb670ac8f.js} +2 -2
  132. package/assets/esri/core/workers/chunks/{0df1f56df6d47dfbb6ea.js → eada3483116a5ea8baed.js} +1 -1
  133. package/assets/esri/core/workers/chunks/ed8863c3d334f438b625.js +1 -0
  134. package/assets/esri/core/workers/chunks/{47682247910271077333.js → ee78a38a0cacb19b2fd4.js} +1 -1
  135. package/assets/esri/core/workers/chunks/{f4061587ff5789fa4e1f.js → f594df2f5ce6ca41a254.js} +1 -1
  136. package/assets/esri/core/workers/chunks/{d7b3e81cc313fd0a33b0.js → f5c821ca2911a5103c9a.js} +1 -1
  137. package/assets/esri/core/workers/chunks/f636ca5c811c3a2a962f.js +1 -0
  138. package/assets/esri/core/workers/chunks/{a3ee76b7e46d3fba7cf7.js → f6d91256c4e5f8a0d5c0.js} +1 -1
  139. package/assets/esri/core/workers/chunks/f711aeba1a2c184ddb43.js +1 -0
  140. package/assets/esri/core/workers/chunks/f718f630a8b81496c646.js +1 -0
  141. package/assets/esri/core/workers/chunks/{cac060a187f3a27a19ba.js → fa0f94318173db2034de.js} +1 -1
  142. package/assets/esri/core/workers/chunks/fdae43a97537093e4b97.js +1 -0
  143. package/assets/esri/core/workers/chunks/{b6a201e86f9caef45ff0.js → ff2614d96ca5228e9685.js} +1 -1
  144. package/assets/esri/themes/base/widgets/_Editor.scss +5 -3
  145. package/assets/esri/themes/base/widgets/_SelectionToolbar.scss +6 -0
  146. package/assets/esri/themes/dark/main.css +1 -1
  147. package/assets/esri/themes/light/main.css +1 -1
  148. package/assets/esri/themes/light/view.css +1 -1
  149. package/assets/esri/widgets/support/SelectionToolbar/t9n/SelectionToolbar.json +1 -1
  150. package/assets/esri/widgets/support/SelectionToolbar/t9n/SelectionToolbar_en.json +1 -1
  151. package/chunks/BloomComposition.glsl.js +36 -18
  152. package/chunks/ColorMaterial.glsl.js +1 -1
  153. package/chunks/ComponentShader.glsl.js +3 -3
  154. package/chunks/CompositeGeographicTransformation.js +1 -1
  155. package/chunks/CutFillDepth.glsl.js +15 -0
  156. package/chunks/CutFillReduction.glsl.js +12 -0
  157. package/chunks/CutFillTargetDepth.glsl.js +6 -0
  158. package/chunks/DefaultMaterial.glsl.js +2 -2
  159. package/chunks/GeodeticDistanceCalculator-Ce-woMPw.js +1 -1
  160. package/chunks/GeographicTransformation.js +1 -1
  161. package/chunks/HUDMaterial.glsl.js +4 -4
  162. package/chunks/ImageMaterial.glsl.js +2 -2
  163. package/chunks/MultiPathImpl.js +1 -1
  164. package/chunks/NativeLine.glsl.js +1 -1
  165. package/chunks/OperatorGeodesicBuffer.js +1 -1
  166. package/chunks/OperatorGeodeticArea.js +1 -1
  167. package/chunks/OperatorGeodeticDensifyByLength.js +1 -1
  168. package/chunks/OperatorGeodeticLength.js +1 -1
  169. package/chunks/OperatorProximityGeodesic.js +1 -1
  170. package/chunks/OperatorShapePreservingLength.js +1 -1
  171. package/chunks/OperatorShapePreservingProject.js +1 -1
  172. package/chunks/Path.glsl.js +7 -7
  173. package/chunks/Pattern.glsl.js +1 -1
  174. package/chunks/Point2D.js +1 -1
  175. package/chunks/ProjectionTransformation.js +1 -1
  176. package/chunks/RealisticTree.glsl.js +2 -2
  177. package/chunks/RibbonLine.glsl.js +2 -2
  178. package/chunks/ShadedColorMaterial.glsl.js +1 -1
  179. package/chunks/SimpleAtmosphere.glsl.js +1 -1
  180. package/chunks/SpatialReference.js +1 -1
  181. package/chunks/Terrain.glsl.js +4 -4
  182. package/chunks/UnitFactory.js +1 -1
  183. package/chunks/WaterSurface.glsl.js +3 -3
  184. package/chunks/offsetOperator.js +1 -1
  185. package/chunks/sphere.js +1 -1
  186. package/chunks/vec42.js +1 -1
  187. package/config.js +1 -1
  188. package/copyright.txt +2 -20
  189. package/core/Clonable.js +1 -1
  190. package/core/accessorSupport/layerContainerType.js +1 -1
  191. package/core/libs/gl-matrix-2/math/quat.js +1 -1
  192. package/core/libs/gl-matrix-2/math/vec4.js +1 -1
  193. package/core/quantityFormatUtils.js +1 -1
  194. package/core/unitFormatUtils.js +1 -1
  195. package/editing/geometry/coordUtils.js +5 -0
  196. package/editing/geometry/lineUtils.js +5 -0
  197. package/editing/sharedTemplates/executor/builders/equallySpaced.js +1 -1
  198. package/editing/sharedTemplates/executor/builders/pointAtIntersectionVerticesOfLine.js +1 -1
  199. package/editing/sharedTemplates/executor/builders/support/builderUtils.js +1 -1
  200. package/editing/sharedTemplates/executor/builders/support/offsetUtils.js +1 -1
  201. package/editing/sharedTemplates/executor/builders/support/shapeUtils.js +1 -1
  202. package/effects/FocusArea.js +1 -1
  203. package/geometry/coordinateFormatter.js +1 -1
  204. package/geometry/operators/gx/operatorAlphaShape.js +1 -1
  205. package/geometry/operators/gx/operatorIntegrate.js +1 -1
  206. package/geometry/operators/gx/operatorOffset.js +1 -1
  207. package/geometry/operators/gx/operatorPolygonSlicer.js +1 -1
  208. package/geometry/operators/offsetOperator.js +1 -1
  209. package/geometry/operators/support/apiConverter.js +1 -1
  210. package/geometry/operators/support/initNoPeFactory.js +1 -1
  211. package/geometry/operators/support/jsonConverter.js +1 -1
  212. package/geometry/support/sphere.js +1 -1
  213. package/graphic/KnowledgeGraphGraphicOrigin.js +1 -1
  214. package/graphic/LinkChartGraphicOrigin.js +5 -0
  215. package/graphic/isLinkChartGraphicOrigin.js +5 -0
  216. package/interfaces.d.ts +131 -12
  217. package/kernel.js +1 -1
  218. package/layers/FeatureLayer.js +1 -1
  219. package/layers/GroundLayer.js +1 -1
  220. package/layers/IntegratedMesh3DTilesLayer.js +1 -1
  221. package/layers/IntegratedMeshLayer.js +1 -1
  222. package/layers/ParquetLayer.js +1 -1
  223. package/layers/PointCloudLayer.js +1 -1
  224. package/layers/SceneLayer.js +1 -1
  225. package/layers/buildingSublayers/BuildingComponentSublayer.js +1 -1
  226. package/layers/catalog/catalogUtils.js +1 -1
  227. package/layers/graphics/hydratedFeatures.js +1 -1
  228. package/layers/knowledgeGraph/KnowledgeGraphSublayer.js +1 -1
  229. package/layers/knowledgeGraph/nodeMovementUtils.js +5 -0
  230. package/layers/mixins/ImageryTileMixin.js +1 -1
  231. package/layers/mixins/operationalLayers.js +1 -1
  232. package/layers/support/RasterStorageInfo.js +1 -1
  233. package/layers/support/SceneFilter.js +1 -1
  234. package/layers/support/Sublayer.js +1 -1
  235. package/layers/support/layersCreator.js +1 -1
  236. package/layers/support/rasterDatasets/BaseRaster.js +1 -1
  237. package/layers/support/rasterFunctions/BandArithmeticFunction.js +1 -1
  238. package/layers/support/rasterFunctions/BaseRasterFunction.js +1 -1
  239. package/layers/support/rasterFunctions/ExtractBandFunction.js +1 -1
  240. package/layers/support/rasterFunctions/NDVIFunction.js +1 -1
  241. package/package.json +2 -2
  242. package/portal/schemas/definitions.js +1 -1
  243. package/renderers/support/RasterSymbolizer.js +1 -1
  244. package/support/basemapUtils.js +1 -1
  245. package/support/revision.js +1 -1
  246. package/views/2d/engine/Stage.js +1 -1
  247. package/views/2d/engine/webgl/Profiler.js +1 -1
  248. package/views/2d/layers/imagery/BaseImageryTileSubView2D.js +1 -1
  249. package/views/2d/layers/imagery/ImageryTileView2D.js +1 -1
  250. package/views/3d/camera/constraintUtils/distance.js +1 -1
  251. package/views/3d/camera/constraintUtils/tilt.js +1 -1
  252. package/views/3d/layers/BuildingComponentSublayerView3D.js +1 -1
  253. package/views/3d/layers/CSVLayerView3D.js +1 -1
  254. package/views/3d/layers/FeatureLayerView3D.js +1 -1
  255. package/views/3d/layers/FeatureLikeLayerView3D.js +1 -1
  256. package/views/3d/layers/GeoJSONLayerView3D.js +1 -1
  257. package/views/3d/layers/GraphicsLayerView3D.js +1 -1
  258. package/views/3d/layers/GraphicsView3D.js +1 -1
  259. package/views/3d/layers/I3SMeshView3D.js +1 -1
  260. package/views/3d/layers/IntegratedMesh3DTilesLayerView3D.js +1 -1
  261. package/views/3d/layers/IntegratedMeshLayerView3D.js +1 -1
  262. package/views/3d/layers/OGCFeatureLayerView3D.js +1 -1
  263. package/views/3d/layers/PointCloudLayerView3D.js +1 -1
  264. package/views/3d/layers/RouteLayerView3D.js +1 -1
  265. package/views/3d/layers/SceneLayerGraphicsView3D.js +1 -1
  266. package/views/3d/layers/SceneLayerView3D.js +1 -1
  267. package/views/3d/layers/StreamLayerView3D.js +1 -1
  268. package/views/3d/layers/WFSLayerView3D.js +1 -1
  269. package/views/3d/layers/graphics/Deconflictor.js +1 -1
  270. package/views/3d/layers/graphics/ElevationAligners.js +1 -1
  271. package/views/3d/layers/graphics/ElevationContext.js +1 -1
  272. package/views/3d/layers/graphics/Graphics3DCore.js +1 -1
  273. package/views/3d/layers/graphics/Graphics3DMeshFillSymbolLayer.js +1 -1
  274. package/views/3d/layers/graphics/Graphics3DObject3DGraphicLayer.js +1 -1
  275. package/views/3d/layers/graphics/GraphicsProcessor.js +1 -1
  276. package/views/3d/layers/graphics/Labeler.js +1 -1
  277. package/views/3d/layers/graphics/QueryEngine.js +1 -1
  278. package/views/3d/layers/graphics/StreamController.js +1 -1
  279. package/views/3d/layers/graphics/pipeline/Feature3DPipelineWorkerHandle.js +1 -1
  280. package/views/3d/layers/graphics/pipeline/rendering/DirectRenderer.js +1 -1
  281. package/views/3d/layers/graphics/pointUtils.js +1 -1
  282. package/views/3d/layers/i3s/I3SClientNodeLoader.js +1 -1
  283. package/views/3d/layers/i3s/I3SIndex.js +1 -1
  284. package/views/3d/layers/i3s/I3SViewportQueries.js +1 -1
  285. package/views/3d/layers/i3s/PointCloudRenderer.js +1 -1
  286. package/views/3d/layers/support/FlowTileTree3DDebugger.js +1 -1
  287. package/views/3d/layers/support/StageLayerElevationProvider.js +1 -1
  288. package/views/3d/layers/support/Tiles3DIntersectionHandler.js +1 -1
  289. package/views/3d/state/controllers/GamepadKeyboardController.js +1 -1
  290. package/views/3d/state/controllers/PinchAndPanControllerGlobal.js +1 -1
  291. package/views/3d/state/utils/navigationUtils.js +1 -1
  292. package/views/3d/support/CombinedElevationProvider.js +1 -1
  293. package/views/3d/support/flow/FlowSubViewTiles3D.js +1 -1
  294. package/views/3d/terrain/OverlayManager.js +1 -1
  295. package/views/3d/terrain/OverlayRenderTargets.js +1 -1
  296. package/views/3d/terrain/OverlayRenderer.js +1 -1
  297. package/views/3d/terrain/SphericalPatch.js +1 -1
  298. package/views/3d/terrain/TerrainRenderer.js +1 -1
  299. package/views/3d/terrain/TerrainSurface.js +1 -1
  300. package/views/3d/terrain/Tile.js +1 -1
  301. package/views/3d/webgl-engine/collections/Component/Material/ComponentMaterial.js +1 -1
  302. package/views/3d/webgl-engine/collections/Component/Material/ComponentTechniqueConfiguration.js +1 -1
  303. package/views/3d/webgl-engine/collections/Component/Material/shader/ComponentData.glsl.js +2 -2
  304. package/views/3d/webgl-engine/core/FBOCache.js +1 -1
  305. package/views/3d/webgl-engine/core/FBOCacheFormats.js +1 -1
  306. package/views/3d/webgl-engine/core/renderPasses/RenderPassManager.js +1 -1
  307. package/views/3d/webgl-engine/core/shaderLibrary/ShaderOutput.js +1 -1
  308. package/views/3d/webgl-engine/core/shaderLibrary/ShaderOutputConfiguration.js +1 -1
  309. package/views/3d/webgl-engine/core/shaderLibrary/attributes/ObjectAndLayerIdColor.glsl.js +1 -1
  310. package/views/3d/webgl-engine/core/shaderLibrary/default/DefaultMaterialAuxiliaryPasses.glsl.js +4 -4
  311. package/views/3d/webgl-engine/core/shaderLibrary/output/OutputDepth.glsl.js +2 -0
  312. package/views/3d/webgl-engine/core/shaderLibrary/output/OutputHighlight.glsl.js +1 -1
  313. package/views/3d/webgl-engine/core/shaderLibrary/output/OutputHighlightOverlay.js +1 -1
  314. package/views/3d/webgl-engine/core/shaderLibrary/shading/EvaluateSceneLighting.glsl.js +2 -4
  315. package/views/3d/webgl-engine/core/shaderLibrary/terrain/Overlay.glsl.js +1 -1
  316. package/views/3d/webgl-engine/effects/RenderPlugin.js +1 -1
  317. package/views/3d/webgl-engine/effects/RenderPluginManager.js +1 -1
  318. package/views/3d/webgl-engine/effects/bloom/BloomComposition.glsl.js +1 -1
  319. package/views/3d/webgl-engine/effects/bloom/BloomCompositionTechniqueConfiguration.js +5 -0
  320. package/views/3d/webgl-engine/effects/bloom/BloomRenderNode.js +1 -1
  321. package/views/3d/webgl-engine/effects/focusArea/FocusAreaMaskNode.js +1 -1
  322. package/views/3d/webgl-engine/effects/geometry/ObjectAndLayerIDRenderNode.js +1 -1
  323. package/views/3d/webgl-engine/effects/geometry/RenderOccludedRenderNode.js +1 -1
  324. package/views/3d/webgl-engine/lib/BindParameters.js +1 -1
  325. package/views/3d/webgl-engine/lib/CutFillDepth.js +5 -0
  326. package/views/3d/webgl-engine/lib/DefaultVertexBufferLayouts.js +1 -1
  327. package/views/3d/webgl-engine/lib/MainFramebuffer.js +1 -1
  328. package/views/3d/webgl-engine/lib/Material.js +1 -1
  329. package/views/3d/webgl-engine/lib/Object3D.js +1 -1
  330. package/views/3d/webgl-engine/lib/Octree.js +1 -1
  331. package/views/3d/webgl-engine/lib/RenderGeometry.js +1 -1
  332. package/views/3d/webgl-engine/lib/Renderer.js +1 -1
  333. package/views/3d/webgl-engine/lib/ShadowMap.js +1 -1
  334. package/views/3d/webgl-engine/lib/SortedRenderGeometryRenderer.js +1 -1
  335. package/views/3d/webgl-engine/lib/Viewshed.js +1 -1
  336. package/views/3d/webgl-engine/lib/ViewshedShadowMap.js +1 -1
  337. package/views/3d/webgl-engine/lib/depthRangeUtils.js +1 -1
  338. package/views/3d/webgl-engine/lib/edgeRendering/EdgeView.js +1 -1
  339. package/views/3d/webgl-engine/lib/lodRendering/InstanceOctree.js +1 -1
  340. package/views/3d/webgl-engine/lib/lodRendering/LodRenderer.js +1 -1
  341. package/views/3d/webgl-engine/lib/octreeUtils.js +1 -1
  342. package/views/3d/webgl-engine/materials/ColorMaterial.js +1 -1
  343. package/views/3d/webgl-engine/materials/DefaultTechniqueConfiguration.js +1 -1
  344. package/views/3d/webgl-engine/materials/LineMarkerMaterial.js +1 -1
  345. package/views/3d/webgl-engine/materials/RibbonLineMaterial.js +1 -1
  346. package/views/3d/webgl-engine/materials/ShadedColorMaterial.js +1 -1
  347. package/views/3d/webgl-engine/materials/WaterTechnique.js +1 -1
  348. package/views/3d/webgl-engine/materials/renderers/MergedRenderer.js +1 -1
  349. package/views/3d/webgl-engine/materials/renderers/VaoRenderer.js +1 -1
  350. package/views/3d/webgl-engine/shaders/CutFillDepth.glsl.js +5 -0
  351. package/views/3d/webgl-engine/shaders/CutFillDepthTechnique.js +5 -0
  352. package/views/3d/webgl-engine/shaders/CutFillReduction.glsl.js +5 -0
  353. package/views/3d/webgl-engine/shaders/CutFillReductionTechnique.js +5 -0
  354. package/views/3d/webgl-engine/shaders/CutFillTargetDepth.glsl.js +5 -0
  355. package/views/3d/webgl-engine/shaders/CutFillTargetDepthTechnique.js +5 -0
  356. package/views/3d/webgl-engine/shaders/HUDMaterialTechnique.js +1 -1
  357. package/views/3d/webgl-engine/shaders/OutputColorHighlightOID.glsl.js +1 -1
  358. package/views/3d/webgl.js +1 -1
  359. package/views/LinkChartView.js +1 -1
  360. package/views/draw/DrawOperation.js +1 -1
  361. package/views/draw/support/GraphicMover.js +1 -1
  362. package/views/draw/support/HighlightHelper.js +1 -1
  363. package/views/draw/support/Reshape.js +1 -1
  364. package/views/draw/support/drawUtils.js +1 -1
  365. package/views/interactive/Tooltip.js +1 -1
  366. package/views/interactive/editGeometry/EditGeometry.js +1 -1
  367. package/views/interactive/sketch/SketchLabelOptions.js +1 -1
  368. package/views/interactive/sketch/SketchOptions.js +1 -1
  369. package/views/interactive/sketch/SketchTooltipOptions.js +1 -1
  370. package/views/interactive/sketch/SketchTooltipVisibleElements.js +1 -1
  371. package/views/interactive/sketch/SketchValueOptions.js +1 -1
  372. package/views/interactive/sketch/Units.js +1 -1
  373. package/views/interactive/sketch/constraints.js +1 -1
  374. package/views/interactive/snapping/featureSources/FeatureCollectionSnappingSource.js +1 -1
  375. package/views/interactive/snapping/featureSources/FeatureServiceSnappingSource.js +1 -1
  376. package/views/interactive/snapping/featureSources/GraphicsSnappingSource.js +1 -1
  377. package/views/interactive/snapping/featureSources/sceneLayerSource/SceneLayerSnappingSourceWorker.js +1 -1
  378. package/views/interactive/snapping/featureSources/sceneLayerSource/sceneLayerSnappingUtils.js +1 -1
  379. package/views/interactive/tooltip/fields/fields.js +1 -1
  380. package/views/interactive/tooltip/fields/parsingAndFormattingUtils.js +1 -1
  381. package/views/interactive/tooltip/tooltipCommonUtils.js +1 -1
  382. package/views/support/angularMeasurementUtils.js +1 -1
  383. package/webdoc/support/writeUtils.js +1 -1
  384. package/webscene/spec-certification/api.js +1 -1
  385. package/widgets/DistanceMeasurement2D/DistanceMeasurement2DViewModel.js +1 -1
  386. package/widgets/Editor/EditorViewModel.js +1 -1
  387. package/widgets/Editor/support/splitFeatureUtils.js +5 -0
  388. package/widgets/FeatureForm/FeatureFormUtilityNetworkAssociations/UtilityNetworkAssociationItemList.js +1 -1
  389. package/widgets/FeatureTable/FeatureTableViewModel.js +1 -1
  390. package/widgets/FeatureTable/support/FeatureStore.js +1 -1
  391. package/widgets/OrientedImageryViewer/OrientedImageryViewerViewModel.js +1 -1
  392. package/widgets/OrientedImageryViewer/adapters/sketch/MeasurementAdapter.js +1 -1
  393. package/widgets/OrientedImageryViewer/services/ImageMeasurementService.js +1 -1
  394. package/widgets/OrientedImageryViewer.js +1 -1
  395. package/widgets/Sketch.js +1 -1
  396. package/widgets/support/SelectionToolbar/SelectionToolbarViewModel.js +1 -1
  397. package/widgets/support/SelectionToolbar/VisibleElements.js +1 -1
  398. package/widgets/support/SelectionToolbar.js +1 -1
  399. package/widgets/support/Selector2D/SelectionOperation.js +1 -1
  400. package/EULA.pdf +0 -0
  401. package/assets/esri/core/workers/chunks/0390f3aa624e3f380ce2.js +0 -1
  402. package/assets/esri/core/workers/chunks/0569698a3e4eaf2bac8e.js +0 -1
  403. package/assets/esri/core/workers/chunks/06d2251d6f6b3e44800a.js +0 -1
  404. package/assets/esri/core/workers/chunks/07eea90733834313e9fa.js +0 -1
  405. package/assets/esri/core/workers/chunks/08393d9cc2ed846dd5b4.js +0 -1
  406. package/assets/esri/core/workers/chunks/094c741fa8139c3f40cf.js +0 -1
  407. package/assets/esri/core/workers/chunks/0f51e51db83f303ce5a6.js +0 -1
  408. package/assets/esri/core/workers/chunks/171ce8c64f322cd5d6d1.js +0 -1
  409. package/assets/esri/core/workers/chunks/184d3c88ac2fc1d7e2c3.js +0 -1
  410. package/assets/esri/core/workers/chunks/1ae15163af8875148fb8.js +0 -1
  411. package/assets/esri/core/workers/chunks/1eee7cf11df01a52c1bf.js +0 -1
  412. package/assets/esri/core/workers/chunks/27197b0a2ffb2b6104ea.js +0 -1
  413. package/assets/esri/core/workers/chunks/2c0241a5958aef9cda61.js +0 -1
  414. package/assets/esri/core/workers/chunks/2ded2446700f89155ccd.js +0 -1
  415. package/assets/esri/core/workers/chunks/3264d58aeef8cf074b86.js +0 -1
  416. package/assets/esri/core/workers/chunks/3445ffd752262673fb13.js +0 -1
  417. package/assets/esri/core/workers/chunks/38f09e36e174792646bd.js +0 -1
  418. package/assets/esri/core/workers/chunks/3c57b2e13628b5c1f6de.js +0 -1
  419. package/assets/esri/core/workers/chunks/4162c633efefc63c5506.js +0 -1
  420. package/assets/esri/core/workers/chunks/435169b455fd2846799b.js +0 -1
  421. package/assets/esri/core/workers/chunks/44dc7ec52c4abb700783.js +0 -1
  422. package/assets/esri/core/workers/chunks/4558f2e3e77831758fdc.js +0 -1
  423. package/assets/esri/core/workers/chunks/4fc267552939583a81a0.js +0 -1
  424. package/assets/esri/core/workers/chunks/527557b603400189d49a.js +0 -1
  425. package/assets/esri/core/workers/chunks/53873f26a2c24cd75e4a.js +0 -1
  426. package/assets/esri/core/workers/chunks/554c789f4e875d7e6fd5.js +0 -1
  427. package/assets/esri/core/workers/chunks/561a2078458bc0339f83.js +0 -1
  428. package/assets/esri/core/workers/chunks/5f28470304b57e24d94c.js +0 -1
  429. package/assets/esri/core/workers/chunks/61a294f9411bf884f2ab.js +0 -1
  430. package/assets/esri/core/workers/chunks/6acffacbb4a03af52e3b.js +0 -1
  431. package/assets/esri/core/workers/chunks/719450ccd455f503d81a.js +0 -1
  432. package/assets/esri/core/workers/chunks/71cac356874b36f9a383.js +0 -1
  433. package/assets/esri/core/workers/chunks/7388e8c905d93dea1c05.js +0 -1
  434. package/assets/esri/core/workers/chunks/749c7159e0902388e828.js +0 -1
  435. package/assets/esri/core/workers/chunks/7714228825fb44d506df.js +0 -1
  436. package/assets/esri/core/workers/chunks/77ee4afaa4a1c7047940.js +0 -1
  437. package/assets/esri/core/workers/chunks/790e97ddbe318bc75415.js +0 -1
  438. package/assets/esri/core/workers/chunks/8762928d10c3821738ad.js +0 -1
  439. package/assets/esri/core/workers/chunks/8ead467a5af0d9bba804.js +0 -1
  440. package/assets/esri/core/workers/chunks/91e04d03b0013bcaad82.js +0 -1
  441. package/assets/esri/core/workers/chunks/92b60d4fb09711919601.js +0 -1
  442. package/assets/esri/core/workers/chunks/9940e59033a8a1eff2a9.js +0 -1
  443. package/assets/esri/core/workers/chunks/998c38974372720b1c52.js +0 -1
  444. package/assets/esri/core/workers/chunks/9b10e70f28873cff44f5.js +0 -1
  445. package/assets/esri/core/workers/chunks/9b5e04d87116ce2b68b2.js +0 -1
  446. package/assets/esri/core/workers/chunks/9d920f3488d59e7f276c.js +0 -1
  447. package/assets/esri/core/workers/chunks/a999f804fc2f00b2e7ae.js +0 -1
  448. package/assets/esri/core/workers/chunks/acf13a64df2991a4cb6b.js +0 -1
  449. package/assets/esri/core/workers/chunks/b457b7dd907f06278bee.js +0 -1
  450. package/assets/esri/core/workers/chunks/b5640f9623a9c9ded92a.js +0 -1
  451. package/assets/esri/core/workers/chunks/b8158c681456d4cf2395.js +0 -1
  452. package/assets/esri/core/workers/chunks/bbdbb618a18542f7a4a2.js +0 -1
  453. package/assets/esri/core/workers/chunks/bead38898c3f4d4d3569.js +0 -1
  454. package/assets/esri/core/workers/chunks/c51e2a048df152abd901.js +0 -1
  455. package/assets/esri/core/workers/chunks/c86e339e45900c54c9f5.js +0 -1
  456. package/assets/esri/core/workers/chunks/ca7c9756802214e41c56.js +0 -1
  457. package/assets/esri/core/workers/chunks/cb8f2ce22274990b359c.js +0 -1
  458. package/assets/esri/core/workers/chunks/d6ab4d55f1023ee6ec6a.js +0 -1
  459. package/assets/esri/core/workers/chunks/db2b8d8cf7131554cf7e.js +0 -1
  460. package/assets/esri/core/workers/chunks/e7ccf067bea8f4766424.js +0 -1
  461. package/assets/esri/core/workers/chunks/f1c50f37a81c672263a1.js +0 -1
  462. package/assets/esri/core/workers/chunks/ff323db554c9e09749e8.js +0 -1
@@ -2,7 +2,7 @@
2
2
  All material copyright ESRI, All Rights Reserved, unless otherwise specified.
3
3
  See https://js.arcgis.com/4.34/esri/copyright.txt for details.
4
4
  */
5
- import{SliceDraw as e}from"../views/3d/webgl-engine/core/shaderLibrary/Slice.glsl.js";import{Transform as o}from"../views/3d/webgl-engine/core/shaderLibrary/Transform.glsl.js";import{VertexColor as r}from"../views/3d/webgl-engine/core/shaderLibrary/attributes/VertexColor.glsl.js";import{addProjViewLocalOrigin as i}from"../views/3d/webgl-engine/core/shaderLibrary/util/View.glsl.js";import{Float4PassUniform as s}from"../views/3d/webgl-engine/core/shaderModules/Float4PassUniform.js";import{glsl as l}from"../views/3d/webgl-engine/core/shaderModules/glsl.js";import{outputColorHighlightOID as t}from"../views/3d/webgl-engine/shaders/OutputColorHighlightOID.glsl.js";import{ShaderBuilder as n}from"../views/webgl/ShaderBuilder.js";function a(a){const d=new n,{vertex:g,fragment:c,varyings:m}=d;return d.fragment.include(e,a),d.include(o,a),d.include(r,a),d.include(t,a),i(g,a),d.attributes.add("position","vec3"),m.add("vpos","vec3",{invariant:!0}),g.main.add(l`vpos = position;
5
+ import{SliceDraw as e}from"../views/3d/webgl-engine/core/shaderLibrary/Slice.glsl.js";import{Transform as o}from"../views/3d/webgl-engine/core/shaderLibrary/Transform.glsl.js";import{VertexColor as r}from"../views/3d/webgl-engine/core/shaderLibrary/attributes/VertexColor.glsl.js";import{addProjViewLocalOrigin as i}from"../views/3d/webgl-engine/core/shaderLibrary/util/View.glsl.js";import{Float4PassUniform as s}from"../views/3d/webgl-engine/core/shaderModules/Float4PassUniform.js";import{glsl as l}from"../views/3d/webgl-engine/core/shaderModules/glsl.js";import{outputColorHighlightOID as t}from"../views/3d/webgl-engine/shaders/OutputColorHighlightOID.glsl.js";import{ShaderBuilder as n}from"../views/webgl/ShaderBuilder.js";function a(a){const d=new n,{vertex:g,fragment:c,varyings:m}=d;return d.fragment.include(e,a),d.include(o),d.include(r,a),d.include(t,a),i(g,a),d.attributes.add("position","vec3"),m.add("vpos","vec3",{invariant:!0}),g.main.add(l`vpos = position;
6
6
  forwardNormalizedVertexColor();
7
7
  gl_Position = transformPosition(proj, view, vpos);`),a.hasVertexColors||c.uniforms.add(new s("constantColor",e=>e.color)),c.main.add(l`
8
8
  discardBySlice(vpos);
@@ -2,4 +2,4 @@
2
2
  All material copyright ESRI, All Rights Reserved, unless otherwise specified.
3
3
  See https://js.arcgis.com/4.34/esri/copyright.txt for details.
4
4
  */
5
- import{S as e,G as t}from"./SimpleGeometryCursor.js";import{d as s,t as n,a as i,c as r,i as o,G as m,m as a,f as h,e as c,h as u,n as l}from"./Geometry.js";import{Envelope2D as _}from"./Envelope2D.js";import{W as f,g as d,F as g,ai as p,ak as P,O as x,af as y,an as b,a3 as w,r as C,ao as v,ap as S,V as D,L as I,aq as G,ar as M,as as T,a7 as N,a8 as k,at as A,au as E,av as q,aw as R,ax as z,ay as X}from"./UnitFactory.js";import{__addDisposableResource as B,__disposeResources as Y}from"tslib";import{a as O,P as F,E as j}from"./MultiPathImpl.js";import{e as W,c as J,P as U,b as H,f as L,h as V,s as K}from"./Envelope.js";import{T as Q}from"./Transformation2D.js";import{d as Z,m as $,P as ee,S as te,o as se,p as ne}from"./Point2D.js";import{c as ie}from"./OperatorClip.js";import{c as re}from"./GeometryCleaner-BEJM7I4l.js";import{O as oe}from"./OperatorDensify.js";function me(e,t,s,n,a,h){n<Number.MAX_VALUE&&n>-Number.MAX_VALUE||i("Geodesic_bufferer.buffer - bad distance"),r(e);const c=re(e),u=c.getGeometryType();if(o(u)){const e=c.getPointCount(),i=8e6;if(Math.abs(n)>i&&(e>50||u!==m.enumMultiPoint&&4===s&&e>2)){let e=c;const r=n>0?1:-1,o=7e6;let m=n,u=1;do{u++,m=(Math.abs(m)-o)*r}while(Math.abs(m)>i);m=n;for(let n=0;n<u-1;n++)e=he(e,t,s,o*r,a,u,h),m=(Math.abs(m)-o)*r;return e=he(e,t,s,m,a,u,h),e}}return he(c,t,s,n,a,1,h)}class ae{constructor(e){this.m_sr=null,this.m_gcs=null,this.m_transform=null,this.m_a=0,this.m_eSquared=0,this.m_rpu=0,this.m_radTolerance=0,this.m_q90=0,this.m_gcs90=0,this.m_gcs180=0,this.m_gcs360=0,this.m_gcs60=0,this.m_ellipticToGeodesicMaxRatio=0,this.m_curveType=0,this.m_bShapePreserving=!1,this.m_distance=0,this.m_absDistance=0,this.m_convergenceOffset=0,this.m_cornerStep=0,this.m_segmentStep=0,this.m_progressTracker=e}bufferPolygon(e){const t=new O,s=new we(this,e,t);return this.processGnomonicBufferPiecesCursor(!0,s)}bufferPolyline(e){const t=new we(this,e,null);return this.processGnomonicBufferPiecesCursor(!0,t)}bufferMultiPoint(e){const t=new Ce(this,e);return this.processGnomonicBufferPiecesCursor(!1,t)}bufferPoint(e){const t=e.getXY();t.scale(this.m_rpu);let s=new O;if(this.bufferPoint2D(t,!1,s)){const e=H(null,s,!0);s=w(s,e,!0,!0,-1,this.m_progressTracker,0,!1)}return s=(new x).foldInto360RangeGeodetic(s,this.m_gcs,2),s}processGnomonicBufferPiecesCursor(e,t){const s=t;let n=s.getGnomonic();const i=C(v());let r=new S,o=(new f).executeMany(r,i,this.m_progressTracker,2);const m=Z(6,!1),a=$(_,6);this.initializeGrid(m,a);const h=[null,null,null,null,null,null],c=[null,null,null,null,null,null],u=[null,null,null,null,null,null];let l,d,g;for(;null!==(l=s.next());){if(d=s.getGnomonic(),d!==n){if(null!==n){let t=o.next();if(r=null,o=null,null!=t){const s=H(i,t,!0),r=W(s);t=n.unproject(t,r,this.m_progressTracker),this.putInGridCursors(e,t,i,!0,m,a,h,c,u)}}null!==d&&(r=new S,o=(new f).executeMany(r,i,this.m_progressTracker,2)),n=d}if(s.isRunningInGnomonic()){if(d.project(l),s.needsSimplify()){const e=H(null,l,!0);l=w(l,e,!0,!0,-1,this.m_progressTracker,0,!1)}r.tick(ye(l)),o.tock()}else this.putInGridCursors(e,l,i,!0,m,a,h,c,u)}let p=!1;for(let _=0;_<6;_++)if(null!=u[_]){p=!0;break}if(p){let t=!1;const l=[null,null,null,null,null,null];if(e){const n=s.m_densified;if(s.m_densified=null,null!==n){const s=new Q;s.scale(1/this.m_rpu,1/this.m_rpu),n.applyTransformation(s),this.m_distance>0?this.putInGridCursors(e,n,i,!1,m,a,h,c,u):(this.processInGrid(e,n,!1,m,a,h,l),t=!0)}}const _=new S,d=(new f).executeMany(_,this.m_gcs,this.m_progressTracker,2);if(null!==o){let t=o.next();r=null,o=null;const s=H(i,t,!0),l=W(s);t=n.unproject(t,l,this.m_progressTracker),this.putInGridCursors(e,t,i,!0,m,a,h,c,u)}for(let e=0;e<6;e++)if(null!=u[e]){let s=u[e].next();u[e]=null,c[e]=null,t&&null!==l[e]&&(s=(new D).execute(l[e],s,i,this.m_progressTracker));const n=H(i,s,!0),r=W(n);s=h[e].unproject(s,r,this.m_progressTracker),s=(new I).execute(s,this.m_gcs,!0,this.m_progressTracker),_.tick(ye(s)),d.tock()}g=d.next()}else{let t,m=!1;if(e){let e=s.m_densified;if(s.m_densified=null,null!==e){const s=new Q;s.scale(1/this.m_rpu,1/this.m_rpu),e.applyTransformation(s),d.project(e);const n=H(null,e,!0);e=w(e,n,!1,!0,-1,this.m_progressTracker,0,!1),this.m_distance>0?(r.tick(ye(e)),o.tock()):(t=e,m=!0)}}let a=o.next();r=null,o=null,m&&(a=(new D).execute(t,a,i,this.m_progressTracker));const h=H(i,a,!0),c=W(h);g=n.unproject(a,c,this.m_progressTracker),g=(new I).execute(g,this.m_gcs,!0,this.m_progressTracker)}return g=(new x).foldInto360RangeGeodetic(g,this.m_gcs,2),g}putInGridCursors(e,t,s,n,i,r,o,m,a){const h=[null,null,null,null,null,null];this.processInGrid(e,t,n,i,r,o,h);for(let c=0;c<6;c++)null!==h[c]&&(null===m[c]&&(m[c]=new S,a[c]=(new f).executeMany(m[c],s,this.m_progressTracker,2)),m[c].tick(ye(h[c])),a[c].tock())}processInGrid(e,t,s,n,i,r,o){const m=.01,a=this.insertGeodeticPointsAlongGrid(t,i,m);for(let h=0;h<6;h++){if(n[h])continue;const e=i[h].clone();e.inflateCoords(m,m);const c=L(t,e),u=J(null,c,!1).total();let l=ie(a,e,u,Number.NaN,this.m_progressTracker);if(null!==l&&!l.isEmpty()){if(l===a&&(l=l.clone()),null===r[h]){const e=new ee;h<3?e.setCoords(0,1):e.setCoords(0,-1);const t=new ee;t.setAdd(i[h].getCenter(),e),r[h]=xe(this.m_gcs,t)}r[h].project(l);const e=H(null,l,!0);l=w(l,e,s,!0,-1,this.m_progressTracker,0,!1),o[h]=l}}}insertGeodeticPointsAlongGrid(e,t,s){const n=_.construct(t[3].xmin,t[3].ymin,t[2].xmax,t[2].ymax),i=G(this.m_gcs,n,e,!0,this.m_progressTracker),r=new j,o=r.addGeometry(i);return M(r,o,this.m_gcs,0,2,!0,t[0].xmax+s),M(r,o,this.m_gcs,0,2,!0,t[1].xmax+s),M(r,o,this.m_gcs,0,2,!1,t[1].ymin+s),0!==s&&(M(r,o,this.m_gcs,0,2,!0,t[0].xmax-s),M(r,o,this.m_gcs,0,2,!0,t[1].xmax-s),M(r,o,this.m_gcs,0,2,!1,t[1].ymin-s)),r.getGeometry(o)}initializeGrid(e,t){for(let s=0;s<6;s++)e[s]=!1;t[0].setCoords({xmin:-this.m_gcs180,ymin:0,xmax:-this.m_gcs60,ymax:this.m_gcs90}),t[1].setCoords({xmin:-this.m_gcs60,ymin:0,xmax:this.m_gcs60,ymax:this.m_gcs90}),t[2].setCoords({xmin:this.m_gcs60,ymin:0,xmax:this.m_gcs180,ymax:this.m_gcs90}),t[3].setCoords({xmin:-this.m_gcs180,ymin:-this.m_gcs90,xmax:-this.m_gcs60,ymax:0}),t[4].setCoords({xmin:-this.m_gcs60,ymin:-this.m_gcs90,xmax:this.m_gcs60,ymax:0}),t[5].setCoords({xmin:this.m_gcs60,ymin:-this.m_gcs90,xmax:this.m_gcs180,ymax:0})}checkAndPrepSegmentForCrossingAzimuthsOrPoleWrap(e,t,s,n,i,r){const o=e[0],m=e.at(-1),a=o.y<m.y?o.y:m.y,h=o.y>m.y?o.y:m.y,c=p.q(this.m_a,this.m_eSquared,a),u=p.q(this.m_a,this.m_eSquared,h);if(this.m_q90-(c+t+this.m_absDistance)>.001&&this.m_q90+(u-t-this.m_absDistance)>.001)return!1;const l=s-se,_=n+se,f=l-Math.PI,d=l+Math.PI,g=_+Math.PI,P=[Number.NaN],x=[Number.NaN],y=[Number.NaN],b=[Number.NaN];let w=!1;if(le(this.m_a,this.m_eSquared,this.m_rpu,this.m_absDistance,o,l,f,m,_,P,x),le(this.m_a,this.m_eSquared,this.m_rpu,this.m_absDistance,m,g,_,o,f,y,b),(_<P[0]&&P[0]<g||_<x[0]&&x[0]<g)&&(w=!0),w||(f<y[0]&&y[0]<l||f<b[0]&&b[0]<l)&&(w=!0),!w&&i)return!1;const C=[];for(let p=e.length-1;p>=0;p--)C.push(e[p]);r.setEmpty(),r.addPathPoint2D(null,0,!0);let v=0;v=ce(this.m_a,this.m_eSquared,this.m_rpu,this.m_absDistance,this.m_curveType,e,l,_,i,v,r),v=ue(this.m_a,this.m_eSquared,this.m_rpu,this.m_absDistance,m,_,g,this.m_cornerStep,i,v,r,P[0],x[0]),v=ce(this.m_a,this.m_eSquared,this.m_rpu,this.m_absDistance,this.m_curveType,C,g,d,i,v,r),v=ue(this.m_a,this.m_eSquared,this.m_rpu,this.m_absDistance,o,f,l,this.m_cornerStep,i,v,r,y[0],b[0]);let S=!1;return i||(S=this.checkAndPrepForPole(r)),w||S}bufferPoint2D(e,t,s){s.setEmpty(),s.addPathPoint2D(null,0,!0);const n=0;ue(this.m_a,this.m_eSquared,this.m_rpu,this.m_absDistance,e,-this.m_cornerStep,2*Math.PI,this.m_cornerStep,t,n,s);let i=!1;return t||(i=this.checkAndPrepForPole(s)),i}checkAndPrepForPole(e){const t=this.checkAndPrepForPoleTouch(e),s=this.checkAndPrepForPoleWrap(e);return t||s}checkAndPrepForPoleTouch(e){const t=new _;return e.queryEnvelope(t),!(!T(t.ymax,this.m_gcs90)&&!T(t.ymin,-this.m_gcs90))&&(this.prepPoleTouch(e),!0)}checkAndPrepForPoleWrap(e){const t=e.getXY(0),s=e.getXY(e.getPointCount()-1);return Math.abs(t.x-s.x)>this.m_gcs180?(this.prepSinglePoleWrap(e),!0):this.checkAndPrepForDoublePoleWrap(e)}checkAndPrepForDoublePoleWrap(e){return e.calculateArea2D()<0&&(this.prepDoublePoleWrap(e),!0)}prepPoleTouch(e){const t=new O;t.insertPath2D(-1,null,0,0,!0);const s=e.getPathStart(0),n=e.getPathEnd(0),i=n-s;let r=-1;for(r=s;r<n;r++){const t=e.getXY(r),s=T(t.y,this.m_gcs90),n=T(t.y,-this.m_gcs90);if(!s&&!n)break}let o=r,m=!1,a=Number.NaN;do{const n=e.getXY(o),r=T(n.y,this.m_gcs90),h=T(n.y,-this.m_gcs90),c=s+(o+1-s)%i;if(r||h){let s=ee.construct(a,n.y);t.insertPoint2D(0,-1,s);const i=e.getXY(c),r=T(i.y,this.m_gcs90),o=T(i.y,-this.m_gcs90);r||o||(s=ee.construct(i.x,n.y),m?t.setXY(t.getPointCount()-1,s):t.insertPoint2D(0,-1,s)),m=!0}else t.insertPoint2D(0,-1,n),a=n.x,m=!1;o=c}while(o!==r);e.setEmpty(),e.add(t,!1)}prepSinglePoleWrap(e){const t=new O,s=new O,n=new Q,i=e.getXY(e.getPathStart(0)),r=e.getXY(e.getPathEnd(0)-1),o=this.m_gcs360,m=this.m_gcs180,a=new _;a.setCoords({xmin:-this.m_gcs180,ymin:-this.m_gcs90,xmax:this.m_gcs180,ymax:this.m_gcs90});const h=new _;e.queryEnvelope(h);const c=Math.ceil(h.width()/o);let u,l;i.x>r.x?(u=-o,l=this.m_gcs90):(u=o,l=-this.m_gcs90),n.setShiftCoords(u,0),t.addPath(e,0,!0),s.add(t,!1);const f=new U;for(let _=0;_<c;_++)s.applyTransformation(n),s.getPointByVal(0,f),t.lineToPoint(f),t.addSegmentsFromPath(s,0,0,s.getSegmentCount()-1,!1);const d=t.getXY(0),g=t.getXY(t.getPointCount()-1);d.y=l,g.y=l,t.lineTo(g);const p=new ee;for(p.setCoordsPoint2D(g),p.x-=.5*u;Math.abs(p.x-d.x)>m;)t.lineTo(p),p.x-=.5*u;t.lineTo(d);const P=a.getCenterX(),x=new _;t.queryEnvelope(x);let y=0;const b=x.getCenter().x;b-P>m?y=-Math.ceil((b-P-m)/o):P-b>m&&(y=Math.ceil((P-b-m)/o)),0!==y&&(n.setShiftCoords(y*o,0),t.applyTransformation(n));const w=new j,C=w.addGeometry(t);M(w,C,this.m_gcs,0,2,!0,a.xmin),M(w,C,this.m_gcs,0,2,!0,a.xmax);const v=w.getGeometry(C),S=L(v,a);S.inflateCoords(0,1);const D=J(null,S,!0).total(),I=ie(v,a,D,Number.NaN,this.m_progressTracker);e.setEmpty(),e.add(I,!1)}prepDoublePoleWrap(e){const t=this.m_gcs360,s=this.m_gcs180,n=new _;n.setCoords({xmin:-this.m_gcs180,ymin:-this.m_gcs90,xmax:this.m_gcs180,ymax:this.m_gcs90});const i=n.getCenter().x,r=new _;e.queryPathEnvelope(0,r);let o,m=0,a=r.getCenter().x;if(a-i>s?m=-Math.ceil((a-i-s)/t):i-a>s&&(m=Math.ceil((i-a-s)/t)),0!==m){const s=new Q;s.setShiftCoords(m*t,0),e.getImpl().applyTransformationToPath(s,0),e.queryPathEnvelope(0,r),a=r.getCenter().x}const h=new _;n.containsExclusiveEnvelope(r)?(o=!1,h.setCoords({env2D:n})):(o=!0,h.setCoords({env2D:n}),h.xmin-=t,h.xmax+=t);let c=e.createInstance();c.addPathPoint2D(null,0,!0);const u=new ee;if(u.setCoords(h.xmin,h.ymin),c.insertPoint2D(0,-1,u),u.setCoords(h.xmin,h.ymax),c.insertPoint2D(0,-1,u),u.setCoords(.5*(h.xmin+h.xmax),h.ymax),c.insertPoint2D(0,-1,u),u.setCoords(h.xmax,h.ymax),c.insertPoint2D(0,-1,u),u.setCoords(h.xmax,h.ymin),c.insertPoint2D(0,-1,u),u.setCoords(.5*(h.xmin+h.xmax),h.ymin),c.insertPoint2D(0,-1,u),o){c.addPath(e,0,!0);const s=new Q;a<i?s.setShiftCoords(t,0):s.setShiftCoords(-t,0),e.getImpl().applyTransformationToPath(s,0),c.addPath(e,0,!0);const r=new j,o=r.addGeometry(c);M(r,o,this.m_gcs,0,2,!0,n.xmin),M(r,o,this.m_gcs,0,2,!0,n.xmax),c=r.getGeometry(o);const m=L(c,n);m.inflateCoords(0,1);const h=J(null,m,!0).total();c=ie(c,n,h,Number.NaN,this.m_progressTracker)}else c.addPath(e,0,!0);e.setEmpty(),e.add(c,!1)}setMinCornerStep(){const e={stack:[],error:void 0,hasError:!1};try{let s=Math.min(Math.PI*this.m_a-this.m_absDistance,this.m_absDistance);s=Math.min(s,.125*this.m_a*Math.PI);const n=new ee;n.setCoords(0,10*this.m_rpu);const i=0;let r=45*this.m_rpu;const o=B(e,new te(new N,new N),!1),m=B(e,new te(new N,new N),!1),a=B(e,new te(new N,new N),!1),h=B(e,new te(new N,new N),!1),c=new ee,u=new ee,l=new ee,_=new ee;for(k.geodesicCoordinate(this.m_a,this.m_eSquared,n.x,n.y,s,i,o.at(0),o.at(1)),c.setCoords(o.at(0).val,o.at(1).val),k.geodesicCoordinate(this.m_a,this.m_eSquared,n.x,n.y,s,r,m.at(0),m.at(1)),u.setCoords(m.at(0).val,m.at(1).val);;){const e={stack:[],error:void 0,hasError:!1};try{const t=.5*(i+r);k.geodesicCoordinate(this.m_a,this.m_eSquared,n.x,n.y,s,t,a.at(0),a.at(1)),l.setCoords(a.at(0).val,a.at(1).val);const o=B(e,new N,!1),f=B(e,new N,!1);k.geodeticDistance(this.m_a,this.m_eSquared,c.x,c.y,u.x,u.y,o,f,null,2),k.geodeticCoordinate(this.m_a,this.m_eSquared,c.x,c.y,.5*o.val,f.val,h.at(0),h.at(1),2),_.setCoords(h.at(0).val,h.at(1).val);const d=B(e,new N,!1);k.geodeticDistance(this.m_a,this.m_eSquared,l.x,l.y,_.x,_.y,d,null,null,2);if(d.val<=this.m_convergenceOffset)break;r*=.9,k.geodesicCoordinate(this.m_a,this.m_eSquared,n.x,n.y,s,r,m.at(0),m.at(1)),u.setCoords(m.at(0).val,m.at(1).val)}catch(t){e.error=t,e.hasError=!0}finally{Y(e)}}const f=r-i,d=2*Math.PI/Math.ceil(2*Math.PI/f);this.m_cornerStep=d}catch(s){e.error=s,e.hasError=!0}finally{Y(e)}}setMinSegmentStep(){const e={stack:[],error:void 0,hasError:!1};try{let n=Math.min(Math.PI*this.m_a-this.m_absDistance,this.m_absDistance);n=Math.min(n,.125*this.m_a*Math.PI);const i=new ee,r=new ee;i.setCoords(0,10*this.m_rpu),r.setCoords(10*this.m_rpu,10*this.m_rpu);const o=B(e,new N,!1),m=B(e,new N,!1),a=B(e,new N,!1);k.geodeticDistance(this.m_a,this.m_eSquared,i.x,i.y,r.x,r.y,a,o,m,this.m_curveType);const h=B(e,new te(new N,new N),!1),c=B(e,new te(new N,new N),!1),u=new ee,l=B(e,new N,!1),_=B(e,new te(new N,new N),!1),f=B(e,new te(new N,new N),!1),d=B(e,new te(new N,new N),!1),g=B(e,new te(new N,new N),!1),p=new ee,P=new ee,x=new ee,y=new ee,b=0;let w=1;const C=o.val,v=m.val,S=C-.5*Math.PI,D=v+.5*Math.PI,I=a.val;for(k.geodesicCoordinate(this.m_a,this.m_eSquared,i.x,i.y,n,S,_.at(0),_.at(1)),p.setCoords(_.at(0).val,_.at(1).val),k.geodesicCoordinate(this.m_a,this.m_eSquared,r.x,r.y,n,D,f.at(0),f.at(1)),P.setCoords(f.at(0).val,f.at(1).val);;){const e={stack:[],error:void 0,hasError:!1};try{const s=.5*(b+w);k.geodeticCoordinate(this.m_a,this.m_eSquared,i.x,i.y,s*I,C,h.at(0),h.at(1),this.m_curveType),u.setCoords(h.at(0).val,h.at(1).val),k.geodeticDistance(this.m_a,this.m_eSquared,i.x,i.y,u.x,u.y,null,null,l,this.m_curveType);const o=l.val+.5*Math.PI;k.geodesicCoordinate(this.m_a,this.m_eSquared,u.x,u.y,n,o,d.at(0),d.at(1)),x.setCoords(d.at(0).val,d.at(1).val);const m=B(e,new N,!1),a=B(e,new N,!1);k.geodeticDistance(this.m_a,this.m_eSquared,p.x,p.y,P.x,P.y,m,a,null,2),k.geodeticCoordinate(this.m_a,this.m_eSquared,p.x,p.y,.5*m.val,a.val,g.at(0),g.at(1),2),y.setCoords(g.at(0).val,g.at(1).val);const _=B(e,new N,!1);k.geodeticDistance(this.m_a,this.m_eSquared,x.x,x.y,y.x,y.y,_,null,null,2);if(_.val<=this.m_convergenceOffset)break;{const e={stack:[],error:void 0,hasError:!1};try{w*=.9,k.geodeticCoordinate(this.m_a,this.m_eSquared,i.x,i.y,w*I,C,c.at(0),c.at(1),this.m_curveType),r.setCoords(c.at(0).val,c.at(1).val);const t=B(e,new N,!1);k.geodeticDistance(this.m_a,this.m_eSquared,i.x,i.y,r.x,r.y,null,null,t,this.m_curveType);const s=t.val+.5*Math.PI;k.geodesicCoordinate(this.m_a,this.m_eSquared,r.x,r.y,n,s,f.at(0),f.at(1)),P.setCoords(f.at(0).val,f.at(1).val)}catch(t){e.error=t,e.hasError=!0}finally{Y(e)}}}catch(s){e.error=s,e.hasError=!0}finally{Y(e)}}let G=w*I;G>1e5&&(G=1e5),this.m_segmentStep=G}catch(n){e.error=n,e.hasError=!0}finally{Y(e)}}setConvergenceOffset(){let e;e=this.m_absDistance>5e4?100:this.m_absDistance>1e4?10:1,this.m_absDistance/e<500&&(e=this.m_absDistance/500),e<.01&&(e=.01),this.m_convergenceOffset=e}}function he(e,t,s,n,i,r,o){if(e.isEmpty())return new O({vd:e.getDescription()});let f=e;if(a(f)){const e=10*t.getTolerance(0);f=(new oe).execute(f,0,e,0,o,12e3)}const w=new ae(o);w.m_sr=t,w.m_gcs=t.getGCS(),w.m_transform=d(t,w.m_gcs,null);const C=g();w.m_gcs.querySpheroidData(C);const v=new _;f.queryEnvelope(v),w.m_a=C.majorSemiAxis,w.m_eSquared=C.e2,w.m_rpu=w.m_gcs.getUnit().getUnitToBaseFactor(),w.m_gcs90=.5*Math.PI/w.m_rpu,w.m_gcs180=Math.PI/w.m_rpu,w.m_gcs360=2*Math.PI/w.m_rpu,w.m_gcs60=w.m_gcs360/6,w.m_q90=p.q90(w.m_a,w.m_eSquared),w.m_ellipticToGeodesicMaxRatio=.5*w.m_a*Math.PI/w.m_q90;const S=w.m_gcs.getTolerance(0);w.m_radTolerance=S*w.m_rpu,4===s?(w.m_curveType=2,w.m_bShapePreserving=!0):(w.m_curveType=s,w.m_bShapePreserving=!1),w.m_distance=n,w.m_absDistance=Math.abs(n),Number.isNaN(i)||i<=0?w.setConvergenceOffset():w.m_convergenceOffset=Math.max(i,.001),w.m_convergenceOffset/=r;let D,I=f.getGeometryType();if(h(I)){const e=new F({vd:f.getDescription()});e.addSegment(f,!0),D=e,I=m.enumPolyline}else if(I===m.enumEnvelope){const e=f,t=new _;e.queryEnvelope(t);const s=W(J(w.m_sr,v,!0));if(t.minDimension()<=s)if(0===t.maxDimension()){const t=new U({vd:f.getDescription()});e.getCenter(t),D=t,I=m.enumPoint}else{const t=new F({vd:f.getDescription()});t.addEnvelope(e,!1),D=t,I=m.enumPolyline}else{const t=new O({vd:f.getDescription()});t.addEnvelope(e,!1),D=t,I=m.enumPolygon}}else D=f;if(w.setMinCornerStep(),c(I)||w.setMinSegmentStep(),w.m_absDistance<=.5*w.m_convergenceOffset)return I!==m.enumPolygon?new O({vd:D.getDescription()}):w.m_bShapePreserving?D:P(D,w.m_sr,w.m_curveType,w.m_segmentStep,-1,o);if(w.m_distance<0&&I!==m.enumPolygon)return new O({vd:D.getDescription()});if(w.m_bShapePreserving&&u(I)){const e=P(D,t,4,Number.NaN,w.m_convergenceOffset,o);D=(new x).execute(e,w.m_transform,o)}else D=(new x).execute(D,w.m_transform,o);if(D=y(D,w.m_gcs),D.isEmpty())return new O({vd:D.getDescription()});!w.m_bShapePreserving&&u(I)&&(D=b(w.m_rpu,D)),D=fe(D,w.m_gcs);let G=new O;switch(I){case m.enumPolygon:G=w.bufferPolygon(D);break;case m.enumPolyline:G=w.bufferPolyline(D);break;case m.enumMultiPoint:G=w.bufferMultiPoint(D);break;case m.enumPoint:G=w.bufferPoint(D);break;default:l("")}const M=(new x).execute(G,w.m_transform.getInverse(),o);return M.mergeVertexDescription(D.getDescription()),M}function ce(e,t,s,n,i,r,o,m,a,h,c){const u={stack:[],error:void 0,hasError:!1};try{const l=new ee;l.setNAN(),a||c.getPointCount()>0&&(l.setCoordsPoint2D(c.getXY(c.getPointCount()-1)),l.scale(s));const _=B(u,new N,!1),f=B(u,new te(new N,new N),!1),d=new ee,g=new ee,p=r.at(-1),P=1/s;for(let s=0;s<r.length;s++){const u=r[s];let x;0===s?x=o:s===r.length-1?x=m:(k.geodeticDistance(e,t,p.x,p.y,u.x,u.y,null,null,_,i),x=_.val-.5*Math.PI),k.geodesicCoordinate(e,t,u.x,u.y,n,x,f.at(0),f.at(1)),a?g.setCoords(f.at(0).val,f.at(1).val):(d.setCoords(f.at(0).val,f.at(1).val),h=_e(u.x,d.x,l.x,h),g.setCoords(h+d.x,d.y),l.setCoordsPoint2D(g)),g.scale(P),c.insertPoint2D(0,-1,g)}return h}catch(l){u.error=l,u.hasError=!0}finally{Y(u)}}function ue(e,t,s,n,i,r,o,m,a,h,c,u=Number.NaN,l=Number.NaN){const _={stack:[],error:void 0,hasError:!1};try{if(o-r<m)return h;const f=B(_,new te(new N,new N),!1),d=new ee,g=new ee,p=new ee;g.setNAN(),a||c.getPointCount()>0&&(g.setCoordsPoint2D(c.getXY(c.getPointCount()-1)),g.scale(s));let P=Math.ceil(r/m),x=P++*m;x===r&&(x=P++*m);let y=r;const b=1/s;for(;x<o+m&&(y<u&&u<x?(x=u,P--):y<l&&l<x&&(x=l,P--),!(x>=o));)k.geodesicCoordinate(e,t,i.x,i.y,n,x,f.at(0),f.at(1)),a?p.setCoords(f.at(0).val,f.at(1).val):(d.setCoords(f.at(0).val,f.at(1).val),h=_e(i.x,d.x,g.x,h),p.setCoords(h+d.x,d.y),g.setCoordsPoint2D(p)),p.scale(b),c.insertPoint2D(0,-1,p),y=x,x=P++*m;return h}catch(f){_.error=f,_.hasError=!0}finally{Y(_)}}function le(e,t,s,n,i,r,o,m,a,h,c){const u={stack:[],error:void 0,hasError:!1};try{const s=new ee,l=new ee,_=B(u,new te(new N,new N),!1);k.geodesicCoordinate(e,t,i.x,i.y,n,r,_.at(0),_.at(1)),s.setCoords(_.at(0).val,_.at(1).val),k.geodesicCoordinate(e,t,i.x,i.y,n,o,_.at(0),_.at(1)),l.setCoords(_.at(0).val,_.at(1).val);const f=B(u,new N,!1);for(k.geodeticDistance(e,t,m.x,m.y,s.x,s.y,null,f,null,0),h[0]=f.val,k.geodeticDistance(e,t,m.x,m.y,l.x,l.y,null,f,null,0),c[0]=f.val;h[0]<=c[0];)h[0]+=ne;for(;h[0]>c[0];)h[0]-=ne;for(;h[0]>=a;)h[0]-=ne,c[0]-=ne;for(;h[0]<a;)h[0]+=ne,c[0]+=ne}catch(l){u.error=l,u.hasError=!0}finally{Y(u)}}function _e(e,t,s,n){if(Number.isNaN(s)){for(;n+t-e>Math.PI;)n-=ne;for(;e-(n+t)>Math.PI;)n+=ne;return n}return n+t-s>Math.PI?n-=ne:s-(n+t)>Math.PI&&(n+=ne),n}function fe(e,t){const s=e.getGeometryType();let n;if(n=u(s)?e.getPathCount():s===m.enumMultiPoint?e.getPointCount():1,1===n)return e;const i=[],r=[];for(let m=0;m<n;m++){i.push(m);const n=new ee;if(u(s)){const t=new _;e.queryPathEnvelope(m,t),n.assign(t.getCenter())}else n.assign(e.getXY(m));const o=t.toGeohash(n);r.push(o)}i.sort((e,t)=>r[e]<r[t]?-1:r[e]>r[t]?1:0);const o=e.createInstance();for(let m=0;m<n;m++){const t=i[m];u(s)?o.addPath(e,t,!0):o.addPoints(e,t,t+1)}return o}function de(e,t,s,n,i,r){const o={stack:[],error:void 0,hasError:!1};try{if(n>=r)return!1;const m=s[0],a=s.at(-1),h=B(o,new N,!1),c=B(o,new N,!1),u=B(o,new N,!1);k.greatEllipticDistance(e,t,i.x,i.y,m.x,m.y,h,null,null),k.greatEllipticDistance(e,t,i.x,i.y,a.x,a.y,c,null,null),k.greatEllipticDistance(e,t,m.x,m.y,a.x,a.y,u,null,null);let l=Math.min(h.val,c.val)+u.val,_=l+n;if(_<r)return!0;const f=B(o,new N,!1);l=Math.max(h.val,c.val);for(let n=1;n<s.length-1;n++){const r=s[n];k.greatEllipticDistance(e,t,i.x,i.y,r.x,r.y,f,null,null),f.val>l&&(l=f.val)}return _=l+n,_<r}catch(m){o.error=m,o.hasError=!0}finally{Y(o)}}function ge(e,t,s,n,i,r,o,m){let a;if(n.length%2==0){const e=n.length>>1,t=n[e],s=n[e-1];a=ee.lerp(t,s,.5)}else{a=n[n.length-1>>1].clone()}const h=a.clone(),c=A(e,t,h,75/180*Math.PI);return!!de(e,t,n,i,h,c)&&(null!==r&&(r.setCoordsPoint2D(a),r.scale(1/s)),null!==o&&o.setCoordsPoint2D(h),null!==m&&(m[0]=c),!0)}function pe(e,t,s,n,i,r){const o={stack:[],error:void 0,hasError:!1};try{if(n>=r)return!1;const m=B(o,new N,!1);k.greatEllipticDistance(e,t,i.x,i.y,s.x,s.y,m,null,null);return m.val+n<r}catch(m){o.error=m,o.hasError=!0}finally{Y(o)}}function Pe(e,t,s,n,i,r,o,m){const a=A(e,t,n,75/180*Math.PI);return!!pe(e,t,n,i,n,a)&&(null!==r&&(r.setCoordsPoint2D(n),r.scale(1/s)),null!==o&&o.setCoordsPoint2D(n),null!==m&&(m[0]=a),!0)}function xe(e,t){return new X(e,t)}function ye(e){return V(e,0)||K(e,0),e}class be{constructor(e){this.m_bRunningInGnomonic=!1,this.m_bNeedsSimplify=!1,this.m_gnomonic=null,this.m_gnomonicCenterRad=new ee,this.m_minGnomonicRadius=Number.NaN,this.m_progressTracker=e}isRunningInGnomonic(){return this.m_bRunningInGnomonic}needsSimplify(){return this.m_bNeedsSimplify}getGnomonic(){return this.m_gnomonic}}class we extends be{constructor(e,t,s){super(e.m_progressTracker),this.m_segIter=null,this.m_bNextSegmentCannotJoin=!1,this.m_currentDensifiedDelta=[0],this.m_currentBufferedDelta=0,this.m_lastAzimuth=0,this.m_startAzimuth=[0],this.m_endAzimuth=[0],this.m_numWinds=0,this.m_debugCounter=0,this.m_bufferHelper=new O,this.m_densifiedPoints=[],this.m_bufferer=e,this.m_multiPath=t,this.m_densified=s,this.m_bNeedsSimplify=!0;const n=new _;this.m_multiPath.queryEnvelope(n);const i=n.getCenter(),r=i.clone();r.scale(this.m_bufferer.m_rpu),this.m_gnomonic=xe(this.m_bufferer.m_gcs,i),this.m_gnomonicCenterRad=r.clone(),this.m_minGnomonicRadius=A(this.m_bufferer.m_a,this.m_bufferer.m_eSquared,r,75/180*Math.PI)}next(){let e;if(this.m_bNextSegmentCannotJoin)return this.m_bNextSegmentCannotJoin=!1,this.m_segIter.nextSegment(),e=this.m_bufferHelper.clone(),e;if(null===this.m_segIter){if(this.m_segIter=this.m_multiPath.getImpl().querySegmentIterator(),!this.m_segIter.nextPath())return null;null!==this.m_densified&&this.m_densified.addPathPoint2D(null,0,!0)}if(!this.m_segIter.hasNextSegment()){if(!this.m_segIter.nextPath())return null;null!=this.m_densified&&this.m_densified.addPathPoint2D(null,0,!0)}let t=null;this.m_currentBufferedDelta=0,this.m_currentDensifiedDelta=[0],this.m_numWinds=0,this.m_lastAzimuth=Number.NaN,this.m_bNextSegmentCannotJoin=!1,this.m_densifiedPoints.length=0;const s=16;let n=0;const i=new ee,r=new ee;for(;this.m_segIter.hasNextSegment()&&this.m_numWinds<s;){const e=this.m_segIter.nextSegment();if(i.setCoordsPoint2D(e.getStartXY()),r.setCoordsPoint2D(e.getEndXY()),i.scale(this.m_bufferer.m_rpu),r.scale(this.m_bufferer.m_rpu),E(i,r))i.x=r.x;else if(q(i,r))r.x=i.x;else{let e=-1,t=-1;const s=this.m_segIter.getPathIndex(),n=this.m_multiPath.getPathStart(s),o=this.m_multiPath.getPathEnd(s);if(e=this.m_segIter.getStartPointIndex()-1,t=this.m_segIter.getEndPointIndex()+1,e<n&&(e=this.m_multiPath.isClosedPath(s)?o-1:-1),t>o-1&&(t=this.m_multiPath.isClosedPath(s)?n:-1),-1!==e){const t=this.m_multiPath.getXY(e);t.scale(this.m_bufferer.m_rpu),q(t,i)&&(i.x=t.x)}if(-1!==t){const e=this.m_multiPath.getXY(t);e.scale(this.m_bufferer.m_rpu),E(r,e)&&(r.x=e.x)}}this.m_densifiedPoints.length=0;const s=R(this.m_bufferer.m_a,this.m_bufferer.m_eSquared,this.m_bufferer.m_curveType,i,r,this.m_bufferer.m_segmentStep,Number.NaN,this.m_bufferer.m_radTolerance,this.m_startAzimuth,this.m_endAzimuth,this.m_densifiedPoints,this.m_currentDensifiedDelta);if(0===n)this.m_bRunningInGnomonic=this.isSegmentBufferInCurrentGnomonic(this.m_densifiedPoints),this.m_bRunningInGnomonic||(this.m_bRunningInGnomonic=this.tryUpdateGnomonic(this.m_densifiedPoints));else if(this.m_bRunningInGnomonic){if(!this.isSegmentBufferInCurrentGnomonic(this.m_densifiedPoints)){this.m_segIter.previousSegment(),this.m_segIter.previousSegment(),this.m_segIter.nextSegment();break}}else{if(ge(this.m_bufferer.m_a,this.m_bufferer.m_eSquared,this.m_bufferer.m_rpu,this.m_densifiedPoints,this.m_bufferer.m_absDistance*this.m_bufferer.m_ellipticToGeodesicMaxRatio,null,null,null)){this.m_segIter.previousSegment(),this.m_segIter.previousSegment(),this.m_segIter.nextSegment();break}}if(0===s||z(i,r)?(this.m_bufferHelper.setEmpty(),this.m_bufferer.bufferPoint2D(i,this.m_bRunningInGnomonic,this.m_bufferHelper),this.m_bNextSegmentCannotJoin=!0):(this.m_bufferHelper.setEmpty(),this.m_bNextSegmentCannotJoin=this.checkAndPrepSegmentForCrossingAzimuthsOrPoleWrap(s,this.m_bufferHelper)),this.m_bNextSegmentCannotJoin){this.m_segIter.previousSegment(),this.m_segIter.hasPreviousSegment()?(this.m_segIter.previousSegment(),this.m_segIter.nextSegment()):this.m_segIter.resetToFirstSegment(),null!=this.m_densified&&this.m_densified.insertPointsFromPoints(this.m_densified.getPathCount()-1,-1,this.m_densifiedPoints,0,this.m_densifiedPoints.length-1,!0);break}null!=this.m_densified&&this.m_densified.insertPointsFromPoints(this.m_densified.getPathCount()-1,-1,this.m_densifiedPoints,0,this.m_densifiedPoints.length-1,!0),null===t&&(t=new O,t.addPathPoint2D(null,0,!0)),this.addJoinAndBufferLeftSide(t),n++}if(this.m_currentDensifiedDelta=[0],n>0){const e=this.m_segIter.getStartPointIndex(),s=this.m_segIter.getPathIndex();for(;n>0;){if(this.m_segIter.previousSegment(),i.setCoordsPoint2D(this.m_multiPath.getXY(this.m_segIter.getStartPointIndex())),r.setCoordsPoint2D(this.m_multiPath.getXY(this.m_segIter.getEndPointIndex())),i.scale(this.m_bufferer.m_rpu),r.scale(this.m_bufferer.m_rpu),this.m_bRunningInGnomonic)if(E(i,r))i.x=r.x;else if(q(i,r))r.x=i.x;else{let e=-1,t=-1;const s=this.m_segIter.getPathIndex(),n=this.m_multiPath.getPathStart(s),o=this.m_multiPath.getPathEnd(s);if(e=this.m_segIter.getStartPointIndex()-1,t=this.m_segIter.getEndPointIndex()+1,e<n&&(e=this.m_multiPath.isClosedPath(s)?o-1:-1),t>o-1&&(t=this.m_multiPath.isClosedPath(s)?n:-1),-1!==e){const t=this.m_multiPath.getXY(e);t.scale(this.m_bufferer.m_rpu),q(t,i)&&(i.x=t.x)}if(-1!==t){const e=this.m_multiPath.getXY(t);e.scale(this.m_bufferer.m_rpu),E(r,e)&&(r.x=e.x)}}this.m_densifiedPoints.length=0,R(this.m_bufferer.m_a,this.m_bufferer.m_eSquared,this.m_bufferer.m_curveType,r,i,this.m_bufferer.m_segmentStep,Number.NaN,this.m_bufferer.m_radTolerance,this.m_startAzimuth,this.m_endAzimuth,this.m_densifiedPoints,this.m_currentDensifiedDelta),this.addJoinAndBufferLeftSide(t),n--}return i.setCoordsPoint2D(this.m_multiPath.getXY(this.m_segIter.getStartPointIndex())),i.scale(this.m_bufferer.m_rpu),this.m_currentBufferedDelta=ue(this.m_bufferer.m_a,this.m_bufferer.m_eSquared,this.m_bufferer.m_rpu,this.m_bufferer.m_absDistance,i,this.m_lastAzimuth+.5*Math.PI,this.m_lastAzimuth+1.5*Math.PI,this.m_bufferer.m_cornerStep,this.m_bRunningInGnomonic,this.m_currentBufferedDelta,t),this.m_segIter.resetToVertex(e,s),this.m_segIter.nextSegment(),t}return this.m_bNextSegmentCannotJoin=!1,this.m_segIter.nextSegment(),e=this.m_bufferHelper.clone(),e}isSegmentBufferInCurrentGnomonic(e){return null!==this.m_gnomonic&&de(this.m_bufferer.m_a,this.m_bufferer.m_eSquared,e,this.m_bufferer.m_absDistance*this.m_bufferer.m_ellipticToGeodesicMaxRatio,this.m_gnomonicCenterRad,this.m_minGnomonicRadius)}tryUpdateGnomonic(e){const t=new ee,s=new ee,n=[0];return ge(this.m_bufferer.m_a,this.m_bufferer.m_eSquared,this.m_bufferer.m_rpu,e,this.m_bufferer.m_absDistance*this.m_bufferer.m_ellipticToGeodesicMaxRatio,t,s,n)?(this.m_gnomonicCenterRad.setCoordsPoint2D(s),this.m_minGnomonicRadius=n[0],this.m_gnomonic=xe(this.m_bufferer.m_gcs,t),!0):(this.m_gnomonic=null,!1)}checkAndPrepSegmentForCrossingAzimuthsOrPoleWrap(e,t){return this.m_bufferer.checkAndPrepSegmentForCrossingAzimuthsOrPoleWrap(this.m_densifiedPoints,e,this.m_startAzimuth[0],this.m_endAzimuth[0],this.m_bRunningInGnomonic,t)}addJoinAndBufferLeftSide(e){const t=this.m_densifiedPoints[0];let s=Number.NaN,n=this.m_startAzimuth[0]-se;const i=this.m_endAzimuth[0]+se;let r=!1;if(!Number.isNaN(this.m_lastAzimuth)){this.m_lastAzimuth>=this.m_startAzimuth[0]?(s=this.m_lastAzimuth+se,n=s+Math.PI-(this.m_lastAzimuth-this.m_startAzimuth[0])):(s=this.m_lastAzimuth+se,n=s+Math.PI-(ne-(this.m_startAzimuth[0]-this.m_lastAzimuth))),r=!(this.m_lastAzimuth>=this.m_startAzimuth[0]&&this.m_lastAzimuth-this.m_startAzimuth[0]<=Math.PI)&&!(this.m_lastAzimuth<this.m_startAzimuth[0]&&this.m_startAzimuth[0]-this.m_lastAzimuth>=Math.PI);let i=!1;if(Math.abs(n-s)<=.5*this.m_bufferer.m_cornerStep&&(r||(i=!0)),i){if(e.removePointFromPath(0,e.getPointCount()-1),!this.m_bRunningInGnomonic){const t=new ee;t.setCoordsPoint2D(e.getXY(e.getPointCount()-1)),t.scale(this.m_bufferer.m_rpu),t.x-this.m_currentBufferedDelta<-Math.PI?this.m_currentBufferedDelta-=ne:t.x-this.m_currentBufferedDelta>Math.PI&&(this.m_currentBufferedDelta+=ne)}n=.5*(n+s)}else if(r){const s=new ee;s.setCoordsPoint2D(t),s.scale(1/this.m_bufferer.m_rpu),e.insertPoint2D(0,-1,s)}else ue(this.m_bufferer.m_a,this.m_bufferer.m_eSquared,this.m_bufferer.m_rpu,this.m_bufferer.m_absDistance,this.m_densifiedPoints[0],s,n,this.m_bufferer.m_cornerStep,this.m_bRunningInGnomonic,this.m_currentBufferedDelta,e)}this.m_startAzimuth[0]!==this.m_lastAzimuth&&this.m_numWinds++,ce(this.m_bufferer.m_a,this.m_bufferer.m_eSquared,this.m_bufferer.m_rpu,this.m_bufferer.m_absDistance,this.m_bufferer.m_curveType,this.m_densifiedPoints,n,i,this.m_bRunningInGnomonic,this.m_currentBufferedDelta,e),this.m_lastAzimuth=this.m_endAzimuth[0]}}class Ce extends be{constructor(e,t){super(e.m_progressTracker),this.m_pointIndex=-1,this.m_bufferer=e,this.m_multiPoint=t,this.m_bNeedsSimplify=!1;const s=new _;this.m_multiPoint.queryEnvelope(s);const n=s.getCenter(),i=n.clone();i.scale(this.m_bufferer.m_rpu),this.m_gnomonic=xe(this.m_bufferer.m_gcs,n),this.m_gnomonicCenterRad=i.clone(),this.m_minGnomonicRadius=A(this.m_bufferer.m_a,this.m_bufferer.m_eSquared,i,75/180*Math.PI)}next(){if(this.m_bNeedsSimplify=!1,++this.m_pointIndex===this.m_multiPoint.getPointCount())return null;const e=this.m_multiPoint.getXY(this.m_pointIndex);e.scale(this.m_bufferer.m_rpu),this.m_bRunningInGnomonic=this.isPointBufferInCurrentGnomonic(e),this.m_bRunningInGnomonic||(this.m_bRunningInGnomonic=this.tryUpdateGnomonic(e));const t=new O,s=this.m_bufferer.bufferPoint2D(e,this.m_bRunningInGnomonic,t);return this.m_bNeedsSimplify=s,t}isPointBufferInCurrentGnomonic(e){return null!==this.m_gnomonic&&pe(this.m_bufferer.m_a,this.m_bufferer.m_eSquared,e,this.m_bufferer.m_absDistance*this.m_bufferer.m_ellipticToGeodesicMaxRatio,this.m_gnomonicCenterRad,this.m_minGnomonicRadius)}tryUpdateGnomonic(e){const t=new ee,s=new ee,n=[0];return Pe(this.m_bufferer.m_a,this.m_bufferer.m_eSquared,this.m_bufferer.m_rpu,e,this.m_bufferer.m_absDistance*this.m_bufferer.m_ellipticToGeodesicMaxRatio,t,s,n)?(this.m_gnomonicCenterRad.setCoordsPoint2D(s),this.m_minGnomonicRadius=n[0],this.m_gnomonic=xe(this.m_bufferer.m_gcs,t),!0):(this.m_gnomonic=null,!1)}}class ve{getOperatorType(){return 10110}supportsCurves(){return!0}accelerateGeometry(e,t,s){return!1}canAccelerateGeometry(e){return!1}executeMany(e,t,s,n,i,r,o,m){if(o){const o=new Se(e,t,s,n,i,!1,r,m);return(new f).executeMany(o,t,m)}return new Se(e,t,s,n,i,!1,r,m)}execute(t,n,i,r,o,m,a){const h=new e([t]),c=[r],u=this.executeMany(h,n,i,c,o,!1,m,a).next();return u||s("geodesic buffer null output"),u}}class Se extends t{constructor(e,t,s,r,o,m,a,h){super(),this.m_currentUnionEnvelope2D=new _,this.m_index=-1,this.m_dindex=-1,this.m_progressTracker=h,m&&n(""),t||i("");0===t.getCoordinateSystemType()&&i(""),this.m_inputGeoms=e,this.m_spatialReference=t,this.m_curveType=s,this.m_distances=r,this.m_convergenceOffset=o,this.m_bOutlineOnly=m,this.m_bUnion=a}next(){let e;for(;e=this.m_inputGeoms.next();)return r(e),this.m_index=this.m_inputGeoms.getGeometryID(),this.m_dindex+1<this.m_distances.length&&this.m_dindex++,this.geodesicBuffer(e,this.m_distances[this.m_dindex]);return null}getGeometryID(){return this.m_index}tock(){return!0}getRank(){return 1}geodesicBuffer(e,t){return me(e,this.m_spatialReference,this.m_curveType,t,this.m_convergenceOffset,this.m_progressTracker)}}export{ve as OperatorGeodesicBuffer};
5
+ import{S as e,G as t}from"./SimpleGeometryCursor.js";import{d as s,t as n,a as i,c as r,i as o,G as m,m as a,f as h,e as c,h as u,n as l}from"./Geometry.js";import{Envelope2D as _}from"./Envelope2D.js";import{W as f,E as d,r as g,al as p,am as P,O as x,a7 as y,an as b,a3 as w,e as C,ao as v,ap as S,V as D,L as I,aq as G,ar as M,as as T,aa as N,ab as k,at as A,au as E,av as q,aw as R,ax as z,ay as X}from"./UnitFactory.js";import{__addDisposableResource as B,__disposeResources as Y}from"tslib";import{a as O,P as F,E as j}from"./MultiPathImpl.js";import{e as W,c as J,P as U,b as H,f as L,h as V,s as K}from"./Envelope.js";import{T as Q}from"./Transformation2D.js";import{d as Z,m as $,P as ee,S as te,o as se,p as ne}from"./Point2D.js";import{c as ie}from"./OperatorClip.js";import{c as re}from"./GeometryCleaner-BEJM7I4l.js";import{O as oe}from"./OperatorDensify.js";function me(e,t,s,n,a,h){n<Number.MAX_VALUE&&n>-Number.MAX_VALUE||i("Geodesic_bufferer.buffer - bad distance"),r(e);const c=re(e),u=c.getGeometryType();if(o(u)){const e=c.getPointCount(),i=8e6;if(Math.abs(n)>i&&(e>50||u!==m.enumMultiPoint&&4===s&&e>2)){let e=c;const r=n>0?1:-1,o=7e6;let m=n,u=1;do{u++,m=(Math.abs(m)-o)*r}while(Math.abs(m)>i);m=n;for(let n=0;n<u-1;n++)e=he(e,t,s,o*r,a,u,h),m=(Math.abs(m)-o)*r;return e=he(e,t,s,m,a,u,h),e}}return he(c,t,s,n,a,1,h)}class ae{constructor(e){this.m_sr=null,this.m_gcs=null,this.m_transform=null,this.m_a=0,this.m_eSquared=0,this.m_rpu=0,this.m_radTolerance=0,this.m_q90=0,this.m_gcs90=0,this.m_gcs180=0,this.m_gcs360=0,this.m_gcs60=0,this.m_ellipticToGeodesicMaxRatio=0,this.m_curveType=0,this.m_bShapePreserving=!1,this.m_distance=0,this.m_absDistance=0,this.m_convergenceOffset=0,this.m_cornerStep=0,this.m_segmentStep=0,this.m_progressTracker=e}bufferPolygon(e){const t=new O,s=new we(this,e,t);return this.processGnomonicBufferPiecesCursor(!0,s)}bufferPolyline(e){const t=new we(this,e,null);return this.processGnomonicBufferPiecesCursor(!0,t)}bufferMultiPoint(e){const t=new Ce(this,e);return this.processGnomonicBufferPiecesCursor(!1,t)}bufferPoint(e){const t=e.getXY();t.scale(this.m_rpu);let s=new O;if(this.bufferPoint2D(t,!1,s)){const e=H(null,s,!0);s=w(s,e,!0,!0,-1,this.m_progressTracker,0,!1)}return s=(new x).foldInto360RangeGeodetic(s,this.m_gcs,2),s}processGnomonicBufferPiecesCursor(e,t){const s=t;let n=s.getGnomonic();const i=C(v());let r=new S,o=(new f).executeMany(r,i,this.m_progressTracker,2);const m=Z(6,!1),a=$(_,6);this.initializeGrid(m,a);const h=[null,null,null,null,null,null],c=[null,null,null,null,null,null],u=[null,null,null,null,null,null];let l,d,g;for(;null!==(l=s.next());){if(d=s.getGnomonic(),d!==n){if(null!==n){let t=o.next();if(r=null,o=null,null!=t){const s=H(i,t,!0),r=W(s);t=n.unproject(t,r,this.m_progressTracker),this.putInGridCursors(e,t,i,!0,m,a,h,c,u)}}null!==d&&(r=new S,o=(new f).executeMany(r,i,this.m_progressTracker,2)),n=d}if(s.isRunningInGnomonic()){if(d.project(l),s.needsSimplify()){const e=H(null,l,!0);l=w(l,e,!0,!0,-1,this.m_progressTracker,0,!1)}r.tick(ye(l)),o.tock()}else this.putInGridCursors(e,l,i,!0,m,a,h,c,u)}let p=!1;for(let _=0;_<6;_++)if(null!=u[_]){p=!0;break}if(p){let t=!1;const l=[null,null,null,null,null,null];if(e){const n=s.m_densified;if(s.m_densified=null,null!==n){const s=new Q;s.scale(1/this.m_rpu,1/this.m_rpu),n.applyTransformation(s),this.m_distance>0?this.putInGridCursors(e,n,i,!1,m,a,h,c,u):(this.processInGrid(e,n,!1,m,a,h,l),t=!0)}}const _=new S,d=(new f).executeMany(_,this.m_gcs,this.m_progressTracker,2);if(null!==o){let t=o.next();r=null,o=null;const s=H(i,t,!0),l=W(s);t=n.unproject(t,l,this.m_progressTracker),this.putInGridCursors(e,t,i,!0,m,a,h,c,u)}for(let e=0;e<6;e++)if(null!=u[e]){let s=u[e].next();u[e]=null,c[e]=null,t&&null!==l[e]&&(s=(new D).execute(l[e],s,i,this.m_progressTracker));const n=H(i,s,!0),r=W(n);s=h[e].unproject(s,r,this.m_progressTracker),s=(new I).execute(s,this.m_gcs,!0,this.m_progressTracker),_.tick(ye(s)),d.tock()}g=d.next()}else{let t,m=!1;if(e){let e=s.m_densified;if(s.m_densified=null,null!==e){const s=new Q;s.scale(1/this.m_rpu,1/this.m_rpu),e.applyTransformation(s),d.project(e);const n=H(null,e,!0);e=w(e,n,!1,!0,-1,this.m_progressTracker,0,!1),this.m_distance>0?(r.tick(ye(e)),o.tock()):(t=e,m=!0)}}let a=o.next();r=null,o=null,m&&(a=(new D).execute(t,a,i,this.m_progressTracker));const h=H(i,a,!0),c=W(h);g=n.unproject(a,c,this.m_progressTracker),g=(new I).execute(g,this.m_gcs,!0,this.m_progressTracker)}return g=(new x).foldInto360RangeGeodetic(g,this.m_gcs,2),g}putInGridCursors(e,t,s,n,i,r,o,m,a){const h=[null,null,null,null,null,null];this.processInGrid(e,t,n,i,r,o,h);for(let c=0;c<6;c++)null!==h[c]&&(null===m[c]&&(m[c]=new S,a[c]=(new f).executeMany(m[c],s,this.m_progressTracker,2)),m[c].tick(ye(h[c])),a[c].tock())}processInGrid(e,t,s,n,i,r,o){const m=.01,a=this.insertGeodeticPointsAlongGrid(t,i,m);for(let h=0;h<6;h++){if(n[h])continue;const e=i[h].clone();e.inflateCoords(m,m);const c=L(t,e),u=J(null,c,!1).total();let l=ie(a,e,u,Number.NaN,this.m_progressTracker);if(null!==l&&!l.isEmpty()){if(l===a&&(l=l.clone()),null===r[h]){const e=new ee;h<3?e.setCoords(0,1):e.setCoords(0,-1);const t=new ee;t.setAdd(i[h].getCenter(),e),r[h]=xe(this.m_gcs,t)}r[h].project(l);const e=H(null,l,!0);l=w(l,e,s,!0,-1,this.m_progressTracker,0,!1),o[h]=l}}}insertGeodeticPointsAlongGrid(e,t,s){const n=_.construct(t[3].xmin,t[3].ymin,t[2].xmax,t[2].ymax),i=G(this.m_gcs,n,e,!0,this.m_progressTracker),r=new j,o=r.addGeometry(i);return M(r,o,this.m_gcs,0,2,!0,t[0].xmax+s),M(r,o,this.m_gcs,0,2,!0,t[1].xmax+s),M(r,o,this.m_gcs,0,2,!1,t[1].ymin+s),0!==s&&(M(r,o,this.m_gcs,0,2,!0,t[0].xmax-s),M(r,o,this.m_gcs,0,2,!0,t[1].xmax-s),M(r,o,this.m_gcs,0,2,!1,t[1].ymin-s)),r.getGeometry(o)}initializeGrid(e,t){for(let s=0;s<6;s++)e[s]=!1;t[0].setCoords({xmin:-this.m_gcs180,ymin:0,xmax:-this.m_gcs60,ymax:this.m_gcs90}),t[1].setCoords({xmin:-this.m_gcs60,ymin:0,xmax:this.m_gcs60,ymax:this.m_gcs90}),t[2].setCoords({xmin:this.m_gcs60,ymin:0,xmax:this.m_gcs180,ymax:this.m_gcs90}),t[3].setCoords({xmin:-this.m_gcs180,ymin:-this.m_gcs90,xmax:-this.m_gcs60,ymax:0}),t[4].setCoords({xmin:-this.m_gcs60,ymin:-this.m_gcs90,xmax:this.m_gcs60,ymax:0}),t[5].setCoords({xmin:this.m_gcs60,ymin:-this.m_gcs90,xmax:this.m_gcs180,ymax:0})}checkAndPrepSegmentForCrossingAzimuthsOrPoleWrap(e,t,s,n,i,r){const o=e[0],m=e.at(-1),a=o.y<m.y?o.y:m.y,h=o.y>m.y?o.y:m.y,c=p.q(this.m_a,this.m_eSquared,a),u=p.q(this.m_a,this.m_eSquared,h);if(this.m_q90-(c+t+this.m_absDistance)>.001&&this.m_q90+(u-t-this.m_absDistance)>.001)return!1;const l=s-se,_=n+se,f=l-Math.PI,d=l+Math.PI,g=_+Math.PI,P=[Number.NaN],x=[Number.NaN],y=[Number.NaN],b=[Number.NaN];let w=!1;if(le(this.m_a,this.m_eSquared,this.m_rpu,this.m_absDistance,o,l,f,m,_,P,x),le(this.m_a,this.m_eSquared,this.m_rpu,this.m_absDistance,m,g,_,o,f,y,b),(_<P[0]&&P[0]<g||_<x[0]&&x[0]<g)&&(w=!0),w||(f<y[0]&&y[0]<l||f<b[0]&&b[0]<l)&&(w=!0),!w&&i)return!1;const C=[];for(let p=e.length-1;p>=0;p--)C.push(e[p]);r.setEmpty(),r.addPathPoint2D(null,0,!0);let v=0;v=ce(this.m_a,this.m_eSquared,this.m_rpu,this.m_absDistance,this.m_curveType,e,l,_,i,v,r),v=ue(this.m_a,this.m_eSquared,this.m_rpu,this.m_absDistance,m,_,g,this.m_cornerStep,i,v,r,P[0],x[0]),v=ce(this.m_a,this.m_eSquared,this.m_rpu,this.m_absDistance,this.m_curveType,C,g,d,i,v,r),v=ue(this.m_a,this.m_eSquared,this.m_rpu,this.m_absDistance,o,f,l,this.m_cornerStep,i,v,r,y[0],b[0]);let S=!1;return i||(S=this.checkAndPrepForPole(r)),w||S}bufferPoint2D(e,t,s){s.setEmpty(),s.addPathPoint2D(null,0,!0);const n=0;ue(this.m_a,this.m_eSquared,this.m_rpu,this.m_absDistance,e,-this.m_cornerStep,2*Math.PI,this.m_cornerStep,t,n,s);let i=!1;return t||(i=this.checkAndPrepForPole(s)),i}checkAndPrepForPole(e){const t=this.checkAndPrepForPoleTouch(e),s=this.checkAndPrepForPoleWrap(e);return t||s}checkAndPrepForPoleTouch(e){const t=new _;return e.queryEnvelope(t),!(!T(t.ymax,this.m_gcs90)&&!T(t.ymin,-this.m_gcs90))&&(this.prepPoleTouch(e),!0)}checkAndPrepForPoleWrap(e){const t=e.getXY(0),s=e.getXY(e.getPointCount()-1);return Math.abs(t.x-s.x)>this.m_gcs180?(this.prepSinglePoleWrap(e),!0):this.checkAndPrepForDoublePoleWrap(e)}checkAndPrepForDoublePoleWrap(e){return e.calculateArea2D()<0&&(this.prepDoublePoleWrap(e),!0)}prepPoleTouch(e){const t=new O;t.insertPath2D(-1,null,0,0,!0);const s=e.getPathStart(0),n=e.getPathEnd(0),i=n-s;let r=-1;for(r=s;r<n;r++){const t=e.getXY(r),s=T(t.y,this.m_gcs90),n=T(t.y,-this.m_gcs90);if(!s&&!n)break}let o=r,m=!1,a=Number.NaN;do{const n=e.getXY(o),r=T(n.y,this.m_gcs90),h=T(n.y,-this.m_gcs90),c=s+(o+1-s)%i;if(r||h){let s=ee.construct(a,n.y);t.insertPoint2D(0,-1,s);const i=e.getXY(c),r=T(i.y,this.m_gcs90),o=T(i.y,-this.m_gcs90);r||o||(s=ee.construct(i.x,n.y),m?t.setXY(t.getPointCount()-1,s):t.insertPoint2D(0,-1,s)),m=!0}else t.insertPoint2D(0,-1,n),a=n.x,m=!1;o=c}while(o!==r);e.setEmpty(),e.add(t,!1)}prepSinglePoleWrap(e){const t=new O,s=new O,n=new Q,i=e.getXY(e.getPathStart(0)),r=e.getXY(e.getPathEnd(0)-1),o=this.m_gcs360,m=this.m_gcs180,a=new _;a.setCoords({xmin:-this.m_gcs180,ymin:-this.m_gcs90,xmax:this.m_gcs180,ymax:this.m_gcs90});const h=new _;e.queryEnvelope(h);const c=Math.ceil(h.width()/o);let u,l;i.x>r.x?(u=-o,l=this.m_gcs90):(u=o,l=-this.m_gcs90),n.setShiftCoords(u,0),t.addPath(e,0,!0),s.add(t,!1);const f=new U;for(let _=0;_<c;_++)s.applyTransformation(n),s.getPointByVal(0,f),t.lineToPoint(f),t.addSegmentsFromPath(s,0,0,s.getSegmentCount()-1,!1);const d=t.getXY(0),g=t.getXY(t.getPointCount()-1);d.y=l,g.y=l,t.lineTo(g);const p=new ee;for(p.setCoordsPoint2D(g),p.x-=.5*u;Math.abs(p.x-d.x)>m;)t.lineTo(p),p.x-=.5*u;t.lineTo(d);const P=a.getCenterX(),x=new _;t.queryEnvelope(x);let y=0;const b=x.getCenter().x;b-P>m?y=-Math.ceil((b-P-m)/o):P-b>m&&(y=Math.ceil((P-b-m)/o)),0!==y&&(n.setShiftCoords(y*o,0),t.applyTransformation(n));const w=new j,C=w.addGeometry(t);M(w,C,this.m_gcs,0,2,!0,a.xmin),M(w,C,this.m_gcs,0,2,!0,a.xmax);const v=w.getGeometry(C),S=L(v,a);S.inflateCoords(0,1);const D=J(null,S,!0).total(),I=ie(v,a,D,Number.NaN,this.m_progressTracker);e.setEmpty(),e.add(I,!1)}prepDoublePoleWrap(e){const t=this.m_gcs360,s=this.m_gcs180,n=new _;n.setCoords({xmin:-this.m_gcs180,ymin:-this.m_gcs90,xmax:this.m_gcs180,ymax:this.m_gcs90});const i=n.getCenter().x,r=new _;e.queryPathEnvelope(0,r);let o,m=0,a=r.getCenter().x;if(a-i>s?m=-Math.ceil((a-i-s)/t):i-a>s&&(m=Math.ceil((i-a-s)/t)),0!==m){const s=new Q;s.setShiftCoords(m*t,0),e.getImpl().applyTransformationToPath(s,0),e.queryPathEnvelope(0,r),a=r.getCenter().x}const h=new _;n.containsExclusiveEnvelope(r)?(o=!1,h.setCoords({env2D:n})):(o=!0,h.setCoords({env2D:n}),h.xmin-=t,h.xmax+=t);let c=e.createInstance();c.addPathPoint2D(null,0,!0);const u=new ee;if(u.setCoords(h.xmin,h.ymin),c.insertPoint2D(0,-1,u),u.setCoords(h.xmin,h.ymax),c.insertPoint2D(0,-1,u),u.setCoords(.5*(h.xmin+h.xmax),h.ymax),c.insertPoint2D(0,-1,u),u.setCoords(h.xmax,h.ymax),c.insertPoint2D(0,-1,u),u.setCoords(h.xmax,h.ymin),c.insertPoint2D(0,-1,u),u.setCoords(.5*(h.xmin+h.xmax),h.ymin),c.insertPoint2D(0,-1,u),o){c.addPath(e,0,!0);const s=new Q;a<i?s.setShiftCoords(t,0):s.setShiftCoords(-t,0),e.getImpl().applyTransformationToPath(s,0),c.addPath(e,0,!0);const r=new j,o=r.addGeometry(c);M(r,o,this.m_gcs,0,2,!0,n.xmin),M(r,o,this.m_gcs,0,2,!0,n.xmax),c=r.getGeometry(o);const m=L(c,n);m.inflateCoords(0,1);const h=J(null,m,!0).total();c=ie(c,n,h,Number.NaN,this.m_progressTracker)}else c.addPath(e,0,!0);e.setEmpty(),e.add(c,!1)}setMinCornerStep(){const e={stack:[],error:void 0,hasError:!1};try{let s=Math.min(Math.PI*this.m_a-this.m_absDistance,this.m_absDistance);s=Math.min(s,.125*this.m_a*Math.PI);const n=new ee;n.setCoords(0,10*this.m_rpu);const i=0;let r=45*this.m_rpu;const o=B(e,new te(new N,new N),!1),m=B(e,new te(new N,new N),!1),a=B(e,new te(new N,new N),!1),h=B(e,new te(new N,new N),!1),c=new ee,u=new ee,l=new ee,_=new ee;for(k.geodesicCoordinate(this.m_a,this.m_eSquared,n.x,n.y,s,i,o.at(0),o.at(1)),c.setCoords(o.at(0).val,o.at(1).val),k.geodesicCoordinate(this.m_a,this.m_eSquared,n.x,n.y,s,r,m.at(0),m.at(1)),u.setCoords(m.at(0).val,m.at(1).val);;){const e={stack:[],error:void 0,hasError:!1};try{const t=.5*(i+r);k.geodesicCoordinate(this.m_a,this.m_eSquared,n.x,n.y,s,t,a.at(0),a.at(1)),l.setCoords(a.at(0).val,a.at(1).val);const o=B(e,new N,!1),f=B(e,new N,!1);k.geodeticDistance(this.m_a,this.m_eSquared,c.x,c.y,u.x,u.y,o,f,null,2),k.geodeticCoordinate(this.m_a,this.m_eSquared,c.x,c.y,.5*o.val,f.val,h.at(0),h.at(1),2),_.setCoords(h.at(0).val,h.at(1).val);const d=B(e,new N,!1);k.geodeticDistance(this.m_a,this.m_eSquared,l.x,l.y,_.x,_.y,d,null,null,2);if(d.val<=this.m_convergenceOffset)break;r*=.9,k.geodesicCoordinate(this.m_a,this.m_eSquared,n.x,n.y,s,r,m.at(0),m.at(1)),u.setCoords(m.at(0).val,m.at(1).val)}catch(t){e.error=t,e.hasError=!0}finally{Y(e)}}const f=r-i,d=2*Math.PI/Math.ceil(2*Math.PI/f);this.m_cornerStep=d}catch(s){e.error=s,e.hasError=!0}finally{Y(e)}}setMinSegmentStep(){const e={stack:[],error:void 0,hasError:!1};try{let n=Math.min(Math.PI*this.m_a-this.m_absDistance,this.m_absDistance);n=Math.min(n,.125*this.m_a*Math.PI);const i=new ee,r=new ee;i.setCoords(0,10*this.m_rpu),r.setCoords(10*this.m_rpu,10*this.m_rpu);const o=B(e,new N,!1),m=B(e,new N,!1),a=B(e,new N,!1);k.geodeticDistance(this.m_a,this.m_eSquared,i.x,i.y,r.x,r.y,a,o,m,this.m_curveType);const h=B(e,new te(new N,new N),!1),c=B(e,new te(new N,new N),!1),u=new ee,l=B(e,new N,!1),_=B(e,new te(new N,new N),!1),f=B(e,new te(new N,new N),!1),d=B(e,new te(new N,new N),!1),g=B(e,new te(new N,new N),!1),p=new ee,P=new ee,x=new ee,y=new ee,b=0;let w=1;const C=o.val,v=m.val,S=C-.5*Math.PI,D=v+.5*Math.PI,I=a.val;for(k.geodesicCoordinate(this.m_a,this.m_eSquared,i.x,i.y,n,S,_.at(0),_.at(1)),p.setCoords(_.at(0).val,_.at(1).val),k.geodesicCoordinate(this.m_a,this.m_eSquared,r.x,r.y,n,D,f.at(0),f.at(1)),P.setCoords(f.at(0).val,f.at(1).val);;){const e={stack:[],error:void 0,hasError:!1};try{const s=.5*(b+w);k.geodeticCoordinate(this.m_a,this.m_eSquared,i.x,i.y,s*I,C,h.at(0),h.at(1),this.m_curveType),u.setCoords(h.at(0).val,h.at(1).val),k.geodeticDistance(this.m_a,this.m_eSquared,i.x,i.y,u.x,u.y,null,null,l,this.m_curveType);const o=l.val+.5*Math.PI;k.geodesicCoordinate(this.m_a,this.m_eSquared,u.x,u.y,n,o,d.at(0),d.at(1)),x.setCoords(d.at(0).val,d.at(1).val);const m=B(e,new N,!1),a=B(e,new N,!1);k.geodeticDistance(this.m_a,this.m_eSquared,p.x,p.y,P.x,P.y,m,a,null,2),k.geodeticCoordinate(this.m_a,this.m_eSquared,p.x,p.y,.5*m.val,a.val,g.at(0),g.at(1),2),y.setCoords(g.at(0).val,g.at(1).val);const _=B(e,new N,!1);k.geodeticDistance(this.m_a,this.m_eSquared,x.x,x.y,y.x,y.y,_,null,null,2);if(_.val<=this.m_convergenceOffset)break;{const e={stack:[],error:void 0,hasError:!1};try{w*=.9,k.geodeticCoordinate(this.m_a,this.m_eSquared,i.x,i.y,w*I,C,c.at(0),c.at(1),this.m_curveType),r.setCoords(c.at(0).val,c.at(1).val);const t=B(e,new N,!1);k.geodeticDistance(this.m_a,this.m_eSquared,i.x,i.y,r.x,r.y,null,null,t,this.m_curveType);const s=t.val+.5*Math.PI;k.geodesicCoordinate(this.m_a,this.m_eSquared,r.x,r.y,n,s,f.at(0),f.at(1)),P.setCoords(f.at(0).val,f.at(1).val)}catch(t){e.error=t,e.hasError=!0}finally{Y(e)}}}catch(s){e.error=s,e.hasError=!0}finally{Y(e)}}let G=w*I;G>1e5&&(G=1e5),this.m_segmentStep=G}catch(n){e.error=n,e.hasError=!0}finally{Y(e)}}setConvergenceOffset(){let e;e=this.m_absDistance>5e4?100:this.m_absDistance>1e4?10:1,this.m_absDistance/e<500&&(e=this.m_absDistance/500),e<.01&&(e=.01),this.m_convergenceOffset=e}}function he(e,t,s,n,i,r,o){if(e.isEmpty())return new O({vd:e.getDescription()});let f=e;if(a(f)){const e=10*t.getTolerance(0);f=(new oe).execute(f,0,e,0,o,12e3)}const w=new ae(o);w.m_sr=t,w.m_gcs=t.getGCS(),w.m_transform=d(t,w.m_gcs,null);const C=g();w.m_gcs.querySpheroidData(C);const v=new _;f.queryEnvelope(v),w.m_a=C.majorSemiAxis,w.m_eSquared=C.e2,w.m_rpu=w.m_gcs.getUnit().getUnitToBaseFactor(),w.m_gcs90=.5*Math.PI/w.m_rpu,w.m_gcs180=Math.PI/w.m_rpu,w.m_gcs360=2*Math.PI/w.m_rpu,w.m_gcs60=w.m_gcs360/6,w.m_q90=p.q90(w.m_a,w.m_eSquared),w.m_ellipticToGeodesicMaxRatio=.5*w.m_a*Math.PI/w.m_q90;const S=w.m_gcs.getTolerance(0);w.m_radTolerance=S*w.m_rpu,4===s?(w.m_curveType=2,w.m_bShapePreserving=!0):(w.m_curveType=s,w.m_bShapePreserving=!1),w.m_distance=n,w.m_absDistance=Math.abs(n),Number.isNaN(i)||i<=0?w.setConvergenceOffset():w.m_convergenceOffset=Math.max(i,.001),w.m_convergenceOffset/=r;let D,I=f.getGeometryType();if(h(I)){const e=new F({vd:f.getDescription()});e.addSegment(f,!0),D=e,I=m.enumPolyline}else if(I===m.enumEnvelope){const e=f,t=new _;e.queryEnvelope(t);const s=W(J(w.m_sr,v,!0));if(t.minDimension()<=s)if(0===t.maxDimension()){const t=new U({vd:f.getDescription()});e.getCenter(t),D=t,I=m.enumPoint}else{const t=new F({vd:f.getDescription()});t.addEnvelope(e,!1),D=t,I=m.enumPolyline}else{const t=new O({vd:f.getDescription()});t.addEnvelope(e,!1),D=t,I=m.enumPolygon}}else D=f;if(w.setMinCornerStep(),c(I)||w.setMinSegmentStep(),w.m_absDistance<=.5*w.m_convergenceOffset)return I!==m.enumPolygon?new O({vd:D.getDescription()}):w.m_bShapePreserving?D:P(D,w.m_sr,w.m_curveType,w.m_segmentStep,-1,o);if(w.m_distance<0&&I!==m.enumPolygon)return new O({vd:D.getDescription()});if(w.m_bShapePreserving&&u(I)){const e=P(D,t,4,Number.NaN,w.m_convergenceOffset,o);D=(new x).execute(e,w.m_transform,o)}else D=(new x).execute(D,w.m_transform,o);if(D=y(D,w.m_gcs),D.isEmpty())return new O({vd:D.getDescription()});!w.m_bShapePreserving&&u(I)&&(D=b(w.m_rpu,D)),D=fe(D,w.m_gcs);let G=new O;switch(I){case m.enumPolygon:G=w.bufferPolygon(D);break;case m.enumPolyline:G=w.bufferPolyline(D);break;case m.enumMultiPoint:G=w.bufferMultiPoint(D);break;case m.enumPoint:G=w.bufferPoint(D);break;default:l("")}const M=(new x).execute(G,w.m_transform.getInverse(),o);return M.mergeVertexDescription(D.getDescription()),M}function ce(e,t,s,n,i,r,o,m,a,h,c){const u={stack:[],error:void 0,hasError:!1};try{const l=new ee;l.setNAN(),a||c.getPointCount()>0&&(l.setCoordsPoint2D(c.getXY(c.getPointCount()-1)),l.scale(s));const _=B(u,new N,!1),f=B(u,new te(new N,new N),!1),d=new ee,g=new ee,p=r.at(-1),P=1/s;for(let s=0;s<r.length;s++){const u=r[s];let x;0===s?x=o:s===r.length-1?x=m:(k.geodeticDistance(e,t,p.x,p.y,u.x,u.y,null,null,_,i),x=_.val-.5*Math.PI),k.geodesicCoordinate(e,t,u.x,u.y,n,x,f.at(0),f.at(1)),a?g.setCoords(f.at(0).val,f.at(1).val):(d.setCoords(f.at(0).val,f.at(1).val),h=_e(u.x,d.x,l.x,h),g.setCoords(h+d.x,d.y),l.setCoordsPoint2D(g)),g.scale(P),c.insertPoint2D(0,-1,g)}return h}catch(l){u.error=l,u.hasError=!0}finally{Y(u)}}function ue(e,t,s,n,i,r,o,m,a,h,c,u=Number.NaN,l=Number.NaN){const _={stack:[],error:void 0,hasError:!1};try{if(o-r<m)return h;const f=B(_,new te(new N,new N),!1),d=new ee,g=new ee,p=new ee;g.setNAN(),a||c.getPointCount()>0&&(g.setCoordsPoint2D(c.getXY(c.getPointCount()-1)),g.scale(s));let P=Math.ceil(r/m),x=P++*m;x===r&&(x=P++*m);let y=r;const b=1/s;for(;x<o+m&&(y<u&&u<x?(x=u,P--):y<l&&l<x&&(x=l,P--),!(x>=o));)k.geodesicCoordinate(e,t,i.x,i.y,n,x,f.at(0),f.at(1)),a?p.setCoords(f.at(0).val,f.at(1).val):(d.setCoords(f.at(0).val,f.at(1).val),h=_e(i.x,d.x,g.x,h),p.setCoords(h+d.x,d.y),g.setCoordsPoint2D(p)),p.scale(b),c.insertPoint2D(0,-1,p),y=x,x=P++*m;return h}catch(f){_.error=f,_.hasError=!0}finally{Y(_)}}function le(e,t,s,n,i,r,o,m,a,h,c){const u={stack:[],error:void 0,hasError:!1};try{const s=new ee,l=new ee,_=B(u,new te(new N,new N),!1);k.geodesicCoordinate(e,t,i.x,i.y,n,r,_.at(0),_.at(1)),s.setCoords(_.at(0).val,_.at(1).val),k.geodesicCoordinate(e,t,i.x,i.y,n,o,_.at(0),_.at(1)),l.setCoords(_.at(0).val,_.at(1).val);const f=B(u,new N,!1);for(k.geodeticDistance(e,t,m.x,m.y,s.x,s.y,null,f,null,0),h[0]=f.val,k.geodeticDistance(e,t,m.x,m.y,l.x,l.y,null,f,null,0),c[0]=f.val;h[0]<=c[0];)h[0]+=ne;for(;h[0]>c[0];)h[0]-=ne;for(;h[0]>=a;)h[0]-=ne,c[0]-=ne;for(;h[0]<a;)h[0]+=ne,c[0]+=ne}catch(l){u.error=l,u.hasError=!0}finally{Y(u)}}function _e(e,t,s,n){if(Number.isNaN(s)){for(;n+t-e>Math.PI;)n-=ne;for(;e-(n+t)>Math.PI;)n+=ne;return n}return n+t-s>Math.PI?n-=ne:s-(n+t)>Math.PI&&(n+=ne),n}function fe(e,t){const s=e.getGeometryType();let n;if(n=u(s)?e.getPathCount():s===m.enumMultiPoint?e.getPointCount():1,1===n)return e;const i=[],r=[];for(let m=0;m<n;m++){i.push(m);const n=new ee;if(u(s)){const t=new _;e.queryPathEnvelope(m,t),n.assign(t.getCenter())}else n.assign(e.getXY(m));const o=t.toGeohash(n);r.push(o)}i.sort((e,t)=>r[e]<r[t]?-1:r[e]>r[t]?1:0);const o=e.createInstance();for(let m=0;m<n;m++){const t=i[m];u(s)?o.addPath(e,t,!0):o.addPoints(e,t,t+1)}return o}function de(e,t,s,n,i,r){const o={stack:[],error:void 0,hasError:!1};try{if(n>=r)return!1;const m=s[0],a=s.at(-1),h=B(o,new N,!1),c=B(o,new N,!1),u=B(o,new N,!1);k.greatEllipticDistance(e,t,i.x,i.y,m.x,m.y,h,null,null),k.greatEllipticDistance(e,t,i.x,i.y,a.x,a.y,c,null,null),k.greatEllipticDistance(e,t,m.x,m.y,a.x,a.y,u,null,null);let l=Math.min(h.val,c.val)+u.val,_=l+n;if(_<r)return!0;const f=B(o,new N,!1);l=Math.max(h.val,c.val);for(let n=1;n<s.length-1;n++){const r=s[n];k.greatEllipticDistance(e,t,i.x,i.y,r.x,r.y,f,null,null),f.val>l&&(l=f.val)}return _=l+n,_<r}catch(m){o.error=m,o.hasError=!0}finally{Y(o)}}function ge(e,t,s,n,i,r,o,m){let a;if(n.length%2==0){const e=n.length>>1,t=n[e],s=n[e-1];a=ee.lerp(t,s,.5)}else{a=n[n.length-1>>1].clone()}const h=a.clone(),c=A(e,t,h,75/180*Math.PI);return!!de(e,t,n,i,h,c)&&(null!==r&&(r.setCoordsPoint2D(a),r.scale(1/s)),null!==o&&o.setCoordsPoint2D(h),null!==m&&(m[0]=c),!0)}function pe(e,t,s,n,i,r){const o={stack:[],error:void 0,hasError:!1};try{if(n>=r)return!1;const m=B(o,new N,!1);k.greatEllipticDistance(e,t,i.x,i.y,s.x,s.y,m,null,null);return m.val+n<r}catch(m){o.error=m,o.hasError=!0}finally{Y(o)}}function Pe(e,t,s,n,i,r,o,m){const a=A(e,t,n,75/180*Math.PI);return!!pe(e,t,n,i,n,a)&&(null!==r&&(r.setCoordsPoint2D(n),r.scale(1/s)),null!==o&&o.setCoordsPoint2D(n),null!==m&&(m[0]=a),!0)}function xe(e,t){return new X(e,t)}function ye(e){return V(e,0)||K(e,0),e}class be{constructor(e){this.m_bRunningInGnomonic=!1,this.m_bNeedsSimplify=!1,this.m_gnomonic=null,this.m_gnomonicCenterRad=new ee,this.m_minGnomonicRadius=Number.NaN,this.m_progressTracker=e}isRunningInGnomonic(){return this.m_bRunningInGnomonic}needsSimplify(){return this.m_bNeedsSimplify}getGnomonic(){return this.m_gnomonic}}class we extends be{constructor(e,t,s){super(e.m_progressTracker),this.m_segIter=null,this.m_bNextSegmentCannotJoin=!1,this.m_currentDensifiedDelta=[0],this.m_currentBufferedDelta=0,this.m_lastAzimuth=0,this.m_startAzimuth=[0],this.m_endAzimuth=[0],this.m_numWinds=0,this.m_debugCounter=0,this.m_bufferHelper=new O,this.m_densifiedPoints=[],this.m_bufferer=e,this.m_multiPath=t,this.m_densified=s,this.m_bNeedsSimplify=!0;const n=new _;this.m_multiPath.queryEnvelope(n);const i=n.getCenter(),r=i.clone();r.scale(this.m_bufferer.m_rpu),this.m_gnomonic=xe(this.m_bufferer.m_gcs,i),this.m_gnomonicCenterRad=r.clone(),this.m_minGnomonicRadius=A(this.m_bufferer.m_a,this.m_bufferer.m_eSquared,r,75/180*Math.PI)}next(){let e;if(this.m_bNextSegmentCannotJoin)return this.m_bNextSegmentCannotJoin=!1,this.m_segIter.nextSegment(),e=this.m_bufferHelper.clone(),e;if(null===this.m_segIter){if(this.m_segIter=this.m_multiPath.getImpl().querySegmentIterator(),!this.m_segIter.nextPath())return null;null!==this.m_densified&&this.m_densified.addPathPoint2D(null,0,!0)}if(!this.m_segIter.hasNextSegment()){if(!this.m_segIter.nextPath())return null;null!=this.m_densified&&this.m_densified.addPathPoint2D(null,0,!0)}let t=null;this.m_currentBufferedDelta=0,this.m_currentDensifiedDelta=[0],this.m_numWinds=0,this.m_lastAzimuth=Number.NaN,this.m_bNextSegmentCannotJoin=!1,this.m_densifiedPoints.length=0;const s=16;let n=0;const i=new ee,r=new ee;for(;this.m_segIter.hasNextSegment()&&this.m_numWinds<s;){const e=this.m_segIter.nextSegment();if(i.setCoordsPoint2D(e.getStartXY()),r.setCoordsPoint2D(e.getEndXY()),i.scale(this.m_bufferer.m_rpu),r.scale(this.m_bufferer.m_rpu),E(i,r))i.x=r.x;else if(q(i,r))r.x=i.x;else{let e=-1,t=-1;const s=this.m_segIter.getPathIndex(),n=this.m_multiPath.getPathStart(s),o=this.m_multiPath.getPathEnd(s);if(e=this.m_segIter.getStartPointIndex()-1,t=this.m_segIter.getEndPointIndex()+1,e<n&&(e=this.m_multiPath.isClosedPath(s)?o-1:-1),t>o-1&&(t=this.m_multiPath.isClosedPath(s)?n:-1),-1!==e){const t=this.m_multiPath.getXY(e);t.scale(this.m_bufferer.m_rpu),q(t,i)&&(i.x=t.x)}if(-1!==t){const e=this.m_multiPath.getXY(t);e.scale(this.m_bufferer.m_rpu),E(r,e)&&(r.x=e.x)}}this.m_densifiedPoints.length=0;const s=R(this.m_bufferer.m_a,this.m_bufferer.m_eSquared,this.m_bufferer.m_curveType,i,r,this.m_bufferer.m_segmentStep,Number.NaN,this.m_bufferer.m_radTolerance,this.m_startAzimuth,this.m_endAzimuth,this.m_densifiedPoints,this.m_currentDensifiedDelta);if(0===n)this.m_bRunningInGnomonic=this.isSegmentBufferInCurrentGnomonic(this.m_densifiedPoints),this.m_bRunningInGnomonic||(this.m_bRunningInGnomonic=this.tryUpdateGnomonic(this.m_densifiedPoints));else if(this.m_bRunningInGnomonic){if(!this.isSegmentBufferInCurrentGnomonic(this.m_densifiedPoints)){this.m_segIter.previousSegment(),this.m_segIter.previousSegment(),this.m_segIter.nextSegment();break}}else{if(ge(this.m_bufferer.m_a,this.m_bufferer.m_eSquared,this.m_bufferer.m_rpu,this.m_densifiedPoints,this.m_bufferer.m_absDistance*this.m_bufferer.m_ellipticToGeodesicMaxRatio,null,null,null)){this.m_segIter.previousSegment(),this.m_segIter.previousSegment(),this.m_segIter.nextSegment();break}}if(0===s||z(i,r)?(this.m_bufferHelper.setEmpty(),this.m_bufferer.bufferPoint2D(i,this.m_bRunningInGnomonic,this.m_bufferHelper),this.m_bNextSegmentCannotJoin=!0):(this.m_bufferHelper.setEmpty(),this.m_bNextSegmentCannotJoin=this.checkAndPrepSegmentForCrossingAzimuthsOrPoleWrap(s,this.m_bufferHelper)),this.m_bNextSegmentCannotJoin){this.m_segIter.previousSegment(),this.m_segIter.hasPreviousSegment()?(this.m_segIter.previousSegment(),this.m_segIter.nextSegment()):this.m_segIter.resetToFirstSegment(),null!=this.m_densified&&this.m_densified.insertPointsFromPoints(this.m_densified.getPathCount()-1,-1,this.m_densifiedPoints,0,this.m_densifiedPoints.length-1,!0);break}null!=this.m_densified&&this.m_densified.insertPointsFromPoints(this.m_densified.getPathCount()-1,-1,this.m_densifiedPoints,0,this.m_densifiedPoints.length-1,!0),null===t&&(t=new O,t.addPathPoint2D(null,0,!0)),this.addJoinAndBufferLeftSide(t),n++}if(this.m_currentDensifiedDelta=[0],n>0){const e=this.m_segIter.getStartPointIndex(),s=this.m_segIter.getPathIndex();for(;n>0;){if(this.m_segIter.previousSegment(),i.setCoordsPoint2D(this.m_multiPath.getXY(this.m_segIter.getStartPointIndex())),r.setCoordsPoint2D(this.m_multiPath.getXY(this.m_segIter.getEndPointIndex())),i.scale(this.m_bufferer.m_rpu),r.scale(this.m_bufferer.m_rpu),this.m_bRunningInGnomonic)if(E(i,r))i.x=r.x;else if(q(i,r))r.x=i.x;else{let e=-1,t=-1;const s=this.m_segIter.getPathIndex(),n=this.m_multiPath.getPathStart(s),o=this.m_multiPath.getPathEnd(s);if(e=this.m_segIter.getStartPointIndex()-1,t=this.m_segIter.getEndPointIndex()+1,e<n&&(e=this.m_multiPath.isClosedPath(s)?o-1:-1),t>o-1&&(t=this.m_multiPath.isClosedPath(s)?n:-1),-1!==e){const t=this.m_multiPath.getXY(e);t.scale(this.m_bufferer.m_rpu),q(t,i)&&(i.x=t.x)}if(-1!==t){const e=this.m_multiPath.getXY(t);e.scale(this.m_bufferer.m_rpu),E(r,e)&&(r.x=e.x)}}this.m_densifiedPoints.length=0,R(this.m_bufferer.m_a,this.m_bufferer.m_eSquared,this.m_bufferer.m_curveType,r,i,this.m_bufferer.m_segmentStep,Number.NaN,this.m_bufferer.m_radTolerance,this.m_startAzimuth,this.m_endAzimuth,this.m_densifiedPoints,this.m_currentDensifiedDelta),this.addJoinAndBufferLeftSide(t),n--}return i.setCoordsPoint2D(this.m_multiPath.getXY(this.m_segIter.getStartPointIndex())),i.scale(this.m_bufferer.m_rpu),this.m_currentBufferedDelta=ue(this.m_bufferer.m_a,this.m_bufferer.m_eSquared,this.m_bufferer.m_rpu,this.m_bufferer.m_absDistance,i,this.m_lastAzimuth+.5*Math.PI,this.m_lastAzimuth+1.5*Math.PI,this.m_bufferer.m_cornerStep,this.m_bRunningInGnomonic,this.m_currentBufferedDelta,t),this.m_segIter.resetToVertex(e,s),this.m_segIter.nextSegment(),t}return this.m_bNextSegmentCannotJoin=!1,this.m_segIter.nextSegment(),e=this.m_bufferHelper.clone(),e}isSegmentBufferInCurrentGnomonic(e){return null!==this.m_gnomonic&&de(this.m_bufferer.m_a,this.m_bufferer.m_eSquared,e,this.m_bufferer.m_absDistance*this.m_bufferer.m_ellipticToGeodesicMaxRatio,this.m_gnomonicCenterRad,this.m_minGnomonicRadius)}tryUpdateGnomonic(e){const t=new ee,s=new ee,n=[0];return ge(this.m_bufferer.m_a,this.m_bufferer.m_eSquared,this.m_bufferer.m_rpu,e,this.m_bufferer.m_absDistance*this.m_bufferer.m_ellipticToGeodesicMaxRatio,t,s,n)?(this.m_gnomonicCenterRad.setCoordsPoint2D(s),this.m_minGnomonicRadius=n[0],this.m_gnomonic=xe(this.m_bufferer.m_gcs,t),!0):(this.m_gnomonic=null,!1)}checkAndPrepSegmentForCrossingAzimuthsOrPoleWrap(e,t){return this.m_bufferer.checkAndPrepSegmentForCrossingAzimuthsOrPoleWrap(this.m_densifiedPoints,e,this.m_startAzimuth[0],this.m_endAzimuth[0],this.m_bRunningInGnomonic,t)}addJoinAndBufferLeftSide(e){const t=this.m_densifiedPoints[0];let s=Number.NaN,n=this.m_startAzimuth[0]-se;const i=this.m_endAzimuth[0]+se;let r=!1;if(!Number.isNaN(this.m_lastAzimuth)){this.m_lastAzimuth>=this.m_startAzimuth[0]?(s=this.m_lastAzimuth+se,n=s+Math.PI-(this.m_lastAzimuth-this.m_startAzimuth[0])):(s=this.m_lastAzimuth+se,n=s+Math.PI-(ne-(this.m_startAzimuth[0]-this.m_lastAzimuth))),r=!(this.m_lastAzimuth>=this.m_startAzimuth[0]&&this.m_lastAzimuth-this.m_startAzimuth[0]<=Math.PI)&&!(this.m_lastAzimuth<this.m_startAzimuth[0]&&this.m_startAzimuth[0]-this.m_lastAzimuth>=Math.PI);let i=!1;if(Math.abs(n-s)<=.5*this.m_bufferer.m_cornerStep&&(r||(i=!0)),i){if(e.removePointFromPath(0,e.getPointCount()-1),!this.m_bRunningInGnomonic){const t=new ee;t.setCoordsPoint2D(e.getXY(e.getPointCount()-1)),t.scale(this.m_bufferer.m_rpu),t.x-this.m_currentBufferedDelta<-Math.PI?this.m_currentBufferedDelta-=ne:t.x-this.m_currentBufferedDelta>Math.PI&&(this.m_currentBufferedDelta+=ne)}n=.5*(n+s)}else if(r){const s=new ee;s.setCoordsPoint2D(t),s.scale(1/this.m_bufferer.m_rpu),e.insertPoint2D(0,-1,s)}else ue(this.m_bufferer.m_a,this.m_bufferer.m_eSquared,this.m_bufferer.m_rpu,this.m_bufferer.m_absDistance,this.m_densifiedPoints[0],s,n,this.m_bufferer.m_cornerStep,this.m_bRunningInGnomonic,this.m_currentBufferedDelta,e)}this.m_startAzimuth[0]!==this.m_lastAzimuth&&this.m_numWinds++,ce(this.m_bufferer.m_a,this.m_bufferer.m_eSquared,this.m_bufferer.m_rpu,this.m_bufferer.m_absDistance,this.m_bufferer.m_curveType,this.m_densifiedPoints,n,i,this.m_bRunningInGnomonic,this.m_currentBufferedDelta,e),this.m_lastAzimuth=this.m_endAzimuth[0]}}class Ce extends be{constructor(e,t){super(e.m_progressTracker),this.m_pointIndex=-1,this.m_bufferer=e,this.m_multiPoint=t,this.m_bNeedsSimplify=!1;const s=new _;this.m_multiPoint.queryEnvelope(s);const n=s.getCenter(),i=n.clone();i.scale(this.m_bufferer.m_rpu),this.m_gnomonic=xe(this.m_bufferer.m_gcs,n),this.m_gnomonicCenterRad=i.clone(),this.m_minGnomonicRadius=A(this.m_bufferer.m_a,this.m_bufferer.m_eSquared,i,75/180*Math.PI)}next(){if(this.m_bNeedsSimplify=!1,++this.m_pointIndex===this.m_multiPoint.getPointCount())return null;const e=this.m_multiPoint.getXY(this.m_pointIndex);e.scale(this.m_bufferer.m_rpu),this.m_bRunningInGnomonic=this.isPointBufferInCurrentGnomonic(e),this.m_bRunningInGnomonic||(this.m_bRunningInGnomonic=this.tryUpdateGnomonic(e));const t=new O,s=this.m_bufferer.bufferPoint2D(e,this.m_bRunningInGnomonic,t);return this.m_bNeedsSimplify=s,t}isPointBufferInCurrentGnomonic(e){return null!==this.m_gnomonic&&pe(this.m_bufferer.m_a,this.m_bufferer.m_eSquared,e,this.m_bufferer.m_absDistance*this.m_bufferer.m_ellipticToGeodesicMaxRatio,this.m_gnomonicCenterRad,this.m_minGnomonicRadius)}tryUpdateGnomonic(e){const t=new ee,s=new ee,n=[0];return Pe(this.m_bufferer.m_a,this.m_bufferer.m_eSquared,this.m_bufferer.m_rpu,e,this.m_bufferer.m_absDistance*this.m_bufferer.m_ellipticToGeodesicMaxRatio,t,s,n)?(this.m_gnomonicCenterRad.setCoordsPoint2D(s),this.m_minGnomonicRadius=n[0],this.m_gnomonic=xe(this.m_bufferer.m_gcs,t),!0):(this.m_gnomonic=null,!1)}}class ve{getOperatorType(){return 10110}supportsCurves(){return!0}accelerateGeometry(e,t,s){return!1}canAccelerateGeometry(e){return!1}executeMany(e,t,s,n,i,r,o,m){if(o){const o=new Se(e,t,s,n,i,!1,r,m);return(new f).executeMany(o,t,m)}return new Se(e,t,s,n,i,!1,r,m)}execute(t,n,i,r,o,m,a){const h=new e([t]),c=[r],u=this.executeMany(h,n,i,c,o,!1,m,a).next();return u||s("geodesic buffer null output"),u}}class Se extends t{constructor(e,t,s,r,o,m,a,h){super(),this.m_currentUnionEnvelope2D=new _,this.m_index=-1,this.m_dindex=-1,this.m_progressTracker=h,m&&n(""),t||i("");0===t.getCoordinateSystemType()&&i(""),this.m_inputGeoms=e,this.m_spatialReference=t,this.m_curveType=s,this.m_distances=r,this.m_convergenceOffset=o,this.m_bOutlineOnly=m,this.m_bUnion=a}next(){let e;for(;e=this.m_inputGeoms.next();)return r(e),this.m_index=this.m_inputGeoms.getGeometryID(),this.m_dindex+1<this.m_distances.length&&this.m_dindex++,this.geodesicBuffer(e,this.m_distances[this.m_dindex]);return null}getGeometryID(){return this.m_index}tock(){return!0}getRank(){return 1}geodesicBuffer(e,t){return me(e,this.m_spatialReference,this.m_curveType,t,this.m_convergenceOffset,this.m_progressTracker)}}export{ve as OperatorGeodesicBuffer};
@@ -2,4 +2,4 @@
2
2
  All material copyright ESRI, All Rights Reserved, unless otherwise specified.
3
3
  See https://js.arcgis.com/4.34/esri/copyright.txt for details.
4
4
  */
5
- import{a as e,c as t,G as i,d as s,g as n}from"./Geometry.js";import{a,x as _,L as r}from"./MultiPathImpl.js";import{O as h}from"./OperatorDensify.js";import{g as o,L as m,F as l,aj as p,O as u,aG as c,v as g,o as d,af as f,am as E,aY as P,aZ as S,a7 as A,a8 as x,a9 as y,a_ as R,ah as M,ac as C}from"./UnitFactory.js";import{P as T,K as w,d as N,k as q,o as b,a as I,E as v,n as $,f as z,c as O,x as D,y as G,z as L}from"./Point2D.js";import{Envelope2D as k}from"./Envelope2D.js";import{c as F,d as J}from"./Envelope.js";import{O as Y}from"./OperatorClip.js";import{O as U}from"./OperatorShapePreservingLength.js";import{__addDisposableResource as X,__disposeResources as j}from"tslib";import{T as B}from"./Transformation2D.js";import{a as H}from"./GeodeticDistanceCalculator-Ce-woMPw.js";class Q{constructor(e,t,i,s,n=100){this.m_startPt=e.clone(),this.m_endPt=t.clone(),this.m_cE2=s,this.m_cE=Math.sqrt(this.m_cE2),this.m_c1By2e=1/(2*this.m_cE),this.m_cRpu=i.getGCS().getUnit().getUnitToBaseFactor(),this.isPcs=2===i.getCoordinateSystemType(),this.PEProjcs=i.getPECoordSys(),this.m_points=N(2*n,Number.NaN)}setSegmentEndPoints(e,t){this.m_startPt.assign(e),this.m_endPt.assign(t)}makeFunctor(){return e=>{const t=[0,0];t[0]=this.m_startPt.x*(1-e)+this.m_endPt.x*e,t[1]=this.m_startPt.y*(1-e)+this.m_endPt.y*e,this.isPcs&&p.projToGeogCenter(this.PEProjcs,1,t,0);const i=Math.sin(t[1]*this.m_cRpu);if(0===this.m_cE2)return i;return-Math.log((1-this.m_cE*i)/(1+this.m_cE*i))*this.m_c1By2e+i/(1-this.m_cE2*i*i)}}}function V(e,t,i){const s=new k;e.queryEnvelope(s);const n=F(t,s,!0).total(),a=t.getPannableExtent();a.xmin=s.xmin-10*n,a.xmax=s.xmax+10*n;const r=(new Y).execute(e,a,t,i).getImpl().querySegmentIterator();r.stripAttributes();const h=l();t.querySpheroidData(h);const o=h.e2,m=0===o?2:1,p=new T(0,0),u=new T(0,0),c=new w(0),g=new Q(p,u,t,o,100);for(;r.nextPath();)for(;r.hasNextSegment();){const e=r.nextSegment();p.assign(e.getStartXY()),u.assign(e.getEndXY()),g.setSegmentEndPoints(p,u);const t=_(6,0,1,1e-12,1e-15,g.makeFunctor());c.pe((u.x-p.x)*t)}const d=h.majorSemiAxis;return m*d*d*(1-o)*Math.PI*c.getResult()/t.getPannableExtent().width()}function Z(e,t,i,s,n){const a=se(e,t,n);let _=W(e,a.first,i,s,n),r=1,h=0,o=0;do{if(r++,a.first*=.5,a.first<50*t.getTolerance(0))return _;a.second*=2,o=W(e,a.first,i,s,n),h=Math.abs(o-_),_=o}while(Math.abs(_)>1&&h>1e-8*Math.abs(_)&&(a.second<65e3&&r<8||r<4));return o}function W(e,t,i,s,n){const a=(new h).execute(e,t,0,0,n);let _;_=s?(new u).execute(a,s,n):a;const r=1===i.getUnit().getUnitToBaseFactor()?Math.PI/180:1,o=new k;_.queryEnvelope(o);const m=new k,l=new k,p=new k;m.setCoords({xmin:o.xmin,ymin:75*r,xmax:o.xmax,ymax:90*r}),l.setCoords({xmin:o.xmin,ymin:-60*r,xmax:o.xmax,ymax:75*r}),p.setCoords({xmin:o.xmin,ymin:-90*r,xmax:o.xmax,ymax:-60*r}),m.inflateCoords(.01*m.width(),0),l.inflateCoords(.01*l.width(),0),p.inflateCoords(.01*p.width(),0);let c=0;return c+=K(_,m,i,n),c+=K(_,l,i,n),c+=K(_,p,i,n),c}function K(e,t,i,s){const n=(new Y).execute(e,t,i,s);if(null!==n&&!n.isEmpty()){const e=new k;n.queryEnvelope(e);const{first:t,second:a}=ie(i,e,!1),_=o(i,t,null),r=(new u).execute(n,_,s).calculateArea2D();return a&&t.destroy(),r}return 0}const ee=[null,null,null,null,null,null,null];function te(e,t,i){const a=e.getUnit().getUnitToBaseFactor(),_=t.getCenter();_.scale(180*a/Math.PI);const r=new T;r.x=0,r.y=0;let h=0;if(0===h){_.y>45?(r.y=b,h=0):_.y<-45?(r.y=-b,h=1):_.x>=45&&_.x<135?(r.x=b,h=2):_.x>=135||_.x<-135?(r.x=b,h=3):_.x<-45&&_.x>=-135?(r.x=-b,h=4):(r.x=0,h=5);const e=a*Math.sqrt(I(t.xmin-t.xmax)+I(t.ymin-t.ymax)),i=r.clone(),s=t.getCenter();s.scale(a),h<2&&(i.x=s.x);if(T.distance(i,s)+.5*e>b)return null}const o=ee[h];if(null!==o&&o.getGCS().equalHorizontal(e))return o;const m=e.getText(),l=r.x,p=r.y,u=0,f=0;let E=0,P=-1;6!==h?P=c.PE_PRJ_LAMBERT_AZIMUTHAL_EQAREA:(n(i),E=0,P=c.PE_PRJ_CYLINDRICAL_EQAREA);const S=g("EqualAreaPCS");let A;P===c.PE_PRJ_LAMBERT_AZIMUTHAL_EQAREA?A=`PROJCS["${S}",${m},PROJECTION["Lambert_Azimuthal_Equal_Area"],PARAMETER["False_Easting",${u}],PARAMETER["False_Northing",${f}],PARAMETER["Central_Meridian",${l}],PARAMETER["Latitude_of_Origin",${p}],UNIT["Meter",1.0]]`:P===c.PE_PRJ_CYLINDRICAL_EQAREA?A=`PROJCS["${S}",${m},PROJECTION["Cylindrical_Equal_Area"],PARAMETER["False_Easting",${u}],PARAMETER["False_Northing",${f}],PARAMETER["Central_Meridian",${l}],PARAMETER["Standard_Parallel_1",${E}],PARAMETER["Latitude_of_Origin",${p}],UNIT["Meter",1.0]]`:s("getEqualAreaPcsFixed");const x=d(A);return ee[h]&&ee[h].destroy(),ee[h]=x,x}function ie(e,t,i){const n=te(e,t,i);if(null!==n)return q(n,!1);const a=e.getText(),_=e.getUnit().getUnitToBaseFactor(),r=(t.xmin+t.width()/2)*_,h=(t.ymin+t.height()/2)*_,o=0,m=0;let l=0,p=0,u=-1;t.ymin*_>=75*Math.PI/180||t.ymax*_<=-60*Math.PI/180?u=c.PE_PRJ_LAMBERT_AZIMUTHAL_EQAREA:t.ymin>0||t.ymax<0?(l=(t.ymin+1/3*t.height())*_,p=(t.ymin+2/3*t.height())*_,u=c.PE_PRJ_ALBERS):(l=(t.ymin+2/3*t.height())*_,u=c.PE_PRJ_CYLINDRICAL_EQAREA);const f=g("EqualAreaPCS");let E;return u===c.PE_PRJ_LAMBERT_AZIMUTHAL_EQAREA?E=`PROJCS["${f}",${a},PROJECTION["Lambert_Azimuthal_Equal_Area"],PARAMETER["False_Easting",${o}],PARAMETER["False_Northing",${m}],PARAMETER["Central_Meridian",${r}],PARAMETER["Latitude_of_Origin",${h}],UNIT["Meter",1.0]]`:u===c.PE_PRJ_ALBERS?E=`PROJCS["${f}",${a},PROJECTION["Albers"],PARAMETER["False_Easting",${o}],PARAMETER["False_Northing",${m}],PARAMETER["Central_Meridian",${r}],PARAMETER["Standard_Parallel_1",${l}],PARAMETER["Standard_Parallel_2",${p}],PARAMETER["Latitude_of_Origin",${h}],UNIT["Meter",1.0]]`:u===c.PE_PRJ_CYLINDRICAL_EQAREA?E=`PROJCS["${f}",${a},PROJECTION["Cylindrical_Equal_Area"],PARAMETER["False_Easting",${o}],PARAMETER["False_Northing",${m}],PARAMETER["Central_Meridian",${r}],PARAMETER["Standard_Parallel_1",${l}],PARAMETER["Latitude_of_Origin",${h}],UNIT["Meter",1.0]]`:s("getEqualAreaPCSInstance"),q(d(E),!0)}function se(e,t,i){const s=e.calculateLength2D(),n=(new U).execute(e,t,i)/25e3,a=s/e.getSegmentCount()*2;let _=Math.min(a,s/n);0===_&&(_=1);return q(_,s/_)}class ne{getOperatorType(){return 10314}supportsCurves(){return!0}accelerateGeometry(e,t,i){return!1}canAccelerateGeometry(e){return!1}execute(s,n,_){if(0===n.getCoordinateSystemType()&&e(""),s.isEmpty()||s.getDimension()<2)return 0;if(t(s),s.getGeometryType()===i.enumEnvelope){const e=new a;return e.addEnvelope(s,!1),this.execute(e,n,_)}let r=s;s.getDescription().getAttributeCount()>1&&(r=s.clone(),r.dropAllAttributes());const l=(new h).execute(r,0,n.getTolerance(0),0,_);let p=null;const u=n.getGCS();u!==n&&(p=o(n,u));let c=(new m).execute(l,n,!1,_);return c.isEmpty()?0:(c===s&&(c=s.clone()),n.isPannable()?V(c,n,_):Z(c,n,u,p,_))}}function ae(){return{m_p_PCS:new T,m_factor:Number.NaN,setValues:_e,assign:re}}function _e(e,t){this.m_factor=e,this.m_p_PCS.assign(t)}function re(e){this.m_factor=e.m_factor,this.m_p_PCS.assign(e.m_p_PCS)}class he{constructor(e,t,i,s){this.m_ptStart=new J,this.m_ptEnd=new J,this.m_ptStart.assign(t),this.m_ptEnd.assign(i),this.m_deltaX=this.m_ptEnd.x-this.m_ptStart.x,this.m_deltaY=this.m_ptEnd.y-this.m_ptStart.y,this.m_e=Math.sqrt(e),this.m_e2=e,this.m_c1MinusE2=1-e;const n=Math.sin(s);let a;a=0===this.m_e2?2*n:n*(G(this.m_e*n)+1/(1-this.m_e2*n*n)),this.m_baseA=a}setSegmentEndPoints(e,t){this.m_ptStart.assign(e),this.m_ptEnd.assign(t),this.m_deltaX=this.m_ptEnd.x-this.m_ptStart.x,this.m_deltaY=this.m_ptEnd.y-this.m_ptStart.y}makeFunctor(){return e=>{const t=1-e,i=t*this.m_ptStart.x+e*this.m_ptEnd.x,s=t*this.m_ptStart.y+e*this.m_ptEnd.y,n=t*this.m_ptStart.z+e*this.m_ptEnd.z,a=i*i+s*s,_=n/Math.sqrt(n*n+this.m_c1MinusE2*this.m_c1MinusE2*a);let r;if(0===this.m_e2)r=2*_;else{r=_*(G(this.m_e*_)+1/(1-this.m_e2*_*_))}return(this.m_deltaY*i-this.m_deltaX*s)/a*(r-this.m_baseA)}}}function oe(){return{e:Number.NaN,one_p_e:Number.NaN,one_m_e:Number.NaN,one_m_e_2:Number.NaN,atanh_e_over_e:Number.NaN,half_qp:Number.NaN,f:Number.NaN,z:Number.NaN}}function me(){return{sin_phi:Number.NaN,one_p_sin_phi:Number.NaN,one_m_sin_phi:Number.NaN,one_m_e_2_sin_2_phi:Number.NaN,sin_half_phi_pf:Number.NaN,sin_half_phi_pz:Number.NaN,sin_half_asin_e_sin_phi_pf:Number.NaN,sin_half_asin_e_sin_phi_pz:Number.NaN,atanh_sin_phi:Number.NaN,atanh_esin_phi:Number.NaN,make_negative:!1,initialize:le,changeSign:pe,assign:ue,clone:ce}}function le(e,t,i,s){const n=.5*e;this.sin_phi=Math.sin(e);const a=t*this.sin_phi,_=.5*Math.asin(a);this.one_p_sin_phi=1+this.sin_phi,this.one_m_sin_phi=1-this.sin_phi,this.one_m_e_2_sin_2_phi=(1+a)*(1-a),this.sin_half_phi_pf=Math.sin(n+i),this.sin_half_phi_pz=Math.sin(n+s),this.sin_half_asin_e_sin_phi_pf=Math.sin(_+i),this.sin_half_asin_e_sin_phi_pz=Math.sin(_+s),this.atanh_sin_phi=Math.log(this.sin_half_phi_pf/this.sin_half_phi_pz),this.atanh_esin_phi=Math.log(this.sin_half_asin_e_sin_phi_pf/this.sin_half_asin_e_sin_phi_pz)}function pe(){this.sin_phi=-this.sin_phi;let e=this.one_p_sin_phi;this.one_p_sin_phi=this.one_m_sin_phi,this.one_m_sin_phi=e,e=this.sin_half_phi_pf,this.sin_half_phi_pf=this.sin_half_phi_pz,this.sin_half_phi_pz=e,e=this.sin_half_asin_e_sin_phi_pf,this.sin_half_asin_e_sin_phi_pf=this.sin_half_asin_e_sin_phi_pz,this.sin_half_asin_e_sin_phi_pz=e,this.atanh_sin_phi=-this.atanh_sin_phi,this.atanh_esin_phi=-this.atanh_esin_phi}function ue(e){this.sin_phi=e.sin_phi,this.one_p_sin_phi=e.one_p_sin_phi,this.one_m_sin_phi=e.one_m_sin_phi,this.one_m_e_2_sin_2_phi=e.one_m_e_2_sin_2_phi,this.sin_half_phi_pf=e.sin_half_phi_pf,this.sin_half_phi_pz=e.sin_half_phi_pz,this.sin_half_asin_e_sin_phi_pf=e.sin_half_asin_e_sin_phi_pf,this.sin_half_asin_e_sin_phi_pz=e.sin_half_asin_e_sin_phi_pz,this.atanh_sin_phi=e.atanh_sin_phi,this.atanh_esin_phi=e.atanh_esin_phi,this.make_negative=e.make_negative}function ce(){return{...this}}class ge{constructor(t,i,s){this.m_transformPCS2GCS=null,this.m_scaleToRadians=new B,this.m_scaleToDegrees=new B,this.m_progressTracker=s,n(4!==i),this.m_curveType=i,this.m_inputSR=t,t&&0!==t.getCoordinateSystemType()||e(""),this.m_inputGCS=t.getGCS(),this.m_a=0,this.m_eSquared=0,this.m_b=0,this.m_rpu=0}executePolygonGeodeticArea(e){let t,i=e.clone();if(i.dropAllAttributes(),e.hasNonLinearSegments()){i=(new h).execute(i,0,this.m_inputSR.getTolerance(0),0,this.m_progressTracker)}if(this.m_inputSR.isPannable()){const e=new k;i.queryEnvelope(e);const t=this.m_inputSR.getPannableExtent();if(!t.containsEnvelope(e)){const s=t.getCenterX()-e.getCenterX(),n=new B;n.setShiftCoords(s,0),i.applyTransformation(n),e.move(s,0);const a=new v;t.queryIntervalX(a);const _=new v;e.queryIntervalX(_),i=a.contains(_)?f(i,this.m_inputSR):(new u).foldInto360RangeGeodetic(i,this.m_inputSR,this.m_curveType)}}if(this.m_transformPCS2GCS?(i=(new m).execute(i,this.m_inputSR,!1,this.m_progressTracker),t=i.createInstance(),E(this.m_transformPCS2GCS,i,t,this.m_progressTracker)||(t=(new u).execute(i,this.m_transformPCS2GCS,this.m_progressTracker))):t=(new m).execute(i,this.m_inputGCS,!1,this.m_progressTracker),t.isEmpty())return 0;if(1===this.m_curveType){const e=l();return this.m_inputGCS.querySpheroidData(e),this.m_a=e.majorSemiAxis,this.m_eSquared=e.e2,this.loxodromeArea(t)}const s=t.getImpl();this.m_rpu=this.m_inputGCS.getUnit().getUnitToBaseFactor(),this.m_scaleToRadians.setScale(this.m_rpu),s.applyTransformation(this.m_scaleToRadians),this.m_scaleToDegrees=this.m_scaleToRadians,this.m_scaleToDegrees.invertThis();const n=l();if(this.m_inputGCS.querySpheroidData(n),this.m_a=n.majorSemiAxis,this.m_b=n.minorSemiAxis,this.m_eSquared=n.e2,2===this.m_curveType)return this.executeClippedPolygonGreatEllipticArea(t);{const e={stack:[],error:void 0,hasError:!1};try{const i=P.unit(9101),s=this.m_inputGCS.getPECoordSys(),n=X(e,s.cloneAlterUnits(i),!1);let a,_,r=this.executeClippedPolygonGeodeticArea(t,n,0),h=0;do{h++,a=this.executeClippedPolygonGeodeticArea(t,n,h),_=Math.abs(a-r),r=a}while(Math.abs(a)>1&&_>1e-8*Math.abs(a)&&h<7);return a}catch(a){e.error=a,e.hasError=!0}finally{j(e)}}}executeClippedPolygonGeodeticArea(e,t,i){const s={stack:[],error:void 0,hasError:!1};try{const n=new k;e.queryEnvelope(n);const a=X(s,this.getEqualAreaPCSInstance(t,n),!1),_=e.clone();S(a,_);const r=50,h=_.getImpl().getAttributeStreamRef(0),o=e.getImpl().getAttributeStreamRef(0),m=X(s,new A,!1),l=X(s,new A,!1),u=40,c=[0,0],g=$(ae,u),d=N(u,-1),f=ae(),E=ae();let P,y;const R=a;let M=_.calculateArea2D();const C=new w(0),q=.5*Math.PI,b=1e-10*Math.abs(M)+1e-6,I=e.getPathCount();let v,O,D,G;const L=new T,F=new T,J=new T,Y=new T,U=new T,j=new T;let B,H;for(O=e.getPathStart(0),v=0;v<I;v++,O=D)for(D=e.getPathEnd(v),h.queryPoint2D(D-1<<1,J),o.queryPoint2D(D-1<<1,L),Math.abs(L.y)>q&&(L.y=z(q,L.y)),G=O;G<D;G++,J.assign(Y),L.assign(F)){if(h.queryPoint2D(G<<1,Y),o.queryPoint2D(G<<1,F),Math.abs(F.y)>q&&(F.y=z(q,F.y)),B=T.distance(J,Y),B<r||0===L.y&&0===F.y)continue;x.geodeticDistance(this.m_a,this.m_eSquared,L.x,L.y,F.x,F.y,m,l,null,this.m_curveType);const e=m.val,t=l.val;for(f.setValues(0,J),E.setValues(1,Y),y=i,g[0].assign(E),d[0]=i,P=0;P>=0;){H=.5*(f.m_factor+E.m_factor),x.geodeticCoordinate(this.m_a,this.m_eSquared,L.x,L.y,e*H,t,m,l,this.m_curveType),U.x=m.val,U.y=l.val,c[0]=U.x,c[1]=U.y,p.geogToProj(R,1,c),j.x=c[0],j.y=c[1];const i=-j.offset(f.m_p_PCS,E.m_p_PCS),s=.5*i*T.distance(f.m_p_PCS,E.m_p_PCS);if(C.pe(s),Math.abs(s)>b||Math.abs(s)>0&&y>0)E.setValues(H,j),P++,g[P].assign(E),Math.abs(s)<=b?(y--,d[P-1]=y,d[P]=y):(y=d[P-1],d[P]=y);else{if(P<=0)break;f.assign(E),P--,E.assign(g[P]),y=d[P]}}}return M+=C.getResult(),Math.abs(M)}catch(n){s.error=n,s.hasError=!0}finally{j(s)}}executeClippedPolygonGreatEllipticArea(e){const t=[],i=[],s=new T,n=new T,a=y(1,this.m_eSquared,new T(0,.5*Math.PI)),_=new w(0),r=new w(0),h=new w(0),o=new J,m=new J,l=new k;e.queryLooseEnvelope(l);let p=0;l.containsCoords(l.xmin,0)||(p=Math.abs(l.ymin)<Math.abs(l.ymax)?l.ymin:l.ymax);const u=new he(this.m_eSquared,o,m,p),c=this.m_a*this.m_a,g=e.getImpl().querySegmentIterator();for(g.stripAttributes();g.nextPath();)for(;g.hasNextSegment();){const e=g.nextSegment();s.assign(e.getStartXY()),n.assign(e.getEndXY()),n.x-s.x>Math.PI?s.x+=2*Math.PI:n.x-s.x<-Math.PI&&(n.x+=2*Math.PI),this.splitSegmentCrossingItegralThreshold(e,t,i);for(let i of t)o.assign(y(this.m_a,this.m_eSquared,i.getStartXY())),m.assign(y(this.m_a,this.m_eSquared,i.getEndXY())),u.setSegmentEndPoints(o,m),this.adaptiveIntegrationWithRomberg(u,_);for(let t of i){let e=t.getStartXY(),i=t.getEndXY(),s=p;e.y<0&&(i=O(e,e=i),e.y=-e.y,i.y=-i.y,s=-s);const n=y(1,this.m_eSquared,e),_=y(1,this.m_eSquared,i),o=Math.min(e.y,i.y),m=R(this.m_eSquared,e.x,i.x,s,o);r.pe(m);const l=Math.abs(R(this.m_eSquared,e.x,i.x,o,b)),u=new J;u.setSub(n,a);const g=new J;g.setSub(_,a);const d=new J;d.setCrossProductVector(u,g);let f=c*(l-.5*d.length());f=z(f,i.x-e.x),h.pe(f)}t.length=0,i.length=0}return h.getResult()+c*(.5*(1-this.m_eSquared)*_.getResult()+r.getResult())}getEqualAreaPCSInstance(e,t){const i=t.getCenterX(),s=0,n=0;let a,_;const r=t.height();let h,o;(h=t.ymin>45*Math.PI/180||t.ymax<45*-Math.PI/180)?a=z(.5*Math.PI,t.getCenterY()):(a=t.getCenterY(),_=t.ymin+r*(2/3));const m=g("EqualAreaPCS"),l=e.toString();return o=h?P.fromString(c.PE_TYPE_PROJCS,`PROJCS["${m}", ${l}, PROJECTION["Lambert_Azimuthal_Equal_Area"],PARAMETER["False_Easting",${s}],PARAMETER["False_Northing", ${n}],PARAMETER["Central_Meridian", ${i}], PARAMETER["Latitude_of_Origin", ${a}], UNIT["Meter",1.0]]`):P.fromString(c.PE_TYPE_PROJCS,`PROJCS["${m}", ${l}, PROJECTION["Cylindrical_Equal_Area"],PARAMETER["False_Easting", ${s}],PARAMETER["False_Northing", ${n}],PARAMETER["Central_Meridian", ${i}],PARAMETER["Standard_Parallel_1", ${_}],PARAMETER["Latitude_of_Origin", ${a}],UNIT["Meter",1.0]]`),o}splitSegmentCrossingItegralThreshold(e,t,i){const s=100,n=20,a=n*n,_=y(this.m_a,this.m_eSquared,new T(0,b)),h=y(this.m_a,this.m_eSquared,new T(0,-b)),o=this.splitSegmentPassingThroughPole(e);for(let m of o){const e=m.getStartXY(),o=m.getEndXY(),l=y(this.m_a,this.m_eSquared,e),p=y(this.m_a,this.m_eSquared,o),u=new T,c=new J;let g=J.sqrDistance(_,l),d=J.sqrDistance(l,p);if(g<=s){if(!(d>a)){i.push(new r({start:e,end:o}));continue}c.assign(p.sub(l)),c.normalizeThis(),c.assign(l.add(c.mul(n))),u.assign(M(this.m_a,this.m_eSquared,c)),i.push(new r({start:e,end:u})),e.assign(u)}if(l.assign(y(this.m_a,this.m_eSquared,e)),g=J.sqrDistance(_,p),d=J.sqrDistance(l,p),g<=s){if(!(d>a)){i.push(new r({start:e,end:o}));continue}c.assign(p.sub(l)),c.normalizeThis(),c.assign(p.sub(c.mul(n))),u.assign(M(this.m_a,this.m_eSquared,c)),i.push(new r({start:u,end:o})),o.assign(u)}if(l.assign(y(this.m_a,this.m_eSquared,e)),p.assign(y(this.m_a,this.m_eSquared,o)),g=J.sqrDistance(h,l),d=J.sqrDistance(l,p),g<=s){if(!(d>a)){i.push(new r({start:e,end:o}));continue}c.assign(p.sub(l)),c.normalizeThis(),c.assign(l.add(c.mul(n))),u.assign(M(this.m_a,this.m_eSquared,c)),i.push(new r({start:e,end:u})),e.assign(u)}if(l.assign(y(this.m_a,this.m_eSquared,e)),p.assign(y(this.m_a,this.m_eSquared,o)),g=J.sqrDistance(h,p),d=J.sqrDistance(l,p),g<=s){if(!(d>a)){i.push(new r({start:e,end:o}));continue}c.assign(p.sub(l)),c.normalizeThis(),c.assign(p.sub(c.mul(n))),u.assign(M(this.m_a,this.m_eSquared,c)),i.push(new r({start:u,end:o})),o.assign(u)}t.push(new r({start:e,end:o}))}}splitSegmentPassingThroughPole(e){const t={stack:[],error:void 0,hasError:!1};try{const i=[],s=new J,n=new J,a=new J,_=new T,h=20,o=3.124139361,m=10,l=e.getStartXY(),p=e.getEndXY(),u=X(t,new A,!1);if(x.geodeticDistance(this.m_a,this.m_eSquared,l.x,l.y,p.x,p.y,u,null,null,2),Math.abs(p.x-l.x)>o&&u.val>h){const e=new H(new T(0,90),l.divide(this.m_rpu),p.divide(this.m_rpu),this.m_inputGCS,2,2);let t=C(e.makeFunctor(),0,1,1e-10);if(t.second<=m&&t.first>0&&t.first<1)return s.assign(y(this.m_a,this.m_eSquared,l)),n.assign(y(this.m_a,this.m_eSquared,p)),D(s,n,t.first,a),_.assign(M(this.m_a,this.m_eSquared,a)),i.push(new r({start:l,end:_})),i.push(new r({start:_,end:p})),i;if(e.setPointDistFrom(new T(0,-90)),t=C(e.makeFunctor(),0,1,1e-10),t.second<=m&&t.first>0&&t.first<1)return s.assign(y(this.m_a,this.m_eSquared,l)),n.assign(y(this.m_a,this.m_eSquared,p)),D(s,n,t.first,a),_.assign(M(this.m_a,this.m_eSquared,a)),i.push(new r({start:l,end:_})),i.push(new r({start:_,end:p})),i}return i.push(new r({start:l,end:p})),i}catch(i){t.error=i,t.hasError=!0}finally{j(t)}}adaptiveIntegrationWithRomberg(e,t){const i=e.makeFunctor();let s=0,n=1,a=i(s),r=i(n);const h=1e-17,o=1e-14;let m=(s+n)/2,l=i(m),p=Math.abs(l-a),u=Math.abs(r-l),c=0;for(;c++<32&&(p/u<.1||u/p<.1);)p<u?(t.pe(_(5,s,m,o,h,i)),s=m,a=l):(t.pe(_(5,m,n,o,h,i)),n=m,r=l),m=(s+n)/2,l=Math.abs(i(m)),p=Math.abs(l-a),u=Math.abs(r-l);t.pe(_(5,s,n,o,h,i))}loxodromeAreaHemi(e,t,i,s,n){const a=i.clone(),_=n.clone();let r,h,o,m,l,p,u,c,g,d,f,E,P,S,A,x;return a.make_negative&&a.changeSign(),_.make_negative&&_.changeSign(),f=s-t,1===Math.abs(a.sin_phi)||1===Math.abs(_.sin_phi)?e.half_qp*f:a.sin_phi===_.sin_phi?(d=.5*e.one_m_e_2*a.sin_phi*(1/a.one_m_e_2_sin_2_phi+G(e.e*a.sin_phi))*f,d):(A=Math.log(_.sin_half_phi_pf*a.sin_half_phi_pz/(_.sin_half_phi_pz*a.sin_half_phi_pf)),x=Math.log(_.sin_half_asin_e_sin_phi_pf*a.sin_half_asin_e_sin_phi_pz/(_.sin_half_asin_e_sin_phi_pz*a.sin_half_asin_e_sin_phi_pf)),1===this.m_eSquared?(l=0,r=.5*(A+_.sin_phi/_.one_m_e_2_sin_2_phi-a.sin_phi/a.one_m_e_2_sin_2_phi),h=0):(l=-2*e.atanh_e_over_e*(Math.log(_.one_p_sin_phi/a.one_p_sin_phi)-e.e*x),r=(A-e.e*x)/e.one_m_e_2,h=(Math.log(_.one_m_e_2_sin_2_phi/a.one_m_e_2_sin_2_phi)+l/e.atanh_e_over_e)/e.one_m_e_2),o=-x*(a.atanh_esin_phi+_.atanh_esin_phi),m=1/a.one_m_e_2_sin_2_phi-1/_.one_m_e_2_sin_2_phi,p=L(_.one_m_sin_phi/e.one_p_e,e.e)-L(a.one_m_sin_phi/e.one_p_e,e.e),u=L(_.one_p_sin_phi/e.one_p_e,e.e)-L(a.one_p_sin_phi/e.one_p_e,e.e),c=L(a.one_m_sin_phi/-e.one_m_e,e.e)-L(_.one_m_sin_phi/-e.one_m_e,e.e),g=L(a.one_p_sin_phi/-e.one_m_e,e.e)-L(_.one_p_sin_phi/-e.one_m_e,e.e),d=.25/r*(h+o+m+l+.5*(p+u+c+g)),d+=e.half_qp,E=.5*e.one_m_e_2*a.sin_phi*(1/a.one_m_e_2_sin_2_phi+G(e.e*a.sin_phi)),P=.5*e.one_m_e_2*_.sin_phi*(1/_.one_m_e_2_sin_2_phi+G(e.e*_.sin_phi)),P<E&&(S=E,E=P,P=S),d<E&&(d=E),d>P&&(d=P),d*=f,d)}loxodromeArea(e){const t=Math.PI/180;let i=0;const s=oe(),n=me(),a=me();s.e=Math.sqrt(this.m_eSquared),s.one_p_e=1+s.e,s.one_m_e=1-s.e,s.one_m_e_2=1-this.m_eSquared,s.atanh_e_over_e=G(s.e),this.m_eSquared>=1?s.half_qp=1:s.half_qp=.5*(1+s.atanh_e_over_e*s.one_m_e_2),s.f=.25*Math.PI,s.z=.75*Math.PI,a.initialize(0,s.e,s.f,s.z);const _=e.getPathCount(),r=new T,h=new T,o=e.getImpl().getAttributeStreamRef(0);for(let m=0;m<_;m++){const _=e.getPathStart(m),l=e.getPathEnd(m);if(!(l-_<=1)){o.queryPoint2D(2*(l-1),r);for(let e=_;e<l;e++){o.queryPoint2D(2*e,h);const m=r.y*t,l=h.y*t;if(e===_?(n.initialize(m,s.e,s.f,s.z),n.make_negative=!1):n.assign(a),a.initialize(l,s.e,s.f,s.z),a.make_negative=!1,r.y*h.y<0){if(r.y>=90&&h.y<=-90||h.y>=90&&r.y<=-90)return Number.NaN;const e=me();e.initialize(0,s.e,s.f,s.z),e.make_negative=!1;const _=n.atanh_sin_phi-s.e*n.atanh_esin_phi,o=a.atanh_sin_phi-s.e*a.atanh_esin_phi,l=(o*r.x-_*h.x)/(o-_);m<0?(n.make_negative=!0,i-=this.loxodromeAreaHemi(s,r.x*t,n,l*t,e),n.make_negative=!1,i+=this.loxodromeAreaHemi(s,l*t,e,h.x*t,a)):(i+=this.loxodromeAreaHemi(s,r.x*t,n,l*t,e),a.make_negative=!0,i-=this.loxodromeAreaHemi(s,l*t,e,h.x*t,a),a.make_negative=!1)}else r.y>=0?i+=this.loxodromeAreaHemi(s,r.x*t,n,h.x*t,a):(n.make_negative=!0,a.make_negative=!0,i-=this.loxodromeAreaHemi(s,r.x*t,n,h.x*t,a),n.make_negative=!1,a.make_negative=!1);r.assign(h)}}}return this.m_a*i*this.m_a}calculate(e){if(e.isEmpty()||e.getDimension()<2)return 0;if(e.getGeometryType()===i.enumEnvelope){const t=new a;return t.addEnvelope(e,!1),this.calculate(t)}return this.m_inputSR!==this.m_inputGCS&&null===this.m_transformPCS2GCS&&(this.m_transformPCS2GCS=o(this.m_inputSR,this.m_inputGCS,null)),this.executePolygonGeodeticArea(e)}}class de{getOperatorType(){return 10311}supportsCurves(){return!0}accelerateGeometry(e,t,i){return!1}canAccelerateGeometry(e){return!1}execute(e,i,s,n){if(t(e),4===s)return(new ne).execute(e,i,n);return new ge(i,s,n).calculate(e)}}export{de as OperatorGeodeticArea};
5
+ import{a as e,c as t,G as i,d as s,g as n}from"./Geometry.js";import{a,x as _,L as r}from"./MultiPathImpl.js";import{O as h}from"./OperatorDensify.js";import{E as o,L as m,r as l,ac as p,O as u,aG as c,i as g,b as d,a7 as E,a9 as f,aY as P,aZ as S,aa as A,ab as x,ad as y,a_ as R,ak as M,ag as C}from"./UnitFactory.js";import{P as T,K as w,d as N,l as q,o as b,a as I,E as v,k as $,f as z,c as O,x as D,y as G,z as k}from"./Point2D.js";import{Envelope2D as L}from"./Envelope2D.js";import{c as F,d as J}from"./Envelope.js";import{O as Y}from"./OperatorClip.js";import{O as U}from"./OperatorShapePreservingLength.js";import{__addDisposableResource as X,__disposeResources as j}from"tslib";import{T as B}from"./Transformation2D.js";import{a as H}from"./GeodeticDistanceCalculator-Ce-woMPw.js";class Q{constructor(e,t,i,s,n=100){this.m_startPt=e.clone(),this.m_endPt=t.clone(),this.m_cE2=s,this.m_cE=Math.sqrt(this.m_cE2),this.m_c1By2e=1/(2*this.m_cE),this.m_cRpu=i.getGCS().getUnit().getUnitToBaseFactor(),this.isPcs=2===i.getCoordinateSystemType(),this.PEProjcs=i.getPECoordSys(),this.m_points=N(2*n,Number.NaN)}setSegmentEndPoints(e,t){this.m_startPt.assign(e),this.m_endPt.assign(t)}makeFunctor(){return e=>{const t=[0,0];t[0]=this.m_startPt.x*(1-e)+this.m_endPt.x*e,t[1]=this.m_startPt.y*(1-e)+this.m_endPt.y*e,this.isPcs&&p.projToGeogCenter(this.PEProjcs,1,t,0);const i=Math.sin(t[1]*this.m_cRpu);if(0===this.m_cE2)return i;return-Math.log((1-this.m_cE*i)/(1+this.m_cE*i))*this.m_c1By2e+i/(1-this.m_cE2*i*i)}}}function V(e,t,i){const s=new L;e.queryEnvelope(s);const n=F(t,s,!0).total(),a=t.getPannableExtent();a.xmin=s.xmin-10*n,a.xmax=s.xmax+10*n;const r=(new Y).execute(e,a,t,i).getImpl().querySegmentIterator();r.stripAttributes();const h=l();t.querySpheroidData(h);const o=h.e2,m=0===o?2:1,p=new T(0,0),u=new T(0,0),c=new w(0),g=new Q(p,u,t,o,100);for(;r.nextPath();)for(;r.hasNextSegment();){const e=r.nextSegment();p.assign(e.getStartXY()),u.assign(e.getEndXY()),g.setSegmentEndPoints(p,u);const t=_(6,0,1,1e-12,1e-15,g.makeFunctor());c.pe((u.x-p.x)*t)}const d=h.majorSemiAxis;return m*d*d*(1-o)*Math.PI*c.getResult()/t.getPannableExtent().width()}function Z(e,t,i,s,n){const a=se(e,t,n);let _=W(e,a.first,i,s,n),r=1,h=0,o=0;do{if(r++,a.first*=.5,a.first<50*t.getTolerance(0))return _;a.second*=2,o=W(e,a.first,i,s,n),h=Math.abs(o-_),_=o}while(Math.abs(_)>1&&h>1e-8*Math.abs(_)&&(a.second<65e3&&r<8||r<4));return o}function W(e,t,i,s,n){const a=(new h).execute(e,t,0,0,n);let _;_=s?(new u).execute(a,s,n):a;const r=1===i.getUnit().getUnitToBaseFactor()?Math.PI/180:1,o=new L;_.queryEnvelope(o);const m=new L,l=new L,p=new L;m.setCoords({xmin:o.xmin,ymin:75*r,xmax:o.xmax,ymax:90*r}),l.setCoords({xmin:o.xmin,ymin:-60*r,xmax:o.xmax,ymax:75*r}),p.setCoords({xmin:o.xmin,ymin:-90*r,xmax:o.xmax,ymax:-60*r}),m.inflateCoords(.01*m.width(),0),l.inflateCoords(.01*l.width(),0),p.inflateCoords(.01*p.width(),0);let c=0;return c+=K(_,m,i,n),c+=K(_,l,i,n),c+=K(_,p,i,n),c}function K(e,t,i,s){const n=(new Y).execute(e,t,i,s);if(null!==n&&!n.isEmpty()){const e=new L;n.queryEnvelope(e);const{first:t,second:a}=ie(i,e,!1),_=o(i,t,null),r=(new u).execute(n,_,s).calculateArea2D();return a&&t.destroy(),r}return 0}const ee=[null,null,null,null,null,null,null];function te(e,t,i){const a=e.getUnit().getUnitToBaseFactor(),_=t.getCenter();_.scale(180*a/Math.PI);const r=new T;r.x=0,r.y=0;let h=0;if(0===h){_.y>45?(r.y=b,h=0):_.y<-45?(r.y=-b,h=1):_.x>=45&&_.x<135?(r.x=b,h=2):_.x>=135||_.x<-135?(r.x=b,h=3):_.x<-45&&_.x>=-135?(r.x=-b,h=4):(r.x=0,h=5);const e=a*Math.sqrt(I(t.xmin-t.xmax)+I(t.ymin-t.ymax)),i=r.clone(),s=t.getCenter();s.scale(a),h<2&&(i.x=s.x);if(T.distance(i,s)+.5*e>b)return null}const o=ee[h];if(null!==o&&o.getGCS().equalHorizontal(e))return o;const m=e.getText(),l=r.x,p=r.y,u=0,E=0;let f=0,P=-1;6!==h?P=c.PE_PRJ_LAMBERT_AZIMUTHAL_EQAREA:(n(i),f=0,P=c.PE_PRJ_CYLINDRICAL_EQAREA);const S=g("EqualAreaPCS");let A;P===c.PE_PRJ_LAMBERT_AZIMUTHAL_EQAREA?A=`PROJCS["${S}",${m},PROJECTION["Lambert_Azimuthal_Equal_Area"],PARAMETER["False_Easting",${u}],PARAMETER["False_Northing",${E}],PARAMETER["Central_Meridian",${l}],PARAMETER["Latitude_of_Origin",${p}],UNIT["Meter",1.0]]`:P===c.PE_PRJ_CYLINDRICAL_EQAREA?A=`PROJCS["${S}",${m},PROJECTION["Cylindrical_Equal_Area"],PARAMETER["False_Easting",${u}],PARAMETER["False_Northing",${E}],PARAMETER["Central_Meridian",${l}],PARAMETER["Standard_Parallel_1",${f}],PARAMETER["Latitude_of_Origin",${p}],UNIT["Meter",1.0]]`:s("getEqualAreaPcsFixed");const x=d(A);return ee[h]&&ee[h].destroy(),ee[h]=x,x}function ie(e,t,i){const n=te(e,t,i);if(null!==n)return q(n,!1);const a=e.getText(),_=e.getUnit().getUnitToBaseFactor(),r=(t.xmin+t.width()/2)*_,h=(t.ymin+t.height()/2)*_,o=0,m=0;let l=0,p=0,u=-1;t.ymin*_>=75*Math.PI/180||t.ymax*_<=-60*Math.PI/180?u=c.PE_PRJ_LAMBERT_AZIMUTHAL_EQAREA:t.ymin>0||t.ymax<0?(l=(t.ymin+1/3*t.height())*_,p=(t.ymin+2/3*t.height())*_,u=c.PE_PRJ_ALBERS):(l=(t.ymin+2/3*t.height())*_,u=c.PE_PRJ_CYLINDRICAL_EQAREA);const E=g("EqualAreaPCS");let f;return u===c.PE_PRJ_LAMBERT_AZIMUTHAL_EQAREA?f=`PROJCS["${E}",${a},PROJECTION["Lambert_Azimuthal_Equal_Area"],PARAMETER["False_Easting",${o}],PARAMETER["False_Northing",${m}],PARAMETER["Central_Meridian",${r}],PARAMETER["Latitude_of_Origin",${h}],UNIT["Meter",1.0]]`:u===c.PE_PRJ_ALBERS?f=`PROJCS["${E}",${a},PROJECTION["Albers"],PARAMETER["False_Easting",${o}],PARAMETER["False_Northing",${m}],PARAMETER["Central_Meridian",${r}],PARAMETER["Standard_Parallel_1",${l}],PARAMETER["Standard_Parallel_2",${p}],PARAMETER["Latitude_of_Origin",${h}],UNIT["Meter",1.0]]`:u===c.PE_PRJ_CYLINDRICAL_EQAREA?f=`PROJCS["${E}",${a},PROJECTION["Cylindrical_Equal_Area"],PARAMETER["False_Easting",${o}],PARAMETER["False_Northing",${m}],PARAMETER["Central_Meridian",${r}],PARAMETER["Standard_Parallel_1",${l}],PARAMETER["Latitude_of_Origin",${h}],UNIT["Meter",1.0]]`:s("getEqualAreaPCSInstance"),q(d(f),!0)}function se(e,t,i){const s=e.calculateLength2D(),n=(new U).execute(e,t,i)/25e3,a=s/e.getSegmentCount()*2;let _=Math.min(a,s/n);0===_&&(_=1);return q(_,s/_)}class ne{getOperatorType(){return 10314}supportsCurves(){return!0}accelerateGeometry(e,t,i){return!1}canAccelerateGeometry(e){return!1}execute(s,n,_){if(0===n.getCoordinateSystemType()&&e(""),s.isEmpty()||s.getDimension()<2)return 0;if(t(s),s.getGeometryType()===i.enumEnvelope){const e=new a;return e.addEnvelope(s,!1),this.execute(e,n,_)}let r=s;s.getDescription().getAttributeCount()>1&&(r=s.clone(),r.dropAllAttributes());const l=(new h).execute(r,0,n.getTolerance(0),0,_);let p=null;const u=n.getGCS();u!==n&&(p=o(n,u));let c=(new m).execute(l,n,!1,_);return c.isEmpty()?0:(c===s&&(c=s.clone()),n.isPannable()?V(c,n,_):Z(c,n,u,p,_))}}function ae(){return{m_p_PCS:new T,m_factor:Number.NaN,setValues:_e,assign:re}}function _e(e,t){this.m_factor=e,this.m_p_PCS.assign(t)}function re(e){this.m_factor=e.m_factor,this.m_p_PCS.assign(e.m_p_PCS)}class he{constructor(e,t,i,s){this.m_ptStart=new J,this.m_ptEnd=new J,this.m_ptStart.assign(t),this.m_ptEnd.assign(i),this.m_deltaX=this.m_ptEnd.x-this.m_ptStart.x,this.m_deltaY=this.m_ptEnd.y-this.m_ptStart.y,this.m_e=Math.sqrt(e),this.m_e2=e,this.m_c1MinusE2=1-e;const n=Math.sin(s);let a;a=0===this.m_e2?2*n:n*(G(this.m_e*n)+1/(1-this.m_e2*n*n)),this.m_baseA=a}setSegmentEndPoints(e,t){this.m_ptStart.assign(e),this.m_ptEnd.assign(t),this.m_deltaX=this.m_ptEnd.x-this.m_ptStart.x,this.m_deltaY=this.m_ptEnd.y-this.m_ptStart.y}makeFunctor(){return e=>{const t=1-e,i=t*this.m_ptStart.x+e*this.m_ptEnd.x,s=t*this.m_ptStart.y+e*this.m_ptEnd.y,n=t*this.m_ptStart.z+e*this.m_ptEnd.z,a=i*i+s*s,_=n/Math.sqrt(n*n+this.m_c1MinusE2*this.m_c1MinusE2*a);let r;if(0===this.m_e2)r=2*_;else{r=_*(G(this.m_e*_)+1/(1-this.m_e2*_*_))}return(this.m_deltaY*i-this.m_deltaX*s)/a*(r-this.m_baseA)}}}function oe(){return{e:Number.NaN,one_p_e:Number.NaN,one_m_e:Number.NaN,one_m_e_2:Number.NaN,atanh_e_over_e:Number.NaN,half_qp:Number.NaN,f:Number.NaN,z:Number.NaN}}function me(){return{sin_phi:Number.NaN,one_p_sin_phi:Number.NaN,one_m_sin_phi:Number.NaN,one_m_e_2_sin_2_phi:Number.NaN,sin_half_phi_pf:Number.NaN,sin_half_phi_pz:Number.NaN,sin_half_asin_e_sin_phi_pf:Number.NaN,sin_half_asin_e_sin_phi_pz:Number.NaN,atanh_sin_phi:Number.NaN,atanh_esin_phi:Number.NaN,make_negative:!1,initialize:le,changeSign:pe,assign:ue,clone:ce}}function le(e,t,i,s){const n=.5*e;this.sin_phi=Math.sin(e);const a=t*this.sin_phi,_=.5*Math.asin(a);this.one_p_sin_phi=1+this.sin_phi,this.one_m_sin_phi=1-this.sin_phi,this.one_m_e_2_sin_2_phi=(1+a)*(1-a),this.sin_half_phi_pf=Math.sin(n+i),this.sin_half_phi_pz=Math.sin(n+s),this.sin_half_asin_e_sin_phi_pf=Math.sin(_+i),this.sin_half_asin_e_sin_phi_pz=Math.sin(_+s),this.atanh_sin_phi=Math.log(this.sin_half_phi_pf/this.sin_half_phi_pz),this.atanh_esin_phi=Math.log(this.sin_half_asin_e_sin_phi_pf/this.sin_half_asin_e_sin_phi_pz)}function pe(){this.sin_phi=-this.sin_phi;let e=this.one_p_sin_phi;this.one_p_sin_phi=this.one_m_sin_phi,this.one_m_sin_phi=e,e=this.sin_half_phi_pf,this.sin_half_phi_pf=this.sin_half_phi_pz,this.sin_half_phi_pz=e,e=this.sin_half_asin_e_sin_phi_pf,this.sin_half_asin_e_sin_phi_pf=this.sin_half_asin_e_sin_phi_pz,this.sin_half_asin_e_sin_phi_pz=e,this.atanh_sin_phi=-this.atanh_sin_phi,this.atanh_esin_phi=-this.atanh_esin_phi}function ue(e){this.sin_phi=e.sin_phi,this.one_p_sin_phi=e.one_p_sin_phi,this.one_m_sin_phi=e.one_m_sin_phi,this.one_m_e_2_sin_2_phi=e.one_m_e_2_sin_2_phi,this.sin_half_phi_pf=e.sin_half_phi_pf,this.sin_half_phi_pz=e.sin_half_phi_pz,this.sin_half_asin_e_sin_phi_pf=e.sin_half_asin_e_sin_phi_pf,this.sin_half_asin_e_sin_phi_pz=e.sin_half_asin_e_sin_phi_pz,this.atanh_sin_phi=e.atanh_sin_phi,this.atanh_esin_phi=e.atanh_esin_phi,this.make_negative=e.make_negative}function ce(){return{...this}}class ge{constructor(t,i,s){this.m_transformPCS2GCS=null,this.m_scaleToRadians=new B,this.m_scaleToDegrees=new B,this.m_progressTracker=s,n(4!==i),this.m_curveType=i,this.m_inputSR=t,t&&0!==t.getCoordinateSystemType()||e(""),this.m_inputGCS=t.getGCS(),this.m_a=0,this.m_eSquared=0,this.m_b=0,this.m_rpu=0}executePolygonGeodeticArea(e){let t,i=e.clone();if(i.dropAllAttributes(),e.hasNonLinearSegments()){i=(new h).execute(i,0,this.m_inputSR.getTolerance(0),0,this.m_progressTracker)}if(this.m_inputSR.isPannable()){const e=new L;i.queryEnvelope(e);const t=this.m_inputSR.getPannableExtent();if(!t.containsEnvelope(e)){const s=t.getCenterX()-e.getCenterX(),n=new B;n.setShiftCoords(s,0),i.applyTransformation(n),e.move(s,0);const a=new v;t.queryIntervalX(a);const _=new v;e.queryIntervalX(_),i=a.contains(_)?E(i,this.m_inputSR):(new u).foldInto360RangeGeodetic(i,this.m_inputSR,this.m_curveType)}}if(this.m_transformPCS2GCS?(i=(new m).execute(i,this.m_inputSR,!1,this.m_progressTracker),t=i.createInstance(),f(this.m_transformPCS2GCS,i,t,this.m_progressTracker)||(t=(new u).execute(i,this.m_transformPCS2GCS,this.m_progressTracker))):t=(new m).execute(i,this.m_inputGCS,!1,this.m_progressTracker),t.isEmpty())return 0;if(1===this.m_curveType){const e=l();return this.m_inputGCS.querySpheroidData(e),this.m_a=e.majorSemiAxis,this.m_eSquared=e.e2,this.loxodromeArea(t)}const s=t.getImpl();this.m_rpu=this.m_inputGCS.getUnit().getUnitToBaseFactor(),this.m_scaleToRadians.setScale(this.m_rpu),s.applyTransformation(this.m_scaleToRadians),this.m_scaleToDegrees=this.m_scaleToRadians,this.m_scaleToDegrees.invertThis();const n=l();if(this.m_inputGCS.querySpheroidData(n),this.m_a=n.majorSemiAxis,this.m_b=n.minorSemiAxis,this.m_eSquared=n.e2,2===this.m_curveType)return this.executeClippedPolygonGreatEllipticArea(t);{const e={stack:[],error:void 0,hasError:!1};try{const i=P.unit(9101),s=this.m_inputGCS.getPECoordSys(),n=X(e,s.cloneAlterUnits(i),!1);let a,_,r=this.executeClippedPolygonGeodeticArea(t,n,0),h=0;do{h++,a=this.executeClippedPolygonGeodeticArea(t,n,h),_=Math.abs(a-r),r=a}while(Math.abs(a)>1&&_>1e-8*Math.abs(a)&&h<7);return a}catch(a){e.error=a,e.hasError=!0}finally{j(e)}}}executeClippedPolygonGeodeticArea(e,t,i){const s={stack:[],error:void 0,hasError:!1};try{const n=new L;e.queryEnvelope(n);const a=X(s,this.getEqualAreaPCSInstance(t,n),!1),_=e.clone();S(a,_);const r=50,h=_.getImpl().getAttributeStreamRef(0),o=e.getImpl().getAttributeStreamRef(0),m=X(s,new A,!1),l=X(s,new A,!1),u=40,c=[0,0],g=$(ae,u),d=N(u,-1),E=ae(),f=ae();let P,y;const R=a;let M=_.calculateArea2D();const C=new w(0),q=.5*Math.PI,b=1e-10*Math.abs(M)+1e-6,I=e.getPathCount();let v,O,D,G;const k=new T,F=new T,J=new T,Y=new T,U=new T,j=new T;let B,H;for(O=e.getPathStart(0),v=0;v<I;v++,O=D)for(D=e.getPathEnd(v),h.queryPoint2D(D-1<<1,J),o.queryPoint2D(D-1<<1,k),Math.abs(k.y)>q&&(k.y=z(q,k.y)),G=O;G<D;G++,J.assign(Y),k.assign(F)){if(h.queryPoint2D(G<<1,Y),o.queryPoint2D(G<<1,F),Math.abs(F.y)>q&&(F.y=z(q,F.y)),B=T.distance(J,Y),B<r||0===k.y&&0===F.y)continue;x.geodeticDistance(this.m_a,this.m_eSquared,k.x,k.y,F.x,F.y,m,l,null,this.m_curveType);const e=m.val,t=l.val;for(E.setValues(0,J),f.setValues(1,Y),y=i,g[0].assign(f),d[0]=i,P=0;P>=0;){H=.5*(E.m_factor+f.m_factor),x.geodeticCoordinate(this.m_a,this.m_eSquared,k.x,k.y,e*H,t,m,l,this.m_curveType),U.x=m.val,U.y=l.val,c[0]=U.x,c[1]=U.y,p.geogToProj(R,1,c),j.x=c[0],j.y=c[1];const i=-j.offset(E.m_p_PCS,f.m_p_PCS),s=.5*i*T.distance(E.m_p_PCS,f.m_p_PCS);if(C.pe(s),Math.abs(s)>b||Math.abs(s)>0&&y>0)f.setValues(H,j),P++,g[P].assign(f),Math.abs(s)<=b?(y--,d[P-1]=y,d[P]=y):(y=d[P-1],d[P]=y);else{if(P<=0)break;E.assign(f),P--,f.assign(g[P]),y=d[P]}}}return M+=C.getResult(),Math.abs(M)}catch(n){s.error=n,s.hasError=!0}finally{j(s)}}executeClippedPolygonGreatEllipticArea(e){const t=[],i=[],s=new T,n=new T,a=y(1,this.m_eSquared,new T(0,.5*Math.PI)),_=new w(0),r=new w(0),h=new w(0),o=new J,m=new J,l=new L;e.queryLooseEnvelope(l);let p=0;l.containsCoords(l.xmin,0)||(p=Math.abs(l.ymin)<Math.abs(l.ymax)?l.ymin:l.ymax);const u=new he(this.m_eSquared,o,m,p),c=this.m_a*this.m_a,g=e.getImpl().querySegmentIterator();for(g.stripAttributes();g.nextPath();)for(;g.hasNextSegment();){const e=g.nextSegment();s.assign(e.getStartXY()),n.assign(e.getEndXY()),n.x-s.x>Math.PI?s.x+=2*Math.PI:n.x-s.x<-Math.PI&&(n.x+=2*Math.PI),this.splitSegmentCrossingItegralThreshold(e,t,i);for(let i of t)o.assign(y(this.m_a,this.m_eSquared,i.getStartXY())),m.assign(y(this.m_a,this.m_eSquared,i.getEndXY())),u.setSegmentEndPoints(o,m),this.adaptiveIntegrationWithRomberg(u,_);for(let t of i){let e=t.getStartXY(),i=t.getEndXY(),s=p;e.y<0&&(i=O(e,e=i),e.y=-e.y,i.y=-i.y,s=-s);const n=y(1,this.m_eSquared,e),_=y(1,this.m_eSquared,i),o=Math.min(e.y,i.y),m=R(this.m_eSquared,e.x,i.x,s,o);r.pe(m);const l=Math.abs(R(this.m_eSquared,e.x,i.x,o,b)),u=new J;u.setSub(n,a);const g=new J;g.setSub(_,a);const d=new J;d.setCrossProductVector(u,g);let E=c*(l-.5*d.length());E=z(E,i.x-e.x),h.pe(E)}t.length=0,i.length=0}return h.getResult()+c*(.5*(1-this.m_eSquared)*_.getResult()+r.getResult())}getEqualAreaPCSInstance(e,t){const i=t.getCenterX(),s=0,n=0;let a,_;const r=t.height();let h,o;(h=t.ymin>45*Math.PI/180||t.ymax<45*-Math.PI/180)?a=z(.5*Math.PI,t.getCenterY()):(a=t.getCenterY(),_=t.ymin+r*(2/3));const m=g("EqualAreaPCS"),l=e.toString();return o=h?P.fromString(c.PE_TYPE_PROJCS,`PROJCS["${m}", ${l}, PROJECTION["Lambert_Azimuthal_Equal_Area"],PARAMETER["False_Easting",${s}],PARAMETER["False_Northing", ${n}],PARAMETER["Central_Meridian", ${i}], PARAMETER["Latitude_of_Origin", ${a}], UNIT["Meter",1.0]]`):P.fromString(c.PE_TYPE_PROJCS,`PROJCS["${m}", ${l}, PROJECTION["Cylindrical_Equal_Area"],PARAMETER["False_Easting", ${s}],PARAMETER["False_Northing", ${n}],PARAMETER["Central_Meridian", ${i}],PARAMETER["Standard_Parallel_1", ${_}],PARAMETER["Latitude_of_Origin", ${a}],UNIT["Meter",1.0]]`),o}splitSegmentCrossingItegralThreshold(e,t,i){const s=100,n=20,a=n*n,_=y(this.m_a,this.m_eSquared,new T(0,b)),h=y(this.m_a,this.m_eSquared,new T(0,-b)),o=this.splitSegmentPassingThroughPole(e);for(let m of o){const e=m.getStartXY(),o=m.getEndXY(),l=y(this.m_a,this.m_eSquared,e),p=y(this.m_a,this.m_eSquared,o),u=new T,c=new J;let g=J.sqrDistance(_,l),d=J.sqrDistance(l,p);if(g<=s){if(!(d>a)){i.push(new r({start:e,end:o}));continue}c.assign(p.sub(l)),c.normalizeThis(),c.assign(l.add(c.mul(n))),u.assign(M(this.m_a,this.m_eSquared,c)),i.push(new r({start:e,end:u})),e.assign(u)}if(l.assign(y(this.m_a,this.m_eSquared,e)),g=J.sqrDistance(_,p),d=J.sqrDistance(l,p),g<=s){if(!(d>a)){i.push(new r({start:e,end:o}));continue}c.assign(p.sub(l)),c.normalizeThis(),c.assign(p.sub(c.mul(n))),u.assign(M(this.m_a,this.m_eSquared,c)),i.push(new r({start:u,end:o})),o.assign(u)}if(l.assign(y(this.m_a,this.m_eSquared,e)),p.assign(y(this.m_a,this.m_eSquared,o)),g=J.sqrDistance(h,l),d=J.sqrDistance(l,p),g<=s){if(!(d>a)){i.push(new r({start:e,end:o}));continue}c.assign(p.sub(l)),c.normalizeThis(),c.assign(l.add(c.mul(n))),u.assign(M(this.m_a,this.m_eSquared,c)),i.push(new r({start:e,end:u})),e.assign(u)}if(l.assign(y(this.m_a,this.m_eSquared,e)),p.assign(y(this.m_a,this.m_eSquared,o)),g=J.sqrDistance(h,p),d=J.sqrDistance(l,p),g<=s){if(!(d>a)){i.push(new r({start:e,end:o}));continue}c.assign(p.sub(l)),c.normalizeThis(),c.assign(p.sub(c.mul(n))),u.assign(M(this.m_a,this.m_eSquared,c)),i.push(new r({start:u,end:o})),o.assign(u)}t.push(new r({start:e,end:o}))}}splitSegmentPassingThroughPole(e){const t={stack:[],error:void 0,hasError:!1};try{const i=[],s=new J,n=new J,a=new J,_=new T,h=20,o=3.124139361,m=10,l=e.getStartXY(),p=e.getEndXY(),u=X(t,new A,!1);if(x.geodeticDistance(this.m_a,this.m_eSquared,l.x,l.y,p.x,p.y,u,null,null,2),Math.abs(p.x-l.x)>o&&u.val>h){const e=new H(new T(0,90),l.divide(this.m_rpu),p.divide(this.m_rpu),this.m_inputGCS,2,2);let t=C(e.makeFunctor(),0,1,1e-10);if(t.second<=m&&t.first>0&&t.first<1)return s.assign(y(this.m_a,this.m_eSquared,l)),n.assign(y(this.m_a,this.m_eSquared,p)),D(s,n,t.first,a),_.assign(M(this.m_a,this.m_eSquared,a)),i.push(new r({start:l,end:_})),i.push(new r({start:_,end:p})),i;if(e.setPointDistFrom(new T(0,-90)),t=C(e.makeFunctor(),0,1,1e-10),t.second<=m&&t.first>0&&t.first<1)return s.assign(y(this.m_a,this.m_eSquared,l)),n.assign(y(this.m_a,this.m_eSquared,p)),D(s,n,t.first,a),_.assign(M(this.m_a,this.m_eSquared,a)),i.push(new r({start:l,end:_})),i.push(new r({start:_,end:p})),i}return i.push(new r({start:l,end:p})),i}catch(i){t.error=i,t.hasError=!0}finally{j(t)}}adaptiveIntegrationWithRomberg(e,t){const i=e.makeFunctor();let s=0,n=1,a=i(s),r=i(n);const h=1e-17,o=1e-14;let m=(s+n)/2,l=i(m),p=Math.abs(l-a),u=Math.abs(r-l),c=0;for(;c++<32&&(p/u<.1||u/p<.1);)p<u?(t.pe(_(5,s,m,o,h,i)),s=m,a=l):(t.pe(_(5,m,n,o,h,i)),n=m,r=l),m=(s+n)/2,l=Math.abs(i(m)),p=Math.abs(l-a),u=Math.abs(r-l);t.pe(_(5,s,n,o,h,i))}loxodromeAreaHemi(e,t,i,s,n){const a=i.clone(),_=n.clone();let r,h,o,m,l,p,u,c,g,d,E,f,P,S,A,x;return a.make_negative&&a.changeSign(),_.make_negative&&_.changeSign(),E=s-t,1===Math.abs(a.sin_phi)||1===Math.abs(_.sin_phi)?e.half_qp*E:a.sin_phi===_.sin_phi?(d=.5*e.one_m_e_2*a.sin_phi*(1/a.one_m_e_2_sin_2_phi+G(e.e*a.sin_phi))*E,d):(A=Math.log(_.sin_half_phi_pf*a.sin_half_phi_pz/(_.sin_half_phi_pz*a.sin_half_phi_pf)),x=Math.log(_.sin_half_asin_e_sin_phi_pf*a.sin_half_asin_e_sin_phi_pz/(_.sin_half_asin_e_sin_phi_pz*a.sin_half_asin_e_sin_phi_pf)),1===this.m_eSquared?(l=0,r=.5*(A+_.sin_phi/_.one_m_e_2_sin_2_phi-a.sin_phi/a.one_m_e_2_sin_2_phi),h=0):(l=-2*e.atanh_e_over_e*(Math.log(_.one_p_sin_phi/a.one_p_sin_phi)-e.e*x),r=(A-e.e*x)/e.one_m_e_2,h=(Math.log(_.one_m_e_2_sin_2_phi/a.one_m_e_2_sin_2_phi)+l/e.atanh_e_over_e)/e.one_m_e_2),o=-x*(a.atanh_esin_phi+_.atanh_esin_phi),m=1/a.one_m_e_2_sin_2_phi-1/_.one_m_e_2_sin_2_phi,p=k(_.one_m_sin_phi/e.one_p_e,e.e)-k(a.one_m_sin_phi/e.one_p_e,e.e),u=k(_.one_p_sin_phi/e.one_p_e,e.e)-k(a.one_p_sin_phi/e.one_p_e,e.e),c=k(a.one_m_sin_phi/-e.one_m_e,e.e)-k(_.one_m_sin_phi/-e.one_m_e,e.e),g=k(a.one_p_sin_phi/-e.one_m_e,e.e)-k(_.one_p_sin_phi/-e.one_m_e,e.e),d=.25/r*(h+o+m+l+.5*(p+u+c+g)),d+=e.half_qp,f=.5*e.one_m_e_2*a.sin_phi*(1/a.one_m_e_2_sin_2_phi+G(e.e*a.sin_phi)),P=.5*e.one_m_e_2*_.sin_phi*(1/_.one_m_e_2_sin_2_phi+G(e.e*_.sin_phi)),P<f&&(S=f,f=P,P=S),d<f&&(d=f),d>P&&(d=P),d*=E,d)}loxodromeArea(e){const t=Math.PI/180;let i=0;const s=oe(),n=me(),a=me();s.e=Math.sqrt(this.m_eSquared),s.one_p_e=1+s.e,s.one_m_e=1-s.e,s.one_m_e_2=1-this.m_eSquared,s.atanh_e_over_e=G(s.e),this.m_eSquared>=1?s.half_qp=1:s.half_qp=.5*(1+s.atanh_e_over_e*s.one_m_e_2),s.f=.25*Math.PI,s.z=.75*Math.PI,a.initialize(0,s.e,s.f,s.z);const _=e.getPathCount(),r=new T,h=new T,o=e.getImpl().getAttributeStreamRef(0);for(let m=0;m<_;m++){const _=e.getPathStart(m),l=e.getPathEnd(m);if(!(l-_<=1)){o.queryPoint2D(2*(l-1),r);for(let e=_;e<l;e++){o.queryPoint2D(2*e,h);const m=r.y*t,l=h.y*t;if(e===_?(n.initialize(m,s.e,s.f,s.z),n.make_negative=!1):n.assign(a),a.initialize(l,s.e,s.f,s.z),a.make_negative=!1,r.y*h.y<0){if(r.y>=90&&h.y<=-90||h.y>=90&&r.y<=-90)return Number.NaN;const e=me();e.initialize(0,s.e,s.f,s.z),e.make_negative=!1;const _=n.atanh_sin_phi-s.e*n.atanh_esin_phi,o=a.atanh_sin_phi-s.e*a.atanh_esin_phi,l=(o*r.x-_*h.x)/(o-_);m<0?(n.make_negative=!0,i-=this.loxodromeAreaHemi(s,r.x*t,n,l*t,e),n.make_negative=!1,i+=this.loxodromeAreaHemi(s,l*t,e,h.x*t,a)):(i+=this.loxodromeAreaHemi(s,r.x*t,n,l*t,e),a.make_negative=!0,i-=this.loxodromeAreaHemi(s,l*t,e,h.x*t,a),a.make_negative=!1)}else r.y>=0?i+=this.loxodromeAreaHemi(s,r.x*t,n,h.x*t,a):(n.make_negative=!0,a.make_negative=!0,i-=this.loxodromeAreaHemi(s,r.x*t,n,h.x*t,a),n.make_negative=!1,a.make_negative=!1);r.assign(h)}}}return this.m_a*i*this.m_a}calculate(e){if(e.isEmpty()||e.getDimension()<2)return 0;if(e.getGeometryType()===i.enumEnvelope){const t=new a;return t.addEnvelope(e,!1),this.calculate(t)}return this.m_inputSR!==this.m_inputGCS&&null===this.m_transformPCS2GCS&&(this.m_transformPCS2GCS=o(this.m_inputSR,this.m_inputGCS,null)),this.executePolygonGeodeticArea(e)}}class de{getOperatorType(){return 10311}supportsCurves(){return!0}accelerateGeometry(e,t,i){return!1}canAccelerateGeometry(e){return!1}execute(e,i,s,n){if(t(e),4===s)return(new ne).execute(e,i,n);return new ge(i,s,n).calculate(e)}}export{de as OperatorGeodeticArea};
@@ -2,4 +2,4 @@
2
2
  All material copyright ESRI, All Rights Reserved, unless otherwise specified.
3
3
  See https://js.arcgis.com/4.34/esri/copyright.txt for details.
4
4
  */
5
- import{S as e,G as t}from"./SimpleGeometryCursor.js";import{d as r,t as s,a as n,c as i}from"./Geometry.js";import{ak as m}from"./UnitFactory.js";class a{getOperatorType(){return 10310}supportsCurves(){return!0}accelerateGeometry(e,t,r){return!1}canAccelerateGeometry(e){return!1}executeMany(e,t,r,s,n){return new o(e,r,s,t,-1,-1,n)}execute(t,s,n,i,m){const a=new e([t]),o=this.executeMany(a,s,n,i,m).next();return o||r("null output"),o}}class o extends t{constructor(e,t,r,i,m,a,o){super(),this.m_progressTracker=o,a>0&&s(""),4!==r&&m>0&&s(""),t||n("");0===t.getCoordinateSystemType()&&n(""),i>0||m>0||n(""),this.m_index=-1,this.m_inputGeoms=e,this.m_spatialReference=t,this.m_curveType=r,this.m_maxLengthMeters=i,this.m_maxDeviationMeters=m,this.m_maxAngle=a}next(){{let e;for(;e=this.m_inputGeoms.next();)return i(e),this.m_index=this.m_inputGeoms.getGeometryID(),this.geodeticDensify(e);return null}}getGeometryID(){return this.m_index}tock(){return!0}getRank(){return 1}geodeticDensify(e){return m(e,this.m_spatialReference,this.m_curveType,this.m_maxLengthMeters,this.m_maxDeviationMeters,this.m_progressTracker)}}export{a as OperatorGeodeticDensifyByLength,o as OperatorGeodeticDensifyCursor};
5
+ import{S as e,G as t}from"./SimpleGeometryCursor.js";import{d as r,t as s,a as n,c as i}from"./Geometry.js";import{am as m}from"./UnitFactory.js";class a{getOperatorType(){return 10310}supportsCurves(){return!0}accelerateGeometry(e,t,r){return!1}canAccelerateGeometry(e){return!1}executeMany(e,t,r,s,n){return new o(e,r,s,t,-1,-1,n)}execute(t,s,n,i,m){const a=new e([t]),o=this.executeMany(a,s,n,i,m).next();return o||r("null output"),o}}class o extends t{constructor(e,t,r,i,m,a,o){super(),this.m_progressTracker=o,a>0&&s(""),4!==r&&m>0&&s(""),t||n("");0===t.getCoordinateSystemType()&&n(""),i>0||m>0||n(""),this.m_index=-1,this.m_inputGeoms=e,this.m_spatialReference=t,this.m_curveType=r,this.m_maxLengthMeters=i,this.m_maxDeviationMeters=m,this.m_maxAngle=a}next(){{let e;for(;e=this.m_inputGeoms.next();)return i(e),this.m_index=this.m_inputGeoms.getGeometryID(),this.geodeticDensify(e);return null}}getGeometryID(){return this.m_index}tock(){return!0}getRank(){return 1}geodeticDensify(e){return m(e,this.m_spatialReference,this.m_curveType,this.m_maxLengthMeters,this.m_maxDeviationMeters,this.m_progressTracker)}}export{a as OperatorGeodeticDensifyByLength,o as OperatorGeodeticDensifyCursor};
@@ -2,4 +2,4 @@
2
2
  All material copyright ESRI, All Rights Reserved, unless otherwise specified.
3
3
  See https://js.arcgis.com/4.34/esri/copyright.txt for details.
4
4
  */
5
- import{__addDisposableResource as e,__disposeResources as t}from"tslib";import{a as r,c as n,G as o,f as a}from"./Geometry.js";import{O as s}from"./OperatorShapePreservingLength.js";import{c as i,P as c}from"./MultiPathImpl.js";import{E as m}from"./Point2D.js";import{F as l,af as u,al as g,am as p,O as y,a7 as f,a8 as x}from"./UnitFactory.js";import{O as h}from"./OperatorDensify.js";class S{getOperatorType(){return 10311}supportsCurves(){return!0}accelerateGeometry(e,t,r){return!1}canAccelerateGeometry(e){return!1}execute(e,t,f,x){if(4===f)return(new s).execute(e,t,x);if(0===t.getCoordinateSystemType()&&r(""),n(e),e.isEmpty()||e.getDimension()<1)return 0;const S=t.getGCS(),P=l();S.querySpheroidData(P);const d=P.majorSemiAxis,E=P.e2,G=S.getUnit().getUnitToBaseFactor();let j;const v=e.getGeometryType();if(v===o.enumPolygon?j=e.getBoundary():v===o.enumEnvelope?j=i(e):a(v)?(j=new c({vd:e.getDescription()}),j.addSegment(e,!0)):j=e,j.hasNonLinearSegments()){j=(new h).execute(j,0,t.getTolerance(0),0,x)}if(S!==t){const r=t.getSRToGCSTransform();if(t.isPannable()){j=u(j,t),v===o.enumPolyline&&j===e&&(j=e.clone());const r=new m;t.getPannableExtent().queryIntervalX(r);for(let e=0,t=j.getPointCount();e<t;e++){const t=j.getXY(e);t.x=g(t.x,r),j.setXY(e,t)}}const n=j.createInstance();j=p(r,j,n,x)?n:(new y).execute(j,r,x)}return this._ExecuteMultiPathGeodeticLength(j,f,d,E,G)}_ExecuteMultiPathGeodeticLength(r,n,o,a,s){const i={stack:[],error:void 0,hasError:!1};try{const t=e(i,new f,!1);let c=0;const m=r.querySegmentIterator();for(;m.nextPath();)for(;m.hasNextSegment();){const e=m.nextSegment(),r=e.getStartXY(),i=e.getEndXY();r.scale(s),i.scale(s),x.geodeticDistance(o,a,r.x,r.y,i.x,i.y,t,null,null,n),c+=t.val}return c}catch(c){i.error=c,i.hasError=!0}finally{t(i)}}}export{S as OperatorGeodeticLength};
5
+ import{__addDisposableResource as e,__disposeResources as t}from"tslib";import{a as r,c as n,G as a,f as o}from"./Geometry.js";import{O as s}from"./OperatorShapePreservingLength.js";import{c as i,P as c}from"./MultiPathImpl.js";import{E as m}from"./Point2D.js";import{r as l,a7 as u,a8 as g,a9 as p,O as y,aa as f,ab as x}from"./UnitFactory.js";import{O as h}from"./OperatorDensify.js";class S{getOperatorType(){return 10311}supportsCurves(){return!0}accelerateGeometry(e,t,r){return!1}canAccelerateGeometry(e){return!1}execute(e,t,f,x){if(4===f)return(new s).execute(e,t,x);if(0===t.getCoordinateSystemType()&&r(""),n(e),e.isEmpty()||e.getDimension()<1)return 0;const S=t.getGCS(),P=l();S.querySpheroidData(P);const d=P.majorSemiAxis,E=P.e2,G=S.getUnit().getUnitToBaseFactor();let j;const v=e.getGeometryType();if(v===a.enumPolygon?j=e.getBoundary():v===a.enumEnvelope?j=i(e):o(v)?(j=new c({vd:e.getDescription()}),j.addSegment(e,!0)):j=e,j.hasNonLinearSegments()){j=(new h).execute(j,0,t.getTolerance(0),0,x)}if(S!==t){const r=t.getSRToGCSTransform();if(t.isPannable()){j=u(j,t),v===a.enumPolyline&&j===e&&(j=e.clone());const r=new m;t.getPannableExtent().queryIntervalX(r);for(let e=0,t=j.getPointCount();e<t;e++){const t=j.getXY(e);t.x=g(t.x,r),j.setXY(e,t)}}const n=j.createInstance();j=p(r,j,n,x)?n:(new y).execute(j,r,x)}return this._ExecuteMultiPathGeodeticLength(j,f,d,E,G)}_ExecuteMultiPathGeodeticLength(r,n,a,o,s){const i={stack:[],error:void 0,hasError:!1};try{const t=e(i,new f,!1);let c=0;const m=r.querySegmentIterator();for(;m.nextPath();)for(;m.hasNextSegment();){const e=m.nextSegment(),r=e.getStartXY(),i=e.getEndXY();r.scale(s),i.scale(s),x.geodeticDistance(a,o,r.x,r.y,i.x,i.y,t,null,null,n),c+=t.val}return c}catch(c){i.error=c,i.hasError=!0}finally{t(i)}}}export{S as OperatorGeodeticLength};
@@ -2,4 +2,4 @@
2
2
  All material copyright ESRI, All Rights Reserved, unless otherwise specified.
3
3
  See https://js.arcgis.com/4.34/esri/copyright.txt for details.
4
4
  */
5
- import{__addDisposableResource as e,__disposeResources as t}from"tslib";import{a as n,G as s,h as o,t as r,d as i,g as a}from"./Geometry.js";import{m as c,a as m,c as l}from"./SideCalculator2D-BNwb5gvz.js";import{a as u,b as g,S as f,s as y}from"./MultiPathImpl.js";import{P as S,d,c as N,m as x}from"./Point2D.js";import{P as h,d as p}from"./Envelope.js";import{G as A}from"./SimpleGeometryCursor.js";import{O as C,M as P,ad as w,F as E,a9 as _,az as T,aA as j,aB as G,ah as I,aC as D,aD as v,aE as b,a7 as R,a8 as U,aF as F,aG as q}from"./UnitFactory.js";import{O as B}from"./OperatorShapePreservingDensify.js";class M{getOperatorType(){return 10501}supportsCurves(){return!0}accelerateGeometry(e,t,n){return!1}canAccelerateGeometry(e){return!1}getNearestCoordinate(e,t,y,d,N,x){if(t.isNAN()&&n("NAN xy coordinates are not allowed"),e.isEmpty())return c();if(Number.isNaN(d)&&(d=0),d>=0||n("maxDeviationMeters"),0===e.getDimension())return this.getNearestVertex(e,t,y);const A=e.getGeometryType();if(A===s.enumGeometryCollection){const n=e;let s=c();for(let e=0,o=n.getGeometryCount();e<o;++e){const o=n.getGeometry(e),r=this.getNearestCoordinate(o,t,y,d,N,x);if(!r.isEmpty()){if(0===r.m_distance)return r;r.m_distance>=s.m_distance||(s=r,s.m_geometryIndex=e)}}return s}if(A===s.enumEnvelope){const n=new u;return n.addEnvelope(e,!1),this.getNearestCoordinate(n,t,y,d,N,x)}o(A)||r("Operation is not implemented for this geometry type");const D=e;if((N||x)&&A===s.enumPolygon){const n=()=>{const e=m(t,-1,0);return e.m_bRightSide=!0,e};if(y.isPannable()){const s=(new C).foldInto360Range(new h(t),y);if(s.isEmpty())return c();const o=(new C).foldInto360Range(e,y);if(o.isEmpty())return c();if((new P).execute(o,s,y,null)&&N)return n()}else{const e=(new C).clipToSpatialReference(new h(t),y,null,1);if(e.isEmpty())return c();const s=w(D,y,0,null);if(s.isEmpty())return c();if((new P).execute(s,e,y,null)&&N)return n()}}const v=y!==y.getGCS()?y.getSRToGCSTransform():null,b=new S;if(v?(new C).transform(v,[t],1,[b],!1):b.assign(t),b.isNAN())return c();const R=V(D,t,y,1);let U=R.m_distance;if(0===U)return R;Number.isNaN(U)?U=Number.POSITIVE_INFINITY:U*=1+1e-7;const F=y.getGCS(),q=F.getUnit().getUnitToBaseFactor(),M=b.clone();M.scale(q);const O=E();y.querySpheroidData(O);const k=_(O.majorSemiAxis,O.e2,M),L=T(O.majorSemiAxis,O.e2),z=new X(D.querySegmentIterator());0===d&&(d=.01);const H=O.majorSemiAxis*g(45),J=(new B).executeMany(z,y,H,d,0,null),K=[];let Q=-1;const W=new p,Z=new f;for(let n=J.next();null!==n;n=J.next()){if(n.isEmpty())continue;const t=J.getGeometryID(),s=e.getPathIndexFromPointIndex(t);e.isClosedPath(s)&&D.getPathEnd(s);const o=n;for(let e=0,n=o.getPathCount();e<n;++e){K.length=0;for(let t=o.getPathStart(e),r=o.getPathEnd(e);t<r;++t)K.push(o.getXY(t));if(v&&(new C).transform(v,K,K.length,K,!1),K.length>3){const e=Y(K,K.length,b,F,1);if(e.m_distance<U){U=e.m_distance,W.assign(_(O.majorSemiAxis,O.e2,e.m_coordinate.mul(q))),Q=t;let n=e.m_vertexIndex;n+1===K.length&&(n-=1),o.getSegmentBuffer(n,Z,!0)}}K.forEach(e=>e.mulThis(q));const n=_(O.majorSemiAxis,O.e2,K[0]),s=new p;for(let e=1,r=K.length;e<r;++e){const r=_(O.majorSemiAxis,O.e2,K[e]);if(j(L,k,n,r,s)<U){const{second:s}=G(O.majorSemiAxis,O.e2,k,n,r,2,null);if(s<=U){const s=new p,{second:i}=G(O.majorSemiAxis,O.e2,k,n,r,0,s);i<U&&(U=i,W.assign(s),Q=t,o.getSegmentBuffer(e-1,Z,!0))}}n.assign(r)}}}if(!Number.isFinite(U))return c();-1===Q&&n("");const $=I(O.majorSemiAxis,O.e2,W);$.divThis(q);const ee=$.clone(),te=y!==y.getGCS()?y.getGCSToSRTransform():null;te&&(new C).transform(te,[$],1,[ee],!1),ee.isNAN()&&i("closestPoint2DSr.isNAN()"),a(!Z.empty());const ne=Z.get().getClosestCoordinate(ee,!1);ee.assign(Z.get().getCoord2D(ne)),v?(new C).transform(v,[ee],1,[$],!1):$.assign(ee),a(!$.isNAN());const se=this.getNearestVertex(new h($),b,y.getGCS()),oe=m(ee,Q,se.m_distance);if(x&&e.getDimension()>0){const n=l(e,t,-1,-1),s=0!==n&&3!==n;oe.m_bRightSide=s}return oe}getNearestVertex(e,t,o){if(t.isNAN()&&n("NAN xy coordinates are not allowed"),e.isEmpty())return c();switch(e.getGeometryType()){case s.enumPoint:return O(e,t,o);case s.enumMultiPoint:case s.enumPolyline:case s.enumPolygon:return V(e,t,o);default:r("")}}getNearestVertexPoint2D(e,t,n,s){return Y(e,t,n,s)}getNearestVertices(e,t,o,i,a){if(t.isNAN()&&n("NAN xy coordinates are not allowed"),e.isEmpty())return[];switch(e.getGeometryType()){case s.enumPoint:{const n=O(e,t,o);if(!n.isEmpty()&&n.m_distance<i&&a>=1){const e=[];return e.push(n),e}return[]}case s.enumMultiPoint:case s.enumPolyline:case s.enumPolygon:return k(e,t,o,i,a);default:r("")}}}function O(s,o,r){const i={stack:[],error:void 0,hasError:!1};try{if(0===r.getCoordinateSystemType()&&n("Cannot use local SR"),1!==r.getCoordinateSystemType()){const e=new Array(2);e[0]=s.getXY(),e[1]=o.clone();const t=x(S,2);2!==F(r,e,2,t)&&n("Point cannot be projected to GCS");const i=r.getGCS(),a=O(new h(t[0]),t[1],i);return m(a.m_coordinate,0,a.m_distance)}const t=r.getUnit().getUnitToBaseFactor(),a=s.getXY();a.scale(t);const c=o.clone();c.scale(t);const l=E();r.querySpheroidData(l);const u=e(i,new R,!1);U.geodeticDistance(l.majorSemiAxis,l.e2,a.x,a.y,c.x,c.y,u,null,null,q.PE_LINETYPE_GEODESIC);const g=s.getXY();return m(g,0,u.val)}catch(a){i.error=a,i.hasError=!0}finally{t(i)}}function V(s,o,r,i=0){0===r.getCoordinateSystemType()&&n("Cannot use local SR");let a=s.getAttributeStreamRef(0),c=s.getPointCount();const l=r.getGCS(),u=o.clone();if(1!==r.getCoordinateSystemType()){const e=r.getSRToGCSTransform();if(D(e,[o],1,[u],null),u.isNAN())return m(S.getNAN(),-1,Number.NaN);const t=(new C).execute(s,e,null);a=t.getAttributeStreamRef(0),c=t.getPointCount()}const g=l.getUnit().getUnitToBaseFactor(),f=d(c,0);for(let e=0;e<c;++e)f[e]=e;y(c,f);const x=E();l.querySpheroidData(x);const h=u.clone();h.scale(g);const A=_(x.majorSemiAxis,x.e2,h);let P=-1,w=Number.MAX_VALUE;const T=v(x.majorSemiAxis,x.e2);let j=c;const G=new S,I=new S;for(let e=0;e<j;){if(a.queryPoint2D(2*f[e],G),G.isNAN())continue;I.assign(G),I.scale(g);const t=_(x.majorSemiAxis,x.e2,I);if(p.distance(t,A)>w){f[j-1]=N(f[e],f[e]=f[j-1]),j--;continue}const n=b(T,t,A);n<w&&(P=f[e],w=n),e++}if(0!==x.e2){const n={stack:[],error:void 0,hasError:!1};try{const t=e(n,new R,!1);for(let e=0;e<j;e++){if(a.queryPoint2D(2*f[e],G),G.isNAN())continue;I.assign(G),I.scale(g);const n=_(x.majorSemiAxis,x.e2,I);p.distance(n,A)>w||(U.geodeticDistance(x.majorSemiAxis,x.e2,h.x,h.y,I.x,I.y,t,null,null,i),t.val<w&&(P=f[e],w=t.val))}}catch(q){n.error=q,n.hasError=!0}finally{t(n)}}const F=new S;return-1!==P&&F.assign(s.getXY(P)),m(F,P,w)}function Y(s,o,r,i,a=0){0===i.getCoordinateSystemType()&&n("Cannot use local SR");const l=i.getGCS(),u=r.clone();if(1!==i.getCoordinateSystemType()){const e=i.getSRToGCSTransform();if(D(e,[r],1,[u],null),u.isNAN())return c();const t=x(S,o);D(e,s,o,t,null);const n=Y(t,o,r,l,a);return n.isEmpty()?n:m(s[n.m_vertexIndex],n.m_vertexIndex,n.m_distance)}const g=l.getUnit().getUnitToBaseFactor(),f=d(o,0);for(let e=0;e<o;++e)f[e]=e;y(o,f);const h=E();l.querySpheroidData(h);const A=u.clone();A.scale(g);const C=_(h.majorSemiAxis,h.e2,A);let P=-1,w=Number.MAX_VALUE;const T=v(h.majorSemiAxis,h.e2);let j=o;for(let e=0;e<j;){const t=s[f[e]];if(t.isNAN())continue;const n=t.clone();n.scale(g);const o=_(h.majorSemiAxis,h.e2,n);if(p.distance(o,C)>w){f[j-1]=N(f[e],f[e]=f[j-1]),j--;continue}const r=b(T,o,C);r<w&&(P=f[e],w=r),e++}if(0!==h.e2){const n={stack:[],error:void 0,hasError:!1};try{const t=e(n,new R,!1);for(let e=0;e<j;e++){const n=s[f[e]];if(n.isNAN())continue;const o=n.clone();o.scale(g);const r=_(h.majorSemiAxis,h.e2,o);p.distance(r,C)>w||(U.geodeticDistance(h.majorSemiAxis,h.e2,A.x,A.y,o.x,o.y,t,null,null,a),t.val<w&&(P=f[e],w=t.val))}}catch(I){n.error=I,n.hasError=!0}finally{t(n)}}const G=new S;return-1!==P&&G.assign(s[P]),m(G,P,w)}function k(s,o,r,i,a){const c={stack:[],error:void 0,hasError:!1};try{0===r.getCoordinateSystemType()&&n("Cannot use local SR");let t=s.getAttributeStreamRef(0),l=s.getPointCount();const u=r.getGCS(),g=o.clone();if(1!==r.getCoordinateSystemType()){const e=r.getSRToGCSTransform();if(D(e,[o],1,[g],null),g.isNAN())return[];const n=(new C).execute(s,e,null);t=n.getAttributeStreamRef(0),l=n.getPointCount()}const f=u.getUnit().getUnitToBaseFactor(),x=d(l,0);for(let e=0;e<l;++e)x[e]=e;y(l,x);const h=E();u.querySpheroidData(h);const A=g.clone();A.scale(f);const P=_(h.majorSemiAxis,h.e2,A),w=[];let T=l;const j=new S,G=new S;for(let e=0;e<T;){if(t.queryPoint2D(2*x[e],j),j.isNAN())continue;G.assign(j),G.scale(f);const n=_(h.majorSemiAxis,h.e2,G);p.distance(n,P)>i?(x[T-1]=N(x[e],x[e]=x[T-1]),T--):e++}const I=(e,t)=>e.m_distance-t.m_distance,v=e(c,new R,!1);for(let e=0;e<T;e++)t.queryPoint2D(2*x[e],j),j.isNAN()||(U.geodeticDistance(h.majorSemiAxis,h.e2,A.x,A.y,j.x*f,j.y*f,v,null,null,q.PE_LINETYPE_GEODESIC),v.val<i&&w.push(m(j,x[e],v.val)));return w.sort(I),w.slice(0,a)}catch(l){c.error=l,c.hasError=!0}finally{t(c)}}class X extends A{constructor(e){super(),this.m_first=!0,this.m_segIter=e,this.m_segIter.stripAttributes()}tock(){return!0}getRank(){return 1}next(){if(this.m_first){if(!this.m_segIter.nextPath())return null;this.m_first=!1}for(;;){if(this.m_segIter.hasNextSegment())return this.m_segIter.nextSegment().clone();if(!this.m_segIter.nextPath())break}return null}getGeometryID(){return this.m_segIter.getStartPointIndex()}}export{M as OperatorProximityGeodesic};
5
+ import{__addDisposableResource as e,__disposeResources as t}from"tslib";import{a as n,G as s,h as o,t as r,d as i,g as a}from"./Geometry.js";import{m as c,a as m,c as l}from"./SideCalculator2D-BNwb5gvz.js";import{a as u,b as g,S as f,s as y}from"./MultiPathImpl.js";import{P as S,d,c as N,m as x}from"./Point2D.js";import{P as h,d as p}from"./Envelope.js";import{G as A}from"./SimpleGeometryCursor.js";import{O as C,M as P,ah as w,r as E,ad as _,az as T,aA as j,aB as G,ak as I,aC as D,aD as v,aE as b,aa as R,ab as U,aF as q,aG as F}from"./UnitFactory.js";import{O as B}from"./OperatorShapePreservingDensify.js";class k{getOperatorType(){return 10501}supportsCurves(){return!0}accelerateGeometry(e,t,n){return!1}canAccelerateGeometry(e){return!1}getNearestCoordinate(e,t,y,d,N,x){if(t.isNAN()&&n("NAN xy coordinates are not allowed"),e.isEmpty())return c();if(Number.isNaN(d)&&(d=0),d>=0||n("maxDeviationMeters"),0===e.getDimension())return this.getNearestVertex(e,t,y);const A=e.getGeometryType();if(A===s.enumGeometryCollection){const n=e;let s=c();for(let e=0,o=n.getGeometryCount();e<o;++e){const o=n.getGeometry(e),r=this.getNearestCoordinate(o,t,y,d,N,x);if(!r.isEmpty()){if(0===r.m_distance)return r;r.m_distance>=s.m_distance||(s=r,s.m_geometryIndex=e)}}return s}if(A===s.enumEnvelope){const n=new u;return n.addEnvelope(e,!1),this.getNearestCoordinate(n,t,y,d,N,x)}o(A)||r("Operation is not implemented for this geometry type");const D=e;if((N||x)&&A===s.enumPolygon){const n=()=>{const e=m(t,-1,0);return e.m_bRightSide=!0,e};if(y.isPannable()){const s=(new C).foldInto360Range(new h(t),y);if(s.isEmpty())return c();const o=(new C).foldInto360Range(e,y);if(o.isEmpty())return c();if((new P).execute(o,s,y,null)&&N)return n()}else{const e=(new C).clipToSpatialReference(new h(t),y,null,1);if(e.isEmpty())return c();const s=w(D,y,0,null);if(s.isEmpty())return c();if((new P).execute(s,e,y,null)&&N)return n()}}const v=y!==y.getGCS()?y.getSRToGCSTransform():null,b=new S;if(v?(new C).transform(v,[t],1,[b],!1):b.assign(t),b.isNAN())return c();const R=O(D,t,y,1);let U=R.m_distance;if(0===U)return R;Number.isNaN(U)?U=Number.POSITIVE_INFINITY:U*=1+1e-7;const q=y.getGCS(),F=q.getUnit().getUnitToBaseFactor(),k=b.clone();k.scale(F);const M=E();y.querySpheroidData(M);const Y=_(M.majorSemiAxis,M.e2,k),L=T(M.majorSemiAxis,M.e2),z=new X(D.querySegmentIterator());0===d&&(d=.01);const H=M.majorSemiAxis*g(45),J=(new B).executeMany(z,y,H,d,0,null),K=[];let Q=-1;const W=new p,Z=new f;for(let n=J.next();null!==n;n=J.next()){if(n.isEmpty())continue;const t=J.getGeometryID(),s=e.getPathIndexFromPointIndex(t);e.isClosedPath(s)&&D.getPathEnd(s);const o=n;for(let e=0,n=o.getPathCount();e<n;++e){K.length=0;for(let t=o.getPathStart(e),r=o.getPathEnd(e);t<r;++t)K.push(o.getXY(t));if(v&&(new C).transform(v,K,K.length,K,!1),K.length>3){const e=V(K,K.length,b,q,1);if(e.m_distance<U){U=e.m_distance,W.assign(_(M.majorSemiAxis,M.e2,e.m_coordinate.mul(F))),Q=t;let n=e.m_vertexIndex;n+1===K.length&&(n-=1),o.getSegmentBuffer(n,Z,!0)}}K.forEach(e=>e.mulThis(F));const n=_(M.majorSemiAxis,M.e2,K[0]),s=new p;for(let e=1,r=K.length;e<r;++e){const r=_(M.majorSemiAxis,M.e2,K[e]);if(j(L,Y,n,r,s)<U){const{second:s}=G(M.majorSemiAxis,M.e2,Y,n,r,2,null);if(s<=U){const s=new p,{second:i}=G(M.majorSemiAxis,M.e2,Y,n,r,0,s);i<U&&(U=i,W.assign(s),Q=t,o.getSegmentBuffer(e-1,Z,!0))}}n.assign(r)}}}if(!Number.isFinite(U))return c();-1===Q&&n("");const $=I(M.majorSemiAxis,M.e2,W);$.divThis(F);const ee=$.clone(),te=y!==y.getGCS()?y.getGCSToSRTransform():null;te&&(new C).transform(te,[$],1,[ee],!1),ee.isNAN()&&i("closestPoint2DSr.isNAN()"),a(!Z.empty());const ne=Z.get().getClosestCoordinate(ee,!1);ee.assign(Z.get().getCoord2D(ne)),v?(new C).transform(v,[ee],1,[$],!1):$.assign(ee),a(!$.isNAN());const se=this.getNearestVertex(new h($),b,y.getGCS()),oe=m(ee,Q,se.m_distance);if(x&&e.getDimension()>0){const n=l(e,t,-1,-1),s=0!==n&&3!==n;oe.m_bRightSide=s}return oe}getNearestVertex(e,t,o){if(t.isNAN()&&n("NAN xy coordinates are not allowed"),e.isEmpty())return c();switch(e.getGeometryType()){case s.enumPoint:return M(e,t,o);case s.enumMultiPoint:case s.enumPolyline:case s.enumPolygon:return O(e,t,o);default:r("")}}getNearestVertexPoint2D(e,t,n,s){return V(e,t,n,s)}getNearestVertices(e,t,o,i,a){if(t.isNAN()&&n("NAN xy coordinates are not allowed"),e.isEmpty())return[];switch(e.getGeometryType()){case s.enumPoint:{const n=M(e,t,o);if(!n.isEmpty()&&n.m_distance<i&&a>=1){const e=[];return e.push(n),e}return[]}case s.enumMultiPoint:case s.enumPolyline:case s.enumPolygon:return Y(e,t,o,i,a);default:r("")}}}function M(s,o,r){const i={stack:[],error:void 0,hasError:!1};try{if(0===r.getCoordinateSystemType()&&n("Cannot use local SR"),1!==r.getCoordinateSystemType()){const e=new Array(2);e[0]=s.getXY(),e[1]=o.clone();const t=x(S,2);2!==q(r,e,2,t)&&n("Point cannot be projected to GCS");const i=r.getGCS(),a=M(new h(t[0]),t[1],i);return m(a.m_coordinate,0,a.m_distance)}const t=r.getUnit().getUnitToBaseFactor(),a=s.getXY();a.scale(t);const c=o.clone();c.scale(t);const l=E();r.querySpheroidData(l);const u=e(i,new R,!1);U.geodeticDistance(l.majorSemiAxis,l.e2,a.x,a.y,c.x,c.y,u,null,null,F.PE_LINETYPE_GEODESIC);const g=s.getXY();return m(g,0,u.val)}catch(a){i.error=a,i.hasError=!0}finally{t(i)}}function O(s,o,r,i=0){0===r.getCoordinateSystemType()&&n("Cannot use local SR");let a=s.getAttributeStreamRef(0),c=s.getPointCount();const l=r.getGCS(),u=o.clone();if(1!==r.getCoordinateSystemType()){const e=r.getSRToGCSTransform();if(D(e,[o],1,[u],null),u.isNAN())return m(S.getNAN(),-1,Number.NaN);const t=(new C).execute(s,e,null);a=t.getAttributeStreamRef(0),c=t.getPointCount()}const g=l.getUnit().getUnitToBaseFactor(),f=d(c,0);for(let e=0;e<c;++e)f[e]=e;y(c,f);const x=E();l.querySpheroidData(x);const h=u.clone();h.scale(g);const A=_(x.majorSemiAxis,x.e2,h);let P=-1,w=Number.MAX_VALUE;const T=v(x.majorSemiAxis,x.e2);let j=c;const G=new S,I=new S;for(let e=0;e<j;){if(a.queryPoint2D(2*f[e],G),G.isNAN())continue;I.assign(G),I.scale(g);const t=_(x.majorSemiAxis,x.e2,I);if(p.distance(t,A)>w){f[j-1]=N(f[e],f[e]=f[j-1]),j--;continue}const n=b(T,t,A);n<w&&(P=f[e],w=n),e++}if(0!==x.e2){const n={stack:[],error:void 0,hasError:!1};try{const t=e(n,new R,!1);for(let e=0;e<j;e++){if(a.queryPoint2D(2*f[e],G),G.isNAN())continue;I.assign(G),I.scale(g);const n=_(x.majorSemiAxis,x.e2,I);p.distance(n,A)>w||(U.geodeticDistance(x.majorSemiAxis,x.e2,h.x,h.y,I.x,I.y,t,null,null,i),t.val<w&&(P=f[e],w=t.val))}}catch(F){n.error=F,n.hasError=!0}finally{t(n)}}const q=new S;return-1!==P&&q.assign(s.getXY(P)),m(q,P,w)}function V(s,o,r,i,a=0){0===i.getCoordinateSystemType()&&n("Cannot use local SR");const l=i.getGCS(),u=r.clone();if(1!==i.getCoordinateSystemType()){const e=i.getSRToGCSTransform();if(D(e,[r],1,[u],null),u.isNAN())return c();const t=x(S,o);D(e,s,o,t,null);const n=V(t,o,r,l,a);return n.isEmpty()?n:m(s[n.m_vertexIndex],n.m_vertexIndex,n.m_distance)}const g=l.getUnit().getUnitToBaseFactor(),f=d(o,0);for(let e=0;e<o;++e)f[e]=e;y(o,f);const h=E();l.querySpheroidData(h);const A=u.clone();A.scale(g);const C=_(h.majorSemiAxis,h.e2,A);let P=-1,w=Number.MAX_VALUE;const T=v(h.majorSemiAxis,h.e2);let j=o;for(let e=0;e<j;){const t=s[f[e]];if(t.isNAN())continue;const n=t.clone();n.scale(g);const o=_(h.majorSemiAxis,h.e2,n);if(p.distance(o,C)>w){f[j-1]=N(f[e],f[e]=f[j-1]),j--;continue}const r=b(T,o,C);r<w&&(P=f[e],w=r),e++}if(0!==h.e2){const n={stack:[],error:void 0,hasError:!1};try{const t=e(n,new R,!1);for(let e=0;e<j;e++){const n=s[f[e]];if(n.isNAN())continue;const o=n.clone();o.scale(g);const r=_(h.majorSemiAxis,h.e2,o);p.distance(r,C)>w||(U.geodeticDistance(h.majorSemiAxis,h.e2,A.x,A.y,o.x,o.y,t,null,null,a),t.val<w&&(P=f[e],w=t.val))}}catch(I){n.error=I,n.hasError=!0}finally{t(n)}}const G=new S;return-1!==P&&G.assign(s[P]),m(G,P,w)}function Y(s,o,r,i,a){const c={stack:[],error:void 0,hasError:!1};try{0===r.getCoordinateSystemType()&&n("Cannot use local SR");let t=s.getAttributeStreamRef(0),l=s.getPointCount();const u=r.getGCS(),g=o.clone();if(1!==r.getCoordinateSystemType()){const e=r.getSRToGCSTransform();if(D(e,[o],1,[g],null),g.isNAN())return[];const n=(new C).execute(s,e,null);t=n.getAttributeStreamRef(0),l=n.getPointCount()}const f=u.getUnit().getUnitToBaseFactor(),x=d(l,0);for(let e=0;e<l;++e)x[e]=e;y(l,x);const h=E();u.querySpheroidData(h);const A=g.clone();A.scale(f);const P=_(h.majorSemiAxis,h.e2,A),w=[];let T=l;const j=new S,G=new S;for(let e=0;e<T;){if(t.queryPoint2D(2*x[e],j),j.isNAN())continue;G.assign(j),G.scale(f);const n=_(h.majorSemiAxis,h.e2,G);p.distance(n,P)>i?(x[T-1]=N(x[e],x[e]=x[T-1]),T--):e++}const I=(e,t)=>e.m_distance-t.m_distance,v=e(c,new R,!1);for(let e=0;e<T;e++)t.queryPoint2D(2*x[e],j),j.isNAN()||(U.geodeticDistance(h.majorSemiAxis,h.e2,A.x,A.y,j.x*f,j.y*f,v,null,null,F.PE_LINETYPE_GEODESIC),v.val<i&&w.push(m(j,x[e],v.val)));return w.sort(I),w.slice(0,a)}catch(l){c.error=l,c.hasError=!0}finally{t(c)}}class X extends A{constructor(e){super(),this.m_first=!0,this.m_segIter=e,this.m_segIter.stripAttributes()}tock(){return!0}getRank(){return 1}next(){if(this.m_first){if(!this.m_segIter.nextPath())return null;this.m_first=!1}for(;;){if(this.m_segIter.hasNextSegment())return this.m_segIter.nextSegment().clone();if(!this.m_segIter.nextPath())break}return null}getGeometryID(){return this.m_segIter.getStartPointIndex()}}export{k as OperatorProximityGeodesic};
@@ -2,4 +2,4 @@
2
2
  All material copyright ESRI, All Rights Reserved, unless otherwise specified.
3
3
  See https://js.arcgis.com/4.34/esri/copyright.txt for details.
4
4
  */
5
- import{a as e,G as t,f as s,d as n}from"./Geometry.js";import{aj as o,Q as r,F as a,g as i,a9 as m}from"./UnitFactory.js";import{a as c,P as g}from"./MultiPathImpl.js";import{n as u,d as p,P as h}from"./Point2D.js";import{d as y}from"./Envelope.js";import{Envelope2D as l}from"./Envelope2D.js";import{O as f}from"./OperatorDensify.js";import{O as _}from"./OperatorClip.js";function x(){return{m_pGcs:new h,m_xyz:new y,m_factor:Number.NaN,m_geoLength:Number.NaN,setValues:d,setLength:P,assign:S}}function d(e,t,s,n){this.m_factor=e,this.m_pGcs.assign(t),this.m_xyz.assign(n),this.m_geoLength=s}function P(e){this.m_geoLength=e}function S(e){this.m_pGcs.assign(e.m_pGcs),this.m_xyz.assign(e.m_xyz),this.m_factor=e.m_factor,this.m_geoLength=e.m_geoLength}class w{getOperatorType(){return 10315}supportsCurves(){return!0}accelerateGeometry(e,t,s){return!1}canAccelerateGeometry(e){return!1}_ExecuteShapePreservingLength(e,t,s,n,a){if(e.hasNonLinearSegments()){e=(new f).execute(e,0,t.getTolerance(0),0,a)}if(t.isPannable()){let n=90,r=-90;if(1===s.getUnit().getUnitToBaseFactor()&&(n*=Math.PI/180,r*=Math.PI/180),2===t.getCoordinateSystemType()){let e=null;const s=[0,0,0,0];e=t.getPECoordSys(),s[0]=0,s[1]=n,s[2]=0,s[3]=r,o.geogToProj(e,2,s),n=s[1],r=s[3]}const i=new l;e.queryEnvelope(i),i.ymin=r,i.ymax=n,e=(new _).execute(e,i,t,a)}else{const s=t.getPCSHorizon();if((e=(new r).execute(e,s,t,a))===s){const t=e.clone();e=t}}return e.isEmpty()?0:this._ExecuteIterativeApproach(e,t,s,n,1,a)}_ExecuteIterativeApproach(e,t,s,r,i,m){const c=a();s.querySpheroidData(c);const g=c.majorSemiAxis,l=c.e2,f=s.getUnit().getUnitToBaseFactor(),_=40,d=u(x,_),P=p(_,Number.NaN),S=x(),w=x();let E;const G=[0,0,0,0],j=t.getPECoordSys(),L=new h,v=new h,T=new h,D=new h,b=new h;let z=0;const I=e.querySegmentIterator();for(;I.nextPath();)for(;I.hasNextSegment();){const e=I.nextSegment();L.assign(e.getStartXY()),v.assign(e.getEndXY()),2===t.getCoordinateSystemType()?(G[0]=L.x,G[1]=L.y,G[2]=v.x,G[3]=v.y,o.projToGeog(j,2,G),T.x=G[0]*f,T.y=G[1]*f,D.x=G[2]*f,D.y=G[3]*f):(T.setCoordsPoint2D(L),D.setCoordsPoint2D(v),T.scale(f),D.scale(f));const s=new y,r=new y;N(g,l,T,s),N(g,l,D,r);let a=C(g,s,r);S.setValues(0,T,Number.NaN,s),w.setValues(1,D,a,r),E=i,d[0].assign(w),P[0]=i;let m=0;for(;;){m>128&&n("iterations exceeded");const s=.5*(S.m_factor+w.m_factor),r=e.getCoord2D(s);2===t.getCoordinateSystemType()?(G[0]=r.x,G[1]=r.y,o.projToGeog(j,1,G),b.x=G[0]*f,b.y=G[1]*f):(b.setCoordsPoint2D(r),b.scale(f)),T.setCoordsPoint2D(S.m_pGcs),D.setCoordsPoint2D(w.m_pGcs);const c=new y;N(g,l,b,c);const u=C(g,S.m_xyz,c),p=C(g,w.m_xyz,c);a=w.m_geoLength,Number.isNaN(a)&&(a=C(g,S.m_xyz,w.m_xyz));const h=u+p,x=E===i&&h>=20&&Math.abs(h-a)>1e-8*(a+h);if(m+2<_&&(x||Math.abs(h-a)>0&&E>0))w.setLength(p),d[m].assign(w),w.setValues(s,b,u,c),d[++m].assign(w),x?(E=i,P[m]=i):(E--,P[m-1]=E,P[m]=E);else{if(z+=h,0===m)break;S.assign(w),w.assign(d[--m]),E=P[m]}}}return z}execute(n,o,r){if(o&&0!==o.getCoordinateSystemType()||e(""),n.isEmpty()||n.getDimension()<1)return 0;let a=null;const m=o.getGCS();m!==o&&(a=i(o,m,null));const u=n.getGeometryType();if(u===t.enumEnvelope){const e=new c;return e.addEnvelope(n,!1),this._ExecuteShapePreservingLength(e,o,m,a,r)}if(s(u)){const e=new g;return e.addSegment(n,!0),this._ExecuteShapePreservingLength(e,o,m,a,r)}return this._ExecuteShapePreservingLength(n,o,m,a,r)}}function N(e,t,s,n){n.assign(m(e,t,s))}function C(e,t,s){const n=e,o=new y;o.setSub(t,s);const r=o.length();return 2*n*Math.asin(r/(2*n))}export{w as O};
5
+ import{a as e,G as t,f as s,d as n}from"./Geometry.js";import{ac as o,Q as r,r as a,E as i,ad as m}from"./UnitFactory.js";import{a as c,P as g}from"./MultiPathImpl.js";import{k as u,d as p,P as h}from"./Point2D.js";import{d as y}from"./Envelope.js";import{Envelope2D as l}from"./Envelope2D.js";import{O as f}from"./OperatorDensify.js";import{O as _}from"./OperatorClip.js";function x(){return{m_pGcs:new h,m_xyz:new y,m_factor:Number.NaN,m_geoLength:Number.NaN,setValues:d,setLength:P,assign:S}}function d(e,t,s,n){this.m_factor=e,this.m_pGcs.assign(t),this.m_xyz.assign(n),this.m_geoLength=s}function P(e){this.m_geoLength=e}function S(e){this.m_pGcs.assign(e.m_pGcs),this.m_xyz.assign(e.m_xyz),this.m_factor=e.m_factor,this.m_geoLength=e.m_geoLength}class w{getOperatorType(){return 10315}supportsCurves(){return!0}accelerateGeometry(e,t,s){return!1}canAccelerateGeometry(e){return!1}_ExecuteShapePreservingLength(e,t,s,n,a){if(e.hasNonLinearSegments()){e=(new f).execute(e,0,t.getTolerance(0),0,a)}if(t.isPannable()){let n=90,r=-90;if(1===s.getUnit().getUnitToBaseFactor()&&(n*=Math.PI/180,r*=Math.PI/180),2===t.getCoordinateSystemType()){let e=null;const s=[0,0,0,0];e=t.getPECoordSys(),s[0]=0,s[1]=n,s[2]=0,s[3]=r,o.geogToProj(e,2,s),n=s[1],r=s[3]}const i=new l;e.queryEnvelope(i),i.ymin=r,i.ymax=n,e=(new _).execute(e,i,t,a)}else{const s=t.getPCSHorizon();if((e=(new r).execute(e,s,t,a))===s){const t=e.clone();e=t}}return e.isEmpty()?0:this._ExecuteIterativeApproach(e,t,s,n,1,a)}_ExecuteIterativeApproach(e,t,s,r,i,m){const c=a();s.querySpheroidData(c);const g=c.majorSemiAxis,l=c.e2,f=s.getUnit().getUnitToBaseFactor(),_=40,d=u(x,_),P=p(_,Number.NaN),S=x(),w=x();let C;const G=[0,0,0,0],L=t.getPECoordSys(),j=new h,v=new h,T=new h,D=new h,b=new h;let z=0;const I=e.querySegmentIterator();for(;I.nextPath();)for(;I.hasNextSegment();){const e=I.nextSegment();j.assign(e.getStartXY()),v.assign(e.getEndXY()),2===t.getCoordinateSystemType()?(G[0]=j.x,G[1]=j.y,G[2]=v.x,G[3]=v.y,o.projToGeog(L,2,G),T.x=G[0]*f,T.y=G[1]*f,D.x=G[2]*f,D.y=G[3]*f):(T.setCoordsPoint2D(j),D.setCoordsPoint2D(v),T.scale(f),D.scale(f));const s=new y,r=new y;E(g,l,T,s),E(g,l,D,r);let a=N(g,s,r);S.setValues(0,T,Number.NaN,s),w.setValues(1,D,a,r),C=i,d[0].assign(w),P[0]=i;let m=0;for(;;){m>128&&n("iterations exceeded");const s=.5*(S.m_factor+w.m_factor),r=e.getCoord2D(s);2===t.getCoordinateSystemType()?(G[0]=r.x,G[1]=r.y,o.projToGeog(L,1,G),b.x=G[0]*f,b.y=G[1]*f):(b.setCoordsPoint2D(r),b.scale(f)),T.setCoordsPoint2D(S.m_pGcs),D.setCoordsPoint2D(w.m_pGcs);const c=new y;E(g,l,b,c);const u=N(g,S.m_xyz,c),p=N(g,w.m_xyz,c);a=w.m_geoLength,Number.isNaN(a)&&(a=N(g,S.m_xyz,w.m_xyz));const h=u+p,x=C===i&&h>=20&&Math.abs(h-a)>1e-8*(a+h);if(m+2<_&&(x||Math.abs(h-a)>0&&C>0))w.setLength(p),d[m].assign(w),w.setValues(s,b,u,c),d[++m].assign(w),x?(C=i,P[m]=i):(C--,P[m-1]=C,P[m]=C);else{if(z+=h,0===m)break;S.assign(w),w.assign(d[--m]),C=P[m]}}}return z}execute(n,o,r){if(o&&0!==o.getCoordinateSystemType()||e(""),n.isEmpty()||n.getDimension()<1)return 0;let a=null;const m=o.getGCS();m!==o&&(a=i(o,m,null));const u=n.getGeometryType();if(u===t.enumEnvelope){const e=new c;return e.addEnvelope(n,!1),this._ExecuteShapePreservingLength(e,o,m,a,r)}if(s(u)){const e=new g;return e.addSegment(n,!0),this._ExecuteShapePreservingLength(e,o,m,a,r)}return this._ExecuteShapePreservingLength(n,o,m,a,r)}}function E(e,t,s,n){n.assign(m(e,t,s))}function N(e,t,s){const n=e,o=new y;o.setSub(t,s);const r=o.length();return 2*n*Math.asin(r/(2*n))}export{w as O};
@@ -2,4 +2,4 @@
2
2
  All material copyright ESRI, All Rights Reserved, unless otherwise specified.
3
3
  See https://js.arcgis.com/4.34/esri/copyright.txt for details.
4
4
  */
5
- import{G as t}from"./SimpleGeometryCursor.js";import{a as e,c as s,o as i,p as n,g as o,G as r,f as h,h as m,t as a}from"./Geometry.js";import{E as c,P as l}from"./Envelope.js";import{Envelope2D as u}from"./Envelope2D.js";import{P as f,S as g,L as _}from"./MultiPathImpl.js";import{p as d,P as p,d as P}from"./Point2D.js";import{T}from"./Transformation2D.js";import{O as b,j as D,m as S,i as I,af as x,aH as F,L as C,R as N,Q as y,V as w,U as E,ab as G,aI as v,aa as z}from"./UnitFactory.js";import{c as k}from"./OperatorClip.js";function q(t){const e=t.getInputSR(),s=t.getOutputSR();let i=!1;do{if(e.equals(s)){i=!1;break}if(!O(e)||!O(s)){i=!1;break}if(2===e.getCoordinateSystemType()){i=!0;break}if(2===s.getCoordinateSystemType()){i=!0;break}const n=t.getGeographicTransformations();if(null!==n&&n.count()>0){i=!0;break}}while(0);return i}class L{constructor(t,e,s,i){this.m_horizon2Env=new u,this.m_horizon2=t,this.m_sr=e,this.m_bInclusive2=s,this.m_pannableExtent=i.clone(),this.m_segIter=null,this.m_qtIter=null,null!==t?(t.queryEnvelope(this.m_horizon2Env),this.m_gcs360=i.width(),this.m_gcs180=.5*this.m_gcs360,this.m_gcs90=.25*this.m_gcs360,this.m_pannableFactor=1,this.m_horizon2Env.width()-this.m_gcs360>0&&(this.m_pannableFactor+=Math.ceil((this.m_horizon2Env.width()-this.m_gcs360)/this.m_gcs360)),this.m_period=this.m_gcs360):(this.m_horizon2Env.setEmpty(),this.m_gcs360=Number.NaN,this.m_gcs180=Number.NaN,this.m_gcs90=Number.NaN,this.m_pannableFactor=Number.NaN,this.m_period=Number.NaN),this.m_gcsTolerance=null!=e?e.getTolerance(0):Number.NaN}isPointStartInHorizon(t,e){if(!this.m_horizon2)return!0;let s=nt(new l(t),this.m_horizon2,!0,this.m_period);do{const e=t.clone();if(e.x-=s*this.m_period,this.m_horizon2.getGeometryType()===r.enumPolygon){let t;if(t=this.m_horizon2Env.contains(e)?N(this.m_horizon2,e,0):0,this.m_bInclusive2){if(0===t)return!1}else if(1===t)return!1}else{const t=this.m_horizon2Env.contains(e);if(this.m_bInclusive2){if(!t)return!1}else if(t)return!1}}while(this.m_horizon2Env.xmin+ ++s*this.m_period<t.x);return!0}isAdjoiningLineInHorizon(t,e,s){if(!this.m_horizon2)return!0;const i=new p,n=new p;rt(t,e,this.m_gcs90,this.m_gcs180,this.m_gcs360,i,n);const h=Math.max(i.x,n.x),m=new _;m.setStart2D(i),m.setEnd2D(n);let a=nt(m,this.m_horizon2,!0,this.m_period);const c=!1;do{const t=i.clone(),e=n.clone();if(t.x-=a*this.m_period,e.x-=a*this.m_period,this.m_horizon2.getGeometryType()===r.enumPolygon){const s=new _;s.setStartXY(t),s.setEndXY(e);const i=new u,n=new u;if(s.queryEnvelope(i),n.setCoords({env2D:i}),n.inflateCoords(this.m_gcsTolerance,this.m_gcsTolerance),this.m_horizon2Env.isIntersecting(n)){const t=this.m_horizon2.getImpl(),e=t.getAccelerators();if(null!==e){null!==e.getRasterizedGeometry()&&o(0)}{let i=null;if(null!==e&&(i=e.getQuadTree()),null!==i){this.m_qtIter||(this.m_qtIter=i.getIteratorForQT()),this.m_qtIter.resetIterator(s,this.m_gcsTolerance),this.m_segIter||(this.m_segIter=t.querySegmentIterator());for(let t=this.m_qtIter.next();-1!==t;t=this.m_qtIter.next()){const e=i.getElement(t);this.m_segIter.resetToVertex(e,-1);if(this.m_segIter.nextSegment().isIntersecting(s,this.m_gcsTolerance))return!1}}else for(this.m_segIter||(this.m_segIter=t.querySegmentIterator()),this.m_segIter.resetToFirstPath();this.m_segIter.nextPath();)for(;this.m_segIter.hasNextSegment();){const t=this.m_segIter.nextSegment(),e=new u;if(t.queryEnvelope(e),e.isIntersecting(n)&&t.isIntersecting(s,this.m_gcsTolerance))return!1}}}}else if(this.m_bInclusive2){const s=this.m_horizon2Env.contains(t),i=this.m_horizon2Env.contains(e);if(s&&i)return!0}else{const s=this.m_horizon2Env.clone();s.inflateCoords(this.m_gcsTolerance,this.m_gcsTolerance);if(!(0===s.clipLine(t,e)))return!1}}while(this.m_horizon2Env.xmin+ ++a*this.m_period<h);return!this.m_bInclusive2||c}isEnvelopeInHorizon(t,e){if(!this.m_horizon2)return!0;const s=new c({env2D:t});let i=nt(s,this.m_horizon2,!0,this.m_period);do{const n=t.clone();n.move(-i*this.m_period,0),s.setCoords(n.xmin,n.ymin,n.xmax,n.ymax);if(!st(s,this.m_horizon2,this.m_sr,this.m_bInclusive2,e))return!1}while(this.m_horizon2Env.xmin+ ++i*this.m_period<t.xmax);return!0}}class R{constructor(t,e,s){this.m_splitLines2=null,this.m_scalars=[],this.m_splitIter=null,this.m_splitLines2=t,this.m_transform1=e,this.m_pannableExtent=s.clone(),this.m_gcs360=s.width(),this.m_gcs180=.5*this.m_gcs360,this.m_gcs90=.25*this.m_gcs360,null!==e?(this.m_gcsTolerance=this.m_transform1.getOutputSR().getTolerance(0),this.m_halfGcsTolerance=.5*this.m_gcsTolerance,this.m_gcsToleranceSq=this.m_gcsTolerance*this.m_gcsTolerance):(this.m_gcsTolerance=Number.NaN,this.m_halfGcsTolerance=Number.NaN,this.m_gcsToleranceSq=Number.NaN)}hasSplitLines(){return null!=this.m_splitLines2}getSplitLineFactorEx(t,e,s,i,n,o){const r=new p,h=new p;rt(i,n,this.m_gcs90,this.m_gcs180,this.m_gcs360,r,h);const m=new _;for(m.setStartXY(r),m.setEndXY(h),this.m_splitIter?this.m_splitIter.resetToFirstPath():this.m_splitIter=this.m_splitLines2.getImpl().querySegmentIterator();this.m_splitIter.nextPath();)for(;this.m_splitIter.hasNextSegment();){const i=this.m_splitIter.nextSegment(),n=.5*(i.getStartX()+i.getEndX());Z(this.m_gcs180,this.m_gcs360,n,m);const r=new u;m.queryEnvelope(r),r.inflateCoords(this.m_gcsTolerance,this.m_gcsTolerance);const h=new u;if(i.queryEnvelope(h),!r.isIntersecting(h))continue;this.m_scalars.length<2&&(this.m_scalars.length=2);if(1===m.intersect(i,null,this.m_scalars,null,this.m_gcsTolerance)&&(this.m_scalars[0]>0&&this.m_scalars[0]<1)){const n=ct(e,s,this.m_scalars[0]),r=Q(t.getCoord2D(n),this.m_transform1);if(i.isIntersectingPoint(r,this.m_halfGcsTolerance))return n;return this.getSplitLineFactor(t,e,s,i,o)}}return-1}getSplitLineFactor(t,e,s,i,n){let o=e,r=s;const h=.5*(i.getStartX()+i.getEndX()),m=new _,a=t.getCoord2D(o),c=t.getCoord2D(r),l=Q(a,this.m_transform1),u=Q(c,this.m_transform1);for(;o<r;){const e=new p,s=new p;rt(l,u,this.m_gcs90,this.m_gcs180,this.m_gcs360,e,s),m.setStartXY(e),m.setEndXY(s),Z(this.m_gcs180,this.m_gcs360,h,m);const n=p.sqrDistance(m.getStartXY(),m.getEndXY());if(n<=this.m_gcsToleranceSq)break;if(Number.isNaN(n))return Number.NaN;let f=ct(o,r,this.m_scalars[0]);if(o<f&&f<r||(f=.5*(r+o)),o===f||f===r)return f;const g=t.getCoord2D(f),_=Q(g,this.m_transform1),d=new p;rt(l,_,this.m_gcs90,this.m_gcs180,this.m_gcs360,e,d),m.setStartXY(e),m.setEndXY(d),Z(this.m_gcs180,this.m_gcs360,h,m);let P=m.intersect(i,null,this.m_scalars,null,this.m_halfGcsTolerance);if(0!==P){if(1===this.m_scalars[0])return f;r=f,c.setCoordsPoint2D(g),u.setCoordsPoint2D(_)}else{if(rt(_,u,this.m_gcs90,this.m_gcs180,this.m_gcs360,d,s),m.setStartXY(d),m.setEndXY(s),Z(this.m_gcs180,this.m_gcs360,h,m),P=m.intersect(i,null,this.m_scalars,null,this.m_halfGcsTolerance),0===P)return f;if(0===this.m_scalars[0])return f;o=f,a.setCoordsPoint2D(g),l.setCoordsPoint2D(_)}}return.5*(r+o)}}class M{constructor(){this.m_bPrepared=!1,this.m_bNeedsShapePreservingProject=!1,this.m_inputTransform=null,this.m_transform1=null,this.m_transform2=null,this.m_extentFrom=null,this.m_horizon1=null,this.m_horizon2=null,this.m_pannableExtentFrom=new u,this.m_pannableExtentTo=new u,this.m_pannableExtentGcsTo=new u,this.m_bClipTopBottomFrom=!1,this.m_bNeedsGeoTransform=!1,this.m_bIsPannableFrom=!1,this.m_bIsPannableTo=!1,this.m_bInclusive1=!1,this.m_bInclusive2=!1,this.m_bSrFromIsPcs=!1,this.m_bSrToIsPcs=!1,this.m_fromTolerance=Number.NaN,this.m_toTolerance=Number.NaN,this.m_gcsToTolerance=Number.NaN,this.m_aFrom=Number.NaN,this.m_mpuFrom=Number.NaN,this.m_rpuFrom=Number.NaN,this.m_rpuGcsTo=Number.NaN,this.m_aTo=Number.NaN,this.m_mpuTo=Number.NaN,this.m_stages=0}prepare(t,s,i){this.m_bPrepared&&n(""),t||e("");const r=t.getInputSR(),h=t.getOutputSR();O(r)&&O(h)||e("shape preserving project requires PCS or GCS");const m=r.getCoordinateSystemType(),a=h.getCoordinateSystemType();this.m_bSrFromIsPcs=2===m,this.m_bSrToIsPcs=2===a;let c=null,l=null,u=null,f=null;this.m_bSrFromIsPcs?(c=r,u=r.getGCS(),this.m_aFrom=at(u),this.m_mpuFrom=mt(c),this.m_rpuFrom=Number.NaN):(u=r,this.m_rpuFrom=ht(u),this.m_aFrom=Number.NaN),this.m_bSrToIsPcs?(l=h,f=h.getGCS(),this.m_aTo=at(f),this.m_mpuTo=mt(l)):(f=h,this.m_aTo=Number.NaN,this.m_mpuTo=Number.NaN),this.m_rpuGcsTo=ht(f);const g=t.getGeographicTransformations();this.m_bNeedsGeoTransform=null!==g&&g.count()>0;const _=r.equals(h);if(this.m_bNeedsShapePreservingProject=!_&&(this.m_bSrFromIsPcs||this.m_bSrToIsPcs||this.m_bNeedsGeoTransform),!this.m_bNeedsShapePreservingProject)return this.m_inputTransform=t,this.m_extentFrom=s?s.clone():null,void(this.m_bPrepared=!0);if(this.m_bIsPannableFrom=r.isPannable(),this.m_bIsPannableTo=h.isPannable(),this.m_bIsPannableFrom&&(this.m_pannableExtentFrom=r.getPannableExtent()),this.m_bIsPannableTo&&(this.m_pannableExtentTo=h.getPannableExtent()),this.m_bSrToIsPcs){this.m_pannableExtentGcsTo=f.getPannableExtent();const t=l.getCentralMeridian(),e=this.m_pannableExtentGcsTo.getCenter();e.x=t,this.m_pannableExtentGcsTo.centerAt(e)}else this.m_pannableExtentGcsTo=this.m_pannableExtentTo.clone();this.m_fromTolerance=r.getTolerance(0),this.m_toTolerance=h.getTolerance(0),this.m_gcsToTolerance=f.getTolerance(0);{const e=t.getExtendedParams(),n=e.clipWithInputHorizon,o=e.clipWithOutputHorizon;n&&this.setHorizon1(t,s,i),o&&this.setHorizon2(t,i),this.checkAndSetStages(t,i)}const d=D();d.setFlag(1073741824,!0),d.setFlag(536870912,!0);const p=S();if(p.clipWithInputHorizon=!1,p.clipWithOutputHorizon=!1,1===this.m_stages)this.m_transform1=I(!1,r,h,g,p,d);else if(2===this.m_stages){d.setFlag(2147483648,!0),this.m_transform1=I(!1,r,f,g,p,d);const t=D();this.m_transform2=I(!1,f,h,null,p,t)}else{o(null!=l),p.centralMeridianOfOutputGCS=l.getCentralMeridian(),this.m_transform1=I(!1,r,f,g,p,d);const t=D();t.setFlag(2147483648,!0),this.m_transform2=I(!1,f,h,null,p,t)}this.m_inputTransform=t,this.m_extentFrom=s?s.clone():null,this.m_bPrepared=!0}execute(t,e,s,i){this.m_bPrepared||n(""),o(!t.hasAttribute(10));return this.execute_(t,e,s,i)}checkIfNeedsReset(t,e){return o(0),!1}setHorizon1(t,e,s){const i=t.getInputSR();let n,o=null;const r=new u;if(this.m_bSrFromIsPcs){n=!0,o=i.getPCSHorizon(),o.queryEnvelope(r),this.m_bIsPannableFrom&&(o=new c({xmin:this.m_pannableExtentFrom.xmin,ymin:r.ymin,xmax:this.m_pannableExtentFrom.xmax,ymax:r.ymax}));let t=!1;null!=e&&(t=et(e,o,i,n,this.m_bIsPannableFrom,this.m_pannableExtentFrom,s)),t||(this.m_horizon1=o,this.m_bInclusive1=n)}else this.m_bClipTopBottomFrom=!0,this.m_bInclusive1=!0}setHorizon2(t,e){const s=t.getOutputSR();if(1===s.getCoordinateSystemType())return this.m_horizon2=null,void(this.m_bInclusive2=!1);let i=null;const n=new u,o=s.getGCSHorisonIsInclusive();i=s.getGCSHorizon(),i.queryEnvelope(n);const r=s.getCentralMeridian();if(this.m_bIsPannableTo){const t=new c({xmin:this.m_pannableExtentGcsTo.xmin,ymin:n.ymin,xmax:this.m_pannableExtentGcsTo.xmax,ymax:n.ymax});t.centerAt(r,0),i=t}this.m_horizon2=i,this.m_bInclusive2=o}checkAndSetStages(t,e){const s=t.getOutputSR().getGCSSplitLines();if(!this.m_horizon2&&!s)return void(this.m_stages=1);if(this.m_horizon2.getGeometryType()===r.enumEnvelope){const t=new u;this.m_horizon2.queryEnvelope(t);const e=t.width(),s=t.height();e>=d/this.m_rpuGcsTo&&s>=Math.PI/this.m_rpuGcsTo&&(this.m_horizon2=null)}if(this.m_horizon2||s){if(null!==this.m_horizon2&&!this.m_bNeedsGeoTransform&&!this.m_bSrFromIsPcs){const e=t.getOutputSR().getGCS();return t.getInputSR().equals(e)?(this.m_horizon1=this.m_horizon2,this.m_bInclusive1=this.m_bInclusive2,this.m_bClipTopBottomFrom=!1,this.m_horizon2=null,this.m_bInclusive2=!1,void(this.m_stages=1)):void(this.m_stages=2)}this.m_stages=3}else this.m_stages=1}execute_(t,e,n,o){if(!this.m_bNeedsShapePreservingProject)return(new b).execute(t,this.m_inputTransform,o);if(!t)return null;s(t),i(t);let a,c=t.getGeometryType();return h(c)?(a=W(t),c=r.enumPolyline):a=t,a.isEmpty()?a:m(c)?this.executeEx(t,e,n,o):(new b).execute(t,this.m_inputTransform,o)}executeEx(t,e,s,i){let n;t.hasNonLinearSegments()&&a(""),n=this.m_bIsPannableFrom?(new b).foldInto360Range(t,this.m_transform1.getInputSR()):t;let o,r=s;return r>0||(r=100*this.m_toTolerance),o=1===this.m_stages?this.executeGood(n,e,r,i):2===this.m_stages?this.executeBad(n,e,r,i):this.executeUgly(n,e,r,i),this.filterOverDensification(o,this.m_inputTransform.getOutputSR(),r,i)}executeGood(t,e,s,i){const n=s*s;let o,r;return o=e>0?this.getMinLengthInSrFrom(e):this.getMinLengthInSrFrom(1e-5),r=this.m_bClipTopBottomFrom?x(t,this.m_transform1.getInputSR()):$(t,this.m_transform1.getInputSR(),this.m_horizon1,this.m_bInclusive1,this.m_bIsPannableFrom,this.m_pannableExtentFrom,!0,Number.NaN,i),r=F(r,this.m_transform1.getOutputSR(),i),r=j(r,this.m_transform1,this.m_bIsPannableFrom,this.m_pannableExtentFrom,this.m_bIsPannableTo,this.m_pannableExtentTo,null,null,null,null,o,n,i),r=(new b).execute(r,this.m_transform1,i),r}executeBad(t,e,s,i){let n;n=e>0?e*(Math.PI/180/this.m_rpuGcsTo):Math.PI/180/this.m_rpuGcsTo*1e-5;const o=s*s;let r;return r=this.m_bClipTopBottomFrom?x(t,this.m_transform1.getInputSR()):t,r=(new b).execute(r,this.m_transform1,i),r=$(r,this.m_transform2.getInputSR(),this.m_horizon2,this.m_bInclusive2,!0,this.m_pannableExtentGcsTo,!0,Number.NaN,i),r=F(r,this.m_transform2.getOutputSR(),i),r=j(r,this.m_transform2,!0,this.m_pannableExtentGcsTo,this.m_bIsPannableTo,this.m_pannableExtentTo,null,null,null,null,n,o,i),r=(new b).execute(r,this.m_transform2,i),r}executeUgly(t,e,s,i){const n=s*s;let o;o=e>0?this.getMinLengthInSrFrom(e):this.getMinLengthInSrFrom(1e-5);let r=null;r=this.m_bClipTopBottomFrom?x(t,this.m_transform1.getInputSR()):$(t,this.m_transform1.getInputSR(),this.m_horizon1,this.m_bInclusive1,this.m_bIsPannableFrom,this.m_pannableExtentFrom,!0,Number.NaN,i);let h=r;const m=new L(this.m_horizon2,this.m_transform2.getInputSR(),this.m_bInclusive2,this.m_pannableExtentGcsTo),a=this.m_transform2.getOutputSR().getGCSSplitLines(),c=new R(a,this.m_transform1,this.m_pannableExtentGcsTo);if(r=j(r,this.m_transform1,this.m_bIsPannableFrom,this.m_pannableExtentFrom,this.m_bIsPannableTo,this.m_pannableExtentTo,this.m_transform2,m,this.m_pannableExtentGcsTo,c,o,n,i),null!==r){h=null,r=(new b).execute(r,this.m_transform1,i);const t=Math.PI/180/this.m_rpuGcsTo*2;return r=$(r,this.m_transform2.getInputSR(),this.m_horizon2,this.m_bInclusive2,!0,this.m_pannableExtentGcsTo,!1,t,i),r=(new b).execute(r,this.m_transform2,i),r}let l=Number.NaN;l=s>0?s:100*this.m_toTolerance,l/=this.m_rpuGcsTo*this.m_aTo/this.m_mpuTo;const u=l*l;let f;return r=j(h,this.m_transform1,this.m_bIsPannableFrom,this.m_pannableExtentFrom,!0,this.m_pannableExtentGcsTo,null,null,null,null,o,u,i),h=null,r=(new b).execute(r,this.m_transform1,i),f=e>0?e*(Math.PI/180/this.m_rpuGcsTo):Math.PI/180/this.m_rpuGcsTo*1e-5,r=$(r,this.m_transform2.getInputSR(),this.m_horizon2,this.m_bInclusive2,!0,this.m_pannableExtentGcsTo,!1,Number.NaN,i),r=F(r,this.m_transform2.getOutputSR(),i),r=j(r,this.m_transform2,!0,this.m_pannableExtentGcsTo,this.m_bIsPannableTo,this.m_pannableExtentTo,null,null,null,null,f,n,i),r=(new b).execute(r,this.m_transform2,i),r}getMinLengthInSrFrom(t){let e;return e=this.m_bSrFromIsPcs?this.m_aFrom*(t*Math.PI/180)/this.m_mpuFrom:t*Math.PI/180*(1/this.m_rpuFrom),e}filterOverDensification(t,e,s,i){let n=X(t,s);return n.dropAttribute(10),n!==t&&n.getGeometryType()===r.enumPolygon&&(n=(new C).execute(n,e,!1,i)),n}}function X(t,e){if(t.isEmpty()||!t.hasAttribute(10))return t;const s=e*e;let i=t.getAttributeStreamRef(10),n=!1;const o=new _,r=[];let h=!1;for(let a=0,c=t.getPathCount();a<c;a++){const e=t.getPathStart(a),m=t.getPathEnd(a),c=t.isClosedPath(a);if(!(m>e))continue;{const t=c?e:m-1;0===i.read(e)&&0===i.read(t)||(n||(i=i.clone(),n=!0),i.write(e,0),i.write(t,0))}const l=c?m+1:m;let u=e;for(let a=e;a<l;a++){const c=a===m?e:a;if(0===i.read(c)){if(a-u>1){r.push({from:u,to:a});const c=new p;for(;r.length>0;){const a=r.at(-1);r.pop(),o.setStartXY(t.getXY(a.from));const l=a.to===m?e:a.to;o.setEndXY(t.getXY(l));let u=s,f=-1;for(let e=a.from+1,s=a.to;e<s;e++){const s=t.getXY(e),i=o.getClosestCoordinate(s,!1);o.queryCoord2D(i,c);const n=p.sqrDistance(c,s);u<n&&(u=n,f=e)}f>=0?(n||(i=i.clone(),n=!0),i.write(f,0),f-a.from>1&&r.push({from:a.from,to:f}),a.to-f>1&&r.push({from:f,to:a.to})):h=!0}}u=c}}}if(!h)return t;const m=Y(t,i,1);return m.dropAttribute(10),m}function Y(t,e,s){const i=t.createInstance(),n=new l;for(let o=0,r=t.getPathCount();o<r;o++){let r=!0,h=0,m=0;const a=t.getPathStart(o),c=t.getPathEnd(o);let l=!0;for(let u=a;u<c;u++){e.read(u)===s?(!l&&m>0&&(i.addSegmentsFromPath(t,o,h-a,m,r),m=0),l=!0):l?(l=!1,t.getPointByVal(u,n),r?(i.startPathPoint(n),r=!1):i.lineToPoint(n),h=u):m++}m>0&&i.addSegmentsFromPath(t,o,h-a,m,r)}return i}const A=8;function H(t,e){const s=.5;for(let i=0;i<t;i++){let n=Math.ceil(i/2)/(t+1);i%2!=0&&(n=-n);const o=s+n;e[i]=o}}function O(t){if(!t)return!1;const e=t.getCoordinateSystemType();return 2===e||1===e}function j(t,e,s,i,n,o,r,h,m,a,c,l,u){const f=t.createInstance();f.addAttribute(10);const _=t.querySegmentIterator(),d=[],p=[],P=new g,T=t.getDescription().getAttributeCount()>1,b=new lt(e,s,i,n,o,r,h,a,c,l,T?p:null,d,u);for(;_.nextPath();)for(;_.hasNextSegment();){const t=_.nextSegment(),e=t.getStartXY(),s=t.getEndXY(),i=e.compare(s)>0,n=J(i,t,P);d.length=0,p.length=0;if(!b.densifySegment(_.isFirstSegmentInPath(),n))return null;i&&K(T?p:null,d),d.at(-1).setCoordsPoint2D(t.getEndXY());const o=f.getPointCount();if(T){const e=J(i,t,P);U(_.isFirstSegmentInPath(),_.isLastSegmentInPath()&&!_.isPathClosed(),t,e,p,d,f)}else B(_.isFirstSegmentInPath(),_.isLastSegmentInPath()&&!_.isPathClosed(),d,f);if(b.needsPostFiltering()){f.addAttribute(10);const t=f.getAttributeStreamRef(10);for(let e=1,s=d.length-1;e<s;e++)t.write(e+o,1)}}return f}function B(t,e,s,i){t&&i.insertPath2D(-1,null,0,0,!0);const n=i.getPathCount()-1;e?i.insertPointsFromPoints(n,-1,s,0,s.length,!0):i.insertPointsFromPoints(n,-1,s,0,s.length-1,!0)}function U(t,e,s,i,n,o,r){r.reserve(r.getPointCount()+o.length-1);const h=new l;if(s.queryStart(h),t?r.startPathPoint(h):r.lineToPoint(h),o.length>2){const t=i.calculateLength2D();for(let e=1;e<o.length-1;e++){const s=i.lengthToT(n[e]*t);i.queryCoord(s,h),h.setXY(o[e]),r.lineToPoint(h)}}e&&(s.queryEnd(h),r.lineToPoint(h))}function W(t){const e=new f({vd:t.getDescription()});return e.addSegment(t,!0),e}function Q(t,e){const s=e.getInputSR(),i=e.getOutputSR(),n=new p;2===s.getCoordinateSystemType()?(n.setCoordsPoint2D(t),G(s,0,[n],1)):n.setCoordsPoint2D(t);const o=new p;o.setCoordsPoint2D(n),v(e,[o],null,1,!1);const r=new p;return 2===i.getCoordinateSystemType()?(r.setCoordsPoint2D(o),z(i,[r],1,!1)):r.setCoordsPoint2D(o),r}function V(t,e,s,i,n,o,r,h){if(n){const n=o.width(),m=.5*n;if(i){const i=.25*n;let o=!1;const a=new p,c=new p;if(Math.abs(t.y)===i?(a.setCoords(s.x,t.y),c.setCoordsPoint2D(s),o=!0):Math.abs(s.y)===i&&(c.setCoords(t.x,s.y),a.setCoordsPoint2D(t),o=!0),Math.abs(e.y)===i&&(o||(a.setCoordsPoint2D(t),c.setCoordsPoint2D(s),o=!0),a.x=e.x),o)return ot(e,a,m,n,r),ot(e,c,m,n,h),!0}let a=0;t.x-e.x>m&&s.x-e.x>m?a-=n:e.x-t.x>m&&e.x-s.x>m&&(a+=n),Math.abs(e.x-(t.x+a))<m?(r.setCoordsPoint2D(t),ot(r,s,m,n,h),r.x+=a,h.x+=a):(r.setCoordsPoint2D(s),ot(r,t,m,n,h),r.x+=a,h.x+=a)}else r.setCoordsPoint2D(t),h.setCoordsPoint2D(s);return!1}function J(t,e,s){return t?(s.create(e.getGeometryType()),e.copyTo(s.get()),s.get().reverse(),s.get()):e}function K(t,e){e.reverse(),null!==t&&t.reverse()}function Z(t,e,s,i){const n=.5*(i.getStartX()+i.getEndX());if(n-s>t){const t=new T;t.setShiftCoords(-e,0),i.applyTransformation(t)}else if(s-n>t){const t=new T;t.setShiftCoords(e,0),i.applyTransformation(t)}}function $(t,e,s,i,n,o,r,h,m){const a=[!1];r&&tt(t,e,s,i,n,o,!0,h,a,m);let c=t;return a[0]||(c=tt(c,e,s,i,n,o,!1,h,null,m)),c=it(c,n,o,c!==t),c}function tt(t,e,s,i,n,o,h,m,a,c){if(h&&(a[0]=!1),null==s)return t;const l=new u,f=new u;s.queryEnvelope(l),t.queryEnvelope(f);const g=t.getGeometryType(),_=s.getGeometryType(),d=e.getTolerance(0);if(!n){if(h)return a[0]=st(t,s,e,i,c),null;let n;return n=i?_===r.enumEnvelope?k(t,l,d,m,c):(new y).execute(t,s,e,c):(new w).execute(t,s,e,c),n===s&&(n=s.clone()),n}const p=o.width(),P=p*Math.ceil(l.width()/p);let b=null;if(i){let o=nt(t,s,n,P),D=0;const S=new T;do{let n=null;if(_===r.enumEnvelope){const r=s.clone();if(S.setShiftCoords(o*P,0),r.applyTransformation(S),h){if(a[0]=st(t,r,e,i,c),!a[0])return null}else{const e=new u;r.queryEnvelope(e),n=k(t,e,d,m,c)}}else{const r=t.clone();if(S.setShiftCoords(-o*P,0),r.applyTransformation(S),h){if(a[0]=st(r,s,e,i,c),!a[0])return null}else n=(new y).execute(r,s,e,c),n===s&&(n=s.clone())}if(!h){if(n.isEmpty())continue;if(g===r.enumPolygon){const t=new u;if(n.queryEnvelope(t),t.width()<=d)continue}_===r.enumEnvelope&&(S.setShiftCoords(-o*P,0),n===t&&(n=n.clone()),n.applyTransformation(S)),null===b?b=n===t?n.clone():n:b.add(n,!1)}D++}while(l.xmin+ ++o*P<f.xmax);if(h)return null;null===b&&(b=t.createInstance()),g===r.enumPolygon&&D>1&&p-f.width()<=10*d&&(b=(new C).execute(b,e,!0,c))}else{let o=nt(t,s,n,P);if(b=t.clone(),0!==o){const t=new T;t.setShiftCoords(-o*P,0),b.applyTransformation(t)}do{if(h){if(a[0]=st(b,s,e,i,c),!a[0])return null}else if(b=(new w).execute(b,s,e,c),b===s&&(b=s.clone()),b.isEmpty())break;const t=new T;t.setShiftCoords(-P,0),b.applyTransformation(t)}while(l.xmin+ ++o*P<f.xmax);if(h)return null;if(!b.isEmpty()&&0!==o){const t=new T;t.setShiftCoords(o*P,0),b.applyTransformation(t)}}return b}function et(t,e,s,i,n,o,r){const h=[!1];return tt(t,s,e,i,n,o,!0,Number.NaN,h,r),h[0]}function st(t,e,s,i,n){let o;if(e.getGeometryType()===r.enumPolygon)if(i){o=E(e,t,s,64,n)}else{o=E(e,t,s,4,n)}else if(i){const s=new u,i=new u;e.queryEnvelope(s),t.queryEnvelope(i);o=s.containsEnvelope(i)}else{o=E(e,t,s,4,n)}return o}function it(t,e,s,i){let n;if(!e)return t;const o=s.getCenter().x,r=s.width(),h=.5*r,m=new u;t.queryEnvelope(m);const a=m.getCenter().x;let c=0;if(a-o>h){c=-Math.ceil((a-o-h)/r)*r}else if(o-a>h){c=Math.ceil((o-a-h)/r)*r}if(0!==c){n=i?t:t.clone();const e=new T;e.setShiftCoords(c,0),n.applyTransformation(e)}else n=t;return n}function nt(t,e,s,i){if(!s)return 0;let n=0;const o=new u;e.queryEnvelope(o);const r=new u;t.queryEnvelope(r);const h=o.xmin+i;for(;h+i+n*i>r.xmin;)n--;for(;h+n*i<r.xmin;)n++;return n}function ot(t,e,s,i,n){e.x-t.x>s?n.setCoords(e.x-i,e.y):t.x-e.x>s?n.setCoords(e.x+i,e.y):n.setCoordsPoint2D(e)}function rt(t,e,s,i,n,o,r){Math.abs(t.y)===s?(o.setCoords(e.x,t.y),r.setCoordsPoint2D(e)):Math.abs(e.y)===s?(o.setCoordsPoint2D(t),r.setCoords(t.x,e.y)):(o.setCoordsPoint2D(t),ot(o,e,i,n,r))}function ht(t){return t.getUnit().getUnitToBaseFactor()}function mt(t){return t.getUnit().getUnitToBaseFactor()}function at(t){return t.getPECoordSys().getDatum().getSpheroid().getAxis()}function ct(t,e,s){return s<=.5?t+(e-t)*s:e-(e-t)*(1-s)}class lt{checkSegment(){for(let t=0;t<this.n;t++){if(null!==this.pSplitLines2Info&&this.pSplitLines2Info.hasSplitLines()&&!this.bCheckIfNoDensificationNeededForCurve){const t=this.pSplitLines2Info.getSplitLineFactorEx(this.rectifiedSegment,this.leftFactor,this.rightFactor,this.leftGcsToDensifiedPoint,this.rightGcsToDensifiedPoint,this.progressTracker);if(Number.isNaN(t))return-1;if(-1!==t&&this.leftFactor<t&&t<this.rightFactor)return this.cutFactor=t,this.cutFromDensifiedPoint.assign(this.rectifiedSegment.getCoord2D(this.cutFactor)),this.cutToDensifiedPoint.assign(Q(this.cutFromDensifiedPoint,this.transform)),this.cutGcsToDensifiedPoint.setCoordsPoint2D(this.cutToDensifiedPoint),this.cutToDensifiedPoint.assign(Q(this.cutGcsToDensifiedPoint,this.transform2)),this.midFactor=this.cutFactor,this.midFromDensifiedPoint.setCoordsPoint2D(this.cutFromDensifiedPoint),this.midToDensifiedPoint.setCoordsPoint2D(this.cutToDensifiedPoint),this.midGcsToDensifiedPoint.setCoordsPoint2D(this.cutGcsToDensifiedPoint),1}if(this.cutFactor=ct(this.leftFactor,this.rightFactor,this.scalars[t]),this.cutFromDensifiedPoint.assign(this.rectifiedSegment.getCoord2D(this.cutFactor)),this.cutToDensifiedPoint.assign(Q(this.cutFromDensifiedPoint,this.transform)),null!==this.transform2&&(this.cutGcsToDensifiedPoint.setCoordsPoint2D(this.cutToDensifiedPoint),this.cutToDensifiedPoint.assign(Q(this.cutGcsToDensifiedPoint,this.transform2))),0===t&&(this.midFactor=this.cutFactor,this.midFromDensifiedPoint.setCoordsPoint2D(this.cutFromDensifiedPoint),this.midToDensifiedPoint.setCoordsPoint2D(this.cutToDensifiedPoint),this.midGcsToDensifiedPoint.setCoordsPoint2D(this.cutGcsToDensifiedPoint)),this.bIsPannableFrom&&!this.bCheckIfNoDensificationNeededForCurve&&Math.abs(this.leftFromDensifiedPoint.x-this.rightFromDensifiedPoint.x)>=.25*this.pannableExtentFrom.width())return 1;let e;if(this.bCheckIfNoDensificationNeededForCurve){const t=this.projCurveSegment.get().getClosestCoordinate(this.cutToDensifiedPoint,!1),s=this.projCurveSegment.get().getCoord2D(t);e=p.sqrDistance(this.cutToDensifiedPoint,s)}else{const s=new p,i=new p,n=V(this.leftToDensifiedPoint,this.cutToDensifiedPoint,this.rightToDensifiedPoint,this.bSrToIsGcs,this.bIsPannableTo,this.pannableExtentTo,s,i);this.line.setStartXY(s),this.line.setEndXY(i);const o=this.line.getClosestCoordinate(this.cutToDensifiedPoint,!0);if(n||t>0||Math.abs(o-this.scalars[t])<.3){const t=this.line.getCoord2D(o);e=p.sqrDistance(this.cutToDensifiedPoint,t)}else e=2*this.maxDeviationInSrToSq,this.bNeedPostFiltering=!0}if(e>this.maxDeviationInSrToSq)return this.bCheckIfNoDensificationNeededForCurve=!1,1}return 0}constructor(t,e,s,i,n,o,r,h,m,a,c,l,f){this.leftFromDensifiedPoint=new p,this.rightFromDensifiedPoint=new p,this.cutFromDensifiedPoint=new p,this.midFromDensifiedPoint=new p,this.leftToDensifiedPoint=new p,this.rightToDensifiedPoint=new p,this.cutToDensifiedPoint=new p,this.midToDensifiedPoint=new p,this.line=new _,this.leftGcsToDensifiedPoint=new p,this.rightGcsToDensifiedPoint=new p,this.cutGcsToDensifiedPoint=new p,this.midGcsToDensifiedPoint=new p,this.bSrToIsGcs=!1,this.bIsCurve=!1,this.leftFactor=0,this.rightFactor=0,this.bIsFirstInPath=!1,this.rectifiedSegment=null,this.transform=null,this.bIsPannableFrom=!1,this.pannableExtentFrom=new u,this.bIsPannableTo=!1,this.bNeedPostFiltering=!1,this.pannableExtentTo=new u,this.transform2=null,this.pHorizon2Info=null,this.pSplitLines2Info=null,this.minLengthInSrFrom=0,this.maxDeviationInSrToSq=0,this.cutFactor=0,this.midFactor=0,this.pDensifiedFactors=null,this.pDensifiedPoints=[],this.rightFromDensifiedPointsStack=[],this.rightToDensifiedPointsStack=[],this.rightGcsToDensifiedPointsStack=[],this.rightFactorsStack=[],this.projCurveSegment=new g,this.n=0,this.bCheckIfNoDensificationNeededForCurve=!1,this.scalars=P(A-1,Number.NaN),this.progressTracker=f,this.transform=t,this.bIsPannableFrom=e,this.pannableExtentFrom.assign(s),this.bIsPannableTo=i,this.pannableExtentTo.assign(n),this.transform2=o,this.pHorizon2Info=r,this.pSplitLines2Info=h,this.minLengthInSrFrom=m,this.maxDeviationInSrToSq=a,this.pDensifiedFactors=c,this.pDensifiedPoints=l,this.progressTracker=f,this.bNeedPostFiltering=!1}needsPostFiltering(){return this.bNeedPostFiltering}densifySegment(t,e){if(this.bIsFirstInPath=t,this.rectifiedSegment=e,this.leftGcsToDensifiedPoint.setNAN(),this.rightGcsToDensifiedPoint.setNAN(),this.cutGcsToDensifiedPoint.setNAN(),this.midGcsToDensifiedPoint.setNAN(),this.bSrToIsGcs=null!=this.transform2?1===this.transform2.getOutputSR().getCoordinateSystemType():1===this.transform.getOutputSR().getCoordinateSystemType(),this.bIsCurve=this.rectifiedSegment.isCurve(),this.leftFactor=0,this.rightFactor=1,this.leftFromDensifiedPoint.assign(this.rectifiedSegment.getStartXY()),this.rightFromDensifiedPoint.assign(this.rectifiedSegment.getEndXY()),this.leftToDensifiedPoint.assign(Q(this.leftFromDensifiedPoint,this.transform)),this.rightToDensifiedPoint.assign(Q(this.rightFromDensifiedPoint,this.transform)),null!==this.transform2&&(this.leftGcsToDensifiedPoint.setCoordsPoint2D(this.leftToDensifiedPoint),this.rightGcsToDensifiedPoint.setCoordsPoint2D(this.rightToDensifiedPoint),this.leftToDensifiedPoint.assign(Q(this.leftGcsToDensifiedPoint,this.transform2)),this.rightToDensifiedPoint.assign(Q(this.rightGcsToDensifiedPoint,this.transform2)),this.bIsFirstInPath&&!this.pHorizon2Info.isPointStartInHorizon(this.leftGcsToDensifiedPoint,this.progressTracker)))return!1;this.rightFromDensifiedPointsStack.length=0,this.rightToDensifiedPointsStack.length=0,this.rightGcsToDensifiedPointsStack.length=0,this.rightFactorsStack.length=0,this.rightFromDensifiedPointsStack.push(this.rightFromDensifiedPoint.clone()),this.rightToDensifiedPointsStack.push(this.rightToDensifiedPoint.clone()),this.rightFactorsStack.push(this.rightFactor),null!=this.transform2&&this.rightGcsToDensifiedPointsStack.push(this.rightGcsToDensifiedPoint.clone()),null!==this.pDensifiedPoints&&this.pDensifiedPoints.push(this.leftFromDensifiedPoint.clone()),null!==this.pDensifiedFactors&&this.pDensifiedFactors.push(this.leftFactor),this.bIsCurve?this.rectifiedSegment.getGeometryType()===r.enumBezier?this.n=A-1:this.n=5:this.n=3,H(this.n,this.scalars);const s=this.rectifiedSegment.calculateLength2D();if(this.bCheckIfNoDensificationNeededForCurve=!1,this.bIsCurve){const t=new f({vd:this.rectifiedSegment.getDescription()});let e=(new b).execute(t,this.transform,this.progressTracker);if(null!==this.transform2){const t=new u;if(e.queryEnvelope(t),!this.pHorizon2Info.isEnvelopeInHorizon(t,this.progressTracker))return!1;e=(new b).execute(e,this.transform2,this.progressTracker)}e.getSegmentBuffer(0,this.projCurveSegment,!1),this.bCheckIfNoDensificationNeededForCurve=!0}for(;this.rightFromDensifiedPointsStack.length>0;){let t=!1;if(this.cutFactor=Number.NaN,this.midFactor=Number.NaN,this.midFromDensifiedPoint.setNAN(),this.midToDensifiedPoint.setNAN(),(this.rightFactor-this.leftFactor)*s>this.minLengthInSrFrom){const e=this.checkSegment();if(-1===e)return!1;t=0!==e}if(t)this.rightFromDensifiedPoint.setCoordsPoint2D(this.midFromDensifiedPoint),this.rightToDensifiedPoint.setCoordsPoint2D(this.midToDensifiedPoint),this.rightFactor=this.midFactor,this.rightFromDensifiedPointsStack.push(this.rightFromDensifiedPoint.clone()),this.rightToDensifiedPointsStack.push(this.rightToDensifiedPoint.clone()),this.rightFactorsStack.push(this.rightFactor),null!==this.transform2&&(this.rightGcsToDensifiedPoint.setCoordsPoint2D(this.midGcsToDensifiedPoint),this.rightGcsToDensifiedPointsStack.push(this.rightGcsToDensifiedPoint.clone()));else{if(null!==this.transform2&&!this.pHorizon2Info.isAdjoiningLineInHorizon(this.leftGcsToDensifiedPoint,this.rightGcsToDensifiedPoint,this.progressTracker))return!1;if(this.rightFromDensifiedPointsStack.pop(),this.rightToDensifiedPointsStack.pop(),this.rightFactorsStack.pop(),null!==this.transform2&&this.rightGcsToDensifiedPointsStack.pop(),null!==this.pDensifiedPoints&&this.pDensifiedPoints.push(this.rightFromDensifiedPoint.clone()),null!==this.pDensifiedFactors&&this.pDensifiedFactors.push(this.rightFactor),this.rightFromDensifiedPointsStack.length>0){this.leftFromDensifiedPoint.setCoordsPoint2D(this.rightFromDensifiedPoint),this.leftToDensifiedPoint.setCoordsPoint2D(this.rightToDensifiedPoint),this.leftFactor=this.rightFactor;const t=this.rightFromDensifiedPointsStack.at(-1),e=this.rightToDensifiedPointsStack.at(-1);if(this.rightFromDensifiedPoint.setCoordsPoint2D(t),this.rightToDensifiedPoint.setCoordsPoint2D(e),this.rightFactor=this.rightFactorsStack.at(-1),null!==this.transform2){this.leftGcsToDensifiedPoint.setCoordsPoint2D(this.rightGcsToDensifiedPoint);const t=this.rightGcsToDensifiedPointsStack.at(-1);this.rightGcsToDensifiedPoint.setCoordsPoint2D(t)}}}}return!0}}class ut{getOperatorType(){return 10315}supportsCurves(){return!1}accelerateGeometry(t,e,s){return!1}canAccelerateGeometry(t){return!1}executeMany(t,e,s,i,n,o){return q(s)?new ft(t,e,s,i,n,o):(new b).executeMany(t,s,o)}execute(t,e,s,i,n){if(!q(e))return(new b).execute(t,e,n);const o=new M;return o.prepare(e,null,n),o.execute(t,s,i,n)}}class ft extends t{constructor(t,s,i,n,o,r){super(),this.m_spp=null,this.m_index=-1,t||e(""),this.m_progressTracker=r,this.m_geometries=t,this.m_geometriesExtent=s?s.clone():null,this.m_transform=i,this.m_minSegmentLengthInDegrees=n,this.m_maxDeviationInSrTo=o}tock(){return!0}getRank(){return 1}next(){this.m_spp||(this.m_spp=new M,this.m_spp.prepare(this.m_transform,this.m_geometriesExtent,this.m_progressTracker));const t=this.m_geometries.next();return s(t),i(t),null!=t?(this.m_index=this.m_geometries.getGeometryID(),this.m_spp.execute(t,this.m_minSegmentLengthInDegrees,this.m_maxDeviationInSrTo,this.m_progressTracker)):null}getGeometryID(){return this.m_index}}export{ut as OperatorShapePreservingProject};
5
+ import{G as t}from"./SimpleGeometryCursor.js";import{a as e,c as s,o as i,p as n,g as o,G as r,f as h,h as m,t as a}from"./Geometry.js";import{E as c,P as l}from"./Envelope.js";import{Envelope2D as u}from"./Envelope2D.js";import{P as f,S as g,L as _}from"./MultiPathImpl.js";import{p as d,P as p,d as P}from"./Point2D.js";import{T}from"./Transformation2D.js";import{O as b,J as D,I as S,H as I,a7 as x,aH as F,L as C,R as N,Q as y,V as w,U as E,af as G,aI as v,ae as z}from"./UnitFactory.js";import{c as k}from"./OperatorClip.js";function q(t){const e=t.getInputSR(),s=t.getOutputSR();let i=!1;do{if(e.equals(s)){i=!1;break}if(!O(e)||!O(s)){i=!1;break}if(2===e.getCoordinateSystemType()){i=!0;break}if(2===s.getCoordinateSystemType()){i=!0;break}const n=t.getGeographicTransformations();if(null!==n&&n.count()>0){i=!0;break}}while(0);return i}class L{constructor(t,e,s,i){this.m_horizon2Env=new u,this.m_horizon2=t,this.m_sr=e,this.m_bInclusive2=s,this.m_pannableExtent=i.clone(),this.m_segIter=null,this.m_qtIter=null,null!==t?(t.queryEnvelope(this.m_horizon2Env),this.m_gcs360=i.width(),this.m_gcs180=.5*this.m_gcs360,this.m_gcs90=.25*this.m_gcs360,this.m_pannableFactor=1,this.m_horizon2Env.width()-this.m_gcs360>0&&(this.m_pannableFactor+=Math.ceil((this.m_horizon2Env.width()-this.m_gcs360)/this.m_gcs360)),this.m_period=this.m_gcs360):(this.m_horizon2Env.setEmpty(),this.m_gcs360=Number.NaN,this.m_gcs180=Number.NaN,this.m_gcs90=Number.NaN,this.m_pannableFactor=Number.NaN,this.m_period=Number.NaN),this.m_gcsTolerance=null!=e?e.getTolerance(0):Number.NaN}isPointStartInHorizon(t,e){if(!this.m_horizon2)return!0;let s=nt(new l(t),this.m_horizon2,!0,this.m_period);do{const e=t.clone();if(e.x-=s*this.m_period,this.m_horizon2.getGeometryType()===r.enumPolygon){let t;if(t=this.m_horizon2Env.contains(e)?N(this.m_horizon2,e,0):0,this.m_bInclusive2){if(0===t)return!1}else if(1===t)return!1}else{const t=this.m_horizon2Env.contains(e);if(this.m_bInclusive2){if(!t)return!1}else if(t)return!1}}while(this.m_horizon2Env.xmin+ ++s*this.m_period<t.x);return!0}isAdjoiningLineInHorizon(t,e,s){if(!this.m_horizon2)return!0;const i=new p,n=new p;rt(t,e,this.m_gcs90,this.m_gcs180,this.m_gcs360,i,n);const h=Math.max(i.x,n.x),m=new _;m.setStart2D(i),m.setEnd2D(n);let a=nt(m,this.m_horizon2,!0,this.m_period);const c=!1;do{const t=i.clone(),e=n.clone();if(t.x-=a*this.m_period,e.x-=a*this.m_period,this.m_horizon2.getGeometryType()===r.enumPolygon){const s=new _;s.setStartXY(t),s.setEndXY(e);const i=new u,n=new u;if(s.queryEnvelope(i),n.setCoords({env2D:i}),n.inflateCoords(this.m_gcsTolerance,this.m_gcsTolerance),this.m_horizon2Env.isIntersecting(n)){const t=this.m_horizon2.getImpl(),e=t.getAccelerators();if(null!==e){null!==e.getRasterizedGeometry()&&o(0)}{let i=null;if(null!==e&&(i=e.getQuadTree()),null!==i){this.m_qtIter||(this.m_qtIter=i.getIteratorForQT()),this.m_qtIter.resetIterator(s,this.m_gcsTolerance),this.m_segIter||(this.m_segIter=t.querySegmentIterator());for(let t=this.m_qtIter.next();-1!==t;t=this.m_qtIter.next()){const e=i.getElement(t);this.m_segIter.resetToVertex(e,-1);if(this.m_segIter.nextSegment().isIntersecting(s,this.m_gcsTolerance))return!1}}else for(this.m_segIter||(this.m_segIter=t.querySegmentIterator()),this.m_segIter.resetToFirstPath();this.m_segIter.nextPath();)for(;this.m_segIter.hasNextSegment();){const t=this.m_segIter.nextSegment(),e=new u;if(t.queryEnvelope(e),e.isIntersecting(n)&&t.isIntersecting(s,this.m_gcsTolerance))return!1}}}}else if(this.m_bInclusive2){const s=this.m_horizon2Env.contains(t),i=this.m_horizon2Env.contains(e);if(s&&i)return!0}else{const s=this.m_horizon2Env.clone();s.inflateCoords(this.m_gcsTolerance,this.m_gcsTolerance);if(!(0===s.clipLine(t,e)))return!1}}while(this.m_horizon2Env.xmin+ ++a*this.m_period<h);return!this.m_bInclusive2||c}isEnvelopeInHorizon(t,e){if(!this.m_horizon2)return!0;const s=new c({env2D:t});let i=nt(s,this.m_horizon2,!0,this.m_period);do{const n=t.clone();n.move(-i*this.m_period,0),s.setCoords(n.xmin,n.ymin,n.xmax,n.ymax);if(!st(s,this.m_horizon2,this.m_sr,this.m_bInclusive2,e))return!1}while(this.m_horizon2Env.xmin+ ++i*this.m_period<t.xmax);return!0}}class R{constructor(t,e,s){this.m_splitLines2=null,this.m_scalars=[],this.m_splitIter=null,this.m_splitLines2=t,this.m_transform1=e,this.m_pannableExtent=s.clone(),this.m_gcs360=s.width(),this.m_gcs180=.5*this.m_gcs360,this.m_gcs90=.25*this.m_gcs360,null!==e?(this.m_gcsTolerance=this.m_transform1.getOutputSR().getTolerance(0),this.m_halfGcsTolerance=.5*this.m_gcsTolerance,this.m_gcsToleranceSq=this.m_gcsTolerance*this.m_gcsTolerance):(this.m_gcsTolerance=Number.NaN,this.m_halfGcsTolerance=Number.NaN,this.m_gcsToleranceSq=Number.NaN)}hasSplitLines(){return null!=this.m_splitLines2}getSplitLineFactorEx(t,e,s,i,n,o){const r=new p,h=new p;rt(i,n,this.m_gcs90,this.m_gcs180,this.m_gcs360,r,h);const m=new _;for(m.setStartXY(r),m.setEndXY(h),this.m_splitIter?this.m_splitIter.resetToFirstPath():this.m_splitIter=this.m_splitLines2.getImpl().querySegmentIterator();this.m_splitIter.nextPath();)for(;this.m_splitIter.hasNextSegment();){const i=this.m_splitIter.nextSegment(),n=.5*(i.getStartX()+i.getEndX());Z(this.m_gcs180,this.m_gcs360,n,m);const r=new u;m.queryEnvelope(r),r.inflateCoords(this.m_gcsTolerance,this.m_gcsTolerance);const h=new u;if(i.queryEnvelope(h),!r.isIntersecting(h))continue;this.m_scalars.length<2&&(this.m_scalars.length=2);if(1===m.intersect(i,null,this.m_scalars,null,this.m_gcsTolerance)&&(this.m_scalars[0]>0&&this.m_scalars[0]<1)){const n=ct(e,s,this.m_scalars[0]),r=Q(t.getCoord2D(n),this.m_transform1);if(i.isIntersectingPoint(r,this.m_halfGcsTolerance))return n;return this.getSplitLineFactor(t,e,s,i,o)}}return-1}getSplitLineFactor(t,e,s,i,n){let o=e,r=s;const h=.5*(i.getStartX()+i.getEndX()),m=new _,a=t.getCoord2D(o),c=t.getCoord2D(r),l=Q(a,this.m_transform1),u=Q(c,this.m_transform1);for(;o<r;){const e=new p,s=new p;rt(l,u,this.m_gcs90,this.m_gcs180,this.m_gcs360,e,s),m.setStartXY(e),m.setEndXY(s),Z(this.m_gcs180,this.m_gcs360,h,m);const n=p.sqrDistance(m.getStartXY(),m.getEndXY());if(n<=this.m_gcsToleranceSq)break;if(Number.isNaN(n))return Number.NaN;let f=ct(o,r,this.m_scalars[0]);if(o<f&&f<r||(f=.5*(r+o)),o===f||f===r)return f;const g=t.getCoord2D(f),_=Q(g,this.m_transform1),d=new p;rt(l,_,this.m_gcs90,this.m_gcs180,this.m_gcs360,e,d),m.setStartXY(e),m.setEndXY(d),Z(this.m_gcs180,this.m_gcs360,h,m);let P=m.intersect(i,null,this.m_scalars,null,this.m_halfGcsTolerance);if(0!==P){if(1===this.m_scalars[0])return f;r=f,c.setCoordsPoint2D(g),u.setCoordsPoint2D(_)}else{if(rt(_,u,this.m_gcs90,this.m_gcs180,this.m_gcs360,d,s),m.setStartXY(d),m.setEndXY(s),Z(this.m_gcs180,this.m_gcs360,h,m),P=m.intersect(i,null,this.m_scalars,null,this.m_halfGcsTolerance),0===P)return f;if(0===this.m_scalars[0])return f;o=f,a.setCoordsPoint2D(g),l.setCoordsPoint2D(_)}}return.5*(r+o)}}class M{constructor(){this.m_bPrepared=!1,this.m_bNeedsShapePreservingProject=!1,this.m_inputTransform=null,this.m_transform1=null,this.m_transform2=null,this.m_extentFrom=null,this.m_horizon1=null,this.m_horizon2=null,this.m_pannableExtentFrom=new u,this.m_pannableExtentTo=new u,this.m_pannableExtentGcsTo=new u,this.m_bClipTopBottomFrom=!1,this.m_bNeedsGeoTransform=!1,this.m_bIsPannableFrom=!1,this.m_bIsPannableTo=!1,this.m_bInclusive1=!1,this.m_bInclusive2=!1,this.m_bSrFromIsPcs=!1,this.m_bSrToIsPcs=!1,this.m_fromTolerance=Number.NaN,this.m_toTolerance=Number.NaN,this.m_gcsToTolerance=Number.NaN,this.m_aFrom=Number.NaN,this.m_mpuFrom=Number.NaN,this.m_rpuFrom=Number.NaN,this.m_rpuGcsTo=Number.NaN,this.m_aTo=Number.NaN,this.m_mpuTo=Number.NaN,this.m_stages=0}prepare(t,s,i){this.m_bPrepared&&n(""),t||e("");const r=t.getInputSR(),h=t.getOutputSR();O(r)&&O(h)||e("shape preserving project requires PCS or GCS");const m=r.getCoordinateSystemType(),a=h.getCoordinateSystemType();this.m_bSrFromIsPcs=2===m,this.m_bSrToIsPcs=2===a;let c=null,l=null,u=null,f=null;this.m_bSrFromIsPcs?(c=r,u=r.getGCS(),this.m_aFrom=at(u),this.m_mpuFrom=mt(c),this.m_rpuFrom=Number.NaN):(u=r,this.m_rpuFrom=ht(u),this.m_aFrom=Number.NaN),this.m_bSrToIsPcs?(l=h,f=h.getGCS(),this.m_aTo=at(f),this.m_mpuTo=mt(l)):(f=h,this.m_aTo=Number.NaN,this.m_mpuTo=Number.NaN),this.m_rpuGcsTo=ht(f);const g=t.getGeographicTransformations();this.m_bNeedsGeoTransform=null!==g&&g.count()>0;const _=r.equals(h);if(this.m_bNeedsShapePreservingProject=!_&&(this.m_bSrFromIsPcs||this.m_bSrToIsPcs||this.m_bNeedsGeoTransform),!this.m_bNeedsShapePreservingProject)return this.m_inputTransform=t,this.m_extentFrom=s?s.clone():null,void(this.m_bPrepared=!0);if(this.m_bIsPannableFrom=r.isPannable(),this.m_bIsPannableTo=h.isPannable(),this.m_bIsPannableFrom&&(this.m_pannableExtentFrom=r.getPannableExtent()),this.m_bIsPannableTo&&(this.m_pannableExtentTo=h.getPannableExtent()),this.m_bSrToIsPcs){this.m_pannableExtentGcsTo=f.getPannableExtent();const t=l.getCentralMeridian(),e=this.m_pannableExtentGcsTo.getCenter();e.x=t,this.m_pannableExtentGcsTo.centerAt(e)}else this.m_pannableExtentGcsTo=this.m_pannableExtentTo.clone();this.m_fromTolerance=r.getTolerance(0),this.m_toTolerance=h.getTolerance(0),this.m_gcsToTolerance=f.getTolerance(0);{const e=t.getExtendedParams(),n=e.clipWithInputHorizon,o=e.clipWithOutputHorizon;n&&this.setHorizon1(t,s,i),o&&this.setHorizon2(t,i),this.checkAndSetStages(t,i)}const d=D();d.setFlag(1073741824,!0),d.setFlag(536870912,!0);const p=S();if(p.clipWithInputHorizon=!1,p.clipWithOutputHorizon=!1,1===this.m_stages)this.m_transform1=I(!1,r,h,g,p,d);else if(2===this.m_stages){d.setFlag(2147483648,!0),this.m_transform1=I(!1,r,f,g,p,d);const t=D();this.m_transform2=I(!1,f,h,null,p,t)}else{o(null!=l),p.centralMeridianOfOutputGCS=l.getCentralMeridian(),this.m_transform1=I(!1,r,f,g,p,d);const t=D();t.setFlag(2147483648,!0),this.m_transform2=I(!1,f,h,null,p,t)}this.m_inputTransform=t,this.m_extentFrom=s?s.clone():null,this.m_bPrepared=!0}execute(t,e,s,i){this.m_bPrepared||n(""),o(!t.hasAttribute(10));return this.execute_(t,e,s,i)}checkIfNeedsReset(t,e){return o(0),!1}setHorizon1(t,e,s){const i=t.getInputSR();let n,o=null;const r=new u;if(this.m_bSrFromIsPcs){n=!0,o=i.getPCSHorizon(),o.queryEnvelope(r),this.m_bIsPannableFrom&&(o=new c({xmin:this.m_pannableExtentFrom.xmin,ymin:r.ymin,xmax:this.m_pannableExtentFrom.xmax,ymax:r.ymax}));let t=!1;null!=e&&(t=et(e,o,i,n,this.m_bIsPannableFrom,this.m_pannableExtentFrom,s)),t||(this.m_horizon1=o,this.m_bInclusive1=n)}else this.m_bClipTopBottomFrom=!0,this.m_bInclusive1=!0}setHorizon2(t,e){const s=t.getOutputSR();if(1===s.getCoordinateSystemType())return this.m_horizon2=null,void(this.m_bInclusive2=!1);let i=null;const n=new u,o=s.getGCSHorisonIsInclusive();i=s.getGCSHorizon(),i.queryEnvelope(n);const r=s.getCentralMeridian();if(this.m_bIsPannableTo){const t=new c({xmin:this.m_pannableExtentGcsTo.xmin,ymin:n.ymin,xmax:this.m_pannableExtentGcsTo.xmax,ymax:n.ymax});t.centerAt(r,0),i=t}this.m_horizon2=i,this.m_bInclusive2=o}checkAndSetStages(t,e){const s=t.getOutputSR().getGCSSplitLines();if(!this.m_horizon2&&!s)return void(this.m_stages=1);if(this.m_horizon2.getGeometryType()===r.enumEnvelope){const t=new u;this.m_horizon2.queryEnvelope(t);const e=t.width(),s=t.height();e>=d/this.m_rpuGcsTo&&s>=Math.PI/this.m_rpuGcsTo&&(this.m_horizon2=null)}if(this.m_horizon2||s){if(null!==this.m_horizon2&&!this.m_bNeedsGeoTransform&&!this.m_bSrFromIsPcs){const e=t.getOutputSR().getGCS();return t.getInputSR().equals(e)?(this.m_horizon1=this.m_horizon2,this.m_bInclusive1=this.m_bInclusive2,this.m_bClipTopBottomFrom=!1,this.m_horizon2=null,this.m_bInclusive2=!1,void(this.m_stages=1)):void(this.m_stages=2)}this.m_stages=3}else this.m_stages=1}execute_(t,e,n,o){if(!this.m_bNeedsShapePreservingProject)return(new b).execute(t,this.m_inputTransform,o);if(!t)return null;s(t),i(t);let a,c=t.getGeometryType();return h(c)?(a=W(t),c=r.enumPolyline):a=t,a.isEmpty()?a:m(c)?this.executeEx(t,e,n,o):(new b).execute(t,this.m_inputTransform,o)}executeEx(t,e,s,i){let n;t.hasNonLinearSegments()&&a(""),n=this.m_bIsPannableFrom?(new b).foldInto360Range(t,this.m_transform1.getInputSR()):t;let o,r=s;return r>0||(r=100*this.m_toTolerance),o=1===this.m_stages?this.executeGood(n,e,r,i):2===this.m_stages?this.executeBad(n,e,r,i):this.executeUgly(n,e,r,i),this.filterOverDensification(o,this.m_inputTransform.getOutputSR(),r,i)}executeGood(t,e,s,i){const n=s*s;let o,r;return o=e>0?this.getMinLengthInSrFrom(e):this.getMinLengthInSrFrom(1e-5),r=this.m_bClipTopBottomFrom?x(t,this.m_transform1.getInputSR()):$(t,this.m_transform1.getInputSR(),this.m_horizon1,this.m_bInclusive1,this.m_bIsPannableFrom,this.m_pannableExtentFrom,!0,Number.NaN,i),r=F(r,this.m_transform1.getOutputSR(),i),r=j(r,this.m_transform1,this.m_bIsPannableFrom,this.m_pannableExtentFrom,this.m_bIsPannableTo,this.m_pannableExtentTo,null,null,null,null,o,n,i),r=(new b).execute(r,this.m_transform1,i),r}executeBad(t,e,s,i){let n;n=e>0?e*(Math.PI/180/this.m_rpuGcsTo):Math.PI/180/this.m_rpuGcsTo*1e-5;const o=s*s;let r;return r=this.m_bClipTopBottomFrom?x(t,this.m_transform1.getInputSR()):t,r=(new b).execute(r,this.m_transform1,i),r=$(r,this.m_transform2.getInputSR(),this.m_horizon2,this.m_bInclusive2,!0,this.m_pannableExtentGcsTo,!0,Number.NaN,i),r=F(r,this.m_transform2.getOutputSR(),i),r=j(r,this.m_transform2,!0,this.m_pannableExtentGcsTo,this.m_bIsPannableTo,this.m_pannableExtentTo,null,null,null,null,n,o,i),r=(new b).execute(r,this.m_transform2,i),r}executeUgly(t,e,s,i){const n=s*s;let o;o=e>0?this.getMinLengthInSrFrom(e):this.getMinLengthInSrFrom(1e-5);let r=null;r=this.m_bClipTopBottomFrom?x(t,this.m_transform1.getInputSR()):$(t,this.m_transform1.getInputSR(),this.m_horizon1,this.m_bInclusive1,this.m_bIsPannableFrom,this.m_pannableExtentFrom,!0,Number.NaN,i);let h=r;const m=new L(this.m_horizon2,this.m_transform2.getInputSR(),this.m_bInclusive2,this.m_pannableExtentGcsTo),a=this.m_transform2.getOutputSR().getGCSSplitLines(),c=new R(a,this.m_transform1,this.m_pannableExtentGcsTo);if(r=j(r,this.m_transform1,this.m_bIsPannableFrom,this.m_pannableExtentFrom,this.m_bIsPannableTo,this.m_pannableExtentTo,this.m_transform2,m,this.m_pannableExtentGcsTo,c,o,n,i),null!==r){h=null,r=(new b).execute(r,this.m_transform1,i);const t=Math.PI/180/this.m_rpuGcsTo*2;return r=$(r,this.m_transform2.getInputSR(),this.m_horizon2,this.m_bInclusive2,!0,this.m_pannableExtentGcsTo,!1,t,i),r=(new b).execute(r,this.m_transform2,i),r}let l=Number.NaN;l=s>0?s:100*this.m_toTolerance,l/=this.m_rpuGcsTo*this.m_aTo/this.m_mpuTo;const u=l*l;let f;return r=j(h,this.m_transform1,this.m_bIsPannableFrom,this.m_pannableExtentFrom,!0,this.m_pannableExtentGcsTo,null,null,null,null,o,u,i),h=null,r=(new b).execute(r,this.m_transform1,i),f=e>0?e*(Math.PI/180/this.m_rpuGcsTo):Math.PI/180/this.m_rpuGcsTo*1e-5,r=$(r,this.m_transform2.getInputSR(),this.m_horizon2,this.m_bInclusive2,!0,this.m_pannableExtentGcsTo,!1,Number.NaN,i),r=F(r,this.m_transform2.getOutputSR(),i),r=j(r,this.m_transform2,!0,this.m_pannableExtentGcsTo,this.m_bIsPannableTo,this.m_pannableExtentTo,null,null,null,null,f,n,i),r=(new b).execute(r,this.m_transform2,i),r}getMinLengthInSrFrom(t){let e;return e=this.m_bSrFromIsPcs?this.m_aFrom*(t*Math.PI/180)/this.m_mpuFrom:t*Math.PI/180*(1/this.m_rpuFrom),e}filterOverDensification(t,e,s,i){let n=X(t,s);return n.dropAttribute(10),n!==t&&n.getGeometryType()===r.enumPolygon&&(n=(new C).execute(n,e,!1,i)),n}}function X(t,e){if(t.isEmpty()||!t.hasAttribute(10))return t;const s=e*e;let i=t.getAttributeStreamRef(10),n=!1;const o=new _,r=[];let h=!1;for(let a=0,c=t.getPathCount();a<c;a++){const e=t.getPathStart(a),m=t.getPathEnd(a),c=t.isClosedPath(a);if(!(m>e))continue;{const t=c?e:m-1;0===i.read(e)&&0===i.read(t)||(n||(i=i.clone(),n=!0),i.write(e,0),i.write(t,0))}const l=c?m+1:m;let u=e;for(let a=e;a<l;a++){const c=a===m?e:a;if(0===i.read(c)){if(a-u>1){r.push({from:u,to:a});const c=new p;for(;r.length>0;){const a=r.at(-1);r.pop(),o.setStartXY(t.getXY(a.from));const l=a.to===m?e:a.to;o.setEndXY(t.getXY(l));let u=s,f=-1;for(let e=a.from+1,s=a.to;e<s;e++){const s=t.getXY(e),i=o.getClosestCoordinate(s,!1);o.queryCoord2D(i,c);const n=p.sqrDistance(c,s);u<n&&(u=n,f=e)}f>=0?(n||(i=i.clone(),n=!0),i.write(f,0),f-a.from>1&&r.push({from:a.from,to:f}),a.to-f>1&&r.push({from:f,to:a.to})):h=!0}}u=c}}}if(!h)return t;const m=Y(t,i,1);return m.dropAttribute(10),m}function Y(t,e,s){const i=t.createInstance(),n=new l;for(let o=0,r=t.getPathCount();o<r;o++){let r=!0,h=0,m=0;const a=t.getPathStart(o),c=t.getPathEnd(o);let l=!0;for(let u=a;u<c;u++){e.read(u)===s?(!l&&m>0&&(i.addSegmentsFromPath(t,o,h-a,m,r),m=0),l=!0):l?(l=!1,t.getPointByVal(u,n),r?(i.startPathPoint(n),r=!1):i.lineToPoint(n),h=u):m++}m>0&&i.addSegmentsFromPath(t,o,h-a,m,r)}return i}const A=8;function H(t,e){const s=.5;for(let i=0;i<t;i++){let n=Math.ceil(i/2)/(t+1);i%2!=0&&(n=-n);const o=s+n;e[i]=o}}function O(t){if(!t)return!1;const e=t.getCoordinateSystemType();return 2===e||1===e}function j(t,e,s,i,n,o,r,h,m,a,c,l,u){const f=t.createInstance();f.addAttribute(10);const _=t.querySegmentIterator(),d=[],p=[],P=new g,T=t.getDescription().getAttributeCount()>1,b=new lt(e,s,i,n,o,r,h,a,c,l,T?p:null,d,u);for(;_.nextPath();)for(;_.hasNextSegment();){const t=_.nextSegment(),e=t.getStartXY(),s=t.getEndXY(),i=e.compare(s)>0,n=J(i,t,P);d.length=0,p.length=0;if(!b.densifySegment(_.isFirstSegmentInPath(),n))return null;i&&K(T?p:null,d),d.at(-1).setCoordsPoint2D(t.getEndXY());const o=f.getPointCount();if(T){const e=J(i,t,P);U(_.isFirstSegmentInPath(),_.isLastSegmentInPath()&&!_.isPathClosed(),t,e,p,d,f)}else B(_.isFirstSegmentInPath(),_.isLastSegmentInPath()&&!_.isPathClosed(),d,f);if(b.needsPostFiltering()){f.addAttribute(10);const t=f.getAttributeStreamRef(10);for(let e=1,s=d.length-1;e<s;e++)t.write(e+o,1)}}return f}function B(t,e,s,i){t&&i.insertPath2D(-1,null,0,0,!0);const n=i.getPathCount()-1;e?i.insertPointsFromPoints(n,-1,s,0,s.length,!0):i.insertPointsFromPoints(n,-1,s,0,s.length-1,!0)}function U(t,e,s,i,n,o,r){r.reserve(r.getPointCount()+o.length-1);const h=new l;if(s.queryStart(h),t?r.startPathPoint(h):r.lineToPoint(h),o.length>2){const t=i.calculateLength2D();for(let e=1;e<o.length-1;e++){const s=i.lengthToT(n[e]*t);i.queryCoord(s,h),h.setXY(o[e]),r.lineToPoint(h)}}e&&(s.queryEnd(h),r.lineToPoint(h))}function W(t){const e=new f({vd:t.getDescription()});return e.addSegment(t,!0),e}function Q(t,e){const s=e.getInputSR(),i=e.getOutputSR(),n=new p;2===s.getCoordinateSystemType()?(n.setCoordsPoint2D(t),G(s,0,[n],1)):n.setCoordsPoint2D(t);const o=new p;o.setCoordsPoint2D(n),v(e,[o],null,1,!1);const r=new p;return 2===i.getCoordinateSystemType()?(r.setCoordsPoint2D(o),z(i,[r],1,!1)):r.setCoordsPoint2D(o),r}function V(t,e,s,i,n,o,r,h){if(n){const n=o.width(),m=.5*n;if(i){const i=.25*n;let o=!1;const a=new p,c=new p;if(Math.abs(t.y)===i?(a.setCoords(s.x,t.y),c.setCoordsPoint2D(s),o=!0):Math.abs(s.y)===i&&(c.setCoords(t.x,s.y),a.setCoordsPoint2D(t),o=!0),Math.abs(e.y)===i&&(o||(a.setCoordsPoint2D(t),c.setCoordsPoint2D(s),o=!0),a.x=e.x),o)return ot(e,a,m,n,r),ot(e,c,m,n,h),!0}let a=0;t.x-e.x>m&&s.x-e.x>m?a-=n:e.x-t.x>m&&e.x-s.x>m&&(a+=n),Math.abs(e.x-(t.x+a))<m?(r.setCoordsPoint2D(t),ot(r,s,m,n,h),r.x+=a,h.x+=a):(r.setCoordsPoint2D(s),ot(r,t,m,n,h),r.x+=a,h.x+=a)}else r.setCoordsPoint2D(t),h.setCoordsPoint2D(s);return!1}function J(t,e,s){return t?(s.create(e.getGeometryType()),e.copyTo(s.get()),s.get().reverse(),s.get()):e}function K(t,e){e.reverse(),null!==t&&t.reverse()}function Z(t,e,s,i){const n=.5*(i.getStartX()+i.getEndX());if(n-s>t){const t=new T;t.setShiftCoords(-e,0),i.applyTransformation(t)}else if(s-n>t){const t=new T;t.setShiftCoords(e,0),i.applyTransformation(t)}}function $(t,e,s,i,n,o,r,h,m){const a=[!1];r&&tt(t,e,s,i,n,o,!0,h,a,m);let c=t;return a[0]||(c=tt(c,e,s,i,n,o,!1,h,null,m)),c=it(c,n,o,c!==t),c}function tt(t,e,s,i,n,o,h,m,a,c){if(h&&(a[0]=!1),null==s)return t;const l=new u,f=new u;s.queryEnvelope(l),t.queryEnvelope(f);const g=t.getGeometryType(),_=s.getGeometryType(),d=e.getTolerance(0);if(!n){if(h)return a[0]=st(t,s,e,i,c),null;let n;return n=i?_===r.enumEnvelope?k(t,l,d,m,c):(new y).execute(t,s,e,c):(new w).execute(t,s,e,c),n===s&&(n=s.clone()),n}const p=o.width(),P=p*Math.ceil(l.width()/p);let b=null;if(i){let o=nt(t,s,n,P),D=0;const S=new T;do{let n=null;if(_===r.enumEnvelope){const r=s.clone();if(S.setShiftCoords(o*P,0),r.applyTransformation(S),h){if(a[0]=st(t,r,e,i,c),!a[0])return null}else{const e=new u;r.queryEnvelope(e),n=k(t,e,d,m,c)}}else{const r=t.clone();if(S.setShiftCoords(-o*P,0),r.applyTransformation(S),h){if(a[0]=st(r,s,e,i,c),!a[0])return null}else n=(new y).execute(r,s,e,c),n===s&&(n=s.clone())}if(!h){if(n.isEmpty())continue;if(g===r.enumPolygon){const t=new u;if(n.queryEnvelope(t),t.width()<=d)continue}_===r.enumEnvelope&&(S.setShiftCoords(-o*P,0),n===t&&(n=n.clone()),n.applyTransformation(S)),null===b?b=n===t?n.clone():n:b.add(n,!1)}D++}while(l.xmin+ ++o*P<f.xmax);if(h)return null;null===b&&(b=t.createInstance()),g===r.enumPolygon&&D>1&&p-f.width()<=10*d&&(b=(new C).execute(b,e,!0,c))}else{let o=nt(t,s,n,P);if(b=t.clone(),0!==o){const t=new T;t.setShiftCoords(-o*P,0),b.applyTransformation(t)}do{if(h){if(a[0]=st(b,s,e,i,c),!a[0])return null}else if(b=(new w).execute(b,s,e,c),b===s&&(b=s.clone()),b.isEmpty())break;const t=new T;t.setShiftCoords(-P,0),b.applyTransformation(t)}while(l.xmin+ ++o*P<f.xmax);if(h)return null;if(!b.isEmpty()&&0!==o){const t=new T;t.setShiftCoords(o*P,0),b.applyTransformation(t)}}return b}function et(t,e,s,i,n,o,r){const h=[!1];return tt(t,s,e,i,n,o,!0,Number.NaN,h,r),h[0]}function st(t,e,s,i,n){let o;if(e.getGeometryType()===r.enumPolygon)if(i){o=E(e,t,s,64,n)}else{o=E(e,t,s,4,n)}else if(i){const s=new u,i=new u;e.queryEnvelope(s),t.queryEnvelope(i);o=s.containsEnvelope(i)}else{o=E(e,t,s,4,n)}return o}function it(t,e,s,i){let n;if(!e)return t;const o=s.getCenter().x,r=s.width(),h=.5*r,m=new u;t.queryEnvelope(m);const a=m.getCenter().x;let c=0;if(a-o>h){c=-Math.ceil((a-o-h)/r)*r}else if(o-a>h){c=Math.ceil((o-a-h)/r)*r}if(0!==c){n=i?t:t.clone();const e=new T;e.setShiftCoords(c,0),n.applyTransformation(e)}else n=t;return n}function nt(t,e,s,i){if(!s)return 0;let n=0;const o=new u;e.queryEnvelope(o);const r=new u;t.queryEnvelope(r);const h=o.xmin+i;for(;h+i+n*i>r.xmin;)n--;for(;h+n*i<r.xmin;)n++;return n}function ot(t,e,s,i,n){e.x-t.x>s?n.setCoords(e.x-i,e.y):t.x-e.x>s?n.setCoords(e.x+i,e.y):n.setCoordsPoint2D(e)}function rt(t,e,s,i,n,o,r){Math.abs(t.y)===s?(o.setCoords(e.x,t.y),r.setCoordsPoint2D(e)):Math.abs(e.y)===s?(o.setCoordsPoint2D(t),r.setCoords(t.x,e.y)):(o.setCoordsPoint2D(t),ot(o,e,i,n,r))}function ht(t){return t.getUnit().getUnitToBaseFactor()}function mt(t){return t.getUnit().getUnitToBaseFactor()}function at(t){return t.getPECoordSys().getDatum().getSpheroid().getAxis()}function ct(t,e,s){return s<=.5?t+(e-t)*s:e-(e-t)*(1-s)}class lt{checkSegment(){for(let t=0;t<this.n;t++){if(null!==this.pSplitLines2Info&&this.pSplitLines2Info.hasSplitLines()&&!this.bCheckIfNoDensificationNeededForCurve){const t=this.pSplitLines2Info.getSplitLineFactorEx(this.rectifiedSegment,this.leftFactor,this.rightFactor,this.leftGcsToDensifiedPoint,this.rightGcsToDensifiedPoint,this.progressTracker);if(Number.isNaN(t))return-1;if(-1!==t&&this.leftFactor<t&&t<this.rightFactor)return this.cutFactor=t,this.cutFromDensifiedPoint.assign(this.rectifiedSegment.getCoord2D(this.cutFactor)),this.cutToDensifiedPoint.assign(Q(this.cutFromDensifiedPoint,this.transform)),this.cutGcsToDensifiedPoint.setCoordsPoint2D(this.cutToDensifiedPoint),this.cutToDensifiedPoint.assign(Q(this.cutGcsToDensifiedPoint,this.transform2)),this.midFactor=this.cutFactor,this.midFromDensifiedPoint.setCoordsPoint2D(this.cutFromDensifiedPoint),this.midToDensifiedPoint.setCoordsPoint2D(this.cutToDensifiedPoint),this.midGcsToDensifiedPoint.setCoordsPoint2D(this.cutGcsToDensifiedPoint),1}if(this.cutFactor=ct(this.leftFactor,this.rightFactor,this.scalars[t]),this.cutFromDensifiedPoint.assign(this.rectifiedSegment.getCoord2D(this.cutFactor)),this.cutToDensifiedPoint.assign(Q(this.cutFromDensifiedPoint,this.transform)),null!==this.transform2&&(this.cutGcsToDensifiedPoint.setCoordsPoint2D(this.cutToDensifiedPoint),this.cutToDensifiedPoint.assign(Q(this.cutGcsToDensifiedPoint,this.transform2))),0===t&&(this.midFactor=this.cutFactor,this.midFromDensifiedPoint.setCoordsPoint2D(this.cutFromDensifiedPoint),this.midToDensifiedPoint.setCoordsPoint2D(this.cutToDensifiedPoint),this.midGcsToDensifiedPoint.setCoordsPoint2D(this.cutGcsToDensifiedPoint)),this.bIsPannableFrom&&!this.bCheckIfNoDensificationNeededForCurve&&Math.abs(this.leftFromDensifiedPoint.x-this.rightFromDensifiedPoint.x)>=.25*this.pannableExtentFrom.width())return 1;let e;if(this.bCheckIfNoDensificationNeededForCurve){const t=this.projCurveSegment.get().getClosestCoordinate(this.cutToDensifiedPoint,!1),s=this.projCurveSegment.get().getCoord2D(t);e=p.sqrDistance(this.cutToDensifiedPoint,s)}else{const s=new p,i=new p,n=V(this.leftToDensifiedPoint,this.cutToDensifiedPoint,this.rightToDensifiedPoint,this.bSrToIsGcs,this.bIsPannableTo,this.pannableExtentTo,s,i);this.line.setStartXY(s),this.line.setEndXY(i);const o=this.line.getClosestCoordinate(this.cutToDensifiedPoint,!0);if(n||t>0||Math.abs(o-this.scalars[t])<.3){const t=this.line.getCoord2D(o);e=p.sqrDistance(this.cutToDensifiedPoint,t)}else e=2*this.maxDeviationInSrToSq,this.bNeedPostFiltering=!0}if(e>this.maxDeviationInSrToSq)return this.bCheckIfNoDensificationNeededForCurve=!1,1}return 0}constructor(t,e,s,i,n,o,r,h,m,a,c,l,f){this.leftFromDensifiedPoint=new p,this.rightFromDensifiedPoint=new p,this.cutFromDensifiedPoint=new p,this.midFromDensifiedPoint=new p,this.leftToDensifiedPoint=new p,this.rightToDensifiedPoint=new p,this.cutToDensifiedPoint=new p,this.midToDensifiedPoint=new p,this.line=new _,this.leftGcsToDensifiedPoint=new p,this.rightGcsToDensifiedPoint=new p,this.cutGcsToDensifiedPoint=new p,this.midGcsToDensifiedPoint=new p,this.bSrToIsGcs=!1,this.bIsCurve=!1,this.leftFactor=0,this.rightFactor=0,this.bIsFirstInPath=!1,this.rectifiedSegment=null,this.transform=null,this.bIsPannableFrom=!1,this.pannableExtentFrom=new u,this.bIsPannableTo=!1,this.bNeedPostFiltering=!1,this.pannableExtentTo=new u,this.transform2=null,this.pHorizon2Info=null,this.pSplitLines2Info=null,this.minLengthInSrFrom=0,this.maxDeviationInSrToSq=0,this.cutFactor=0,this.midFactor=0,this.pDensifiedFactors=null,this.pDensifiedPoints=[],this.rightFromDensifiedPointsStack=[],this.rightToDensifiedPointsStack=[],this.rightGcsToDensifiedPointsStack=[],this.rightFactorsStack=[],this.projCurveSegment=new g,this.n=0,this.bCheckIfNoDensificationNeededForCurve=!1,this.scalars=P(A-1,Number.NaN),this.progressTracker=f,this.transform=t,this.bIsPannableFrom=e,this.pannableExtentFrom.assign(s),this.bIsPannableTo=i,this.pannableExtentTo.assign(n),this.transform2=o,this.pHorizon2Info=r,this.pSplitLines2Info=h,this.minLengthInSrFrom=m,this.maxDeviationInSrToSq=a,this.pDensifiedFactors=c,this.pDensifiedPoints=l,this.progressTracker=f,this.bNeedPostFiltering=!1}needsPostFiltering(){return this.bNeedPostFiltering}densifySegment(t,e){if(this.bIsFirstInPath=t,this.rectifiedSegment=e,this.leftGcsToDensifiedPoint.setNAN(),this.rightGcsToDensifiedPoint.setNAN(),this.cutGcsToDensifiedPoint.setNAN(),this.midGcsToDensifiedPoint.setNAN(),this.bSrToIsGcs=null!=this.transform2?1===this.transform2.getOutputSR().getCoordinateSystemType():1===this.transform.getOutputSR().getCoordinateSystemType(),this.bIsCurve=this.rectifiedSegment.isCurve(),this.leftFactor=0,this.rightFactor=1,this.leftFromDensifiedPoint.assign(this.rectifiedSegment.getStartXY()),this.rightFromDensifiedPoint.assign(this.rectifiedSegment.getEndXY()),this.leftToDensifiedPoint.assign(Q(this.leftFromDensifiedPoint,this.transform)),this.rightToDensifiedPoint.assign(Q(this.rightFromDensifiedPoint,this.transform)),null!==this.transform2&&(this.leftGcsToDensifiedPoint.setCoordsPoint2D(this.leftToDensifiedPoint),this.rightGcsToDensifiedPoint.setCoordsPoint2D(this.rightToDensifiedPoint),this.leftToDensifiedPoint.assign(Q(this.leftGcsToDensifiedPoint,this.transform2)),this.rightToDensifiedPoint.assign(Q(this.rightGcsToDensifiedPoint,this.transform2)),this.bIsFirstInPath&&!this.pHorizon2Info.isPointStartInHorizon(this.leftGcsToDensifiedPoint,this.progressTracker)))return!1;this.rightFromDensifiedPointsStack.length=0,this.rightToDensifiedPointsStack.length=0,this.rightGcsToDensifiedPointsStack.length=0,this.rightFactorsStack.length=0,this.rightFromDensifiedPointsStack.push(this.rightFromDensifiedPoint.clone()),this.rightToDensifiedPointsStack.push(this.rightToDensifiedPoint.clone()),this.rightFactorsStack.push(this.rightFactor),null!=this.transform2&&this.rightGcsToDensifiedPointsStack.push(this.rightGcsToDensifiedPoint.clone()),null!==this.pDensifiedPoints&&this.pDensifiedPoints.push(this.leftFromDensifiedPoint.clone()),null!==this.pDensifiedFactors&&this.pDensifiedFactors.push(this.leftFactor),this.bIsCurve?this.rectifiedSegment.getGeometryType()===r.enumBezier?this.n=A-1:this.n=5:this.n=3,H(this.n,this.scalars);const s=this.rectifiedSegment.calculateLength2D();if(this.bCheckIfNoDensificationNeededForCurve=!1,this.bIsCurve){const t=new f({vd:this.rectifiedSegment.getDescription()});let e=(new b).execute(t,this.transform,this.progressTracker);if(null!==this.transform2){const t=new u;if(e.queryEnvelope(t),!this.pHorizon2Info.isEnvelopeInHorizon(t,this.progressTracker))return!1;e=(new b).execute(e,this.transform2,this.progressTracker)}e.getSegmentBuffer(0,this.projCurveSegment,!1),this.bCheckIfNoDensificationNeededForCurve=!0}for(;this.rightFromDensifiedPointsStack.length>0;){let t=!1;if(this.cutFactor=Number.NaN,this.midFactor=Number.NaN,this.midFromDensifiedPoint.setNAN(),this.midToDensifiedPoint.setNAN(),(this.rightFactor-this.leftFactor)*s>this.minLengthInSrFrom){const e=this.checkSegment();if(-1===e)return!1;t=0!==e}if(t)this.rightFromDensifiedPoint.setCoordsPoint2D(this.midFromDensifiedPoint),this.rightToDensifiedPoint.setCoordsPoint2D(this.midToDensifiedPoint),this.rightFactor=this.midFactor,this.rightFromDensifiedPointsStack.push(this.rightFromDensifiedPoint.clone()),this.rightToDensifiedPointsStack.push(this.rightToDensifiedPoint.clone()),this.rightFactorsStack.push(this.rightFactor),null!==this.transform2&&(this.rightGcsToDensifiedPoint.setCoordsPoint2D(this.midGcsToDensifiedPoint),this.rightGcsToDensifiedPointsStack.push(this.rightGcsToDensifiedPoint.clone()));else{if(null!==this.transform2&&!this.pHorizon2Info.isAdjoiningLineInHorizon(this.leftGcsToDensifiedPoint,this.rightGcsToDensifiedPoint,this.progressTracker))return!1;if(this.rightFromDensifiedPointsStack.pop(),this.rightToDensifiedPointsStack.pop(),this.rightFactorsStack.pop(),null!==this.transform2&&this.rightGcsToDensifiedPointsStack.pop(),null!==this.pDensifiedPoints&&this.pDensifiedPoints.push(this.rightFromDensifiedPoint.clone()),null!==this.pDensifiedFactors&&this.pDensifiedFactors.push(this.rightFactor),this.rightFromDensifiedPointsStack.length>0){this.leftFromDensifiedPoint.setCoordsPoint2D(this.rightFromDensifiedPoint),this.leftToDensifiedPoint.setCoordsPoint2D(this.rightToDensifiedPoint),this.leftFactor=this.rightFactor;const t=this.rightFromDensifiedPointsStack.at(-1),e=this.rightToDensifiedPointsStack.at(-1);if(this.rightFromDensifiedPoint.setCoordsPoint2D(t),this.rightToDensifiedPoint.setCoordsPoint2D(e),this.rightFactor=this.rightFactorsStack.at(-1),null!==this.transform2){this.leftGcsToDensifiedPoint.setCoordsPoint2D(this.rightGcsToDensifiedPoint);const t=this.rightGcsToDensifiedPointsStack.at(-1);this.rightGcsToDensifiedPoint.setCoordsPoint2D(t)}}}}return!0}}class ut{getOperatorType(){return 10315}supportsCurves(){return!1}accelerateGeometry(t,e,s){return!1}canAccelerateGeometry(t){return!1}executeMany(t,e,s,i,n,o){return q(s)?new ft(t,e,s,i,n,o):(new b).executeMany(t,s,o)}execute(t,e,s,i,n){if(!q(e))return(new b).execute(t,e,n);const o=new M;return o.prepare(e,null,n),o.execute(t,s,i,n)}}class ft extends t{constructor(t,s,i,n,o,r){super(),this.m_spp=null,this.m_index=-1,t||e(""),this.m_progressTracker=r,this.m_geometries=t,this.m_geometriesExtent=s?s.clone():null,this.m_transform=i,this.m_minSegmentLengthInDegrees=n,this.m_maxDeviationInSrTo=o}tock(){return!0}getRank(){return 1}next(){this.m_spp||(this.m_spp=new M,this.m_spp.prepare(this.m_transform,this.m_geometriesExtent,this.m_progressTracker));const t=this.m_geometries.next();return s(t),i(t),null!=t?(this.m_index=this.m_geometries.getGeometryID(),this.m_spp.execute(t,this.m_minSegmentLengthInDegrees,this.m_maxDeviationInSrTo,this.m_progressTracker)):null}getGeometryID(){return this.m_index}}export{ut as OperatorShapePreservingProject};