@arcgis/core 4.33.0-next.20250331 → 4.33.0-next.20250402

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 (209) hide show
  1. package/applications/SceneViewer/sceneViewerUtils.d.ts +1 -0
  2. package/applications/SceneViewer/sceneViewerUtils.js +1 -1
  3. package/arcade/featureSetUtils.js +1 -1
  4. package/arcade/featureset/sources/FeatureLayerDynamic.js +1 -1
  5. package/arcade/functions/knowledgegraph.js +1 -1
  6. package/assets/esri/core/workers/RemoteClient.js +1 -1
  7. package/assets/esri/core/workers/chunks/0297e55a49ca0d1231ef.js +1 -0
  8. package/assets/esri/core/workers/chunks/{98da74243df03e0cc70d.js → 067dda58592fbf4fb812.js} +1 -1
  9. package/assets/esri/core/workers/chunks/0cd5f15b8558b23e5fcd.js +1 -0
  10. package/assets/esri/core/workers/chunks/0db4c0071282dd94f3b2.js +1 -0
  11. package/assets/esri/core/workers/chunks/1072b4f37eacbbfda2c8.js +1 -0
  12. package/assets/esri/core/workers/chunks/{4d95cc85f4b73e857b1f.js → 11badb73d43059374ad8.js} +1 -1
  13. package/assets/esri/core/workers/chunks/{dcb043986fb065de0366.js → 16607e71804eff64c0e1.js} +1 -1
  14. package/assets/esri/core/workers/chunks/18f8b41bd761e9ab60d0.js +1 -0
  15. package/assets/esri/core/workers/chunks/{ed831e51c2a03ee95879.js → 19e83b184d8b4d0b3007.js} +1 -1
  16. package/assets/esri/core/workers/chunks/{5de3aee547113bfd59df.js → 1b87fa15470cce26feea.js} +1 -1
  17. package/assets/esri/core/workers/chunks/{dde03a893f9cef8e0f45.js → 1d322685016263f86cf5.js} +1 -1
  18. package/assets/esri/core/workers/chunks/{e4b80c8f4c45fd78bde1.js → 23de8aeed5b82c682cbe.js} +1 -1
  19. package/assets/esri/core/workers/chunks/269531e770376ed9e4fd.js +1 -0
  20. package/assets/esri/core/workers/chunks/2791f1f2791087d0217f.js +1 -0
  21. package/assets/esri/core/workers/chunks/{48ad7beb48dcc2693cc3.js → 2ab7d36409e9af3ac3da.js} +1 -1
  22. package/assets/esri/core/workers/chunks/{a7a1832274892e99c388.js → 30a047bd66f333bb7d2d.js} +1 -1
  23. package/assets/esri/core/workers/chunks/{94292c7afff18694d55e.js → 322cb1b1871d03b69f0a.js} +37 -37
  24. package/assets/esri/core/workers/chunks/37e49d1a1407c193dcd0.js +1 -0
  25. package/assets/esri/core/workers/chunks/3b7284516a0e34a9e85e.js +1 -0
  26. package/assets/esri/core/workers/chunks/{6cb5ce0a6bb85c624a21.js → 400f95295bbfced31076.js} +1 -1
  27. package/assets/esri/core/workers/chunks/401ff3c83789c72e9ac9.js +1 -0
  28. package/assets/esri/core/workers/chunks/{6339a24874c698594101.js → 40b33c9bd271cddbd837.js} +1 -1
  29. package/assets/esri/core/workers/chunks/48fbf887da6d19838bf0.js +1 -0
  30. package/assets/esri/core/workers/chunks/4ba34124054752b363c0.js +1 -0
  31. package/assets/esri/core/workers/chunks/4cc77769009901a112ec.js +39 -0
  32. package/assets/esri/core/workers/chunks/{ba4d91816f6a0bf0d812.js → 4dc135e0133d58a06d67.js} +1 -1
  33. package/assets/esri/core/workers/chunks/5aae4e127e888f69435a.js +1 -0
  34. package/assets/esri/core/workers/chunks/{0943695a1dcd21c45e83.js → 5b32c2a1b276352593dc.js} +1 -1
  35. package/assets/esri/core/workers/chunks/{087a09b4c41abef6b516.js → 5c757e20c0543e6a49b3.js} +1 -1
  36. package/assets/esri/core/workers/chunks/6280e1fe944ea4a71b91.js +1 -0
  37. package/assets/esri/core/workers/chunks/{9c59fc2df8081e65a128.js → 628395830c78b95b46dc.js} +1 -1
  38. package/assets/esri/core/workers/chunks/{edcc0fefd57323d2cb67.js → 6828e4936db0121a9638.js} +1 -1
  39. package/assets/esri/core/workers/chunks/{1cd9b5ef62582b25df9b.js → 69b5d0ef14fb521b0fd7.js} +1 -1
  40. package/assets/esri/core/workers/chunks/{b52a3a48d2d3ff22542d.js → 6a8cf1f51cc4adc268d3.js} +1 -1
  41. package/assets/esri/core/workers/chunks/6e679703b5d6fc1b91a5.js +1 -0
  42. package/assets/esri/core/workers/chunks/6f3731f19497cbc6ea74.js +1 -0
  43. package/assets/esri/core/workers/chunks/72d7e45e7eb28f2cc0b0.js +1 -0
  44. package/assets/esri/core/workers/chunks/7649d59b0b7d53818a29.js +1 -0
  45. package/assets/esri/core/workers/chunks/{fe3ed029b07bb1e4aef3.js → 77ae11dbd3e1eeacd7ee.js} +1 -1
  46. package/assets/esri/core/workers/chunks/7978b66cdfe078960ddd.js +1 -0
  47. package/assets/esri/core/workers/chunks/7b8f0b63b968ff40d00d.js +1 -0
  48. package/assets/esri/core/workers/chunks/7e00122014d0a55363a8.js +319 -0
  49. package/assets/esri/core/workers/chunks/{f452ca61842dbe8de9af.js → 7ea5bbb52e84be9a608e.js} +1 -1
  50. package/assets/esri/core/workers/chunks/{eb9d2bb8b44a93347274.js → 7ef9bcd58af499a14a08.js} +1 -1
  51. package/assets/esri/core/workers/chunks/{b2f8702a9f54fff23ad9.js → 7f31dbe0ca8974a10be8.js} +1 -1
  52. package/assets/esri/core/workers/chunks/80427cd9f0c2e07f21c3.js +1 -0
  53. package/assets/esri/core/workers/chunks/{77199b4b39ee8b4303de.js → 82a58a405332d43a328f.js} +1 -1
  54. package/assets/esri/core/workers/chunks/{626db8488f9d931cf55c.js → 899f197556b6ced6eddf.js} +2 -2
  55. package/assets/esri/core/workers/chunks/8aae03e347ab18ae6ee2.js +1 -0
  56. package/assets/esri/core/workers/chunks/8d49c79e549e90371303.js +1 -0
  57. package/assets/esri/core/workers/chunks/{a9b6377f1fef5826f28d.js → 8f35416a5036897d6289.js} +1 -1
  58. package/assets/esri/core/workers/chunks/91439b59260b0fb04be9.js +1 -0
  59. package/assets/esri/core/workers/chunks/{bdeac9196f28aff93e68.js → 93d06a1a0b700ddb3807.js} +1 -1
  60. package/assets/esri/core/workers/chunks/{a01c86910fe4984eb788.js → 9574896c90b39fa7ecb4.js} +1 -1
  61. package/assets/esri/core/workers/chunks/96978d039f183565bffa.js +1 -0
  62. package/assets/esri/core/workers/chunks/9a641fb94819574e48f6.js +1 -0
  63. package/assets/esri/core/workers/chunks/{72c7126dbd27fa48fcdb.js → a3421383e48379012c9c.js} +1 -1
  64. package/assets/esri/core/workers/chunks/b28b699de6deb7e9fa53.js +1 -0
  65. package/assets/esri/core/workers/chunks/{1a5f96b1b892ecceb36a.js → b4a1f3f3a036226d6810.js} +1 -1
  66. package/assets/esri/core/workers/chunks/{f8d1c7df671733c3325c.js → b64f708f821dd2bb51cd.js} +1 -1
  67. package/assets/esri/core/workers/chunks/{3e4204502f6e09483c60.js → b7a1185ac49480fc1410.js} +1 -1
  68. package/assets/esri/core/workers/chunks/{738e4f46feb3758456e0.js → baa9fd23414f03ef90bc.js} +1 -1
  69. package/assets/esri/core/workers/chunks/{aa712f850fd129ca5ed8.js → bba6d7615d8f3862fe70.js} +1 -1
  70. package/assets/esri/core/workers/chunks/{1cf8a431e5da946c7d27.js → bd0dbad694ce5531deab.js} +1 -1
  71. package/assets/esri/core/workers/chunks/c1bd47cde53918f454ca.js +1 -0
  72. package/assets/esri/core/workers/chunks/{1d0473dd43c88ab5776d.js → c589d32f8efcca6bf712.js} +1 -1
  73. package/assets/esri/core/workers/chunks/{081699532b183db1e7c2.js → cda6ae4c5cb67e22b454.js} +1 -1
  74. package/assets/esri/core/workers/chunks/{e2029267cddb8e2effab.js → d58fae2fc9d148e015ae.js} +1 -1
  75. package/assets/esri/core/workers/chunks/{460afde071df9f35182d.js → e14449f07ed3386f4f2b.js} +1 -1
  76. package/assets/esri/core/workers/chunks/{d0fbd4c6bffe0cb98d14.js → e592731ac12b9bc646ff.js} +1 -1
  77. package/assets/esri/core/workers/chunks/e5aff9b10877fb04d6de.js +1 -0
  78. package/assets/esri/core/workers/chunks/e6469173c65531d6524a.js +1 -0
  79. package/assets/esri/core/workers/chunks/e6544e966f14fb410157.js +1 -0
  80. package/assets/esri/core/workers/chunks/e8312c999b3f0c9ef09e.js +1 -0
  81. package/assets/esri/core/workers/chunks/{cb386923200272cf26a9.js → e9e517a2141e504eec64.js} +1 -1
  82. package/assets/esri/core/workers/chunks/eb011e8b14db37ddb110.js +1 -0
  83. package/assets/esri/core/workers/chunks/{f809cbfb744adb4fad29.js → efb0f3ec2344adcb24f3.js} +1 -1
  84. package/assets/esri/core/workers/chunks/{999e8dbe6f4d0665b3ab.js → f5fcba6ca6f43bf1d65d.js} +1 -1
  85. package/assets/esri/core/workers/chunks/fa9ef9e8eae505371965.js +1 -0
  86. package/assets/esri/core/workers/chunks/fb5b852d0f72df014377.js +1 -0
  87. package/assets/esri/core/workers/chunks/ff62b813fff4a015a8a6.js +1 -0
  88. package/core/has.js +1 -1
  89. package/core/sql/WhereClause.js +1 -1
  90. package/core/typedArrayUtil.js +1 -1
  91. package/editing/sharedTemplates/templateDefinitions/TemplateDefinitionBase.js +1 -1
  92. package/geometry/asserts.js +1 -1
  93. package/geometry/support/normalizeUtils.js +1 -1
  94. package/identity/IdentityManagerBase.js +1 -1
  95. package/interfaces.d.ts +96 -8
  96. package/layers/TileLayer.js +1 -1
  97. package/layers/graphics/applyEditsUtils.js +1 -1
  98. package/layers/graphics/data/QueryEngineResult.js +1 -1
  99. package/layers/graphics/featureConversionUtils.js +1 -1
  100. package/layers/graphics/sources/GeoJSONSource.js +1 -1
  101. package/layers/graphics/sources/MemorySource.js +1 -1
  102. package/layers/graphics/sources/connections/GeoEventConnection.js +1 -1
  103. package/layers/graphics/sources/support/sourceUtils.js +1 -1
  104. package/layers/support/ElevationQuery.js +1 -1
  105. package/layers/support/SubtypeSublayer.js +1 -1
  106. package/layers/support/VideoElement.js +1 -1
  107. package/layers/support/wmtsUtils.js +1 -1
  108. package/networks/support/UtilityNetworkLookupHelper.js +1 -1
  109. package/package.json +3 -3
  110. package/portal/support/geometryServiceUtils.js +1 -1
  111. package/renderers/support/DictionaryScriptEvaluator.js +1 -1
  112. package/rest/support/printTaskUtils.js +1 -1
  113. package/smartMapping/support/adapters/InMemoryLayerAdapter.js +1 -1
  114. package/support/revision.js +1 -1
  115. package/symbols/support/ElevationInfo.js +1 -1
  116. package/undoredo/support/Services.js +1 -1
  117. package/versionManagement/VersioningState.js +1 -1
  118. package/views/2d/engine/webgl/Mesh2D.js +1 -1
  119. package/views/2d/layers/features/FeaturePipelineWorker.js +1 -1
  120. package/views/2d/layers/features/layerAdapters/InMemoryLayerAdapter.js +1 -1
  121. package/views/2d/layers/features/support/FeatureSetReaderPBFHeader.js +1 -1
  122. package/views/3d/layers/I3SMeshView3D.js +1 -1
  123. package/views/3d/layers/PointCloudLayerView3D.js +1 -1
  124. package/views/3d/layers/SceneLayerGraphicsView3D.js +1 -1
  125. package/views/3d/layers/graphics/pipeline/Feature3DPipeline.js +1 -1
  126. package/views/3d/layers/graphics/pipeline/Feature3DPipelineWorker.js +1 -1
  127. package/views/3d/layers/graphics/pipeline/Feature3DPipelineWorkerHandle.js +1 -1
  128. package/views/3d/layers/graphics/pipeline/rendering/FeaturePipelineRenderManager.js +1 -1
  129. package/views/3d/layers/graphics/pipeline/rendering/RenderCommandContext.js +1 -1
  130. package/views/3d/layers/graphics/pipeline/symbolization/TestObjectSymbol.js +1 -1
  131. package/views/3d/layers/graphics/pipeline/symbolization/TestSymbol.js +1 -1
  132. package/views/3d/layers/i3s/I3SBinaryReader.js +1 -1
  133. package/views/3d/layers/i3s/I3SClientMaterialUtil.js +1 -1
  134. package/views/3d/layers/i3s/I3SClientNodeLoader.js +1 -1
  135. package/views/3d/layers/i3s/I3SQueryFeatureAdapter.js +1 -1
  136. package/views/3d/layers/i3s/I3SQueryFeatureStore.js +1 -1
  137. package/views/3d/layers/i3s/I3SUtil.js +1 -1
  138. package/views/3d/layers/support/TemporalSceneLayerView.js +1 -1
  139. package/views/3d/support/engineContent/sdfPrimitives.js +1 -1
  140. package/views/3d/webgl-engine/core/FBOCache.js +1 -1
  141. package/views/3d/webgl-engine/core/shaderTechnique/ShaderTechniqueConfiguration.js +1 -1
  142. package/views/3d/webgl-engine/core/shaderTechnique/ShaderTechniqueRepository.js +1 -1
  143. package/views/3d/webgl-engine/lib/Texture.js +1 -1
  144. package/views/3d/webgl-engine/lib/lodRendering/LodRenderer.js +1 -1
  145. package/views/3d/webgl-engine/lib/textureUtils.js +1 -1
  146. package/views/3d/webgl-engine/materials/LineMarkerMaterial.js +1 -1
  147. package/views/3d/webgl-engine/materials/RibbonLineMaterial.js +1 -1
  148. package/views/SceneView.js +1 -1
  149. package/views/View.js +1 -1
  150. package/views/ViewAnimation.js +1 -1
  151. package/views/interactive/snapping/FeatureSnappingSourceInfo.js +1 -1
  152. package/views/layers/PointCloudLayerView.d.ts +1 -1
  153. package/views/layers/PointCloudLayerView.js +5 -0
  154. package/views/webgl/ShaderBuilder.js +1 -1
  155. package/views/webgl/Texture.js +1 -1
  156. package/views/webgl/textureUtils.js +1 -1
  157. package/widgets/Editor/AddAssociationWorkflow.js +1 -1
  158. package/widgets/Editor/UpdateFeaturesWorkflow.js +5 -0
  159. package/widgets/Editor/UpdateFeaturesWorkflowData.js +5 -0
  160. package/widgets/Editor/UpdateRecordWorkflow.js +1 -1
  161. package/widgets/Editor/workflowUtils.js +1 -1
  162. package/widgets/Feature/support/relatedFeatureUtils.js +1 -1
  163. package/widgets/FeatureForm/FieldInput.js +1 -1
  164. package/widgets/FloorFilter/FloorFilterViewModel.js +1 -1
  165. package/widgets/OrientedImageryViewer/OrientedImageryViewerViewModel.js +1 -1
  166. package/widgets/OrientedImageryViewer/dataCaptureUtils.js +1 -1
  167. package/widgets/Slider.js +1 -1
  168. package/widgets/UtilityNetworkTrace/UtilityNetworkTraceViewModel.js +1 -1
  169. package/widgets/UtilityNetworkTraceAnalysis/UtilityNetworkTraceAnalysisViewModel.js +1 -1
  170. package/widgets/VersionManagement/VersionManagementViewModel.js +1 -1
  171. package/widgets/support/UtilityNetworkAssociations/FeatureUtilityNetworkAssociationsViewModel.js +1 -1
  172. package/assets/esri/core/workers/chunks/028e2e0fa6971aaaaae8.js +0 -1
  173. package/assets/esri/core/workers/chunks/0e82365be7d9257e7cb2.js +0 -1
  174. package/assets/esri/core/workers/chunks/1322096a72e910f23167.js +0 -1
  175. package/assets/esri/core/workers/chunks/186387a561364a11e574.js +0 -1
  176. package/assets/esri/core/workers/chunks/3808f10747cecc8a1a9b.js +0 -1
  177. package/assets/esri/core/workers/chunks/3f7c57d5f3bdefa74d18.js +0 -1
  178. package/assets/esri/core/workers/chunks/424e2058228e5f6a183d.js +0 -1
  179. package/assets/esri/core/workers/chunks/4816cf647eca2f4cecc2.js +0 -1
  180. package/assets/esri/core/workers/chunks/4aa0a58ded4465ea28bd.js +0 -1
  181. package/assets/esri/core/workers/chunks/4bb65ef7b3a02ebe416e.js +0 -1
  182. package/assets/esri/core/workers/chunks/4d798da25a726f179089.js +0 -319
  183. package/assets/esri/core/workers/chunks/4ffdff269aae8c293cb4.js +0 -1
  184. package/assets/esri/core/workers/chunks/564cc81c232c97646833.js +0 -1
  185. package/assets/esri/core/workers/chunks/5820808c7659460969d4.js +0 -1
  186. package/assets/esri/core/workers/chunks/5d01f0b86566d08ba29d.js +0 -1
  187. package/assets/esri/core/workers/chunks/6c378e7a6ca29d530880.js +0 -1
  188. package/assets/esri/core/workers/chunks/7d1c39c2a80e20a0595f.js +0 -1
  189. package/assets/esri/core/workers/chunks/86ee278919038260696e.js +0 -39
  190. package/assets/esri/core/workers/chunks/8752f807c05d1ec215e8.js +0 -1
  191. package/assets/esri/core/workers/chunks/8ef5e6f1c606e5e41002.js +0 -1
  192. package/assets/esri/core/workers/chunks/921b41b101957cfc1cfd.js +0 -1
  193. package/assets/esri/core/workers/chunks/9ef509e0853ad41f7690.js +0 -1
  194. package/assets/esri/core/workers/chunks/9f18de17fbcad0e5c140.js +0 -1
  195. package/assets/esri/core/workers/chunks/a53e9f5092de715da025.js +0 -1
  196. package/assets/esri/core/workers/chunks/aa3a45e8228216c1739b.js +0 -1
  197. package/assets/esri/core/workers/chunks/ab0113d1269675dcd520.js +0 -1
  198. package/assets/esri/core/workers/chunks/b23d16745674486ddd6c.js +0 -1
  199. package/assets/esri/core/workers/chunks/b3c126e8a0a722c03efc.js +0 -1
  200. package/assets/esri/core/workers/chunks/c7aa4a8263e21f631004.js +0 -1
  201. package/assets/esri/core/workers/chunks/cc441051a52bfbda9caf.js +0 -1
  202. package/assets/esri/core/workers/chunks/ccc6f6f7052985bebdab.js +0 -1
  203. package/assets/esri/core/workers/chunks/d3912886ac2910290f43.js +0 -1
  204. package/assets/esri/core/workers/chunks/d8b903b4147b090576f2.js +0 -1
  205. package/assets/esri/core/workers/chunks/da8a002d18544def5383.js +0 -1
  206. package/assets/esri/core/workers/chunks/f28eaf1d3a7f12788bcf.js +0 -1
  207. package/assets/esri/core/workers/chunks/f9bedb421d4e115a888f.js +0 -1
  208. package/assets/esri/core/workers/chunks/faed301a25252c619cff.js +0 -1
  209. package/assets/esri/core/workers/chunks/fc9758006a7135c7d9c3.js +0 -1
@@ -2,4 +2,4 @@
2
2
  All material copyright ESRI, All Rights Reserved, unless otherwise specified.
3
3
  See https://js.arcgis.com/4.33/esri/copyright.txt for details.
4
4
  */
5
- import e from"../../Color.js";import r from"../../symbols/SimpleFillSymbol.js";import t from"../../symbols/SimpleLineSymbol.js";import n from"../../symbols/SimpleMarkerSymbol.js";import{isInEffectiveScaleRange as o}from"../../views/support/layerViewUtils.js";function i(){return{layerDefinition:{name:"multipointLayer",geometryType:"esriGeometryMultipoint",drawingInfo:{renderer:null}},featureSet:{geometryType:"esriGeometryMultipoint",features:[]}}}function l(){return{layerDefinition:{name:"polygonLayer",geometryType:"esriGeometryPolygon",drawingInfo:{renderer:null}},featureSet:{geometryType:"esriGeometryPolygon",features:[]}}}function f(){return{layerDefinition:{name:"pointLayer",geometryType:"esriGeometryPoint",drawingInfo:{renderer:null}},featureSet:{geometryType:"esriGeometryPoint",features:[]}}}function a(){return{layerDefinition:{name:"polylineLayer",geometryType:"esriGeometryPolyline",drawingInfo:{renderer:null}},featureSet:{geometryType:"esriGeometryPolyline",features:[]}}}function u(e,r=15){const t=e.canvas.width,n=e.canvas.height,o=e.getImageData(0,0,t,n).data;let i,l,f,a,u,y;e:for(l=n;l--;)for(i=t;i--;)if(o[4*(t*l+i)+3]>r){y=l;break e}if(!y)return null;e:for(i=t;i--;)for(l=y+1;l--;)if(o[4*(t*l+i)+3]>r){u=i;break e}e:for(i=0;i<=u;++i)for(l=y+1;l--;)if(o[4*(t*l+i)+3]>r){f=i;break e}e:for(l=0;l<=y;++l)for(i=f;i<=u;++i)if(o[4*(t*l+i)+3]>r){a=l;break e}return{x:f,y:a,width:u-f,height:y-a}}function y(e){if(!e.attributionVisible)return;let r;return"function"==typeof e.originOf&&"user"===e.originOf("copyright")&&(r=e.copyright),r||!e.hasAttributionData?(r??=e.portalItem?.accessInformation,r??=e.copyright,r??void 0):void 0}function s(o,i){const l=i.color?.clone()??new e([0,255,255]),f=i.haloColor?.clone()??l.clone();switch(o){case"envelope":case"polygon":return l.a*=i.fillOpacity??.25,new r({color:l,outline:new t({color:f}),style:"solid"});case"polyline":return new t({color:f});default:return f.a=1,new n({color:f,outline:null})}}function c(e,r){const t=e.allLayerViews.items;if(r===e.scale)return t.filter((e=>!e.suspended));const n=new Array;for(const i of t){const e=i.parent;e&&e!==i.view&&(g(e)||d(e))&&!n.includes(e)||i.visible&&i.visibleAtCurrentTimeExtent&&o(i.layer.effectiveScaleRange,r)&&n.push(i)}return n}function m(e){return"bing-maps"===e?.type}function p(e){return e&&"blendMode"in e&&"effect"in e}function g(e){return"catalog"===e.layer.type}function d(e){return"group"===e.layer.type}function b(e){const r=e.layer;if(p(r)){const t=r.blendMode;if((!t||"normal"===t)&&(r.effect||"featureEffect"in e&&e.featureEffect))return!0}return!1}export{i as createMultipointLayer,f as createPointLayer,l as createPolygonLayer,a as createPolylineLayer,u as getContextBoundingBox,y as getCopyright,s as getSelectionSymbol,c as getVisibleLayerViews,m as isBingMapsLayer,p as isBlendLayer,b as isScreenshotRequired};
5
+ import e from"../../Color.js";import r from"../../symbols/SimpleFillSymbol.js";import t from"../../symbols/SimpleLineSymbol.js";import n from"../../symbols/SimpleMarkerSymbol.js";import{isInEffectiveScaleRange as o}from"../../views/support/layerViewUtils.js";function i(){return{layerDefinition:{name:"multipointLayer",geometryType:"esriGeometryMultipoint",drawingInfo:{renderer:null}},featureSet:{geometryType:"esriGeometryMultipoint",features:[]}}}function l(){return{layerDefinition:{name:"polygonLayer",geometryType:"esriGeometryPolygon",drawingInfo:{renderer:null}},featureSet:{geometryType:"esriGeometryPolygon",features:[]}}}function f(){return{layerDefinition:{name:"pointLayer",geometryType:"esriGeometryPoint",drawingInfo:{renderer:null}},featureSet:{geometryType:"esriGeometryPoint",features:[]}}}function a(){return{layerDefinition:{name:"polylineLayer",geometryType:"esriGeometryPolyline",drawingInfo:{renderer:null}},featureSet:{geometryType:"esriGeometryPolyline",features:[]}}}function u(e,r=15){const t=e.canvas.width,n=e.canvas.height,o=e.getImageData(0,0,t,n).data;let i,l,f,a,u,y;e:for(l=n;l--;)for(i=t;i--;)if(o[4*(t*l+i)+3]>r){y=l;break e}if(!y)return null;e:for(i=t;i--;)for(l=y+1;l--;)if(o[4*(t*l+i)+3]>r){u=i;break e}e:for(i=0;i<=u;++i)for(l=y+1;l--;)if(o[4*(t*l+i)+3]>r){f=i;break e}e:for(l=0;l<=y;++l)for(i=f;i<=u;++i)if(o[4*(t*l+i)+3]>r){a=l;break e}return{x:f,y:a,width:u-f,height:y-a}}function y(e){if(!e.attributionVisible)return;let r;return"function"==typeof e.originOf&&"user"===e.originOf("copyright")&&(r=e.copyright),r||!e.hasAttributionData?(r??=e.portalItem?.accessInformation,r??=e.copyright,r??void 0):void 0}function s(o,i){const l=i.color?.clone()??new e([0,255,255]),f=i.haloColor?.clone()??l.clone();switch(o){case"envelope":case"polygon":return l.a*=i.fillOpacity??.25,new r({color:l,outline:new t({color:f}),style:"solid"});case"polyline":return new t({color:f});default:return f.a=1,new n({color:f,outline:null})}}function c(e,r){const t=e.allLayerViews.items;if(r===e.scale)return t.filter((e=>!e.suspended));const n=new Array;for(const i of t){const e=i.parent;e&&e!==i.view&&(g(e)||d(e))&&!n.includes(e)||i.visible&&i.visibleAtCurrentTimeExtent&&o(i.layer.effectiveScaleRange,r)&&n.push(i)}return n}function m(e){return"bing-maps"===e?.type}function p(e){return e&&"blendMode"in e&&"effect"in e}function g(e){return"catalog"===e.layer.type}function d(e){return"group"===e.layer.type}function b(e){return e&&"trackInfo"in e}function w(e){const r=e.layer;if(p(r)){const t=r.blendMode;if((!t||"normal"===t)&&(r.effect||"featureEffect"in e&&e.featureEffect))return!0}return!(!b(r)||!r.trackInfo?.enabled)}export{i as createMultipointLayer,f as createPointLayer,l as createPolygonLayer,a as createPolylineLayer,u as getContextBoundingBox,y as getCopyright,s as getSelectionSymbol,c as getVisibleLayerViews,m as isBingMapsLayer,p as isBlendLayer,w as isScreenshotRequired};
@@ -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{pickRandom as t}from"../../../core/arrayUtils.js";import r from"../../../core/Error.js";import a from"../../../core/Logger.js";import{assertIsSome as i}from"../../../core/maybe.js";import{timeout as s,throwIfAborted as o}from"../../../core/promiseUtils.js";import{whenOnce as n}from"../../../core/reactiveUtils.js";import{property as l}from"../../../core/accessorSupport/decorators/property.js";import"../../../core/has.js";import{subclass as u}from"../../../core/accessorSupport/decorators/subclass.js";import{toQuantizationTransform as m}from"../../../geometry/support/quantizationUtils.js";import{kebabDict as p}from"../../../layers/support/fieldType.js";import{isTimeOnlyField as y}from"../../../layers/support/fieldUtils.js";import c from"../../../rest/support/QuantizationParameters.js";import{getArcadeForPredominantCategory as f}from"../../statistics/support/predominanceUtils.js";import{summaryStatistics as d,uniqueValues as h,histogram as w,classBreaks as g,heatmapStatistics as F}from"../../statistics/support/statsWorker.js";import{mergeWhereClauses as S}from"../../statistics/support/utils.js";import{WorkerClient as v}from"../../statistics/support/WorkerClient.js";import{getFieldsList as q,isAnyDateField as V,fieldDelimiter as x}from"../utils.js";import _ from"./LayerAdapter.js";import{getHistogramAttributeDefinition as z,getAttributeBinsQuery as T,processQueryAttributeBinsResult as N}from"./support/histogramUtils.js";import{ensureFeaturesJSON as M,getSummaryStatsQuery as L,getSummaryStatisticsFromFeatureSet as E,getViewInfoParams as C,getMissingFields as j,updateQueryWithFeatureFilter as b,getUVQuery as k,getUniqueValuesFromFeatureSet as I,getBins as O,getDomainsForFields as Q,getPredominantCategoriesFromUVInfos as J}from"./support/utils.js";import{processSummaryStatisticsResult as B,createUVResult as P,resolveCBResult as U}from"../../../statistics/utils.js";import{loadArcade as A}from"../../../support/loadArcade.js";const $=5;let G=null,R=class extends _{constructor(){super(...arguments),this._hasLocalSource=!1,this.adapterName="in-memory-layer-adapter"}destroy(){this.workerClient?.destroy()}async _waitForLayerViewUpdate(e){if(!e)throw new r(`${this.adapterName}:insufficient-data", "layerView is required to fetch the features`);const t=new AbortController,i=n((()=>!e.updating),t.signal);await s(i,5e3,t).catch((e=>{throw a.getLogger(this).warn("LayerView is taking too long to update. Aborting fetch from layerView."),e}))}async _fetchFeatureSetFromMemory(e,t,a){const i=this.layer;if(this._hasLocalSource&&"queryFeatures"in i)return i.queryFeatures(e);if(!t)throw new r(`${this.adapterName}:insufficient-data`,"view is required to fetch the features from layerView");const s=await t.whenLayerView(this.layer);return await this._waitForLayerViewUpdate(s),s.queryFeatures(e,{signal:a})}async _fetchFeaturesFromMemory(e,t,a,i){const s=this.layer,o="json"===i;if(this._hasLocalSource&&"queryFeatures"in s){const e=await s.queryFeatures(t);return o?M(e.features):e.features}if(await this._waitForLayerViewUpdate(e),o&&"queryFeaturesJSON"in e&&e.queryFeaturesJSON){const{features:r}=await e.queryFeaturesJSON(t,{signal:a});return r}if(!("queryFeatures"in e))throw new r(`${this.adapterName}:not-supported`,"'queryFeatures' is not supported on the layerView");const n=await e.queryFeatures(t,{signal:a});return o?M(n.features):n.features}_fetchFeaturesForStats(e,t){return q({field:e.field,field2:e.field2,field3:e.field3,normalizationField:e.normalizationField,valueExpression:e.valueExpression}).then((r=>this.getSampleFeatures({sampleSize:-1,view:e.view,returnGeometry:e.returnGeometry,filter:e.filter,requiredFields:r,signal:e.signal},t)))}async _summaryStatsFromClientQuery(e,t){const{view:r,signal:a}=e,i=L(this,e,t),s=await this._fetchFeatureSetFromMemory(i,r,a),o=E(s,V(t)||y(t));return B(o,e.outStatisticTypes)}async _getNormalizationTotalFromMemory(e,t,a){const{featuresJSON:i,graphics:s,layerView:o,query:n}=t,l={include:["sum"]},u=(!i&&!s&&o&&"querySummaryStatistics"in o?await o.querySummaryStatistics(n,{field:e},{signal:a}):i?await this.workerClient.summaryStatistics({field:e,outStatisticTypes:l},i):await d({attribute:{field:e,outStatisticTypes:l},features:s??[]})).sum;if(null==u)throw new r(`${this.adapterName}:invalid`,"invalid normalizationTotal");return u}async _summaryStatsFromMemory(e,t){const{view:r,field:a,valueExpression:i,normalizationType:s,signal:o}=e,n={field:a,valueExpression:i,normalizationType:s,normalizationField:e.normalizationField,normalizationTotal:e.normalizationTotal,minValue:e.minValue,maxValue:e.maxValue,outStatisticTypes:e.outStatisticTypes},{featuresJSON:l,graphics:u,layerView:m,query:y,fieldInfos:c}=await this._processStatsFromMemoryParams({...e,layerViewFunc:"querySummaryStatistics"});return i&&r&&(l||u)&&(n.fieldType=t?.type?p.toJSON(t.type):null,n.viewInfoParams=C(r),n.timeZone=r.timeZone,n.fieldInfos=c),"percent-of-total"===s&&null==e.normalizationTotal&&(n.normalizationTotal=await this._getNormalizationTotalFromMemory(a,{featuresJSON:l,graphics:u,layerView:m,query:y},o)),!l&&!u&&m&&"querySummaryStatistics"in m?m.querySummaryStatistics(y,n,{signal:o}):l?this.workerClient.summaryStatistics(n,l):d({attribute:n,features:u})}async _getFilteredFeatures(e,t){let r=[];if("intersects"===t?.spatialRelationship){const{intersect:a}=await import("../../../geometry/geometryEngineAsync.js"),i=null!=t.geometry?t.geometry:null;for(const t of e){const e=null!=t.geometry?t.geometry:null;if(e&&i){await a(e,i)&&r.push(t)}}}else r=e;return e.length&&"declaredClass"in e[0]&&"esri.Graphic"===e[0].declaredClass?{graphics:r}:{featuresJSON:r}}async _processStatsFromMemoryParams(e){const{features:t,filter:r}=e;if(t?.length)return this._getFilteredFeatures(t,r);const{view:a,field:i,field2:s,field3:o,normalizationField:n,valueExpression:l,layerViewFunc:u,signal:m}=e;let p=e.returnGeometry;if(null==p&&l){if(!G){const{arcadeUtils:e}=await A();G=e}const e=G.hasGeometryOperations(l);e&&await G.enableGeometryOperations(),p=e}let y=null,c=null,f=null,d=null,h=null;if(a)try{const e="subtype-sublayer"===this.layer.type?this.layer.parent:this.layer;y=await a.whenLayerView(e),c=null!=u&&u in y&&"function"==typeof y[u]}catch{c=!1}if(c)try{await this._waitForLayerViewUpdate(y);const e=await q({field:i,field2:s,field3:o,normalizationField:n,valueExpression:l});j(this,e,y).length?c=!1:(f=this.layer.createQuery(),f.outFields=e,f.returnGeometry=!1,b(f,r)),y.suspended&&(c=!1)}catch{c=!1}return c||(d=await this._fetchFeaturesForStats({field:i,field2:s,field3:o,valueExpression:l,normalizationField:n,returnGeometry:p,filter:r,view:a,signal:m},"json"),h=(await q({valueExpression:l})).map((e=>this.getField(e)?.toJSON())).filter(Boolean)),{layerView:y,query:f,featuresJSON:d,fieldInfos:h}}async _uvFromClientQuery(e,t){const{view:r,signal:a}=e,i=k(this,e),s=await this._fetchFeatureSetFromMemory(i,r,a),o=await I(s,{layer:this,field:e.field,field2:e.field2,field3:e.field3,fieldDelimiter:x,view:e.view,signal:e.signal});return P(o,t,e.returnAllCodedValues,x)}async _uvFromMemory(e,t){const{view:r,field:a,valueExpression:i,returnAllCodedValues:s,signal:o}=e,{featuresJSON:n,graphics:l,layerView:u,query:m,fieldInfos:p}=await this._processStatsFromMemoryParams({...e,layerViewFunc:"queryUniqueValues"}),y={field:a,field2:e.field2,field3:e.field3,fieldDelimiter:x,valueExpression:i,domains:t,returnAllCodedValues:s};return i&&r&&(n||l)&&(y.viewInfoParams=C(r),y.timeZone=r.timeZone,y.fieldInfos=p),!n&&!l&&u&&"queryUniqueValues"in u?u.queryUniqueValues(m,y,{signal:o}):n?this.workerClient.uniqueValues(y,n):h({attribute:y,features:l})}_histogramForField(e){let t=null;return t=null!=e.minValue&&null!=e.maxValue?Promise.resolve({min:e.minValue,max:e.maxValue}):this.summaryStatistics({...e,outStatisticTypes:{include:["min","max","count"]}}).then((e=>{if(!e.count)throw new r(`${this.adapterName}:insufficient-data`,"Either the layer has no features or none of the features have data for the field");return{min:e.min,max:e.max}})),t.then((t=>O(this,{min:t.min,max:t.max},e.field,e.numBins??void 0,e.view,e.filter,e.signal)))}async _histogramFromQueryAttributeBinsFromMemory(e){const{field:t,normalizationType:r,signal:a}=e,i=await this._processStatsFromMemoryParams({...e,layerViewFunc:"queryAttributeBins"}),{featuresJSON:s,graphics:o,layerView:n,query:l}=i,u="percent-of-total"===r?e.normalizationTotal??await this._getNormalizationTotalFromMemory(t,i,a):void 0;if(!n||!("queryAttributeBins"in n)||s||o){const t=z(e,i,u);return s?this.workerClient.histogram(t,s):w({attribute:t,features:o})}const{query:m,min:p,max:y}=await T(e,this,u,l?.where);if(!m)return{bins:[],minValue:p,maxValue:y,normalizationTotal:u};const c=await n.queryAttributeBins(m,{signal:a});return N(c,t?this.getField(t):null,{minValue:p,maxValue:y,normalizationTotal:u})}async _histogramFromMemory(e){const{field:t,signal:r}=e,a=await this._processStatsFromMemoryParams({...e,layerViewFunc:"queryHistogram"}),{featuresJSON:i,graphics:s,layerView:o,query:n}=a,l="percent-of-total"===e.normalizationType?e.normalizationTotal??await this._getNormalizationTotalFromMemory(t,a,r):void 0,u=z(e,a,l);return!i&&!s&&o&&"queryHistogram"in o?o.queryHistogram(n,u,{signal:r}):i?this.workerClient.histogram(u,i):w({attribute:u,features:s})}_classBreaksFromInterpolation(e){const{minValue:t,maxValue:r}=e,a=e.numClasses||$,i=[],s=(r-t)/a;for(let l=0;l<a;l++){const e=t+l*s;i.push({minValue:e,maxValue:e+s})}i[a-1].maxValue=r;const o={classBreaks:i,normalizationTotal:e.normalizationTotal},n=U(o,e.classificationMethod);return Promise.resolve(n)}async _classBreaksFromMemory(e){const{view:t,field:r,valueExpression:a,signal:i}=e,{featuresJSON:s,graphics:o,layerView:n,query:l,fieldInfos:u}=await this._processStatsFromMemoryParams({...e,layerViewFunc:"queryClassBreaks"}),m={field:r,valueExpression:a,normalizationType:e.normalizationType,normalizationField:e.normalizationField,normalizationTotal:e.normalizationTotal,minValue:e.minValue,maxValue:e.maxValue,standardDeviationInterval:e.standardDeviationInterval,classificationMethod:e.classificationMethod,numClasses:e.numClasses};return a&&t&&(s||o)&&(m.viewInfoParams=C(t),m.timeZone=t.timeZone,m.fieldInfos=u),"percent-of-total"===e.normalizationType&&null==e.normalizationTotal&&(m.normalizationTotal=await this._getNormalizationTotalFromMemory(r,{featuresJSON:s,graphics:o,layerView:n,query:l},i)),!s&&!o&&n&&"queryClassBreaks"in n?n.queryClassBreaks(l,m,{signal:i}):s?this.workerClient.classBreaks(m,s):g({attribute:m,features:o})}async _heatmapStatsFromMemory(e){const{view:t,field:r,radius:a,signal:s}=e;i(t,"InMemoryLayerAdapter: must have a view");try{const r=await t.whenLayerView(this.layer);if("queryHeatmapStatistics"in r&&!r.updating&&!e.filter)return await r.queryHeatmapStatistics({field:e.field,radius:e.radius})}catch{o(s)}const{featuresJSON:n,graphics:l}=await this._processStatsFromMemoryParams({...e,returnGeometry:!0}),u=new c({extent:t.extent,tolerance:"2d"===t.type?t.state.resolution:t.pixelSizeAt?.(t.center)}),p={field:r,radius:a,transform:m(u),spatialReference:t.spatialReference?.toJSON(),size:t.size};return n?.length||l?.length?n?this.workerClient.heatmapStatistics(p,n):F({attribute:p,features:l}):{min:null,max:null}}getField(e=""){return this.layer.getField(e)}getFieldUsageInfo(e){return this.getField(e)?{supportsLabelingInfo:!0,supportsRenderer:!0,supportsPopupTemplate:!0,supportsLayerQuery:!0,supportsStatistics:!0}:null}getFieldDomain(e,t){return this.layer.getFieldDomain(e,t)}createQuery(){return this.layer.createQuery()}async summaryStatistics(e){const{field:t,valueExpression:a,sqlExpression:i,features:s,view:o}=e,n=t?this.getField(t):null,l=!!a,u="3d"===o?.type;if(!a&&i&&!this.supportsSQLExpression)throw new r(`${this.adapterName}:not-supported`,"Layer does not support standardized SQL expression for queries");return l||s||u?this._summaryStatsFromMemory(e,n):this._summaryStatsFromClientQuery(e,n)}async uniqueValues(e){const{valueExpression:t,sqlExpression:a,features:i,view:s}=e,o=await Q(e,this),n=!!t,l="3d"===s?.type;if(!t&&a&&!this.supportsSQLExpression)throw new r(`${this.adapterName}:not-supported`,"Layer does not support standardized SQL expression for queries");return n||i||l?this._uvFromMemory(e,o):this._uvFromClientQuery(e,o)}async histogram(e){const{features:t,valueExpression:a,normalizationType:i,sqlExpression:s}=e,o=t||!!a;if(!a&&s&&!this.supportsSQLExpression)throw new r(`${this.adapterName}:not-supported`,"Layer does not support standardized SQL expression for queries");return o||i?this._histogramFromMemory(e):this._histogramForField(e)}async classBreaks(e){return!1!==e.analyzeData?this._classBreaksFromMemory(e):this._classBreaksFromInterpolation(e)}async queryFeatureCount(e){const{whereClause:t,view:a,signal:i}=e;if(!a)throw new r(`${this.adapterName}:insufficient-data`,"view is required to fetch the features from layerView");const s=this.layer.createQuery();s.where=S(s.where,t);const o=await a.whenLayerView(this.layer);return await n((()=>!o.updating),i),o.queryFeatureCount(s,{signal:i})}async generateRenderer(e,t){throw new r(`${this.adapterName}:not-supported`,"Layer does not support generateRenderer operation")}async predominantCategories(e){const{fields:t,view:r,signal:a,filter:i}=e,s=f(t),o=await this._uvFromMemory({valueExpression:s,view:r,signal:a,filter:i});return J(o.uniqueValueInfos,t)}async heatmapStatistics(e){return this._heatmapStatsFromMemory(e)}async getSampleFeatures(e,a){const{view:i,sampleSize:s,requiredFields:o,returnGeometry:n,filter:l,signal:u}=e,m=this.layer.createQuery(),p=1;if(m.outSpatialReference=i?.spatialReference,m.returnGeometry=!!n,m.outFields=o,b(m,l),!i)throw new r(`${this.adapterName}:not-supported`,"view is required to get sample features for Layer");const y=await i.whenLayerView(this.layer);if(j(this,o,y).length)throw new r(`${this.adapterName}:not-supported`,"Required fields need to be passed in the outFields for Layer");const c=await this._fetchFeaturesFromMemory(y,m,u,a),f=null!=s&&s>0&&s<=c.length?s:c.length;return t(c,f,p)}load(e){const t=this.layer.load(e).then((async t=>{this.geometryType=t.geometryType,this.objectIdField=t.objectIdField,this.supportsSQLExpression="stream"===t.type||!!t.capabilities?.query?.supportsSqlExpression,this.minScale=t.minScale,this.maxScale=t.maxScale,this.fullExtent="fullExtent"in t?t.fullExtent:t.parent?.fullExtent,this._hasLocalSource=!1,this.hasQueryEngine=!0,this.workerClient=v.getInstance(),await this.workerClient.open(e.signal)}));return this.addResolvingPromise(t),Promise.resolve(this)}};e([l({readOnly:!0})],R.prototype,"adapterName",void 0),e([l({constructOnly:!0})],R.prototype,"layer",void 0),R=e([u("esri.smartMapping.support.adapters.InMemoryLayerAdapter")],R);const D=R;export{D as default};
5
+ import{_ as e}from"../../../chunks/tslib.es6.js";import{pickRandom as t}from"../../../core/arrayUtils.js";import r from"../../../core/Error.js";import a from"../../../core/Logger.js";import{assertIsSome as i}from"../../../core/maybe.js";import{timeout as s,throwIfAborted as o}from"../../../core/promiseUtils.js";import{whenOnce as n}from"../../../core/reactiveUtils.js";import{property as l}from"../../../core/accessorSupport/decorators/property.js";import"../../../core/has.js";import{subclass as u}from"../../../core/accessorSupport/decorators/subclass.js";import{toQuantizationTransform as m}from"../../../geometry/support/quantizationUtils.js";import{kebabDict as p}from"../../../layers/support/fieldType.js";import{isTimeOnlyField as y}from"../../../layers/support/fieldUtils.js";import c from"../../../rest/support/QuantizationParameters.js";import{getArcadeForPredominantCategory as f}from"../../statistics/support/predominanceUtils.js";import{summaryStatistics as d,uniqueValues as h,histogram as w,classBreaks as g,heatmapStatistics as F}from"../../statistics/support/statsWorker.js";import{mergeWhereClauses as S}from"../../statistics/support/utils.js";import{WorkerClient as v}from"../../statistics/support/WorkerClient.js";import{getFieldsList as q,isAnyDateField as V,fieldDelimiter as x}from"../utils.js";import _ from"./LayerAdapter.js";import{getHistogramAttributeDefinition as z,getAttributeBinsQuery as T,processQueryAttributeBinsResult as N}from"./support/histogramUtils.js";import{ensureFeaturesJSON as M,getSummaryStatsQuery as L,getSummaryStatisticsFromFeatureSet as E,getViewInfoParams as C,getMissingFields as j,updateQueryWithFeatureFilter as b,getUVQuery as k,getUniqueValuesFromFeatureSet as I,getBins as O,getDomainsForFields as Q,getPredominantCategoriesFromUVInfos as J}from"./support/utils.js";import{processSummaryStatisticsResult as B,createUVResult as P,resolveCBResult as U}from"../../../statistics/utils.js";import{loadArcade as A}from"../../../support/loadArcade.js";const $=5;let G=null,R=class extends _{constructor(){super(...arguments),this._hasLocalSource=!1,this.adapterName="in-memory-layer-adapter"}destroy(){this.workerClient?.destroy()}async _waitForLayerViewUpdate(e){if(!e)throw new r(`${this.adapterName}:insufficient-data`,"layerView is required to fetch the features");const t=new AbortController,i=n((()=>!e.updating),t.signal);await s(i,5e3,t).catch((e=>{throw a.getLogger(this).warn("LayerView is taking too long to update. Aborting fetch from layerView."),e}))}async _fetchFeatureSetFromMemory(e,t,a){const i=this.layer;if(this._hasLocalSource&&"queryFeatures"in i)return i.queryFeatures(e);if(!t)throw new r(`${this.adapterName}:insufficient-data`,"view is required to fetch the features from layerView");const s=await t.whenLayerView(this.layer);return await this._waitForLayerViewUpdate(s),s.queryFeatures(e,{signal:a})}async _fetchFeaturesFromMemory(e,t,a,i){const s=this.layer,o="json"===i;if(this._hasLocalSource&&"queryFeatures"in s){const e=await s.queryFeatures(t);return o?M(e.features):e.features}if(await this._waitForLayerViewUpdate(e),o&&"queryFeaturesJSON"in e&&e.queryFeaturesJSON){const{features:r}=await e.queryFeaturesJSON(t,{signal:a});return r}if(!("queryFeatures"in e))throw new r(`${this.adapterName}:not-supported`,"'queryFeatures' is not supported on the layerView");const n=await e.queryFeatures(t,{signal:a});return o?M(n.features):n.features}_fetchFeaturesForStats(e,t){return q({field:e.field,field2:e.field2,field3:e.field3,normalizationField:e.normalizationField,valueExpression:e.valueExpression}).then((r=>this.getSampleFeatures({sampleSize:-1,view:e.view,returnGeometry:e.returnGeometry,filter:e.filter,requiredFields:r,signal:e.signal},t)))}async _summaryStatsFromClientQuery(e,t){const{view:r,signal:a}=e,i=L(this,e,t),s=await this._fetchFeatureSetFromMemory(i,r,a),o=E(s,V(t)||y(t));return B(o,e.outStatisticTypes)}async _getNormalizationTotalFromMemory(e,t,a){const{featuresJSON:i,graphics:s,layerView:o,query:n}=t,l={include:["sum"]},u=(!i&&!s&&o&&"querySummaryStatistics"in o?await o.querySummaryStatistics(n,{field:e},{signal:a}):i?await this.workerClient.summaryStatistics({field:e,outStatisticTypes:l},i):await d({attribute:{field:e,outStatisticTypes:l},features:s??[]})).sum;if(null==u)throw new r(`${this.adapterName}:invalid`,"invalid normalizationTotal");return u}async _summaryStatsFromMemory(e,t){const{view:r,field:a,valueExpression:i,normalizationType:s,signal:o}=e,n={field:a,valueExpression:i,normalizationType:s,normalizationField:e.normalizationField,normalizationTotal:e.normalizationTotal,minValue:e.minValue,maxValue:e.maxValue,outStatisticTypes:e.outStatisticTypes},{featuresJSON:l,graphics:u,layerView:m,query:y,fieldInfos:c}=await this._processStatsFromMemoryParams({...e,layerViewFunc:"querySummaryStatistics"});return i&&r&&(l||u)&&(n.fieldType=t?.type?p.toJSON(t.type):null,n.viewInfoParams=C(r),n.timeZone=r.timeZone,n.fieldInfos=c),"percent-of-total"===s&&null==e.normalizationTotal&&(n.normalizationTotal=await this._getNormalizationTotalFromMemory(a,{featuresJSON:l,graphics:u,layerView:m,query:y},o)),!l&&!u&&m&&"querySummaryStatistics"in m?m.querySummaryStatistics(y,n,{signal:o}):l?this.workerClient.summaryStatistics(n,l):d({attribute:n,features:u})}async _getFilteredFeatures(e,t){let r=[];if("intersects"===t?.spatialRelationship){const{intersect:a}=await import("../../../geometry/geometryEngineAsync.js"),i=null!=t.geometry?t.geometry:null;for(const t of e){const e=null!=t.geometry?t.geometry:null;if(e&&i){await a(e,i)&&r.push(t)}}}else r=e;return e.length&&"declaredClass"in e[0]&&"esri.Graphic"===e[0].declaredClass?{graphics:r}:{featuresJSON:r}}async _processStatsFromMemoryParams(e){const{features:t,filter:r}=e;if(t?.length)return this._getFilteredFeatures(t,r);const{view:a,field:i,field2:s,field3:o,normalizationField:n,valueExpression:l,layerViewFunc:u,signal:m}=e;let p=e.returnGeometry;if(null==p&&l){if(!G){const{arcadeUtils:e}=await A();G=e}const e=G.hasGeometryOperations(l);e&&await G.enableGeometryOperations(),p=e}let y=null,c=null,f=null,d=null,h=null;if(a)try{const e="subtype-sublayer"===this.layer.type?this.layer.parent:this.layer;y=await a.whenLayerView(e),c=null!=u&&u in y&&"function"==typeof y[u]}catch{c=!1}if(c)try{await this._waitForLayerViewUpdate(y);const e=await q({field:i,field2:s,field3:o,normalizationField:n,valueExpression:l});j(this,e,y).length?c=!1:(f=this.layer.createQuery(),f.outFields=e,f.returnGeometry=!1,b(f,r)),y.suspended&&(c=!1)}catch{c=!1}return c||(d=await this._fetchFeaturesForStats({field:i,field2:s,field3:o,valueExpression:l,normalizationField:n,returnGeometry:p,filter:r,view:a,signal:m},"json"),h=(await q({valueExpression:l})).map((e=>this.getField(e)?.toJSON())).filter(Boolean)),{layerView:y,query:f,featuresJSON:d,fieldInfos:h}}async _uvFromClientQuery(e,t){const{view:r,signal:a}=e,i=k(this,e),s=await this._fetchFeatureSetFromMemory(i,r,a),o=await I(s,{layer:this,field:e.field,field2:e.field2,field3:e.field3,fieldDelimiter:x,view:e.view,signal:e.signal});return P(o,t,e.returnAllCodedValues,x)}async _uvFromMemory(e,t){const{view:r,field:a,valueExpression:i,returnAllCodedValues:s,signal:o}=e,{featuresJSON:n,graphics:l,layerView:u,query:m,fieldInfos:p}=await this._processStatsFromMemoryParams({...e,layerViewFunc:"queryUniqueValues"}),y={field:a,field2:e.field2,field3:e.field3,fieldDelimiter:x,valueExpression:i,domains:t,returnAllCodedValues:s};return i&&r&&(n||l)&&(y.viewInfoParams=C(r),y.timeZone=r.timeZone,y.fieldInfos=p),!n&&!l&&u&&"queryUniqueValues"in u?u.queryUniqueValues(m,y,{signal:o}):n?this.workerClient.uniqueValues(y,n):h({attribute:y,features:l})}_histogramForField(e){let t=null;return t=null!=e.minValue&&null!=e.maxValue?Promise.resolve({min:e.minValue,max:e.maxValue}):this.summaryStatistics({...e,outStatisticTypes:{include:["min","max","count"]}}).then((e=>{if(!e.count)throw new r(`${this.adapterName}:insufficient-data`,"Either the layer has no features or none of the features have data for the field");return{min:e.min,max:e.max}})),t.then((t=>O(this,{min:t.min,max:t.max},e.field,e.numBins??void 0,e.view,e.filter,e.signal)))}async _histogramFromQueryAttributeBinsFromMemory(e){const{field:t,normalizationType:r,signal:a}=e,i=await this._processStatsFromMemoryParams({...e,layerViewFunc:"queryAttributeBins"}),{featuresJSON:s,graphics:o,layerView:n,query:l}=i,u="percent-of-total"===r?e.normalizationTotal??await this._getNormalizationTotalFromMemory(t,i,a):void 0;if(!n||!("queryAttributeBins"in n)||s||o){const t=z(e,i,u);return s?this.workerClient.histogram(t,s):w({attribute:t,features:o})}const{query:m,min:p,max:y}=await T(e,this,u,l?.where);if(!m)return{bins:[],minValue:p,maxValue:y,normalizationTotal:u};const c=await n.queryAttributeBins(m,{signal:a});return N(c,t?this.getField(t):null,{minValue:p,maxValue:y,normalizationTotal:u})}async _histogramFromMemory(e){const{field:t,signal:r}=e,a=await this._processStatsFromMemoryParams({...e,layerViewFunc:"queryHistogram"}),{featuresJSON:i,graphics:s,layerView:o,query:n}=a,l="percent-of-total"===e.normalizationType?e.normalizationTotal??await this._getNormalizationTotalFromMemory(t,a,r):void 0,u=z(e,a,l);return!i&&!s&&o&&"queryHistogram"in o?o.queryHistogram(n,u,{signal:r}):i?this.workerClient.histogram(u,i):w({attribute:u,features:s})}_classBreaksFromInterpolation(e){const{minValue:t,maxValue:r}=e,a=e.numClasses||$,i=[],s=(r-t)/a;for(let l=0;l<a;l++){const e=t+l*s;i.push({minValue:e,maxValue:e+s})}i[a-1].maxValue=r;const o={classBreaks:i,normalizationTotal:e.normalizationTotal},n=U(o,e.classificationMethod);return Promise.resolve(n)}async _classBreaksFromMemory(e){const{view:t,field:r,valueExpression:a,signal:i}=e,{featuresJSON:s,graphics:o,layerView:n,query:l,fieldInfos:u}=await this._processStatsFromMemoryParams({...e,layerViewFunc:"queryClassBreaks"}),m={field:r,valueExpression:a,normalizationType:e.normalizationType,normalizationField:e.normalizationField,normalizationTotal:e.normalizationTotal,minValue:e.minValue,maxValue:e.maxValue,standardDeviationInterval:e.standardDeviationInterval,classificationMethod:e.classificationMethod,numClasses:e.numClasses};return a&&t&&(s||o)&&(m.viewInfoParams=C(t),m.timeZone=t.timeZone,m.fieldInfos=u),"percent-of-total"===e.normalizationType&&null==e.normalizationTotal&&(m.normalizationTotal=await this._getNormalizationTotalFromMemory(r,{featuresJSON:s,graphics:o,layerView:n,query:l},i)),!s&&!o&&n&&"queryClassBreaks"in n?n.queryClassBreaks(l,m,{signal:i}):s?this.workerClient.classBreaks(m,s):g({attribute:m,features:o})}async _heatmapStatsFromMemory(e){const{view:t,field:r,radius:a,signal:s}=e;i(t,"InMemoryLayerAdapter: must have a view");try{const r=await t.whenLayerView(this.layer);if("queryHeatmapStatistics"in r&&!r.updating&&!e.filter)return await r.queryHeatmapStatistics({field:e.field,radius:e.radius})}catch{o(s)}const{featuresJSON:n,graphics:l}=await this._processStatsFromMemoryParams({...e,returnGeometry:!0}),u=new c({extent:t.extent,tolerance:"2d"===t.type?t.state.resolution:t.pixelSizeAt?.(t.center)}),p={field:r,radius:a,transform:m(u),spatialReference:t.spatialReference?.toJSON(),size:t.size};return n?.length||l?.length?n?this.workerClient.heatmapStatistics(p,n):F({attribute:p,features:l}):{min:null,max:null}}getField(e=""){return this.layer.getField(e)}getFieldUsageInfo(e){return this.getField(e)?{supportsLabelingInfo:!0,supportsRenderer:!0,supportsPopupTemplate:!0,supportsLayerQuery:!0,supportsStatistics:!0}:null}getFieldDomain(e,t){return this.layer.getFieldDomain(e,t)}createQuery(){return this.layer.createQuery()}async summaryStatistics(e){const{field:t,valueExpression:a,sqlExpression:i,features:s,view:o}=e,n=t?this.getField(t):null,l=!!a,u="3d"===o?.type;if(!a&&i&&!this.supportsSQLExpression)throw new r(`${this.adapterName}:not-supported`,"Layer does not support standardized SQL expression for queries");return l||s||u?this._summaryStatsFromMemory(e,n):this._summaryStatsFromClientQuery(e,n)}async uniqueValues(e){const{valueExpression:t,sqlExpression:a,features:i,view:s}=e,o=await Q(e,this),n=!!t,l="3d"===s?.type;if(!t&&a&&!this.supportsSQLExpression)throw new r(`${this.adapterName}:not-supported`,"Layer does not support standardized SQL expression for queries");return n||i||l?this._uvFromMemory(e,o):this._uvFromClientQuery(e,o)}async histogram(e){const{features:t,valueExpression:a,normalizationType:i,sqlExpression:s}=e,o=t||!!a;if(!a&&s&&!this.supportsSQLExpression)throw new r(`${this.adapterName}:not-supported`,"Layer does not support standardized SQL expression for queries");return o||i?this._histogramFromMemory(e):this._histogramForField(e)}async classBreaks(e){return!1!==e.analyzeData?this._classBreaksFromMemory(e):this._classBreaksFromInterpolation(e)}async queryFeatureCount(e){const{whereClause:t,view:a,signal:i}=e;if(!a)throw new r(`${this.adapterName}:insufficient-data`,"view is required to fetch the features from layerView");const s=this.layer.createQuery();s.where=S(s.where,t);const o=await a.whenLayerView(this.layer);return await n((()=>!o.updating),i),o.queryFeatureCount(s,{signal:i})}async generateRenderer(e,t){throw new r(`${this.adapterName}:not-supported`,"Layer does not support generateRenderer operation")}async predominantCategories(e){const{fields:t,view:r,signal:a,filter:i}=e,s=f(t),o=await this._uvFromMemory({valueExpression:s,view:r,signal:a,filter:i});return J(o.uniqueValueInfos,t)}async heatmapStatistics(e){return this._heatmapStatsFromMemory(e)}async getSampleFeatures(e,a){const{view:i,sampleSize:s,requiredFields:o,returnGeometry:n,filter:l,signal:u}=e,m=this.layer.createQuery(),p=1;if(m.outSpatialReference=i?.spatialReference,m.returnGeometry=!!n,m.outFields=o,b(m,l),!i)throw new r(`${this.adapterName}:not-supported`,"view is required to get sample features for Layer");const y=await i.whenLayerView(this.layer);if(j(this,o,y).length)throw new r(`${this.adapterName}:not-supported`,"Required fields need to be passed in the outFields for Layer");const c=await this._fetchFeaturesFromMemory(y,m,u,a),f=null!=s&&s>0&&s<=c.length?s:c.length;return t(c,f,p)}load(e){const t=this.layer.load(e).then((async t=>{this.geometryType=t.geometryType,this.objectIdField=t.objectIdField,this.supportsSQLExpression="stream"===t.type||!!t.capabilities?.query?.supportsSqlExpression,this.minScale=t.minScale,this.maxScale=t.maxScale,this.fullExtent="fullExtent"in t?t.fullExtent:t.parent?.fullExtent,this._hasLocalSource=!1,this.hasQueryEngine=!0,this.workerClient=v.getInstance(),await this.workerClient.open(e.signal)}));return this.addResolvingPromise(t),Promise.resolve(this)}};e([l({readOnly:!0})],R.prototype,"adapterName",void 0),e([l({constructOnly:!0})],R.prototype,"layer",void 0),R=e([u("esri.smartMapping.support.adapters.InMemoryLayerAdapter")],R);const D=R;export{D 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
- const b="20250331",c="bb02fb8a303c54226cd26a62dc8da3ee3bf89324";export{b as buildDate,c as commitHash};
5
+ const b="20250402",e="a3fe9b98d9e84bb51d7aa0599c2b4ee831020ab8";export{b as buildDate,e as commitHash};
@@ -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{strict as o,JSONMap as r}from"../../core/jsonMap.js";import t from"../../core/JSONSupport.js";import{equalsMaybe as s}from"../../core/maybe.js";import{property as i}from"../../core/accessorSupport/decorators/property.js";import"../../core/has.js";import"../../core/Logger.js";import"../../core/RandomLCG.js";import{reader as n}from"../../core/accessorSupport/decorators/reader.js";import{subclass as p}from"../../core/accessorSupport/decorators/subclass.js";import{writer as u}from"../../core/accessorSupport/decorators/writer.js";import f from"./FeatureExpressionInfo.js";import{supportedUnits as a}from"./unitConversionUtils.js";var l;const m=o()({onTheGround:"on-the-ground",relativeToGround:"relative-to-ground",relativeToScene:"relative-to-scene",absoluteHeight:"absolute-height"}),d=new r({foot:"feet",kilometer:"kilometers",meter:"meters",mile:"miles","us-foot":"us-feet",yard:"yards"});let c=class extends t{static{l=this}constructor(e){super(e),this.featureExpressionInfo=void 0,this.offset=null}readFeatureExpressionInfo(e,o){return null!=e?e:o.featureExpression&&0===o.featureExpression.value?{expression:"0"}:void 0}writeFeatureExpressionInfo(e,o,r,t){o[r]=e.write({},t),"0"===e.expression&&(o.featureExpression={value:0})}get mode(){const{offset:e,featureExpressionInfo:o}=this;return this._isOverridden("mode")?this._get("mode"):null!=e||o?"relative-to-ground":"on-the-ground"}set mode(e){this._override("mode",e)}set unit(e){this._set("unit",e)}write(e,o){return this.offset||this.mode||this.featureExpressionInfo||this.unit?super.write(e,o):null}clone(){return new l({mode:this.mode,offset:this.offset,featureExpressionInfo:this.featureExpressionInfo?this.featureExpressionInfo.clone():void 0,unit:this.unit})}equals(e){return this.mode===e.mode&&this.offset===e.offset&&this.unit===e.unit&&s(this.featureExpressionInfo,e.featureExpressionInfo)}};e([i({type:f,json:{write:!0}})],c.prototype,"featureExpressionInfo",void 0),e([n("featureExpressionInfo",["featureExpressionInfo","featureExpression"])],c.prototype,"readFeatureExpressionInfo",null),e([u("featureExpressionInfo",{featureExpressionInfo:{type:f},"featureExpression.value":{type:[0]}})],c.prototype,"writeFeatureExpressionInfo",null),e([i({type:m.apiValues,nonNullable:!0,json:{type:m.jsonValues,read:m.read,write:{writer:m.write,isRequired:!0}}})],c.prototype,"mode",null),e([i({type:Number,json:{write:!0}})],c.prototype,"offset",void 0),e([i({type:a,json:{type:String,read:d.read,write:d.write}})],c.prototype,"unit",null),c=l=e([p("esri.symbols.support.ElevationInfo")],c);const h=c;export{h as default};
5
+ import{_ as e}from"../../chunks/tslib.es6.js";import{strict as o,JSONMap as r}from"../../core/jsonMap.js";import t from"../../core/JSONSupport.js";import{equalsMaybe as s}from"../../core/maybe.js";import{property as i}from"../../core/accessorSupport/decorators/property.js";import"../../core/has.js";import"../../core/Logger.js";import"../../core/RandomLCG.js";import{reader as n}from"../../core/accessorSupport/decorators/reader.js";import{subclass as p}from"../../core/accessorSupport/decorators/subclass.js";import{writer as u}from"../../core/accessorSupport/decorators/writer.js";import f from"./FeatureExpressionInfo.js";import{supportedUnits as a}from"./unitConversionUtils.js";var l;const m=o()({onTheGround:"on-the-ground",relativeToGround:"relative-to-ground",relativeToScene:"relative-to-scene",absoluteHeight:"absolute-height"}),d=new r({foot:"feet",kilometer:"kilometers",meter:"meters",mile:"miles","us-foot":"us-feet",yard:"yards"});let c=class extends t{static{l=this}constructor(e){super(e),this.featureExpressionInfo=void 0,this.offset=null}readFeatureExpressionInfo(e,o){return null!=e?e.expression?e:void 0:o.featureExpression&&0===o.featureExpression.value?{expression:"0"}:void 0}writeFeatureExpressionInfo(e,o,r,t){o[r]=e.write({},t),"0"===e.expression&&(o.featureExpression={value:0})}get mode(){const{offset:e,featureExpressionInfo:o}=this;return this._isOverridden("mode")?this._get("mode"):null!=e||o?"relative-to-ground":"on-the-ground"}set mode(e){this._override("mode",e)}set unit(e){this._set("unit",e)}write(e,o){return this.offset||this.mode||this.featureExpressionInfo||this.unit?super.write(e,o):null}clone(){return new l({mode:this.mode,offset:this.offset,featureExpressionInfo:this.featureExpressionInfo?this.featureExpressionInfo.clone():void 0,unit:this.unit})}equals(e){return this.mode===e.mode&&this.offset===e.offset&&this.unit===e.unit&&s(this.featureExpressionInfo,e.featureExpressionInfo)}};e([i({type:f,json:{write:!0}})],c.prototype,"featureExpressionInfo",void 0),e([n("featureExpressionInfo",["featureExpressionInfo","featureExpression"])],c.prototype,"readFeatureExpressionInfo",null),e([u("featureExpressionInfo",{featureExpressionInfo:{type:f},"featureExpression.value":{type:[0]}})],c.prototype,"writeFeatureExpressionInfo",null),e([i({type:m.apiValues,nonNullable:!0,json:{type:m.jsonValues,read:m.read,write:{writer:m.write,isRequired:!0}}})],c.prototype,"mode",null),e([i({type:Number,json:{write:!0}})],c.prototype,"offset",void 0),e([i({type:a,json:{type:String,read:d.read,write:d.write}})],c.prototype,"unit",null),c=l=e([p("esri.symbols.support.ElevationInfo")],c);const h=c;export{h 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{_ as e}from"../../chunks/tslib.es6.js";import{id as i}from"../../kernel.js";import r from"../../core/Collection.js";import s from"../../core/Error.js";import n from"../../core/Evented.js";import t from"../../core/Loadable.js";import o from"../../core/Logger.js";import{getOrCreateMapValue as a}from"../../core/MapUtils.js";import d from"../../core/Promise.js";import{debounce as c,throwIfAborted as v}from"../../core/promiseUtils.js";import l from"../../core/ReactiveMap.js";import{watch as p,whenOnce as u}from"../../core/reactiveUtils.js";import{normalize as f}from"../../core/urlUtils.js";import{property as m}from"../../core/accessorSupport/decorators/property.js";import"../../core/has.js";import"../../core/RandomLCG.js";import{subclass as h}from"../../core/accessorSupport/decorators/subclass.js";import{UpdatingHandles as g}from"../../core/support/UpdatingHandles.js";import{parse as w}from"../../layers/support/arcgisLayerUrl.js";import{isSubtypeGroupLayer as y,isFeatureLayer as S}from"../../layers/support/layerUtils.js";import I from"../../portal/Portal.js";import{hasUserTypeExtension as _}from"../../portal/support/utils.js";import b from"../../rest/featureService/FeatureService.js";import{ServiceVersionInfo as L}from"./ServiceVersionInfo.js";import V from"../../versionManagement/VersionManagementService.js";function U(e){return!e||0===e.trim().length}const A=new Map;function T(e){return a(A,e,(()=>{const i=new j({view:e});return e.addHandles({remove(){A.delete(e),i.destroy()}}),i.load().catch((e=>{o.getLogger("esri.views.Services").error("Failed to load service metadata",e)})),i}))}let j=class extends(t.LoadableMixin(d.EsriPromiseMixin(n.EventedAccessor))){constructor(e){super(e),this._updatingHandles=new g,this.items=new r,this.tablesAndLayersLookup=new l,this.additionalLayers=new r,this._debouncedCheckAndUpdateServiceInfos=c((async()=>{const e=[];for(const i of this.items){if(0===i.layersAndTables.length)continue;const r=i.layersAndTables.getItemAt(0);r?.gdbVersion!==i.versionInfo?.versionIdentifier.name&&e.push(i)}0!==e.length&&(await u((()=>!this.updating)),await this._updateVersionInfos(e))})),this._debouncedLayersChanged=c((async()=>{const e=this._detectNewLayersAndTables();0!==e.length&&(await u((()=>!this._updatingHandles.updating)),await this._updatingHandles.addPromise((async()=>{const i=new Set;for(const s of e)if("feature"===s.type||"subtype-group"===s.type){if(!s.url)continue;const e=w(s.url).url.path,n=this._findServiceInfo(e);if(n)this.tablesAndLayersLookup.set(s,n),s.isTable?n.tables.push(s):n.layers.push(s);else if(!i.has(e))try{await this._addServiceInfo(e,s)}catch(r){o.getLogger(this).error(`Failed to load feature service: ${e}`,r)}finally{i.add(e)}}})()))})),this._processed=new Set}destroy(){this._set("view",null),this.items.removeAll(),this.tablesAndLayersLookup.clear()}async load(e){return v(e),this.addHandles([p((()=>this._allLayersAndTables),(()=>{this._debouncedLayersChanged().catch((e=>{o.getLogger(this).warn("Failed to update service info",e)}))})),p((()=>this.items.map((e=>e.layersAndTables.map((e=>e.gdbVersion??"")).join(",")))),(()=>{this.checkAndUpdateServiceInfos().catch((e=>{o.getLogger(this).warn("Failed to update service info",e)}))}))]),this.addResolvingPromise(this._debouncedLayersChanged()),this}get updating(){return"loading"===this.loadStatus||this._updatingHandles.updating}checkAndUpdateServiceInfos(){return this._debouncedCheckAndUpdateServiceInfos()}changeVersion(e,i,r){return this._updatingHandles.addPromise((async()=>{await this._changeVersionInternal(e,i,r)})())}createVersion(e){return this._updatingHandles.addPromise((async()=>{const i=e.featureServerUrl,r=this._findServiceInfo(i);if(!r?.versionService)throw new s("services:no-version-management-service");const n=r.hasAdvancedEditingUserTypeExtension,t=r.loggedInServiceUser.toUpperCase(),o=U(e.ownerName)?t:e.ownerName?.trim().toUpperCase();if(o!==t){if(r.featureServiceVersion<=11.1)throw new s("services:versioning-api-error");if(!n)throw new s("services:no-advanced-editing-user-type-extension")}if("SDE"===o?.toUpperCase()&&"DEFAULT"===e.versionName.toUpperCase())throw new s("services:no-valid-version-name");{const i=await r.versionService.getVersionInfos();if(i?.find((i=>i.versionIdentifier.name.toUpperCase()===(o+"."+e.versionName).toUpperCase()||i.versionIdentifier.name.toUpperCase()===(t+"."+e.versionName).toUpperCase())))throw new s("services:no-valid-version-name")}const a=await r.versionService.createVersion({versionName:e.versionName,access:o!==t?"public":e.access,description:e.description});if(o!==t){const{guid:i,name:s}=a.versionIdentifier;await r.versionService.alterVersion({guid:i,name:s},{ownerName:o,access:e.access})}e.switchToVersion&&await this._changeVersionInternal(i,a.versionIdentifier.name,a.versionIdentifier.guid),this.emit("version-created",{versionIdentifier:a.versionIdentifier,versionManagementService:r.versionService})})())}deleteVersion(e,i,r){return this._updatingHandles.addPromise((async()=>{const n=this._findServiceInfo(e);if(!n?.versionService)throw new s("services:no-version-management-service");if(n.featureServiceVersion<=11.1)throw new s("services:versioning-api-error");if(!n.hasAdvancedEditingUserTypeExtension)throw new s("services:no-advanced-editing-user-type-extension");const t={name:i,guid:r};await n.versionService.deleteVersion(t)&&(await this._updateVersionInfo(n),this.emit("version-deleted",{versionIdentifier:t,versionManagementService:n.versionService}))})())}startEditing(e){return this._updatingHandles.addPromise((async()=>{const i=this._findServiceInfo(e);if(!i?.versionService)throw new s("services:no-version-management-service");if(!i.hasAdvancedEditingUserTypeExtension)throw new s("services:no-advanced-editing-user-type-extension");const r=i.versionInfo?.versionIdentifier??{name:i.versionService.defaultVersionIdentifier.name,guid:i.versionService.defaultVersionIdentifier.guid};let n=!0;("none"!==i.versionService.getLockType(r)||(n=await i.versionService.startReading(r),n))&&(n=await i.versionService.startEditing(r),i.updateLockType())})())}finishEditing(e,i){return this._updatingHandles.addPromise((async()=>{const r=this._findServiceInfo(e);if(!r?.versionService)throw new s("services:no-version-management-service");if(!r.hasAdvancedEditingUserTypeExtension)throw new s("services:no-advanced-editing-user-type-extension");const n=r.versionInfo?.versionIdentifier??{name:r.versionService.defaultVersionIdentifier.name,guid:r.versionService.defaultVersionIdentifier.guid},t=r.versionService.getLockType(n);if("none"!==t)return"read"===t?(await r.versionService.stopReading(n),void r.updateLockType()):"edit"===t?(await r.versionService.stopEditing(n,i),await r.versionService.stopReading(n),void r.updateLockType()):void 0})())}async _changeVersionInternal(e,i,r){const n=this._findServiceInfo(e);if(!n?.versionService)throw new s("services:no-version-management-service");const t=n.versionInfo?.versionIdentifier??{name:n.versionService.defaultVersionIdentifier.name,guid:n.versionService.defaultVersionIdentifier.guid},o={name:i,guid:r};await n.versionService.changeVersion(this.view?.map,t,o)&&await this._updateVersionInfo(n)}async _updateVersionInfo(e){const i=e.versionService;if(!i)return;if(0===e.layersAndTables.length)return;const r=e.layersAndTables.getItemAt(0)?.gdbVersion,s=r?await i.getVersionIdentifierFromName(r):i.defaultVersionIdentifier;e.versionInfo=await i.getVersionInfoExtended(s)}_findServiceInfo(e){return this.items.find((i=>i.featureService.url===e))??null}_removeFeatureService(e){this.items.remove(e)}async _findPortal(e){const r=i?.findServerInfo(e??"");if(!r?.owningSystemUrl)return null;const s=`${r.owningSystemUrl}/sharing/rest`,n=I.getDefault();if(n?.loaded&&f(n.restUrl)===f(s))return n;return new I({authMode:"immediate",url:r.owningSystemUrl}).load()}_updateVersionInfos(e){return this._updatingHandles.addPromise((async()=>{for(const i of e)await this._updateVersionInfo(i).catch((e=>{o.getLogger(this).error("Failed to update version details",e)}))})())}async _addServiceInfo(e,i){const s=new b({url:e});await s.load();const n=await this._findPortal(e),t=n?.user?.username;let o=!1;t&&(o=await _(n,t,"advediting"));let a=null;s.versionManagementServiceUrl&&(a=new V({url:s.versionManagementServiceUrl}),await a.load());const d=i.isTable?[]:[i],c=i.isTable?[i]:[],v=new L({loggedInServiceUser:t??"",hasAdvancedEditingUserTypeExtension:o,versionInfo:null,lockType:"none",canEditVersionedData:!0,canCreateVersion:!0,featureService:s,versionService:a,layers:new r(d),tables:new r(c)});return a&&await this._updateVersionInfo(v),this.items.push(v),this.tablesAndLayersLookup.set(i,v),i.isTable?v.tables.push(i):v.layers.push(i),v}get _allLayersAndTables(){return[...this.view.map.allLayers,...this.view.map.allTables,...this.additionalLayers]}_detectNewLayersAndTables(){const e=new Set(this._allLayersAndTables),i=[];for(const r of e)"feature"!==r.type&&"subtype-group"!==r.type||this._processed.has(r)||i.push(r);for(const r of this._processed)if(!e.has(r)&&(y(r)||S(r))){const e=this.tablesAndLayersLookup.get(r);if(!e)continue;this.tablesAndLayersLookup.delete(r),r.isTable?e.tables.remove(r):e.layers.remove(r),0===e.layersAndTables.length&&this._removeFeatureService(e)}return this._processed=e,i}};e([m({constructOnly:!0})],j.prototype,"view",void 0),e([m()],j.prototype,"items",void 0),e([m()],j.prototype,"tablesAndLayersLookup",void 0),e([m()],j.prototype,"additionalLayers",void 0),e([m()],j.prototype,"updating",null),e([m()],j.prototype,"_allLayersAndTables",null),j=e([h("esri.undoredo.support.Services")],j);export{j as Services,T as getServices};
5
+ import{_ as e}from"../../chunks/tslib.es6.js";import{id as i}from"../../kernel.js";import r from"../../core/Collection.js";import n from"../../core/Error.js";import s from"../../core/Evented.js";import t from"../../core/Loadable.js";import o from"../../core/Logger.js";import{getOrCreateMapValue as a}from"../../core/MapUtils.js";import d from"../../core/Promise.js";import{debounce as c,throwIfAborted as v}from"../../core/promiseUtils.js";import l from"../../core/ReactiveMap.js";import{watch as p,whenOnce as m}from"../../core/reactiveUtils.js";import{normalize as u}from"../../core/urlUtils.js";import{property as f}from"../../core/accessorSupport/decorators/property.js";import"../../core/has.js";import"../../core/RandomLCG.js";import{subclass as h}from"../../core/accessorSupport/decorators/subclass.js";import{UpdatingHandles as g}from"../../core/support/UpdatingHandles.js";import{parse as w}from"../../layers/support/arcgisLayerUrl.js";import{isSubtypeGroupLayer as y,isFeatureLayer as S}from"../../layers/support/layerUtils.js";import I from"../../portal/Portal.js";import{hasUserTypeExtension as _}from"../../portal/support/utils.js";import b from"../../rest/featureService/FeatureService.js";import{ServiceVersionInfo as L}from"./ServiceVersionInfo.js";import V from"../../versionManagement/VersionManagementService.js";function A(e){return!e||0===e.trim().length}const U=new Map;function T(e){return a(U,e,(()=>{const i=new j({view:e});return e.addHandles({remove(){U.delete(e),i.destroy()}}),i.load().catch((e=>{o.getLogger("esri.views.Services").error("Failed to load service metadata",e)})),i}))}let j=class extends(t.LoadableMixin(d.EsriPromiseMixin(s.EventedAccessor))){constructor(e){super(e),this._updatingHandles=new g,this.items=new r,this.tablesAndLayersLookup=new l,this.additionalLayers=new r,this._debouncedCheckAndUpdateServiceInfos=c((async()=>{const e=[];for(const i of this.items){if(0===i.layersAndTables.length)continue;const r=i.layersAndTables.getItemAt(0);r?.gdbVersion!==i.versionInfo?.versionIdentifier.name&&e.push(i)}0!==e.length&&(await m((()=>!this.updating)),await this._updateVersionInfos(e))})),this._debouncedLayersChanged=c((async()=>{const e=this._detectNewLayersAndTables();0!==e.length&&(await m((()=>!this._updatingHandles.updating)),await this._updatingHandles.addPromise((async()=>{const i=new Set;for(const n of e)if("feature"===n.type||"subtype-group"===n.type){if(!n.url)continue;const e=w(n.url).url.path,s=this._findServiceInfo(e);if(s)this.tablesAndLayersLookup.set(n,s),n.isTable?s.tables.push(n):s.layers.push(n);else if(!i.has(e))try{await this._addServiceInfo(e,n)}catch(r){o.getLogger(this).error(`Failed to load feature service: ${e}`,r)}finally{i.add(e)}}})()))})),this._processed=new Set}destroy(){this._set("view",null),this.items.removeAll(),this.tablesAndLayersLookup.clear()}async load(e){return v(e),this.addHandles([p((()=>this._allLayersAndTables),(()=>{this._debouncedLayersChanged().catch((e=>{o.getLogger(this).warn("Failed to update service info",e)}))})),p((()=>this.items.map((e=>e.layersAndTables.map((e=>e.gdbVersion??"")).join(",")))),(()=>{this.checkAndUpdateServiceInfos().catch((e=>{o.getLogger(this).warn("Failed to update service info",e)}))}))]),this.addResolvingPromise(this._debouncedLayersChanged()),this}get updating(){return"loading"===this.loadStatus||this._updatingHandles.updating}checkAndUpdateServiceInfos(){return this._debouncedCheckAndUpdateServiceInfos()}changeVersion(e,i,r){return this._updatingHandles.addPromise((async()=>{await this._changeVersionInternal(e,i,r)})())}createVersion(e){return this._updatingHandles.addPromise((async()=>{const i=e.featureServerUrl,r=this._findServiceInfo(i);if(!r?.versionService)throw new n("services:no-version-management-service","No version management service");const s=r.hasAdvancedEditingUserTypeExtension,t=r.loggedInServiceUser.toUpperCase(),o=A(e.ownerName)?t:e.ownerName?.trim().toUpperCase();if(o!==t){if(r.featureServiceVersion<=11.1)throw new n("services:versioning-api-error","Version management API too old");if(!s)throw new n("services:no-advanced-editing-user-type-extension","No advanced editing extension on service")}if("SDE"===o?.toUpperCase()&&"DEFAULT"===e.versionName.toUpperCase())throw new n("services:no-valid-version-name","No valid version name");{const i=await r.versionService.getVersionInfos();if(i?.find((i=>i.versionIdentifier.name.toUpperCase()===(o+"."+e.versionName).toUpperCase()||i.versionIdentifier.name.toUpperCase()===(t+"."+e.versionName).toUpperCase())))throw new n("services:no-valid-version-name","No valid version name")}const a=await r.versionService.createVersion({versionName:e.versionName,access:o!==t?"public":e.access,description:e.description});if(o!==t){const{guid:i,name:n}=a.versionIdentifier;await r.versionService.alterVersion({guid:i,name:n},{ownerName:o,access:e.access})}e.switchToVersion&&await this._changeVersionInternal(i,a.versionIdentifier.name,a.versionIdentifier.guid),this.emit("version-created",{versionIdentifier:a.versionIdentifier,versionManagementService:r.versionService})})())}deleteVersion(e,i,r){return this._updatingHandles.addPromise((async()=>{const s=this._findServiceInfo(e);if(!s?.versionService)throw new n("services:no-version-management-service","No version management service");if(s.featureServiceVersion<=11.1)throw new n("services:versioning-api-error","Version management API too old");if(!s.hasAdvancedEditingUserTypeExtension)throw new n("services:no-advanced-editing-user-type-extension","No advanced editing extension on service");const t={name:i,guid:r};await s.versionService.deleteVersion(t)&&(await this._updateVersionInfo(s),this.emit("version-deleted",{versionIdentifier:t,versionManagementService:s.versionService}))})())}startEditing(e){return this._updatingHandles.addPromise((async()=>{const i=this._findServiceInfo(e);if(!i?.versionService)throw new n("services:no-version-management-service","No version management service");if(!i.hasAdvancedEditingUserTypeExtension)throw new n("services:no-advanced-editing-user-type-extension","No advanced editing extension on service");const r=i.versionInfo?.versionIdentifier??{name:i.versionService.defaultVersionIdentifier.name,guid:i.versionService.defaultVersionIdentifier.guid};let s=!0;("none"!==i.versionService.getLockType(r)||(s=await i.versionService.startReading(r),s))&&(s=await i.versionService.startEditing(r),i.updateLockType())})())}finishEditing(e,i){return this._updatingHandles.addPromise((async()=>{const r=this._findServiceInfo(e);if(!r?.versionService)throw new n("services:no-version-management-service","No version management service");if(!r.hasAdvancedEditingUserTypeExtension)throw new n("services:no-advanced-editing-user-type-extension","No advanced editing extension on service");const s=r.versionInfo?.versionIdentifier??{name:r.versionService.defaultVersionIdentifier.name,guid:r.versionService.defaultVersionIdentifier.guid},t=r.versionService.getLockType(s);if("none"!==t)return"read"===t?(await r.versionService.stopReading(s),void r.updateLockType()):"edit"===t?(await r.versionService.stopEditing(s,i),await r.versionService.stopReading(s),void r.updateLockType()):void 0})())}async _changeVersionInternal(e,i,r){const s=this._findServiceInfo(e);if(!s?.versionService)throw new n("services:no-version-management-service","No version management service");const t=s.versionInfo?.versionIdentifier??{name:s.versionService.defaultVersionIdentifier.name,guid:s.versionService.defaultVersionIdentifier.guid},o={name:i,guid:r};await s.versionService.changeVersion(this.view?.map,t,o)&&await this._updateVersionInfo(s)}async _updateVersionInfo(e){const i=e.versionService;if(!i)return;if(0===e.layersAndTables.length)return;const r=e.layersAndTables.getItemAt(0)?.gdbVersion,n=r?await i.getVersionIdentifierFromName(r):i.defaultVersionIdentifier;e.versionInfo=await i.getVersionInfoExtended(n)}_findServiceInfo(e){return this.items.find((i=>i.featureService.url===e))??null}_removeFeatureService(e){this.items.remove(e)}async _findPortal(e){const r=i?.findServerInfo(e??"");if(!r?.owningSystemUrl)return null;const n=`${r.owningSystemUrl}/sharing/rest`,s=I.getDefault();if(s?.loaded&&u(s.restUrl)===u(n))return s;return new I({authMode:"immediate",url:r.owningSystemUrl}).load()}_updateVersionInfos(e){return this._updatingHandles.addPromise((async()=>{for(const i of e)await this._updateVersionInfo(i).catch((e=>{o.getLogger(this).error("Failed to update version details",e)}))})())}async _addServiceInfo(e,i){const n=new b({url:e});await n.load();const s=await this._findPortal(e),t=s?.user?.username;let o=!1;t&&(o=await _(s,t,"advediting"));let a=null;n.versionManagementServiceUrl&&(a=new V({url:n.versionManagementServiceUrl}),await a.load());const d=i.isTable?[]:[i],c=i.isTable?[i]:[],v=new L({loggedInServiceUser:t??"",hasAdvancedEditingUserTypeExtension:o,versionInfo:null,lockType:"none",canEditVersionedData:!0,canCreateVersion:!0,featureService:n,versionService:a,layers:new r(d),tables:new r(c)});return a&&await this._updateVersionInfo(v),this.items.push(v),this.tablesAndLayersLookup.set(i,v),i.isTable?v.tables.push(i):v.layers.push(i),v}get _allLayersAndTables(){return[...this.view.map.allLayers,...this.view.map.allTables,...this.additionalLayers]}_detectNewLayersAndTables(){const e=new Set(this._allLayersAndTables),i=[];for(const r of e)"feature"!==r.type&&"subtype-group"!==r.type||this._processed.has(r)||i.push(r);for(const r of this._processed)if(!e.has(r)&&(y(r)||S(r))){const e=this.tablesAndLayersLookup.get(r);if(!e)continue;this.tablesAndLayersLookup.delete(r),r.isTable?e.tables.remove(r):e.layers.remove(r),0===e.layersAndTables.length&&this._removeFeatureService(e)}return this._processed=e,i}};e([f({constructOnly:!0})],j.prototype,"view",void 0),e([f()],j.prototype,"items",void 0),e([f()],j.prototype,"tablesAndLayersLookup",void 0),e([f()],j.prototype,"additionalLayers",void 0),e([f()],j.prototype,"updating",null),e([f()],j.prototype,"_allLayersAndTables",null),j=e([h("esri.undoredo.support.Services")],j);export{j as Services,T as getServices};
@@ -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"../core/Collection.js";import r from"../core/Error.js";import s from"../core/JSONSupport.js";import i from"../core/Loadable.js";import n from"../core/Logger.js";import{property as o}from"../core/accessorSupport/decorators/property.js";import"../core/has.js";import"../core/RandomLCG.js";import{subclass as a}from"../core/accessorSupport/decorators/subclass.js";let c=class extends(s.JSONSupportMixin(i)){constructor(e){super(e),this.versionManagementService=null,this.featureServiceUrl=null,this.url=null,this.currentVersion=null,this.currentVersionInfo=null,this.versionInfos=[],this.versionableItems=new t,this.usePersistentReadSessions=!1,this.state="lock-none"}initialize(){this.url=this.versionManagementService.url,this.featureServiceUrl=this.url.replace(/\/VersionManagementServer/i,"/FeatureServer"),this.addHandles([this.versionableItems.on("before-add",(e=>{if(e.item.featureServiceUrl.toLowerCase()!==this.featureServiceUrl.toLowerCase())return e.preventDefault(),void n.getLogger(this).error("#add()","Cannot add versionAdapter, feature service urls do not match.")})),this.versionableItems.on("before-remove",(e=>{if(0===this.versionableItems.items.length&&this.currentVersion&&"name"in this.currentVersion&&"none"!==this.versionManagementService.getLockType(this.currentVersion))return e.preventDefault(),void n.getLogger(this).error("#remove()","Cannot remove last versionAdapter.")}))])}load(e){return this.addResolvingPromise(this._setUpState(e)),Promise.resolve(this)}get defaultVersionIdentifier(){return this.versionManagementService.defaultVersionIdentifier}get isDefault(){return!this.currentVersion||!!this.currentVersion&&"name"in this.currentVersion&&this.currentVersion.name===this.defaultVersionIdentifier.name}async getVersionInfos(e=!1){return e&&(this.versionInfos=await this.versionManagementService.getVersionInfos()),this.versionInfos}async alterVersion(e,t){if(this.currentVersion&&"guid"in this.currentVersion&&e.guid===this.currentVersion.guid)return!1;const r=await this.versionManagementService.alterVersion(e,t);return r&&await this.getVersionInfos(!0),r}async deleteVersion(e){if(this.currentVersion&&"guid"in this.currentVersion&&e.guid===this.currentVersion.guid)return!1;const t=await this.versionManagementService.deleteVersion(e);return t&&await this.getVersionInfos(!0),t}async getVersionInfoExtended(){return this.currentVersion&&"name"in this.currentVersion?this.versionManagementService.getVersionInfoExtended(this.currentVersion):this.versionManagementService.getVersionInfoExtended(this.defaultVersionIdentifier)}async startEditing(){if(this._isDefaultOrHistoricVersion())return{success:!1};if(!this.usePersistentReadSessions){const e=await this.versionManagementService.startReadingWithResult(this.currentVersion);if(!e.success)return e;this.state="lock-read"}const e=await this.versionManagementService.startEditingWithResult(this.currentVersion);return e.success&&(this.state="lock-write"),e}async stopEditing(e){if(this._isDefaultOrHistoricVersion())return{success:!1};const t=await this.versionManagementService.stopEditingWithResult(this.currentVersion,e);if(!t.success)return t;if(this.state="lock-read",!this.usePersistentReadSessions){const e=await this.versionManagementService.stopReadingWithResult(this.currentVersion);return e.success&&(this.state="lock-none"),e}return t}async changeVersion(e){let t=null;if(this.usePersistentReadSessions){if(this._isDefaultOrHistoricVersion(e))e&&"name"in e?(t=await this.versionManagementService.getVersionInfoExtended(e),this.state="public"===t?.access?"lock-none":"lock-read"):this.state="lock-read";else if(!await this.versionManagementService.startReading(e))throw new r("Failed to acquire read lock for version: "+e);this._isDefaultOrHistoricVersion(this.currentVersion)||await this.versionManagementService.stopReading(this.currentVersion)}const s=await this.versionManagementService.changeVersionWithResult(this.versionableItems,this.currentVersion,e);let i=!1;return s.forEach(((e,t)=>{i=i||e.success})),i&&(this.currentVersion=e,this.currentVersionInfo=t||await this.getVersionInfoExtended(),this._isDefaultOrHistoricVersion()?this.currentVersion&&"name"in this.currentVersion?this.state="public"===this.currentVersionInfo?.access?"lock-none":"lock-read":this.state="lock-read":this.state="read"!==this.versionManagementService.getLockType(this.currentVersion)?"lock-none":"lock-read"),s}async undo(){return this._isDefaultOrHistoricVersion()?{success:!1}:(this.versionManagementService.undo(this.currentVersion),{success:!0})}async redo(){return this._isDefaultOrHistoricVersion()?{success:!1}:(this.versionManagementService.redo(this.currentVersion),{success:!0})}async _setUpState(e){await this.versionManagementService.load(e),this.state="lock-none",this.currentVersionInfo=await this.getVersionInfoExtended(),this.versionableItems.forEach((e=>{this.currentVersion?"name"in this.currentVersion?(e.gdbVersion=this.currentVersion.name,e.historicMoment=null):(e.historicMoment=this.currentVersion,e.gdbVersion=null):(e.gdbVersion=null,e.historicMoment=null)})),this.usePersistentReadSessions&&(this._isDefaultOrHistoricVersion()?this.currentVersion&&"name"in this.currentVersion?this.state="public"===this.currentVersionInfo?.access?"lock-none":"lock-read":this.state="lock-read":await this.versionManagementService.startReading(this.currentVersion)&&(this.state="lock-read"))}_isDefaultOrHistoricVersion(e=this.currentVersion){return!(e&&"name"in e)||e.name===this.versionManagementService.defaultVersionIdentifier.name}};e([o()],c.prototype,"versionManagementService",void 0),e([o()],c.prototype,"featureServiceUrl",void 0),e([o()],c.prototype,"url",void 0),e([o()],c.prototype,"currentVersion",void 0),e([o()],c.prototype,"currentVersionInfo",void 0),e([o()],c.prototype,"versionInfos",void 0),e([o()],c.prototype,"versionableItems",void 0),e([o()],c.prototype,"usePersistentReadSessions",void 0),e([o()],c.prototype,"state",void 0),e([o({readOnly:!0})],c.prototype,"defaultVersionIdentifier",null),e([o({readOnly:!0})],c.prototype,"isDefault",null),c=e([a("esri.versionManagement.VersioningState")],c);const u=c;export{u as default};
5
+ import{_ as e}from"../chunks/tslib.es6.js";import t from"../core/Collection.js";import r from"../core/Error.js";import s from"../core/JSONSupport.js";import i from"../core/Loadable.js";import n from"../core/Logger.js";import{property as o}from"../core/accessorSupport/decorators/property.js";import"../core/has.js";import"../core/RandomLCG.js";import{subclass as a}from"../core/accessorSupport/decorators/subclass.js";let c=class extends(s.JSONSupportMixin(i)){constructor(e){super(e),this.versionManagementService=null,this.featureServiceUrl=null,this.url=null,this.currentVersion=null,this.currentVersionInfo=null,this.versionInfos=[],this.versionableItems=new t,this.usePersistentReadSessions=!1,this.state="lock-none"}initialize(){this.url=this.versionManagementService.url,this.featureServiceUrl=this.url.replace(/\/VersionManagementServer/i,"/FeatureServer"),this.addHandles([this.versionableItems.on("before-add",(e=>{if(e.item.featureServiceUrl.toLowerCase()!==this.featureServiceUrl.toLowerCase())return e.preventDefault(),void n.getLogger(this).error("#add()","Cannot add versionAdapter, feature service urls do not match.")})),this.versionableItems.on("before-remove",(e=>{if(0===this.versionableItems.items.length&&this.currentVersion&&"name"in this.currentVersion&&"none"!==this.versionManagementService.getLockType(this.currentVersion))return e.preventDefault(),void n.getLogger(this).error("#remove()","Cannot remove last versionAdapter.")}))])}load(e){return this.addResolvingPromise(this._setUpState(e)),Promise.resolve(this)}get defaultVersionIdentifier(){return this.versionManagementService.defaultVersionIdentifier}get isDefault(){return!this.currentVersion||!!this.currentVersion&&"name"in this.currentVersion&&this.currentVersion.name===this.defaultVersionIdentifier.name}async getVersionInfos(e=!1){return e&&(this.versionInfos=await this.versionManagementService.getVersionInfos()),this.versionInfos}async alterVersion(e,t){if(this.currentVersion&&"guid"in this.currentVersion&&e.guid===this.currentVersion.guid)return!1;const r=await this.versionManagementService.alterVersion(e,t);return r&&await this.getVersionInfos(!0),r}async deleteVersion(e){if(this.currentVersion&&"guid"in this.currentVersion&&e.guid===this.currentVersion.guid)return!1;const t=await this.versionManagementService.deleteVersion(e);return t&&await this.getVersionInfos(!0),t}async getVersionInfoExtended(){return this.currentVersion&&"name"in this.currentVersion?this.versionManagementService.getVersionInfoExtended(this.currentVersion):this.versionManagementService.getVersionInfoExtended(this.defaultVersionIdentifier)}async startEditing(){if(this._isDefaultOrHistoricVersion())return{success:!1};if(!this.usePersistentReadSessions){const e=await this.versionManagementService.startReadingWithResult(this.currentVersion);if(!e.success)return e;this.state="lock-read"}const e=await this.versionManagementService.startEditingWithResult(this.currentVersion);return e.success&&(this.state="lock-write"),e}async stopEditing(e){if(this._isDefaultOrHistoricVersion())return{success:!1};const t=await this.versionManagementService.stopEditingWithResult(this.currentVersion,e);if(!t.success)return t;if(this.state="lock-read",!this.usePersistentReadSessions){const e=await this.versionManagementService.stopReadingWithResult(this.currentVersion);return e.success&&(this.state="lock-none"),e}return t}async changeVersion(e){let t=null;if(this.usePersistentReadSessions){if(this._isDefaultOrHistoricVersion(e))e&&"name"in e?(t=await this.versionManagementService.getVersionInfoExtended(e),this.state="public"===t?.access?"lock-none":"lock-read"):this.state="lock-read";else if(!await this.versionManagementService.startReading(e))throw new r("internal","Failed to acquire read lock for version: "+e);this._isDefaultOrHistoricVersion(this.currentVersion)||await this.versionManagementService.stopReading(this.currentVersion)}const s=await this.versionManagementService.changeVersionWithResult(this.versionableItems,this.currentVersion,e);let i=!1;return s.forEach(((e,t)=>{i=i||e.success})),i&&(this.currentVersion=e,this.currentVersionInfo=t||await this.getVersionInfoExtended(),this._isDefaultOrHistoricVersion()?this.currentVersion&&"name"in this.currentVersion?this.state="public"===this.currentVersionInfo?.access?"lock-none":"lock-read":this.state="lock-read":this.state="read"!==this.versionManagementService.getLockType(this.currentVersion)?"lock-none":"lock-read"),s}async undo(){return this._isDefaultOrHistoricVersion()?{success:!1}:(this.versionManagementService.undo(this.currentVersion),{success:!0})}async redo(){return this._isDefaultOrHistoricVersion()?{success:!1}:(this.versionManagementService.redo(this.currentVersion),{success:!0})}async _setUpState(e){await this.versionManagementService.load(e),this.state="lock-none",this.currentVersionInfo=await this.getVersionInfoExtended(),this.versionableItems.forEach((e=>{this.currentVersion?"name"in this.currentVersion?(e.gdbVersion=this.currentVersion.name,e.historicMoment=null):(e.historicMoment=this.currentVersion,e.gdbVersion=null):(e.gdbVersion=null,e.historicMoment=null)})),this.usePersistentReadSessions&&(this._isDefaultOrHistoricVersion()?this.currentVersion&&"name"in this.currentVersion?this.state="public"===this.currentVersionInfo?.access?"lock-none":"lock-read":this.state="lock-read":await this.versionManagementService.startReading(this.currentVersion)&&(this.state="lock-read"))}_isDefaultOrHistoricVersion(e=this.currentVersion){return!(e&&"name"in e)||e.name===this.versionManagementService.defaultVersionIdentifier.name}};e([o()],c.prototype,"versionManagementService",void 0),e([o()],c.prototype,"featureServiceUrl",void 0),e([o()],c.prototype,"url",void 0),e([o()],c.prototype,"currentVersion",void 0),e([o()],c.prototype,"currentVersionInfo",void 0),e([o()],c.prototype,"versionInfos",void 0),e([o()],c.prototype,"versionableItems",void 0),e([o()],c.prototype,"usePersistentReadSessions",void 0),e([o()],c.prototype,"state",void 0),e([o({readOnly:!0})],c.prototype,"defaultVersionIdentifier",null),e([o({readOnly:!0})],c.prototype,"isDefault",null),c=e([a("esri.versionManagement.VersioningState")],c);const u=c;export{u 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 r from"../../../../core/Logger.js";import{e as t}from"../../../../chunks/earcut.js";import{set as n}from"../../../../core/libs/gl-matrix-2/math/vec2.js";import{create as o}from"../../../../core/libs/gl-matrix-2/factories/vec2f64.js";import{convertFromNestedArray as s,convertFromPolygon as i}from"../../../../layers/graphics/featureConversionUtils.js";import c from"../../../../layers/graphics/OptimizedGeometry.js";import{i1616to32 as a}from"./number.js";import{BufferObject as f}from"../../../webgl/BufferObject.js";import{PrimitiveType as m,Usage as h,DataType as u}from"../../../webgl/enums.js";const l=r=>{switch(r.BYTES_PER_ELEMENT){case 1:return u.UNSIGNED_BYTE;case 2:return u.UNSIGNED_SHORT;case 4:return u.UNSIGNED_INT;default:throw new e("Cannot get DataType of array")}},y=(e,r,t,n)=>{let o=0;for(let s=1;s<t;s++){const t=e[2*(r+s-1)],n=e[2*(r+s-1)+1];o+=(e[2*(r+s)]-t)*(e[2*(r+s)+1]+n)}return n?o>0:o<0},g=({coords:e,lengths:r},n)=>{const o=[];for(let s=0,i=0;s<r.length;i+=r[s],s+=1){const c=i,a=[];for(;s<r.length-1&&y(e,i+r[s],r[s+1],n);s+=1,i+=r[s])a.push(i+r[s]-c);const f=e.slice(2*c,2*(i+r[s])),m=t(f,a,2);for(const e of m)o.push(e+c)}return o};class p{constructor(e,r,t,n=!1){this._cache={},this.vertices=e,this.indices=r,this.primitiveType=t,this.isMapSpace=n}static fromPath(e){const r=s(new c,e.path,!1,!1),t=r.coords,n=new Uint32Array(g(r,!0)),o=new Uint32Array(t.length/2);for(let s=0;s<o.length;s++)o[s]=a(Math.floor(t[2*s]),Math.floor(t[2*s+1]));return new p({geometry:o},n,m.TRIANGLES)}static fromGeometry(t,n){const o=n.geometry?.type;switch(o){case"polygon":return p.fromPolygon(t,n.geometry);case"extent":return p.fromMapExtent(t,n.geometry);default:return r.getLogger("esri.views.2d.engine.webgl.Mesh2D").error(new e("mapview-bad-type",`Unable to create a mesh from type ${o}`,n)),p.fromScreenExtent({xmin:0,ymin:0,xmax:1,ymax:1})}}static fromPolygon(e,r){const t=i(new c,r,!1,!1),s=t.coords,f=new Uint32Array(g(t,!1)),h=new Uint32Array(s.length/2),u=o(),l=o();for(let o=0;o<h.length;o++)n(u,s[2*o],s[2*o+1]),e.toScreen(l,u),h[o]=a(Math.floor(l[0]),Math.floor(l[1]));return new p({geometry:h},f,m.TRIANGLES,!0)}static fromScreenExtent({xmin:e,xmax:r,ymin:t,ymax:n}){const o={geometry:new Uint32Array([a(e,t),a(r,t),a(e,n),a(e,n),a(r,t),a(r,n)])},s=new Uint32Array([0,1,2,3,4,5]);return new p(o,s,m.TRIANGLES)}static fromMapExtent(e,r){const[t,n]=e.toScreen([0,0],[r.xmin,r.ymin]),[o,s]=e.toScreen([0,0],[r.xmax,r.ymax]),i={geometry:new Uint32Array([a(t,n),a(o,n),a(t,s),a(t,s),a(o,n),a(o,s)])},c=new Uint32Array([0,1,2,3,4,5]);return new p(i,c,m.TRIANGLES)}destroy(){null!=this._cache.indexBuffer&&this._cache.indexBuffer.dispose(),this._cache.vertexBuffers?.forEach((e=>e?.dispose())),this._cache.indexBuffer=this._cache.vertexBuffers=null}get elementType(){return l(this.indices)}getIndexBuffer(e,r=h.STATIC_DRAW){return this._cache.indexBuffer??=f.createIndex(e,r,this.indices),this._cache.indexBuffer}getVertexBuffers(e,r=h.STATIC_DRAW){return this._cache.vertexBuffers??=new Map(Object.keys(this.vertices).reduce(((t,n)=>(t.push([n,f.createVertex(e,r,this.vertices[n])]),t)),new Array)),this._cache.vertexBuffers}}export{p as default};
5
+ import e from"../../../../core/Error.js";import r from"../../../../core/Logger.js";import{e as t}from"../../../../chunks/earcut.js";import{set as n}from"../../../../core/libs/gl-matrix-2/math/vec2.js";import{create as o}from"../../../../core/libs/gl-matrix-2/factories/vec2f64.js";import{convertFromNestedArray as s,convertFromPolygon as i}from"../../../../layers/graphics/featureConversionUtils.js";import c from"../../../../layers/graphics/OptimizedGeometry.js";import{i1616to32 as a}from"./number.js";import{BufferObject as f}from"../../../webgl/BufferObject.js";import{PrimitiveType as m,Usage as h,DataType as u}from"../../../webgl/enums.js";const l=r=>{switch(r.BYTES_PER_ELEMENT){case 1:return u.UNSIGNED_BYTE;case 2:return u.UNSIGNED_SHORT;case 4:return u.UNSIGNED_INT;default:throw new e("internal","Cannot get DataType of array")}},y=(e,r,t,n)=>{let o=0;for(let s=1;s<t;s++){const t=e[2*(r+s-1)],n=e[2*(r+s-1)+1];o+=(e[2*(r+s)]-t)*(e[2*(r+s)+1]+n)}return n?o>0:o<0},g=({coords:e,lengths:r},n)=>{const o=[];for(let s=0,i=0;s<r.length;i+=r[s],s+=1){const c=i,a=[];for(;s<r.length-1&&y(e,i+r[s],r[s+1],n);s+=1,i+=r[s])a.push(i+r[s]-c);const f=e.slice(2*c,2*(i+r[s])),m=t(f,a,2);for(const e of m)o.push(e+c)}return o};class p{constructor(e,r,t,n=!1){this._cache={},this.vertices=e,this.indices=r,this.primitiveType=t,this.isMapSpace=n}static fromPath(e){const r=s(new c,e.path,!1,!1),t=r.coords,n=new Uint32Array(g(r,!0)),o=new Uint32Array(t.length/2);for(let s=0;s<o.length;s++)o[s]=a(Math.floor(t[2*s]),Math.floor(t[2*s+1]));return new p({geometry:o},n,m.TRIANGLES)}static fromGeometry(t,n){const o=n.geometry?.type;switch(o){case"polygon":return p.fromPolygon(t,n.geometry);case"extent":return p.fromMapExtent(t,n.geometry);default:return r.getLogger("esri.views.2d.engine.webgl.Mesh2D").error(new e("mapview-bad-type",`Unable to create a mesh from type ${o}`,n)),p.fromScreenExtent({xmin:0,ymin:0,xmax:1,ymax:1})}}static fromPolygon(e,r){const t=i(new c,r,!1,!1),s=t.coords,f=new Uint32Array(g(t,!1)),h=new Uint32Array(s.length/2),u=o(),l=o();for(let o=0;o<h.length;o++)n(u,s[2*o],s[2*o+1]),e.toScreen(l,u),h[o]=a(Math.floor(l[0]),Math.floor(l[1]));return new p({geometry:h},f,m.TRIANGLES,!0)}static fromScreenExtent({xmin:e,xmax:r,ymin:t,ymax:n}){const o={geometry:new Uint32Array([a(e,t),a(r,t),a(e,n),a(e,n),a(r,t),a(r,n)])},s=new Uint32Array([0,1,2,3,4,5]);return new p(o,s,m.TRIANGLES)}static fromMapExtent(e,r){const[t,n]=e.toScreen([0,0],[r.xmin,r.ymin]),[o,s]=e.toScreen([0,0],[r.xmax,r.ymax]),i={geometry:new Uint32Array([a(t,n),a(o,n),a(t,s),a(t,s),a(o,n),a(o,s)])},c=new Uint32Array([0,1,2,3,4,5]);return new p(i,c,m.TRIANGLES)}destroy(){null!=this._cache.indexBuffer&&this._cache.indexBuffer.dispose(),this._cache.vertexBuffers?.forEach((e=>e?.dispose())),this._cache.indexBuffer=this._cache.vertexBuffers=null}get elementType(){return l(this.indices)}getIndexBuffer(e,r=h.STATIC_DRAW){return this._cache.indexBuffer??=f.createIndex(e,r,this.indices),this._cache.indexBuffer}getVertexBuffers(e,r=h.STATIC_DRAW){return this._cache.vertexBuffers??=new Map(Object.keys(this.vertices).reduce(((t,n)=>(t.push([n,f.createVertex(e,r,this.vertices[n])]),t)),new Array)),this._cache.vertexBuffers}}export{p 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{tileSize as p}from"../../engine/webgl/definitions.js";import{PipelineConnectionHandlers as h}from"./PipelineConnectionHandlers.js";import l from"./Processor.js";import{FeatureSource as g}from"./sources/FeatureSource.js";import{FeatureTileSubscription as _}from"./sources/FeatureTileSubscription.js";import{Tile as b}from"./support/Tile.js";import f from"../../tiling/TileInfoView.js";class m{constructor(e){this.inner=e,this.resolver=r()}}class q{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 f(i),this._source=new g(e.service,this._aggregateAdapter,this._subscriptions,s,this._cachedObjectIds),this._processor=new l(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 h(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),h=2*t,l=Math.ceil(p/h);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()/h,i=u.readYForDisplay()/h,a=Math.floor(s),p=Math.floor(i);if(a<0||p<0||a>=l||p>=l)continue;const g=((.5+a-s)*h)**2+((.5+p-i)*h)**2;if(g>d)continue;const _=t*(c*(1-g/d)**2);n[p+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 b(this._tileInfoView,t),i=new _(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._processor.requiresInvalidation()&&(t=!0),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{q 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{tileSize as p}from"../../engine/webgl/definitions.js";import{PipelineConnectionHandlers as h}from"./PipelineConnectionHandlers.js";import l from"./Processor.js";import{FeatureSource as g}from"./sources/FeatureSource.js";import{FeatureTileSubscription as _}from"./sources/FeatureTileSubscription.js";import{Tile as f}from"./support/Tile.js";import b from"../../tiling/TileInfoView.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 b(i),this._source=new g(e.service,this._aggregateAdapter,this._subscriptions,s,this._cachedObjectIds),this._processor=new l(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 h(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("featurelayer","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),h=2*t,l=Math.ceil(p/h);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()/h,i=u.readYForDisplay()/h,a=Math.floor(s),p=Math.floor(i);if(a<0||p<0||a>=l||p>=l)continue;const g=((.5+a-s)*h)**2+((.5+p-i)*h)**2;if(g>d)continue;const _=t*(c*(1-g/d)**2);n[p+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 _(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._processor.requiresInvalidation()&&(t=!0),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 e from"../../../../../core/Error.js";import{getEffectiveFeatureReduction as t}from"./featureReductionUtils.js";import{getServiceGeometryType as r}from"./geometryUtils.js";import{getFeatureReductionDeconflictionEnabled as o,getLayerDeconflictionEnabled as i,createLabelVVEvaluator as n}from"./labelingUtils.js";import{createFeatureSourceSchema as l}from"../schema/SourceSchema.js";import{createSimpleProcessorSchema as s}from"../schema/processor/SimpleProcessorSchema.js";import{isRendererSupported as a}from"../support/rendererUtils.js";function u(t){if(!("openPorts"in t))throw new e("source-not-supported")}class p{constructor(e){this.layer=e}getLabelingDeconflictionInfo(e){const r=this.layer,l=o(r,e)??i(r),s=t(r,e),a=[...r.labelingInfo||[],...s?.labelingInfo||[]];return[{vvEvaluators:{0:n(r.renderer)},deconflictionEnabled:l,labelingInfo:a}]}async createServiceOptions(e){const t=this.layer,{capabilities:o,objectIdField:i}=t,n=t.fieldsIndex.toJSON(),l=r(t),s=t.timeInfo?.toJSON(),a=t.spatialReference.toJSON();u(t.source);const p=await t.source.openPorts(),c=i,d=e.spatialReference.toJSON();return{type:"memory",source:p,orderByFields:c,outSpatialReference:d,metadata:{fieldsIndex:n,geometryType:l,objectIdField:i,timeInfo:s,spatialReference:a,outSpatialReference:d,subtypes:null,subtypeField:null,globalIdField:null,typeIdField:null,types:null,timeReferenceUnknownClient:"datesInUnknownTimezone"in t?t.datesInUnknownTimezone:null,dateFieldsTimeZone:"dateFieldsTimeZone"in t?t.dateFieldsTimeZone:null},queryMetadata:{maxRecordCount:o.query.maxRecordCount,supportsCompactGeometry:o.query.supportsCompactGeometry,supportsDefaultSpatialReference:o.query.supportsDefaultSpatialReference,supportsFormatPBF:o.query.supportsFormatPBF,supportsMaxRecordCountFactor:o.query.supportsMaxRecordCountFactor,supportsQuantization:o.query.supportsQuantization,lastEditDate:null,snapshotInfo:null}}}createSourceSchema(e,t){const{definitionExpression:r,timeExtent:o,displayFilterInfo:i}=this.layer;return l({customParameters:null,definitionExpression:r,displayFilterInfo:i,timeExtent:o},e,t,null)}createProcessorSchema(e,r,o){const{fields:i,renderer:n,geometryType:l,labelingInfo:a,labelsVisible:u,orderBy:p,objectIdField:c}=this.layer,d="trackInfo"in this.layer?this.layer.trackInfo:null,y={fields:i.map((e=>e.toJSON())),renderer:n?.clone(),layerId:this.layer.id,featureReduction:t(this.layer,r),geometryType:l,labelingInfo:a,labelsVisible:u,objectIdField:c,orderBy:p??"default",trackInfo:d};return s(e,r,y,o)}get hasRequiredSupport(){return a(this.layer.renderer)}get timeOptions(){return this.layer}getUpdateHashProperties(e){return[()=>this.layer.definitionExpression,()=>this.layer.displayFilterInfo,()=>this.layer.orderBy,()=>"outFields"in this.layer?this.layer.outFields:null,()=>this.layer.renderer,()=>this.layer.labelsVisible?this.layer.labelingInfo:null,()=>t(this.layer,e),()=>"trackInfo"in this.layer?this.layer.trackInfo:null]}}export{p as InMemoryLayerAdapter};
5
+ import e from"../../../../../core/Error.js";import{getEffectiveFeatureReduction as t}from"./featureReductionUtils.js";import{getServiceGeometryType as r}from"./geometryUtils.js";import{getFeatureReductionDeconflictionEnabled as o,getLayerDeconflictionEnabled as i,createLabelVVEvaluator as n}from"./labelingUtils.js";import{createFeatureSourceSchema as l}from"../schema/SourceSchema.js";import{createSimpleProcessorSchema as s}from"../schema/processor/SimpleProcessorSchema.js";import{isRendererSupported as a}from"../support/rendererUtils.js";function u(t){if(!("openPorts"in t))throw new e("featurelayer","source-not-supported")}class p{constructor(e){this.layer=e}getLabelingDeconflictionInfo(e){const r=this.layer,l=o(r,e)??i(r),s=t(r,e),a=[...r.labelingInfo||[],...s?.labelingInfo||[]];return[{vvEvaluators:{0:n(r.renderer)},deconflictionEnabled:l,labelingInfo:a}]}async createServiceOptions(e){const t=this.layer,{capabilities:o,objectIdField:i}=t,n=t.fieldsIndex.toJSON(),l=r(t),s=t.timeInfo?.toJSON(),a=t.spatialReference.toJSON();u(t.source);const p=await t.source.openPorts(),c=i,d=e.spatialReference.toJSON();return{type:"memory",source:p,orderByFields:c,outSpatialReference:d,metadata:{fieldsIndex:n,geometryType:l,objectIdField:i,timeInfo:s,spatialReference:a,outSpatialReference:d,subtypes:null,subtypeField:null,globalIdField:null,typeIdField:null,types:null,timeReferenceUnknownClient:"datesInUnknownTimezone"in t?t.datesInUnknownTimezone:null,dateFieldsTimeZone:"dateFieldsTimeZone"in t?t.dateFieldsTimeZone:null},queryMetadata:{maxRecordCount:o.query.maxRecordCount,supportsCompactGeometry:o.query.supportsCompactGeometry,supportsDefaultSpatialReference:o.query.supportsDefaultSpatialReference,supportsFormatPBF:o.query.supportsFormatPBF,supportsMaxRecordCountFactor:o.query.supportsMaxRecordCountFactor,supportsQuantization:o.query.supportsQuantization,lastEditDate:null,snapshotInfo:null}}}createSourceSchema(e,t){const{definitionExpression:r,timeExtent:o,displayFilterInfo:i}=this.layer;return l({customParameters:null,definitionExpression:r,displayFilterInfo:i,timeExtent:o},e,t,null)}createProcessorSchema(e,r,o){const{fields:i,renderer:n,geometryType:l,labelingInfo:a,labelsVisible:u,orderBy:p,objectIdField:c}=this.layer,d="trackInfo"in this.layer?this.layer.trackInfo:null,y={fields:i.map((e=>e.toJSON())),renderer:n?.clone(),layerId:this.layer.id,featureReduction:t(this.layer,r),geometryType:l,labelingInfo:a,labelsVisible:u,objectIdField:c,orderBy:p??"default",trackInfo:d};return s(e,r,y,o)}get hasRequiredSupport(){return a(this.layer.renderer)}get timeOptions(){return this.layer}getUpdateHashProperties(e){return[()=>this.layer.definitionExpression,()=>this.layer.displayFilterInfo,()=>this.layer.orderBy,()=>"outFields"in this.layer?this.layer.outFields:null,()=>this.layer.renderer,()=>this.layer.labelsVisible?this.layer.labelingInfo:null,()=>t(this.layer,e),()=>"trackInfo"in this.layer?this.layer.trackInfo:null]}}export{p as InMemoryLayerAdapter};
@@ -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 t from"../../../../../layers/support/FieldsIndex.js";import{parseField as s,parseTransform as r}from"../../../../../rest/query/operations/pbfFeatureServiceParser.js";const n=268435455;class o{constructor(){this.hasFeatures=!1,this.exceededTransferLimit=!1,this.fieldCount=0,this.featureCount=0,this.objectIdFieldIndex=0,this.vertexCount=0,this.offsets={attributes:new Array,geometry:new Array},this.centroid=new Array}}function a(a,i,c=!1){const f=1,d=3,u=9,g=12,l=13,p=15,h=a.asUnsafe(),b=h.pos(),w=new o;let m=0,y=0;const k=1,x=2,I=4,L=3;let A=null,F=null,C=null,S=!1;const j=[];for(;h.next();)switch(h.tag()){case f:A=h.getString();break;case d:F=h.getString();break;case g:C=h.processMessage(r);break;case u:if(w.exceededTransferLimit=h.getBool(),w.exceededTransferLimit){w.offsets.geometry=c?new Float64Array(8e3):new Int32Array(8e3),w.centroid=c?new Float64Array(16e3):new Int32Array(16e3);for(let e=0;e<w.centroid.length;e++)w.centroid[e]=n}break;case l:{const e=h.processMessage(s);e.index=m++,j.push(e);break}case p:{const e=h.getLength(),t=h.pos()+e;if(!w.exceededTransferLimit){const e=w.offsets.geometry,t=w.centroid;e.push(0),t.push(n),t.push(n)}!S&&w.exceededTransferLimit&&(S=!0,w.offsets.attributes=c?new Float64Array(8e3*m):new Uint32Array(8e3*m));let s=y*m;for(;h.pos()<t&&h.next();)switch(h.tag()){case k:{if(S)w.offsets.attributes[s++]=h.pos();else{w.offsets.attributes.push(h.pos())}const e=h.getLength();h.skipLen(e);break}case x:if(i){const e=h.getLength(),t=h.pos()+e;for(;h.pos()<t&&h.next();)switch(h.tag()){case L:{h.getUInt32();const e=h.getSInt64(),t=h.getSInt64();w.centroid[2*y]=e,w.centroid[2*y+1]=t;break}default:h.skip()}}else{w.offsets.geometry[y]=h.pos();const e=h.getLength();w.vertexCount+=e,h.skipLen(e)}break;case I:{const e=h.getLength(),t=h.pos()+e;for(;h.pos()<t&&h.next();)switch(h.tag()){case L:{h.getUInt32();const e=h.getSInt64(),t=h.getSInt64();w.centroid[2*y]=e,w.centroid[2*y+1]=t;break}default:h.skip()}break}default:h.skip()}y++,w.hasFeatures=!0;break}default:h.skip()}const U=A||F;if(!U)throw new e("FeatureSet has no objectId or globalId field name");return w.fields=new t(j),w.featureCount=y,w.fieldCount=m,w.objectIdFieldIndex=w.fields.get(U)?.index,w.transform=C,w.displayIds=new Uint32Array(w.featureCount),w.groupIds=new Uint16Array(w.featureCount),h.move(b),w}export{o as FeatureSetHeader,a as parseHeader};
5
+ import e from"../../../../../core/Error.js";import t from"../../../../../layers/support/FieldsIndex.js";import{parseField as s,parseTransform as r}from"../../../../../rest/query/operations/pbfFeatureServiceParser.js";const n=268435455;class o{constructor(){this.hasFeatures=!1,this.exceededTransferLimit=!1,this.fieldCount=0,this.featureCount=0,this.objectIdFieldIndex=0,this.vertexCount=0,this.offsets={attributes:new Array,geometry:new Array},this.centroid=new Array}}function a(a,i,c=!1){const f=1,d=3,u=9,g=12,l=13,p=15,h=a.asUnsafe(),b=h.pos(),w=new o;let y=0,m=0;const k=1,x=2,I=4,L=3;let A=null,F=null,C=null,S=!1;const j=[];for(;h.next();)switch(h.tag()){case f:A=h.getString();break;case d:F=h.getString();break;case g:C=h.processMessage(r);break;case u:if(w.exceededTransferLimit=h.getBool(),w.exceededTransferLimit){w.offsets.geometry=c?new Float64Array(8e3):new Int32Array(8e3),w.centroid=c?new Float64Array(16e3):new Int32Array(16e3);for(let e=0;e<w.centroid.length;e++)w.centroid[e]=n}break;case l:{const e=h.processMessage(s);e.index=y++,j.push(e);break}case p:{const e=h.getLength(),t=h.pos()+e;if(!w.exceededTransferLimit){const e=w.offsets.geometry,t=w.centroid;e.push(0),t.push(n),t.push(n)}!S&&w.exceededTransferLimit&&(S=!0,w.offsets.attributes=c?new Float64Array(8e3*y):new Uint32Array(8e3*y));let s=m*y;for(;h.pos()<t&&h.next();)switch(h.tag()){case k:{if(S)w.offsets.attributes[s++]=h.pos();else{w.offsets.attributes.push(h.pos())}const e=h.getLength();h.skipLen(e);break}case x:if(i){const e=h.getLength(),t=h.pos()+e;for(;h.pos()<t&&h.next();)switch(h.tag()){case L:{h.getUInt32();const e=h.getSInt64(),t=h.getSInt64();w.centroid[2*m]=e,w.centroid[2*m+1]=t;break}default:h.skip()}}else{w.offsets.geometry[m]=h.pos();const e=h.getLength();w.vertexCount+=e,h.skipLen(e)}break;case I:{const e=h.getLength(),t=h.pos()+e;for(;h.pos()<t&&h.next();)switch(h.tag()){case L:{h.getUInt32();const e=h.getSInt64(),t=h.getSInt64();w.centroid[2*m]=e,w.centroid[2*m+1]=t;break}default:h.skip()}break}default:h.skip()}m++,w.hasFeatures=!0;break}default:h.skip()}const U=A||F;if(!U)throw new e("featurelayer","FeatureSet has no objectId or globalId field name");return w.fields=new t(j),w.featureCount=m,w.fieldCount=y,w.objectIdFieldIndex=w.fields.get(U)?.index,w.transform=C,w.displayIds=new Uint32Array(w.featureCount),w.groupIds=new Uint16Array(w.featureCount),h.move(b),w}export{o as FeatureSetHeader,a as parseHeader};