@arcgis/core 4.32.0-next.20250101 → 4.32.0-next.20250103

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 (261) hide show
  1. package/Color.js +1 -1
  2. package/PopupTemplate.js +1 -1
  3. package/arcade/functions/date.js +1 -1
  4. package/arcade/functions/featuresetbase.js +1 -1
  5. package/arcade/functions/featuresetstats.js +1 -1
  6. package/arcade/functions/featuresetstring.js +1 -1
  7. package/arcade/functions/geomasync.js +1 -1
  8. package/arcade/functions/geometry.js +1 -1
  9. package/arcade/functions/geomsync.js +1 -1
  10. package/arcade/functions/knowledgegraph.js +1 -1
  11. package/arcade/functions/string.js +1 -1
  12. package/arcade/geometry/extendedUnitData.js +5 -0
  13. package/arcade/geometry/functions.js +5 -0
  14. package/arcade/geometry/operators.js +5 -0
  15. package/arcade/geometry/unitConversion.js +5 -0
  16. package/arcade/geometry/wkt.js +5 -0
  17. package/arcade/languageUtils.js +1 -1
  18. package/assets/esri/core/workers/RemoteClient.js +1 -1
  19. package/assets/esri/core/workers/chunks/{e371f4f0eb3c22f222df.js → 005727711cca0614c2ab.js} +2 -2
  20. package/assets/esri/core/workers/chunks/{e371f4f0eb3c22f222df.js.LICENSE.txt → 005727711cca0614c2ab.js.LICENSE.txt} +1 -1
  21. package/assets/esri/core/workers/chunks/{2d908c115ea18e813b95.js → 00c0fbe19c12691cf2c3.js} +1 -1
  22. package/assets/esri/core/workers/chunks/08e28328385066c519c2.js +1 -0
  23. package/assets/esri/core/workers/chunks/{0e735d01296d340b393e.js → 0b95ec12218f3c04df18.js} +1 -1
  24. package/assets/esri/core/workers/chunks/{59bf879b4802a5ba431e.js → 0ee669947c23f469e357.js} +1 -1
  25. package/assets/esri/core/workers/chunks/116103ecec27cce47a2f.js +1 -0
  26. package/assets/esri/core/workers/chunks/11f00218905f0db447ff.js +1 -0
  27. package/assets/esri/core/workers/chunks/14b87f3dd9942e6b19d0.js +1 -0
  28. package/assets/esri/core/workers/chunks/16d7c07e1c11b88dae84.js +1 -0
  29. package/assets/esri/core/workers/chunks/1d04fe800cb98e4d6bc4.js +1 -0
  30. package/assets/esri/core/workers/chunks/{71f6e5742cf0c482066b.js → 1dc6b5b177022b80c473.js} +1 -1
  31. package/assets/esri/core/workers/chunks/{59455e2dd44b4c01cc76.js → 2586741c359057b3f626.js} +1 -1
  32. package/assets/esri/core/workers/chunks/{250a810dd4e1ff293564.js → 318a39b56851e707edad.js} +1 -1
  33. package/assets/esri/core/workers/chunks/{b1e4813f0c73fc2a483c.js → 370b230fd2d7703d0698.js} +2 -2
  34. package/assets/esri/core/workers/chunks/{b1e4813f0c73fc2a483c.js.LICENSE.txt → 370b230fd2d7703d0698.js.LICENSE.txt} +1 -1
  35. package/assets/esri/core/workers/chunks/38d03fe352057fb375b5.js +1 -0
  36. package/assets/esri/core/workers/chunks/{ebf9caf2dc8af89afec2.js → 42aa697b4718b75b8cb2.js} +2 -2
  37. package/assets/esri/core/workers/chunks/{ebf9caf2dc8af89afec2.js.LICENSE.txt → 42aa697b4718b75b8cb2.js.LICENSE.txt} +1 -1
  38. package/assets/esri/core/workers/chunks/{801dbea20966806db1c9.js → 53cd990b2c988518de6d.js} +1 -1
  39. package/assets/esri/core/workers/chunks/5a1eb0d1e25ff5574c43.js +1 -0
  40. package/assets/esri/core/workers/chunks/6157c49e7431f5868c77.js +1 -0
  41. package/assets/esri/core/workers/chunks/{eef2d94a73064f9bc085.js → 61d64f163840563017d5.js} +1 -1
  42. package/assets/esri/core/workers/chunks/6d218fb5e0f0a04d72c5.js +2 -0
  43. package/assets/esri/core/workers/chunks/{d82b3e2905cab511ff3a.js.LICENSE.txt → 6d218fb5e0f0a04d72c5.js.LICENSE.txt} +1 -1
  44. package/assets/esri/core/workers/chunks/6ed57d01be6bc054c7cd.js +1 -0
  45. package/assets/esri/core/workers/chunks/7254956381e823219db0.js +1 -0
  46. package/assets/esri/core/workers/chunks/740e6bdb3b76f2ea6d61.js +1 -0
  47. package/assets/esri/core/workers/chunks/756c2f7c8659deab6c96.js.LICENSE.txt +1 -1
  48. package/assets/esri/core/workers/chunks/{56fc353421252f2d0a99.js → 75e8ba7e02647b7216ae.js} +1 -1
  49. package/assets/esri/core/workers/chunks/89d7eec47e5b29935d92.js +1 -0
  50. package/assets/esri/core/workers/chunks/8cd2c9ec1e541836b81c.js +1 -0
  51. package/assets/esri/core/workers/chunks/{0b3e1e903120da297641.js → 932375de79e3d33bc4d7.js} +1 -1
  52. package/assets/esri/core/workers/chunks/{263adfd1c2641ef5c0f5.js → 95f23bd17ce9e07fc8ef.js} +1 -1
  53. package/assets/esri/core/workers/chunks/{7de9c01849c4aa1940e7.js → 986889cea53c4a470347.js} +1 -1
  54. package/assets/esri/core/workers/chunks/{cc6160e8ab3cea4040c2.js → 9e9b2fd958e816b1b5f6.js} +1 -1
  55. package/assets/esri/core/workers/chunks/a57cead317eb2fc9afd8.js +1 -0
  56. package/assets/esri/core/workers/chunks/acec58a7f23b2cc938ee.js +1 -0
  57. package/assets/esri/core/workers/chunks/b0f4254d8a32dd713009.js +1 -0
  58. package/assets/esri/core/workers/chunks/b277b8c2f556918e4f9a.js +1 -0
  59. package/assets/esri/core/workers/chunks/{deffd56e39ce725ce377.js → b30046a40bcfbec8abe4.js} +1 -1
  60. package/assets/esri/core/workers/chunks/{5c11e2e65b97565e5003.js → b7db64b07edb0b37ece1.js} +1 -1
  61. package/assets/esri/core/workers/chunks/bd1fb82e8bac439d05ea.js +1 -0
  62. package/assets/esri/core/workers/chunks/bf0a0ca7fdac98f06a89.js.LICENSE.txt +1 -1
  63. package/assets/esri/core/workers/chunks/c44ce0302dc82fb66ada.js +1 -0
  64. package/assets/esri/core/workers/chunks/c52872a50a5989121388.js +1 -0
  65. package/assets/esri/core/workers/chunks/c8cd6ba5600d8ff8db0b.js +2 -0
  66. package/assets/esri/core/workers/chunks/{a100fb789d72410f8d4f.js.LICENSE.txt → c8cd6ba5600d8ff8db0b.js.LICENSE.txt} +1 -1
  67. package/assets/esri/core/workers/chunks/{57c1370b310768c0790a.js → ca1e186f136abb23ae4b.js} +1 -1
  68. package/assets/esri/core/workers/chunks/{d14e4fc82ad772899336.js → ca4a37bdc0f7fb705146.js} +1 -1
  69. package/assets/esri/core/workers/chunks/cb94fc9b0f613ad50b3f.js +1 -0
  70. package/assets/esri/core/workers/chunks/d20764cc99fcabcb7cbf.js +1 -0
  71. package/assets/esri/core/workers/chunks/df18a72e3625cbe31935.js +1 -0
  72. package/assets/esri/core/workers/chunks/eff8fcb6393cd1193cbc.js +1 -0
  73. package/assets/esri/core/workers/chunks/f19d3c855f6e93544918.js +1 -0
  74. package/assets/esri/core/workers/chunks/{60b40b2319d1651dd150.js → f7e50a8284d12da21355.js} +1 -1
  75. package/assets/esri/core/workers/chunks/f9c0d571f62e611ffe2b.js +1 -0
  76. package/assets/esri/core/workers/chunks/fdfe8e0d942b78f08191.js +1 -0
  77. package/assets/esri/core/workers/chunks/ff21207f46a354786eed.js +1 -0
  78. package/chunks/Bufferer-BiY2mtjI.js +1 -1
  79. package/chunks/Centroid-DZi-eb9F.js +1 -1
  80. package/chunks/Clipper-a9xfvRaw.js +1 -1
  81. package/chunks/CrackAndCluster-CfzXpEle.js +1 -1
  82. package/chunks/Distance2DCalculator-eS0piaux.js +1 -1
  83. package/chunks/GeodeticDistanceCalculator-bNilDneE.js +1 -1
  84. package/chunks/Geometry.js +1 -1
  85. package/chunks/GeometryCleaner-DVgW95-D.js +1 -1
  86. package/chunks/Intersector-K1VmdfQW.js +1 -1
  87. package/chunks/LineSeries.js +1 -1
  88. package/chunks/OperatorClip.js +1 -1
  89. package/chunks/OperatorCrosses.js +1 -1
  90. package/chunks/OperatorCut.js +1 -1
  91. package/chunks/OperatorDensify.js +1 -1
  92. package/chunks/OperatorDifference.js +1 -1
  93. package/chunks/OperatorGeneralize.js +1 -1
  94. package/chunks/OperatorGeodesicBuffer.js +1 -1
  95. package/chunks/OperatorGeodeticArea.js +1 -1
  96. package/chunks/OperatorGeodeticDensifyByLength.js +1 -1
  97. package/chunks/OperatorGeodeticDistance.js +1 -1
  98. package/chunks/OperatorGeodeticLength.js +1 -1
  99. package/chunks/OperatorIntersection.js +1 -1
  100. package/chunks/OperatorIntersects.js +1 -1
  101. package/chunks/OperatorMultiPartToSinglePart.js +1 -1
  102. package/chunks/OperatorOverlaps.js +1 -1
  103. package/chunks/OperatorProject.js +1 -1
  104. package/chunks/OperatorProximity.js +1 -1
  105. package/chunks/OperatorProximityGeodesic.js +1 -1
  106. package/chunks/OperatorShapePreservingDensify.js +1 -1
  107. package/chunks/OperatorShapePreservingLength.js +1 -1
  108. package/chunks/OperatorSimplify.js +1 -1
  109. package/chunks/OperatorTouches.js +1 -1
  110. package/chunks/OperatorUnion.js +1 -1
  111. package/chunks/OperatorWithin.js +1 -1
  112. package/chunks/QuadraticBezier.js +1 -1
  113. package/chunks/SideCalculator2D-Bf4QCxCR.js +1 -1
  114. package/chunks/Theme.js +1 -1
  115. package/chunks/Tick.js +1 -1
  116. package/chunks/Transformation2D.js +1 -1
  117. package/chunks/arcade.js +1 -1
  118. package/chunks/areaOperator.js +5 -0
  119. package/chunks/array.js +1 -1
  120. package/chunks/bufferOperator.js +5 -0
  121. package/chunks/centroidOperator.js +5 -0
  122. package/chunks/chartUtilsAm5.js +1 -1
  123. package/chunks/clipOperator.js +5 -0
  124. package/chunks/containsOperator.js +5 -0
  125. package/chunks/convexHullOperator.js +5 -0
  126. package/chunks/crossesOperator.js +5 -0
  127. package/chunks/cutOperator.js +5 -0
  128. package/chunks/densifyOperator.js +5 -0
  129. package/chunks/differenceOperator.js +5 -0
  130. package/chunks/disjointOperator.js +5 -0
  131. package/chunks/distanceOperator.js +5 -0
  132. package/chunks/equalsOperator.js +5 -0
  133. package/chunks/generalizeOperator.js +5 -0
  134. package/chunks/geodesicBufferOperator.js +5 -0
  135. package/chunks/geodeticAreaOperator.js +5 -0
  136. package/chunks/geodeticDensifyOperator.js +5 -0
  137. package/chunks/geodeticLengthOperator.js +5 -0
  138. package/chunks/i3s.js +1 -1
  139. package/chunks/intersectionOperator.js +5 -0
  140. package/chunks/intersectsOperator.js +5 -0
  141. package/chunks/languageUtils.js +1 -1
  142. package/chunks/lclayout.js +1 -1
  143. package/chunks/lengthOperator.js +5 -0
  144. package/chunks/lyr3DMain.js +1 -1
  145. package/chunks/lyr3DWorker.js +1 -1
  146. package/chunks/offsetOperator.js +5 -0
  147. package/chunks/overlapsOperator.js +5 -0
  148. package/chunks/pe-wasm.js +1 -1
  149. package/chunks/proximityOperator.js +5 -0
  150. package/chunks/relateOperator.js +5 -0
  151. package/chunks/simplifyOperator.js +5 -0
  152. package/chunks/symmetricDifferenceOperator.js +5 -0
  153. package/chunks/touchesOperator.js +5 -0
  154. package/chunks/unionOperator.js +5 -0
  155. package/chunks/vxlLayer.js +1 -1
  156. package/chunks/withinOperator.js +5 -0
  157. package/copyright.txt +2 -2
  158. package/core/Evented.js +1 -1
  159. package/geometry/operators/areaOperator.js +1 -1
  160. package/geometry/operators/bufferOperator.js +1 -1
  161. package/geometry/operators/centroidOperator.js +1 -1
  162. package/geometry/operators/clipOperator.js +1 -1
  163. package/geometry/operators/containsOperator.js +1 -1
  164. package/geometry/operators/convexHullOperator.js +1 -1
  165. package/geometry/operators/crossesOperator.js +1 -1
  166. package/geometry/operators/cutOperator.js +1 -1
  167. package/geometry/operators/densifyOperator.js +1 -1
  168. package/geometry/operators/differenceOperator.js +1 -1
  169. package/geometry/operators/disjointOperator.js +1 -1
  170. package/geometry/operators/distanceOperator.js +1 -1
  171. package/geometry/operators/equalsOperator.js +1 -1
  172. package/geometry/operators/extendOperator.js +1 -1
  173. package/geometry/operators/generalizeOperator.js +1 -1
  174. package/geometry/operators/geodesicBufferOperator.js +1 -1
  175. package/geometry/operators/geodeticAreaOperator.js +1 -1
  176. package/geometry/operators/geodeticDensifyOperator.js +1 -1
  177. package/geometry/operators/geodeticLengthOperator.js +1 -1
  178. package/geometry/operators/gx/operatorAffineTransform.js +1 -1
  179. package/geometry/operators/gx/operatorAlphaShape.js +1 -1
  180. package/geometry/operators/gx/operatorAutoComplete.js +1 -1
  181. package/geometry/operators/gx/operatorBoundary.js +1 -1
  182. package/geometry/operators/gx/operatorBuffer.js +1 -1
  183. package/geometry/operators/gx/operatorConvexHull.js +1 -1
  184. package/geometry/operators/gx/operatorGraphicBuffer.js +1 -1
  185. package/geometry/operators/gx/operatorIntegrate.js +1 -1
  186. package/geometry/operators/gx/operatorLabelPoint.js +1 -1
  187. package/geometry/operators/gx/operatorLinesToPolygons.js +1 -1
  188. package/geometry/operators/gx/operatorLocateBetween.js +1 -1
  189. package/geometry/operators/gx/operatorMinimumBoundingCircle.js +1 -1
  190. package/geometry/operators/gx/operatorOffset.js +1 -1
  191. package/geometry/operators/gx/operatorPolygonOverlay.js +1 -1
  192. package/geometry/operators/gx/operatorPolygonSlicer.js +1 -1
  193. package/geometry/operators/gx/operatorSinglePartToMultiPart.js +1 -1
  194. package/geometry/operators/gx/operatorSymmetricDifference.js +1 -1
  195. package/geometry/operators/intersectionOperator.js +1 -1
  196. package/geometry/operators/intersectsOperator.js +1 -1
  197. package/geometry/operators/isNearOperator.js +1 -1
  198. package/geometry/operators/json/disjointOperator.js +1 -1
  199. package/geometry/operators/lengthOperator.js +1 -1
  200. package/geometry/operators/offsetOperator.js +1 -1
  201. package/geometry/operators/overlapsOperator.js +1 -1
  202. package/geometry/operators/proximityOperator.js +1 -1
  203. package/geometry/operators/relateOperator.js +1 -1
  204. package/geometry/operators/reshapeOperator.js +1 -1
  205. package/geometry/operators/simplifyOperator.js +1 -1
  206. package/geometry/operators/support/apiConverter.js +1 -1
  207. package/geometry/operators/support/jsonConverter.js +1 -1
  208. package/geometry/operators/symmetricDifferenceOperator.js +1 -1
  209. package/geometry/operators/touchesOperator.js +1 -1
  210. package/geometry/operators/unionOperator.js +1 -1
  211. package/geometry/operators/withinOperator.js +1 -1
  212. package/geometry/support/contains.js +1 -1
  213. package/kernel.js +1 -1
  214. package/layers/KMLLayer.js +1 -1
  215. package/layers/WCSLayer.js +1 -1
  216. package/layers/support/rasterDatasets/WCSRaster.js +1 -1
  217. package/layers/support/rasterFormats/RasterCodec.js +1 -1
  218. package/layers/support/rasterFormats/TiffDecoder.js +1 -1
  219. package/layers/support/wmtsUtils.js +1 -1
  220. package/package.json +3 -3
  221. package/smartMapping/renderers/support/utils.js +1 -1
  222. package/smartMapping/symbology/support/Theme.js +1 -1
  223. package/support/revision.js +1 -1
  224. package/views/3d/interactive/measurementTools/areaMeasurement3D/AreaMeasurement3DView.js +1 -1
  225. package/views/3d/support/DisplayQualityProfile.js +1 -1
  226. package/views/3d/webgl-engine/core/shaderModules/interfaces.js +1 -1
  227. package/views/3d/webgl-engine/lib/Octree.js +1 -1
  228. package/views/SelectionManager.js +1 -1
  229. package/widgets/BatchAttributeForm.js +1 -1
  230. package/widgets/Feature/support/featureUtils.js +1 -1
  231. package/widgets/Legend/support/heatmapRampUtils.js +1 -1
  232. package/widgets/OrientedImageryViewer/OrientedImageryViewerVisibleElements.js +1 -1
  233. package/widgets/OrientedImageryViewer.js +1 -1
  234. package/assets/esri/core/workers/chunks/015285436ca965f94e17.js +0 -1
  235. package/assets/esri/core/workers/chunks/048d296efa26ccd79056.js +0 -1
  236. package/assets/esri/core/workers/chunks/0e0b978459d70b15acb5.js +0 -1
  237. package/assets/esri/core/workers/chunks/10fa211987b16fd71a1a.js +0 -1
  238. package/assets/esri/core/workers/chunks/200a5f1864c2c2f7536c.js +0 -1
  239. package/assets/esri/core/workers/chunks/23a697d48f6e45cc033e.js +0 -1
  240. package/assets/esri/core/workers/chunks/29b610ff44708e044cbd.js +0 -1
  241. package/assets/esri/core/workers/chunks/3600125c58d5d04c515a.js +0 -1
  242. package/assets/esri/core/workers/chunks/457d4abc938d14f28e31.js +0 -1
  243. package/assets/esri/core/workers/chunks/4b5dbdcad438cb2dd4bf.js +0 -1
  244. package/assets/esri/core/workers/chunks/69efc716991a407c3d23.js +0 -1
  245. package/assets/esri/core/workers/chunks/6e254e846e284223ef63.js +0 -1
  246. package/assets/esri/core/workers/chunks/785610aa615198fd3815.js +0 -1
  247. package/assets/esri/core/workers/chunks/7bf7aace72f81f5de4e4.js +0 -1
  248. package/assets/esri/core/workers/chunks/7ea3d652536e1d79dfc6.js +0 -1
  249. package/assets/esri/core/workers/chunks/816c9c81352cd0ca8ce8.js +0 -1
  250. package/assets/esri/core/workers/chunks/9291508232b23f030178.js +0 -1
  251. package/assets/esri/core/workers/chunks/9fc49968dea8e2b64f3e.js +0 -1
  252. package/assets/esri/core/workers/chunks/a0b3d70a1b0360084593.js +0 -1
  253. package/assets/esri/core/workers/chunks/a100fb789d72410f8d4f.js +0 -2
  254. package/assets/esri/core/workers/chunks/b4d76d46661aba356ea3.js +0 -1
  255. package/assets/esri/core/workers/chunks/cb3af81e1fe6405c4885.js +0 -1
  256. package/assets/esri/core/workers/chunks/cbf57abb537e86c1dd7f.js +0 -1
  257. package/assets/esri/core/workers/chunks/cebdf2f88c4d2ad8baab.js +0 -1
  258. package/assets/esri/core/workers/chunks/d56d77125798beb7e493.js +0 -1
  259. package/assets/esri/core/workers/chunks/d82b3e2905cab511ff3a.js +0 -2
  260. package/assets/esri/core/workers/chunks/e2f91098793b8742fae6.js +0 -1
  261. package/assets/esri/core/workers/chunks/f25c04cf1a4bc1d2636a.js +0 -1
@@ -1 +1 @@
1
- "use strict";(self.webpackChunkRemoteClient=self.webpackChunkRemoteClient||[]).push([[1867],{76061:(e,t,s)=>{s.d(t,{G:()=>o,S:()=>r});class o{*[Symbol.iterator](){let e=this.next();for(;e;)yield e,e=this.next()}}class r extends o{constructor(e){super(),this.m_iGeom=-1,this.m_aGeoms=e?e.slice():[]}next(){if(this.m_iGeom<this.m_aGeoms.length-1){const e=this.m_aGeoms[++this.m_iGeom];return this.m_aGeoms[this.m_iGeom]=null,e}return null}tock(){return!1}getGeometryID(){return this.m_iGeom}getRank(){return 1}}},29127:(e,t,s)=>{s.r(t),s.d(t,{execute:()=>n});var o=s(26986),r=s(30830);const m=new o.O;function n(e,t){const s=(0,r.fromGeometry)(e);return m.execute(s.getGeometry(),(0,r.fromGeometryToGXGeometry)(t),s.getSpatialReference(),null)}}}]);
1
+ "use strict";(self.webpackChunkRemoteClient=self.webpackChunkRemoteClient||[]).push([[1867],{76061:(e,t,s)=>{s.d(t,{G:()=>o,S:()=>r});class o{*[Symbol.iterator](){let e=this.next();for(;e;)yield e,e=this.next()}}class r extends o{constructor(e){super(),this.m_iGeom=-1,this.m_aGeoms=e?e.slice():[]}next(){if(this.m_iGeom<this.m_aGeoms.length-1){const e=this.m_aGeoms[++this.m_iGeom];return this.m_aGeoms[this.m_iGeom]=null,e}return null}tock(){return!1}getGeometryID(){return this.m_iGeom}getRank(){return 1}}},29127:(e,t,s)=>{s.r(t),s.d(t,{execute:()=>n});var o=s(9192),r=s(83299);const m=new o.O;function n(e,t){const s=(0,r.fromGeometry)(e);return m.execute(s.getGeometry(),(0,r.fromGeometryToGXGeometry)(t),s.getSpatialReference(),null)}}}]);
@@ -0,0 +1 @@
1
+ "use strict";(self.webpackChunkRemoteClient=self.webpackChunkRemoteClient||[]).push([[587],{68197:(t,e,r)=>{r.d(e,{A:()=>u});var i,o,s=r(40876),n=r(34727),l=r(56507);function a(t){return(0,n.qE)((0,l.Vr)(t),0,255)}function h(t,e,r){return t=Number(t),isNaN(t)?r:t<e?e:t>r?r:t}function p(t,e){const r=t.toString(16).padStart(2,"0");return e?r.slice(0,1):r}class u{static blendColors(t,e,r,i=new u){return i.r=Math.round(t.r+(e.r-t.r)*r),i.g=Math.round(t.g+(e.g-t.g)*r),i.b=Math.round(t.b+(e.b-t.b)*r),i.a=t.a+(e.a-t.a)*r,i._sanitize()}static fromRgb(t,e){const r=t.toLowerCase().match(/^(rgba?|hsla?)\(([\s.\-,%0-9]+)\)/);if(r){const t=r[2].split(/\s*,\s*/),i=r[1];if("rgb"===i&&3===t.length||"rgba"===i&&4===t.length){const r=t[0];if("%"===r.charAt(r.length-1)){const r=t.map((t=>2.56*parseFloat(t)));return 4===t.length&&(r[3]=parseFloat(t[3])),u.fromArray(r,e)}return u.fromArray(t.map((t=>parseFloat(t))),e)}if("hsl"===i&&3===t.length||"hsla"===i&&4===t.length)return u.fromArray((0,s.z$)(parseFloat(t[0]),parseFloat(t[1])/100,parseFloat(t[2])/100,parseFloat(t[3])),e)}return null}static fromHex(t,e=new u){if("#"!==t[0]||isNaN(Number(`0x${t.slice(1)}`)))return null;switch(t.length){case 4:case 5:{const r=parseInt(t.slice(1,2),16),i=parseInt(t.slice(2,3),16),o=parseInt(t.slice(3,4),16),s=5===t.length?15:parseInt(t.slice(4),16);return u.fromArray([r+16*r,i+16*i,o+16*o,(s+16*s)/255],e)}case 7:case 9:{const r=parseInt(t.slice(1,3),16),i=parseInt(t.slice(3,5),16),o=parseInt(t.slice(5,7),16),s=7===t.length?255:parseInt(t.slice(7),16);return u.fromArray([r,i,o,s/255],e)}default:return null}}static fromArray(t,e=new u){return e._set(Number(t[0]),Number(t[1]),Number(t[2]),Number(t[3])),isNaN(e.a)&&(e.a=1),e._sanitize()}static fromString(t,e){const r=(0,s.V6)(t)?(0,s.TS)(t):null;return r&&u.fromArray(r,e)||u.fromRgb(t,e)||u.fromHex(t,e)}static fromJSON(t){return null!=t?new u([t[0],t[1],t[2],(t[3]??255)/255]):void 0}static toUnitRGB(t){return null!=t?[t.r/255,t.g/255,t.b/255]:null}static toUnitRGBA(t){return null!=t?[t.r/255,t.g/255,t.b/255,null!=t.a?t.a:1]:null}constructor(t){this.r=255,this.g=255,this.b=255,this.a=1,t&&this.setColor(t)}get isBright(){return.299*this.r+.587*this.g+.114*this.b>=127}setColor(t){return"string"==typeof t?u.fromString(t,this):Array.isArray(t)?u.fromArray(t,this):(this._set(t.r??0,t.g??0,t.b??0,t.a??1),t instanceof u||this._sanitize()),this}toRgb(){return[this.r,this.g,this.b]}toRgba(){return[this.r,this.g,this.b,this.a]}toHex(t){const e=t?.capitalize??!1,r=t?.digits??6,i=3===r||4===r,o=4===r||8===r,s=`#${p(this.r,i)}${p(this.g,i)}${p(this.b,i)}${o?p(Math.round(255*this.a),i):""}`;return e?s.toUpperCase():s}toCss(t=!1){const e=this.r+", "+this.g+", "+this.b;return t?`rgba(${e}, ${this.a})`:`rgb(${e})`}toString(){return this.toCss(!0)}toJSON(){return this.toArray()}toArray(t=u.AlphaMode.ALWAYS){const e=a(this.r),r=a(this.g),i=a(this.b);return t===u.AlphaMode.ALWAYS||1!==this.a?[e,r,i,a(255*this.a)]:[e,r,i]}clone(){return new u(this.toRgba())}hash(){return this.r<<24|this.g<<16|this.b<<8|255*this.a}equals(t){return null!=t&&t.r===this.r&&t.g===this.g&&t.b===this.b&&t.a===this.a}_sanitize(){return this.r=Math.round(h(this.r,0,255)),this.g=Math.round(h(this.g,0,255)),this.b=Math.round(h(this.b,0,255)),this.a=h(this.a,0,1),this}_set(t,e,r,i){this.r=t,this.g=e,this.b=r,this.a=i}}u.prototype.declaredClass="esri.Color",(o=(i=u).AlphaMode||(i.AlphaMode={}))[o.ALWAYS=0]="ALWAYS",o[o.UNLESS_OPAQUE=1]="UNLESS_OPAQUE"},36708:(t,e,r)=>{r.d(e,{C_:()=>y,OH:()=>m,Vh:()=>g,on:()=>u,pc:()=>S,wB:()=>a,z7:()=>h}),r(60999),r(5503);var i=r(37955),o=r(36563),s=r(97768),n=r(74887),l=r(14012);function a(t,e,r={}){return p(t,e,r,c)}function h(t,e,r={}){return p(t,e,r,d)}function p(t,e,r={},i){let o=null;const n=r.once?(t,r)=>{i(t)&&((0,s.xt)(o),e(t,r))}:(t,r)=>{i(t)&&e(t,r)};if(o=(0,l.Cn)(t,n,r.sync,r.equals),r.initial){const e=t();n(e,e)}return o}function u(t,e,r,n={}){let l=null,h=null,p=null;function u(){l&&h&&(h.remove(),n.onListenerRemove?.(l),l=null,h=null)}function y(t){n.once&&n.once&&(0,s.xt)(p),r(t)}const c=a(t,((t,r)=>{u(),(0,i.wb)(t)&&(l=t,h=(0,i.on)(t,e,y),n.onListenerAdd?.(t))}),{sync:n.sync,initial:!0});return p=(0,o.hA)((()=>{c.remove(),u()})),p}function y(t,e){return function(t,e,r){if((0,n.G4)(r))return Promise.reject((0,n.NK)());const i=t();if(e?.(i))return Promise.resolve(i);let l=null;function a(){l=(0,s.xt)(l)}return new Promise(((i,s)=>{l=(0,o.vE)([(0,n.u7)(r,(()=>{a(),s((0,n.NK)())})),p(t,(t=>{a(),i(t)}),{sync:!1,once:!0},e??c)])}))}(t,d,e)}function c(t){return!0}function d(t){return!!t}r(80559);const m={sync:!0},g={initial:!0},S={sync:!0,initial:!0}},65851:(t,e,r)=>{r.d(e,{A:()=>h});var i=r(90237),o=r(10107),s=(r(44208),r(53966),r(87811),r(40608)),n=r(31593),l=r(20378);let a=class extends l.A{constructor(t){super(t),this.outline=null,this.type=null}hash(){return`${this.type}.${this.outline?.hash()}`}};(0,i._)([(0,o.MZ)({types:{key:"type",base:null,defaultKeyValue:"simple-line",typeMap:{"simple-line":n.A}},json:{default:null,write:!0}})],a.prototype,"outline",void 0),(0,i._)([(0,o.MZ)({type:["simple-fill","picture-fill"],readOnly:!0})],a.prototype,"type",void 0),a=(0,i._)([(0,s.$)("esri.symbols.FillSymbol")],a);const h=a},11831:(t,e,r)=>{r.d(e,{A:()=>y});var i,o=r(90237),s=r(25482),n=r(90629),l=r(10107),a=r(79901),h=(r(87811),r(44208),r(40608)),p=r(5760);let u=i=class extends s.A{constructor(t){super(t),this.decoration="none",this.family="sans-serif",this.size=9,this.style="normal",this.weight="normal"}castSize(t){return(0,n.cr)(t)}clone(){return new i({decoration:this.decoration,family:this.family,size:this.size,style:this.style,weight:this.weight})}hash(){return`${this.decoration}.${this.family}.${this.size}.${this.style}.${this.weight}`}};(0,o._)([(0,l.MZ)({type:p.h9,json:{default:"none",write:!0}})],u.prototype,"decoration",void 0),(0,o._)([(0,l.MZ)({type:String,json:{write:!0}})],u.prototype,"family",void 0),(0,o._)([(0,l.MZ)({type:Number,json:{write:{overridePolicy:(t,e,r)=>({enabled:!r||!r.textSymbol3D})}}})],u.prototype,"size",void 0),(0,o._)([(0,a.w)("size")],u.prototype,"castSize",null),(0,o._)([(0,l.MZ)({type:p._R,json:{default:"normal",write:!0}})],u.prototype,"style",void 0),(0,o._)([(0,l.MZ)({type:p.NM,json:{default:"normal",write:!0}})],u.prototype,"weight",void 0),u=i=(0,o._)([(0,h.$)("esri.symbols.Font")],u);const y=u},89420:(t,e,r)=>{r.d(e,{A:()=>p});var i=r(90237),o=r(90629),s=r(10107),n=r(56507),l=(r(87811),r(44208),r(40608)),a=r(20378);let h=class extends a.A{constructor(t){super(t),this.angle=0,this.type=null,this.xoffset=0,this.yoffset=0,this.size=9}hash(){return`${this.type}.${this.angle}.${this.size}.${this.xoffset}.${this.yoffset}`}};(0,i._)([(0,s.MZ)({type:Number,json:{read:t=>t&&-1*t,write:(t,e)=>e.angle=t&&-1*t}})],h.prototype,"angle",void 0),(0,i._)([(0,s.MZ)({type:["simple-marker","picture-marker"],readOnly:!0})],h.prototype,"type",void 0),(0,i._)([(0,s.MZ)({type:Number,cast:o.cr,json:{write:!0}})],h.prototype,"xoffset",void 0),(0,i._)([(0,s.MZ)({type:Number,cast:o.cr,json:{write:!0}})],h.prototype,"yoffset",void 0),(0,i._)([(0,s.MZ)({cast:t=>"auto"===t?t:(0,n.GB)((0,o.cr)(t)),json:{write:!0}})],h.prototype,"size",void 0),h=(0,i._)([(0,l.$)("esri.symbols.MarkerSymbol")],h);const p=h},94985:(t,e,r)=>{r.d(e,{A:()=>m});var i,o=r(90237),s=r(68197),n=r(66552),l=r(4718),a=r(10107),h=(r(44208),r(53966),r(93223)),p=r(40608),u=r(65851),y=r(31593);const c=new n.J({esriSFSSolid:"solid",esriSFSNull:"none",esriSFSHorizontal:"horizontal",esriSFSVertical:"vertical",esriSFSForwardDiagonal:"forward-diagonal",esriSFSBackwardDiagonal:"backward-diagonal",esriSFSCross:"cross",esriSFSDiagonalCross:"diagonal-cross"});let d=i=class extends u.A{constructor(...t){super(...t),this.color=new s.A([0,0,0,.25]),this.outline=new y.A,this.type="simple-fill",this.style="solid"}normalizeCtorArgs(t,e,r){if(t&&"string"!=typeof t)return t;const i={};return t&&(i.style=t),e&&(i.outline=e),r&&(i.color=r),i}clone(){return new i({color:(0,l.o8)(this.color),outline:this.outline&&this.outline.clone(),style:this.style})}hash(){return`${super.hash()}${this.style}.${this.color&&this.color.hash()}`}};(0,o._)([(0,a.MZ)()],d.prototype,"color",void 0),(0,o._)([(0,a.MZ)()],d.prototype,"outline",void 0),(0,o._)([(0,h.e)({esriSFS:"simple-fill"},{readOnly:!0})],d.prototype,"type",void 0),(0,o._)([(0,a.MZ)({type:c.apiValues,json:{read:c.read,write:c.write}})],d.prototype,"style",void 0),d=i=(0,o._)([(0,p.$)("esri.symbols.SimpleFillSymbol")],d);const m=d},31593:(t,e,r)=>{r.d(e,{A:()=>A});var i=r(90237),o=r(66552),s=r(4718),n=r(90629),l=r(10107),a=(r(44208),r(53966),r(93223)),h=r(40608),p=(r(87811),r(20378));let u=class extends p.A{constructor(t){super(t),this.type="simple-line",this.width=.75}hash(){return`${this.type}.${this.width}`}};(0,i._)([(0,a.e)({esriSLS:"simple-line"},{readOnly:!0})],u.prototype,"type",void 0),(0,i._)([(0,l.MZ)({type:Number,cast:n.cr,json:{write:!0}})],u.prototype,"width",void 0),u=(0,i._)([(0,h.$)("esri.symbols.LineSymbol")],u);const y=u;var c,d=r(68197),m=r(25482),g=r(36005),S=r(43937),b=r(83213);let f=c=class extends m.A{constructor(t){super(t),this.placement="begin-end",this.type="line-marker",this.style="arrow"}writeStyle(t,e,r,i){e[r]="web-map"===i?.origin?"arrow":t}set color(t){this._set("color",t)}readColor(t){return null!=t?.[0]?[t[0],t[1],t[2],t[3]/255]:t}writeColor(t,e,r,i){"web-map"===i?.origin||(e[r]=t)}clone(){return new c({color:(0,s.o8)(this.color),placement:this.placement,style:this.style})}hash(){return`${this.placement}.${this.color?.hash()}.${this.style}`}};(0,i._)([(0,l.MZ)({type:["begin","end","begin-end"],json:{write:!0}})],f.prototype,"placement",void 0),(0,i._)([(0,a.e)({"line-marker":"line-marker"},{readOnly:!0}),(0,l.MZ)({json:{origins:{"web-map":{write:!1}}}})],f.prototype,"type",void 0),(0,i._)([(0,l.MZ)({type:b.z})],f.prototype,"style",void 0),(0,i._)([(0,S.K)("style")],f.prototype,"writeStyle",null),(0,i._)([(0,l.MZ)({type:d.A,value:null,json:{write:{allowNull:!0}}})],f.prototype,"color",null),(0,i._)([(0,g.w)("color")],f.prototype,"readColor",null),(0,i._)([(0,S.K)("color")],f.prototype,"writeColor",null),f=c=(0,i._)([(0,h.$)("esri.symbols.LineSymbolMarker")],f);const w=f;var _;const v=new o.J({esriSLSSolid:"solid",esriSLSDash:"dash",esriSLSDot:"dot",esriSLSDashDot:"dash-dot",esriSLSDashDotDot:"long-dash-dot-dot",esriSLSNull:"none",esriSLSShortDash:"short-dash",esriSLSShortDot:"short-dot",esriSLSShortDashDot:"short-dash-dot",esriSLSShortDashDotDot:"short-dash-dot-dot",esriSLSLongDash:"long-dash",esriSLSLongDashDot:"long-dash-dot"});let M=_=class extends y{constructor(...t){super(...t),this.type="simple-line",this.style="solid",this.cap="round",this.join="round",this.marker=null,this.miterLimit=2}normalizeCtorArgs(t,e,r,i,o,s){if(t&&"string"!=typeof t)return t;const l={};return null!=t&&(l.style=t),null!=e&&(l.color=e),null!=r&&(l.width=(0,n.cr)(r)),null!=i&&(l.cap=i),null!=o&&(l.join=o),null!=s&&(l.miterLimit=(0,n.cr)(s)),l}clone(){return new _({color:(0,s.o8)(this.color),style:this.style,width:this.width,cap:this.cap,join:this.join,miterLimit:this.miterLimit,marker:this.marker?.clone()})}hash(){return`${super.hash()}.${this.color?.hash()}.${this.style}.${this.cap}.${this.join}.${this.miterLimit}.${this.marker?.hash()}`}};(0,i._)([(0,a.e)({esriSLS:"simple-line"},{readOnly:!0})],M.prototype,"type",void 0),(0,i._)([(0,l.MZ)({type:v.apiValues,json:{read:v.read,write:v.write}})],M.prototype,"style",void 0),(0,i._)([(0,l.MZ)({type:["butt","round","square"],json:{write:{overridePolicy:(t,e,r)=>({enabled:"round"!==t&&null==r?.origin})}}})],M.prototype,"cap",void 0),(0,i._)([(0,l.MZ)({type:["miter","round","bevel"],json:{write:{overridePolicy:(t,e,r)=>({enabled:"round"!==t&&null==r?.origin})}}})],M.prototype,"join",void 0),(0,i._)([(0,l.MZ)({types:{key:"type",base:null,defaultKeyValue:"line-marker",typeMap:{"line-marker":w}},json:{write:!0,origins:{"web-scene":{write:!1}}}})],M.prototype,"marker",void 0),(0,i._)([(0,l.MZ)({type:Number,json:{read:!1,write:!1}})],M.prototype,"miterLimit",void 0),M=_=(0,i._)([(0,h.$)("esri.symbols.SimpleLineSymbol")],M);const A=M},53930:(t,e,r)=>{r.d(e,{A:()=>S});var i,o=r(90237),s=r(68197),n=r(66552),l=r(4718),a=r(90629),h=r(10107),p=(r(44208),r(53966),r(93223)),u=r(40608),y=r(43937),c=r(89420),d=r(31593);const m=new n.J({esriSMSCircle:"circle",esriSMSSquare:"square",esriSMSCross:"cross",esriSMSX:"x",esriSMSDiamond:"diamond",esriSMSTriangle:"triangle",esriSMSPath:"path"});let g=i=class extends c.A{constructor(...t){super(...t),this.color=new s.A([255,255,255,.25]),this.type="simple-marker",this.size=12,this.style="circle",this.outline=new d.A}normalizeCtorArgs(t,e,r,i){if(t&&"string"!=typeof t)return t;const o={};return t&&(o.style=t),null!=e&&(o.size=(0,a.cr)(e)),r&&(o.outline=r),i&&(o.color=i),o}writeColor(t,e){t&&"x"!==this.style&&"cross"!==this.style&&(e.color=t.toJSON()),null===t&&(e.color=null)}set path(t){this.style="path",this._set("path",t)}clone(){return new i({angle:this.angle,color:(0,l.o8)(this.color),outline:this.outline&&this.outline.clone(),path:this.path,size:this.size,style:this.style,xoffset:this.xoffset,yoffset:this.yoffset})}hash(){return`${super.hash()}.${this.color&&this.color.hash()}.${this.path}.${this.style}.${this.outline?.hash()}`}};(0,o._)([(0,h.MZ)()],g.prototype,"color",void 0),(0,o._)([(0,y.K)("color")],g.prototype,"writeColor",null),(0,o._)([(0,p.e)({esriSMS:"simple-marker"},{readOnly:!0})],g.prototype,"type",void 0),(0,o._)([(0,h.MZ)()],g.prototype,"size",void 0),(0,o._)([(0,h.MZ)({type:m.apiValues,json:{read:m.read,write:m.write}})],g.prototype,"style",void 0),(0,o._)([(0,h.MZ)({type:String,json:{write:!0}})],g.prototype,"path",null),(0,o._)([(0,h.MZ)({types:{key:"type",base:null,defaultKeyValue:"simple-line",typeMap:{"simple-line":d.A}},json:{default:null,write:!0}})],g.prototype,"outline",void 0),g=i=(0,o._)([(0,u.$)("esri.symbols.SimpleMarkerSymbol")],g);const S=g},20378:(t,e,r)=>{r.d(e,{A:()=>c});var i=r(90237),o=r(68197),s=r(66552),n=r(25482),l=r(10107),a=(r(44208),r(53966),r(87811),r(36005)),h=r(40608);const p=new s.J({esriSMS:"simple-marker",esriPMS:"picture-marker",esriSLS:"simple-line",esriSFS:"simple-fill",esriPFS:"picture-fill",esriTS:"text",esriSHD:"shield-label-symbol",PointSymbol3D:"point-3d",LineSymbol3D:"line-3d",PolygonSymbol3D:"polygon-3d",WebStyleSymbol:"web-style",MeshSymbol3D:"mesh-3d",LabelSymbol3D:"label-3d",CIMSymbolReference:"cim"});let u=0,y=class extends n.A{constructor(t){super(t),this.id="sym"+u++,this.type=null,this.color=new o.A([0,0,0,1])}readColor(t){return null!=t?.[0]?[t[0],t[1],t[2],t[3]/255]:t}async collectRequiredFields(t,e){}hash(){return JSON.stringify(this.toJSON())}clone(){}};(0,i._)([(0,l.MZ)({type:p.apiValues,readOnly:!0,json:{read:!1,write:{ignoreOrigin:!0,writer:p.write,isRequired:!0}}})],y.prototype,"type",void 0),(0,i._)([(0,l.MZ)({type:o.A,json:{write:{allowNull:!0}}})],y.prototype,"color",void 0),(0,i._)([(0,a.w)("color")],y.prototype,"readColor",null),y=(0,i._)([(0,h.$)("esri.symbols.Symbol")],y);const c=y},68249:(t,e,r)=>{r.d(e,{A:()=>S});var i,o=r(90237),s=r(68197),n=r(4718),l=r(90629),a=r(10107),h=r(79901),p=r(93223),u=r(40608),y=r(43937),c=r(11831),d=r(20378),m=r(5760);let g=i=class extends d.A{constructor(...t){super(...t),this.backgroundColor=null,this.borderLineColor=null,this.borderLineSize=null,this.font=new c.A,this.horizontalAlignment="center",this.kerning=!0,this.haloColor=null,this.haloSize=null,this.rightToLeft=null,this.rotated=!1,this.text="",this.type="text",this.verticalAlignment="baseline",this.xoffset=0,this.yoffset=0,this.angle=0,this.width=null,this.lineWidth=192,this.lineHeight=1}normalizeCtorArgs(t,e,r){if(t&&"string"!=typeof t)return t;const i={};return t&&(i.text=t),e&&(i.font=e),r&&(i.color=r),i}writeLineWidth(t,e,r,i){i&&"string"!=typeof i?i.origin:e[r]=t}castLineWidth(t){return(0,l.cr)(t)}writeLineHeight(t,e,r,i){i&&"string"!=typeof i?i.origin:e[r]=t}clone(){return new i({angle:this.angle,backgroundColor:(0,n.o8)(this.backgroundColor),borderLineColor:(0,n.o8)(this.borderLineColor),borderLineSize:this.borderLineSize,color:(0,n.o8)(this.color),font:this.font&&this.font.clone(),haloColor:(0,n.o8)(this.haloColor),haloSize:this.haloSize,horizontalAlignment:this.horizontalAlignment,kerning:this.kerning,lineHeight:this.lineHeight,lineWidth:this.lineWidth,rightToLeft:this.rightToLeft,rotated:this.rotated,text:this.text,verticalAlignment:this.verticalAlignment,width:this.width,xoffset:this.xoffset,yoffset:this.yoffset})}hash(){return`${this.backgroundColor?.hash()}.${this.borderLineColor}.${this.borderLineSize}.${this.color?.hash()}.${this.font&&this.font.hash()}.${this.haloColor?.hash()}.${this.haloSize}.${this.horizontalAlignment}.${this.kerning}.${this.rightToLeft}.${this.rotated}.${this.text}.${this.verticalAlignment}.${this.width}.${this.xoffset}.${this.yoffset}.${this.lineHeight}.${this.lineWidth}.${this.angle}`}};(0,o._)([(0,a.MZ)({type:s.A,json:{write:!0}})],g.prototype,"backgroundColor",void 0),(0,o._)([(0,a.MZ)({type:s.A,json:{write:!0}})],g.prototype,"borderLineColor",void 0),(0,o._)([(0,a.MZ)({type:Number,json:{write:!0},cast:l.cr})],g.prototype,"borderLineSize",void 0),(0,o._)([(0,a.MZ)({type:c.A,json:{write:!0}})],g.prototype,"font",void 0),(0,o._)([(0,a.MZ)({...m.rM,json:{write:!0}})],g.prototype,"horizontalAlignment",void 0),(0,o._)([(0,a.MZ)({type:Boolean,json:{write:!0}})],g.prototype,"kerning",void 0),(0,o._)([(0,a.MZ)({type:s.A,json:{write:!0}})],g.prototype,"haloColor",void 0),(0,o._)([(0,a.MZ)({type:Number,cast:l.cr,json:{write:!0}})],g.prototype,"haloSize",void 0),(0,o._)([(0,a.MZ)({type:Boolean,json:{write:!0}})],g.prototype,"rightToLeft",void 0),(0,o._)([(0,a.MZ)({type:Boolean,json:{write:!0}})],g.prototype,"rotated",void 0),(0,o._)([(0,a.MZ)({type:String,json:{write:!0}})],g.prototype,"text",void 0),(0,o._)([(0,p.e)({esriTS:"text"},{readOnly:!0})],g.prototype,"type",void 0),(0,o._)([(0,a.MZ)({...m.x0,json:{write:!0}})],g.prototype,"verticalAlignment",void 0),(0,o._)([(0,a.MZ)({type:Number,cast:l.cr,json:{write:!0}})],g.prototype,"xoffset",void 0),(0,o._)([(0,a.MZ)({type:Number,cast:l.cr,json:{write:!0}})],g.prototype,"yoffset",void 0),(0,o._)([(0,a.MZ)({type:Number,json:{read:t=>t&&-1*t,write:(t,e)=>e.angle=t&&-1*t}})],g.prototype,"angle",void 0),(0,o._)([(0,a.MZ)({type:Number,json:{write:!0}})],g.prototype,"width",void 0),(0,o._)([(0,a.MZ)({type:Number})],g.prototype,"lineWidth",void 0),(0,o._)([(0,y.K)("lineWidth")],g.prototype,"writeLineWidth",null),(0,o._)([(0,h.w)("lineWidth")],g.prototype,"castLineWidth",null),(0,o._)([(0,a.MZ)(m.Tb)],g.prototype,"lineHeight",void 0),(0,o._)([(0,y.K)("lineHeight")],g.prototype,"writeLineHeight",null),g=i=(0,o._)([(0,u.$)("esri.symbols.TextSymbol")],g);const S=g},83213:(t,e,r)=>{r.d(e,{x:()=>i,z:()=>o});const i=["begin","end","begin-end"],o=["arrow","circle","square","diamond","cross","x"]},5760:(t,e,r)=>{r.d(e,{NM:()=>l,Tb:()=>a,_R:()=>n,h9:()=>s,rM:()=>h,x0:()=>p,y7:()=>u});var i=r(34727),o=r(56507);const s=["none","underline","line-through"],n=["normal","italic","oblique"],l=["normal","lighter","bold","bolder"],a={type:Number,cast:t=>{const e=(0,o.GB)(t);return 0===e?1:(0,i.qE)(e,.1,4)},nonNullable:!0},h={type:["left","right","center"],nonNullable:!0},p={type:["baseline","top","middle","bottom"],nonNullable:!0},u=8}}]);
@@ -0,0 +1 @@
1
+ "use strict";(self.webpackChunkRemoteClient=self.webpackChunkRemoteClient||[]).push([[9265],{22802:(e,t,r)=>{r.d(t,{O:()=>n});var s=r(9192);class n extends s.d{getOperatorType(){return 7}execute(e,t,r,n){return(0,s.r)(e,t,r,2,n)}}},76061:(e,t,r)=>{r.d(t,{G:()=>s,S:()=>n});class s{*[Symbol.iterator](){let e=this.next();for(;e;)yield e,e=this.next()}}class n extends s{constructor(e){super(),this.m_iGeom=-1,this.m_aGeoms=e?e.slice():[]}next(){if(this.m_iGeom<this.m_aGeoms.length-1){const e=this.m_aGeoms[++this.m_iGeom];return this.m_aGeoms[this.m_iGeom]=null,e}return null}tock(){return!1}getGeometryID(){return this.m_iGeom}getRank(){return 1}}},85445:(e,t,r)=>{r.r(t),r.d(t,{execute:()=>m});var s=r(22802),n=r(83299);const o=new s.O;function m(e,t){const r=(0,n.fromGeometry)(e);return o.execute(r.getGeometry(),(0,n.fromGeometryToGXGeometry)(t),r.getSpatialReference(),null)}}}]);
@@ -0,0 +1 @@
1
+ "use strict";(self.webpackChunkRemoteClient=self.webpackChunkRemoteClient||[]).push([[3299],{90293:(e,t,n)=>{n(35368),n(55537),n(11878);var r=n(9192),i=n(83047),a=n(21325);(0,r.i)((e=>{let t,n;"number"==typeof e?t=e:n=e;const r={wkid:t,wkt:n};let s,o;if(n){s=(0,i.x1)(n);const e=(0,a.EA)(r);if(!s&&!e)throw new Error(`Unsupported WKT type: ${n}`)}else s=!(0,a.EA)(r);return o=t&&i.yD.has(t)?Math.PI/200:s?(0,i.Ao)(r):Math.PI/180,{isPCS:s,metersOrRadiansPerUnit:o,semiMajor:0,wkidOrWkt:e}}))},83299:(e,t,n)=>{n.r(t),n.d(t,{fromGeometries:()=>oe,fromGeometry:()=>ue,fromGeometryToGXGeometry:()=>me,getSpatialReference:()=>ae,toGeometry:()=>le});var r=n(55537),i=n(11878),a=n(9192),s=n(35368);function o(){if(-1===this.m_i)return this.m_i=0,{value:{m_token:1,m_value:null},done:!1};if(this.m_i<this.m_keys.length){const e=this.m_bReturnKey,t=Math.trunc(this.m_i);return this.m_bReturnKey=!this.m_bReturnKey,this.m_i+=.5,e?{value:{m_token:5,m_value:this.m_keys[t]},done:!1}:{value:{m_token:6,m_value:this.m_o[this.m_keys[t]]},done:!1}}return{value:{m_token:3,m_value:null},done:!0}}function u(){if(-1===this.m_i)return this.m_i=0,{value:{m_token:2,m_value:null},done:!1};if(this.m_i<this.m_a.length){const e={value:{m_token:6,m_value:this.m_a[this.m_i++]},done:!1};return this.m_strict||void 0===e.value.m_value&&(e.value.m_value=Number.NaN),e}return{value:{m_token:4,m_value:null},done:!0}}n(90293);class m{createJSONObjectIterator(e){return{m_iteratorType:"object",m_o:e,m_keys:this.m_options.strict?Object.keys(e):Object.keys(e).filter((t=>void 0!==e[t])),m_i:-1,m_bReturnKey:!0,next:o}}createJSONArrayIterator(e){return{m_iteratorType:"array",m_strict:this.m_options.strict,m_i:-1,m_a:e,next:u}}constructor(e,t){this.m_currentToken=0,this.m_options=t?{...t}:{strict:!0};const n=e;this.m_iteratorStack=[n instanceof Array?this.createJSONArrayIterator(n):this.createJSONObjectIterator(n)],this.m_nextFlatToken={m_value:null,m_token:0}}nextToken(){if(0===this.m_iteratorStack.length)return this.m_currentToken=0;switch(this.m_nextFlatToken=this.m_iteratorStack.at(-1).next().value,this.m_currentValue=void 0,this.m_nextFlatToken.m_token){case 1:return this.m_currentToken=1;case 3:return this.m_iteratorStack.pop(),this.m_currentToken=3;case 2:return this.m_currentToken=2;case 4:return this.m_iteratorStack.pop(),this.m_currentToken=4;case 5:return this.m_currentValue=this.m_nextFlatToken.m_value,this.m_currentToken=5;case 6:if(this.m_nextFlatToken.m_value instanceof Array)return this.m_iteratorStack.push(this.createJSONArrayIterator(this.m_nextFlatToken.m_value)),this.nextToken();if(this.m_nextFlatToken.m_value instanceof Object)return this.m_iteratorStack.push(this.createJSONObjectIterator(this.m_nextFlatToken.m_value)),this.nextToken();if("number"==typeof this.m_nextFlatToken.m_value)return this.m_currentValue=this.m_nextFlatToken.m_value,Number.isSafeInteger(this.m_currentValue)&&this.m_currentValue>=(0,i.L)()&&this.m_currentValue<=(0,i.o)()?this.m_currentToken=8:this.m_currentToken=7;if("string"==typeof this.m_nextFlatToken.m_value)return this.m_currentValue=this.m_nextFlatToken.m_value,this.m_currentToken=6;if("boolean"==typeof this.m_nextFlatToken.m_value)return this.m_currentValue=this.m_nextFlatToken.m_value,this.m_currentToken=this.m_nextFlatToken.m_value?11:12;if("object"==typeof this.m_nextFlatToken.m_value)return this.m_currentValue=null,this.m_currentToken=10;(0,r.b)("unrecognized json element type")}return(0,r.b)("unrecognized json element type"),0}currentToken(){return this.m_currentToken}skipChildren(){if(0!==this.m_iteratorStack.length)switch(this.m_currentValue=void 0,this.m_nextFlatToken.m_token){case 1:return this.m_iteratorStack.pop(),this.m_nextFlatToken.m_token=3,void(this.m_currentToken=3);case 2:return this.m_iteratorStack.pop(),this.m_nextFlatToken.m_token=4,void(this.m_currentToken=4)}}currentString(){return 6!==this.m_currentToken&&5!==this.m_currentToken&&(0,r.t)("invalid token"),this.m_currentValue}currentDoubleValue(){return 7!==this.m_currentToken&&8!==this.m_currentToken&&(0,r.t)("invalid token"),this.m_currentValue}currentInt32Value(){return 8!==this.m_currentToken&&(0,r.t)("invalid token"),this.m_currentValue}currentInt64Value(){return(0,r.g)(0),0n}currentBoolValue(){return 12!==this.m_currentToken&&11!==this.m_currentToken&&(0,r.t)("invalid token"),this.m_currentValue}isError(){return 0}}class l{constructor(e){return this.m_buffer=null,this.m_view=null,this.m_sz=0,this.m_offset=0,this.m_bOwnsBuffer=!0,this.m_bLittleEndian=!0,this.m_element=new ArrayBuffer(8),this.m_elementBytes=new Uint8Array(this.m_element),this.m_elementView=new DataView(this.m_element),this.m_elementDouble=new Float64Array(this.m_element),this.m_elementFloat=new Float32Array(this.m_element),this.m_elementInt64=new BigInt64Array(this.m_element),this.m_elementInt32=new Int32Array(this.m_element),this.m_elementInt16=new Int16Array(this.m_element),void 0!==e.sz?(this.m_sz=e.sz,e.buffer?(this.m_sz<0&&(0,r.w)("size out of range"),this.m_buffer=e.buffer,this.m_offset=void 0!==e.offset?e.offset:0,this.m_view=void 0!==e.offset?new DataView(e.buffer,e.offset,e.sz):new DataView(this.m_buffer),this.m_bOwnsBuffer=!1,void(this.m_bLittleEndian=!0)):(this.m_sz<0&&(0,r.w)("size out of range"),void(this.m_sz>0&&(this.m_buffer=new ArrayBuffer(this.m_sz),this.m_view=new DataView(this.m_buffer))))):e.move?(this.m_sz=e.move.m_sz,this.m_buffer=e.move.m_buffer,this.m_view=e.move.m_view,this.m_bOwnsBuffer=e.move.m_bOwnsBuffer,this.m_bLittleEndian=e.move.m_bLittleEndian,e.move.m_buffer=null,e.move.m_view=null,e.move.m_sz=0,void(e.move.m_bOwnsBuffer=!0)):void(0,r.b)("unrecognized constructor options")}swapBytesDouble(){this.doSwap()&&(this.m_elementDouble[0]=this.m_elementBytes[0]<<56|this.m_elementBytes[1]<<48|this.m_elementBytes[2]<<40|this.m_elementBytes[3]<<32|this.m_elementBytes[4]<<24|this.m_elementBytes[5]<<16|this.m_elementBytes[6]<<8|this.m_elementBytes[7])}swapBytesInt32(){this.doSwap()&&(this.m_elementInt32[0]=this.m_elementBytes[0]<<24|this.m_elementBytes[1]<<16|this.m_elementBytes[2]<<8|this.m_elementBytes[3])}getOffset(){return this.m_offset}assignMove(e){return this===e||(this.clear(),this.m_sz=e.m_sz,this.m_buffer=e.m_buffer,this.m_view=e.m_view,this.m_bOwnsBuffer=e.m_bOwnsBuffer,this.m_bLittleEndian=e.m_bLittleEndian,e.m_buffer=null,e.m_sz=0,e.m_bOwnsBuffer=!0),this}doSwap(){return this.m_bLittleEndian!==(1===l.getNativeByteOrder())}setNativeByteOrder(){this.m_bLittleEndian=1===l.getNativeByteOrder()}setOrder(e){this.m_bLittleEndian=1===e}getOrder(){return this.m_bLittleEndian?1:0}getView(){return this.m_view||(0,r.u)("buffer not defined"),this.m_view}static getNativeByteOrder(){return 1}clear(){this.m_buffer=null,this.m_sz=0,this.m_bOwnsBuffer=!0}size(){return this.m_sz}readDouble(e){return this.doSwap()?(this.m_elementDouble[0]=this.m_view.getFloat64(e,this.m_bLittleEndian),this.swapBytesDouble(),this.m_elementDouble[0]):this.m_view.getFloat64(e,this.m_bLittleEndian)}writeDouble(e,t){this.m_elementDouble[0]=t,this.swapBytesDouble(),this.m_view.setFloat64(e,this.m_elementDouble[0],this.m_bLittleEndian)}readInt32(e){return this.doSwap()?(this.m_elementInt32[0]=this.m_view.getInt32(e,this.m_bLittleEndian),this.swapBytesInt32(),this.m_elementInt32[0]):this.m_view.getInt32(e,this.m_bLittleEndian)}writeInt32(e,t){this.m_elementInt32[0]=t,this.swapBytesInt32(),this.m_view.setInt32(e,this.m_elementInt32[0],this.m_bLittleEndian)}getPtr(){return this.m_buffer}setSizeNoRealloc(e){(0,r.g)(e>=0&&e<=this.m_sz),this.m_sz=e}}function c(e){let t=!1;for(;3!==e.nextToken();){const n=e.currentString();e.nextToken(),"uwkid"===n?t||(t=!0,8===e.currentToken()&&e.currentInt32Value()):e.skipChildren()}return null}function d(e){let t=!1,n=!1,r=!1,i=!1,s=!1,o=!1,u=!1,m=!1,l=!1,d=!1,h=!1,_=!1,f=!1,p=!1,k=!1,b=!1,y=!1,g=-1,T=-1,N=-1,v=-1,x=0,A=0,S=0,w=0,C=0,D=0,F=0,j=0,O=0,I=0,z="",E="",G=null;for(;3!==e.nextToken();){const a=e.currentString();e.nextToken(),"wkid"===a?t||(t=!0,8===e.currentToken()&&(g=e.currentInt32Value())):"latestWkid"===a?n||(n=!0,8===e.currentToken()&&(T=e.currentInt32Value())):"wkt"===a?s||(s=!0,6===e.currentToken()&&(z=e.currentString())):"wkt2"===a?s||6===e.currentToken()&&(E=e.currentString()):"vcsWkid"===a?r||(r=!0,8===e.currentToken()&&(N=e.currentInt32Value())):"latestVcsWkid"===a?i||(i=!0,8===e.currentToken()&&(v=e.currentInt32Value())):"xyTolerance"===a?u||(u=!0,o=!0,x=e.currentDoubleValue()):"zTolerance"===a?m||(m=!0,o=!0,A=e.currentDoubleValue()):"mTolerance"===a?l||(l=!0,o=!0,S=e.currentDoubleValue()):"falseX"===a?d||(d=!0,o=!0,F=e.currentDoubleValue()):"falseY"===a?h||(h=!0,o=!0,j=e.currentDoubleValue()):"falseZ"===a?_||(_=!0,o=!0,O=e.currentDoubleValue()):"falseM"===a?f||(f=!0,o=!0,I=e.currentDoubleValue()):"xyUnits"===a?p||(p=!0,o=!0,w=e.currentDoubleValue()):"zUnits"===a?k||(k=!0,o=!0,C=e.currentDoubleValue()):"mUnits"===a?b||(b=!0,o=!0,D=e.currentDoubleValue()):"unit"===a?y||(y=!0,G=c(e)):e.skipChildren()}v<=0&&N>0&&(v=N),N<=0&&v>0&&(N=v);let P=null,B=!0;if(0!==z.length&&(B=!1,(0,a.a3)(z)&&(P=(0,a.b)(z))),P||0===E.length||(B=!1,(0,a.a3)(E)&&(P=(0,a.b)(E))),!P&&T>0&&(B=!1,(0,a.a4)(T)&&(v<=0||(0,a.a5)())&&(P=(0,a.c)(T,v))),!P&&g>0&&(B=!1,(0,a.a4)(g)&&(N<=0||(0,a.a5)())&&(P=(0,a.c)(g,N))),B&&(P=(0,a.j)(G)),o&&P){const e=new a.S;P.queryPrecisionDescriptorWithoutFalseXY(e),u&&e.setTolerance(0,x),m&&e.setTolerance(1,A),l&&e.setTolerance(2,S),p&&d&&h&&e.setGridParams(F,j,w),k&&_&&e.setZParams(O,C),b&&f&&e.setMParams(I,D),P=(0,a.a6)(P,e)}return P}function h(e,t,n,a){2!==a.currentToken()&&(0,r.t)("failed to parse multipath: array of array of vertices is expected");const o=e?new s.h:new s.i,u=o,m=(0,s.az)(0),l=(0,s.ax)(2,0),c=(0,s.aA)(0);let d=null,h=null,_=null,f=null,k=null,T=0,N=0,v=0;const x=new s.S,A=i.P.getNAN();let S=0,w=0;const C=e?1:0;for(;4!==a.nextToken();){2!==a.currentToken()&&(0,r.t)("failed to parse multipath: ring/path array is expected");let n=2,o=0,D=!0;const F=4;let j=0,O=0;const I=i.P.getNAN(),z=new Array(F),E=new Array(F);let G=!1;for(a.nextToken();4!==a.currentToken();){if(t&&1===a.currentToken())D&&(0,r.t)("failed to parse multipath: starting vertex array is expected"),_||(_=(0,s.aA)(S-1,1),f=(0,s.az)(S-1,-1),k=(0,s.ax)(0)),G=!0,n=1,({segFlag:v,toPointSz:j}=g(x,z,A,a));else{for(G=!1,2!==a.currentToken()&&(0,r.t)("failed to parse multipath: array is expected, rings/paths vertices consist of arrays of coordinates"),j=0;4!==a.nextToken();)j===F&&(0,r.t)("failed to parse multipath: each vertex array has to have at most 4 elements"),z[j++]=p(a);j<2&&(0,r.t)("failed to parse multipath: each vertex array has to have at least 2 elements"),(0,s.aB)(z[0],z[1])||(0,r.t)("failed to parse multipath: x and y must be finite")}a.nextToken();do{if(l.size()===2*S&&l.resize(b(S)),l.writePoint2D(2*S,I.setCoords(z[0],z[1])),d&&d.size()===S&&d.resize(y(S)),j>2?(d||(d=(0,s.ax)(S+1,Number.NaN)),d.write(S,z[2])):d&&d.write(S,Number.NaN),h&&h.size()===S&&h.resize(y(S)),j>3?(h||(h=(0,s.ax)(S+1,Number.NaN)),h.write(S,z[3])):h&&h.write(S,Number.NaN),D)w++,m.add(S),c.add(C),D=!1,O=j,(0,i.D)(E,z,0,0,O);else if(null!==_)if(G){const e=(0,s.aG)(v),t=k.size();k.resize(t+e),_.add(v),f.add(T),x.get().writeInBufferStream(k,T),T+=e,u.incCurveType(v,1),N++}else _.add(1),f.add(-1);S++,o++,A.setCoords(z[0],z[1])}while(o<n&&4===a.currentToken())}0!==o&&(e&&o>n&&j===O&&0===(0,i.N)(z,E,j)?(S--,o--):null!==_&&(_.add(1),f.add(-1)))}return S&&(m.resize(w),c.resize(w),S>0&&(m.add(S),c.add(0)),u.setAttributeStreamRef(0,l),u.setPathFlagsStreamRef(c),u.setPathStreamRef(m),null!==_&&(u.updateCurveCounter(N),u.setSegmentData(f,k,_,T)),u.notifyModifiedFlags(65535)),{geometry:o,as:d,bs:h}}function _(e,t){2!==t.currentToken()&&(0,r.t)("failed to parse multipoint: array of vertices is expected");let n=0;const a=new s.M,o=(0,s.ax)(2,0);let u=0;const m=new Array(4),l=new i.P;let c=null,d=null;for(;4!==t.nextToken();){for(2!==t.currentToken()&&(0,r.t)("failed to parse multipoint: array is expected, multipoint vertices consist of arrays of cooridinates"),u=0;4!==t.nextToken();)4===u&&(0,r.t)("failed to parse multipoint: each vertex array has to have at most 4 elements"),m[u++]=p(t);u<2&&(0,r.t)("failed to parse multipoint: each vertex array has to have at least 2 elements"),(0,s.aB)(m[0],m[1])||(0,r.t)("failed to parse multipoint: x and y must be finite"),o.size()===2*n&&o.resize(b(n)),o.writePoint2D(2*n,l.setCoords(m[0],m[1])),c&&c.size()===n&&c.resize(y(n)),u>2?(c||(c=(0,s.ax)(n+1,Number.NaN)),c.write(n,m[2])):c&&c.write(n,Number.NaN),d&&d.size()===n&&d.resize(y(n)),u>3?(d||(d=(0,s.ax)(n+1,Number.NaN)),d.write(n,m[3])):d&&d.write(n,Number.NaN),n++}if(n){const e=a.getImpl();e.setAttributeStreamRef(0,o),e.resizeNoInit(n),e.notifyModifiedFlags(65535)}return{geometry:a,as:c,bs:d}}function f(e,t){2!==t.currentToken()&&(0,r.t)("failed to parse array of IDs: array of array of integers is expected");const n=(0,s.aC)(2,0);let i=0,a=-1;for(;4!==t.nextToken();){const e=i;n.size()===i&&n.resize(y(i)),i++;let s=0;for(-1===a?a=2===t.currentToken()?1:0:1===a&&2!==t.currentToken()&&(0,r.t)("failed to parse array of IDs: array of array of integers is expected"),0===a&&(n.size()===i&&n.resize(y(i)),n.write(i,k(t)),s++,i++);4!==t.nextToken();)n.size()===i&&n.resize(y(i)),n.write(i,k(t)),s++,i++;if(n.write(e,s),0===a)break}return n.resize(i),n}function p(e){const t=e.currentToken();if(10===t||6===t&&"NaN"===e.currentString())return Number.NaN;{const t=e.currentDoubleValue();return Number.isNaN(t)?Number.NaN:t}}function k(e){return e.currentInt32Value()}function b(e){let t=2*Math.trunc(3*(e+1)/2);return t<8?t=8:t<32&&(t=32),t}function y(e){let t=Math.trunc(3*(e+1)/2);return t<4?t=4:t<16&&(t=16),t}function g(e,t,n,a,o){const u={segFlag:0,toPointSz:0};let m=a.currentToken();m=a.nextToken();const c=a.currentString(),d=c[0];for((1!==c.length||"a"!==d&&"b"!==d&&"c"!==d&&"n"!==d&&"q"!==d)&&(0,r.t)('failed to parse curve: expecting "a", "b", "n", "q", or "c"'),m=a.nextToken(),2!==m&&(0,r.t)("failed to parse curve: start array is expected for curve parameters"),m=a.nextToken(),2!==m&&(0,r.t)("failed to parse curve: start array is expected for to point"),u.toPointSz=0;4!==a.nextToken();)4===u.toPointSz&&(0,r.t)("failed to parse curve: vertex array cannot have more than 4 elements"),t[u.toPointSz++]=p(a);u.toPointSz<2&&(0,r.t)("failed to parse curve: vertex array must have at least 2 elements");const h=i.P.construct(t[0],t[1]),_=i.P.getNAN();let f=-1,k=-1,b=!1,y=Number.NaN,g=Number.NaN,N=Number.NaN;const v=[i.P.getNAN(),i.P.getNAN(),i.P.getNAN()],x=i.P.getNAN();if("a"===d){m=a.nextToken(),2!==m&&(0,r.t)("failed to parse curve: start array is expected for center point"),m=a.nextToken();const e=p(a);m=a.nextToken();const t=p(a);m=a.nextToken(),4!==m&&(0,r.t)("failed to parse curve: end array is expected for center point"),_.setCoords(e,t),m=a.nextToken(),f=a.currentInt32Value(),m=a.nextToken(),k=a.currentInt32Value(),m=a.nextToken(),4!==m?(b=!1,y=p(a),m=a.nextToken(),g=p(a),m=a.nextToken(),N=p(a),m=a.nextToken(),4!==m&&(0,r.t)("failed to parse curve: end array is expected for curve parameters")):b=!0,u.segFlag=4}else if("b"===d){for(let e=0;e<2;e++){m=a.nextToken(),2!==m&&(0,r.t)("failed to parse curve: start array is expected for control point"),m=a.nextToken();const t=p(a);m=a.nextToken();const n=p(a);m=a.nextToken(),4!==m&&(0,r.t)("failed to parse curve: end array is expected for control point"),v[e].setCoords(t,n)}m=a.nextToken(),4!==m&&(0,r.t)("failed to parse curve: end array is expected for curve parameters"),u.segFlag=2}else if("n"===d){{m=a.nextToken(),2!==m&&(0,r.t)("failed to parse curve: start array is expected for control point"),m=a.nextToken();const e=p(a);m=a.nextToken();const t=p(a);m=a.nextToken(),4!==m&&(0,r.t)("failed to parse curve: end array is expected for control point"),v[0].setCoords(e,t)}m=a.nextToken();const e=p(a);m=a.nextToken();const t=p(a);m=a.nextToken();const n=p(a);v[1].setCoords(e,t),v[2].setCoords(n,n),m=a.nextToken(),4!==m&&(0,r.t)("failed to parse curve: end array is expected for curve parameters"),u.segFlag=8}else if("q"===d){for(let e=0;e<1;e++){m=a.nextToken(),2!==m&&(0,r.t)("failed to parse curve: start array is expected for control point"),m=a.nextToken();const t=p(a);m=a.nextToken();const n=p(a);m=a.nextToken(),4!==m&&(0,r.t)("failed to parse curve: end array is expected for control point"),v[e].setCoords(t,n)}m=a.nextToken(),4!==m&&(0,r.t)("failed to parse curve: end array is expected for curve parameters"),u.segFlag=16}else{m=a.nextToken(),2!==m&&(0,r.t)("failed to parse curve: start array is expected for interior point"),m=a.nextToken();const e=p(a);m=a.nextToken();const t=p(a);m=a.nextToken(),4!==m&&(0,r.t)("failed to parse curve: end array is expected for interior point"),x.setCoords(e,t),m=a.nextToken(),4!==m&&(0,r.t)("failed to parse curve: end array is expected for curve parameters"),u.segFlag=4}if(m=a.nextToken(),3!==m&&(0,r.t)("failed to parse curve: end object is expected for curve"),"a"===d)if(e.createEllipticArc(),b){const t=!0;T(e.get(),n,h,_,t,f,k)}else!function(e,t,n,r,i,a,o,u,m){e.dropAllAttributes();const c=new ArrayBuffer(44),d=new l({sz:44,buffer:c});let h=0;d.writeDouble(h,r.x),h+=8,d.writeDouble(h,r.y),h+=8,d.writeDouble(h,o),h+=8,d.writeDouble(h,u),h+=8,d.writeDouble(h,m),h+=8;let _=0;a||(_|=2048),i&&(_|=4096),d.writeInt32(h,_),h+=4,function(e,t,n,r){e.m_bits=0,e.m_center.x=r.readDouble(0),e.m_center.y=r.readDouble(8),e.m_rotation=r.readDouble(16),e.m_semiMajorAxis=r.readDouble(24),e.m_minorMajorRatio=r.readDouble(32),e.m_XStart=t.x,e.m_YStart=t.y,e.m_XEnd=n.x,e.m_YEnd=n.y;const i=r.readInt32(40);if(1&i)return!1;let a=!!(64&i),o=!!(128&i);const u=!!(2048&i),m=!!(4096&i);!(512&i)&&!(1024&i)||o||(a=!0),o&&!t.equals(n)?(o=!1,a=!0):a&&t.equals(n)&&(o=!0,a=!1),o?(e.m_center.assign(t),e.m_startAngle=e.m_center.x,e.m_sweepAngle=e.m_center.y,(0,s.aF)(e,Number.NaN,u,m),e.m_semiMajorAxis=0,e.m_interior.setCoordsPoint2D(t)):a?(e.m_center.setNAN(),e.m_semiMajorAxis=1,e.m_minorMajorRatio=0,e.m_center.setNAN(),e.m_sweepAngle=0,e.m_startAngle=0,(0,s.aD)(e),e.queryCoord2D(.5,e.m_interior)):e.constructEllipticArcEndPointsCenter(t,n,e.m_semiMajorAxis,e.m_minorMajorRatio,e.m_rotation,!m,u,e.m_center),e.setProjectionBehavior(1),(0,s.aD)(e)}(e,t,n,d)}(e.get(),n,h,_,f,k,y,g,N);else if("b"===d)e.createCubicBezier(),function(e,t,n,a){e.dropAllAttributes();const s=new ArrayBuffer(32),o=new l({sz:32,buffer:s});let u=0;o.writeDouble(u,a[0].x),u+=8,o.writeDouble(u,a[0].y),u+=8,o.writeDouble(u,a[1].x),u+=8,o.writeDouble(u,a[1].y),u+=8,function(e,t,n,a){(0,r.g)(32<=a.size()),e.m_cp=(0,i.m)(i.P,2),e.m_cp[0].x=a.readDouble(0),e.m_cp[0].y=a.readDouble(8),e.m_cp[1].x=a.readDouble(16),e.m_cp[1].y=a.readDouble(24),e.m_XStart=t.x,e.m_YStart=t.y,e.m_XEnd=n.x,e.m_YEnd=n.y}(e,t,n,o)}(e.get(),n,h,v);else if("n"===d)e.createQuadraticRationalBezier(),function(e,t,n,r,i,a,s){e.dropAllAttributes();const o=new ArrayBuffer(40),u=new l({sz:40,buffer:o});let m=0;u.writeDouble(m,r.x),m+=8,u.writeDouble(m,r.y),m+=8,u.writeDouble(m,i),m+=8,u.writeDouble(m,a),m+=8,u.writeDouble(m,s),m+=8,function(e,t,n,r){e.m_cp.x=r.readDouble(0),e.m_cp.y=r.readDouble(8),e.m_weights[0]=r.readDouble(16),e.m_weights[1]=r.readDouble(24),e.m_weights[2]=r.readDouble(32),e.m_XStart=t.x,e.m_YStart=t.y,e.m_XEnd=n.x,e.m_YEnd=n.y}(e,t,n,u)}(e.get(),n,h,v[0],v[1].x,v[1].y,v[2].x);else if("q"===d)e.createQuadraticBezier(),e.get().construct(n,v[0],h);else{e.createEllipticArc();const t=!1;T(e.get(),n,h,x,t,-1,-1)}return u}function T(e,t,n,a,o,u,m){e.dropAllAttributes();const c=new ArrayBuffer(20),d=new l({sz:20,buffer:c});let h=0;d.writeDouble(h,a.x),h+=8,d.writeDouble(h,a.y),h+=8;let _=0;o?(m||(_|=8),u&&(_|=16)):_|=128,d.writeInt32(h,_),h+=4,function(e,t,n,a){0>=a.size()&&(0,r.w)("Byte_buffer out of range access"),e.m_bits=0,e.m_rotation=0,e.m_cosr=1,e.m_sinr=0,e.setStartXY(t),e.setEndXY(n);const o=i.P.getNAN();o.x=a.readDouble(0),o.y=a.readDouble(8);const u=a.readInt32(16);if(1&u)return e.m_semiMajorAxis=0,e.m_minorMajorRatio=1,e.m_interior.assign(o),e.m_center.setNAN(),e.m_sweepAngle=0,e.m_startAngle=0,(0,s.aD)(e),!1;let m=!!(64&u);const l=!!(128&u);let c=!!(32&u);const d=!!(8&u),h=!!(16&u),_=t.equals(n);m&&!_&&(m=!1,c=!0),c&&_&&(m=!0,c=!1,o.setCoords(0,0)),m||(l?c?(e.m_semiMajorAxis=1,e.m_minorMajorRatio=0,e.m_interior.assign(o),e.m_center.setNAN(),e.m_sweepAngle=0,e.m_startAngle=0):(e.constructCircularArcThreePoint(t,n,o),_&&d===e.isClockwise()&&e.reverse()):c?(e.m_semiMajorAxis=1,e.m_minorMajorRatio=0,e.m_center.setNAN(),e.m_sweepAngle=0,e.m_startAngle=0,(0,s.aD)(e),e.queryCoord2D(.5,e.m_interior)):(0,s.aE)(e,t,n,o,d,h)),m&&(e.m_center.assign(t),e.m_startAngle=o.x,e.m_sweepAngle=o.y,(0,s.aF)(e,Number.NaN,d,h),e.m_semiMajorAxis=0,e.m_minorMajorRatio=1,e.m_interior.setCoordsPoint2D(t)),e.setProjectionBehavior(0),(0,s.aD)(e)}(e,t,n,d)}function N(e,t,n,i,a){const o=e.getGeometryType();if(o===r.G.enumEllipticArc)return function(e,t,n,i,a){(0,r.g)(!(0,s.aw)(e));const o=e.getEndXY(),u=e.hasAttribute(1)&&!t,m=e.hasAttribute(2)&&!n;let l=Number.NaN,c=Number.NaN;if(u&&(l=e.getEndAttributeAsDbl(1,0)),m&&(c=e.getEndAttributeAsDbl(2,0)),e.isDegenerateToLine()||e.isDegenerate(0))return x(u,m,o.x,o.y,l,c,i,a),!0;const d=0===e.projectionBehavior(),h=!!d&&e.isClosed();if(d&&!h)a.startObject(),a.addFieldName("c"),a.startArray(),x(u,m,o.x,o.y,l,c,i,a),A(e.m_interior.x,e.m_interior.y,17,a),a.endArray(),a.endObject();else if(d){a.startObject(),a.addFieldName("a"),a.startArray(),x(u,m,o.x,o.y,l,c,i,a);const t=0,n=0;A(e.m_center.x+t,e.m_center.y+n,17,a);const r=!e.isMajor();a.addInt32(r?1:0);const s=e.isClockwise();a.addInt32(s?1:0),a.endArray(),a.endObject()}else{a.startObject(),a.addFieldName("a"),a.startArray(),x(u,m,o.x,o.y,l,c,i,a);const t=e;A(t.m_center.x,t.m_center.y,17,a);const n=!t.isMajor();a.addInt32(n?1:0);const r=t.isClockwise();a.addInt32(r?1:0),a.addDouble(t.m_rotation,17),a.addDouble(t.m_semiMajorAxis,17),a.addDouble(t.m_minorMajorRatio,17),a.endArray(),a.endObject()}return!1}(e,t,n,i,a);if(o===r.G.enumBezier)return v(e,t,n,i,a);if(o===r.G.enumRationalBezier2)return function(e,t,n,r,i){const a=e.getEndXY(),s=e.hasAttribute(1)&&!t,o=e.hasAttribute(2)&&!n;let u=Number.NaN,m=Number.NaN;s&&(u=e.getEndAttributeAsDbl(1,0)),o&&(m=e.getEndAttributeAsDbl(2,0)),i.startObject(),i.addFieldName("n"),i.startArray(),x(s,o,a.x,a.y,u,m,r,i),A(e.m_cp.x,e.m_cp.y,r,i);const l=r;return i.addDouble(e.m_weights[0],l),i.addDouble(e.m_weights[1],l),i.addDouble(e.m_weights[2],l),i.endArray(),i.endObject(),!1}(e,t,n,i,a);if(o===r.G.enumBezier2){const r=new s.af;return r.constructFromQuadraticSegment(e),v(r,t,n,i,a)}(0,r.a)("")}function v(e,t,n,r,i){const a=e.getEndXY(),s=e.hasAttribute(1)&&!t,o=e.hasAttribute(2)&&!n;let u=Number.NaN,m=Number.NaN;return s&&(u=e.getEndAttributeAsDbl(1,0)),o&&(m=e.getEndAttributeAsDbl(2,0)),i.startObject(),i.addFieldName("b"),i.startArray(),x(s,o,a.x,a.y,u,m,r,i),A(e.m_cp[0].x,e.m_cp[0].y,r,i),A(e.m_cp[1].x,e.m_cp[1].y,r,i),i.endArray(),i.endObject(),!1}function x(e,t,n,r,i,a,s,o){o.startArray(),o.addDouble(n,s),o.addDouble(r,s),e&&o.addDouble(i,s),t&&o.addDouble(a,s),o.endArray()}function A(e,t,n,r){r.startArray(),r.addDouble(e,n),r.addDouble(t,n),r.endArray()}function S(e,t,n,i){const a=n.getImpl(),o=!!(2&t),u=!!(4&t),m=!!(8&t),l=a.hasAttribute(1)&&!o,c=a.hasAttribute(2)&&!u,d=a.hasAttribute(3)&&!m,h=a.hasNonLinearSegments();l&&(i.addFieldName("hasZ"),i.addBool(!0)),c&&(i.addFieldName("hasM"),i.addBool(!0)),e?h?i.addFieldName("curveRings"):i.addFieldName("rings"):h?i.addFieldName("curvePaths"):i.addFieldName("paths");let _=null;const f=[];if(n.isEmpty())i.startArray(),i.endArray();else{const e=17-(31&t>>13);i.startArray();const m=n.getPathCount();let p=0;const k=a.getAttributeStreamRef(0);let b=null,y=null,g=null;const T=new s.S;let v=null,x=null,A=null;h&&(v=a.getSegmentFlagsStreamRef(),x=a.getSegmentIndexStreamRef(),A=a.getSegmentDataStreamRef()),l&&(b=a.getAttributeStreamRef(1)),c&&(y=a.getAttributeStreamRef(2)),d&&(g=a.getAttributeStreamRef(3),_=(0,s.aH)(3,0));for(let t=0;t<m;t++){i.startArray(),d&&f.push(0);const a=n.getPathEnd(t);if(p===a){i.endArray();continue}const s=n.isClosedPath(t);let m=k.read(2*p),h=k.read(2*p+1),S=l?b.read(p):Number.NaN,C=c?y.read(p):Number.NaN,D=d?g.read(p):0;w(l,c,m,h,S,C,e,i);let F=1;d&&(_.add(D),f[f.length-1]++);const j=m,O=h,I=S,z=C,E=D;let G=!1,P=0,B=Number.NaN,V=Number.NaN,M=0;for(let t=p+1,n=p,R=s?a+1:a;t<R;t++,n++){const s=null!==v?31&v.read(n):1;let p,R;if(t<a?(p=k.read(2*t),R=k.read(2*t+1),l&&(B=b.read(t)),c&&(V=y.read(t)),d&&(M=g.read(t))):(p=j,R=O,B=I,V=z,M=E),1!==s){G=!0,4===s?T.createEllipticArc():2===s?T.createCubicBezier():16===s?T.createQuadraticBezier():8===s?T.createQuadraticRationalBezier():(0,r.a)("JSON export.unsupported curve");const t=T.get(),a=x.read(n);t.setStartXYCoords(m,h),t.setEndXYCoords(p,R),l&&(t.setStartAttribute(1,0,S),t.setEndAttribute(1,0,B)),c&&(t.setStartAttribute(2,0,C),t.setEndAttribute(2,0,V)),t.readFromBufferStream(A,a),N(T.get(),o,u,e,i)&&P++}else w(l,c,p,R,B,V,e,i);d&&(_.add(M),f[f.length-1]++),F++,m=p,h=R,S=B,C=V,D=M}G&&0===P||(F<2&&P<1&&(w(l,c,m,h,S,C,e,i),F++,d&&(_.add(D),f[f.length-1]++)),s&&F<3&&P<2&&(w(l,c,j,O,I,z,e,i),F++,m=j,h=O,S=I,C=z,D=E,d&&(_.add(E),f[f.length-1]++))),i.endArray(),p=a}i.endArray()}if(d){i.addFieldName("ids"),i.startArray();let e=0;for(let t=0,n=f.length;t<n;++t){const n=f[t];(0,r.g)(0===n||null!==_&&e+n<=_.size()),i.startArray();for(let t=0;t<n;++t)i.addInt32(_.read(e)),e++;i.endArray()}i.endArray()}}function w(e,t,n,r,i,a,s,o){o.startArray(),o.addDouble(n,s),o.addDouble(r,s),e&&o.addDouble(i,s),t&&o.addDouble(a,s),o.endArray()}const C="a".charCodeAt(0),D="A".charCodeAt(0),F="*".charCodeAt(0),j="b".charCodeAt(0),O=("\b".charCodeAt(0),"\\".charCodeAt(0)),I="[".charCodeAt(0),z="{".charCodeAt(0),E=":".charCodeAt(0),G=".".charCodeAt(0),P=",".charCodeAt(0),B='"'.charCodeAt(0),V="]".charCodeAt(0),M="}".charCodeAt(0),R="e".charCodeAt(0),U="E".charCodeAt(0),X="f".charCodeAt(0),W=("\f".charCodeAt(0),"F".charCodeAt(0)),L="/".charCodeAt(0),Y=("<".charCodeAt(0),"-".charCodeAt(0)),K="+".charCodeAt(0),q="n".charCodeAt(0),Z="N".charCodeAt(0),J=("\n".charCodeAt(0),"r".charCodeAt(0)),H=("\r".charCodeAt(0),"t".charCodeAt(0)),Q=("\t".charCodeAt(0),"u".charCodeAt(0)),$="0".charCodeAt(0),ee="9".charCodeAt(0);class te{constructor(e){this.m_functionStack=[],this.m_pushPositions=[],this.m_utf8Decoder=new TextDecoder("utf-8",{fatal:!0}),void 0===e?(this.m_startToken=Number.MAX_SAFE_INTEGER,this.m_endToken=0,this.m_currentTokenType=0,this.m_functionStack.push((()=>this.accept_())),this.m_jsonString=null,this.m_bHasEscapes=!1):e.jsonString?this.resetParserFromString(e.jsonString):e.jsonStream?(0,r.a)("streaming json parsing not yet impl"):(0,r.b)("invalid constructor parameter")}prepSubstrString_(){}getCurrentSubstrString_(){return this.m_jsonString.slice(this.m_startToken,this.m_endToken)}stepOverCharString_(){this.m_endToken++}peekCharString_(){return this.m_jsonString.charCodeAt(this.m_endToken)}getString_(e){const t=this.m_jsonString?.slice(this.m_startToken,this.m_startToken+e-1);return this.m_endToken+=e-1,{s:t,bDone:this.m_endToken>=this.m_jsonString.length}}incrementString_(){this.m_endToken++}eofString_(){return this.m_endToken>=this.m_jsonString.length}setStringFunctions_(){this.m_prepSubstr=this.prepSubstrString_,this.m_getCurrentSubstr=this.getCurrentSubstrString_,this.m_stepOverChar=this.stepOverCharString_,this.m_peekChar=this.peekCharString_,this.m_get=this.getString_,this.m_increment=this.incrementString_,this.m_eof=this.eofString_}setStreamFunctions_(){(0,r.a)("streaming json parsing not yet impl")}reset_(){this.m_jsonString=null,this.m_endToken=0,this.m_startToken=Number.MAX_SAFE_INTEGER,this.m_currentTokenType=0,this.m_bHasEscapes=!1,this.m_functionStack.length=0,this.m_functionStack.push((()=>this.start_())),this.m_pushPositions.length=0}resetParserFromString(e){this.reset_(),this.setStringFunctions_(),this.m_jsonString=e}resetParserFromStream(e){(0,r.a)("streaming json parsing not yet impl")}resetToPosition(e){return(0,r.g)(0),!1}nextToken(){return this.m_functionStack.at(-1)(),this.m_currentTokenType}currentToken(){return this.m_currentTokenType}currentTokenStartIndex(){return this.m_startToken}currentTokenEndIndex(){return this.m_endToken}currentText(){return(0,r.g)(0),""}childrenAsString(){return(0,r.g)(0),""}skipChildren(){this.skipChildren_()}skipChildren_(){if(1!==this.m_currentTokenType)if(2!==this.m_currentTokenType);else{let e=1;do{this.m_currentTokenType=this.nextToken(),2===this.m_currentTokenType?e++:4===this.m_currentTokenType&&e--}while(4!==this.m_currentTokenType||0!==e)}else{let e=1;do{this.m_currentTokenType=this.nextToken(),1===this.m_currentTokenType?e++:3===this.m_currentTokenType&&e--}while(3!==this.m_currentTokenType||0!==e)}}currentTerminalAsString_(){switch(this.m_currentTokenType){case 7:case 8:case 9:return this.m_getCurrentSubstr().slice(0,this.m_endToken-this.m_startToken);case 10:return"null";case 11:return"true";case 12:return"false"}(0,r.t)("invalid token")}toUTF8_(e,t){let n=0,r=e;for(;t.charCodeAt(r)===O&&t.charCodeAt(r+1)===Q;)n++,r+=6;r=e;const i=new Uint8Array(n);let a=0;for(;t.charCodeAt(r)===O&&t.charCodeAt(r+1)===Q;)i[a++]=Number.parseInt(t.slice(r+2,r+6),16),r+=6;return{u8s:this.m_utf8Decoder.decode(i),end:r}}unquoteCurrentString_(){let e="",t=1;const n=this.m_endToken-this.m_startToken-1;let r=0;const i=this.m_getCurrentSubstr();for(let a=t;a<n;a++)if(i.charCodeAt(a)!==O)r++;else{switch(r>0&&(e+=i.slice(t,t+r)),i.charCodeAt(++a)){case B:e+='"';break;case Q:{const{u8s:t,end:n}=this.toUTF8_(a-1,i);a=n-1,e+=t;break}case O:e+="\\";break;case L:e+="/";break;case j:e+="\b";break;case X:e+="\f";break;case q:e+="\n";break;case J:e+="\r";break;case H:e+="\t"}t=a+1,r=0}return r>0&&(e+=i.slice(t,t+r)),e}currentString(){return 5!==this.m_currentTokenType&&6!==this.m_currentTokenType?this.currentTerminalAsString_():this.m_bHasEscapes?this.unquoteCurrentString_():this.m_getCurrentSubstr().slice(1,this.m_endToken-this.m_startToken-2+1)}currentDoubleValue(){if(7!==this.m_currentTokenType&&8!==this.m_currentTokenType&&9!==this.m_currentTokenType&&6!==this.m_currentTokenType&&10!==this.m_currentTokenType&&(0,r.t)("invalid token"),10===this.m_currentTokenType)return Number.NaN;let e=this.m_getCurrentSubstr(),t=this.m_endToken-this.m_startToken;if(6===this.m_currentTokenType){if("NaN"===this.currentString())return Number.NaN;e=e.slice(1),t-=2,0===t&&(0,r.t)("invalid token")}const n=Number.parseFloat(e);if(6===this.m_currentTokenType)Number.isNaN(n)&&(0,r.t)("invalid token");else if(Number.isNaN(n))return Number.NaN;return n}currentInt32Value(){8!==this.m_currentTokenType&&6!==this.m_currentTokenType&&(0,r.t)("invalid token");let e=this.m_getCurrentSubstr(),t=this.m_endToken-this.m_startToken;6===this.m_currentTokenType&&(e=e.slice(1),t-=2,0===t&&(0,r.t)("invalid token"));const n=parseInt(e);return Number.isNaN(n)&&(0,r.t)("invalid token"),n}currentInt64Value(){return(0,r.g)(0),0n}currentBoolValue(){return(0,r.g)(0),!1}isError(){return 0}JSONString(){return(0,r.g)(0),""}pushPosition(){return(0,r.g)(0),!1}popPosition(){return(0,r.g)(0),!1}skipCStyleComments_(){(0,r.g)(0)}skipCppStyleComments_(){(0,r.g)(0)}skipComments_(){this.m_prepSubstr();let e=this.m_peekChar();this.m_stepOverChar(),this.m_eof()&&(0,r.t)("invalid token"),e=this.m_peekChar(),e===F?this.skipCStyleComments_():e===L?this.skipCppStyleComments_():(0,r.t)("invalid token")}skipWhiteSpace_(){let e;do{this.m_eof()&&(0,r.t)("invalid token");let t=this.m_peekChar();for(;t>=9&&t<=13||32===t;)this.m_increment(),this.m_eof()&&(0,r.t)("invalid token"),t=this.m_peekChar();t===L?(this.m_startToken=this.m_endToken,e=!0,this.skipComments_()):e=!1}while(e)}rightBracket_(){return this.m_peekChar()===V&&(this.m_startToken=this.m_endToken,this.m_increment(),this.m_currentTokenType=4,!0)}rightBrace_(){return this.m_peekChar()===M&&(this.m_startToken=this.m_endToken,this.m_increment(),this.m_currentTokenType=3,!0)}string_(){this.m_prepSubstr(),this.m_bHasEscapes=!1,this.m_stepOverChar(),this.m_eof()&&(0,r.t)("invalid token");let e=this.m_peekChar();for(;e!==B;){const t=e===O;if(this.m_stepOverChar(),this.m_eof()&&(0,r.t)("invalid token"),e=this.m_peekChar(),t)if(this.m_bHasEscapes=!0,e===B||e===O||e===L||e===j||e===X||e===q||e===J||e===H)this.m_stepOverChar(),this.m_eof()&&(0,r.t)("invalid token"),e=this.m_peekChar();else if(e===Q)for(let t=0;t<4;t++)this.m_stepOverChar(),this.m_eof()&&(0,r.t)("invalid token"),e=this.m_peekChar(),e>=$&&e<=ee||e>=C&&e<=X||e>=D&&e<=W||(0,r.t)("invalid token");else(0,r.t)("invalid token")}this.m_stepOverChar()}comma_(){return this.m_peekChar()===P&&(this.m_increment(),!0)}colon_(){return this.m_peekChar()===E&&(this.m_increment(),!0)}fieldNameEnd_(){this.skipWhiteSpace_(),this.m_functionStack.pop(),this.colon_()?(this.skipWhiteSpace_(),this.value_()):(0,r.t)("invalid token")}fieldNameStart_(){this.m_startToken=this.m_endToken,this.m_peekChar()!==B&&(0,r.t)("invalid token"),this.string_(),this.m_currentTokenType=5,this.m_functionStack.push((()=>this.fieldNameEnd_()))}pairEnd_(){this.skipWhiteSpace_(),this.comma_()?(this.skipWhiteSpace_(),this.fieldNameStart_()):this.rightBrace_()?this.m_functionStack.pop():(0,r.t)("invalid token")}arrayStart_(){this.skipWhiteSpace_(),this.m_functionStack.pop(),this.rightBracket_()||(this.m_functionStack.push((()=>this.elementEnd_())),this.value_())}elementEnd_(){this.skipWhiteSpace_(),this.comma_()?(this.skipWhiteSpace_(),this.value_()):this.rightBracket_()?this.m_functionStack.pop():(0,r.t)("invalid token")}objectStart_(){this.skipWhiteSpace_(),this.m_functionStack.pop(),this.rightBrace_()||(this.m_functionStack.push((()=>this.pairEnd_())),this.fieldNameStart_())}valueStartObject_(){this.m_increment(),this.m_currentTokenType=1,this.m_functionStack.push((()=>this.objectStart_()))}valueStartArray_(){this.m_increment(),this.m_currentTokenType=2,this.m_functionStack.push((()=>this.arrayStart_()))}valueString_(){this.string_(),this.m_currentTokenType=6}int_(){this.m_peekChar()!==$?this.digits_():this.m_stepOverChar()}digits_(){let e=this.m_peekChar();do{this.m_stepOverChar(),this.m_eof()&&(0,r.t)("invalid token"),e=this.m_peekChar()}while(e>=$&&e<=ee)}frac_(){let e=this.m_peekChar();this.m_stepOverChar(),this.m_eof()&&(0,r.t)("invalid token"),e=this.m_peekChar(),e>=$&&e<=ee||(0,r.t)("invalid token"),this.digits_()}exp_(){let e=this.m_peekChar();this.m_stepOverChar(),this.m_eof()&&(0,r.t)("invalid token"),e=this.m_peekChar(),e!==K&&e!==Y||(this.m_stepOverChar(),this.m_eof()&&(0,r.t)("invalid token"),e=this.m_peekChar()),e>=$&&e<=ee||(0,r.t)("invalid token"),this.digits_()}valueNumber_(){this.m_prepSubstr();let e=!1,t=this.m_peekChar();if(t===Y?(this.m_stepOverChar(),this.m_eof()&&(0,r.t)("invalid token"),t=this.m_peekChar(),e=!0,t>=$&&t<=ee||(0,r.t)("invalid token"),this.int_()):this.int_(),t=this.m_peekChar(),t===G)this.m_currentTokenType=7,this.frac_(),t=this.m_peekChar(),t!==R&&t!==U||this.exp_();else if(t===R||t===U)this.m_currentTokenType=7,this.exp_();else{let t=0;e&&t++;const n=this.m_endToken-this.m_startToken-t;if(n<10)this.m_currentTokenType=8;else if(10===n){const n=this.m_getCurrentSubstr();e?n.slice(t)<="2147483648"?this.m_currentTokenType=8:this.m_currentTokenType=9:n.slice(t)<="2147483647"?this.m_currentTokenType=8:this.m_currentTokenType=9}else if(n<19)this.m_currentTokenType=9;else if(19===n){const n=this.m_getCurrentSubstr();e?n.slice(t)<="9223372036854775808"?this.m_currentTokenType=9:this.m_currentTokenType=7:n.slice(t)<="9223372036854775807"?this.m_currentTokenType=9:this.m_currentTokenType=7}else this.m_currentTokenType=7}}valueNull_(){const{s:e,bDone:t}=this.m_get(5);t&&(0,r.t)("invalid token"),"null"!==e&&(0,r.t)("invalid token"),this.m_currentTokenType=10}valueTrue_(){const{s:e,bDone:t}=this.m_get(5);t&&(0,r.t)("invalid token"),"true"!==e&&(0,r.t)("invalid token"),this.m_currentTokenType=11}valueFalse_(){const{s:e,bDone:t}=this.m_get(6);t&&(0,r.t)("invalid token"),"false"!==e&&(0,r.t)("invalid token"),this.m_currentTokenType=12}valueNan_(){const{s:e,bDone:t}=this.m_get(4);t&&(0,r.t)("invalid token"),"NaN"!==e&&(0,r.t)("invalid token"),this.m_currentTokenType=7}value_(){this.m_startToken=this.m_endToken;const e=this.m_peekChar();e===z?this.valueStartObject_():e===I?this.valueStartArray_():e===B?this.valueString_():e===Y||e>=$&&e<=$+9?this.valueNumber_():e===q?this.valueNull_():e===H?this.valueTrue_():e===X?this.valueFalse_():e===Z?this.valueNan_():(0,r.t)("invalid token")}start_(){this.skipWhiteSpace_(),this.m_functionStack.pop(),this.m_functionStack.push((()=>this.accept_()));const e=this.m_peekChar();e!==z&&e!==I&&(0,r.t)("invalid token"),this.value_()}accept_(){this.m_startToken=this.m_endToken,this.m_currentTokenType=0}}const ne=new class{constructor(){this.m_pendingKey=null,this.m_acceptedObject=null,this.m_currentObject=[]}reset(){this.m_pendingKey=null,this.m_acceptedObject=null,this.m_currentObject.length=0}startObject(){const e={};this.m_pendingKey?(this.m_currentObject.at(-1)[this.m_pendingKey]=e,this.m_pendingKey=null):Array.isArray(this.m_currentObject.at(-1))&&this.m_currentObject.at(-1).push(e),this.m_currentObject.push(e)}startArray(){const e=[];this.m_pendingKey?(this.m_currentObject.at(-1)[this.m_pendingKey]=e,this.m_pendingKey=null):Array.isArray(this.m_currentObject.at(-1))&&this.m_currentObject.at(-1).push(e),this.m_currentObject.push(e)}endObject(){this.m_acceptedObject=this.m_currentObject.at(-1),this.m_currentObject.pop()}endArray(){this.m_currentObject.pop()}addFieldName(e){this.m_pendingKey=e}addValue_(e){this.m_pendingKey?(this.m_currentObject.at(-1)[this.m_pendingKey]=e,this.m_pendingKey=null):this.m_currentObject.at(-1).push(e)}addString(e){this.addValue_(e)}addDouble(e,t){this.addValue_(e)}addInt64(e){(0,r.g)(0)}addInt32(e){this.addValue_(e)}addBool(e){this.addValue_(e)}addNull(){this.addValue_(null)}getObject(){return this.m_acceptedObject}},re=new class{getOperatorType(){return 10405}accelerateGeometry(e,t,n){return!1}canAccelerateGeometry(e){return!1}supportsCurves(){return!0}execute(e,t,n,i,s,o){!function(e,t,n,i){if(t||n){if(i.startObject(),null!==t)switch(t.getGeometryType()){case r.G.enumPolygon:S(!0,e,t,i);break;case r.G.enumPolyline:S(!1,e,t,i);break;case r.G.enumMultiPoint:!function(e,t,n){const i=t.getImpl(),a=i.hasAttribute(1)&&!(2&e),s=i.hasAttribute(2)&&!(4&e),o=i.hasAttribute(3)&&!(8&e);a&&(n.addFieldName("hasZ"),n.addBool(!0)),s&&(n.addFieldName("hasM"),n.addBool(!0)),n.addFieldName("points");const u=t.getPointCount();if(t.isEmpty())n.startArray(),n.endArray();else{const t=17-(31&e>>13);n.startArray();const r=i.getAttributeStreamRef(0);let o=null,m=null;a&&(o=i.getAttributeStreamRef(1)),s&&(m=i.getAttributeStreamRef(2));for(let e=0;e<u;e++){const i=r.read(2*e),u=r.read(2*e+1);let l=Number.NaN,c=Number.NaN;a&&(l=o.read(e)),s&&(c=m.read(e)),w(a,s,i,u,l,c,t,n)}n.endArray()}if(o){let e=null;i.isEmpty()||(e=i.getAttributeStreamRef(3)),(0,r.g)(0===u||null!==e&&e.size()>=u),n.addFieldName("ids"),n.startArray();for(let t=0;t<u;t++)n.addInt32(e.read(t));n.endArray()}}(e,t,i);break;case r.G.enumPoint:!function(e,t,n){const r=t.hasAttribute(1)&&!(2&e),i=t.hasAttribute(2)&&!(4&e),a=t.hasAttribute(3)&&!(8&e);if(t.isEmpty())return n.addFieldName("x"),n.addNull(),n.addFieldName("y"),n.addNull(),r&&(n.addFieldName("z"),n.addNull()),i&&(n.addFieldName("m"),n.addNull()),void(a&&(n.addFieldName("id"),n.addInt32(0)));const s=17-(31&e>>13);n.addFieldName("x"),n.addDouble(t.getX(),s),n.addFieldName("y"),n.addDouble(t.getY(),s),r&&(n.addFieldName("z"),n.addDouble(t.getZ(),s)),i&&(n.addFieldName("m"),n.addDouble(t.getM(),s)),a&&(n.addFieldName("id"),n.addInt32(t.getID()))}(e,t,i);break;case r.G.enumEnvelope:!function(e,t,n){const r=t.hasAttribute(1)&&!(2&e),i=t.hasAttribute(2)&&!(4&e),a=t.hasAttribute(3)&&!(8&e);if(t.isEmpty())return n.addFieldName("xmin"),n.addNull(),n.addFieldName("ymin"),n.addNull(),n.addFieldName("xmax"),n.addNull(),n.addFieldName("ymax"),n.addNull(),r&&(n.addFieldName("zmin"),n.addNull(),n.addFieldName("zmax"),n.addNull()),i&&(n.addFieldName("mmin"),n.addNull(),n.addFieldName("mmax"),n.addNull()),void(a&&(n.addFieldName("idmin"),n.addInt32(0),n.addFieldName("idmax"),n.addInt32(0)));const s=17-(31&e>>13);if(n.addFieldName("xmin"),n.addDouble(t.getXMin(),s),n.addFieldName("ymin"),n.addDouble(t.getYMin(),s),n.addFieldName("xmax"),n.addDouble(t.getXMax(),s),n.addFieldName("ymax"),n.addDouble(t.getYMax(),s),r){const e=t.queryInterval(1,0);n.addFieldName("zmin"),n.addDouble(e.vmin,s),n.addFieldName("zmax"),n.addDouble(e.vmax,s)}if(i){const e=t.queryInterval(2,0);n.addFieldName("mmin"),n.addDouble(e.vmin,s),n.addFieldName("mmax"),n.addDouble(e.vmax,s)}if(a){const e=t.queryInterval(3,0);n.addFieldName("idmin"),n.addInt32(e.vmin),n.addFieldName("idmax"),n.addInt32(e.vmax)}}(e,t,i);break;case r.G.enumMultipatch:(0,r.g)(0);break;default:(0,r.b)("exportToJSON")}null!==n&&(i.addFieldName("spatialReference"),function(e,t,n){n.startObject();let i=0;t.isCustomWkid()||(i=t.getOldID());let s=0;const o=t.getVCS();if(null!==o&&(o.isCustomWkid()||(s=o.getOldID()),s<=0&&(i=0)),i>0){n.addFieldName("wkid"),n.addInt32(i);const e=t.getLatestID();if(e>0&&e!==i&&(n.addFieldName("latestWkid"),n.addInt32(e)),s>0){n.addFieldName("vcsWkid"),n.addInt32(s);const e=t.getLatestVerticalID();e!==s&&(n.addFieldName("latestVcsWkid"),n.addInt32(e))}}if(0===t.getCoordinateSystemType())n.addFieldName("wkid"),n.addNull(),null!==t.getUnit()&&(n.addFieldName("unit"),function(e,t,n){n.startObject();const i=t.getID();i<=0&&(0,r.t)("cannot export unit that has no valid WKID"),n.addFieldName("uwkid"),n.addInt32(i),n.endObject()}(0,t.getUnit(),n));else if(i<=0||1&e){let r="";64&e&&(r=t.getText2(),n.addFieldName("wkt2"),n.addString(r));const i=t.getText();i!==r&&(n.addFieldName("wkt"),n.addString(i))}if(16&e){const e=new a.S;t.queryPrecisionDescriptor(e),n.addFieldName("xyTolerance"),n.addDouble(e.getTolerance(0)),n.addFieldName("zTolerance"),n.addDouble(e.getTolerance(1)),n.addFieldName("mTolerance"),n.addDouble(e.getTolerance(2)),n.addFieldName("falseX"),n.addDouble(e.getFalseX()),n.addFieldName("falseY"),n.addDouble(e.getFalseY()),n.addFieldName("xyUnits"),n.addDouble(e.getGridUnitsXY()),n.addFieldName("falseZ"),n.addDouble(e.getFalseZ()),n.addFieldName("zUnits"),n.addDouble(e.getGridUnitsZ()),n.addFieldName("falseM"),n.addDouble(e.getFalseM()),n.addFieldName("mUnits"),n.addDouble(e.getGridUnitsM())}n.endObject()}(e,n,i)),i.endObject()}}(e,t,n,i)}exportSpatialReference(e,t,n,i){(0,r.g)(0)}exportProjectionTransformation(e,t,n,i){(0,r.g)(0)}exportDatumTransformation(e,t,n,i){(0,r.g)(0)}static geometryTypeToString(e){return(0,r.g)(0),""}},ie=new class{getOperatorType(){return 10404}accelerateGeometry(e,t,n){return!1}canAccelerateGeometry(e){return!1}supportsCurves(){return!0}execute(e,t,n,i,o,u,m){let l;"string"==typeof n?(l=new te({jsonString:n}),l.nextToken()):l=n,1!==l.currentToken()&&(0,r.t)("failed to import map geometry: start of object is expected");const c=function(e,t,n,i,a){let o=!1,u=!1,m=!1,l=!1,c=!1,b=!1,y=!1,g=!1,T=!1,N=!1,v=!1,x=!1,A=!1,S=!1,w=!1,C=!1,D=!1,F=!1,j=!1,O=!1,I=!1,z=!1,E=!1,G=!1,P=Number.NaN,B=Number.NaN,V=Number.NaN,M=Number.NaN,R=0,U=Number.NaN,X=Number.NaN,W=Number.NaN,L=Number.NaN,Y=Number.NaN,K=Number.NaN,q=Number.NaN,Z=Number.NaN,J=0,H=0,Q=!1,$=!1,ee=null,te=null,ne=null,re=null,ie=null;for(;3!==n.nextToken();){const t=n.currentString();if(n.nextToken(),"spatialReference"===t){if(a&&!o){o=!0,1===n.currentToken()?re=d(n):10!==n.currentToken()&&(0,r.t)("failed to parse spatial reference: object or null is expected");continue}}else if(i)if("hasZ"===t){if(!u){u=!0,Q=11===n.currentToken();continue}}else if("hasM"===t){if(!m){m=!0,$=11===n.currentToken();continue}}else if("rings"===t){if(!(c||b||e!==r.G.enumUnknown&&e!==r.G.enumPolygon)){c=!0,({geometry:ie,as:ee,bs:te}=h(!0,!1,0,n));continue}}else if("curveRings"===t){if(!b&&(e===r.G.enumUnknown||e===r.G.enumPolygon)){b=!0,({geometry:ie,as:ee,bs:te}=h(!0,!0,0,n));continue}}else if("paths"===t){if(!(y||g||e!==r.G.enumUnknown&&e!==r.G.enumPolyline)){y=!0,({geometry:ie,as:ee,bs:te}=h(!1,!1,0,n));continue}}else if("curvePaths"===t){if(!g&&(e===r.G.enumUnknown||e===r.G.enumPolyline)){g=!0,({geometry:ie,as:ee,bs:te}=h(!1,!0,0,n));continue}}else if("points"===t){if(!T&&(e===r.G.enumUnknown||e===r.G.enumMultiPoint)){T=!0,({geometry:ie,as:ee,bs:te}=_(0,n));continue}}else if("ids"===t){if(!l){l=!0,ne=f(0,n);continue}}else if("x"===t){if(!N&&(e===r.G.enumUnknown||e===r.G.enumPoint)){N=!0,P=p(n);continue}}else if("y"===t){if(!v&&(e===r.G.enumUnknown||e===r.G.enumPoint)){v=!0,B=p(n);continue}}else if("z"===t){if(!x&&(e===r.G.enumUnknown||e===r.G.enumPoint)){x=!0,V=p(n);continue}}else if("m"===t){if(!A&&(e===r.G.enumUnknown||e===r.G.enumPoint)){A=!0,M=p(n);continue}}else if("id"===t){if(!S&&(e===r.G.enumUnknown||e===r.G.enumPoint)){S=!0,R=k(n);continue}}else if("xmin"===t){if(!w&&(e===r.G.enumUnknown||e===r.G.enumEnvelope)){w=!0,U=p(n);continue}}else if("ymin"===t){if(!C&&(e===r.G.enumUnknown||e===r.G.enumEnvelope)){C=!0,X=p(n);continue}}else if("mmin"===t){if(!I&&(e===r.G.enumUnknown||e===r.G.enumEnvelope)){I=!0,q=p(n);continue}}else if("zmin"===t){if(!j&&(e===r.G.enumUnknown||e===r.G.enumEnvelope)){j=!0,Y=p(n);continue}}else if("idmin"===t){if(!E&&(e===r.G.enumUnknown||e===r.G.enumEnvelope)){E=!0,J=k(n);continue}}else if("xmax"===t){if(!D&&(e===r.G.enumUnknown||e===r.G.enumEnvelope)){D=!0,W=p(n);continue}}else if("ymax"===t){if(!F&&(e===r.G.enumUnknown||e===r.G.enumEnvelope)){F=!0,L=p(n);continue}}else if("mmax"===t){if(!z&&(e===r.G.enumUnknown||e===r.G.enumEnvelope)){z=!0,Z=p(n);continue}}else if("zmax"===t){if(!O&&(e===r.G.enumUnknown||e===r.G.enumEnvelope)){O=!0,K=p(n);continue}}else if("idmax"===t){if(!G&&(e===r.G.enumUnknown||e===r.G.enumEnvelope)){G=!0,H=k(n);continue}}else"materials"===t&&(0,r.g)(0);n.skipChildren()}if(c||b||y||g||T){let e=null,t=null;const n=ie;Q&&(ie.addAttribute(1),e=ee,e||(e=(0,s.ax)(n.getPointCount(),Number.NaN))),$&&(ie.addAttribute(2),t=Q?te:ee),null!=ne&&ie.addAttribute(3),Q&&null!=e&&n.setAttributeStreamRef(1,e),$&&null!=t&&n.setAttributeStreamRef(2,t),null!=ne&&function(e,t){if(e.isEmpty())return;const n=(0,s.aC)(2,0),i=e.getGeometryType();let a=0;i===s.M.type?a=1:i===s.i.type||i===s.h.type?a=e.getPathCount():(0,r.b)("not implemented"),n.resize(e.getPointCount(),0);let o=0;for(let u=0;u<a;++u){const a=t.read(o);o++;const m=o+a;let l=0,c=0;i===s.M.type?l=e.getPointCount():i===s.i.type||i===s.h.type?(l=e.getPathSize(u),c=e.getPathStart(u)):(0,r.b)("not implemented");for(let e=0,r=Math.min(a,l);e<r;++e)n.write(c,t.read(o)),o++,c++;o=m}e.getImpl().setAttributeStreamRef(3,n)}(n,ne)}else if(N||v||A||x||S){(0,s.ay)(P,B)||(0,r.t)("failed to parse point: x and y must be finite or nan"),(Number.isNaN(B)||Number.isNaN(P))&&(P=Number.NaN,B=Number.NaN);const e=new s.P({x:P,y:B});x&&e.setZ(V),A&&e.setM(M),S&&e.setID(R),ie=e}else if(w||C||D||F||j||O||I||z||E||G){(Number.isNaN(X)||Number.isNaN(W)||Number.isNaN(L))&&(U=Number.NaN);const e=new s.E({xmin:U,ymin:X,xmax:W,ymax:L});j&&O&&e.setInterval(1,0,Y,K),I&&z&&e.setInterval(2,0,q,Z),E&&G&&e.setInterval(3,0,J,H),ie=e}return{...ie?{geom:ie}:{},...re?{sr:re}:{}}}(t,0,l,i,o);return new a.a7(c)}importProjectionTransformation(e,t){return(0,r.g)(0),{}}importDatumTransformation(e,t){return(0,r.g)(0),{}}static stringToGeometryType(e){return r.G.enumPoint}};function ae(e){return Array.isArray(e)?e[0].spatialReference:e.spatialReference}function se(e,t){const n=new m(e,{strict:!1});return n.nextToken(),ie.execute(0,r.G.enumUnknown,n,!0,t)}function oe(e){let t=null;return[e.map((e=>{if(null==t){const n=ue(e);return t=n.getSpatialReference(),n.getGeometry()}return me(e)})),t]}function ue(e){return se(e,!0)}function me(e){return se(e,!1).getGeometry()}function le(e,t){return e instanceof a.a7&&(t=e.getSpatialReference(),e=e.getGeometry()),e?.isEmpty()?null:(ne.reset(),re.execute(0,e,t,ne),ne.getObject())}}}]);
@@ -2,4 +2,4 @@
2
2
  All material copyright ESRI, All Rights Reserved, unless otherwise specified.
3
3
  See https://js.arcgis.com/4.32/esri/copyright.txt for details.
4
4
  */
5
- import{b as e,c as t}from"./tslib.es6.js";import{a as s,t as i,b as n,G as r,r as m,k as o,q as a,f as h,s as l,n as c,d as u,g as f}from"./Geometry.js";import{S as _,G as g}from"./SimpleGeometryCursor.js";import{C as d,L as p,D as b,g as y,a as P,c as x,h as C,P as D,X as w,E as T,b as v,n as S,N as I}from"./QuadraticBezier.js";import{o as M,P as V,T as E,m as k,f as R,a as A,e as B}from"./Transformation2D.js";import{c as X}from"./GeometryCleaner-DVgW95-D.js";import{k as Y,l as F,O as G,p as q}from"./OperatorSimplify.js";import{O as z}from"./OperatorUnion.js";import{O as L}from"./OperatorGeneralize.js";class N{getOperatorType(){return 10104}accelerateGeometry(e,t,s){return!1}canAccelerateGeometry(e){return!1}supportsCurves(){return!0}isSimple(e,t,s,i,n){return 5===Y(e,t,s,i,n)}executeMany(e,t,s,i){return new j(e,t,s,i)}execute(e,t,i,n){const r=new _([e]),m=this.executeMany(r,t,i,n).next();return m||s("null output"),m}}class j extends g{constructor(e,t,s,n){super(),e||i(""),this.m_progressTracker=n,this.m_bForceSimplify=s,this.m_index=-1,this.m_inputGeometryCursor=e,this.m_spatialReference=t}next(){const e=this.m_inputGeometryCursor.next();return e?(n(e),this.m_index=this.m_inputGeometryCursor.getGeometryID(),this.simplify(e)):null}getGeometryID(){return this.m_index}tock(){return!1}getRank(){return 1}simplify(e){e||i("");return F(e,this.m_spatialReference,this.m_bForceSimplify,this.m_progressTracker)}}var O;function U(e,t,s,i,n,r){return{m_from:e.clone(),m_to:t.clone(),m_center:s.clone(),m_next:n,m_type:i}}function J(e,t,s,i,n){return{m_from:e.clone(),m_to:t.clone(),m_next:s,m_type:4,m_center:new V}}!function(e){e[e.enumDummy=256]="enumDummy",e[e.enumLine=1]="enumLine",e[e.enumArc=2]="enumArc",e[e.enumMiter=8]="enumMiter",e[e.enumBevel=16]="enumBevel",e[e.enumJoinMask=26]="enumJoinMask",e[e.enumConnectionMask=27]="enumConnectionMask"}(O||(O={}));class Q extends g{constructor(e,t,s,i,n,r,m,o,a,h){super(),this.m_index=0,this.m_bufferedPolygon=null,this.m_x=0,this.m_y=0,this.m_progressTracker=h,this.m_parent=e,this.m_mp=t,this.m_distance=s,this.m_spatialReference=i,this.m_densifyDist=o,this.m_maxVertexInCompleteCircle=a,this.m_joins=n,this.m_caps=r,this.m_miterLimit=m}next(){const e=new D;for(;;){if(this.m_index===this.m_mp.getPointCount())return null;if(1===this.m_caps)return this.m_index=this.m_mp.getPointCount(),new y({vd:this.m_mp.getDescription()});if(this.m_mp.getPointByVal(this.m_index,e),this.m_index++,!e.isEmpty())break}let t,s=!1;if(null===this.m_bufferedPolygon&&(this.m_x=e.getX(),this.m_y=e.getY(),this.m_bufferedPolygon=this.m_parent.buffer(e,this.m_distance,this.m_spatialReference,this.m_joins,this.m_caps,this.m_miterLimit,this.m_densifyDist,this.m_maxVertexInCompleteCircle),s=!0),t=this.m_index<this.m_mp.getPointCount()?this.m_bufferedPolygon.clone():this.m_bufferedPolygon,!s){const s=new E,i=e.getX()-this.m_x,n=e.getY()-this.m_y;s.setShiftCoords(i,n),t.applyTransformation(s)}return I(t,0),t}getGeometryID(){return 0}getRank(){return 1}tock(){return!0}}class W extends g{constructor(e){super(),this.m_currentPathIndex=0,this.m_polyline=e}next(){if(!this.m_polyline)return null;const e=this.m_polyline.getImpl(),t=e.getPathCount();if(this.m_currentPathIndex<t){const t=this.m_currentPathIndex;if(this.m_currentPathIndex++,!e.isClosedPathInXYPlane(t)){let s=e.getXY(e.getPathEnd(t)-1);for(;this.m_currentPathIndex<e.getPathCount();){const t=e.getXY(e.getPathStart(this.m_currentPathIndex));if(e.isClosedPathInXYPlane(this.m_currentPathIndex))break;if(!t.equals(s))break;s=e.getXY(e.getPathEnd(this.m_currentPathIndex)-1),this.m_currentPathIndex++}}if(0===t&&this.m_currentPathIndex===this.m_polyline.getPathCount()){const e=this.m_polyline;return this.m_polyline=null,e}const s=new C({vd:this.m_polyline.getDescription()});s.addPath(this.m_polyline,t,!0);for(let i=t+1;i<this.m_currentPathIndex;i++)s.addSegmentsFromPath(this.m_polyline,i,0,e.getSegmentCountPath(i),!1);return this.m_currentPathIndex===this.m_polyline.getPathCount()&&(this.m_polyline=null),s}return null}getGeometryID(){return 0}getRank(){return 1}tock(){return!0}}class H extends g{constructor(e,t,s){super(),this.m_geometry=null,this.m_index=0,this.m_bufferer=e,this.m_geoms=t,this.m_index=0,this.m_bFilter=s}next(){if(null===this.m_geometry&&(this.m_index=0,this.m_geometry=this.m_geoms.next(),!this.m_geometry))return null;const e=this.m_geometry.getImpl();if(this.m_index<e.getPathCount()){const e=this.m_index;this.m_index++;return this.m_bufferer.bufferPolylinePath(this.m_geometry,e,this.m_bFilter)}return this.m_geometry=null,this.next()}getGeometryID(){return 0}getRank(){return 1}tock(){return!0}}class K extends g{constructor(e){super(),this.m_index=0,this.m_bufferer=e}next(){const e=this.m_bufferer.m_geometry;if(this.m_index<e.getPathCount()){const t=this.m_index,s=e.calculateRingArea2D(this.m_index);for(f(s>0),this.m_index++;this.m_index<e.getPathCount();){if(e.calculateRingArea2D(this.m_index)>0)break;this.m_index++}let i;return i=0===t&&this.m_index===e.getPathCount()?this.m_bufferer.bufferPolygonImpl(e,0,e.getPathCount()):this.m_bufferer.bufferPolygonImpl(e,t,this.m_index),i}return null}getGeometryID(){return 0}getRank(){return 1}tock(){return!0}}class Z{constructor(e){this.m_geometry=null,this.m_bufferCommands=[],this.m_originalGeomType=r.enumUnknown,this.m_maxVertexInCompleteCircle=-1,this.m_circleTemplateSize=-1,this.m_oldCircleTemplateSize=0,this.m_spatialReference=null,this.m_tolerance=new d(0,0),this.m_smallTolerance=new d(0,0),this.m_filterTolerance=0,this.m_densifyDist=-1,this.m_distance=Number.NaN,this.m_absDistance=0,this.m_absDistanceReversed=0,this.m_dA=-1,this.m_miterLimit=4,this.m_joins=0,this.m_caps=0,this.m_bRoundBuffer=!0,this.m_bOutputLoops=!0,this.m_bFilter=!0,this.m_circleTemplate=[],this.m_leftStack=[],this.m_middleStack=[],this.m_helperLine1=new p,this.m_helperLine2=new p,this.m_helperArray=[],this.m_progressCounter=0,this.m_densificator=b.constructDefault(e),this.m_progressTracker=e}buffer(e,t,s,n,r,u,f,_){if(e||i("Geometry.Bufferer.Impl.Buffer"),f<0&&i("Geometry.Bufferer.Impl.Buffer"),m(e.getGeometryType())&&o("Unsupported geometry type."),e.isEmpty())return new y({vd:e.getDescription()});if(this.m_joins=n,this.m_caps=r,this.m_bRoundBuffer=!1,this.m_miterLimit=u,this.m_originalGeomType=e.getGeometryType(),a(this.m_originalGeomType)?this.m_bRoundBuffer=0===this.m_joins:h(this.m_originalGeomType)?this.m_bRoundBuffer=0===this.m_caps:l(this.m_originalGeomType)&&(this.m_bRoundBuffer=0===this.m_joins&&0===this.m_caps),this.m_bFilter=this.m_bRoundBuffer,this.m_geometry=X(e),this.m_geometry.isEmpty())return new y({vd:e.getDescription()});const g=new P;this.m_geometry.queryLooseEnvelope(g),t>0&&g.inflateCoords(t,t),this.m_tolerance=x(s,g,!0),this.m_smallTolerance=x(null,g,!0),_<=0&&(_=96),this.m_spatialReference=s,this.m_distance=t,this.m_absDistance=Math.abs(this.m_distance),this.m_absDistanceReversed=0!==this.m_absDistance?1/this.m_absDistance:0,Number.isNaN(f)||0===f?f=1e-5*this.m_absDistance:f>.5*this.m_absDistance&&(f=.5*this.m_absDistance),_<12&&(_=12);const d=Math.abs(t)*(1-Math.cos(Math.PI/_));if(d>f)f=d;else if(0!==t){const e=Math.PI/Math.acos(1-f/Math.abs(t));e<_-1&&(_=Math.trunc(e))<12&&(_=12,f=Math.abs(t)*(1-Math.cos(Math.PI/_)))}this.m_densifyDist=f,this.m_maxVertexInCompleteCircle=_,this.m_filterTolerance=this.m_bRoundBuffer?Math.min(this.m_smallTolerance.total(),.25*this.m_densifyDist):0,this.m_circleTemplateSize=this.calcN(),this.m_circleTemplateSize!==this.m_oldCircleTemplateSize&&(this.m_circleTemplate.length=0,this.m_oldCircleTemplateSize=this.m_circleTemplateSize),this.m_densifyDist>0&&c(this.m_geometry)&&(this.m_geometry=this.m_densificator.densifyEx(this.m_geometry,0,this.m_densifyDist,0,0!==this.m_joins,M()));const p=this.bufferImpl();return this.m_geometry=null,p}generateCircleTemplate(){if(this.m_circleTemplate.length)return;const e=this.m_circleTemplateSize,t=Math.trunc((e+3)/4),s=.5*Math.PI/t;this.m_dA=s,this.m_circleTemplate.length=4*t;const i=Math.cos(s),n=Math.sin(s),r=V.construct(0,1);for(let m=0;m<t;m++)this.m_circleTemplate[m+0*t]=V.construct(r.y,-r.x),this.m_circleTemplate[m+1*t]=V.construct(-r.x,-r.y),this.m_circleTemplate[m+2*t]=V.construct(-r.y,r.x),this.m_circleTemplate[m+3*t]=r.clone(),r.rotateReverse(i,n)}bufferImpl(){const e=this.m_geometry.getGeometryType();if(u(e)){const e=new C({vd:this.m_geometry.getDescription()});return e.addSegment(this.m_geometry,!0),this.m_geometry=e,this.bufferImpl()}if(this.m_distance<=this.m_tolerance.total()){if(!a(e))return new y({vd:this.m_geometry.getDescription()});if(this.m_distance<0){const e=new P;if(this.m_geometry.queryEnvelope(e),e.width()<=2*this.m_absDistance||e.height()<=2*this.m_absDistance)return new y({vd:this.m_geometry.getDescription()})}}switch(this.m_geometry.getGeometryType()){case r.enumPoint:return this.bufferPoint();case r.enumMultiPoint:return this.bufferMultiPoint();case r.enumPolyline:return this.bufferPolyline();case r.enumPolygon:return this.bufferPolygon();case r.enumEnvelope:return this.bufferEnvelope();default:s("")}}bufferPolyline(){if(this.isDegenerateGeometry(this.m_geometry)){const e=new D;this.m_geometry.getPointByVal(0,e);const t=new P;return this.m_geometry.queryEnvelope(t),e.setXY(t.getCenter()),this.bufferDegeneratePath(e,!0)}const e=this.m_geometry,t=this.m_geometry.getDescription();this.m_geometry=null;const s=new W(e);let i,n;i=0===this.m_joins?(new L).executeMany(s,.25*this.m_densifyDist,!1,this.m_progressTracker):s,n=this.m_bRoundBuffer?(new N).executeMany(i,null,!0,this.m_progressTracker):i;const r=new H(this,n,this.m_bFilter),m=(new z).executeMany(r,this.m_spatialReference,this.m_progressTracker,2),o=(new G).executeMany(m,this.m_spatialReference,!1,this.m_progressTracker).next();return null!==o?o:new y({vd:t})}bufferPolygon(){if(0===this.m_distance)return this.m_geometry;this.generateCircleTemplate();const e=(new G).execute(this.m_geometry,null,!1,this.m_progressTracker);if(this.m_distance<0){if(this.m_geometry=e,this.m_geometry.isEmpty())return this.m_geometry;const t=this.m_geometry,s=this.bufferPolygonImpl(t,0,t.getPathCount());return(new G).execute(s,this.m_spatialReference,!1,this.m_progressTracker)}{if(this.m_geometry=e,this.isDegenerateGeometry(this.m_geometry)){const e=new D;this.m_geometry.getPointByVal(0,e);const t=new P;return this.m_geometry.queryEnvelope(t),e.setXY(t.getCenter()),this.bufferDegeneratePath(e,!0)}const t=new K(this),s=(new z).executeMany(t,this.m_spatialReference,this.m_progressTracker,2),i=(new G).executeMany(s,this.m_spatialReference,!1,this.m_progressTracker).next();return null!==i?i:new y({vd:this.m_geometry.getDescription()})}}bufferPolygonImpl(e,t,s){const i=e,n=i.getImpl();let r=new y({vd:e.getDescription()});for(let m=t;m<s;m++){if(n.getPathSize(m)<1)continue;const t=n.calculateRingArea2D(m),s=new P;if(n.queryPathEnvelope(m,s),this.m_distance>0)if(t>0)if(this.isDegeneratePath(n,m)){const e=new D;n.getPointByVal(n.getPathStart(m),e),e.setXY(s.getCenter()),r.add(this.bufferDegeneratePath(e,!0),!1)}else{const t=new C({vd:e.getDescription()}),s=t.getImpl();if(w(this.m_geometry,m)){const e=this.bufferConvexPath(i,m);r.add(e,!1)}else{this.bufferClosedPath(this.m_geometry,m,s,this.m_bRoundBuffer,1);const e=this.bufferCleanup(t);r.add(e,!1)}}else{if(s.width()+this.m_tolerance.total()<=2*this.m_absDistance||s.height()+this.m_tolerance.total()<=2*this.m_absDistance)continue;const t=new C({vd:e.getDescription()}),i=t.getImpl();if(this.bufferClosedPath(this.m_geometry,m,i,this.m_bRoundBuffer,1),!t.isEmpty()){const e=s,n=Math.max(1,this.m_absDistance),m=e.clone();m.inflateCoords(n,n),i.addEnvelope(m,!1);const o=this.bufferCleanup(t);r.reserve(r.getPointCount()+o.getPointCount()-4),re(o,r,m,!0)}}else if(t>0){if(s.width()+this.m_tolerance.total()<=2*this.m_absDistance||s.height()+this.m_tolerance.total()<=2*this.m_absDistance)continue;const t=new C({vd:e.getDescription()}),i=t.getImpl();if(this.bufferClosedPath(this.m_geometry,m,i,this.m_bRoundBuffer,-1),!t.isEmpty()){const e=new P;i.queryLooseEnvelope(e);const s=Math.max(1,this.m_absDistance),n=e.clone();n.inflateCoords(s,s),i.addEnvelope(n,!1);re(this.bufferCleanup(t),r,n,!0)}}else{const t=new C({vd:e.getDescription()}),s=t.getImpl();this.bufferClosedPath(this.m_geometry,m,s,this.m_bRoundBuffer,-1);const i=this.bufferCleanup(t);for(let e=0,n=i.getPathCount();e<n;e++)r.addPath(i,e,!0)}}if(this.m_distance>0){if(r.getPathCount()>1){return this.bufferCleanup(r)}return $(r)}{const e=new P;if(r.queryLooseEnvelope(e),r.isEmpty())return $(r);{const t=Math.max(1,this.m_absDistance),s=e.clone();s.inflateCoords(t,t),r.addEnvelope(s,!1);const i=this.bufferCleanup(r);r=new y;const n=new y({vd:i.getDescription()});return re(i,n,s,!1),$(n)}}}bufferPoint(){return this.bufferPointImpl(this.m_geometry)}bufferPointImpl(e){const t=new y({vd:e.getDescription()});return 0===this.m_caps?(this.addCircle(t.getImpl(),e),this.setStrongSimple(t)):2===this.m_caps?(this.addSquare(t.getImpl(),e),this.setStrongSimple(t)):t}bufferDegeneratePath(e,t){const s=new y({vd:e.getDescription()});return t&&0===this.m_joins||!t&&0===this.m_caps?(this.addCircle(s.getImpl(),e),this.setStrongSimple(s)):t||2!==this.m_caps?s:(this.addSquare(s.getImpl(),e),this.setStrongSimple(s))}bufferMultiPoint(){const e=new Q(this,this.m_geometry,this.m_distance,this.m_spatialReference,this.m_joins,this.m_caps,this.m_miterLimit,this.m_densifyDist,this.m_maxVertexInCompleteCircle,this.m_progressTracker);return(new z).executeMany(e,this.m_spatialReference,this.m_progressTracker,2).next()}bufferEnvelope(){let e=new y({vd:this.m_geometry.getDescription()});if(this.m_distance<=0){if(0===this.m_distance)e.addEnvelope(this.m_geometry,!1),ee(this.m_geometry,this.m_tolerance.total())&&(e=this.setStrongSimple(e));else{const t=new T;this.m_geometry.queryEnvelope(t),t.inflateCoords(this.m_distance,this.m_distance),e.addEnvelope(t,!1),ee(t,this.m_tolerance.total())&&(e=this.setStrongSimple(e))}return e}if(1===this.m_joins){const t=new T({copy:this.m_geometry});return t.inflateCoords(this.m_absDistance,this.m_absDistance),e.addEnvelope(t,!1),e}const t=this.m_geometry.clone();if(0===t.width()||0===t.height()){if(0===t.width()&&0===t.height()){const e=new D({vd:this.m_geometry.getDescription()});return t.queryCornerByVal(0,e),this.m_geometry=e,this.bufferImpl()}const e=new C({vd:this.m_geometry.getDescription()}),s=new D;return t.queryCornerByVal(0,s),e.startPathPoint(s),t.queryCornerByVal(2,s),e.lineToPoint(s),this.m_geometry=e,this.bufferImpl()}return e.addEnvelope(this.m_geometry,!1),this.m_geometry=e,this.bufferConvexPath(e,0)}bufferConvexPath(e,t){this.generateCircleTemplate();const i=e.hasAttribute(10),n=new y({vd:e.getDescription()}),r=n.getImpl();n.reserve((this.m_circleTemplate.length/10+4)*e.getPathSize(t));const m=new V,o=new V,a=new V,h=new V(0,0),l=new V,c=new V,u=e.getImpl(),f=e.getPathSize(t),_=e.getPathStart(t);for(let g=0,d=e.getPathSize(t);g<d;g++){const e=u.getXY(_+g),t=u.getXY(_+(g+1)%f),n=u.getXY(_+(g+2)%f);l.setSub(t,e),0===l.length()&&s("");const d=i&&!!(1&u.getAttributeAsInt(10,(g+1)%f,0));l.normalize();const p=l.clone();l.leftPerpendicularThis(),l.scale(this.m_absDistance),m.setAdd(l,e),o.setAdd(l,t),0===g?r.startPath(m):r.lineTo(m),r.lineTo(o),c.setSub(n,t),0===c.length()&&s(""),c.normalize();const b=c.clone();c.leftPerpendicularThis(),c.scale(this.m_absDistance),a.setAdd(c,t);let y=O.enumArc;const P=d?0:this.m_joins;if(2===P)y=O.enumBevel;else if(1===P){const e=-p.crossProduct(b);h.setSub(p,b),h.scale(this.m_absDistance/e),h.length()<this.m_miterLimit*this.m_absDistance?(h.addThis(t),y=O.enumMiter):y=O.enumBevel}else h.assign(t);this.addJoin(y,r,h,o,a,!1,!1)}return $(n)}bufferPolylinePath(e,t,s){this.generateCircleTemplate();const i=e,n=i.getImpl();if(n.getPathSize(t)<1)return null;let r;if(r=this.m_bRoundBuffer?n.isClosedPathInXYPlane(t):n.isClosedPath(t),this.isDegeneratePath(n,t)&&this.m_distance>0){const e=new D;n.getPointByVal(n.getPathStart(t),e);const s=new P;return n.queryPathEnvelope(t,s),e.setXY(s.getCenter()),this.bufferDegeneratePath(e,r)}const m=new C({vd:e.getDescription()});m.reserve((Math.trunc(this.m_circleTemplate.length/10)+4)*n.getPathSize(t));const o=m.getImpl();return r?2!==this.bufferClosedPath(i,t,o,s,1)&&this.bufferClosedPath(i,t,o,s,-1):this.bufferOpenPath(i,t,o,s),this.bufferCleanup(m)}progress_(){}bufferCleanup(e,t=!1){const s=t?this.m_tolerance:this.m_smallTolerance;return q(e,s,!0,!t,-1,this.m_progressTracker,0,!1)}calcN(){const e=4;if(0===this.m_densifyDist)return this.m_maxVertexInCompleteCircle;const t=1-this.m_densifyDist*Math.abs(this.m_absDistanceReversed);let s=e;return s=t<-1?e:2*Math.PI/Math.acos(t)+.5,s<e?s=e:s>this.m_maxVertexInCompleteCircle&&(s=this.m_maxVertexInCompleteCircle),Math.trunc(s)}addJoin(e,t,s,i,n,r,m){if(this.generateCircleTemplate(),r&&(t.startPath(i),r=!1),e===O.enumBevel)return void(m&&t.lineTo(n));if(e===O.enumMiter){const e=s.clone();return t.lineTo(e),void(m&&t.lineTo(n))}const o=new V;o.setSub(i,s),o.scale(this.m_absDistanceReversed);const a=new V;a.setSub(n,s),a.scale(this.m_absDistanceReversed);let h=Math.atan2(o.y,o.x)/this.m_dA;h<0&&(h=this.m_circleTemplate.length+h),h=this.m_circleTemplate.length-h;let l=Math.atan2(a.y,a.x)/this.m_dA;l<0&&(l=this.m_circleTemplate.length+l),l=this.m_circleTemplate.length-l,l<h&&(l+=this.m_circleTemplate.length);let c=Math.trunc(l),u=Math.ceil(h),f=this.m_circleTemplate[u%this.m_circleTemplate.length].clone();f.scaleAddThis(this.m_absDistance,s);const _=10*this.m_tolerance.total();f.sub(i).length()<_&&(u+=1),f=this.m_circleTemplate[c%this.m_circleTemplate.length].clone(),f.scaleAddThis(this.m_absDistance,s),f.sub(n).length()<_&&(c-=1);let g=c-u;g++;for(let d=0,p=u%this.m_circleTemplate.length;d<g;d++,p=(p+1)%this.m_circleTemplate.length)f=this.m_circleTemplate[p].clone(),f.scaleAddThis(this.m_absDistance,s),t.lineTo(f),this.progress_();m&&t.lineTo(n)}bufferClosedPath(e,t,s,i,n){const r=new v,m=r.addPathFromMultiPath(e,t,!0);return this.bufferClosedPathImpl(r,m,s,i,n)}bufferClosedPathImpl(e,t,s,i,n){const r=e.getFirstVertex(e.getFirstPath(t)),m=new D;e.queryPoint(r,m),e.filterClosePoints(this.m_filterTolerance,!1,!1,!1,-1);if(e.getPointCount(t)<2)return n<0?0:(this.m_bRoundBuffer&&this.addCircle(s,m),2);f(e.getFirstPath(t)!==S),f(e.getFirstVertex(e.getFirstPath(t))!==S);const o=e.getXY(e.getFirstVertex(e.getFirstPath(t))),a=new E;if(a.setShift(o.negate()),e.applyTransformation(a),i){const i=ne(e,t,n,!0,this.m_absDistance,this.m_filterTolerance,this.m_densifyDist);if(f(1===i),e.getPointCount(t)<2)return n<0?0:(this.addCircle(s,m),2)}const h=0!==this.m_joins&&e.getVertexDescription().hasAttribute(10);this.m_bufferCommands.length=0;const l=e.getFirstPath(t);let c=e.getFirstVertex(l),u=1===n?e.getPrevVertex(c):e.getNextVertex(c),_=1===n?e.getNextVertex(c):e.getPrevVertex(c),g=!0;const d=new V,p=new V,b=new V,y=new V,P=new V,x=new V,C=new V,w=new V,T=this.m_absDistance,v=e.getPathSize(l),I=new V(0,0);for(let f=0;f<v;f++){p.assign(e.getXY(_)),g&&(d.assign(e.getXY(c)),b.assign(e.getXY(u)),x.setSub(d,b),x.normalize(),w.leftPerpendicularOther(x),w.scale(T),y.setAdd(w,d));const t=h&&!!(1&e.getAttributeAsDbl(10,c,0));P.setSub(p,d),P.normalize(),C.leftPerpendicularOther(P),C.scale(T);const s=new V;s.setAdd(d,C);const i=x.crossProduct(P),r=x.dotProduct(P);if(i<0||r<0&&i<Math.abs(r)*Number.EPSILON*8){let e=!1;const n=t?0:this.m_joins;if(1===n){const t=-i;I.setSub(x,P),I.scale(this.m_absDistance/t),I.length()<this.m_miterLimit*this.m_absDistance&&(I.addThis(d),e=!0),this.m_bufferCommands.push(U(y,s,I,e?O.enumMiter:O.enumBevel,this.m_bufferCommands.length+1))}else this.m_bufferCommands.push(U(y,s,d,0===n?O.enumArc:O.enumBevel,this.m_bufferCommands.length+1))}else y.equals(s)||(this.m_bufferCommands.push(J(y,d,this.m_bufferCommands.length+1)),this.m_bufferCommands.push(J(d,s,this.m_bufferCommands.length+1)));const m=new V;m.setAdd(p,C),this.m_bufferCommands.push(U(s,m,d,O.enumLine,this.m_bufferCommands.length+1)),y.setCoordsPoint2D(m),w.setCoordsPoint2D(C),b.setCoordsPoint2D(d),d.setCoordsPoint2D(p),x.setCoordsPoint2D(P),u=c,c=_,g=!1,_=1===n?e.getNextVertex(c):e.getPrevVertex(c)}return this.m_bufferCommands.at(-1).m_next=0,this.processBufferCommands(s),a.setShift(o),s.applyTransformationToPath(a,s.getPathCount()-1),1}bufferOpenPath(e,t,s,i){if(this.m_bRoundBuffer){const n=new C({vd:e.getDescription()});return n.addPath(e,t,!1),n.addSegmentsFromPath(e,t,0,e.getSegmentCountPath(t),!1),this.bufferClosedPath(n,0,s,i,1)}let n=0;const r=new C({vd:e.getDescription()}),m=new V(0,0);{const i=new v,o=i.addPathFromMultiPath(e,t,!1),a=i.getFirstVertex(i.getFirstPath(o)),h=new D;i.queryPoint(a,h),m.assign(h.getXY()),i.filterClosePoints(0,!1,!1,!1,-1);if(i.getPointCount(o)<2)return this.m_bRoundBuffer&&this.addCircle(s,h),2;const l=i.getGeometry(i.getFirstGeometry());r.addPath(l,0,!1),n=r.getPointCount()-1,r.addSegmentsFromPath(l,0,0,l.getSegmentCountPath(0)-1,!1)}const o=new v,a=o.addPathFromMultiPath(r,0,!0);f(o.getFirstPath(a)!==S),f(o.getFirstVertex(o.getFirstPath(a))!==S);const h=new E;h.setShift(m.negate()),o.applyTransformation(h),this.m_bufferCommands.length=0;const l=o.getFirstPath(a),c=0!==this.m_joins&&o.getVertexDescription().hasAttribute(10);let u=o.getFirstVertex(l),_=o.getPrevVertex(u),g=o.getNextVertex(u),d=!0;const p=new V,b=new V,y=new V,P=new V,x=new V,w=new V,T=new V,I=new V,M=this.m_absDistance,k=o.getPathSize(l),R=new V(0,0);for(let f=0;f<k;f++){let e=!1;0!==f&&f!==n||(e=!0),b.assign(o.getXY(g)),d&&(p.assign(o.getXY(u)),y.assign(o.getXY(_)),w.setSub(p,y),w.normalize(),I.leftPerpendicularOther(w),I.scale(M),P.setAdd(I,p));const t=c&&!!(1&o.getAttributeAsDbl(10,u,0));x.setSub(b,p),x.normalize(),T.leftPerpendicularOther(x),T.scale(M);const s=new V;s.setAdd(p,T);const i=w.crossProduct(x),r=w.dotProduct(x);if(i<0||r<0&&i<Math.abs(r)*Number.EPSILON*8)if(e)if(0===this.m_caps)this.m_bufferCommands.push(U(P,s,p,O.enumArc,this.m_bufferCommands.length+1));else if(1===this.m_caps)this.m_bufferCommands.push(U(P,s,p,O.enumLine,this.m_bufferCommands.length+1));else{const e=x.mul(this.m_absDistance).negate(),t=e.clone();e.addThis(P),t.addThis(s),this.m_bufferCommands.push(U(P,e,p,O.enumLine,this.m_bufferCommands.length+1)),this.m_bufferCommands.push(U(e,t,p,O.enumLine,this.m_bufferCommands.length+1)),this.m_bufferCommands.push(U(t,s,p,O.enumLine,this.m_bufferCommands.length+1))}else{let e=!1;const n=t?0:this.m_joins;if(1===n){const t=-i;R.setSub(w,x),R.scale(this.m_absDistance/t),R.length()<this.m_miterLimit*this.m_absDistance&&(R.addThis(p),e=!0),this.m_bufferCommands.push(U(P,s,R,e?O.enumMiter:O.enumBevel,this.m_bufferCommands.length+1))}else this.m_bufferCommands.push(U(P,s,p,0===n?O.enumArc:O.enumBevel,this.m_bufferCommands.length+1))}else P.equals(s)||(this.m_bufferCommands.push(J(P,p,this.m_bufferCommands.length+1)),this.m_bufferCommands.push(J(p,s,this.m_bufferCommands.length+1)));const m=new V;m.setAdd(b,T),this.m_bufferCommands.push(U(s,m,p,O.enumLine,this.m_bufferCommands.length+1)),P.setCoordsPoint2D(m),I.setCoordsPoint2D(T),y.setCoordsPoint2D(p),p.setCoordsPoint2D(b),w.setCoordsPoint2D(x),_=u,u=g,d=!1,g=o.getNextVertex(u)}return this.m_bufferCommands.at(-1).m_next=0,this.processBufferCommands(s),h.setShift(m),s.applyTransformationToPath(h,s.getPathCount()-1),1}processBufferCommands(e){const t=this.cleanupBufferCommands();let s=!0,i=t+1;for(let n=t;i!==t;n=i){const t=this.m_bufferCommands[n];i=-1!==t.m_next?t.m_next:(n+1)%this.m_bufferCommands.length,t.m_type&&(s&&(e.startPath(t.m_from),s=!1),t.m_type&O.enumJoinMask?this.addJoin(t.m_type,e,t.m_center,t.m_from,t.m_to,!1,!0):e.lineTo(t.m_to))}}cleanupBufferCommands(){this.m_helperArray=k(V,9);let e=0;for(let s=0,i=this.m_bufferCommands.length;s<i;){const t=this.m_bufferCommands[s];if(t.m_type&O.enumConnectionMask){e=s;break}s=t.m_next}let t=e+1;for(let s=e;t!==e;s=t){const e=this.m_bufferCommands[s];t=e.m_next;let i=1,n=null;for(;t!==s&&(n=this.m_bufferCommands[t],!(n.m_type&O.enumConnectionMask));)t=n.m_next,i++;if(1!==i&&(e.m_type&n.m_type)===O.enumLine){this.m_helperLine1.setStartXY(e.m_from),this.m_helperLine1.setEndXY(e.m_to),this.m_helperLine2.setStartXY(n.m_from),this.m_helperLine2.setEndXY(n.m_to);1===this.m_helperLine1.intersect(this.m_helperLine2,this.m_helperArray,null,null,this.m_smallTolerance.total())&&(e.m_to.assign(this.m_helperArray[0]),n.m_from.assign(this.m_helperArray[0]),e.m_next=t)}}return e}isDegeneratePath(e,t){if(1===e.getPathSize(t))return!0;if(0===this.m_joins&&0===this.m_caps){const s=new P;if(e.queryPathEnvelope(t,s),Math.max(s.width(),s.height())<.5*this.m_densifyDist)return!0}return!1}isDegenerateGeometry(e){if(0===this.m_joins&&0===this.m_caps){const t=new P;if(e.queryEnvelope(t),Math.max(t.width(),t.height())<.5*this.m_densifyDist)return!0}return!1}addCircle(e,t){const s=t.getXY();if(0!==this.m_circleTemplate.length){let t=this.m_circleTemplate[0].clone();t.scaleAddThis(this.m_absDistance,s),e.startPath(t);for(let i=1,n=this.m_circleTemplate.length;i<n;i++)t=this.m_circleTemplate[i].clone(),t.scaleAddThis(this.m_absDistance,s),e.lineTo(t);return}const i=this.m_circleTemplateSize,n=Math.trunc((i+3)/4),r=.5*Math.PI/n;e.reserve(4*n);const m=Math.cos(r),o=Math.sin(r);for(let a=3;a>=0;a--){const t=V.construct(0,this.m_absDistance);switch(a){case 0:for(let i=0;i<n;i++)e.lineToCoords(t.x+s.x,t.y+s.y),t.rotateReverse(m,o);break;case 1:for(let i=0;i<n;i++)e.lineToCoords(-t.y+s.x,t.x+s.y),t.rotateReverse(m,o);break;case 2:for(let i=0;i<n;i++)e.lineToCoords(-t.x+s.x,-t.y+s.y),t.rotateReverse(m,o);break;default:e.startPathCoords(t.y+s.x,-t.x+s.y);for(let i=1;i<n;i++)t.rotateReverse(m,o),e.lineToCoords(t.y+s.x,-t.x+s.y)}this.progress_()}}addSquare(e,t){const s=new T({vd:t.getDescription()});s.setCoords(t.getX(),t.getY(),t.getX(),t.getY()),s.inflateCoords(this.m_absDistance,this.m_absDistance),e.addEnvelope(s,!1)}setStrongSimple(e){return e.getImpl().setIsSimple(4,this.m_tolerance.total()),e.getImpl().updateOGCFlagsProtected(),e}}function $(e){return I(e,0),e}function ee(e,t){return!!e.isEmpty()||Math.min(e.width(),e.height())>t}function te(e,t,s,i,n,r,m,o){const a=e.getXY(s),h=e.getXY(i);if(a.equals(h))return-1;const l=.25*m,c=.25*m,u=new V;u.setSub(h,a);const _=u.length(),g=_*_*.25,d=r*r-g;if(d<=g)return-1;const p=Math.sqrt(d);u.normalize();const b=u.clone();b.rightPerpendicularThis();const y=g/p,P=y<=c,x=V.lerp(h,a,.5),C=b.clone(),D=y-l;C.scaleAddThis(Math.max(0,D),x);b.negate().scaleAddThis(p,x);const w=3.61*B(r-c),T=C.sub(a),v=C.sub(h);let S=!1,I=0;const M=A(64,0);f(o===M.length);{for(let o=e.getPrevVertexEx(i,n);o!==s;){if(1===e.getUserIndex(o,t))return-1;if(!e.getXY(o).equals(h))break;{const t=e.getPrevVertexEx(o,n);e.removeVertex(o,!1),o=t}}const r=new V,m=a.clone();M[I++]=1;for(let o=e.getNextVertexEx(s,n);o!==i;){if(1===e.getUserIndex(o,t))return-1;const s=e.getXY(o);if(s.equals(m)){const t=e.getNextVertexEx(o,n);e.removeVertex(o,!1),o=t;continue}M[I++]=0;const i=new V;if(i.setSub(s,a),i.dotProduct(b)<0)return 0;(V.sqrDistance(s,a)>w||V.sqrDistance(s,h)>w)&&(S=!0);let l=0;s.sub(a).crossProduct(T)>=0&&(l=1);if(s.sub(h).crossProduct(v)<=0&&(l|=2),0===l)return 0;M[I-1]=l,r.assign(m),m.assign(s),o=e.getNextVertexEx(o,n)}if(1===I)return 0;f(I<M.length),M[I++]=2}let E=!0;for(let f=1,V=0;f<I;f++)if(M[f]!==M[f-1]&&(V++,E=V<3&&(1===V&&3===M[f]||2===V&&2===M[f]),!E))return 0;if(I>2&&E&&(3===I||!S)){let t=0,r=e.getNextVertexEx(s,n);for(P||(e.setXY(r,C),r=e.getNextVertexEx(r,n));r!==i;){const s=e.getNextVertexEx(r,n);e.removeVertex(r,!1),r=s,++t}return t}if(f(3!==I),S&&I>3)return 0;const k=a.clone();let R=s;const X=a.clone();let Y=1,F=-1,G=R,q=0;for(I=1;G!==i;){G=e.getNextVertexEx(G,n);const t=M[I++];if(0===t){if(G===i)break;continue}const s=e.getXY(G);if(-1!==F){if(3&(F&Y&t)){e.removeVertex(R,!0),q++,R=G,X.setCoordsPoint2D(s),Y=t;continue}if(3===Y&&0!==F&&0!==t){if(X.setCoordsPoint2D(C),P||X.equals(k)){e.removeVertex(R,!0),q++,R=G,X.setCoordsPoint2D(s),Y=t;continue}e.setXY(R,X)}}F=Y,k.setCoordsPoint2D(X),R=G,Y=t,X.setCoordsPoint2D(s)}return q}function se(e,t,s,i){let n=-1;const r=new V,m=new V,o=new V;for(let a=0,h=e.getPathSize(i),l=e.getFirstVertex(i);a<h;++a){-1===n&&(e.queryXY(l,m),n=e.getPrevVertex(l),-1!==n&&(e.queryXY(n,r),o.setSub(m,r),o.normalize()));const s=e.getNextVertex(l);if(-1===s)break;const i=e.getXY(s),a=i.sub(m);if(a.normalize(),-1!==n){a.dotProduct(o)<-.99&&Math.abs(a.crossProduct(o))<1e-7&&e.setUserIndex(l,t,1)}n=l,l=s,r.assign(m),m.assign(i),o.assign(a)}}function ie(s,i,n,r,m,o,a){const h={stack:[],error:void 0,hasError:!1};try{const t=s.getFirstPath(i),r=s.createUserIndex();e(h,R((()=>{s.removeUserIndex(r)}),!1),!1),se(s,r,i,t);for(let e=0;e<100;++e){if(0===s.getPathSize(t))return 1;let e=s.getFirstVertex(t),i=s.getPathSize(t);if(i<3)return 1;s.isClosedPath(t)||(i-=1);const o=64;let h=0,l=!1;for(let t=0;t<i&&e!==S;t++){let c=0,u=e;for(let h=1,l=Math.min(o,i-t);h<l;h++)if(u=s.getNextVertexEx(u,n),h>1){const t=te(s,r,e,u,n,m,a,o);if(-1===t)break;c+=t,i-=t}if(h+=c,l=c>0,l){const t=s.getPrevVertexEx(e,n);if(-1!==t){e=t,i++;continue}}e=s.getNextVertexEx(e,n)}if(0===h)break}return s.filterClosePoints(o,!1,!1,!1,-1),1}catch(l){h.error=l,h.hasError=!0}finally{t(h)}}function ne(e,t,s,i,n,r,m){return ie(e,t,s,i,n,r,m)}function re(e,t,s,i){for(let n=0,r=e.getPathCount();n<r;n++){const r=e.getXY(e.getPathStart(n));r.x!==s.xmin&&r.x!==s.xmax&&t.addPath(e,n,i)}}export{Z as B};
5
+ import{b as e,c as t}from"./tslib.es6.js";import{b as s,t as i,c as n,G as r,q as m,a as o,r as a,h,s as l,n as c,e as u,g as f}from"./Geometry.js";import{S as _,G as g}from"./SimpleGeometryCursor.js";import{C as d,L as p,D as b,h as y,a as P,b as x,i as C,P as D,U as w,E as T,d as v,n as S,N as I}from"./QuadraticBezier.js";import{o as M,P as V,T as E,m as k,f as R,a as A,e as B}from"./Transformation2D.js";import{c as X}from"./GeometryCleaner-DVgW95-D.js";import{k as Y,l as F,O as G,p as q}from"./OperatorSimplify.js";import{O as z}from"./OperatorUnion.js";import{O as L}from"./OperatorGeneralize.js";class N{getOperatorType(){return 10104}accelerateGeometry(e,t,s){return!1}canAccelerateGeometry(e){return!1}supportsCurves(){return!0}isSimple(e,t,s,i,n){return 5===Y(e,t,s,i,n)}executeMany(e,t,s,i){return new j(e,t,s,i)}execute(e,t,i,n){const r=new _([e]),m=this.executeMany(r,t,i,n).next();return m||s("null output"),m}}class j extends g{constructor(e,t,s,n){super(),e||i(""),this.m_progressTracker=n,this.m_bForceSimplify=s,this.m_index=-1,this.m_inputGeometryCursor=e,this.m_spatialReference=t}next(){const e=this.m_inputGeometryCursor.next();return e?(n(e),this.m_index=this.m_inputGeometryCursor.getGeometryID(),this.simplify(e)):null}getGeometryID(){return this.m_index}tock(){return!1}getRank(){return 1}simplify(e){e||i("");return F(e,this.m_spatialReference,this.m_bForceSimplify,this.m_progressTracker)}}var O;function U(e,t,s,i,n,r){return{m_from:e.clone(),m_to:t.clone(),m_center:s.clone(),m_next:n,m_type:i}}function J(e,t,s,i,n){return{m_from:e.clone(),m_to:t.clone(),m_next:s,m_type:4,m_center:new V}}!function(e){e[e.enumDummy=256]="enumDummy",e[e.enumLine=1]="enumLine",e[e.enumArc=2]="enumArc",e[e.enumMiter=8]="enumMiter",e[e.enumBevel=16]="enumBevel",e[e.enumJoinMask=26]="enumJoinMask",e[e.enumConnectionMask=27]="enumConnectionMask"}(O||(O={}));class Q extends g{constructor(e,t,s,i,n,r,m,o,a,h){super(),this.m_index=0,this.m_bufferedPolygon=null,this.m_x=0,this.m_y=0,this.m_progressTracker=h,this.m_parent=e,this.m_mp=t,this.m_distance=s,this.m_spatialReference=i,this.m_densifyDist=o,this.m_maxVertexInCompleteCircle=a,this.m_joins=n,this.m_caps=r,this.m_miterLimit=m}next(){const e=new D;for(;;){if(this.m_index===this.m_mp.getPointCount())return null;if(1===this.m_caps)return this.m_index=this.m_mp.getPointCount(),new y({vd:this.m_mp.getDescription()});if(this.m_mp.getPointByVal(this.m_index,e),this.m_index++,!e.isEmpty())break}let t,s=!1;if(null===this.m_bufferedPolygon&&(this.m_x=e.getX(),this.m_y=e.getY(),this.m_bufferedPolygon=this.m_parent.buffer(e,this.m_distance,this.m_spatialReference,this.m_joins,this.m_caps,this.m_miterLimit,this.m_densifyDist,this.m_maxVertexInCompleteCircle),s=!0),t=this.m_index<this.m_mp.getPointCount()?this.m_bufferedPolygon.clone():this.m_bufferedPolygon,!s){const s=new E,i=e.getX()-this.m_x,n=e.getY()-this.m_y;s.setShiftCoords(i,n),t.applyTransformation(s)}return I(t,0),t}getGeometryID(){return 0}getRank(){return 1}tock(){return!0}}class W extends g{constructor(e){super(),this.m_currentPathIndex=0,this.m_polyline=e}next(){if(!this.m_polyline)return null;const e=this.m_polyline.getImpl(),t=e.getPathCount();if(this.m_currentPathIndex<t){const t=this.m_currentPathIndex;if(this.m_currentPathIndex++,!e.isClosedPathInXYPlane(t)){let s=e.getXY(e.getPathEnd(t)-1);for(;this.m_currentPathIndex<e.getPathCount();){const t=e.getXY(e.getPathStart(this.m_currentPathIndex));if(e.isClosedPathInXYPlane(this.m_currentPathIndex))break;if(!t.equals(s))break;s=e.getXY(e.getPathEnd(this.m_currentPathIndex)-1),this.m_currentPathIndex++}}if(0===t&&this.m_currentPathIndex===this.m_polyline.getPathCount()){const e=this.m_polyline;return this.m_polyline=null,e}const s=new C({vd:this.m_polyline.getDescription()});s.addPath(this.m_polyline,t,!0);for(let i=t+1;i<this.m_currentPathIndex;i++)s.addSegmentsFromPath(this.m_polyline,i,0,e.getSegmentCountPath(i),!1);return this.m_currentPathIndex===this.m_polyline.getPathCount()&&(this.m_polyline=null),s}return null}getGeometryID(){return 0}getRank(){return 1}tock(){return!0}}class H extends g{constructor(e,t,s){super(),this.m_geometry=null,this.m_index=0,this.m_bufferer=e,this.m_geoms=t,this.m_index=0,this.m_bFilter=s}next(){if(null===this.m_geometry&&(this.m_index=0,this.m_geometry=this.m_geoms.next(),!this.m_geometry))return null;const e=this.m_geometry.getImpl();if(this.m_index<e.getPathCount()){const e=this.m_index;this.m_index++;return this.m_bufferer.bufferPolylinePath(this.m_geometry,e,this.m_bFilter)}return this.m_geometry=null,this.next()}getGeometryID(){return 0}getRank(){return 1}tock(){return!0}}class K extends g{constructor(e){super(),this.m_index=0,this.m_bufferer=e}next(){const e=this.m_bufferer.m_geometry;if(this.m_index<e.getPathCount()){const t=this.m_index,s=e.calculateRingArea2D(this.m_index);for(f(s>0),this.m_index++;this.m_index<e.getPathCount();){if(e.calculateRingArea2D(this.m_index)>0)break;this.m_index++}let i;return i=0===t&&this.m_index===e.getPathCount()?this.m_bufferer.bufferPolygonImpl(e,0,e.getPathCount()):this.m_bufferer.bufferPolygonImpl(e,t,this.m_index),i}return null}getGeometryID(){return 0}getRank(){return 1}tock(){return!0}}class Z{constructor(e){this.m_geometry=null,this.m_bufferCommands=[],this.m_originalGeomType=r.enumUnknown,this.m_maxVertexInCompleteCircle=-1,this.m_circleTemplateSize=-1,this.m_oldCircleTemplateSize=0,this.m_spatialReference=null,this.m_tolerance=new d(0,0),this.m_smallTolerance=new d(0,0),this.m_filterTolerance=0,this.m_densifyDist=-1,this.m_distance=Number.NaN,this.m_absDistance=0,this.m_absDistanceReversed=0,this.m_dA=-1,this.m_miterLimit=4,this.m_joins=0,this.m_caps=0,this.m_bRoundBuffer=!0,this.m_bOutputLoops=!0,this.m_bFilter=!0,this.m_circleTemplate=[],this.m_leftStack=[],this.m_middleStack=[],this.m_helperLine1=new p,this.m_helperLine2=new p,this.m_helperArray=[],this.m_progressCounter=0,this.m_densificator=b.constructDefault(e),this.m_progressTracker=e}buffer(e,t,s,n,r,u,f,_){if(e||i("Geometry.Bufferer.Impl.Buffer"),f<0&&i("Geometry.Bufferer.Impl.Buffer"),m(e.getGeometryType())&&o("Unsupported geometry type."),e.isEmpty())return new y({vd:e.getDescription()});if(this.m_joins=n,this.m_caps=r,this.m_bRoundBuffer=!1,this.m_miterLimit=u,this.m_originalGeomType=e.getGeometryType(),a(this.m_originalGeomType)?this.m_bRoundBuffer=0===this.m_joins:h(this.m_originalGeomType)?this.m_bRoundBuffer=0===this.m_caps:l(this.m_originalGeomType)&&(this.m_bRoundBuffer=0===this.m_joins&&0===this.m_caps),this.m_bFilter=this.m_bRoundBuffer,this.m_geometry=X(e),this.m_geometry.isEmpty())return new y({vd:e.getDescription()});const g=new P;this.m_geometry.queryLooseEnvelope(g),t>0&&g.inflateCoords(t,t),this.m_tolerance=x(s,g,!0),this.m_smallTolerance=x(null,g,!0),_<=0&&(_=96),this.m_spatialReference=s,this.m_distance=t,this.m_absDistance=Math.abs(this.m_distance),this.m_absDistanceReversed=0!==this.m_absDistance?1/this.m_absDistance:0,Number.isNaN(f)||0===f?f=1e-5*this.m_absDistance:f>.5*this.m_absDistance&&(f=.5*this.m_absDistance),_<12&&(_=12);const d=Math.abs(t)*(1-Math.cos(Math.PI/_));if(d>f)f=d;else if(0!==t){const e=Math.PI/Math.acos(1-f/Math.abs(t));e<_-1&&(_=Math.trunc(e))<12&&(_=12,f=Math.abs(t)*(1-Math.cos(Math.PI/_)))}this.m_densifyDist=f,this.m_maxVertexInCompleteCircle=_,this.m_filterTolerance=this.m_bRoundBuffer?Math.min(this.m_smallTolerance.total(),.25*this.m_densifyDist):0,this.m_circleTemplateSize=this.calcN(),this.m_circleTemplateSize!==this.m_oldCircleTemplateSize&&(this.m_circleTemplate.length=0,this.m_oldCircleTemplateSize=this.m_circleTemplateSize),this.m_densifyDist>0&&c(this.m_geometry)&&(this.m_geometry=this.m_densificator.densifyEx(this.m_geometry,0,this.m_densifyDist,0,0!==this.m_joins,M()));const p=this.bufferImpl();return this.m_geometry=null,p}generateCircleTemplate(){if(this.m_circleTemplate.length)return;const e=this.m_circleTemplateSize,t=Math.trunc((e+3)/4),s=.5*Math.PI/t;this.m_dA=s,this.m_circleTemplate.length=4*t;const i=Math.cos(s),n=Math.sin(s),r=V.construct(0,1);for(let m=0;m<t;m++)this.m_circleTemplate[m+0*t]=V.construct(r.y,-r.x),this.m_circleTemplate[m+1*t]=V.construct(-r.x,-r.y),this.m_circleTemplate[m+2*t]=V.construct(-r.y,r.x),this.m_circleTemplate[m+3*t]=r.clone(),r.rotateReverse(i,n)}bufferImpl(){const e=this.m_geometry.getGeometryType();if(u(e)){const e=new C({vd:this.m_geometry.getDescription()});return e.addSegment(this.m_geometry,!0),this.m_geometry=e,this.bufferImpl()}if(this.m_distance<=this.m_tolerance.total()){if(!a(e))return new y({vd:this.m_geometry.getDescription()});if(this.m_distance<0){const e=new P;if(this.m_geometry.queryEnvelope(e),e.width()<=2*this.m_absDistance||e.height()<=2*this.m_absDistance)return new y({vd:this.m_geometry.getDescription()})}}switch(this.m_geometry.getGeometryType()){case r.enumPoint:return this.bufferPoint();case r.enumMultiPoint:return this.bufferMultiPoint();case r.enumPolyline:return this.bufferPolyline();case r.enumPolygon:return this.bufferPolygon();case r.enumEnvelope:return this.bufferEnvelope();default:s("")}}bufferPolyline(){if(this.isDegenerateGeometry(this.m_geometry)){const e=new D;this.m_geometry.getPointByVal(0,e);const t=new P;return this.m_geometry.queryEnvelope(t),e.setXY(t.getCenter()),this.bufferDegeneratePath(e,!0)}const e=this.m_geometry,t=this.m_geometry.getDescription();this.m_geometry=null;const s=new W(e);let i,n;i=0===this.m_joins?(new L).executeMany(s,.25*this.m_densifyDist,!1,this.m_progressTracker):s,n=this.m_bRoundBuffer?(new N).executeMany(i,null,!0,this.m_progressTracker):i;const r=new H(this,n,this.m_bFilter),m=(new z).executeMany(r,this.m_spatialReference,this.m_progressTracker,2),o=(new G).executeMany(m,this.m_spatialReference,!1,this.m_progressTracker).next();return null!==o?o:new y({vd:t})}bufferPolygon(){if(0===this.m_distance)return this.m_geometry;this.generateCircleTemplate();const e=(new G).execute(this.m_geometry,null,!1,this.m_progressTracker);if(this.m_distance<0){if(this.m_geometry=e,this.m_geometry.isEmpty())return this.m_geometry;const t=this.m_geometry,s=this.bufferPolygonImpl(t,0,t.getPathCount());return(new G).execute(s,this.m_spatialReference,!1,this.m_progressTracker)}{if(this.m_geometry=e,this.isDegenerateGeometry(this.m_geometry)){const e=new D;this.m_geometry.getPointByVal(0,e);const t=new P;return this.m_geometry.queryEnvelope(t),e.setXY(t.getCenter()),this.bufferDegeneratePath(e,!0)}const t=new K(this),s=(new z).executeMany(t,this.m_spatialReference,this.m_progressTracker,2),i=(new G).executeMany(s,this.m_spatialReference,!1,this.m_progressTracker).next();return null!==i?i:new y({vd:this.m_geometry.getDescription()})}}bufferPolygonImpl(e,t,s){const i=e,n=i.getImpl();let r=new y({vd:e.getDescription()});for(let m=t;m<s;m++){if(n.getPathSize(m)<1)continue;const t=n.calculateRingArea2D(m),s=new P;if(n.queryPathEnvelope(m,s),this.m_distance>0)if(t>0)if(this.isDegeneratePath(n,m)){const e=new D;n.getPointByVal(n.getPathStart(m),e),e.setXY(s.getCenter()),r.add(this.bufferDegeneratePath(e,!0),!1)}else{const t=new C({vd:e.getDescription()}),s=t.getImpl();if(w(this.m_geometry,m)){const e=this.bufferConvexPath(i,m);r.add(e,!1)}else{this.bufferClosedPath(this.m_geometry,m,s,this.m_bRoundBuffer,1);const e=this.bufferCleanup(t);r.add(e,!1)}}else{if(s.width()+this.m_tolerance.total()<=2*this.m_absDistance||s.height()+this.m_tolerance.total()<=2*this.m_absDistance)continue;const t=new C({vd:e.getDescription()}),i=t.getImpl();if(this.bufferClosedPath(this.m_geometry,m,i,this.m_bRoundBuffer,1),!t.isEmpty()){const e=s,n=Math.max(1,this.m_absDistance),m=e.clone();m.inflateCoords(n,n),i.addEnvelope(m,!1);const o=this.bufferCleanup(t);r.reserve(r.getPointCount()+o.getPointCount()-4),re(o,r,m,!0)}}else if(t>0){if(s.width()+this.m_tolerance.total()<=2*this.m_absDistance||s.height()+this.m_tolerance.total()<=2*this.m_absDistance)continue;const t=new C({vd:e.getDescription()}),i=t.getImpl();if(this.bufferClosedPath(this.m_geometry,m,i,this.m_bRoundBuffer,-1),!t.isEmpty()){const e=new P;i.queryLooseEnvelope(e);const s=Math.max(1,this.m_absDistance),n=e.clone();n.inflateCoords(s,s),i.addEnvelope(n,!1);re(this.bufferCleanup(t),r,n,!0)}}else{const t=new C({vd:e.getDescription()}),s=t.getImpl();this.bufferClosedPath(this.m_geometry,m,s,this.m_bRoundBuffer,-1);const i=this.bufferCleanup(t);for(let e=0,n=i.getPathCount();e<n;e++)r.addPath(i,e,!0)}}if(this.m_distance>0){if(r.getPathCount()>1){return this.bufferCleanup(r)}return $(r)}{const e=new P;if(r.queryLooseEnvelope(e),r.isEmpty())return $(r);{const t=Math.max(1,this.m_absDistance),s=e.clone();s.inflateCoords(t,t),r.addEnvelope(s,!1);const i=this.bufferCleanup(r);r=new y;const n=new y({vd:i.getDescription()});return re(i,n,s,!1),$(n)}}}bufferPoint(){return this.bufferPointImpl(this.m_geometry)}bufferPointImpl(e){const t=new y({vd:e.getDescription()});return 0===this.m_caps?(this.addCircle(t.getImpl(),e),this.setStrongSimple(t)):2===this.m_caps?(this.addSquare(t.getImpl(),e),this.setStrongSimple(t)):t}bufferDegeneratePath(e,t){const s=new y({vd:e.getDescription()});return t&&0===this.m_joins||!t&&0===this.m_caps?(this.addCircle(s.getImpl(),e),this.setStrongSimple(s)):t||2!==this.m_caps?s:(this.addSquare(s.getImpl(),e),this.setStrongSimple(s))}bufferMultiPoint(){const e=new Q(this,this.m_geometry,this.m_distance,this.m_spatialReference,this.m_joins,this.m_caps,this.m_miterLimit,this.m_densifyDist,this.m_maxVertexInCompleteCircle,this.m_progressTracker);return(new z).executeMany(e,this.m_spatialReference,this.m_progressTracker,2).next()}bufferEnvelope(){let e=new y({vd:this.m_geometry.getDescription()});if(this.m_distance<=0){if(0===this.m_distance)e.addEnvelope(this.m_geometry,!1),ee(this.m_geometry,this.m_tolerance.total())&&(e=this.setStrongSimple(e));else{const t=new T;this.m_geometry.queryEnvelope(t),t.inflateCoords(this.m_distance,this.m_distance),e.addEnvelope(t,!1),ee(t,this.m_tolerance.total())&&(e=this.setStrongSimple(e))}return e}if(1===this.m_joins){const t=new T({copy:this.m_geometry});return t.inflateCoords(this.m_absDistance,this.m_absDistance),e.addEnvelope(t,!1),e}const t=this.m_geometry.clone();if(0===t.width()||0===t.height()){if(0===t.width()&&0===t.height()){const e=new D({vd:this.m_geometry.getDescription()});return t.queryCornerByVal(0,e),this.m_geometry=e,this.bufferImpl()}const e=new C({vd:this.m_geometry.getDescription()}),s=new D;return t.queryCornerByVal(0,s),e.startPathPoint(s),t.queryCornerByVal(2,s),e.lineToPoint(s),this.m_geometry=e,this.bufferImpl()}return e.addEnvelope(this.m_geometry,!1),this.m_geometry=e,this.bufferConvexPath(e,0)}bufferConvexPath(e,t){this.generateCircleTemplate();const i=e.hasAttribute(10),n=new y({vd:e.getDescription()}),r=n.getImpl();n.reserve((this.m_circleTemplate.length/10+4)*e.getPathSize(t));const m=new V,o=new V,a=new V,h=new V(0,0),l=new V,c=new V,u=e.getImpl(),f=e.getPathSize(t),_=e.getPathStart(t);for(let g=0,d=e.getPathSize(t);g<d;g++){const e=u.getXY(_+g),t=u.getXY(_+(g+1)%f),n=u.getXY(_+(g+2)%f);l.setSub(t,e),0===l.length()&&s("");const d=i&&!!(1&u.getAttributeAsInt(10,(g+1)%f,0));l.normalize();const p=l.clone();l.leftPerpendicularThis(),l.scale(this.m_absDistance),m.setAdd(l,e),o.setAdd(l,t),0===g?r.startPath(m):r.lineTo(m),r.lineTo(o),c.setSub(n,t),0===c.length()&&s(""),c.normalize();const b=c.clone();c.leftPerpendicularThis(),c.scale(this.m_absDistance),a.setAdd(c,t);let y=O.enumArc;const P=d?0:this.m_joins;if(2===P)y=O.enumBevel;else if(1===P){const e=-p.crossProduct(b);h.setSub(p,b),h.scale(this.m_absDistance/e),h.length()<this.m_miterLimit*this.m_absDistance?(h.addThis(t),y=O.enumMiter):y=O.enumBevel}else h.assign(t);this.addJoin(y,r,h,o,a,!1,!1)}return $(n)}bufferPolylinePath(e,t,s){this.generateCircleTemplate();const i=e,n=i.getImpl();if(n.getPathSize(t)<1)return null;let r;if(r=this.m_bRoundBuffer?n.isClosedPathInXYPlane(t):n.isClosedPath(t),this.isDegeneratePath(n,t)&&this.m_distance>0){const e=new D;n.getPointByVal(n.getPathStart(t),e);const s=new P;return n.queryPathEnvelope(t,s),e.setXY(s.getCenter()),this.bufferDegeneratePath(e,r)}const m=new C({vd:e.getDescription()});m.reserve((Math.trunc(this.m_circleTemplate.length/10)+4)*n.getPathSize(t));const o=m.getImpl();return r?2!==this.bufferClosedPath(i,t,o,s,1)&&this.bufferClosedPath(i,t,o,s,-1):this.bufferOpenPath(i,t,o,s),this.bufferCleanup(m)}progress_(){}bufferCleanup(e,t=!1){const s=t?this.m_tolerance:this.m_smallTolerance;return q(e,s,!0,!t,-1,this.m_progressTracker,0,!1)}calcN(){const e=4;if(0===this.m_densifyDist)return this.m_maxVertexInCompleteCircle;const t=1-this.m_densifyDist*Math.abs(this.m_absDistanceReversed);let s=e;return s=t<-1?e:2*Math.PI/Math.acos(t)+.5,s<e?s=e:s>this.m_maxVertexInCompleteCircle&&(s=this.m_maxVertexInCompleteCircle),Math.trunc(s)}addJoin(e,t,s,i,n,r,m){if(this.generateCircleTemplate(),r&&(t.startPath(i),r=!1),e===O.enumBevel)return void(m&&t.lineTo(n));if(e===O.enumMiter){const e=s.clone();return t.lineTo(e),void(m&&t.lineTo(n))}const o=new V;o.setSub(i,s),o.scale(this.m_absDistanceReversed);const a=new V;a.setSub(n,s),a.scale(this.m_absDistanceReversed);let h=Math.atan2(o.y,o.x)/this.m_dA;h<0&&(h=this.m_circleTemplate.length+h),h=this.m_circleTemplate.length-h;let l=Math.atan2(a.y,a.x)/this.m_dA;l<0&&(l=this.m_circleTemplate.length+l),l=this.m_circleTemplate.length-l,l<h&&(l+=this.m_circleTemplate.length);let c=Math.trunc(l),u=Math.ceil(h),f=this.m_circleTemplate[u%this.m_circleTemplate.length].clone();f.scaleAddThis(this.m_absDistance,s);const _=10*this.m_tolerance.total();f.sub(i).length()<_&&(u+=1),f=this.m_circleTemplate[c%this.m_circleTemplate.length].clone(),f.scaleAddThis(this.m_absDistance,s),f.sub(n).length()<_&&(c-=1);let g=c-u;g++;for(let d=0,p=u%this.m_circleTemplate.length;d<g;d++,p=(p+1)%this.m_circleTemplate.length)f=this.m_circleTemplate[p].clone(),f.scaleAddThis(this.m_absDistance,s),t.lineTo(f),this.progress_();m&&t.lineTo(n)}bufferClosedPath(e,t,s,i,n){const r=new v,m=r.addPathFromMultiPath(e,t,!0);return this.bufferClosedPathImpl(r,m,s,i,n)}bufferClosedPathImpl(e,t,s,i,n){const r=e.getFirstVertex(e.getFirstPath(t)),m=new D;e.queryPoint(r,m),e.filterClosePoints(this.m_filterTolerance,!1,!1,!1,-1);if(e.getPointCount(t)<2)return n<0?0:(this.m_bRoundBuffer&&this.addCircle(s,m),2);f(e.getFirstPath(t)!==S),f(e.getFirstVertex(e.getFirstPath(t))!==S);const o=e.getXY(e.getFirstVertex(e.getFirstPath(t))),a=new E;if(a.setShift(o.negate()),e.applyTransformation(a),i){const i=ne(e,t,n,!0,this.m_absDistance,this.m_filterTolerance,this.m_densifyDist);if(f(1===i),e.getPointCount(t)<2)return n<0?0:(this.addCircle(s,m),2)}const h=0!==this.m_joins&&e.getVertexDescription().hasAttribute(10);this.m_bufferCommands.length=0;const l=e.getFirstPath(t);let c=e.getFirstVertex(l),u=1===n?e.getPrevVertex(c):e.getNextVertex(c),_=1===n?e.getNextVertex(c):e.getPrevVertex(c),g=!0;const d=new V,p=new V,b=new V,y=new V,P=new V,x=new V,C=new V,w=new V,T=this.m_absDistance,v=e.getPathSize(l),I=new V(0,0);for(let f=0;f<v;f++){p.assign(e.getXY(_)),g&&(d.assign(e.getXY(c)),b.assign(e.getXY(u)),x.setSub(d,b),x.normalize(),w.leftPerpendicularOther(x),w.scale(T),y.setAdd(w,d));const t=h&&!!(1&e.getAttributeAsDbl(10,c,0));P.setSub(p,d),P.normalize(),C.leftPerpendicularOther(P),C.scale(T);const s=new V;s.setAdd(d,C);const i=x.crossProduct(P),r=x.dotProduct(P);if(i<0||r<0&&i<Math.abs(r)*Number.EPSILON*8){let e=!1;const n=t?0:this.m_joins;if(1===n){const t=-i;I.setSub(x,P),I.scale(this.m_absDistance/t),I.length()<this.m_miterLimit*this.m_absDistance&&(I.addThis(d),e=!0),this.m_bufferCommands.push(U(y,s,I,e?O.enumMiter:O.enumBevel,this.m_bufferCommands.length+1))}else this.m_bufferCommands.push(U(y,s,d,0===n?O.enumArc:O.enumBevel,this.m_bufferCommands.length+1))}else y.equals(s)||(this.m_bufferCommands.push(J(y,d,this.m_bufferCommands.length+1)),this.m_bufferCommands.push(J(d,s,this.m_bufferCommands.length+1)));const m=new V;m.setAdd(p,C),this.m_bufferCommands.push(U(s,m,d,O.enumLine,this.m_bufferCommands.length+1)),y.setCoordsPoint2D(m),w.setCoordsPoint2D(C),b.setCoordsPoint2D(d),d.setCoordsPoint2D(p),x.setCoordsPoint2D(P),u=c,c=_,g=!1,_=1===n?e.getNextVertex(c):e.getPrevVertex(c)}return this.m_bufferCommands.at(-1).m_next=0,this.processBufferCommands(s),a.setShift(o),s.applyTransformationToPath(a,s.getPathCount()-1),1}bufferOpenPath(e,t,s,i){if(this.m_bRoundBuffer){const n=new C({vd:e.getDescription()});return n.addPath(e,t,!1),n.addSegmentsFromPath(e,t,0,e.getSegmentCountPath(t),!1),this.bufferClosedPath(n,0,s,i,1)}let n=0;const r=new C({vd:e.getDescription()}),m=new V(0,0);{const i=new v,o=i.addPathFromMultiPath(e,t,!1),a=i.getFirstVertex(i.getFirstPath(o)),h=new D;i.queryPoint(a,h),m.assign(h.getXY()),i.filterClosePoints(0,!1,!1,!1,-1);if(i.getPointCount(o)<2)return this.m_bRoundBuffer&&this.addCircle(s,h),2;const l=i.getGeometry(i.getFirstGeometry());r.addPath(l,0,!1),n=r.getPointCount()-1,r.addSegmentsFromPath(l,0,0,l.getSegmentCountPath(0)-1,!1)}const o=new v,a=o.addPathFromMultiPath(r,0,!0);f(o.getFirstPath(a)!==S),f(o.getFirstVertex(o.getFirstPath(a))!==S);const h=new E;h.setShift(m.negate()),o.applyTransformation(h),this.m_bufferCommands.length=0;const l=o.getFirstPath(a),c=0!==this.m_joins&&o.getVertexDescription().hasAttribute(10);let u=o.getFirstVertex(l),_=o.getPrevVertex(u),g=o.getNextVertex(u),d=!0;const p=new V,b=new V,y=new V,P=new V,x=new V,w=new V,T=new V,I=new V,M=this.m_absDistance,k=o.getPathSize(l),R=new V(0,0);for(let f=0;f<k;f++){let e=!1;0!==f&&f!==n||(e=!0),b.assign(o.getXY(g)),d&&(p.assign(o.getXY(u)),y.assign(o.getXY(_)),w.setSub(p,y),w.normalize(),I.leftPerpendicularOther(w),I.scale(M),P.setAdd(I,p));const t=c&&!!(1&o.getAttributeAsDbl(10,u,0));x.setSub(b,p),x.normalize(),T.leftPerpendicularOther(x),T.scale(M);const s=new V;s.setAdd(p,T);const i=w.crossProduct(x),r=w.dotProduct(x);if(i<0||r<0&&i<Math.abs(r)*Number.EPSILON*8)if(e)if(0===this.m_caps)this.m_bufferCommands.push(U(P,s,p,O.enumArc,this.m_bufferCommands.length+1));else if(1===this.m_caps)this.m_bufferCommands.push(U(P,s,p,O.enumLine,this.m_bufferCommands.length+1));else{const e=x.mul(this.m_absDistance).negate(),t=e.clone();e.addThis(P),t.addThis(s),this.m_bufferCommands.push(U(P,e,p,O.enumLine,this.m_bufferCommands.length+1)),this.m_bufferCommands.push(U(e,t,p,O.enumLine,this.m_bufferCommands.length+1)),this.m_bufferCommands.push(U(t,s,p,O.enumLine,this.m_bufferCommands.length+1))}else{let e=!1;const n=t?0:this.m_joins;if(1===n){const t=-i;R.setSub(w,x),R.scale(this.m_absDistance/t),R.length()<this.m_miterLimit*this.m_absDistance&&(R.addThis(p),e=!0),this.m_bufferCommands.push(U(P,s,R,e?O.enumMiter:O.enumBevel,this.m_bufferCommands.length+1))}else this.m_bufferCommands.push(U(P,s,p,0===n?O.enumArc:O.enumBevel,this.m_bufferCommands.length+1))}else P.equals(s)||(this.m_bufferCommands.push(J(P,p,this.m_bufferCommands.length+1)),this.m_bufferCommands.push(J(p,s,this.m_bufferCommands.length+1)));const m=new V;m.setAdd(b,T),this.m_bufferCommands.push(U(s,m,p,O.enumLine,this.m_bufferCommands.length+1)),P.setCoordsPoint2D(m),I.setCoordsPoint2D(T),y.setCoordsPoint2D(p),p.setCoordsPoint2D(b),w.setCoordsPoint2D(x),_=u,u=g,d=!1,g=o.getNextVertex(u)}return this.m_bufferCommands.at(-1).m_next=0,this.processBufferCommands(s),h.setShift(m),s.applyTransformationToPath(h,s.getPathCount()-1),1}processBufferCommands(e){const t=this.cleanupBufferCommands();let s=!0,i=t+1;for(let n=t;i!==t;n=i){const t=this.m_bufferCommands[n];i=-1!==t.m_next?t.m_next:(n+1)%this.m_bufferCommands.length,t.m_type&&(s&&(e.startPath(t.m_from),s=!1),t.m_type&O.enumJoinMask?this.addJoin(t.m_type,e,t.m_center,t.m_from,t.m_to,!1,!0):e.lineTo(t.m_to))}}cleanupBufferCommands(){this.m_helperArray=k(V,9);let e=0;for(let s=0,i=this.m_bufferCommands.length;s<i;){const t=this.m_bufferCommands[s];if(t.m_type&O.enumConnectionMask){e=s;break}s=t.m_next}let t=e+1;for(let s=e;t!==e;s=t){const e=this.m_bufferCommands[s];t=e.m_next;let i=1,n=null;for(;t!==s&&(n=this.m_bufferCommands[t],!(n.m_type&O.enumConnectionMask));)t=n.m_next,i++;if(1!==i&&(e.m_type&n.m_type)===O.enumLine){this.m_helperLine1.setStartXY(e.m_from),this.m_helperLine1.setEndXY(e.m_to),this.m_helperLine2.setStartXY(n.m_from),this.m_helperLine2.setEndXY(n.m_to);1===this.m_helperLine1.intersect(this.m_helperLine2,this.m_helperArray,null,null,this.m_smallTolerance.total())&&(e.m_to.assign(this.m_helperArray[0]),n.m_from.assign(this.m_helperArray[0]),e.m_next=t)}}return e}isDegeneratePath(e,t){if(1===e.getPathSize(t))return!0;if(0===this.m_joins&&0===this.m_caps){const s=new P;if(e.queryPathEnvelope(t,s),Math.max(s.width(),s.height())<.5*this.m_densifyDist)return!0}return!1}isDegenerateGeometry(e){if(0===this.m_joins&&0===this.m_caps){const t=new P;if(e.queryEnvelope(t),Math.max(t.width(),t.height())<.5*this.m_densifyDist)return!0}return!1}addCircle(e,t){const s=t.getXY();if(0!==this.m_circleTemplate.length){let t=this.m_circleTemplate[0].clone();t.scaleAddThis(this.m_absDistance,s),e.startPath(t);for(let i=1,n=this.m_circleTemplate.length;i<n;i++)t=this.m_circleTemplate[i].clone(),t.scaleAddThis(this.m_absDistance,s),e.lineTo(t);return}const i=this.m_circleTemplateSize,n=Math.trunc((i+3)/4),r=.5*Math.PI/n;e.reserve(4*n);const m=Math.cos(r),o=Math.sin(r);for(let a=3;a>=0;a--){const t=V.construct(0,this.m_absDistance);switch(a){case 0:for(let i=0;i<n;i++)e.lineToCoords(t.x+s.x,t.y+s.y),t.rotateReverse(m,o);break;case 1:for(let i=0;i<n;i++)e.lineToCoords(-t.y+s.x,t.x+s.y),t.rotateReverse(m,o);break;case 2:for(let i=0;i<n;i++)e.lineToCoords(-t.x+s.x,-t.y+s.y),t.rotateReverse(m,o);break;default:e.startPathCoords(t.y+s.x,-t.x+s.y);for(let i=1;i<n;i++)t.rotateReverse(m,o),e.lineToCoords(t.y+s.x,-t.x+s.y)}this.progress_()}}addSquare(e,t){const s=new T({vd:t.getDescription()});s.setCoords(t.getX(),t.getY(),t.getX(),t.getY()),s.inflateCoords(this.m_absDistance,this.m_absDistance),e.addEnvelope(s,!1)}setStrongSimple(e){return e.getImpl().setIsSimple(4,this.m_tolerance.total()),e.getImpl().updateOGCFlagsProtected(),e}}function $(e){return I(e,0),e}function ee(e,t){return!!e.isEmpty()||Math.min(e.width(),e.height())>t}function te(e,t,s,i,n,r,m,o){const a=e.getXY(s),h=e.getXY(i);if(a.equals(h))return-1;const l=.25*m,c=.25*m,u=new V;u.setSub(h,a);const _=u.length(),g=_*_*.25,d=r*r-g;if(d<=g)return-1;const p=Math.sqrt(d);u.normalize();const b=u.clone();b.rightPerpendicularThis();const y=g/p,P=y<=c,x=V.lerp(h,a,.5),C=b.clone(),D=y-l;C.scaleAddThis(Math.max(0,D),x);b.negate().scaleAddThis(p,x);const w=3.61*B(r-c),T=C.sub(a),v=C.sub(h);let S=!1,I=0;const M=A(64,0);f(o===M.length);{for(let o=e.getPrevVertexEx(i,n);o!==s;){if(1===e.getUserIndex(o,t))return-1;if(!e.getXY(o).equals(h))break;{const t=e.getPrevVertexEx(o,n);e.removeVertex(o,!1),o=t}}const r=new V,m=a.clone();M[I++]=1;for(let o=e.getNextVertexEx(s,n);o!==i;){if(1===e.getUserIndex(o,t))return-1;const s=e.getXY(o);if(s.equals(m)){const t=e.getNextVertexEx(o,n);e.removeVertex(o,!1),o=t;continue}M[I++]=0;const i=new V;if(i.setSub(s,a),i.dotProduct(b)<0)return 0;(V.sqrDistance(s,a)>w||V.sqrDistance(s,h)>w)&&(S=!0);let l=0;s.sub(a).crossProduct(T)>=0&&(l=1);if(s.sub(h).crossProduct(v)<=0&&(l|=2),0===l)return 0;M[I-1]=l,r.assign(m),m.assign(s),o=e.getNextVertexEx(o,n)}if(1===I)return 0;f(I<M.length),M[I++]=2}let E=!0;for(let f=1,V=0;f<I;f++)if(M[f]!==M[f-1]&&(V++,E=V<3&&(1===V&&3===M[f]||2===V&&2===M[f]),!E))return 0;if(I>2&&E&&(3===I||!S)){let t=0,r=e.getNextVertexEx(s,n);for(P||(e.setXY(r,C),r=e.getNextVertexEx(r,n));r!==i;){const s=e.getNextVertexEx(r,n);e.removeVertex(r,!1),r=s,++t}return t}if(f(3!==I),S&&I>3)return 0;const k=a.clone();let R=s;const X=a.clone();let Y=1,F=-1,G=R,q=0;for(I=1;G!==i;){G=e.getNextVertexEx(G,n);const t=M[I++];if(0===t){if(G===i)break;continue}const s=e.getXY(G);if(-1!==F){if(3&(F&Y&t)){e.removeVertex(R,!0),q++,R=G,X.setCoordsPoint2D(s),Y=t;continue}if(3===Y&&0!==F&&0!==t){if(X.setCoordsPoint2D(C),P||X.equals(k)){e.removeVertex(R,!0),q++,R=G,X.setCoordsPoint2D(s),Y=t;continue}e.setXY(R,X)}}F=Y,k.setCoordsPoint2D(X),R=G,Y=t,X.setCoordsPoint2D(s)}return q}function se(e,t,s,i){let n=-1;const r=new V,m=new V,o=new V;for(let a=0,h=e.getPathSize(i),l=e.getFirstVertex(i);a<h;++a){-1===n&&(e.queryXY(l,m),n=e.getPrevVertex(l),-1!==n&&(e.queryXY(n,r),o.setSub(m,r),o.normalize()));const s=e.getNextVertex(l);if(-1===s)break;const i=e.getXY(s),a=i.sub(m);if(a.normalize(),-1!==n){a.dotProduct(o)<-.99&&Math.abs(a.crossProduct(o))<1e-7&&e.setUserIndex(l,t,1)}n=l,l=s,r.assign(m),m.assign(i),o.assign(a)}}function ie(s,i,n,r,m,o,a){const h={stack:[],error:void 0,hasError:!1};try{const t=s.getFirstPath(i),r=s.createUserIndex();e(h,R((()=>{s.removeUserIndex(r)}),!1),!1),se(s,r,i,t);for(let e=0;e<100;++e){if(0===s.getPathSize(t))return 1;let e=s.getFirstVertex(t),i=s.getPathSize(t);if(i<3)return 1;s.isClosedPath(t)||(i-=1);const o=64;let h=0,l=!1;for(let t=0;t<i&&e!==S;t++){let c=0,u=e;for(let h=1,l=Math.min(o,i-t);h<l;h++)if(u=s.getNextVertexEx(u,n),h>1){const t=te(s,r,e,u,n,m,a,o);if(-1===t)break;c+=t,i-=t}if(h+=c,l=c>0,l){const t=s.getPrevVertexEx(e,n);if(-1!==t){e=t,i++;continue}}e=s.getNextVertexEx(e,n)}if(0===h)break}return s.filterClosePoints(o,!1,!1,!1,-1),1}catch(l){h.error=l,h.hasError=!0}finally{t(h)}}function ne(e,t,s,i,n,r,m){return ie(e,t,s,i,n,r,m)}function re(e,t,s,i){for(let n=0,r=e.getPathCount();n<r;n++){const r=e.getXY(e.getPathStart(n));r.x!==s.xmin&&r.x!==s.xmax&&t.addPath(e,n,i)}}export{Z as B};
@@ -2,4 +2,4 @@
2
2
  All material copyright ESRI, All Rights Reserved, unless otherwise specified.
3
3
  See https://js.arcgis.com/4.32/esri/copyright.txt for details.
4
4
  */
5
- import{G as t,a as e}from"./Geometry.js";import{P as n,K as r}from"./Transformation2D.js";function a(e,r){if(!e.isEmpty()){switch(e.getGeometryType()){case t.enumPolygon:return o(e);case t.enumPolyline:return l(e);case t.enumLine:case t.enumBezier:case t.enumEllipticArc:return i(e);case t.enumMultiPoint:return g(e);case t.enumEnvelope:return e.getCenterXY();case t.enumPoint:return e.getXY();default:return n.construct(Number.NaN,Number.NaN)}}return n.construct(Number.NaN,Number.NaN)}function u(t,e){return o(t,e)}function o(t,e=-1){const a=new r(0),u=new r(0),o=t.getImpl();let l;const i=o.hasNonLinearSegments();let g;const m=o.getXY(0);if(-1===e){if(g=o.calculateArea2D(),0===g)return d(t);i&&(l=o.querySegmentIterator());for(let t=0,e=o.getPathCount();t<e;t++)s(m,o,t,a,u),i&&c(m,l,a,u)}else{if(g=o.calculateRingArea2D(e),0===g)return d(t,e);i&&(l=o.querySegmentIterator(),l.resetToPath(e)),s(m,o,e,a,u),i&&c(m,l,a,u)}const f=new n,h=new n;return f.setCoords(a.getResult(),u.getResult()),h.assign(f.mul(1/g).add(m)),h}function s(t,e,a,u,o){const s=e.getPathStart(a),c=e.getPathEnd(a);if(c-s<3)return;const l=e.getAttributeStreamRef(0),i=l.readPoint2D(2*s),g=l.readPoint2D(2*(s+1));g.subThis(i);const d=new r(0),m=e.hasNonLinearSegments(),f=1/3,h=new n;for(let n=s+2;n<c;n++){l.queryPoint2D(2*n,h),h.subThis(i);const t=.5*h.crossProduct(g);m&&d.add(t);const e=f*t;u.add((g.x+h.x)*e),o.add((g.y+h.y)*e),g.setCoordsPoint2D(h)}const P=m?d.getResult():e.calculateRingArea2D(a),y=i.sub(t).mul(P);u.add(y.x),o.add(y.y)}function c(t,n,r,a){let u;for(n.nextPath()||e("centroid");null!==(u=n.nextCurve());){const e=u.calculateWeightedAreaCentroid2D(t);r.add(e.x),a.add(e.y)}}function l(t){return m(t.getImpl())}function i(t){const e=t.calculateLength2D();if(0===e)return t.getStartXY();return t.calculateWeightedCentroid2D().mul(1/e)}function g(t){const e=new r(0),a=new r(0),u=t.getImpl(),o=u.getAttributeStreamRef(0),s=u.getPointCount(),c=new n;for(let n=0;n<s;n++)o.queryPoint2D(2*n,c),e.add(c.x),a.add(c.y);const l=new n;return l.setCoords(e.getResult(),a.getResult()),l.divThis(s)}function d(t,e=-1){return m(t.getImpl(),e)}function m(t,e=-1){const a=-1===e?t.calculateLength2D():t.calculatePathLength2D(e);if(0===a)return f(t,e);const u=new r(0),o=new r(0),s=t.querySegmentIterator();for(-1!==e&&s.resetToPath(e);s.nextPath();){const n=s.getPathIndex(),r=t.getXY(t.getPathStart(n));for(;s.hasNextSegment();){const t=s.nextSegment(),e=t.calculateLength2D();if(0===e)continue;const n=t.calculateWeightedCentroid2D().sub(r.mul(e));u.add(n.x),o.add(n.y)}const a=r.mul(t.calculatePathLength2D(n));if(u.add(a.x),o.add(a.y),-1!==e)break}const c=new n;return c.setCoords(u.getResult(),o.getResult()),c.mul(1/a)}function f(t,e=-1){if(-1!==e)return t.getXY(t.getPathStart(e));const a=new r(0),u=new r(0);for(let n=0;n<t.getPathCount();++n){const e=t.getXY(t.getPathStart(n));a.add(e.x),u.add(e.y)}return n.construct(a.getResult(),u.getResult()).mul(1/t.getPathCount())}export{u as a,a as c};
5
+ import{G as t,b as e}from"./Geometry.js";import{P as n,K as r}from"./Transformation2D.js";function a(e,r){if(!e.isEmpty()){switch(e.getGeometryType()){case t.enumPolygon:return o(e);case t.enumPolyline:return l(e);case t.enumLine:case t.enumBezier:case t.enumEllipticArc:return i(e);case t.enumMultiPoint:return g(e);case t.enumEnvelope:return e.getCenterXY();case t.enumPoint:return e.getXY();default:return n.construct(Number.NaN,Number.NaN)}}return n.construct(Number.NaN,Number.NaN)}function u(t,e){return o(t,e)}function o(t,e=-1){const a=new r(0),u=new r(0),o=t.getImpl();let l;const i=o.hasNonLinearSegments();let g;const m=o.getXY(0);if(-1===e){if(g=o.calculateArea2D(),0===g)return d(t);i&&(l=o.querySegmentIterator());for(let t=0,e=o.getPathCount();t<e;t++)s(m,o,t,a,u),i&&c(m,l,a,u)}else{if(g=o.calculateRingArea2D(e),0===g)return d(t,e);i&&(l=o.querySegmentIterator(),l.resetToPath(e)),s(m,o,e,a,u),i&&c(m,l,a,u)}const f=new n,h=new n;return f.setCoords(a.getResult(),u.getResult()),h.assign(f.mul(1/g).add(m)),h}function s(t,e,a,u,o){const s=e.getPathStart(a),c=e.getPathEnd(a);if(c-s<3)return;const l=e.getAttributeStreamRef(0),i=l.readPoint2D(2*s),g=l.readPoint2D(2*(s+1));g.subThis(i);const d=new r(0),m=e.hasNonLinearSegments(),f=1/3,h=new n;for(let n=s+2;n<c;n++){l.queryPoint2D(2*n,h),h.subThis(i);const t=.5*h.crossProduct(g);m&&d.add(t);const e=f*t;u.add((g.x+h.x)*e),o.add((g.y+h.y)*e),g.setCoordsPoint2D(h)}const P=m?d.getResult():e.calculateRingArea2D(a),y=i.sub(t).mul(P);u.add(y.x),o.add(y.y)}function c(t,n,r,a){let u;for(n.nextPath()||e("centroid");null!==(u=n.nextCurve());){const e=u.calculateWeightedAreaCentroid2D(t);r.add(e.x),a.add(e.y)}}function l(t){return m(t.getImpl())}function i(t){const e=t.calculateLength2D();if(0===e)return t.getStartXY();return t.calculateWeightedCentroid2D().mul(1/e)}function g(t){const e=new r(0),a=new r(0),u=t.getImpl(),o=u.getAttributeStreamRef(0),s=u.getPointCount(),c=new n;for(let n=0;n<s;n++)o.queryPoint2D(2*n,c),e.add(c.x),a.add(c.y);const l=new n;return l.setCoords(e.getResult(),a.getResult()),l.divThis(s)}function d(t,e=-1){return m(t.getImpl(),e)}function m(t,e=-1){const a=-1===e?t.calculateLength2D():t.calculatePathLength2D(e);if(0===a)return f(t,e);const u=new r(0),o=new r(0),s=t.querySegmentIterator();for(-1!==e&&s.resetToPath(e);s.nextPath();){const n=s.getPathIndex(),r=t.getXY(t.getPathStart(n));for(;s.hasNextSegment();){const t=s.nextSegment(),e=t.calculateLength2D();if(0===e)continue;const n=t.calculateWeightedCentroid2D().sub(r.mul(e));u.add(n.x),o.add(n.y)}const a=r.mul(t.calculatePathLength2D(n));if(u.add(a.x),o.add(a.y),-1!==e)break}const c=new n;return c.setCoords(u.getResult(),o.getResult()),c.mul(1/a)}function f(t,e=-1){if(-1!==e)return t.getXY(t.getPathStart(e));const a=new r(0),u=new r(0);for(let n=0;n<t.getPathCount();++n){const e=t.getXY(t.getPathStart(n));a.add(e.x),u.add(e.y)}return n.construct(a.getResult(),u.getResult()).mul(1/t.getPathCount())}export{u as a,a as c};
@@ -2,4 +2,4 @@
2
2
  All material copyright ESRI, All Rights Reserved, unless otherwise specified.
3
3
  See https://js.arcgis.com/4.32/esri/copyright.txt for details.
4
4
  */
5
- import{a as e,c as t,b as s,n as i,L as n,S as h}from"./QuadraticBezier.js";import{G as r,i as a,t as m,g as o,a as x}from"./Geometry.js";import{m as c,P as p,s as l,c as _}from"./Transformation2D.js";function g(e,t,s,i,n){return u(e,t,null,s,i,n)}function u(s,i,n,h,c,p){const l=s.getGeometryType();if(l===r.enumPoint){const e=s.getXY();return i.contains(e)?s:s.createInstance()}if(l===r.enumEnvelope){const t=e.constructEmpty();if(s.queryEnvelope(t),t.intersect(i)){const e=s.clone();return e.setEnvelope(t),e}return s.createInstance()}if(s.isEmpty())return s;if(i.isEmpty())return s.createInstance();const _=i.clone();{const t=new e;if(s.queryLooseEnvelope(t),_.containsEnvelope(t))return s;if(!_.isIntersecting(t))return s.createInstance();0===c&&(t.intersect(_),t.inflate(Math.max(.1*t.maxDimension(),1)),t.intersect(_),_.assign(t))}let u=h;if((null!==n||Number.isNaN(u))&&(u=t(n,_,!1).total()),l===r.enumGeometryCollection){const e=s,t=s.createInstance();for(let s=0,i=e.getGeometryCount();s<i;s++){const i=e.getGeometry(s);if(i.isEmpty())continue;const n=g(i,_,u,c,p);n.isEmpty()||(n===i?t.addGeometry(n.clone()):t.addGeometry(n))}return t}a(l)||m("Clip: geometry not supported");const y=s.getImpl().getAccelerators();if(null!==y){const e=y.getRasterizedGeometry();o(null===e)}switch(l){case r.enumMultiPoint:{const e=s;let t;const i=e.getPointCount(),n=e.getImpl().getAttributeStreamRef(0);let h=0;for(let s=0;s<i;s++){const i=n.readPoint2D(2*s);_.contains(i)||(0===h&&(t=e.createInstance()),h<s&&t.addPoints(e,h,s),h=s+1)}return h>0&&t.addPoints(e,h,i),0===h?e:(o(null!==t),t)}case r.enumPolygon:case r.enumPolyline:return f(s,_,u,c,p);default:x("")}}function y(t,s,i,n,h,r){const a=new v(s,r),m=new e;return t.queryLooseEnvelope(m),s.containsEnvelope(m)?t:s.isIntersecting(m)?a.clipPolesOut(t,h):t.createInstance()}function f(e,t,s,i,n){return new v(t,n).clipMultiPath2(e,s,i)}class v{constructor(t,n){this.m_shape=new s,this.m_geometry=i,this.m_verticesOnExtentIndex=-1,this.m_verticesOnExtent=[],this.m_progressCounter=0,this.m_extent=new e(t),this.m_progressTracker=n}progress_(){}clipMultiPath2(e,t,s){return e.getGeometryType()===r.enumPolygon?this.clipPolygonOrProjectedPolyline2(e,s):this.clipPolyline(e,t)}clipPolygonOrProjectedPolyline2(t,s){const h=t.getGeometryType()===r.enumPolyline;if(0===this.m_extent.width()||0===this.m_extent.height())return t.createInstance();const a=e.constructEmpty();t.queryLooseEnvelope(a),this.m_geometry=h?this.m_shape.addGeometry(t):this.m_shape.addGeometry(t,this.m_extent);const m=e.constructEmpty(),x=e.constructEmpty(),l=new p,_=new p,g=new Array(9),u=new Array(9),y=c(p,9);let f=null;const d=new n,P=[];let V=!1;for(let e=0;!V&&e<4;e++){let t=!1;const s=!!(1&e);let n=0;switch(e){case 0:n=this.m_extent.xmin,t=a.xmin<=n&&a.xmax>=n;break;case 1:n=this.m_extent.ymin,t=a.ymin<=n&&a.ymax>=n;break;case 2:n=this.m_extent.xmax,t=a.xmin<=n&&a.xmax>=n;break;case 3:n=this.m_extent.ymax,t=a.ymin<=n&&a.ymax>=n}if(t){V=!0;for(let t=this.m_shape.getFirstPath(this.m_geometry);t!==i;){let r=!0,a=-1,c=-1;const p=this.m_shape.getFirstVertex(t);let E=p;do{this.progress_(),f=this.m_shape.getSegment(E);let t=f;if(null===t){const e=this.m_shape.getNextVertex(E);if(e===i){o(h),0===a&&P.push(E);break}this.m_shape.queryXY(E,l),d.setStartXY(l),this.m_shape.queryXY(e,_),d.setEndXY(_),t=d}t.queryLooseEnvelope(m);let p=v.checkSegmentIntersection(m,e,n);t.isCurve()&&0===p&&t.isCurve()&&(d.setStartXY(t.getStartXY()),d.setEndXY(t.getEndXY()),this.m_shape.replaceCurveWithLine(E),t=d,d.queryEnvelope(m),p=v.checkSegmentIntersection(m,e,n));let I=0,X=i;if(-1===p){const i=t.intersectionWithAxis2D(s,n,g,u);if(i>0){let e=null;if(t.isCurve()){e=y,o(i<=9);for(let e=0;e<i;e++)s?y[e].setCoords(g[e],n):y[e].setCoords(n,g[e]);I=this.m_shape.splitSegmentAxisAware(E,u,i,e,s?1:0)}else I=this.m_shape.splitSegmentAxisAware(E,u,i,null,-1)}else I=0;I+=1;let h=E,m=this.m_shape.getNextVertex(h);t=null;for(let t=0;t<I;t++){this.m_shape.queryXY(h,l),this.m_shape.queryXY(m,_),f=this.m_shape.getSegment(h);let t=f;null===t&&(d.setStartXY(l),d.setEndXY(_),t=d),t.queryEnvelope(x);let i=v.checkSegmentIntersection(x,e,n);if(t.isCurve()&&0===i&&(this.m_shape.replaceCurveWithLine(h),d.setStartXY(l),d.setEndXY(_),t=d,t.queryEnvelope(x),i=v.checkSegmentIntersection(x,e,n)),-1===i){if(s){Math.abs(l.y-n)<Math.abs(_.y-n)?(l.y=n,this.m_shape.setXY(h,l)):(_.y=n,this.m_shape.setXY(m,_))}else{Math.abs(l.x-n)<Math.abs(_.x-n)?(l.x=n,this.m_shape.setXY(h,l)):(_.x=n,this.m_shape.setXY(m,_))}f=this.m_shape.getSegment(h),t=f,null===t&&(d.setStartXY(l),d.setEndXY(_),t=d),t.queryEnvelope(x),i=v.checkSegmentIntersection(x,e,n),-1===i&&(i=v.checkSegmentIntersectionLoose(x,e,n))}const o=a;a=i,-1===c&&(c=a),0===o&&1===a||1===o&&0===a||0===o&&0===a&&P.push(h),1===a&&(V=!1,r=!1),h=m,X=h,m=this.m_shape.getNextVertex(m)}}if(0===I){const e=a;a=p,-1===c&&(c=a),0===e&&a>=1||e>=1&&0===a||0===e&&0===a&&P.push(E),1===a&&(V=!1,r=!1),X=this.m_shape.getNextVertex(E)}if(E=X,P.length>=256){for(let e=1,t=P.length-1;e<t;e++){const t=P[e];h?this.m_shape.snapVertexForPoleClipping(t,n):this.m_shape.removeVertex(t,!1)}P[1]=P.at(-1),P.length=2}}while(E!==p);if(!r){0!==c||!h&&0!==a&&2!==a||P.push(p);for(let e=0,t=P.length;e<t;e++){const t=P[e];h?this.m_shape.snapVertexForPoleClipping(t,n):this.m_shape.removeVertex(t,!1)}}P.length=0,t=r||0===this.m_shape.getPathSize(t)?this.m_shape.removePath(t):this.m_shape.getNextPath(t)}}}if(V)return t.createInstance();f=null,h?this.removeSpikesAlongPoles():this.resolveBoundaryOverlaps(),s>0&&this.densifyAlongClipExtent(s);const E=this.m_shape.getGeometry(this.m_geometry);if(E.getGeometryType()===r.enumPolygon){E.setFillRule(t.getFillRule())}return E}clipPolyline(t,s){const i=e.constructEmpty(),n=e.constructEmpty(),r=new Array(9),a=new Array(9),m=new h;let o=t;const x=e.constructEmpty();t.queryLooseEnvelope(x);for(let e=0;e<4;e++){let s=!1;const h=!!(1&e);let c=0;switch(e){case 0:c=this.m_extent.xmin,s=x.xmin<=c&&x.xmax>=c;break;case 1:c=this.m_extent.ymin,s=x.ymin<=c&&x.ymax>=c;break;case 2:c=this.m_extent.xmax,s=x.xmin<=c&&x.xmax>=c;break;case 3:c=this.m_extent.ymax,s=x.ymin<=c&&x.ymax>=c}if(!s)continue;const l=o;o=t.createInstance();const _=l.getImpl().querySegmentIterator();_.resetToFirstPath();const g=new p,u=new p;for(;_.nextPath();){let t=-1,s=!0;for(;_.hasNextSegment();){this.progress_();const x=_.nextSegment(),p=x.isDegenerate(0);x.queryLooseEnvelope(i);const l=v.checkSegmentIntersection(i,e,c);if(-1===l){const i=x.intersectionWithAxis2D(h,c,r,a);let l=0;g.assign(x.getStartXY());for(let _=0;_<=i;_++){const y=_<i?a[_]:1;if(l===y)continue;x.queryCut(l,y,m,!1);const f=m.get();let d=!1;if(f.getStartXY().equals(g)||(f.setStartXY(g),d=!0),_<i&&(h?(u.x=r[_],u.y=c):(u.x=c,u.y=r[_]),f.getEndXY().equals(u)||(f.setEndXY(u),d=!0)),d&&f.normalizeAfterEndpointChange(),!p&&f.isDegenerate(0))continue;f.queryEnvelope(n);let P=v.checkSegmentIntersection(n,e,c);if(-1===P){const t=f.getStartXY(),s=f.getEndXY();if(d=!1,h){Math.abs(t.y-c)<Math.abs(s.y-c)?(t.y=c,f.setStartXY(t),t.equals(f.getStartXY())||(f.setStartXY(t),d=!0)):(s.y=c,s.equals(f.getEndXY())||(f.setEndXY(s),d=!0))}else{Math.abs(t.x-c)<Math.abs(s.x-c)?(t.x=c,t.equals(f.getStartXY())||(f.setStartXY(t),d=!0)):(s.x=c,s.equals(f.getEndXY())||(f.setEndXY(s),d=!0))}d&&f.normalizeAfterEndpointChange(),f.queryEnvelope(n),P=v.checkSegmentIntersection(n,e,c),-1===P&&(P=v.checkSegmentIntersectionLoose(n,e,c))}g.assign(f.getEndXY()),l=y,t=P,t>=1?(o.addSegment(f,s),s=!1):s=!0}}else t=l,t>=1?(o.addSegment(x,s),s=!1):s=!0}}}return o}static checkSegmentIntersection(e,t,s){switch(t){case 0:return e.xmin<s&&e.xmax<=s?0:e.xmin>=s?e.xmax===s?2:1:-1;case 1:return e.ymin<s&&e.ymax<=s?0:e.ymin>=s?e.ymax===s?2:1:-1;case 2:return e.xmin>=s&&e.xmax>s?0:e.xmax<=s?e.xmin===s?2:1:-1;case 3:return e.ymin>=s&&e.ymax>s?0:e.ymax<=s?e.ymin===s?2:1:-1}return x(""),0}static checkSegmentIntersectionLoose(e,t,s){switch(t){case 0:{const t=Math.abs(e.xmin-s),i=Math.abs(e.xmax-s);return e.xmin<s?t>i?0:1:(x(""),1)}case 1:{const t=Math.abs(e.ymin-s),i=Math.abs(e.ymax-s);return e.ymin<s?t>i?0:1:(x(""),1)}case 2:{const t=Math.abs(e.xmin-s),i=Math.abs(e.xmax-s);return e.xmax>s?t<i?0:1:(x(""),1)}case 3:{const t=Math.abs(e.ymin-s),i=Math.abs(e.ymax-s);return e.ymax>s?t<i?0:1:(x(""),1)}}return x(""),0}resolveBoundaryOverlaps(){this.m_verticesOnExtentIndex=-1,this.splitSegments(!1,this.m_extent.xmin),this.splitSegments(!1,this.m_extent.xmax),this.splitSegments(!0,this.m_extent.ymin),this.splitSegments(!0,this.m_extent.ymax),this.m_verticesOnExtent.length=0,this.m_verticesOnExtentIndex=this.m_shape.createUserIndex();const e=new p;for(let t=this.m_shape.getFirstPath(this.m_geometry);t!==i;t=this.m_shape.getNextPath(t)){let s=this.m_shape.getFirstVertex(t);for(let i=0,n=this.m_shape.getPathSize(t);i<n;i++,s=this.m_shape.getNextVertex(s))this.progress_(),this.m_shape.queryXY(s,e),this.m_extent.xmin!==e.x&&this.m_extent.xmax!==e.x&&this.m_extent.ymin!==e.y&&this.m_extent.ymax!==e.y||(this.m_shape.setUserIndex(s,this.m_verticesOnExtentIndex,this.m_verticesOnExtent.length),this.m_verticesOnExtent.push(s))}this.dbgCheckPathFirst(),this.resolveOverlaps(!1,this.m_extent.xmin),this.dbgCheckPathFirst(),this.resolveOverlaps(!1,this.m_extent.xmax),this.dbgCheckPathFirst(),this.resolveOverlaps(!0,this.m_extent.ymin),this.dbgCheckPathFirst(),this.resolveOverlaps(!0,this.m_extent.ymax),this.fixPaths()}densifyAlongClipExtent(e){const t=new p(0,0),s=new p(0,0),n=new Array(2048);for(let h=this.m_shape.getFirstPath(this.m_geometry);h!==i;h=this.m_shape.getNextPath(h)){const i=this.m_shape.getFirstVertex(h);let r=i;do{const i=this.m_shape.getNextVertex(r);this.m_shape.queryXY(r,t);let h=-1;if(t.x===this.m_extent.xmin?(this.m_shape.queryXY(i,s),s.x===this.m_extent.xmin&&(h=1)):t.x===this.m_extent.xmax&&(this.m_shape.queryXY(i,s),s.x===this.m_extent.xmax&&(h=1)),t.y===this.m_extent.ymin?(this.m_shape.queryXY(i,s),s.y===this.m_extent.ymin&&(h=0)):t.y===this.m_extent.ymax&&(this.m_shape.queryXY(i,s),s.y===this.m_extent.ymax&&(h=0)),-1===h){r=i;continue}if(this.isCurve(r)){r=i;continue}const a=t.clone(),m=new p(0,0);if(h){const i=t.y-this.m_extent.ymin;m.y=l(s.y-t.y),a.y=e*_(Math.floor(Math.abs(i)/e),i)+this.m_extent.ymin,m.y<0&&(a.y+=e)}else{const i=t.x-this.m_extent.xmin;m.x=l(s.x-t.x),a.x=e*_(Math.floor(Math.abs(i)/e),i)+this.m_extent.xmin,m.x<0&&(a.x+=e)}const c=h?s.y-t.y:s.x-t.x,g=Math.abs(c);if(g/e>65536&&x(""),g>0){const s=Math.trunc(g/e)+2;n.length<s&&(n.length=s);let i=0;for(let r=0;;r++){const s=a.add(m.mul(r*e)),x=(h?s.y-t.y:s.x-t.x)/c;if(x>=1)break;x<=0||(o(i<=n.length),n[i]=x,i++)}0!==i&&this.m_shape.splitSegment(r,n,i)}r=i}while(r!==i)}}splitSegments(e,t){let s=-1;const n=new p,h=[];for(let p=this.m_shape.getFirstPath(this.m_geometry);p!==i;p=this.m_shape.getNextPath(p)){let r=this.m_shape.getFirstVertex(p),a=i;for(let i=0,m=this.m_shape.getPathSize(p);i<m;i++,r=a)if(this.progress_(),a=this.m_shape.getNextVertex(r),this.m_shape.queryXY(r,n),(e?n.y===t:n.x===t)&&(this.m_shape.queryXY(a,n),e?n.y===t:n.x===t)){if(this.isCurve(r))continue;-1===s&&(s=this.m_shape.createUserIndex()),1!==this.m_shape.getUserIndex(r,s)&&(h.push(r),this.m_shape.setUserIndex(r,s,1)),1!==this.m_shape.getUserIndex(a,s)&&(h.push(a),this.m_shape.setUserIndex(a,s,1))}}if(-1!==s&&this.m_shape.removeUserIndex(s),h.length<3)return;h.sort(((e,t)=>this.compareVertices(e,t)));const r=new p,a=new p,m=new p;a.setNAN();let o=-1;let x=[],c=[];const l=this.m_shape.createUserIndex(),_=this.m_shape.createUserIndex();for(let i=0,g=h.length;i<g;i++){const s=h[i];if(this.m_shape.queryXY(s,n),!n.isEqualPoint2D(a)){if(-1===o){o=i,a.setCoordsPoint2D(n);continue}for(let n=o;n<i;n++){const s=h[n],i=this.m_shape.getNextVertex(s),m=this.m_shape.getPrevVertex(s);let o=!1;this.m_shape.queryXY(i,r),a.compare(r)<0&&(e?r.y===t:r.x===t)&&(this.isCurve(s)||(x.push(s),o=!0,this.m_shape.setUserIndex(s,_,1))),this.m_shape.queryXY(m,r),a.compare(r)<0&&(e?r.y===t:r.x===t)&&(this.isCurve(m)||(o||x.push(s),this.m_shape.setUserIndex(s,l,1)))}for(let e=0,t=x.length;e<t;e++){const t=x[e],s=this.m_shape.getUserIndex(t,l),i=this.m_shape.getUserIndex(t,_);if(1===s){const e=this.m_shape.getPrevVertex(t);this.m_shape.queryXY(e,m);let s=0;if(!m.isEqualPoint2D(n)){const i=p.distance(a,m);s=p.distance(m,n)/i,0===s?s=Number.EPSILON:1===s&&(s=1-Number.EPSILON),this.m_shape.splitSegment(e,[s],1);const h=this.m_shape.getPrevVertex(t);this.m_shape.setXY(h,n),c.push(h),this.m_shape.setUserIndex(h,l,1),this.m_shape.setUserIndex(h,_,-1)}}if(1===i){const e=this.m_shape.getNextVertex(t);this.m_shape.queryXY(e,m);let s=0;if(!m.isEqualPoint2D(n)){const e=p.distance(a,m);s=p.distance(a,n)/e,0===s?s=Number.EPSILON:1===s&&(s=1-Number.EPSILON),this.m_shape.splitSegment(t,[s],1);const i=this.m_shape.getNextVertex(t);this.m_shape.setXY(i,n),c.push(i),this.m_shape.setUserIndex(i,l,-1),this.m_shape.setUserIndex(i,_,1)}}}const s=x;x=c,c=s,c.length=0,o=i,a.setCoordsPoint2D(n)}}this.m_shape.removeUserIndex(l),this.m_shape.removeUserIndex(_)}resolveOverlaps(e,t){const s=new p,n=[];let h=-1;for(let o=0,x=this.m_verticesOnExtent.length;o<x;o++){this.progress_();const r=this.m_verticesOnExtent[o];if(r===i)continue;const a=this.m_shape.getNextVertex(r);if(this.m_shape.queryXY(r,s),(e?s.y===t:s.x===t)&&(this.m_shape.queryXY(a,s),e?s.y===t:s.x===t)){if(this.isCurve(r))continue;-1===h&&(h=this.m_shape.createUserIndex()),-2!==this.m_shape.getUserIndex(r,h)&&(n.push(r),this.m_shape.setUserIndex(r,h,-2)),-2!==this.m_shape.getUserIndex(a,h)&&(n.push(a),this.m_shape.setUserIndex(a,h,-2))}}if(0===n.length)return void(-1!==h&&this.m_shape.removeUserIndex(h));o(-1!==h),n.sort(((e,t)=>this.compareVertices(e,t)));for(let i=0,o=n.length;i<o;i++){const e=n[i];this.m_shape.setUserIndex(e,h,i)}const r=new p,a=new p;a.setNAN();let m=-1;for(let o=0,x=n.length;o<x;o++){this.progress_();const x=n[o];if(x!==i&&(this.m_shape.queryXY(x,s),!s.isEqualPoint2D(a))){if(-1!==m)for(;;){let s=!1;const x=o;for(let c=m;c<x;c++){const m=n[c];if(m===i)continue;let x=i;const p=this.m_shape.getNextVertex(m);this.m_shape.queryXY(p,r),a.compare(r)<0&&(e?r.y===t:r.x===t)&&(this.isCurve(m)||(x=p));let l=i;const _=this.m_shape.getPrevVertex(m);if(this.m_shape.queryXY(_,r),a.compare(r)<0&&(e?r.y===t:r.x===t)&&(this.isCurve(_)||(l=_)),x===i||l===i){if(x!==i||l!==i){for(let p=c+1;p<o;p++){const o=n[p];if(o===i)continue;const c=this.m_shape.getNextVertex(o);let _=i;this.m_shape.queryXY(c,r),a.compare(r)<0&&(e?r.y===t:r.x===t)&&(this.isCurve(o)||(_=c));const g=this.m_shape.getPrevVertex(o);let u=i;if(this.m_shape.queryXY(g,r),a.compare(r)<0&&(e?r.y===t:r.x===t)&&(this.isCurve(g)||(u=g)),_!==i&&u!==i){this.beforeRemoveVertex(o,n,h),this.m_shape.removeVertex(o,!1),this.beforeRemoveVertex(_,n,h),this.m_shape.removeVertex(_,!1),s=!0;break}if(x!==i&&u!==i){this.removeOverlap(n,m,x,o,u,h),s=!0;break}if(l!==i&&_!==i){this.removeOverlap(n,o,_,m,l,h),s=!0;break}}if(s)break}}else this.beforeRemoveVertex(m,n,h),this.m_shape.removeVertex(m,!1),this.beforeRemoveVertex(x,n,h),this.m_shape.removeVertex(x,!1),s=!0}if(!s)break}m=o,a.setCoordsPoint2D(s)}}this.m_shape.removeUserIndex(h)}beforeRemoveVertex(e,t,s){let n=this.m_shape.getUserIndex(e,s);o(n>=0),t[n]=i,n=this.m_shape.getUserIndex(e,this.m_verticesOnExtentIndex),o(n>=0),this.m_verticesOnExtent[n]=i;const h=this.m_shape.getPathFromVertex(e);if(h!==i){this.m_shape.getFirstVertex(h)===e&&(this.m_shape.setFirstVertex(h,i),this.m_shape.setLastVertex(h,i))}}removeOverlap(e,t,s,i,n,h){this.m_shape.setNextVertex(t,i),this.m_shape.setPrevVertex(i,t),this.m_shape.setPrevVertex(s,n),this.m_shape.setNextVertex(n,s),this.beforeRemoveVertex(i,e,h),this.m_shape.removeVertexInternal(i,!1),this.beforeRemoveVertex(n,e,h),this.m_shape.removeVertexInternal(n,!0)}removeSpikesAlongPoles(){this.removeSpikesOnPole(this.m_extent.ymin),this.removeSpikesOnPole(this.m_extent.ymax)}removeSpikesOnPole(e){for(let t=this.m_shape.getFirstPath(this.m_geometry);t!==i;t=this.m_shape.getNextPath(t)){const s=this.m_shape.getPathSize(t);if(s<3)continue;let i=this.m_shape.getFirstVertex(t);const n=new p;this.m_shape.queryXY(i,n);let h=n.y===e&&!this.isCurve(i);i=this.m_shape.getNextVertex(i);const r=new p;this.m_shape.queryXY(i,r);let a=r.y===e&&!this.isCurve(i);i=this.m_shape.getNextVertex(i);const m=new p;for(let t=0,o=s-2;t<o;t++,i=this.m_shape.getNextVertex(i)){this.progress_(),this.m_shape.queryXY(i,m);const t=m.y===e;if(a&&h&&t){if((r.x-n.x)*(m.x-r.x)<=0){this.m_shape.removeVertex(this.m_shape.getPrevVertex(i),!1),r.setCoordsPoint2D(m),a=t&&!this.isCurve(i);continue}}n.setCoordsPoint2D(r),h=a,r.setCoordsPoint2D(m),a=t&&!this.isCurve(i)}}}fixPaths(){for(let h=0,r=this.m_verticesOnExtent.length;h<r;h++){const e=this.m_verticesOnExtent[h];e!==i&&this.m_shape.setPathToVertex(e,i)}const e=this.m_shape.hasCurves();let t=0,s=0;for(let h=this.m_shape.getFirstPath(this.m_geometry);h!==i;){const e=this.m_shape.getFirstVertex(h);if(e===i||h!==this.m_shape.getPathFromVertex(e)){const e=h;h=this.m_shape.getNextPath(h),this.m_shape.setFirstVertex(e,i),this.m_shape.removePathOnly(e);continue}let n=e,r=0;do{this.m_shape.setPathToVertex(n,h),r++,n=this.m_shape.getNextVertex(n)}while(n!==e);this.m_shape.setRingAreaValid(h,!1),this.m_shape.setLastVertex(h,this.m_shape.getPrevVertex(e)),this.m_shape.setPathSize(h,r),s+=r,t++,h=this.m_shape.getNextPath(h)}for(let h=0,r=this.m_verticesOnExtent.length;h<r;h++){let n=this.m_verticesOnExtent[h];if(n===i)continue;let r=this.m_shape.getPathFromVertex(n);if(r!==i)continue;r=this.m_shape.insertPath(this.m_geometry,i);let a=!1,m=0;const x=n;do{this.m_shape.setPathToVertex(n,r),m++,e&&m<=2&&(a||=this.isCurve(n)),n=this.m_shape.getNextVertex(n)}while(n!==x);if(a?0===m:m<=2){let e=this.m_shape.getUserIndex(x,this.m_verticesOnExtentIndex);o(e>=0),this.m_verticesOnExtent[e]=i;const t=this.m_shape.removeVertex(x,!1);2===m&&(e=this.m_shape.getUserIndex(t,this.m_verticesOnExtentIndex),e>=0&&(this.m_verticesOnExtent[e]=i),this.m_shape.removeVertex(t,!1));const s=r;r=this.m_shape.getNextPath(r),this.m_shape.setFirstVertex(s,i),this.m_shape.removePathOnly(s)}else this.m_shape.setClosedPath(r,!0),this.m_shape.setPathSize(r,m),this.m_shape.setFirstVertex(r,x),this.m_shape.setLastVertex(r,this.m_shape.getPrevVertex(x)),this.m_shape.setRingAreaValid(r,!1),s+=m,t++}this.m_shape.setGeometryPathCount(this.m_geometry,t),this.m_shape.setGeometryVertexCount(this.m_geometry,s);let n=0;for(let h=this.m_shape.getFirstGeometry();h!==i;h=this.m_shape.getNextGeometry(h))n+=this.m_shape.getPointCount(h);this.m_shape.setTotalPointCount(n)}dbgCheckPathFirst(){}isCurve(e){return null!==this.m_shape.getSegment(e)}compareVertices(e,t){const s=new p;this.m_shape.queryXY(e,s);const i=new p;this.m_shape.queryXY(t,i);return s.compare(i)}clipPolesOut(e,t){return this.clipPolygonOrProjectedPolyline2(e,t)}}export{u as a,y as b,g as c};
5
+ import{a as e,b as t,d as s,n as i,L as n,S as h}from"./QuadraticBezier.js";import{G as r,i as a,t as m,g as o,b as x}from"./Geometry.js";import{m as p,P as c,s as l,c as _}from"./Transformation2D.js";function g(e,t,s,i,n){return u(e,t,null,s,i,n)}function u(s,i,n,h,p,c){const l=s.getGeometryType();if(l===r.enumPoint){const e=s.getXY();return i.contains(e)?s:s.createInstance()}if(l===r.enumEnvelope){const t=e.constructEmpty();if(s.queryEnvelope(t),t.intersect(i)){const e=s.clone();return e.setEnvelope(t),e}return s.createInstance()}if(s.isEmpty())return s;if(i.isEmpty())return s.createInstance();const _=i.clone();{const t=new e;if(s.queryLooseEnvelope(t),_.containsEnvelope(t))return s;if(!_.isIntersecting(t))return s.createInstance();0===p&&(t.intersect(_),t.inflate(Math.max(.1*t.maxDimension(),1)),t.intersect(_),_.assign(t))}let u=h;if((null!==n||Number.isNaN(u))&&(u=t(n,_,!1).total()),l===r.enumGeometryCollection){const e=s,t=s.createInstance();for(let s=0,i=e.getGeometryCount();s<i;s++){const i=e.getGeometry(s);if(i.isEmpty())continue;const n=g(i,_,u,p,c);n.isEmpty()||(n===i?t.addGeometry(n.clone()):t.addGeometry(n))}return t}a(l)||m("Clip: geometry not supported");const y=s.getImpl().getAccelerators();if(null!==y){const e=y.getRasterizedGeometry();o(null===e)}switch(l){case r.enumMultiPoint:{const e=s;let t;const i=e.getPointCount(),n=e.getImpl().getAttributeStreamRef(0);let h=0;for(let s=0;s<i;s++){const i=n.readPoint2D(2*s);_.contains(i)||(0===h&&(t=e.createInstance()),h<s&&t.addPoints(e,h,s),h=s+1)}return h>0&&t.addPoints(e,h,i),0===h?e:(o(null!==t),t)}case r.enumPolygon:case r.enumPolyline:return f(s,_,u,p,c);default:x("")}}function y(t,s,i,n,h,r){const a=new v(s,r),m=new e;return t.queryLooseEnvelope(m),s.containsEnvelope(m)?t:s.isIntersecting(m)?a.clipPolesOut(t,h):t.createInstance()}function f(e,t,s,i,n){return new v(t,n).clipMultiPath2(e,s,i)}class v{constructor(t,n){this.m_shape=new s,this.m_geometry=i,this.m_verticesOnExtentIndex=-1,this.m_verticesOnExtent=[],this.m_progressCounter=0,this.m_extent=new e(t),this.m_progressTracker=n}progress_(){}clipMultiPath2(e,t,s){return e.getGeometryType()===r.enumPolygon?this.clipPolygonOrProjectedPolyline2(e,s):this.clipPolyline(e,t)}clipPolygonOrProjectedPolyline2(t,s){const h=t.getGeometryType()===r.enumPolyline;if(0===this.m_extent.width()||0===this.m_extent.height())return t.createInstance();const a=e.constructEmpty();t.queryLooseEnvelope(a),this.m_geometry=h?this.m_shape.addGeometry(t):this.m_shape.addGeometry(t,this.m_extent);const m=e.constructEmpty(),x=e.constructEmpty(),l=new c,_=new c,g=new Array(9),u=new Array(9),y=p(c,9);let f=null;const d=new n,P=[];let V=!1;for(let e=0;!V&&e<4;e++){let t=!1;const s=!!(1&e);let n=0;switch(e){case 0:n=this.m_extent.xmin,t=a.xmin<=n&&a.xmax>=n;break;case 1:n=this.m_extent.ymin,t=a.ymin<=n&&a.ymax>=n;break;case 2:n=this.m_extent.xmax,t=a.xmin<=n&&a.xmax>=n;break;case 3:n=this.m_extent.ymax,t=a.ymin<=n&&a.ymax>=n}if(t){V=!0;for(let t=this.m_shape.getFirstPath(this.m_geometry);t!==i;){let r=!0,a=-1,p=-1;const c=this.m_shape.getFirstVertex(t);let E=c;do{this.progress_(),f=this.m_shape.getSegment(E);let t=f;if(null===t){const e=this.m_shape.getNextVertex(E);if(e===i){o(h),0===a&&P.push(E);break}this.m_shape.queryXY(E,l),d.setStartXY(l),this.m_shape.queryXY(e,_),d.setEndXY(_),t=d}t.queryLooseEnvelope(m);let c=v.checkSegmentIntersection(m,e,n);t.isCurve()&&0===c&&t.isCurve()&&(d.setStartXY(t.getStartXY()),d.setEndXY(t.getEndXY()),this.m_shape.replaceCurveWithLine(E),t=d,d.queryEnvelope(m),c=v.checkSegmentIntersection(m,e,n));let I=0,X=i;if(-1===c){const i=t.intersectionWithAxis2D(s,n,g,u);if(i>0){let e=null;if(t.isCurve()){e=y,o(i<=9);for(let e=0;e<i;e++)s?y[e].setCoords(g[e],n):y[e].setCoords(n,g[e]);I=this.m_shape.splitSegmentAxisAware(E,u,i,e,s?1:0)}else I=this.m_shape.splitSegmentAxisAware(E,u,i,null,-1)}else I=0;I+=1;let h=E,m=this.m_shape.getNextVertex(h);t=null;for(let t=0;t<I;t++){this.m_shape.queryXY(h,l),this.m_shape.queryXY(m,_),f=this.m_shape.getSegment(h);let t=f;null===t&&(d.setStartXY(l),d.setEndXY(_),t=d),t.queryEnvelope(x);let i=v.checkSegmentIntersection(x,e,n);if(t.isCurve()&&0===i&&(this.m_shape.replaceCurveWithLine(h),d.setStartXY(l),d.setEndXY(_),t=d,t.queryEnvelope(x),i=v.checkSegmentIntersection(x,e,n)),-1===i){if(s){Math.abs(l.y-n)<Math.abs(_.y-n)?(l.y=n,this.m_shape.setXY(h,l)):(_.y=n,this.m_shape.setXY(m,_))}else{Math.abs(l.x-n)<Math.abs(_.x-n)?(l.x=n,this.m_shape.setXY(h,l)):(_.x=n,this.m_shape.setXY(m,_))}f=this.m_shape.getSegment(h),t=f,null===t&&(d.setStartXY(l),d.setEndXY(_),t=d),t.queryEnvelope(x),i=v.checkSegmentIntersection(x,e,n),-1===i&&(i=v.checkSegmentIntersectionLoose(x,e,n))}const o=a;a=i,-1===p&&(p=a),0===o&&1===a||1===o&&0===a||0===o&&0===a&&P.push(h),1===a&&(V=!1,r=!1),h=m,X=h,m=this.m_shape.getNextVertex(m)}}if(0===I){const e=a;a=c,-1===p&&(p=a),0===e&&a>=1||e>=1&&0===a||0===e&&0===a&&P.push(E),1===a&&(V=!1,r=!1),X=this.m_shape.getNextVertex(E)}if(E=X,P.length>=256){for(let e=1,t=P.length-1;e<t;e++){const t=P[e];h?this.m_shape.snapVertexForPoleClipping(t,n):this.m_shape.removeVertex(t,!1)}P[1]=P.at(-1),P.length=2}}while(E!==c);if(!r){0!==p||!h&&0!==a&&2!==a||P.push(c);for(let e=0,t=P.length;e<t;e++){const t=P[e];h?this.m_shape.snapVertexForPoleClipping(t,n):this.m_shape.removeVertex(t,!1)}}P.length=0,t=r||0===this.m_shape.getPathSize(t)?this.m_shape.removePath(t):this.m_shape.getNextPath(t)}}}if(V)return t.createInstance();f=null,h?this.removeSpikesAlongPoles():this.resolveBoundaryOverlaps(),s>0&&this.densifyAlongClipExtent(s);const E=this.m_shape.getGeometry(this.m_geometry);if(E.getGeometryType()===r.enumPolygon){E.setFillRule(t.getFillRule())}return E}clipPolyline(t,s){const i=e.constructEmpty(),n=e.constructEmpty(),r=new Array(9),a=new Array(9),m=new h;let o=t;const x=e.constructEmpty();t.queryLooseEnvelope(x);for(let e=0;e<4;e++){let s=!1;const h=!!(1&e);let p=0;switch(e){case 0:p=this.m_extent.xmin,s=x.xmin<=p&&x.xmax>=p;break;case 1:p=this.m_extent.ymin,s=x.ymin<=p&&x.ymax>=p;break;case 2:p=this.m_extent.xmax,s=x.xmin<=p&&x.xmax>=p;break;case 3:p=this.m_extent.ymax,s=x.ymin<=p&&x.ymax>=p}if(!s)continue;const l=o;o=t.createInstance();const _=l.getImpl().querySegmentIterator();_.resetToFirstPath();const g=new c,u=new c;for(;_.nextPath();){let t=-1,s=!0;for(;_.hasNextSegment();){this.progress_();const x=_.nextSegment(),c=x.isDegenerate(0);x.queryLooseEnvelope(i);const l=v.checkSegmentIntersection(i,e,p);if(-1===l){const i=x.intersectionWithAxis2D(h,p,r,a);let l=0;g.assign(x.getStartXY());for(let _=0;_<=i;_++){const y=_<i?a[_]:1;if(l===y)continue;x.queryCut(l,y,m,!1);const f=m.get();let d=!1;if(f.getStartXY().equals(g)||(f.setStartXY(g),d=!0),_<i&&(h?(u.x=r[_],u.y=p):(u.x=p,u.y=r[_]),f.getEndXY().equals(u)||(f.setEndXY(u),d=!0)),d&&f.normalizeAfterEndpointChange(),!c&&f.isDegenerate(0))continue;f.queryEnvelope(n);let P=v.checkSegmentIntersection(n,e,p);if(-1===P){const t=f.getStartXY(),s=f.getEndXY();if(d=!1,h){Math.abs(t.y-p)<Math.abs(s.y-p)?(t.y=p,f.setStartXY(t),t.equals(f.getStartXY())||(f.setStartXY(t),d=!0)):(s.y=p,s.equals(f.getEndXY())||(f.setEndXY(s),d=!0))}else{Math.abs(t.x-p)<Math.abs(s.x-p)?(t.x=p,t.equals(f.getStartXY())||(f.setStartXY(t),d=!0)):(s.x=p,s.equals(f.getEndXY())||(f.setEndXY(s),d=!0))}d&&f.normalizeAfterEndpointChange(),f.queryEnvelope(n),P=v.checkSegmentIntersection(n,e,p),-1===P&&(P=v.checkSegmentIntersectionLoose(n,e,p))}g.assign(f.getEndXY()),l=y,t=P,t>=1?(o.addSegment(f,s),s=!1):s=!0}}else t=l,t>=1?(o.addSegment(x,s),s=!1):s=!0}}}return o}static checkSegmentIntersection(e,t,s){switch(t){case 0:return e.xmin<s&&e.xmax<=s?0:e.xmin>=s?e.xmax===s?2:1:-1;case 1:return e.ymin<s&&e.ymax<=s?0:e.ymin>=s?e.ymax===s?2:1:-1;case 2:return e.xmin>=s&&e.xmax>s?0:e.xmax<=s?e.xmin===s?2:1:-1;case 3:return e.ymin>=s&&e.ymax>s?0:e.ymax<=s?e.ymin===s?2:1:-1}return x(""),0}static checkSegmentIntersectionLoose(e,t,s){switch(t){case 0:{const t=Math.abs(e.xmin-s),i=Math.abs(e.xmax-s);return e.xmin<s?t>i?0:1:(x(""),1)}case 1:{const t=Math.abs(e.ymin-s),i=Math.abs(e.ymax-s);return e.ymin<s?t>i?0:1:(x(""),1)}case 2:{const t=Math.abs(e.xmin-s),i=Math.abs(e.xmax-s);return e.xmax>s?t<i?0:1:(x(""),1)}case 3:{const t=Math.abs(e.ymin-s),i=Math.abs(e.ymax-s);return e.ymax>s?t<i?0:1:(x(""),1)}}return x(""),0}resolveBoundaryOverlaps(){this.m_verticesOnExtentIndex=-1,this.splitSegments(!1,this.m_extent.xmin),this.splitSegments(!1,this.m_extent.xmax),this.splitSegments(!0,this.m_extent.ymin),this.splitSegments(!0,this.m_extent.ymax),this.m_verticesOnExtent.length=0,this.m_verticesOnExtentIndex=this.m_shape.createUserIndex();const e=new c;for(let t=this.m_shape.getFirstPath(this.m_geometry);t!==i;t=this.m_shape.getNextPath(t)){let s=this.m_shape.getFirstVertex(t);for(let i=0,n=this.m_shape.getPathSize(t);i<n;i++,s=this.m_shape.getNextVertex(s))this.progress_(),this.m_shape.queryXY(s,e),this.m_extent.xmin!==e.x&&this.m_extent.xmax!==e.x&&this.m_extent.ymin!==e.y&&this.m_extent.ymax!==e.y||(this.m_shape.setUserIndex(s,this.m_verticesOnExtentIndex,this.m_verticesOnExtent.length),this.m_verticesOnExtent.push(s))}this.dbgCheckPathFirst(),this.resolveOverlaps(!1,this.m_extent.xmin),this.dbgCheckPathFirst(),this.resolveOverlaps(!1,this.m_extent.xmax),this.dbgCheckPathFirst(),this.resolveOverlaps(!0,this.m_extent.ymin),this.dbgCheckPathFirst(),this.resolveOverlaps(!0,this.m_extent.ymax),this.fixPaths()}densifyAlongClipExtent(e){const t=new c(0,0),s=new c(0,0),n=new Array(2048);for(let h=this.m_shape.getFirstPath(this.m_geometry);h!==i;h=this.m_shape.getNextPath(h)){const i=this.m_shape.getFirstVertex(h);let r=i;do{const i=this.m_shape.getNextVertex(r);this.m_shape.queryXY(r,t);let h=-1;if(t.x===this.m_extent.xmin?(this.m_shape.queryXY(i,s),s.x===this.m_extent.xmin&&(h=1)):t.x===this.m_extent.xmax&&(this.m_shape.queryXY(i,s),s.x===this.m_extent.xmax&&(h=1)),t.y===this.m_extent.ymin?(this.m_shape.queryXY(i,s),s.y===this.m_extent.ymin&&(h=0)):t.y===this.m_extent.ymax&&(this.m_shape.queryXY(i,s),s.y===this.m_extent.ymax&&(h=0)),-1===h){r=i;continue}if(this.isCurve(r)){r=i;continue}const a=t.clone(),m=new c(0,0);if(h){const i=t.y-this.m_extent.ymin;m.y=l(s.y-t.y),a.y=e*_(Math.floor(Math.abs(i)/e),i)+this.m_extent.ymin,m.y<0&&(a.y+=e)}else{const i=t.x-this.m_extent.xmin;m.x=l(s.x-t.x),a.x=e*_(Math.floor(Math.abs(i)/e),i)+this.m_extent.xmin,m.x<0&&(a.x+=e)}const p=h?s.y-t.y:s.x-t.x,g=Math.abs(p);if(g/e>65536&&x(""),g>0){const s=Math.trunc(g/e)+2;n.length<s&&(n.length=s);let i=0;for(let r=0;;r++){const s=a.add(m.mul(r*e)),x=(h?s.y-t.y:s.x-t.x)/p;if(x>=1)break;x<=0||(o(i<=n.length),n[i]=x,i++)}0!==i&&this.m_shape.splitSegment(r,n,i)}r=i}while(r!==i)}}splitSegments(e,t){let s=-1;const n=new c,h=[];for(let c=this.m_shape.getFirstPath(this.m_geometry);c!==i;c=this.m_shape.getNextPath(c)){let r=this.m_shape.getFirstVertex(c),a=i;for(let i=0,m=this.m_shape.getPathSize(c);i<m;i++,r=a)if(this.progress_(),a=this.m_shape.getNextVertex(r),this.m_shape.queryXY(r,n),(e?n.y===t:n.x===t)&&(this.m_shape.queryXY(a,n),e?n.y===t:n.x===t)){if(this.isCurve(r))continue;-1===s&&(s=this.m_shape.createUserIndex()),1!==this.m_shape.getUserIndex(r,s)&&(h.push(r),this.m_shape.setUserIndex(r,s,1)),1!==this.m_shape.getUserIndex(a,s)&&(h.push(a),this.m_shape.setUserIndex(a,s,1))}}if(-1!==s&&this.m_shape.removeUserIndex(s),h.length<3)return;h.sort(((e,t)=>this.compareVertices(e,t)));const r=new c,a=new c,m=new c;a.setNAN();let o=-1;let x=[],p=[];const l=this.m_shape.createUserIndex(),_=this.m_shape.createUserIndex();for(let i=0,g=h.length;i<g;i++){const s=h[i];if(this.m_shape.queryXY(s,n),!n.isEqualPoint2D(a)){if(-1===o){o=i,a.setCoordsPoint2D(n);continue}for(let n=o;n<i;n++){const s=h[n],i=this.m_shape.getNextVertex(s),m=this.m_shape.getPrevVertex(s);let o=!1;this.m_shape.queryXY(i,r),a.compare(r)<0&&(e?r.y===t:r.x===t)&&(this.isCurve(s)||(x.push(s),o=!0,this.m_shape.setUserIndex(s,_,1))),this.m_shape.queryXY(m,r),a.compare(r)<0&&(e?r.y===t:r.x===t)&&(this.isCurve(m)||(o||x.push(s),this.m_shape.setUserIndex(s,l,1)))}for(let e=0,t=x.length;e<t;e++){const t=x[e],s=this.m_shape.getUserIndex(t,l),i=this.m_shape.getUserIndex(t,_);if(1===s){const e=this.m_shape.getPrevVertex(t);this.m_shape.queryXY(e,m);let s=0;if(!m.isEqualPoint2D(n)){const i=c.distance(a,m);s=c.distance(m,n)/i,0===s?s=Number.EPSILON:1===s&&(s=1-Number.EPSILON),this.m_shape.splitSegment(e,[s],1);const h=this.m_shape.getPrevVertex(t);this.m_shape.setXY(h,n),p.push(h),this.m_shape.setUserIndex(h,l,1),this.m_shape.setUserIndex(h,_,-1)}}if(1===i){const e=this.m_shape.getNextVertex(t);this.m_shape.queryXY(e,m);let s=0;if(!m.isEqualPoint2D(n)){const e=c.distance(a,m);s=c.distance(a,n)/e,0===s?s=Number.EPSILON:1===s&&(s=1-Number.EPSILON),this.m_shape.splitSegment(t,[s],1);const i=this.m_shape.getNextVertex(t);this.m_shape.setXY(i,n),p.push(i),this.m_shape.setUserIndex(i,l,-1),this.m_shape.setUserIndex(i,_,1)}}}const s=x;x=p,p=s,p.length=0,o=i,a.setCoordsPoint2D(n)}}this.m_shape.removeUserIndex(l),this.m_shape.removeUserIndex(_)}resolveOverlaps(e,t){const s=new c,n=[];let h=-1;for(let o=0,x=this.m_verticesOnExtent.length;o<x;o++){this.progress_();const r=this.m_verticesOnExtent[o];if(r===i)continue;const a=this.m_shape.getNextVertex(r);if(this.m_shape.queryXY(r,s),(e?s.y===t:s.x===t)&&(this.m_shape.queryXY(a,s),e?s.y===t:s.x===t)){if(this.isCurve(r))continue;-1===h&&(h=this.m_shape.createUserIndex()),-2!==this.m_shape.getUserIndex(r,h)&&(n.push(r),this.m_shape.setUserIndex(r,h,-2)),-2!==this.m_shape.getUserIndex(a,h)&&(n.push(a),this.m_shape.setUserIndex(a,h,-2))}}if(0===n.length)return void(-1!==h&&this.m_shape.removeUserIndex(h));o(-1!==h),n.sort(((e,t)=>this.compareVertices(e,t)));for(let i=0,o=n.length;i<o;i++){const e=n[i];this.m_shape.setUserIndex(e,h,i)}const r=new c,a=new c;a.setNAN();let m=-1;for(let o=0,x=n.length;o<x;o++){this.progress_();const x=n[o];if(x!==i&&(this.m_shape.queryXY(x,s),!s.isEqualPoint2D(a))){if(-1!==m)for(;;){let s=!1;const x=o;for(let p=m;p<x;p++){const m=n[p];if(m===i)continue;let x=i;const c=this.m_shape.getNextVertex(m);this.m_shape.queryXY(c,r),a.compare(r)<0&&(e?r.y===t:r.x===t)&&(this.isCurve(m)||(x=c));let l=i;const _=this.m_shape.getPrevVertex(m);if(this.m_shape.queryXY(_,r),a.compare(r)<0&&(e?r.y===t:r.x===t)&&(this.isCurve(_)||(l=_)),x===i||l===i){if(x!==i||l!==i){for(let c=p+1;c<o;c++){const o=n[c];if(o===i)continue;const p=this.m_shape.getNextVertex(o);let _=i;this.m_shape.queryXY(p,r),a.compare(r)<0&&(e?r.y===t:r.x===t)&&(this.isCurve(o)||(_=p));const g=this.m_shape.getPrevVertex(o);let u=i;if(this.m_shape.queryXY(g,r),a.compare(r)<0&&(e?r.y===t:r.x===t)&&(this.isCurve(g)||(u=g)),_!==i&&u!==i){this.beforeRemoveVertex(o,n,h),this.m_shape.removeVertex(o,!1),this.beforeRemoveVertex(_,n,h),this.m_shape.removeVertex(_,!1),s=!0;break}if(x!==i&&u!==i){this.removeOverlap(n,m,x,o,u,h),s=!0;break}if(l!==i&&_!==i){this.removeOverlap(n,o,_,m,l,h),s=!0;break}}if(s)break}}else this.beforeRemoveVertex(m,n,h),this.m_shape.removeVertex(m,!1),this.beforeRemoveVertex(x,n,h),this.m_shape.removeVertex(x,!1),s=!0}if(!s)break}m=o,a.setCoordsPoint2D(s)}}this.m_shape.removeUserIndex(h)}beforeRemoveVertex(e,t,s){let n=this.m_shape.getUserIndex(e,s);o(n>=0),t[n]=i,n=this.m_shape.getUserIndex(e,this.m_verticesOnExtentIndex),o(n>=0),this.m_verticesOnExtent[n]=i;const h=this.m_shape.getPathFromVertex(e);if(h!==i){this.m_shape.getFirstVertex(h)===e&&(this.m_shape.setFirstVertex(h,i),this.m_shape.setLastVertex(h,i))}}removeOverlap(e,t,s,i,n,h){this.m_shape.setNextVertex(t,i),this.m_shape.setPrevVertex(i,t),this.m_shape.setPrevVertex(s,n),this.m_shape.setNextVertex(n,s),this.beforeRemoveVertex(i,e,h),this.m_shape.removeVertexInternal(i,!1),this.beforeRemoveVertex(n,e,h),this.m_shape.removeVertexInternal(n,!0)}removeSpikesAlongPoles(){this.removeSpikesOnPole(this.m_extent.ymin),this.removeSpikesOnPole(this.m_extent.ymax)}removeSpikesOnPole(e){for(let t=this.m_shape.getFirstPath(this.m_geometry);t!==i;t=this.m_shape.getNextPath(t)){const s=this.m_shape.getPathSize(t);if(s<3)continue;let i=this.m_shape.getFirstVertex(t);const n=new c;this.m_shape.queryXY(i,n);let h=n.y===e&&!this.isCurve(i);i=this.m_shape.getNextVertex(i);const r=new c;this.m_shape.queryXY(i,r);let a=r.y===e&&!this.isCurve(i);i=this.m_shape.getNextVertex(i);const m=new c;for(let t=0,o=s-2;t<o;t++,i=this.m_shape.getNextVertex(i)){this.progress_(),this.m_shape.queryXY(i,m);const t=m.y===e;if(a&&h&&t){if((r.x-n.x)*(m.x-r.x)<=0){this.m_shape.removeVertex(this.m_shape.getPrevVertex(i),!1),r.setCoordsPoint2D(m),a=t&&!this.isCurve(i);continue}}n.setCoordsPoint2D(r),h=a,r.setCoordsPoint2D(m),a=t&&!this.isCurve(i)}}}fixPaths(){for(let h=0,r=this.m_verticesOnExtent.length;h<r;h++){const e=this.m_verticesOnExtent[h];e!==i&&this.m_shape.setPathToVertex(e,i)}const e=this.m_shape.hasCurves();let t=0,s=0;for(let h=this.m_shape.getFirstPath(this.m_geometry);h!==i;){const e=this.m_shape.getFirstVertex(h);if(e===i||h!==this.m_shape.getPathFromVertex(e)){const e=h;h=this.m_shape.getNextPath(h),this.m_shape.setFirstVertex(e,i),this.m_shape.removePathOnly(e);continue}let n=e,r=0;do{this.m_shape.setPathToVertex(n,h),r++,n=this.m_shape.getNextVertex(n)}while(n!==e);this.m_shape.setRingAreaValid(h,!1),this.m_shape.setLastVertex(h,this.m_shape.getPrevVertex(e)),this.m_shape.setPathSize(h,r),s+=r,t++,h=this.m_shape.getNextPath(h)}for(let h=0,r=this.m_verticesOnExtent.length;h<r;h++){let n=this.m_verticesOnExtent[h];if(n===i)continue;let r=this.m_shape.getPathFromVertex(n);if(r!==i)continue;r=this.m_shape.insertPath(this.m_geometry,i);let a=!1,m=0;const x=n;do{this.m_shape.setPathToVertex(n,r),m++,e&&m<=2&&(a||=this.isCurve(n)),n=this.m_shape.getNextVertex(n)}while(n!==x);if(a?0===m:m<=2){let e=this.m_shape.getUserIndex(x,this.m_verticesOnExtentIndex);o(e>=0),this.m_verticesOnExtent[e]=i;const t=this.m_shape.removeVertex(x,!1);2===m&&(e=this.m_shape.getUserIndex(t,this.m_verticesOnExtentIndex),e>=0&&(this.m_verticesOnExtent[e]=i),this.m_shape.removeVertex(t,!1));const s=r;r=this.m_shape.getNextPath(r),this.m_shape.setFirstVertex(s,i),this.m_shape.removePathOnly(s)}else this.m_shape.setClosedPath(r,!0),this.m_shape.setPathSize(r,m),this.m_shape.setFirstVertex(r,x),this.m_shape.setLastVertex(r,this.m_shape.getPrevVertex(x)),this.m_shape.setRingAreaValid(r,!1),s+=m,t++}this.m_shape.setGeometryPathCount(this.m_geometry,t),this.m_shape.setGeometryVertexCount(this.m_geometry,s);let n=0;for(let h=this.m_shape.getFirstGeometry();h!==i;h=this.m_shape.getNextGeometry(h))n+=this.m_shape.getPointCount(h);this.m_shape.setTotalPointCount(n)}dbgCheckPathFirst(){}isCurve(e){return null!==this.m_shape.getSegment(e)}compareVertices(e,t){const s=new c;this.m_shape.queryXY(e,s);const i=new c;this.m_shape.queryXY(t,i);return s.compare(i)}clipPolesOut(e,t){return this.clipPolygonOrProjectedPolyline2(e,t)}}export{u as a,y as b,g as c};