@arcgis/core 4.33.0-next.20250218 → 4.33.0-next.20250220

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 (216) hide show
  1. package/applications/ExperienceBuilder/sketchUtils.d.ts +1 -0
  2. package/applications/ExperienceBuilder/sketchUtils.js +1 -1
  3. package/arcade/treeAnalysis.js +1 -1
  4. package/assets/esri/core/workers/RemoteClient.js +1 -1
  5. package/assets/esri/core/workers/chunks/{f5ce6af342c02a4b0d15.js → 030384851fa745908a6e.js} +13 -12
  6. package/assets/esri/core/workers/chunks/0c3930e40fc9f8a84599.js +2 -0
  7. package/assets/esri/core/workers/chunks/{ccee343fb8c415b59ce3.js.LICENSE.txt → 0c3930e40fc9f8a84599.js.LICENSE.txt} +1 -1
  8. package/assets/esri/core/workers/chunks/0e6762d69b7449f8a997.js +1 -0
  9. package/assets/esri/core/workers/chunks/{5ad51a68d20b0d0d404f.js → 1661ac4e1b6c6af6ee0f.js} +1 -1
  10. package/assets/esri/core/workers/chunks/186db99d05ca1183d4e9.js +1 -0
  11. package/assets/esri/core/workers/chunks/{a42ae5d5e5f66d120b4d.js → 21c7265f1f2a718de7c6.js} +1 -1
  12. package/assets/esri/core/workers/chunks/2a88909a03600349dff9.js +1 -0
  13. package/assets/esri/core/workers/chunks/333bb93a28209c997d8b.js +314 -0
  14. package/assets/esri/core/workers/chunks/469c50c49447f0d602c0.js +1 -0
  15. package/assets/esri/core/workers/chunks/486df1e042204b90b0dd.js.LICENSE.txt +1 -1
  16. package/assets/esri/core/workers/chunks/{c2d539359f321bba3432.js → 52c13b3c074c9f6dadde.js} +2 -2
  17. package/assets/esri/core/workers/chunks/{c2d539359f321bba3432.js.LICENSE.txt → 52c13b3c074c9f6dadde.js.LICENSE.txt} +1 -1
  18. package/assets/esri/core/workers/chunks/5352b374454bc4f73d55.js +1 -0
  19. package/assets/esri/core/workers/chunks/5693d9ce4472a4c5959f.js.LICENSE.txt +1 -1
  20. package/assets/esri/core/workers/chunks/5984ab09ea8010f8a874.js +1 -0
  21. package/assets/esri/core/workers/chunks/5b56b271afb0fadf48b4.js.LICENSE.txt +1 -1
  22. package/assets/esri/core/workers/chunks/6518954889df2e781c47.js.LICENSE.txt +1 -1
  23. package/assets/esri/core/workers/chunks/68322a63ec92d33701ea.js +1 -0
  24. package/assets/esri/core/workers/chunks/{ec62fffe07c4382e8796.js → 6c64ccf5f64b5025b239.js} +1 -1
  25. package/assets/esri/core/workers/chunks/717d7e9912d948e44d8d.js +1 -0
  26. package/assets/esri/core/workers/chunks/aacebda644be06ad1a61.js +1 -0
  27. package/assets/esri/core/workers/chunks/ac11b2168feee63d2f09.js +1 -0
  28. package/assets/esri/core/workers/chunks/b0952b81d5be214262dd.js.LICENSE.txt +1 -1
  29. package/assets/esri/core/workers/chunks/b9292cd91005137a2094.js +1 -0
  30. package/assets/esri/core/workers/chunks/b9d2f60b2d587a2b6cd7.js +1 -0
  31. package/assets/esri/core/workers/chunks/cf285e45c18cd4399dde.js +1 -0
  32. package/assets/esri/core/workers/chunks/{42f21349f488a14198e4.js → d4a08800c75051a5131d.js} +1 -1
  33. package/assets/esri/core/workers/chunks/e2df18662cc4d6e47715.js +1 -0
  34. package/assets/esri/core/workers/chunks/e96f4c76c8bc78a7f80f.js +1 -0
  35. package/assets/esri/core/workers/chunks/f24aef061e60d2c2f597.js +1 -0
  36. package/assets/esri/core/workers/chunks/f664cc15238c8e9856a0.js +1 -0
  37. package/assets/esri/themes/base/widgets/_Editor.scss +3 -0
  38. package/assets/esri/themes/base/widgets/_Print.scss +1 -0
  39. package/assets/esri/themes/base/widgets/_ResponsiveToolbar.scss +23 -3
  40. package/assets/esri/themes/base/widgets/_Sketch.scss +32 -24
  41. package/assets/esri/themes/dark/main.css +1 -1
  42. package/assets/esri/themes/light/main.css +1 -1
  43. package/assets/esri/themes/light/view.css +1 -1
  44. package/assets/esri/widgets/BatchAttributeForm/t9n/BatchAttributeForm.json +1 -1
  45. package/assets/esri/widgets/BatchAttributeForm/t9n/BatchAttributeForm_ar.json +1 -1
  46. package/assets/esri/widgets/BatchAttributeForm/t9n/BatchAttributeForm_bg.json +1 -1
  47. package/assets/esri/widgets/BatchAttributeForm/t9n/BatchAttributeForm_bs.json +1 -1
  48. package/assets/esri/widgets/BatchAttributeForm/t9n/BatchAttributeForm_ca.json +1 -1
  49. package/assets/esri/widgets/BatchAttributeForm/t9n/BatchAttributeForm_cs.json +1 -1
  50. package/assets/esri/widgets/BatchAttributeForm/t9n/BatchAttributeForm_da.json +1 -1
  51. package/assets/esri/widgets/BatchAttributeForm/t9n/BatchAttributeForm_de.json +1 -1
  52. package/assets/esri/widgets/BatchAttributeForm/t9n/BatchAttributeForm_el.json +1 -1
  53. package/assets/esri/widgets/BatchAttributeForm/t9n/BatchAttributeForm_en.json +1 -1
  54. package/assets/esri/widgets/BatchAttributeForm/t9n/BatchAttributeForm_es.json +1 -1
  55. package/assets/esri/widgets/BatchAttributeForm/t9n/BatchAttributeForm_et.json +1 -1
  56. package/assets/esri/widgets/BatchAttributeForm/t9n/BatchAttributeForm_fi.json +1 -1
  57. package/assets/esri/widgets/BatchAttributeForm/t9n/BatchAttributeForm_fr.json +1 -1
  58. package/assets/esri/widgets/BatchAttributeForm/t9n/BatchAttributeForm_he.json +1 -1
  59. package/assets/esri/widgets/BatchAttributeForm/t9n/BatchAttributeForm_hr.json +1 -1
  60. package/assets/esri/widgets/BatchAttributeForm/t9n/BatchAttributeForm_hu.json +1 -1
  61. package/assets/esri/widgets/BatchAttributeForm/t9n/BatchAttributeForm_id.json +1 -1
  62. package/assets/esri/widgets/BatchAttributeForm/t9n/BatchAttributeForm_it.json +1 -1
  63. package/assets/esri/widgets/BatchAttributeForm/t9n/BatchAttributeForm_ja.json +1 -1
  64. package/assets/esri/widgets/BatchAttributeForm/t9n/BatchAttributeForm_ko.json +1 -1
  65. package/assets/esri/widgets/BatchAttributeForm/t9n/BatchAttributeForm_lt.json +1 -1
  66. package/assets/esri/widgets/BatchAttributeForm/t9n/BatchAttributeForm_lv.json +1 -1
  67. package/assets/esri/widgets/BatchAttributeForm/t9n/BatchAttributeForm_nl.json +1 -1
  68. package/assets/esri/widgets/BatchAttributeForm/t9n/BatchAttributeForm_no.json +1 -1
  69. package/assets/esri/widgets/BatchAttributeForm/t9n/BatchAttributeForm_pl.json +1 -1
  70. package/assets/esri/widgets/BatchAttributeForm/t9n/BatchAttributeForm_pt-BR.json +1 -1
  71. package/assets/esri/widgets/BatchAttributeForm/t9n/BatchAttributeForm_pt-PT.json +1 -1
  72. package/assets/esri/widgets/BatchAttributeForm/t9n/BatchAttributeForm_ro.json +1 -1
  73. package/assets/esri/widgets/BatchAttributeForm/t9n/BatchAttributeForm_ru.json +1 -1
  74. package/assets/esri/widgets/BatchAttributeForm/t9n/BatchAttributeForm_sk.json +1 -1
  75. package/assets/esri/widgets/BatchAttributeForm/t9n/BatchAttributeForm_sl.json +1 -1
  76. package/assets/esri/widgets/BatchAttributeForm/t9n/BatchAttributeForm_sr.json +1 -1
  77. package/assets/esri/widgets/BatchAttributeForm/t9n/BatchAttributeForm_sv.json +1 -1
  78. package/assets/esri/widgets/BatchAttributeForm/t9n/BatchAttributeForm_th.json +1 -1
  79. package/assets/esri/widgets/BatchAttributeForm/t9n/BatchAttributeForm_tr.json +1 -1
  80. package/assets/esri/widgets/BatchAttributeForm/t9n/BatchAttributeForm_uk.json +1 -1
  81. package/assets/esri/widgets/BatchAttributeForm/t9n/BatchAttributeForm_vi.json +1 -1
  82. package/assets/esri/widgets/BatchAttributeForm/t9n/BatchAttributeForm_zh-CN.json +1 -1
  83. package/assets/esri/widgets/BatchAttributeForm/t9n/BatchAttributeForm_zh-HK.json +1 -1
  84. package/assets/esri/widgets/BatchAttributeForm/t9n/BatchAttributeForm_zh-TW.json +1 -1
  85. package/chunks/RealisticTree.glsl.js +18 -17
  86. package/copyright.txt +91 -0
  87. package/geometry/support/meshUtils/elevation.js +1 -1
  88. package/interfaces.d.ts +493 -131
  89. package/layers/BuildingSceneLayer.js +1 -1
  90. package/layers/FeatureLayer.js +1 -1
  91. package/layers/IntegratedMesh3DTilesLayer.js +1 -1
  92. package/layers/IntegratedMeshLayer.js +1 -1
  93. package/layers/OrientedImageryLayer.js +1 -1
  94. package/layers/PointCloudLayer.js +1 -1
  95. package/layers/RouteLayer.js +1 -1
  96. package/layers/SceneLayer.js +1 -1
  97. package/layers/buildingSublayers/BuildingComponentSublayer.js +1 -1
  98. package/layers/graphics/OptimizedGeometry.js +1 -1
  99. package/layers/graphics/featureConversionUtils.js +1 -1
  100. package/layers/support/featureLayerUtils.js +1 -1
  101. package/layers/support/rasterFunctionUtils.d.ts +11 -0
  102. package/networks/UtilityNetwork.js +1 -1
  103. package/package.json +2 -2
  104. package/portal/Portal.js +1 -1
  105. package/rest/route.js +1 -1
  106. package/rest/support/AttributeBinsGrouping.js +1 -1
  107. package/rest/support/AttributeBinsQuery.js +1 -1
  108. package/rest/support/RouteParameters.js +1 -1
  109. package/rest/support/RouteSolveResult.js +1 -1
  110. package/support/revision.js +1 -1
  111. package/symbols/cim/CIMEffects.js +1 -1
  112. package/symbols/cim/cimAnalyzer.js +1 -1
  113. package/symbols/cim/effects/EffectAddControlPoints.js +1 -1
  114. package/symbols/cim/effects/EffectBuffer.js +1 -1
  115. package/symbols/cim/effects/EffectDonut.js +1 -1
  116. package/symbols/cim/effects/EffectOffset.js +1 -1
  117. package/views/2d/FrameTask.js +1 -1
  118. package/views/2d/engine/webgl/TextureManager.js +1 -1
  119. package/views/2d/engine/webgl/Utils.js +1 -1
  120. package/views/2d/engine/webgl/shaderGraph/techniques/labels/LabelTechnique.js +1 -1
  121. package/views/2d/engine/webgl/shaderGraph/techniques/markers/MarkerMeshWriter.js +1 -1
  122. package/views/2d/engine/webgl/shaderGraph/techniques/text/TextShader.js +1 -1
  123. package/views/2d/layers/FeatureLayerView2D.js +1 -1
  124. package/views/2d/layers/features/FeaturePipelineWorker.js +1 -1
  125. package/views/2d/layers/features/sources/FeatureCache.js +1 -1
  126. package/views/2d/layers/features/sources/FeatureSource.js +1 -1
  127. package/views/2d/layers/features/sources/strategies/chunks/Overrides.js +1 -1
  128. package/views/2d/layers/features/support/FeatureSetReader.js +1 -1
  129. package/views/2d/layers/features/support/FeatureSetReaderPBF.js +1 -1
  130. package/views/2d/viewpointUtils.js +1 -1
  131. package/views/3d/camera/constraintUtils/tilt.js +1 -1
  132. package/views/3d/layers/I3SMeshView3D.js +1 -1
  133. package/views/3d/layers/graphics/pipeline/Feature3DPipelineWorker.js +1 -1
  134. package/views/3d/layers/graphics/pipeline/Tile.js +1 -1
  135. package/views/3d/layers/graphics/pipeline/Tile3DManager.js +1 -1
  136. package/views/3d/layers/graphics/pipeline/featureData/FeatureData.js +1 -1
  137. package/views/3d/layers/graphics/pipeline/featureData/FeatureDataSubset.js +5 -0
  138. package/views/3d/layers/graphics/pipeline/featureData/processingUtils.js +1 -1
  139. package/views/3d/layers/graphics/pipeline/featureSet/PBFPointFeatureSetView.js +1 -1
  140. package/views/3d/layers/graphics/pipeline/featureSet/TiledFeatureStore.js +1 -1
  141. package/views/3d/layers/graphics/pipeline/fetching/Tile3DFetcher.js +1 -1
  142. package/views/3d/layers/graphics/pipeline/symbolization/TestObjectSymbol.js +1 -1
  143. package/views/3d/layers/graphics/pipeline/symbolization/TestSymbol.js +1 -1
  144. package/views/3d/layers/graphics/pipeline/symbolization/UniqueValueFeatureRenderer.js +1 -1
  145. package/views/3d/layers/support/FeatureTile.js +1 -1
  146. package/views/3d/layers/support/FeatureTileFetcher3D.js +1 -1
  147. package/views/3d/terrain/TileRenderer.js +1 -1
  148. package/views/3d/webgl-engine/collections/Component/ComponentData.js +1 -1
  149. package/views/3d/webgl-engine/collections/Component/ComponentObjectCollection.js +1 -1
  150. package/views/3d/webgl-engine/collections/Component/ComponentObjectElevationAgnosticComponentBVH.js +1 -1
  151. package/views/3d/webgl-engine/collections/Component/IndexRange/ComponentRange.js +5 -0
  152. package/views/3d/webgl-engine/lib/ComponentUtils.js +1 -1
  153. package/views/3d/webgl-engine/lib/lodRendering/LodRenderer.js +1 -1
  154. package/views/3d/webgl-engine/materials/renderers/BufferRange.js +1 -1
  155. package/views/VideoView.js +1 -1
  156. package/views/View2D.js +1 -1
  157. package/views/Viewport2DMixin.js +5 -0
  158. package/views/webgl/Texture.js +1 -1
  159. package/webmap/utils.js +1 -1
  160. package/widgets/BasemapLayerList.js +1 -1
  161. package/widgets/BatchAttributeForm/BatchAttributeFormViewModel.js +1 -1
  162. package/widgets/BatchAttributeForm/inputs/FieldInput.js +1 -1
  163. package/widgets/BatchAttributeForm/templates/support/contingentValuesUtils.js +5 -0
  164. package/widgets/BatchAttributeForm/templates/support/createBatchFormTemplate.js +1 -1
  165. package/widgets/BatchAttributeForm.js +1 -1
  166. package/widgets/CatalogLayerList.js +1 -1
  167. package/widgets/DirectionalPad/DirectionalPadViewModel.js +1 -1
  168. package/widgets/Directions/DirectionsViewModel.js +1 -1
  169. package/widgets/Directions.js +1 -1
  170. package/widgets/ElevationProfile/components/LegendItem.js +1 -1
  171. package/widgets/ElevationProfile/components/SettingsButton.js +1 -1
  172. package/widgets/Feature/FeatureUtilityNetworkAssociations.js +1 -1
  173. package/widgets/FeatureForm/FeatureFormUtilityNetworkAssociations/UtilityNetworkAssociationItemList.js +1 -1
  174. package/widgets/FeatureForm/UtilityNetworkAssociationAddAssociationViewModel.js +1 -1
  175. package/widgets/FeatureForm/featureFormUtils.js +1 -1
  176. package/widgets/FeatureTable/FeatureTableViewModel.js +1 -1
  177. package/widgets/FeatureTable/support/FeatureStore.js +1 -1
  178. package/widgets/LayerList.js +1 -1
  179. package/widgets/Legend/styles/support/utils.js +1 -1
  180. package/widgets/OrientedImageryViewer/OrientedImageryViewerViewModel.js +1 -1
  181. package/widgets/OrientedImageryViewer/components/ImageOverlays.js +1 -1
  182. package/widgets/OrientedImageryViewer/digitizationUtils.js +1 -1
  183. package/widgets/OrientedImageryViewer/galleryUtils.js +1 -1
  184. package/widgets/OrientedImageryViewer/imageMeasurementUtils.js +1 -1
  185. package/widgets/OrientedImageryViewer.js +1 -1
  186. package/widgets/Print.js +1 -1
  187. package/widgets/ShadowCast.js +1 -1
  188. package/widgets/Sketch/SketchViewModel.js +1 -1
  189. package/widgets/Sketch/support/ResponsiveToolbar/OverflowGroup.js +1 -1
  190. package/widgets/Sketch/support/ResponsiveToolbar/ResponsiveToolbar.js +1 -1
  191. package/widgets/Sketch/support/ResponsiveToolbar/SplitButton.js +1 -1
  192. package/widgets/Sketch/support/sketchUtils.js +1 -1
  193. package/widgets/Sketch.js +1 -1
  194. package/widgets/VideoPlayer.js +1 -1
  195. package/widgets/support/UtilityNetworkAssociations/utilityNetworkUtils.js +1 -1
  196. package/assets/esri/core/workers/chunks/1cbea0c0b20a2963a86d.js +0 -1
  197. package/assets/esri/core/workers/chunks/238bcf6514a1f214cc8a.js +0 -1
  198. package/assets/esri/core/workers/chunks/26b5397f63dc602612f2.js +0 -1
  199. package/assets/esri/core/workers/chunks/290f613ef70590de9f15.js +0 -314
  200. package/assets/esri/core/workers/chunks/33c6fd524711efd8ef13.js +0 -1
  201. package/assets/esri/core/workers/chunks/3f077176c03a360e1edd.js +0 -1
  202. package/assets/esri/core/workers/chunks/544ad8fa4777ba8ec177.js +0 -1
  203. package/assets/esri/core/workers/chunks/6039da57a2adedd3b83f.js +0 -1
  204. package/assets/esri/core/workers/chunks/842db06ce62758fab1e7.js +0 -1
  205. package/assets/esri/core/workers/chunks/916f0ca8e3aaed5a9508.js +0 -1
  206. package/assets/esri/core/workers/chunks/bdc9dec6a359d2e3705c.js +0 -1
  207. package/assets/esri/core/workers/chunks/bf127fe767174e2715b5.js +0 -1
  208. package/assets/esri/core/workers/chunks/cb3148cf11a420d6e9ab.js +0 -1
  209. package/assets/esri/core/workers/chunks/ccee343fb8c415b59ce3.js +0 -2
  210. package/assets/esri/core/workers/chunks/d342c56558f164e9e786.js +0 -1
  211. package/assets/esri/core/workers/chunks/d3f7ff03ab5b40062d89.js +0 -1
  212. package/assets/esri/core/workers/chunks/ed89a108b032b982b12f.js +0 -1
  213. package/assets/esri/core/workers/chunks/ef6279f5c63ab1e88c71.js +0 -1
  214. package/assets/esri/core/workers/chunks/f088e7db4e7ac85aaff1.js +0 -1
  215. package/views/3d/layers/graphics/pipeline/featureData/FeatureDataStore.js +0 -5
  216. package/views/3d/webgl-engine/collections/Component/IndexRange/ComponentRangeRunLengthEncoded.js +0 -5
@@ -2,4 +2,4 @@
2
2
  All material copyright ESRI, All Rights Reserved, unless otherwise specified.
3
3
  See https://js.arcgis.com/4.33/esri/copyright.txt for details.
4
4
  */
5
- import{_ as e}from"../../../chunks/tslib.es6.js";import t from"../../../AggregateGraphic.js";import r from"../../../Graphic.js";import s from"../../../TrackGraphic.js";import{isSome as i}from"../../../core/arrayUtils.js";import a from"../../../core/Collection.js";import{neverReached as o}from"../../../core/compilerUtils.js";import n from"../../../core/Error.js";import{makeHandle as u,handlesGroup as l}from"../../../core/handleUtils.js";import has from"../../../core/has.js";import h from"../../../core/Logger.js";import{destroyMaybe as c}from"../../../core/maybe.js";import{notDeepEqual as d}from"../../../core/object.js";import{createAbortError as p,createResolver as y,ignoreAbortErrors as f,throwIfNotAbortError as g,isAbortError as m}from"../../../core/promiseUtils.js";import{watch as w}from"../../../core/reactiveUtils.js";import{sqlOr as v,sqlIn as _,sqlAnd as b}from"../../../core/sql.js";import{property as F}from"../../../core/accessorSupport/decorators/property.js";import{subclass as A}from"../../../core/accessorSupport/decorators/subclass.js";import{UpdatingHandles as S}from"../../../core/support/UpdatingHandles.js";import j from"../../../geometry/Extent.js";import U from"../../../layers/effects/FeatureEffectView.js";import{convertFromFeature as I}from"../../../layers/graphics/featureConversionUtils.js";import x from"../../../layers/support/FeatureFilter.js";import{checkServiceCurrentUserSupport as E}from"../../../layers/support/featureLayerUtils.js";import{packFields as k}from"../../../layers/support/fieldUtils.js";import{getEffectiveLayerCapabilities as C}from"../../../layers/support/layerUtils.js";import{combineTimeExtent as V}from"../../../layers/support/timeSupport.js";import q from"../../../rest/support/AggregateFeatureSet.js";import R from"../../../rest/support/AttributeBinsFeatureSet.js";import Q from"../../../rest/support/AttributeBinsQuery.js";import O from"../../../rest/support/FeatureSet.js";import L from"../../../rest/support/Query.js";import{LayerView2DMixin as D}from"./LayerView2D.js";import{FeatureContainer as P}from"./features/FeatureContainer.js";import{createFeaturePipelineWorkerProxy as T}from"./features/FeaturePipelineWorkerProxy.js";import{FeatureSourceEventLog as W}from"./features/FeatureSourceEventLog.js";import{CatalogFootprintLayerAdapter as H}from"./features/layerAdapters/CatalogFootprintLayerAdapter.js";import{FeatureLayerAdapter as M}from"./features/layerAdapters/FeatureLayerAdapter.js";import{InMemoryLayerAdapter as N}from"./features/layerAdapters/InMemoryLayerAdapter.js";import{KnowledgeGraphSublayerAdapter as J}from"./features/layerAdapters/KnowledgeGraphSublayerAdapter.js";import{OGCFeatureLayerAdapter as G}from"./features/layerAdapters/OGCFeatureLayerAdapter.js";import{OrientedImageryLayerAdapter as $}from"./features/layerAdapters/OrientedImageryLayerAdapter.js";import{ParquetLayerAdapter as B}from"./features/layerAdapters/ParquetLayerAdapter.js";import{StreamLayerAdapter as z}from"./features/layerAdapters/StreamLayerAdapter.js";import{SubtypeGroupLayerAdapter as Z}from"./features/layerAdapters/SubtypeGroupLayerAdapter.js";import{createComplexSymbolInstances as K}from"./features/schema/processor/symbols/ComplexSymbolSchema.js";import{DebouncedFeatureOverride as X}from"./support/DebouncedFeatureOverride.js";import{FeatureCommandQueue as Y}from"./support/FeatureCommandQueue.js";import{handleNoEngineError as ee}from"./support/handleNoEngineError.js";import{toJSONGeometryType as te}from"./support/util.js";import{FeatureTileSubscriptionManager as re}from"../tiling/FeatureTileSubscriptionManager.js";import se from"../../layers/FeatureLayerView.js";import ie from"../../layers/LayerView.js";import ae from"../../layers/RefreshableLayerView.js";import{defaultHighlightName as oe}from"../../support/HighlightDefaults.js";function ne(e,t){const r=new Set;return e&&e.forEach((e=>r.add(e))),t&&t.forEach((e=>r.add(e))),r.has("*")?["*"]:Array.from(r)}const ue=4294967294;function le(e,t){return l(e.map((e=>w((()=>{const t=e();return t&&"object"==typeof t?"getTime"in t&&"function"==typeof t.getTime?t.getTime():JSON.stringify(t):t}),t))))}let he=class extends(se(ae(D(ie)))){constructor(){super(...arguments),this._commandsQueue=new Y({process:e=>{switch(e.type){case"override-batch":return this._doOverride(e);case"update":return this._doUpdate();case"highlight":return this._updateHighlights()}}}),this._visibilityOverrides=new Set,this._lastAvailableFields=[],this._lastTargetState=null,this.eventLog=new W,this._sourceRefreshVersion=1,this._displayRefreshVersion=1,this._pipelineUpdating=!1,this._editUpdatingHandles=new S,this._fields=null,this._sourceUpdating=!1,this.featureEffectView=new U}destroy(){this._workerProxy?.destroy(),this._workerAttached.reject(p()),this._commandsQueue.destroy()}initialize(){this._workerAttached=y(),f(this._workerAttached.promise),this.addResolvingPromise(this._initProxy()),this.featureEffectView.featureEffect=this.featureEffect,this.featureEffectView.endTransition()}async _initProxy(){const e=this.layer;if("isTable"in e&&e.isTable)throw new n("featurelayerview:table-not-supported","table feature layer can't be displayed",{layer:e});if(("feature"===e.type||"subtype-group"===e.type)&&!1===C(e)?.operations.supportsQuery)throw new n("featurelayerview:query-not-supported","layer view requires a layer with query capability",{layer:e});this._workerProxy&&this._workerProxy.destroy();const t=this._createClientOptions();this._workerProxy=await T(t)}async _attachProxy(){const e={service:await this.layerAdapter.createServiceOptions(this.view),tileInfoJSON:this.view?.featuresTilingScheme?.tileInfo?.toJSON()};let t=[];Array.isArray(e.service.source)&&(t=e.service.source);try{await this._workerProxy.pipeline.onAttach(e,{transferList:t}),this._workerAttached.resolve()}catch(r){this._workerAttached.reject(p()),g(r)}}async _detachProxy(){return this._workerProxy.pipeline.onDetach()}async getWorker(){return await this._workerAttached.promise,this._workerProxy}get dataUpdating(){return this._sourceUpdating||this._editUpdatingHandles.updating}get effectiveDisplayFilterClause(){const e=this.effectiveDisplayFilter?.where??null;return e&&this.hasHighlight?v(e,_(this.layer.objectIdField,this.highlightIds)):e}get hasAllFeatures(){return this.layer.visible&&!this.suspended&&this.eventLog.hasAllData&&this.eventLog.willQueryAllFeatures}get hasAllFeaturesInView(){const e=this.effectiveDisplayFilter?.where||null,t=!this.eventLog.willQueryAllFeatures&&null!=e&&"1=1"!==e;return this.layer.visible&&!this.suspended&&this.eventLog.hasAllData&&!t}get hasFullGeometries(){return this.layer.visible&&!this.suspended&&this.eventLog.hasAllData&&this.eventLog.willQueryFullResolutionGeometry}get labelingCollisionInfos(){const e=this.layerAdapter.getLabelingDeconflictionInfo(this.view),t=this.layer.geometryType,r=!this.suspended;return e.map((({vvEvaluators:e,deconflictionEnabled:s})=>({container:this.featureContainer,vvEvaluators:e,deconflictionEnabled:s,geometryType:t,visible:r})))}get layerAdapter(){switch(this.layer.type){case"feature":return"memory"===this.layer.source.type?new N(this.layer):new M(this.layer);case"geojson":case"csv":case"wfs":return new N(this.layer);case"parquet":return new B(this.layer);case"subtype-group":return new Z(this.layer);case"ogc-feature":return new G(this.layer);case"stream":return new z(this.layer);case"oriented-imagery":return new $(this.layer);case"knowledge-graph-sublayer":return new J(this.layer);case"catalog-footprint":return new H(this.layer);default:o(this.layer)}return null}get timeExtent(){return V(this.layerAdapter.timeOptions,this.view?.timeExtent,this._get("timeExtent"))}getDisplayStatistics(e,t){return this.featureContainer?.getDisplayStatistics(e,t)}async queryHeatmapStatistics(e){return(await this.getWorker()).pipeline.queryHeatmapStatistics(e)}highlight(e,t){let s;e instanceof r?s=[e.getObjectId()]:"number"==typeof e||"string"==typeof e?s=[e]:a.isCollection(e)&&e.length>0?s=e.map((e=>e?.getObjectId())).toArray():Array.isArray(e)&&e.length>0&&(s="number"==typeof e[0]||"string"==typeof e[0]?e:e.map((e=>e?.getObjectId())));const o=s?.filter(i);if(!o?.length)return u();const n=t?.name??oe;return this._addHighlights(o,n),u((()=>!this.destroyed&&this._removeHighlights(o,n)))}async hitTest(e,i){const a=await this.featureContainer.hitTest(i);if(0===a.length)return null;const o=await this.getWorker(),{features:n,aggregates:u,tracks:l}=await o.pipeline.getDisplayFeatures(a),h=this.featureContainer.getSortKeys(a),c=({displayId:e},{displayId:t})=>h.has(e)&&h.has(t)?h.get(e)-h.get(t):e-t;return n.sort(c).reverse(),u.sort(c).reverse(),[...u.map((r=>this._createGraphicHit(e,t.fromJSON(r)))),...l.map((t=>this._createGraphicHit(e,s.fromJSON(t)))),...n.map((t=>this._createGraphicHit(e,r.fromJSON(t))))]}async queryStatistics(){const e=await this.getWorker();return ee(e.pipeline.queryStatistics(),{featureCount:0,ringCount:0,vertexCount:0})}async querySummaryStatistics(e,t,r){const s=await this.getWorker(),i={...t,scale:this.view.scale},a=s.features.executeQueryForSummaryStatistics(this._cleanUpQuery(e),i,r);return ee(a,{})}async queryAggregateSummaryStatistics(e,t,r){const s={...t,scale:this.view.scale},i=(await this.getWorker()).aggregates.executeQueryForSummaryStatistics(this._cleanUpAggregateQuery(e),s,r);return ee(i,{})}async queryUniqueValues(e,t,r){const s=await this.getWorker(),i={...t,scale:this.view.scale},a=s.features.executeQueryForUniqueValues(this._cleanUpQuery(e),i,r);return ee(a,{uniqueValueInfos:[]})}async queryAggregateUniqueValues(e,t,r){const s=await this.getWorker(),i={...t,scale:this.view.scale},a=s.aggregates.executeQueryForUniqueValues(this._cleanUpAggregateQuery(e),i,r);return ee(a,{uniqueValueInfos:[]})}async queryClassBreaks(e,t,r){const s=await this.getWorker(),i={...t,scale:this.view.scale},a=s.features.executeQueryForClassBreaks(this._cleanUpQuery(e),i,r);return ee(a,{classBreakInfos:[]})}async queryAggregateClassBreaks(e,t,r){const s=await this.getWorker(),i={...t,scale:this.view.scale},a=s.aggregates.executeQueryForClassBreaks(this._cleanUpAggregateQuery(e),i,r);return ee(a,{classBreakInfos:[]})}async queryHistogram(e,t,r){const s=await this.getWorker(),i={...t,scale:this.view.scale},a=s.features.executeQueryForHistogram(this._cleanUpQuery(e),i,r);return ee(a,{bins:[],maxValue:null,minValue:null,normalizationTotal:null})}async queryAggregateHistogram(e,t,r){const s=await this.getWorker(),i={...t,scale:this.view.scale},a=s.aggregates.executeQueryForHistogram(this._cleanUpAggregateQuery(e),i,r);return ee(a,{bins:[],maxValue:null,minValue:null,normalizationTotal:null})}queryFeatures(e,t){return this.queryFeaturesJSON(e,t).then((e=>{const t=O.fromJSON(e);return t.features.forEach((e=>this._setLayersForFeature(e))),t}))}async queryVisibleFeatures(e,t){const r=(await this.getWorker()).pipeline.queryVisibleFeatures(this._cleanUpQuery(e),t),s=await ee(r,{features:[]}),i=O.fromJSON(s);return i.features.forEach((e=>this._setLayersForFeature(e))),i}async queryAggregates(e,t){const r=(await this.getWorker()).aggregates.executeQuery(this._cleanUpAggregateQuery(e),t),s=await ee(r,{features:[]}),i=q.fromJSON(s);return i.features.forEach((e=>this._setLayersForFeature(e))),i}async queryAggregateIds(e,t){const r=(await this.getWorker()).aggregates.executeQueryForIds(this._cleanUpAggregateQuery(e),t);return ee(r,[])}async queryAggregateCount(e,t){const r=(await this.getWorker()).aggregates.executeQueryForCount(this._cleanUpAggregateQuery(e),t);return ee(r,0)}async queryAggregateJSON(e,t){const r=(await this.getWorker()).aggregates.executeQuery(this._cleanUpAggregateQuery(e),t);return ee(r,{features:[]})}async queryFeaturesJSON(e,t){const r=(await this.getWorker()).features.executeQuery(this._cleanUpQuery(e),t);return ee(r,{features:[]})}async queryObjectIds(e,t){const r=(await this.getWorker()).features.executeQueryForIds(this._cleanUpQuery(e),t);return ee(r,[])}async queryFeatureCount(e,t){const r=(await this.getWorker()).features.executeQueryForCount(this._cleanUpQuery(e),t);return ee(r,0)}async queryExtent(e,t){const r=(await this.getWorker()).features.executeQueryForExtent(this._cleanUpQuery(e),t),s=await ee(r,{count:0,extent:null});return{count:s.count,extent:j.fromJSON(s.extent)}}async queryAttributeBins(e,t){const r=(await this.getWorker()).features.executeAttributeBinsQuery(this._cleanUpAttributeBinsQuery(e),t),s=await ee(r,{features:[]});return R.fromJSON(s)}async getSampleFeatures(e){return(await this.getWorker()).pipeline.getSampleFeatures(e)}setVisibility(e,t){t?this._visibilityOverrides.delete(e):this._visibilityOverrides.add(e),this._update()}update(e){if(!this._subscriptionManager)return;this.view.animation&&!this._lastTargetState&&(this._lastTargetState=e.state.clone()),!this.view.animation&&this._lastTargetState&&(this._lastTargetState=null);const t=this._subscriptionManager.update(e.targetState,this._lastTargetState);this.featureContainer.setVisibleTiles(t)}attach(){has("esri-2d-update-debug")&&console.debug("FeatureLayerView2D.attach"),f(this._updatingHandles.addPromise(this._workerAttached.promise)),f(this._attachProxy()),this.featureContainer=new P(this),this.container.addChild(this.featureContainer),this.view.timeline.record(`${this.layer.title} (FeatureLayer) Attach`),this._subscriptionManager=new re({tileInfoView:this.view.featuresTilingScheme,updateSubscriptions:e=>{this.featureContainer.updateSubscriptions(e),f(this._updatingHandles.addPromise(this.getWorker().then((t=>t.pipeline.updateSubscriptions(e)))))},isDone:e=>this.featureContainer.isDone(e)}),this.requestUpdate(),this.addAttachHandles([le([()=>this._displayRefreshVersion,()=>this.layer.displayFilterInfo,()=>this.timeExtent,()=>this.clips,()=>this.filter,()=>this.effectiveDisplayFilterClause,()=>this.featureEffect,()=>this._sourceRefreshVersion,()=>this.view.timeZone,()=>this.view.timeExtent,...this.layerAdapter.getUpdateHashProperties(this.view)],(()=>this._update())),w((()=>this.updateSuspended),(e=>{e||(this._subscriptionManager.resume(),this.view.labelManager.requestUpdate())})),w((()=>this.visible),(e=>{this.view.labelManager.requestUpdate()}))]),this._update(),"stream"!==this.layer.type&&"parquet"!==this.layer.type&&"catalog-footprint"!==this.layer.type&&this.addAttachHandles(this.layer.on("edits",(e=>this._editUpdatingHandles.addPromise(this._edit(e)))))}detach(){has("esri-2d-update-debug")&&console.debug("FeatureLayerView2D.detach"),this._detachProxy(),this._fields=null,this.featureContainer.destroy(),this.featureContainer=null,this._commandsQueue.clear(),this.container.removeAllChildren(),this._subscriptionManager=c(this._subscriptionManager),this._workerProxy.pipeline.onDetach(),this._workerAttached=y(),f(this._workerAttached.promise),this._lastAvailableFields=[],this._lastSchema=null}viewChange(){this.requestUpdate()}moveEnd(){this.requestUpdate()}addOverrides(e){return this._commandsQueue.push({type:"override",options:{...e,release:[]}})}removeOverrides(e){for(const r of e)if(null==r)throw new n("featurelayerview:bad-override","Tried to remove an override for an invalid objectId",{objectId:r});const t={added:[],updated:[],removed:[],release:e,isWeak:!1,historicMoment:null};return this._commandsQueue.push({type:"override",options:t})}isUpdating(){const e="renderer"in this.layer&&null!=this.layer.renderer,t=this._commandsQueue.updateTracking.updating,r=null!=this._updatingRequiredPromise,s=this.featureContainer.updatingHandles.updating,i=this.updateRequested||e&&(t||r)||s||this._pipelineUpdating||this.dataUpdating;if(has("esri-2d-log-updating")){console.log(`Updating FLV2D (${this.layer.id}): ${i}\n -> updateRequested ${this.updateRequested}\n -> hasRenderer ${e}\n -> updatingRequiredFields ${r}\n -> hasPendingCommand ${t}\n -> dataUpdating ${this.dataUpdating}\n -> processing ${this._pipelineUpdating}\n -> updatingContainer ${s}\n`);for(const e of this.featureContainer.subscriptions())console.log(` -> Tile[${e.id}] Done: ${e.done}`)}return i}_createClientOptions(){const e=this;return{get container(){return e.featureContainer},setUpdating:e=>{this._set("_pipelineUpdating",e.pipeline),this._set("_sourceUpdating",e.source)},emitEvent:e=>{this.emit(e.name,e.event)},get eventLog(){return e.eventLog},fetch:async t=>{if(has("esri-2d-stabilize-glyphs")){const r=[];for(const s of t)r.push(await e.view.stage.painter.textureManager.rasterizeItem(s));return r}return Promise.all(t.map((t=>e.view.stage.painter.textureManager.rasterizeItem(t))))},fetchDictionary:e=>Promise.all(e.map((e=>this._fetchDictionaryRequest(e))))}}async _fetchDictionaryRequest(e){try{if("subtype-group"===this.layer.type)throw new Error("InternalError: SubtypeGroupLayer does not support dictionary renderer");const t=this.layer.renderer;if(!t||"dictionary"!==t.type)throw new Error("InternalError: Expected layer to have a DictionaryRenderer");const r=this._lastSchema.processor.mesh.factory.symbology;if("dictionary"!==r.type)throw new Error("InternalError: Expected schema to be of type 'dictionary'");const s={cimAnalyzer:this.view.stage.cimAnalyzer,cimResourceManager:this.view.stage.painter.textureManager.resourceManager,store:this.featureContainer.instanceStore,scaleExpression:r.scaleExpression};this._fields||(this._fields=this.layer.fields.map((e=>e.toJSON())));const i=r.visualVariableUniforms,a=await t.getSymbolAsync(e.feature,{fields:this._fields});if(!a||!a.data)return{type:"dictionary-response",meshes:[]};return{type:"dictionary-response",meshes:await K(a.data,{uniforms:i,path:"renderer",schemaOptions:s})}}catch(t){return{type:"dictionary-response",meshes:[]}}}_cleanUpQuery(e){const t=L.from(e)||this.createQuery();return t.outSpatialReference||(t.outSpatialReference=this.view.spatialReference),t.toJSON()}_cleanUpAttributeBinsQuery(e){const t=Q.from(e);return t.outSpatialReference||(t.outSpatialReference=this.view.spatialReference),t.toJSON()}_cleanUpAggregateQuery(e){const t=L.from(e)||this.createAggregateQuery();t.outSpatialReference||(t.outSpatialReference=this.view.spatialReference);const r=t.objectIds??[];for(const s of t.aggregateIds??[])r.push(s);return t.objectIds=r,t.aggregateIds=[],t.toJSON()}async _update(){return this._commandsQueue.push({type:"update"})}_edit(e){return this.updateSuspended?(this._subscriptionManager.suspend(),Promise.resolve()):this._commandsQueue.push({type:"edit",event:e})}async doRefresh(e){this.attached&&(this.updateSuspended&&e||(e?this.incrementSourceRefreshVersion():this.incrementDisplayRefreshVersion()))}incrementSourceRefreshVersion(){this._sourceRefreshVersion=(this._sourceRefreshVersion+1)%ue+1}incrementDisplayRefreshVersion(){this._displayRefreshVersion=(this._displayRefreshVersion+1)%ue+1}async _resolveIdenifiers(e){const t=[],r=[];for(const a of e)null==a.objectId||-1===a.objectId?null==a.globalId?h.getLogger(this).warn("mapview-apply-edits","A feature identifier must contain either a GlobalId or ObjectId. Ignoring",{identifier:a}):r.push(a.globalId):t.push(a.objectId);const s="globalIdField"in this.layer&&this.layer.globalIdField,i=s&&this.availableFields.includes(s);if(r.length&&!i)return h.getLogger(this).error(new n("mapview-apply-edits",`Editing the specified service requires the layer's globalIdField, ${s} to be included the layer's outFields for updates to be reflected on the map`)),t;if(r.length){const e=await this._workerProxy.pipeline.getObjectIdsFromGlobalIds(r);for(const r of e)t.push(r)}return t}_resolveOverrides(e){const t=!1,r=!1,s=te(this.layer.geometryType),i=this.layer.objectIdField,a=[];for(const o of e.added){const e=I(o,s,t,r,i);if(null==e.objectId)throw new n("featurelayerview:bad-override","Feature does not have an objectId",{feature:o});a.push(e)}for(const o of e.updated){const e=I(o,s,t,r,i);if(null==e.objectId)throw new n("featurelayerview:bad-override","Feature does not have an objectId",{feature:o});a.push(e)}for(const o of e.removed)if(null==o)throw new n("featurelayerview:bad-override","Tried to remove an invalid objectId",{objectId:o});return{type:"override",updates:a,removed:e.removed,release:e.release,isWeak:e.isWeak??!1,historicMoment:e.historicMoment??null}}async _resolveEdit(e){const t=this.layer,r=e.historicMoment?.getTime()??null,s="layerId"in t&&e.editedFeatures?.find((e=>e.layerId===t.layerId));if(s&&this._canEditByFeature(s)){const{adds:e,deletes:t,updates:i}=s.editedFeatures,a=this.layer.objectIdField,o=i.map((e=>e.current)),n=t.map((e=>"attributes"in e?{objectId:a?e.attributes[a]:null}:e)),u=await this._resolveIdenifiers(n);return this._resolveOverrides({added:e,updated:o,removed:u,historicMoment:r,isWeak:!0,release:[]})}const[i,a,o]=await Promise.all([this._resolveIdenifiers(e.addedFeatures),this._resolveIdenifiers(e.updatedFeatures),this._resolveIdenifiers(e.deletedFeatures)]);return{type:"override-by-id",updates:[...i,...a],removed:o,historicMoment:r,isWeak:!0}}_canEditByFeature(e){const{adds:t,updates:r}=e.editedFeatures;return t.every((e=>this.view.spatialReference.equals(e.geometry?.spatialReference)))&&r.every((e=>this.view.spatialReference.equals(e.current.geometry?.spatialReference)))}async _doUpdate(){"featureReduction"in this.layer&&this.layer.featureReduction&&this.layer.featureReduction!==this._lastFeatureReduction&&(this.layer.featureReduction=this.layer.featureReduction?.clone(),this._lastFeatureReduction=this.layer.featureReduction);try{if(await Promise.allSettled([this._handleChange(),E(this.layer)]),this.destroyed||!this.layerAdapter?.hasRequiredSupport||!this._subscriptionManager)return;const e=this.featureContainer.instanceStore;this.featureContainer.attributeView.lockTextureUploads(),e.updateStart();const t=this.featureEffect,r={store:e,cimAnalyzer:this.view.stage.cimAnalyzer,cimResourceManager:this.view.stage.painter.textureManager.resourceManager,scaleExpression:void 0},s=await this._createViewSchemaConfig(),i={source:this.layerAdapter.createSourceSchema(s,this._sourceRefreshVersion),processor:await this.layerAdapter.createProcessorSchema(r,s,this._displayRefreshVersion)},a=d(this._lastSchema?.source.mutable,i.source.mutable)||d(this._lastSchema?.processor,i.processor);if(!a)return this.featureContainer.requestRender(),this.featureContainer.attributeView.unlockTextureUploads(),e.updateEnd(),void(this.featureEffectView.featureEffect=t);this._lastSchema=i,this._fields=null;const o=Math.round(performance.now());has("esri-2d-update-debug")&&console.debug(`Id[${this.layer.uid}] Version[${o}] FeatureLayerView2D._doUpdate`,{changes:a});const n=await this.getWorker();await n.pipeline.updateSchema(i,o),e.updateEnd(),this.featureEffectView.featureEffect=t,this.featureEffectView.endTransition(),this.featureContainer.restartAllAnimations(),this.featureContainer.attributeView.unlockTextureUploads(),this.featureContainer.trySwapRenderState(),this.featureContainer.requestRender(),has("esri-2d-update-debug")&&console.debug(`Version[${o}] FeatureLayerView2D.updateEnd`),this.requestUpdate()}catch(e){has("esri-2d-update-debug")&&console.error("Encountered an error during update",e)}}async _doOverride(e){const t=await this.getWorker(),r=new X;for(const i of e.messages)switch(i.type){case"edit":r.add(await this._resolveEdit(i.event));break;case"override":r.add(this._resolveOverrides(i.options))}try{await t.pipeline.onOverride(r.toMessage())}catch(s){m(s),0}}_getEffectiveAvailableFields(e){const t=ne(this._lastAvailableFields,e);return this._lastAvailableFields=t,k(this.layer.fieldsIndex,t)}async _createViewSchemaConfig(){const e=this.requiresCurrentUser?await this.signedInUser:null,t=[ce(this.view,this.layerAdapter,this.timeExtent,this._visibilityOverrides,this.filter,this.effectiveDisplayFilterClause),this.featureEffect?.filter?.toJSON()??null];return{availableFields:this._getEffectiveAvailableFields(this.availableFields),displayFilterEnabled:this.displayFilterEnabled,filters:t,scale:this.view.scale,timeZone:this.view.timeZone,timeExtent:this.view.timeExtent,currentUser:e}}_processHighlight(){this._commandsQueue.push({type:"highlight"})}async _updateHighlights(){const e=this._getHighlights(),t=await this.getWorker();if(this.destroyed)return;const r=t.pipeline.updateHighlight({highlights:e}).catch((e=>{m(e)||h.getLogger(this).error(e)}));this._updatingHandles.addPromise(r)}_setLayersForFeature(e){e.layer=e.sourceLayer=this.layer,this.layerAdapter.setGraphicOrigin&&this.layerAdapter.setGraphicOrigin(e)}_createGraphicHit(e,t){return this._setLayersForFeature(t),null!=t.geometry&&(t.geometry.spatialReference=this.view.spatialReference),{type:"graphic",graphic:t,layer:this.layer,mapPoint:e}}};function ce(e,t,r,s,i,a){i&&(i=i.clone());const o=null!=i?i.timeExtent:null,n=null!=r&&null!=o?r.intersection(o):r||o;n&&(i??=new x,i.timeExtent=n),i=t.addFilters?.(i,e)??i,a&&(i??=new x,i.where=b(i.where,a));let u=i?.toJSON()??null;return s.size&&(u??=(new x).toJSON(),u.hiddenIds=Array.from(s)),u}e([F()],he.prototype,"_commandsQueue",void 0),e([F()],he.prototype,"_sourceRefreshVersion",void 0),e([F()],he.prototype,"_displayRefreshVersion",void 0),e([F({readOnly:!0})],he.prototype,"_pipelineUpdating",void 0),e([F()],he.prototype,"_sourceUpdating",void 0),e([F({readOnly:!0})],he.prototype,"dataUpdating",null),e([F({readOnly:!0})],he.prototype,"effectiveDisplayFilterClause",null),e([F({readOnly:!0})],he.prototype,"hasAllFeatures",null),e([F({readOnly:!0})],he.prototype,"hasAllFeaturesInView",null),e([F({readOnly:!0})],he.prototype,"hasFullGeometries",null),e([F()],he.prototype,"featureEffectView",void 0),e([F()],he.prototype,"labelingCollisionInfos",null),e([F()],he.prototype,"layerAdapter",null),e([F({readOnly:!0})],he.prototype,"timeExtent",null),e([F()],he.prototype,"updating",void 0),he=e([A("esri.views.2d.layers.FeatureLayerView2D")],he);const de=he;export{de as default};
5
+ import{_ as e}from"../../../chunks/tslib.es6.js";import t from"../../../AggregateGraphic.js";import r from"../../../Graphic.js";import s from"../../../TrackGraphic.js";import{isSome as i}from"../../../core/arrayUtils.js";import a from"../../../core/Collection.js";import{neverReached as o}from"../../../core/compilerUtils.js";import n from"../../../core/Error.js";import{makeHandle as u,handlesGroup as l}from"../../../core/handleUtils.js";import has from"../../../core/has.js";import h from"../../../core/Logger.js";import{destroyMaybe as c}from"../../../core/maybe.js";import{notDeepEqual as d}from"../../../core/object.js";import{createAbortError as p,createResolver as y,ignoreAbortErrors as f,throwIfNotAbortError as g,isAbortError as m}from"../../../core/promiseUtils.js";import{watch as w}from"../../../core/reactiveUtils.js";import{sqlOr as v,sqlIn as _,sqlAnd as b}from"../../../core/sql.js";import{property as F}from"../../../core/accessorSupport/decorators/property.js";import{subclass as A}from"../../../core/accessorSupport/decorators/subclass.js";import{UpdatingHandles as S}from"../../../core/support/UpdatingHandles.js";import j from"../../../geometry/Extent.js";import U from"../../../layers/effects/FeatureEffectView.js";import{convertFromFeature as I}from"../../../layers/graphics/featureConversionUtils.js";import x from"../../../layers/support/FeatureFilter.js";import{checkServiceCurrentUserSupport as E}from"../../../layers/support/featureLayerUtils.js";import{packFields as k}from"../../../layers/support/fieldUtils.js";import{getEffectiveLayerCapabilities as C}from"../../../layers/support/layerUtils.js";import{combineTimeExtent as V}from"../../../layers/support/timeSupport.js";import q from"../../../rest/support/AggregateFeatureSet.js";import R from"../../../rest/support/AttributeBinsFeatureSet.js";import O from"../../../rest/support/AttributeBinsQuery.js";import Q from"../../../rest/support/FeatureSet.js";import L from"../../../rest/support/Query.js";import{LayerView2DMixin as D}from"./LayerView2D.js";import{FeatureContainer as P}from"./features/FeatureContainer.js";import{createFeaturePipelineWorkerProxy as T}from"./features/FeaturePipelineWorkerProxy.js";import{FeatureSourceEventLog as W}from"./features/FeatureSourceEventLog.js";import{CatalogFootprintLayerAdapter as H}from"./features/layerAdapters/CatalogFootprintLayerAdapter.js";import{FeatureLayerAdapter as M}from"./features/layerAdapters/FeatureLayerAdapter.js";import{InMemoryLayerAdapter as N}from"./features/layerAdapters/InMemoryLayerAdapter.js";import{KnowledgeGraphSublayerAdapter as J}from"./features/layerAdapters/KnowledgeGraphSublayerAdapter.js";import{OGCFeatureLayerAdapter as G}from"./features/layerAdapters/OGCFeatureLayerAdapter.js";import{OrientedImageryLayerAdapter as $}from"./features/layerAdapters/OrientedImageryLayerAdapter.js";import{ParquetLayerAdapter as B}from"./features/layerAdapters/ParquetLayerAdapter.js";import{StreamLayerAdapter as z}from"./features/layerAdapters/StreamLayerAdapter.js";import{SubtypeGroupLayerAdapter as Z}from"./features/layerAdapters/SubtypeGroupLayerAdapter.js";import{createComplexSymbolInstances as K}from"./features/schema/processor/symbols/ComplexSymbolSchema.js";import{DebouncedFeatureOverride as X}from"./support/DebouncedFeatureOverride.js";import{FeatureCommandQueue as Y}from"./support/FeatureCommandQueue.js";import{handleNoEngineError as ee}from"./support/handleNoEngineError.js";import{toJSONGeometryType as te}from"./support/util.js";import{FeatureTileSubscriptionManager as re}from"../tiling/FeatureTileSubscriptionManager.js";import se from"../../layers/FeatureLayerView.js";import ie from"../../layers/LayerView.js";import ae from"../../layers/RefreshableLayerView.js";import{defaultHighlightName as oe}from"../../support/HighlightDefaults.js";function ne(e,t){const r=new Set;return e&&e.forEach((e=>r.add(e))),t&&t.forEach((e=>r.add(e))),r.has("*")?["*"]:Array.from(r)}const ue=4294967294;function le(e,t){return l(e.map((e=>w((()=>{const t=e();return t&&"object"==typeof t?"getTime"in t&&"function"==typeof t.getTime?t.getTime():JSON.stringify(t):t}),t))))}let he=class extends(se(ae(D(ie)))){constructor(){super(...arguments),this._commandsQueue=new Y({process:e=>{switch(e.type){case"override-batch":return this._doOverride(e);case"update":return this._doUpdate();case"highlight":return this._updateHighlights()}}}),this._visibilityOverrides=new Set,this._lastAvailableFields=[],this._lastTargetState=null,this.eventLog=new W,this._sourceRefreshVersion=1,this._displayRefreshVersion=1,this._pipelineUpdating=!1,this._editUpdatingHandles=new S,this._fields=null,this._sourceUpdating=!1,this.featureEffectView=new U}destroy(){this._workerProxy?.destroy(),this._workerAttached.reject(p()),this._commandsQueue.destroy()}initialize(){this._workerAttached=y(),f(this._workerAttached.promise),this.addResolvingPromise(this._initProxy()),this.featureEffectView.featureEffect=this.featureEffect,this.featureEffectView.endTransition()}async _initProxy(){const e=this.layer;if("isTable"in e&&e.isTable)throw new n("featurelayerview:table-not-supported","table feature layer can't be displayed",{layer:e});if(("feature"===e.type||"subtype-group"===e.type)&&!1===C(e)?.operations.supportsQuery)throw new n("featurelayerview:query-not-supported","layer view requires a layer with query capability",{layer:e});this._workerProxy&&this._workerProxy.destroy();const t=this._createClientOptions();this._workerProxy=await T(t)}async _attachProxy(){const e={service:await this.layerAdapter.createServiceOptions(this.view),tileInfoJSON:this.view?.featuresTilingScheme?.tileInfo?.toJSON()};let t=[];Array.isArray(e.service.source)&&(t=e.service.source);try{await this._workerProxy.pipeline.onAttach(e,{transferList:t}),this._workerAttached.resolve()}catch(r){this._workerAttached.reject(p()),g(r)}}async _detachProxy(){return this._workerProxy.pipeline.onDetach()}async getWorker(){return await this._workerAttached.promise,this._workerProxy}get dataUpdating(){return this._sourceUpdating||this._editUpdatingHandles.updating}get effectiveDisplayFilterClause(){const e=this.effectiveDisplayFilter?.where??null;return e&&this.hasHighlight?v(e,_(this.layer.objectIdField,this.highlightIds)):e}get hasAllFeatures(){return this.layer.visible&&!this.suspended&&this.eventLog.hasAllData&&this.eventLog.willQueryAllFeatures}get hasAllFeaturesInView(){const e=this.effectiveDisplayFilter?.where||null,t=!this.eventLog.willQueryAllFeatures&&null!=e&&"1=1"!==e;return this.layer.visible&&!this.suspended&&this.eventLog.hasAllData&&!t}get hasFullGeometries(){return this.layer.visible&&!this.suspended&&this.eventLog.hasAllData&&this.eventLog.willQueryFullResolutionGeometry}get labelingCollisionInfos(){const e=this.layerAdapter.getLabelingDeconflictionInfo(this.view),t=this.layer.geometryType,r=!this.suspended;return e.map((({vvEvaluators:e,deconflictionEnabled:s})=>({container:this.featureContainer,vvEvaluators:e,deconflictionEnabled:s,geometryType:t,visible:r})))}get layerAdapter(){switch(this.layer.type){case"feature":return"memory"===this.layer.source.type?new N(this.layer):new M(this.layer);case"geojson":case"csv":case"wfs":return new N(this.layer);case"parquet":return new B(this.layer);case"subtype-group":return new Z(this.layer);case"ogc-feature":return new G(this.layer);case"stream":return new z(this.layer);case"oriented-imagery":return new $(this.layer);case"knowledge-graph-sublayer":return new J(this.layer);case"catalog-footprint":return new H(this.layer);default:o(this.layer)}return null}get timeExtent(){return V(this.layerAdapter.timeOptions,this.view?.timeExtent,this._get("timeExtent"))}getDisplayStatistics(e,t){return this.featureContainer?.getDisplayStatistics(e,t)}async queryHeatmapStatistics(e){return(await this.getWorker()).pipeline.queryHeatmapStatistics(e)}highlight(e,t){let s;e instanceof r?s=[e.getObjectId()]:"number"==typeof e||"string"==typeof e?s=[e]:a.isCollection(e)&&e.length>0?s=e.map((e=>e?.getObjectId())).toArray():Array.isArray(e)&&e.length>0&&(s="number"==typeof e[0]||"string"==typeof e[0]?e:e.map((e=>e?.getObjectId())));const o=s?.filter(i);if(!o?.length)return u();const n=t?.name??oe;return this._addHighlights(o,n),u((()=>!this.destroyed&&this._removeHighlights(o,n)))}async hitTest(e,i){const a=await this.featureContainer.hitTest(i);if(0===a.length)return null;const o=await this.getWorker(),{features:n,aggregates:u,tracks:l}=await o.pipeline.getDisplayFeatures(a),h=this.featureContainer.getSortKeys(a),c=({displayId:e},{displayId:t})=>h.has(e)&&h.has(t)?h.get(e)-h.get(t):e-t;return n.sort(c).reverse(),u.sort(c).reverse(),[...u.map((r=>this._createGraphicHit(e,t.fromJSON(r)))),...l.map((t=>this._createGraphicHit(e,s.fromJSON(t)))),...n.map((t=>this._createGraphicHit(e,r.fromJSON(t))))]}async queryStatistics(){const e=await this.getWorker();return ee(e.pipeline.queryStatistics(),{featureCount:0,ringCount:0,vertexCount:0})}async querySummaryStatistics(e,t,r){const s=await this.getWorker(),i={...t,scale:this.view.scale},a=s.features.executeQueryForSummaryStatistics(this._cleanUpQuery(e),i,r);return ee(a,{})}async queryAggregateSummaryStatistics(e,t,r){const s={...t,scale:this.view.scale},i=(await this.getWorker()).aggregates.executeQueryForSummaryStatistics(this._cleanUpAggregateQuery(e),s,r);return ee(i,{})}async queryUniqueValues(e,t,r){const s=await this.getWorker(),i={...t,scale:this.view.scale},a=s.features.executeQueryForUniqueValues(this._cleanUpQuery(e),i,r);return ee(a,{uniqueValueInfos:[]})}async queryAggregateUniqueValues(e,t,r){const s=await this.getWorker(),i={...t,scale:this.view.scale},a=s.aggregates.executeQueryForUniqueValues(this._cleanUpAggregateQuery(e),i,r);return ee(a,{uniqueValueInfos:[]})}async queryClassBreaks(e,t,r){const s=await this.getWorker(),i={...t,scale:this.view.scale},a=s.features.executeQueryForClassBreaks(this._cleanUpQuery(e),i,r);return ee(a,{classBreakInfos:[]})}async queryAggregateClassBreaks(e,t,r){const s=await this.getWorker(),i={...t,scale:this.view.scale},a=s.aggregates.executeQueryForClassBreaks(this._cleanUpAggregateQuery(e),i,r);return ee(a,{classBreakInfos:[]})}async queryHistogram(e,t,r){const s=await this.getWorker(),i={...t,scale:this.view.scale},a=s.features.executeQueryForHistogram(this._cleanUpQuery(e),i,r);return ee(a,{bins:[],maxValue:null,minValue:null,normalizationTotal:null})}async queryAggregateHistogram(e,t,r){const s=await this.getWorker(),i={...t,scale:this.view.scale},a=s.aggregates.executeQueryForHistogram(this._cleanUpAggregateQuery(e),i,r);return ee(a,{bins:[],maxValue:null,minValue:null,normalizationTotal:null})}queryFeatures(e,t){return this.queryFeaturesJSON(e,t).then((e=>{const t=Q.fromJSON(e);return t.features.forEach((e=>this._setLayersForFeature(e))),t}))}async queryVisibleFeatures(e,t){const r=(await this.getWorker()).pipeline.queryVisibleFeatures(this._cleanUpQuery(e),t),s=await ee(r,{features:[]}),i=Q.fromJSON(s);return i.features.forEach((e=>this._setLayersForFeature(e))),i}async queryAggregates(e,t){const r=(await this.getWorker()).aggregates.executeQuery(this._cleanUpAggregateQuery(e),t),s=await ee(r,{features:[]}),i=q.fromJSON(s);return i.features.forEach((e=>this._setLayersForFeature(e))),i}async queryAggregateIds(e,t){const r=(await this.getWorker()).aggregates.executeQueryForIds(this._cleanUpAggregateQuery(e),t);return ee(r,[])}async queryAggregateCount(e,t){const r=(await this.getWorker()).aggregates.executeQueryForCount(this._cleanUpAggregateQuery(e),t);return ee(r,0)}async queryAggregateJSON(e,t){const r=(await this.getWorker()).aggregates.executeQuery(this._cleanUpAggregateQuery(e),t);return ee(r,{features:[]})}async queryFeaturesJSON(e,t){const r=(await this.getWorker()).features.executeQuery(this._cleanUpQuery(e),t);return ee(r,{features:[]})}async queryObjectIds(e,t){const r=(await this.getWorker()).features.executeQueryForIds(this._cleanUpQuery(e),t);return ee(r,[])}async queryFeatureCount(e,t){const r=(await this.getWorker()).features.executeQueryForCount(this._cleanUpQuery(e),t);return ee(r,0)}async queryExtent(e,t){const r=(await this.getWorker()).features.executeQueryForExtent(this._cleanUpQuery(e),t),s=await ee(r,{count:0,extent:null});return{count:s.count,extent:j.fromJSON(s.extent)}}async queryAttributeBins(e,t){const r=(await this.getWorker()).features.executeAttributeBinsQuery(this._cleanUpAttributeBinsQuery(e),t),s=await ee(r,{features:[]});return R.fromJSON(s)}async getSampleFeatures(e){return(await this.getWorker()).pipeline.getSampleFeatures(e)}setVisibility(e,t){t?this._visibilityOverrides.delete(e):this._visibilityOverrides.add(e),this._update()}update(e){if(!this._subscriptionManager)return;this.view.animation&&!this._lastTargetState&&(this._lastTargetState=e.state.clone()),!this.view.animation&&this._lastTargetState&&(this._lastTargetState=null);const t=this._subscriptionManager.update(e.targetState,this._lastTargetState);this.featureContainer.setVisibleTiles(t)}attach(){has("esri-2d-update-debug")&&console.debug("FeatureLayerView2D.attach"),f(this._updatingHandles.addPromise(this._workerAttached.promise)),f(this._attachProxy()),this.featureContainer=new P(this),this.container.addChild(this.featureContainer),this.view.timeline.record(`${this.layer.title} (FeatureLayer) Attach`),this._subscriptionManager=new re({tileInfoView:this.view.featuresTilingScheme,updateSubscriptions:e=>{this.featureContainer.updateSubscriptions(e),f(this._updatingHandles.addPromise(this.getWorker().then((t=>t.pipeline.updateSubscriptions(e)))))},isDone:e=>this.featureContainer.isDone(e)}),this.requestUpdate(),this.addAttachHandles([le([()=>this._displayRefreshVersion,()=>this.layer.displayFilterInfo,()=>this.timeExtent,()=>this.clips,()=>this.filter,()=>this.effectiveDisplayFilterClause,()=>this.featureEffect,()=>this._sourceRefreshVersion,()=>this.view.timeZone,()=>this.view.timeExtent,...this.layerAdapter.getUpdateHashProperties(this.view)],(()=>this._update())),w((()=>this.updateSuspended),(e=>{e||(this._subscriptionManager.resume(),this.view.labelManager.requestUpdate())})),w((()=>this.visible),(e=>{this.view.labelManager.requestUpdate()}))]),this._update(),"stream"!==this.layer.type&&"parquet"!==this.layer.type&&"catalog-footprint"!==this.layer.type&&this.addAttachHandles(this.layer.on("edits",(e=>this._editUpdatingHandles.addPromise(this._edit(e)))))}detach(){has("esri-2d-update-debug")&&console.debug("FeatureLayerView2D.detach"),this._detachProxy(),this._fields=null,this.featureContainer.destroy(),this.featureContainer=null,this._commandsQueue.clear(),this.container.removeAllChildren(),this._subscriptionManager=c(this._subscriptionManager),this._workerProxy.pipeline.onDetach(),this._workerAttached=y(),f(this._workerAttached.promise),this._lastAvailableFields=[],this._lastSchema=null}viewChange(){this.requestUpdate()}moveEnd(){this.requestUpdate()}addOverrides(e){return this._commandsQueue.push({type:"override",options:{...e,release:[]}})}removeOverrides(e){for(const r of e)if(null==r)throw new n("featurelayerview:bad-override","Tried to remove an override for an invalid objectId",{objectId:r});const t={added:[],updated:[],removed:[],release:e,isWeak:!1,historicMoment:null};return this._commandsQueue.push({type:"override",options:t})}isUpdating(){const e="renderer"in this.layer&&null!=this.layer.renderer,t=this._commandsQueue.updateTracking.updating,r=null!=this._updatingRequiredPromise,s=this.featureContainer.updatingHandles.updating,i=this.updateRequested||e&&(t||r)||s||this._pipelineUpdating||this.dataUpdating;if(has("esri-2d-log-updating")){console.log(`Updating FLV2D (${this.layer.id}): ${i}\n -> updateRequested ${this.updateRequested}\n -> hasRenderer ${e}\n -> updatingRequiredFields ${r}\n -> hasPendingCommand ${t}\n -> dataUpdating ${this.dataUpdating}\n -> processing ${this._pipelineUpdating}\n -> updatingContainer ${s}\n`);for(const e of this.featureContainer.subscriptions())console.log(` -> Tile[${e.id}] Done: ${e.done}`)}return i}_createClientOptions(){const e=this;return{get container(){return e.featureContainer},setUpdating:e=>{this._set("_pipelineUpdating",e.pipeline),this._set("_sourceUpdating",e.source)},emitEvent:e=>{this.emit(e.name,e.event)},get eventLog(){return e.eventLog},fetch:async t=>{if(has("esri-2d-stabilize-glyphs")){const r=[];for(const s of t)r.push(await e.view.stage.painter.textureManager.rasterizeItem(s));return r}return Promise.all(t.map((t=>e.view.stage.painter.textureManager.rasterizeItem(t))))},fetchDictionary:e=>Promise.all(e.map((e=>this._fetchDictionaryRequest(e))))}}async _fetchDictionaryRequest(e){try{if("subtype-group"===this.layer.type)throw new Error("InternalError: SubtypeGroupLayer does not support dictionary renderer");const t=this.layer.renderer;if(!t||"dictionary"!==t.type)throw new Error("InternalError: Expected layer to have a DictionaryRenderer");const r=this._lastSchema.processor.mesh.factory.symbology;if("dictionary"!==r.type)throw new Error("InternalError: Expected schema to be of type 'dictionary'");const s={cimAnalyzer:this.view.stage.cimAnalyzer,cimResourceManager:this.view.stage.painter.textureManager.resourceManager,store:this.featureContainer.instanceStore,scaleExpression:r.scaleExpression};this._fields||(this._fields=this.layer.fields.map((e=>e.toJSON())));const i=r.visualVariableUniforms,a=await t.getSymbolAsync(e.feature,{fields:this._fields});if(!a||!a.data)return{type:"dictionary-response",meshes:[]};return{type:"dictionary-response",meshes:await K(a.data,{uniforms:i,path:"renderer",schemaOptions:s})}}catch(t){return{type:"dictionary-response",meshes:[]}}}_cleanUpQuery(e){const t=L.from(e)||this.createQuery();return t.outSpatialReference||(t.outSpatialReference=this.view.spatialReference),t.toJSON()}_cleanUpAttributeBinsQuery(e){const t=O.from(e);return t.outSpatialReference||(t.outSpatialReference=this.view.spatialReference),t.toJSON()}_cleanUpAggregateQuery(e){const t=L.from(e)||this.createAggregateQuery();t.outSpatialReference||(t.outSpatialReference=this.view.spatialReference);const r=t.objectIds??[];for(const s of t.aggregateIds??[])r.push(s);return t.objectIds=r,t.aggregateIds=[],t.toJSON()}async _update(){return this._commandsQueue.push({type:"update"})}_edit(e){return this.updateSuspended?(this._subscriptionManager.suspend(),Promise.resolve()):this._commandsQueue.push({type:"edit",event:e})}async doRefresh(e){this.attached&&(this.updateSuspended&&e||(e?this.incrementSourceRefreshVersion():this.incrementDisplayRefreshVersion()))}incrementSourceRefreshVersion(){this._sourceRefreshVersion=(this._sourceRefreshVersion+1)%ue+1}incrementDisplayRefreshVersion(){this._displayRefreshVersion=(this._displayRefreshVersion+1)%ue+1}async _resolveIdenifiers(e){const t=[],r=[];for(const a of e)null==a.objectId||-1===a.objectId?null==a.globalId?h.getLogger(this).warn("mapview-apply-edits","A feature identifier must contain either a GlobalId or ObjectId. Ignoring",{identifier:a}):r.push(a.globalId):t.push(a.objectId);const s="globalIdField"in this.layer&&this.layer.globalIdField,i=s&&this.availableFields.includes(s);if(r.length&&!i)return h.getLogger(this).error(new n("mapview-apply-edits",`Editing the specified service requires the layer's globalIdField, ${s} to be included the layer's outFields for updates to be reflected on the map`)),t;if(r.length){const e=await this._workerProxy.pipeline.getObjectIdsFromGlobalIds(r);for(const r of e)t.push(r)}return t}_resolveOverrides(e){const t=!1,r=!1,s=te(this.layer.geometryType),i=this.layer.objectIdField,a=[];for(const o of e.added){const e=I(o,s,t,r,i);if(null==e.objectId)throw new n("featurelayerview:bad-override","Feature does not have an objectId",{feature:o});a.push(e)}for(const o of e.updated){const e=I(o,s,t,r,i);if(null==e.objectId)throw new n("featurelayerview:bad-override","Feature does not have an objectId",{feature:o});a.push(e)}for(const o of e.removed)if(null==o)throw new n("featurelayerview:bad-override","Tried to remove an invalid objectId",{objectId:o});return{type:"override",updates:a,removed:e.removed,release:e.release,isWeak:e.isWeak??!1,historicMoment:e.historicMoment??null}}async _resolveEdit(e){const t=this.layer,r=e.historicMoment?.getTime()??null,s="layerId"in t&&e.editedFeatures?.find((e=>e.layerId===t.layerId));if(s&&this._canEditByFeature(s)){const{adds:e,deletes:t,updates:i}=s.editedFeatures,a=this.layer.objectIdField,o=i.map((e=>e.current)),n=t.map((e=>"attributes"in e?{objectId:a?e.attributes[a]:null}:e)),u=await this._resolveIdenifiers(n);return this._resolveOverrides({added:e,updated:o,removed:u,historicMoment:r,isWeak:!0,release:[]})}const[i,a,o]=await Promise.all([this._resolveIdenifiers(e.addedFeatures),this._resolveIdenifiers(e.updatedFeatures),this._resolveIdenifiers(e.deletedFeatures)]);return{type:"override-by-id",updates:[...i,...a],removed:o,historicMoment:r,isWeak:!0}}_canEditByFeature(e){const{adds:t,updates:r}=e.editedFeatures;return t.every((e=>this.view.spatialReference.equals(e.geometry?.spatialReference)))&&r.every((e=>this.view.spatialReference.equals(e.current.geometry?.spatialReference)))}async _doUpdate(){"featureReduction"in this.layer&&this.layer.featureReduction&&this.layer.featureReduction!==this._lastFeatureReduction&&(this.layer.featureReduction=this.layer.featureReduction?.clone(),this._lastFeatureReduction=this.layer.featureReduction);try{if(await Promise.allSettled([this._handleChange(),E(this.layer)]),this.destroyed||!this.layerAdapter?.hasRequiredSupport||!this._subscriptionManager)return;const e=this.featureContainer.instanceStore;this.featureContainer.attributeView.lockTextureUploads(),e.updateStart();const t=this.featureEffect,r={store:e,cimAnalyzer:this.view.stage.cimAnalyzer,cimResourceManager:this.view.stage.painter.textureManager.resourceManager,scaleExpression:void 0},s=await this._createViewSchemaConfig(),i={source:this.layerAdapter.createSourceSchema(s,this._sourceRefreshVersion),processor:await this.layerAdapter.createProcessorSchema(r,s,this._displayRefreshVersion)},a=d(this._lastSchema?.source.mutable,i.source.mutable)||d(this._lastSchema?.processor,i.processor);if(!a)return this.featureContainer.requestRender(),this.featureContainer.attributeView.unlockTextureUploads(),e.updateEnd(),void(this.featureEffectView.featureEffect=t);this._lastSchema=i,this._fields=null;const o=Math.round(performance.now());has("esri-2d-update-debug")&&console.debug(`Id[${this.layer.uid}] Version[${o}] FeatureLayerView2D._doUpdate`,{changes:a});const n=await this.getWorker();await n.pipeline.updateSchema(i,o),e.updateEnd(),this.featureEffectView.featureEffect=t,this.featureEffectView.endTransition(),this.featureContainer.restartAllAnimations(),this.featureContainer.attributeView.unlockTextureUploads(),this.featureContainer.trySwapRenderState(),this.featureContainer.requestRender(),has("esri-2d-update-debug")&&console.debug(`Version[${o}] FeatureLayerView2D.updateEnd`),this.requestUpdate()}catch(e){has("esri-2d-update-debug")&&console.error("Encountered an error during update",e)}}async _doOverride(e){const t=await this.getWorker();try{for(const r of e.messages)switch(r.type){case"edit":{const e=new X;e.add(await this._resolveEdit(r.event)),await t.pipeline.onOverride(e.toMessage());break}case"override":{const e=new X;e.add(this._resolveOverrides(r.options)),await t.pipeline.onOverride(e.toMessage());break}}}catch(r){m(r),0}}_getEffectiveAvailableFields(e){const t=ne(this._lastAvailableFields,e);return this._lastAvailableFields=t,k(this.layer.fieldsIndex,t)}async _createViewSchemaConfig(){const e=this.requiresCurrentUser?await this.signedInUser:null,t=[ce(this.view,this.layerAdapter,this.timeExtent,this._visibilityOverrides,this.filter,this.effectiveDisplayFilterClause),this.featureEffect?.filter?.toJSON()??null];return{availableFields:this._getEffectiveAvailableFields(this.availableFields),displayFilterEnabled:this.displayFilterEnabled,filters:t,scale:this.view.scale,timeZone:this.view.timeZone,timeExtent:this.view.timeExtent,currentUser:e}}_processHighlight(){this._commandsQueue.push({type:"highlight"})}async _updateHighlights(){const e=this._getHighlights(),t=await this.getWorker();if(this.destroyed)return;const r=t.pipeline.updateHighlight({highlights:e}).catch((e=>{m(e)||h.getLogger(this).error(e)}));this._updatingHandles.addPromise(r)}_setLayersForFeature(e){e.layer=e.sourceLayer=this.layer,this.layerAdapter.setGraphicOrigin&&this.layerAdapter.setGraphicOrigin(e)}_createGraphicHit(e,t){return this._setLayersForFeature(t),null!=t.geometry&&(t.geometry.spatialReference=this.view.spatialReference),{type:"graphic",graphic:t,layer:this.layer,mapPoint:e}}};function ce(e,t,r,s,i,a){i&&(i=i.clone());const o=null!=i?i.timeExtent:null,n=null!=r&&null!=o?r.intersection(o):r||o;n&&(i??=new x,i.timeExtent=n),i=t.addFilters?.(i,e)??i,a&&(i??=new x,i.where=b(i.where,a));let u=i?.toJSON()??null;return s.size&&(u??=(new x).toJSON(),u.hiddenIds=Array.from(s)),u}e([F()],he.prototype,"_commandsQueue",void 0),e([F()],he.prototype,"_sourceRefreshVersion",void 0),e([F()],he.prototype,"_displayRefreshVersion",void 0),e([F({readOnly:!0})],he.prototype,"_pipelineUpdating",void 0),e([F()],he.prototype,"_sourceUpdating",void 0),e([F({readOnly:!0})],he.prototype,"dataUpdating",null),e([F({readOnly:!0})],he.prototype,"effectiveDisplayFilterClause",null),e([F({readOnly:!0})],he.prototype,"hasAllFeatures",null),e([F({readOnly:!0})],he.prototype,"hasAllFeaturesInView",null),e([F({readOnly:!0})],he.prototype,"hasFullGeometries",null),e([F()],he.prototype,"featureEffectView",void 0),e([F()],he.prototype,"labelingCollisionInfos",null),e([F()],he.prototype,"layerAdapter",null),e([F({readOnly:!0})],he.prototype,"timeExtent",null),e([F()],he.prototype,"updating",void 0),he=e([A("esri.views.2d.layers.FeatureLayerView2D")],he);const de=he;export{de as default};
@@ -2,4 +2,4 @@
2
2
  All material copyright ESRI, All Rights Reserved, unless otherwise specified.
3
3
  See https://js.arcgis.com/4.33/esri/copyright.txt for details.
4
4
  */
5
- import e from"../../../../core/Error.js";import{handlesGroup as t}from"../../../../core/handleUtils.js";import has from"../../../../core/has.js";import{nextTick as s}from"../../../../core/nextTick.js";import{throwIfNotAbortError as i,createResolver as r,ignoreAbortErrors as o}from"../../../../core/promiseUtils.js";import n from"../../../../core/RandomLCG.js";import{watch as u}from"../../../../core/reactiveUtils.js";import{pt2px as a}from"../../../../core/screenUtils.js";import{ignoreConnectionErrors as d}from"../../../../core/workers/utils.js";import c from"../../../../layers/support/TileInfo.js";import p from"../../tiling/TileInfoView.js";import"../../tiling/TileKey.js";import"../../tiling/TileQueue.js";import"../../tiling/TileStrategy.js";import{tileSize as h}from"../../engine/webgl/definitions.js";import{PipelineConnectionHandlers as l}from"./PipelineConnectionHandlers.js";import g from"./Processor.js";import{FeatureSource as _}from"./sources/FeatureSource.js";import{FeatureTileSubscription as b}from"./sources/FeatureTileSubscription.js";import{Tile as f}from"./support/Tile.js";class m{constructor(e){this.inner=e,this.resolver=r()}}class y{constructor(){this._aggregateAdapter={getFeatureObjectIds:e=>this._processor.getFeatureObjectIdsForAggregate(e)},this._subscriptions=new Map,this._cachedObjectIds=new Set,this._updateRequested=!1,this._didSourceRefresh=!1,this._updateSubscriptionRequests=[],this._updateHighlightRequests=[]}destroy(){this._subscriptions.clear(),this._processor?.destroy(),this._source?.destroy(),this._handles?.remove(),this._updateOverridesRequest=null,this._tileInfoView=null}onAttach(e){has("esri-2d-update-debug")&&console.debug("Pipeline.onAttach");const s=this._connection,i=c.fromJSON(e.tileInfoJSON);this._tileInfoView=new p(i),this._source=new _(e.service,this._aggregateAdapter,this._subscriptions,s,this._cachedObjectIds),this._processor=new g(s,this._source),this._handles=t([this._source.store.events.on("changed",(()=>this._requestUpdate())),this._source.store.events.on("refresh",(()=>this._requestRefresh())),u((()=>this._source.updateTracking.updating),(()=>{this._requestUpdate(),o(this._connection.layerView.setUpdating({source:this._source.updateTracking.updating,pipeline:!0}))}))])}onDetach(){has("esri-2d-update-debug")&&console.debug("Pipeline.onDetach"),this.destroy()}set remoteClient(e){this._connection=new l(e)}get features(){const t=this._source?.queryEngine;if(!t)throw new e("no-queryEngine","No query engine defined");return t}get aggregates(){const t=this._processor?.aggregateQueryEngine;if(!t)throw new e("no-queryEngine","No aggregate query engine defined");return t}get processor(){return this._processor}get streamMessenger(){return this._source.streamMessenger}getDisplayFeatures(e){return this._processor.getDisplayFeatures(e)}getDisplayIds(e){return this._processor.getDisplayIds(e)}getObjectIdsFromGlobalIds(e){return this._source.getObjectIdsFromGlobalIds(e)}async updateSchema(e,t){return has("esri-2d-update-debug")&&this._updateSchemaRequest&&console.error("InternalError: Schema already updating"),this._updateSchemaRequest=new m({schema:e,version:t}),this._requestUpdate(),this._updateSchemaRequest.resolver.promise}updateSubscriptions(e){const t=new m(e);return this._updateSubscriptionRequests.push(t),this._requestUpdate(),t.resolver.promise}updateHighlight(e){const t=new m(e);return this._updateHighlightRequests.push(t),this._requestUpdate(),t.resolver.promise}async addParquetFile(e){return this._source.addParquetFile(e)}async onOverride(t){if(null!=this._updateOverridesRequest)throw new e("InternalError - Already processing an edit");this._updateOverridesRequest=new m(t);const s=this._updateOverridesRequest.resolver.promise;return this._requestUpdate(),s}queryStatistics(){return this._source.statistics.toJSON()}async queryVisibleFeatures(e,t){return this.features.executeQuery(e,t)}async queryHeatmapStatistics(e){const t=Math.round(a(e.radius));let s=Number.POSITIVE_INFINITY,i=Number.NEGATIVE_INFINITY;const r="string"==typeof e.fieldOffset,o=e.fieldOffset??0,n=Array.from(this._subscriptions.values()),u=this._source.chunks(),d=t**2,c=3/(Math.PI*d),p=2*t,l=Math.ceil(h/p);for(const a of n){const t=a.tile,n=new Float64Array(l*l);for(const s of u){const i=s.getTileReader(t);if(!i)continue;const u=i.getCursor();for(;u.next();){let t=1;if(null!=e.field){const s=u.readAttribute(e.field);t=r?-1*+s:+s+o}const s=u.readXForDisplay()/p,i=u.readYForDisplay()/p,a=Math.floor(s),h=Math.floor(i);if(a<0||h<0||a>=l||h>=l)continue;const g=((.5+a-s)*p)**2+((.5+h-i)*p)**2;if(g>d)continue;const _=t*(c*(1-g/d)**2);n[h+a*l]+=_}}for(let e=0;e<n.length;e++)s=Math.min(s,n[e]),i=Math.max(i,n[e])}return{max:i,min:s}}async getSampleFeatures(e){const t=this._source.chunks();if(t.reduce(((e,t)=>e+t.size()),0)<=e.minFeatureCount){if(!this._source.updateTracking.updating){const e=[];return this._source.store.forEachUnsafe((t=>e.push(t.readLegacyFeatureWorldSpace()))),e}return null}const s=new Set,i=[],r=t.map((e=>e.reader.getCursor())),o=new n,u=3*e.sampleSize;for(let n=0;n<u&&i.length<e.sampleSize;n++){const e=r[o.getIntRange(0,t.length-1)];if(0===e.getSize())continue;const n=o.getIntRange(0,e.getSize()-1);e.setIndex(n);const u=e.getObjectId();s.has(u)||(s.add(u),i.push(e.readLegacyFeatureWorldSpace()))}return i.length>=e.sampleSize?i:null}_requestUpdate(){this._updateRequested||(this._updateRequested=!0,s((()=>this._scheduleNextUpdate())))}_requestRefresh(){this._didSourceRefresh=!0,this._requestUpdate()}_scheduleNextUpdate(){this._updateRequested&&(this._ongoingUpdate||(this._ongoingUpdate=d(this._doUpdate()).finally((()=>{this._ongoingUpdate=null,this._scheduleNextUpdate()})),this._updateRequested=!1))}_subscribe(e){const t=e.tileId;if(this._subscriptions.has(t))return;has("esri-2d-update-debug")&&console.debug(`Tile[${t}] Pipeline.subscribe`);const s=new f(this._tileInfoView,t),i=new b(s,e.version);this._subscriptions.set(t,i),this._source.onSubscribe(i),this._processor.onSubscribe(i)}_unsubscribe(e){const t=this._subscriptions.get(e);t&&(has("esri-2d-update-debug")&&console.debug(`Tile[${e}] Pipeline.unsubscribe`),t.abort(),this._source.onUnsubscribe(t),this._processor.onUnsubscribe(t),this._subscriptions.delete(t.key.id))}async _doUpdate(){if(has("esri-2d-update-debug")&&console.debug("Pipeline._doUpdateStart"),await this._connection.layerView.setUpdating({source:this._source.updateTracking.updating,pipeline:!0}),this._updateSubscriptionRequests.length){const e=this._updateSubscriptionRequests;this._updateSubscriptionRequests=[];for(const t of e)this._doUpdateSubscriptions(t.inner),t.resolver.resolve()}if(this._updateHighlightRequests.length){const e=this._updateHighlightRequests,t=new Set,s=new Set;for(const i of e)for(const{objectId:e,highlightFlags:r}of i.inner.highlights)r?(t.add(e),s.delete(e)):(s.add(e),t.delete(e));this._source.prepareCacheUpdate(t,s)}const e=this._updateSchemaRequest;this._updateSchemaRequest=null;let t=!1;if(null!=e){const{schema:s,version:i}=e.inner;t=await this._doUpdateSchema(s,i)}this._didSourceRefresh&&(t=!0,this._didSourceRefresh=!1),t&&(this._processor.invalidate(),await this._connection.container.updateRenderState(this._processor.version));const s=this._updateOverridesRequest;if(this._updateOverridesRequest=null,null!=s){has("esri-2d-update-debug")&&console.debug("Pipeline.applyOverride",s.inner);const e=await this._source.normalizeOverrides(s.inner);null!=e.historicMoment&&this._source.unsafeSetQueryHistoricMoment(e.historicMoment),this._source.applyOverride(e),has("esri-2d-update-debug")&&console.debug("Pipeline.endOverride",s.inner)}if(await this._source.applyCacheUpdate(),this._updateHighlightRequests.length){const e=this._updateHighlightRequests;this._updateHighlightRequests=[];for(const t of e)this._processor.updateHighlight(t.inner),t.resolver.resolve()}const r=this._source.cleanup();this._processor.removeChunks(r);try{const e=this._source.takeOverrideUpdate();if(null!=e&&this._subscriptions.size){has("esri-2d-update-debug")&&console.debug("Pipeline.applyOverrideChangesStart"),await this._connection.container.lockForOverrides();try{await this._processor.applyOverrideUpdate(e)}catch(o){has("esri-2d-update-debug")&&console.debug("InternalError",o)}await this._connection.container.unlockForOverrides(),has("esri-2d-update-debug")&&console.debug("Pipeline.applyOverrideChangesEnd")}this._subscriptions.size&&(has("esri-2d-update-debug")&&console.debug("Pipeline.updateChunksStart"),await this._processor.updateChunks(),has("esri-2d-update-debug")&&console.debug("Pipeline.updateChunksEnd"))}catch(o){i(o)}null!=s&&s.resolver.resolve(),null!=e&&e.resolver.resolve(),null==e&&t&&await this._connection.container.trySwapRenderState(),this._updateRequested?(has("esri-2d-update-debug")&&console.debug("Pipeline._doUpdateEnd [updateRequested=true]"),await this._connection.layerView.setUpdating({source:this._source.updateTracking.updating,pipeline:!0})):(has("esri-2d-update-debug")&&console.debug("Pipeline._doUpdateEnd [updateRequested=false, After flush]"),await this._connection.layerView.setUpdating({source:this._source.updateTracking.updating,pipeline:this._updateRequested}))}async _doUpdateSchema(e,t){has("esri-2d-update-debug")&&console.debug(`Version[${t}] Pipeline.updateStart`,{schema:e});const s={tileInfo:this._tileInfoView?.tileInfo},i=await this._source.update(e,t),r=Array.from(this._subscriptions.values()),o=this._processor.update(e,t,s,i,r);return has("esri-2d-update-debug")&&console.debug(`Version[${t}] Pipeline.updateEnd`),o}_doUpdateSubscriptions(e){has("esri-2d-update-debug")&&console.debug("Pipeline.updateSubscriptions",e);for(const t of e.subscribe)this._subscribe(t);for(const t of e.unsubscribe)this._unsubscribe(t)}}export{y as default};
5
+ import e from"../../../../core/Error.js";import{handlesGroup as t}from"../../../../core/handleUtils.js";import has from"../../../../core/has.js";import{nextTick as s}from"../../../../core/nextTick.js";import{throwIfNotAbortError as i,createResolver as r,ignoreAbortErrors as o}from"../../../../core/promiseUtils.js";import n from"../../../../core/RandomLCG.js";import{watch as u}from"../../../../core/reactiveUtils.js";import{pt2px as a}from"../../../../core/screenUtils.js";import{ignoreConnectionErrors as d}from"../../../../core/workers/utils.js";import c from"../../../../layers/support/TileInfo.js";import p from"../../tiling/TileInfoView.js";import"../../tiling/TileKey.js";import"../../tiling/TileQueue.js";import"../../tiling/TileStrategy.js";import{tileSize as h}from"../../engine/webgl/definitions.js";import{PipelineConnectionHandlers as l}from"./PipelineConnectionHandlers.js";import g from"./Processor.js";import{FeatureSource as _}from"./sources/FeatureSource.js";import{FeatureTileSubscription as b}from"./sources/FeatureTileSubscription.js";import{Tile as f}from"./support/Tile.js";class m{constructor(e){this.inner=e,this.resolver=r()}}class y{constructor(){this._aggregateAdapter={getFeatureObjectIds:e=>this._processor.getFeatureObjectIdsForAggregate(e)},this._subscriptions=new Map,this._cachedObjectIds=new Set,this._updateRequested=!1,this._didSourceRefresh=!1,this._updateSubscriptionRequests=[],this._updateHighlightRequests=[]}destroy(){this._subscriptions.clear(),this._processor?.destroy(),this._source?.destroy(),this._handles?.remove(),this._updateOverridesRequest=null,this._tileInfoView=null}onAttach(e){has("esri-2d-update-debug")&&console.debug("Pipeline.onAttach");const s=this._connection,i=c.fromJSON(e.tileInfoJSON);this._tileInfoView=new p(i),this._source=new _(e.service,this._aggregateAdapter,this._subscriptions,s,this._cachedObjectIds),this._processor=new g(s,this._source),this._handles=t([this._source.store.events.on("changed",(()=>this._requestUpdate())),this._source.store.events.on("refresh",(()=>this._requestRefresh())),u((()=>this._source.updateTracking.updating),(()=>{this._requestUpdate(),o(this._connection.layerView.setUpdating({source:this._source.updateTracking.updating,pipeline:!0}))}))])}onDetach(){has("esri-2d-update-debug")&&console.debug("Pipeline.onDetach"),this.destroy()}set remoteClient(e){this._connection=new l(e)}get features(){const t=this._source?.queryEngine;if(!t)throw new e("no-queryEngine","No query engine defined");return t}get aggregates(){const t=this._processor?.aggregateQueryEngine;if(!t)throw new e("no-queryEngine","No aggregate query engine defined");return t}get processor(){return this._processor}get streamMessenger(){return this._source.streamMessenger}getDisplayFeatures(e){return this._processor.getDisplayFeatures(e)}getDisplayIds(e){return this._processor.getDisplayIds(e)}getObjectIdsFromGlobalIds(e){return this._source.getObjectIdsFromGlobalIds(e)}async updateSchema(e,t){return has("esri-2d-update-debug")&&this._updateSchemaRequest&&console.error("InternalError: Schema already updating"),this._updateSchemaRequest=new m({schema:e,version:t}),this._requestUpdate(),this._updateSchemaRequest.resolver.promise}updateSubscriptions(e){const t=new m(e);return this._updateSubscriptionRequests.push(t),this._requestUpdate(),t.resolver.promise}updateHighlight(e){const t=new m(e);return this._updateHighlightRequests.push(t),this._requestUpdate(),t.resolver.promise}async addParquetFile(e){return this._source.addParquetFile(e)}async onOverride(t){if(null!=this._updateOverridesRequest)throw new e("InternalError - Already processing an edit");this._updateOverridesRequest=new m(t);const s=this._updateOverridesRequest.resolver.promise;return this._requestUpdate(),s}queryStatistics(){return this._source.statistics.toJSON()}async queryVisibleFeatures(e,t){return this.features.executeQuery(e,t)}async queryHeatmapStatistics(e){const t=Math.round(a(e.radius));let s=Number.POSITIVE_INFINITY,i=Number.NEGATIVE_INFINITY;const r="string"==typeof e.fieldOffset,o=e.fieldOffset??0,n=Array.from(this._subscriptions.values()),u=this._source.chunks(),d=t**2,c=3/(Math.PI*d),p=2*t,l=Math.ceil(h/p);for(const a of n){const t=a.tile,n=new Float64Array(l*l);for(const s of u){const i=s.getTileReader(t);if(!i)continue;const u=i.getCursor();for(;u.next();){let t=1;if(null!=e.field){const s=u.readAttribute(e.field);t=r?-1*+s:+s+o}const s=u.readXForDisplay()/p,i=u.readYForDisplay()/p,a=Math.floor(s),h=Math.floor(i);if(a<0||h<0||a>=l||h>=l)continue;const g=((.5+a-s)*p)**2+((.5+h-i)*p)**2;if(g>d)continue;const _=t*(c*(1-g/d)**2);n[h+a*l]+=_}}for(let e=0;e<n.length;e++)s=Math.min(s,n[e]),i=Math.max(i,n[e])}return{max:i,min:s}}async getSampleFeatures(e){const t=this._source.chunks();if(t.reduce(((e,t)=>e+t.size()),0)<=e.minFeatureCount){if(!this._source.updateTracking.updating){const e=[];return this._source.store.forEachUnsafe((t=>e.push(t.readLegacyFeatureWorldSpace()))),e}return null}const s=new Set,i=[],r=t.map((e=>e.reader.getCursor())),o=new n,u=3*e.sampleSize;for(let n=0;n<u&&i.length<e.sampleSize;n++){const e=r[o.getIntRange(0,t.length-1)];if(0===e.getSize())continue;const n=o.getIntRange(0,e.getSize()-1);e.setIndex(n);const u=e.getObjectId();s.has(u)||(s.add(u),i.push(e.readLegacyFeatureWorldSpace()))}return i.length>=e.sampleSize?i:null}_requestUpdate(){this._updateRequested||(this._updateRequested=!0,s((()=>this._scheduleNextUpdate())))}_requestRefresh(){this._didSourceRefresh=!0,this._requestUpdate()}_scheduleNextUpdate(){this._updateRequested&&(this._ongoingUpdate||(this._ongoingUpdate=d(this._doUpdate()).finally((()=>{this._ongoingUpdate=null,this._scheduleNextUpdate()})),this._updateRequested=!1))}_subscribe(e){const t=e.tileId;if(this._subscriptions.has(t))return;has("esri-2d-update-debug")&&console.debug(`Tile[${t}] Pipeline.subscribe`);const s=new f(this._tileInfoView,t),i=new b(s,e.version);this._subscriptions.set(t,i),this._source.onSubscribe(i),this._processor.onSubscribe(i)}_unsubscribe(e){const t=this._subscriptions.get(e);t&&(has("esri-2d-update-debug")&&console.debug(`Tile[${e}] Pipeline.unsubscribe`),t.abort(),this._source.onUnsubscribe(t),this._processor.onUnsubscribe(t),this._subscriptions.delete(t.key.id))}async _doUpdate(){if(has("esri-2d-update-debug")&&console.debug("Pipeline._doUpdateStart"),await this._connection.layerView.setUpdating({source:this._source.updateTracking.updating,pipeline:!0}),this._updateSubscriptionRequests.length){const e=this._updateSubscriptionRequests;this._updateSubscriptionRequests=[];for(const t of e)this._doUpdateSubscriptions(t.inner),t.resolver.resolve()}if(this._updateHighlightRequests.length){const e=this._updateHighlightRequests,t=new Set,s=new Set;for(const i of e)for(const{objectId:e,highlightFlags:r}of i.inner.highlights)r?(t.add(e),s.delete(e)):(s.add(e),t.delete(e));this._source.prepareCacheUpdate(t,s)}const e=this._updateSchemaRequest;this._updateSchemaRequest=null;let t=!1;if(null!=e){const{schema:s,version:i}=e.inner;t=await this._doUpdateSchema(s,i)}this._didSourceRefresh&&(t=!0,this._didSourceRefresh=!1),t&&(this._processor.invalidate(),await this._connection.container.updateRenderState(this._processor.version));const s=this._updateOverridesRequest;if(this._updateOverridesRequest=null,null!=s){has("esri-2d-update-debug")&&console.debug("Pipeline.applyOverride",s.inner),null!=s.inner.historicMoment&&this._source.unsafeSetQueryHistoricMoment(s.inner.historicMoment);const e=await this._source.normalizeOverrides(s.inner);this._source.applyOverride(e),has("esri-2d-update-debug")&&console.debug("Pipeline.endOverride",s.inner)}if(await this._source.applyCacheUpdate(),this._updateHighlightRequests.length){const e=this._updateHighlightRequests;this._updateHighlightRequests=[];for(const t of e)this._processor.updateHighlight(t.inner),t.resolver.resolve()}const r=this._source.cleanup();this._processor.removeChunks(r);try{const e=this._source.takeOverrideUpdate();if(null!=e&&this._subscriptions.size){has("esri-2d-update-debug")&&console.debug("Pipeline.applyOverrideChangesStart"),await this._connection.container.lockForOverrides();try{await this._processor.applyOverrideUpdate(e)}catch(o){has("esri-2d-update-debug")&&console.debug("InternalError",o)}await this._connection.container.unlockForOverrides(),has("esri-2d-update-debug")&&console.debug("Pipeline.applyOverrideChangesEnd")}this._subscriptions.size&&(has("esri-2d-update-debug")&&console.debug("Pipeline.updateChunksStart"),await this._processor.updateChunks(),has("esri-2d-update-debug")&&console.debug("Pipeline.updateChunksEnd"))}catch(o){i(o)}null!=s&&s.resolver.resolve(),null!=e&&e.resolver.resolve(),null==e&&t&&await this._connection.container.trySwapRenderState(),this._updateRequested?(has("esri-2d-update-debug")&&console.debug("Pipeline._doUpdateEnd [updateRequested=true]"),await this._connection.layerView.setUpdating({source:this._source.updateTracking.updating,pipeline:!0})):(has("esri-2d-update-debug")&&console.debug("Pipeline._doUpdateEnd [updateRequested=false, After flush]"),await this._connection.layerView.setUpdating({source:this._source.updateTracking.updating,pipeline:this._updateRequested}))}async _doUpdateSchema(e,t){has("esri-2d-update-debug")&&console.debug(`Version[${t}] Pipeline.updateStart`,{schema:e});const s={tileInfo:this._tileInfoView?.tileInfo},i=await this._source.update(e,t),r=Array.from(this._subscriptions.values()),o=this._processor.update(e,t,s,i,r);return has("esri-2d-update-debug")&&console.debug(`Version[${t}] Pipeline.updateEnd`),o}_doUpdateSubscriptions(e){has("esri-2d-update-debug")&&console.debug("Pipeline.updateSubscriptions",e);for(const t of e.subscribe)this._subscribe(t);for(const t of e.unsubscribe)this._unsubscribe(t)}}export{y as default};
@@ -2,4 +2,4 @@
2
2
  All material copyright ESRI, All Rights Reserved, unless otherwise specified.
3
3
  See https://js.arcgis.com/4.33/esri/copyright.txt for details.
4
4
  */
5
- import{debounce as t}from"../../../../../core/promiseUtils.js";import{FeatureSnapshotSourceChunk as e}from"./strategies/chunks/FeatureSnapshotSourceChunk.js";class s{constructor(s,h,i,o){this.store=s,this.queryInfo=h,this._options=i,this._fetch=o,this._nextBatch=new Set,this._fetchFeatures=t((async()=>{if(0===this._nextBatch.size||this._options.signal?.aborted)return;const t=Array.from(this._nextBatch);this._nextBatch.clear();try{const s=this.queryInfo.createQuery({objectIds:t,outFields:["*"],cacheHint:!0}),h="cache."+t.join(","),i=await this._fetch(s,this._options,{chunkId:h}),o=new e(i,s.inner.toJSON(),0,!1);o.chunkId=h,this.store.insert(o)}catch{}}))}prepareCacheUpdate(t,e){if(e)for(const s of e)this._nextBatch.delete(s);for(const s of t)this._nextBatch.add(s)}applyCacheUpdate(){return 0===this._nextBatch.size||this._options.signal?.aborted?null:this._fetchFeatures().catch((()=>{}))}}export{s as FeatureCache};
5
+ import"../../../../../core/has.js";import{debounce as t}from"../../../../../core/promiseUtils.js";import{FeatureSnapshotSourceChunk as e}from"./strategies/chunks/FeatureSnapshotSourceChunk.js";class s{constructor(s,h,i,o){this.store=s,this.queryInfo=h,this._options=i,this._fetch=o,this._nextBatch=new Set,this._fetchFeatures=t((async()=>{if(0===this._nextBatch.size||this._options.signal?.aborted)return;const t=Array.from(this._nextBatch);this._nextBatch.clear();try{const s=this.queryInfo.createQuery({objectIds:t,outFields:["*"],cacheHint:!0}),h="cache."+t.join(","),i=await this._fetch(s,this._options,{chunkId:h}),o=new e(i,s.inner.toJSON(),0,!1);o.chunkId=h,this.store.insert(o)}catch(s){}}))}prepareCacheUpdate(t,e){if(e)for(const s of e)this._nextBatch.delete(s);for(const s of t)this._nextBatch.add(s)}applyCacheUpdate(){return 0===this._nextBatch.size||this._options.signal?.aborted?null:this._fetchFeatures().catch((()=>{}))}}export{s as FeatureCache};
@@ -2,4 +2,4 @@
2
2
  All material copyright ESRI, All Rights Reserved, unless otherwise specified.
3
3
  See https://js.arcgis.com/4.33/esri/copyright.txt for details.
4
4
  */
5
- import e from"../../../../../request.js";import has from"../../../../../core/has.js";import{ignoreAbortErrors as t,throwIfNotAbortError as s}from"../../../../../core/promiseUtils.js";import{diff as r,hasRootDiffOnly as a,hasRootDiff as i}from"../../../../../core/accessorSupport/diffUtils.js";import{OptimizedFeature as n}from"../../../../../layers/graphics/OptimizedFeature.js";import{QueryEngine as o}from"../../../../../layers/graphics/data/QueryEngine.js";import{executeQueryForCount as d}from"../../../../../rest/query/operations/query.js";import{FeatureStoreStatistics as h}from"../FeatureStoreStatistics.js";import{FeatureSourceQueryInfo as c}from"./FeatureSourceQueryInfo.js";import{StreamMessenger as u}from"./StreamMessenger.js";import{DrillDownTileLoadStrategy as p}from"./strategies/DrillDownTileLoadStrategy.js";import{PagedTileLoadStrategy as l}from"./strategies/PagedTileLoadStrategy.js";import{ParquetLoadStrategy as m}from"./strategies/ParquetLoadStrategy.js";import{SnapshotLoadStrategy as y}from"./strategies/SnapshotLoadStrategy.js";import{StreamLoadStrategy as _}from"./strategies/StreamLoadStrategy.js";import{FeatureSourceChunkStore as g}from"./strategies/chunks/SourceChunkStore.js";import{FeatureMetadata as f}from"../support/FeatureMetadata.js";import{UpdateTracking2D as S}from"../../support/UpdateTracking2D.js";class v{constructor(e,t,s,r,a){this.service=e,this._aggregateAdapter=t,this._subscriptions=s,this._connection=r,this._cachedObjectIds=a,this._updateTracking=new S({debugName:"FeatureSource"}),this._didInvalidateData=!1,this._metadata=f.createFeature(e.metadata),this._store=new g(this._metadata)}destroy(){this._strategy?.destroy(),this._store.destroy(),this._streamMessenger?.destroy(),"memory"===this.service.type&&this.service.source.map((e=>e.close()))}get metadata(){if(!this._metadata)throw new Error("InternalError: Metadata not defined. Was update called?");return this._metadata}get store(){return this._store}get streamMessenger(){return null==this._streamMessenger&&this._initStreamMessenger(),this._streamMessenger}get statistics(){return h.from(this._store)}get updateTracking(){return this._updateTracking}get queryEngine(){if(!this._queryEngine){if(!this._schema)return null;const{dataFilter:e}=this._schema.mutable,t=this._schema.mutable.availableFields,s=this._metadata;this._queryEngine=new o({featureStore:this._store,fieldsIndex:s.fieldsIndex,geometryType:s.geometryType,objectIdField:s.objectIdField,hasM:!1,hasZ:!1,spatialReference:this.service.outSpatialReference,aggregateAdapter:this._aggregateAdapter,timeInfo:s.timeInfo,definitionExpression:e.definitionExpression,availableFields:t})}return this._queryEngine}get isStream(){return"stream"===this._schema.type}get hasDisplayFilter(){return"displayFilterInfo"in this._schema.mutable&&null!=this._schema.mutable.displayFilterInfo}chunks(){return Array.from(this._store.chunks())}prepareCacheUpdate(e,t){const s=new Set,r=new Set;for(const a of e)this._cachedObjectIds.has(a)||(this._cachedObjectIds.add(a),s.add(a));for(const a of t)this._cachedObjectIds.delete(a),r.add(a);this.hasDisplayFilter&&this._strategy.prepareCacheUpdate(s,r)}async applyCacheUpdate(){this.hasDisplayFilter&&await this._updateTracking.addPromise(this._strategy.applyCacheUpdate())}cleanup(){return this._store.cleanup()}onSubscribe(e){this._connection.onEvent({type:"subscribe",tile:e.tile.id});const t=this._strategy?.load(e);t&&(t.then((()=>this._connection.onEvent({type:"loaded",tile:e.tile.id}))).catch((t=>this._connection.onEvent({type:"error",tile:e.tile.id,error:t}))),this._updateTracking.addPromise(t))}onResume(e){this._updateTracking.addPromise(t(this._strategy?.load(e)))}onUnsubscribe(e){this._connection.onEvent({type:"unsubscribe",tile:e.tile.id}),this._strategy?.unload(e)}applyOverride(e){this._didInvalidateData=!0,this._store.applyOverride(e)}takeOverrideUpdate(){return this._store.takeOverrideUpdate()}async update(e,t){const s=e.source,n=r(this._schema?.mutable,s.mutable);if(!n)return!1;if(has("esri-2d-update-debug")&&console.debug(`Version[${t}] FeatureSource.update`,{changes:n}),this._schema=s,this._queryEngine?.destroy(),this._queryEngine=null,"feature-service"===this.service.type&&null!=this.service.queryMetadata.lastEditDate&&(this._lastEditDate=this.service.queryMetadata.lastEditDate),null==this._streamMessenger&&"stream"===this._schema.type&&this._initStreamMessenger(),a(n,"sourceRefreshVersion")&&this._strategy?.refresh)return await this._strategy.refresh(),!0;if(("feature"===s.type||"parquet"===s.type)&&a(n,"availableFields")){if(await this._queryLastEditDateChanged()||this._didInvalidateData)this._didInvalidateData=!1,await this._updateStrategy(t);else{this._connection.onEvent({type:"updateFieldsStart"});try{await this._strategy.updateFields(s.mutable.availableFields),this._connection.onEvent({type:"updateFieldsEnd"})}catch(o){this._connection.onEvent({type:"updateFieldsError",error:o})}}return!1}return!!(i(n,"dataFilter")||i(n,"sourceRefreshVersion")||this._strategy.about.supportsDisplayFilter&&i(n,"displayFilterInfo"))&&(await this._updateStrategy(t),!0)}async addParquetFile(e){this._strategy.addParquetFile(e)}unsafeSetQueryHistoricMoment(e){"feature"===this._schema.type&&(this._schema.mutable.dataFilter.historicMoment=e,this._strategy.unsafeSetQueryHistoricMoment(new Date(e)))}_initStreamMessenger(){null==this._streamMessenger&&(this._streamMessenger=new u(this._connection))}async normalizeOverrides(e){const t={historicMoment:e.historicMoment,commands:{updateWeak:e.commands.updateWeak.map(n.fromJSON),removeWeak:e.commands.removeWeak,update:e.commands.update.map(n.fromJSON),remove:e.commands.remove,release:e.commands.release}},s=e.commands.updateByIdWeak,r=await this._queryOptimizedFeatures(s);return t.commands.updateWeak.push(...r),t}async _queryOptimizedFeatures(e){if(0===e.length)return[];const t=[],s=(await this._strategy.queryByObjectId(e)).getCursor();for(;s.next();)t.push(s.readOptimizedFeatureWorldSpace());return t}getObjectIdsFromGlobalIds(e){const t=new Set(e),s=this.metadata.globalIdField;if(null==s)throw new Error("InternalError: Recieved an edit with globalIds, but not supported by the service");const r=[];return this._store.forEachUnsafe((e=>{const a=e.readAttribute(s);if(t.has(a)){const t=e.getObjectId();null!=t&&r.push(t)}})),r}async _queryLastEditDateChanged(){if(null==this._lastEditDate)return!1;const t=this.service.source,s={...t.query,f:"json"},r=(await e(t.path,{query:s,responseType:"json"})).data.editingInfo.lastEditDate;return r!==this._lastEditDate&&(this._lastEditDate=r,!0)}async _createStrategy(){const e="isSourceHosted"in this.service&&this.service.isSourceHosted,t=Array.isArray(this.service.source),s=this.service.source&&"collection"in this.service.source,r=e||t||s;if("stream"===this._schema.type){const e=new _(this.service,this._schema.mutable.dataFilter,this._store,{outSR:this.service.outSpatialReference},this.metadata);return this._streamMessenger.strategy=e,e}if("parquet"===this._schema.type){const e=this.service;return new m(e,this._metadata,this._schema,this._store)}const a=this.service,i=c.fromSchema(a,this._schema,this._metadata),n=await this._supportSnapshotMode(a,i);return n?new y(a,i,this._store,n.featureCount,this.metadata,this._connection):r?new l(a,i,this._store,this.metadata,this._connection):new p(a,i,this._store,this.metadata,this._connection)}async _updateStrategy(e){const t=await this._createStrategy();this._connection.onEvent({type:"updateStrategyStart",about:t.about});const r=!!this._strategy;this._store.clear(),this._strategy?.destroy(),this._strategy=t,has("esri-2d-update-debug")&&console.debug(`Version[${e}] FeatureSource.updateStrategy`,{strategy:t});const a=Array.from(this._subscriptions.values());if(!a.length)return void this._connection.onEvent({type:"updateStrategyEnd"});const i=Promise.all(a.map((e=>this._strategy.load(e).then((()=>this._connection.onEvent({type:"loaded",tile:e.tile.id}))).catch((t=>this._connection.onEvent({type:"error",tile:e.tile.id,error:t}))))));this._updateTracking.addPromise(i),this._strategy.prepareCacheUpdate(this._cachedObjectIds);try{r&&await i}catch(n){s(n)}this._connection.onEvent({type:"updateStrategyEnd"}),has("esri-2d-update-debug")&&console.debug(`Version[${e}] FeatureSource.updateStrategyEnd`,{strategy:t})}async _supportSnapshotMode(e,t){const{queryMetadata:s}=e,r=s.snapshotInfo;if(!r||!r.supportsSnapshotMinThreshold||!r.snapshotCountThresholds)return null;const a=e.source,i=t.createQuery();i.inner.orderByFields=[],i.inner.returnGeometry=!1;const n=(await d(a,i.inner,{query:i.customParameters})).data.count,{min:o,max:h}=r.snapshotCountThresholds;return n<=o||r.supportsSnapshotMaxThreshold&&n<h?{featureCount:n}:null}}export{v as FeatureSource};
5
+ import e from"../../../../../request.js";import has from"../../../../../core/has.js";import{ignoreAbortErrors as t,throwIfNotAbortError as s}from"../../../../../core/promiseUtils.js";import{diff as r,hasRootDiffOnly as a,hasRootDiff as i}from"../../../../../core/accessorSupport/diffUtils.js";import{OptimizedFeature as n}from"../../../../../layers/graphics/OptimizedFeature.js";import{QueryEngine as o}from"../../../../../layers/graphics/data/QueryEngine.js";import{executeQueryForCount as d}from"../../../../../rest/query/operations/query.js";import{FeatureStoreStatistics as h}from"../FeatureStoreStatistics.js";import{FeatureSourceQueryInfo as c}from"./FeatureSourceQueryInfo.js";import{StreamMessenger as u}from"./StreamMessenger.js";import{DrillDownTileLoadStrategy as p}from"./strategies/DrillDownTileLoadStrategy.js";import{PagedTileLoadStrategy as l}from"./strategies/PagedTileLoadStrategy.js";import{ParquetLoadStrategy as m}from"./strategies/ParquetLoadStrategy.js";import{SnapshotLoadStrategy as y}from"./strategies/SnapshotLoadStrategy.js";import{StreamLoadStrategy as _}from"./strategies/StreamLoadStrategy.js";import{FeatureSourceChunkStore as g}from"./strategies/chunks/SourceChunkStore.js";import{FeatureMetadata as f}from"../support/FeatureMetadata.js";import{UpdateTracking2D as S}from"../../support/UpdateTracking2D.js";class v{constructor(e,t,s,r,a){this.service=e,this._aggregateAdapter=t,this._subscriptions=s,this._connection=r,this._cachedObjectIds=a,this._updateTracking=new S({debugName:"FeatureSource"}),this._didInvalidateData=!1,this._metadata=f.createFeature(e.metadata),this._store=new g(this._metadata)}destroy(){this._strategy?.destroy(),this._store.destroy(),this._streamMessenger?.destroy(),"memory"===this.service.type&&this.service.source.map((e=>e.close()))}get metadata(){if(!this._metadata)throw new Error("InternalError: Metadata not defined. Was update called?");return this._metadata}get store(){return this._store}get streamMessenger(){return null==this._streamMessenger&&this._initStreamMessenger(),this._streamMessenger}get statistics(){return h.from(this._store)}get updateTracking(){return this._updateTracking}get queryEngine(){if(!this._queryEngine){if(!this._schema)return null;const{dataFilter:e}=this._schema.mutable,t=this._schema.mutable.availableFields,s=this._metadata;this._queryEngine=new o({featureStore:this._store,fieldsIndex:s.fieldsIndex,geometryType:s.geometryType,objectIdField:s.objectIdField,hasM:!1,hasZ:!1,spatialReference:this.service.outSpatialReference,aggregateAdapter:this._aggregateAdapter,timeInfo:s.timeInfo,definitionExpression:e.definitionExpression,availableFields:t})}return this._queryEngine}get isStream(){return"stream"===this._schema.type}get hasDisplayFilter(){return!!this._schema&&("displayFilterInfo"in this._schema.mutable&&null!=this._schema.mutable.displayFilterInfo)}chunks(){return Array.from(this._store.chunks())}prepareCacheUpdate(e,t){const s=new Set,r=new Set;for(const a of e)this._cachedObjectIds.has(a)||(this._cachedObjectIds.add(a),s.add(a));for(const a of t)this._cachedObjectIds.delete(a),r.add(a);this.hasDisplayFilter&&this._strategy.prepareCacheUpdate(s,r)}async applyCacheUpdate(){this.hasDisplayFilter&&await this._updateTracking.addPromise(this._strategy.applyCacheUpdate())}cleanup(){return this._store.cleanup()}onSubscribe(e){this._connection.onEvent({type:"subscribe",tile:e.tile.id});const t=this._strategy?.load(e);t&&(t.then((()=>this._connection.onEvent({type:"loaded",tile:e.tile.id}))).catch((t=>this._connection.onEvent({type:"error",tile:e.tile.id,error:t}))),this._updateTracking.addPromise(t))}onResume(e){this._updateTracking.addPromise(t(this._strategy?.load(e)))}onUnsubscribe(e){this._connection.onEvent({type:"unsubscribe",tile:e.tile.id}),this._strategy?.unload(e)}applyOverride(e){this._didInvalidateData=!0,this._store.applyOverride(e)}takeOverrideUpdate(){return this._store.takeOverrideUpdate()}async update(e,t){const s=e.source,n=r(this._schema?.mutable,s.mutable);if(!n)return!1;if(has("esri-2d-update-debug")&&console.debug(`Version[${t}] FeatureSource.update`,{changes:n}),this._schema=s,this._queryEngine?.destroy(),this._queryEngine=null,"feature-service"===this.service.type&&null!=this.service.queryMetadata.lastEditDate&&(this._lastEditDate=this.service.queryMetadata.lastEditDate),null==this._streamMessenger&&"stream"===this._schema.type&&this._initStreamMessenger(),a(n,"sourceRefreshVersion")&&this._strategy?.refresh)return await this._strategy.refresh(),!0;if(("feature"===s.type||"parquet"===s.type)&&a(n,"availableFields")){if(await this._queryLastEditDateChanged()||this._didInvalidateData)this._didInvalidateData=!1,await this._updateStrategy(t);else{this._connection.onEvent({type:"updateFieldsStart"});try{await this._strategy.updateFields(s.mutable.availableFields),this._connection.onEvent({type:"updateFieldsEnd"})}catch(o){this._connection.onEvent({type:"updateFieldsError",error:o})}}return!1}return!!(i(n,"dataFilter")||i(n,"sourceRefreshVersion")||this._strategy.about.supportsDisplayFilter&&i(n,"displayFilterInfo"))&&(await this._updateStrategy(t),!0)}async addParquetFile(e){this._strategy.addParquetFile(e)}unsafeSetQueryHistoricMoment(e){"feature"===this._schema.type&&(this._schema.mutable.dataFilter.historicMoment=e,this._strategy.unsafeSetQueryHistoricMoment(new Date(e)))}_initStreamMessenger(){null==this._streamMessenger&&(this._streamMessenger=new u(this._connection))}async normalizeOverrides(e){const t={historicMoment:e.historicMoment,commands:{updateWeak:e.commands.updateWeak.map(n.fromJSON),removeWeak:e.commands.removeWeak,update:e.commands.update.map(n.fromJSON),remove:e.commands.remove,release:e.commands.release}},s=e.commands.updateByIdWeak,r=await this._queryOptimizedFeatures(s);return t.commands.updateWeak.push(...r),t}async _queryOptimizedFeatures(e){if(0===e.length)return[];const t=[],s=(await this._strategy.queryByObjectId(e)).getCursor();for(;s.next();)t.push(s.readOptimizedFeatureWorldSpace());return t}getObjectIdsFromGlobalIds(e){const t=new Set(e),s=this.metadata.globalIdField;if(null==s)throw new Error("InternalError: Recieved an edit with globalIds, but not supported by the service");const r=[];return this._store.forEachUnsafe((e=>{const a=e.readAttribute(s);if(t.has(a)){const t=e.getObjectId();null!=t&&r.push(t)}})),r}async _queryLastEditDateChanged(){if(null==this._lastEditDate)return!1;const t=this.service.source,s={...t.query,f:"json"},r=(await e(t.path,{query:s,responseType:"json"})).data.editingInfo.lastEditDate;return r!==this._lastEditDate&&(this._lastEditDate=r,!0)}async _createStrategy(){const e="isSourceHosted"in this.service&&this.service.isSourceHosted,t=Array.isArray(this.service.source),s=this.service.source&&"collection"in this.service.source,r=e||t||s;if("stream"===this._schema.type){const e=new _(this.service,this._schema.mutable.dataFilter,this._store,{outSR:this.service.outSpatialReference},this.metadata);return this._streamMessenger.strategy=e,e}if("parquet"===this._schema.type){const e=this.service;return new m(e,this._metadata,this._schema,this._store)}const a=this.service,i=c.fromSchema(a,this._schema,this._metadata),n=await this._supportSnapshotMode(a,i);return n?new y(a,i,this._store,n.featureCount,this.metadata,this._connection):r?new l(a,i,this._store,this.metadata,this._connection):new p(a,i,this._store,this.metadata,this._connection)}async _updateStrategy(e){const t=await this._createStrategy();this._connection.onEvent({type:"updateStrategyStart",about:t.about});const r=!!this._strategy;this._store.clear(),this._strategy?.destroy(),this._strategy=t,has("esri-2d-update-debug")&&console.debug(`Version[${e}] FeatureSource.updateStrategy`,{strategy:t});const a=Array.from(this._subscriptions.values());if(!a.length)return void this._connection.onEvent({type:"updateStrategyEnd"});const i=Promise.all(a.map((e=>this._strategy.load(e).then((()=>this._connection.onEvent({type:"loaded",tile:e.tile.id}))).catch((t=>this._connection.onEvent({type:"error",tile:e.tile.id,error:t}))))));this._updateTracking.addPromise(i),this._strategy.prepareCacheUpdate(this._cachedObjectIds);try{r&&await i}catch(n){s(n)}this._connection.onEvent({type:"updateStrategyEnd"}),has("esri-2d-update-debug")&&console.debug(`Version[${e}] FeatureSource.updateStrategyEnd`,{strategy:t})}async _supportSnapshotMode(e,t){const{queryMetadata:s}=e,r=s.snapshotInfo;if(!r||!r.supportsSnapshotMinThreshold||!r.snapshotCountThresholds)return null;const a=e.source,i=t.createQuery();i.inner.orderByFields=[],i.inner.returnGeometry=!1;const n=(await d(a,i.inner,{query:i.customParameters})).data.count,{min:o,max:h}=r.snapshotCountThresholds;return n<=o||r.supportsSnapshotMaxThreshold&&n<h?{featureCount:n}:null}}export{v as FeatureSource};
@@ -2,4 +2,4 @@
2
2
  All material copyright ESRI, All Rights Reserved, unless otherwise specified.
3
3
  See https://js.arcgis.com/4.33/esri/copyright.txt for details.
4
4
  */
5
- import{ASourceChunk as e}from"./ASourceChunk.js";import{FeatureSetReaderJSON as t}from"../../../support/FeatureSetReaderJSON.js";const s=1e4,r=1e3;class i{constructor(){this.modified=[],this.removed=[]}modify(e){this.modified.push(e)}remove(e){this.removed.push(e)}get isEmpty(){return 0===this.modified.length&&0===this.removed.length}}class o extends e{constructor(e){super(),this._reader=e,this.chunkId="override",this.normalizedChunkId="override"}static fromFeatures(e,s){const r=t.fromOptimizedFeatures(e,s);return new o(r)}get reader(){return this._reader}get queryInfo(){return{}}get first(){return!1}get end(){return!1}get isTiled(){return!1}getTileReader(e){if(!this._reader.getSize())return null;const t=this.queryFeaturesInBounds(e.bounds);return t.setTransformForDisplay(e.transform),t}}class n{constructor(e,t){this.inner=e,this.isWeak=t,this.lastWeak=null}}class a{constructor(){this._overrides=new Map,this._update=new i,this._lastCleanup=0}hasOverride(e){return this._overrides.has(e)}onChunkInsert(e){if(this._overrides.size){const t=e.reader.getCursor();for(;t.next();){const e=t.getObjectId(),s=this._overrides.get(e);if(s?.lastWeak&&(s.lastWeak=null),s?.isWeak){const e=t.readOptimizedFeatureWorldSpace();s.inner=e,this._update.modify(e),this.invalidate()}}}e.registerOverrides(this)}apply(e,t){const{updateWeak:s,removeWeak:r,update:i,remove:o,release:a}=e.commands;this.invalidate();for(const d of s)this._overrides.set(d.objectId,new n(d,!0)),this._update.modify(d);for(const d of i){const e=new n(d,!1),t=this._overrides.get(d.objectId);t?.isWeak&&(e.lastWeak=t),this._overrides.set(d.objectId,e),this._update.modify(d)}for(const d of r)this._overrides.set(d,new n(null,!0)),this._update.remove(d);for(const d of o){const e=new n(null,!1),t=this._overrides.get(d);t?.isWeak&&(e.lastWeak=t),this._overrides.set(d,e),this._update.remove(d)}if(a.length){const e=new Set;for(const t of a){const s=this._overrides.get(t);s?.lastWeak?this._overrides.set(t,s.lastWeak):s&&!s.isWeak&&(this._overrides.delete(t),e.add(t))}t.forEachUnsafe((t=>{const s=t.getObjectId();e.has(s)&&(this._update.modify(t.readOptimizedFeatureWorldSpace()),e.delete(s))}));for(const t of e.values())this._update.remove(t)}}clearWeakOverrides(){for(const[e,t]of this._overrides.entries())t.isWeak&&this._overrides.delete(e);this.invalidate()}cleanup(e){if(this._overrides.size<s)return;const t=performance.now();if(t-this._lastCleanup<r)return;this._lastCleanup=t;const i=this._getWeakDeletions();if(!(i.size<s)){for(const t of e){const e=t.reader.withoutOverrides().getCursor();for(;e.next();){const t=e.getObjectId();i.delete(t)}}for(const e of i)this._overrides.delete(e);i.size&&this.invalidate()}}takeOverrideUpdate(){const e=this._update;return e.isEmpty?null:(this._update=new i,e)}asChunk(e){if(!this._chunk){const t=[];for(const e of this._overrides.values())null!=e.inner&&t.push(e.inner);this._chunk=o.fromFeatures(t,e)}return this._chunk}invalidate(){this._chunk=null}_getWeakDeletions(){const e=new Set;for(const[t,s]of this._overrides.entries())s.isWeak&&null==s.inner&&e.add(t);return e}}export{o as OverrideChunk,a as OverrideState,i as OverrideUpdate};
5
+ import{ASourceChunk as e}from"./ASourceChunk.js";import{FeatureSetReaderJSON as t}from"../../../support/FeatureSetReaderJSON.js";const s=1e4,r=1e3;class i{constructor(){this.modified=[],this.removed=[]}modify(e){this.modified.push(e)}remove(e){this.removed.push(e)}get isEmpty(){return 0===this.modified.length&&0===this.removed.length}}class o extends e{constructor(e){super(),this._reader=e,this.chunkId="override",this.normalizedChunkId="override"}static fromFeatures(e,s){const r=t.fromOptimizedFeatures(e,s);return new o(r)}get reader(){return this._reader}get queryInfo(){return{}}get first(){return!1}get end(){return!1}get isTiled(){return!1}getTileReader(e){if(!this._reader.getSize())return null;const t=this.queryFeaturesInBounds(e.bounds);return t.setTransformForDisplay(e.transform),t}}class n{constructor(e,t){this.inner=e,this.isWeak=t,this.lastWeak=null}get isStrong(){return!this.isWeak}}class a{constructor(){this._overrides=new Map,this._update=new i,this._lastCleanup=0}hasOverride(e){return this._overrides.has(e)}onChunkInsert(e){if(this._overrides.size){const t=e.reader.getCursor();for(;t.next();){const e=t.getObjectId(),s=this._overrides.get(e);if(s?.lastWeak&&(s.lastWeak=null),s?.isWeak){const e=t.readOptimizedFeatureWorldSpace();s.inner=e,this._update.modify(e),this.invalidate()}}}e.registerOverrides(this)}apply(e,t){const{updateWeak:s,removeWeak:r,update:i,remove:o,release:a}=e.commands;this.invalidate();for(const d of s){const e=new n(d,!0),t=this._overrides.get(d.objectId);t?.isStrong?t.lastWeak=e:(this._overrides.set(d.objectId,e),this._update.modify(d))}for(const d of i){const e=new n(d,!1),t=this._overrides.get(d.objectId);e.lastWeak=t?.isWeak?t:t?.lastWeak??null,this._overrides.set(d.objectId,e),this._update.modify(d)}for(const d of r){const e=new n(null,!0),t=this._overrides.get(d);t?.isStrong?t.lastWeak=e:(this._overrides.set(d,e),this._update.remove(d))}for(const d of o){const e=new n(null,!1),t=this._overrides.get(d);e.lastWeak=t?.isWeak?t:t?.lastWeak??null,this._overrides.set(d,e),this._update.remove(d)}if(a.length){const e=new Set;for(const t of a){const s=this._overrides.get(t);s?.lastWeak?(this._overrides.set(t,s.lastWeak),null==s.lastWeak.inner?this._update.remove(t):this._update.modify(s.lastWeak.inner)):s&&!s.isWeak&&(this._overrides.delete(t),e.add(t))}t.forEachUnsafe((t=>{const s=t.getObjectId();e.has(s)&&(this._update.modify(t.readOptimizedFeatureWorldSpace()),e.delete(s))}));for(const t of e.values())this._update.remove(t)}}clearWeakOverrides(){for(const[e,t]of this._overrides.entries())t.isWeak&&this._overrides.delete(e);this.invalidate()}cleanup(e){if(this._overrides.size<s)return;const t=performance.now();if(t-this._lastCleanup<r)return;this._lastCleanup=t;const i=this._getWeakDeletions();if(!(i.size<s)){for(const t of e){const e=t.reader.withoutOverrides().getCursor();for(;e.next();){const t=e.getObjectId();i.delete(t)}}for(const e of i)this._overrides.delete(e);i.size&&this.invalidate()}}takeOverrideUpdate(){const e=this._update;return e.isEmpty?null:(this._update=new i,e)}asChunk(e){if(!this._chunk){const t=[];for(const e of this._overrides.values())null!=e.inner&&t.push(e.inner);this._chunk=o.fromFeatures(t,e)}return this._chunk}invalidate(){this._chunk=null}_getWeakDeletions(){const e=new Set;for(const[t,s]of this._overrides.entries())s.isWeak&&null==s.inner&&e.add(t);return e}}export{o as OverrideChunk,a as OverrideState,i as OverrideUpdate};
@@ -2,4 +2,4 @@
2
2
  All material copyright ESRI, All Rights Reserved, unless otherwise specified.
3
3
  See https://js.arcgis.com/4.33/esri/copyright.txt for details.
4
4
  */
5
- import{ArcadeDate as e}from"../../../../../arcade/ArcadeDate.js";import has from"../../../../../core/has.js";import{DateOnly as t}from"../../../../../core/sql/DateOnly.js";import{TimeOnly as r}from"../../../../../core/sql/TimeOnly.js";import{GeometryCursor as s}from"../../../../../geometry/GeometryCursor.js";import{fromRectValues as i}from"../../../../../geometry/support/aaBoundingBox.js";import{fromJSON as a}from"../../../../../geometry/support/jsonUtils.js";import{getLabelPoint as o}from"../../../../../geometry/support/labelPoint.js";import{getCentroidOptimizedGeometry as n}from"../../../../../layers/graphics/centroid.js";import{convertToGeometry as d,unquantizeOptimizedGeometry as u}from"../../../../../layers/graphics/featureConversionUtils.js";import{OptimizedFeature as h}from"../../../../../layers/graphics/OptimizedFeature.js";import c from"../../../../../layers/graphics/OptimizedGeometry.js";import{system as l,unknown as m}from"../../../../../time/timeZoneUtils.js";import{FeatureSetCache as y}from"./FeatureSetCache.js";const f=has("featurelayer-simplify-thresholds")??[.5,.5,.5,.5],p=f[0],g=f[1],_=f[2],b=f[3],x=has("featurelayer-simplify-payload-size-factors")??[1,2,4],D=x[0],T=x[1],F=x[2],A=has("featurelayer-simplify-mobile-factor")??2,S=has("esri-mobile"),I=4294967295;function B(e,t,r){if(!(e.length>t))for(;e.length<=t;)e.push(r)}class j{constructor(e){this.metadata=e,this.type="FeatureSetReader",this._overrides=null,this._joined=[],this._objectIdToIndex=null,this._boundsBuffer=[],this._caches=new Map,this.arcadeDeclaredClass="esri.arcade.Feature",this._contextTimeZone=null}destroy(){}[Symbol.dispose](){this.destroy()}getAreaSimplificationThreshold(e,t){let r=1;const s=S?A:1;t>4e6?r=F*s:t>1e6?r=T*s:t>5e5?r=D*s:t>1e5&&(r=s);let i=0;return e>4e3?i=b*r:e>2e3?i=_*r:e>100?i=g:e>15&&(i=p),i}getBounds(e){if(B(this._boundsBuffer,4*this.getIndex()+4,0),this.getBoundsXMin()===I)return!1;if(0===this.getBoundsXMin()){const t=this.readGeometryWorldSpace();if(!t)return this.setBoundsXMin(I),!1;let r=1/0,s=1/0,a=-1/0,o=-1/0;return t.forEachVertex(((e,t)=>{r=Math.min(r,e),s=Math.min(s,t),a=Math.max(a,e),o=Math.max(o,t)})),this.setBoundsXMin(r),this.setBoundsYMin(s),this.setBoundsXMax(a),this.setBoundsYMax(o),i(e,r,s,a,o),!0}const t=this.getBoundsXMin(),r=this.getBoundsYMin(),s=this.getBoundsXMax(),a=this.getBoundsYMax();return i(e,t,r,s,a),!0}getBoundsXMin(){return this._boundsBuffer[4*this.getIndex()]}setBoundsXMin(e){this._boundsBuffer[4*this.getIndex()]=e}getBoundsYMin(){return this._boundsBuffer[4*this.getIndex()+1]}setBoundsYMin(e){this._boundsBuffer[4*this.getIndex()+1]=e}getBoundsXMax(){return this._boundsBuffer[4*this.getIndex()+2]}setBoundsXMax(e){this._boundsBuffer[4*this.getIndex()+2]=e}getBoundsYMax(){return this._boundsBuffer[4*this.getIndex()+3]}setBoundsYMax(e){this._boundsBuffer[4*this.getIndex()+3]=e}readAttributeAsTimestamp(e){const t=this.readAttribute(e);return"string"==typeof t?new Date(t).getTime():"number"==typeof t||null==t?t:null}readAttribute(e,t=!1){const r=this._readAttribute(e,t);if(void 0!==r)return r;for(const s of this._joined){s.setIndex(this.getIndex());const r=s._readAttribute(e,t);if(void 0!==r)return r}}readAttributes(){const e=this._readAttributes();for(const t of this._joined){t.setIndex(this.getIndex());const r=t._readAttributes();for(const t of Object.keys(r))e[t]=r[t]}return e}joinAttributes(e){this._joined.push(e)}registerOverrides(e){this._overrides=e}withoutOverrides(){const e=this.copy();return e._overrides=null,e}readOptimizedFeatureWorldSpace(){const e=this.readGeometryWorldSpace(),t=this.readAttributes(),r=this.readCentroidWorldSpace();return new h(e,t,r,this.getObjectId(),this.getDisplayId())}readLegacyFeatureForDisplay(){const e=this.readCentroidForDisplay();return{attributes:this.readAttributes(),geometry:this.readLegacyGeometryForDisplay(),centroid:(e&&{x:e.coords[0],y:e.coords[1]})??null}}readLegacyFeatureWorldSpace(){const e=this.readCentroidWorldSpace();return{attributes:this.readAttributes(),geometry:this._readLegacyGeometryWorldSpace(),centroid:(e&&{x:e.coords[0],y:e.coords[1]})??null}}readLegacyGeometryForDisplay(){const e=this.readGeometryForDisplay();return d(e,this.geometryType,!1,!1)}readXForDisplay(){return this._readX()}readYForDisplay(){return this._readY()}readXWorldSpace(){const e=this._readX(),t=this.getInTransform();return null==t?e:e*t.scale[0]+t.translate[0]}readYWorldSpace(){const e=this._readY(),t=this.getInTransform();return null==t?e:t.translate[1]-e*t.scale[1]}readGeometryForDisplay(){const e=this._readGeometryDeltaDecoded(!0);if(!e){const e=this._createDeltaQuantizedGeometryFromServerCentroid();return e?e.deltaDecode():null}return e}readGeometryForDisplayTransformed(e){return this.readGeometryForDisplay()?.quantize(e)??null}readGeometryWorldSpace(){let e=this._readGeometry();if(e||(e=this._createDeltaQuantizedGeometryFromServerCentroid()),!e)return null;const t=e.clone(),r=this.getInTransform();return null!=r&&u(t,t,this.hasZ,this.hasM,r),t}readCentroidForDisplay(){const e=this.readGeometryForDisplay();return e?this._computeDisplayCentroid(e):this._readServerCentroid()}readCentroidWorldSpace(){const e=this.readGeometryForDisplay(),t=e?this._computeDisplayCentroid(e):this._readServerCentroid();if(!t)return null;const r=t.clone(),s=this.getInTransform();return null!=s&&u(r,r,this.hasZ,this.hasM,s),r}setCache(e){let t=this._caches.get(e);null==t&&(t=new y(this.getSize()),this._caches.set(e,t)),this._activeCache=t}setCachedValue(e){this._activeCache.set(this.getIndex(),e)}hasCachedValue(){return this._activeCache.has(this.getIndex())}getCachedValue(){return this._activeCache.get(this.getIndex())}_readGeometryDeltaDecoded(e){const t=this._readGeometry(e);return"esriGeometryPoint"!==this.geometryType&&t&&this.getInTransform()?t.deltaDecode():t}get contextTimeZone(){return this._contextTimeZone}set contextTimeZone(e){this._contextTimeZone=e}readArcadeFeature(){return this}hasField(e){return this.fields.has(e)||this._joined.some((t=>t.hasField(e)))}geometry(){const e=this.readGeometryWorldSpace(),t=d(e,this.geometryType,this.hasZ,this.hasM),r=a(t);if(r){if(!this.metadata.outSpatialReference)throw new Error("InternalError: Expected spatial reference to be defined");r.spatialReference=this.metadata.outSpatialReference}return r}autocastArcadeDate(t,r){return r&&r instanceof Date?this.isUnknownDateTimeField(t)?e.unknownDateJSToArcadeDate(r):e.dateJSAndZoneToArcadeDate(r,this.contextTimeZone??l):r}isUnknownDateTimeField(e){return this.metadata.fieldsIndex.getTimeZone(e)===m}field(s){let i=this.fields.get(s);if(i)switch(i.type){case"date-only":case"esriFieldTypeDateOnly":return t.fromReader(this.readAttribute(s,!1));case"time-only":case"esriFieldTypeTimeOnly":return r.fromReader(this.readAttribute(s,!1));case"esriFieldTypeTimestampOffset":case"timestamp-offset":return e.fromReaderAsTimeStampOffset(this.readAttribute(s,!1));case"date":case"esriFieldTypeDate":return this.autocastArcadeDate(s,this.readAttribute(s,!0));default:return this.readAttribute(s,!1)}for(const a of this._joined)if(a.setIndex(this.getIndex()),i=a.fields.get(s),i)switch(i.type){case"date-only":case"esriFieldTypeDateOnly":return t.fromReader(a._readAttribute(s,!1));case"time-only":case"esriFieldTypeTimeOnly":return r.fromReader(a._readAttribute(s,!1));case"esriFieldTypeTimestampOffset":case"timestamp-offset":return e.fromReaderAsTimeStampOffset(a._readAttribute(s,!1));case"date":case"esriFieldTypeDate":return this.autocastArcadeDate(s,a._readAttribute(s,!0));default:return this.readAttribute(s,!1)}throw new Error(`Field ${s} does not exist`)}setField(e,t){throw new Error("Unable to update feature attribute values, feature is readonly")}keys(){return this.fields.fields.map((e=>e.name))}castToText(e=!1){if(!e)return JSON.stringify(this.readLegacyFeatureForDisplay());const t=this.readLegacyFeatureForDisplay();if(!t)return JSON.stringify(null);const r={geometry:t.geometry,attributes:{...t.attributes??{}}};for(const s in r.attributes){const e=r.attributes[s];e instanceof Date&&(r.attributes[s]=e.getTime())}return JSON.stringify(r)}gdbVersion(){return null}fullSchema(){return this.metadata.arcadeSchema}castAsJson(e=null){return{attributes:this._readAttributes(),geometry:!0===e?.keepGeometryType?this.geometry():this.geometry()?.toJSON()??null}}castAsJsonAsync(e=null,t=null){return Promise.resolve(this.castAsJson(t))}_getExists(){if(this._overrides){const e=this.getObjectId();return!this._overrides.hasOverride(e)}return!0}_computeDisplayCentroid(e){if(null==this.getInTransform())return n(new c,e,this.hasM,this.hasZ);const t=s.fromOptimized(e,this.geometryType);t.yFactor*=-1;const r=o(t);return r?(r[1]*=-1,new c([],r)):null}copyInto(e){e._joined=this._joined,e._overrides=this._overrides,e._objectIdToIndex=this._objectIdToIndex,e._boundsBuffer=this._boundsBuffer,e._activeCache=this._activeCache,e._caches=this._caches,e._contextTimeZone=this._contextTimeZone}_readLegacyGeometryWorldSpace(){const e=this.readGeometryWorldSpace();return d(e,this.geometryType,!1,!1)}_createDeltaQuantizedGeometryFromServerCentroid(){const e=this._readServerCentroid();if(!e)return null;const[t,r]=e.coords;return this._createDeltaQuantizedExtrudedGeometry(t,r)}_createDeltaQuantizedExtrudedGeometry(e,t){return"esriGeometryPolyline"===this.geometryType?this._createDeltaQuantizedExtrudedLine(e,t):this._createDeltaQuantizedExtrudedQuad(e,t)}_createDeltaQuantizedExtrudedQuad(e,t){return new c([5],[e-1,t,1,-1,1,1,-1,1,-1,-1])}_createDeltaQuantizedExtrudedLine(e,t){return new c([2],[e-1,t+1,1,-1])}}export{j as FeatureSetReader};
5
+ import{ArcadeDate as e}from"../../../../../arcade/ArcadeDate.js";import has from"../../../../../core/has.js";import{DateOnly as t}from"../../../../../core/sql/DateOnly.js";import{TimeOnly as r}from"../../../../../core/sql/TimeOnly.js";import{GeometryCursor as s}from"../../../../../geometry/GeometryCursor.js";import{fromRectValues as i}from"../../../../../geometry/support/aaBoundingBox.js";import{fromJSON as a}from"../../../../../geometry/support/jsonUtils.js";import{getLabelPoint as o}from"../../../../../geometry/support/labelPoint.js";import{quantizeX as n,quantizeY as d}from"../../../../../geometry/support/quantizationUtils.js";import{getCentroidOptimizedGeometry as u}from"../../../../../layers/graphics/centroid.js";import{convertToGeometry as h,quantizeForDisplay as c,unquantizeOptimizedGeometry as l}from"../../../../../layers/graphics/featureConversionUtils.js";import{OptimizedFeature as m}from"../../../../../layers/graphics/OptimizedFeature.js";import y from"../../../../../layers/graphics/OptimizedGeometry.js";import{system as f,unknown as p}from"../../../../../time/timeZoneUtils.js";import{FeatureSetCache as g}from"./FeatureSetCache.js";const _=has("featurelayer-simplify-thresholds")??[.5,.5,.5,.5],b=_[0],x=_[1],D=_[2],T=_[3],F=has("featurelayer-simplify-payload-size-factors")??[1,2,4],A=F[0],S=F[1],I=F[2],B=has("featurelayer-simplify-mobile-factor")??2,j=has("esri-mobile"),G=4294967295;function C(e,t,r){if(!(e.length>t))for(;e.length<=t;)e.push(r)}class M{constructor(e){this.metadata=e,this.type="FeatureSetReader",this._overrides=null,this._joined=[],this._objectIdToIndex=null,this._boundsBuffer=[],this._caches=new Map,this.arcadeDeclaredClass="esri.arcade.Feature",this._contextTimeZone=null}destroy(){}[Symbol.dispose](){this.destroy()}getAreaSimplificationThreshold(e,t){let r=1;const s=j?B:1;t>4e6?r=I*s:t>1e6?r=S*s:t>5e5?r=A*s:t>1e5&&(r=s);let i=0;return e>4e3?i=T*r:e>2e3?i=D*r:e>100?i=x:e>15&&(i=b),i}getBounds(e){if(C(this._boundsBuffer,4*this.getIndex()+4,0),this.getBoundsXMin()===G)return!1;if(0===this.getBoundsXMin()){const t=this.readGeometryWorldSpace();if(!t)return this.setBoundsXMin(G),!1;let r=1/0,s=1/0,a=-1/0,o=-1/0;return t.forEachVertex(((e,t)=>{r=Math.min(r,e),s=Math.min(s,t),a=Math.max(a,e),o=Math.max(o,t)})),this.setBoundsXMin(r),this.setBoundsYMin(s),this.setBoundsXMax(a),this.setBoundsYMax(o),i(e,r,s,a,o),!0}const t=this.getBoundsXMin(),r=this.getBoundsYMin(),s=this.getBoundsXMax(),a=this.getBoundsYMax();return i(e,t,r,s,a),!0}getBoundsXMin(){return this._boundsBuffer[4*this.getIndex()]}setBoundsXMin(e){this._boundsBuffer[4*this.getIndex()]=e}getBoundsYMin(){return this._boundsBuffer[4*this.getIndex()+1]}setBoundsYMin(e){this._boundsBuffer[4*this.getIndex()+1]=e}getBoundsXMax(){return this._boundsBuffer[4*this.getIndex()+2]}setBoundsXMax(e){this._boundsBuffer[4*this.getIndex()+2]=e}getBoundsYMax(){return this._boundsBuffer[4*this.getIndex()+3]}setBoundsYMax(e){this._boundsBuffer[4*this.getIndex()+3]=e}readAttributeAsTimestamp(e){const t=this.readAttribute(e);return"string"==typeof t?new Date(t).getTime():"number"==typeof t||null==t?t:null}readAttribute(e,t=!1){const r=this._readAttribute(e,t);if(void 0!==r)return r;for(const s of this._joined){s.setIndex(this.getIndex());const r=s._readAttribute(e,t);if(void 0!==r)return r}}readAttributes(){const e=this._readAttributes();for(const t of this._joined){t.setIndex(this.getIndex());const r=t._readAttributes();for(const t of Object.keys(r))e[t]=r[t]}return e}joinAttributes(e){this._joined.push(e)}registerOverrides(e){this._overrides=e}withoutOverrides(){const e=this.copy();return e._overrides=null,e}readOptimizedFeatureWorldSpace(){const e=this.readGeometryWorldSpace(),t=this.readAttributes(),r=this.readCentroidWorldSpace();return new m(e,t,r,this.getObjectId(),this.getDisplayId())}readLegacyFeatureForDisplay(){const e=this.readCentroidForDisplay();return{attributes:this.readAttributes(),geometry:this.readLegacyGeometryForDisplay(),centroid:(e&&{x:e.coords[0],y:e.coords[1]})??null}}readLegacyFeatureWorldSpace(){const e=this.readCentroidWorldSpace();return{attributes:this.readAttributes(),geometry:this._readLegacyGeometryWorldSpace(),centroid:(e&&{x:e.coords[0],y:e.coords[1]})??null}}readLegacyGeometryForDisplay(){const e=this.readGeometryForDisplay();return h(e,this.geometryType,!1,!1)}readXForDisplay(){return this._readX()}readYForDisplay(){return this._readY()}readXWorldSpace(){const e=this._readX(),t=this.getInTransform();return null==t?e:e*t.scale[0]+t.translate[0]}readYWorldSpace(){const e=this._readY(),t=this.getInTransform();return null==t?e:t.translate[1]-e*t.scale[1]}readGeometryForDisplay(){const e=this._readGeometryDeltaDecoded(!0);if(!e){const e=this._createDeltaQuantizedGeometryFromServerCentroid();return e?e.deltaDecode():null}return e}readGeometryForDisplayTransformed(e){let t=this.readGeometryForDisplay();if(t&&(t=c(t,e,this.metadata.geometryType,this.hasZ,this.hasM)),!t){const t=this.readCentroidForDisplay();if(!t)return null;const r=n(e,t.coords[0]),s=d(e,t.coords[1]);return this._createDeltaQuantizedExtrudedGeometry(r,s).deltaDecode()}return t}readGeometryWorldSpace(){let e=this._readGeometry();if(e||(e=this._createDeltaQuantizedGeometryFromServerCentroid()),!e)return null;const t=e.clone(),r=this.getInTransform();return null!=r&&l(t,t,this.hasZ,this.hasM,r),t}readCentroidForDisplay(){const e=this.readGeometryForDisplay();return e?this._computeDisplayCentroid(e):this._readServerCentroid()}readCentroidWorldSpace(){const e=this.readGeometryForDisplay(),t=e?this._computeDisplayCentroid(e):this._readServerCentroid();if(!t)return null;const r=t.clone(),s=this.getInTransform();return null!=s&&l(r,r,this.hasZ,this.hasM,s),r}setCache(e){let t=this._caches.get(e);null==t&&(t=new g(this.getSize()),this._caches.set(e,t)),this._activeCache=t}setCachedValue(e){this._activeCache.set(this.getIndex(),e)}hasCachedValue(){return this._activeCache.has(this.getIndex())}getCachedValue(){return this._activeCache.get(this.getIndex())}_readGeometryDeltaDecoded(e){const t=this._readGeometry(e);return"esriGeometryPoint"!==this.geometryType&&t&&this.getInTransform()?t.deltaDecode():t}get contextTimeZone(){return this._contextTimeZone}set contextTimeZone(e){this._contextTimeZone=e}readArcadeFeature(){return this}hasField(e){return this.fields.has(e)||this._joined.some((t=>t.hasField(e)))}geometry(){const e=this.readGeometryWorldSpace(),t=h(e,this.geometryType,this.hasZ,this.hasM),r=a(t);if(r){if(!this.metadata.outSpatialReference)throw new Error("InternalError: Expected spatial reference to be defined");r.spatialReference=this.metadata.outSpatialReference}return r}autocastArcadeDate(t,r){return r&&r instanceof Date?this.isUnknownDateTimeField(t)?e.unknownDateJSToArcadeDate(r):e.dateJSAndZoneToArcadeDate(r,this.contextTimeZone??f):r}isUnknownDateTimeField(e){return this.metadata.fieldsIndex.getTimeZone(e)===p}field(s){let i=this.fields.get(s);if(i)switch(i.type){case"date-only":case"esriFieldTypeDateOnly":return t.fromReader(this.readAttribute(s,!1));case"time-only":case"esriFieldTypeTimeOnly":return r.fromReader(this.readAttribute(s,!1));case"esriFieldTypeTimestampOffset":case"timestamp-offset":return e.fromReaderAsTimeStampOffset(this.readAttribute(s,!1));case"date":case"esriFieldTypeDate":return this.autocastArcadeDate(s,this.readAttribute(s,!0));default:return this.readAttribute(s,!1)}for(const a of this._joined)if(a.setIndex(this.getIndex()),i=a.fields.get(s),i)switch(i.type){case"date-only":case"esriFieldTypeDateOnly":return t.fromReader(a._readAttribute(s,!1));case"time-only":case"esriFieldTypeTimeOnly":return r.fromReader(a._readAttribute(s,!1));case"esriFieldTypeTimestampOffset":case"timestamp-offset":return e.fromReaderAsTimeStampOffset(a._readAttribute(s,!1));case"date":case"esriFieldTypeDate":return this.autocastArcadeDate(s,a._readAttribute(s,!0));default:return this.readAttribute(s,!1)}throw new Error(`Field ${s} does not exist`)}setField(e,t){throw new Error("Unable to update feature attribute values, feature is readonly")}keys(){return this.fields.fields.map((e=>e.name))}castToText(e=!1){if(!e)return JSON.stringify(this.readLegacyFeatureForDisplay());const t=this.readLegacyFeatureForDisplay();if(!t)return JSON.stringify(null);const r={geometry:t.geometry,attributes:{...t.attributes??{}}};for(const s in r.attributes){const e=r.attributes[s];e instanceof Date&&(r.attributes[s]=e.getTime())}return JSON.stringify(r)}gdbVersion(){return null}fullSchema(){return this.metadata.arcadeSchema}castAsJson(e=null){return{attributes:this._readAttributes(),geometry:!0===e?.keepGeometryType?this.geometry():this.geometry()?.toJSON()??null}}castAsJsonAsync(e=null,t=null){return Promise.resolve(this.castAsJson(t))}_getExists(){if(this._overrides){const e=this.getObjectId();return!this._overrides.hasOverride(e)}return!0}_computeDisplayCentroid(e){if(null==this.getInTransform())return u(new y,e,this.hasM,this.hasZ);const t=s.fromOptimized(e,this.geometryType);t.yFactor*=-1;const r=o(t);return r?(r[1]*=-1,new y([],r)):null}copyInto(e){e._joined=this._joined,e._overrides=this._overrides,e._objectIdToIndex=this._objectIdToIndex,e._boundsBuffer=this._boundsBuffer,e._activeCache=this._activeCache,e._caches=this._caches,e._contextTimeZone=this._contextTimeZone}_readLegacyGeometryWorldSpace(){const e=this.readGeometryWorldSpace();return h(e,this.geometryType,!1,!1)}_createDeltaQuantizedGeometryFromServerCentroid(){const e=this._readServerCentroid();if(!e)return null;const[t,r]=e.coords;return this._createDeltaQuantizedExtrudedGeometry(t,r)}_createDeltaQuantizedExtrudedGeometry(e,t){return"esriGeometryPolyline"===this.geometryType?this._createDeltaQuantizedExtrudedLine(e,t):this._createDeltaQuantizedExtrudedQuad(e,t)}_createDeltaQuantizedExtrudedQuad(e,t){return new y([5],[e-1,t,1,-1,1,1,-1,1,-1,-1])}_createDeltaQuantizedExtrudedLine(e,t){return new y([2],[e-1,t+1,1,-1])}}export{M as FeatureSetReader};
@@ -2,4 +2,4 @@
2
2
  All material copyright ESRI, All Rights Reserved, unless otherwise specified.
3
3
  See https://js.arcgis.com/4.33/esri/copyright.txt for details.
4
4
  */
5
- import e from"../../../../../core/Error.js";import"../../../../../core/has.js";import t from"../../../../../core/Logger.js";import{assertIsSome as r}from"../../../../../core/maybe.js";import{baseObjectMemory as s}from"../../../../../core/memoryEstimations.js";import n from"../../../../../core/pbf.js";import a from"../../../../../layers/graphics/OptimizedGeometry.js";import{FeatureSetCache as i}from"./FeatureSetCache.js";import{FeatureSetReader as h}from"./FeatureSetReader.js";import{parseHeader as o}from"./FeatureSetReaderPBFHeader.js";const u=!0,d=268435455,c=128,g=128e3,f={small:{delta:new Int32Array(c),decoded:new Int32Array(c)},large:{delta:new Int32Array(g),decoded:new Int32Array(g)}};function _(e){return e<=f.small.delta.length?f.small:(e<=f.large.delta.length||(f.large.delta=new Int32Array(Math.round(1.25*e)),f.large.decoded=new Int32Array(Math.round(1.25*e))),f.large)}function l(r){try{const e=2,t=new n(new Uint8Array(r),new DataView(r));for(;t.next();){if(t.tag()===e)return I(t.getMessage());t.skip()}}catch(s){const r=new e("query:parsing-pbf","Error while parsing FeatureSet PBF payload",{error:s});t.getLogger("esri.view.2d.layers.features.support.FeatureSetReaderPBF").error(r)}return null}function I(e){const t=1;for(;e.next();){if(e.tag()===t)return e.getMessage();e.skip()}return null}function m(e){const t=1,r=2,s=3,n=4,a=5,i=6,h=7,o=8,u=9,d=e.getLength(),c=e.pos()+d;for(;e.pos()<c&&e.next();)switch(e.tag()){case t:return e.getString();case r:return e.getFloat();case s:return e.getDouble();case n:return e.getSInt32();case a:return e.getUInt32();case i:return e.getInt64();case h:return e.getUInt64();case o:return e.getSInt64();case u:return e.getBool();default:return e.skip(),null}return null}function y(e,t,r,s,n,a){return.5*Math.abs(e*s+r*a+n*t-e*a-r*t-n*s)}function p(e,t,r,s,n){if(!e)return!1;return 0===t*n-s*r&&t*s+r*n>0}class x extends h{static fromBuffer(e,t,r=!1){const s=t.geometryType,n=l(e),a=o(n,"esriGeometryPoint"===s,r);return new x(n,a,t)}constructor(e,t,r){super(r),this._hasNext=!1,this._isPoints=!1,this._featureIndex=-1,this._featureOffset=0,this._cache={area:0,unquantGeometry:void 0,geometry:void 0},this._parseCaches=new Array,this._geometryType=r.geometryType,this._reader=e,this._header=t,this._hasNext=t.hasFeatures,this._isPoints="esriGeometryPoint"===r.geometryType}get _size(){return this._header.featureCount}get fields(){return this._header.fields}get geometryType(){return this._geometryType}get hasZ(){return!1}get hasM(){return!1}get hasFeatures(){return this._header.hasFeatures}get hasNext(){return this._hasNext}get exceededTransferLimit(){return this._header.exceededTransferLimit}getSize(){return this._size}getInTransform(){return this._header.transform}getCursor(){return this.copy()}getIndex(){return this._featureIndex}setIndex(e){this._cache.area=0,this._cache.unquantGeometry=void 0,this._cache.geometry=void 0,this._featureIndex=e}getAttributeHash(){let e="";for(const t of this._header.fields.fields)e+=this._readAttributeAtIndex(t.index)+".";return e}getObjectId(){return this._readAttributeAtIndex(this._header.objectIdFieldIndex)}getDisplayId(){return this._header.displayIds[this._featureIndex]}setDisplayId(e){this._header.displayIds[this._featureIndex]=e}readGeometryArea(){return this._cache.area||this._readGeometry(!0),this._cache.area}copy(){const e=this._reader.clone(),t=new x(e,this._header,this.metadata);return this.copyInto(t),t}next(){for(this._cache.area=0,this._cache.unquantGeometry=void 0,this._cache.geometry=void 0;++this._featureIndex<this._size&&!this._getExists(););return this._featureIndex<this._size}get usedMemory(){return s+(this._cache.geometry?.usedMemory??0)}_readX(){return this._header.centroid[2*this._featureIndex]}_readY(){return this._header.centroid[2*this._featureIndex+1]}_readServerCentroid(){const e=this._header.centroid[2*this._featureIndex],t=this._header.centroid[2*this._featureIndex+1];return e===d?null:new a([],[e,t])}_readGeometry(e=!1){if(void 0===this._cache.geometry){let r=null;if(this._isPoints){if(this._header.centroid[2*this._featureIndex]===d)return null;const e=this._header.centroid[2*this._featureIndex],t=this._header.centroid[2*this._featureIndex+1];r=new a([],[e,t])}else{const s=this._header.offsets.geometry[this._featureIndex],n=this._reader;if(0===s)return null;n.move(s);try{r=e?this._parseGeometryForDisplay(n):this._parseGeometry(n)}catch(t){return null}}return 0===r?.coords.length&&(r=null),this._cache.geometry=r,r}return this._cache.geometry}_readAttribute(e,t){const r=this._header.fields.get(e);if(null==r)return;const s=this._readAttributeAtIndex(r.index),n=this._header.fields.isDateField(r.name);return t?null==s?s:n?new Date(s):s:s}_readAttributes(){const e={};for(const t of this._header.fields.fields)e[t.name]=this._readAttributeAtIndex(t.index);return e}copyInto(e){super.copyInto(e),e._featureIndex=this._featureIndex,e._featureOffset=this._featureOffset,e._hasNext=this._hasNext,e._parseCaches=this._parseCaches}_readAttributeAtIndex(e){let t=this._parseCaches[e];if(t||(t=new i(this.getSize()),this._parseCaches[e]=t),t.has(this._featureIndex))return t.get(this._featureIndex);const r=this._header.offsets.attributes[this._featureIndex*this._header.fieldCount+e],s=this._reader;s.move(r);const n=m(s);return t.set(this._featureIndex,n),n}_readGeometryDeltaDecoded(e=!1){if(void 0===this._cache.unquantGeometry){const t=this._readGeometry(e);if(!t)return this._cache.unquantGeometry=void 0,null;if(!this.getInTransform())return this._cache.unquantGeometry=t,t;const r=_(t.coords.length).decoded,s=t.clone(r),n=s.coords;let a=0;for(const e of s.lengths){for(let t=1;t<e;t++){const e=2*(a+t),r=2*(a+t-1);n[e]+=n[r],n[e+1]+=n[r+1]}a+=e}return this._cache.unquantGeometry=s,s}return this._cache.unquantGeometry}_parseGeometry(e){const t=2,r=3,s=e.asUnsafe(),n=s.getLength(),i=s.pos()+n,h=[],o=[];for(;s.pos()<i&&s.next();)switch(s.tag()){case t:{const e=s.getUInt32(),t=s.pos()+e;for(;s.pos()<t;)o.push(s.getUInt32());break}case r:{const e=s.getUInt32(),t=s.pos()+e;for(h.push(s.getSInt64()),h.push(s.getSInt64()),this.hasZ&&s.getSInt64(),this.hasM&&s.getSInt64();s.pos()<t;)h.push(s.getSInt64()),h.push(s.getSInt64()),this.hasZ&&s.getSInt64(),this.hasM&&s.getSInt64();break}default:s.skip()}return new a(o,h)}_parseGeometryForDisplay(e){const t=2,s=3,n=e.asUnsafe(),i=n.getLength(),h=n.pos()+i,o=[],d=[];let c=0,g=0,f=null,l=0;const I="esriGeometryPolygon"===this.geometryType,m="esriGeometryPolyline"===this.geometryType,x=I||m;for(;n.pos()<h&&n.next();)switch(n.tag()){case t:{const e=n.getUInt32(),t=n.pos()+e;for(;n.pos()<t;){const e=n.getUInt32();o.push(e),c+=e}f=_(2*c).delta;break}case s:{n.getUInt32();const e=2+(this.hasZ?1:0)+(this.hasM?1:0);r(f);for(const t of o)if(g+e*t>f.length)for(let e=0;e<t;e++)n.getSInt32(),n.getSInt32(),this.hasZ&&n.getSInt32(),this.hasM&&n.getSInt32();else if(I&&u){const e=this.getAreaSimplificationThreshold(t,this._header.vertexCount);let r=2,s=1;const a=!1;let i=n.getSInt32(),h=n.getSInt32();f[g++]=i,f[g++]=h,this.hasZ&&n.getSInt32(),this.hasM&&n.getSInt32();let o=n.getSInt32(),u=n.getSInt32();for(this.hasZ&&n.getSInt32(),this.hasM&&n.getSInt32();r<t;){let t=n.getSInt32(),a=n.getSInt32();this.hasZ&&n.getSInt32(),this.hasM&&n.getSInt32();const d=i+o,c=h+u;y(i,h,d,c,d+t,c+a)>=e?(l+=-.5*(d-i)*(c+h),s>1&&p(x,f[g-2],f[g-1],o,u)?(f[g-2]+=o,f[g-1]+=u):(f[g++]=o,f[g++]=u,s++),i=d,h=c):(t+=o,a+=u),o=t,u=a,r++}s<3||a?g-=2*s:(l+=-.5*(i+o-i)*(h+u+h),p(x,f[g-2],f[g-1],o,u)?(f[g-2]+=o,f[g-1]+=u,d.push(s)):(f[g++]=o,f[g++]=u,d.push(++s)))}else{let e=0,r=n.getSInt32(),s=n.getSInt32();this.hasZ&&n.getSInt32(),this.hasM&&n.getSInt32(),f[g++]=r,f[g++]=s,e+=1;for(let a=1;a<t;a++){const t=n.getSInt32(),i=n.getSInt32(),h=r+t,o=s+i;l+=-.5*(h-r)*(o+s),this.hasZ&&n.getSInt32(),this.hasM&&n.getSInt32(),a>2&&p(x,f[g-2],f[g-1],t,i)?(f[g-2]+=t,f[g-1]+=i):(f[g++]=t,f[g++]=i,e+=1),r=h,s=o}d.push(e)}break}default:n.skip()}return this._cache.area=l,d.length?new a(d,f):null!=f?this._createDeltaQuantizedExtrudedGeometry(f[0],f[1]):null}}export{x as FeatureSetReaderPBF};
5
+ import e from"../../../../../core/Error.js";import"../../../../../core/has.js";import t from"../../../../../core/Logger.js";import{assertIsSome as r}from"../../../../../core/maybe.js";import{baseObjectMemory as s}from"../../../../../core/memoryEstimations.js";import n from"../../../../../core/pbf.js";import a from"../../../../../layers/graphics/OptimizedGeometry.js";import{FeatureSetCache as i}from"./FeatureSetCache.js";import{FeatureSetReader as h}from"./FeatureSetReader.js";import{parseHeader as o}from"./FeatureSetReaderPBFHeader.js";const d=!0,u=268435455,c=128,l=128e3,g={small:{delta:new Int32Array(c),decoded:new Int32Array(c)},small64:{delta:new Float64Array(0),decoded:new Float64Array(0)},large:{delta:new Int32Array(l),decoded:new Int32Array(l)},large64:{delta:new Float64Array(0),decoded:new Float64Array(0)}};function _(e,t){return t?e<=g.small64.delta.length?g.small64:(e<=g.large64.delta.length||(g.large64.delta=new Float64Array(Math.round(1.25*e)),g.large64.decoded=new Float64Array(Math.round(1.25*e))),g.large64):e<=g.small.delta.length?g.small:(e<=g.large.delta.length||(g.large.delta=new Int32Array(Math.round(1.25*e)),g.large.decoded=new Int32Array(Math.round(1.25*e))),g.large)}function f(r){try{const e=2,t=new n(new Uint8Array(r),new DataView(r));for(;t.next();){if(t.tag()===e)return I(t.getMessage());t.skip()}}catch(s){const r=new e("query:parsing-pbf","Error while parsing FeatureSet PBF payload",{error:s});t.getLogger("esri.view.2d.layers.features.support.FeatureSetReaderPBF").error(r)}return null}function I(e){const t=1;for(;e.next();){if(e.tag()===t)return e.getMessage();e.skip()}return null}function y(e){const t=1,r=2,s=3,n=4,a=5,i=6,h=7,o=8,d=9,u=e.getLength(),c=e.pos()+u;for(;e.pos()<c&&e.next();)switch(e.tag()){case t:return e.getString();case r:return e.getFloat();case s:return e.getDouble();case n:return e.getSInt32();case a:return e.getUInt32();case i:return e.getInt64();case h:return e.getUInt64();case o:return e.getSInt64();case d:return e.getBool();default:return e.skip(),null}return null}function m(e,t,r,s,n,a){return.5*Math.abs(e*s+r*a+n*t-e*a-r*t-n*s)}function p(e,t,r,s,n){if(!e)return!1;return 0===t*n-s*r&&t*s+r*n>0}class x extends h{static fromBuffer(e,t,r=!1){const s=t.geometryType,n=f(e),a=o(n,"esriGeometryPoint"===s,r);return new x(n,a,t,r)}constructor(e,t,r,s){super(r),this._use64Bit=s,this._hasNext=!1,this._isPoints=!1,this._featureIndex=-1,this._featureOffset=0,this._cache={area:0,unquantGeometry:void 0,geometry:void 0},this._parseCaches=new Array,this._geometryType=r.geometryType,this._reader=e,this._header=t,this._hasNext=t.hasFeatures,this._isPoints="esriGeometryPoint"===r.geometryType}get _size(){return this._header.featureCount}get fields(){return this._header.fields}get geometryType(){return this._geometryType}get hasZ(){return!1}get hasM(){return!1}get hasFeatures(){return this._header.hasFeatures}get hasNext(){return this._hasNext}get exceededTransferLimit(){return this._header.exceededTransferLimit}getSize(){return this._size}getInTransform(){return this._header.transform}getCursor(){return this.copy()}getIndex(){return this._featureIndex}setIndex(e){this._cache.area=0,this._cache.unquantGeometry=void 0,this._cache.geometry=void 0,this._featureIndex=e}getAttributeHash(){let e="";for(const t of this._header.fields.fields)e+=this._readAttributeAtIndex(t.index)+".";return e}getObjectId(){return this._readAttributeAtIndex(this._header.objectIdFieldIndex)}getDisplayId(){return this._header.displayIds[this._featureIndex]}setDisplayId(e){this._header.displayIds[this._featureIndex]=e}readGeometryArea(){return this._cache.area||this._readGeometry(!0),this._cache.area}copy(){const e=this._reader.clone(),t=new x(e,this._header,this.metadata,this._use64Bit);return this.copyInto(t),t}next(){for(this._cache.area=0,this._cache.unquantGeometry=void 0,this._cache.geometry=void 0;++this._featureIndex<this._size&&!this._getExists(););return this._featureIndex<this._size}get usedMemory(){return s+(this._cache.geometry?.usedMemory??0)}_readX(){return this._header.centroid[2*this._featureIndex]}_readY(){return this._header.centroid[2*this._featureIndex+1]}_readServerCentroid(){const e=this._header.centroid[2*this._featureIndex],t=this._header.centroid[2*this._featureIndex+1];return e===u?null:new a([],[e,t])}_readGeometry(e=!1){if(void 0===this._cache.geometry){let r=null;if(this._isPoints){if(this._header.centroid[2*this._featureIndex]===u)return null;const e=this._header.centroid[2*this._featureIndex],t=this._header.centroid[2*this._featureIndex+1];r=new a([],[e,t])}else{const s=this._header.offsets.geometry[this._featureIndex],n=this._reader;if(0===s)return null;n.move(s);try{r=e?this._parseGeometryForDisplay(n):this._parseGeometry(n)}catch(t){return null}}return 0===r?.coords.length&&(r=null),this._cache.geometry=r,r}return this._cache.geometry}_readAttribute(e,t){const r=this._header.fields.get(e);if(null==r)return;const s=this._readAttributeAtIndex(r.index),n=this._header.fields.isDateField(r.name);return t?null==s?s:n?new Date(s):s:s}_readAttributes(){const e={};for(const t of this._header.fields.fields)e[t.name]=this._readAttributeAtIndex(t.index);return e}copyInto(e){super.copyInto(e),e._featureIndex=this._featureIndex,e._featureOffset=this._featureOffset,e._hasNext=this._hasNext,e._parseCaches=this._parseCaches}_readAttributeAtIndex(e){let t=this._parseCaches[e];if(t||(t=new i(this.getSize()),this._parseCaches[e]=t),t.has(this._featureIndex))return t.get(this._featureIndex);const r=this._header.offsets.attributes[this._featureIndex*this._header.fieldCount+e],s=this._reader;s.move(r);const n=y(s);return t.set(this._featureIndex,n),n}_readGeometryDeltaDecoded(e=!1){if(void 0===this._cache.unquantGeometry){const t=this._readGeometry(e);if(!t)return this._cache.unquantGeometry=void 0,null;if(!this.getInTransform())return this._cache.unquantGeometry=t,t;const r=_(t.coords.length,this._use64Bit).decoded,s=t.clone(r),n=s.coords;let a=0;for(const e of s.lengths){for(let t=1;t<e;t++){const e=2*(a+t),r=2*(a+t-1);n[e]+=n[r],n[e+1]+=n[r+1]}a+=e}return this._cache.unquantGeometry=s,s}return this._cache.unquantGeometry}_parseGeometry(e){const t=2,r=3,s=e.asUnsafe(),n=s.getLength(),i=s.pos()+n,h=[],o=[];for(;s.pos()<i&&s.next();)switch(s.tag()){case t:{const e=s.getUInt32(),t=s.pos()+e;for(;s.pos()<t;)o.push(s.getUInt32());break}case r:{const e=s.getUInt32(),t=s.pos()+e;for(h.push(s.getSInt64()),h.push(s.getSInt64()),this.hasZ&&s.getSInt64(),this.hasM&&s.getSInt64();s.pos()<t;)h.push(s.getSInt64()),h.push(s.getSInt64()),this.hasZ&&s.getSInt64(),this.hasM&&s.getSInt64();break}default:s.skip()}return new a(o,h)}_parseGeometryForDisplay(e){const t=2,s=3,n=e.asUnsafe(),i=n.getLength(),h=n.pos()+i,o=[],u=[];let c=0,l=0,g=null,f=0;const I="esriGeometryPolygon"===this.geometryType,y="esriGeometryPolyline"===this.geometryType,x=I||y;for(;n.pos()<h&&n.next();)switch(n.tag()){case t:{const e=n.getUInt32(),t=n.pos()+e;for(;n.pos()<t;){const e=n.getUInt32();o.push(e),c+=e}g=_(2*c,this._use64Bit).delta;break}case s:{n.getUInt32();const e=2+(this.hasZ?1:0)+(this.hasM?1:0);r(g);for(const t of o)if(l+e*t>g.length)for(let e=0;e<t;e++)n.getSInt64(),n.getSInt64(),this.hasZ&&n.getSInt64(),this.hasM&&n.getSInt64();else if(I&&d){const e=this.getAreaSimplificationThreshold(t,this._header.vertexCount);let r=2,s=1;const a=!1;let i=n.getSInt64(),h=n.getSInt64();g[l++]=i,g[l++]=h,this.hasZ&&n.getSInt64(),this.hasM&&n.getSInt64();let o=n.getSInt64(),d=n.getSInt64();for(this.hasZ&&n.getSInt64(),this.hasM&&n.getSInt64();r<t;){let t=n.getSInt64(),a=n.getSInt64();this.hasZ&&n.getSInt64(),this.hasM&&n.getSInt64();const u=i+o,c=h+d;m(i,h,u,c,u+t,c+a)>=e?(f+=-.5*(u-i)*(c+h),s>1&&p(x,g[l-2],g[l-1],o,d)?(g[l-2]+=o,g[l-1]+=d):(g[l++]=o,g[l++]=d,s++),i=u,h=c):(t+=o,a+=d),o=t,d=a,r++}s<3||a?l-=2*s:(f+=-.5*(i+o-i)*(h+d+h),p(x,g[l-2],g[l-1],o,d)?(g[l-2]+=o,g[l-1]+=d,u.push(s)):(g[l++]=o,g[l++]=d,u.push(++s)))}else{let e=0,r=n.getSInt64(),s=n.getSInt64();this.hasZ&&n.getSInt64(),this.hasM&&n.getSInt64(),g[l++]=r,g[l++]=s,e+=1;for(let a=1;a<t;a++){const t=n.getSInt64(),i=n.getSInt64(),h=r+t,o=s+i;f+=-.5*(h-r)*(o+s),this.hasZ&&n.getSInt64(),this.hasM&&n.getSInt64(),a>2&&p(x,g[l-2],g[l-1],t,i)?(g[l-2]+=t,g[l-1]+=i):(g[l++]=t,g[l++]=i,e+=1),r=h,s=o}u.push(e)}break}default:n.skip()}return this._cache.area=f,u.length?new a(u,g):null!=g?this._createDeltaQuantizedExtrudedGeometry(g[0],g[1]):null}}export{x as FeatureSetReaderPBF};
@@ -2,4 +2,4 @@
2
2
  All material copyright ESRI, All Rights Reserved, unless otherwise specified.
3
3
  See https://js.arcgis.com/4.33/esri/copyright.txt for details.
4
4
  */
5
- import t from"../../Viewpoint.js";import e from"../../core/Collection.js";import{deg2rad as r}from"../../core/mathUtils.js";import{getMetersPerUnitForSR as n}from"../../core/unitUtils.js";import{toRadian as o}from"../../core/libs/gl-matrix-2/math/common.js";import{fromScaling as a,rotate as i,translate as c,fromTranslation as s,scale as u,fromRotation as l,invert as f}from"../../core/libs/gl-matrix-2/math/mat2d.js";import{create as m}from"../../core/libs/gl-matrix-2/factories/mat2df64.js";import{scale as y,set as p,sub as g,negate as x,subtract as h,normalize as b,cross as w,dot as d,length as j,add as G,transformMat2d as R,copy as A}from"../../core/libs/gl-matrix-2/math/vec2.js";import{fromValues as S,create as k}from"../../core/libs/gl-matrix-2/factories/vec2f64.js";import M from"../../geometry/Extent.js";import v from"../../geometry/Geometry.js";import z from"../../geometry/Point.js";import{isLoaded as C,canProjectWithoutEngine as F,load as N,project as I}from"../../geometry/projection.js";import V from"../../geometry/SpatialReference.js";import{getClosestDenormalizedXToReference as q,getDenormalizedExtent as L}from"../../geometry/support/normalizeUtils.js";import{equals as P,isValid as U,getInfo as E}from"../../geometry/support/spatialReferenceUtils.js";const O=96,Q=39.37,T=180/Math.PI;function B(t){return t.wkid?t:t.spatialReference||V.WGS84}function D(t,e){return e.type?p(t,e.x,e.y):A(t,e)}function W(t){return n(t)}function H(t,e,n=0){let o=t.width,a=t.height;if(0!==n){const e=r(n),i=Math.abs(Math.cos(e)),c=Math.abs(Math.sin(e));o=t.width*i+t.height*c,a=t.width*c+t.height*i}const i=Math.max(1,e[0]),c=Math.max(1,e[1]);return Math.max(o/i,a/c)*ct(t.spatialReference)}async function J(t,r,n,o){let a,i;if(!t)return null;if(Array.isArray(t)&&!t.length)return null;if(e.isCollection(t)&&(t=t.toArray()),Array.isArray(t)&&t.length&&"object"==typeof t[0]){const e=t.every((t=>"attributes"in t)),a=t.some((t=>!t.geometry));let i=t;if(e&&a&&r&&r.allLayerViews){const e=new Map;for(const r of t){const t=r.layer,n=e.get(t)||[],o=r.attributes[t.objectIdField];null!=o&&n.push(o),e.set(t,n)}const n=[];e.forEach(((t,e)=>{const o=r.allLayerViews.find((t=>t.layer.id===e.id));if(o&&"queryFeatures"in o){const r=e.createQuery();r.objectIds=t,r.returnGeometry=!0,n.push(o.queryFeatures(r))}}));const o=await Promise.all(n),a=[];for(const t of o)if(t&&t.features&&t.features.length)for(const e of t.features)null!=e.geometry&&a.push(e.geometry);i=a}for(const t of i)o=await J(t,r,n,o);return o}if(Array.isArray(t)&&2===t.length&&"number"==typeof t[0]&&"number"==typeof t[1])a=new z(t);else if(t instanceof v)a=t;else if("geometry"in t)if(t.geometry)a=t.geometry;else if(t.layer){const e=t.layer,n=r.allLayerViews.find((t=>t.layer.id===e.id));if(n&&"queryFeatures"in n){const r=e.createQuery();r.objectIds=[t.attributes[e.objectIdField]],r.returnGeometry=!0;const o=await n.queryFeatures(r);a=o?.features?.[0]?.geometry}}if(null==a)return null;switch(a.type){case"point":i=new M({xmin:a.x,ymin:a.y,xmax:a.x,ymax:a.y,spatialReference:a.spatialReference});break;case"extent":case"multipoint":case"polygon":case"polyline":i=L(a);break;default:i=a.extent}if(!i)return null;C()||F(i.spatialReference,n)||await N();const c=I(i,n);if(!c)return null;if(o){const t=c.center,e=t.clone();e.x=q(t.x,o.center.x,n),e.x!==t.x&&c.centerAt(e),o=o.union(c)}else o=c;return o}function K(t){if(t&&(!Array.isArray(t)||"number"!=typeof t[0])&&("object"==typeof t||Array.isArray(t)&&"object"==typeof t[0])){if("layer"in t&&null!=t.layer?.minScale&&null!=t.layer.maxScale){const e=t.layer;return{min:e.minScale,max:e.maxScale}}if(Array.isArray(t)&&t.length&&t.every((t=>"layer"in t))){let e=0,r=0;for(const n of t){const t=n.layer;t?.minScale&&t.maxScale&&(e=t.minScale<e?t.minScale:e,r=t.maxScale>r?t.maxScale:r)}return e&&r?{min:e,max:r}:null}}}function X(t,e){const r=B(t);return P(r,e)||r.imageCoordinateSystem||e.imageCoordinateSystem?t:I(t,e)}async function Y(e,r){if(!e||!r)return new t({targetGeometry:new z,scale:0,rotation:0});let n=r.spatialReference;const{constraints:o,padding:a,viewpoint:i,size:c}=r,s=[a?c[0]-a.left-a.right:c[0],a?c[1]-a.top-a.bottom:c[1]];let u=null;e instanceof t?u=e:e.viewpoint?u=e.viewpoint:e.target&&"esri.Viewpoint"===e.target.declaredClass&&(u=e.target);let l=null;u?.targetGeometry?l=u.targetGeometry:e instanceof M?l=e:e instanceof v?l=await J(e,r,n):e&&(l=await J(e.center,r,n)||await J(e.target,r,n)||await J(e,r,n)),!l&&i?.targetGeometry?l=i.targetGeometry:!l&&r.extent&&(l=r.extent),n||(n=B(r.spatialReference||r.extent||l)),C()||P(l.spatialReference,n)||F(l.spatialReference,n)||await N();const f=X(l,n),m="center"in f?f.center:f;!1!==r.pickClosestTarget&&"point"===m.type&&"point"===i.targetGeometry?.type&&(m.x=q(m.x,i.targetGeometry.x,m.spatialReference));let y=0;u?y=u.rotation:e.hasOwnProperty("rotation")?y=e.rotation:i&&(y=i.rotation);let p=0;p=null!=u?.targetGeometry&&"point"===u.targetGeometry.type?u.scale:"scale"in e&&e.scale?e.scale:"zoom"in e&&-1!==e.zoom&&o&&o.effectiveLODs?o.zoomToScale(e.zoom):Array.isArray(l)||"point"===l.type||"extent"===l.type&&0===l.width&&0===l.height?i.scale:H(X(l.extent,n),s,y);const g=K(e.target??e);g&&(g.min&&g.min<p?p=g.min:g.max&&g.max>p&&(p=g.max));let x=new t({targetGeometry:m,scale:p,rotation:y});return o&&(x=o.fit(x),o.constrainByGeometry(x),o.rotationEnabled||(x.rotation=i.rotation)),x}function Z(t,e){const r=t.targetGeometry,n=e.targetGeometry;return r.x=n.x,r.y=n.y,r.spatialReference=n.spatialReference,t.scale=e.scale,t.rotation=e.rotation,t}function $(t,e,r){return r?p(t,.5*(e[0]-r.right+r.left),.5*(e[1]-r.bottom+r.top)):y(t,e,.5)}const _=function(){const t=k();return function(e,r,n){const o=r.targetGeometry;D(t,o);const a=.5*ot(r);return e.xmin=t[0]-a*n[0],e.ymin=t[1]-a*n[1],e.xmax=t[0]+a*n[0],e.ymax=t[1]+a*n[1],e.spatialReference=o.spatialReference,e}}();function tt(t,e,r,n,o){return xt(t,e,r.center),t.scale=H(r,n),o?.constraints?.constrain(t),t}function et(t,e,r,n){return lt(t,e,r,n),f(t,t)}const rt=function(){const t=k();return function(e,r,n){return g(e,st(e,r),$(t,r,n))}}(),nt=function(){const t=m(),e=k();return function(r,n,o,s){const u=ot(n),l=it(n);return p(e,u,u),a(t,e),i(t,t,l),c(t,t,rt(e,o,s)),c(t,t,[0,s.top-s.bottom]),p(r,t[4],t[5])}}();function ot(t){return t.scale*at(t.targetGeometry?.spatialReference)}function at(t){return U(t)?1/(W(t)*Q*O):1}function it(t){return o(t.rotation)||0}function ct(t){return U(t)?W(t)*Q*O:1}function st(t,e){return y(t,e,.5)}const ut=function(){const t=k(),e=k(),r=k();return function(n,o,a,l,f,m){return x(t,o),y(e,a,.5*m),p(r,1/l*m,-1/l*m),s(n,e),f&&i(n,n,f),u(n,n,r),c(n,n,t),n}}(),lt=function(){const t=k();return function(e,r,n,o){const a=ot(r),i=it(r);return D(t,r.targetGeometry),ut(e,t,n,a,i,o)}}(),ft=function(){const t=k();return function(e,r,n,o){const a=ot(r);return D(t,r.targetGeometry),ut(e,t,n,a,0,o)}}();function mt(t){const e=E(t);return e?e.valid[1]-e.valid[0]:0}function yt(t,e){return Math.round(mt(t)/e)}const pt=function(){const t=k(),e=k(),r=[0,0,0];return function(n,o,a){h(t,n,o),b(t,t),h(e,n,a),b(e,e),w(r,t,e);let i=Math.acos(d(t,e)/(j(t)*j(e)))*T;return r[2]<0&&(i=-i),isNaN(i)&&(i=0),i}}(),gt=function(){const t=k();return function(e,r,n,o){const a=e.targetGeometry;return Z(e,r),nt(t,r,n,o),a.x+=t[0],a.y+=t[1],e}}(),xt=function(t,e,r){Z(t,e);const n=t.targetGeometry;return n.x=r.x,n.y=r.y,n.spatialReference=r.spatialReference,t},ht=function(){const t=k();return function(e,r,n,o,a){a||(a="center"),g(t,n,o),y(t,t,.5);const i=t[0],c=t[1];switch(a){case"center":p(t,0,0);break;case"left":p(t,-i,0);break;case"top":p(t,0,c);break;case"right":p(t,i,0);break;case"bottom":p(t,0,-c);break;case"top-left":p(t,-i,c);break;case"bottom-left":p(t,-i,-c);break;case"top-right":p(t,i,c);break;case"bottom-right":p(t,i,-c)}return kt(e,r,t),e}}();function bt(t,e,r){return Z(t,e),t.rotation+=r,t}function wt(t,e,r){return Z(t,e),t.rotation=r,t}const dt=function(){const t=k();return function(e,r,n,o,a){return Z(e,r),isNaN(n)||0===n||(At(t,o,r,a),e.scale=r.scale*n,St(t,t,e,a),kt(e,e,p(t,t[0]-o[0],o[1]-t[1]))),e}}();function jt(t,e,r){return Z(t,e),t.scale=r,t}const Gt=function(){const t=k();return function(e,r,n,o,a,i){return Z(e,r),isNaN(n)||0===n||(At(t,a,r,i),e.scale=r.scale*n,e.rotation+=o,St(t,t,e,i),kt(e,e,p(t,t[0]-a[0],a[1]-t[1]))),e}}(),Rt=function(){const t=k(),e=k();return function(r,n,o,a,i,c,s){return rt(e,c,s),G(t,i,e),a?Gt(r,n,o,a,t,c):dt(r,n,o,t,c)}}(),At=function(){const t=m();return function(e,r,n,o){return R(e,r,et(t,n,o,1))}}(),St=function(){const t=m();return function(e,r,n,o){return R(e,r,lt(t,n,o,1))}}(),kt=function(){const t=k(),e=m();return function(r,n,o){Z(r,n);const a=ot(n),i=r.targetGeometry;return l(e,it(n)),u(e,e,S(a,a)),R(t,o,e),i.x+=t[0],i.y+=t[1],r}}();export{gt as addPadding,pt as angleBetween,xt as centerAt,Z as copy,Y as create,H as extentToScale,$ as getAnchor,_ as getExtent,ut as getMatrix,nt as getPaddingMapTranslation,rt as getPaddingScreenTranslation,ot as getResolution,ct as getResolutionToScaleFactor,at as getScaleToResolutionFactor,lt as getTransform,ft as getTransformNoRotation,yt as getWorldScreenWidth,mt as getWorldWidth,Rt as padAndScaleAndRotateBy,ht as resize,bt as rotateBy,wt as rotateTo,Gt as scaleAndRotateBy,jt as scaleTo,tt as setExtent,At as toMap,St as toScreen,kt as translateBy};
5
+ import t from"../../Viewpoint.js";import e from"../../core/Collection.js";import{deg2rad as r}from"../../core/mathUtils.js";import{getMetersPerUnitForSR as n}from"../../core/unitUtils.js";import{toRadian as o}from"../../core/libs/gl-matrix-2/math/common.js";import{fromScaling as a,rotate as i,translate as c,fromTranslation as s,scale as u,fromRotation as l,invert as f}from"../../core/libs/gl-matrix-2/math/mat2d.js";import{create as m}from"../../core/libs/gl-matrix-2/factories/mat2df64.js";import{scale as y,set as p,sub as g,negate as x,subtract as h,normalize as b,cross as w,dot as d,length as j,add as G,transformMat2d as R,copy as A}from"../../core/libs/gl-matrix-2/math/vec2.js";import{fromValues as S,create as k}from"../../core/libs/gl-matrix-2/factories/vec2f64.js";import M from"../../geometry/Extent.js";import v from"../../geometry/Geometry.js";import z from"../../geometry/Point.js";import{isLoaded as C,canProjectWithoutEngine as F,load as N,project as I}from"../../geometry/projection.js";import V from"../../geometry/SpatialReference.js";import{getClosestDenormalizedXToReference as q,getDenormalizedExtent as L}from"../../geometry/support/normalizeUtils.js";import{equals as P,isValid as U,getInfo as E}from"../../geometry/support/spatialReferenceUtils.js";const O=96,Q=39.37,T=180/Math.PI;function B(t){return t.wkid?t:t.spatialReference||V.WGS84}function D(t,e){return e.type?p(t,e.x,e.y):A(t,e)}function W(t){return n(t)}function H(t,e,n=0){let o=t.width,a=t.height;if(0!==n){const e=r(n),i=Math.abs(Math.cos(e)),c=Math.abs(Math.sin(e));o=t.width*i+t.height*c,a=t.width*c+t.height*i}const i=Math.max(1,e[0]),c=Math.max(1,e[1]);return Math.max(o/i,a/c)*ct(t.spatialReference)}async function J(t,r,n,o){let a,i;if(!t)return null;if(Array.isArray(t)&&!t.length)return null;if(e.isCollection(t)&&(t=t.toArray()),Array.isArray(t)&&t.length&&"object"==typeof t[0]){const e=t.every((t=>"attributes"in t)),a=t.some((t=>!t.geometry));let i=t;if(e&&a&&r&&r.allLayerViews){const e=new Map;for(const r of t){const t=r.layer,n=e.get(t)||[],o=r.attributes[t.objectIdField];null!=o&&n.push(o),e.set(t,n)}const n=[];e.forEach(((t,e)=>{const o=r.allLayerViews?.find((t=>t.layer.id===e.id));if(o&&"queryFeatures"in o){const r=e.createQuery();r.objectIds=t,r.returnGeometry=!0,n.push(o.queryFeatures(r))}}));const o=await Promise.all(n),a=[];for(const t of o)if(t&&t.features&&t.features.length)for(const e of t.features)null!=e.geometry&&a.push(e.geometry);i=a}for(const t of i)o=await J(t,r,n,o);return o}if(Array.isArray(t)&&2===t.length&&"number"==typeof t[0]&&"number"==typeof t[1])a=new z(t);else if(t instanceof v)a=t;else if("geometry"in t)if(t.geometry)a=t.geometry;else if(t.layer){const e=t.layer,n=r.allLayerViews?.find((t=>t.layer.id===e.id));if(n&&"queryFeatures"in n){const r=e.createQuery();r.objectIds=[t.attributes[e.objectIdField]],r.returnGeometry=!0;const o=await n.queryFeatures(r);a=o?.features?.[0]?.geometry}}if(null==a)return null;switch(a.type){case"point":i=new M({xmin:a.x,ymin:a.y,xmax:a.x,ymax:a.y,spatialReference:a.spatialReference});break;case"extent":case"multipoint":case"polygon":case"polyline":i=L(a);break;default:i=a.extent}if(!i)return null;C()||F(i.spatialReference,n)||await N();const c=I(i,n);if(!c)return null;if(o){const t=c.center,e=t.clone();e.x=q(t.x,o.center.x,n),e.x!==t.x&&c.centerAt(e),o=o.union(c)}else o=c;return o}function K(t){if(t&&(!Array.isArray(t)||"number"!=typeof t[0])&&("object"==typeof t||Array.isArray(t)&&"object"==typeof t[0])){if("layer"in t&&null!=t.layer?.minScale&&null!=t.layer.maxScale){const e=t.layer;return{min:e.minScale,max:e.maxScale}}if(Array.isArray(t)&&t.length&&t.every((t=>"layer"in t))){let e=0,r=0;for(const n of t){const t=n.layer;t?.minScale&&t.maxScale&&(e=t.minScale<e?t.minScale:e,r=t.maxScale>r?t.maxScale:r)}return e&&r?{min:e,max:r}:null}}}function X(t,e){const r=B(t);return P(r,e)||r.imageCoordinateSystem||e.imageCoordinateSystem?t:I(t,e)}async function Y(e,r){if(!e||!r)return new t({targetGeometry:new z,scale:0,rotation:0});let n=r.spatialReference;const{constraints:o,padding:a,viewpoint:i,size:c}=r,s=[a?c[0]-a.left-a.right:c[0],a?c[1]-a.top-a.bottom:c[1]];let u=null;e instanceof t?u=e:e.viewpoint?u=e.viewpoint:e.target&&"esri.Viewpoint"===e.target.declaredClass&&(u=e.target);let l=null;u?.targetGeometry?l=u.targetGeometry:e instanceof M?l=e:e instanceof v?l=await J(e,r,n):e&&(l=await J(e.center,r,n)||await J(e.target,r,n)||await J(e,r,n)),!l&&i?.targetGeometry?l=i.targetGeometry:!l&&r.extent&&(l=r.extent),n||(n=B(r.spatialReference||r.extent||l)),C()||P(l.spatialReference,n)||F(l.spatialReference,n)||await N();const f=X(l,n),m="center"in f?f.center:f;!1!==r.pickClosestTarget&&"point"===m.type&&"point"===i.targetGeometry?.type&&(m.x=q(m.x,i.targetGeometry.x,m.spatialReference));let y=0;u?y=u.rotation:e.hasOwnProperty("rotation")?y=e.rotation:i&&(y=i.rotation);let p=0;p=null!=u?.targetGeometry&&"point"===u.targetGeometry.type?u.scale:"scale"in e&&e.scale?e.scale:"zoom"in e&&-1!==e.zoom&&o&&o.effectiveLODs?o.zoomToScale(e.zoom):Array.isArray(l)||"point"===l.type||"extent"===l.type&&0===l.width&&0===l.height?i.scale:H(X(l.extent,n),s,y);const g=K(e.target??e);g&&(g.min&&g.min<p?p=g.min:g.max&&g.max>p&&(p=g.max));let x=new t({targetGeometry:m,scale:p,rotation:y});return o&&(x=o.fit(x),o.constrainByGeometry(x),o.rotationEnabled||(x.rotation=i.rotation)),x}function Z(t,e){const r=t.targetGeometry,n=e.targetGeometry;return r.x=n.x,r.y=n.y,r.spatialReference=n.spatialReference,t.scale=e.scale,t.rotation=e.rotation,t}function $(t,e,r){return r?p(t,.5*(e[0]-r.right+r.left),.5*(e[1]-r.bottom+r.top)):y(t,e,.5)}const _=function(){const t=k();return function(e,r,n){const o=r.targetGeometry;D(t,o);const a=.5*ot(r);return e.xmin=t[0]-a*n[0],e.ymin=t[1]-a*n[1],e.xmax=t[0]+a*n[0],e.ymax=t[1]+a*n[1],e.spatialReference=o.spatialReference,e}}();function tt(t,e,r,n,o){return xt(t,e,r.center),t.scale=H(r,n),o?.constraints?.constrain(t),t}function et(t,e,r,n){return lt(t,e,r,n),f(t,t)}const rt=function(){const t=k();return function(e,r,n){return g(e,st(e,r),$(t,r,n))}}(),nt=function(){const t=m(),e=k();return function(r,n,o,s){const u=ot(n),l=it(n);return p(e,u,u),a(t,e),i(t,t,l),c(t,t,rt(e,o,s)),c(t,t,[0,s.top-s.bottom]),p(r,t[4],t[5])}}();function ot(t){return t.scale*at(t.targetGeometry?.spatialReference)}function at(t){return U(t)?1/(W(t)*Q*O):1}function it(t){return o(t.rotation)||0}function ct(t){return U(t)?W(t)*Q*O:1}function st(t,e){return y(t,e,.5)}const ut=function(){const t=k(),e=k(),r=k();return function(n,o,a,l,f,m){return x(t,o),y(e,a,.5*m),p(r,1/l*m,-1/l*m),s(n,e),f&&i(n,n,f),u(n,n,r),c(n,n,t),n}}(),lt=function(){const t=k();return function(e,r,n,o){const a=ot(r),i=it(r);return D(t,r.targetGeometry),ut(e,t,n,a,i,o)}}(),ft=function(){const t=k();return function(e,r,n,o){const a=ot(r);return D(t,r.targetGeometry),ut(e,t,n,a,0,o)}}();function mt(t){const e=E(t);return e?e.valid[1]-e.valid[0]:0}function yt(t,e){return Math.round(mt(t)/e)}const pt=function(){const t=k(),e=k(),r=[0,0,0];return function(n,o,a){h(t,n,o),b(t,t),h(e,n,a),b(e,e),w(r,t,e);let i=Math.acos(d(t,e)/(j(t)*j(e)))*T;return r[2]<0&&(i=-i),isNaN(i)&&(i=0),i}}(),gt=function(){const t=k();return function(e,r,n,o){const a=e.targetGeometry;return Z(e,r),nt(t,r,n,o),a.x+=t[0],a.y+=t[1],e}}(),xt=function(t,e,r){Z(t,e);const n=t.targetGeometry;return n.x=r.x,n.y=r.y,n.spatialReference=r.spatialReference,t},ht=function(){const t=k();return function(e,r,n,o,a){a||(a="center"),g(t,n,o),y(t,t,.5);const i=t[0],c=t[1];switch(a){case"center":p(t,0,0);break;case"left":p(t,-i,0);break;case"top":p(t,0,c);break;case"right":p(t,i,0);break;case"bottom":p(t,0,-c);break;case"top-left":p(t,-i,c);break;case"bottom-left":p(t,-i,-c);break;case"top-right":p(t,i,c);break;case"bottom-right":p(t,i,-c)}return kt(e,r,t),e}}();function bt(t,e,r){return Z(t,e),t.rotation+=r,t}function wt(t,e,r){return Z(t,e),t.rotation=r,t}const dt=function(){const t=k();return function(e,r,n,o,a){return Z(e,r),isNaN(n)||0===n||(At(t,o,r,a),e.scale=r.scale*n,St(t,t,e,a),kt(e,e,p(t,t[0]-o[0],o[1]-t[1]))),e}}();function jt(t,e,r){return Z(t,e),t.scale=r,t}const Gt=function(){const t=k();return function(e,r,n,o,a,i){return Z(e,r),isNaN(n)||0===n||(At(t,a,r,i),e.scale=r.scale*n,e.rotation+=o,St(t,t,e,i),kt(e,e,p(t,t[0]-a[0],a[1]-t[1]))),e}}(),Rt=function(){const t=k(),e=k();return function(r,n,o,a,i,c,s){return rt(e,c,s),G(t,i,e),a?Gt(r,n,o,a,t,c):dt(r,n,o,t,c)}}(),At=function(){const t=m();return function(e,r,n,o){return R(e,r,et(t,n,o,1))}}(),St=function(){const t=m();return function(e,r,n,o){return R(e,r,lt(t,n,o,1))}}(),kt=function(){const t=k(),e=m();return function(r,n,o){Z(r,n);const a=ot(n),i=r.targetGeometry;return l(e,it(n)),u(e,e,S(a,a)),R(t,o,e),i.x+=t[0],i.y+=t[1],r}}();export{gt as addPadding,pt as angleBetween,xt as centerAt,Z as copy,Y as create,H as extentToScale,$ as getAnchor,_ as getExtent,ut as getMatrix,nt as getPaddingMapTranslation,rt as getPaddingScreenTranslation,ot as getResolution,ct as getResolutionToScaleFactor,at as getScaleToResolutionFactor,lt as getTransform,ft as getTransformNoRotation,yt as getWorldScreenWidth,mt as getWorldWidth,Rt as padAndScaleAndRotateBy,ht as resize,bt as rotateBy,wt as rotateTo,Gt as scaleAndRotateBy,jt as scaleTo,tt as setExtent,At as toMap,St as toScreen,kt as translateBy};
@@ -2,4 +2,4 @@
2
2
  All material copyright ESRI, All Rights Reserved, unless otherwise specified.
3
3
  See https://js.arcgis.com/4.33/esri/copyright.txt for details.
4
4
  */
5
- import{neverReached as e}from"../../../../core/compilerUtils.js";import{clamp as t,acosClamped as r,asinClamped as n,deg2rad as i}from"../../../../core/mathUtils.js";import{fromRotation as s}from"../../../../core/libs/gl-matrix-2/math/mat4.js";import{create as a}from"../../../../core/libs/gl-matrix-2/factories/mat4f64.js";import{d as o,t as c,h as u,g as l,j as m,f,n as d,l as p,k as y}from"../../../../chunks/vec32.js";import{create as M}from"../../../../core/libs/gl-matrix-2/factories/vec3f64.js";import{getReferenceEllipsoid as h}from"../../../../geometry/ellipsoidUtils.js";import{k as C,b as T,t as I}from"../../../../chunks/sphere.js";import{hasConstraintType as O,defaultConstraintOptions as A,adjustRangeForInteraction as D}from"./common.js";import{ConstraintTypes as x}from"./ConstraintTypes.js";import{InteractionType as S}from"./InteractionType.js";import{TiltMode as R}from"./TiltMode.js";import{viewAngle as j}from"../../state/utils/viewUtils.js";function w(t,r,n,i=!0){V.eyeCenterDistance=0,V.requiresTwoSteps=!1;const a=U(t,r,n,A,V);if(0===a)return!1;switch(s(_,-a,r.viewRight),n.tiltMode){case R.LOOK_AROUND:c(K,r.viewForward,_),u(K,K,V.eyeCenterDistance),r.center=l(z,r.eye,K);break;case R.TUMBLE:o(K,r.center,r.eye),c(K,K,_),r.eye=o(z,r.center,K);break;default:e(n.tiltMode)}return r.up=c(z,r.up,_),!V.requiresTwoSteps||!i||w(t,r,n,!1)}function U(e,t,r,n=A,i){if(!e.state.constraints.tilt)return 0;const s=t.distance,a=e.state.constraints.tilt(s,J);return N(e,r,a),n.interactionType===S.TUMBLE&&O(n.selection,x.ALTITUDE)&&B(e,n.interactionStartCamera,a),r.tiltMode===R.LOOK_AROUND||n.tiltMode===R.LOOK_AROUND?b(e,t,a,i):P(e,t,a)}function P(e,r,n){const i=j(e.renderCoordsHelper,r.center,r.eye),s=i-t(i,n.min,n.max);return v(s)?s:0}function b(e,t,r,n){switch(n&&(n.requiresTwoSteps=!1),e.viewingMode){case"global":return g(e,t,r,n);case"local":return L(e,t,r,n)}}function L(e,r,n,i){const s=j(e.renderCoordsHelper,r.center,r.eye),a=t(s,n.min,n.max),o=s-a;if(!v(o))return 0;if(i){const t=Math.abs(e.pointsOfInterest.centerOnSurfaceFrequent.estimatedSurfaceAltitude),n=e.renderCoordsHelper.getAltitude(r.eye)-t,s=Math.max(Math.cos(a),1e-4);Math.abs(s)>1e-4?i.eyeCenterDistance=n/s:i.eyeCenterDistance=r.distance}return o}function g(e,r,n,i){const s=q(e,r,Q),a=t(s.tiltAtCenter,n.min,n.max);if(!v(s.tiltAtCenter-a))return 0;let o,c;return s.centerIsOnSurface?(o=H(s),c=E(s,o)):(o=s.constraints.clampTilt(s.eyeCenterDistance,s.tiltAtCenter),i&&o<Math.PI/2&&(i.requiresTwoSteps=!0,o=Math.PI/2-1e-5),c=F(s,o)),i&&(i.eyeCenterDistance=k(s,o)),c}function q(e,t,n){const i=e.pointsOfInterest.centerOnSurfaceFrequent.estimatedSurfaceAltitude,s=i+h(e.spatialReference).radius,a=e.renderCoordsHelper.intersectManifold(t.ray,i,z);return n.eyeCenterDistance=t.distance,n.centerIsOnSurface=!1,null!=a?(n.eyeCenterDistance=m(t.eye,a),n.tiltAtCenter=j(e.renderCoordsHelper,a,t.eye),n.centerIsOnSurface=!0):e.state.isLocal?n.tiltAtCenter=j(e.renderCoordsHelper,t.center,t.eye):(C(T(I,s),t.ray,z),n.eyeCenterDistance=m(t.eye,z),n.tiltAtCenter=r(-f(t.viewForward,d(z,z)))),n.radius=s,n.eyeRadius=p(t.eye),n.constraints=e.state.constraints,n}function v(e){return Math.abs(e)>1e-9}function H(e){const{constraints:t,eyeCenterDistance:r,tiltAtCenter:n}=e;let i=n,s=t.clampTilt(r,n);const a=k(e,s);if(t.clampTilt(a,n)===s)return s;let o=0;for(;o<10&&v(s-i);){const r=(i+s)/2,n=k(e,r);v(t.clampTilt(n,r)-r)?i=r:s=r,o++}return s}function k(e,r){if(!e.centerIsOnSurface)return e.eyeCenterDistance;const i=Math.PI-t(r,0,Math.PI),s=n(e.radius/e.eyeRadius*Math.sin(i)),a=Math.PI-i-s,o=Math.sin(a)/Math.sin(i);if(e.eyeRadius<e.radius&&o>1){const t=Math.PI-s,r=Math.PI-i-t;return Math.sin(r)/Math.sin(i)*e.eyeRadius}return o*e.eyeRadius}function E(e,t){const r=n(e.radius/e.eyeRadius*Math.sin(e.tiltAtCenter)),i=n(e.radius/e.eyeRadius*Math.sin(t));return e.eyeRadius>e.radius?r-i:i-r}function F(e,t){return e.tiltAtCenter-Math.PI/2-(t-Math.PI/2)}function N(e,t,r){if(t.interactionType===S.NONE)return;const{interactionStartCamera:n,interactionFactor:i}=t;if(!n)return;const{min:s,max:a}=r,o=U(e,n,A,t),c=0===o?0:j(e.renderCoordsHelper,n.center,n.eye);r.min=s,r.max=a,t.interactionType===S.TUMBLE?(O(t.selection,x.ALTITUDE)&&B(e,n,r),D(o,c,!0,i,G,r)):D(o,c,!1,i,G,r)}function B(e,t,n){const i=e.state.constraints;if(e.state.isLocal||!i.altitude||!t)return;const s=y(t.center),a=Math.sqrt(s),o=t.distance,c=h(e.spatialReference).radius,u=i.altitude.min+c,l=i.altitude.max+c,m=(u*u-o*o-s)/(-2*a*o),f=(l*l-o*o-s)/(-2*a*o);n.min=Math.max(n.min,Math.min(Math.PI-r(f),n.max)),n.max=Math.min(n.max,Math.PI-r(m))}const K=M(),_=a(),z=M(),G=i(5),J={min:0,max:0},Q={constraints:null,radius:0,eyeRadius:0,centerIsOnSurface:!0,eyeCenterDistance:0,tiltAtCenter:0},V={eyeCenterDistance:0,requiresTwoSteps:!1};export{w as applyTiltConstraint,U as getTiltConstraintError};
5
+ import{neverReached as e}from"../../../../core/compilerUtils.js";import{clamp as t,acosClamped as r,asinClamped as n,deg2rad as i}from"../../../../core/mathUtils.js";import{fromRotation as a}from"../../../../core/libs/gl-matrix-2/math/mat4.js";import{create as s}from"../../../../core/libs/gl-matrix-2/factories/mat4f64.js";import{d as o,t as c,h as u,g as l,j as m,f as d,n as f,l as p,k as M}from"../../../../chunks/vec32.js";import{create as h}from"../../../../core/libs/gl-matrix-2/factories/vec3f64.js";import{getReferenceEllipsoid as y}from"../../../../geometry/ellipsoidUtils.js";import{k as C,b as T,t as I}from"../../../../chunks/sphere.js";import{hasConstraintType as O,defaultConstraintOptions as A,adjustRangeForInteraction as x}from"./common.js";import{ConstraintTypes as S}from"./ConstraintTypes.js";import{InteractionType as v}from"./InteractionType.js";import{TiltMode as R}from"./TiltMode.js";import{viewAngle as j}from"../../state/utils/viewUtils.js";function w(t,r,n,i=!0){W.eyeCenterDistance=0,W.requiresTwoSteps=!1;const s=U(t,r,n,A,W);if(0===s)return!1;switch(a(_,-s,r.viewRight),n.tiltMode){case R.LOOK_AROUND:c(K,r.viewForward,_),u(K,K,W.eyeCenterDistance),r.center=l(z,r.eye,K);break;case R.TUMBLE:o(K,r.center,r.eye),c(K,K,_),r.eye=o(z,r.center,K);break;default:e(n.tiltMode)}return r.up=c(z,r.up,_),!W.requiresTwoSteps||!i||w(t,r,n,!1)}function U(e,t,r,n=A,i){if(!e.state.constraints.tilt)return 0;const a=Math.min(t.relativeElevation*J,t.distance),s=e.state.constraints.tilt(a,Q);return N(e,r,s),n.interactionType===v.TUMBLE&&O(n.selection,S.ALTITUDE)&&B(e,n.interactionStartCamera,s),r.tiltMode===R.LOOK_AROUND||n.tiltMode===R.LOOK_AROUND?P(e,t,s,i):D(e,t,s)}function D(e,r,n){const i=j(e.renderCoordsHelper,r.center,r.eye),a=i-t(i,n.min,n.max);return g(a)?a:0}function P(e,t,r,n){switch(n&&(n.requiresTwoSteps=!1),e.viewingMode){case"global":return E(e,t,r,n);case"local":return b(e,t,r,n)}}function b(e,r,n,i){const a=j(e.renderCoordsHelper,r.center,r.eye),s=t(a,n.min,n.max),o=a-s;if(!g(o))return 0;if(i){const t=Math.abs(e.pointsOfInterest.centerOnSurfaceFrequent.estimatedSurfaceAltitude),n=e.renderCoordsHelper.getAltitude(r.eye)-t,a=Math.max(Math.cos(s),1e-4);Math.abs(a)>1e-4?i.eyeCenterDistance=n/a:i.eyeCenterDistance=r.distance}return o}function E(e,r,n,i){const a=L(e,r,V),s=t(a.tiltAtCenter,n.min,n.max);if(!g(a.tiltAtCenter-s))return 0;let o,c;return a.centerIsOnSurface?(o=q(a),c=k(a,o)):(o=a.constraints.clampTilt(a.distance,a.tiltAtCenter),i&&o<Math.PI/2&&(i.requiresTwoSteps=!0,o=Math.PI/2-1e-5),c=F(a,o)),i&&(i.eyeCenterDistance=H(a,o)),c}function L(e,t,n){const i=e.pointsOfInterest.centerOnSurfaceFrequent.estimatedSurfaceAltitude,a=i+y(e.spatialReference).radius,s=e.renderCoordsHelper.intersectManifold(t.ray,i,z);return n.distance=Math.min(t.relativeElevation*J,t.distance),n.centerIsOnSurface=!1,null!=s?(n.distance=Math.min(t.relativeElevation*J,m(t.eye,s)),n.tiltAtCenter=j(e.renderCoordsHelper,s,t.eye),n.centerIsOnSurface=!0):e.state.isLocal?n.tiltAtCenter=j(e.renderCoordsHelper,t.center,t.eye):(C(T(I,a),t.ray,z),n.distance=Math.min(t.relativeElevation*J,m(t.eye,z)),n.tiltAtCenter=r(-d(t.viewForward,f(z,z)))),n.radius=a,n.eyeRadius=p(t.eye),n.constraints=e.state.constraints,n}function g(e){return Math.abs(e)>1e-9}function q(e){const{constraints:t,distance:r,tiltAtCenter:n}=e;let i=n,a=t.clampTilt(r,n);const s=H(e,a);if(t.clampTilt(s,n)===a)return a;let o=0;for(;o<10&&g(a-i);){const r=(i+a)/2,n=H(e,r);g(t.clampTilt(n,r)-r)?i=r:a=r,o++}return a}function H(e,r){if(!e.centerIsOnSurface)return e.distance;const i=Math.PI-t(r,0,Math.PI),a=n(e.radius/e.eyeRadius*Math.sin(i)),s=Math.PI-i-a,o=Math.sin(s)/Math.sin(i);if(e.eyeRadius<e.radius&&o>1){const t=Math.PI-a,r=Math.PI-i-t;return Math.sin(r)/Math.sin(i)*e.eyeRadius}return o*e.eyeRadius}function k(e,t){const r=n(e.radius/e.eyeRadius*Math.sin(e.tiltAtCenter)),i=n(e.radius/e.eyeRadius*Math.sin(t));return e.eyeRadius>e.radius?r-i:i-r}function F(e,t){return e.tiltAtCenter-Math.PI/2-(t-Math.PI/2)}function N(e,t,r){if(t.interactionType===v.NONE)return;const{interactionStartCamera:n,interactionFactor:i}=t;if(!n)return;const{min:a,max:s}=r,o=U(e,n,A,t),c=0===o?0:j(e.renderCoordsHelper,n.center,n.eye);r.min=a,r.max=s,t.interactionType===v.TUMBLE?(O(t.selection,S.ALTITUDE)&&B(e,n,r),x(o,c,!0,i,G,r)):x(o,c,!1,i,G,r)}function B(e,t,n){const i=e.state.constraints;if(e.state.isLocal||!i.altitude||!t)return;const a=M(t.center),s=Math.sqrt(a),o=t.distance,c=y(e.spatialReference).radius,u=i.altitude.min+c,l=i.altitude.max+c,m=(u*u-o*o-a)/(-2*s*o),d=(l*l-o*o-a)/(-2*s*o);n.min=Math.max(n.min,Math.min(Math.PI-r(d),n.max)),n.max=Math.min(n.max,Math.PI-r(m))}const K=h(),_=s(),z=h(),G=i(5),J=30,Q={min:0,max:0},V={constraints:null,radius:0,eyeRadius:0,centerIsOnSurface:!0,distance:0,tiltAtCenter:0},W={eyeCenterDistance:0,requiresTwoSteps:!1};export{w as applyTiltConstraint,U as getTiltConstraintError};