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

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (229) hide show
  1. package/Basemap.js +1 -1
  2. package/LICENSE.md +19 -0
  3. package/README.md +2 -18
  4. package/applications/KnowledgeStudio/reshape.d.ts +5 -0
  5. package/applications/KnowledgeStudio/reshape.js +5 -0
  6. package/assets/esri/core/workers/RemoteClient.js +1 -1
  7. package/assets/esri/core/workers/chunks/{26975e5b3fb7f2ed45a4.js → 03fe4164abd12abc7921.js} +1 -1
  8. package/assets/esri/core/workers/chunks/{893e5eb5c028c4704317.js → 0427f66b56ec6601deb0.js} +1 -1
  9. package/assets/esri/core/workers/chunks/0cb2f7172190babb4139.js +1 -0
  10. package/assets/esri/core/workers/chunks/0e28cb5d8d89ae29cdd0.js +1 -0
  11. package/assets/esri/core/workers/chunks/{1776ef96c9f4636f8838.js → 138c11b5eca621e51396.js} +1 -1
  12. package/assets/esri/core/workers/chunks/{57c438bb0da6410df525.js → 1bf17c6548ac4cd5a166.js} +1 -1
  13. package/assets/esri/core/workers/chunks/{043bb97e38e3a54aa2ab.js → 1ed7a8f4a0058d3b69ef.js} +1 -1
  14. package/assets/esri/core/workers/chunks/{827bebb4bcdde23adc91.js → 251b7f2e295ce191eb62.js} +1 -1
  15. package/assets/esri/core/workers/chunks/{02a31483e09652a1a1a2.js → 2b7f9a57a2cfbc108673.js} +1 -1
  16. package/assets/esri/core/workers/chunks/{7c86af4f60cea383ed96.js → 39a1f361bb69073af765.js} +1 -1
  17. package/assets/esri/core/workers/chunks/{327b0da744426ce40e60.js → 3a7ac10a6614fe5745f7.js} +1 -1
  18. package/assets/esri/core/workers/chunks/{8c79945909069733558f.js → 4094cebc4b92c52f4e27.js} +1 -1
  19. package/assets/esri/core/workers/chunks/{82de1b50ae286f1e6c44.js → 451761c7bd2da530e1d0.js} +1 -1
  20. package/assets/esri/core/workers/chunks/{cc748d4f4adb9c584aa4.js → 45aeff2f751f124f8e53.js} +1 -1
  21. package/assets/esri/core/workers/chunks/{d20af70b23f175fb5442.js → 48b9ba825856a0c843ff.js} +1 -1
  22. package/assets/esri/core/workers/chunks/4dee2f05508e90410f13.js +1 -0
  23. package/assets/esri/core/workers/chunks/{d630fc3acd2552c98dc0.js → 547af4ffbeeccba9d187.js} +1 -1
  24. package/assets/esri/core/workers/chunks/{ff14b632f147cb68ed59.js → 58422c616a824ab49218.js} +1 -1
  25. package/assets/esri/core/workers/chunks/589a0e244ef5f1b84ab6.js +1 -0
  26. package/assets/esri/core/workers/chunks/{2c7e7895c4dda176220e.js → 5d4b24c864ebb68ae61e.js} +1 -1
  27. package/assets/esri/core/workers/chunks/{a1ff4c252012d5026133.js → 65eb183b5d001dfc42c8.js} +1 -1
  28. package/assets/esri/core/workers/chunks/{f1b6d6ee03635d985c3e.js → 6688efc71d9d8f4d2559.js} +1 -1
  29. package/assets/esri/core/workers/chunks/{d5faf3ddf9a39de826be.js → 672c04d48aa51f16e9b7.js} +1 -1
  30. package/assets/esri/core/workers/chunks/{17e203e4680c07bd02f1.js → 7aa7aff6d42be7c2d1d2.js} +1 -1
  31. package/assets/esri/core/workers/chunks/{549e073fe276363a9896.js → 7db105f6b688b6da8106.js} +1 -1
  32. package/assets/esri/core/workers/chunks/{945c5a477940ebd23a4c.js → 7f0c78bcba0aed3c4eff.js} +1 -1
  33. package/assets/esri/core/workers/chunks/{3eb792863a789b97ec58.js → 831a69e5a87e92830fbe.js} +1 -1
  34. package/assets/esri/core/workers/chunks/83dfaa6e3bd58d544f35.js +1 -0
  35. package/assets/esri/core/workers/chunks/8bbae8ac586e5c0819d2.js +1 -0
  36. package/assets/esri/core/workers/chunks/{9275313e0f1f521b2658.js → 9325000c87295c473291.js} +1 -1
  37. package/assets/esri/core/workers/chunks/{944d1608f935516951c4.js → 94b9948ec628187c19fc.js} +1 -1
  38. package/assets/esri/core/workers/chunks/{757717416d909059df2f.js → 981275b6f008431c983a.js} +1 -1
  39. package/assets/esri/core/workers/chunks/{c71dac67f95d694bf67e.js → 9f4e23bae621ff3ecea3.js} +1 -1
  40. package/assets/esri/core/workers/chunks/{989251f5e0d6a08b1afa.js → a17ed7ce97e69466d730.js} +1 -1
  41. package/assets/esri/core/workers/chunks/{319fe6a02ec630a827ea.js → a7ea2e3895046e566bc6.js} +1 -1
  42. package/assets/esri/core/workers/chunks/{5cfec58c7c31e6d8c6ea.js → abe60d92e0219ee97036.js} +1 -1
  43. package/assets/esri/core/workers/chunks/{4193691ca076948f4f90.js → b53008c1461dd6bacc63.js} +1 -1
  44. package/assets/esri/core/workers/chunks/{1d234c057a6671acc59f.js → b605dfdfed8ff8eda4f3.js} +1 -1
  45. package/assets/esri/core/workers/chunks/{0fb2dcbd54175e75d94d.js → b68b54be3d67595a9446.js} +4 -6
  46. package/assets/esri/core/workers/chunks/{7eda1c400658b6a99be8.js → ba0c7339fa19cc7cbde7.js} +1 -1
  47. package/assets/esri/core/workers/chunks/{724de82d101eb59c2834.js → bd451668c4ce9f7d7128.js} +1 -1
  48. package/assets/esri/core/workers/chunks/{91ede8c62a7b1e8b8023.js → be06c8a58c217a17451b.js} +1 -1
  49. package/assets/esri/core/workers/chunks/{08c0c016787caa169492.js → c24214666d10cb648428.js} +1 -1
  50. package/assets/esri/core/workers/chunks/{a3a23a56df4e5ee86bb2.js → c5fe356fc5b8b7be0d31.js} +1 -1
  51. package/assets/esri/core/workers/chunks/{64fab4e1e28c06c83403.js → c779c8b98e07fa881c1d.js} +1 -1
  52. package/assets/esri/core/workers/chunks/{4a0257c449f31bdadf26.js → cef9ff811221a7c3812c.js} +1 -1
  53. package/assets/esri/core/workers/chunks/{b1982490762972ae023d.js → d0296368ae143de4d5ce.js} +1 -1
  54. package/assets/esri/core/workers/chunks/{3d5954478864a975e65e.js → d07d3b0e06f12aee4a8b.js} +1 -1
  55. package/assets/esri/core/workers/chunks/{e1472dbf0795d737d6f8.js → d2371f5034b2a32e2523.js} +1 -1
  56. package/assets/esri/core/workers/chunks/{2f65081bfedeab44d6cb.js → d35cadfb78ac9803069b.js} +1 -1
  57. package/assets/esri/core/workers/chunks/d7ce68667bb355ef8e5d.js +1 -0
  58. package/assets/esri/core/workers/chunks/{8c2fcfcfbb6b70f7bada.js → d823277612f971a9c2f0.js} +1 -1
  59. package/assets/esri/core/workers/chunks/{c4ff5c78fc8668af9c05.js → d91b80aa4f847c2e2a33.js} +1 -1
  60. package/assets/esri/core/workers/chunks/{c4ceb267d4004d8da8cc.js → e0bbfbe1ed39c82f1bd4.js} +1 -1
  61. package/assets/esri/core/workers/chunks/e58c5c8639aa837c84d1.js +1 -0
  62. package/assets/esri/core/workers/chunks/{a24762e976c1459b12de.js → e689a4849f5af3f2f641.js} +1 -1
  63. package/assets/esri/core/workers/chunks/{5787101b2b814c5d2439.js → eacc7fccdc3fb670ac8f.js} +1 -1
  64. package/assets/esri/core/workers/chunks/{0df1f56df6d47dfbb6ea.js → eada3483116a5ea8baed.js} +1 -1
  65. package/assets/esri/core/workers/chunks/{47682247910271077333.js → ee78a38a0cacb19b2fd4.js} +1 -1
  66. package/assets/esri/core/workers/chunks/{f4061587ff5789fa4e1f.js → f594df2f5ce6ca41a254.js} +1 -1
  67. package/assets/esri/core/workers/chunks/{d7b3e81cc313fd0a33b0.js → f5c821ca2911a5103c9a.js} +1 -1
  68. package/assets/esri/core/workers/chunks/f711aeba1a2c184ddb43.js +1 -0
  69. package/assets/esri/core/workers/chunks/fdae43a97537093e4b97.js +1 -0
  70. package/chunks/BloomComposition.glsl.js +36 -18
  71. package/chunks/ComponentShader.glsl.js +1 -1
  72. package/chunks/CompositeGeographicTransformation.js +1 -1
  73. package/chunks/DefaultMaterial.glsl.js +1 -1
  74. package/chunks/GeodeticDistanceCalculator-Ce-woMPw.js +1 -1
  75. package/chunks/GeographicTransformation.js +1 -1
  76. package/chunks/MultiPathImpl.js +1 -1
  77. package/chunks/OperatorGeodesicBuffer.js +1 -1
  78. package/chunks/OperatorGeodeticArea.js +1 -1
  79. package/chunks/OperatorGeodeticDensifyByLength.js +1 -1
  80. package/chunks/OperatorGeodeticLength.js +1 -1
  81. package/chunks/OperatorProximityGeodesic.js +1 -1
  82. package/chunks/OperatorShapePreservingLength.js +1 -1
  83. package/chunks/OperatorShapePreservingProject.js +1 -1
  84. package/chunks/Path.glsl.js +1 -1
  85. package/chunks/Point2D.js +1 -1
  86. package/chunks/ProjectionTransformation.js +1 -1
  87. package/chunks/RealisticTree.glsl.js +1 -1
  88. package/chunks/SpatialReference.js +1 -1
  89. package/chunks/UnitFactory.js +1 -1
  90. package/chunks/sphere.js +1 -1
  91. package/chunks/vec42.js +1 -1
  92. package/config.js +1 -1
  93. package/copyright.txt +2 -20
  94. package/core/accessorSupport/layerContainerType.js +1 -1
  95. package/core/libs/gl-matrix-2/math/quat.js +1 -1
  96. package/core/libs/gl-matrix-2/math/vec4.js +1 -1
  97. package/core/quantityFormatUtils.js +1 -1
  98. package/core/unitFormatUtils.js +1 -1
  99. package/editing/geometry/coordUtils.js +5 -0
  100. package/editing/geometry/lineUtils.js +5 -0
  101. package/editing/sharedTemplates/executor/builders/equallySpaced.js +1 -1
  102. package/editing/sharedTemplates/executor/builders/pointAtIntersectionVerticesOfLine.js +1 -1
  103. package/editing/sharedTemplates/executor/builders/support/builderUtils.js +1 -1
  104. package/editing/sharedTemplates/executor/builders/support/offsetUtils.js +1 -1
  105. package/editing/sharedTemplates/executor/builders/support/shapeUtils.js +1 -1
  106. package/geometry/coordinateFormatter.js +1 -1
  107. package/geometry/operators/gx/operatorAlphaShape.js +1 -1
  108. package/geometry/operators/gx/operatorIntegrate.js +1 -1
  109. package/geometry/operators/gx/operatorOffset.js +1 -1
  110. package/geometry/operators/gx/operatorPolygonSlicer.js +1 -1
  111. package/geometry/operators/support/apiConverter.js +1 -1
  112. package/geometry/operators/support/initNoPeFactory.js +1 -1
  113. package/geometry/operators/support/jsonConverter.js +1 -1
  114. package/geometry/support/sphere.js +1 -1
  115. package/graphic/KnowledgeGraphGraphicOrigin.js +1 -1
  116. package/graphic/LinkChartGraphicOrigin.js +5 -0
  117. package/graphic/isLinkChartGraphicOrigin.js +5 -0
  118. package/interfaces.d.ts +129 -10
  119. package/kernel.js +1 -1
  120. package/layers/FeatureLayer.js +1 -1
  121. package/layers/GroundLayer.js +1 -1
  122. package/layers/ParquetLayer.js +1 -1
  123. package/layers/catalog/catalogUtils.js +1 -1
  124. package/layers/knowledgeGraph/KnowledgeGraphSublayer.js +1 -1
  125. package/layers/knowledgeGraph/nodeMovementUtils.js +5 -0
  126. package/layers/mixins/ImageryTileMixin.js +1 -1
  127. package/layers/mixins/operationalLayers.js +1 -1
  128. package/layers/support/RasterStorageInfo.js +1 -1
  129. package/layers/support/Sublayer.js +1 -1
  130. package/layers/support/layersCreator.js +1 -1
  131. package/layers/support/rasterDatasets/BaseRaster.js +1 -1
  132. package/layers/support/rasterFunctions/BandArithmeticFunction.js +1 -1
  133. package/layers/support/rasterFunctions/BaseRasterFunction.js +1 -1
  134. package/layers/support/rasterFunctions/ExtractBandFunction.js +1 -1
  135. package/layers/support/rasterFunctions/NDVIFunction.js +1 -1
  136. package/package.json +1 -1
  137. package/portal/schemas/definitions.js +1 -1
  138. package/renderers/support/RasterSymbolizer.js +1 -1
  139. package/support/basemapUtils.js +1 -1
  140. package/support/revision.js +1 -1
  141. package/views/2d/layers/imagery/BaseImageryTileSubView2D.js +1 -1
  142. package/views/2d/layers/imagery/ImageryTileView2D.js +1 -1
  143. package/views/3d/camera/constraintUtils/distance.js +1 -1
  144. package/views/3d/camera/constraintUtils/tilt.js +1 -1
  145. package/views/3d/layers/I3SMeshView3D.js +1 -1
  146. package/views/3d/layers/IntegratedMesh3DTilesLayerView3D.js +1 -1
  147. package/views/3d/layers/graphics/Deconflictor.js +1 -1
  148. package/views/3d/layers/graphics/ElevationAligners.js +1 -1
  149. package/views/3d/layers/graphics/ElevationContext.js +1 -1
  150. package/views/3d/layers/graphics/Graphics3DMeshFillSymbolLayer.js +1 -1
  151. package/views/3d/layers/graphics/Graphics3DObject3DGraphicLayer.js +1 -1
  152. package/views/3d/layers/graphics/pointUtils.js +1 -1
  153. package/views/3d/layers/i3s/I3SClientNodeLoader.js +1 -1
  154. package/views/3d/layers/i3s/I3SIndex.js +1 -1
  155. package/views/3d/layers/i3s/I3SViewportQueries.js +1 -1
  156. package/views/3d/layers/support/FlowTileTree3DDebugger.js +1 -1
  157. package/views/3d/layers/support/StageLayerElevationProvider.js +1 -1
  158. package/views/3d/state/controllers/GamepadKeyboardController.js +1 -1
  159. package/views/3d/state/controllers/PinchAndPanControllerGlobal.js +1 -1
  160. package/views/3d/state/utils/navigationUtils.js +1 -1
  161. package/views/3d/support/CombinedElevationProvider.js +1 -1
  162. package/views/3d/support/flow/FlowSubViewTiles3D.js +1 -1
  163. package/views/3d/terrain/OverlayManager.js +1 -1
  164. package/views/3d/terrain/SphericalPatch.js +1 -1
  165. package/views/3d/terrain/TerrainSurface.js +1 -1
  166. package/views/3d/terrain/Tile.js +1 -1
  167. package/views/3d/webgl-engine/core/renderPasses/RenderPassManager.js +1 -1
  168. package/views/3d/webgl-engine/core/shaderLibrary/shading/EvaluateSceneLighting.glsl.js +2 -4
  169. package/views/3d/webgl-engine/effects/RenderPlugin.js +1 -1
  170. package/views/3d/webgl-engine/effects/RenderPluginManager.js +1 -1
  171. package/views/3d/webgl-engine/effects/bloom/BloomComposition.glsl.js +1 -1
  172. package/views/3d/webgl-engine/effects/bloom/BloomCompositionTechniqueConfiguration.js +5 -0
  173. package/views/3d/webgl-engine/effects/bloom/BloomRenderNode.js +1 -1
  174. package/views/3d/webgl-engine/lib/Object3D.js +1 -1
  175. package/views/3d/webgl-engine/lib/Octree.js +1 -1
  176. package/views/3d/webgl-engine/lib/RenderGeometry.js +1 -1
  177. package/views/3d/webgl-engine/lib/Renderer.js +1 -1
  178. package/views/3d/webgl-engine/lib/Viewshed.js +1 -1
  179. package/views/3d/webgl-engine/lib/depthRangeUtils.js +1 -1
  180. package/views/3d/webgl-engine/lib/edgeRendering/EdgeView.js +1 -1
  181. package/views/3d/webgl-engine/lib/lodRendering/InstanceOctree.js +1 -1
  182. package/views/3d/webgl-engine/lib/lodRendering/LodRenderer.js +1 -1
  183. package/views/3d/webgl-engine/lib/octreeUtils.js +1 -1
  184. package/views/3d/webgl-engine/materials/renderers/MergedRenderer.js +1 -1
  185. package/views/LinkChartView.js +1 -1
  186. package/views/draw/DrawOperation.js +1 -1
  187. package/views/draw/support/GraphicMover.js +1 -1
  188. package/views/draw/support/HighlightHelper.js +1 -1
  189. package/views/draw/support/Reshape.js +1 -1
  190. package/views/draw/support/drawUtils.js +1 -1
  191. package/views/interactive/Tooltip.js +1 -1
  192. package/views/interactive/editGeometry/EditGeometry.js +1 -1
  193. package/views/interactive/sketch/SketchLabelOptions.js +1 -1
  194. package/views/interactive/sketch/SketchOptions.js +1 -1
  195. package/views/interactive/sketch/SketchTooltipOptions.js +1 -1
  196. package/views/interactive/sketch/SketchTooltipVisibleElements.js +1 -1
  197. package/views/interactive/sketch/SketchValueOptions.js +1 -1
  198. package/views/interactive/sketch/Units.js +1 -1
  199. package/views/interactive/sketch/constraints.js +1 -1
  200. package/views/interactive/snapping/featureSources/FeatureCollectionSnappingSource.js +1 -1
  201. package/views/interactive/snapping/featureSources/FeatureServiceSnappingSource.js +1 -1
  202. package/views/interactive/snapping/featureSources/GraphicsSnappingSource.js +1 -1
  203. package/views/interactive/snapping/featureSources/sceneLayerSource/SceneLayerSnappingSourceWorker.js +1 -1
  204. package/views/interactive/snapping/featureSources/sceneLayerSource/sceneLayerSnappingUtils.js +1 -1
  205. package/views/interactive/tooltip/fields/fields.js +1 -1
  206. package/views/interactive/tooltip/fields/parsingAndFormattingUtils.js +1 -1
  207. package/views/interactive/tooltip/tooltipCommonUtils.js +1 -1
  208. package/views/support/angularMeasurementUtils.js +1 -1
  209. package/webdoc/support/writeUtils.js +1 -1
  210. package/webscene/spec-certification/api.js +1 -1
  211. package/widgets/DistanceMeasurement2D/DistanceMeasurement2DViewModel.js +1 -1
  212. package/widgets/Editor/support/splitFeatureUtils.js +5 -0
  213. package/widgets/FeatureTable/FeatureTableViewModel.js +1 -1
  214. package/widgets/FeatureTable/support/FeatureStore.js +1 -1
  215. package/widgets/OrientedImageryViewer/OrientedImageryViewerViewModel.js +1 -1
  216. package/widgets/OrientedImageryViewer/adapters/sketch/MeasurementAdapter.js +1 -1
  217. package/widgets/OrientedImageryViewer/services/ImageMeasurementService.js +1 -1
  218. package/widgets/OrientedImageryViewer.js +1 -1
  219. package/EULA.pdf +0 -0
  220. package/assets/esri/core/workers/chunks/00ee6f84119bc55a222f.js +0 -1
  221. package/assets/esri/core/workers/chunks/0569698a3e4eaf2bac8e.js +0 -1
  222. package/assets/esri/core/workers/chunks/0e4976f92b66793137c4.js +0 -1
  223. package/assets/esri/core/workers/chunks/171ce8c64f322cd5d6d1.js +0 -1
  224. package/assets/esri/core/workers/chunks/1ae15163af8875148fb8.js +0 -1
  225. package/assets/esri/core/workers/chunks/373c9e17e2834dfc1839.js +0 -1
  226. package/assets/esri/core/workers/chunks/55bb794bcdd9cc788322.js +0 -1
  227. package/assets/esri/core/workers/chunks/6acffacbb4a03af52e3b.js +0 -1
  228. package/assets/esri/core/workers/chunks/b457b7dd907f06278bee.js +0 -1
  229. package/assets/esri/core/workers/chunks/e7ccf067bea8f4766424.js +0 -1
@@ -2,4 +2,4 @@
2
2
  All material copyright ESRI, All Rights Reserved, unless otherwise specified.
3
3
  See https://js.arcgis.com/4.34/esri/copyright.txt for details.
4
4
  */
5
- import{G as t,S as s}from"../../../chunks/SimpleGeometryCursor.js";import{b as e}from"../../../chunks/Envelope.js";import{c as i,a as n,G as o,f as h,t as r}from"../../../chunks/Geometry.js";import{P as m,a,d as f}from"../../../chunks/MultiPathImpl.js";import{P as c,o as _,p as P,t as d,e as u}from"../../../chunks/Point2D.js";function l(t,s,e,o,h,r){if(null===t&&n(""),t.getDimension()<1&&n(""),h>0||n(""),i(t),0===s||t.isEmpty())return t;const m=new A(r);return m.m_bUseZ=t.hasAttribute(1),m.m_bUseM=t.hasAttribute(2),m.m_inputGeometry=t,m.m_distance=s,m.m_tolerance=h,m.m_joins=e,m.m_miterLimit=o>1?o:1,m.m_progressCounter=0,m.constructOffset()}const y=1.4142135623730951,x=.017453292519943295,p=256,b=512,M=1024;class g{static construct(t,s,e){const i=new g;return i.x=t.x,i.y=t.y,i.m_next=-1,i.m_prev=-1,i.z=s,i.m=e,i.type=0,i}clone(){const t=new g;return t.x=this.x,t.y=this.y,t.m_next=this.m_next,t.m_prev=this.m_prev,t.z=this.z,t.m=this.m,t.type=this.type,t}asPoint2D(){return new c(this.x,this.y)}}function C(){return{pt:new g,bAtExistingPt:!1}}class A{constructor(t){this.m_distance=-1,this.m_tolerance=-1,this.m_miterLimit=10,this.m_joins=0,this.m_progressCounter=0,this.m_bUseZ=!1,this.m_bUseM=!1,this.m_srcPts=[],this.m_srcPtCount=0,this.m_offsetPts=[],this.m_offsetPtCount=0,this.m_a1=0,this.m_a2=0,this.m_progressTracker=t}constructOffset(){const t=this.m_inputGeometry.getGeometryType();if(t===o.enumLine)return this.offsetLine();if(t===o.enumEnvelope)return this.offsetEnvelope();if(h(t)){const t=new m;return t.addSegment(this.m_inputGeometry,!0),this.m_inputGeometry=t,this.constructOffset()}if(t===o.enumPolyline){const t=new m;return this.offsetMultiPath(t),t}if(t===o.enumPolygon){const t=new a;return this.offsetMultiPath(t),t}r("")}offsetLine(){const t=this.m_inputGeometry,s=t.getStartXY(),e=t.getEndXY(),i=new c;i.setSub(e,s),i.normalize(),i.leftPerpendicularThis(),i.scale(this.m_distance),s.addThis(i),e.addThis(i);const n=t.clone();return n.setStartXY(s),n.setEndXY(e),n}offsetEnvelope(){const t=this.m_inputGeometry;if(this.m_distance>0&&2!==this.m_joins){const s=new a;return s.addEnvelope(t,!1),this.m_inputGeometry=s,this.constructOffset()}const s=t.clone();return s.inflateCoords(this.m_distance,this.m_distance),s}progress(){}static buildPoint(t,s,e,i){i.x=t.x+s*Math.cos(e),i.y=t.y+s*Math.sin(e),i.type=t.type,i.z=t.z,i.m=t.m,i.m_next=-1,i.m_prev=-1}addPoint(t){this.m_offsetPts.push(t.clone()),this.m_offsetPtCount++}addPointEx(t,s){if(0===this.m_offsetPtCount)return void this.addPoint(t);const e=this.m_srcPtCount,i=this.m_srcPts[0===s?e-1:s-1],n=this.m_srcPts[s],o=A.dotSign(i,n,this.m_offsetPts[this.m_offsetPtCount-1],t);if(o>0)this.addPoint(t);else if(o<0)if(A.dotSign(i,n,n,this.m_offsetPts[this.m_offsetPtCount-1])>0){const n=new g;let o;o=0===s?e-2:1===s?e-1:s-2;const h=this.m_srcPts[o],r=Math.atan2(i.y-h.y,i.x-h.x);if(A.buildPoint(i,this.m_distance,r-_,n),this.m_offsetPts[this.m_offsetPtCount-1]=n,1===this.m_joins||2===this.m_joins){n.x=.5*(n.x+i.x),n.y=.5*(n.y+i.y),this.addPoint(n),A.buildPoint(i,this.m_distance,this.m_a1+_,n);const t=n.clone();t.x=.5*(t.x+i.x),t.y=.5*(t.y+i.y),t.type|=p,this.addPoint(t),this.addPoint(n)}else A.buildPoint(i,this.m_distance,this.m_a1+_,n),n.type|=p,this.addPoint(n);this.addPointEx(t,s)}else{const t=new g;if(A.buildPoint(n,this.m_distance,this.m_a1+_,t),this.addPoint(t),1===this.m_joins||2===this.m_joins){t.x=.5*(t.x+n.x),t.y=.5*(t.y+n.y),this.addPoint(t),A.buildPoint(n,this.m_distance,this.m_a2-_,t);const s=t.clone();s.x=.5*(s.x+n.x),s.y=.5*(s.y+n.y),s.type|=p,this.addPoint(s),this.addPoint(t)}else A.buildPoint(n,this.m_distance,this.m_a2-_,t),t.type|=p,this.addPoint(t)}}buildOffset(){const t=new g,s=this.m_srcPtCount;this.m_offsetPtCount=0;const e=.5*this.m_tolerance;let i=0,n=0;for(let o=0;o<s;o++){const h=this.m_srcPts[o],r=0===o?this.m_srcPts[s-1]:this.m_srcPts[o-1],m=o===s-1?this.m_srcPts[0]:this.m_srcPts[o+1];let a,f,d=0;{const t=r.x-h.x,s=r.y-h.y,e=m.x-h.x,_=m.y-h.y;a=Math.atan2(s,t),f=Math.atan2(_,e),this.m_a1=a,this.m_a2=f,0===o&&(i=a,n=f),d=c.orientationRobust(h.asPoint2D(),r.asPoint2D(),m.asPoint2D())}const u=f;if(f<a&&(f+=P),d*this.m_distance>0)if(1===this.m_joins||2===this.m_joins){A.buildPoint(h,this.m_distance,a+_,t),this.addPoint(t);const s=.001;t.x=h.x+(t.x-h.x)*s,t.y=h.y+(t.y-h.y)*s,this.addPoint(t),A.buildPoint(h,this.m_distance,f-_,t);const e=t.clone();e.x=h.x+(e.x-h.x)*s,e.y=h.y+(e.y-h.y)*s,e.type|=p,this.addPoint(e),this.addPoint(t)}else{const s=.5*(f-a),e=0===s?this.m_distance:this.m_distance/Math.abs(Math.sin(s));A.buildPoint(h,e,.5*(a+f),t),this.addPointEx(t,o)}else{if(h.type&b){const s=1-e/Math.abs(this.m_distance);let i=1,n=this.m_distance<0?-Math.PI:Math.PI;if(s>-1&&s<1){let t=2*Math.acos(s);t<x&&(t=x),i=Math.trunc(Math.PI/t+1.5),i>1&&(n/=i)}i<=1&&(i=2,n/=2);let r=a+_;A.buildPoint(h,this.m_distance,r,t),0===o&&(t.type|=M),this.addPointEx(t,o);const m=this.m_distance/Math.cos(n/2);for(r+=n/2,A.buildPoint(h,m,r,t),t.type|=M,this.addPoint(t);--i>0;)r+=n,A.buildPoint(h,m,r,t),t.type|=M,this.addPoint(t);A.buildPoint(h,this.m_distance,f-_,t),t.type|=M,this.addPoint(t);continue}if(1!==this.m_joins){if(0===this.m_joins){const s=1-e/Math.abs(this.m_distance);let i=1,n=f-_-(a+_);if(s>-1&&s<1){let t=2*Math.acos(s);t<x&&(t=x),i=Math.trunc(Math.abs(n)/t+1.5),i>1&&(n/=i)}const r=this.m_distance/Math.cos(.5*n);let m=a+_+.5*n;for(A.buildPoint(h,r,m,t),this.addPointEx(t,o);--i>0;)m+=n,A.buildPoint(h,r,m,t),this.addPoint(t);continue}if(2===this.m_joins){const s=r.x-h.x,e=r.y-h.y,i=m.x-h.x,n=m.y-h.y,_=(s*i+e*n)/Math.sqrt(s*s+e*e)/Math.sqrt(i*i+n*n);if(_>1-1e-8){A.buildPoint(h,y*this.m_distance,f-.25*Math.PI,t),this.addPointEx(t,o),A.buildPoint(h,y*this.m_distance,f+.25*Math.PI,t),this.addPoint(t);continue}const P=Math.abs(this.m_distance/Math.sin(.5*Math.acos(_))),d=Math.abs(this.m_miterLimit*this.m_distance);if(P>d){const s=.5*(f-a),e=this.m_distance/Math.abs(Math.sin(s));A.buildPoint(h,e,.5*(a+f),t);const i=c.construct(t.x,t.y),n=c.construct(h.x,h.y),r=new c;r.setSub(i,n);const m=new c;m.setScaleAdd(d/r.length(),r,n);const _=Math.sqrt(P*P-this.m_distance*this.m_distance),u=(P-d)*Math.abs(this.m_distance)/_;this.m_distance>0?r.leftPerpendicularThis():r.rightPerpendicularThis(),r.scale(u/r.length());const l=new c;l.setAdd(m,r);const y=new c;y.setSub(m,r),t.x=l.x,t.y=l.y,this.addPointEx(t,o),t.x=y.x,t.y=y.y,this.addPoint(t);continue}const u=.5*(f-a),l=this.m_distance/Math.abs(Math.sin(u));A.buildPoint(h,l,.5*(a+f),t),this.addPointEx(t,o);continue}{let s;if(f=u,this.m_distance>0?(f>a&&(f-=P),s=a-f<_):(f<a&&(f+=P),s=f-a<_),s){const s=this.m_distance*y;let e;e=s<0?a+.25*Math.PI:a+3*Math.PI*.25,A.buildPoint(h,s,e,t),this.addPointEx(t,o),e=s<0?f-.25*Math.PI:f-3*Math.PI*.25,A.buildPoint(h,s,e,t),this.addPoint(t)}else{const s=.5*(f-a),e=this.m_distance/Math.abs(Math.sin(s));f<a&&(f+=P),A.buildPoint(h,e,(a+f)/2,t),this.addPointEx(t,o)}}}else A.buildPoint(h,this.m_distance,a+_,t),this.addPointEx(t,o),A.buildPoint(h,this.m_distance,f-_,t),this.addPoint(t)}}return this.m_a1=i,this.m_a2=n,this.addPointEx(this.m_offsetPts[0],0),this.m_offsetPts[0]=this.m_offsetPts[this.m_offsetPtCount-1].clone(),this.removeBadSegsFast()}removeBadSegsFast(){let t=!1;for(let e=0;e<this.m_offsetPtCount;e++){const t=this.m_offsetPts[e];t.m_next=e+1,t.m_prev=e-1}this.m_offsetPts[0].m_prev=this.m_offsetPtCount-2,this.m_offsetPts[this.m_offsetPtCount-2].m_next=0;let s=0;for(let e=0;e<this.m_offsetPtCount;e++)if(this.m_offsetPts[s].type&p){const e=this.deleteClosedSeg(s);if(-1===e){t=!0;break}s=e}else s=this.m_offsetPts[s].m_next;return!t&&(this.compressOffsetArray(s),!0)}deleteClosedSeg(t){const s=this.m_offsetPtCount-1;let e,i,n=t;for(let o=1;o<=s-2;o++){n=this.m_offsetPts[n].m_next,e=n,i=t;for(let t=1;t<=o;t++){if(i=this.m_offsetPts[i].m_prev,0===(this.m_offsetPts[i].type&p)&&0===(this.m_offsetPts[e].type&p)){const t=this.handleClosedIntersection(i,e);if(-1!==t)return t}e=this.m_offsetPts[e].m_prev}}return-1}handleClosedIntersection(t,s){const e=this.m_offsetPts[this.m_offsetPts[t].m_prev],i=this.m_offsetPts[t],n=this.m_offsetPts[this.m_offsetPts[s].m_prev],o=this.m_offsetPts[s];if(!this.sectGraphicRect(e,i,n,o))return-1;const h=C();if(((i.x-e.x)*(o.y-n.y)-(i.y-e.y)*(o.x-n.x))*this.m_distance<0){if(this.findIntersection(e,i,n,o,h)&&!h.bAtExistingPt){const r=1e-8,m=Math.sqrt((i.x-e.x)*(i.x-e.x)+(i.y-e.y)*(i.y-e.y)),a=(i.x-e.x)/m,f=(i.y-e.y)/m,c=Math.sqrt((o.x-n.x)*(o.x-n.x)+(o.y-n.y)*(o.y-n.y)),_=(o.x-n.x)/c,P=(o.y-n.y)/c;let d=!1;const u=h.pt.clone();u.x+=(a+_)*r,u.y+=(f+P)*r;let l=n,y=h.pt,x=this.m_offsetPts[t].m_prev;for(;y.y>u.y!=l.y>u.y&&u.x<(l.x-y.x)*(u.y-y.y)/(l.y-y.y)+y.x&&(d=!d),l=y,x=this.m_offsetPts[x].m_next,x!==s;)y=this.m_offsetPts[x];if(d)return-1;const p=this.m_offsetPts[t].m_prev;return h.pt.type=i.type,h.pt.m_next=s,h.pt.m_prev=p,this.m_offsetPts[t]=h.pt,this.m_offsetPts[s].m_prev=t,s}}return-1}sectGraphicRect(t,s,e,i){return Math.max(t.x,s.x)>=Math.min(e.x,i.x)&&Math.max(e.x,i.x)>=Math.min(t.x,s.x)&&Math.max(t.y,s.y)>=Math.min(e.y,i.y)&&Math.max(e.y,i.y)>=Math.min(t.y,s.y)}findIntersection(t,s,e,i,n){let o,h,r,m;return n.bAtExistingPt=!1,o=(s.y-t.y)*(i.x-e.x)-(s.x-t.x)*(i.y-e.y),h=(e.y-t.y)*(s.x-t.x)-(e.x-t.x)*(s.y-t.y),r=0===o?2:h/o,r>=0&&r<=1&&(m=r,o=(i.y-e.y)*(s.x-t.x)-(i.x-e.x)*(s.y-t.y),h=(t.y-e.y)*(i.x-e.x)-(t.x-e.x)*(i.y-e.y),r=0===o?2:h/o,r>=0&&r<=1)&&(n.pt.x=t.x+r*(s.x-t.x),n.pt.y=t.y+r*(s.y-t.y),this.m_bUseZ&&(n.pt.z=e.z+m*(i.z-e.z)),this.m_bUseM&&(n.pt.m=e.m+m*(i.m-e.m)),0!==m&&1!==m||0!==r&&1!==r||(n.bAtExistingPt=!0),!((0===m||1===m)&&r>0&&r<1||(0===r||1===r)&&m>0&&m<1))}compressOffsetArray(t){for(;this.m_offsetPts[t].m_prev<t;)t=this.m_offsetPts[t].m_prev;let s=0,e=t;do{const t=this.m_offsetPts[e].clone();this.m_offsetPts[s]=t,e=t.m_next,s++}while(e!==t);this.m_offsetPts[s]=this.m_offsetPts[0].clone(),this.m_offsetPtCount=s+1}addPart(t,s){if(!(s<2))for(let e=0;e<s;e++){const s=this.m_offsetPts[t+e];if(e?this.m_bUseZ?this.m_resultPath.lineTo3DCoords(s.x,s.y,s.z):this.m_resultPath.lineToCoords(s.x,s.y):this.m_bUseZ?this.m_resultPath.startPath3DCoords(s.x,s.y,s.z):this.m_resultPath.startPathCoords(s.x,s.y),this.m_bUseM){const t=this.m_resultPath.getPointCount()-1;this.m_resultPath.setAttribute(2,t,0,s.m)}}}offsetMultiPath(t){const s=f(this.m_inputGeometry,0,this.m_tolerance,0,this.m_progressTracker,12e3),e=s.querySegmentIterator();e.resetToFirstPath();let i=-1;for(;e.nextPath();)i++,this.offsetPath(s,i,t)}offsetPath(t,s,e){let i=t.getPathStart(s),n=t.getPathEnd(s);if(this.m_resultPath=e,t.isClosedPath(s)){const s=t.getXY(i);for(;n>i&&t.getXY(n-1).equals(s);)n--;if(n-i>=2){this.m_srcPtCount=n-i,this.m_srcPts.length=this.m_srcPtCount;for(let s=i;s<n;s++)this.progress(),this.m_srcPts[s-i]=g.construct(t.getXY(s),this.m_bUseZ?t.getAttributeAsDbl(1,s,0):0,this.m_bUseM?t.getAttributeAsDbl(2,s,0):0);this.buildOffset()&&this.addPart(0,this.m_offsetPtCount-1)}}else{const s=t.getXY(i);for(;i<n-1&&t.getXY(i+1).equals(s);)i++;const e=t.getXY(n-1);for(;i<n-1&&t.getXY(n-2).equals(e);)n--;if(n-i>=2){this.m_srcPtCount=2*(n-i)-2,this.m_srcPts.length=this.m_srcPtCount;let e=g.construct(s,this.m_bUseZ?t.getAttributeAsDbl(1,i,0):0,this.m_bUseM?t.getAttributeAsDbl(2,i,0):0);e.type|=b+M,this.m_srcPts[0]=e;let o=1,h=this.m_srcPtCount-1;for(let s=i+1;s<n-1;s++,o++,h--)this.progress(),e=g.construct(t.getXY(s),this.m_bUseZ?t.getAttributeAsDbl(1,s,0):0,this.m_bUseM?t.getAttributeAsDbl(2,s,0):0),this.m_srcPts[o]=e.clone(),e.type|=M,this.m_srcPts[h]=e.clone();if(e=g.construct(t.getXY(n-1),this.m_bUseZ?t.getAttributeAsDbl(1,n-1,0):0,this.m_bUseM?t.getAttributeAsDbl(2,n-1,0):0),e.type|=b,this.m_srcPts[o]=e.clone(),this.buildOffset())if(this.m_offsetPts.length>=2){let t=-1,s=-1,e=0!==(this.m_offsetPts[this.m_offsetPtCount-1].type&M);e||(t=0);for(let i=1;i<this.m_offsetPtCount;i++){this.progress();const n=0!==(this.m_offsetPts[i].type&M);n?e||(s=i-1,s-t+1>1&&this.addPart(t,s-t+1)):e&&(t=i-1),e=n}e||(s=this.m_offsetPtCount-1,s-t+1>1&&this.addPart(t,s-t+1))}else{const t=0,s=this.m_offsetPtCount-1;s-t>=1&&this.addPart(t,s-t+1)}}}this.m_srcPts.length=0,this.m_srcPtCount=0,this.m_offsetPts.length=0,this.m_offsetPtCount=0}static dotSign(t,s,e,i){const n=s.x-t.x,o=s.y-t.y,h=i.x-e.x,r=i.y-e.y,m=d(n,o,h,r);return u(m)}}class E{getOperatorType(){return 10108}accelerateGeometry(t,s,e){return!1}canAccelerateGeometry(t){return!1}supportsCurves(){return!0}executeMany(t,s,e,i,n,o,h){return new v(t,s,e,i,n,o,h)}execute(t,s,e,i,n,o,h){return new v(null,s,e,i,n,o,h).offset(t)}}class v extends t{constructor(t,s,e,i,n,o,h){super(),this.m_progressTracker=h,this.m_index=-1,this.m_inputGeoms=t,this.m_spatialReference=s,this.m_distance=e,this.m_joins=i,this.m_miterLimit=n,this.m_flattenError=o}tock(){return!0}getRank(){return 1}next(){if(!this.m_inputGeoms)return null;let t;for(;t=this.m_inputGeoms.next();)return this.m_index=this.m_inputGeoms.getGeometryID(),this.offset(t);return null}getGeometryID(){return this.m_index}offset(t){let s;return i(t),s=this.m_flattenError<=0?e(this.m_spatialReference,t,!0).total():this.m_flattenError,l(t,this.m_distance,this.m_joins,this.m_miterLimit,s,this.m_progressTracker)}}const G=new E;function w(t,s,e,i,n,o){return G.execute(t,s,e,i,n,o,null)}function j(t,e,i,n,o,h){const r=G.executeMany(new s(t),e,i,n,o,h,null);return Array.from(r)}function D(){return G.supportsCurves()}export{w as execute,j as executeMany,D as supportsCurves};
5
+ import{G as t,S as s}from"../../../chunks/SimpleGeometryCursor.js";import{b as e}from"../../../chunks/Envelope.js";import{c as i,a as n,G as o,f as h,t as r}from"../../../chunks/Geometry.js";import{P as m,a,d as f}from"../../../chunks/MultiPathImpl.js";import{P as c,o as _,p as P,t as d,e as u}from"../../../chunks/Point2D.js";function l(t,s,e,o,h,r){if(null===t&&n(""),t.getDimension()<1&&n(""),h>0||n(""),i(t),0===s||t.isEmpty())return t;const m=new A(r);return m.m_bUseZ=t.hasAttribute(1),m.m_bUseM=t.hasAttribute(2),m.m_inputGeometry=t,m.m_distance=s,m.m_tolerance=h,m.m_joins=e,m.m_miterLimit=o>1?o:1,m.m_progressCounter=0,m.constructOffset()}const y=1.4142135623730951,x=.017453292519943295,p=256,b=512,M=1024;class g{static construct(t,s,e){const i=new g;return i.x=t.x,i.y=t.y,i.m_next=-1,i.m_prev=-1,i.z=s,i.m=e,i.type=0,i}clone(){const t=new g;return t.x=this.x,t.y=this.y,t.m_next=this.m_next,t.m_prev=this.m_prev,t.z=this.z,t.m=this.m,t.type=this.type,t}asPoint2D(){return new c(this.x,this.y)}}function C(){return{pt:new g,bAtExistingPt:!1}}class A{constructor(t){this.m_distance=-1,this.m_tolerance=-1,this.m_miterLimit=10,this.m_joins=0,this.m_progressCounter=0,this.m_bUseZ=!1,this.m_bUseM=!1,this.m_srcPts=[],this.m_srcPtCount=0,this.m_offsetPts=[],this.m_offsetPtCount=0,this.m_a1=0,this.m_a2=0,this.m_progressTracker=t}constructOffset(){const t=this.m_inputGeometry.getGeometryType();if(t===o.enumLine)return this.offsetLine();if(t===o.enumEnvelope)return this.offsetEnvelope();if(h(t)){const t=new m;return t.addSegment(this.m_inputGeometry,!0),this.m_inputGeometry=t,this.constructOffset()}if(t===o.enumPolyline){const t=new m;return this.offsetMultiPath(t),t}if(t===o.enumPolygon){const t=new a;return this.offsetMultiPath(t),t}r("")}offsetLine(){const t=this.m_inputGeometry,s=t.getStartXY(),e=t.getEndXY(),i=new c;i.setSub(e,s),i.normalize(),i.leftPerpendicularThis(),i.scale(this.m_distance),s.addThis(i),e.addThis(i);const n=t.clone();return n.setStartXY(s),n.setEndXY(e),n}offsetEnvelope(){const t=this.m_inputGeometry;if(this.m_distance>0&&2!==this.m_joins){const s=new a;return s.addEnvelope(t,!1),this.m_inputGeometry=s,this.constructOffset()}const s=t.clone();return s.inflateCoords(this.m_distance,this.m_distance),s}progress(){}static buildPoint(t,s,e,i){i.x=t.x+s*Math.cos(e),i.y=t.y+s*Math.sin(e),i.type=t.type,i.z=t.z,i.m=t.m,i.m_next=-1,i.m_prev=-1}addPoint(t){this.m_offsetPts.push(t.clone()),this.m_offsetPtCount++}addPointEx(t,s){if(0===this.m_offsetPtCount)return void this.addPoint(t);const e=this.m_srcPtCount,i=this.m_srcPts[0===s?e-1:s-1],n=this.m_srcPts[s],o=A.dotSign(i,n,this.m_offsetPts[this.m_offsetPtCount-1],t);if(o>0)this.addPoint(t);else if(o<0)if(A.dotSign(i,n,n,this.m_offsetPts[this.m_offsetPtCount-1])>0){const n=new g;let o;o=0===s?e-2:1===s?e-1:s-2;const h=this.m_srcPts[o],r=Math.atan2(i.y-h.y,i.x-h.x);if(A.buildPoint(i,this.m_distance,r-_,n),this.m_offsetPts[this.m_offsetPtCount-1]=n,1===this.m_joins||2===this.m_joins){n.x=.5*(n.x+i.x),n.y=.5*(n.y+i.y),this.addPoint(n),A.buildPoint(i,this.m_distance,this.m_a1+_,n);const t=n.clone();t.x=.5*(t.x+i.x),t.y=.5*(t.y+i.y),t.type|=p,this.addPoint(t),this.addPoint(n)}else A.buildPoint(i,this.m_distance,this.m_a1+_,n),n.type|=p,this.addPoint(n);this.addPointEx(t,s)}else{const t=new g;if(A.buildPoint(n,this.m_distance,this.m_a1+_,t),this.addPoint(t),1===this.m_joins||2===this.m_joins){t.x=.5*(t.x+n.x),t.y=.5*(t.y+n.y),this.addPoint(t),A.buildPoint(n,this.m_distance,this.m_a2-_,t);const s=t.clone();s.x=.5*(s.x+n.x),s.y=.5*(s.y+n.y),s.type|=p,this.addPoint(s),this.addPoint(t)}else A.buildPoint(n,this.m_distance,this.m_a2-_,t),t.type|=p,this.addPoint(t)}}buildOffset(){const t=new g,s=this.m_srcPtCount;this.m_offsetPtCount=0;const e=.5*this.m_tolerance;let i=0,n=0;for(let o=0;o<s;o++){const h=this.m_srcPts[o],r=0===o?this.m_srcPts[s-1]:this.m_srcPts[o-1],m=o===s-1?this.m_srcPts[0]:this.m_srcPts[o+1];let a,f,d=0;{const t=r.x-h.x,s=r.y-h.y,e=m.x-h.x,_=m.y-h.y;a=Math.atan2(s,t),f=Math.atan2(_,e),this.m_a1=a,this.m_a2=f,0===o&&(i=a,n=f),d=c.orientationRobust(h.asPoint2D(),r.asPoint2D(),m.asPoint2D())}const u=f;if(f<a&&(f+=P),d*this.m_distance>0)if(1===this.m_joins||2===this.m_joins){A.buildPoint(h,this.m_distance,a+_,t),this.addPoint(t);const s=.001;t.x=h.x+(t.x-h.x)*s,t.y=h.y+(t.y-h.y)*s,this.addPoint(t),A.buildPoint(h,this.m_distance,f-_,t);const e=t.clone();e.x=h.x+(e.x-h.x)*s,e.y=h.y+(e.y-h.y)*s,e.type|=p,this.addPoint(e),this.addPoint(t)}else{const s=.5*(f-a),e=0===s?this.m_distance:this.m_distance/Math.abs(Math.sin(s));A.buildPoint(h,e,.5*(a+f),t),this.addPointEx(t,o)}else{if(h.type&b){const s=1-e/Math.abs(this.m_distance);let i=1,n=this.m_distance<0?-Math.PI:Math.PI;if(s>-1&&s<1){let t=2*Math.acos(s);t<x&&(t=x),i=Math.trunc(Math.PI/t+1.5),i>1&&(n/=i)}i<=1&&(i=2,n/=2);let r=a+_;A.buildPoint(h,this.m_distance,r,t),0===o&&(t.type|=M),this.addPointEx(t,o);const m=this.m_distance/Math.cos(n/2);for(r+=n/2,A.buildPoint(h,m,r,t),t.type|=M,this.addPoint(t);--i>0;)r+=n,A.buildPoint(h,m,r,t),t.type|=M,this.addPoint(t);A.buildPoint(h,this.m_distance,f-_,t),t.type|=M,this.addPoint(t);continue}if(1!==this.m_joins){if(0===this.m_joins){const s=1-e/Math.abs(this.m_distance);let i=1,n=f-_-(a+_);if(s>-1&&s<1){let t=2*Math.acos(s);t<x&&(t=x),i=Math.trunc(Math.abs(n)/t+1.5),i>1&&(n/=i)}const r=this.m_distance/Math.cos(.5*n);let m=a+_+.5*n;for(A.buildPoint(h,r,m,t),this.addPointEx(t,o);--i>0;)m+=n,A.buildPoint(h,r,m,t),this.addPoint(t);continue}if(2===this.m_joins){const s=r.x-h.x,e=r.y-h.y,i=m.x-h.x,n=m.y-h.y,_=(s*i+e*n)/Math.sqrt(s*s+e*e)/Math.sqrt(i*i+n*n);if(_>1-1e-8){A.buildPoint(h,y*this.m_distance,f-.25*Math.PI,t),this.addPointEx(t,o),A.buildPoint(h,y*this.m_distance,f+.25*Math.PI,t),this.addPoint(t);continue}const P=Math.abs(this.m_distance/Math.sin(.5*Math.acos(_))),d=Math.abs(this.m_miterLimit*this.m_distance);if(P>d){const s=.5*(f-a),e=this.m_distance/Math.abs(Math.sin(s));A.buildPoint(h,e,.5*(a+f),t);const i=c.construct(t.x,t.y),n=c.construct(h.x,h.y),r=new c;r.setSub(i,n);const m=new c;m.setScaleAdd(d/r.length(),r,n);const _=Math.sqrt(P*P-this.m_distance*this.m_distance),u=(P-d)*Math.abs(this.m_distance)/_;this.m_distance>0?r.leftPerpendicularThis():r.rightPerpendicularThis(),r.scale(u/r.length());const l=new c;l.setAdd(m,r);const y=new c;y.setSub(m,r),t.x=y.x,t.y=y.y,this.addPointEx(t,o),t.x=l.x,t.y=l.y,this.addPoint(t);continue}const u=.5*(f-a),l=this.m_distance/Math.abs(Math.sin(u));A.buildPoint(h,l,.5*(a+f),t),this.addPointEx(t,o);continue}{let s;if(f=u,this.m_distance>0?(f>a&&(f-=P),s=a-f<_):(f<a&&(f+=P),s=f-a<_),s){const s=this.m_distance*y;let e;e=s<0?a+.25*Math.PI:a+3*Math.PI*.25,A.buildPoint(h,s,e,t),this.addPointEx(t,o),e=s<0?f-.25*Math.PI:f-3*Math.PI*.25,A.buildPoint(h,s,e,t),this.addPoint(t)}else{const s=.5*(f-a),e=this.m_distance/Math.abs(Math.sin(s));f<a&&(f+=P),A.buildPoint(h,e,(a+f)/2,t),this.addPointEx(t,o)}}}else A.buildPoint(h,this.m_distance,a+_,t),this.addPointEx(t,o),A.buildPoint(h,this.m_distance,f-_,t),this.addPoint(t)}}return this.m_a1=i,this.m_a2=n,this.addPointEx(this.m_offsetPts[0],0),this.m_offsetPts[0]=this.m_offsetPts[this.m_offsetPtCount-1].clone(),this.removeBadSegsFast()}removeBadSegsFast(){let t=!1;for(let e=0;e<this.m_offsetPtCount;e++){const t=this.m_offsetPts[e];t.m_next=e+1,t.m_prev=e-1}this.m_offsetPts[0].m_prev=this.m_offsetPtCount-2,this.m_offsetPts[this.m_offsetPtCount-2].m_next=0;let s=0;for(let e=0;e<this.m_offsetPtCount;e++)if(this.m_offsetPts[s].type&p){const e=this.deleteClosedSeg(s);if(-1===e){t=!0;break}s=e}else s=this.m_offsetPts[s].m_next;return!t&&(this.compressOffsetArray(s),!0)}deleteClosedSeg(t){const s=this.m_offsetPtCount-1;let e,i,n=t;for(let o=1;o<=s-2;o++){n=this.m_offsetPts[n].m_next,e=n,i=t;for(let t=1;t<=o;t++){if(i=this.m_offsetPts[i].m_prev,0===(this.m_offsetPts[i].type&p)&&0===(this.m_offsetPts[e].type&p)){const t=this.handleClosedIntersection(i,e);if(-1!==t)return t}e=this.m_offsetPts[e].m_prev}}return-1}handleClosedIntersection(t,s){const e=this.m_offsetPts[this.m_offsetPts[t].m_prev],i=this.m_offsetPts[t],n=this.m_offsetPts[this.m_offsetPts[s].m_prev],o=this.m_offsetPts[s];if(!this.sectGraphicRect(e,i,n,o))return-1;const h=C();if(((i.x-e.x)*(o.y-n.y)-(i.y-e.y)*(o.x-n.x))*this.m_distance<0){if(this.findIntersection(e,i,n,o,h)&&!h.bAtExistingPt){const r=1e-8,m=Math.sqrt((i.x-e.x)*(i.x-e.x)+(i.y-e.y)*(i.y-e.y)),a=(i.x-e.x)/m,f=(i.y-e.y)/m,c=Math.sqrt((o.x-n.x)*(o.x-n.x)+(o.y-n.y)*(o.y-n.y)),_=(o.x-n.x)/c,P=(o.y-n.y)/c;let d=!1;const u=h.pt.clone();u.x+=(a+_)*r,u.y+=(f+P)*r;let l=n,y=h.pt,x=this.m_offsetPts[t].m_prev;for(;y.y>u.y!=l.y>u.y&&u.x<(l.x-y.x)*(u.y-y.y)/(l.y-y.y)+y.x&&(d=!d),l=y,x=this.m_offsetPts[x].m_next,x!==s;)y=this.m_offsetPts[x];if(d)return-1;const p=this.m_offsetPts[t].m_prev;return h.pt.type=i.type,h.pt.m_next=s,h.pt.m_prev=p,this.m_offsetPts[t]=h.pt,this.m_offsetPts[s].m_prev=t,s}}return-1}sectGraphicRect(t,s,e,i){return Math.max(t.x,s.x)>=Math.min(e.x,i.x)&&Math.max(e.x,i.x)>=Math.min(t.x,s.x)&&Math.max(t.y,s.y)>=Math.min(e.y,i.y)&&Math.max(e.y,i.y)>=Math.min(t.y,s.y)}findIntersection(t,s,e,i,n){let o,h,r,m;return n.bAtExistingPt=!1,o=(s.y-t.y)*(i.x-e.x)-(s.x-t.x)*(i.y-e.y),h=(e.y-t.y)*(s.x-t.x)-(e.x-t.x)*(s.y-t.y),r=0===o?2:h/o,r>=0&&r<=1&&(m=r,o=(i.y-e.y)*(s.x-t.x)-(i.x-e.x)*(s.y-t.y),h=(t.y-e.y)*(i.x-e.x)-(t.x-e.x)*(i.y-e.y),r=0===o?2:h/o,r>=0&&r<=1)&&(n.pt.x=t.x+r*(s.x-t.x),n.pt.y=t.y+r*(s.y-t.y),this.m_bUseZ&&(n.pt.z=e.z+m*(i.z-e.z)),this.m_bUseM&&(n.pt.m=e.m+m*(i.m-e.m)),0!==m&&1!==m||0!==r&&1!==r||(n.bAtExistingPt=!0),!((0===m||1===m)&&r>0&&r<1||(0===r||1===r)&&m>0&&m<1))}compressOffsetArray(t){for(;this.m_offsetPts[t].m_prev<t;)t=this.m_offsetPts[t].m_prev;let s=0,e=t;do{const t=this.m_offsetPts[e].clone();this.m_offsetPts[s]=t,e=t.m_next,s++}while(e!==t);this.m_offsetPts[s]=this.m_offsetPts[0].clone(),this.m_offsetPtCount=s+1}addPart(t,s){if(!(s<2))for(let e=0;e<s;e++){const s=this.m_offsetPts[t+e];if(e?this.m_bUseZ?this.m_resultPath.lineTo3DCoords(s.x,s.y,s.z):this.m_resultPath.lineToCoords(s.x,s.y):this.m_bUseZ?this.m_resultPath.startPath3DCoords(s.x,s.y,s.z):this.m_resultPath.startPathCoords(s.x,s.y),this.m_bUseM){const t=this.m_resultPath.getPointCount()-1;this.m_resultPath.setAttribute(2,t,0,s.m)}}}offsetMultiPath(t){const s=f(this.m_inputGeometry,0,this.m_tolerance,0,this.m_progressTracker,12e3),e=s.querySegmentIterator();e.resetToFirstPath();let i=-1;for(;e.nextPath();)i++,this.offsetPath(s,i,t)}offsetPath(t,s,e){let i=t.getPathStart(s),n=t.getPathEnd(s);if(this.m_resultPath=e,t.isClosedPath(s)){const s=t.getXY(i);for(;n>i&&t.getXY(n-1).equals(s);)n--;if(n-i>=2){this.m_srcPtCount=n-i,this.m_srcPts.length=this.m_srcPtCount;for(let s=i;s<n;s++)this.progress(),this.m_srcPts[s-i]=g.construct(t.getXY(s),this.m_bUseZ?t.getAttributeAsDbl(1,s,0):0,this.m_bUseM?t.getAttributeAsDbl(2,s,0):0);this.buildOffset()&&this.addPart(0,this.m_offsetPtCount-1)}}else{const s=t.getXY(i);for(;i<n-1&&t.getXY(i+1).equals(s);)i++;const e=t.getXY(n-1);for(;i<n-1&&t.getXY(n-2).equals(e);)n--;if(n-i>=2){this.m_srcPtCount=2*(n-i)-2,this.m_srcPts.length=this.m_srcPtCount;let e=g.construct(s,this.m_bUseZ?t.getAttributeAsDbl(1,i,0):0,this.m_bUseM?t.getAttributeAsDbl(2,i,0):0);e.type|=b+M,this.m_srcPts[0]=e;let o=1,h=this.m_srcPtCount-1;for(let s=i+1;s<n-1;s++,o++,h--)this.progress(),e=g.construct(t.getXY(s),this.m_bUseZ?t.getAttributeAsDbl(1,s,0):0,this.m_bUseM?t.getAttributeAsDbl(2,s,0):0),this.m_srcPts[o]=e.clone(),e.type|=M,this.m_srcPts[h]=e.clone();if(e=g.construct(t.getXY(n-1),this.m_bUseZ?t.getAttributeAsDbl(1,n-1,0):0,this.m_bUseM?t.getAttributeAsDbl(2,n-1,0):0),e.type|=b,this.m_srcPts[o]=e.clone(),this.buildOffset())if(this.m_offsetPts.length>=2){let t=-1,s=-1,e=0!==(this.m_offsetPts[this.m_offsetPtCount-1].type&M);e||(t=0);for(let i=1;i<this.m_offsetPtCount;i++){this.progress();const n=0!==(this.m_offsetPts[i].type&M);n?e||(s=i-1,s-t+1>1&&this.addPart(t,s-t+1)):e&&(t=i-1),e=n}e||(s=this.m_offsetPtCount-1,s-t+1>1&&this.addPart(t,s-t+1))}else{const t=0,s=this.m_offsetPtCount-1;s-t>=1&&this.addPart(t,s-t+1)}}}this.m_srcPts.length=0,this.m_srcPtCount=0,this.m_offsetPts.length=0,this.m_offsetPtCount=0}static dotSign(t,s,e,i){const n=s.x-t.x,o=s.y-t.y,h=i.x-e.x,r=i.y-e.y,m=d(n,o,h,r);return u(m)}}class E{getOperatorType(){return 10108}accelerateGeometry(t,s,e){return!1}canAccelerateGeometry(t){return!1}supportsCurves(){return!0}executeMany(t,s,e,i,n,o,h){return new v(t,s,e,i,n,o,h)}execute(t,s,e,i,n,o,h){return new v(null,s,e,i,n,o,h).offset(t)}}class v extends t{constructor(t,s,e,i,n,o,h){super(),this.m_progressTracker=h,this.m_index=-1,this.m_inputGeoms=t,this.m_spatialReference=s,this.m_distance=e,this.m_joins=i,this.m_miterLimit=n,this.m_flattenError=o}tock(){return!0}getRank(){return 1}next(){if(!this.m_inputGeoms)return null;let t;for(;t=this.m_inputGeoms.next();)return this.m_index=this.m_inputGeoms.getGeometryID(),this.offset(t);return null}getGeometryID(){return this.m_index}offset(t){let s;return i(t),s=this.m_flattenError<=0?e(this.m_spatialReference,t,!0).total():this.m_flattenError,l(t,this.m_distance,this.m_joins,this.m_miterLimit,s,this.m_progressTracker)}}const G=new E;function w(t,s,e,i,n,o){return G.execute(t,s,e,i,n,o,null)}function j(t,e,i,n,o,h){const r=G.executeMany(new s(t),e,i,n,o,h,null);return Array.from(r)}function D(){return G.supportsCurves()}export{w as execute,j as executeMany,D as supportsCurves};
@@ -2,4 +2,4 @@
2
2
  All material copyright ESRI, All Rights Reserved, unless otherwise specified.
3
3
  See https://js.arcgis.com/4.34/esri/copyright.txt for details.
4
4
  */
5
- import{G as t,S as e}from"../../../chunks/SimpleGeometryCursor.js";import{a as s,g as r}from"../../../chunks/Geometry.js";import{Envelope2D as n}from"../../../chunks/Envelope2D.js";import{T as i}from"../../../chunks/Transformation2D.js";import{p as o,q as a,t as u,u as l,P as h,v as m,E as c,n as p,a as _,w as g}from"../../../chunks/MultiPathImpl.js";import{K as f,k as y,E as d,m as x,P as T,c as A,q as E}from"../../../chunks/Point2D.js";import{P as v,b as N}from"../../../chunks/Envelope.js";import{O as S}from"../../../chunks/OperatorClip.js";import{O as w}from"../../../chunks/OperatorMultiPartToSinglePart.js";import{O as C}from"../../../chunks/OperatorCut.js";function k(t,e,s,r,n){return new j(n).findSlicesByArea(t,e,s,r)}function X(t,e,s,r,n){return new j(n).sliceIntoStrips(t,e,s,r)}function P(t,e,s,r){return new j(r).recursiveSliceEqualArea(t,e,s)}function H(t){this.currentX=this.calcX(t)}function b(t){if(null===this.curve){const e=(t-this.y0)/(this.y1-this.y0);return E(this.x0,this.x1,e)}return this.curve.intersectionOfYMonotonicWithAxisX(t,this.x0)}function Y(){return{x0:Number.NaN,y0:Number.NaN,x1:Number.NaN,y1:Number.NaN,currentX:Number.NaN,nextAET:null,prevAET:null,startNodeNext:null,nextInChain:null,curve:null,advance:H,calcX:b}}function I(t,e){const s=Y();return s.x0=t.getStartX(),s.y0=t.getStartY(),s.x1=t.getEndX(),s.y1=t.getEndY(),e&&(s.y0=A(s.x0,s.x0=s.y0),s.y1=A(s.x1,s.x1=s.y1)),s.y1<s.y0&&(s.y1=A(s.y0,s.y0=s.y1),s.x1=A(s.x0,s.x0=s.x1)),s.currentX=Number.NaN,s.nextAET=null,s.prevAET=null,s.startNodeNext=null,s.nextInChain=null,s.curve=null,s}function O(t){const e=Y();return e.x0=t.getStartX(),e.y0=t.getStartY(),e.x1=t.getEndX(),e.y1=t.getEndY(),e.curve=t,e.y1<e.y0&&(e.y1=A(e.y0,e.y0=e.y1),e.x1=A(e.x0,e.x0=e.x1)),e.currentX=Number.NaN,e.nextAET=null,e.prevAET=null,e.startNodeNext=null,e.nextInChain=null,e}function q(t){if(this.x===t.x&&this.y===t.y){const e=null!==this.endEdge,s=null!==t.startEdge;return e&&s?-1:1}return this.y!==t.y?this.y-t.y:this.x-t.x}function R(){return{x:Number.NaN,y:Number.NaN,startEdge:null,endEdge:null,compare:q}}function D(t,e){return{y:t,startingEdges:e}}class M{constructor(t,e,s,r,n,i){this.m_parent=t,this.m_y0=e,this.m_y1=s,this.m_t0=r,this.m_area=i}getMaxDerivative(){return 1}getValue(t,e){return 1===t?0:this.getArea(e)-this.m_area}getError(t){return r(0),0}getArea(t){const e=.5*(this.m_parent.m_sumBase-this.m_parent.m_sumA),s=this.m_y1-this.m_y0;let r=(this.m_parent.m_sumBase-e*(t+this.m_t0))*s*(t-this.m_t0),n=!1;for(let i=this.m_parent.m_AETHead;null!==i;i=i.nextAET)if(n=!n,n&&(null!==i.curve||null!==i.nextAET.curve)){const e=this.m_y0+s*this.m_t0,n=this.m_y0+s*t;i.curve&&(r+=V(i.curve,this.m_y0+s*this.m_t0,this.m_y0+s*t)),i.nextAET.curve&&(r-=V(i.nextAET.curve,this.m_y0+s*this.m_t0,this.m_y0+s*t));r+=(n-e)*(i.nextAET.calcX(e)-i.calcX(e)+(i.nextAET.calcX(n)-i.calcX(n)))*.5}return r}}function B(t,e,s){return{polygon:t,from:e,to:s}}function V(t,e,s){const n=[0,0],i=t.intersectionWithAxis2D(!0,e,null,n);r(1===i);const o=n[0],a=t.intersectionWithAxis2D(!0,s,null,n);r(1===a);const u=n[0],l=x(T,4);g(t,l,!0);const h=l[3],m=l[2],c=l[1],p=t.getCoordX(o)-t.getStartX(),_=t.getCoordY(o)-t.getStartY(),f=t=>{const e=t*t;return e*t*(10*(m.x*c.y-m.y*c.x)-15*t*(h.y*c.x-h.x*c.y)+6*e*(m.y*h.x-h.y*m.x))/60},y=t=>(-t*(c.y+t*(m.y+h.y*t))*p+t*(c.x+t*(m.x+h.x*t))*_)/2;return f(u)-f(o)-(y(u)-y(o))}class z extends t{constructor(t){super(),this.m_geoms=[],this.m_index=-1,this.m_id=-1,this.m_geoms=t}tock(){return!0}getRank(){return 1}next(){return this.m_index++,this.m_index>=this.m_geoms.length?null:(this.m_id=this.m_geoms[this.m_index].second,this.m_geoms[this.m_index].first)}getGeometryID(){return this.m_id}}class j{constructor(t){this.m_edges=[],this.m_curves=[],this.m_sortedNodes=[],this.m_sortHelper=[],this.m_cuts=[],this.m_cutAreas=[],this.m_totalAreaOfTraps=new f(0),this.m_areaTracking=0,this.m_splitArea=0,this.m_sumBase=0,this.m_sumA=0,this.m_numberOfCuts=0,this.m_currentScan=0,this.m_progressCounter=0,this.m_AETHead=null,this.m_bHorizontalSweep=!1,this.m_bPolygonHasCurves=!1,this.m_progressTracker=t}findSlicesByArea(t,e,r,n){n<0&&s("remainingArea");let i=t,a=null;i.hasNonLinearSegments()&&(this.m_bPolygonHasCurves=!0,a=o(t,1e-16,!0),G(a),i=a);const u=Math.abs(i.calculateArea2D());return 0===u||0===r||n>=u||1===r&&0===n?[]:(this.m_splitArea=(u-n)/r,this.m_numberOfCuts=r-1,n>0&&this.m_numberOfCuts++,this.m_edges.length=0,this.m_sortedNodes.length=0,this.m_cuts.length=0,this.m_areaTracking=0,this.m_totalAreaOfTraps.reset(),this.m_curves.length=0,this.buildEdges(i),this.buildScanNodes(),this.trapezoidation(),this.m_cuts)}sliceIntoStrips(t,s,r,i){if(0===i)return new e([t]);const o=new n;t.queryLooseEnvelope(o);const a=o.width()+o.height();return new z(this.splitPolygon(t,s,o.xmin-a-1+1,o.xmax+a+1,r,i))}recursiveSliceEqualArea(t,s,o){if(o<=1||t.isEmpty())return new e([t]);{const e=[],a=[];a.push(y(t.clone(),o));let u=0,l=0;for(;a.length>0;){r(l++<2*o);const t=a.at(-1);if(a.pop(),1===t.second){e.push(y(t.first,u++));continue}const h=new n;t.first.queryEnvelope(h);const m=h.width()+h.height(),c=new i;c.setIdentity(),h.width()>h.height()&&(c.setRotateCcw90(),t.first.applyTransformation(c),c.transformEnvInPlace(h));const p=t.first.calculateArea2D(),_=p/t.second,g=p-Math.trunc(t.second/2)*_,f=new j(this.m_progressTracker).findSlicesByArea(t.first,s,1,g),d=new j(this.m_progressTracker).splitPolygon(t.first,s,h.xmin-m-1+1,h.xmax+m+1,f,1),x=d.length;if(r(x>0&&x<=2),!c.isIdentity()){const t=new i;t.setRotateCw90(),d[0].first.applyTransformation(t),2===x&&d[1].first.applyTransformation(t)}2===x?(a.push(y(d[1].first,t.second-Math.trunc(t.second/2))),a.push(y(d[0].first,Math.trunc(t.second/2)))):a.push(y(d[0].first,t.second))}return new z(e)}}recursiveSliceEqualAreaImpl(t,e,s,n){return r(0),{}}processTraps(t,e,s){s?this.processTrapsCurves(t,e):this.processTrapsLinear(t,e)}processTrapsLinear(t,e){let s=0,r=1;const n=.5*(this.m_sumBase-this.m_sumA),i=e-t,o=(this.m_sumBase-n*(r+s))*i*(r-s);if(o+this.m_areaTracking<this.m_splitArea)return this.m_totalAreaOfTraps.pe(o),void(this.m_areaTracking+=o);const u=new f(o),l=new d(0,1);let h=!1;for(;s<1;){const e=this.m_splitArea-this.m_areaTracking,m=[Number.NaN,Number.NaN];if(!(a(-n*i,this.m_sumBase*i,(n*s-this.m_sumBase)*i*s-e,l,!1,m)>0)){h?this.m_areaTracking=u.getResult():this.m_areaTracking+=o;break}{h=!0,r=m[0],this.m_areaTracking=0,s=r,u.me(e);const n=r*i+t;if(this.m_cuts.push(n),this.m_cutAreas.push(this.m_totalAreaOfTraps.getResult()+o-u.getResult()),this.m_cuts.length===this.m_numberOfCuts)return void this.m_totalAreaOfTraps.pe(o-u.getResult())}}this.m_totalAreaOfTraps.pe(o)}processTrapsCurves(t,e){let s=0,r=1;const n=new M(this,t,e,0,1,0).getArea(1);if(n+this.m_areaTracking<this.m_splitArea)return this.m_totalAreaOfTraps.pe(n),void(this.m_areaTracking+=n);const i=e-t,o=new f(n);let a=!1;for(;s<1;){const l=this.m_splitArea-this.m_areaTracking,h=new M(this,t,e,s,1,l),m=[0],c=new d(s,1);if(!(u(h,c,1,m)>0)){a?this.m_areaTracking=o.getResult():this.m_areaTracking+=n;break}{a=!0,r=m[0],this.m_areaTracking=0,s=r,o.me(l);const e=r*i+t;if(this.m_cuts.push(e),this.m_cutAreas.push(this.m_totalAreaOfTraps.getResult()+n-o.getResult()),this.m_cuts.length===this.m_numberOfCuts)return void this.m_totalAreaOfTraps.pe(n-o.getResult())}}this.m_totalAreaOfTraps.pe(n)}advanceAET(){const t=this.m_sortedNodes[this.m_currentScan-1].y,e=this.m_sortedNodes[this.m_currentScan];let s=!1,r=!1;const n=new f(0);for(let a=this.m_AETHead;null!==a;a=a.nextAET){const t=a.prevAET;s=!s,null!==a.nextAET&&s&&(this.m_bPolygonHasCurves&&(a.curve||a.nextAET.curve)||n.pe(a.nextAET.currentX-a.currentX)),a.advance(e.y),null!==t&&a.currentX<t.currentX&&(r=!0)}this.m_sumBase=n.getResult(),r&&this.sortAET();const i=new f(0);s=!1;let o=!1;for(let a=this.m_AETHead;null!==a;a=a.nextAET){o=o||null!==a.curve;s=!s,null!==a.prevAET&&(s||this.m_bPolygonHasCurves&&(a.curve||a.prevAET.curve)||i.pe(a.currentX-a.prevAET.currentX))}this.m_sumA=i.getResult(),this.processTraps(t,e.y,o);for(let a=this.m_AETHead;null!=a;){const t=a.prevAET,s=a.nextAET;if(e.y===a.y1)if(a.prevAET=null,a.nextAET=null,null!==a.nextInChain){const e=a.currentX;a=a.nextInChain,a.currentX=e,a.prevAET=t,t?t.nextAET=a:this.m_AETHead=a,a.nextAET=s,s&&(s.prevAET=a)}else t?t.nextAET=s:this.m_AETHead=s,s&&(s.prevAET=t);a=s}}mergeNewEdgesToAET(){for(let r=this.m_sortedNodes[this.m_currentScan].startingEdges;null!==r;r=r.startNodeNext)Number.isNaN(r.currentX)&&(this.m_sortHelper.push(r),r.currentX=r.x0);if(!this.m_sortHelper.length)return;this.sortHelper();let t=this.m_AETHead,e=0,s=t;for(;null!==t&&e<this.m_sortHelper.length;)t.currentX>this.m_sortHelper[e].currentX?(this.m_sortHelper[e].prevAET=t.prevAET,t.prevAET?t.prevAET.nextAET=this.m_sortHelper[e]:this.m_AETHead=this.m_sortHelper[e],this.m_sortHelper[e].nextAET=t,t.prevAET=this.m_sortHelper[e],e++):(s=t,t=t.nextAET);for(;e<this.m_sortHelper.length;)this.m_sortHelper[e].prevAET=s,null!==s?s.nextAET=this.m_sortHelper[e]:this.m_AETHead=this.m_sortHelper[e],this.m_sortHelper[e].nextAET=null,s=this.m_sortHelper[e],e++;this.m_sortHelper.length=0}sortAET(){for(let e=this.m_AETHead;null!==e;e=e.nextAET)this.m_sortHelper.push(e);this.sortHelper(),this.m_AETHead=null;let t=null;for(const e of this.m_sortHelper)e.prevAET=t,t?t.nextAET=e:this.m_AETHead=e,e.nextAET=null,t=e;this.m_sortHelper.length=0}sortHelper(){this.m_sortHelper.sort((t,e)=>t.currentX-e.currentX)}trapezoidation(){for(this.m_currentScan=0,this.mergeNewEdgesToAET(),this.m_currentScan++;this.m_currentScan<this.m_sortedNodes.length&&(this.progress(),this.advanceAET(),this.m_cuts.length!==this.m_numberOfCuts);)this.mergeNewEdgesToAET(),this.m_currentScan++}buildEdges(t){const e=t.querySegmentIterator();for(e.stripAttributes();e.nextPath();)for(;e.hasNextSegment();){const t=e.nextSegment();if(t.isCurve()){const e=t;if(l(e),this.m_bHorizontalSweep){const t=x(T,4);e.queryControlPoints(t);for(const e of t)e.y=A(e.x,e.x=e.y);e.constructPoints(t)}const s=e.getStartY(),r=e.getEndY();if(r===s)continue;r<s&&e.reverse(),this.m_curves.push(e.clone()),this.m_edges.push(O(this.m_curves.at(-1)))}else{const e=this.m_bHorizontalSweep?t.getStartX():t.getStartY();if((this.m_bHorizontalSweep?t.getEndX():t.getEndY())===e)continue;this.m_edges.push(I(t,this.m_bHorizontalSweep))}}this.m_edges.sort((t,e)=>t.y0===e.y0?t.x0-e.x0:t.y0-e.y0)}buildScanNodes(){const t=[];for(const n of this.m_edges){const e=R();e.x=n.x0,e.y=n.y0,e.startEdge=n,e.endEdge=null,t.push(e);const s=R();s.x=n.x1,s.y=n.y1,s.startEdge=null,s.endEdge=n,t.push(s)}t.sort((t,e)=>t.compare(e));let e=0,s=t[e].y;this.m_sortedNodes.push(D(s,t[e].startEdge));let r=e;for(e++;e!==t.length;++e){t[e].y!==s&&(this.m_sortedNodes.push(D(t[e].y,null)),s=t[e].y);const n=t[e].startEdge;if(n){const t=this.m_sortedNodes.at(-1);n.startNodeNext=t.startingEdges,t.startingEdges=n}if(t[r].x!==t[e].x||t[r].y!==t[e].y){if(e-r===2){let e=r;e++,null!==t[r].endEdge&&null!==t[e].startEdge&&(t[r].endEdge.nextInChain=t[e].startEdge)}r=e}}}progress(){}splitPolygonLinear(t,s,i,o,a,u){const l=[];l.push([t,0,u]);const m=[],c=new h;for(c.startPathCoords(i,0),c.lineToCoords(o,0);l.length>0;){const h=l.at(-1);l.pop();const p=h[0],_=h[1],g=h[2],f=(new w).executeMany(new e([p]),s,this.m_progressTracker);for(let e=f.next();null!==e;e=f.next()){const h=e,p=new n;h.queryLooseEnvelope(p);let f=_,d=g;for(let t=_,e=g-1;t<g;++t,--e)p.ymin>=a[t]&&(f=t+1),p.ymax<=a[e]&&(d=e);if(f!==g)if(d!==_)if(f!==d)if(this.isYMonotone(h))this.splitYMonotone(m,h,s,a,f,d);else{const e=Math.trunc((f+d)/2);c.setXYCoords(0,i,a[e]),c.setXYCoords(1,o,a[e]);const _=(new C).execute(!1,h,c,null,this.m_progressTracker),g=_.next(),x=_.next(),T=_.next();if(null!==g){if(g.isEmpty()||(e===d-1?(m.push(y(g,e)),r(L(m.at(-1).first,s,t,m.at(-1).second,a,u))):l.push([g,e+1,d])),x.isEmpty()||(e===f?(m.push(y(x,e-1)),r(L(m.at(-1).first,s,t,m.at(-1).second,a,u))):l.push([x,f,e])),null!==T&&!T.isEmpty()){const t=new n;T.queryLooseEnvelope(t),t.ymin>=a[e]?l.push([T,e+1,d]):t.ymax<=a[e]?l.push([T,f,e]):l.push([T,f,d])}}else e+1===d?(a[e]-p.ymin<p.ymax-a[e]?m.push(y(h,e)):m.push(y(h,e+1)),r(L(m.at(-1).first,s,t,m.at(-1).second,a,u))):l.push([h,e+1,d])}else m.push(y(e,f-1));else m.push(y(e,_-1));else m.push(y(e,g-1))}}return m}splitPolygon(t,e,s,r,i,o){const a=new n;t.queryLooseEnvelope(a),a.inflateCoords(0,Math.max(a.width(),a.height()));const u=[],l=[];for(l.push(B(t,0,o));l.length;){const o={...l.at(-1)};if(l.pop(),o.polygon.hasNonLinearSegments()){const t=Math.trunc((o.to+o.from)/2),h=i[t],m=new n(s,a.ymin,r,h),c=(new S).execute(o.polygon,m,e,this.m_progressTracker);c.isEmpty()||(t-o.from===0?u.push(y(c,t-1)):l.push(B(c,o.from,t)));const p=new n(s,h,r,a.ymax),_=(new S).execute(o.polygon,p,e,this.m_progressTracker);_.isEmpty()||(o.to-t===1?u.push(y(_,t)):l.push(B(_,t+1,o.to)))}else{const n=this.splitPolygonLinear(t,e,s,r,i.slice(o.from),o.to-o.from);u.push(...n)}}u.sort((t,e)=>t.second-e.second);const h=[];return m(u,(t,e)=>t.second===e.second,(t,e)=>{const s=new _;for(let r=t;r!==e;++r)s.add(u[r].first,!1);h.push(y(s,u[t].second))}),h}isYMonotone(t){if(1!==t.getPathCount())return!1;const e=t.getXY(0);let s=0,r=0;const n=new T;for(let i=1,o=t.getPointCount();i<=o;i++){t.queryXY(i===o?0:i,n);const a=n.y>e.y?1:n.y<e.y?-1:0;if(e.setCoordsPoint2D(n),s!==a&&0!==a){if(0!==s&&(r++,r>2))return!1;s=a}}return!0}splitYMonotone(t,e,s,n,i,o){const a=new c;a.addGeometry(e);const u=a.getFirstPath(a.getFirstGeometry()),l=a.getFirstVertex(u),h=new T,m=new T;let _=l,g=l;{const t=a.getXY(l);h.setCoordsPoint2D(t),m.setCoordsPoint2D(t)}let f=a.getNextVertex(l);const d=new T;for(let r=0,c=a.getPathSize(u);r<c;r++,f=a.getNextVertex(f))a.queryXY(f,d),d.compare(h)<0?(_=f,h.setCoordsPoint2D(d)):d.compare(m)>0&&(g=f,m.setCoordsPoint2D(d));let x=_,A=_,E=x,v=A,N=!1,S=!1,w=i,C=h.y,k=h.y,X=!1;for(;w<o;)if(n[w]<=h.y)w++;else{if(n[w]>=m.y)break;if(!N){const t=a.getNextVertex(x),e=a.getY(t);if(e<C)break;const s=n[w];C<=s&&e>=s?N=!0:(C=e,x=t)}if(!S){const t=a.getPrevVertex(A),e=a.getY(t);if(e<k)break;const s=n[w];k<=s&&e>=s?S=!0:(k=e,A=t)}if(N&&S){X=!0;let e=a.getXY(x);const s=a.getNextVertex(x);let i=a.getXY(s),o=p;if(i.y===e.y)o=i.x<e.x?x:s;else{const t=(n[w]-e.y)/(i.y-e.y);if(0===t)o=x;else if(1===t)o=s;else{const e=a.splitSegmentAxisAware(x,[t],1,null,-1);r(1===e),o=a.getNextVertex(x),a.getY(o)!==n[w]&&a.setXYCoords(o,a.getX(o),n[w])}}const u=a.getPrevVertex(A);e=a.getXY(u),i=a.getXY(A);let l=p;if(i.y===e.y)l=i.x<e.x?A:u;else{const t=(n[w]-e.y)/(i.y-e.y);if(0===t)l=u;else if(1===t)l=A;else{const e=a.splitSegmentAxisAware(u,[t],1,null,-1);r(1===e),l=a.getNextVertex(u),a.getY(l)!==n[w]&&a.setXYCoords(l,a.getX(l),n[w])}}t.push(y(this.extractTrapezoid(a,E,o,v,l),w-1)),E=o,v=l,x=o,A=l,C=k=n[w],N=!1,S=!1,w++}}X?t.push(y(this.extractTrapezoid(a,E,g,v,g),w-1)):t.push(y(e,w))}extractTrapezoid(t,e,s,r,n){const i=new _({vd:t.getVertexDescription()}),o=new v;let a=!0;for(let u=e;;u=t.getNextVertex(u)){const e=t.getSegment(u);if(e?i.addSegment(e,a):(t.queryPoint(u,o),a?i.startPathPoint(o):i.lineToPoint(o)),a=!1,u===s)break}s!==n&&(t.queryPoint(n,o),i.lineToPoint(o)),a=!0;for(let u=n;;u=t.getNextVertex(u)){const s=t.getSegment(u);if(s?i.addSegment(s,a):a||u===e||(t.queryPoint(u,o),i.lineToPoint(o)),a=!1,u===r)break}return i}}function G(t){return t.getImpl().ensureXYMonotoneSegments()}function L(t,e,s,r,i,o){const a=new n;t.queryEnvelope(a);const u=4*N(e,s,!0).total();return(!(r>=0)||a.ymin+u>=i[r])&&!(r+1<o&&a.ymax>i[r+1]+u)}class F{getOperatorType(){return 10011}accelerateGeometry(t,e,s){return!1}canAccelerateGeometry(t){return!1}supportsCurves(){return!0}sliceIntoStrips(t,e,s,r,n,i){return new W(0,t,e,s,n,0,i)}findSlicesByArea(t,e,s,r,n,i){if(!n||n.isIdentity())return k(t,e,s,r,i);{const o=t.clone();return o.applyTransformation(n),k(o,e,s,r,i)}}recursiveSliceEqualArea(t,e,s,r,n){return new W(1,t,e,null,r,s,n)}}class W extends t{constructor(t,e,s,r,n,i,o){super(),this.m_resultCursor=null,this.m_method=t,this.m_polygon=e,this.m_sr=s,this.m_ySplits=r?.slice()??null,this.m_transform=n,this.m_bReversePaths=n?.isReflective()??!1,this.m_inverseTransform=n?n.clone().invertThis():null,this.m_partCount=i,this.m_tracker=o}tock(){return!0}getRank(){return 1}next(){this.m_resultCursor||(this.m_method?this.recursiveSliceEqualArea():this.sliceIntoStrips());const t=this.m_resultCursor.next();return t?(this.m_inverseTransform&&!this.m_inverseTransform.isIdentity()&&(t.applyTransformation(this.m_inverseTransform),this.m_bReversePaths&&t.reverseAllPaths()),t):t}getGeometryID(){return this.m_resultCursor?this.m_resultCursor.getGeometryID():-1}sliceIntoStrips(){if(!this.m_transform||this.m_transform.isIdentity())this.m_resultCursor=X(this.m_polygon,this.m_sr,this.m_ySplits,this.m_ySplits.length,this.m_tracker);else{const t=this.m_polygon.clone();t.applyTransformation(this.m_transform),this.m_bReversePaths&&t.reverseAllPaths(),this.m_resultCursor=X(t,this.m_sr,this.m_ySplits,this.m_ySplits.length,this.m_tracker)}}recursiveSliceEqualArea(){if(!this.m_transform||this.m_transform.isIdentity())this.m_resultCursor=P(this.m_polygon,this.m_sr,this.m_partCount,this.m_tracker);else{const t=this.m_polygon.clone();t.applyTransformation(this.m_transform),this.m_bReversePaths&&t.reverseAllPaths(),this.m_resultCursor=P(t,this.m_sr,this.m_partCount,this.m_tracker)}}}const K=new F;function J(t,e,s,r,n){return K.findSlicesByArea(t,e,s,r,n,null)}function Q(t,e,s,r){const n=K.recursiveSliceEqualArea(t,e,s,r,null);return Array.from(n)}function U(t,e,s,r){const n=K.sliceIntoStrips(t,e,s,0,r,null);return Array.from(n)}function Z(){return K.supportsCurves()}export{J as findSlicesByArea,Q as recursiveSliceEqualArea,U as sliceIntoStrips,Z as supportsCurves};
5
+ import{G as t,S as e}from"../../../chunks/SimpleGeometryCursor.js";import{a as s,g as r}from"../../../chunks/Geometry.js";import{Envelope2D as n}from"../../../chunks/Envelope2D.js";import{T as i}from"../../../chunks/Transformation2D.js";import{p as o,q as a,t as l,u,P as h,v as m,E as c,n as p,a as _,w as g}from"../../../chunks/MultiPathImpl.js";import{K as f,l as y,E as d,m as x,P as T,c as A,q as E}from"../../../chunks/Point2D.js";import{P as v,b as N}from"../../../chunks/Envelope.js";import{O as S}from"../../../chunks/OperatorClip.js";import{O as w}from"../../../chunks/OperatorMultiPartToSinglePart.js";import{O as C}from"../../../chunks/OperatorCut.js";function X(t,e,s,r,n){return new j(n).findSlicesByArea(t,e,s,r)}function k(t,e,s,r,n){return new j(n).sliceIntoStrips(t,e,s,r)}function P(t,e,s,r){return new j(r).recursiveSliceEqualArea(t,e,s)}function H(t){this.currentX=this.calcX(t)}function b(t){if(null===this.curve){const e=(t-this.y0)/(this.y1-this.y0);return E(this.x0,this.x1,e)}return this.curve.intersectionOfYMonotonicWithAxisX(t,this.x0)}function Y(){return{x0:Number.NaN,y0:Number.NaN,x1:Number.NaN,y1:Number.NaN,currentX:Number.NaN,nextAET:null,prevAET:null,startNodeNext:null,nextInChain:null,curve:null,advance:H,calcX:b}}function I(t,e){const s=Y();return s.x0=t.getStartX(),s.y0=t.getStartY(),s.x1=t.getEndX(),s.y1=t.getEndY(),e&&(s.y0=A(s.x0,s.x0=s.y0),s.y1=A(s.x1,s.x1=s.y1)),s.y1<s.y0&&(s.y1=A(s.y0,s.y0=s.y1),s.x1=A(s.x0,s.x0=s.x1)),s.currentX=Number.NaN,s.nextAET=null,s.prevAET=null,s.startNodeNext=null,s.nextInChain=null,s.curve=null,s}function O(t){const e=Y();return e.x0=t.getStartX(),e.y0=t.getStartY(),e.x1=t.getEndX(),e.y1=t.getEndY(),e.curve=t,e.y1<e.y0&&(e.y1=A(e.y0,e.y0=e.y1),e.x1=A(e.x0,e.x0=e.x1)),e.currentX=Number.NaN,e.nextAET=null,e.prevAET=null,e.startNodeNext=null,e.nextInChain=null,e}function q(t){if(this.x===t.x&&this.y===t.y){const e=null!==this.endEdge,s=null!==t.startEdge;return e&&s?-1:1}return this.y!==t.y?this.y-t.y:this.x-t.x}function R(){return{x:Number.NaN,y:Number.NaN,startEdge:null,endEdge:null,compare:q}}function D(t,e){return{y:t,startingEdges:e}}class M{constructor(t,e,s,r,n,i){this.m_parent=t,this.m_y0=e,this.m_y1=s,this.m_t0=r,this.m_area=i}getMaxDerivative(){return 1}getValue(t,e){return 1===t?0:this.getArea(e)-this.m_area}getError(t){return r(0),0}getArea(t){const e=.5*(this.m_parent.m_sumBase-this.m_parent.m_sumA),s=this.m_y1-this.m_y0;let r=(this.m_parent.m_sumBase-e*(t+this.m_t0))*s*(t-this.m_t0),n=!1;for(let i=this.m_parent.m_AETHead;null!==i;i=i.nextAET)if(n=!n,n&&(null!==i.curve||null!==i.nextAET.curve)){const e=this.m_y0+s*this.m_t0,n=this.m_y0+s*t;i.curve&&(r+=V(i.curve,this.m_y0+s*this.m_t0,this.m_y0+s*t)),i.nextAET.curve&&(r-=V(i.nextAET.curve,this.m_y0+s*this.m_t0,this.m_y0+s*t));r+=(n-e)*(i.nextAET.calcX(e)-i.calcX(e)+(i.nextAET.calcX(n)-i.calcX(n)))*.5}return r}}function B(t,e,s){return{polygon:t,from:e,to:s}}function V(t,e,s){const n=[0,0],i=t.intersectionWithAxis2D(!0,e,null,n);r(1===i);const o=n[0],a=t.intersectionWithAxis2D(!0,s,null,n);r(1===a);const l=n[0],u=x(T,4);g(t,u,!0);const h=u[3],m=u[2],c=u[1],p=t.getCoordX(o)-t.getStartX(),_=t.getCoordY(o)-t.getStartY(),f=t=>{const e=t*t;return e*t*(10*(m.x*c.y-m.y*c.x)-15*t*(h.y*c.x-h.x*c.y)+6*e*(m.y*h.x-h.y*m.x))/60},y=t=>(-t*(c.y+t*(m.y+h.y*t))*p+t*(c.x+t*(m.x+h.x*t))*_)/2;return f(l)-f(o)-(y(l)-y(o))}class z extends t{constructor(t){super(),this.m_geoms=[],this.m_index=-1,this.m_id=-1,this.m_geoms=t}tock(){return!0}getRank(){return 1}next(){return this.m_index++,this.m_index>=this.m_geoms.length?null:(this.m_id=this.m_geoms[this.m_index].second,this.m_geoms[this.m_index].first)}getGeometryID(){return this.m_id}}class j{constructor(t){this.m_edges=[],this.m_curves=[],this.m_sortedNodes=[],this.m_sortHelper=[],this.m_cuts=[],this.m_cutAreas=[],this.m_totalAreaOfTraps=new f(0),this.m_areaTracking=0,this.m_splitArea=0,this.m_sumBase=0,this.m_sumA=0,this.m_numberOfCuts=0,this.m_currentScan=0,this.m_progressCounter=0,this.m_AETHead=null,this.m_bHorizontalSweep=!1,this.m_bPolygonHasCurves=!1,this.m_progressTracker=t}findSlicesByArea(t,e,r,n){n<0&&s("remainingArea");let i=t,a=null;i.hasNonLinearSegments()&&(this.m_bPolygonHasCurves=!0,a=o(t,1e-16,!0),G(a),i=a);const l=Math.abs(i.calculateArea2D());return 0===l||0===r||n>=l||1===r&&0===n?[]:(this.m_splitArea=(l-n)/r,this.m_numberOfCuts=r-1,n>0&&this.m_numberOfCuts++,this.m_edges.length=0,this.m_sortedNodes.length=0,this.m_cuts.length=0,this.m_areaTracking=0,this.m_totalAreaOfTraps.reset(),this.m_curves.length=0,this.buildEdges(i),this.buildScanNodes(),this.trapezoidation(),this.m_cuts)}sliceIntoStrips(t,s,r,i){if(0===i)return new e([t]);const o=new n;t.queryLooseEnvelope(o);const a=o.width()+o.height();return new z(this.splitPolygon(t,s,o.xmin-a-1+1,o.xmax+a+1,r,i))}recursiveSliceEqualArea(t,s,o){if(o<=1||t.isEmpty())return new e([t]);{const e=[],a=[];a.push(y(t.clone(),o));let l=0,u=0;for(;a.length>0;){r(u++<2*o);const t=a.at(-1);if(a.pop(),1===t.second){e.push(y(t.first,l++));continue}const h=new n;t.first.queryEnvelope(h);const m=h.width()+h.height(),c=new i;c.setIdentity(),h.width()>h.height()&&(c.setRotateCcw90(),t.first.applyTransformation(c),c.transformEnvInPlace(h));const p=t.first.calculateArea2D(),_=p/t.second,g=p-Math.trunc(t.second/2)*_,f=new j(this.m_progressTracker).findSlicesByArea(t.first,s,1,g),d=new j(this.m_progressTracker).splitPolygon(t.first,s,h.xmin-m-1+1,h.xmax+m+1,f,1),x=d.length;if(r(x>0&&x<=2),!c.isIdentity()){const t=new i;t.setRotateCw90(),d[0].first.applyTransformation(t),2===x&&d[1].first.applyTransformation(t)}2===x?(a.push(y(d[1].first,t.second-Math.trunc(t.second/2))),a.push(y(d[0].first,Math.trunc(t.second/2)))):a.push(y(d[0].first,t.second))}return new z(e)}}recursiveSliceEqualAreaImpl(t,e,s,n){return r(0),{}}processTraps(t,e,s){s?this.processTrapsCurves(t,e):this.processTrapsLinear(t,e)}processTrapsLinear(t,e){let s=0,r=1;const n=.5*(this.m_sumBase-this.m_sumA),i=e-t,o=(this.m_sumBase-n*(r+s))*i*(r-s);if(o+this.m_areaTracking<this.m_splitArea)return this.m_totalAreaOfTraps.pe(o),void(this.m_areaTracking+=o);const l=new f(o),u=new d(0,1);let h=!1;for(;s<1;){const e=this.m_splitArea-this.m_areaTracking,m=[Number.NaN,Number.NaN];if(!(a(-n*i,this.m_sumBase*i,(n*s-this.m_sumBase)*i*s-e,u,!1,m)>0)){h?this.m_areaTracking=l.getResult():this.m_areaTracking+=o;break}{h=!0,r=m[0],this.m_areaTracking=0,s=r,l.me(e);const n=r*i+t;if(this.m_cuts.push(n),this.m_cutAreas.push(this.m_totalAreaOfTraps.getResult()+o-l.getResult()),this.m_cuts.length===this.m_numberOfCuts)return void this.m_totalAreaOfTraps.pe(o-l.getResult())}}this.m_totalAreaOfTraps.pe(o)}processTrapsCurves(t,e){let s=0,r=1;const n=new M(this,t,e,0,1,0).getArea(1);if(n+this.m_areaTracking<this.m_splitArea)return this.m_totalAreaOfTraps.pe(n),void(this.m_areaTracking+=n);const i=e-t,o=new f(n);let a=!1;for(;s<1;){const u=this.m_splitArea-this.m_areaTracking,h=new M(this,t,e,s,1,u),m=[0],c=new d(s,1);if(!(l(h,c,1,m)>0)){a?this.m_areaTracking=o.getResult():this.m_areaTracking+=n;break}{a=!0,r=m[0],this.m_areaTracking=0,s=r,o.me(u);const e=r*i+t;if(this.m_cuts.push(e),this.m_cutAreas.push(this.m_totalAreaOfTraps.getResult()+n-o.getResult()),this.m_cuts.length===this.m_numberOfCuts)return void this.m_totalAreaOfTraps.pe(n-o.getResult())}}this.m_totalAreaOfTraps.pe(n)}advanceAET(){const t=this.m_sortedNodes[this.m_currentScan-1].y,e=this.m_sortedNodes[this.m_currentScan];let s=!1,r=!1;const n=new f(0);for(let a=this.m_AETHead;null!==a;a=a.nextAET){const t=a.prevAET;s=!s,null!==a.nextAET&&s&&(this.m_bPolygonHasCurves&&(a.curve||a.nextAET.curve)||n.pe(a.nextAET.currentX-a.currentX)),a.advance(e.y),null!==t&&a.currentX<t.currentX&&(r=!0)}this.m_sumBase=n.getResult(),r&&this.sortAET();const i=new f(0);s=!1;let o=!1;for(let a=this.m_AETHead;null!==a;a=a.nextAET){o=o||null!==a.curve;s=!s,null!==a.prevAET&&(s||this.m_bPolygonHasCurves&&(a.curve||a.prevAET.curve)||i.pe(a.currentX-a.prevAET.currentX))}this.m_sumA=i.getResult(),this.processTraps(t,e.y,o);for(let a=this.m_AETHead;null!=a;){const t=a.prevAET,s=a.nextAET;if(e.y===a.y1)if(a.prevAET=null,a.nextAET=null,null!==a.nextInChain){const e=a.currentX;a=a.nextInChain,a.currentX=e,a.prevAET=t,t?t.nextAET=a:this.m_AETHead=a,a.nextAET=s,s&&(s.prevAET=a)}else t?t.nextAET=s:this.m_AETHead=s,s&&(s.prevAET=t);a=s}}mergeNewEdgesToAET(){for(let r=this.m_sortedNodes[this.m_currentScan].startingEdges;null!==r;r=r.startNodeNext)Number.isNaN(r.currentX)&&(this.m_sortHelper.push(r),r.currentX=r.x0);if(!this.m_sortHelper.length)return;this.sortHelper();let t=this.m_AETHead,e=0,s=t;for(;null!==t&&e<this.m_sortHelper.length;)t.currentX>this.m_sortHelper[e].currentX?(this.m_sortHelper[e].prevAET=t.prevAET,t.prevAET?t.prevAET.nextAET=this.m_sortHelper[e]:this.m_AETHead=this.m_sortHelper[e],this.m_sortHelper[e].nextAET=t,t.prevAET=this.m_sortHelper[e],e++):(s=t,t=t.nextAET);for(;e<this.m_sortHelper.length;)this.m_sortHelper[e].prevAET=s,null!==s?s.nextAET=this.m_sortHelper[e]:this.m_AETHead=this.m_sortHelper[e],this.m_sortHelper[e].nextAET=null,s=this.m_sortHelper[e],e++;this.m_sortHelper.length=0}sortAET(){for(let e=this.m_AETHead;null!==e;e=e.nextAET)this.m_sortHelper.push(e);this.sortHelper(),this.m_AETHead=null;let t=null;for(const e of this.m_sortHelper)e.prevAET=t,t?t.nextAET=e:this.m_AETHead=e,e.nextAET=null,t=e;this.m_sortHelper.length=0}sortHelper(){this.m_sortHelper.sort((t,e)=>t.currentX-e.currentX)}trapezoidation(){for(this.m_currentScan=0,this.mergeNewEdgesToAET(),this.m_currentScan++;this.m_currentScan<this.m_sortedNodes.length&&(this.progress(),this.advanceAET(),this.m_cuts.length!==this.m_numberOfCuts);)this.mergeNewEdgesToAET(),this.m_currentScan++}buildEdges(t){const e=t.querySegmentIterator();for(e.stripAttributes();e.nextPath();)for(;e.hasNextSegment();){const t=e.nextSegment();if(t.isCurve()){const e=t;if(u(e),this.m_bHorizontalSweep){const t=x(T,4);e.queryControlPoints(t);for(const e of t)e.y=A(e.x,e.x=e.y);e.constructPoints(t)}const s=e.getStartY(),r=e.getEndY();if(r===s)continue;r<s&&e.reverse(),this.m_curves.push(e.clone()),this.m_edges.push(O(this.m_curves.at(-1)))}else{const e=this.m_bHorizontalSweep?t.getStartX():t.getStartY();if((this.m_bHorizontalSweep?t.getEndX():t.getEndY())===e)continue;this.m_edges.push(I(t,this.m_bHorizontalSweep))}}this.m_edges.sort((t,e)=>t.y0===e.y0?t.x0-e.x0:t.y0-e.y0)}buildScanNodes(){const t=[];for(const n of this.m_edges){const e=R();e.x=n.x0,e.y=n.y0,e.startEdge=n,e.endEdge=null,t.push(e);const s=R();s.x=n.x1,s.y=n.y1,s.startEdge=null,s.endEdge=n,t.push(s)}t.sort((t,e)=>t.compare(e));let e=0,s=t[e].y;this.m_sortedNodes.push(D(s,t[e].startEdge));let r=e;for(e++;e!==t.length;++e){t[e].y!==s&&(this.m_sortedNodes.push(D(t[e].y,null)),s=t[e].y);const n=t[e].startEdge;if(n){const t=this.m_sortedNodes.at(-1);n.startNodeNext=t.startingEdges,t.startingEdges=n}if(t[r].x!==t[e].x||t[r].y!==t[e].y){if(e-r===2){let e=r;e++,null!==t[r].endEdge&&null!==t[e].startEdge&&(t[r].endEdge.nextInChain=t[e].startEdge)}r=e}}}progress(){}splitPolygonLinear(t,s,i,o,a,l){const u=[];u.push([t,0,l]);const m=[],c=new h;for(c.startPathCoords(i,0),c.lineToCoords(o,0);u.length>0;){const h=u.at(-1);u.pop();const p=h[0],_=h[1],g=h[2],f=(new w).executeMany(new e([p]),s,this.m_progressTracker);for(let e=f.next();null!==e;e=f.next()){const h=e,p=new n;h.queryLooseEnvelope(p);let f=_,d=g;for(let t=_,e=g-1;t<g;++t,--e)p.ymin>=a[t]&&(f=t+1),p.ymax<=a[e]&&(d=e);if(f!==g)if(d!==_)if(f!==d)if(this.isYMonotone(h))this.splitYMonotone(m,h,s,a,f,d);else{const e=Math.trunc((f+d)/2);c.setXYCoords(0,i,a[e]),c.setXYCoords(1,o,a[e]);const _=(new C).execute(!1,h,c,null,this.m_progressTracker),g=_.next(),x=_.next(),T=_.next();if(null!==g){if(g.isEmpty()||(e===d-1?(m.push(y(g,e)),r(L(m.at(-1).first,s,t,m.at(-1).second,a,l))):u.push([g,e+1,d])),x.isEmpty()||(e===f?(m.push(y(x,e-1)),r(L(m.at(-1).first,s,t,m.at(-1).second,a,l))):u.push([x,f,e])),null!==T&&!T.isEmpty()){const t=new n;T.queryLooseEnvelope(t),t.ymin>=a[e]?u.push([T,e+1,d]):t.ymax<=a[e]?u.push([T,f,e]):u.push([T,f,d])}}else e+1===d?(a[e]-p.ymin<p.ymax-a[e]?m.push(y(h,e)):m.push(y(h,e+1)),r(L(m.at(-1).first,s,t,m.at(-1).second,a,l))):u.push([h,e+1,d])}else m.push(y(e,f-1));else m.push(y(e,_-1));else m.push(y(e,g-1))}}return m}splitPolygon(t,e,s,r,i,o){const a=new n;t.queryLooseEnvelope(a),a.inflateCoords(0,Math.max(a.width(),a.height()));const l=[],u=[];for(u.push(B(t,0,o));u.length;){const o={...u.at(-1)};if(u.pop(),o.polygon.hasNonLinearSegments()){const t=Math.trunc((o.to+o.from)/2),h=i[t],m=new n(s,a.ymin,r,h),c=(new S).execute(o.polygon,m,e,this.m_progressTracker);c.isEmpty()||(t-o.from===0?l.push(y(c,t-1)):u.push(B(c,o.from,t)));const p=new n(s,h,r,a.ymax),_=(new S).execute(o.polygon,p,e,this.m_progressTracker);_.isEmpty()||(o.to-t===1?l.push(y(_,t)):u.push(B(_,t+1,o.to)))}else{const n=this.splitPolygonLinear(t,e,s,r,i.slice(o.from),o.to-o.from);l.push(...n)}}l.sort((t,e)=>t.second-e.second);const h=[];return m(l,(t,e)=>t.second===e.second,(t,e)=>{const s=new _;for(let r=t;r!==e;++r)s.add(l[r].first,!1);h.push(y(s,l[t].second))}),h}isYMonotone(t){if(1!==t.getPathCount())return!1;const e=t.getXY(0);let s=0,r=0;const n=new T;for(let i=1,o=t.getPointCount();i<=o;i++){t.queryXY(i===o?0:i,n);const a=n.y>e.y?1:n.y<e.y?-1:0;if(e.setCoordsPoint2D(n),s!==a&&0!==a){if(0!==s&&(r++,r>2))return!1;s=a}}return!0}splitYMonotone(t,e,s,n,i,o){const a=new c;a.addGeometry(e);const l=a.getFirstPath(a.getFirstGeometry()),u=a.getFirstVertex(l),h=new T,m=new T;let _=u,g=u;{const t=a.getXY(u);h.setCoordsPoint2D(t),m.setCoordsPoint2D(t)}let f=a.getNextVertex(u);const d=new T;for(let r=0,c=a.getPathSize(l);r<c;r++,f=a.getNextVertex(f))a.queryXY(f,d),d.compare(h)<0?(_=f,h.setCoordsPoint2D(d)):d.compare(m)>0&&(g=f,m.setCoordsPoint2D(d));let x=_,A=_,E=x,v=A,N=!1,S=!1,w=i,C=h.y,X=h.y,k=!1;for(;w<o;)if(n[w]<=h.y)w++;else{if(n[w]>=m.y)break;if(!N){const t=a.getNextVertex(x),e=a.getY(t);if(e<C)break;const s=n[w];C<=s&&e>=s?N=!0:(C=e,x=t)}if(!S){const t=a.getPrevVertex(A),e=a.getY(t);if(e<X)break;const s=n[w];X<=s&&e>=s?S=!0:(X=e,A=t)}if(N&&S){k=!0;let e=a.getXY(x);const s=a.getNextVertex(x);let i=a.getXY(s),o=p;if(i.y===e.y)o=i.x<e.x?x:s;else{const t=(n[w]-e.y)/(i.y-e.y);if(0===t)o=x;else if(1===t)o=s;else{const e=a.splitSegmentAxisAware(x,[t],1,null,-1);r(1===e),o=a.getNextVertex(x),a.getY(o)!==n[w]&&a.setXYCoords(o,a.getX(o),n[w])}}const l=a.getPrevVertex(A);e=a.getXY(l),i=a.getXY(A);let u=p;if(i.y===e.y)u=i.x<e.x?A:l;else{const t=(n[w]-e.y)/(i.y-e.y);if(0===t)u=l;else if(1===t)u=A;else{const e=a.splitSegmentAxisAware(l,[t],1,null,-1);r(1===e),u=a.getNextVertex(l),a.getY(u)!==n[w]&&a.setXYCoords(u,a.getX(u),n[w])}}t.push(y(this.extractTrapezoid(a,E,o,v,u),w-1)),E=o,v=u,x=o,A=u,C=X=n[w],N=!1,S=!1,w++}}k?t.push(y(this.extractTrapezoid(a,E,g,v,g),w-1)):t.push(y(e,w))}extractTrapezoid(t,e,s,r,n){const i=new _({vd:t.getVertexDescription()}),o=new v;let a=!0;for(let l=e;;l=t.getNextVertex(l)){const e=t.getSegment(l);if(e?i.addSegment(e,a):(t.queryPoint(l,o),a?i.startPathPoint(o):i.lineToPoint(o)),a=!1,l===s)break}s!==n&&(t.queryPoint(n,o),i.lineToPoint(o)),a=!0;for(let l=n;;l=t.getNextVertex(l)){const s=t.getSegment(l);if(s?i.addSegment(s,a):a||l===e||(t.queryPoint(l,o),i.lineToPoint(o)),a=!1,l===r)break}return i}}function G(t){return t.getImpl().ensureXYMonotoneSegments()}function L(t,e,s,r,i,o){const a=new n;t.queryEnvelope(a);const l=4*N(e,s,!0).total();return(!(r>=0)||a.ymin+l>=i[r])&&!(r+1<o&&a.ymax>i[r+1]+l)}class F{getOperatorType(){return 10011}accelerateGeometry(t,e,s){return!1}canAccelerateGeometry(t){return!1}supportsCurves(){return!0}sliceIntoStrips(t,e,s,r,n,i){return new W(0,t,e,s,n,0,i)}findSlicesByArea(t,e,s,r,n,i){if(!n||n.isIdentity())return X(t,e,s,r,i);{const o=t.clone();return o.applyTransformation(n),X(o,e,s,r,i)}}recursiveSliceEqualArea(t,e,s,r,n){return new W(1,t,e,null,r,s,n)}}class W extends t{constructor(t,e,s,r,n,i,o){super(),this.m_resultCursor=null,this.m_method=t,this.m_polygon=e,this.m_sr=s,this.m_ySplits=r?.slice()??null,this.m_transform=n,this.m_bReversePaths=n?.isReflective()??!1,this.m_inverseTransform=n?n.clone().invertThis():null,this.m_partCount=i,this.m_tracker=o}tock(){return!0}getRank(){return 1}next(){this.m_resultCursor||(this.m_method?this.recursiveSliceEqualArea():this.sliceIntoStrips());const t=this.m_resultCursor.next();return t?(this.m_inverseTransform&&!this.m_inverseTransform.isIdentity()&&(t.applyTransformation(this.m_inverseTransform),this.m_bReversePaths&&t.reverseAllPaths()),t):t}getGeometryID(){return this.m_resultCursor?this.m_resultCursor.getGeometryID():-1}sliceIntoStrips(){if(!this.m_transform||this.m_transform.isIdentity())this.m_resultCursor=k(this.m_polygon,this.m_sr,this.m_ySplits,this.m_ySplits.length,this.m_tracker);else{const t=this.m_polygon.clone();t.applyTransformation(this.m_transform),this.m_bReversePaths&&t.reverseAllPaths(),this.m_resultCursor=k(t,this.m_sr,this.m_ySplits,this.m_ySplits.length,this.m_tracker)}}recursiveSliceEqualArea(){if(!this.m_transform||this.m_transform.isIdentity())this.m_resultCursor=P(this.m_polygon,this.m_sr,this.m_partCount,this.m_tracker);else{const t=this.m_polygon.clone();t.applyTransformation(this.m_transform),this.m_bReversePaths&&t.reverseAllPaths(),this.m_resultCursor=P(t,this.m_sr,this.m_partCount,this.m_tracker)}}}const K=new F;function J(t,e,s,r,n){return K.findSlicesByArea(t,e,s,r,n,null)}function Q(t,e,s,r){const n=K.recursiveSliceEqualArea(t,e,s,r,null);return Array.from(n)}function U(t,e,s,r){const n=K.sliceIntoStrips(t,e,s,0,r,null);return Array.from(n)}function Z(){return K.supportsCurves()}export{J as findSlicesByArea,Q as recursiveSliceEqualArea,U as sliceIntoStrips,Z as supportsCurves};
@@ -2,4 +2,4 @@
2
2
  All material copyright ESRI, All Rights Reserved, unless otherwise specified.
3
3
  See https://js.arcgis.com/4.34/esri/copyright.txt for details.
4
4
  */
5
- import{P as e}from"../../../chunks/Point2D.js";import"../../../chunks/Envelope2D.js";import{G as t}from"../../../chunks/Geometry.js";import{E as n,P as s}from"../../../chunks/Envelope.js";import{M as r}from"../../../chunks/MultiPathImpl.js";import{n as a,o}from"../../../chunks/UnitFactory.js";import i from"../../Extent.js";import u from"../../Multipoint.js";import c from"../../Point.js";import l from"../../Polygon.js";import m from"../../Polyline.js";import"./initNoPeFactory.js";import{fromGeometryToGXGeometry as h,toGeometry as f}from"./jsonConverter.js";const p="_gxVersion",g=2,y=1;function C(e){return Array.isArray(e)?e[0].spatialReference:e.spatialReference}function x(e){switch(e.type){case"point":return w(e);case"multipoint":return V(e);case"polyline":return P(e);case"polygon":return v(e);case"extent":return M(e);default:throw new Error(`Unsupported geometry type: ${e.type}`)}}function M(e){if(!e.getCacheValue(p)){const t=new n;t.setCoords(e.xmin,e.ymin,e.xmax,e.ymax),e.hasM&&t.setInterval(g,0,e.mmin,e.mmax),e.hasZ&&t.setInterval(y,0,e.zmin,e.zmax),e.setCacheValue(p,t)}return e.getCacheValue(p)}function V(e){if(!e.getCacheValue(p)){const t=new r,n=new s,a=e.points,o=e.hasM,i=e.hasZ,u=i?3:2;for(let e=0,s=a.length;e<s;e++){const s=a[e];n.setXYCoords(s[0],s[1]),i&&n.setZ(s[2]??0),o&&n.setM(s[u]??NaN),t.add(n)}e.setCacheValue(p,t)}return e.getCacheValue(p)}function w(e){if(!e.getCacheValue(p)){const t=new s;t.setXYCoords(e.x,e.y),e.hasM&&t.setM(e.m),e.hasZ&&t.setZ(e.z),e.setCacheValue(p,t)}return e.getCacheValue(p)}function v(e){if(!e.getCacheValue(p)){const{curveRings:t,hasM:n,hasZ:s,rings:r}=e,a=h({curveRings:t,hasM:n,hasZ:s,rings:r});e.setCacheValue(p,a)}return e.getCacheValue(p)}function P(e){if(!e.getCacheValue(p)){const{curvePaths:t,hasM:n,hasZ:s,paths:r}=e,a=h({curvePaths:t,hasM:n,hasZ:s,paths:r});e.setCacheValue(p,a)}return e.getCacheValue(p)}function Z(e){if(e.wkid)return a(e.wkid);const t=e.wkt2||e.wkt;return t?o(t):null}function j(e,n){if(e)switch(e.getGeometryType()){case t.enumPoint:return R(e,n);case t.enumEnvelope:return E(e,n);case t.enumMultiPoint:return k(e,n);case t.enumPolyline:return z(e,n);case t.enumPolygon:return d(e,n)}return null}function E(e,t){if(e.isEmpty())return null;const n=new i({xmin:e.getXMin(),ymin:e.getYMin(),xmax:e.getXMax(),ymax:e.getYMax(),spatialReference:t}),s=e.getDescription();if(s.hasM()){const t=e.queryInterval(g,0);n.mmin=t.vmin,n.mmax=t.vmax}if(s.hasZ()){const t=e.queryInterval(y,0);n.zmin=t.vmin,n.zmax=t.vmax}return n.setCacheValue(p,e),n}function k(e,t){if(e.isEmpty())return null;const n=e.getDescription(),r=n.hasM(),a=n.hasZ(),o=[],i=new s;for(let s=0,u=e.getPointCount();s<u;s++){e.getPointByVal(s,i);const t=[i.getX(),i.getY()];a&&t.push(i.getZ()),r&&t.push(i.getM()),o.push(t)}const c=new u({hasM:r,hasZ:a,points:o,spatialReference:t});return c.setCacheValue(p,e),c}function R(t,n){if(t instanceof e)return new c({x:t.x,y:t.y,spatialReference:n});if(t.isEmpty())return null;const s=new c({x:t.getX(),y:t.getY(),spatialReference:n}),r=t.getDescription();return r.hasM()&&(s.m=t.getM()),r.hasZ()&&(s.z=t.getZ()),s.setCacheValue(p,t),s}function d(e,t){if(e.isEmpty())return null;const n=l.fromJSON({spatialReference:t,...f(e,null)});return n.setCacheValue(p,e),n}function z(e,t){if(e.isEmpty())return null;const n=m.fromJSON({spatialReference:t,...f(e,null)});return n.setCacheValue(p,e),n}export{M as fromExtent,x as fromGeometry,V as fromMultipoint,w as fromPoint,v as fromPolygon,P as fromPolyline,Z as fromSpatialReference,C as getSpatialReference,E as toExtent,j as toGeometry,k as toMultipoint,R as toPoint,d as toPolygon,z as toPolyline};
5
+ import{P as e}from"../../../chunks/Point2D.js";import"../../../chunks/Envelope2D.js";import{G as t}from"../../../chunks/Geometry.js";import{E as n,P as s}from"../../../chunks/Envelope.js";import{M as r}from"../../../chunks/MultiPathImpl.js";import{c as a,b as o}from"../../../chunks/UnitFactory.js";import i from"../../Extent.js";import u from"../../Multipoint.js";import c from"../../Point.js";import l from"../../Polygon.js";import m from"../../Polyline.js";import"./initNoPeFactory.js";import{fromGeometryToGXGeometry as h,toGeometry as f}from"./jsonConverter.js";const p="_gxVersion",g=2,y=1;function C(e){return Array.isArray(e)?e[0].spatialReference:e.spatialReference}function x(e){switch(e.type){case"point":return w(e);case"multipoint":return V(e);case"polyline":return P(e);case"polygon":return v(e);case"extent":return M(e);default:throw new Error(`Unsupported geometry type: ${e.type}`)}}function M(e){if(!e.getCacheValue(p)){const t=new n;t.setCoords(e.xmin,e.ymin,e.xmax,e.ymax),e.hasM&&t.setInterval(g,0,e.mmin,e.mmax),e.hasZ&&t.setInterval(y,0,e.zmin,e.zmax),e.setCacheValue(p,t)}return e.getCacheValue(p)}function V(e){if(!e.getCacheValue(p)){const t=new r,n=new s,a=e.points,o=e.hasM,i=e.hasZ,u=i?3:2;for(let e=0,s=a.length;e<s;e++){const s=a[e];n.setXYCoords(s[0],s[1]),i&&n.setZ(s[2]??0),o&&n.setM(s[u]??NaN),t.add(n)}e.setCacheValue(p,t)}return e.getCacheValue(p)}function w(e){if(!e.getCacheValue(p)){const t=new s;t.setXYCoords(e.x,e.y),e.hasM&&t.setM(e.m),e.hasZ&&t.setZ(e.z),e.setCacheValue(p,t)}return e.getCacheValue(p)}function v(e){if(!e.getCacheValue(p)){const{curveRings:t,hasM:n,hasZ:s,rings:r}=e,a=h({curveRings:t,hasM:n,hasZ:s,rings:r});e.setCacheValue(p,a)}return e.getCacheValue(p)}function P(e){if(!e.getCacheValue(p)){const{curvePaths:t,hasM:n,hasZ:s,paths:r}=e,a=h({curvePaths:t,hasM:n,hasZ:s,paths:r});e.setCacheValue(p,a)}return e.getCacheValue(p)}function Z(e){if(e.wkid)return a(e.wkid);const t=e.wkt2||e.wkt;return t?o(t):null}function j(e,n){if(e)switch(e.getGeometryType()){case t.enumPoint:return R(e,n);case t.enumEnvelope:return E(e,n);case t.enumMultiPoint:return k(e,n);case t.enumPolyline:return z(e,n);case t.enumPolygon:return d(e,n)}return null}function E(e,t){if(e.isEmpty())return null;const n=new i({xmin:e.getXMin(),ymin:e.getYMin(),xmax:e.getXMax(),ymax:e.getYMax(),spatialReference:t}),s=e.getDescription();if(s.hasM()){const t=e.queryInterval(g,0);n.mmin=t.vmin,n.mmax=t.vmax}if(s.hasZ()){const t=e.queryInterval(y,0);n.zmin=t.vmin,n.zmax=t.vmax}return n.setCacheValue(p,e),n}function k(e,t){if(e.isEmpty())return null;const n=e.getDescription(),r=n.hasM(),a=n.hasZ(),o=[],i=new s;for(let s=0,u=e.getPointCount();s<u;s++){e.getPointByVal(s,i);const t=[i.getX(),i.getY()];a&&t.push(i.getZ()),r&&t.push(i.getM()),o.push(t)}const c=new u({hasM:r,hasZ:a,points:o,spatialReference:t});return c.setCacheValue(p,e),c}function R(t,n){if(t instanceof e)return new c({x:t.x,y:t.y,spatialReference:n});if(t.isEmpty())return null;const s=new c({x:t.getX(),y:t.getY(),spatialReference:n}),r=t.getDescription();return r.hasM()&&(s.m=t.getM()),r.hasZ()&&(s.z=t.getZ()),s.setCacheValue(p,t),s}function d(e,t){if(e.isEmpty())return null;const n=l.fromJSON({spatialReference:t,...f(e,null)});return n.setCacheValue(p,e),n}function z(e,t){if(e.isEmpty())return null;const n=m.fromJSON({spatialReference:t,...f(e,null)});return n.setCacheValue(p,e),n}export{M as fromExtent,x as fromGeometry,V as fromMultipoint,w as fromPoint,v as fromPolygon,P as fromPolyline,Z as fromSpatialReference,C as getSpatialReference,E as toExtent,j as toGeometry,k as toMultipoint,R as toPoint,d as toPolygon,z as toPolyline};
@@ -2,4 +2,4 @@
2
2
  All material copyright ESRI, All Rights Reserved, unless otherwise specified.
3
3
  See https://js.arcgis.com/4.34/esri/copyright.txt for details.
4
4
  */
5
- import"../../../chunks/Envelope2D.js";import"../../../chunks/Geometry.js";import"../../../chunks/MultiPathImpl.js";import"../../../chunks/Envelope.js";import"../../../chunks/Point2D.js";import{y as t}from"../../../chunks/UnitFactory.js";import{gradGcsIds as r,getMetersPerUnit as s,isProjectedWKT as e}from"../../../core/unitUtils.js";import{isGeographic as o}from"../../support/spatialReferenceUtils.js";t(t=>{let i,n;"number"==typeof t?i=t:n=t;const p={wkid:i,wkt:n};let m,u;if(n){m=e(n);const t=o(p);if(!m&&!t)throw new Error(`Unsupported WKT type: ${n}`)}else m=!o(p);return u=i&&r.has(i)?Math.PI/200:m?s(p):Math.PI/180,{isPCS:m,metersOrRadiansPerUnit:u,semiMajor:0,wkidOrWkt:t}});
5
+ import"../../../chunks/Envelope2D.js";import"../../../chunks/Geometry.js";import"../../../chunks/MultiPathImpl.js";import"../../../chunks/Envelope.js";import"../../../chunks/Point2D.js";import{l as t}from"../../../chunks/UnitFactory.js";import{gradGcsIds as r,getMetersPerUnit as s,isProjectedWKT as e}from"../../../core/unitUtils.js";import{isGeographic as o}from"../../support/spatialReferenceUtils.js";t(t=>{let i,n;"number"==typeof t?i=t:n=t;const p={wkid:i,wkt:n};let m,u;if(n){m=e(n);const t=o(p);if(!m&&!t)throw new Error(`Unsupported WKT type: ${n}`)}else m=!o(p);return u=i&&r.has(i)?Math.PI/200:m?s(p):Math.PI/180,{isPCS:m,metersOrRadiansPerUnit:u,semiMajor:0,wkidOrWkt:t}});
@@ -2,4 +2,4 @@
2
2
  All material copyright ESRI, All Rights Reserved, unless otherwise specified.
3
3
  See https://js.arcgis.com/4.34/esri/copyright.txt for details.
4
4
  */
5
- import{d as e,a as t,g as n,q as r,p as i,G as s,t as a}from"../../../chunks/Geometry.js";import{aJ as o,i as u,d as m,P as l,b as c,aK as d,m as _}from"../../../chunks/Point2D.js";import{E as h,o as f,D as p,a$ as k,n as b,r as y,l as N,s as T,b0 as g}from"../../../chunks/UnitFactory.js";import{a1 as v,a4 as x,P as A,E as S,$ as w,a0 as C,a5 as D,a6 as F,X as j}from"../../../chunks/Envelope.js";import{a as z,P as O,S as I,M as E,J as P,a5 as B,a6 as V,a7 as M,a8 as R,a9 as U}from"../../../chunks/MultiPathImpl.js";import"./initNoPeFactory.js";function W(){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 X(){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}}class L{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:W}}createJSONArrayIterator(e){return{m_iteratorType:"array",m_strict:this.m_options.strict,m_i:-1,m_a:e,next:X}}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>=o()&&this.m_currentValue<=u()?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;e("unrecognized json element type")}return e("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&&t("invalid token"),this.m_currentValue}currentDoubleValue(){return 7!==this.m_currentToken&&8!==this.m_currentToken&&t("invalid token"),this.m_currentValue}currentInt32Value(){return 8!==this.m_currentToken&&t("invalid token"),this.m_currentValue}currentInt64Value(){return n(0),0n}currentBoolValue(){return 12!==this.m_currentToken&&11!==this.m_currentToken&&t("invalid token"),this.m_currentValue}isError(){return 0}}class Y{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){n(0)}addInt32(e){this.addValue_(e)}addBool(e){this.addValue_(e)}addNull(){this.addValue_(null)}getObject(){return this.m_acceptedObject}}class G{constructor(t){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!==t.sz?(this.m_sz=t.sz,t.buffer?(this.m_sz<0&&r("size out of range"),this.m_buffer=t.buffer,this.m_offset=void 0!==t.offset?t.offset:0,this.m_view=void 0!==t.offset?new DataView(t.buffer,t.offset,t.sz):new DataView(this.m_buffer),this.m_bOwnsBuffer=!1,void(this.m_bLittleEndian=!0)):(this.m_sz<0&&r("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))))):t.move?(this.m_sz=t.move.m_sz,this.m_buffer=t.move.m_buffer,this.m_view=t.move.m_view,this.m_bOwnsBuffer=t.move.m_bOwnsBuffer,this.m_bLittleEndian=t.move.m_bLittleEndian,t.move.m_buffer=null,t.move.m_view=null,t.move.m_sz=0,void(t.move.m_bOwnsBuffer=!0)):void e("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===G.getNativeByteOrder())}setNativeByteOrder(){this.m_bLittleEndian=1===G.getNativeByteOrder()}setOrder(e){this.m_bLittleEndian=1===e}getOrder(){return this.m_bLittleEndian?1:0}getView(){return this.m_view||i("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){n(e>=0&&e<=this.m_sz),this.m_sz=e}}function K(e,r,i,a,o,u){let m=!1,l=!1,c=!1,d=!1,_=!1,h=!1,f=!1,p=!1,k=!1,b=!1,y=!1,N=!1,T=!1,g=!1,w=!1,C=!1,D=!1,F=!1,j=!1,z=!1,O=!1,I=!1,E=!1,P=!1,B=Number.NaN,V=Number.NaN,M=Number.NaN,R=Number.NaN,U=0,W=Number.NaN,X=Number.NaN,L=Number.NaN,Y=Number.NaN,G=Number.NaN,K=Number.NaN,q=Number.NaN,ne=Number.NaN,re=0,ie=0,se=!1,ae=!1,oe=null,ue=null,me=null,le=null,ce=null;for(;3!==i.nextToken();){const u=i.currentString();if(i.nextToken(),"spatialReference"===u){if(o&&!m){m=!0,1===i.currentToken()?le=J(i):10!==i.currentToken()&&t("failed to parse spatial reference: object or null is expected");continue}}else if(a)if("hasZ"===u){if(!l){l=!0,se=11===i.currentToken();continue}}else if("hasM"===u){if(!c){c=!0,ae=11===i.currentToken();continue}}else if("rings"===u){if(!(_||h||e!==s.enumUnknown&&e!==s.enumPolygon)){_=!0,({geometry:ce,as:oe,bs:ue}=Q(!0,!1,r,i));continue}}else if("curveRings"===u){if(!h&&(e===s.enumUnknown||e===s.enumPolygon)){h=!0,({geometry:ce,as:oe,bs:ue}=Q(!0,!0,r,i));continue}}else if("paths"===u){if(!(f||p||e!==s.enumUnknown&&e!==s.enumPolyline)){f=!0,({geometry:ce,as:oe,bs:ue}=Q(!1,!1,r,i));continue}}else if("curvePaths"===u){if(!p&&(e===s.enumUnknown||e===s.enumPolyline)){p=!0,({geometry:ce,as:oe,bs:ue}=Q(!1,!0,r,i));continue}}else if("points"===u){if(!k&&(e===s.enumUnknown||e===s.enumMultiPoint)){k=!0,({geometry:ce,as:oe,bs:ue}=Z(r,i));continue}}else if("ids"===u){if(!d){d=!0,me=H(r,i);continue}}else if("x"===u){if(!b&&(e===s.enumUnknown||e===s.enumPoint)){b=!0,B=$(i);continue}}else if("y"===u){if(!y&&(e===s.enumUnknown||e===s.enumPoint)){y=!0,V=$(i);continue}}else if("z"===u){if(!N&&(e===s.enumUnknown||e===s.enumPoint)){N=!0,M=$(i);continue}}else if("m"===u){if(!T&&(e===s.enumUnknown||e===s.enumPoint)){T=!0,R=$(i);continue}}else if("id"===u){if(!g&&(e===s.enumUnknown||e===s.enumPoint)){g=!0,U=ee(i);continue}}else if("xmin"===u){if(!w&&(e===s.enumUnknown||e===s.enumEnvelope)){w=!0,W=$(i);continue}}else if("ymin"===u){if(!C&&(e===s.enumUnknown||e===s.enumEnvelope)){C=!0,X=$(i);continue}}else if("mmin"===u){if(!O&&(e===s.enumUnknown||e===s.enumEnvelope)){O=!0,q=$(i);continue}}else if("zmin"===u){if(!j&&(e===s.enumUnknown||e===s.enumEnvelope)){j=!0,G=$(i);continue}}else if("idmin"===u){if(!E&&(e===s.enumUnknown||e===s.enumEnvelope)){E=!0,re=ee(i);continue}}else if("xmax"===u){if(!D&&(e===s.enumUnknown||e===s.enumEnvelope)){D=!0,L=$(i);continue}}else if("ymax"===u){if(!F&&(e===s.enumUnknown||e===s.enumEnvelope)){F=!0,Y=$(i);continue}}else if("mmax"===u){if(!I&&(e===s.enumUnknown||e===s.enumEnvelope)){I=!0,ne=$(i);continue}}else if("zmax"===u){if(!z&&(e===s.enumUnknown||e===s.enumEnvelope)){z=!0,K=$(i);continue}}else if("idmax"===u){if(!P&&(e===s.enumUnknown||e===s.enumEnvelope)){P=!0,ie=ee(i);continue}}else"materials"===u&&n(0);i.skipChildren()}if(_||h||f||p||k){let e=null,t=null;const n=ce;se&&(ce.addAttribute(1),e=oe,e||(e=v(n.getPointCount(),Number.NaN))),ae&&(ce.addAttribute(2),t=se?ue:oe),null!=me&&ce.addAttribute(3),se&&null!=e&&n.setAttributeStreamRef(1,e),ae&&null!=t&&n.setAttributeStreamRef(2,t),null!=me&&te(n,me)}else if(b||y||T||N||g){x(B,V)||t("failed to parse point: x and y must be finite or nan"),(Number.isNaN(V)||Number.isNaN(B))&&(B=Number.NaN,V=Number.NaN);const e=new A({x:B,y:V});N&&e.setZ(M),T&&e.setM(R),g&&e.setID(U),ce=e}else if(w||C||D||F||j||z||O||I||E||P){(Number.isNaN(X)||Number.isNaN(L)||Number.isNaN(Y))&&(W=Number.NaN);const e=new S({xmin:W,ymin:X,xmax:L,ymax:Y});j&&z&&e.setInterval(1,0,G,K),O&&I&&e.setInterval(2,0,q,ne),E&&P&&e.setInterval(3,0,re,ie),ce=e}return{...ce?{geom:ce}:{},...le?{sr:le}:{}}}function q(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 J(e){let t=!1,n=!1,r=!1,i=!1,s=!1,a=!1,o=!1,u=!1,m=!1,l=!1,c=!1,d=!1,_=!1,g=!1,v=!1,x=!1,A=!1,S=-1,w=-1,C=-1,D=-1,F=0,j=0,z=0,O=0,I=0,E=0,P=0,B=0,V=0,M=0,R="",U="",W=null;for(;3!==e.nextToken();){const h=e.currentString();e.nextToken(),"wkid"===h?t||(t=!0,8===e.currentToken()&&(S=e.currentInt32Value())):"latestWkid"===h?n||(n=!0,8===e.currentToken()&&(w=e.currentInt32Value())):"wkt"===h?s||(s=!0,6===e.currentToken()&&(R=e.currentString())):"wkt2"===h?s||6===e.currentToken()&&(U=e.currentString()):"vcsWkid"===h?r||(r=!0,8===e.currentToken()&&(C=e.currentInt32Value())):"latestVcsWkid"===h?i||(i=!0,8===e.currentToken()&&(D=e.currentInt32Value())):"xyTolerance"===h?o||(o=!0,a=!0,F=e.currentDoubleValue()):"zTolerance"===h?u||(u=!0,a=!0,j=e.currentDoubleValue()):"mTolerance"===h?m||(m=!0,a=!0,z=e.currentDoubleValue()):"falseX"===h?l||(l=!0,a=!0,P=e.currentDoubleValue()):"falseY"===h?c||(c=!0,a=!0,B=e.currentDoubleValue()):"falseZ"===h?d||(d=!0,a=!0,V=e.currentDoubleValue()):"falseM"===h?_||(_=!0,a=!0,M=e.currentDoubleValue()):"xyUnits"===h?g||(g=!0,a=!0,O=e.currentDoubleValue()):"zUnits"===h?v||(v=!0,a=!0,I=e.currentDoubleValue()):"mUnits"===h?x||(x=!0,a=!0,E=e.currentDoubleValue()):"unit"===h?A||(A=!0,W=q(e)):e.skipChildren()}D<=0&&C>0&&(D=C),C<=0&&D>0&&(C=D);let X=null,L=!0;if(0!==R.length&&(L=!1,h(R)&&(X=f(R))),X||0===U.length||(L=!1,h(U)&&(X=f(U))),!X&&w>0&&(L=!1,p(w)&&(D<=0||k())&&(X=b(w,D))),!X&&S>0&&(L=!1,p(S)&&(C<=0||k())&&(X=b(S,C))),L&&(X=y(W)),a&&X){const e=new N;X.queryPrecisionDescriptorWithoutFalseXY(e),o&&e.setTolerance(0,F),u&&e.setTolerance(1,j),m&&e.setTolerance(2,z),g&&l&&c&&e.setGridParams(P,B,O),v&&d&&e.setZParams(V,I),x&&_&&e.setMParams(M,E),X=T(X,e)}return X}function Q(e,n,r,i){2!==i.currentToken()&&t("failed to parse multipath: array of array of vertices is expected");const s=e?new z:new O,a=s,o=w(0),u=v(2,0),_=C(0);let h=null,f=null,p=null,k=null,b=null,y=0,N=0,T=0;const g=new I,x=l.getNAN();let A=0,S=0;const F=e?1:0;for(;4!==i.nextToken();){2!==i.currentToken()&&t("failed to parse multipath: ring/path array is expected");let r=2,s=0,j=!0;const z=4;let O=0,I=0;const E=l.getNAN(),P=m(z,Number.NaN),B=m(z,Number.NaN);let V=!1;for(i.nextToken();4!==i.currentToken();){if(n&&1===i.currentToken())j&&t("failed to parse multipath: starting vertex array is expected"),p||(p=C(A-1,1),k=w(A-1,-1),b=v(0)),V=!0,r=1,({segFlag:T,toPointSz:O}=ue(g,P,x,i));else{for(V=!1,2!==i.currentToken()&&t("failed to parse multipath: array is expected, rings/paths vertices consist of arrays of coordinates"),O=0;4!==i.nextToken();)O===z&&t("failed to parse multipath: each vertex array has to have at most 4 elements"),P[O++]=$(i);O<2&&t("failed to parse multipath: each vertex array has to have at least 2 elements"),D(P[0],P[1])||t("failed to parse multipath: x and y must be finite")}i.nextToken();do{if(u.size()===2*A&&u.resize(ne(A)),u.writePoint2D(2*A,E.setCoords(P[0],P[1])),h&&h.size()===A&&h.resize(re(A)),O>2?(h||(h=v(A+1,Number.NaN)),h.write(A,P[2])):h&&h.write(A,Number.NaN),f&&f.size()===A&&f.resize(re(A)),O>3?(f||(f=v(A+1,Number.NaN)),f.write(A,P[3])):f&&f.write(A,Number.NaN),j)S++,o.add(A),_.add(F),j=!1,I=O,c(B,P,0,0,I);else if(null!==p)if(V){const e=U(T),t=b.size();b.resize(t+e),p.add(T),k.add(y),g.get().writeInBufferStream(b,y),y+=e,a.incCurveType(T,1),N++}else p.add(1),k.add(-1);A++,s++,x.setCoords(P[0],P[1])}while(s<r&&4===i.currentToken())}0!==s&&(e&&s>r&&O===I&&0===d(P,B,O)?(A--,s--):null!==p&&(p.add(1),k.add(-1)))}return A&&(o.resize(S),_.resize(S),A>0&&(o.add(A),_.add(0)),a.setAttributeStreamRef(0,u),a.setPathFlagsStreamRef(_),a.setPathStreamRef(o),null!==p&&(a.updateCurveCounter(N),a.setSegmentData(k,b,p,y)),a.notifyModifiedFlags(65535)),{geometry:s,as:h,bs:f}}function Z(e,n){2!==n.currentToken()&&t("failed to parse multipoint: array of vertices is expected");let r=0;const i=new E,s=v(2,0);let a=0;const o=4,u=m(o,Number.NaN),c=new l;let d=null,_=null;for(;4!==n.nextToken();){for(2!==n.currentToken()&&t("failed to parse multipoint: array is expected, multipoint vertices consist of arrays of cooridinates"),a=0;4!==n.nextToken();)a===o&&t("failed to parse multipoint: each vertex array has to have at most 4 elements"),u[a++]=$(n);a<2&&t("failed to parse multipoint: each vertex array has to have at least 2 elements"),D(u[0],u[1])||t("failed to parse multipoint: x and y must be finite"),s.size()===2*r&&s.resize(ne(r)),s.writePoint2D(2*r,c.setCoords(u[0],u[1])),d&&d.size()===r&&d.resize(re(r)),a>2?(d||(d=v(r+1,Number.NaN)),d.write(r,u[2])):d&&d.write(r,Number.NaN),_&&_.size()===r&&_.resize(re(r)),a>3?(_||(_=v(r+1,Number.NaN)),_.write(r,u[3])):_&&_.write(r,Number.NaN),r++}if(r){const e=i.getImpl();e.setAttributeStreamRef(0,s),e.resizeNoInit(r),e.notifyModifiedFlags(65535)}return{geometry:i,as:d,bs:_}}function H(e,n){2!==n.currentToken()&&t("failed to parse array of IDs: array of array of integers is expected");const r=F(2,0);let i=0,s=-1;for(;4!==n.nextToken();){const e=i;r.size()===i&&r.resize(re(i)),i++;let a=0;for(-1===s?s=2===n.currentToken()?1:0:1===s&&2!==n.currentToken()&&t("failed to parse array of IDs: array of array of integers is expected"),0===s&&(r.size()===i&&r.resize(re(i)),r.write(i,ee(n)),a++,i++);4!==n.nextToken();)r.size()===i&&r.resize(re(i)),r.write(i,ee(n)),a++,i++;if(r.write(e,a),0===s)break}return r.resize(i),r}function $(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 ee(e){return e.currentInt32Value()}function te(t,n){if(t.isEmpty())return;const r=F(2,0),i=t.getGeometryType();let s=0;i===E.type?s=1:i===O.type||i===z.type?s=t.getPathCount():e("not implemented"),r.resize(t.getPointCount(),0);let a=0;for(let o=0;o<s;++o){const s=n.read(a);a++;const u=a+s;let m=0,l=0;i===E.type?m=t.getPointCount():i===O.type||i===z.type?(m=t.getPathSize(o),l=t.getPathStart(o)):e("not implemented");for(let e=0,t=Math.min(s,m);e<t;++e)r.write(l,n.read(a)),a++,l++;a=u}t.getImpl().setAttributeStreamRef(3,r)}function ne(e){let t=2*Math.trunc(3*(e+1)/2);return t<8?t=8:t<32&&(t=32),t}function re(e){let t=Math.trunc(3*(e+1)/2);return t<4?t=4:t<16&&(t=16),t}function ie(e,t,n,i,s){s>=i.size()&&r("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 a=l.getNAN();a.x=i.readDouble(s),a.y=i.readDouble(s+8);const o=i.readInt32(s+16);if(!!(1&o))return e.m_semiMajorAxis=0,e.m_minorMajorRatio=1,e.m_interior.assign(a),e.m_center.setNAN(),e.m_sweepAngle=0,e.m_startAngle=0,V(e),!1;let u=!!(64&o);const m=!!(128&o);let c=!!(32&o);const d=!!(8&o),_=!!(16&o),h=t.equals(n);return u&&!h&&(u=!1,c=!0),c&&h&&(u=!0,c=!1,a.setCoords(0,0)),u||(m?c?(e.m_semiMajorAxis=1,e.m_minorMajorRatio=0,e.m_interior.assign(a),e.m_center.setNAN(),e.m_sweepAngle=0,e.m_startAngle=0):(e.constructCircularArcThreePoint(t,n,a),h&&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,V(e),e.queryCoord2D(.5,e.m_interior)):M(e,t,n,a,d,_)),u&&(e.m_center.assign(t),e.m_startAngle=a.x,e.m_sweepAngle=a.y,R(e,Number.NaN,d,_),e.m_semiMajorAxis=0,e.m_minorMajorRatio=1,e.m_interior.setCoordsPoint2D(t)),e.setProjectionBehavior(0),V(e),!0}function se(e,t,n,r,i){e.m_bits=0,e.m_center.x=r.readDouble(i),e.m_center.y=r.readDouble(i+8),e.m_rotation=r.readDouble(i+16),e.m_semiMajorAxis=r.readDouble(i+24),e.m_minorMajorRatio=r.readDouble(i+32),e.m_XStart=t.x,e.m_YStart=t.y,e.m_XEnd=n.x,e.m_YEnd=n.y;const s=r.readInt32(i+40);if(1&s)return!1;let a=!!(64&s),o=!!(128&s);const u=!!(2048&s),m=!!(4096&s);return!!!(512&s)&&!!!(1024&s)||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,R(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,V(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),V(e),!0}function ae(e,t,r,i,s){return n(s+32<=i.size()),e.m_cp=_(l,2),e.m_cp[0].x=i.readDouble(s),e.m_cp[0].y=i.readDouble(s+8),e.m_cp[1].x=i.readDouble(s+16),e.m_cp[1].y=i.readDouble(s+24),e.m_XStart=t.x,e.m_YStart=t.y,e.m_XEnd=r.x,e.m_YEnd=r.y,!0}function oe(e,t,n,r,i){return e.m_cp.x=r.readDouble(i),e.m_cp.y=r.readDouble(i+8),e.m_weights[0]=r.readDouble(i+16),e.m_weights[1]=r.readDouble(i+24),e.m_weights[2]=r.readDouble(i+32),e.m_XStart=t.x,e.m_YStart=t.y,e.m_XEnd=n.x,e.m_YEnd=n.y,!0}function ue(e,n,r,i,s){const a={segFlag:0,toPointSz:0};let o=i.currentToken();o=i.nextToken();const u=i.currentString(),m=u[0];for((1!==u.length||"a"!==m&&"b"!==m&&"c"!==m&&"n"!==m&&"q"!==m)&&t('failed to parse curve: expecting "a", "b", "n", "q", or "c"'),o=i.nextToken(),2!==o&&t("failed to parse curve: start array is expected for curve parameters"),o=i.nextToken(),2!==o&&t("failed to parse curve: start array is expected for to point"),a.toPointSz=0;4!==i.nextToken();)4===a.toPointSz&&t("failed to parse curve: vertex array cannot have more than 4 elements"),n[a.toPointSz++]=$(i);a.toPointSz<2&&t("failed to parse curve: vertex array must have at least 2 elements");const c=l.construct(n[0],n[1]),d=l.getNAN();let _=-1,h=-1,f=!1,p=Number.NaN,k=Number.NaN,b=Number.NaN;const y=[l.getNAN(),l.getNAN(),l.getNAN()],N=l.getNAN();if("a"===m){o=i.nextToken(),2!==o&&t("failed to parse curve: start array is expected for center point"),o=i.nextToken();const e=$(i);o=i.nextToken();const n=$(i);o=i.nextToken(),4!==o&&t("failed to parse curve: end array is expected for center point"),d.setCoords(e,n),o=i.nextToken(),_=i.currentInt32Value(),o=i.nextToken(),h=i.currentInt32Value(),o=i.nextToken(),4!==o?(f=!1,p=$(i),o=i.nextToken(),k=$(i),o=i.nextToken(),b=$(i),o=i.nextToken(),4!==o&&t("failed to parse curve: end array is expected for curve parameters")):f=!0,a.segFlag=4}else if("b"===m){for(let e=0;e<2;e++){o=i.nextToken(),2!==o&&t("failed to parse curve: start array is expected for control point"),o=i.nextToken();const n=$(i);o=i.nextToken();const r=$(i);o=i.nextToken(),4!==o&&t("failed to parse curve: end array is expected for control point"),y[e].setCoords(n,r)}o=i.nextToken(),4!==o&&t("failed to parse curve: end array is expected for curve parameters"),a.segFlag=2}else if("n"===m){{o=i.nextToken(),2!==o&&t("failed to parse curve: start array is expected for control point"),o=i.nextToken();const e=$(i);o=i.nextToken();const n=$(i);o=i.nextToken(),4!==o&&t("failed to parse curve: end array is expected for control point"),y[0].setCoords(e,n)}o=i.nextToken();const e=$(i);o=i.nextToken();const n=$(i);o=i.nextToken();const r=$(i);y[1].setCoords(e,n),y[2].setCoords(r,r),o=i.nextToken(),4!==o&&t("failed to parse curve: end array is expected for curve parameters"),a.segFlag=8}else if("q"===m){for(let e=0;e<1;e++){o=i.nextToken(),2!==o&&t("failed to parse curve: start array is expected for control point"),o=i.nextToken();const n=$(i);o=i.nextToken();const r=$(i);o=i.nextToken(),4!==o&&t("failed to parse curve: end array is expected for control point"),y[e].setCoords(n,r)}o=i.nextToken(),4!==o&&t("failed to parse curve: end array is expected for curve parameters"),a.segFlag=16}else{o=i.nextToken(),2!==o&&t("failed to parse curve: start array is expected for interior point"),o=i.nextToken();const e=$(i);o=i.nextToken();const n=$(i);o=i.nextToken(),4!==o&&t("failed to parse curve: end array is expected for interior point"),N.setCoords(e,n),o=i.nextToken(),4!==o&&t("failed to parse curve: end array is expected for curve parameters"),a.segFlag=4}if(o=i.nextToken(),3!==o&&t("failed to parse curve: end object is expected for curve"),"a"===m)if(e.createEllipticArc(),f){const t=!0;me(e.get(),r,c,d,t,_,h)}else le(e.get(),r,c,d,_,h,p,k,b);else if("b"===m)e.createCubicBezier(),ce(e.get(),r,c,y);else if("n"===m)e.createQuadraticRationalBezier(),de(e.get(),r,c,y[0],y[1].x,y[1].y,y[2].x);else if("q"===m)e.createQuadraticBezier(),e.get().construct(r,y[0],c);else{e.createEllipticArc();const t=!1;me(e.get(),r,c,N,t,-1,-1)}return a}function me(e,t,n,r,i,s,a){e.dropAllAttributes();const o=20,u=new ArrayBuffer(o),m=new G({sz:o,buffer:u});let l=0;m.writeDouble(l,r.x),l+=8,m.writeDouble(l,r.y),l+=8;let c=0;i?(a||(c|=8),s&&(c|=16)):c|=128,m.writeInt32(l,c),l+=4,ie(e,t,n,m,0)}function le(e,t,n,r,i,s,a,o,u){e.dropAllAttributes();const m=44,l=new ArrayBuffer(m),c=new G({sz:m,buffer:l});let d=0;c.writeDouble(d,r.x),d+=8,c.writeDouble(d,r.y),d+=8,c.writeDouble(d,a),d+=8,c.writeDouble(d,o),d+=8,c.writeDouble(d,u),d+=8;let _=0;s||(_|=2048),i&&(_|=4096),c.writeInt32(d,_),d+=4,se(e,t,n,c,0)}function ce(e,t,n,r){e.dropAllAttributes();const i=32,s=new ArrayBuffer(i),a=new G({sz:i,buffer:s});let o=0;a.writeDouble(o,r[0].x),o+=8,a.writeDouble(o,r[0].y),o+=8,a.writeDouble(o,r[1].x),o+=8,a.writeDouble(o,r[1].y),o+=8,ae(e,t,n,a,0)}function de(e,t,n,r,i,s,a){e.dropAllAttributes();const o=40,u=new ArrayBuffer(o),m=new G({sz:o,buffer:u});let l=0;m.writeDouble(l,r.x),l+=8,m.writeDouble(l,r.y),l+=8,m.writeDouble(l,i),l+=8,m.writeDouble(l,s),l+=8,m.writeDouble(l,a),l+=8,oe(e,t,n,m,0)}function _e(e,t,n,r,i){const o=e.getGeometryType();if(o===s.enumEllipticArc)return he(e,t,n,r,i);if(o===s.enumBezier)return fe(e,t,n,r,i);if(o===s.enumRationalBezier2)return pe(e,t,n,r,i);if(o===s.enumBezier2){const s=new P;return s.constructFromQuadraticSegment(e),fe(s,t,n,r,i)}a("")}function he(e,t,r,i,s){n(!B(e));const a=e.getEndXY(),o=e.hasAttribute(1)&&!t,u=e.hasAttribute(2)&&!r;let m=Number.NaN,l=Number.NaN;if(o&&(m=e.getEndAttributeAsDbl(1,0)),u&&(l=e.getEndAttributeAsDbl(2,0)),e.isDegenerateToLine()||e.isDegenerate(0))return ke(o,u,a.x,a.y,m,l,i,s),!0;const c=0===e.projectionBehavior(),d=!!c&&e.isClosed();if(c&&!d)s.startObject(),s.addFieldName("c"),s.startArray(),ke(o,u,a.x,a.y,m,l,i,s),be(e.m_interior.x,e.m_interior.y,17,s),s.endArray(),s.endObject();else if(c){s.startObject(),s.addFieldName("a"),s.startArray(),ke(o,u,a.x,a.y,m,l,i,s);const t=0,n=0;be(e.m_center.x+t,e.m_center.y+n,17,s);const r=!e.isMajor();s.addInt32(r?1:0);const c=e.isClockwise();s.addInt32(c?1:0),s.endArray(),s.endObject()}else{s.startObject(),s.addFieldName("a"),s.startArray(),ke(o,u,a.x,a.y,m,l,i,s);const t=e;be(t.m_center.x,t.m_center.y,17,s);const n=!t.isMajor();s.addInt32(n?1:0);const r=t.isClockwise();s.addInt32(r?1:0),s.addDouble(t.m_rotation,17),s.addDouble(t.m_semiMajorAxis,17),s.addDouble(t.m_minorMajorRatio,17),s.endArray(),s.endObject()}return!1}function fe(e,t,n,r,i){const s=e.getEndXY(),a=e.hasAttribute(1)&&!t,o=e.hasAttribute(2)&&!n;let u=Number.NaN,m=Number.NaN;return a&&(u=e.getEndAttributeAsDbl(1,0)),o&&(m=e.getEndAttributeAsDbl(2,0)),i.startObject(),i.addFieldName("b"),i.startArray(),ke(a,o,s.x,s.y,u,m,r,i),be(e.m_cp[0].x,e.m_cp[0].y,r,i),be(e.m_cp[1].x,e.m_cp[1].y,r,i),i.endArray(),i.endObject(),!1}function pe(e,t,n,r,i){const s=e.getEndXY(),a=e.hasAttribute(1)&&!t,o=e.hasAttribute(2)&&!n;let u=Number.NaN,m=Number.NaN;a&&(u=e.getEndAttributeAsDbl(1,0)),o&&(m=e.getEndAttributeAsDbl(2,0)),i.startObject(),i.addFieldName("n"),i.startArray(),ke(a,o,s.x,s.y,u,m,r,i),be(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}function ke(e,t,n,r,i,s,a,o){o.startArray(),o.addDouble(n,a),o.addDouble(r,a),e&&o.addDouble(i,a),t&&o.addDouble(s,a),o.endArray()}function be(e,t,n,r){r.startArray(),r.addDouble(e,n),r.addDouble(t,n),r.endArray()}class ye{getOperatorType(){return 10405}accelerateGeometry(e,t,n){return!1}canAccelerateGeometry(e){return!1}supportsCurves(){return!0}execute(e,t,n,r,i,s){Ne(e,t,n,r)}exportSpatialReference(e,t,r,i){n(0)}exportProjectionTransformation(e,t,r,i){n(0)}exportDatumTransformation(e,t,r,i){n(0)}static geometryTypeToString(e){return n(0),""}}function Ne(t,r,i,a,o){if(r||i){if(a.startObject(),null!==r){switch(r.getGeometryType()){case s.enumPolygon:Te(!0,t,r,a);break;case s.enumPolyline:Te(!1,t,r,a);break;case s.enumMultiPoint:ge(t,r,a);break;case s.enumPoint:ve(t,r,a);break;case s.enumEnvelope:xe(t,r,a);break;case s.enumMultipatch:n(0);break;default:e("exportToJSON")}}null!==i&&(a.addFieldName("spatialReference"),Se(t,i,a)),a.endObject()}}function Te(e,t,r,i){const s=r.getImpl(),o=!!(2&t),u=!!(4&t),m=!!(8&t),l=s.hasAttribute(1)&&!o,c=s.hasAttribute(2)&&!u,d=s.hasAttribute(3)&&!m,_=s.hasNonLinearSegments();l&&(i.addFieldName("hasZ"),i.addBool(!0)),c&&(i.addFieldName("hasM"),i.addBool(!0)),e?_?i.addFieldName("curveRings"):i.addFieldName("rings"):_?i.addFieldName("curvePaths"):i.addFieldName("paths");let h=null;const f=[];if(r.isEmpty())i.startArray(),i.endArray();else{const e=17-(31&t>>13);i.startArray();const n=r.getPathCount();let m=0;const p=s.getAttributeStreamRef(0);let k=null,b=null,y=null;const N=new I;let T=null,g=null,v=null;_&&(T=s.getSegmentFlagsStreamRef(),g=s.getSegmentIndexStreamRef(),v=s.getSegmentDataStreamRef()),l&&(k=s.getAttributeStreamRef(1)),c&&(b=s.getAttributeStreamRef(2)),d&&(y=s.getAttributeStreamRef(3),h=j(3,0));for(let t=0;t<n;t++){i.startArray(),d&&f.push(0);const n=r.getPathEnd(t);if(m===n){i.endArray();continue}const s=r.isClosedPath(t);let _=p.read(2*m),x=p.read(2*m+1),A=l?k.read(m):Number.NaN,S=c?b.read(m):Number.NaN,w=d?y.read(m):0;we(l,c,_,x,A,S,e,i);let C=1;d&&(h.add(w),f[f.length-1]++);const D=_,F=x,j=A,z=S,O=w;let I=!1,E=0,P=Number.NaN,B=Number.NaN,V=0;for(let t=m+1,r=m,M=s?n+1:n;t<M;t++,r++){const s=null!==T?31&T.read(r):1;let m,M;if(t<n?(m=p.read(2*t),M=p.read(2*t+1),l&&(P=k.read(t)),c&&(B=b.read(t)),d&&(V=y.read(t))):(m=D,M=F,P=j,B=z,V=O),1!==s){I=!0,4===s?N.createEllipticArc():2===s?N.createCubicBezier():16===s?N.createQuadraticBezier():8===s?N.createQuadraticRationalBezier():a("JSON export.unsupported curve");const t=N.get(),n=g.read(r);t.setStartXYCoords(_,x),t.setEndXYCoords(m,M),l&&(t.setStartAttribute(1,0,A),t.setEndAttribute(1,0,P)),c&&(t.setStartAttribute(2,0,S),t.setEndAttribute(2,0,B)),t.readFromBufferStream(v,n);_e(N.get(),o,u,e,i)&&E++}else we(l,c,m,M,P,B,e,i);d&&(h.add(V),f[f.length-1]++),C++,_=m,x=M,A=P,S=B,w=V}I&&0===E||(C<2&&E<1&&(we(l,c,_,x,A,S,e,i),C++,d&&(h.add(w),f[f.length-1]++)),s&&C<3&&E<2&&(we(l,c,D,F,j,z,e,i),C++,_=D,x=F,A=j,S=z,w=O,d&&(h.add(O),f[f.length-1]++))),i.endArray(),m=n}i.endArray()}if(d){i.addFieldName("ids"),i.startArray();let e=0;for(let t=0,r=f.length;t<r;++t){const r=f[t];n(0===r||null!==h&&e+r<=h.size()),i.startArray();for(let t=0;t<r;++t)i.addInt32(h.read(e)),e++;i.endArray()}i.endArray()}}function ge(e,t,r){const i=t.getImpl(),s=i.hasAttribute(1)&&!(2&e),a=i.hasAttribute(2)&&!(4&e),o=i.hasAttribute(3)&&!(8&e);s&&(r.addFieldName("hasZ"),r.addBool(!0)),a&&(r.addFieldName("hasM"),r.addBool(!0)),r.addFieldName("points");const u=t.getPointCount();if(t.isEmpty())r.startArray(),r.endArray();else{const t=17-(31&e>>13);r.startArray();const n=i.getAttributeStreamRef(0);let o=null,m=null;s&&(o=i.getAttributeStreamRef(1)),a&&(m=i.getAttributeStreamRef(2));for(let e=0;e<u;e++){const i=n.read(2*e),u=n.read(2*e+1);let l=Number.NaN,c=Number.NaN;s&&(l=o.read(e)),a&&(c=m.read(e)),we(s,a,i,u,l,c,t,r)}r.endArray()}if(o){let e=null;i.isEmpty()||(e=i.getAttributeStreamRef(3)),n(0===u||null!==e&&e.size()>=u),r.addFieldName("ids"),r.startArray();for(let t=0;t<u;t++)r.addInt32(e.read(t));r.endArray()}}function ve(e,t,n){const r=t.hasAttribute(1)&&!(2&e),i=t.hasAttribute(2)&&!(4&e),s=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(s&&(n.addFieldName("id"),n.addInt32(0)));const a=17-(31&e>>13);n.addFieldName("x"),n.addDouble(t.getX(),a),n.addFieldName("y"),n.addDouble(t.getY(),a),r&&(n.addFieldName("z"),n.addDouble(t.getZ(),a)),i&&(n.addFieldName("m"),n.addDouble(t.getM(),a)),s&&(n.addFieldName("id"),n.addInt32(t.getID()))}function xe(e,t,n){const r=t.hasAttribute(1)&&!(2&e),i=t.hasAttribute(2)&&!(4&e),s=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(s&&(n.addFieldName("idmin"),n.addInt32(0),n.addFieldName("idmax"),n.addInt32(0)));const a=17-(31&e>>13);if(n.addFieldName("xmin"),n.addDouble(t.getXMin(),a),n.addFieldName("ymin"),n.addDouble(t.getYMin(),a),n.addFieldName("xmax"),n.addDouble(t.getXMax(),a),n.addFieldName("ymax"),n.addDouble(t.getYMax(),a),r){const e=t.queryInterval(1,0);n.addFieldName("zmin"),n.addDouble(e.vmin,a),n.addFieldName("zmax"),n.addDouble(e.vmax,a)}if(i){const e=t.queryInterval(2,0);n.addFieldName("mmin"),n.addDouble(e.vmin,a),n.addFieldName("mmax"),n.addDouble(e.vmax,a)}if(s){const e=t.queryInterval(3,0);n.addFieldName("idmin"),n.addInt32(e.vmin),n.addFieldName("idmax"),n.addInt32(e.vmax)}}function Ae(e,n,r){r.startObject();const i=n.getID();i<=0&&t("cannot export unit that has no valid WKID"),r.addFieldName("uwkid"),r.addInt32(i),r.endObject()}function Se(e,t,n){n.startObject();let r=0;t.isCustomWkid()||(r=t.getOldID());let i=0;const s=t.getVCS();if(null!==s&&(s.isCustomWkid()||(i=s.getOldID()),i<=0&&(r=0)),r>0){n.addFieldName("wkid"),n.addInt32(r);const e=t.getLatestID();if(e>0&&e!==r&&(n.addFieldName("latestWkid"),n.addInt32(e)),i>0){n.addFieldName("vcsWkid"),n.addInt32(i);const e=t.getLatestVerticalID();e!==i&&(n.addFieldName("latestVcsWkid"),n.addInt32(e))}}if(0===t.getCoordinateSystemType())n.addFieldName("wkid"),n.addNull(),null!==t.getUnit()&&(n.addFieldName("unit"),Ae(e,t.getUnit(),n));else if(r<=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 N;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()}function we(e,t,n,r,i,s,a,o){o.startArray(),o.addDouble(n,a),o.addDouble(r,a),e&&o.addDouble(i,a),t&&o.addDouble(s,a),o.endArray()}const Ce={s_a:"a".charCodeAt(0),s_A:"A".charCodeAt(0),s_asterisk:"*".charCodeAt(0),s_b:"b".charCodeAt(0),s_backslash:"\\".charCodeAt(0),s_beginArray:"[".charCodeAt(0),s_beginObject:"{".charCodeAt(0),s_colon:":".charCodeAt(0),s_period:".".charCodeAt(0),s_comma:",".charCodeAt(0),s_doubleQuote:'"'.charCodeAt(0),s_endArray:"]".charCodeAt(0),s_endObject:"}".charCodeAt(0),s_e:"e".charCodeAt(0),s_E:"E".charCodeAt(0),s_f:"f".charCodeAt(0),s_F:"F".charCodeAt(0),s_forwardslash:"/".charCodeAt(0),s_minus:"-".charCodeAt(0),s_plus:"+".charCodeAt(0),s_n:"n".charCodeAt(0),s_N:"N".charCodeAt(0),s_r:"r".charCodeAt(0),s_t:"t".charCodeAt(0),s_u:"u".charCodeAt(0),s_zero:"0".charCodeAt(0),s_nine:"9".charCodeAt(0)};class De{constructor(t){this.m_functionStack=[],this.m_pushPositions=[],this.m_utf8Decoder=new TextDecoder("utf-8",{fatal:!0}),void 0===t?(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):t.jsonString?this.resetParserFromString(t.jsonString):t.jsonStream?a("streaming json parsing not yet impl"):e("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);this.m_endToken+=e-1;return{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_(){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){a("streaming json parsing not yet impl")}resetToPosition(e){return!!this.m_jsonString&&(this.m_endToken=e,this.m_startToken=Number.MAX_VALUE,this.m_currentTokenType=0,this.m_functionStack.length=0,e>=this.m_jsonString.length?(this.m_functionStack.push(()=>this.accept_()),!1):(this.m_functionStack.push(()=>this.start_()),!0))}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 n(0),""}childrenAsString(){return n(0),""}skipChildren(){this.skipChildren_()}skipChildren_(){if(1===this.m_currentTokenType){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);return}if(2===this.m_currentTokenType){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);return}}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"}t("invalid token")}toUTF8_(e,t){let n=0,r=e;for(;t.charCodeAt(r)===Ce.s_backslash&&t.charCodeAt(r+1)===Ce.s_u;)n++,r+=6;r=e;const i=new Uint8Array(n);let s=0;for(;t.charCodeAt(r)===Ce.s_backslash&&t.charCodeAt(r+1)===Ce.s_u;)i[s++]=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 s=t;s<n;s++)if(i.charCodeAt(s)!==Ce.s_backslash)r++;else{switch(r>0&&(e+=i.slice(t,t+r)),i.charCodeAt(++s)){case Ce.s_doubleQuote:e+='"';break;case Ce.s_u:{const{u8s:t,end:n}=this.toUTF8_(s-1,i);s=n-1,e+=t;break}case Ce.s_backslash:e+="\\";break;case Ce.s_forwardslash:e+="/";break;case Ce.s_b:e+="\b";break;case Ce.s_f:e+="\f";break;case Ce.s_n:e+="\n";break;case Ce.s_r:e+="\r";break;case Ce.s_t:e+="\t"}t=s+1,r=0}return r>0&&(e+=i.slice(t,t+r)),e}currentString(){if(5!==this.m_currentTokenType&&6!==this.m_currentTokenType)return this.currentTerminalAsString_();if(this.m_bHasEscapes)return this.unquoteCurrentString_();return 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&&t("invalid token"),10===this.m_currentTokenType)return Number.NaN;let e=this.m_getCurrentSubstr(),n=this.m_endToken-this.m_startToken;if(6===this.m_currentTokenType){if("NaN"===this.currentString())return Number.NaN;e=e.slice(1),n-=2,0===n&&t("invalid token")}const r=Number.parseFloat(e);if(6===this.m_currentTokenType)Number.isNaN(r)&&t("invalid token");else if(Number.isNaN(r))return Number.NaN;return r}currentInt32Value(){8!==this.m_currentTokenType&&6!==this.m_currentTokenType&&t("invalid token");let e=this.m_getCurrentSubstr(),n=this.m_endToken-this.m_startToken;6===this.m_currentTokenType&&(e=e.slice(1),n-=2,0===n&&t("invalid token"));const r=parseInt(e);return Number.isNaN(r)&&t("invalid token"),r}currentInt64Value(){return n(0),0n}currentBoolValue(){return n(0),!1}isError(){return 0}JSONString(){return n(0),""}pushPosition(){return n(0),!1}popPosition(){return n(0),!1}skipCStyleComments_(){n(0)}skipCppStyleComments_(){n(0)}skipComments_(){this.m_prepSubstr();let e=this.m_peekChar();this.m_stepOverChar(),this.m_eof()&&t("invalid token"),e=this.m_peekChar(),e===Ce.s_asterisk?this.skipCStyleComments_():e===Ce.s_forwardslash?this.skipCppStyleComments_():t("invalid token")}skipWhiteSpace_(){let e;do{this.m_eof()&&t("invalid token");let n=this.m_peekChar();for(;n>=9&&n<=13||32===n;)this.m_increment(),this.m_eof()&&t("invalid token"),n=this.m_peekChar();n===Ce.s_forwardslash?(this.m_startToken=this.m_endToken,e=!0,this.skipComments_()):e=!1}while(e)}rightBracket_(){return this.m_peekChar()===Ce.s_endArray&&(this.m_startToken=this.m_endToken,this.m_increment(),this.m_currentTokenType=4,!0)}rightBrace_(){return this.m_peekChar()===Ce.s_endObject&&(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()&&t("invalid token");let e=this.m_peekChar();for(;e!==Ce.s_doubleQuote;){const n=e===Ce.s_backslash;if(this.m_stepOverChar(),this.m_eof()&&t("invalid token"),e=this.m_peekChar(),n)if(this.m_bHasEscapes=!0,e===Ce.s_doubleQuote||e===Ce.s_backslash||e===Ce.s_forwardslash||e===Ce.s_b||e===Ce.s_f||e===Ce.s_n||e===Ce.s_r||e===Ce.s_t)this.m_stepOverChar(),this.m_eof()&&t("invalid token"),e=this.m_peekChar();else if(e===Ce.s_u)for(let r=0;r<4;r++)this.m_stepOverChar(),this.m_eof()&&t("invalid token"),e=this.m_peekChar(),e>=Ce.s_zero&&e<=Ce.s_nine||e>=Ce.s_a&&e<=Ce.s_f||e>=Ce.s_A&&e<=Ce.s_F||t("invalid token");else t("invalid token")}this.m_stepOverChar()}comma_(){return this.m_peekChar()===Ce.s_comma&&(this.m_increment(),!0)}colon_(){return this.m_peekChar()===Ce.s_colon&&(this.m_increment(),!0)}fieldNameEnd_(){this.skipWhiteSpace_(),this.m_functionStack.pop(),this.colon_()?(this.skipWhiteSpace_(),this.value_()):t("invalid token")}fieldNameStart_(){this.m_startToken=this.m_endToken;this.m_peekChar()!==Ce.s_doubleQuote&&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():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():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()!==Ce.s_zero?this.digits_():this.m_stepOverChar()}digits_(){let e=this.m_peekChar();do{this.m_stepOverChar(),this.m_eof()&&t("invalid token"),e=this.m_peekChar()}while(e>=Ce.s_zero&&e<=Ce.s_nine)}frac_(){let e=this.m_peekChar();this.m_stepOverChar(),this.m_eof()&&t("invalid token"),e=this.m_peekChar(),e>=Ce.s_zero&&e<=Ce.s_nine||t("invalid token"),this.digits_()}exp_(){let e=this.m_peekChar();this.m_stepOverChar(),this.m_eof()&&t("invalid token"),e=this.m_peekChar(),e!==Ce.s_plus&&e!==Ce.s_minus||(this.m_stepOverChar(),this.m_eof()&&t("invalid token"),e=this.m_peekChar()),e>=Ce.s_zero&&e<=Ce.s_nine||t("invalid token"),this.digits_()}valueNumber_(){this.m_prepSubstr();let e=!1,n=this.m_peekChar();if(n===Ce.s_minus?(this.m_stepOverChar(),this.m_eof()&&t("invalid token"),n=this.m_peekChar(),e=!0,n>=Ce.s_zero&&n<=Ce.s_nine||t("invalid token"),this.int_()):this.int_(),n=this.m_peekChar(),n===Ce.s_period)this.m_currentTokenType=7,this.frac_(),n=this.m_peekChar(),n!==Ce.s_e&&n!==Ce.s_E||this.exp_();else if(n===Ce.s_e||n===Ce.s_E)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:n}=this.m_get(5);n&&t("invalid token"),"null"!==e&&t("invalid token"),this.m_currentTokenType=10}valueTrue_(){const{s:e,bDone:n}=this.m_get(5);n&&t("invalid token"),"true"!==e&&t("invalid token"),this.m_currentTokenType=11}valueFalse_(){const{s:e,bDone:n}=this.m_get(6);n&&t("invalid token"),"false"!==e&&t("invalid token"),this.m_currentTokenType=12}valueNan_(){const{s:e,bDone:n}=this.m_get(4);n&&t("invalid token"),"NaN"!==e&&t("invalid token"),this.m_currentTokenType=7}value_(){this.m_startToken=this.m_endToken;const e=this.m_peekChar();e===Ce.s_beginObject?this.valueStartObject_():e===Ce.s_beginArray?this.valueStartArray_():e===Ce.s_doubleQuote?this.valueString_():e===Ce.s_minus||e>=Ce.s_zero&&e<=Ce.s_zero+9?this.valueNumber_():e===Ce.s_n?this.valueNull_():e===Ce.s_t?this.valueTrue_():e===Ce.s_f?this.valueFalse_():e===Ce.s_N?this.valueNan_():t("invalid token")}start_(){this.skipWhiteSpace_(),this.m_functionStack.pop(),this.m_functionStack.push(()=>this.accept_());const e=this.m_peekChar();e!==Ce.s_beginObject&&e!==Ce.s_beginArray&&t("invalid token"),this.value_()}accept_(){this.m_startToken=this.m_endToken,this.m_currentTokenType=0}}class Fe{getOperatorType(){return 10404}accelerateGeometry(e,t,n){return!1}canAccelerateGeometry(e){return!1}supportsCurves(){return!0}execute(e,n,r,i,s,a,o){let u;"string"==typeof r?(u=new De({jsonString:r}),u.nextToken()):u=r,1!==u.currentToken()&&t("failed to import map geometry: start of object is expected");const m=K(n,e,u,i,s);return new g(m)}importSpatialReference(t){const n=J(t);return null===n&&e("failed to import spatial reference"),n}importProjectionTransformation(e,t){return n(0),{}}importDatumTransformation(e,t){return n(0),{}}static stringToGeometryType(e){return(e=e.toLowerCase()).startsWith("esrigeometry")||t("string_to_geometry_type"),e.endsWith("point")?s.enumPoint:e.endsWith("envelope")?s.enumEnvelope:e.endsWith("multipoint")?s.enumMultiPoint:e.endsWith("polyline")?s.enumPolyline:e.endsWith("polygon")?s.enumPolygon:void t("string_to_geometry_type")}}const je=new Y,ze=new ye,Oe=new Fe;function Ie(e){return Array.isArray(e)?e[0].spatialReference:e.spatialReference}function Ee(e,t){const n=new L(e,{strict:!1});return n.nextToken(),Oe.execute(0,s.enumUnknown,n,!0,t)}function Pe(e){let t=null;return[e.map(e=>{if(null==t){const n=Be(e);return t=n.getSpatialReference(),n.getGeometry()}return Ve(e)}),t]}function Be(e){return Ee(e,!0)}function Ve(e){return Ee(e,!1).getGeometry()}function Me(e,t){return e instanceof g&&(t=e.getSpatialReference(),e=e.getGeometry()),e?.isEmpty()?null:(je.reset(),ze.execute(0,e,t,je),je.getObject())}export{Pe as fromGeometries,Be as fromGeometry,Ve as fromGeometryToGXGeometry,Ie as getSpatialReference,Me as toGeometry};
5
+ import{d as e,a as t,g as n,q as r,p as i,G as s,t as a}from"../../../chunks/Geometry.js";import{aJ as o,i as u,d as m,P as l,b as c,aK as d,m as _}from"../../../chunks/Point2D.js";import{q as h,b as f,p,a$ as k,c as b,e as y,a as N,f as T,b0 as g}from"../../../chunks/UnitFactory.js";import{a1 as v,a4 as x,P as A,E as S,$ as w,a0 as C,a5 as D,a6 as F,X as j}from"../../../chunks/Envelope.js";import{a as z,P as O,S as I,M as E,J as P,a5 as B,a6 as V,a7 as M,a8 as R,a9 as U}from"../../../chunks/MultiPathImpl.js";import"./initNoPeFactory.js";function W(){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 X(){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}}class L{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:W}}createJSONArrayIterator(e){return{m_iteratorType:"array",m_strict:this.m_options.strict,m_i:-1,m_a:e,next:X}}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>=o()&&this.m_currentValue<=u()?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;e("unrecognized json element type")}return e("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&&t("invalid token"),this.m_currentValue}currentDoubleValue(){return 7!==this.m_currentToken&&8!==this.m_currentToken&&t("invalid token"),this.m_currentValue}currentInt32Value(){return 8!==this.m_currentToken&&t("invalid token"),this.m_currentValue}currentInt64Value(){return n(0),0n}currentBoolValue(){return 12!==this.m_currentToken&&11!==this.m_currentToken&&t("invalid token"),this.m_currentValue}isError(){return 0}}class Y{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){n(0)}addInt32(e){this.addValue_(e)}addBool(e){this.addValue_(e)}addNull(){this.addValue_(null)}getObject(){return this.m_acceptedObject}}class G{constructor(t){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!==t.sz?(this.m_sz=t.sz,t.buffer?(this.m_sz<0&&r("size out of range"),this.m_buffer=t.buffer,this.m_offset=void 0!==t.offset?t.offset:0,this.m_view=void 0!==t.offset?new DataView(t.buffer,t.offset,t.sz):new DataView(this.m_buffer),this.m_bOwnsBuffer=!1,void(this.m_bLittleEndian=!0)):(this.m_sz<0&&r("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))))):t.move?(this.m_sz=t.move.m_sz,this.m_buffer=t.move.m_buffer,this.m_view=t.move.m_view,this.m_bOwnsBuffer=t.move.m_bOwnsBuffer,this.m_bLittleEndian=t.move.m_bLittleEndian,t.move.m_buffer=null,t.move.m_view=null,t.move.m_sz=0,void(t.move.m_bOwnsBuffer=!0)):void e("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===G.getNativeByteOrder())}setNativeByteOrder(){this.m_bLittleEndian=1===G.getNativeByteOrder()}setOrder(e){this.m_bLittleEndian=1===e}getOrder(){return this.m_bLittleEndian?1:0}getView(){return this.m_view||i("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){n(e>=0&&e<=this.m_sz),this.m_sz=e}}function q(e,r,i,a,o,u){let m=!1,l=!1,c=!1,d=!1,_=!1,h=!1,f=!1,p=!1,k=!1,b=!1,y=!1,N=!1,T=!1,g=!1,w=!1,C=!1,D=!1,F=!1,j=!1,z=!1,O=!1,I=!1,E=!1,P=!1,B=Number.NaN,V=Number.NaN,M=Number.NaN,R=Number.NaN,U=0,W=Number.NaN,X=Number.NaN,L=Number.NaN,Y=Number.NaN,G=Number.NaN,q=Number.NaN,K=Number.NaN,ne=Number.NaN,re=0,ie=0,se=!1,ae=!1,oe=null,ue=null,me=null,le=null,ce=null;for(;3!==i.nextToken();){const u=i.currentString();if(i.nextToken(),"spatialReference"===u){if(o&&!m){m=!0,1===i.currentToken()?le=J(i):10!==i.currentToken()&&t("failed to parse spatial reference: object or null is expected");continue}}else if(a)if("hasZ"===u){if(!l){l=!0,se=11===i.currentToken();continue}}else if("hasM"===u){if(!c){c=!0,ae=11===i.currentToken();continue}}else if("rings"===u){if(!(_||h||e!==s.enumUnknown&&e!==s.enumPolygon)){_=!0,({geometry:ce,as:oe,bs:ue}=Q(!0,!1,r,i));continue}}else if("curveRings"===u){if(!h&&(e===s.enumUnknown||e===s.enumPolygon)){h=!0,({geometry:ce,as:oe,bs:ue}=Q(!0,!0,r,i));continue}}else if("paths"===u){if(!(f||p||e!==s.enumUnknown&&e!==s.enumPolyline)){f=!0,({geometry:ce,as:oe,bs:ue}=Q(!1,!1,r,i));continue}}else if("curvePaths"===u){if(!p&&(e===s.enumUnknown||e===s.enumPolyline)){p=!0,({geometry:ce,as:oe,bs:ue}=Q(!1,!0,r,i));continue}}else if("points"===u){if(!k&&(e===s.enumUnknown||e===s.enumMultiPoint)){k=!0,({geometry:ce,as:oe,bs:ue}=Z(r,i));continue}}else if("ids"===u){if(!d){d=!0,me=H(r,i);continue}}else if("x"===u){if(!b&&(e===s.enumUnknown||e===s.enumPoint)){b=!0,B=$(i);continue}}else if("y"===u){if(!y&&(e===s.enumUnknown||e===s.enumPoint)){y=!0,V=$(i);continue}}else if("z"===u){if(!N&&(e===s.enumUnknown||e===s.enumPoint)){N=!0,M=$(i);continue}}else if("m"===u){if(!T&&(e===s.enumUnknown||e===s.enumPoint)){T=!0,R=$(i);continue}}else if("id"===u){if(!g&&(e===s.enumUnknown||e===s.enumPoint)){g=!0,U=ee(i);continue}}else if("xmin"===u){if(!w&&(e===s.enumUnknown||e===s.enumEnvelope)){w=!0,W=$(i);continue}}else if("ymin"===u){if(!C&&(e===s.enumUnknown||e===s.enumEnvelope)){C=!0,X=$(i);continue}}else if("mmin"===u){if(!O&&(e===s.enumUnknown||e===s.enumEnvelope)){O=!0,K=$(i);continue}}else if("zmin"===u){if(!j&&(e===s.enumUnknown||e===s.enumEnvelope)){j=!0,G=$(i);continue}}else if("idmin"===u){if(!E&&(e===s.enumUnknown||e===s.enumEnvelope)){E=!0,re=ee(i);continue}}else if("xmax"===u){if(!D&&(e===s.enumUnknown||e===s.enumEnvelope)){D=!0,L=$(i);continue}}else if("ymax"===u){if(!F&&(e===s.enumUnknown||e===s.enumEnvelope)){F=!0,Y=$(i);continue}}else if("mmax"===u){if(!I&&(e===s.enumUnknown||e===s.enumEnvelope)){I=!0,ne=$(i);continue}}else if("zmax"===u){if(!z&&(e===s.enumUnknown||e===s.enumEnvelope)){z=!0,q=$(i);continue}}else if("idmax"===u){if(!P&&(e===s.enumUnknown||e===s.enumEnvelope)){P=!0,ie=ee(i);continue}}else"materials"===u&&n(0);i.skipChildren()}if(_||h||f||p||k){let e=null,t=null;const n=ce;se&&(ce.addAttribute(1),e=oe,e||(e=v(n.getPointCount(),Number.NaN))),ae&&(ce.addAttribute(2),t=se?ue:oe),null!=me&&ce.addAttribute(3),se&&null!=e&&n.setAttributeStreamRef(1,e),ae&&null!=t&&n.setAttributeStreamRef(2,t),null!=me&&te(n,me)}else if(b||y||T||N||g){x(B,V)||t("failed to parse point: x and y must be finite or nan"),(Number.isNaN(V)||Number.isNaN(B))&&(B=Number.NaN,V=Number.NaN);const e=new A({x:B,y:V});N&&e.setZ(M),T&&e.setM(R),g&&e.setID(U),ce=e}else if(w||C||D||F||j||z||O||I||E||P){(Number.isNaN(X)||Number.isNaN(L)||Number.isNaN(Y))&&(W=Number.NaN);const e=new S({xmin:W,ymin:X,xmax:L,ymax:Y});j&&z&&e.setInterval(1,0,G,q),O&&I&&e.setInterval(2,0,K,ne),E&&P&&e.setInterval(3,0,re,ie),ce=e}return{...ce?{geom:ce}:{},...le?{sr:le}:{}}}function K(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 J(e){let t=!1,n=!1,r=!1,i=!1,s=!1,a=!1,o=!1,u=!1,m=!1,l=!1,c=!1,d=!1,_=!1,g=!1,v=!1,x=!1,A=!1,S=-1,w=-1,C=-1,D=-1,F=0,j=0,z=0,O=0,I=0,E=0,P=0,B=0,V=0,M=0,R="",U="",W=null;for(;3!==e.nextToken();){const h=e.currentString();e.nextToken(),"wkid"===h?t||(t=!0,8===e.currentToken()&&(S=e.currentInt32Value())):"latestWkid"===h?n||(n=!0,8===e.currentToken()&&(w=e.currentInt32Value())):"wkt"===h?s||(s=!0,6===e.currentToken()&&(R=e.currentString())):"wkt2"===h?s||6===e.currentToken()&&(U=e.currentString()):"vcsWkid"===h?r||(r=!0,8===e.currentToken()&&(C=e.currentInt32Value())):"latestVcsWkid"===h?i||(i=!0,8===e.currentToken()&&(D=e.currentInt32Value())):"xyTolerance"===h?o||(o=!0,a=!0,F=e.currentDoubleValue()):"zTolerance"===h?u||(u=!0,a=!0,j=e.currentDoubleValue()):"mTolerance"===h?m||(m=!0,a=!0,z=e.currentDoubleValue()):"falseX"===h?l||(l=!0,a=!0,P=e.currentDoubleValue()):"falseY"===h?c||(c=!0,a=!0,B=e.currentDoubleValue()):"falseZ"===h?d||(d=!0,a=!0,V=e.currentDoubleValue()):"falseM"===h?_||(_=!0,a=!0,M=e.currentDoubleValue()):"xyUnits"===h?g||(g=!0,a=!0,O=e.currentDoubleValue()):"zUnits"===h?v||(v=!0,a=!0,I=e.currentDoubleValue()):"mUnits"===h?x||(x=!0,a=!0,E=e.currentDoubleValue()):"unit"===h?A||(A=!0,W=K(e)):e.skipChildren()}D<=0&&C>0&&(D=C),C<=0&&D>0&&(C=D);let X=null,L=!0;if(0!==R.length&&(L=!1,h(R)&&(X=f(R))),X||0===U.length||(L=!1,h(U)&&(X=f(U))),!X&&w>0&&(L=!1,p(w)&&(D<=0||k())&&(X=b(w,D))),!X&&S>0&&(L=!1,p(S)&&(C<=0||k())&&(X=b(S,C))),L&&(X=y(W)),a&&X){const e=new N;X.queryPrecisionDescriptorWithoutFalseXY(e),o&&e.setTolerance(0,F),u&&e.setTolerance(1,j),m&&e.setTolerance(2,z),g&&l&&c&&e.setGridParams(P,B,O),v&&d&&e.setZParams(V,I),x&&_&&e.setMParams(M,E),X=T(X,e)}return X}function Q(e,n,r,i){2!==i.currentToken()&&t("failed to parse multipath: array of array of vertices is expected");const s=e?new z:new O,a=s,o=w(0),u=v(2,0),_=C(0);let h=null,f=null,p=null,k=null,b=null,y=0,N=0,T=0;const g=new I,x=l.getNAN();let A=0,S=0;const F=e?1:0;for(;4!==i.nextToken();){2!==i.currentToken()&&t("failed to parse multipath: ring/path array is expected");let r=2,s=0,j=!0;const z=4;let O=0,I=0;const E=l.getNAN(),P=m(z,Number.NaN),B=m(z,Number.NaN);let V=!1;for(i.nextToken();4!==i.currentToken();){if(n&&1===i.currentToken())j&&t("failed to parse multipath: starting vertex array is expected"),p||(p=C(A-1,1),k=w(A-1,-1),b=v(0)),V=!0,r=1,({segFlag:T,toPointSz:O}=ue(g,P,x,i));else{for(V=!1,2!==i.currentToken()&&t("failed to parse multipath: array is expected, rings/paths vertices consist of arrays of coordinates"),O=0;4!==i.nextToken();)O===z&&t("failed to parse multipath: each vertex array has to have at most 4 elements"),P[O++]=$(i);O<2&&t("failed to parse multipath: each vertex array has to have at least 2 elements"),D(P[0],P[1])||t("failed to parse multipath: x and y must be finite")}i.nextToken();do{if(u.size()===2*A&&u.resize(ne(A)),u.writePoint2D(2*A,E.setCoords(P[0],P[1])),h&&h.size()===A&&h.resize(re(A)),O>2?(h||(h=v(A+1,Number.NaN)),h.write(A,P[2])):h&&h.write(A,Number.NaN),f&&f.size()===A&&f.resize(re(A)),O>3?(f||(f=v(A+1,Number.NaN)),f.write(A,P[3])):f&&f.write(A,Number.NaN),j)S++,o.add(A),_.add(F),j=!1,I=O,c(B,P,0,0,I);else if(null!==p)if(V){const e=U(T),t=b.size();b.resize(t+e),p.add(T),k.add(y),g.get().writeInBufferStream(b,y),y+=e,a.incCurveType(T,1),N++}else p.add(1),k.add(-1);A++,s++,x.setCoords(P[0],P[1])}while(s<r&&4===i.currentToken())}0!==s&&(e&&s>r&&O===I&&0===d(P,B,O)?(A--,s--):null!==p&&(p.add(1),k.add(-1)))}return A&&(o.resize(S),_.resize(S),A>0&&(o.add(A),_.add(0)),a.setAttributeStreamRef(0,u),a.setPathFlagsStreamRef(_),a.setPathStreamRef(o),null!==p&&(a.updateCurveCounter(N),a.setSegmentData(k,b,p,y)),a.notifyModifiedFlags(65535)),{geometry:s,as:h,bs:f}}function Z(e,n){2!==n.currentToken()&&t("failed to parse multipoint: array of vertices is expected");let r=0;const i=new E,s=v(2,0);let a=0;const o=4,u=m(o,Number.NaN),c=new l;let d=null,_=null;for(;4!==n.nextToken();){for(2!==n.currentToken()&&t("failed to parse multipoint: array is expected, multipoint vertices consist of arrays of cooridinates"),a=0;4!==n.nextToken();)a===o&&t("failed to parse multipoint: each vertex array has to have at most 4 elements"),u[a++]=$(n);a<2&&t("failed to parse multipoint: each vertex array has to have at least 2 elements"),D(u[0],u[1])||t("failed to parse multipoint: x and y must be finite"),s.size()===2*r&&s.resize(ne(r)),s.writePoint2D(2*r,c.setCoords(u[0],u[1])),d&&d.size()===r&&d.resize(re(r)),a>2?(d||(d=v(r+1,Number.NaN)),d.write(r,u[2])):d&&d.write(r,Number.NaN),_&&_.size()===r&&_.resize(re(r)),a>3?(_||(_=v(r+1,Number.NaN)),_.write(r,u[3])):_&&_.write(r,Number.NaN),r++}if(r){const e=i.getImpl();e.setAttributeStreamRef(0,s),e.resizeNoInit(r),e.notifyModifiedFlags(65535)}return{geometry:i,as:d,bs:_}}function H(e,n){2!==n.currentToken()&&t("failed to parse array of IDs: array of array of integers is expected");const r=F(2,0);let i=0,s=-1;for(;4!==n.nextToken();){const e=i;r.size()===i&&r.resize(re(i)),i++;let a=0;for(-1===s?s=2===n.currentToken()?1:0:1===s&&2!==n.currentToken()&&t("failed to parse array of IDs: array of array of integers is expected"),0===s&&(r.size()===i&&r.resize(re(i)),r.write(i,ee(n)),a++,i++);4!==n.nextToken();)r.size()===i&&r.resize(re(i)),r.write(i,ee(n)),a++,i++;if(r.write(e,a),0===s)break}return r.resize(i),r}function $(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 ee(e){return e.currentInt32Value()}function te(t,n){if(t.isEmpty())return;const r=F(2,0),i=t.getGeometryType();let s=0;i===E.type?s=1:i===O.type||i===z.type?s=t.getPathCount():e("not implemented"),r.resize(t.getPointCount(),0);let a=0;for(let o=0;o<s;++o){const s=n.read(a);a++;const u=a+s;let m=0,l=0;i===E.type?m=t.getPointCount():i===O.type||i===z.type?(m=t.getPathSize(o),l=t.getPathStart(o)):e("not implemented");for(let e=0,t=Math.min(s,m);e<t;++e)r.write(l,n.read(a)),a++,l++;a=u}t.getImpl().setAttributeStreamRef(3,r)}function ne(e){let t=2*Math.trunc(3*(e+1)/2);return t<8?t=8:t<32&&(t=32),t}function re(e){let t=Math.trunc(3*(e+1)/2);return t<4?t=4:t<16&&(t=16),t}function ie(e,t,n,i,s){s>=i.size()&&r("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 a=l.getNAN();a.x=i.readDouble(s),a.y=i.readDouble(s+8);const o=i.readInt32(s+16);if(!!(1&o))return e.m_semiMajorAxis=0,e.m_minorMajorRatio=1,e.m_interior.assign(a),e.m_center.setNAN(),e.m_sweepAngle=0,e.m_startAngle=0,V(e),!1;let u=!!(64&o);const m=!!(128&o);let c=!!(32&o);const d=!!(8&o),_=!!(16&o),h=t.equals(n);return u&&!h&&(u=!1,c=!0),c&&h&&(u=!0,c=!1,a.setCoords(0,0)),u||(m?c?(e.m_semiMajorAxis=1,e.m_minorMajorRatio=0,e.m_interior.assign(a),e.m_center.setNAN(),e.m_sweepAngle=0,e.m_startAngle=0):(e.constructCircularArcThreePoint(t,n,a),h&&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,V(e),e.queryCoord2D(.5,e.m_interior)):M(e,t,n,a,d,_)),u&&(e.m_center.assign(t),e.m_startAngle=a.x,e.m_sweepAngle=a.y,R(e,Number.NaN,d,_),e.m_semiMajorAxis=0,e.m_minorMajorRatio=1,e.m_interior.setCoordsPoint2D(t)),e.setProjectionBehavior(0),V(e),!0}function se(e,t,n,r,i){e.m_bits=0,e.m_center.x=r.readDouble(i),e.m_center.y=r.readDouble(i+8),e.m_rotation=r.readDouble(i+16),e.m_semiMajorAxis=r.readDouble(i+24),e.m_minorMajorRatio=r.readDouble(i+32),e.m_XStart=t.x,e.m_YStart=t.y,e.m_XEnd=n.x,e.m_YEnd=n.y;const s=r.readInt32(i+40);if(1&s)return!1;let a=!!(64&s),o=!!(128&s);const u=!!(2048&s),m=!!(4096&s);return!!!(512&s)&&!!!(1024&s)||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,R(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,V(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),V(e),!0}function ae(e,t,r,i,s){return n(s+32<=i.size()),e.m_cp=_(l,2),e.m_cp[0].x=i.readDouble(s),e.m_cp[0].y=i.readDouble(s+8),e.m_cp[1].x=i.readDouble(s+16),e.m_cp[1].y=i.readDouble(s+24),e.m_XStart=t.x,e.m_YStart=t.y,e.m_XEnd=r.x,e.m_YEnd=r.y,!0}function oe(e,t,n,r,i){return e.m_cp.x=r.readDouble(i),e.m_cp.y=r.readDouble(i+8),e.m_weights[0]=r.readDouble(i+16),e.m_weights[1]=r.readDouble(i+24),e.m_weights[2]=r.readDouble(i+32),e.m_XStart=t.x,e.m_YStart=t.y,e.m_XEnd=n.x,e.m_YEnd=n.y,!0}function ue(e,n,r,i,s){const a={segFlag:0,toPointSz:0};let o=i.currentToken();o=i.nextToken();const u=i.currentString(),m=u[0];for((1!==u.length||"a"!==m&&"b"!==m&&"c"!==m&&"n"!==m&&"q"!==m)&&t('failed to parse curve: expecting "a", "b", "n", "q", or "c"'),o=i.nextToken(),2!==o&&t("failed to parse curve: start array is expected for curve parameters"),o=i.nextToken(),2!==o&&t("failed to parse curve: start array is expected for to point"),a.toPointSz=0;4!==i.nextToken();)4===a.toPointSz&&t("failed to parse curve: vertex array cannot have more than 4 elements"),n[a.toPointSz++]=$(i);a.toPointSz<2&&t("failed to parse curve: vertex array must have at least 2 elements");const c=l.construct(n[0],n[1]),d=l.getNAN();let _=-1,h=-1,f=!1,p=Number.NaN,k=Number.NaN,b=Number.NaN;const y=[l.getNAN(),l.getNAN(),l.getNAN()],N=l.getNAN();if("a"===m){o=i.nextToken(),2!==o&&t("failed to parse curve: start array is expected for center point"),o=i.nextToken();const e=$(i);o=i.nextToken();const n=$(i);o=i.nextToken(),4!==o&&t("failed to parse curve: end array is expected for center point"),d.setCoords(e,n),o=i.nextToken(),_=i.currentInt32Value(),o=i.nextToken(),h=i.currentInt32Value(),o=i.nextToken(),4!==o?(f=!1,p=$(i),o=i.nextToken(),k=$(i),o=i.nextToken(),b=$(i),o=i.nextToken(),4!==o&&t("failed to parse curve: end array is expected for curve parameters")):f=!0,a.segFlag=4}else if("b"===m){for(let e=0;e<2;e++){o=i.nextToken(),2!==o&&t("failed to parse curve: start array is expected for control point"),o=i.nextToken();const n=$(i);o=i.nextToken();const r=$(i);o=i.nextToken(),4!==o&&t("failed to parse curve: end array is expected for control point"),y[e].setCoords(n,r)}o=i.nextToken(),4!==o&&t("failed to parse curve: end array is expected for curve parameters"),a.segFlag=2}else if("n"===m){{o=i.nextToken(),2!==o&&t("failed to parse curve: start array is expected for control point"),o=i.nextToken();const e=$(i);o=i.nextToken();const n=$(i);o=i.nextToken(),4!==o&&t("failed to parse curve: end array is expected for control point"),y[0].setCoords(e,n)}o=i.nextToken();const e=$(i);o=i.nextToken();const n=$(i);o=i.nextToken();const r=$(i);y[1].setCoords(e,n),y[2].setCoords(r,r),o=i.nextToken(),4!==o&&t("failed to parse curve: end array is expected for curve parameters"),a.segFlag=8}else if("q"===m){for(let e=0;e<1;e++){o=i.nextToken(),2!==o&&t("failed to parse curve: start array is expected for control point"),o=i.nextToken();const n=$(i);o=i.nextToken();const r=$(i);o=i.nextToken(),4!==o&&t("failed to parse curve: end array is expected for control point"),y[e].setCoords(n,r)}o=i.nextToken(),4!==o&&t("failed to parse curve: end array is expected for curve parameters"),a.segFlag=16}else{o=i.nextToken(),2!==o&&t("failed to parse curve: start array is expected for interior point"),o=i.nextToken();const e=$(i);o=i.nextToken();const n=$(i);o=i.nextToken(),4!==o&&t("failed to parse curve: end array is expected for interior point"),N.setCoords(e,n),o=i.nextToken(),4!==o&&t("failed to parse curve: end array is expected for curve parameters"),a.segFlag=4}if(o=i.nextToken(),3!==o&&t("failed to parse curve: end object is expected for curve"),"a"===m)if(e.createEllipticArc(),f){const t=!0;me(e.get(),r,c,d,t,_,h)}else le(e.get(),r,c,d,_,h,p,k,b);else if("b"===m)e.createCubicBezier(),ce(e.get(),r,c,y);else if("n"===m)e.createQuadraticRationalBezier(),de(e.get(),r,c,y[0],y[1].x,y[1].y,y[2].x);else if("q"===m)e.createQuadraticBezier(),e.get().construct(r,y[0],c);else{e.createEllipticArc();const t=!1;me(e.get(),r,c,N,t,-1,-1)}return a}function me(e,t,n,r,i,s,a){e.dropAllAttributes();const o=20,u=new ArrayBuffer(o),m=new G({sz:o,buffer:u});let l=0;m.writeDouble(l,r.x),l+=8,m.writeDouble(l,r.y),l+=8;let c=0;i?(a||(c|=8),s&&(c|=16)):c|=128,m.writeInt32(l,c),l+=4,ie(e,t,n,m,0)}function le(e,t,n,r,i,s,a,o,u){e.dropAllAttributes();const m=44,l=new ArrayBuffer(m),c=new G({sz:m,buffer:l});let d=0;c.writeDouble(d,r.x),d+=8,c.writeDouble(d,r.y),d+=8,c.writeDouble(d,a),d+=8,c.writeDouble(d,o),d+=8,c.writeDouble(d,u),d+=8;let _=0;s||(_|=2048),i&&(_|=4096),c.writeInt32(d,_),d+=4,se(e,t,n,c,0)}function ce(e,t,n,r){e.dropAllAttributes();const i=32,s=new ArrayBuffer(i),a=new G({sz:i,buffer:s});let o=0;a.writeDouble(o,r[0].x),o+=8,a.writeDouble(o,r[0].y),o+=8,a.writeDouble(o,r[1].x),o+=8,a.writeDouble(o,r[1].y),o+=8,ae(e,t,n,a,0)}function de(e,t,n,r,i,s,a){e.dropAllAttributes();const o=40,u=new ArrayBuffer(o),m=new G({sz:o,buffer:u});let l=0;m.writeDouble(l,r.x),l+=8,m.writeDouble(l,r.y),l+=8,m.writeDouble(l,i),l+=8,m.writeDouble(l,s),l+=8,m.writeDouble(l,a),l+=8,oe(e,t,n,m,0)}function _e(e,t,n,r,i){const o=e.getGeometryType();if(o===s.enumEllipticArc)return he(e,t,n,r,i);if(o===s.enumBezier)return fe(e,t,n,r,i);if(o===s.enumRationalBezier2)return pe(e,t,n,r,i);if(o===s.enumBezier2){const s=new P;return s.constructFromQuadraticSegment(e),fe(s,t,n,r,i)}a("")}function he(e,t,r,i,s){n(!B(e));const a=e.getEndXY(),o=e.hasAttribute(1)&&!t,u=e.hasAttribute(2)&&!r;let m=Number.NaN,l=Number.NaN;if(o&&(m=e.getEndAttributeAsDbl(1,0)),u&&(l=e.getEndAttributeAsDbl(2,0)),e.isDegenerateToLine()||e.isDegenerate(0))return ke(o,u,a.x,a.y,m,l,i,s),!0;const c=0===e.projectionBehavior(),d=!!c&&e.isClosed();if(c&&!d)s.startObject(),s.addFieldName("c"),s.startArray(),ke(o,u,a.x,a.y,m,l,i,s),be(e.m_interior.x,e.m_interior.y,17,s),s.endArray(),s.endObject();else if(c){s.startObject(),s.addFieldName("a"),s.startArray(),ke(o,u,a.x,a.y,m,l,i,s);const t=0,n=0;be(e.m_center.x+t,e.m_center.y+n,17,s);const r=!e.isMajor();s.addInt32(r?1:0);const c=e.isClockwise();s.addInt32(c?1:0),s.endArray(),s.endObject()}else{s.startObject(),s.addFieldName("a"),s.startArray(),ke(o,u,a.x,a.y,m,l,i,s);const t=e;be(t.m_center.x,t.m_center.y,17,s);const n=!t.isMajor();s.addInt32(n?1:0);const r=t.isClockwise();s.addInt32(r?1:0),s.addDouble(t.m_rotation,17),s.addDouble(t.m_semiMajorAxis,17),s.addDouble(t.m_minorMajorRatio,17),s.endArray(),s.endObject()}return!1}function fe(e,t,n,r,i){const s=e.getEndXY(),a=e.hasAttribute(1)&&!t,o=e.hasAttribute(2)&&!n;let u=Number.NaN,m=Number.NaN;return a&&(u=e.getEndAttributeAsDbl(1,0)),o&&(m=e.getEndAttributeAsDbl(2,0)),i.startObject(),i.addFieldName("b"),i.startArray(),ke(a,o,s.x,s.y,u,m,r,i),be(e.m_cp[0].x,e.m_cp[0].y,r,i),be(e.m_cp[1].x,e.m_cp[1].y,r,i),i.endArray(),i.endObject(),!1}function pe(e,t,n,r,i){const s=e.getEndXY(),a=e.hasAttribute(1)&&!t,o=e.hasAttribute(2)&&!n;let u=Number.NaN,m=Number.NaN;a&&(u=e.getEndAttributeAsDbl(1,0)),o&&(m=e.getEndAttributeAsDbl(2,0)),i.startObject(),i.addFieldName("n"),i.startArray(),ke(a,o,s.x,s.y,u,m,r,i),be(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}function ke(e,t,n,r,i,s,a,o){o.startArray(),o.addDouble(n,a),o.addDouble(r,a),e&&o.addDouble(i,a),t&&o.addDouble(s,a),o.endArray()}function be(e,t,n,r){r.startArray(),r.addDouble(e,n),r.addDouble(t,n),r.endArray()}class ye{getOperatorType(){return 10405}accelerateGeometry(e,t,n){return!1}canAccelerateGeometry(e){return!1}supportsCurves(){return!0}execute(e,t,n,r,i,s){Ne(e,t,n,r)}exportSpatialReference(e,t,r,i){n(0)}exportProjectionTransformation(e,t,r,i){n(0)}exportDatumTransformation(e,t,r,i){n(0)}static geometryTypeToString(e){return n(0),""}}function Ne(t,r,i,a,o){if(r||i){if(a.startObject(),null!==r){switch(r.getGeometryType()){case s.enumPolygon:Te(!0,t,r,a);break;case s.enumPolyline:Te(!1,t,r,a);break;case s.enumMultiPoint:ge(t,r,a);break;case s.enumPoint:ve(t,r,a);break;case s.enumEnvelope:xe(t,r,a);break;case s.enumMultipatch:n(0);break;default:e("exportToJSON")}}null!==i&&(a.addFieldName("spatialReference"),Se(t,i,a)),a.endObject()}}function Te(e,t,r,i){const s=r.getImpl(),o=!!(2&t),u=!!(4&t),m=!!(8&t),l=s.hasAttribute(1)&&!o,c=s.hasAttribute(2)&&!u,d=s.hasAttribute(3)&&!m,_=s.hasNonLinearSegments();l&&(i.addFieldName("hasZ"),i.addBool(!0)),c&&(i.addFieldName("hasM"),i.addBool(!0)),e?_?i.addFieldName("curveRings"):i.addFieldName("rings"):_?i.addFieldName("curvePaths"):i.addFieldName("paths");let h=null;const f=[];if(r.isEmpty())i.startArray(),i.endArray();else{const e=17-(31&t>>13);i.startArray();const n=r.getPathCount();let m=0;const p=s.getAttributeStreamRef(0);let k=null,b=null,y=null;const N=new I;let T=null,g=null,v=null;_&&(T=s.getSegmentFlagsStreamRef(),g=s.getSegmentIndexStreamRef(),v=s.getSegmentDataStreamRef()),l&&(k=s.getAttributeStreamRef(1)),c&&(b=s.getAttributeStreamRef(2)),d&&(y=s.getAttributeStreamRef(3),h=j(3,0));for(let t=0;t<n;t++){i.startArray(),d&&f.push(0);const n=r.getPathEnd(t);if(m===n){i.endArray();continue}const s=r.isClosedPath(t);let _=p.read(2*m),x=p.read(2*m+1),A=l?k.read(m):Number.NaN,S=c?b.read(m):Number.NaN,w=d?y.read(m):0;we(l,c,_,x,A,S,e,i);let C=1;d&&(h.add(w),f[f.length-1]++);const D=_,F=x,j=A,z=S,O=w;let I=!1,E=0,P=Number.NaN,B=Number.NaN,V=0;for(let t=m+1,r=m,M=s?n+1:n;t<M;t++,r++){const s=null!==T?31&T.read(r):1;let m,M;if(t<n?(m=p.read(2*t),M=p.read(2*t+1),l&&(P=k.read(t)),c&&(B=b.read(t)),d&&(V=y.read(t))):(m=D,M=F,P=j,B=z,V=O),1!==s){I=!0,4===s?N.createEllipticArc():2===s?N.createCubicBezier():16===s?N.createQuadraticBezier():8===s?N.createQuadraticRationalBezier():a("JSON export.unsupported curve");const t=N.get(),n=g.read(r);t.setStartXYCoords(_,x),t.setEndXYCoords(m,M),l&&(t.setStartAttribute(1,0,A),t.setEndAttribute(1,0,P)),c&&(t.setStartAttribute(2,0,S),t.setEndAttribute(2,0,B)),t.readFromBufferStream(v,n);_e(N.get(),o,u,e,i)&&E++}else we(l,c,m,M,P,B,e,i);d&&(h.add(V),f[f.length-1]++),C++,_=m,x=M,A=P,S=B,w=V}I&&0===E||(C<2&&E<1&&(we(l,c,_,x,A,S,e,i),C++,d&&(h.add(w),f[f.length-1]++)),s&&C<3&&E<2&&(we(l,c,D,F,j,z,e,i),C++,_=D,x=F,A=j,S=z,w=O,d&&(h.add(O),f[f.length-1]++))),i.endArray(),m=n}i.endArray()}if(d){i.addFieldName("ids"),i.startArray();let e=0;for(let t=0,r=f.length;t<r;++t){const r=f[t];n(0===r||null!==h&&e+r<=h.size()),i.startArray();for(let t=0;t<r;++t)i.addInt32(h.read(e)),e++;i.endArray()}i.endArray()}}function ge(e,t,r){const i=t.getImpl(),s=i.hasAttribute(1)&&!(2&e),a=i.hasAttribute(2)&&!(4&e),o=i.hasAttribute(3)&&!(8&e);s&&(r.addFieldName("hasZ"),r.addBool(!0)),a&&(r.addFieldName("hasM"),r.addBool(!0)),r.addFieldName("points");const u=t.getPointCount();if(t.isEmpty())r.startArray(),r.endArray();else{const t=17-(31&e>>13);r.startArray();const n=i.getAttributeStreamRef(0);let o=null,m=null;s&&(o=i.getAttributeStreamRef(1)),a&&(m=i.getAttributeStreamRef(2));for(let e=0;e<u;e++){const i=n.read(2*e),u=n.read(2*e+1);let l=Number.NaN,c=Number.NaN;s&&(l=o.read(e)),a&&(c=m.read(e)),we(s,a,i,u,l,c,t,r)}r.endArray()}if(o){let e=null;i.isEmpty()||(e=i.getAttributeStreamRef(3)),n(0===u||null!==e&&e.size()>=u),r.addFieldName("ids"),r.startArray();for(let t=0;t<u;t++)r.addInt32(e.read(t));r.endArray()}}function ve(e,t,n){const r=t.hasAttribute(1)&&!(2&e),i=t.hasAttribute(2)&&!(4&e),s=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(s&&(n.addFieldName("id"),n.addInt32(0)));const a=17-(31&e>>13);n.addFieldName("x"),n.addDouble(t.getX(),a),n.addFieldName("y"),n.addDouble(t.getY(),a),r&&(n.addFieldName("z"),n.addDouble(t.getZ(),a)),i&&(n.addFieldName("m"),n.addDouble(t.getM(),a)),s&&(n.addFieldName("id"),n.addInt32(t.getID()))}function xe(e,t,n){const r=t.hasAttribute(1)&&!(2&e),i=t.hasAttribute(2)&&!(4&e),s=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(s&&(n.addFieldName("idmin"),n.addInt32(0),n.addFieldName("idmax"),n.addInt32(0)));const a=17-(31&e>>13);if(n.addFieldName("xmin"),n.addDouble(t.getXMin(),a),n.addFieldName("ymin"),n.addDouble(t.getYMin(),a),n.addFieldName("xmax"),n.addDouble(t.getXMax(),a),n.addFieldName("ymax"),n.addDouble(t.getYMax(),a),r){const e=t.queryInterval(1,0);n.addFieldName("zmin"),n.addDouble(e.vmin,a),n.addFieldName("zmax"),n.addDouble(e.vmax,a)}if(i){const e=t.queryInterval(2,0);n.addFieldName("mmin"),n.addDouble(e.vmin,a),n.addFieldName("mmax"),n.addDouble(e.vmax,a)}if(s){const e=t.queryInterval(3,0);n.addFieldName("idmin"),n.addInt32(e.vmin),n.addFieldName("idmax"),n.addInt32(e.vmax)}}function Ae(e,n,r){r.startObject();const i=n.getID();i<=0&&t("cannot export unit that has no valid WKID"),r.addFieldName("uwkid"),r.addInt32(i),r.endObject()}function Se(e,t,n){n.startObject();let r=0;t.isCustomWkid()||(r=t.getOldID());let i=0;const s=t.getVCS();if(null!==s&&(s.isCustomWkid()||(i=s.getOldID()),i<=0&&(r=0)),r>0){n.addFieldName("wkid"),n.addInt32(r);const e=t.getLatestID();if(e>0&&e!==r&&(n.addFieldName("latestWkid"),n.addInt32(e)),i>0){n.addFieldName("vcsWkid"),n.addInt32(i);const e=t.getLatestVerticalID();e!==i&&(n.addFieldName("latestVcsWkid"),n.addInt32(e))}}if(0===t.getCoordinateSystemType())n.addFieldName("wkid"),n.addNull(),null!==t.getUnit()&&(n.addFieldName("unit"),Ae(e,t.getUnit(),n));else if(r<=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 N;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()}function we(e,t,n,r,i,s,a,o){o.startArray(),o.addDouble(n,a),o.addDouble(r,a),e&&o.addDouble(i,a),t&&o.addDouble(s,a),o.endArray()}const Ce={s_a:"a".charCodeAt(0),s_A:"A".charCodeAt(0),s_asterisk:"*".charCodeAt(0),s_b:"b".charCodeAt(0),s_backslash:"\\".charCodeAt(0),s_beginArray:"[".charCodeAt(0),s_beginObject:"{".charCodeAt(0),s_colon:":".charCodeAt(0),s_period:".".charCodeAt(0),s_comma:",".charCodeAt(0),s_doubleQuote:'"'.charCodeAt(0),s_endArray:"]".charCodeAt(0),s_endObject:"}".charCodeAt(0),s_e:"e".charCodeAt(0),s_E:"E".charCodeAt(0),s_f:"f".charCodeAt(0),s_F:"F".charCodeAt(0),s_forwardslash:"/".charCodeAt(0),s_minus:"-".charCodeAt(0),s_plus:"+".charCodeAt(0),s_n:"n".charCodeAt(0),s_N:"N".charCodeAt(0),s_r:"r".charCodeAt(0),s_t:"t".charCodeAt(0),s_u:"u".charCodeAt(0),s_zero:"0".charCodeAt(0),s_nine:"9".charCodeAt(0)};class De{constructor(t){this.m_functionStack=[],this.m_pushPositions=[],this.m_utf8Decoder=new TextDecoder("utf-8",{fatal:!0}),void 0===t?(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):t.jsonString?this.resetParserFromString(t.jsonString):t.jsonStream?a("streaming json parsing not yet impl"):e("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);this.m_endToken+=e-1;return{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_(){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){a("streaming json parsing not yet impl")}resetToPosition(e){return!!this.m_jsonString&&(this.m_endToken=e,this.m_startToken=Number.MAX_VALUE,this.m_currentTokenType=0,this.m_functionStack.length=0,e>=this.m_jsonString.length?(this.m_functionStack.push(()=>this.accept_()),!1):(this.m_functionStack.push(()=>this.start_()),!0))}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 n(0),""}childrenAsString(){return n(0),""}skipChildren(){this.skipChildren_()}skipChildren_(){if(1===this.m_currentTokenType){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);return}if(2===this.m_currentTokenType){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);return}}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"}t("invalid token")}toUTF8_(e,t){let n=0,r=e;for(;t.charCodeAt(r)===Ce.s_backslash&&t.charCodeAt(r+1)===Ce.s_u;)n++,r+=6;r=e;const i=new Uint8Array(n);let s=0;for(;t.charCodeAt(r)===Ce.s_backslash&&t.charCodeAt(r+1)===Ce.s_u;)i[s++]=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 s=t;s<n;s++)if(i.charCodeAt(s)!==Ce.s_backslash)r++;else{switch(r>0&&(e+=i.slice(t,t+r)),i.charCodeAt(++s)){case Ce.s_doubleQuote:e+='"';break;case Ce.s_u:{const{u8s:t,end:n}=this.toUTF8_(s-1,i);s=n-1,e+=t;break}case Ce.s_backslash:e+="\\";break;case Ce.s_forwardslash:e+="/";break;case Ce.s_b:e+="\b";break;case Ce.s_f:e+="\f";break;case Ce.s_n:e+="\n";break;case Ce.s_r:e+="\r";break;case Ce.s_t:e+="\t"}t=s+1,r=0}return r>0&&(e+=i.slice(t,t+r)),e}currentString(){if(5!==this.m_currentTokenType&&6!==this.m_currentTokenType)return this.currentTerminalAsString_();if(this.m_bHasEscapes)return this.unquoteCurrentString_();return 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&&t("invalid token"),10===this.m_currentTokenType)return Number.NaN;let e=this.m_getCurrentSubstr(),n=this.m_endToken-this.m_startToken;if(6===this.m_currentTokenType){if("NaN"===this.currentString())return Number.NaN;e=e.slice(1),n-=2,0===n&&t("invalid token")}const r=Number.parseFloat(e);if(6===this.m_currentTokenType)Number.isNaN(r)&&t("invalid token");else if(Number.isNaN(r))return Number.NaN;return r}currentInt32Value(){8!==this.m_currentTokenType&&6!==this.m_currentTokenType&&t("invalid token");let e=this.m_getCurrentSubstr(),n=this.m_endToken-this.m_startToken;6===this.m_currentTokenType&&(e=e.slice(1),n-=2,0===n&&t("invalid token"));const r=parseInt(e);return Number.isNaN(r)&&t("invalid token"),r}currentInt64Value(){return n(0),0n}currentBoolValue(){return n(0),!1}isError(){return 0}JSONString(){return n(0),""}pushPosition(){return n(0),!1}popPosition(){return n(0),!1}skipCStyleComments_(){n(0)}skipCppStyleComments_(){n(0)}skipComments_(){this.m_prepSubstr();let e=this.m_peekChar();this.m_stepOverChar(),this.m_eof()&&t("invalid token"),e=this.m_peekChar(),e===Ce.s_asterisk?this.skipCStyleComments_():e===Ce.s_forwardslash?this.skipCppStyleComments_():t("invalid token")}skipWhiteSpace_(){let e;do{this.m_eof()&&t("invalid token");let n=this.m_peekChar();for(;n>=9&&n<=13||32===n;)this.m_increment(),this.m_eof()&&t("invalid token"),n=this.m_peekChar();n===Ce.s_forwardslash?(this.m_startToken=this.m_endToken,e=!0,this.skipComments_()):e=!1}while(e)}rightBracket_(){return this.m_peekChar()===Ce.s_endArray&&(this.m_startToken=this.m_endToken,this.m_increment(),this.m_currentTokenType=4,!0)}rightBrace_(){return this.m_peekChar()===Ce.s_endObject&&(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()&&t("invalid token");let e=this.m_peekChar();for(;e!==Ce.s_doubleQuote;){const n=e===Ce.s_backslash;if(this.m_stepOverChar(),this.m_eof()&&t("invalid token"),e=this.m_peekChar(),n)if(this.m_bHasEscapes=!0,e===Ce.s_doubleQuote||e===Ce.s_backslash||e===Ce.s_forwardslash||e===Ce.s_b||e===Ce.s_f||e===Ce.s_n||e===Ce.s_r||e===Ce.s_t)this.m_stepOverChar(),this.m_eof()&&t("invalid token"),e=this.m_peekChar();else if(e===Ce.s_u)for(let r=0;r<4;r++)this.m_stepOverChar(),this.m_eof()&&t("invalid token"),e=this.m_peekChar(),e>=Ce.s_zero&&e<=Ce.s_nine||e>=Ce.s_a&&e<=Ce.s_f||e>=Ce.s_A&&e<=Ce.s_F||t("invalid token");else t("invalid token")}this.m_stepOverChar()}comma_(){return this.m_peekChar()===Ce.s_comma&&(this.m_increment(),!0)}colon_(){return this.m_peekChar()===Ce.s_colon&&(this.m_increment(),!0)}fieldNameEnd_(){this.skipWhiteSpace_(),this.m_functionStack.pop(),this.colon_()?(this.skipWhiteSpace_(),this.value_()):t("invalid token")}fieldNameStart_(){this.m_startToken=this.m_endToken;this.m_peekChar()!==Ce.s_doubleQuote&&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():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():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()!==Ce.s_zero?this.digits_():this.m_stepOverChar()}digits_(){let e=this.m_peekChar();do{this.m_stepOverChar(),this.m_eof()&&t("invalid token"),e=this.m_peekChar()}while(e>=Ce.s_zero&&e<=Ce.s_nine)}frac_(){let e=this.m_peekChar();this.m_stepOverChar(),this.m_eof()&&t("invalid token"),e=this.m_peekChar(),e>=Ce.s_zero&&e<=Ce.s_nine||t("invalid token"),this.digits_()}exp_(){let e=this.m_peekChar();this.m_stepOverChar(),this.m_eof()&&t("invalid token"),e=this.m_peekChar(),e!==Ce.s_plus&&e!==Ce.s_minus||(this.m_stepOverChar(),this.m_eof()&&t("invalid token"),e=this.m_peekChar()),e>=Ce.s_zero&&e<=Ce.s_nine||t("invalid token"),this.digits_()}valueNumber_(){this.m_prepSubstr();let e=!1,n=this.m_peekChar();if(n===Ce.s_minus?(this.m_stepOverChar(),this.m_eof()&&t("invalid token"),n=this.m_peekChar(),e=!0,n>=Ce.s_zero&&n<=Ce.s_nine||t("invalid token"),this.int_()):this.int_(),n=this.m_peekChar(),n===Ce.s_period)this.m_currentTokenType=7,this.frac_(),n=this.m_peekChar(),n!==Ce.s_e&&n!==Ce.s_E||this.exp_();else if(n===Ce.s_e||n===Ce.s_E)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:n}=this.m_get(5);n&&t("invalid token"),"null"!==e&&t("invalid token"),this.m_currentTokenType=10}valueTrue_(){const{s:e,bDone:n}=this.m_get(5);n&&t("invalid token"),"true"!==e&&t("invalid token"),this.m_currentTokenType=11}valueFalse_(){const{s:e,bDone:n}=this.m_get(6);n&&t("invalid token"),"false"!==e&&t("invalid token"),this.m_currentTokenType=12}valueNan_(){const{s:e,bDone:n}=this.m_get(4);n&&t("invalid token"),"NaN"!==e&&t("invalid token"),this.m_currentTokenType=7}value_(){this.m_startToken=this.m_endToken;const e=this.m_peekChar();e===Ce.s_beginObject?this.valueStartObject_():e===Ce.s_beginArray?this.valueStartArray_():e===Ce.s_doubleQuote?this.valueString_():e===Ce.s_minus||e>=Ce.s_zero&&e<=Ce.s_zero+9?this.valueNumber_():e===Ce.s_n?this.valueNull_():e===Ce.s_t?this.valueTrue_():e===Ce.s_f?this.valueFalse_():e===Ce.s_N?this.valueNan_():t("invalid token")}start_(){this.skipWhiteSpace_(),this.m_functionStack.pop(),this.m_functionStack.push(()=>this.accept_());const e=this.m_peekChar();e!==Ce.s_beginObject&&e!==Ce.s_beginArray&&t("invalid token"),this.value_()}accept_(){this.m_startToken=this.m_endToken,this.m_currentTokenType=0}}class Fe{getOperatorType(){return 10404}accelerateGeometry(e,t,n){return!1}canAccelerateGeometry(e){return!1}supportsCurves(){return!0}execute(e,n,r,i,s,a,o){let u;"string"==typeof r?(u=new De({jsonString:r}),u.nextToken()):u=r,1!==u.currentToken()&&t("failed to import map geometry: start of object is expected");const m=q(n,e,u,i,s);return new g(m)}importSpatialReference(t){const n=J(t);return null===n&&e("failed to import spatial reference"),n}importProjectionTransformation(e,t){return n(0),{}}importDatumTransformation(e,t){return n(0),{}}static stringToGeometryType(e){return(e=e.toLowerCase()).startsWith("esrigeometry")||t("string_to_geometry_type"),e.endsWith("point")?s.enumPoint:e.endsWith("envelope")?s.enumEnvelope:e.endsWith("multipoint")?s.enumMultiPoint:e.endsWith("polyline")?s.enumPolyline:e.endsWith("polygon")?s.enumPolygon:void t("string_to_geometry_type")}}const je=new Y,ze=new ye,Oe=new Fe;function Ie(e){return Array.isArray(e)?e[0].spatialReference:e.spatialReference}function Ee(e,t){const n=new L(e,{strict:!1});return n.nextToken(),Oe.execute(0,s.enumUnknown,n,!0,t)}function Pe(e){let t=null;return[e.map(e=>{if(null==t){const n=Be(e);return t=n.getSpatialReference(),n.getGeometry()}return Ve(e)}),t]}function Be(e){return Ee(e,!0)}function Ve(e){return Ee(e,!1).getGeometry()}function Me(e,t){return e instanceof g&&(t=e.getSpatialReference(),e=e.getGeometry()),e?.isEmpty()?null:(je.reset(),ze.execute(0,e,t,je),je.getObject())}export{Pe as fromGeometries,Be as fromGeometry,Ve as fromGeometryToGXGeometry,Ie as getSpatialReference,Me as toGeometry};
@@ -2,4 +2,4 @@
2
2
  All material copyright ESRI, All Rights Reserved, unless otherwise specified.
3
3
  See https://js.arcgis.com/4.34/esri/copyright.txt for details.
4
4
  */
5
- import"../../core/has.js";import"../../core/Logger.js";import"../../core/mathUtils.js";import"../../core/libs/gl-matrix-2/math/mat4.js";import"../../chunks/vec32.js";import"../../core/libs/gl-matrix-2/factories/vec3f64.js";import"../../core/libs/gl-matrix-2/factories/vec4f64.js";import"../../core/libs/gl-matrix-2/math/common.js";import"./ray.js";import"./sphereUtils.js";import"./vector.js";import"./vectorStacks.js";export{N as NullSphere,O as altitudeAt,L as angleToSilhouette,M as axisAt,d as cameraFrustumCoverage,F as clear,E as clone,K as closestPoint,h as closestPointOnSilhouette,B as containsPoint,j as copy,r as copyCenter,c as create,n as distanceToSilhouette,G as elevate,D as equals,w as exactEquals,u as fromCenterAndRadius,b as fromRadius,f as fromValues,A as fromVec4,k as getCenter,a as getCenterTemp,I as getExtent,g as getRadius,v as intersectLine,i as intersectRay,J as intersectRayClosestSilhouette,q as intersectsRay,x as projectPoint,C as set,P as setAltitudeAt,l as setCenter,o as setCenterFromValues,H as setExtent,e as setFromCenterAndRadius,p as setFromValues,m as setTransformedCenter,t as tmpSphere,y as toVec4,z as union}from"../../chunks/sphere.js";
5
+ import"../../core/has.js";import"../../core/Logger.js";import"../../core/mathUtils.js";import"../../core/libs/gl-matrix-2/math/mat4.js";import"../../chunks/vec32.js";import"../../core/libs/gl-matrix-2/factories/vec3f64.js";import"../../core/libs/gl-matrix-2/factories/vec4f64.js";import"../../core/libs/gl-matrix-2/math/common.js";import"./ray.js";import"./sphereUtils.js";import"./vector.js";import"./vectorStacks.js";export{N as NullSphere,O as altitudeAt,L as angleToSilhouette,M as axisAt,d as cameraFrustumCoverage,F as clear,E as clone,K as closestPoint,l as closestPointOnSilhouette,B as containsPoint,m as copy,x as copyCenter,c as create,r as distanceToSilhouette,G as elevate,D as equals,k as exactEquals,j as fromCenterAndRadius,b as fromRadius,f as fromValues,A as fromVec4,n as getCenter,a as getCenterTemp,I as getExtent,g as getRadius,h as intersectLine,i as intersectRay,J as intersectRayClosestSilhouette,w as intersectsRay,p as projectPoint,C as set,P as setAltitudeAt,o as setCenter,u as setCenterFromValues,H as setExtent,e as setFromCenterAndRadius,v as setFromValues,q as setTransformedCenter,t as tmpSphere,y as toVec4,z as union}from"../../chunks/sphere.js";
@@ -2,4 +2,4 @@
2
2
  All material copyright ESRI, All Rights Reserved, unless otherwise specified.
3
3
  See https://js.arcgis.com/4.34/esri/copyright.txt for details.
4
4
  */
5
- import r from"./GraphicOrigin.js";import{isKnowledgeGraphGraphicOriginSymbol as t}from"./isKnowledgeGraphGraphicOrigin.js";var e;class s extends r{static{e=t}constructor(r){super(),this[e]=!0,this.type="knowledge-graph",this.sublayer=r}get layer(){return this.sublayer.parent}}export{s as default};
5
+ import r from"./GraphicOrigin.js";import{isKnowledgeGraphGraphicOriginSymbol as s}from"./isKnowledgeGraphGraphicOrigin.js";var i;class t extends r{static{i=s}constructor(r,s){super(),this[i]=!0,this.type="knowledge-graph",this.layer=r,this.sublayer=s}}export{t as default};
@@ -0,0 +1,5 @@
1
+ /*
2
+ All material copyright ESRI, All Rights Reserved, unless otherwise specified.
3
+ See https://js.arcgis.com/4.34/esri/copyright.txt for details.
4
+ */
5
+ import r from"./GraphicOrigin.js";import{isLinkChartGraphicOriginSymbol as i}from"./isLinkChartGraphicOrigin.js";var t;class s extends r{static{t=i}constructor(r,i){super(),this[t]=!0,this.type="link-chart",this.layer=r,this.sublayer=i}}export{s as default};
@@ -0,0 +1,5 @@
1
+ /*
2
+ All material copyright ESRI, All Rights Reserved, unless otherwise specified.
3
+ See https://js.arcgis.com/4.34/esri/copyright.txt for details.
4
+ */
5
+ const i=Symbol("isLinkChartGraphicOriginSymbol");function n(n){return!!n&&i in n}export{n as isLinkChartGraphicOrigin,i as isLinkChartGraphicOriginSymbol};