@arcgis/core 5.1.0-next.118 → 5.1.0-next.119

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 (141) hide show
  1. package/analysis/SliceAnalysis.d.ts +1 -1
  2. package/assets/components/assets/icon/orientedImageryFullSuperimpose16.json +1 -0
  3. package/assets/components/assets/icon/orientedImageryFullSuperimpose24.json +1 -0
  4. package/assets/components/assets/icon/orientedImageryFullSuperimpose32.json +1 -0
  5. package/assets/components/assets/icon/orientedImageryHalfSuperimpose16.json +1 -0
  6. package/assets/components/assets/icon/orientedImageryHalfSuperimpose24.json +1 -0
  7. package/assets/components/assets/icon/orientedImageryHalfSuperimpose32.json +1 -0
  8. package/assets/components/assets/icon/orientedImagerySceneOnly16.json +1 -0
  9. package/assets/components/assets/icon/orientedImagerySceneOnly24.json +1 -0
  10. package/assets/components/assets/icon/orientedImagerySceneOnly32.json +1 -0
  11. package/assets/components/assets/icon/parquetFeatureLayer16.json +1 -0
  12. package/assets/components/assets/icon/parquetFeatureLayer24.json +1 -0
  13. package/assets/components/assets/icon/parquetFeatureLayer32.json +1 -0
  14. package/assets/esri/core/workers/RemoteClient.js +1 -1
  15. package/assets/esri/core/workers/chunks/{1dd1af5978e40295fb62.js → 017f50aae082d6664cfe.js} +1 -1
  16. package/assets/esri/core/workers/chunks/{325bfac7cfa28a6d568f.js → 0e774f14ba274832f390.js} +1 -1
  17. package/assets/esri/core/workers/chunks/{66eea3f203c3ce98ec67.js → 13940660fe88cfc0d9f3.js} +1 -1
  18. package/assets/esri/core/workers/chunks/14c6419568d8a7a15cd6.js +1 -0
  19. package/assets/esri/core/workers/chunks/153dc2a0b08a0e44a881.js +1 -0
  20. package/assets/esri/core/workers/chunks/1bebf7202d5f94b15674.js +1 -0
  21. package/assets/esri/core/workers/chunks/{46ca0d8573450095fcca.js → 290163964ec7f05f96d6.js} +1 -1
  22. package/assets/esri/core/workers/chunks/{9250615c78f8570a9cda.js → 29615df388a0df022d8c.js} +1 -1
  23. package/assets/esri/core/workers/chunks/2a2981f0987dd1eaa75a.js +1 -0
  24. package/assets/esri/core/workers/chunks/{8b8b63be961eb73250a0.js → 32323b0e0fcecd8f640e.js} +1 -1
  25. package/assets/esri/core/workers/chunks/3a6678ee9990d7e83e15.js +1 -0
  26. package/assets/esri/core/workers/chunks/3eabc8af82512dc12355.js +1 -0
  27. package/assets/esri/core/workers/chunks/428561df7ba6f02e2d80.js +1 -0
  28. package/assets/esri/core/workers/chunks/{299b4eecd0288348c971.js → 45323491f9005629c602.js} +1 -1
  29. package/assets/esri/core/workers/chunks/{557e39e5156b313597f9.js → 4e314e7cf477ad54541d.js} +1 -1
  30. package/assets/esri/core/workers/chunks/{7c292f7b181f3b93352b.js → 4ef53455c8bc6efee80e.js} +1 -1
  31. package/assets/esri/core/workers/chunks/{86443e47ad99e555753a.js → 53246ce4d2c7d2d2fc62.js} +1 -1
  32. package/assets/esri/core/workers/chunks/5500dc39e11a0057ae16.js +1 -0
  33. package/assets/esri/core/workers/chunks/578ab400e1998d0bcd62.js +1 -0
  34. package/assets/esri/core/workers/chunks/{69a1cbf0af059548f96a.js → 64daa2a714e59d22bbd4.js} +1 -1
  35. package/assets/esri/core/workers/chunks/{06ab868cced9c607840c.js → 65a9a94162985b54571e.js} +1 -1
  36. package/assets/esri/core/workers/chunks/6af77529c977d034d287.js +1 -0
  37. package/assets/esri/core/workers/chunks/{1f3a676e7a4eae5ad566.js → 767ea5b455b3823afd09.js} +1 -1
  38. package/assets/esri/core/workers/chunks/{466c250537415f12eb59.js → 798e8bf3a7ad83d810e3.js} +1 -1
  39. package/assets/esri/core/workers/chunks/{ed939fd5d3827a3f70e0.js → 81e3bd1a0634ddc2b833.js} +1 -1
  40. package/assets/esri/core/workers/chunks/8244b74e9c3a30d8d2f6.js +2 -0
  41. package/assets/esri/core/workers/chunks/{caf80facb0322be054ab.js → 8cc6a00c2991ce3fde67.js} +1 -1
  42. package/assets/esri/core/workers/chunks/a806ac351ef5da04c250.js +1 -0
  43. package/assets/esri/core/workers/chunks/{558606a1af22e4a0d536.js → aca6ff64495580d873d1.js} +1 -1
  44. package/assets/esri/core/workers/chunks/ad488985824fbb830ed6.js +1 -0
  45. package/assets/esri/core/workers/chunks/adac8583750783b9c599.js +2 -0
  46. package/assets/esri/core/workers/chunks/{74bdf678a4fb6befdac7.js → bfc2b75e4f7531dbd37f.js} +1 -1
  47. package/assets/esri/core/workers/chunks/c216cd5d6b5d4fe4bab3.js +2 -0
  48. package/assets/esri/core/workers/chunks/{d5e6ae5fd004bed33578.js → c528b04d42dffbb491da.js} +31 -21
  49. package/assets/esri/core/workers/chunks/ca4245414d8ecd217f9d.js +1 -0
  50. package/assets/esri/core/workers/chunks/{7a3b05e25de2ff150f38.js → cc479daacd2cf715baa8.js} +1 -1
  51. package/assets/esri/core/workers/chunks/{1252da05832e576d4def.js → d1ccc5f2d8892328ab01.js} +2 -2
  52. package/assets/esri/core/workers/chunks/{3aebbed6d4fd1b993a35.js → d2dd6e252d5fecfc0f83.js} +1 -1
  53. package/assets/esri/core/workers/chunks/{107550695896806c2306.js → d41fe5a248221c0a1714.js} +1 -1
  54. package/assets/esri/core/workers/chunks/d561dc933d8fe1672d85.js +1 -0
  55. package/assets/esri/core/workers/chunks/daec09750a5a70cdb0f0.js +2 -0
  56. package/assets/esri/core/workers/chunks/de41c3f5b34c49175833.js +1 -0
  57. package/assets/esri/core/workers/chunks/e9dcc3e9dbafe9bbed84.js +1 -0
  58. package/assets/esri/core/workers/chunks/{ce77a0e074c17dfd02bd.js → f142f892e9e896052ddc.js} +1 -1
  59. package/assets/esri/themes/dark/main.css +1 -1
  60. package/assets/esri/themes/light/main.css +1 -1
  61. package/assets/esri/themes/light/view.css +1 -1
  62. package/chunks/GlobalIllumination.glsl.js +20 -19
  63. package/chunks/GlobalIlluminationBlur.glsl.js +15 -12
  64. package/chunks/GlobalIlluminationUpscale.glsl.js +4 -3
  65. package/config.js +1 -1
  66. package/kernel.js +1 -1
  67. package/layers/FeatureLayer.d.ts +1 -1
  68. package/layers/FeatureLayer.js +1 -1
  69. package/layers/MediaLayer.d.ts +1 -1
  70. package/layers/SceneLayer.d.ts +2 -2
  71. package/layers/VectorTileLayer.d.ts +2 -2
  72. package/layers/mixins/BlendLayer.d.ts +1 -1
  73. package/layers/save/featureLayerUtils.js +1 -1
  74. package/layers/support/FeatureFilter.d.ts +1 -1
  75. package/layers/support/FeatureReductionSelection.d.ts +1 -1
  76. package/layers/support/arcgisLayers.js +1 -1
  77. package/layers/support/fetchService.js +1 -1
  78. package/layers/support/layerUtils.js +1 -1
  79. package/layers/support/layersLoader.js +1 -1
  80. package/package.json +2 -2
  81. package/renderers/FlowRenderer.d.ts +2 -2
  82. package/smartMapping/raster/renderers/flow.d.ts +2 -2
  83. package/smartMapping/symbology/flow.d.ts +2 -2
  84. package/smartMapping/symbology/types.d.ts +2 -2
  85. package/support/revision.js +1 -1
  86. package/symbols/support/Symbol3DVerticalOffset.d.ts +2 -2
  87. package/views/2d/layers/FeatureLikeLayerView2D.js +1 -1
  88. package/views/2d/layers/features/FeaturePipelineWorker.js +1 -1
  89. package/views/2d/layers/features/Processor.js +1 -1
  90. package/views/2d/layers/features/processor/AProcessorStrategy.js +1 -1
  91. package/views/2d/layers/features/processor/ClusterStrategy.js +1 -1
  92. package/views/2d/layers/features/sources/strategies/ParquetTileLoadStrategy.js +1 -1
  93. package/views/2d/layers/features/support/FeatureSetReaderParquet.js +1 -1
  94. package/views/3d/analysis/ViewshedAnalysisView3D.js +1 -1
  95. package/views/3d/layers/GaussianSplatLayerView3D.js +1 -1
  96. package/views/3d/webgl-engine/effects/globalIllumination/GlobalIllumination.glsl.js +1 -1
  97. package/views/3d/webgl-engine/effects/globalIllumination/GlobalIlluminationBlur.glsl.js +1 -1
  98. package/views/3d/webgl-engine/effects/globalIllumination/GlobalIlluminationColorQuantization.glsl.js +7 -0
  99. package/views/3d/webgl-engine/effects/globalIllumination/GlobalIlluminationUpscale.glsl.js +1 -1
  100. package/views/SceneView.d.ts +1 -1
  101. package/views/interactive/sketch/SketchTooltipOptions.d.ts +1 -1
  102. package/views/interactive/snapping/SnappingOptions.d.ts +3 -3
  103. package/widgets/BatchAttributeForm/BatchAttributeFormViewModel.d.ts +29 -1
  104. package/widgets/BatchAttributeForm/BatchAttributeFormViewModel.js +1 -1
  105. package/widgets/BatchAttributeForm/inputs/FieldInput.d.ts +0 -5
  106. package/widgets/BatchAttributeForm/inputs/FieldInput.js +1 -1
  107. package/widgets/BatchAttributeForm/inputs/support/inputUtils.js +1 -1
  108. package/widgets/BatchAttributeForm/types.d.ts +67 -0
  109. package/widgets/BatchAttributeForm.js +1 -1
  110. package/widgets/Daylight.d.ts +1 -1
  111. package/widgets/Editor.d.ts +8 -8
  112. package/widgets/ElevationProfile.d.ts +1 -1
  113. package/widgets/FeatureTable/ActionColumn.d.ts +1 -1
  114. package/widgets/Sketch/SketchViewModel.d.ts +38 -38
  115. package/widgets/Sketch.d.ts +39 -39
  116. package/widgets/Slice.d.ts +1 -1
  117. package/widgets/UtilityNetworkTrace.d.ts +1 -1
  118. package/widgets/UtilityNetworkValidateTopology.d.ts +1 -1
  119. package/assets/esri/core/workers/chunks/18ebf1d3ed05c8057f7d.js +0 -1
  120. package/assets/esri/core/workers/chunks/2e8db0f05df2e38a14e1.js +0 -2
  121. package/assets/esri/core/workers/chunks/2f2cb40378399d7f5575.js +0 -1
  122. package/assets/esri/core/workers/chunks/413d2fa54508e6f42c74.js +0 -1
  123. package/assets/esri/core/workers/chunks/55b765c72d13b3b911f9.js +0 -1
  124. package/assets/esri/core/workers/chunks/70d8f5bdb452cee41536.js +0 -2
  125. package/assets/esri/core/workers/chunks/74fd31d5404a061bfaed.js +0 -1
  126. package/assets/esri/core/workers/chunks/7623778e065bc78ccbba.js +0 -1
  127. package/assets/esri/core/workers/chunks/7e4571162b86dad86d23.js +0 -2
  128. package/assets/esri/core/workers/chunks/9dd3ecee6c1c9c06edc4.js +0 -1
  129. package/assets/esri/core/workers/chunks/aea439d4c2308f88b295.js +0 -1
  130. package/assets/esri/core/workers/chunks/b8dda9e55caba0e2b4c2.js +0 -1
  131. package/assets/esri/core/workers/chunks/be70809bc6c718ade7df.js +0 -1
  132. package/assets/esri/core/workers/chunks/bfc988edc63ca28e5397.js +0 -2
  133. package/assets/esri/core/workers/chunks/d598d08dbf2796742e8c.js +0 -1
  134. package/assets/esri/core/workers/chunks/e078ff1f79d82d27497e.js +0 -1
  135. package/assets/esri/core/workers/chunks/f3f685c937e9d7f5d4db.js +0 -1
  136. package/assets/esri/core/workers/chunks/fa3138dd8139008b430d.js +0 -1
  137. /package/assets/esri/core/workers/chunks/{2e8db0f05df2e38a14e1.js.LICENSE.txt → 8244b74e9c3a30d8d2f6.js.LICENSE.txt} +0 -0
  138. /package/assets/esri/core/workers/chunks/{7e4571162b86dad86d23.js.LICENSE.txt → adac8583750783b9c599.js.LICENSE.txt} +0 -0
  139. /package/assets/esri/core/workers/chunks/{70d8f5bdb452cee41536.js.LICENSE.txt → c216cd5d6b5d4fe4bab3.js.LICENSE.txt} +0 -0
  140. /package/assets/esri/core/workers/chunks/{1252da05832e576d4def.js.LICENSE.txt → d1ccc5f2d8892328ab01.js.LICENSE.txt} +0 -0
  141. /package/assets/esri/core/workers/chunks/{bfc988edc63ca28e5397.js.LICENSE.txt → daec09750a5a70cdb0f0.js.LICENSE.txt} +0 -0
@@ -1,2 +1,2 @@
1
1
  /* COPYRIGHT Esri - https://js.arcgis.com/5.1/LICENSE.txt */
2
- import e from"../../core/Error.js";import{urlToObject as r,getFilename as a}from"../../core/urlUtils.js";import{parse as t,parseNonStandardSublayerUrl as s}from"./arcgisLayerUrl.js";import{findAssociatedFeatureService as n}from"./associatedFeatureServiceUtils.js";import{getLayerModuleType as l,fetchFeatureService as o}from"./fetchService.js";import{layersLoaderMap as i}from"./layersLoader.js";import{getPreferredUrl as c,sceneServiceLayerTypeToClassName as u}from"./layerUtils.js";import{requestServiceJSON as y}from"../../request/serviceJSON.js";const f="KHR_gaussian_splatting",p={FeatureLayer:!0,SceneLayer:!0,VideoLayer:!0};async function m(e){const{properties:r,url:a}=e,t={...r,url:a},s=await S(a,r?.customParameters),{Constructor:n,layerId:l,sourceJSON:o,parsedUrl:i,layers:c,tables:u}=s;if(c.length+u.length===0)return null!=l&&(t.layerId=l),null!=o&&(t.sourceJSON=o),new n(t);const y=new(0,(await import("../GroupLayer.js")).default)({title:i.title});return await w(y,s,t),y}function d(e,r){return e?e.find(({id:e})=>e===r):null}function v(e,r,a,t,s){const n={...s,layerId:r};return null!=e&&(n.url=e),null!=a&&(n.sourceJSON=a),"sublayerTitleMode"in t.prototype&&(n.sublayerTitleMode="service-name"),new t(n)}async function w(e,r,a){const t=r.sublayerConstructorProvider;for(const{id:s,serverUrl:n}of r.layers){const l=d(r.sublayerInfos,s),o=v(n,s,l,(l&&t?.(l))??r.Constructor,a);e.add(o)}if(r.tables.length){const t=await g("FeatureLayer");r.tables.forEach(({id:s,serverUrl:n})=>{const l=v(n,s,d(r.tableInfos,s),t,a);e.tables.add(l)})}}async function S(r,a){let s=t(r);if(null==s&&(s=await b(r,a)),null==s)throw new e("arcgis-layers:url-mismatch","The url '${url}' is not a valid arcgis resource",{url:r});const{serverType:n,sublayer:o}=s;let i;const f={FeatureServer:"FeatureLayer",KnowledgeGraphServer:"KnowledgeGraphLayer",StreamServer:"StreamLayer",VectorTileServer:"VectorTileLayer",VideoServer:"VideoLayer"},m="FeatureServer"===n,d="SceneServer"===n,v={parsedUrl:s,Constructor:null,layerId:m||d?o??void 0:void 0,layers:[],tables:[]};switch(n){case"MapServer":if(null!=o){const{type:t}=await y(r,{customParameters:a});switch(i="FeatureLayer",t){case"Catalog Layer":i="CatalogLayer";break;case"Catalog Dynamic Group Layer":throw new e("arcgis-layers:unsupported",`fromUrl() not supported for "${t}" layers`)}}else{i=await P(r,a)?"TileLayer":"MapImageLayer"}break;case"ImageServer":{const e=await y(r,{customParameters:a}),{tileInfo:t,cacheType:s}=e;i=t?"LERC"!==t?.format?.toUpperCase()||s&&"elevation"!==s.toLowerCase()?"ImageryTileLayer":"ElevationLayer":"ImageryLayer";break}case"SceneServer":{const e=await y(s.url.path,{customParameters:a});if(i="SceneLayer",e){const r=e?.layers;if("Voxel"===e?.layerType)i="VoxelLayer";else if(r?.length){const e=r[0]?.layerType;null!=e&&null!=u[e]&&(i=u[e])}}break}case"3DTilesServer":i=await U(r,a)?"GaussianSplatLayer":"IntegratedMesh3DTilesLayer";break;case"FeatureServer":if(i="FeatureLayer",null!=o){const e=await y(r,{customParameters:a});v.sourceJSON=e,v.preferredUrl=c(),i=l(e.type)}break;default:i=f[n]}if(p[i]&&null==o){const e=await I(r,n,a);m&&(v.preferredUrl=e.preferredUrl,v.sublayerInfos=e.layerInfos,v.tableInfos=e.tableInfos);if(1!==e.layers.length+e.tables.length)v.layers=e.layers,v.tables=e.tables,m&&e.layerInfos?.length&&(v.sublayerConstructorProvider=await O(e.layerInfos));else if(m||d){const r=e.layerInfos?.[0]??e.tableInfos?.[0];if(v.layerId=e.layers[0]?.id??e.tables[0]?.id,v.sourceJSON=r,m){const e=r?.type;i=l(e)}}}return v.Constructor=await g(i),v}async function b(e,t){const n=await y(e,{customParameters:t});let l=null,o=null;const i=n.type;if("Feature Layer"===i||"Table"===i?(l="FeatureServer",o=n.id??null):"indexedVector"===i?l="VectorTileServer":n.hasOwnProperty("mapName")?l="MapServer":n.hasOwnProperty("bandCount")&&n.hasOwnProperty("pixelSizeX")?l="ImageServer":n.hasOwnProperty("maxRecordCount")&&n.hasOwnProperty("allowGeometryUpdates")?l="FeatureServer":n.hasOwnProperty("streamUrls")?l="StreamServer":h(n)?(l="SceneServer",o=n.id):n.hasOwnProperty("layers")&&h(n.layers?.[0])&&(l="SceneServer"),!l)return null;const c=null!=o?s(e):null;return{title:null!=c&&n.name||a(e),serverType:l,sublayer:o,url:{path:null!=c?c.serviceUrl:r(e).path}}}function h(e){return null!=e&&e.hasOwnProperty("store")&&e.hasOwnProperty("id")&&"number"==typeof e.id}async function I(e,r,a){let t,s,n,l=!1;switch(r){case"FeatureServer":{const r=await o(e,{customParameters:a});n=c(e,{preferredHost:r.preferredHost}),l=!!r.layersJSON,t=r.layersJSON||r.serviceJSON;break}case"SceneServer":{const r=await L(e,a);t=r.serviceInfo,s=r.tableServerUrl;break}default:t=await y(e,{customParameters:a})}const i=t?.layers,u=t?.tables;return{preferredUrl:n,layers:i?.map(e=>({id:e.id})).reverse()||[],tables:u?.map(e=>({serverUrl:s,id:e.id})).reverse()||[],layerInfos:l?i:[],tableInfos:l?u:[]}}async function L(e,r){const a=await y(e,{customParameters:r}),t=a.layers?.[0];if(!t)return{serviceInfo:a};try{const{serverUrl:t}=await n(e),s=await y(t,{customParameters:r}).catch(()=>null);return s&&(a.tables=s.tables),{serviceInfo:a,tableServerUrl:t}}catch{return{serviceInfo:a}}}async function g(e){return(0,i[e])()}async function P(e,r){return(await y(e,{customParameters:r})).tileInfo}async function U(e,r){const a=await y(e,{customParameters:r}),t=a.extensions?.["3DTILES_content_gltf"];return!0===t?.extensionsRequired?.includes(f)}async function O(e){if(!e.length)return;const r=new Set,a=[];for(const{type:n}of e)r.has(n)||(r.add(n),a.push(g(l(n))));const t=await Promise.all(a),s=new Map;return Array.from(r).forEach((e,r)=>{s.set(e,t[r])}),e=>s.get(e.type)}export{m as fromUrl};
2
+ import e from"../../core/Error.js";import{urlToObject as r,getFilename as a}from"../../core/urlUtils.js";import{parse as t,parseNonStandardSublayerUrl as s}from"./arcgisLayerUrl.js";import{findAssociatedFeatureService as n}from"./associatedFeatureServiceUtils.js";import{getLayerModuleType as o,fetchFeatureService as l}from"./fetchService.js";import{layersLoaderMap as i}from"./layersLoader.js";import{getPreferredUrl as c,sceneServiceLayerTypeToClassName as u}from"./layerUtils.js";import{requestServiceJSON as y}from"../../request/serviceJSON.js";const f="KHR_gaussian_splatting",m={FeatureLayer:!0,SceneLayer:!0,VideoLayer:!0};async function p(e){const{properties:r,url:a}=e,t={...r,url:a},s=await w(a,r?.customParameters),{Constructor:n,layerId:o,sourceJSON:l,parsedUrl:i,layers:c,tables:u}=s;if(c.length+u.length===0)return null!=o&&(t.layerId=o),null!=l&&(t.sourceJSON=l),new n(t);const y=new(0,(await import("../GroupLayer.js")).default)({title:i.title});return await v(y,s,t),y}function d(e,r){return e?e.find(({id:e})=>e===r):null}function S(e,r,a,t,s){const n={...s,layerId:r};return null!=e&&(n.url=e),null!=a&&(n.sourceJSON=a),"sublayerTitleMode"in t.prototype&&(n.sublayerTitleMode="service-name"),new t(n)}async function v(e,r,a){const t=r.sublayerConstructorProvider;for(const{id:s,serverUrl:n}of r.layers){const o=d(r.sublayerInfos,s),l=S(n,s,o,(o&&t?.(o))??r.Constructor,a);e.add(l)}if(r.tables.length){const t=await g("FeatureLayer");r.tables.forEach(({id:s,serverUrl:n})=>{const o=S(n,s,d(r.tableInfos,s),t,a);e.tables.add(o)})}}async function w(r,a){let s=t(r);if(null==s&&(s=await b(r,a)),null==s)throw new e("arcgis-layers:url-mismatch","The url '${url}' is not a valid arcgis resource",{url:r});const{serverType:n,sublayer:l}=s;let i;const f={FeatureServer:"FeatureLayer",KnowledgeGraphServer:"KnowledgeGraphLayer",StreamServer:"StreamLayer",VectorTileServer:"VectorTileLayer",VideoServer:"VideoLayer"},p="FeatureServer"===n,d="SceneServer"===n,S={parsedUrl:s,Constructor:null,layerId:p||d?l??void 0:void 0,layers:[],tables:[]};switch(n){case"MapServer":if(null!=l){const{type:t}=await y(r,{customParameters:a});switch(i="FeatureLayer",t){case"Annotation Layer":i="AnnotationLayer";break;case"Dimension Layer":i="DimensionFeatureLayer";break;case"Catalog Layer":i="CatalogLayer";break;case"Annotation SubLayer":case"Catalog Dynamic Group Layer":throw new e("arcgis-layers:unsupported",`fromUrl() not supported for "${t}" layers`)}}else{i=await P(r,a)?"TileLayer":"MapImageLayer"}break;case"ImageServer":{const e=await y(r,{customParameters:a}),{tileInfo:t,cacheType:s}=e;i=t?"LERC"!==t?.format?.toUpperCase()||s&&"elevation"!==s.toLowerCase()?"ImageryTileLayer":"ElevationLayer":"ImageryLayer";break}case"SceneServer":{const e=await y(s.url.path,{customParameters:a});if(i="SceneLayer",e){const r=e?.layers;if("Voxel"===e?.layerType)i="VoxelLayer";else if(r?.length){const e=r[0]?.layerType;null!=e&&null!=u[e]&&(i=u[e])}}break}case"3DTilesServer":i=await U(r,a)?"GaussianSplatLayer":"IntegratedMesh3DTilesLayer";break;case"FeatureServer":if(i="FeatureLayer",null!=l){const e=await y(r,{customParameters:a});S.sourceJSON=e,S.preferredUrl=c(),i=o(e.type)}break;default:i=f[n]}if(m[i]&&null==l){const e=await L(r,n,a);p&&(S.preferredUrl=e.preferredUrl,S.sublayerInfos=e.layerInfos,S.tableInfos=e.tableInfos);if(1!==e.layers.length+e.tables.length)S.layers=e.layers,S.tables=e.tables,p&&e.layerInfos?.length&&(S.sublayerConstructorProvider=await O(e.layerInfos));else if(p||d){const r=e.layerInfos?.[0]??e.tableInfos?.[0];if(S.layerId=e.layers[0]?.id??e.tables[0]?.id,S.sourceJSON=r,p){const e=r?.type;i=o(e)}}}return S.Constructor=await g(i),S}async function b(e,t){const n=await y(e,{customParameters:t});let o=null,l=null;const i=n.type;if("Feature Layer"===i||"Table"===i?(o="FeatureServer",l=n.id??null):"indexedVector"===i?o="VectorTileServer":n.hasOwnProperty("mapName")?o="MapServer":n.hasOwnProperty("bandCount")&&n.hasOwnProperty("pixelSizeX")?o="ImageServer":n.hasOwnProperty("maxRecordCount")&&n.hasOwnProperty("allowGeometryUpdates")?o="FeatureServer":n.hasOwnProperty("streamUrls")?o="StreamServer":h(n)?(o="SceneServer",l=n.id):n.hasOwnProperty("layers")&&h(n.layers?.[0])&&(o="SceneServer"),!o)return null;const c=null!=l?s(e):null;return{title:null!=c&&n.name||a(e),serverType:o,sublayer:l,url:{path:null!=c?c.serviceUrl:r(e).path}}}function h(e){return null!=e&&e.hasOwnProperty("store")&&e.hasOwnProperty("id")&&"number"==typeof e.id}async function L(e,r,a){let t,s,n,o=!1;switch(r){case"FeatureServer":{const r=await l(e,{customParameters:a});n=c(e,{preferredHost:r.preferredHost}),o=!!r.layersJSON,t=r.layersJSON||r.serviceJSON;break}case"SceneServer":{const r=await I(e,a);t=r.serviceInfo,s=r.tableServerUrl;break}default:t=await y(e,{customParameters:a})}const i=t?.layers,u=t?.tables;return{preferredUrl:n,layers:i?.map(e=>({id:e.id})).reverse()||[],tables:u?.map(e=>({serverUrl:s,id:e.id})).reverse()||[],layerInfos:o?i:[],tableInfos:o?u:[]}}async function I(e,r){const a=await y(e,{customParameters:r}),t=a.layers?.[0];if(!t)return{serviceInfo:a};try{const{serverUrl:t}=await n(e),s=await y(t,{customParameters:r}).catch(()=>null);return s&&(a.tables=s.tables),{serviceInfo:a,tableServerUrl:t}}catch{return{serviceInfo:a}}}async function g(e){return(0,i[e])()}async function P(e,r){return(await y(e,{customParameters:r})).tileInfo}async function U(e,r){const a=await y(e,{customParameters:r}),t=a.extensions?.["3DTILES_content_gltf"];return!0===t?.extensionsRequired?.includes(f)}async function O(e){if(!e.length)return;const r=new Set,a=[];for(const{type:n}of e)r.has(n)||(r.add(n),a.push(g(o(n))));const t=await Promise.all(a),s=new Map;return Array.from(r).forEach((e,r)=>{s.set(e,t[r])}),e=>s.get(e.type)}export{p as fromUrl};
@@ -1,2 +1,2 @@
1
1
  /* COPYRIGHT Esri - https://js.arcgis.com/5.1/LICENSE.txt */
2
- import{getPreferredHost as e,getPreferredUrl as r}from"./layerUtils.js";import{requestServiceJSON as a}from"../../request/serviceJSON.js";const t=new Set(["Catalog Layer","Feature Layer","Oriented Imagery Layer"]);async function n(t,n){const{loadContext:s,...c}=n||{},o=s?await s.fetchServiceMetadata(t,c):await a(t,c),y=e();l(o),i(o);const u={serviceJSON:o,preferredHost:y};if((o.currentVersion??0)<10.5)return u;const f=`${r()??t}/layers`,L=s?await s.fetchServiceMetadata(f,c):await a(f,c);return l(L),i(L),u.layersJSON={layers:L.layers,tables:L.tables},u}function s(e){const{type:r}=e;return!!r&&t.has(r)}function c(e){return"Table"===e.type}function i(e){e.layers=e.layers?.filter(s),e.tables=e.tables?.filter(c)}function o(e){e.type||="Feature Layer"}function y(e){e.type||="Table"}function l(e){e.layers?.forEach(o),e.tables?.forEach(y)}function u(e){switch(e){case"Feature Layer":case"Table":return"FeatureLayer";case"Oriented Imagery Layer":return"OrientedImageryLayer";case"Catalog Layer":return"CatalogLayer"}return"FeatureLayer"}export{n as fetchFeatureService,u as getLayerModuleType};
2
+ import{getPreferredHost as e,getPreferredUrl as r}from"./layerUtils.js";import{requestServiceJSON as a}from"../../request/serviceJSON.js";const t=new Set(["Catalog Layer","Feature Layer","Oriented Imagery Layer","Dimension Layer","Annotation Layer"]);async function n(t,n){const{loadContext:s,...i}=n||{},y=s?await s.fetchServiceMetadata(t,i):await a(t,i),c=e();u(y),o(y);const l={serviceJSON:y,preferredHost:c};if((y.currentVersion??0)<10.5)return l;const f=`${r()??t}/layers`,L=s?await s.fetchServiceMetadata(f,i):await a(f,i);return u(L),o(L),l.layersJSON={layers:L.layers,tables:L.tables},l}function s(e){const{type:r}=e;return!!r&&t.has(r)}function i(e){return"Table"===e.type}function o(e){e.layers=e.layers?.filter(s),e.tables=e.tables?.filter(i)}function y(e){e.type||="Feature Layer"}function c(e){e.type||="Table"}function u(e){e.layers?.forEach(y),e.tables?.forEach(c)}function l(e){switch(e){case"Feature Layer":case"Table":return"FeatureLayer";case"Oriented Imagery Layer":return"OrientedImageryLayer";case"Catalog Layer":return"CatalogLayer";case"Dimension Layer":return"DimensionFeatureLayer";case"Annotation Layer":return"AnnotationLayer"}return"FeatureLayer"}export{n as fetchFeatureService,l as getLayerModuleType};
@@ -1,2 +1,2 @@
1
1
  /* COPYRIGHT Esri - https://js.arcgis.com/5.1/LICENSE.txt */
2
- import{id as e}from"../../kernel.js";import t from"../../request.js";import n from"../../core/Collection.js";import"../../core/urlUtils.js";import{isLayerFromCatalog as r}from"../catalog/catalogUtils.js";import{isBasemap as u}from"../../support/userTypeGuards/isBasemap.js";function i(e,t){return null!=e&&"object"==typeof e&&"type"in e&&e.type===t}function o(e){return w(e)||m(e)}function s(e){return i(e,"feature")}function c(e){return"gaussian-splat"===e?.type}function a(e){return i(e,"oriented-imagery")}function l(e){return i(e,"catalog-footprint")}function f(e){return i(e,"graphics")}function p(e){return i(e,"map-image")}function y(e){return i(e,"map-notes")&&"sublayers"in e}function g(e){return i(e,"knowledge-graph")&&"layers"in e}function d(e){return i(e,"knowledge-graph-sublayer")}function b(e){return i(e,"link-chart")&&"layers"in e}function m(e){return i(e,"scene")}function h(e){return i(e,"subtype-group")&&"sublayers"in e}function v(e){return"subtype-sublayer"===e?.type}function w(e){const t=e?.type;return"imagery-tile"===t||"tile"===t||"open-street-map"===t||"vector-tile"===t||"web-tile"===t||"wmts"===t}function j(e){const t=e?.type;return"base-tile"===t||"tile"===t||"elevation"===t||"imagery-tile"===t||"base-elevation"===t||"open-street-map"===t||"wcs"===t||"web-tile"===t||"wmts"===t||"vector-tile"===t}function L(e){return"group"===e?.type}function S(e){const t=e.parent;return L(t)&&t.tables.includes(e)}const E={Point:"SceneLayer","3DObject":"SceneLayer",IntegratedMesh:"IntegratedMeshLayer",PointCloud:"PointCloudLayer",Building:"BuildingSceneLayer"};function k(e){const t=e?.type;return"building-scene"===t||"integrated-mesh"===t||"point-cloud"===t||"scene"===t}function C(e){return"integrated-mesh"===e.type||"integrated-mesh-3dtiles"===e.type}function x(e){return"integrated-mesh-3dtiles"===e.type}function R(e){return"voxel"===e?.type}function T(e){return"imagery-tile"===e?.type}function U(e,t){return u(e?.parent)&&e.parent[t].includes(e)}function M(e){return U(e,"baseLayers")}function O(e){return U(e,"referenceLayers")}function P(e){return"feature"===e?.type&&!e.url&&"memory"===e.source?.type}function B(e){const t=e?.type;return("feature"===t||"subtype-group"===t||"oriented-imagery"===t)&&"feature-layer"===e?.source?.type}function I(e){return"feature"===e?.type&&"feature-layer"===e.source?.type}function q(e){return null!=e&&"object"==typeof e&&"featureReduction"in e}function F(e){return l(e)||s(e)&&I(e)||a(e)||v(e)}function J(e){const t=e?.type;return"binning"===t||"cluster"===t}function N(e,t){if(!F(e))return;const n=t?.graphic,r="featureReduction"in e?e.featureReduction:null;if(n){if(n.isAggregate){const e=n.origin;return e&&("featureReductionProvider"in e&&r)?J(r)?r:null:void 0}return e}return t?.checkFeatureReduction&&r?J(r)?r:null:e}function A(e){const t=/[:;]/,n=[];let r=!1;if(e&&(e.forEach((e,u)=>{n.push([u,e]),!r&&t.test(e)&&(r=!0)}),n.length>0)){let e;if(r){const t={};n.forEach(e=>{t[e[0]]=e[1]}),e=JSON.stringify(t)}else{const t=[];n.forEach(e=>{t.push(e[0]+":"+e[1])}),e=t.join(";")}return e}return null}function D(e){if(!e)return;const t=[];return e.forEach((e,n)=>{t.push('"'+n+'":'+JSON.stringify(e))}),t.length?"{"+t.join(",")+"}":void 0}function G(e){if(e.activeLayer){const t=e.activeLayer.tileMatrixSet;if(t)return t;const n=e.activeLayer.tileMatrixSets;if(n)return n}return null}async function V(n,r){const u=e?.findServerInfo(n);if(null!=u?.currentVersion)return u.owningSystemUrl||null;const i=n.toLowerCase().indexOf("/rest/services");if(-1===i)return null;const o=`${n.slice(0,i)}/rest/info`,s=null!=r?r.signal:null,{data:c}=await t(o,{query:{f:"json"},responseType:"json",signal:s});return c?.owningSystemUrl||null}function $(e){if(!("capabilities"in e))return!1;switch(e.type){case"catalog":case"catalog-footprint":case"csv":case"feature":case"geojson":case"imagery":case"knowledge-graph-sublayer":case"ogc-feature":case"oriented-imagery":case"scene":case"sublayer":case"subtype-group":case"subtype-sublayer":case"wfs":return!0;default:return!1}}function z(e){return null!=e&&"object"==typeof e&&"isTable"in e&&!!e.isTable}function H(e){return $(e)?"effectiveCapabilities"in e?e.effectiveCapabilities:e.capabilities:null}function K(e){if(!("editingEnabled"in e))return!1;switch(e.type){case"csv":case"feature":case"geojson":case"oriented-imagery":case"scene":case"subtype-group":case"subtype-sublayer":case"knowledge-graph-sublayer":return!0;default:return!1}}function Q(e){return!!K(e)&&("effectiveEditingEnabled"in e?e.effectiveEditingEnabled:e.editingEnabled)}function W(e){if(!e)return[];return("subtypes"in e?e.subtypes:h(e.parent)?e.parent.subtypes:[])??[]}function X(e){return("imagery"===e.type||"imagery-tile"===e.type)&&"flow"===e.renderer?.type}function Y(e){const t=new n;for(const n of e.allLayers.concat(e.allTables))r(n)||S(n)||("charts"in n&&t.push(n),"subtype-group"===n.type&&t.push(...n.sublayers));return t}function Z(e,t){return null}function _(e){return null}function ee(e){return!e||"Feature Service"===e.type&&!e.sourceUrl}function te(e,t){if(!t||!ee(e))return;const n=Z(e.url);n&&(e.url=n)}export{te as applyPreferredHostToPortalItem,Q as getEffectiveEditingEnabled,H as getEffectiveLayerCapabilities,N as getFieldConfigurationsContainer,Y as getLayersWithChartSupport,V as getOwningPortalUrl,_ as getPreferredHost,Z as getPreferredUrl,W as getSubtypesFromLayer,G as getTileMaxtrixSetFromActiveLayer,M as isBaseLayer,o as isBasemap3DSupportedLayer,w as isBasemapSupportedTiledLayer,P as isFeatureCollectionLayer,s as isFeatureLayer,I as isFeatureServiceLayer,c as isGaussianSplatLayer,f as isGraphicsLayer,L as isGroupLayer,T as isImageryTileLayer,x as isIntegratedMesh3DTilesLayer,C as isIntegratedMeshLayer,g as isKnowledgeGraphLayer,d as isKnowledgeGraphSublayer,$ as isLayerWithFeatureCapabilities,B as isLayerWithFeatureLayerSource,X as isLayerWithFlowRenderer,b as isLinkChartLayer,p as isMapImageLayer,y as isMapNotesLayer,ee as isPreferredUrlApplicable,O as isReferenceLayer,m as isSceneLayer,k as isSceneServiceLayer,h as isSubtypeGroupLayer,v as isSubtypeSublayer,z as isTable,j as isTiledLayer,R as isVoxelLayer,E as sceneServiceLayerTypeToClassName,A as serializeLayerDefinitions,D as serializeTimeOptions,q as supportsFeatureReduction,F as supportsFieldConfiguration};
2
+ import{id as e}from"../../kernel.js";import t from"../../request.js";import n from"../../core/Collection.js";import"../../core/urlUtils.js";import{isLayerFromCatalog as r}from"../catalog/catalogUtils.js";import{isBasemap as i}from"../../support/userTypeGuards/isBasemap.js";function u(e,t){return null!=e&&"object"==typeof e&&"type"in e&&e.type===t}function o(e){return w(e)||m(e)}function s(e){return u(e,"feature")}function c(e){return"gaussian-splat"===e?.type}function a(e){return u(e,"oriented-imagery")}function l(e){return u(e,"catalog-footprint")}function f(e){return u(e,"graphics")}function p(e){return u(e,"map-image")}function y(e){return u(e,"map-notes")&&"sublayers"in e}function g(e){return u(e,"knowledge-graph")&&"layers"in e}function d(e){return u(e,"knowledge-graph-sublayer")}function b(e){return u(e,"link-chart")&&"layers"in e}function m(e){return u(e,"scene")}function h(e){return u(e,"subtype-group")&&"sublayers"in e}function v(e){return"subtype-sublayer"===e?.type}function w(e){const t=e?.type;return"imagery-tile"===t||"tile"===t||"open-street-map"===t||"vector-tile"===t||"web-tile"===t||"wmts"===t}function j(e){const t=e?.type;return"base-tile"===t||"tile"===t||"elevation"===t||"imagery-tile"===t||"base-elevation"===t||"open-street-map"===t||"wcs"===t||"web-tile"===t||"wmts"===t||"vector-tile"===t}function L(e){return"group"===e?.type}function S(e){const t=e.parent;return L(t)&&t.tables.includes(e)}const E={Point:"SceneLayer","3DObject":"SceneLayer",IntegratedMesh:"IntegratedMeshLayer",PointCloud:"PointCloudLayer",Building:"BuildingSceneLayer"};function k(e){const t=e?.type;return"building-scene"===t||"integrated-mesh"===t||"point-cloud"===t||"scene"===t}function C(e){return"integrated-mesh"===e.type||"integrated-mesh-3dtiles"===e.type}function x(e){return"integrated-mesh-3dtiles"===e.type}function R(e){return"voxel"===e?.type}function T(e){return"imagery-tile"===e?.type}function U(e,t){return i(e?.parent)&&e.parent[t].includes(e)}function M(e){return U(e,"baseLayers")}function O(e){return U(e,"referenceLayers")}function P(e){return"feature"===e?.type&&!e.url&&"memory"===e.source?.type}function B(e){const t=e?.type;return("feature"===t||"subtype-group"===t||"oriented-imagery"===t)&&"feature-layer"===e?.source?.type}function I(e){return"feature"===e?.type&&"feature-layer"===e.source?.type}function q(e){return null!=e&&"object"==typeof e&&"featureReduction"in e}function F(e){return l(e)||s(e)&&I(e)||a(e)||v(e)}function J(e){const t=e?.type;return"binning"===t||"cluster"===t}function N(e,t){if(!F(e))return;const n=t?.graphic,r="featureReduction"in e?e.featureReduction:null;if(n){if(n.isAggregate){const e=n.origin;return e&&("featureReductionProvider"in e&&r)?J(r)?r:null:void 0}return e}return t?.checkFeatureReduction&&r?J(r)?r:null:e}function A(e){const t=/[:;]/,n=[];let r=!1;if(e&&(e.forEach((e,i)=>{n.push([i,e]),!r&&t.test(e)&&(r=!0)}),n.length>0)){let e;if(r){const t={};n.forEach(e=>{t[e[0]]=e[1]}),e=JSON.stringify(t)}else{const t=[];n.forEach(e=>{t.push(e[0]+":"+e[1])}),e=t.join(";")}return e}return null}function D(e){if(!e)return;const t=[];return e.forEach((e,n)=>{t.push('"'+n+'":'+JSON.stringify(e))}),t.length?"{"+t.join(",")+"}":void 0}function G(e){if(e.activeLayer){const t=e.activeLayer.tileMatrixSet;if(t)return t;const n=e.activeLayer.tileMatrixSets;if(n)return n}return null}async function V(n,r){const i=e?.findServerInfo(n);if(null!=i?.currentVersion)return i.owningSystemUrl||null;const u=n.toLowerCase().indexOf("/rest/services");if(-1===u)return null;const o=`${n.slice(0,u)}/rest/info`,s=null!=r?r.signal:null,{data:c}=await t(o,{query:{f:"json"},responseType:"json",signal:s});return c?.owningSystemUrl||null}function $(e){if(!("capabilities"in e))return!1;switch(e.type){case"catalog":case"catalog-footprint":case"csv":case"feature":case"geojson":case"imagery":case"knowledge-graph-sublayer":case"ogc-feature":case"oriented-imagery":case"scene":case"sublayer":case"subtype-group":case"subtype-sublayer":case"wfs":return!0;default:return!1}}function z(e){return null!=e&&"object"==typeof e&&"isTable"in e&&!!e.isTable}function H(e){return $(e)?"effectiveCapabilities"in e?e.effectiveCapabilities:e.capabilities:null}function K(e){if(!("editingEnabled"in e))return!1;switch(e.type){case"csv":case"feature":case"geojson":case"oriented-imagery":case"scene":case"subtype-group":case"subtype-sublayer":case"knowledge-graph-sublayer":return!0;default:return!1}}function Q(e){return!!K(e)&&("effectiveEditingEnabled"in e?e.effectiveEditingEnabled:e.editingEnabled)}function W(e){if(!e)return[];return("subtypes"in e?e.subtypes:h(e.parent)?e.parent.subtypes:[])??[]}function X(e){return("imagery"===e.type||"imagery-tile"===e.type)&&"flow"===e.renderer?.type}function Y(e){const t=new n;for(const n of e.allLayers.concat(e.allTables))r(n)||S(n)||"annotation"===n.type||"dimension-feature"===n.type||("charts"in n&&t.push(n),"subtype-group"===n.type&&t.push(...n.sublayers));return t}function Z(e,t){return null}function _(e){return null}function ee(e){return!e||"Feature Service"===e.type&&!e.sourceUrl}function te(e,t){if(!t||!ee(e))return;const n=Z(e.url);n&&(e.url=n)}export{te as applyPreferredHostToPortalItem,Q as getEffectiveEditingEnabled,H as getEffectiveLayerCapabilities,N as getFieldConfigurationsContainer,Y as getLayersWithChartSupport,V as getOwningPortalUrl,_ as getPreferredHost,Z as getPreferredUrl,W as getSubtypesFromLayer,G as getTileMaxtrixSetFromActiveLayer,M as isBaseLayer,o as isBasemap3DSupportedLayer,w as isBasemapSupportedTiledLayer,P as isFeatureCollectionLayer,s as isFeatureLayer,I as isFeatureServiceLayer,c as isGaussianSplatLayer,f as isGraphicsLayer,L as isGroupLayer,T as isImageryTileLayer,x as isIntegratedMesh3DTilesLayer,C as isIntegratedMeshLayer,g as isKnowledgeGraphLayer,d as isKnowledgeGraphSublayer,$ as isLayerWithFeatureCapabilities,B as isLayerWithFeatureLayerSource,X as isLayerWithFlowRenderer,b as isLinkChartLayer,p as isMapImageLayer,y as isMapNotesLayer,ee as isPreferredUrlApplicable,O as isReferenceLayer,m as isSceneLayer,k as isSceneServiceLayer,h as isSubtypeGroupLayer,v as isSubtypeSublayer,z as isTable,j as isTiledLayer,R as isVoxelLayer,E as sceneServiceLayerTypeToClassName,A as serializeLayerDefinitions,D as serializeTimeOptions,q as supportsFeatureReduction,F as supportsFieldConfiguration};
@@ -1,2 +1,2 @@
1
1
  /* COPYRIGHT Esri - https://js.arcgis.com/5.1/LICENSE.txt */
2
- const a={BingMapsLayer:async()=>(await import("../BingMapsLayer.js")).default,BuildingSceneLayer:async()=>(await import("../BuildingSceneLayer.js")).default,CSVLayer:async()=>(await import("../CSVLayer.js")).default,CatalogLayer:async()=>(await import("../CatalogLayer.js")).default,DimensionLayer:async()=>(await import("../DimensionLayer.js")).default,ElevationLayer:async()=>(await import("../ElevationLayer.js")).default,FeatureLayer:async()=>(await import("../FeatureLayer.js")).default,GaussianSplatLayer:async()=>(await import("../GaussianSplatLayer.js")).default,GeoJSONLayer:async()=>(await import("../GeoJSONLayer.js")).default,GeoRSSLayer:async()=>(await import("../GeoRSSLayer.js")).default,GroupLayer:async()=>(await import("../GroupLayer.js")).default,ImageryLayer:async()=>(await import("../ImageryLayer.js")).default,ImageryTileLayer:async()=>(await import("../ImageryTileLayer.js")).default,IntegratedMesh3DTilesLayer:async()=>(await import("../IntegratedMesh3DTilesLayer.js")).default,IntegratedMeshLayer:async()=>(await import("../IntegratedMeshLayer.js")).default,KMLLayer:async()=>(await import("../KMLLayer.js")).default,KnowledgeGraphLayer:async()=>(await import("../KnowledgeGraphLayer.js")).default,LineOfSightLayer:async()=>(await import("../LineOfSightLayer.js")).default,LinkChartLayer:async()=>(await import("../LinkChartLayer.js")).default,MapImageLayer:async()=>(await import("../MapImageLayer.js")).default,MapNotesLayer:async()=>(await import("../MapNotesLayer.js")).default,MediaLayer:async()=>(await import("../MediaLayer.js")).default,OGCFeatureLayer:async()=>(await import("../OGCFeatureLayer.js")).default,OpenStreetMapLayer:async()=>(await import("../OpenStreetMapLayer.js")).default,OrientedImageryLayer:async()=>(await import("../OrientedImageryLayer.js")).default,ParquetLayer:async()=>(await import("../ParquetLayer.js")).default,PointCloudLayer:async()=>(await import("../PointCloudLayer.js")).default,RouteLayer:async()=>(await import("../RouteLayer.js")).default,SceneLayer:async()=>(await import("../SceneLayer.js")).default,StreamLayer:async()=>(await import("../StreamLayer.js")).default,SubtypeGroupLayer:async()=>(await import("../SubtypeGroupLayer.js")).default,TileLayer:async()=>(await import("../TileLayer.js")).default,UnknownLayer:async()=>(await import("../UnknownLayer.js")).default,UnsupportedLayer:async()=>(await import("../UnsupportedLayer.js")).default,VectorTileLayer:async()=>(await import("../VectorTileLayer.js")).default,VideoLayer:async()=>(await import("../VideoLayer.js")).default,ViewshedLayer:async()=>(await import("../ViewshedLayer.js")).default,VoxelLayer:async()=>(await import("../VoxelLayer.js")).default,WCSLayer:async()=>(await import("../WCSLayer.js")).default,WFSLayer:async()=>(await import("../WFSLayer.js")).default,WMSLayer:async()=>(await import("../WMSLayer.js")).default,WMTSLayer:async()=>(await import("../WMTSLayer.js")).default,WebTileLayer:async()=>(await import("../WebTileLayer.js")).default};export{a as layersLoaderMap};
2
+ const a={AnnotationLayer:async()=>(await import("../AnnotationLayer.js")).default,BingMapsLayer:async()=>(await import("../BingMapsLayer.js")).default,BuildingSceneLayer:async()=>(await import("../BuildingSceneLayer.js")).default,CSVLayer:async()=>(await import("../CSVLayer.js")).default,CatalogLayer:async()=>(await import("../CatalogLayer.js")).default,DimensionFeatureLayer:async()=>(await import("../DimensionFeatureLayer.js")).default,DimensionLayer:async()=>(await import("../DimensionLayer.js")).default,ElevationLayer:async()=>(await import("../ElevationLayer.js")).default,FeatureLayer:async()=>(await import("../FeatureLayer.js")).default,GaussianSplatLayer:async()=>(await import("../GaussianSplatLayer.js")).default,GeoJSONLayer:async()=>(await import("../GeoJSONLayer.js")).default,GeoRSSLayer:async()=>(await import("../GeoRSSLayer.js")).default,GroupLayer:async()=>(await import("../GroupLayer.js")).default,ImageryLayer:async()=>(await import("../ImageryLayer.js")).default,ImageryTileLayer:async()=>(await import("../ImageryTileLayer.js")).default,IntegratedMesh3DTilesLayer:async()=>(await import("../IntegratedMesh3DTilesLayer.js")).default,IntegratedMeshLayer:async()=>(await import("../IntegratedMeshLayer.js")).default,KMLLayer:async()=>(await import("../KMLLayer.js")).default,KnowledgeGraphLayer:async()=>(await import("../KnowledgeGraphLayer.js")).default,LineOfSightLayer:async()=>(await import("../LineOfSightLayer.js")).default,LinkChartLayer:async()=>(await import("../LinkChartLayer.js")).default,MapImageLayer:async()=>(await import("../MapImageLayer.js")).default,MapNotesLayer:async()=>(await import("../MapNotesLayer.js")).default,MediaLayer:async()=>(await import("../MediaLayer.js")).default,OGCFeatureLayer:async()=>(await import("../OGCFeatureLayer.js")).default,OpenStreetMapLayer:async()=>(await import("../OpenStreetMapLayer.js")).default,OrientedImageryLayer:async()=>(await import("../OrientedImageryLayer.js")).default,ParquetLayer:async()=>(await import("../ParquetLayer.js")).default,PointCloudLayer:async()=>(await import("../PointCloudLayer.js")).default,RouteLayer:async()=>(await import("../RouteLayer.js")).default,SceneLayer:async()=>(await import("../SceneLayer.js")).default,StreamLayer:async()=>(await import("../StreamLayer.js")).default,SubtypeGroupLayer:async()=>(await import("../SubtypeGroupLayer.js")).default,TileLayer:async()=>(await import("../TileLayer.js")).default,UnknownLayer:async()=>(await import("../UnknownLayer.js")).default,UnsupportedLayer:async()=>(await import("../UnsupportedLayer.js")).default,VectorTileLayer:async()=>(await import("../VectorTileLayer.js")).default,VideoLayer:async()=>(await import("../VideoLayer.js")).default,ViewshedLayer:async()=>(await import("../ViewshedLayer.js")).default,VoxelLayer:async()=>(await import("../VoxelLayer.js")).default,WCSLayer:async()=>(await import("../WCSLayer.js")).default,WFSLayer:async()=>(await import("../WFSLayer.js")).default,WMSLayer:async()=>(await import("../WMSLayer.js")).default,WMTSLayer:async()=>(await import("../WMTSLayer.js")).default,WebTileLayer:async()=>(await import("../WebTileLayer.js")).default};export{a as layersLoaderMap};
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@arcgis/core",
3
- "version": "5.1.0-next.118",
3
+ "version": "5.1.0-next.119",
4
4
  "homepage": "https://js.arcgis.com",
5
5
  "description": "ArcGIS Maps SDK for JavaScript: A complete 2D and 3D mapping and data visualization API",
6
6
  "keywords": [
@@ -21,7 +21,7 @@
21
21
  "@amcharts/amcharts5": "~5.17.2",
22
22
  "@arcgis/toolkit": "^5.1.0-next.123",
23
23
  "@esri/arcgis-html-sanitizer": "~4.1.0",
24
- "@esri/calcite-components": "^5.1.0-next.60",
24
+ "@esri/calcite-components": "^5.1.1-next.3",
25
25
  "@vaadin/grid": "~25.1.3",
26
26
  "@zip.js/zip.js": "~2.8.26",
27
27
  "luxon": "~3.7.2",
@@ -122,7 +122,7 @@ export interface FlowRendererProperties extends VisualVariablesMixinProperties,
122
122
  * To use this renderer, the [source type of your raster dataset](https://pro.arcgis.com/en/pro-app/latest/help/data/imagery/raster-dataset-properties.htm) must be `Vector-UV` or `Vector-MagDir`.
123
123
  * The direction of the raster defines the direction of movement, and the magnitude defines the visible length of the streamline.
124
124
  *
125
- * [![flow renderer](https://developers.arcgis.com/javascript/latest/assets/references/core/renderers/flow/flow-renderer.webm)](https://developers.arcgis.com/javascript/latest/sample-code/layers-imagery-afrenderer/)
125
+ * [<video src="https://developers.arcgis.com/javascript/latest/assets/references/core/renderers/flow/flow-renderer.webm" aria-label="flow renderer" autoplay muted playsinline loop></video>](https://developers.arcgis.com/javascript/latest/sample-code/layers-imagery-afrenderer/)
126
126
  *
127
127
  * <span id="streamline-animation"></span>
128
128
  * ## Streamline animation
@@ -282,7 +282,7 @@ export default class FlowRenderer extends FlowRendererSuperclass {
282
282
  * The actual trail length is first based on the data, then further scaled by this property.
283
283
  * |`trailLength = 20` | `trailLength = 100` | `trailLength = 250` |
284
284
  * |----------------|-----------------|---------------|
285
- * | ![trailLength 20](https://developers.arcgis.com/javascript/latest/assets/references/core/renderers/flow/trailLength-20.webm) | ![trailLength 100](https://developers.arcgis.com/javascript/latest/assets/references/core/renderers/flow/trailLength-100.webm) | ![trailLength 250](https://developers.arcgis.com/javascript/latest/assets/references/core/renderers/flow/trailLength-250.webm) |
285
+ * | <video src="https://developers.arcgis.com/javascript/latest/assets/references/core/renderers/flow/trailLength-20.webm" aria-label="trailLength 20" autoplay muted playsinline loop></video> | <video src="https://developers.arcgis.com/javascript/latest/assets/references/core/renderers/flow/trailLength-100.webm" aria-label="trailLength 100" autoplay muted playsinline loop></video> | <video src="https://developers.arcgis.com/javascript/latest/assets/references/core/renderers/flow/trailLength-250.webm" aria-label="trailLength 250" autoplay muted playsinline loop></video> |
286
286
  *
287
287
  * @default 100
288
288
  * @see [Streamline animation](https://developers.arcgis.com/javascript/latest/references/core/renderers/FlowRenderer/#streamline-animation)
@@ -61,8 +61,8 @@ export interface FlowRendererParameters extends RasterRendererParameters {
61
61
  * Possible values are listed below.
62
62
  * | Value | Description | Example |
63
63
  * | ----- | ----------- | ------- |
64
- * | flow-line | Renders the uv and magnitude data as animated flow lines. This is ideal for representing wind and other atmospheric data. | ![flow-line](https://developers.arcgis.com/javascript/latest/assets/references/core/renderers/animated-flow/sm-flow-line-2.webm) |
65
- * | wave-front | Renders UV and magnitude data in a wave-like animation. This theme works well for ocean data. | ![above](https://developers.arcgis.com/javascript/latest/assets/references/core/renderers/animated-flow/sm-wave-front-2.webm) |
64
+ * | flow-line | Renders the uv and magnitude data as animated flow lines. This is ideal for representing wind and other atmospheric data. | <video src="https://developers.arcgis.com/javascript/latest/assets/references/core/renderers/animated-flow/sm-flow-line-2.webm" aria-label="flow-line" autoplay muted playsinline loop></video> |
65
+ * | wave-front | Renders UV and magnitude data in a wave-like animation. This theme works well for ocean data. | <video src="https://developers.arcgis.com/javascript/latest/assets/references/core/renderers/animated-flow/sm-wave-front-2.webm" aria-label="above" autoplay muted playsinline loop></video> |
66
66
  *
67
67
  * > [!WARNING]
68
68
  * >
@@ -96,8 +96,8 @@ export interface GetSchemesParameters {
96
96
  * Possible values are listed below.
97
97
  * | Value | Description | Example |
98
98
  * | ----- | ----------- | ------- |
99
- * | flow-line | Renders the uv and magnitude data as animated flow lines. This is ideal for representing wind and other atmospheric data. | ![flow-line](https://developers.arcgis.com/javascript/latest/assets/references/core/renderers/animated-flow/sm-flow-line-2.webm) |
100
- * | wave-front | Renders UV and magnitude data in a wave-like animation. This theme works well for ocean data. | ![above](https://developers.arcgis.com/javascript/latest/assets/references/core/renderers/animated-flow/sm-wave-front-2.webm) |
99
+ * | flow-line | Renders the uv and magnitude data as animated flow lines. This is ideal for representing wind and other atmospheric data. | <video src="https://developers.arcgis.com/javascript/latest/assets/references/core/renderers/animated-flow/sm-flow-line-2.webm" aria-label="flow-line" autoplay muted playsinline loop></video> |
100
+ * | wave-front | Renders UV and magnitude data in a wave-like animation. This theme works well for ocean data. | <video src="https://developers.arcgis.com/javascript/latest/assets/references/core/renderers/animated-flow/sm-wave-front-2.webm" aria-label="above" autoplay muted playsinline loop></video> |
101
101
  *
102
102
  * > [!WARNING]
103
103
  * >
@@ -1749,8 +1749,8 @@ export interface FlowScheme {
1749
1749
  * Possible values are listed below.
1750
1750
  * | Value | Description | Example |
1751
1751
  * | ----- | ----------- | ------- |
1752
- * | flow-line | Renders the uv and magnitude data as animated flow lines. This is ideal for representing wind and other atmospheric data. | ![flow-line](https://developers.arcgis.com/javascript/latest/assets/references/core/renderers/animated-flow/sm-flow-line-2.webm) |
1753
- * | wave-front | Renders UV and magnitude data in a wave-like animation. This theme works well for ocean data. | ![above](https://developers.arcgis.com/javascript/latest/assets/references/core/renderers/animated-flow/sm-wave-front-2.webm) |
1752
+ * | flow-line | Renders the uv and magnitude data as animated flow lines. This is ideal for representing wind and other atmospheric data. | <video src="https://developers.arcgis.com/javascript/latest/assets/references/core/renderers/animated-flow/sm-flow-line-2.webm" aria-label="flow-line" autoplay muted playsinline loop></video> |
1753
+ * | wave-front | Renders UV and magnitude data in a wave-like animation. This theme works well for ocean data. | <video src="https://developers.arcgis.com/javascript/latest/assets/references/core/renderers/animated-flow/sm-wave-front-2.webm" aria-label="wave-front" autoplay muted playsinline loop></video> |
1754
1754
  *
1755
1755
  * > [!WARNING]
1756
1756
  * >
@@ -1,2 +1,2 @@
1
1
  /* COPYRIGHT Esri - https://js.arcgis.com/5.1/LICENSE.txt */
2
- const c="20260602",e="5beede90a18ca6540601038f7231bcdc44b9f37a";export{c as buildDate,e as commitHash};
2
+ const b="20260602",c="6a0d5c59bd284e9c1ff714821a570fb8e77bbd25";export{b as buildDate,c as commitHash};
@@ -25,7 +25,7 @@ export default class Symbol3DVerticalOffset extends JSONSupport {
25
25
  *
26
26
  * In the following animation the green symbols have `maxWorldLength = 50` and orange symbols don't have `maxWorldLength` set:
27
27
  *
28
- * ![maxWorldLength](https://developers.arcgis.com/javascript/latest/assets/references/core/symbols/symbols3D-line-callout-maxWorldLength.webm)
28
+ * <video src="https://developers.arcgis.com/javascript/latest/assets/references/core/symbols/symbols3D-line-callout-maxWorldLength.webm" aria-label="maxWorldLength" autoplay muted playsinline loop></video>
29
29
  */
30
30
  accessor maxWorldLength: number | null | undefined;
31
31
  /**
@@ -33,7 +33,7 @@ export default class Symbol3DVerticalOffset extends JSONSupport {
33
33
  *
34
34
  * In the following animation the green symbol on the left has `minWorldLength = 20` and for the orange symbol on the right `minWorldLength` has not been set:
35
35
  *
36
- * ![minWorldLength-on](https://developers.arcgis.com/javascript/latest/assets/references/core/symbols/symbols3D-line-callout-minWorldLength.webm)
36
+ * <video src="https://developers.arcgis.com/javascript/latest/assets/references/core/symbols/symbols3D-line-callout-minWorldLength.webm" aria-label="minWorldLength-on" autoplay muted playsinline loop></video>
37
37
  *
38
38
  * @default 0
39
39
  */
@@ -1,2 +1,2 @@
1
1
  /* COPYRIGHT Esri - https://js.arcgis.com/5.1/LICENSE.txt */
2
- import{__decorate as e}from"tslib";import t from"../../../AggregateGraphic.js";import r from"../../../Graphic.js";import s from"../../../TrackGraphic.js";import{isSome as i}from"../../../core/arrayUtils.js";import a from"../../../core/Collection.js";import o from"../../../core/Error.js";import{makeHandle as n,handlesGroup as l}from"../../../core/handleUtils.js";import has from"../../../core/has.js";import u from"../../../core/Logger.js";import{destroyMaybe as h}from"../../../core/maybe.js";import{notDeepEqual as c}from"../../../core/object.js";import{createAbortError as p,ignoreAbortErrors as d,throwIfNotAbortError as y,isAbortError as m}from"../../../core/promiseUtils.js";import{watch as g,initial as f,sync as w}from"../../../core/reactiveUtils.js";import{isScreenRect as v}from"../../../core/screenUtils.js";import{sqlAnd as _}from"../../../core/sql.js";import{getMetersPerUnitForSR as b}from"../../../core/units.js";import{property as S,subclass as A}from"../../../core/accessorSupport/decorators.js";import{UpdatingHandles as F}from"../../../core/support/UpdatingHandles.js";import j from"../../../geometry/Extent.js";import{fromJSON as x}from"../../../geometry/support/jsonUtils.js";import R from"../../../geometry/support/rotate.js";import{isCurvedGeometry as E}from"../../../geometry/support/curves/curveUtils.js";import{densifyCurvedGeometry as I}from"../../../geometry/support/curves/densifyCurvedGeometry.js";import k from"../../../layers/effects/FeatureEffectView.js";import{convertFromFeature as O}from"../../../layers/graphics/featureConversionUtils.js";import U from"../../../layers/support/FeatureFilter.js";import{checkServiceCurrentUserSupport as q}from"../../../layers/support/featureLayerUtils.js";import{packFields as C}from"../../../layers/support/fieldUtils.js";import{getEffectiveLayerCapabilities as V}from"../../../layers/support/layerUtils.js";import{combineTimeExtent as Q}from"../../../layers/support/timeSupport.js";import L from"../../../rest/support/AggregateFeatureSet.js";import M from"../../../rest/support/AttributeBinsFeatureSet.js";import H from"../../../rest/support/AttributeBinsQuery.js";import P from"../../../rest/support/FeatureSet.js";import T from"../../../rest/support/Query.js";import{HittestDrawHelper as W}from"../../../symbols/cim/CIMSymbolDrawHelper.js";import{symbolToCIM as D}from"../../../symbols/cim/CIMSymbolHelper.js";import{getDisplayedSymbol as G}from"../../../symbols/support/symbolUtils.js";import{LayerView2D as N}from"./LayerView2D.js";import{FeatureContainer as J}from"./features/FeatureContainer.js";import{createFeaturePipelineWorkerProxy as z}from"./features/FeaturePipelineWorkerProxy.js";import{FeatureSourceEventLog as B}from"./features/FeatureSourceEventLog.js";import{AnnotationLayerAdapter as Z}from"./features/layerAdapters/AnnotationLayerAdapter.js";import{CatalogFootprintLayerAdapter as K}from"./features/layerAdapters/CatalogFootprintLayerAdapter.js";import{DimensionLayerAdapter as $}from"./features/layerAdapters/DimensionLayerAdapter.js";import{FeatureLayerAdapter as X}from"./features/layerAdapters/FeatureLayerAdapter.js";import{createFeatureIdInfo as Y}from"./features/layerAdapters/featureServiceUtils.js";import{InMemoryLayerAdapter as ee}from"./features/layerAdapters/InMemoryLayerAdapter.js";import{KnowledgeGraphSublayerAdapter as te}from"./features/layerAdapters/KnowledgeGraphSublayerAdapter.js";import{OGCFeatureLayerAdapter as re}from"./features/layerAdapters/OGCFeatureLayerAdapter.js";import{OrientedImageryLayerAdapter as se}from"./features/layerAdapters/OrientedImageryLayerAdapter.js";import{ParquetLayerAdapter as ie}from"./features/layerAdapters/ParquetLayerAdapter.js";import{StreamLayerAdapter as ae}from"./features/layerAdapters/StreamLayerAdapter.js";import{SubtypeGroupLayerAdapter as oe}from"./features/layerAdapters/SubtypeGroupLayerAdapter.js";import{createComplexSymbolInstances as ne}from"./features/schema/processor/symbols/ComplexSymbolSchema.js";import{DebouncedFeatureOverride as le}from"./support/DebouncedFeatureOverride.js";import{FeatureCommandQueue as ue}from"./support/FeatureCommandQueue.js";import{handleNoEngineError as he}from"./support/handleNoEngineError.js";import{toJSONGeometryType as ce}from"./support/util.js";import{getMapPointsFromScreen as pe}from"../support/hitTestUtils.js";import{FeatureTileSubscriptionManager as de}from"../tiling/FeatureTileSubscriptionManager.js";import{RefreshableLayerView as ye}from"../../layers/RefreshableLayerView.js";import{getHighlightName as me}from"../../support/highlightOptionsUtils.js";function ge(e,t){const r=new Set;return e&&e.forEach(e=>r.add(e)),t&&t.forEach(e=>r.add(e)),r.has("*")?["*"]:Array.from(r)}const fe=4294967294;function we(e,t){return l(e.map(e=>g(()=>{const t=e();return t&&"object"==typeof t?"getTime"in t&&"function"==typeof t.getTime?t.getTime():JSON.stringify(t):t},t,w)))}function ve(e){if(!e.geometry)return e;if(!E(e.geometry))return e;const t=.001/b(e.geometry.spatialReference),r=100;return{geometry:I(e.geometry,{maxSegmentsPerCurve:12e3,maxSegmentLength:r*t,maxDeviation:0}),attributes:e.attributes}}const _e=l=>{const w=ye(N(l));let b=class extends w{constructor(){super(...arguments),this._commandsQueue=new ue({process:e=>{switch(e.type){case"override-batch":return this._doOverride(e);case"update":return this._doUpdate();case"highlight":return this._updateHighlights()}}}),this._visibilityOverrides=new Set,this._lastAvailableFields=[],this._lastTargetState=null,this._lastRequiredLevel=0,this.eventLog=new B,this._sourceRefreshVersion=1,this._displayRefreshVersion=1,this._pipelineUpdating=!1,this._editUpdatingHandles=new F,this._fields=null,this._hittestDrawHelper=null,this._sourceUpdating=!1,this.featureEffectView=new k}destroy(){this._editUpdatingHandles.destroy(),this._workerProxy?.destroy(),this._workerAttached.reject(p()),this._commandsQueue.destroy(),this._hittestDrawHelper?.destroy()}initialize(){this._workerAttached=Promise.withResolvers(),d(this._workerAttached.promise),this.addResolvingPromise(this._initProxy()),this.featureEffectView.featureEffect=this.featureEffect,this.featureEffectView.endTransition()}async _initProxy(){const e=this.layer;if("isTable"in e&&e.isTable)throw new o("featurelayerview:table-not-supported","table feature layer can't be displayed",{layer:e});if(("feature"===e.type||"subtype-group"===e.type)&&!1===V(e)?.operations.supportsQuery)throw new o("featurelayerview:query-not-supported","layer view requires a layer with query capability",{layer:e});this._workerProxy&&this._workerProxy.destroy();const t=this._createClientOptions();this._workerProxy=await z(t)}async _attachProxy(){const e=R(this.view.extent,this.view.rotation,this.view.center),t=this.view.featuresTilingScheme.getClosestInfoForScale(this.view.scale).level;t!==this._lastRequiredLevel&&(this._lastRequiredLevel=t);const r={tileInfoJSON:this.view?.featuresTilingScheme?.tileInfo?.toJSON(),initialViewExtent:e.toJSON(),requiredLevel:t,requiredScale:this.view.scale};try{await this._workerProxy.pipeline.onAttach(r),this._workerAttached.resolve()}catch(s){this._workerAttached.reject(p()),y(s)}}async _detachProxy(){return this._workerProxy.pipeline.onDetach()}async getWorker(){return await this._workerAttached.promise,this._workerProxy}get dataUpdating(){return this._sourceUpdating||this._editUpdatingHandles.updating}get hasAllFeatures(){return this.layer.visible&&!this.suspended&&this.eventLog.hasAllData&&this.eventLog.willQueryAllFeatures}get hasAllFeaturesInView(){const e=this.effectiveDisplayFilter?.where||null,t=!this.eventLog.willQueryAllFeatures&&null!=e&&"1=1"!==e;return this.layer.visible&&!this.suspended&&this.eventLog.hasAllData&&!t}get hasFullGeometries(){return this.layer.visible&&!this.suspended&&this.eventLog.hasAllData&&this.eventLog.willQueryFullResolutionGeometry}get layerAdapter(){switch(this.layer.type){case"annotation":return new Z(this.layer);case"dimension-feature":return new $(this.layer);case"feature":return"memory"===this.layer.source.type?new ee(this.layer):new X(this.layer);case"geojson":case"csv":case"wfs":return new ee(this.layer);case"parquet":return new ie(this.layer);case"subtype-group":return new oe(this.layer);case"ogc-feature":return new re(this.layer);case"stream":return new ae(this.layer);case"oriented-imagery":return new se(this.layer);case"knowledge-graph-sublayer":return new te(this.layer);case"catalog-footprint":return new K(this.layer);default:this.layer}return null}get timeExtent(){return Q(this.layerAdapter.timeOptions,this.view?.timeExtent,this._get("timeExtent"))}get usedMemory(){return this.container.usedMemory+this.eventLog.pipelineStatistics.usedMemory}getDisplayStatistics(e,t){return this.featureContainer?.getDisplayStatistics(e,t)}highlight(e,t){let s;e instanceof r?s=[e.getObjectId()]:"number"==typeof e||"string"==typeof e?s=[e]:a.isCollection(e)&&e.length>0?s=e.map(e=>e?.getObjectId()).toArray():Array.isArray(e)&&e.length>0&&(s="number"==typeof e[0]||"string"==typeof e[0]?e:e.map(e=>e?.getObjectId()));const o=s?.filter(i);if(!o?.length)return n();const l=me(t);return this._addHighlights(o,l),n(()=>!this.destroyed&&this._removeHighlights(o,l))}async hitTest(e,i){const a=v(i),{trueHitIds:o,candidateHitIds:n}=await this.featureContainer.hitTest(i),l=await this.getWorker(),[u,h]=await Promise.all([l.pipeline.getDisplayFeatures(n),l.pipeline.getDisplayFeatures(o)]),{features:c,aggregates:p,tracks:d}=u,{features:y,aggregates:g,tracks:f}=h,w=[];if(a&&this.hasRenderer()){const e=new Map,t=new r;for(const r of c){t.attributes=r.attributes,t.geometry=x(r.geometry),t.symbol=null;const s=this.layerAdapter.getRenderer(t);if(!s){w.push(r);continue}const i=await G(t,{renderer:s,scale:this.view.scale,resolution:this.view.resolution,spatialReference:this.view.spatialReference,viewingMode:"2d",timeZone:this.view.timeZone});if(!i)continue;let a=null;const o=D(i);if("web-style"===o.type)try{const e=D(await o.fetchSymbol({acceptedFormats:["cim","web"]}));a="web-style"===e.type?null:e.symbol}catch(R){m(R),0;continue}else a=o.symbol;a&&e.set(r,a)}e.size>0&&!this._hittestDrawHelper&&(this._hittestDrawHelper=new W(this.view.stage.painter.textureManager.resourceManager));const{resolution:s,rotation:a}=this.view.state,o=pe(this.view,i);for(const[r,i]of e){if(!r)continue;this._hittestDrawHelper.hitTest(o,i,r.geometry,null,a,s,0,"rect")&&w.push(r)}}else w.push(...c);const _=[...y,...w],b=[...g,...p],S=[...f,...d],A=this.featureContainer.getSortKeys(_.map(e=>e.displayId)),F=({displayId:e},{displayId:t})=>A.has(e)&&A.has(t)?A.get(e)-A.get(t):e-t;_.sort(F).reverse(),b.sort(F).reverse();const j=has("parquetlayer-hittest-max-feature-count")??1;return"parquet"===this.layer.type&&_.length>j&&(_.length=j),[...b.map(r=>this._createAggregateGraphicHit(e,t.fromJSON(r))),...S.map(t=>this._createTrackGraphicHit(e,s.fromJSON(t))),..._.map(t=>this._createFeatureGraphicHit(a?null:e,r.fromJSON(t)))]}async queryAggregateSummaryStatistics(e,t,r){const s={...t,scale:this.view.scale},i=(await this.getWorker()).aggregates.executeQueryForSummaryStatistics(this._cleanUpAggregateQuery(e),s,r);return he(i,{})}async queryUniqueValues(e,t,r){const s=await this.getWorker(),i={...t,scale:this.view.scale},a=s.features.executeQueryForUniqueValues(this._cleanUpQuery(e),i,r);return he(a,{uniqueValueInfos:[]})}async queryAggregateUniqueValues(e,t,r){const s=await this.getWorker(),i={...t,scale:this.view.scale},a=s.aggregates.executeQueryForUniqueValues(this._cleanUpAggregateQuery(e),i,r);return he(a,{uniqueValueInfos:[]})}async queryAggregateClassBreaks(e,t,r){const s=await this.getWorker(),i={...t,scale:this.view.scale},a=s.aggregates.executeQueryForClassBreaks(this._cleanUpAggregateQuery(e),i,r);return he(a,{classBreakInfos:[]})}async queryHistogram(e,t,r){const s=await this.getWorker(),i={...t,scale:this.view.scale},a=s.features.executeQueryForHistogram(this._cleanUpQuery(e),i,r);return he(a,{bins:[],maxValue:null,minValue:null,normalizationTotal:null})}async queryAggregateCount(e,t){const r=(await this.getWorker()).aggregates.executeQueryForCount(this._cleanUpAggregateQuery(e),t);return he(r,0)}async queryAggregateHistogram(e,t,r){const s=await this.getWorker(),i={...t,scale:this.view.scale},a=s.aggregates.executeQueryForHistogram(this._cleanUpAggregateQuery(e),i,r);return he(a,{bins:[],maxValue:null,minValue:null,normalizationTotal:null})}async queryAggregateIds(e,t){const r=(await this.getWorker()).aggregates.executeQueryForIds(this._cleanUpAggregateQuery(e),t);return he(r,[])}async queryAggregateJSON(e,t){const r=(await this.getWorker()).aggregates.executeQuery(this._cleanUpAggregateQuery(e),t);return he(r,{features:[]})}async queryAttributeBins(e,t){const r=(await this.getWorker()).features.executeAttributeBinsQuery(this._cleanUpAttributeBinsQuery(e),t),s=await he(r,{features:[]});return M.fromJSON(s)}async queryAggregates(e,t){const r=(await this.getWorker()).aggregates.executeQuery(this._cleanUpAggregateQuery(e),t),s=await he(r,{features:[]}),i=L.fromJSON(s);return i.features.forEach(e=>this.layerAdapter.setAggregateGraphicOrigin?.(e)),i}async queryClassBreaks(e,t,r){const s=await this.getWorker(),i={...t,scale:this.view.scale},a=s.features.executeQueryForClassBreaks(this._cleanUpQuery(e),i,r);return he(a,{classBreakInfos:[]})}async queryExtent(e,t){const r=(await this.getWorker()).features.executeQueryForExtent(this._cleanUpQuery(e),t),s=await he(r,{count:0,extent:null});return{count:s.count,extent:j.fromJSON(s.extent)}}async queryFeatureCount(e,t){const r=(await this.getWorker()).features.executeQueryForCount(this._cleanUpQuery(e),t);return he(r,0)}queryFeatures(e,t){return this.queryFeaturesJSON(e,t).then(e=>{const t=P.fromJSON(e);return t.features.forEach(e=>this._setOriginForFeature(e)),t})}async queryFeaturesJSON(e,t){const r=(await this.getWorker()).features.executeQuery(this._cleanUpQuery(e),t);return he(r,{features:[]})}async queryHeatmapStatistics(e){return(await this.getWorker()).pipeline.queryHeatmapStatistics(e)}async queryObjectIds(e,t){const r=(await this.getWorker()).features.executeQueryForIds(this._cleanUpQuery(e),t);return he(r,[])}async queryStatistics(){const e=await this.getWorker();return he(e.pipeline.queryStatistics(),{featureCount:0,ringCount:0,vertexCount:0})}async querySummaryStatistics(e,t,r){const s=await this.getWorker(),i={...t,scale:this.view.scale},a=s.features.executeQueryForSummaryStatistics(this._cleanUpQuery(e),i,r);return he(a,{})}async queryVisibleFeatures(e,t){const r=(await this.getWorker()).pipeline.queryVisibleFeatures(this._cleanUpQuery(e),t),s=await he(r,{features:[]}),i=P.fromJSON(s);return i.features.forEach(e=>this._setOriginForFeature(e)),i}async getSampleFeatures(e){return(await this.getWorker()).pipeline.getSampleFeatures(e)}setVisibility(e,t){t?this._visibilityOverrides.delete(e):this._visibilityOverrides.add(e),this._update()}update(e){if(!this._subscriptions)return;this.view.animation&&!this._lastTargetState&&(this._lastTargetState=e.state.clone()),!this.view.animation&&this._lastTargetState&&(this._lastTargetState=null);const t=this.featureContainer.getPresenting(),r=this._subscriptions.update(e.targetState,this._lastTargetState,t);r&&(this.featureContainer.updateSubscriptions(r),d(this._updatingHandles.addPromise(this.getWorker().then(e=>e.pipeline.updateSubscriptions(r))))),this._subscriptions.coverage&&this.featureContainer.setCoverage(this._subscriptions.coverage)}attach(){has("esri-2d-update-debug")&&console.debug("FeatureLayerView2D.attach"),d(this._updatingHandles.addPromise(this._workerAttached.promise)),d(this._attachProxy()),this.featureContainer=new J(this),this.container.addChild(this.featureContainer),this.view.timeline.record(`${this.layer.title} (FeatureLayer) Attach`),this._subscriptions=new de(this.view.featuresTilingScheme),this.requestUpdate(),this.addAttachHandles([we([()=>this._displayRefreshVersion,()=>"displayFilterInfo"in this.layer&&this.layer.displayFilterInfo,()=>this.timeExtent,()=>this.clips,()=>this.filter,()=>this.effectiveDisplayFilterClause,()=>this.featureEffect,()=>this._sourceRefreshVersion,()=>this.view.timeZone,()=>this.view.timeExtent,...this.layerAdapter.getUpdateHashProperties(this.view)],()=>this._update()),g(()=>this.updateSuspended,e=>{e||this._subscriptions.resume(this.featureContainer.getPresenting())}),g(()=>this.view.scale,async e=>{const t=this.view.featuresTilingScheme.getClosestInfoForScale(e).level;if(t!==this._lastRequiredLevel){this._lastRequiredLevel=t;(await this.getWorker()).pipeline.updateRequiredLevel(t,e)}},f),g(()=>this.view.stationary,async e=>{if(e){const e=await this.getWorker(),t=R(this.view.extent,this.view.rotation,this.view.center);e.pipeline.updateStationaryExtent(t.toJSON(),this.featureContainer.requiresRefresh)}})]),this._update(),"stream"!==this.layer.type&&"parquet"!==this.layer.type&&"catalog-footprint"!==this.layer.type&&this.addAttachHandles(this.layer.on("edits",e=>this._editUpdatingHandles.addPromise(this._edit(e))))}detach(){has("esri-2d-update-debug")&&console.debug("FeatureLayerView2D.detach"),this._detachProxy(),this._fields=null,this.featureContainer.destroy(),this.featureContainer=null,this._commandsQueue.clear(),this.container.removeAllChildren(),this._subscriptions=h(this._subscriptions),this._workerProxy.pipeline.onDetach(),this._workerAttached=Promise.withResolvers(),d(this._workerAttached.promise),this._lastAvailableFields=[],this._lastSchema=null}viewChange(){this.requestUpdate()}moveEnd(){this.requestUpdate()}addOverrides(e){return this._commandsQueue.push({type:"override",options:{...e,release:[]}})}removeOverrides(e){for(const r of e)if(null==r)throw new o("featurelayerview:bad-override","Tried to remove an override for an invalid objectId",{objectId:r});const t={added:[],updated:[],removed:[],release:e,isWeak:!1,historicMoment:null};return this._commandsQueue.push({type:"override",options:t})}onProxyClientEvent(e){}hasRenderer(){return"renderer"in this.layer&&null!=this.layer.renderer}isUpdating(){const e=this.hasRenderer(),t=this._commandsQueue.updateTracking.updating,r=null!=this._updatingRequiredPromise,s=this.featureContainer.updating;return this.updateRequested||e&&(t||r)||s||this._pipelineUpdating||this.dataUpdating}_createClientOptions(){const e=this;return{updateSchemaStart:()=>e.updateSchemaStart(),updateSchemaEnd:t=>e.updateSchemaEnd(t),openMemoryPorts:async()=>{if(this.layerAdapter?.openMessagePorts){const e=await this.layerAdapter.openMessagePorts();return{result:e,transferList:e}}throw new Error("InternalError: Layer adapter does not support opening message ports")},get container(){return e.featureContainer},setUpdating:e=>{this._set("_pipelineUpdating",e.pipeline),this._set("_sourceUpdating",e.source)},emitEvent:e=>{this.onProxyClientEvent(e)},get eventLog(){return e.eventLog},fetch:async t=>{if(has("esri-2d-stabilize-glyphs")){const r=[];for(const s of t)r.push(await e.view.stage.painter.textureManager.rasterizeItem(s));return r}return Promise.all(t.map(t=>e.view.stage.painter.textureManager.rasterizeItem(t)))},fetchDictionary:e=>Promise.all(e.map(e=>this._fetchDictionaryRequest(e))),fetchMesh:e=>Promise.all(e.map(e=>this._fetchMeshRequest(e)))}}async _fetchDictionaryRequest(e){try{if("subtype-group"===this.layer.type)throw new Error("InternalError: SubtypeGroupLayer does not support dictionary renderer");const t=this.layer.renderer;if(!t||"dictionary"!==t.type)throw new Error("InternalError: Expected layer to have a DictionaryRenderer");const r=this._lastSchema.processor.mesh.factory.symbology;if("dictionary"!==r.type)throw new Error("InternalError: Expected schema to be of type 'dictionary'");const s={cimAnalyzer:this.view.stage.cimAnalyzer,cimResourceManager:this.view.stage.painter.textureManager.resourceManager,store:this.featureContainer.instanceStore,scaleExpression:r.scaleExpression};this._fields||(this._fields=this.layer.fields.map(e=>e.toJSON()));const i=r.visualVariableUniforms,a=ce(this.layer.geometryType),o=await t.getSymbolForControlString(e.controlString,a,!1);if(!o||!o.data)return{type:"dictionary-response",meshes:[]};return{type:"dictionary-response",meshes:await ne({...o.data,hasTextStringTemplates:!0},{uniforms:i,path:"renderer",schemaOptions:s})}}catch(t){return{type:"dictionary-response",meshes:[]}}}async _fetchMeshRequest(e){const{layer:t}=this;try{const r={cimAnalyzer:this.view.stage.cimAnalyzer,cimResourceManager:this.view.stage.painter.textureManager.resourceManager,store:this.featureContainer.instanceStore,scaleExpression:null};this._fields||(this._fields=t.fields.map(e=>e.toJSON()));return{type:"mesh-response",meshes:await ne({...e.symbolReference,hasTextStringTemplates:!0},{path:"anno-like",schemaOptions:r,uniforms:{visualVariableColor:null,visualVariableOpacity:null,visualVariableRotation:null,visualVariableSizeStops:null,visualVariableSizeScaleStops:null,visualVariableSizeOutlineScaleStops:null,visualVariableSizeUnitValue:null,visualVariableSizeMinMaxValue:null}})}}catch(r){return{type:"mesh-response",meshes:[]}}}_cleanUpQuery(e){const t=T.from(e)||this.createQuery();return t.outSpatialReference||(t.outSpatialReference=this.view.spatialReference),"returnZ"in this.layer&&(t.returnZ??=this.layer.returnZ),"returnM"in this.layer&&(t.returnM??=this.layer.returnM),t.toJSON()}_cleanUpAttributeBinsQuery(e){const t=H.from(e);return t.outSpatialReference||(t.outSpatialReference=this.view.spatialReference),t.toJSON()}_cleanUpAggregateQuery(e){const t=T.from(e)||this.createAggregateQuery();t.outSpatialReference||(t.outSpatialReference=this.view.spatialReference);const r=t.objectIds??[];for(const s of t.aggregateIds??[])r.push(s);return t.objectIds=r,t.aggregateIds=[],t.toJSON()}async _update(){return this._commandsQueue.push({type:"update"})}_edit(e){return this._commandsQueue.push({type:"edit",event:e})}async doRefresh(e){this.attached&&(this.updateSuspended&&e||(e?this.incrementSourceRefreshVersion():this.incrementDisplayRefreshVersion()))}incrementSourceRefreshVersion(){this._sourceRefreshVersion=(this._sourceRefreshVersion+1)%fe+1}incrementDisplayRefreshVersion(){this._displayRefreshVersion=(this._displayRefreshVersion+1)%fe+1}async _resolveIdenifiers(e){const t=[],r=[];for(const a of e)null==a.objectId||-1===a.objectId?null==a.globalId?u.getLogger(this).warn("mapview-apply-edits","A feature identifier must contain either a GlobalId or ObjectId. Ignoring",{identifier:a}):r.push(a.globalId):t.push(a.objectId);const s="globalIdField"in this.layer&&this.layer.globalIdField,i=s&&this.availableFields.includes(s);if(r.length&&!i)return u.getLogger(this).error(new o("mapview-apply-edits",`Editing the specified service requires the layer's globalIdField, ${s} to be included the layer's outFields for updates to be reflected on the map`)),t;if(r.length){const e=await this._workerProxy.pipeline.getObjectIdsFromGlobalIds(r);for(const r of e)t.push(r)}return t}_resolveOverrides(e){const t=!1,r=!1,s=ce(this.layer.geometryType),i=Y(this.layer),a=[];for(const n of e.added){const e=O(ve(n),s,t,r,i);if(null==e.objectId)throw new o("featurelayerview:bad-override","Feature does not have an objectId",{feature:n});a.push(e)}for(const n of e.updated){const e=O(ve(n),s,t,r,i);if(null==e.objectId)throw new o("featurelayerview:bad-override","Feature does not have an objectId",{feature:n});a.push(e)}for(const n of e.removed)if(null==n)throw new o("featurelayerview:bad-override","Tried to remove an invalid objectId",{objectId:n});return{type:"override",updates:a,removed:e.removed,release:e.release,isWeak:e.isWeak??!1,historicMoment:e.historicMoment??null}}async _resolveEdit(e){const t=this.layer,r=e.historicMoment?.getTime()??null,s="layerId"in t&&e.editedFeatures?.find(e=>e.layerId===t.layerId);if(s&&this._canEditByFeature(s)){const{adds:e,deletes:t,updates:i}=s.editedFeatures,a=this.layer.objectIdField,o=i.map(e=>e.current),n=t.map(e=>"attributes"in e?{objectId:a?e.attributes[a]:null}:e),l=await this._resolveIdenifiers(n);return this._resolveOverrides({added:e,updated:o,removed:l,historicMoment:r,isWeak:!0,release:[]})}const[i,a,o]=await Promise.all([this._resolveIdenifiers(e.addedFeatures),this._resolveIdenifiers(e.updatedFeatures),this._resolveIdenifiers(e.deletedFeatures)]);return{type:"override-by-id",updates:[...i,...a],removed:o,historicMoment:r,isWeak:!0}}_canEditByFeature(e){const{adds:t,updates:r}=e.editedFeatures;return t.every(e=>this.view.spatialReference.equals(e.geometry?.spatialReference))&&r.every(e=>this.view.spatialReference.equals(e.current.geometry?.spatialReference))}async updateSchemaStart(){const e=this.layer;"featureReduction"in e&&e.featureReduction&&e.featureReduction!==this._lastFeatureReduction&&(e.featureReduction=e.featureReduction?.clone(),this._lastFeatureReduction=e.featureReduction);try{if(await Promise.allSettled([this._handleChange(),q(e)]),this.destroyed||!this.layerAdapter?.hasRequiredSupport||!this._subscriptions)return null;const t=this.featureContainer.updateStart("subtype-group"===e.type);this._lastFeatureEffect=this.featureEffect;const r={store:t,cimAnalyzer:this.view.stage.cimAnalyzer,cimResourceManager:this.view.stage.painter.textureManager.resourceManager,scaleExpression:void 0},s=await this._createViewSchemaConfig(),i={source:await this.layerAdapter.createSourceSchema(s,this._sourceRefreshVersion),processor:await this.layerAdapter.createProcessorSchema(r,s,this._displayRefreshVersion)};return c(this._lastSchema?.source.strategy,i.source.strategy)||c(this._lastSchema?.processor,i.processor)?(this._lastSchema=i,this._fields=null,i):null}catch(t){}return null}async updateSchemaEnd(e){try{this.featureEffectView.featureEffect=this._lastFeatureEffect,e&&this.featureEffectView.endTransition(),await this.featureContainer.updateEnd(this._lastSchema.processor,this.layerAdapter.getLabelingDeconflictionInfo(),e),has("esri-2d-update-debug")&&console.debug("FeatureLayerView2D.updateEnd")}catch(t){}}async _doUpdate(){const e=Math.round(performance.now()),t=await this.getWorker();await t.pipeline.updateSchema(e),this.requestUpdate()}async _doOverride(e){const t=await this.getWorker();try{let r=new le;for(const s of e.messages)switch(s.type){case"edit":r.tryAdd(await this._resolveEdit(s.event))||(await t.pipeline.onOverride(r.toMessage()),r=new le,r.tryAdd(await this._resolveEdit(s.event)));break;case"override":r.tryAdd(this._resolveOverrides(s.options))||(await t.pipeline.onOverride(r.toMessage()),r=new le,r.tryAdd(this._resolveOverrides(s.options)));break}await t.pipeline.onOverride(r.toMessage())}catch(r){m(r),0}}_getEffectiveAvailableFields(e){const t=ge(this._lastAvailableFields,e);return this._lastAvailableFields=t,C(this.layer.fieldsIndex,t)}async _createViewSchemaConfig(){const e=this.requiresCurrentUser?await this.signedInUser:null,t=[E(this.view,this.layerAdapter,this.timeExtent,this._visibilityOverrides,this.filter,this.effectiveDisplayFilterClause),this.featureEffect?.filter?.toJSON()??null];return{availableFields:this._getEffectiveAvailableFields(this.availableFields),displayFilterEnabled:this.displayFilterEnabled,filters:t,scale:this.view.scale,timeZone:this.view.timeZone,timeExtent:this.view.timeExtent,currentUser:e,spatialReference:this.view.spatialReference,extent:this.view.extent,returnZ:this.hasZ,returnM:this.hasM}}_processHighlight(){this._commandsQueue.push({type:"highlight"})}async _updateHighlights(){const e=this._getHighlights(),t=await this.getWorker();if(this.destroyed)return;const r=t.pipeline.updateHighlight({highlights:e}).catch(e=>{m(e)||u.getLogger(this).error(e)});this._updatingHandles.consumePromise(r)}_setOriginForFeature(e){e.layer=e.sourceLayer=this.layer,this.layerAdapter.setGraphicOrigin(e)}_createFeatureGraphicHit(e,t){return this._setOriginForFeature(t),this._createGraphicHit(e,t)}_createTrackGraphicHit(e,t){return t.layer=t.sourceLayer=this.layer,this.layerAdapter.setTrackGraphicOrigin?.(t),this._createGraphicHit(e,t)}_createAggregateGraphicHit(e,t){return t.layer=t.sourceLayer=this.layer,this.layerAdapter.setAggregateGraphicOrigin?.(t),this._createGraphicHit(e,t)}_createGraphicHit(e,t){return null!=t.geometry&&(t.geometry.spatialReference=this.view.spatialReference),{type:"graphic",graphic:t,layer:this.layer,mapPoint:e}}};function E(e,t,r,s,i,a){i&&(i=i.clone());const o=null!=i?i.timeExtent:null,n=null!=r&&null!=o?r.intersection(o):r||o;n&&(i??=new U,i.timeExtent=n),i=t.addFilters?.(i,e)??i,a&&(i??=new U,i.where=_(i.where,a));let l=i?.toJSON()??null;return s.size&&(l??=(new U).toJSON(),l.hiddenIds=Array.from(s)),l}return e([S()],b.prototype,"_commandsQueue",void 0),e([S()],b.prototype,"_sourceRefreshVersion",void 0),e([S()],b.prototype,"_displayRefreshVersion",void 0),e([S({readOnly:!0})],b.prototype,"_pipelineUpdating",void 0),e([S()],b.prototype,"_sourceUpdating",void 0),e([S({readOnly:!0})],b.prototype,"dataUpdating",null),e([S({readOnly:!0})],b.prototype,"hasAllFeatures",null),e([S({readOnly:!0})],b.prototype,"hasAllFeaturesInView",null),e([S({readOnly:!0})],b.prototype,"hasFullGeometries",null),e([S()],b.prototype,"featureEffectView",void 0),e([S()],b.prototype,"layerAdapter",null),e([S({readOnly:!0})],b.prototype,"timeExtent",null),b=e([A("esri.views.2d.layers.FeatureLikeLayerView2D")],b),b};export{_e as FeatureLikeLayerView2D};
2
+ import{__decorate as e}from"tslib";import t from"../../../AggregateGraphic.js";import r from"../../../Graphic.js";import s from"../../../TrackGraphic.js";import{isSome as i}from"../../../core/arrayUtils.js";import a from"../../../core/Collection.js";import o from"../../../core/Error.js";import{makeHandle as n,handlesGroup as l}from"../../../core/handleUtils.js";import has from"../../../core/has.js";import u from"../../../core/Logger.js";import{destroyMaybe as h}from"../../../core/maybe.js";import{notDeepEqual as c}from"../../../core/object.js";import{createAbortError as p,ignoreAbortErrors as d,throwIfNotAbortError as y,isAbortError as m}from"../../../core/promiseUtils.js";import{watch as g,sync as f}from"../../../core/reactiveUtils.js";import{isScreenRect as w}from"../../../core/screenUtils.js";import{sqlAnd as v}from"../../../core/sql.js";import{getMetersPerUnitForSR as _}from"../../../core/units.js";import{property as b,subclass as S}from"../../../core/accessorSupport/decorators.js";import{UpdatingHandles as A}from"../../../core/support/UpdatingHandles.js";import F from"../../../geometry/Extent.js";import{fromJSON as j}from"../../../geometry/support/jsonUtils.js";import x from"../../../geometry/support/rotate.js";import{isCurvedGeometry as E}from"../../../geometry/support/curves/curveUtils.js";import{densifyCurvedGeometry as I}from"../../../geometry/support/curves/densifyCurvedGeometry.js";import k from"../../../layers/effects/FeatureEffectView.js";import{convertFromFeature as O}from"../../../layers/graphics/featureConversionUtils.js";import U from"../../../layers/support/FeatureFilter.js";import{checkServiceCurrentUserSupport as R}from"../../../layers/support/featureLayerUtils.js";import{packFields as V}from"../../../layers/support/fieldUtils.js";import{getEffectiveLayerCapabilities as C}from"../../../layers/support/layerUtils.js";import{combineTimeExtent as Q}from"../../../layers/support/timeSupport.js";import q from"../../../rest/support/AggregateFeatureSet.js";import M from"../../../rest/support/AttributeBinsFeatureSet.js";import H from"../../../rest/support/AttributeBinsQuery.js";import P from"../../../rest/support/FeatureSet.js";import L from"../../../rest/support/Query.js";import{HittestDrawHelper as T}from"../../../symbols/cim/CIMSymbolDrawHelper.js";import{symbolToCIM as W}from"../../../symbols/cim/CIMSymbolHelper.js";import{getDisplayedSymbol as D}from"../../../symbols/support/symbolUtils.js";import{LayerView2D as G}from"./LayerView2D.js";import{FeatureContainer as N}from"./features/FeatureContainer.js";import{createFeaturePipelineWorkerProxy as J}from"./features/FeaturePipelineWorkerProxy.js";import{FeatureSourceEventLog as z}from"./features/FeatureSourceEventLog.js";import{AnnotationLayerAdapter as B}from"./features/layerAdapters/AnnotationLayerAdapter.js";import{CatalogFootprintLayerAdapter as Z}from"./features/layerAdapters/CatalogFootprintLayerAdapter.js";import{DimensionLayerAdapter as K}from"./features/layerAdapters/DimensionLayerAdapter.js";import{FeatureLayerAdapter as $}from"./features/layerAdapters/FeatureLayerAdapter.js";import{createFeatureIdInfo as X}from"./features/layerAdapters/featureServiceUtils.js";import{InMemoryLayerAdapter as Y}from"./features/layerAdapters/InMemoryLayerAdapter.js";import{KnowledgeGraphSublayerAdapter as ee}from"./features/layerAdapters/KnowledgeGraphSublayerAdapter.js";import{OGCFeatureLayerAdapter as te}from"./features/layerAdapters/OGCFeatureLayerAdapter.js";import{OrientedImageryLayerAdapter as re}from"./features/layerAdapters/OrientedImageryLayerAdapter.js";import{ParquetLayerAdapter as se}from"./features/layerAdapters/ParquetLayerAdapter.js";import{StreamLayerAdapter as ie}from"./features/layerAdapters/StreamLayerAdapter.js";import{SubtypeGroupLayerAdapter as ae}from"./features/layerAdapters/SubtypeGroupLayerAdapter.js";import{createComplexSymbolInstances as oe}from"./features/schema/processor/symbols/ComplexSymbolSchema.js";import{DebouncedFeatureOverride as ne}from"./support/DebouncedFeatureOverride.js";import{FeatureCommandQueue as le}from"./support/FeatureCommandQueue.js";import{handleNoEngineError as ue}from"./support/handleNoEngineError.js";import{toJSONGeometryType as he}from"./support/util.js";import{getMapPointsFromScreen as ce}from"../support/hitTestUtils.js";import{FeatureTileSubscriptionManager as pe}from"../tiling/FeatureTileSubscriptionManager.js";import{RefreshableLayerView as de}from"../../layers/RefreshableLayerView.js";import{getHighlightName as ye}from"../../support/highlightOptionsUtils.js";function me(e,t){const r=new Set;return e&&e.forEach(e=>r.add(e)),t&&t.forEach(e=>r.add(e)),r.has("*")?["*"]:Array.from(r)}const ge=4294967294;function fe(e,t){return l(e.map(e=>g(()=>{const t=e();return t&&"object"==typeof t?"getTime"in t&&"function"==typeof t.getTime?t.getTime():JSON.stringify(t):t},t,f)))}function we(e){if(!e.geometry)return e;if(!E(e.geometry))return e;const t=.001/_(e.geometry.spatialReference),r=100;return{geometry:I(e.geometry,{maxSegmentsPerCurve:12e3,maxSegmentLength:r*t,maxDeviation:0}),attributes:e.attributes}}const ve=l=>{const f=de(G(l));let _=class extends f{constructor(){super(...arguments),this._commandsQueue=new le({process:e=>{switch(e.type){case"override-batch":return this._doOverride(e);case"update":return this._doUpdate();case"highlight":return this._updateHighlights()}}}),this._visibilityOverrides=new Set,this._lastAvailableFields=[],this._lastTargetState=null,this.eventLog=new z,this._sourceRefreshVersion=1,this._displayRefreshVersion=1,this._pipelineUpdating=!1,this._editUpdatingHandles=new A,this._fields=null,this._hittestDrawHelper=null,this._sourceUpdating=!1,this.featureEffectView=new k}destroy(){this._editUpdatingHandles.destroy(),this._workerProxy?.destroy(),this._workerAttached.reject(p()),this._commandsQueue.destroy(),this._hittestDrawHelper?.destroy()}initialize(){this._workerAttached=Promise.withResolvers(),d(this._workerAttached.promise),this.addResolvingPromise(this._initProxy()),this.featureEffectView.featureEffect=this.featureEffect,this.featureEffectView.endTransition()}async _initProxy(){const e=this.layer;if("isTable"in e&&e.isTable)throw new o("featurelayerview:table-not-supported","table feature layer can't be displayed",{layer:e});if(("feature"===e.type||"subtype-group"===e.type)&&!1===C(e)?.operations.supportsQuery)throw new o("featurelayerview:query-not-supported","layer view requires a layer with query capability",{layer:e});this._workerProxy&&this._workerProxy.destroy();const t=this._createClientOptions();this._workerProxy=await J(t)}async _attachProxy(){const e=x(this.view.extent,this.view.rotation,this.view.center),t={tileInfoJSON:this.view?.featuresTilingScheme?.tileInfo?.toJSON(),initialViewExtent:e.toJSON()};try{await this._workerProxy.pipeline.onAttach(t),this._workerAttached.resolve()}catch(r){this._workerAttached.reject(p()),y(r)}}async _detachProxy(){return this._workerProxy.pipeline.onDetach()}async getWorker(){return await this._workerAttached.promise,this._workerProxy}get dataUpdating(){return this._sourceUpdating||this._editUpdatingHandles.updating}get hasAllFeatures(){return this.layer.visible&&!this.suspended&&this.eventLog.hasAllData&&this.eventLog.willQueryAllFeatures}get hasAllFeaturesInView(){const e=this.effectiveDisplayFilter?.where||null,t=!this.eventLog.willQueryAllFeatures&&null!=e&&"1=1"!==e;return this.layer.visible&&!this.suspended&&this.eventLog.hasAllData&&!t}get hasFullGeometries(){return this.layer.visible&&!this.suspended&&this.eventLog.hasAllData&&this.eventLog.willQueryFullResolutionGeometry}get layerAdapter(){switch(this.layer.type){case"annotation":return new B(this.layer);case"dimension-feature":return new K(this.layer);case"feature":return"memory"===this.layer.source.type?new Y(this.layer):new $(this.layer);case"geojson":case"csv":case"wfs":return new Y(this.layer);case"parquet":return new se(this.layer);case"subtype-group":return new ae(this.layer);case"ogc-feature":return new te(this.layer);case"stream":return new ie(this.layer);case"oriented-imagery":return new re(this.layer);case"knowledge-graph-sublayer":return new ee(this.layer);case"catalog-footprint":return new Z(this.layer);default:this.layer}return null}get timeExtent(){return Q(this.layerAdapter.timeOptions,this.view?.timeExtent,this._get("timeExtent"))}get usedMemory(){return this.container.usedMemory+this.eventLog.pipelineStatistics.usedMemory}getDisplayStatistics(e,t){return this.featureContainer?.getDisplayStatistics(e,t)}highlight(e,t){let s;e instanceof r?s=[e.getObjectId()]:"number"==typeof e||"string"==typeof e?s=[e]:a.isCollection(e)&&e.length>0?s=e.map(e=>e?.getObjectId()).toArray():Array.isArray(e)&&e.length>0&&(s="number"==typeof e[0]||"string"==typeof e[0]?e:e.map(e=>e?.getObjectId()));const o=s?.filter(i);if(!o?.length)return n();const l=ye(t);return this._addHighlights(o,l),n(()=>!this.destroyed&&this._removeHighlights(o,l))}async hitTest(e,i){const a=w(i),{trueHitIds:o,candidateHitIds:n}=await this.featureContainer.hitTest(i),l=await this.getWorker(),[u,h]=await Promise.all([l.pipeline.getDisplayFeatures(n),l.pipeline.getDisplayFeatures(o)]),{features:c,aggregates:p,tracks:d}=u,{features:y,aggregates:g,tracks:f}=h,v=[];if(a&&this.hasRenderer()){const e=new Map,t=new r;for(const r of c){t.attributes=r.attributes,t.geometry=j(r.geometry),t.symbol=null;const s=this.layerAdapter.getRenderer(t);if(!s){v.push(r);continue}const i=await D(t,{renderer:s,scale:this.view.scale,resolution:this.view.resolution,spatialReference:this.view.spatialReference,viewingMode:"2d",timeZone:this.view.timeZone});if(!i)continue;let a=null;const o=W(i);if("web-style"===o.type)try{const e=W(await o.fetchSymbol({acceptedFormats:["cim","web"]}));a="web-style"===e.type?null:e.symbol}catch(E){m(E),0;continue}else a=o.symbol;a&&e.set(r,a)}e.size>0&&!this._hittestDrawHelper&&(this._hittestDrawHelper=new T(this.view.stage.painter.textureManager.resourceManager));const{resolution:s,rotation:a}=this.view.state,o=ce(this.view,i);for(const[r,i]of e){if(!r)continue;this._hittestDrawHelper.hitTest(o,i,r.geometry,null,a,s,0,"rect")&&v.push(r)}}else v.push(...c);const _=[...y,...v],b=[...g,...p],S=[...f,...d],A=this.featureContainer.getSortKeys(_.map(e=>e.displayId)),F=({displayId:e},{displayId:t})=>A.has(e)&&A.has(t)?A.get(e)-A.get(t):e-t;_.sort(F).reverse(),b.sort(F).reverse();const x=has("parquetlayer-hittest-max-feature-count")??1;return"parquet"===this.layer.type&&_.length>x&&(_.length=x),[...b.map(r=>this._createAggregateGraphicHit(e,t.fromJSON(r))),...S.map(t=>this._createTrackGraphicHit(e,s.fromJSON(t))),..._.map(t=>this._createFeatureGraphicHit(a?null:e,r.fromJSON(t)))]}async queryAggregateSummaryStatistics(e,t,r){const s={...t,scale:this.view.scale},i=(await this.getWorker()).aggregates.executeQueryForSummaryStatistics(this._cleanUpAggregateQuery(e),s,r);return ue(i,{})}async queryUniqueValues(e,t,r){const s=await this.getWorker(),i={...t,scale:this.view.scale},a=s.features.executeQueryForUniqueValues(this._cleanUpQuery(e),i,r);return ue(a,{uniqueValueInfos:[]})}async queryAggregateUniqueValues(e,t,r){const s=await this.getWorker(),i={...t,scale:this.view.scale},a=s.aggregates.executeQueryForUniqueValues(this._cleanUpAggregateQuery(e),i,r);return ue(a,{uniqueValueInfos:[]})}async queryAggregateClassBreaks(e,t,r){const s=await this.getWorker(),i={...t,scale:this.view.scale},a=s.aggregates.executeQueryForClassBreaks(this._cleanUpAggregateQuery(e),i,r);return ue(a,{classBreakInfos:[]})}async queryHistogram(e,t,r){const s=await this.getWorker(),i={...t,scale:this.view.scale},a=s.features.executeQueryForHistogram(this._cleanUpQuery(e),i,r);return ue(a,{bins:[],maxValue:null,minValue:null,normalizationTotal:null})}async queryAggregateCount(e,t){const r=(await this.getWorker()).aggregates.executeQueryForCount(this._cleanUpAggregateQuery(e),t);return ue(r,0)}async queryAggregateHistogram(e,t,r){const s=await this.getWorker(),i={...t,scale:this.view.scale},a=s.aggregates.executeQueryForHistogram(this._cleanUpAggregateQuery(e),i,r);return ue(a,{bins:[],maxValue:null,minValue:null,normalizationTotal:null})}async queryAggregateIds(e,t){const r=(await this.getWorker()).aggregates.executeQueryForIds(this._cleanUpAggregateQuery(e),t);return ue(r,[])}async queryAggregateJSON(e,t){const r=(await this.getWorker()).aggregates.executeQuery(this._cleanUpAggregateQuery(e),t);return ue(r,{features:[]})}async queryAttributeBins(e,t){const r=(await this.getWorker()).features.executeAttributeBinsQuery(this._cleanUpAttributeBinsQuery(e),t),s=await ue(r,{features:[]});return M.fromJSON(s)}async queryAggregates(e,t){const r=(await this.getWorker()).aggregates.executeQuery(this._cleanUpAggregateQuery(e),t),s=await ue(r,{features:[]}),i=q.fromJSON(s);return i.features.forEach(e=>this.layerAdapter.setAggregateGraphicOrigin?.(e)),i}async queryClassBreaks(e,t,r){const s=await this.getWorker(),i={...t,scale:this.view.scale},a=s.features.executeQueryForClassBreaks(this._cleanUpQuery(e),i,r);return ue(a,{classBreakInfos:[]})}async queryExtent(e,t){const r=(await this.getWorker()).features.executeQueryForExtent(this._cleanUpQuery(e),t),s=await ue(r,{count:0,extent:null});return{count:s.count,extent:F.fromJSON(s.extent)}}async queryFeatureCount(e,t){const r=(await this.getWorker()).features.executeQueryForCount(this._cleanUpQuery(e),t);return ue(r,0)}queryFeatures(e,t){return this.queryFeaturesJSON(e,t).then(e=>{const t=P.fromJSON(e);return t.features.forEach(e=>this._setOriginForFeature(e)),t})}async queryFeaturesJSON(e,t){const r=(await this.getWorker()).features.executeQuery(this._cleanUpQuery(e),t);return ue(r,{features:[]})}async queryHeatmapStatistics(e){return(await this.getWorker()).pipeline.queryHeatmapStatistics(e)}async queryObjectIds(e,t){const r=(await this.getWorker()).features.executeQueryForIds(this._cleanUpQuery(e),t);return ue(r,[])}async queryStatistics(){const e=await this.getWorker();return ue(e.pipeline.queryStatistics(),{featureCount:0,ringCount:0,vertexCount:0})}async querySummaryStatistics(e,t,r){const s=await this.getWorker(),i={...t,scale:this.view.scale},a=s.features.executeQueryForSummaryStatistics(this._cleanUpQuery(e),i,r);return ue(a,{})}async queryVisibleFeatures(e,t){const r=(await this.getWorker()).pipeline.queryVisibleFeatures(this._cleanUpQuery(e),t),s=await ue(r,{features:[]}),i=P.fromJSON(s);return i.features.forEach(e=>this._setOriginForFeature(e)),i}async getSampleFeatures(e){return(await this.getWorker()).pipeline.getSampleFeatures(e)}setVisibility(e,t){t?this._visibilityOverrides.delete(e):this._visibilityOverrides.add(e),this._update()}update(e){if(!this._subscriptions)return;this.view.animation&&!this._lastTargetState&&(this._lastTargetState=e.state.clone()),!this.view.animation&&this._lastTargetState&&(this._lastTargetState=null);const t=this.featureContainer.getPresenting(),r=this._subscriptions.update(e.targetState,this._lastTargetState,t);r&&(this.featureContainer.updateSubscriptions(r),d(this._updatingHandles.addPromise(this.getWorker().then(e=>e.pipeline.updateSubscriptions(r))))),this._subscriptions.coverage&&this.featureContainer.setCoverage(this._subscriptions.coverage)}attach(){has("esri-2d-update-debug")&&console.debug("FeatureLayerView2D.attach"),d(this._updatingHandles.addPromise(this._workerAttached.promise)),d(this._attachProxy()),this.featureContainer=new N(this),this.container.addChild(this.featureContainer),this.view.timeline.record(`${this.layer.title} (FeatureLayer) Attach`),this._subscriptions=new pe(this.view.featuresTilingScheme),this.requestUpdate(),this.addAttachHandles([fe([()=>this._displayRefreshVersion,()=>"displayFilterInfo"in this.layer&&this.layer.displayFilterInfo,()=>this.timeExtent,()=>this.clips,()=>this.filter,()=>this.effectiveDisplayFilterClause,()=>this.featureEffect,()=>this._sourceRefreshVersion,()=>this.view.timeZone,()=>this.view.timeExtent,...this.layerAdapter.getUpdateHashProperties(this.view)],()=>this._update()),g(()=>this.updateSuspended,e=>{e||this._subscriptions.resume(this.featureContainer.getPresenting())}),g(()=>this.view.stationary,async e=>{if(e){const e=await this.getWorker(),t=x(this.view.extent,this.view.rotation,this.view.center);e.pipeline.updateStationaryExtent(t.toJSON(),this.featureContainer.requiresRefresh)}})]),this._update(),"stream"!==this.layer.type&&"parquet"!==this.layer.type&&"catalog-footprint"!==this.layer.type&&this.addAttachHandles(this.layer.on("edits",e=>this._editUpdatingHandles.addPromise(this._edit(e))))}detach(){has("esri-2d-update-debug")&&console.debug("FeatureLayerView2D.detach"),this._detachProxy(),this._fields=null,this.featureContainer.destroy(),this.featureContainer=null,this._commandsQueue.clear(),this.container.removeAllChildren(),this._subscriptions=h(this._subscriptions),this._workerProxy.pipeline.onDetach(),this._workerAttached=Promise.withResolvers(),d(this._workerAttached.promise),this._lastAvailableFields=[],this._lastSchema=null}viewChange(){this.requestUpdate()}moveEnd(){this.requestUpdate()}addOverrides(e){return this._commandsQueue.push({type:"override",options:{...e,release:[]}})}removeOverrides(e){for(const r of e)if(null==r)throw new o("featurelayerview:bad-override","Tried to remove an override for an invalid objectId",{objectId:r});const t={added:[],updated:[],removed:[],release:e,isWeak:!1,historicMoment:null};return this._commandsQueue.push({type:"override",options:t})}onProxyClientEvent(e){}hasRenderer(){return"renderer"in this.layer&&null!=this.layer.renderer}isUpdating(){const e=this.hasRenderer(),t=this._commandsQueue.updateTracking.updating,r=null!=this._updatingRequiredPromise,s=this.featureContainer.updating;return this.updateRequested||e&&(t||r)||s||this._pipelineUpdating||this.dataUpdating}_createClientOptions(){const e=this;return{updateSchemaStart:()=>e.updateSchemaStart(),updateSchemaEnd:t=>e.updateSchemaEnd(t),openMemoryPorts:async()=>{if(this.layerAdapter?.openMessagePorts){const e=await this.layerAdapter.openMessagePorts();return{result:e,transferList:e}}throw new Error("InternalError: Layer adapter does not support opening message ports")},get container(){return e.featureContainer},setUpdating:e=>{this._set("_pipelineUpdating",e.pipeline),this._set("_sourceUpdating",e.source)},emitEvent:e=>{this.onProxyClientEvent(e)},get eventLog(){return e.eventLog},fetch:async t=>{if(has("esri-2d-stabilize-glyphs")){const r=[];for(const s of t)r.push(await e.view.stage.painter.textureManager.rasterizeItem(s));return r}return Promise.all(t.map(t=>e.view.stage.painter.textureManager.rasterizeItem(t)))},fetchDictionary:e=>Promise.all(e.map(e=>this._fetchDictionaryRequest(e))),fetchMesh:e=>Promise.all(e.map(e=>this._fetchMeshRequest(e)))}}async _fetchDictionaryRequest(e){try{if("subtype-group"===this.layer.type)throw new Error("InternalError: SubtypeGroupLayer does not support dictionary renderer");const t=this.layer.renderer;if(!t||"dictionary"!==t.type)throw new Error("InternalError: Expected layer to have a DictionaryRenderer");const r=this._lastSchema.processor.mesh.factory.symbology;if("dictionary"!==r.type)throw new Error("InternalError: Expected schema to be of type 'dictionary'");const s={cimAnalyzer:this.view.stage.cimAnalyzer,cimResourceManager:this.view.stage.painter.textureManager.resourceManager,store:this.featureContainer.instanceStore,scaleExpression:r.scaleExpression};this._fields||(this._fields=this.layer.fields.map(e=>e.toJSON()));const i=r.visualVariableUniforms,a=he(this.layer.geometryType),o=await t.getSymbolForControlString(e.controlString,a,!1);if(!o||!o.data)return{type:"dictionary-response",meshes:[]};return{type:"dictionary-response",meshes:await oe({...o.data,hasTextStringTemplates:!0},{uniforms:i,path:"renderer",schemaOptions:s})}}catch(t){return{type:"dictionary-response",meshes:[]}}}async _fetchMeshRequest(e){const{layer:t}=this;try{const r={cimAnalyzer:this.view.stage.cimAnalyzer,cimResourceManager:this.view.stage.painter.textureManager.resourceManager,store:this.featureContainer.instanceStore,scaleExpression:null};this._fields||(this._fields=t.fields.map(e=>e.toJSON()));return{type:"mesh-response",meshes:await oe({...e.symbolReference,hasTextStringTemplates:!0},{path:"anno-like",schemaOptions:r,uniforms:{visualVariableColor:null,visualVariableOpacity:null,visualVariableRotation:null,visualVariableSizeStops:null,visualVariableSizeScaleStops:null,visualVariableSizeOutlineScaleStops:null,visualVariableSizeUnitValue:null,visualVariableSizeMinMaxValue:null}})}}catch(r){return{type:"mesh-response",meshes:[]}}}_cleanUpQuery(e){const t=L.from(e)||this.createQuery();return t.outSpatialReference||(t.outSpatialReference=this.view.spatialReference),"returnZ"in this.layer&&(t.returnZ??=this.layer.returnZ),"returnM"in this.layer&&(t.returnM??=this.layer.returnM),t.toJSON()}_cleanUpAttributeBinsQuery(e){const t=H.from(e);return t.outSpatialReference||(t.outSpatialReference=this.view.spatialReference),t.toJSON()}_cleanUpAggregateQuery(e){const t=L.from(e)||this.createAggregateQuery();t.outSpatialReference||(t.outSpatialReference=this.view.spatialReference);const r=t.objectIds??[];for(const s of t.aggregateIds??[])r.push(s);return t.objectIds=r,t.aggregateIds=[],t.toJSON()}async _update(){return this._commandsQueue.push({type:"update"})}_edit(e){return this._commandsQueue.push({type:"edit",event:e})}async doRefresh(e){this.attached&&(this.updateSuspended&&e||(e?this.incrementSourceRefreshVersion():this.incrementDisplayRefreshVersion()))}incrementSourceRefreshVersion(){this._sourceRefreshVersion=(this._sourceRefreshVersion+1)%ge+1}incrementDisplayRefreshVersion(){this._displayRefreshVersion=(this._displayRefreshVersion+1)%ge+1}async _resolveIdenifiers(e){const t=[],r=[];for(const a of e)null==a.objectId||-1===a.objectId?null==a.globalId?u.getLogger(this).warn("mapview-apply-edits","A feature identifier must contain either a GlobalId or ObjectId. Ignoring",{identifier:a}):r.push(a.globalId):t.push(a.objectId);const s="globalIdField"in this.layer&&this.layer.globalIdField,i=s&&this.availableFields.includes(s);if(r.length&&!i)return u.getLogger(this).error(new o("mapview-apply-edits",`Editing the specified service requires the layer's globalIdField, ${s} to be included the layer's outFields for updates to be reflected on the map`)),t;if(r.length){const e=await this._workerProxy.pipeline.getObjectIdsFromGlobalIds(r);for(const r of e)t.push(r)}return t}_resolveOverrides(e){const t=!1,r=!1,s=he(this.layer.geometryType),i=X(this.layer),a=[];for(const n of e.added){const e=O(we(n),s,t,r,i);if(null==e.objectId)throw new o("featurelayerview:bad-override","Feature does not have an objectId",{feature:n});a.push(e)}for(const n of e.updated){const e=O(we(n),s,t,r,i);if(null==e.objectId)throw new o("featurelayerview:bad-override","Feature does not have an objectId",{feature:n});a.push(e)}for(const n of e.removed)if(null==n)throw new o("featurelayerview:bad-override","Tried to remove an invalid objectId",{objectId:n});return{type:"override",updates:a,removed:e.removed,release:e.release,isWeak:e.isWeak??!1,historicMoment:e.historicMoment??null}}async _resolveEdit(e){const t=this.layer,r=e.historicMoment?.getTime()??null,s="layerId"in t&&e.editedFeatures?.find(e=>e.layerId===t.layerId);if(s&&this._canEditByFeature(s)){const{adds:e,deletes:t,updates:i}=s.editedFeatures,a=this.layer.objectIdField,o=i.map(e=>e.current),n=t.map(e=>"attributes"in e?{objectId:a?e.attributes[a]:null}:e),l=await this._resolveIdenifiers(n);return this._resolveOverrides({added:e,updated:o,removed:l,historicMoment:r,isWeak:!0,release:[]})}const[i,a,o]=await Promise.all([this._resolveIdenifiers(e.addedFeatures),this._resolveIdenifiers(e.updatedFeatures),this._resolveIdenifiers(e.deletedFeatures)]);return{type:"override-by-id",updates:[...i,...a],removed:o,historicMoment:r,isWeak:!0}}_canEditByFeature(e){const{adds:t,updates:r}=e.editedFeatures;return t.every(e=>this.view.spatialReference.equals(e.geometry?.spatialReference))&&r.every(e=>this.view.spatialReference.equals(e.current.geometry?.spatialReference))}async updateSchemaStart(){const e=this.layer;"featureReduction"in e&&e.featureReduction&&e.featureReduction!==this._lastFeatureReduction&&(e.featureReduction=e.featureReduction?.clone(),this._lastFeatureReduction=e.featureReduction);try{if(await Promise.allSettled([this._handleChange(),R(e)]),this.destroyed||!this.layerAdapter?.hasRequiredSupport||!this._subscriptions)return null;const t=this.featureContainer.updateStart("subtype-group"===e.type);this._lastFeatureEffect=this.featureEffect;const r={store:t,cimAnalyzer:this.view.stage.cimAnalyzer,cimResourceManager:this.view.stage.painter.textureManager.resourceManager,scaleExpression:void 0},s=await this._createViewSchemaConfig(),i={source:await this.layerAdapter.createSourceSchema(s,this._sourceRefreshVersion),processor:await this.layerAdapter.createProcessorSchema(r,s,this._displayRefreshVersion)};return c(this._lastSchema?.source.strategy,i.source.strategy)||c(this._lastSchema?.processor,i.processor)?(this._lastSchema=i,this._fields=null,i):null}catch(t){}return null}async updateSchemaEnd(e){try{this.featureEffectView.featureEffect=this._lastFeatureEffect,e&&this.featureEffectView.endTransition(),await this.featureContainer.updateEnd(this._lastSchema.processor,this.layerAdapter.getLabelingDeconflictionInfo(),e),has("esri-2d-update-debug")&&console.debug("FeatureLayerView2D.updateEnd")}catch(t){}}async _doUpdate(){const e=Math.round(performance.now()),t=await this.getWorker();await t.pipeline.updateSchema(e),this.requestUpdate()}async _doOverride(e){const t=await this.getWorker();try{let r=new ne;for(const s of e.messages)switch(s.type){case"edit":r.tryAdd(await this._resolveEdit(s.event))||(await t.pipeline.onOverride(r.toMessage()),r=new ne,r.tryAdd(await this._resolveEdit(s.event)));break;case"override":r.tryAdd(this._resolveOverrides(s.options))||(await t.pipeline.onOverride(r.toMessage()),r=new ne,r.tryAdd(this._resolveOverrides(s.options)));break}await t.pipeline.onOverride(r.toMessage())}catch(r){m(r),0}}_getEffectiveAvailableFields(e){const t=me(this._lastAvailableFields,e);return this._lastAvailableFields=t,V(this.layer.fieldsIndex,t)}async _createViewSchemaConfig(){const e=this.requiresCurrentUser?await this.signedInUser:null,t=[E(this.view,this.layerAdapter,this.timeExtent,this._visibilityOverrides,this.filter,this.effectiveDisplayFilterClause),this.featureEffect?.filter?.toJSON()??null];return{availableFields:this._getEffectiveAvailableFields(this.availableFields),displayFilterEnabled:this.displayFilterEnabled,filters:t,scale:this.view.scale,timeZone:this.view.timeZone,timeExtent:this.view.timeExtent,currentUser:e,spatialReference:this.view.spatialReference,extent:this.view.extent,returnZ:this.hasZ,returnM:this.hasM}}_processHighlight(){this._commandsQueue.push({type:"highlight"})}async _updateHighlights(){const e=this._getHighlights(),t=await this.getWorker();if(this.destroyed)return;const r=t.pipeline.updateHighlight({highlights:e}).catch(e=>{m(e)||u.getLogger(this).error(e)});this._updatingHandles.consumePromise(r)}_setOriginForFeature(e){e.layer=e.sourceLayer=this.layer,this.layerAdapter.setGraphicOrigin(e)}_createFeatureGraphicHit(e,t){return this._setOriginForFeature(t),this._createGraphicHit(e,t)}_createTrackGraphicHit(e,t){return t.layer=t.sourceLayer=this.layer,this.layerAdapter.setTrackGraphicOrigin?.(t),this._createGraphicHit(e,t)}_createAggregateGraphicHit(e,t){return t.layer=t.sourceLayer=this.layer,this.layerAdapter.setAggregateGraphicOrigin?.(t),this._createGraphicHit(e,t)}_createGraphicHit(e,t){return null!=t.geometry&&(t.geometry.spatialReference=this.view.spatialReference),{type:"graphic",graphic:t,layer:this.layer,mapPoint:e}}};function E(e,t,r,s,i,a){i&&(i=i.clone());const o=null!=i?i.timeExtent:null,n=null!=r&&null!=o?r.intersection(o):r||o;n&&(i??=new U,i.timeExtent=n),i=t.addFilters?.(i,e)??i,a&&(i??=new U,i.where=v(i.where,a));let l=i?.toJSON()??null;return s.size&&(l??=(new U).toJSON(),l.hiddenIds=Array.from(s)),l}return e([b()],_.prototype,"_commandsQueue",void 0),e([b()],_.prototype,"_sourceRefreshVersion",void 0),e([b()],_.prototype,"_displayRefreshVersion",void 0),e([b({readOnly:!0})],_.prototype,"_pipelineUpdating",void 0),e([b()],_.prototype,"_sourceUpdating",void 0),e([b({readOnly:!0})],_.prototype,"dataUpdating",null),e([b({readOnly:!0})],_.prototype,"hasAllFeatures",null),e([b({readOnly:!0})],_.prototype,"hasAllFeaturesInView",null),e([b({readOnly:!0})],_.prototype,"hasFullGeometries",null),e([b()],_.prototype,"featureEffectView",void 0),e([b()],_.prototype,"layerAdapter",null),e([b({readOnly:!0})],_.prototype,"timeExtent",null),_=e([S("esri.views.2d.layers.FeatureLikeLayerView2D")],_),_};export{ve as FeatureLikeLayerView2D};
@@ -1,2 +1,2 @@
1
1
  /* COPYRIGHT Esri - https://js.arcgis.com/5.1/LICENSE.txt */
2
- 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,ignoreAbortErrors as r}from"../../../../core/promiseUtils.js";import o from"../../../../core/RandomLCG.js";import{watch as n}from"../../../../core/reactiveUtils.js";import{pt2px as u}from"../../../../core/screenUtils.js";import{ignoreConnectionErrors as a}from"../../../../core/workers/utils.js";import d from"../../../../layers/support/TileInfo.js";import{tileSize as c}from"../../engine/webgl/definitions.js";import{PipelineConnectionHandlers as h}from"./PipelineConnectionHandlers.js";import p from"./Processor.js";import{FeatureSource as l}from"./sources/FeatureSource.js";import{FeatureTileSubscription as _}from"./sources/FeatureTileSubscription.js";import{Tile as g}from"./support/Tile.js";import f from"../../tiling/TileInfoView.js";class b{constructor(e){this.inner=e,this.resolver=Promise.withResolvers()}}class m{constructor(){this._aggregateAdapter={getFeatureObjectIds:e=>this._processor.getFeatureObjectIdsForAggregate(e)},this._subscriptions=new Map,this._cachedObjectIds=new Set,this._updateRequested=!1,this._didSourceRefresh=!1,this._refreshRequested=!0,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=d.fromJSON(e.tileInfoJSON);this._tileInfoView=new f(i),this._viewExtent=e.initialViewExtent,this._source=new l(this._aggregateAdapter,this._subscriptions,s,this._cachedObjectIds),this._processor=new p(s,this._source,e.requiredLevel,e.requiredScale),this._handles=t([this._source.store.events.on("changed",()=>this._requestUpdate()),this._source.store.events.on("refresh",()=>this._requestRefresh()),n(()=>this._source.updateTracking.updating,()=>{this._requestUpdate(),r(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 streamMessenger(){return this._source.streamMessenger}getUsedMemory(){return this._source.usedMemory+this._processor.usedMemory}getDisplayFeatures(e){return this._processor.getDisplayFeatures(e)}getDisplayIds(e){return this._processor.getDisplayIds(e)}getObjectIdsFromGlobalIds(e){return this._source.getObjectIdsFromGlobalIds(e)}updateStationaryExtent(e,t){t&&(this._refreshRequested=!0,this._requestUpdate()),this._viewExtent=e}updateRequiredLevel(e,t){this._processor.updateRequiredLevel(e,t),this._processor.hasClusters&&this._requestUpdate()}async updateSchema(e){return has("esri-2d-update-debug")&&this._updateSchemaRequest&&console.error("InternalError: Schema already updating"),this._updateSchemaRequest=new b({version:e}),this._requestUpdate(),this._updateSchemaRequest.resolver.promise}updateSubscriptions(e){const t=new b(e);return this._updateSubscriptionRequests.push(t),this._requestUpdate(),t.resolver.promise}updateHighlight(e){const t=new b(e);return this._updateHighlightRequests.push(t),this._requestUpdate(),t.resolver.promise}async onOverride(t){if(null!=this._updateOverridesRequest)throw new e("featurelayer","InternalError - Already processing an edit");this._updateOverridesRequest=new b(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(u(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()),a=this._source.chunks(),d=t**2,h=3/(Math.PI*d),p=2*t,l=Math.ceil(c/p);for(const u of n){const t=u.tile,n=new Float64Array(l*l);for(const s of a){const i=s.getTileReader(t);if(!i)continue;const u=i.getCursor();for(;u.next();){let t=1;if(null!=e.field){const s=u.readAttribute(e.field);t=r?-1*+s:+s+o}const s=u.readXForDisplay()/p,i=u.readYForDisplay()/p,a=Math.floor(s),c=Math.floor(i);if(a<0||c<0||a>=l||c>=l)continue;const _=((.5+a-s)*p)**2+((.5+c-i)*p)**2;if(_>d)continue;const g=t*(h*(1-_/d)**2);n[c+a*l]+=g}}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()),n=new o,u=3*e.sampleSize;for(let o=0;o<u&&i.length<e.sampleSize;o++){const e=r[n.getIntRange(0,t.length-1)];if(0===e.getSize())continue;const o=n.getIntRange(0,e.getSize()-1);e.setIndex(o);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=a(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 g(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{version:s}=e.inner,i=await this._connection.layerView.updateSchemaStart();i&&(t=await this._doUpdateSchema(i,s))}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);await this._source.applyOverride(e),has("esri-2d-update-debug")&&console.debug("Pipeline.endOverride",s.inner)}await this._source.applyCacheUpdate();const r=this._source.chunks(),o=this._source.updateTracking.updating;if(this._processor.requiresInvalidation(r)&&(t=!0),this._didSourceRefresh&&(t=!0,this._didSourceRefresh=!1),this._refreshRequested&&(this._refreshRequested=!1,t=!0),t&&(this._processor.invalidate(),await this._connection.container.updateRenderState(this._processor.version)),this._updateHighlightRequests.length){const e=this._updateHighlightRequests;this._updateHighlightRequests=[];for(const t of e)this._processor.updateHighlight(t.inner),t.resolver.resolve()}const n=this._source.cleanup();this._processor.removeChunks(n);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,this._viewExtent)}catch(u){has("esri-2d-update-debug")&&console.debug("InternalError",u)}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(r,o,this._viewExtent),has("esri-2d-update-debug")&&console.debug("Pipeline.updateChunksEnd"))}catch(u){i(u)}e?await this._connection.layerView.updateSchemaEnd(t):t&&await this._connection.container.swapRenderState(),null!=s&&s.resolver.resolve(),null!=e&&e.resolver.resolve(),this._connection.onEvent({type:"performance",usedMemory:this.getUsedMemory()}),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.source,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{m as default};
2
+ 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,ignoreAbortErrors as r}from"../../../../core/promiseUtils.js";import o from"../../../../core/RandomLCG.js";import{watch as n}from"../../../../core/reactiveUtils.js";import{pt2px as u}from"../../../../core/screenUtils.js";import{ignoreConnectionErrors as a}from"../../../../core/workers/utils.js";import d from"../../../../layers/support/TileInfo.js";import{tileSize as c}from"../../engine/webgl/definitions.js";import{PipelineConnectionHandlers as h}from"./PipelineConnectionHandlers.js";import p from"./Processor.js";import{FeatureSource as l}from"./sources/FeatureSource.js";import{FeatureTileSubscription as _}from"./sources/FeatureTileSubscription.js";import{Tile as g}from"./support/Tile.js";import f from"../../tiling/TileInfoView.js";class b{constructor(e){this.inner=e,this.resolver=Promise.withResolvers()}}class m{constructor(){this._aggregateAdapter={getFeatureObjectIds:e=>this._processor.getFeatureObjectIdsForAggregate(e)},this._subscriptions=new Map,this._cachedObjectIds=new Set,this._updateRequested=!1,this._didSourceRefresh=!1,this._refreshRequested=!0,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=d.fromJSON(e.tileInfoJSON);this._tileInfoView=new f(i),this._viewExtent=e.initialViewExtent,this._source=new l(this._aggregateAdapter,this._subscriptions,s,this._cachedObjectIds),this._processor=new p(s,this._source),this._handles=t([this._source.store.events.on("changed",()=>this._requestUpdate()),this._source.store.events.on("refresh",()=>this._requestRefresh()),n(()=>this._source.updateTracking.updating,()=>{this._requestUpdate(),r(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 streamMessenger(){return this._source.streamMessenger}getUsedMemory(){return this._source.usedMemory+this._processor.usedMemory}getDisplayFeatures(e){return this._processor.getDisplayFeatures(e)}getDisplayIds(e){return this._processor.getDisplayIds(e)}getObjectIdsFromGlobalIds(e){return this._source.getObjectIdsFromGlobalIds(e)}updateStationaryExtent(e,t){t&&(this._refreshRequested=!0,this._requestUpdate()),this._viewExtent=e}async updateSchema(e){return has("esri-2d-update-debug")&&this._updateSchemaRequest&&console.error("InternalError: Schema already updating"),this._updateSchemaRequest=new b({version:e}),this._requestUpdate(),this._updateSchemaRequest.resolver.promise}updateSubscriptions(e){const t=new b(e);return this._updateSubscriptionRequests.push(t),this._requestUpdate(),t.resolver.promise}updateHighlight(e){const t=new b(e);return this._updateHighlightRequests.push(t),this._requestUpdate(),t.resolver.promise}async onOverride(t){if(null!=this._updateOverridesRequest)throw new e("featurelayer","InternalError - Already processing an edit");this._updateOverridesRequest=new b(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(u(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()),a=this._source.chunks(),d=t**2,h=3/(Math.PI*d),p=2*t,l=Math.ceil(c/p);for(const u of n){const t=u.tile,n=new Float64Array(l*l);for(const s of a){const i=s.getTileReader(t);if(!i)continue;const u=i.getCursor();for(;u.next();){let t=1;if(null!=e.field){const s=u.readAttribute(e.field);t=r?-1*+s:+s+o}const s=u.readXForDisplay()/p,i=u.readYForDisplay()/p,a=Math.floor(s),c=Math.floor(i);if(a<0||c<0||a>=l||c>=l)continue;const _=((.5+a-s)*p)**2+((.5+c-i)*p)**2;if(_>d)continue;const g=t*(h*(1-_/d)**2);n[c+a*l]+=g}}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()),n=new o,u=3*e.sampleSize;for(let o=0;o<u&&i.length<e.sampleSize;o++){const e=r[n.getIntRange(0,t.length-1)];if(0===e.getSize())continue;const o=n.getIntRange(0,e.getSize()-1);e.setIndex(o);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=a(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 g(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{version:s}=e.inner,i=await this._connection.layerView.updateSchemaStart();i&&(t=await this._doUpdateSchema(i,s))}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);await this._source.applyOverride(e),has("esri-2d-update-debug")&&console.debug("Pipeline.endOverride",s.inner)}await this._source.applyCacheUpdate();const r=this._source.chunks(),o=this._source.updateTracking.updating;if(this._processor.requiresInvalidation(r)&&(t=!0),this._didSourceRefresh&&(t=!0,this._didSourceRefresh=!1),this._refreshRequested&&(this._refreshRequested=!1,t=!0),t&&(this._processor.invalidate(),await this._connection.container.updateRenderState(this._processor.version)),this._updateHighlightRequests.length){const e=this._updateHighlightRequests;this._updateHighlightRequests=[];for(const t of e)this._processor.updateHighlight(t.inner),t.resolver.resolve()}const n=this._source.cleanup();this._processor.removeChunks(n);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,this._viewExtent)}catch(u){has("esri-2d-update-debug")&&console.debug("InternalError",u)}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(r,o,this._viewExtent),has("esri-2d-update-debug")&&console.debug("Pipeline.updateChunksEnd"))}catch(u){i(u)}e?await this._connection.layerView.updateSchemaEnd(t):t&&await this._connection.container.swapRenderState(),null!=s&&s.resolver.resolve(),null!=e&&e.resolver.resolve(),this._connection.onEvent({type:"performance",usedMemory:this.getUsedMemory()}),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.source,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{m as default};
@@ -1,2 +1,2 @@
1
1
  /* COPYRIGHT Esri - https://js.arcgis.com/5.1/LICENSE.txt */
2
- import has from"../../../../core/has.js";import{destroyMaybe as e}from"../../../../core/maybe.js";import{notDeepEqual as t}from"../../../../core/object.js";import{throwIfNotAbortError as s,throwIfAborted as r,after as i}from"../../../../core/promiseUtils.js";import{diff as a}from"../../../../core/accessorSupport/diffUtils.js";import{ignoreConnectionErrors as o}from"../../../../core/workers/utils.js";import{normalizeTransform as n,quantizeX as c,quantizeY as h}from"../../../../geometry/support/quantizationUtils.js";import{MultiTileMeshData as u}from"../../engine/webgl/mesh/MultiTileMeshData.js";import{FeatureMeshFactory as p}from"../../engine/webgl/mesh/factories/FeatureMeshFactory.js";import{ResourceProxy as g}from"../../engine/webgl/mesh/factories/ResourceProxy.js";import{MeshWriterRegistry as d}from"../../engine/webgl/shaderGraph/techniques/mesh/MeshWriterRegistry.js";import{MatcherContext as y}from"../../engine/webgl/util/MatcherContext.js";import{ProcessorTileMessageQueue as _}from"./ProcessorTileMessageQueue.js";import{BinningStrategy as l}from"./processor/BinningStrategy.js";import{ClusterStrategy as m}from"./processor/ClusterStrategy.js";import{FeatureUpdateStrategy as f}from"./processor/FeatureUpdateStrategy.js";import{TrackStrategy as b}from"./processor/TrackStrategy.js";import{AttributeStore as w}from"./support/AttributeStore.js";import{ComputedAttributeStorage as S}from"./support/ComputedAttributeStorage.js";class j{constructor(e,t,s,r){this._connection=e,this._source=t,this._requiredLevel=s,this._requiredScale=r,this._version=1,this._registry=new d,this._proxy=new g({fetch:(e,t)=>this._connection.layerView.fetch(e,t),fetchDictionary:(e,t)=>this._connection.layerView.fetchDictionary(e,t),fetchMesh:(e,t)=>this._connection.layerView.fetchMesh(e,t)}),this._attributeStore=new w({isLocal:!1,update:e=>o(this._connection.container.updateAttributeView(e))})}destroy(){this._proxy.destroy(),this._strategy?.destroy(),this._attributeStore.destroy()}get hasClusters(){return"cluster"===this._schema?.mesh.strategy.type}get aggregateQueryEngine(){return this._strategy?.aggregateQueryEngine}get usedMemory(){let e=0;return e+=this._attributeStore.usedMemory,this._strategy&&(e+=this._strategy.usedMemory),e}get version(){return this._version}getDisplayFeatures(e){return this._strategy?this._strategy.getDisplayFeatures(e):{features:[],aggregates:[],tracks:[]}}getDisplayIds(e){const t={};return this._strategy?(this._strategy.displayMap(e,e=>e,(e,s,r)=>{t[r]=e}),t):t}getFeatureObjectIdsForAggregate(e){return this._strategy?this._strategy.getFeatureObjectIdsForAggregate(e):[]}onSubscribe(e){this._strategy?.onSubscribe(e)}onUnsubscribe(e){this._strategy?.onUnsubscribe(e)}requiresInvalidation(e){return this._strategy?.requiresInvalidation(e)??!1}updateRequiredLevel(e,t){this._strategy?.updateRequiredLevel(e,t),this._requiredLevel=e,this._requiredScale=t}async update(e,s,r,i,o){const n=e.processor,c=t(this._schema?.storage,n.storage),h=t(this._schema?.mesh.properties,n.mesh.properties),u=t(this._schema?.mesh.factory,n.mesh.factory),g=t(this._schema?.mesh.strategy,n.mesh.strategy),d=v(this._schema?.expressionProperties,n.expressionProperties),_=d.some(e=>this._attributeStore.hasArcadeDependency(e)),l=d.some(e=>this._factory?.hasArcadeDependency(e)??!1),m=d.some(e=>this._strategy?.hasArcadeDependency(e))||this._strategy?.isAggregate&&_,f=l||m,b=h||u||g;if(!(c||b||(l||_||m))&&!i)return!1;has("esri-2d-update-debug")&&console.debug(`Version[${this._version}] SymbolProcessor.update`,{changes:a(this._schema,n),schema:n}),this._schema=n;const w=new S({fields:this._source.metadata.fieldsIndex,spatialReference:this._source.metadata.outSpatialReference}),j={currentUser:n.mesh.properties.currentUser};if((c||b||_)&&(await this._attributeStore.update(n.storage,w,this._source.metadata,s),this._strategy?.invalidateAttributeData(I(n))),!i&&!b&&!f)return!1;(g||h||f)&&await this._updateStrategy(n.mesh.strategy,o,I(n),j),this._updateSortKey(w,"sortKey"in n.mesh.properties?n.mesh.properties.sortKey:null);const M="dictionary"===n.mesh.factory.symbology.type?n.mesh.factory.symbology.fieldMap:null,x=new y(w,this._proxy,r,this._registry,M);return(u||"dictionary"===n.mesh.factory.symbology.type)&&(this._factory=await p.create(x,n.mesh.factory)),this._version=s,!0}async applyOverrideUpdate(e,t){if(!this._strategy)return;const s=this._strategy.applyOverrideUpdate(e);for await(const i of s)try{await this._process(i,t)}catch(r){}}async updateChunks(e,t,s){await this._doUpdateChunks(e,t,s),this._strategy?.afterUpdateChunks()}async removeChunks(e){this._strategy?.removeChunks(e),this._attributeStore.incrementDisplayIdGeneration()}updateHighlight({highlights:e}){if(!this._strategy||!this._strategy.hasSubscribers)return void this._attributeStore.setHighlight(e.map(({objectId:e,highlightFlags:t})=>({objectId:e,highlightFlags:t,displayId:-1})),e);const t=this._strategy.displayMap(e,({objectId:e})=>e,(e,{highlightFlags:t},s)=>({objectId:s,displayId:e,highlightFlags:t}));this._attributeStore.setHighlight(t,e)}invalidate(){this._strategy&&this._strategy.invalidate()}async _doUpdateChunks(e,t,r){if(!this._strategy)return;const i=this._strategy.updateChunks(e,t),a=[],o=new Map;for await(const c of i){let e=o.get(c.id);null==e&&(e=new _({concurrency:16,process:e=>this._process(e,r)}),o.set(c.id,e));const t=e.push(c).catch(e=>s(e));a.push(t)}try{await Promise.all(a)}catch(n){}has("esri-2d-update-debug")&&console.log("SendUpdates"),this._attributeStore.sendUpdates(),has("esri-2d-update-debug")&&console.log("SendUpdates.await")}async _updateStrategy(e,t,s,r){switch(this._strategy?.destroy(),e.type){case"feature":this._strategy=new f(this._source,this._attributeStore,s,r);break;case"binning":this._strategy=await l.create(e,this._source,this._attributeStore,s,r);break;case"cluster":this._strategy=await m.create(this._connection,e,this._source,this._attributeStore,s,r,this._requiredLevel,this._requiredScale);break;case"track":this._strategy=await b.create(e,this._source,this._attributeStore,s,r)}for(const i of t)this._strategy.onSubscribe(i)}async _updateSortKey(t,s){if(this._sortInfo=e(this._sortInfo?.computed),null!=s){const e=s.byRenderer?null:await t.createComputedField(s);this._sortInfo={...s,computed:e}}}async _process(e,t){const s=e.subscription;if(has("esri-2d-update-debug")){const t=s.tile;console.debug(`Version[${this._version}] Tile[${t.key.id}, end=${e.end}] Processor._process`)}const i={currentUser:this._schema?.mesh.properties.currentUser};await this._fetchResources(e,i),r(s.signal);const a=await this._write(e,s.tile.createArcadeEvaluationOptions(I(this._schema)),i,t),o=s.tile.tileInfoView.getLODInfoAt(s.tile.key);r(s.signal);const{message:n,transferList:c}=a.serialize(o),h={objectIdMap:null,inner:e.createMessage(n,this._version,this._attributeStore.epoch)};if(this._schema?.mesh.properties.returnMeshObjectId){h.objectIdMap={};const t=e.reader?.getCursor();if(t)for(;t.next();)h.objectIdMap[t.getDisplayId()]=t.getObjectId()}if(r(s.signal),await this._connection.container.onMessage(h,{signal:s.signal,transferList:c}),this._attributeStore.sendUpdates(),has("esri-2d-update-debug")){const t=s.tile;console.debug(`Version[${this._version}] Tile[${t.key.id}, end=${e.end}] Processor._process.await`)}}async _fetchResources(e,t){await this._fetchMatcherResources(e),await this._fetchWriterResources(e,t)}async _fetchMatcherResources(e){if(!e.reader)return;const t=e.subscription.tile.createArcadeEvaluationOptions(I(this._schema));return this._factory.enqueueMatcherRequests(this._proxy,e.reader,{scale:t.$view.scale,viewingMode:"2d"},e.id)}async _fetchWriterResources(e,t){if(!e.reader)return;const s=e.reader.getCursor(),r=e.subscription.tile.createArcadeEvaluationOptions(I(this._schema));for(;s.next();)this._factory.enqueueWriterRequests(this._proxy,s,r,t);await this._proxy.fetchEnqueuedResources()}async _write(e,t,s,a){const o=e.subscription.tile,n=e.reader?.getCursor(),c=n?.getSize()??0,h=o.tileInfoView.tileInfo.isWrappable,p=o.tileInfoView.spatialReference.isWGS84,g=this._schema?.mesh.factory.referenceScale,d=new u(o.key,this._strategy.enablePixelBuffering,h,p,c);if(!n)return d;const y=M(o.transform,a),_=o.createArcadeEvaluationOptions(I(this._schema));let l=0;for(;n.next();){++l%1e3||(await i(0),r(e.subscription));const a=this._getSortKeyValue(n,t);d.entityStart(n.getDisplayId(),a);try{this._factory.write(d,this._proxy,n,_,s,o.level,y,g)}catch(m){}d.entityEnd()}return d}_getSortKeyValue(e,t){if(!this._sortInfo)return 0;const{computed:s,order:r,byRenderer:i}=this._sortInfo,a=i?this._factory.getSortKey(e,t):s?.read(e,t);return null==a||isNaN(a)?0:a*("asc"===r?-1:1)}}function v(e,t){const s=[];return e?.timeExtent?.start===t.timeExtent?.start&&e?.timeExtent?.end===t.timeExtent?.end||s.push("timeProperties"),s}function I(e){const{timeZone:t}=e?.mesh.properties??{},{timeExtent:s}=e?.expressionProperties??{};return{timeZone:t,timeExtent:s}}function M(e,t){const s=n(e),r=[];for(const i of t.rings){const e=[];for(const t of i)e.push([c(s,t[0]),h(s,t[1])]);r.push(e)}return{rings:r}}export{j as default};
2
+ import has from"../../../../core/has.js";import{destroyMaybe as t}from"../../../../core/maybe.js";import{notDeepEqual as e}from"../../../../core/object.js";import{throwIfNotAbortError as s,throwIfAborted as r,after as i}from"../../../../core/promiseUtils.js";import{diff as a}from"../../../../core/accessorSupport/diffUtils.js";import{ignoreConnectionErrors as o}from"../../../../core/workers/utils.js";import{normalizeTransform as n,quantizeX as c,quantizeY as h}from"../../../../geometry/support/quantizationUtils.js";import{MultiTileMeshData as u}from"../../engine/webgl/mesh/MultiTileMeshData.js";import{FeatureMeshFactory as g}from"../../engine/webgl/mesh/factories/FeatureMeshFactory.js";import{ResourceProxy as p}from"../../engine/webgl/mesh/factories/ResourceProxy.js";import{MeshWriterRegistry as y}from"../../engine/webgl/shaderGraph/techniques/mesh/MeshWriterRegistry.js";import{MatcherContext as d}from"../../engine/webgl/util/MatcherContext.js";import{ProcessorTileMessageQueue as _}from"./ProcessorTileMessageQueue.js";import{BinningStrategy as l}from"./processor/BinningStrategy.js";import{ClusterStrategy as m}from"./processor/ClusterStrategy.js";import{FeatureUpdateStrategy as f}from"./processor/FeatureUpdateStrategy.js";import{TrackStrategy as b}from"./processor/TrackStrategy.js";import{AttributeStore as w}from"./support/AttributeStore.js";import{ComputedAttributeStorage as S}from"./support/ComputedAttributeStorage.js";class j{constructor(t,e){this._connection=t,this._source=e,this._version=1,this._registry=new y,this._proxy=new p({fetch:(t,e)=>this._connection.layerView.fetch(t,e),fetchDictionary:(t,e)=>this._connection.layerView.fetchDictionary(t,e),fetchMesh:(t,e)=>this._connection.layerView.fetchMesh(t,e)}),this._attributeStore=new w({isLocal:!1,update:t=>o(this._connection.container.updateAttributeView(t))})}destroy(){this._proxy.destroy(),this._strategy?.destroy(),this._attributeStore.destroy()}get hasClusters(){return"cluster"===this._schema?.mesh.strategy.type}get aggregateQueryEngine(){return this._strategy?.aggregateQueryEngine}get usedMemory(){let t=0;return t+=this._attributeStore.usedMemory,this._strategy&&(t+=this._strategy.usedMemory),t}get version(){return this._version}getDisplayFeatures(t){return this._strategy?this._strategy.getDisplayFeatures(t):{features:[],aggregates:[],tracks:[]}}getDisplayIds(t){const e={};return this._strategy?(this._strategy.displayMap(t,t=>t,(t,s,r)=>{e[r]=t}),e):e}getFeatureObjectIdsForAggregate(t){return this._strategy?this._strategy.getFeatureObjectIdsForAggregate(t):[]}onSubscribe(t){this._strategy?.onSubscribe(t)}onUnsubscribe(t){this._strategy?.onUnsubscribe(t)}requiresInvalidation(t){return this._strategy?.requiresInvalidation(t)??!1}async update(t,s,r,i,o){const n=t.processor,c=e(this._schema?.storage,n.storage),h=e(this._schema?.mesh.properties,n.mesh.properties),u=e(this._schema?.mesh.factory,n.mesh.factory),p=e(this._schema?.mesh.strategy,n.mesh.strategy),y=I(this._schema?.expressionProperties,n.expressionProperties),_=y.some(t=>this._attributeStore.hasArcadeDependency(t)),l=y.some(t=>this._factory?.hasArcadeDependency(t)??!1),m=y.some(t=>this._strategy?.hasArcadeDependency(t))||this._strategy?.isAggregate&&_,f=l||m,b=h||u||p;if(!(c||b||(l||_||m))&&!i)return!1;has("esri-2d-update-debug")&&console.debug(`Version[${this._version}] SymbolProcessor.update`,{changes:a(this._schema,n),schema:n}),this._schema=n;const w=new S({fields:this._source.metadata.fieldsIndex,spatialReference:this._source.metadata.outSpatialReference}),j={currentUser:n.mesh.properties.currentUser};if((c||b||_)&&(await this._attributeStore.update(n.storage,w,this._source.metadata,s),this._strategy?.invalidateAttributeData(v(n))),!i&&!b&&!f)return!1;(p||h||f)&&await this._updateStrategy(n.mesh.strategy,o,v(n),j),this._updateSortKey(w,"sortKey"in n.mesh.properties?n.mesh.properties.sortKey:null);const M="dictionary"===n.mesh.factory.symbology.type?n.mesh.factory.symbology.fieldMap:null,x=new d(w,this._proxy,r,this._registry,M);return(u||"dictionary"===n.mesh.factory.symbology.type)&&(this._factory=await g.create(x,n.mesh.factory)),this._version=s,!0}async applyOverrideUpdate(t,e){if(!this._strategy)return;const s=this._strategy.applyOverrideUpdate(t);for await(const i of s)try{await this._process(i,e)}catch(r){}}async updateChunks(t,e,s){await this._doUpdateChunks(t,e,s),this._strategy?.afterUpdateChunks()}async removeChunks(t){this._strategy?.removeChunks(t),this._attributeStore.incrementDisplayIdGeneration()}updateHighlight({highlights:t}){if(!this._strategy||!this._strategy.hasSubscribers)return void this._attributeStore.setHighlight(t.map(({objectId:t,highlightFlags:e})=>({objectId:t,highlightFlags:e,displayId:-1})),t);const e=this._strategy.displayMap(t,({objectId:t})=>t,(t,{highlightFlags:e},s)=>({objectId:s,displayId:t,highlightFlags:e}));this._attributeStore.setHighlight(e,t)}invalidate(){this._strategy&&this._strategy.invalidate()}async _doUpdateChunks(t,e,r){if(!this._strategy)return;const i=this._strategy.updateChunks(t,e),a=[],o=new Map;for await(const c of i){let t=o.get(c.id);null==t&&(t=new _({concurrency:16,process:t=>this._process(t,r)}),o.set(c.id,t));const e=t.push(c).catch(t=>s(t));a.push(e)}try{await Promise.all(a)}catch(n){}has("esri-2d-update-debug")&&console.log("SendUpdates"),this._attributeStore.sendUpdates(),has("esri-2d-update-debug")&&console.log("SendUpdates.await")}async _updateStrategy(t,e,s,r){switch(this._strategy?.destroy(),t.type){case"feature":this._strategy=new f(this._source,this._attributeStore,s,r);break;case"binning":this._strategy=await l.create(t,this._source,this._attributeStore,s,r);break;case"cluster":this._strategy=await m.create(this._connection,t,this._source,this._attributeStore,s,r);break;case"track":this._strategy=await b.create(t,this._source,this._attributeStore,s,r)}for(const i of e)this._strategy.onSubscribe(i)}async _updateSortKey(e,s){if(this._sortInfo=t(this._sortInfo?.computed),null!=s){const t=s.byRenderer?null:await e.createComputedField(s);this._sortInfo={...s,computed:t}}}async _process(t,e){const s=t.subscription;if(has("esri-2d-update-debug")){const e=s.tile;console.debug(`Version[${this._version}] Tile[${e.key.id}, end=${t.end}] Processor._process`)}const i={currentUser:this._schema?.mesh.properties.currentUser};await this._fetchResources(t,i),r(s.signal);const a=await this._write(t,s.tile.createArcadeEvaluationOptions(v(this._schema)),i,e),o=s.tile.tileInfoView.getLODInfoAt(s.tile.key);r(s.signal);const{message:n,transferList:c}=a.serialize(o),h={objectIdMap:null,inner:t.createMessage(n,this._version,this._attributeStore.epoch)};if(this._schema?.mesh.properties.returnMeshObjectId){h.objectIdMap={};const e=t.reader?.getCursor();if(e)for(;e.next();)h.objectIdMap[e.getDisplayId()]=e.getObjectId()}if(r(s.signal),await this._connection.container.onMessage(h,{signal:s.signal,transferList:c}),this._attributeStore.sendUpdates(),has("esri-2d-update-debug")){const e=s.tile;console.debug(`Version[${this._version}] Tile[${e.key.id}, end=${t.end}] Processor._process.await`)}}async _fetchResources(t,e){await this._fetchMatcherResources(t),await this._fetchWriterResources(t,e)}async _fetchMatcherResources(t){if(!t.reader)return;const e=t.subscription.tile.createArcadeEvaluationOptions(v(this._schema));return this._factory.enqueueMatcherRequests(this._proxy,t.reader,{scale:e.$view.scale,viewingMode:"2d"},t.id)}async _fetchWriterResources(t,e){if(!t.reader)return;const s=t.reader.getCursor(),r=t.subscription.tile.createArcadeEvaluationOptions(v(this._schema));for(;s.next();)this._factory.enqueueWriterRequests(this._proxy,s,r,e);await this._proxy.fetchEnqueuedResources()}async _write(t,e,s,a){const o=t.subscription.tile,n=t.reader?.getCursor(),c=n?.getSize()??0,h=o.tileInfoView.tileInfo.isWrappable,g=o.tileInfoView.spatialReference.isWGS84,p=this._schema?.mesh.factory.referenceScale,y=new u(o.key,this._strategy.enablePixelBuffering,h,g,c);if(!n)return y;const d=M(o.transform,a),_=o.createArcadeEvaluationOptions(v(this._schema));let l=0;for(;n.next();){++l%1e3||(await i(0),r(t.subscription));const a=this._getSortKeyValue(n,e);y.entityStart(n.getDisplayId(),a);try{this._factory.write(y,this._proxy,n,_,s,o.level,d,p)}catch(m){}y.entityEnd()}return y}_getSortKeyValue(t,e){if(!this._sortInfo)return 0;const{computed:s,order:r,byRenderer:i}=this._sortInfo,a=i?this._factory.getSortKey(t,e):s?.read(t,e);return null==a||isNaN(a)?0:a*("asc"===r?-1:1)}}function I(t,e){const s=[];return t?.timeExtent?.start===e.timeExtent?.start&&t?.timeExtent?.end===e.timeExtent?.end||s.push("timeProperties"),s}function v(t){const{timeZone:e}=t?.mesh.properties??{},{timeExtent:s}=t?.expressionProperties??{};return{timeZone:e,timeExtent:s}}function M(t,e){const s=n(t),r=[];for(const i of e.rings){const t=[];for(const e of i)t.push([c(s,e[0]),h(s,e[1])]);r.push(t)}return{rings:r}}export{j as default};
@@ -1,2 +1,2 @@
1
1
  /* COPYRIGHT Esri - https://js.arcgis.com/5.1/LICENSE.txt */
2
- import has from"../../../../../core/has.js";class e{constructor(e){this.subscription=e,this.handledChunks=new Set,has("esri-2d-update-debug")&&console.debug(`Tile[${e.tile.id}] ASendState.create`)}destroy(){}}class t{constructor(e,t,s){this._source=e,this._attributeStore=t,this._sqlOptions=s,this._sendStates=new Map}destroy(){}get enablePixelBuffering(){return!0}get isAggregate(){return!1}get usedMemory(){return 0}updateRequiredLevel(e,t){}onSubscribe(e){const t=this.createState(e);this._sendStates.set(e.key.id,t)}onUnsubscribe(e){this._sendStates.get(e.key.id)?.destroy(),this._sendStates.delete(e.key.id)}get hasSubscribers(){return this._sendStates.size>0}requiresInvalidation(e){return!1}invalidate(){const e=Array.from(this._sendStates.values());this._sendStates.clear();for(const t of e)t.destroy(),this.onSubscribe(t.subscription)}invalidateAttributeData(e){}hasArcadeDependency(e){return!1}getFeatureObjectIdsForAggregate(e){throw new Error("InternalError: AggregateId lookup not supported")}getDisplayIds(e){return this.displayMap(e,e=>e,e=>e)}getDisplayAndObjectIds(e){return this.displayMap(e,e=>e,(e,t,s)=>[e,s])}afterUpdateChunks(){}}export{t as AProcessorStrategy,e as ASendState};
2
+ import has from"../../../../../core/has.js";class e{constructor(e){this.subscription=e,this.handledChunks=new Set,has("esri-2d-update-debug")&&console.debug(`Tile[${e.tile.id}] ASendState.create`)}destroy(){}}class t{constructor(e,t,s){this._source=e,this._attributeStore=t,this._sqlOptions=s,this._sendStates=new Map}destroy(){}get enablePixelBuffering(){return!0}get isAggregate(){return!1}get usedMemory(){return 0}onSubscribe(e){const t=this.createState(e);this._sendStates.set(e.key.id,t)}onUnsubscribe(e){this._sendStates.get(e.key.id)?.destroy(),this._sendStates.delete(e.key.id)}get hasSubscribers(){return this._sendStates.size>0}requiresInvalidation(e){return!1}invalidate(){const e=Array.from(this._sendStates.values());this._sendStates.clear();for(const t of e)t.destroy(),this.onSubscribe(t.subscription)}invalidateAttributeData(e){}hasArcadeDependency(e){return!1}getFeatureObjectIdsForAggregate(e){throw new Error("InternalError: AggregateId lookup not supported")}getDisplayIds(e){return this.displayMap(e,e=>e,e=>e)}getDisplayAndObjectIds(e){return this.displayMap(e,e=>e,(e,t,s)=>[e,s])}afterUpdateChunks(){}}export{t as AProcessorStrategy,e as ASendState};
@@ -1,2 +1,2 @@
1
1
  /* COPYRIGHT Esri - https://js.arcgis.com/5.1/LICENSE.txt */
2
- import has from"../../../../../core/has.js";import{getOrCreateMapValue as e}from"../../../../../core/MapUtils.js";import{equals as t}from"../../../../../core/SetUtils.js";import{convertToFeature as s}from"../../../../../layers/graphics/featureConversionUtils.js";import{OptimizedFeature as i}from"../../../../../layers/graphics/OptimizedFeature.js";import r from"../../../../../layers/graphics/OptimizedGeometry.js";import a from"../../../../../layers/support/FieldsIndex.js";import{tileSize as n}from"../../../engine/webgl/definitions.js";import{ComputedAggregateField as l}from"../aggregation/ComputedAggregateField.js";import{GridCell as o}from"../aggregation/GridCell.js";import{GridIndexCell as d}from"../aggregation/GridIndexCell.js";import{pixelsPerMapUnit as c}from"../aggregation/GridSpatialIndex.js";import{AAggregateStrategy as u}from"./AAggregateStrategy.js";import{ASendState as p}from"./AProcessorStrategy.js";import{WithDisplayId as h}from"./support/WithDisplayId.js";import{FeatureTileAppendMessage as f}from"../sources/FeatureSourceMessage.js";import{createArcadeEvaluationOptions as g}from"../support/arcadeUtils.js";import{ComputedAttributeStorage as m}from"../support/ComputedAttributeStorage.js";import _ from"../support/FeatureFilterEvaluator.js";import{FeatureMetadata as y}from"../support/FeatureMetadata.js";import{FeatureSetReaderJSON as S}from"../support/FeatureSetReaderJSON.js";import{Hashed as x}from"../support/Hashed.js";const I=128;class M extends p{constructor(e){super(e),this.didSend=!1,this.done=!1}}class C{constructor(e,t,s,i,r){this._level=e,this._scale=t,this._indexOptions=s,this._clusterRadius=i,this._store=r,this._statistics=new Map,this._clusters=new Map}destroy(){this._clearClusters()}_clearClusters(){for(const e of this._clusters.values())this._store.releaseDisplayIdForObjectId(e.inner.id);this._clusters.clear()}*aggregatesWorldSpace(){for(const e of this._clusters.values()){const t=e.inner.getCentroid(null),s=new i(t,e.inner.getAttributes(),null,e.inner.id,e.displayId);yield s}}clusters(){return this._clusters.values()}updateChunks(e,t){const s={xMin:1/0,yMin:1/0,xMax:-1/0,yMax:-1/0},i=c(this._indexOptions.spatialReference,this._scale),r=this._indexOptions.cellSize;for(const{subscription:a}of t){const e=a.tile.bounds,t=Math.floor(e[0]*i/r),n=Math.floor(e[1]*i/r),l=Math.ceil(e[2]*i/r),o=Math.ceil(e[3]*i/r);s.xMin=Math.min(s.xMin,t),s.yMin=Math.min(s.yMin,n),s.xMax=Math.max(s.xMax,l),s.yMax=Math.max(s.yMax,o)}null!=this._lastCellBounds&&s.xMin===this._lastCellBounds.xMin&&s.yMin===this._lastCellBounds.yMin&&s.yMin===this._lastCellBounds.yMin&&s.yMax===this._lastCellBounds.yMax||(this._lastCellBounds=s),this._clusterCells(e,s)}async updateStatistics(e){let t=!1;for(const s of this._clusters.values())s.inner.count>1&&(t=this._updateAggregateStatistics(this._statistics,s.inner)||t);if(t){const t=Array.from(this._statistics.entries()).map(([e,t])=>({fieldName:e,minValue:t.minValue,maxValue:t.maxValue}));await e.container.updateStatistics(this._level,t)}}createAggregateFeatures(e,t){const s=e.subscription,a=[],l=s.tile.transform,o=Array.from(this._clusters.values()),d=o.length;for(const u of o){const e=u.inner.getCentroidX(l),t=u.inner.getCentroidY(l),s=1===u.inner.count?u.inner.firstObjectId:u.inner.id,o=u.displayId;if(e<n+I&&e>=-I&&t<n+I&&t>=-I){const n=new r([],[e,t]),l=new i(n,u.inner.getAttributes(),null,s,o);a.push(l)}}const c=S.fromOptimizedFeatures(a,t,s.tile.transform);return has("esri-2d-update-debug")&&console.debug(`Tile[${e.subscription.tile.id}] ClusterStrategy.createAggregateFeatures`,{clusters:c,levelClusterCount:d}),c}_clusterCells(t,s){this._clearClusters();const i=this._clusterRadius*(1/c(this._indexOptions.spatialReference,this._scale)),{arcadeContextInfo:r}=this._indexOptions,a=g(this._scale,r),n=new x({...this._indexOptions,scale:this._scale}),l=new Set,u=new Map;for(let c=s.yMin;c<=s.yMax;c++)for(let i=s.xMin;i<=s.xMax;i++){const s=d.createId(i,c),r=o.createId(i,c);for(const d of t){const t=d.getGridIndex(n);t.forEachInCell(s,s=>{const n=s.getObjectId();if(l.has(n))return;l.add(n);e(u,r,()=>o.create(i,c,this._indexOptions.fields,t.worldUnitsPerCell)).insert(s,a)})}}let p=Array.from(u.values());p=p.sort((e,t)=>t.count-e.count);const f=new Set;for(const e of p){if(f.has(e.id))continue;if(e.gridX<s.xMin||e.gridX>s.xMax||e.gridY<s.yMin||e.gridY>s.yMax)continue;const t=1+this._clusterRadius/this._indexOptions.cellSize,r=this._store.createDisplayIdForObjectId(e.id),a=new h(e.clone(),r);f.add(e.id),this._clusters.set(e.id,a);const n=e.centroidXWorld,l=e.centroidYWorld;for(let s=e.gridY-t;s<=e.gridY+t;s++)for(let r=e.gridX-t;r<=e.gridX+t;r++){if(s===e.gridY&&r===e.gridX)continue;const t=u.get(o.createId(r,s));if(!t||f.has(t.id))continue;const d=Math.abs(t.centroidXWorld-n),c=Math.abs(t.centroidYWorld-l);d<i&&c<i&&(a.inner.merge(t),f.add(t.id))}}}_updateAggregateStatistics(e,t){let s=!1;for(const i of t.statistics.values()){if("esriFieldTypeString"===i.field.type)continue;const t=i.value,r=i.field,a=e.get(r.name);if(a){const{minValue:e,maxValue:i}=a,r=Math.min(a.minValue,t),n=Math.max(a.maxValue,t);e===r&&i===n||(a.minValue=r,a.maxValue=n,s=!0);continue}e.set(r.name,{minValue:t,maxValue:t}),s=!0}return s}}class v extends u{static async create(e,t,s,i,r,a,n,o){const d=s.metadata.outSpatialReference,c=new m({spatialReference:d}),u={type:"grid",fields:await Promise.all(t.fields.map(async e=>l.create(c,e))),spatialReference:d,featureFilter:t.featureFilter?await _.create({geometryType:s.metadata.geometryType,hasM:!1,hasZ:!1,timeInfo:s.metadata.timeInfo,fieldsIndex:s.metadata.fieldsIndex,spatialReference:d,filterJSON:t.featureFilter}):null,cellSize:t.clusterRadius/4,arcadeContextInfo:r,sqlOptions:a};return new v(e,t.clusterRadius,u,t.fields,s,i,a,n,o)}constructor(e,t,s,i,r,n,l,o,d){super(r,n,s.spatialReference,s.fields,l),this._connection=e,this._clusterRadius=t,this._indexOptions=s,this._requiredLevel=o,this._requiredScale=d,this._cellsPerScale=new Map,this._handled=new Set,this._invalidated=!1,this._metadata=y.createFeature({geometryType:"esriGeometryPoint",hasZ:!1,hasM:!1,featureIdInfo:{type:"object-id",fieldName:"aggregateId"},fieldsIndex:new a([...i,...this._source.metadata.fieldsIndex.fields,{name:"aggregateId",alias:"aggregateId",type:"esriFieldTypeOID"}]).toJSON(),globalIdField:null,spatialReference:r.metadata.spatialReference,outSpatialReference:r.metadata.outSpatialReference,subtypeField:null,subtypes:null,timeInfo:null,timeReferenceUnknownClient:null,dateFieldsTimeZone:null,typeIdField:null,types:null})}get enablePixelBuffering(){return!0}requiresInvalidation(e){for(const t of this._sendStates.values())if(!t.done)return!0;const s=new Set;for(const t of e)s.add(t.chunkId);return!t(s,this._handled)&&(this._handled=s,!0)}invalidate(){this._invalidated=!0;for(const e of this._cellsPerScale.values())e.destroy();this._cellsPerScale.clear()}updateRequiredLevel(e,t){this._requiredLevel=e,this._requiredScale=t}createState(e){return new M(e)}async*applyOverrideUpdate(e){for(const t of this._cellsPerScale.values())t.destroy();this._cellsPerScale.clear();for(const t of this._sendStates.values())t.done=!1}displayMap(e,t,s){const i=new Map(e.map(e=>[t(e),e])),r=[],a=this._getClusterState(this._requiredLevel,this._requiredScale);for(const n of a.clusters()){const e=i.get(n.inner.id);if(null!=e){const t=s(n.displayId,e,n.inner.id);r.push(t),i.delete(n.inner.id);continue}if(1===n.inner.count){const{firstObjectId:e}=n.inner,t=e?i.get(e):null;if(null!=t){const a=s(n.displayId,t,e);r.push(a),i.delete(e)}}}return r}getDisplayFeatures(e){const t=new Set(e),i=new Set,r=[],a=[],n=this._getClusterState(this._requiredLevel,this._requiredScale);for(const l of n.aggregatesWorldSpace())if(t.has(l.displayId)&&!i.has(l.displayId)){const e=s(l,this._metadata.geometryType,!1,!1);if(i.add(l.displayId),1===e.attributes.cluster_count){r.push({...e,displayId:l.displayId});continue}a.push({...e,displayId:l.displayId})}return{features:r,aggregates:a,tracks:[]}}getFeatureObjectIdsForAggregate(e){const t=this._getClusterState(this._requiredLevel,this._requiredScale);for(const s of t.clusters())if(s.inner.id===e)return Array.from(s.inner.containedObjectIds);return[]}async*updateChunks(e,t){if(!this._invalidated)return;this._invalidated=!1;const s=this._getClusterState(this._requiredLevel,this._requiredScale);s.updateChunks(e,Array.from(this._sendStates.values()));for(const i of this._sendStates.values())yield*this._update(i,s,t);await s.updateStatistics(this._connection)}forEachAggregateWorldSpace(e){if(null==this._requiredLevel||null==this._requiredScale)return;const t=this._getClusterState(this._requiredLevel,this._requiredScale);for(const s of t.aggregatesWorldSpace())e(s)}_getClusterState(e,t){if(null==e||null==t)throw new Error("InternalError: Level and scale must be defined");let s=this._cellsPerScale.get(t);return s||(s=new C(e,t,this._indexOptions,this._clusterRadius,this._attributeStore),this._cellsPerScale.set(t,s)),s}async*_update(e,t,s){const i=t.createAggregateFeatures(e,this._metadata);this.events.emit("changed"),e.done=e.done||!s;const r=i.getCursor(),a=e.subscription.tile.createArcadeEvaluationOptions(this._indexOptions.arcadeContextInfo);for(;r.next();)this._attributeStore.setAttributeData(r.getDisplayId(),r,a,this._sqlOptions);has("esri-2d-update-debug")&&console.debug(`Tile[${e.subscription.tile.id}] ClusterStrategy._update`,{done:e.done});const n=new f(e.subscription,i,e.done,{});yield n}}export{M as ClusterState,v as ClusterStrategy};
2
+ import has from"../../../../../core/has.js";import{getOrCreateMapValue as e}from"../../../../../core/MapUtils.js";import{equals as t}from"../../../../../core/SetUtils.js";import{convertToFeature as s}from"../../../../../layers/graphics/featureConversionUtils.js";import{OptimizedFeature as i}from"../../../../../layers/graphics/OptimizedFeature.js";import r from"../../../../../layers/graphics/OptimizedGeometry.js";import a from"../../../../../layers/support/FieldsIndex.js";import{tileSize as n}from"../../../engine/webgl/definitions.js";import{ComputedAggregateField as l}from"../aggregation/ComputedAggregateField.js";import{GridCell as o}from"../aggregation/GridCell.js";import{GridIndexCell as d}from"../aggregation/GridIndexCell.js";import{pixelsPerMapUnit as c}from"../aggregation/GridSpatialIndex.js";import{AAggregateStrategy as u}from"./AAggregateStrategy.js";import{ASendState as p}from"./AProcessorStrategy.js";import{WithDisplayId as f}from"./support/WithDisplayId.js";import{FeatureTileAppendMessage as h}from"../sources/FeatureSourceMessage.js";import{createArcadeEvaluationOptions as g}from"../support/arcadeUtils.js";import{ComputedAttributeStorage as m}from"../support/ComputedAttributeStorage.js";import _ from"../support/FeatureFilterEvaluator.js";import{FeatureMetadata as y}from"../support/FeatureMetadata.js";import{FeatureSetReaderJSON as x}from"../support/FeatureSetReaderJSON.js";import{Hashed as S}from"../support/Hashed.js";const I=128;class M extends p{constructor(e){super(e),this.didSend=!1,this.done=!1}}class v{constructor(e,t,s,i,r){this.level=e,this._scale=t,this._indexOptions=s,this._clusterRadius=i,this._store=r,this._statistics=new Map,this._clusters=new Map}destroy(){this._clearClusters()}_clearClusters(){for(const e of this._clusters.values())this._store.releaseDisplayIdForObjectId(e.inner.id);this._clusters.clear()}*aggregatesWorldSpace(){for(const e of this._clusters.values()){const t=e.inner.getCentroid(null),s=new i(t,e.inner.getAttributes(),null,e.inner.id,e.displayId);yield s}}clusters(){return this._clusters.values()}updateChunks(e,t){const s={xMin:1/0,yMin:1/0,xMax:-1/0,yMax:-1/0},i=c(this._indexOptions.spatialReference,this._scale),r=this._indexOptions.cellSize;for(const{subscription:a}of t){const e=a.tile.bounds,t=Math.floor(e[0]*i/r),n=Math.floor(e[1]*i/r),l=Math.ceil(e[2]*i/r),o=Math.ceil(e[3]*i/r);s.xMin=Math.min(s.xMin,t),s.yMin=Math.min(s.yMin,n),s.xMax=Math.max(s.xMax,l),s.yMax=Math.max(s.yMax,o)}null!=this._lastCellBounds&&s.xMin===this._lastCellBounds.xMin&&s.yMin===this._lastCellBounds.yMin&&s.yMin===this._lastCellBounds.yMin&&s.yMax===this._lastCellBounds.yMax||(this._lastCellBounds=s),this._clusterCells(e,s)}async updateStatistics(e){let t=!1;for(const s of this._clusters.values())s.inner.count>1&&(t=this._updateAggregateStatistics(this._statistics,s.inner)||t);if(t){const t=Array.from(this._statistics.entries()).map(([e,t])=>({fieldName:e,minValue:t.minValue,maxValue:t.maxValue}));await e.container.updateStatistics(this.level,t)}}createAggregateFeatures(e,t){const s=e.subscription,a=[],l=s.tile.transform,o=Array.from(this._clusters.values()),d=o.length;for(const u of o){const e=u.inner.getCentroidX(l),t=u.inner.getCentroidY(l),s=1===u.inner.count?u.inner.firstObjectId:u.inner.id,o=u.displayId;if(e<n+I&&e>=-I&&t<n+I&&t>=-I){const n=new r([],[e,t]),l=new i(n,u.inner.getAttributes(),null,s,o);a.push(l)}}const c=x.fromOptimizedFeatures(a,t,s.tile.transform);return has("esri-2d-update-debug")&&console.debug(`Tile[${e.subscription.tile.id}] ClusterStrategy.createAggregateFeatures`,{clusters:c,levelClusterCount:d}),c}_clusterCells(t,s){this._clearClusters();const i=this._clusterRadius*(1/c(this._indexOptions.spatialReference,this._scale)),{arcadeContextInfo:r}=this._indexOptions,a=g(this._scale,r),n=new S({...this._indexOptions,scale:this._scale}),l=new Set,u=new Map;for(let c=s.yMin;c<=s.yMax;c++)for(let i=s.xMin;i<=s.xMax;i++){const s=d.createId(i,c),r=o.createId(i,c);for(const d of t){const t=d.getGridIndex(n);t.forEachInCell(s,s=>{const n=s.getObjectId();if(l.has(n))return;l.add(n);e(u,r,()=>o.create(i,c,this._indexOptions.fields,t.worldUnitsPerCell)).insert(s,a)})}}let p=Array.from(u.values());p=p.sort((e,t)=>t.count-e.count);const h=new Set;for(const e of p){if(h.has(e.id))continue;if(e.gridX<s.xMin||e.gridX>s.xMax||e.gridY<s.yMin||e.gridY>s.yMax)continue;const t=1+this._clusterRadius/this._indexOptions.cellSize,r=this._store.createDisplayIdForObjectId(e.id),a=new f(e.clone(),r);h.add(e.id),this._clusters.set(e.id,a);const n=e.centroidXWorld,l=e.centroidYWorld;for(let s=e.gridY-t;s<=e.gridY+t;s++)for(let r=e.gridX-t;r<=e.gridX+t;r++){if(s===e.gridY&&r===e.gridX)continue;const t=u.get(o.createId(r,s));if(!t||h.has(t.id))continue;const d=Math.abs(t.centroidXWorld-n),c=Math.abs(t.centroidYWorld-l);d<i&&c<i&&(a.inner.merge(t),h.add(t.id))}}}_updateAggregateStatistics(e,t){let s=!1;for(const i of t.statistics.values()){if("esriFieldTypeString"===i.field.type)continue;const t=i.value,r=i.field,a=e.get(r.name);if(a){const{minValue:e,maxValue:i}=a,r=Math.min(a.minValue,t),n=Math.max(a.maxValue,t);e===r&&i===n||(a.minValue=r,a.maxValue=n,s=!0);continue}e.set(r.name,{minValue:t,maxValue:t}),s=!0}return s}}class b extends u{static async create(e,t,s,i,r,a){const n=s.metadata.outSpatialReference,o=new m({spatialReference:n}),d={type:"grid",fields:await Promise.all(t.fields.map(async e=>l.create(o,e))),spatialReference:n,featureFilter:t.featureFilter?await _.create({geometryType:s.metadata.geometryType,hasM:!1,hasZ:!1,timeInfo:s.metadata.timeInfo,fieldsIndex:s.metadata.fieldsIndex,spatialReference:n,filterJSON:t.featureFilter}):null,cellSize:t.clusterRadius/4,arcadeContextInfo:r,sqlOptions:a};return new b(e,t.clusterRadius,d,t.fields,s,i,a)}constructor(e,t,s,i,r,n,l){super(r,n,s.spatialReference,s.fields,l),this._connection=e,this._clusterRadius=t,this._indexOptions=s,this._cellsPerLevel=new Map,this._handled=new Set,this._invalidated=!1,this._metadata=y.createFeature({geometryType:"esriGeometryPoint",hasZ:!1,hasM:!1,featureIdInfo:{type:"object-id",fieldName:"aggregateId"},fieldsIndex:new a([...i,...this._source.metadata.fieldsIndex.fields,{name:"aggregateId",alias:"aggregateId",type:"esriFieldTypeOID"}]).toJSON(),globalIdField:null,spatialReference:r.metadata.spatialReference,outSpatialReference:r.metadata.outSpatialReference,subtypeField:null,subtypes:null,timeInfo:null,timeReferenceUnknownClient:null,dateFieldsTimeZone:null,typeIdField:null,types:null})}get enablePixelBuffering(){return!0}onSubscribe(e){super.onSubscribe(e),this._lastSubscribedLevel=e.tile.level}requiresInvalidation(e){for(const t of this._sendStates.values())if(!t.done)return!0;const s=new Set;for(const t of e)s.add(t.chunkId);return!t(s,this._handled)&&(this._handled=s,!0)}invalidate(){this._invalidated=!0;for(const e of this._cellsPerLevel.values())e.destroy();this._cellsPerLevel.clear()}createState(e){return new M(e)}async*applyOverrideUpdate(e){for(const t of this._cellsPerLevel.values())t.destroy();this._cellsPerLevel.clear();for(const t of this._sendStates.values())t.done=!1}displayMap(e,t,s){const i=new Map(e.map(e=>[t(e),e])),r=[];for(const a of this._getRequiredClusterStates())for(const e of a.clusters()){const t=i.get(e.inner.id);if(null!=t){const a=s(e.displayId,t,e.inner.id);r.push(a),i.delete(e.inner.id);continue}if(1===e.inner.count){const{firstObjectId:t}=e.inner,a=t?i.get(t):null;if(null!=a){const n=s(e.displayId,a,t);r.push(n),i.delete(t)}}}return r}getDisplayFeatures(e){const t=new Set(e),i=new Set,r=[],a=[];for(const n of this._getRequiredClusterStates())for(const e of n.aggregatesWorldSpace())if(t.has(e.displayId)&&!i.has(e.displayId)){const t=s(e,this._metadata.geometryType,!1,!1);if(i.add(e.displayId),1===t.attributes.cluster_count){r.push({...t,displayId:e.displayId});continue}a.push({...t,displayId:e.displayId})}return{features:r,aggregates:a,tracks:[]}}getFeatureObjectIdsForAggregate(e){for(const t of this._getRequiredClusterStates())for(const s of t.clusters())if(s.inner.id===e)return Array.from(s.inner.containedObjectIds);return[]}async*updateChunks(e,t){if(this._invalidated){this._invalidated=!1;for(const s of this._getRequiredClusterStates()){s.updateChunks(e,Array.from(this._sendStates.values()));for(const e of this._sendStates.values())e.subscription.tile.level===s.level&&(yield*this._update(e,s,t));await s.updateStatistics(this._connection)}}}forEachAggregateWorldSpace(e){if(!this._lastSubscribedLevel)return;const t=this._cellsPerLevel.get(this._lastSubscribedLevel);if(t)for(const s of t.aggregatesWorldSpace())e(s)}_getRequiredClusterStates(){return this._getRequiredLevels().map(({level:e,scale:t})=>this._getClusterState(e,t))}_getRequiredLevels(){const e=[],t=new Set;for(const{subscription:s}of this._sendStates.values()){const{level:i,scale:r}=s.tile;t.has(i)||(t.add(i),e.push({level:i,scale:r}))}return e}_getClusterState(e,t){if(null==e)throw new Error("InternalError: Level and scale must be defined");let s=this._cellsPerLevel.get(e);return s||(s=new v(e,t,this._indexOptions,this._clusterRadius,this._attributeStore),this._cellsPerLevel.set(e,s)),s}async*_update(e,t,s){const i=t.createAggregateFeatures(e,this._metadata);this.events.emit("changed"),e.done=e.done||!s;const r=i.getCursor(),a=e.subscription.tile.createArcadeEvaluationOptions(this._indexOptions.arcadeContextInfo);for(;r.next();)this._attributeStore.setAttributeData(r.getDisplayId(),r,a,this._sqlOptions);has("esri-2d-update-debug")&&console.debug(`Tile[${e.subscription.tile.id}] ClusterStrategy._update`,{done:e.done});const n=new h(e.subscription,i,e.done,{});yield n}}export{M as ClusterState,b as ClusterStrategy};
@@ -1,2 +1,2 @@
1
1
  /* COPYRIGHT Esri - https://js.arcgis.com/5.1/LICENSE.txt */
2
- import t from"../../../../../../core/Error.js";import{handlesGroup as e}from"../../../../../../core/handleUtils.js";import"../../../../../../core/has.js";import{getOrCreateMapValue as s}from"../../../../../../core/MapUtils.js";import{notDeepEqual as i}from"../../../../../../core/object.js";import{throwIfAborted as r,onAbort as a}from"../../../../../../core/promiseUtils.js";import{QueueProcessor as o}from"../../../../../../core/QueueProcessor.js";import{equals as l,difference as n}from"../../../../../../core/SetUtils.js";import{openWithPorts as d}from"../../../../../../core/workers/workers.js";import{loadParquetModule as h}from"../../../../../../libs/parquet/loadParquetModule.js";import{ALoadStrategy as c}from"./ALoadStrategy.js";import{fetchQueueConcurrency as u}from"./constants.js";import{ParquetSourceChunk as p}from"./chunks/ParquetSourceChunk.js";import{FeatureSetReaderParquet as m}from"../../support/FeatureSetReaderParquet.js";const _=2,f=4;class y{constructor(t,s){this.subscription=t,this.chunks=[],this.ids=[],this._controller=new AbortController,this._handles=e([a(t.signal,()=>this._controller.abort()),a(s,()=>this._controller.abort())])}destroy(){this._controller.abort(),this._handles.remove()}get options(){return{signal:this._controller.signal}}addBinaryData(t){this.chunks.push(t)}addSourceChunkId(t){this.ids.push(t)}}class w extends c{constructor(t,e,s,i){if(super(t.metadata,e,s),this._service=t,this._loadStates=new Map,this._fileIds=new Set,this._queue=new o({concurrency:u,process:t=>this._loadTile(t)}),!t.geometryInfo.displayOptimization)throw new Error("InternalError: ParquetTileLoadStrategy only supports XZ-enabled parquet files");this._loaded=this._load(i)}destroy(){super.destroy(),this._loaded.finally(()=>{this._client.close(),this._client=null;for(const t of this._ports)t.close()}).catch(()=>{})}get about(){return{willQueryAllFeatures:!0,willQueryFullResolutionGeometry:!0}}get availableFields(){return this._schema.partial.availableFields}get definitionExpression(){return this._schema.full.definitionExpression}async tryUpdate(e,s){await this._loaded;let r=!0;if(i(this.availableFields,s.availableFields)&&await this._updateFields(s.availableFields),this._schema.partial.dataSourceHash!==s.dataSourceHash){const e=new Set(await this._proxy.getFilesIds());if(!l(e,this._fileIds)){for(const t of e)this._fileIds.has(t)||(r=!1,this._insert(t));for(const s of this._fileIds.keys())if(!e.has(s))throw new t("unsupported","Removing parquet files is not supported",{previous:this._fileIds,next:e})}}return this._schema.partial=s,r}async load(t){return await this._loaded,s(this._loadStates,t.key.id,()=>new y(t,this._options)),this._queue.push(t)}unload(t){const e=this._loadStates.get(t.tile.id);if(null!=e){for(const t of e.ids)this.store.removeById(t);e.destroy(),this._loadStates.delete(t.tile.id)}}async _load(t){this._ports=await t.layerView.openMemoryPorts(),this._client=await d(this._ports,{maxNumberOfConcurrentJobs:20}),this._proxy=this._client.createInvokeProxy(),this._indexMap=await this._proxy.getIndexMap();const e=await this._proxy.getFilesIds();for(const s of e)this._insert(s)}_insert(t){this._fileIds.add(t)}_onOverride(){}async _updateFields(t){const e=new Set(t),s=n(e,new Set(this.availableFields));if(null!=this._service.metadata.fieldsIndex&&s.size){const t=Array.from(this.store.insertedChunks()).map(t=>t.updateFields(this._proxy,Array.from(s),this._options));await Promise.all(t)}}async _loadTile(t){const e=t.tile,s=t.signal,i=this._loadStates.get(e.id),a=new o({process:async e=>this._downloadFileData(t,e),concurrency:_});await Promise.allSettled(Array.from(this._fileIds.keys()).map(t=>a.push(t))),r(s);const l=new p(this.metadata,null,e,null,0,!0);i.addSourceChunkId(l.chunkId),this.store.insert(l)}async _downloadFileData(t,e){const s=await h(),i=t.tile,a=t.signal,o=this._loadStates.get(i.id),l=await this._proxy.queryStream(e,{type:"tile",extent:i.extent,transform:i.normalizedTransform,outFields:Array.from(this.availableFields),returnGeometry:!0,outSpatialReference:this.metadata.outSpatialReference.toJSON(),scale:i.scale,where:this.definitionExpression},{signal:a});let n=0;const d=[],c=async(t=0)=>{const d=await this._proxy.getStreamNext(e,l,{signal:a});if(r(a),null==d)return;const h=s.ParquetChunk.deserialize(new Uint8Array(d)),u=new m(this.metadata,this._indexMap,h,e),_=new p(this.metadata,u,i,e,n++,!1);return o.addBinaryData({data:h,fileId:e}),o.addSourceChunkId(_.chunkId),this.store.insert(_),c(t+1)};for(let r=0;r<f;r++)d.push(c());await Promise.all(d)}}export{w as ParquetTileLoadStrategy};
2
+ import t from"../../../../../../core/Error.js";import{handlesGroup as e}from"../../../../../../core/handleUtils.js";import"../../../../../../core/has.js";import{getOrCreateMapValue as s}from"../../../../../../core/MapUtils.js";import{notDeepEqual as i}from"../../../../../../core/object.js";import{throwIfAborted as r,onAbort as a}from"../../../../../../core/promiseUtils.js";import{QueueProcessor as o}from"../../../../../../core/QueueProcessor.js";import{equals as l,difference as n}from"../../../../../../core/SetUtils.js";import{openWithPorts as d}from"../../../../../../core/workers/workers.js";import{loadParquetModule as h}from"../../../../../../libs/parquet/loadParquetModule.js";import{ALoadStrategy as c}from"./ALoadStrategy.js";import{fetchQueueConcurrency as u}from"./constants.js";import{ParquetSourceChunk as p}from"./chunks/ParquetSourceChunk.js";import{FeatureSetReaderParquet as m}from"../../support/FeatureSetReaderParquet.js";const _=2,f=4;class y{constructor(t,s){this.subscription=t,this.chunks=[],this.ids=[],this._controller=new AbortController,this._handles=e([a(t.signal,()=>this._controller.abort()),a(s,()=>this._controller.abort())])}destroy(){this._controller.abort(),this._handles.remove()}get options(){return{signal:this._controller.signal}}addBinaryData(t){this.chunks.push(t)}addSourceChunkId(t){this.ids.push(t)}}class w extends c{constructor(t,e,s,i){if(super(t.metadata,e,s),this._service=t,this._loadStates=new Map,this._fileIds=new Set,this._queue=new o({concurrency:u,process:t=>this._loadTile(t)}),!t.geometryInfo.displayOptimization)throw new Error("InternalError: ParquetTileLoadStrategy only supports XZ-enabled parquet files");this._loaded=this._load(i)}destroy(){super.destroy(),this._loaded.finally(()=>{this._client.close(),this._client=null;for(const t of this._ports)t.close()}).catch(()=>{})}get about(){return{willQueryAllFeatures:!0,willQueryFullResolutionGeometry:!0}}get availableFields(){return this._schema.partial.availableFields}get definitionExpression(){return this._schema.full.definitionExpression}async tryUpdate(e,s){await this._loaded;let r=!0;if(i(this.availableFields,s.availableFields)&&await this._updateFields(s.availableFields),this._schema.partial.dataSourceHash!==s.dataSourceHash){const e=new Set(await this._proxy.getFilesIds());if(!l(e,this._fileIds)){for(const t of e)this._fileIds.has(t)||(r=!1,this._insert(t));for(const s of this._fileIds.keys())if(!e.has(s))throw new t("unsupported","Removing parquet files is not supported",{previous:this._fileIds,next:e})}}return this._schema.partial=s,r}async load(t){return await this._loaded,s(this._loadStates,t.key.id,()=>new y(t,this._options)),this._queue.push(t)}unload(t){const e=this._loadStates.get(t.tile.id);if(null!=e){for(const t of e.ids)this.store.removeById(t);e.destroy(),this._loadStates.delete(t.tile.id)}}async _load(t){this._ports=await t.layerView.openMemoryPorts(),this._client=await d(this._ports,{maxNumberOfConcurrentJobs:20}),this._proxy=this._client.createInvokeProxy(),this._indexMap=await this._proxy.getIndexMap();const e=await this._proxy.getFilesIds();for(const s of e)this._insert(s)}_insert(t){this._fileIds.add(t)}_onOverride(){}async _updateFields(t){const e=new Set(t),s=n(e,new Set(this.availableFields));if(null!=this._service.metadata.fieldsIndex&&s.size){const t=Array.from(this.store.insertedChunks()).map(t=>t.updateFields(this._proxy,Array.from(s),this._options));await Promise.all(t)}}async _loadTile(t){const e=t.tile,s=t.signal,i=this._loadStates.get(e.id),a=new o({process:async e=>this._downloadFileData(t,e),concurrency:_});await Promise.allSettled(Array.from(this._fileIds.keys()).map(t=>a.push(t))),r(s);const l=new p(this.metadata,null,e,null,0,!0);i.addSourceChunkId(l.chunkId),this.store.insert(l)}async _downloadFileData(t,e){const s=await h(),i=t.tile,a=t.signal,o=this._loadStates.get(i.id),l=await this._proxy.queryStream(e,{type:"tile",extent:i.extent,transform:i.normalizedTransform,outFields:Array.from(this.availableFields),returnGeometry:!0,outSpatialReference:this.metadata.outSpatialReference.toJSON(),scale:i.scale,where:this.definitionExpression},{signal:a});let n=0;const d=[],c=async(t=0)=>{const d=await this._proxy.getStreamNext(e,l,{signal:a});if(r(a),null==d)return;const h=s.ParquetChunk.deserialize(new Uint8Array(d)),u=new m(this.metadata,this._indexMap,h,e,i.transform),_=new p(this.metadata,u,i,e,n++,!1);return o.addBinaryData({data:h,fileId:e}),o.addSourceChunkId(_.chunkId),this.store.insert(_),c(t+1)};for(let r=0;r<f;r++)d.push(c());await Promise.all(d)}}export{w as ParquetTileLoadStrategy};