@arcgis/core 4.33.0-next.20250206 → 4.33.0-next.20250207

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 (115) hide show
  1. package/arcade.js +1 -1
  2. package/assets/esri/core/workers/RemoteClient.js +1 -1
  3. package/assets/esri/core/workers/chunks/0a8e388e96af44deeabb.js +1 -0
  4. package/assets/esri/core/workers/chunks/{38cd7745b8ef1b8b6196.js → 12d6baeffd55a98a7c75.js} +1 -1
  5. package/assets/esri/core/workers/chunks/143a193fa3a6e645c8ac.js +1 -0
  6. package/assets/esri/core/workers/chunks/308ec51ff4a66f7fcb0d.js.LICENSE.txt +1 -1
  7. package/assets/esri/core/workers/chunks/{72cf9192292e5c85c6df.js → 32d3657dcae89b740f8b.js} +2 -2
  8. package/assets/esri/core/workers/chunks/{72cf9192292e5c85c6df.js.LICENSE.txt → 32d3657dcae89b740f8b.js.LICENSE.txt} +1 -1
  9. package/assets/esri/core/workers/chunks/354531dc2f0dea2ad96f.js.LICENSE.txt +1 -1
  10. package/assets/esri/core/workers/chunks/35e4af82a08b4eadbfab.js +1 -0
  11. package/assets/esri/core/workers/chunks/369a2b8484a8807bde38.js +1 -0
  12. package/assets/esri/core/workers/chunks/4040158835f9036967cd.js +2 -0
  13. package/assets/esri/core/workers/chunks/{1a2e1a414e651e988435.js.LICENSE.txt → 4040158835f9036967cd.js.LICENSE.txt} +1 -6
  14. package/assets/esri/core/workers/chunks/459af0c3d62c3ed11c19.js +1 -0
  15. package/assets/esri/core/workers/chunks/53810519ff5922b42cd2.js +1 -0
  16. package/assets/esri/core/workers/chunks/{15f850c9a1154fc57e5a.js → 5721557a1d8eab23a55b.js} +1 -1
  17. package/assets/esri/core/workers/chunks/594d923400fd74881833.js +1 -0
  18. package/assets/esri/core/workers/chunks/62a1d60ad4bf6469c4dd.js +1 -0
  19. package/assets/esri/core/workers/chunks/{81aa8cc289fd02ca4da6.js → 7058001bf66f9f3d5d45.js} +1 -1
  20. package/assets/esri/core/workers/chunks/{e8ae8a11d8439e2a66ad.js → 706f867a9034d62a8ef7.js} +1 -1
  21. package/assets/esri/core/workers/chunks/77764ca90bdd13ee2167.js.LICENSE.txt +1 -1
  22. package/assets/esri/core/workers/chunks/{1ab83753d9eec0463461.js → 7b367bb0ed9c218ca595.js} +1 -1
  23. package/assets/esri/core/workers/chunks/8191dd3d7451b2e7b95e.js +1 -0
  24. package/assets/esri/core/workers/chunks/8c32cee395da0a7b9a8e.js +1 -0
  25. package/assets/esri/core/workers/chunks/{48ecc5a74fecbb2b9c6f.js → 8d8f5f08d730270e1165.js} +1 -1
  26. package/assets/esri/core/workers/chunks/94225d92afbdb10dfedb.js +1 -0
  27. package/assets/esri/core/workers/chunks/94490937dca566fe2640.js +1 -0
  28. package/assets/esri/core/workers/chunks/{b9ce0049e27a3e1ed9f9.js → 9b2fab133786e5d47631.js} +1 -1
  29. package/assets/esri/core/workers/chunks/{28374a64790342e1b5ae.js → 9d61590c4d21c7421925.js} +1 -1
  30. package/assets/esri/core/workers/chunks/b21b152fa15896577242.js.LICENSE.txt +1 -1
  31. package/assets/esri/core/workers/chunks/{5a25cef6355fd20e44e7.js → b765670b47d209d7655a.js} +2 -2
  32. package/assets/esri/core/workers/chunks/{5a25cef6355fd20e44e7.js.LICENSE.txt → b765670b47d209d7655a.js.LICENSE.txt} +1 -1
  33. package/assets/esri/core/workers/chunks/d29c3bf29fcd7fa31f1a.js +1 -0
  34. package/assets/esri/core/workers/chunks/d339dee99c4820b63f39.js +1 -0
  35. package/assets/esri/core/workers/chunks/de1f3c4b8000c2d73013.js +1 -0
  36. package/assets/esri/core/workers/chunks/e4b3f2d5c43518b0cde7.js +1 -0
  37. package/assets/esri/core/workers/chunks/e5e3b6d00d27b5bb354f.js +1 -0
  38. package/assets/esri/core/workers/chunks/f14b318bab5efcf43419.js +1 -0
  39. package/assets/esri/core/workers/chunks/{24e47f748f0e4f815c6e.js → f32ca4381e804cc3481e.js} +1 -1
  40. package/assets/esri/core/workers/chunks/f9070edd8e0b2a57af79.js +1 -0
  41. package/assets/esri/themes/base/widgets/_ItemList.scss +6 -0
  42. package/assets/esri/themes/dark/main.css +1 -1
  43. package/assets/esri/themes/light/main.css +1 -1
  44. package/assets/esri/themes/light/view.css +1 -1
  45. package/interfaces.d.ts +58 -56
  46. package/layers/FeatureLayer.js +1 -1
  47. package/layers/SubtypeGroupLayer.js +1 -1
  48. package/layers/WCSLayer.js +1 -1
  49. package/layers/graphics/data/QueryEngineCapabilities.js +1 -1
  50. package/layers/graphics/sources/FeatureLayerSource.js +1 -1
  51. package/layers/graphics/sources/geojson/GeoJSONSourceWorker.js +1 -1
  52. package/layers/graphics/sources/support/MemorySourceWorker.js +1 -1
  53. package/layers/graphics/sources/support/clientSideDefaults.js +1 -1
  54. package/layers/graphics/sources/support/sourceUtils.js +1 -1
  55. package/layers/mixins/BlendLayer.js +1 -1
  56. package/layers/mixins/FeatureLayerBase.js +1 -1
  57. package/layers/mixins/OperationalLayer.js +1 -1
  58. package/layers/mixins/operationalLayerModuleMap.js +1 -1
  59. package/layers/support/SubtypeSublayer.js +1 -1
  60. package/layers/support/arcadeUtils.js +1 -1
  61. package/layers/support/commonProperties.js +1 -1
  62. package/layers/support/layersCreator.js +1 -1
  63. package/package.json +2 -2
  64. package/portal/support/layersLoader.js +1 -1
  65. package/portal/support/loadUtils.js +1 -1
  66. package/rest/imageService.js +1 -1
  67. package/rest/support/ImageSampleParameters.js +1 -1
  68. package/rest/support/ImageSampleResult.js +1 -1
  69. package/rest/support/ImageVolumeResult.js +1 -1
  70. package/support/TablesMixin.js +1 -1
  71. package/support/revision.js +1 -1
  72. package/symbols/cim/cimAnalyzer.js +1 -1
  73. package/symbols/cim/fitVectorMarker.js +5 -0
  74. package/symbols/support/previewCIMSymbol.js +1 -1
  75. package/views/2d/engine/webgl/TextureManager.js +1 -1
  76. package/views/2d/layers/features/schema/SourceSchema.js +1 -1
  77. package/views/2d/layers/features/sources/FeatureSource.js +1 -1
  78. package/views/2d/layers/features/sources/FeatureSourceQueryInfo.js +1 -1
  79. package/views/2d/layers/features/sources/strategies/DrillDownTileLoadStrategy.js +1 -1
  80. package/views/2d/layers/features/sources/strategies/PagedTileLoadStrategy.js +1 -1
  81. package/views/2d/layers/features/sources/strategies/ParquetLoadStrategy.js +1 -1
  82. package/views/2d/layers/features/sources/strategies/SnapshotLoadStrategy.js +1 -1
  83. package/views/2d/layers/features/sources/strategies/StreamLoadStrategy.js +1 -1
  84. package/views/3d/webgl-engine/parts/RenderView.js +1 -1
  85. package/widgets/Editor/CreateFeaturesWorkflow.js +1 -1
  86. package/widgets/Editor/EditorViewModel.js +1 -1
  87. package/widgets/Editor/UpdateWorkflow.js +1 -1
  88. package/widgets/Editor/VisibleElements.js +1 -1
  89. package/widgets/Editor/components/FeatureList.js +1 -1
  90. package/widgets/Editor/components/UpdateFeaturePanelContent.js +1 -1
  91. package/widgets/Editor/workflowUtils.js +1 -1
  92. package/widgets/Editor.js +1 -1
  93. package/widgets/Feature/support/arcadeFeatureUtils.js +1 -1
  94. package/widgets/Sketch.js +1 -1
  95. package/widgets/support/UtilityNetworkAssociations/UtilityNetworkAssociationsViewModel.js +1 -1
  96. package/assets/esri/core/workers/chunks/07bff9e742f3e5877f3f.js +0 -1
  97. package/assets/esri/core/workers/chunks/1a2e1a414e651e988435.js +0 -2
  98. package/assets/esri/core/workers/chunks/287362f9af132fafe4de.js +0 -1
  99. package/assets/esri/core/workers/chunks/2adc533dadcb018a9755.js +0 -1
  100. package/assets/esri/core/workers/chunks/2ea5e5e6c4660a06b516.js +0 -1
  101. package/assets/esri/core/workers/chunks/3984bf01f055fc42bfbf.js +0 -1
  102. package/assets/esri/core/workers/chunks/41cd1a5c99ab3bbd1fb4.js +0 -1
  103. package/assets/esri/core/workers/chunks/5e7f16b312077ca8c18d.js +0 -1
  104. package/assets/esri/core/workers/chunks/6ef2514a6b7bbfb8e37d.js +0 -1
  105. package/assets/esri/core/workers/chunks/82d26884127ed772cc4b.js +0 -1
  106. package/assets/esri/core/workers/chunks/918bdba41fa470cf77fd.js +0 -1
  107. package/assets/esri/core/workers/chunks/91d2bdfa6e34c10b7f50.js +0 -1
  108. package/assets/esri/core/workers/chunks/991e0f619f1f81f94d56.js +0 -1
  109. package/assets/esri/core/workers/chunks/9a27824d94df702e6e28.js +0 -1
  110. package/assets/esri/core/workers/chunks/c1fd87af3129873369fd.js +0 -1
  111. package/assets/esri/core/workers/chunks/c4c2b94e5cee7b824093.js +0 -1
  112. package/assets/esri/core/workers/chunks/c85374360ac5e169af16.js +0 -1
  113. package/assets/esri/core/workers/chunks/c94ec324ecad77c53a87.js +0 -1
  114. package/assets/esri/core/workers/chunks/d175953337fa655dc6b0.js +0 -1
  115. package/assets/esri/core/workers/chunks/e26dc0c1654316bb1558.js +0 -1
@@ -2,4 +2,4 @@
2
2
  All material copyright ESRI, All Rights Reserved, unless otherwise specified.
3
3
  See https://js.arcgis.com/4.33/esri/copyright.txt for details.
4
4
  */
5
- import e from"../../core/Collection.js";import"../../core/has.js";import{LayerLoadContext as r}from"./LayerLoadContext.js";import{layerLookupMap as a}from"./lazyLayerLoader.js";import y from"../../portal/PortalItem.js";import{isMapNotesLayer as t,isMarkupLayer as i,isRouteLayer as L}from"../../portal/support/featureCollectionUtils.js";import{selectLayerClassPath as n}from"../../portal/support/portalLayers.js";import{loadStyleRenderer as o}from"../../renderers/support/styleUtils.js";async function l(e,r,a){if(!r)return;const y=r.map((e=>G(e,a))),t=await Promise.allSettled(y);for(const i of t)"rejected"===i.status||i.value&&e.add(i.value)}const c={ArcGISDimensionLayer:"DimensionLayer",ArcGISFeatureLayer:"FeatureLayer",ArcGISImageServiceLayer:"ImageryLayer",ArcGISMapServiceLayer:"MapImageLayer",ArcGISSceneServiceLayer:"SceneLayer",ArcGISTiledElevationServiceLayer:"ElevationLayer",ArcGISTiledImageServiceLayer:"ImageryTileLayer",ArcGISTiledMapServiceLayer:"TileLayer",BuildingSceneLayer:"BuildingSceneLayer",CatalogLayer:"CatalogLayer",CSV:"CSVLayer",DefaultTileLayer:"TileLayer",GeoJSON:"GeoJSONLayer",GroupLayer:"GroupLayer",IntegratedMesh3DTilesLayer:"IntegratedMesh3DTilesLayer",IntegratedMeshLayer:"IntegratedMeshLayer",KML:"KMLLayer",LineOfSightLayer:"LineOfSightLayer",MediaLayer:"MediaLayer",OGCFeatureLayer:"OGCFeatureLayer",OrientedImageryLayer:"OrientedImageryLayer",PointCloudLayer:"PointCloudLayer",RasterDataLayer:"UnsupportedLayer",VectorTileLayer:"VectorTileLayer",ViewshedLayer:"ViewshedLayer",Voxel:"VoxelLayer",WCS:"WCSLayer",WFS:"WFSLayer",WMS:"WMSLayer",WebTiledLayer:"WebTileLayer"},s={ArcGISTiledElevationServiceLayer:"ElevationLayer",DefaultTileLayer:"ElevationLayer",RasterDataElevationLayer:"UnsupportedLayer"},p={ArcGISFeatureLayer:"FeatureLayer"},S={ArcGISImageServiceLayer:"UnsupportedLayer",ArcGISMapServiceLayer:"UnsupportedLayer",ArcGISSceneServiceLayer:"SceneLayer",ArcGISTiledImageServiceLayer:"ImageryTileLayer",ArcGISTiledMapServiceLayer:"TileLayer",DefaultTileLayer:"TileLayer",OpenStreetMap:"OpenStreetMapLayer",VectorTileLayer:"VectorTileLayer",WCS:"UnsupportedLayer",WMS:"UnsupportedLayer",WebTiledLayer:"WebTileLayer"},u={ArcGISAnnotationLayer:"UnsupportedLayer",ArcGISDimensionLayer:"UnsupportedLayer",ArcGISFeatureLayer:"FeatureLayer",ArcGISImageServiceLayer:"ImageryLayer",ArcGISImageServiceVectorLayer:"ImageryLayer",ArcGISMapServiceLayer:"MapImageLayer",ArcGISStreamLayer:"StreamLayer",ArcGISTiledImageServiceLayer:"ImageryTileLayer",ArcGISTiledMapServiceLayer:"TileLayer",BingMapsAerial:"BingMapsLayer",BingMapsHybrid:"BingMapsLayer",BingMapsRoad:"BingMapsLayer",CatalogLayer:"CatalogLayer",CSV:"CSVLayer",DefaultTileLayer:"TileLayer",GeoJSON:"GeoJSONLayer",GeoRSS:"GeoRSSLayer",GroupLayer:"GroupLayer",KML:"KMLLayer",KnowledgeGraphLayer:"KnowledgeGraphLayer",MediaLayer:"MediaLayer",OGCFeatureLayer:"OGCFeatureLayer",OrientedImageryLayer:"OrientedImageryLayer",SubtypeGroupLayer:"SubtypeGroupLayer",VectorTileLayer:"VectorTileLayer",WCS:"WCSLayer",WFS:"WFSLayer",WMS:"WMSLayer",WebTiledLayer:"WebTileLayer"},d={ArcGISFeatureLayer:"FeatureLayer",SubtypeGroupTable:"UnsupportedLayer"},I={ArcGISImageServiceLayer:"ImageryLayer",ArcGISImageServiceVectorLayer:"ImageryLayer",ArcGISMapServiceLayer:"MapImageLayer",ArcGISTiledImageServiceLayer:"ImageryTileLayer",ArcGISTiledMapServiceLayer:"TileLayer",BingMapsAerial:"BingMapsLayer",BingMapsHybrid:"BingMapsLayer",BingMapsRoad:"BingMapsLayer",DefaultTileLayer:"TileLayer",OpenStreetMap:"OpenStreetMapLayer",VectorTileLayer:"VectorTileLayer",WCS:"WCSLayer",WMS:"WMSLayer",WebTiledLayer:"WebTileLayer"},m={...u,LinkChartLayer:"LinkChartLayer"},g={...d},T={...I};async function G(e,r){return f(await M(e,r),e,r)}async function f(e,r,a){const y=new e;return y.read(r,a.context),"group"===y.type&&("GroupLayer"===r.layerType?await v(y,r,a):b(r)?C(y,r,a.context):A(r)&&await h(y,r,a.context)),await o(y,a.context),y}async function M(e,o){const l=o.context,c=w(l);let s=e.layerType||e.type;!s&&o?.defaultLayerType&&(s=o.defaultLayerType);const p=c[s];let S=p?a[p]:a.UnknownLayer;if(b(e)){const t=l?.portal;if(e.itemId){const i=new y({id:e.itemId,portal:t});await i.load();const L=(await n(i,new r)).className||"UnknownLayer";S=a[L]}}else"ArcGISFeatureLayer"===s?t(e)||i(e)?S=a.MapNotesLayer:L(e)?S=a.RouteLayer:A(e)&&(S=a.GroupLayer):e.wmtsInfo?.url&&e.wmtsInfo.layerIdentifier?S=a.WMTSLayer:"WFS"===s&&"2.0.0"!==e.wfsInfo?.version&&(S=a.UnsupportedLayer);return S()}function A(e){if("ArcGISFeatureLayer"!==e.layerType||b(e))return!1;return(e.featureCollection?.layers?.length??0)>1}function b(e){return"Feature Collection"===e.type}function w(e){let r;switch(e.origin){case"web-scene":switch(e.layerContainerType){case"basemap":r=S;break;case"ground":r=s;break;case"tables":r=p;break;default:r=c}break;case"link-chart":switch(e.layerContainerType){case"basemap":r=T;break;case"tables":r=g;break;default:r=m}break;default:switch(e.layerContainerType){case"basemap":r=I;break;case"tables":r=d;break;default:r=u}}return r}async function v(r,a,y){const t=new e,i=l(t,Array.isArray(a.layers)?a.layers:[],y);try{try{if(await i,"group"===r.type)return r.layers.addMany(t),r}catch(L){r.destroy();for(const e of t)e.destroy();throw L}}catch(L){throw L}}function C(e,r,a){r.itemId&&(e.portalItem=new y({id:r.itemId,portal:a?.portal}),e.when((()=>{const y=y=>{const t=y.layerId;W(y,e,r,t,a);const i=r.featureCollection?.layers?.[t];i&&y.read(i,a)};e.layers?.forEach(y),e.tables?.forEach(y)})))}async function h(e,r,y){const t=a.FeatureLayer,i=await t(),L=r.featureCollection,n=L?.showLegend,o=L?.layers?.map(((a,t)=>{const L=new i;L.read(a,y);const o={...y,ignoreDefaults:!0};return W(L,e,r,t,o),null!=n&&L.read({showLegend:n},o),L}));e.layers.addMany(o??[])}function W(e,r,a,y,t){e.read({id:`${r.id}-sublayer-${y}`,visibility:a.visibleLayers?.includes(y)??!0},t)}export{v as populateGroupLayer,l as populateOperationalLayers};
5
+ import e from"../../core/Collection.js";import"../../core/has.js";import{LayerLoadContext as r}from"./LayerLoadContext.js";import{layerLookupMap as a}from"./lazyLayerLoader.js";import y from"../../portal/PortalItem.js";import{isMapNotesLayer as t,isMarkupLayer as i,isRouteLayer as L}from"../../portal/support/featureCollectionUtils.js";import{selectLayerClassPath as o}from"../../portal/support/portalLayers.js";import{loadStyleRenderer as n}from"../../renderers/support/styleUtils.js";async function l(e,r,a){if(!r)return;const y=r.map((e=>G(e,a))),t=await Promise.allSettled(y);for(const i of t)"rejected"===i.status||i.value&&e.add(i.value)}const c={ArcGISDimensionLayer:"DimensionLayer",ArcGISFeatureLayer:"FeatureLayer",ArcGISImageServiceLayer:"ImageryLayer",ArcGISMapServiceLayer:"MapImageLayer",ArcGISSceneServiceLayer:"SceneLayer",ArcGISTiledElevationServiceLayer:"ElevationLayer",ArcGISTiledImageServiceLayer:"ImageryTileLayer",ArcGISTiledMapServiceLayer:"TileLayer",BuildingSceneLayer:"BuildingSceneLayer",CatalogLayer:"CatalogLayer",CSV:"CSVLayer",DefaultTileLayer:"TileLayer",GeoJSON:"GeoJSONLayer",GroupLayer:"GroupLayer",IntegratedMesh3DTilesLayer:"IntegratedMesh3DTilesLayer",IntegratedMeshLayer:"IntegratedMeshLayer",KML:"KMLLayer",LineOfSightLayer:"LineOfSightLayer",MediaLayer:"MediaLayer",OGCFeatureLayer:"OGCFeatureLayer",OrientedImageryLayer:"OrientedImageryLayer",PointCloudLayer:"PointCloudLayer",RasterDataLayer:"UnsupportedLayer",VectorTileLayer:"VectorTileLayer",ViewshedLayer:"ViewshedLayer",Voxel:"VoxelLayer",WCS:"WCSLayer",WFS:"WFSLayer",WMS:"WMSLayer",WebTiledLayer:"WebTileLayer"},s={ArcGISTiledElevationServiceLayer:"ElevationLayer",DefaultTileLayer:"ElevationLayer",RasterDataElevationLayer:"UnsupportedLayer"},p={ArcGISFeatureLayer:"FeatureLayer"},S={ArcGISImageServiceLayer:"UnsupportedLayer",ArcGISMapServiceLayer:"UnsupportedLayer",ArcGISSceneServiceLayer:"SceneLayer",ArcGISTiledImageServiceLayer:"ImageryTileLayer",ArcGISTiledMapServiceLayer:"TileLayer",DefaultTileLayer:"TileLayer",OpenStreetMap:"OpenStreetMapLayer",VectorTileLayer:"VectorTileLayer",WCS:"UnsupportedLayer",WMS:"UnsupportedLayer",WebTiledLayer:"WebTileLayer"},u={ArcGISAnnotationLayer:"UnsupportedLayer",ArcGISDimensionLayer:"UnsupportedLayer",ArcGISFeatureLayer:"FeatureLayer",ArcGISImageServiceLayer:"ImageryLayer",ArcGISImageServiceVectorLayer:"ImageryLayer",ArcGISMapServiceLayer:"MapImageLayer",ArcGISStreamLayer:"StreamLayer",ArcGISTiledImageServiceLayer:"ImageryTileLayer",ArcGISTiledMapServiceLayer:"TileLayer",BingMapsAerial:"BingMapsLayer",BingMapsHybrid:"BingMapsLayer",BingMapsRoad:"BingMapsLayer",CatalogLayer:"CatalogLayer",CSV:"CSVLayer",DefaultTileLayer:"TileLayer",GeoJSON:"GeoJSONLayer",GeoRSS:"GeoRSSLayer",GroupLayer:"GroupLayer",KML:"KMLLayer",KnowledgeGraphLayer:"KnowledgeGraphLayer",MediaLayer:"MediaLayer",OGCFeatureLayer:"OGCFeatureLayer",OrientedImageryLayer:"OrientedImageryLayer",SubtypeGroupLayer:"SubtypeGroupLayer",VectorTileLayer:"VectorTileLayer",WCS:"WCSLayer",WFS:"WFSLayer",WMS:"WMSLayer",WebTiledLayer:"WebTileLayer"},d={ArcGISFeatureLayer:"FeatureLayer",SubtypeGroupTable:"SubtypeGroupLayer"},I={ArcGISImageServiceLayer:"ImageryLayer",ArcGISImageServiceVectorLayer:"ImageryLayer",ArcGISMapServiceLayer:"MapImageLayer",ArcGISTiledImageServiceLayer:"ImageryTileLayer",ArcGISTiledMapServiceLayer:"TileLayer",BingMapsAerial:"BingMapsLayer",BingMapsHybrid:"BingMapsLayer",BingMapsRoad:"BingMapsLayer",DefaultTileLayer:"TileLayer",OpenStreetMap:"OpenStreetMapLayer",VectorTileLayer:"VectorTileLayer",WCS:"WCSLayer",WMS:"WMSLayer",WebTiledLayer:"WebTileLayer"},m={...u,LinkChartLayer:"LinkChartLayer"},g={...d},T={...I};async function G(e,r){return f(await M(e,r),e,r)}async function f(e,r,a){const y=new e;return y.read(r,a.context),"group"===y.type&&("GroupLayer"===r.layerType?await v(y,r,a):b(r)?C(y,r,a.context):A(r)&&await h(y,r,a.context)),await n(y,a.context),y}async function M(e,n){const l=n.context,c=w(l);let s=e.layerType||e.type;!s&&n?.defaultLayerType&&(s=n.defaultLayerType);const p=c[s];let S=p?a[p]:a.UnknownLayer;if(b(e)){const t=l?.portal;if(e.itemId){const i=new y({id:e.itemId,portal:t});await i.load();const L=(await o(i,new r)).className||"UnknownLayer";S=a[L]}}else"ArcGISFeatureLayer"===s?t(e)||i(e)?S=a.MapNotesLayer:L(e)?S=a.RouteLayer:A(e)&&(S=a.GroupLayer):e.wmtsInfo?.url&&e.wmtsInfo.layerIdentifier?S=a.WMTSLayer:"WFS"===s&&"2.0.0"!==e.wfsInfo?.version&&(S=a.UnsupportedLayer);return S()}function A(e){if("ArcGISFeatureLayer"!==e.layerType||b(e))return!1;return(e.featureCollection?.layers?.length??0)>1}function b(e){return"Feature Collection"===e.type}function w(e){let r;switch(e.origin){case"web-scene":switch(e.layerContainerType){case"basemap":r=S;break;case"ground":r=s;break;case"tables":r=p;break;default:r=c}break;case"link-chart":switch(e.layerContainerType){case"basemap":r=T;break;case"tables":r=g;break;default:r=m}break;default:switch(e.layerContainerType){case"basemap":r=I;break;case"tables":r=d;break;default:r=u}}return r}async function v(r,a,y){const t=new e,i=l(t,Array.isArray(a.layers)?a.layers:[],y);try{try{if(await i,"group"===r.type)return r.layers.addMany(t),r}catch(L){r.destroy();for(const e of t)e.destroy();throw L}}catch(L){throw L}}function C(e,r,a){r.itemId&&(e.portalItem=new y({id:r.itemId,portal:a?.portal}),e.when((()=>{const y=y=>{const t=y.layerId;W(y,e,r,t,a);const i=r.featureCollection?.layers?.[t];i&&y.read(i,a)};e.layers?.forEach(y),e.tables?.forEach(y)})))}async function h(e,r,y){const t=a.FeatureLayer,i=await t(),L=r.featureCollection,o=L?.showLegend,n=L?.layers?.map(((a,t)=>{const L=new i;L.read(a,y);const n={...y,ignoreDefaults:!0};return W(L,e,r,t,n),null!=o&&L.read({showLegend:o},n),L}));e.layers.addMany(n??[])}function W(e,r,a,y,t){e.read({id:`${r.id}-sublayer-${y}`,visibility:a.visibleLayers?.includes(y)??!0},t)}export{v as populateGroupLayer,l as populateOperationalLayers};
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@arcgis/core",
3
- "version": "4.33.0-next.20250206",
3
+ "version": "4.33.0-next.20250207",
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": [
@@ -26,7 +26,7 @@
26
26
  },
27
27
  "dependencies": {
28
28
  "@esri/arcgis-html-sanitizer": "~4.1.0",
29
- "@esri/calcite-components": "~3.0.0-next.128",
29
+ "@esri/calcite-components": "~3.0.0-next.132",
30
30
  "@vaadin/grid": "~24.6.3",
31
31
  "@zip.js/zip.js": "~2.7.57",
32
32
  "luxon": "~3.5.0",
@@ -2,4 +2,4 @@
2
2
  All material copyright ESRI, All Rights Reserved, unless otherwise specified.
3
3
  See https://js.arcgis.com/4.33/esri/copyright.txt for details.
4
4
  */
5
- import e from"../../core/Error.js";import{parse as t}from"../../layers/support/arcgisLayerUrl.js";import{fetchFeatureService as r}from"../../layers/support/fetchService.js";import{LayerLoadContext as a}from"../../layers/support/LayerLoadContext.js";import o from"../Portal.js";import{createForItemRead as n}from"./jsonContext.js";import{getFirstLayerOrTable as s,preprocessFSItemData as i,populateSceneServiceItemData as l,getNumLayersAndTables as u,createSublayerData as p,instanceTypeToLayerType as c,getSublayersByLayerType as y,layerTypeToLayerModuleType as m}from"./loadUtils.js";import{hasTypeKeyword as d}from"./portalItemUtils.js";import{loadStyleRenderer as f}from"../../renderers/support/styleUtils.js";import{fetchArcGISServiceJSON as w}from"../../support/requestPresets.js";async function h(e,t){const r=e.instance.portalItem;if(r?.id)return await r.load(t),g(e),e.validateItem&&e.validateItem(r),I(e,t)}function g(t){const r=t.instance.portalItem;if(!r?.type||!t.supportedTypes.includes(r.type))throw new e("portal:invalid-layer-item-type","Invalid layer item type '${type}', expected '${expectedType}'",{type:r?.type,expectedType:t.supportedTypes.join(", ")})}async function I(e,t){const r=e.instance,o=r.portalItem;if(!o)return;const{url:s,title:i}=o,l=n(o,"portal-item");if("group"===r.type)return b(r,l,e);s&&"media"!==r.type&&r.read({url:s},l);const u=new a,p=await F(e,u,t);return p&&r.read(p,l),r.resourceReferences={portalItem:o,paths:l.readResourcePaths??[]},"subtype-group"!==r.type&&r.read({title:i},l),f(r,l)}async function b(t,r,a){const o=t.portalItem;if(!t.sourceIsPortalItem)return;const{title:n,type:s}=o;if("Group Layer"===s){if(!d(o,"Map"))throw new e("portal:invalid-layer-item-typekeyword","'Group Layer' item without 'Map' type keyword is not supported");return L(t,a)}return t.read({title:n},r),S(t,a)}async function L(t,r){const a=t.portalItem,o=await a.fetchData("json");if(!o)return;if(!r.populateGroupLayer)throw new e("portal:missing-populate-group-layer","Missing populate group layer");const s=n(a,"web-map");t.read(o,s),await r.populateGroupLayer(t,o,{context:s}),t.resourceReferences={portalItem:a,paths:s.readResourcePaths??[]}}async function S(t,r){let o;const{portalItem:n}=t;if(!n)return;const p=n.type,c=r.layerModuleTypeMap;if(!c)throw new e("portal:missing-layer-module-type-map","Layer module type map is required to construct sub layers");switch(p){case"Feature Service":case"Feature Collection":o=c.FeatureLayer;break;case"Stream Service":o=c.StreamLayer;break;case"Scene Service":o=c.SceneLayer;break;default:throw new e("portal:unsupported-item-type-as-group",`The item type '${p}' is not supported as a 'IGroupLayer'`)}const y=new a;let[m,d]=await Promise.all([o(),F(r,y)]),f=()=>m;if("Feature Service"===p){const e=s(d)?.customParameters;d=n.url?await i(d,n.url,y):{},f=await D(d,c)||f;const r=await C(n.url,{customParameters:e,loadContext:y});return await v(t,f,d,c,r)}return"Scene Service"===p&&n.url&&(d=await l(n,d,y)),u(d)>0?await v(t,f,d,c):await T(t,f,c)}async function T(e,t,r){const{portalItem:a}=e;if(!a?.url)return;const o=await w(a.url);o&&v(e,t,{layers:o.layers?.map(p),tables:o.tables?.map(p)},r)}async function v(e,t,r,a,o){let n=r.layers||[];const s=r.tables||[];if("Feature Collection"===e.portalItem?.type?(n.forEach(((e,t)=>{e.id=t,"Table"===e?.layerDefinition?.type&&s.push(e)})),n=n.filter((e=>"Table"!==e?.layerDefinition?.type))):(n.reverse(),s.reverse()),n.forEach((a=>{const n=o?.(a);if(n||!o){const o=j(e,t(a),r,a,n);e.add(o)}})),s.length){const t=await a.FeatureLayer();s.forEach((a=>{const n=o?.(a);if(n||!o){const o=j(e,t,r,a,n);e.tables.add(o)}}))}}function j(e,t,r,a,n){const s=e.portalItem,i={portalItem:s.clone(),layerId:a.id};null!=a.url&&(i.url=a.url);const l=new t(i);if("sourceJSON"in l&&(l.sourceJSON=n),"subtype-group"!==l.type&&"catalog"!==l.type&&(l.sublayerTitleMode="service-name"),"Feature Collection"===s.type){const e={origin:"portal-item",portal:s.portal||o.getDefault()};l.read(a,e);const t=r.showLegend;null!=t&&l.read({showLegend:t},e)}return l}async function F(e,t,r){if(!1===e.supportsData)return;const a=e.instance,o=a.portalItem;if(!o)return;let n=null;try{n=await o.fetchData("json",r)}catch(i){}if(x(a)){let e=null;const r=await M(o,n,t);if((n?.layers||n?.tables)&&r>0){if(null==a.layerId){const e=c(a.type),t=e?y(n,e)[0]:s(n);t&&(a.layerId=t.id)}e=P(n,a),"OrientedImageryLayer"===e?.layerType&&"oriented-imagery"===a.type&&a.supportedSourceTypes.add("Feature Layer"),e&&null!=n.showLegend&&(e.showLegend=n.showLegend)}return r>1&&"sublayerTitleMode"in a&&"service-name"!==a.sublayerTitleMode&&(a.sublayerTitleMode="item-title-and-service-name"),e}return n}async function M(e,r,a){if(r?.layers&&r?.tables)return u(r);const o=t(e.url);if(!o)return 1;const n=await a.fetchServiceMetadata(o.url.path,{customParameters:s(r)?.customParameters}).catch((()=>null));return(r?.layers?.length??n?.layers?.length??0)+(r?.tables?.length??n?.tables?.length??0)}function P(e,t){const{layerId:r}=t,a=e.layers?.find((e=>e.id===r))||e.tables?.find((e=>e.id===r));return a&&G(a,t)?a:null}function x(e){return"stream"!==e.type&&"layerId"in e}function G(e,t){const r="layerType"in e&&e.layerType,{type:a}=t;return!("feature"===a&&r&&"ArcGISFeatureLayer"!==e.layerType||"catalog"===a&&!r||"oriented-imagery"===a&&!r||"subtype-group"===a&&!r)}async function C(e,t){const{layersJSON:a}=await r(e,t);if(!a)return null;const o=[...a.layers,...a.tables];return e=>o.find((t=>t.id===e.id))}async function D(e,t){const{layers:r}=e;if(!r?.length)return;const a=new Set,o=[];for(const{layerType:i}of r){const e=i??"ArcGISFeatureLayer";if(a.has(e))continue;a.add(e);const r=t[m(e)];o.push(r())}const n=await Promise.all(o),s=new Map;return Array.from(a).forEach(((e,t)=>{s.set(e,n[t])})),({layerType:e})=>{const t=e??"ArcGISFeatureLayer";return s.get(t)}}export{h as load};
5
+ import e from"../../core/Error.js";import{parse as t}from"../../layers/support/arcgisLayerUrl.js";import{fetchFeatureService as r}from"../../layers/support/fetchService.js";import{LayerLoadContext as a}from"../../layers/support/LayerLoadContext.js";import o from"../Portal.js";import{createForItemRead as n}from"./jsonContext.js";import{getFirstLayerOrTable as s,preprocessFSItemData as l,populateSceneServiceItemData as i,getNumLayersAndTables as u,createSublayerData as p,instanceTypeToLayerTypes as c,getSublayersByLayerType as y,layerTypeToLayerModuleType as m}from"./loadUtils.js";import{hasTypeKeyword as d}from"./portalItemUtils.js";import{loadStyleRenderer as f}from"../../renderers/support/styleUtils.js";import{fetchArcGISServiceJSON as w}from"../../support/requestPresets.js";async function h(e,t){const r=e.instance.portalItem;if(r?.id)return await r.load(t),g(e),e.validateItem&&e.validateItem(r),I(e,t)}function g(t){const r=t.instance.portalItem;if(!r?.type||!t.supportedTypes.includes(r.type))throw new e("portal:invalid-layer-item-type","Invalid layer item type '${type}', expected '${expectedType}'",{type:r?.type,expectedType:t.supportedTypes.join(", ")})}async function I(e,t){const r=e.instance,o=r.portalItem;if(!o)return;const{url:s,title:l}=o,i=n(o,"portal-item");if("group"===r.type)return b(r,i,e);s&&"media"!==r.type&&r.read({url:s},i);const u=new a,p=await F(e,u,t);return p&&r.read(p,i),r.resourceReferences={portalItem:o,paths:i.readResourcePaths??[]},"subtype-group"!==r.type&&r.read({title:l},i),f(r,i)}async function b(t,r,a){const o=t.portalItem;if(!t.sourceIsPortalItem)return;const{title:n,type:s}=o;if("Group Layer"===s){if(!d(o,"Map"))throw new e("portal:invalid-layer-item-typekeyword","'Group Layer' item without 'Map' type keyword is not supported");return L(t,a)}return t.read({title:n},r),S(t,a)}async function L(t,r){const a=t.portalItem,o=await a.fetchData("json");if(!o)return;if(!r.populateGroupLayer)throw new e("portal:missing-populate-group-layer","Missing populate group layer");const s=n(a,"web-map");t.read(o,s),await r.populateGroupLayer(t,o,{context:s}),t.resourceReferences={portalItem:a,paths:s.readResourcePaths??[]}}async function S(t,r){let o;const{portalItem:n}=t;if(!n)return;const p=n.type,c=r.layerModuleTypeMap;if(!c)throw new e("portal:missing-layer-module-type-map","Layer module type map is required to construct sub layers");switch(p){case"Feature Service":case"Feature Collection":o=c.FeatureLayer;break;case"Stream Service":o=c.StreamLayer;break;case"Scene Service":o=c.SceneLayer;break;default:throw new e("portal:unsupported-item-type-as-group",`The item type '${p}' is not supported as a 'IGroupLayer'`)}const y=new a;let[m,d]=await Promise.all([o(),F(r,y)]),f=()=>m;if("Feature Service"===p){const e=s(d)?.customParameters;d=n.url?await l(d,n.url,y):{},f=await D(d,c)||f;const r=await C(n.url,{customParameters:e,loadContext:y});return await v(t,f,f,d,c,r)}return"Scene Service"===p&&n.url&&(d=await i(n,d,y)),u(d)>0?await v(t,f,null,d,c):await T(t,f,c)}async function T(e,t,r){const{portalItem:a}=e;if(!a?.url)return;const o=await w(a.url);o&&v(e,t,null,{layers:o.layers?.map(p),tables:o.tables?.map(p)},r)}async function v(e,t,r,a,o,n){let s=a.layers||[];const l=a.tables||[];if("Feature Collection"===e.portalItem?.type?(s.forEach(((e,t)=>{e.id=t,"Table"===e?.layerDefinition?.type&&l.push(e)})),s=s.filter((e=>"Table"!==e?.layerDefinition?.type))):(s.reverse(),l.reverse()),s.forEach((r=>{const o=n?.(r);if(o||!n){const n=j(e,t(r),a,r,o);e.add(n)}})),l.length){const t=r?null:await o.FeatureLayer();l.forEach((o=>{const s=n?.(o);if(s||!n){const n=j(e,r?r(o):t,a,o,s);e.tables.add(n)}}))}}function j(e,t,r,a,n){const s=e.portalItem,l={portalItem:s.clone(),layerId:a.id};null!=a.url&&(l.url=a.url);const i=new t(l);if("sourceJSON"in i&&(i.sourceJSON=n),"subtype-group"!==i.type&&"catalog"!==i.type&&(i.sublayerTitleMode="service-name"),"Feature Collection"===s.type){const e={origin:"portal-item",portal:s.portal||o.getDefault()};i.read(a,e);const t=r.showLegend;null!=t&&i.read({showLegend:t},e)}return i}async function F(e,t,r){if(!1===e.supportsData)return;const a=e.instance,o=a.portalItem;if(!o)return;let n=null;try{n=await o.fetchData("json",r)}catch(l){}if(x(a)){let e=null;const r=await M(o,n,t);if((n?.layers||n?.tables)&&r>0){if(null==a.layerId){const e=c(a.type),t=e?.length?y(n,e)[0]:s(n);t&&(a.layerId=t.id)}e=P(n,a),"OrientedImageryLayer"===e?.layerType&&"oriented-imagery"===a.type&&a.supportedSourceTypes.add("Feature Layer"),e&&null!=n.showLegend&&(e.showLegend=n.showLegend)}return r>1&&"sublayerTitleMode"in a&&"service-name"!==a.sublayerTitleMode&&(a.sublayerTitleMode="item-title-and-service-name"),e}return n}async function M(e,r,a){if(r?.layers&&r?.tables)return u(r);const o=t(e.url);if(!o)return 1;const n=await a.fetchServiceMetadata(o.url.path,{customParameters:s(r)?.customParameters}).catch((()=>null));return(r?.layers?.length??n?.layers?.length??0)+(r?.tables?.length??n?.tables?.length??0)}function P(e,t){const{layerId:r}=t,a=e.layers?.find((e=>e.id===r))||e.tables?.find((e=>e.id===r));return a&&G(a,t)?a:null}function x(e){return"stream"!==e.type&&"layerId"in e}function G(e,t){const r="layerType"in e&&e.layerType,{type:a}=t;return!("feature"===a&&r&&"ArcGISFeatureLayer"!==e.layerType||"catalog"===a&&!r||"oriented-imagery"===a&&!r||"subtype-group"===a&&!r)}async function C(e,t){const{layersJSON:a}=await r(e,t);if(!a)return null;const o=[...a.layers,...a.tables];return e=>o.find((t=>t.id===e.id))}async function D(e,t){const{layers:r,tables:a}=e,o=[...r??[],...a??[]];if(!o.length)return;const n=new Set,s=[];for(const{layerType:u}of o){const e=u??"ArcGISFeatureLayer";if(n.has(e))continue;n.add(e);const r=t[m(e)];s.push(r())}const l=await Promise.all(s),i=new Map;return Array.from(n).forEach(((e,t)=>{i.set(e,l[t])})),({layerType:e})=>{const t=e??"ArcGISFeatureLayer";return i.get(t)}}export{h as load};
@@ -2,4 +2,4 @@
2
2
  All material copyright ESRI, All Rights Reserved, unless otherwise specified.
3
3
  See https://js.arcgis.com/4.33/esri/copyright.txt for details.
4
4
  */
5
- import{findAssociatedFeatureService as e}from"../../layers/support/associatedFeatureServiceUtils.js";import{getLayerModuleType as r}from"../../layers/support/fetchService.js";function t(e){const t={id:e.id,name:e.name},a=r(e.type);return"FeatureLayer"!==a&&(t.layerType=a),t}async function a(e,r,a){if(null==e?.layers||null==e?.tables){const s=await a.fetchServiceMetadata(r,{customParameters:l(e)?.customParameters});(e=e||{}).layers=e.layers||s?.layers?.map(t),e.tables=e.tables||s?.tables?.map(t)}return e}function l(e){if(!e)return null;const{layers:r,tables:t}=e;return r?.length?r[0]:t?.length?t[0]:null}function s(e,r){if(null==r)return null;return[...e.layers||[],...e.tables||[]].find((e=>e.id===r))}function n(e,r){return[...e.layers||[],...e.tables||[]].filter((({layerType:e})=>e?e===r:"ArcGISFeatureLayer"===r))}function u(e){return(e?.layers?.length??0)+(e?.tables?.length??0)}function c(e){switch(e){case"catalog":return"CatalogLayer";case"feature":return"ArcGISFeatureLayer";case"oriented-imagery":return"OrientedImageryLayer";case"subtype-group":return"SubtypeGroupLayer"}return null}function i(e){switch(e){case"CatalogLayer":return"CatalogLayer";case"OrientedImageryLayer":return"OrientedImageryLayer";case"SubtypeGroupLayer":return"SubtypeGroupLayer"}return"FeatureLayer"}async function o(r,a,s){if(!r?.url)return a??{};if(a??={},!a.layers){const e=await s.fetchServiceMetadata(r.url);a.layers=e.layers?.map(t)}const{serverUrl:n,portalItem:u}=await e(r.url,{sceneLayerItem:r,customParameters:l(a)?.customParameters}).catch((()=>({serverUrl:null,portalItem:null})));if(null==n)return a.tables=[],a;if(!a.tables&&u){const e=await u.fetchData().catch((()=>null));if(e?.tables)a.tables=e.tables.map(t);else{const r=await s.fetchServiceMetadata(n,{customParameters:l(e)?.customParameters}).catch((()=>null));a.tables=r?.tables?.map(t)}}if(a.tables)for(const e of a.tables)e.url=`${n}/${e.id}`;return a}export{t as createSublayerData,l as getFirstLayerOrTable,s as getLayerOrTable,u as getNumLayersAndTables,n as getSublayersByLayerType,c as instanceTypeToLayerType,i as layerTypeToLayerModuleType,o as populateSceneServiceItemData,a as preprocessFSItemData};
5
+ import{findAssociatedFeatureService as e}from"../../layers/support/associatedFeatureServiceUtils.js";import{getLayerModuleType as r}from"../../layers/support/fetchService.js";function t(e){const t={id:e.id,name:e.name},a=r(e.type);return"FeatureLayer"!==a&&(t.layerType=a),t}async function a(e,r,a){if(null==e?.layers||null==e?.tables){const s=await a.fetchServiceMetadata(r,{customParameters:l(e)?.customParameters});(e=e||{}).layers=e.layers||s?.layers?.map(t),e.tables=e.tables||s?.tables?.map(t)}return e}function l(e){if(!e)return null;const{layers:r,tables:t}=e;return r?.length?r[0]:t?.length?t[0]:null}function s(e,r){if(null==r)return null;return[...e.layers||[],...e.tables||[]].find((e=>e.id===r))}function n(e,r){return[...e.layers||[],...e.tables||[]].filter((({layerType:e})=>e?r.includes(e):r.includes("ArcGISFeatureLayer")))}function u(e){return(e?.layers?.length??0)+(e?.tables?.length??0)}function c(e){switch(e){case"catalog":return["CatalogLayer"];case"feature":return["ArcGISFeatureLayer"];case"oriented-imagery":return["OrientedImageryLayer"];case"subtype-group":return["SubtypeGroupLayer","SubtypeGroupTable"]}return null}function i(e){switch(e){case"CatalogLayer":return"CatalogLayer";case"OrientedImageryLayer":return"OrientedImageryLayer";case"SubtypeGroupLayer":case"SubtypeGroupTable":return"SubtypeGroupLayer"}return"FeatureLayer"}async function o(r,a,s){if(!r?.url)return a??{};if(a??={},!a.layers){const e=await s.fetchServiceMetadata(r.url);a.layers=e.layers?.map(t)}const{serverUrl:n,portalItem:u}=await e(r.url,{sceneLayerItem:r,customParameters:l(a)?.customParameters}).catch((()=>({serverUrl:null,portalItem:null})));if(null==n)return a.tables=[],a;if(!a.tables&&u){const e=await u.fetchData().catch((()=>null));if(e?.tables)a.tables=e.tables.map(t);else{const r=await s.fetchServiceMetadata(n,{customParameters:l(e)?.customParameters}).catch((()=>null));a.tables=r?.tables?.map(t)}}if(a.tables)for(const e of a.tables)e.url=`${n}/${e.id}`;return a}export{t as createSublayerData,l as getFirstLayerOrTable,s as getLayerOrTable,u as getNumLayersAndTables,n as getSublayersByLayerType,c as instanceTypeToLayerTypes,i as layerTypeToLayerModuleType,o as populateSceneServiceItemData,a as preprocessFSItemData};
@@ -2,4 +2,4 @@
2
2
  All material copyright ESRI, All Rights Reserved, unless otherwise specified.
3
3
  See https://js.arcgis.com/4.33/esri/copyright.txt for details.
4
4
  */
5
- import t from"../request.js";import{ensureClass as e}from"../core/accessorSupport/ensureType.js";import r from"../geometry/SpatialReference.js";import{fromJSON as o}from"../geometry/support/jsonUtils.js";import{normalizeCentralMeridian as a}from"../geometry/support/normalizeUtils.js";import{srToRESTValue as s}from"../geometry/support/spatialReferenceUtils.js";import{parseUrl as n,encode as m,asValidOptions as i}from"./utils.js";import p from"./support/FindImagesParameters.js";import u from"./support/FindImagesResult.js";import c from"./support/ImageAngleParameters.js";import f from"./support/ImageAngleResult.js";import l from"./support/ImageAreaParameters.js";import g from"./support/ImageAreaResult.js";import y from"./support/ImageBoundaryParameters.js";import j from"./support/ImageBoundaryResult.js";import d from"./support/ImageDistanceParameters.js";import S from"./support/ImageDistanceResult.js";import I from"./support/ImageGPSInfoParameters.js";import N from"./support/ImageGPSInfoResult.js";import R from"./support/ImageHeightParameters.js";import h from"./support/ImageHeightResult.js";import O from"./support/ImageHistogramParameters.js";import J from"./support/ImageIdentifyParameters.js";import w from"./support/ImageIdentifyResult.js";import P from"./support/ImagePixelLocationParameters.js";import q from"./support/ImagePixelLocationResult.js";import G from"./support/ImagePointParameters.js";import $ from"./support/ImagePointResult.js";import C from"./support/ImageSampleParameters.js";import M from"./support/ImageSampleResult.js";import b from"./support/ImageToMapMultirayParameters.js";import v from"./support/ImageToMapParameters.js";import F from"./support/ImageUrlParameters.js";import T from"./support/ImageUrlResult.js";import A from"./support/ImageVolumeParameters.js";import L from"./support/ImageVolumeResult.js";import U from"./support/MapToImageParameters.js";import x from"./support/MeasureAreaFromImageResult.js";import H from"./support/MeasureFromImageParameters.js";import V from"./support/MeasureLengthFromImageResult.js";function B(t){const e=t?.time;if(e&&(null!=e.start||null!=e.end)){const r=[];null!=e.start&&r.push(e.start),null==e.end||r.includes(e.end)||r.push(e.end),t.time=r.join(",")}}async function D(t,r,o){r=e(O,r);const s=n(t),p=r.geometry?[r.geometry]:[],u=await a(p),c=r.toJSON();B(c);const f=u?.[0];null!=f&&(c.geometry=st(f));const l=m({...s.query,f:"json",...c});return i(l,o)}async function k(r,o,a){const s=(o=e(A,o)).toJSON();s.geometries=JSON.stringify(s.geometries);const p=n(r),u=m({...p.query,f:"json",...s}),c=i(u,a),{data:f}=await t(`${p.path}/calculateVolume`,c);return L.fromJSON({volumes:f?.results})}async function z(o,a,s){const p=(a=e(c,a)).toJSON();null!=p.angleName&&(p.angleName=p.angleName.join(",")),a?.point?.spatialReference?.imageCoordinateSystem&&(p.point.spatialReference=nt(a.point.spatialReference)),a?.spatialReference?.imageCoordinateSystem&&(p.spatialReference=mt(a.spatialReference));const u=n(o),l=m({...u.query,f:"json",...p}),g=i(l,s),{data:y}=await t(`${u.path}/computeAngles`,g);return y.spatialReference=y.spatialReference?null!=y.spatialReference.geodataXform?new r({wkid:0,imageCoordinateSystem:y.spatialReference}):r.fromJSON(y.spatialReference):null,"NaN"===y.north&&(y.north=null),"NaN"===y.up&&(y.up=null),new f(y)}async function E(r,o,a){const s=(o=e(P,o)).toJSON(),{geometries:p}=o;if(p)for(let t=0;t<p.length;t++)p[t].spatialReference?.imageCoordinateSystem&&(s.geometries.geometries[t].spatialReference=nt(p[t].spatialReference));const u=n(r),c=m({...u.query,f:"json",...s}),f=i(c,a),{data:l}=await t(`${u.path}/computePixelLocation`,f);return q.fromJSON(l)}async function X(e,r,o){const a=await D(e,r,o),s=n(e),{data:m}=await t(`${s.path}/computeStatisticsHistograms`,a),{statistics:i}=m;return i?.length&&i.forEach((t=>{t.avg=t.mean,t.stddev=t.standardDeviation})),{statistics:i,histograms:m.histograms}}async function K(e,r,o){const a=await D(e,r,o),s=n(e),{data:m}=await t(`${s.path}/computeHistograms`,a);return{histograms:m.histograms}}async function Q(r,o,s){const p=(o=e(C,o)).toJSON();B(p),p.outFields?.length&&(p.outFields=p.outFields.join(","));const u=await a(o.geometry),c=u?.[0];null!=c&&(p.geometry=st(c));const f=n(r),l=m({...f.query,f:"json",...p}),g=i(l,s),{data:y}=await t(`${f.path}/getSamples`,g),j=y?.samples?.map((t=>{const e="NaN"===t.value||""===t.value?null:t.value.split(" ").map((t=>Number(t)));return{...t,pixelValue:e}}));return M.fromJSON({samples:j})}async function W(r,o,s){o=e(J,o);const p=n(r),u=o.geometry?[o.geometry]:[];return a(u).then((e=>{const r=o.toJSON(),a=e?.[0];null!=a&&(r.geometry=JSON.stringify(st(a)));const n=m({...p.query,f:"json",...r}),u=i(n,s);return t(p.path+"/identify",u)})).then((t=>w.fromJSON(t.data)))}async function Y(t,r,o){r=e(R,r);const a=await et(t,r,[r.fromGeometry,r.toGeometry],o);return h.fromJSON(a)}async function Z(t,r,o){r=e(l,r);const a=await et(t,r,[r.geometry],o);return g.fromJSON(a)}async function _(t,r,o){r=e(G,r);const a=await et(t,r,[r.geometry],o);return $.fromJSON(a)}async function tt(t,r,o){r=e(d,r);const a=await et(t,r,[r.fromGeometry,r.toGeometry],o);return S.fromJSON(a)}async function et(e,r,o,s){const p=n(e),u=await a(o),c=r.toJSON();null!=u[0]&&(c.fromGeometry=JSON.stringify(st(u[0]))),null!=u[1]&&(c.toGeometry=JSON.stringify(st(u[1])));const f=m({...p.query,f:"json",...c}),l=i(f,s),{data:g}=await t(p.path+"/measure",l);return g}async function rt(t,e,r){const o=await at(t,e,r);return V.fromJSON(o)}async function ot(t,e,r){const o=await at(t,e,r);return x.fromJSON(o)}async function at(r,o,a){o=e(H,o);const s=n(r),p=o.toJSON(),u=m({...s.query,f:"json",...p}),c=i(u,a),{data:f}=await t(s.path+"/measureFromImage",c);return f}function st(t){const e=t.toJSON();return t.spatialReference?.imageCoordinateSystem&&(e.spatialReference=nt(t.spatialReference)),e}function nt(t){const{imageCoordinateSystem:e}=t;if(e){const{id:t,referenceServiceName:r}=e;return null!=t?r?{icsid:t,icsns:r}:{icsid:t}:{ics:e}}return t.toJSON()}function mt(t,e){if(!t.imageCoordinateSystem)return s(t);const r=nt(t),{icsid:o,icsns:a}=r;return null==o||null!=a&&!e?.toLowerCase().includes("/"+a.toLowerCase()+"/")?JSON.stringify(r):`0:${o}`}async function it(r,o,a){o=e(y,o);const s=n(r),p=o.toJSON();o.outSpatialReference&&(p.outSR=mt(o.outSpatialReference));const u=m({...s.query,f:"json",...p}),c=i(u,a),{data:f}=await t(s.path+"/queryBoundary",c);return j.fromJSON(f)}async function pt(r,o,s){const p=(o=e(I,o)).toJSON();B(p),p.objectIds?.length&&(p.objectIds=p.objectIds.join(",")),p.geometry||p.objectIds||p.time||p.where||(p.where="1=1");const u=await a(o.geometry),c=u?.[0];null!=c&&(p.geometry=st(c));const f=c?.spatialReference??o.geometry?.spatialReference;f&&(p.inSR=mt(f));const l=n(r),g=m({...l.query,f:"json",...p}),y=i(g,s),{data:j}=await t(`${l.path}/queryGPSInfo`,y);return N.fromJSON(j)}async function ut(r,a,s){const p=(a=e(v,a)).toJSON();a.geometry.spatialReference.imageCoordinateSystem&&(p.geometry=st(a.geometry)),a.depthOffset&&a.adjust||delete p.options;const u=n(r),c=m({...u.query,f:"json",...p}),f=i(c,s),{data:l}=await t(`${u.path}/imageToMap`,f);return o(l)}async function ct(r,a,s){const p=(a=e(b,a)).toJSON();a.rasterIds?.length&&(p.rasterIds=a.rasterIds.join(","));const u=n(r),c=m({...u.query,f:"json",...p}),f=i(c,s),{data:l}=await t(`${u.path}/imageToMapMultiray`,f);return o(l)}async function ft(r,s,p){const u=(s=e(U,s)).toJSON(),c=await a(s.geometry),f=c?.[0];null!=f&&(u.geometry=st(f)),s.visibleOnly||delete u.options;const l=f?.spatialReference??s.geometry?.spatialReference;l&&(u.inSR=mt(l));const g=n(r),y=m({...g.query,f:"json",...u}),j=i(y,p),{data:d}=await t(`${g.path}/mapToImage`,j);return o(d)}async function lt(r,o,a){const s=(o=e(F,o)).toJSON(),p=n(r),u=m({...p.query,f:"json",...s}),c=i(u,a),{data:f}=await t(`${p.path}/getImageUrl`,c);return T.fromJSON(f)}async function gt(r,o,s){const c=(o=e(p,o)).toJSON(),f=await a([o.fromGeometry,o.toGeometry]);null!=f[0]&&(c.fromGeometry=st(f[0]),f[0].spatialReference&&(c.inSR=mt(f[0].spatialReference))),null!=f[1]&&(c.toGeometry=st(f[1])),o.objectIds?.length&&(c.objectIds=c.objectIds.join(","));const l=n(r),g=m({...l.query,f:"json",...c}),y=i(g,s),{data:j}=await t(`${l.path}/find`,y);return u.fromJSON(j)}export{k as calculateVolume,z as computeAngles,K as computeHistograms,E as computePixelSpaceLocations,X as computeStatisticsHistograms,gt as findImages,nt as getImageSpatialReferenceJSON,mt as getImageSpatialReferenceQueryParameter,lt as getImageUrl,Q as getSamples,W as identify,ut as imageToMap,ct as imageToMapMultiray,ft as mapToImage,Z as measureAreaAndPerimeter,ot as measureAreaFromImage,tt as measureDistanceAndAngle,Y as measureHeight,rt as measureLengthFromImage,_ as measurePointOrCentroid,it as queryBoundary,pt as queryGPSInfo};
5
+ import t from"../request.js";import{ensureClass as e}from"../core/accessorSupport/ensureType.js";import r from"../geometry/SpatialReference.js";import{fromJSON as o}from"../geometry/support/jsonUtils.js";import{normalizeCentralMeridian as a}from"../geometry/support/normalizeUtils.js";import{srToRESTValue as s}from"../geometry/support/spatialReferenceUtils.js";import{parseUrl as n,encode as m,asValidOptions as i}from"./utils.js";import p from"./support/FindImagesParameters.js";import u from"./support/FindImagesResult.js";import c from"./support/ImageAngleParameters.js";import f from"./support/ImageAngleResult.js";import l from"./support/ImageAreaParameters.js";import g from"./support/ImageAreaResult.js";import y from"./support/ImageBoundaryParameters.js";import j from"./support/ImageBoundaryResult.js";import d from"./support/ImageDistanceParameters.js";import S from"./support/ImageDistanceResult.js";import I from"./support/ImageGPSInfoParameters.js";import N from"./support/ImageGPSInfoResult.js";import R from"./support/ImageHeightParameters.js";import h from"./support/ImageHeightResult.js";import O from"./support/ImageHistogramParameters.js";import J from"./support/ImageIdentifyParameters.js";import w from"./support/ImageIdentifyResult.js";import P from"./support/ImagePixelLocationParameters.js";import q from"./support/ImagePixelLocationResult.js";import G from"./support/ImagePointParameters.js";import $ from"./support/ImagePointResult.js";import C from"./support/ImageSampleParameters.js";import M from"./support/ImageSampleResult.js";import b from"./support/ImageToMapMultirayParameters.js";import v from"./support/ImageToMapParameters.js";import F from"./support/ImageUrlParameters.js";import T from"./support/ImageUrlResult.js";import A from"./support/ImageVolumeParameters.js";import L from"./support/ImageVolumeResult.js";import U from"./support/MapToImageParameters.js";import x from"./support/MeasureAreaFromImageResult.js";import H from"./support/MeasureFromImageParameters.js";import V from"./support/MeasureLengthFromImageResult.js";function B(t){const e=t?.time;if(e&&(null!=e.start||null!=e.end)){const r=[];null!=e.start&&r.push(e.start),null==e.end||r.includes(e.end)||r.push(e.end),t.time=r.join(",")}}async function D(t,r,o){r=e(O,r);const s=n(t),p=r.geometry?[r.geometry]:[],u=await a(p),c=r.toJSON();B(c);const f=u?.[0];null!=f&&(c.geometry=st(f));const l=m({...s.query,f:"json",...c});return i(l,o)}async function k(r,o,a){const s=(o=e(A,o)).toJSON();s.geometries=JSON.stringify(s.geometries);const p=n(r),u=m({...p.query,f:"json",...s}),c=i(u,a),{data:f}=await t(`${p.path}/calculateVolume`,c);return L.fromJSON({volumes:f.results})}async function z(o,a,s){const p=(a=e(c,a)).toJSON();null!=p.angleName&&(p.angleName=p.angleName.join(",")),a?.point?.spatialReference?.imageCoordinateSystem&&(p.point.spatialReference=nt(a.point.spatialReference)),a?.spatialReference?.imageCoordinateSystem&&(p.spatialReference=mt(a.spatialReference));const u=n(o),l=m({...u.query,f:"json",...p}),g=i(l,s),{data:y}=await t(`${u.path}/computeAngles`,g);return y.spatialReference=y.spatialReference?null!=y.spatialReference.geodataXform?new r({wkid:0,imageCoordinateSystem:y.spatialReference}):r.fromJSON(y.spatialReference):null,"NaN"===y.north&&(y.north=null),"NaN"===y.up&&(y.up=null),new f(y)}async function E(r,o,a){const s=(o=e(P,o)).toJSON(),{geometries:p}=o;if(p)for(let t=0;t<p.length;t++)p[t].spatialReference?.imageCoordinateSystem&&(s.geometries.geometries[t].spatialReference=nt(p[t].spatialReference));const u=n(r),c=m({...u.query,f:"json",...s}),f=i(c,a),{data:l}=await t(`${u.path}/computePixelLocation`,f);return q.fromJSON(l)}async function X(e,r,o){const a=await D(e,r,o),s=n(e),{data:m}=await t(`${s.path}/computeStatisticsHistograms`,a),{statistics:i}=m;return i?.length&&i.forEach((t=>{t.avg=t.mean,t.stddev=t.standardDeviation})),{statistics:i,histograms:m.histograms}}async function K(e,r,o){const a=await D(e,r,o),s=n(e),{data:m}=await t(`${s.path}/computeHistograms`,a);return{histograms:m.histograms}}async function Q(r,o,s){const p=(o=e(C,o)).toJSON();B(p),p.outFields?.length&&(p.outFields=p.outFields.join(","));const u=await a(o.geometry),c=u?.[0];null!=c&&(p.geometry=st(c));const f=n(r),l=m({...f.query,f:"json",...p}),g=i(l,s),{data:y}=await t(`${f.path}/getSamples`,g),j=y.samples.map((t=>{const e="NaN"===t.value||""===t.value?null:t.value.split(" ").map((t=>Number(t)));return{...t,pixelValue:e}}));return M.fromJSON({samples:j})}async function W(r,o,s){o=e(J,o);const p=n(r),u=o.geometry?[o.geometry]:[];return a(u).then((e=>{const r=o.toJSON(),a=e?.[0];null!=a&&(r.geometry=JSON.stringify(st(a)));const n=m({...p.query,f:"json",...r}),u=i(n,s);return t(p.path+"/identify",u)})).then((t=>w.fromJSON(t.data)))}async function Y(t,r,o){r=e(R,r);const a=await et(t,r,[r.fromGeometry,r.toGeometry],o);return h.fromJSON(a)}async function Z(t,r,o){r=e(l,r);const a=await et(t,r,[r.geometry],o);return g.fromJSON(a)}async function _(t,r,o){r=e(G,r);const a=await et(t,r,[r.geometry],o);return $.fromJSON(a)}async function tt(t,r,o){r=e(d,r);const a=await et(t,r,[r.fromGeometry,r.toGeometry],o);return S.fromJSON(a)}async function et(e,r,o,s){const p=n(e),u=await a(o),c=r.toJSON();null!=u[0]&&(c.fromGeometry=JSON.stringify(st(u[0]))),null!=u[1]&&(c.toGeometry=JSON.stringify(st(u[1])));const f=m({...p.query,f:"json",...c}),l=i(f,s),{data:g}=await t(p.path+"/measure",l);return g}async function rt(t,e,r){const o=await at(t,e,r);return V.fromJSON(o)}async function ot(t,e,r){const o=await at(t,e,r);return x.fromJSON(o)}async function at(r,o,a){o=e(H,o);const s=n(r),p=o.toJSON(),u=m({...s.query,f:"json",...p}),c=i(u,a),{data:f}=await t(s.path+"/measureFromImage",c);return f}function st(t){const e=t.toJSON();return t.spatialReference?.imageCoordinateSystem&&(e.spatialReference=nt(t.spatialReference)),e}function nt(t){const{imageCoordinateSystem:e}=t;if(e){const{id:t,referenceServiceName:r}=e;return null!=t?r?{icsid:t,icsns:r}:{icsid:t}:{ics:e}}return t.toJSON()}function mt(t,e){if(!t.imageCoordinateSystem)return s(t);const r=nt(t),{icsid:o,icsns:a}=r;return null==o||null!=a&&!e?.toLowerCase().includes("/"+a.toLowerCase()+"/")?JSON.stringify(r):`0:${o}`}async function it(r,o,a){o=e(y,o);const s=n(r),p=o.toJSON();o.outSpatialReference&&(p.outSR=mt(o.outSpatialReference));const u=m({...s.query,f:"json",...p}),c=i(u,a),{data:f}=await t(s.path+"/queryBoundary",c);return j.fromJSON(f)}async function pt(r,o,s){const p=(o=e(I,o)).toJSON();B(p),p.objectIds?.length&&(p.objectIds=p.objectIds.join(",")),p.geometry||p.objectIds||p.time||p.where||(p.where="1=1");const u=await a(o.geometry),c=u?.[0];null!=c&&(p.geometry=st(c));const f=c?.spatialReference??o.geometry?.spatialReference;f&&(p.inSR=mt(f));const l=n(r),g=m({...l.query,f:"json",...p}),y=i(g,s),{data:j}=await t(`${l.path}/queryGPSInfo`,y);return N.fromJSON(j)}async function ut(r,a,s){const p=(a=e(v,a)).toJSON();a.geometry.spatialReference.imageCoordinateSystem&&(p.geometry=st(a.geometry)),a.depthOffset&&a.adjust||delete p.options;const u=n(r),c=m({...u.query,f:"json",...p}),f=i(c,s),{data:l}=await t(`${u.path}/imageToMap`,f);return o(l)}async function ct(r,a,s){const p=(a=e(b,a)).toJSON();a.rasterIds?.length&&(p.rasterIds=a.rasterIds.join(","));const u=n(r),c=m({...u.query,f:"json",...p}),f=i(c,s),{data:l}=await t(`${u.path}/imageToMapMultiray`,f);return o(l)}async function ft(r,s,p){const u=(s=e(U,s)).toJSON(),c=await a(s.geometry),f=c?.[0];null!=f&&(u.geometry=st(f)),s.visibleOnly||delete u.options;const l=f?.spatialReference??s.geometry?.spatialReference;l&&(u.inSR=mt(l));const g=n(r),y=m({...g.query,f:"json",...u}),j=i(y,p),{data:d}=await t(`${g.path}/mapToImage`,j);return o(d)}async function lt(r,o,a){const s=(o=e(F,o)).toJSON(),p=n(r),u=m({...p.query,f:"json",...s}),c=i(u,a),{data:f}=await t(`${p.path}/getImageUrl`,c);return T.fromJSON(f)}async function gt(r,o,s){const c=(o=e(p,o)).toJSON(),f=await a([o.fromGeometry,o.toGeometry]);null!=f[0]&&(c.fromGeometry=st(f[0]),f[0].spatialReference&&(c.inSR=mt(f[0].spatialReference))),null!=f[1]&&(c.toGeometry=st(f[1])),o.objectIds?.length&&(c.objectIds=c.objectIds.join(","));const l=n(r),g=m({...l.query,f:"json",...c}),y=i(g,s),{data:j}=await t(`${l.path}/find`,y);return u.fromJSON(j)}export{k as calculateVolume,z as computeAngles,K as computeHistograms,E as computePixelSpaceLocations,X as computeStatisticsHistograms,gt as findImages,nt as getImageSpatialReferenceJSON,mt as getImageSpatialReferenceQueryParameter,lt as getImageUrl,Q as getSamples,W as identify,ut as imageToMap,ct as imageToMapMultiray,ft as mapToImage,Z as measureAreaAndPerimeter,ot as measureAreaFromImage,tt as measureDistanceAndAngle,Y as measureHeight,rt as measureLengthFromImage,_ as measurePointOrCentroid,it as queryBoundary,pt as queryGPSInfo};
@@ -2,4 +2,4 @@
2
2
  All material copyright ESRI, All Rights Reserved, unless otherwise specified.
3
3
  See https://js.arcgis.com/4.33/esri/copyright.txt for details.
4
4
  */
5
- import{_ as t}from"../../chunks/tslib.es6.js";import e from"../../core/JSONSupport.js";import{clone as o}from"../../core/lang.js";import{property as r}from"../../core/accessorSupport/decorators/property.js";import"../../core/has.js";import"../../core/Logger.js";import{subclass as s}from"../../core/accessorSupport/decorators/subclass.js";import{writer as i}from"../../core/accessorSupport/decorators/writer.js";import p from"../../geometry/Multipoint.js";import l from"../../geometry/Point.js";import{getJsonType as n,fromJSON as m}from"../../geometry/support/jsonUtils.js";import{geometryTypes as a}from"../../geometry/support/typeUtils.js";import u from"../../layers/support/MosaicRule.js";import{interpolationKebab as y}from"../../layers/support/rasterEnums.js";import c from"../../time/TimeExtent.js";var d;let j=d=class extends e{constructor(){super(...arguments),this.geometry=null,this.interpolation="nearest",this.mosaicRule=null,this.outFields=null,this.pixelSize=null,this.returnFirstValueOnly=!0,this.sampleDistance=null,this.sampleCount=null,this.sliceId=null,this.timeExtent=null}writeGeometry(t,e,o){null!=t&&(e.geometryType=n(t),e[o]=t.toJSON())}set locations(t){if(t?.length){const e=new p({spatialReference:t[0].spatialReference,points:t.map((({x:t,y:e})=>[t,e]))});this._set("locations",t),this.geometry=e}}clone(){return new d(o({geometry:this.geometry,locations:this.locations,interpolation:this.interpolation,mosaicRule:this.mosaicRule,outFields:this.outFields,raster:this.raster,returnFirstValueOnly:this.returnFirstValueOnly,sampleDistance:this.sampleDistance,sampleCount:this.sampleCount,sliceId:this.sliceId,pixelSize:this.pixelSize,timeExtent:this.timeExtent}))}};t([r({types:a,json:{read:m}})],j.prototype,"geometry",void 0),t([i("geometry")],j.prototype,"writeGeometry",null),t([r({type:[l]})],j.prototype,"locations",null),t([r({type:String,json:{type:y.jsonValues,read:y.read,write:y.write}})],j.prototype,"interpolation",void 0),t([r({type:u,json:{write:!0}})],j.prototype,"mosaicRule",void 0),t([r({type:[String],json:{write:!0}})],j.prototype,"outFields",void 0),t([r({type:l,json:{write:!0}})],j.prototype,"pixelSize",void 0),t([r({type:String,json:{write:!0}})],j.prototype,"raster",void 0),t([r({type:Boolean,json:{write:!0}})],j.prototype,"returnFirstValueOnly",void 0),t([r({type:Number,json:{write:!0}})],j.prototype,"sampleDistance",void 0),t([r({type:Number,json:{write:!0}})],j.prototype,"sampleCount",void 0),t([r({type:Number,json:{write:!0}})],j.prototype,"sliceId",void 0),t([r({type:c,json:{read:{source:"time"},write:{target:"time"}}})],j.prototype,"timeExtent",void 0),j=d=t([s("esri.rest.support.ImageSampleParameters")],j);const h=j;export{h as default};
5
+ import{_ as t}from"../../chunks/tslib.es6.js";import e from"../../core/JSONSupport.js";import{clone as o}from"../../core/lang.js";import{property as r}from"../../core/accessorSupport/decorators/property.js";import"../../core/has.js";import"../../core/Logger.js";import{subclass as s}from"../../core/accessorSupport/decorators/subclass.js";import{writer as i}from"../../core/accessorSupport/decorators/writer.js";import p from"../../geometry/Multipoint.js";import l from"../../geometry/Point.js";import{getJsonType as n,fromJSON as m}from"../../geometry/support/jsonUtils.js";import{geometryTypes as a}from"../../geometry/support/typeUtils.js";import u from"../../layers/support/MosaicRule.js";import{interpolationKebab as y}from"../../layers/support/rasterEnums.js";import c from"../../time/TimeExtent.js";var d;let h=d=class extends e{constructor(){super(...arguments),this.geometry=null,this.interpolation="nearest",this.mosaicRule=null,this.outFields=null,this.pixelSize=null,this.raster=void 0,this.returnFirstValueOnly=!0,this.sampleDistance=null,this.sampleCount=null,this.sliceId=null,this.timeExtent=null}writeGeometry(t,e,o){null!=t&&(e.geometryType=n(t),e[o]=t.toJSON())}set locations(t){if(t?.length){const e=new p({spatialReference:t[0].spatialReference,points:t.map((({x:t,y:e})=>[t,e]))});this._set("locations",t),this.geometry=e}}clone(){return new d(o({geometry:this.geometry,locations:this.locations,interpolation:this.interpolation,mosaicRule:this.mosaicRule,outFields:this.outFields,raster:this.raster,returnFirstValueOnly:this.returnFirstValueOnly,sampleDistance:this.sampleDistance,sampleCount:this.sampleCount,sliceId:this.sliceId,pixelSize:this.pixelSize,timeExtent:this.timeExtent}))}};t([r({types:a,json:{read:m}})],h.prototype,"geometry",void 0),t([i("geometry")],h.prototype,"writeGeometry",null),t([r({type:[l]})],h.prototype,"locations",null),t([r({type:String,json:{type:y.jsonValues,read:y.read,write:y.write}})],h.prototype,"interpolation",void 0),t([r({type:u,json:{write:!0}})],h.prototype,"mosaicRule",void 0),t([r({type:[String],json:{write:!0}})],h.prototype,"outFields",void 0),t([r({type:l,json:{write:!0}})],h.prototype,"pixelSize",void 0),t([r({type:String,json:{write:!0}})],h.prototype,"raster",void 0),t([r({type:Boolean,json:{write:!0}})],h.prototype,"returnFirstValueOnly",void 0),t([r({type:Number,json:{write:!0}})],h.prototype,"sampleDistance",void 0),t([r({type:Number,json:{write:!0}})],h.prototype,"sampleCount",void 0),t([r({type:Number,json:{write:!0}})],h.prototype,"sliceId",void 0),t([r({type:c,json:{read:{source:"time"},write:{target:"time"}}})],h.prototype,"timeExtent",void 0),h=d=t([s("esri.rest.support.ImageSampleParameters")],h);const j=h;export{j as default};
@@ -2,4 +2,4 @@
2
2
  All material copyright ESRI, All Rights Reserved, unless otherwise specified.
3
3
  See https://js.arcgis.com/4.33/esri/copyright.txt for details.
4
4
  */
5
- import{_ as o}from"../../chunks/tslib.es6.js";import r from"../../core/JSONSupport.js";import{property as s}from"../../core/accessorSupport/decorators/property.js";import"../../core/has.js";import"../../core/Logger.js";import"../../core/RandomLCG.js";import{subclass as e}from"../../core/accessorSupport/decorators/subclass.js";import t from"./ImageSample.js";let p=class extends r{constructor(){super(...arguments),this.samples=null}};o([s({type:[t],json:{write:!0}})],p.prototype,"samples",void 0),p=o([e("esri.rest.support.ImageSampleResult")],p);const m=p;export{m as default};
5
+ import{_ as o}from"../../chunks/tslib.es6.js";import r from"../../core/JSONSupport.js";import{property as s}from"../../core/accessorSupport/decorators/property.js";import"../../core/has.js";import"../../core/Logger.js";import"../../core/RandomLCG.js";import{subclass as e}from"../../core/accessorSupport/decorators/subclass.js";import t from"./ImageSample.js";let p=class extends r{constructor(){super(...arguments),this.samples=[]}};o([s({type:[t],json:{write:!0}})],p.prototype,"samples",void 0),p=o([e("esri.rest.support.ImageSampleResult")],p);const m=p;export{m as default};
@@ -2,4 +2,4 @@
2
2
  All material copyright ESRI, All Rights Reserved, unless otherwise specified.
3
3
  See https://js.arcgis.com/4.33/esri/copyright.txt for details.
4
4
  */
5
- import{_ as o}from"../../chunks/tslib.es6.js";import r from"../../core/JSONSupport.js";import{property as s}from"../../core/accessorSupport/decorators/property.js";import"../../core/has.js";import"../../core/Logger.js";import"../../core/RandomLCG.js";import{subclass as e}from"../../core/accessorSupport/decorators/subclass.js";import t from"./ImageVolume.js";let p=class extends r{constructor(){super(...arguments),this.volumes=null}};o([s({type:[t],json:{write:!0}})],p.prototype,"volumes",void 0),p=o([e("esri.rest.support.ImageVolumeResult")],p);const m=p;export{m as default};
5
+ import{_ as o}from"../../chunks/tslib.es6.js";import r from"../../core/JSONSupport.js";import{property as s}from"../../core/accessorSupport/decorators/property.js";import"../../core/has.js";import"../../core/Logger.js";import"../../core/RandomLCG.js";import{subclass as e}from"../../core/accessorSupport/decorators/subclass.js";import t from"./ImageVolume.js";let p=class extends r{constructor(){super(...arguments),this.volumes=[]}};o([s({type:[t],json:{write:!0}})],p.prototype,"volumes",void 0),p=o([e("esri.rest.support.ImageVolumeResult")],p);const m=p;export{m as default};
@@ -2,4 +2,4 @@
2
2
  All material copyright ESRI, All Rights Reserved, unless otherwise specified.
3
3
  See https://js.arcgis.com/4.33/esri/copyright.txt for details.
4
4
  */
5
- import{_ as t}from"../chunks/tslib.es6.js";import e from"../core/Collection.js";import{referenceSetter as r}from"../core/collectionUtils.js";import s from"../core/Logger.js";import{property as o}from"../core/accessorSupport/decorators/property.js";import"../core/has.js";import"../core/RandomLCG.js";import{subclass as i}from"../core/accessorSupport/decorators/subclass.js";function a(t,e,r){if(t)for(let s=0,o=t.length;s<o;s++){const o=t.at(s);if(o[e]===r)return o;if("group"===o?.type){const t=a(o.tables,e,r);if(t)return t}}}const n=n=>{let l=class extends n{constructor(...t){super(...t),this.tables=new e,this.addHandles([this.tables.on("after-add",(t=>{const e=t.item;e.parent&&e.parent!==this&&"tables"in e.parent&&e.parent.tables.remove(e),e.parent=this,"feature"!==e.type&&s.getLogger(this).error(`Layer 'title:${e.title}, id:${e.id}' of type '${e.type}' is not supported as a table and will therefore be ignored.`)})),this.tables.on("after-remove",(t=>{t.item.parent=null}))])}destroy(){const t=this.tables.toArray();for(const e of t)e.destroy();this.tables.destroy()}set tables(t){this._set("tables",r(t,this._get("tables")))}findTableById(t){return a(this.tables,"id",t)}findTableByUid(t){return a(this.tables,"uid",t)}};return t([o()],l.prototype,"tables",null),l=t([i("esri.support.TablesMixin")],l),l};export{n as TablesMixin};
5
+ import{_ as t}from"../chunks/tslib.es6.js";import e from"../core/Collection.js";import{referenceSetter as r}from"../core/collectionUtils.js";import s from"../core/Logger.js";import{property as o}from"../core/accessorSupport/decorators/property.js";import"../core/has.js";import"../core/RandomLCG.js";import{subclass as i}from"../core/accessorSupport/decorators/subclass.js";const a=new Set(["feature","subtype-group"]);function n(t,e,r){if(t)for(let s=0,o=t.length;s<o;s++){const o=t.at(s);if(o[e]===r)return o;if("group"===o?.type){const t=n(o.tables,e,r);if(t)return t}}}const l=l=>{let p=class extends l{constructor(...t){super(...t),this.tables=new e,this.addHandles([this.tables.on("after-add",(t=>{const e=t.item;e.parent&&e.parent!==this&&"tables"in e.parent&&e.parent.tables.remove(e),e.parent=this,a.has(e.type)||s.getLogger(this).error(`Layer 'title:${e.title}, id:${e.id}' of type '${e.type}' is not supported as a table and will therefore be ignored.`)})),this.tables.on("after-remove",(t=>{t.item.parent=null}))])}destroy(){const t=this.tables.toArray();for(const e of t)e.destroy();this.tables.destroy()}set tables(t){this._set("tables",r(t,this._get("tables")))}findTableById(t){return n(this.tables,"id",t)}findTableByUid(t){return n(this.tables,"uid",t)}};return t([o()],p.prototype,"tables",null),p=t([i("esri.support.TablesMixin")],p),p};export{l as TablesMixin};
@@ -2,4 +2,4 @@
2
2
  All material copyright ESRI, All Rights Reserved, unless otherwise specified.
3
3
  See https://js.arcgis.com/4.33/esri/copyright.txt for details.
4
4
  */
5
- const a="20250206",c="68c1da12a90ca4c9a74ba30b1a514a7918d61494";export{a as buildDate,c as commitHash};
5
+ const a="20250207",f="db43f01f6eaa6452009809f92a25350baf160ddc";export{a as buildDate,f as commitHash};
@@ -2,4 +2,4 @@
2
2
  All material copyright ESRI, All Rights Reserved, unless otherwise specified.
3
3
  See https://js.arcgis.com/4.33/esri/copyright.txt for details.
4
4
  */
5
- import{isRGB as e}from"../../core/colorUtils.js";import{getFontFamily as r}from"../../core/fontUtils.js";import{clone as t}from"../../core/lang.js";import i from"../../core/Logger.js";import{pt2px as o,px2pt as a}from"../../core/screenUtils.js";import{numericHash as s}from"../../core/string.js";import{checkForAnimations as l,getAnimationParams as n,handleAbsoluteAnchor as p,handleMarker as c,handleRelativeAnchor as m,getFrameTranslation as y,translate as d,getStaticParam as h,shouldUseAnimatedPath as f}from"./animationUtils.js";import{CIMSymbolHelper as u}from"./CIMSymbolHelper.js";import{defaultCIMValues as v}from"./defaultCIMValues.js";import{Alignment as O,SymbolUnits as g}from"./enums.js";import{OverrideHelper as _}from"./OverrideHelper.js";import{getExtent as S,getSDFMetrics as M,getSDFDimensions as k}from"./SDFHelper.js";import{colorToArray as b,normalizeAlpha as C,getSize as P,isCIMMarkerStrokePlacement as z,getTintColor as x,getNumericValue as E,normalizePrimitiveOverrideProps as I,getDefaultCIMValue as L,getEnum as V,getStrokeWidth as N,getFillColor as R,getStrokeColor as A,fromCIMFontDecoration as w,fromCIMFontStyle as G,fromCIMHorizontalAlignment as F,fromCIMVerticalAlignment as T,isValidCIMValue as X,uncapitalize as Y}from"./utils.js";import{CIMEffectHelper as j}from"./effects/CIMEffectHelper.js";import{rasterizedVectorMarkerMinSize as W,randomInsidePolygonTextureSize as U}from"../../views/2d/engine/webgl/definitions.js";const D=()=>i.getLogger("esri.symbols.cim.cimAnalyzer");function H(e){const r=e.markerPlacement;return r&&r.angleToLine?O.MAP:O.SCREEN}class J{constructor(e){this._cimLayers=[],this._poMap={},this._primitiveOverrides=[],e&&(this._resourceManager=e)}analyzeSymbolReference(r,t,i){if(this._cimLayers=i??[],!r)return this._cimLayers;if(this._reset(),r.primitiveOverrides){this._primitiveOverrides=r.primitiveOverrides;for(const r of this._primitiveOverrides){const t=r.valueExpressionInfo;if(t)this._setPoMap(r.primitiveName,r.propertyName,t);else if(null!=r.value){let t=r.value;r.propertyName.includes("Color")&&(e(t)&&(t=b(t)),t=C(t)),this._setPoMap(r.primitiveName,r.propertyName,t)}}}return this._analyzeSymbol(r.symbol,t),this._cimLayers}_reset(){this._cimLayers=[],this._poMap={},this._primitiveOverrides=[]}_analyzeSymbol(e,r){switch(e?.type){case"CIMPointSymbol":case"CIMLineSymbol":case"CIMPolygonSymbol":this._analyzeMultiLayerSymbol(e,r)}}_analyzeMultiLayerSymbol(e,r){const t=e?.symbolLayers;if(!t)return;const i=e.effects;let o=O.SCREEN;const a=P(e)??0;"CIMPointSymbol"===e.type&&"Map"===e.angleAlignment&&(o=O.MAP);let s={transform:[0,0,0,1],fromColor:[1,1,1,1],toColor:[1,1,1,1],colorMix:[0,0,0,0],toOpacity:[1,1,1,1],opacityMix:[0,0,0,0],hasAnimations:l(e)};s=n(this._poMap,e,s);const p="CIMPolygonSymbol"===e.type;let c=t.length;for(;c--;){const l=t[c];if(!l||!1===l.enable)continue;let n;i?.length&&(n=[...i]);const m=l.effects;m?.length&&(i?n.push(...m):n=[...m]);let y=null;if(n){y=[];for(const e of n){const r=_.findEffectOverrides(e,this._primitiveOverrides);r&&y.push(r)}}const d=[];switch(_.findApplicableOverrides(l,this._primitiveOverrides,d),l.type){case"CIMSolidFill":this._analyzeSolidFill(l,y);break;case"CIMPictureFill":this._analyzePictureFill(l,y);break;case"CIMHatchFill":this._analyzeHatchFill(l,y);break;case"CIMGradientFill":this._analyzeGradientFill(l,y);break;case"CIMSolidStroke":this._analyzeSolidStroke(l,y,p,a);break;case"CIMPictureStroke":this._analyzePictureStroke(l,y,p,a);break;case"CIMGradientStroke":this._analyzeGradientStroke(l,y,p,a);break;case"CIMCharacterMarker":case"CIMPictureMarker":case"CIMVectorMarker":{"CIMLineSymbol"!==e.type&&"CIMPolygonSymbol"!==e.type||(o=H(l));const t=[],i=l.primitiveName;i&&t.push(i);const n=p&&z(l.markerPlacement);this._analyzeMarker(l,y,null,t,o,a,r,[],s,!1,n);break}default:D().error("Cannot analyze CIM layer",l.type)}}}_analyzeSolidFill(e,r){const{primitiveName:t,type:i}=e,o=C(e.color);this._cimLayers.push({type:"fill",spriteRasterizationParam:null,colorLocked:!!e.colorLocked,color:this._getValueOrOverrideExpression(i,t,"Color",o),height:0,angle:0,offsetX:0,offsetY:0,scaleX:1,effects:r,applyRandomOffset:!1,sampleAlphaOnly:!0,hasUnresolvedReplacementColor:!1})}_analyzePictureFill(e,r){const{primitiveName:t,type:i}=e,o=x(e),a=E(e.height,v.CIMPictureFill.height);let s=E(e.scaleX,1);if("width"in e&&"number"==typeof e.width){const r=e.width;let t=1;const i=this._resourceManager.getResource(e.url);null!=i&&(t=i.width/i.height),s/=t*(a/r)}const l={type:"sprite-rasterization-param",resource:e,overrides:this._getPrimitiveMaterialOverrides(t,i)};this._cimLayers.push({type:"fill",spriteRasterizationParam:l,colorLocked:!!e.colorLocked,effects:r,color:this._getValueOrOverrideExpression(i,t,"TintColor",o),height:this._getValueOrOverrideExpression(i,t,"Height",a),scaleX:this._getValueOrOverrideExpression(i,t,"ScaleX",s),angle:this._getValueOrOverrideExpression(i,t,"Rotation",E(e.rotation)),offsetX:this._getValueOrOverrideExpression(i,t,"OffsetX",E(e.offsetX)),offsetY:this._getValueOrOverrideExpression(i,t,"OffsetY",E(e.offsetY)),applyRandomOffset:!1,sampleAlphaOnly:!1,hasUnresolvedReplacementColor:!1})}_analyzeHatchFill(e,r){const{primitiveName:t,type:i}=e,o=this._analyzeMaterialOverrides(t,["Rotation","OffsetX","OffsetY"]),a=I(o);let s=[255,255,255,1],l=!1;if(e.lineSymbol?.symbolLayers)for(const p of e.lineSymbol.symbolLayers){if("CIMSolidStroke"!==p.type)continue;const e=p.primitiveName??t;l||!e||p.colorLocked||null==this._poMap[e]?.Color&&null==this._poMap[e]?.StrokeColor||(s=C(p.color),s=this._maybeGetValueOrOverrideExpression(e,"StrokeColor")??this._getValueOrOverrideExpression(i,e,"Color",s),l=!0);const r=this._maybeGetValueOrOverrideExpression(e,"StrokeWidth");if(r){let t=null,o=null;"number"==typeof r?t=r:o=r.valueExpressionInfo;let s=a.find((e=>"strokeWidth"===e.propertyName));s?s.propertyName="width":(s={type:"CIMPrimitiveOverride",primitiveName:e,propertyName:"width",valueExpressionInfo:o,value:t,defaultValue:L(i,"width")},a.push(s))}}const n={type:"sprite-rasterization-param",resource:e,overrides:a};this._cimLayers.push({type:"fill",spriteRasterizationParam:n,colorLocked:!!e.colorLocked,effects:r,color:s,height:this._getValueOrOverrideExpression(i,t,"Separation",E(e.separation,v.CIMHatchFill.separation)),scaleX:1,angle:this._getValueOrOverrideExpression(i,t,"Rotation",E(e.rotation)),offsetX:this._getValueOrOverrideExpression(i,t,"OffsetX",E(e.offsetX)),offsetY:this._getValueOrOverrideExpression(i,t,"OffsetY",E(e.offsetY)),applyRandomOffset:!1,sampleAlphaOnly:!0,hasUnresolvedReplacementColor:!l})}_analyzeGradientFill(e,r){const{angle:t,gradientMethod:i,gradientSize:o,gradientSizeUnits:a,gradientType:s,interval:l,primitiveName:n,type:p}=e,c=v.CIMGradientFill,m=e.colorRamp;this._cimLayers.push({type:"gradientFill",spriteRasterizationParam:{type:"sprite-rasterization-param",resource:e,overrides:this._getPrimitiveMaterialOverrides(n,p)},colorLocked:!1,effects:r,color:[255,255,255,1],gradientMethod:this._getValueOrOverrideExpression(p,n,"GradientMethod",i??"Linear"),angle:this._getValueOrOverrideExpression(p,n,"Angle",E(t,c.angle)),gradientType:this._getValueOrOverrideExpression(p,n,"GradientType",s??c.gradientType),interval:this._getValueOrOverrideExpression(p,n,"Interval",E(l,"CIMFixedColorRamp"===m.type?m.colors.length:c.interval)),gradientSize:this._getValueOrOverrideExpression(p,n,"GradientSize",E(o,c.gradientSize)),gradientSizeUnits:"Absolute"===a?g.Absolute:"Relative"===a?g.Relative:c.gradientSizeUnits})}_analyzeSolidStroke(e,r,t,i){const{primitiveName:o,type:a}=e,s=C(e.color),l=E(e.width,v.CIMSolidStroke.width),n=V(e.capStyle,v.CIMSolidStroke.capstyle),p=V(e.joinStyle,v.CIMSolidStroke.joinstyle),c=e.miterLimit;let m,y,d,h,f=[];if(this._analyzePrimitiveOverrides(o,r,null,null)&&(f=this._getPrimitiveMaterialOverrides(o,a)),r&&Array.isArray(r)&&r.length>0){const e=r[r.length-1].effect;e&&"CIMGeometricEffectDashes"===e.type&&"NoConstraint"===e.lineDashEnding&&(m=e.dashTemplate,y=e.scaleDash,d=e.offsetAlongLine,h=e.primitiveName,(r=[...r]).pop())}null!=h&&f.push(...this._getPrimitiveMaterialOverrides(h,a).filter((e=>"dashTemplate"===e.propertyName)));const u=void 0!==m?{type:"sprite-rasterization-param",resource:{type:"dash",dashTemplate:m,primitiveName:h},overrides:f}:null;this._cimLayers.push({type:"line",spriteRasterizationParam:u,isOutline:t,colorLocked:!!e.colorLocked,effects:r,color:this._getValueOrOverrideExpression(a,o,"Color",s),width:this._getValueOrOverrideExpression(a,o,"Width",l),cap:this._getValueOrOverrideExpression(a,o,"CapStyle",n),join:this._getValueOrOverrideExpression(a,o,"JoinStyle",p),miterLimit:c&&this._getValueOrOverrideExpression(a,o,"MiterLimit",c),referenceWidth:i,zOrder:q(e.name),dashTemplate:this._maybeGetValueOrOverrideExpression(h,"DashTemplate")??m,offsetAlongLine:this._getValueOrOverrideExpression(a,h,"OffsetAlongLine",d??0),scaleDash:y,sampleAlphaOnly:!0})}_analyzePictureStroke(e,r,t,i){const{primitiveName:o,type:a}=e,s=x(e),l=E(e.width,v.CIMPictureStroke.width),n=V(e.capStyle,v.CIMPictureStroke.capstyle),p=V(e.joinStyle,v.CIMPictureStroke.joinstyle),c=e.miterLimit,m={type:"sprite-rasterization-param",resource:e,overrides:this._getPrimitiveMaterialOverrides(o,a)};this._cimLayers.push({type:"line",spriteRasterizationParam:m,isOutline:t,colorLocked:!!e.colorLocked,effects:r,color:this._getValueOrOverrideExpression(a,o,"TintColor",s),width:this._getValueOrOverrideExpression(a,o,"Width",l),cap:this._getValueOrOverrideExpression(a,o,"CapStyle",n),join:this._getValueOrOverrideExpression(a,o,"JoinStyle",p),miterLimit:c&&this._getValueOrOverrideExpression(a,o,"MiterLimit",c),referenceWidth:i,zOrder:q(e.name),dashTemplate:null,scaleDash:!1,sampleAlphaOnly:!1})}_analyzeGradientStroke(e,r,t,i){const{gradientMethod:o,gradientSize:a,gradientSizeUnits:s,gradientType:l,interval:n,primitiveName:p,type:c}=e,m=v.CIMGradientStroke,y=E(e.width,m.width),d=V(e.capStyle,m.capstyle),h=V(e.joinStyle,m.joinstyle),f=e.miterLimit,u=e.colorRamp;this._cimLayers.push({type:"gradientStroke",spriteRasterizationParam:{type:"sprite-rasterization-param",resource:e,overrides:this._getPrimitiveMaterialOverrides(p,c)},colorLocked:!!e.colorLocked,effects:r,color:[255,255,255,1],width:this._getValueOrOverrideExpression(c,p,"Width",y),cap:this._getValueOrOverrideExpression(c,p,"CapStyle",d),join:this._getValueOrOverrideExpression(c,p,"JoinStyle",h),miterLimit:f&&this._getValueOrOverrideExpression(c,p,"MiterLimit",f),referenceWidth:i,isOutline:t,gradientMethod:this._getValueOrOverrideExpression(c,p,"GradientMethod",o??m.gradientMethod),gradientType:this._getValueOrOverrideExpression(c,p,"GradientType",l??m.gradientType),interval:this._getValueOrOverrideExpression(c,p,"Interval",E(n,"CIMFixedColorRamp"===u.type?u.colors.length:m.interval)),gradientSize:this._getValueOrOverrideExpression(c,p,"GradientSize",E(a,m.gradientSize)),gradientSizeUnits:"Absolute"===s?g.Absolute:"Relative"===s?g.Relative:m.gradientSizeUnits})}_analyzeMarker(e,r,t,i,o,a,s,l,y,d=!1,h=!1){if(d||=!!e.colorLocked,this._analyzeMarkerInsidePolygon(e,r,d))return;const f=E(e.size,v.CIMVectorMarker.size),u=E(e.rotation),O=E(e.offsetX),g=E(e.offsetY),{primitiveName:_,type:S}=e,M=this._getValueOrOverrideExpression(S,_,"Size",f),k=this._getValueOrOverrideExpression(S,_,"Rotation",u),b=this._getValueOrOverrideExpression(S,_,"OffsetX",O),C=this._getValueOrOverrideExpression(S,_,"OffsetY",g);let P=y;switch(P=p(e,P),P=c(this._poMap,e,P),P=m(e,P),P=n(this._poMap,e,P),e.type){case"CIMPictureMarker":this._analyzePictureMarker(e,r,t,i,o,a,M,k,b,C,l,P,d,h);break;case"CIMVectorMarker":this._analyzeVectorMarker(e,r,t,i,o,a,M,k,b,C,l,P,s,d,h)}}_analyzeMarkerInsidePolygon(e,r,t){const{markerPlacement:i,type:o}=e;if(!i||"CIMMarkerPlacementInsidePolygon"!==i.type)return!1;if("CIMVectorMarker"===o||"CIMPictureMarker"===o){const t=e.primitiveName;if(t&&this._analyzePrimitiveOverrides([t],r,null,null))return!1;const a=i.primitiveName;if(a&&this._analyzePrimitiveOverrides([a],r,null,null))return!1;if("CIMVectorMarker"===o){const{markerGraphics:r}=e;if(r)for(const e of r){const{symbol:r}=e;if("CIMPolygonSymbol"===r?.type&&r.symbolLayers){const{symbolLayers:e}=r;for(const r of e)if("CIMSolidStroke"===r.type)return!1}}}else{const{animatedSymbolProperties:r}=e;if(r)return!1}}const s=Math.abs(i.stepX),l=Math.abs(i.stepY);if(0===s||0===l)return!0;let n,p;if("Random"===i.gridType){const e=a(U),r=Math.max(Math.floor(e/s),1);n=l*Math.max(Math.floor(e/l),1);p=r*s/n}else i.shiftOddRows?(n=2*l,p=s/l*.5):(n=l,p=s/l);const c=x(e),m="CIMCharacterMarker"===e.type?null:{type:"sprite-rasterization-param",resource:e,overrides:[]};return this._cimLayers.push({type:"fill",spriteRasterizationParam:m,colorLocked:t,effects:r,color:c,height:n,scaleX:p,angle:i.gridAngle,offsetX:E(i.offsetX),offsetY:E(i.offsetY),applyRandomOffset:"Random"===i.gridType,sampleAlphaOnly:"CIMPictureMarker"!==e.type,hasUnresolvedReplacementColor:!0}),!0}_analyzePictureMarker(e,r,i,o,a,l,n,p,c,m,y,d,h,f){const{animatedSymbolProperties:u,primitiveName:v,type:O}=e;let g=E(e.scaleX,1);const _=x(e);i||(i=this._createMarkerPlacementOverrideExpression(e.markerPlacement));const S=this._createGIFAnimatedSymbolPropertiesOverrideExpression(u),M=e.anchorPoint??{x:0,y:0};if("width"in e&&"number"==typeof e.width){const r=e.width;let t=1;const i=this._resourceManager.getResource(e.url);null!=i&&(t=i.width/i.height);g/=t*(E(e.size)/r)}const k=[...o];let b;e.primitiveName&&k.push(e.primitiveName),u||S?b={type:"animated",url:e.url,urlHash:"H"+s(e.url),playAnimation:e.animatedSymbolProperties?.playAnimation,reverseAnimation:e.animatedSymbolProperties?.reverseAnimation,randomizeStartTime:e.animatedSymbolProperties?.randomizeStartTime,randomizeStartSeed:e.animatedSymbolProperties?.randomizeStartSeed,startTimeOffset:e.animatedSymbolProperties?.startTimeOffset,duration:e.animatedSymbolProperties?.duration,repeatType:e.animatedSymbolProperties?.repeatType,repeatDelay:e.animatedSymbolProperties?.repeatDelay}:(b=t(e),b.markerPlacement=null);const C={type:"sprite-rasterization-param",resource:b,overrides:this._getMaterialOverrides(k,O)};S&&C.overrides.push(...S.overrides);const P=n;this._cimLayers.push({type:"marker",spriteRasterizationParam:C,colorLocked:h,effects:r,scaleSymbolsProportionally:!1,alignment:a,size:n,scaleX:this._getValueOrOverrideExpression(O,v,"ScaleX",g),rotation:p,offsetX:c,offsetY:m,transform:{type:"cim-marker-transform-param",params:y},color:this._getValueOrOverrideExpression(O,v,"TintColor",_),anchorPoint:{x:M.x,y:M.y},isAbsoluteAnchorPoint:"Relative"!==e.anchorPointUnits,outlineColor:[0,0,0,0],outlineWidth:0,frameHeight:0,widthRatio:1,rotateClockwise:!!e.rotateClockwise,referenceSize:l,sizeRatio:1,isOutline:f,markerPlacement:i,animationParams:re(d),baseSize:P})}_analyzeVectorMarker(e,r,t,i,o,a,s,l,p,c,m,f,u,v,O){const g=e.markerGraphics;if(!g)return;const _=e.frame;let S=0;S=_?_.ymax-_.ymin:a;const M=!!e.scaleSymbolsProportionally;if(S){const r={offsetX:p,offsetY:c,rotation:l,size:s,frameHeight:S,rotateClockWise:!!e.rotateClockwise,absoluteAnchorPoint:!1,scaleSymbolsProportionally:M};m=[...m,r]}t||(t=this._createMarkerPlacementOverrideExpression(e.markerPlacement));for(const k of g)if(k){const s=k.symbol;if(!s)continue;const l=k.primitiveName;l&&i.push(l);let p,c=f;if(("CIMPointSymbol"===s.type||"CIMTextSymbol"===s.type)&&_){let r=0,t=0;const i=k.geometry;"x"in i&&"y"in i&&(r+=i.x-.5*(_.xmin+_.xmax),t+=i.y-.5*(_.ymin+_.ymax));const o=e.anchorPoint;let a=!1;o&&("Absolute"===e.anchorPointUnits?(r-=o.x,t-=o.y,a=!0):_&&(r-=(_.xmax-_.xmin)*o.x,t-=(_.ymax-_.ymin)*o.y));const s={offsetX:r,offsetY:t,rotation:0,size:0,frameHeight:0,rotateClockWise:!1,absoluteAnchorPoint:a,scaleSymbolsProportionally:M};p=[...m,s]}const g=k.geometry,[b,C]=y(g,_);switch(0===b&&0===C||(c=d(c,b,C)),"CIMPointSymbol"===s.type&&(c=n(this._poMap,s,c)),s.type){case"CIMPointSymbol":case"CIMLineSymbol":case"CIMPolygonSymbol":u||Z(s)?(c={...c,transform:{type:"AnimatedTransform",relativeTranslation:!1,absoluteScale:!0,translation:h([0,0]),rotation:h(0),scale:h(S),parent:f.transform}},this._analyzeMultiLayerGraphicNonSDF(e,r,t,k,i,o,a,p??m,c,S,v,O)):this._analyzeMultiLayerGraphic(e,r,t,k,i,o,a,p??m,c,S,v,O);break;case"CIMTextSymbol":this._analyzeTextGraphic(r,t,k,i,o,a,p??m,v)}l&&i.pop()}}_analyzeMultiLayerGraphic(e,r,t,i,o,a,s,l,n,p,c,m){const y=i.symbol.symbolLayers;y&&(!Q(y)||f(n)?$(y)?this._analyzeMultiLayerGraphicNonSDF(e,r,t,i,o,a,s,l,n,p,!!c,m):this._analyzeMarkerGraphicSymbolLayers(e,r,t,i,o,a,s,l,n,p,c,m):this._analyzeCompositeMarkerGraphic(e,r,t,i,y,a,s,l,p,c,m))}_analyzeMarkerGraphicSymbolLayers(e,r,t,i,o,a,s,l,p,c,m,y){const d=i.symbol,h=d.symbolLayers;if(!h)return;const f=this._resourceManager.geometryEngine,u=j.applyEffects(d.effects,i.geometry,f);if(!u)return;let O=h.length;for(;O--;){const d=h[O];if(!d||!1===d.enable)continue;const g=d.primitiveName;switch(g&&o.push(g),d.type){case"CIMSolidFill":case"CIMSolidStroke":{const o=j.applyEffects(d.effects,u,f),h=S(o);if(!h)continue;const O="Relative"!==e.anchorPointUnits,_=N(d)??0,{frameSizeRatio:b,anchorX:P,anchorY:z,widthRatio:x,sdfPaddingRatio:I}=M(h,e.frame,e.size,e.anchorPoint,O,_,e.scaleSymbolsProportionally),L="CIMSolidFill"===d.type,V={type:"sdf",geom:o,sdfPaddingRatio:I,asFill:L},{path:w}=d,G=L?C(R(d)):null==w?C(A(d)):[0,0,0,0],F=L?[0,0,0,0]:C(A(d));if(!L&&!_)break;const T=i.primitiveName;let X=null;L&&!d.colorLocked&&(X=this._maybeGetValueOrOverrideExpression(T,"FillColor"));let Y=null;L||d.colorLocked||(Y=this._maybeGetValueOrOverrideExpression(T,"StrokeColor"));const W=X??this._getValueOrOverrideExpression(d.type,g,"Color",G),U=Y??this._getValueOrOverrideExpression(d.type,g,"Color",F),D=this._maybeGetValueOrOverrideExpression(T,"StrokeWidth")??this._getValueOrOverrideExpression(d.type,g,"Width",_),H=w?{type:"sprite-rasterization-param",resource:{type:"path",path:w,asFill:L},overrides:[]}:{type:"sprite-rasterization-param",resource:V,overrides:[]},J=n(this._poMap,d,p),B=E(e.size,v.CIMVectorMarker.size),q=this._getValueOrOverrideExpression(e.type,e.primitiveName,"Size",B);this._cimLayers.push({type:"marker",spriteRasterizationParam:H,colorLocked:!!d.colorLocked||!!m,effects:r,scaleSymbolsProportionally:!!e.scaleSymbolsProportionally,alignment:a,anchorPoint:{x:P,y:z},isAbsoluteAnchorPoint:O,size:c,rotation:0,offsetX:0,offsetY:0,scaleX:1,transform:{type:"cim-marker-transform-param",params:l},frameHeight:c,widthRatio:x,rotateClockwise:!1,referenceSize:s,sizeRatio:b,color:W,outlineColor:U,outlineWidth:D,isOutline:y,markerPlacement:t,animationParams:re(J),isStroke:"CIMSolidFill"!==d.type,baseSize:q,...k(o,I)});break}case"CIMPictureMarker":case"CIMVectorMarker":if(d.markerPlacement){D().error("Error analyzing CIM, got unexpected marker placement");break}this._analyzeMarker(d,r,t,o,a,s,!1,l,p,m,y)}g&&o.pop()}}_analyzeTextGraphic(e,t,i,o,a,s,l,n){const p=[];_.findApplicableOverrides(i,this._primitiveOverrides,p);const c=i.geometry;if(!("x"in c)||!("y"in c))return;const m=i.symbol,y=w(m),d=G(m.fontStyleName),h=r(m.fontFamilyName);m.font={family:h,decoration:y,...d};const f=E(m.height,v.CIMTextSymbol.height),u=E(m.angle),O=E(m.offsetX),g=E(m.offsetY),{haloSymbol:S}=m,M=E(m.haloSize,0);let k=[0,0,0,0];if(S?.symbolLayers?.length){const e=S.symbolLayers;for(const r of e)if(r.color){k=this._getValueOrOverrideExpression(m?.haloSymbol?.type??"CIMPolygonSymbol",r.primitiveName,"Color",C(r.color));break}}const b=i.primitiveName;let P=[0,0,0,1],z=[0,0,0,0],x=0,I=!1;if(m.symbol?.symbolLayers)for(const r of m.symbol.symbolLayers){const e=r.primitiveName;if("CIMSolidStroke"===r.type)z=this._getValueOrOverrideExpression("CIMSolidStroke",e,"Color",C(r.color)),x=this._getValueOrOverrideExpression("CIMSolidStroke",e,"Width",N(r)??0);else if("CIMSolidFill"===r.type){const t=C(r.color);I=I??!!r.colorLocked,P=this._getValueOrOverrideExpression("CIMSolidFill",e??b,"Color",t)}}let L=null,V=null,R=null,A=null,X=null;b&&(L=this._maybeGetValueOrOverrideExpression(b,"TextSize"),V=this._maybeGetValueOrOverrideExpression(b,"TextAngle"),R=this._maybeGetValueOrOverrideExpression(b,"TextOffsetX"),A=this._maybeGetValueOrOverrideExpression(b,"TextOffsetY"),I||(X=this._maybeGetValueOrOverrideExpression(b,"FillColor")));const Y=X??P;let j=null,W=null,U=0;if(m.callout&&"CIMBackgroundCallout"===m.callout.type){const e=m.callout;if(e.backgroundSymbol){const r=e.backgroundSymbol.symbolLayers;if(r)for(const e of r)"CIMSolidFill"===e.type?j=C(e.color):"CIMSolidStroke"===e.type&&(W=C(e.color),U=E(e.width,v.CIMSolidStroke.width))}}const D=this._getValueOrOverrideExpression(m.type,i.primitiveName,"TextString",i.textString??"");if(null==D)return;const{fontStyleName:H}=m,J=h+(H?"-"+H.toLowerCase():"-regular"),B=this._getMaterialOverrides(o,m.type);B.push(...this._getPrimitiveMaterialOverrides(i.primitiveName,m.type));const q={type:"text-rasterization-param",resource:{type:"text",textString:i.textString??"",font:m.font,symbol:m,primitiveName:i.primitiveName},overrides:B};this._cimLayers.push({type:"text",lineWidth:m.lineWidth,textRasterizationParam:q,colorLocked:!!n||!!I,effects:e,alignment:a,anchorPoint:{x:0,y:0},isAbsoluteAnchorPoint:!1,fontName:J,decoration:y,haloSize:M,haloColor:k,weight:d.weight,style:d.style,size:L??f,angle:V??u,offsetX:R??O,offsetY:A??g,transform:{type:"cim-marker-transform-param",params:l},horizontalAlignment:F(m.horizontalAlignment),verticalAlignment:T(m.verticalAlignment),text:D,color:Y,outlineColor:z,outlineSize:x,backgroundColor:j,borderLineColor:W,borderLineWidth:U,referenceSize:s,sizeRatio:1,markerPlacement:t})}_analyzeMultiLayerGraphicNonSDF(e,r,t,i,a,s,l,n,p,c,m,y){const d=B(e,i),h=e.primitiveName,f=this._analyzeMaterialOverrides(h,["Rotation","OffsetX","OffsetY"]),O=I(f),[g,_,S]=u.getTextureAnchor(d,this._resourceManager,W),M=this._getMaterialOverrides(a,e.type);M.push(...O);const k={type:"sprite-rasterization-param",resource:{...d,avoidSDFRasterization:!0},overrides:M},b=E(e.size,v.CIMVectorMarker.size),C=this._getValueOrOverrideExpression(e.type,h,"Size",b);this._cimLayers.push({type:"marker",spriteRasterizationParam:k,colorLocked:m,effects:r,scaleSymbolsProportionally:!!e.scaleSymbolsProportionally,alignment:s,anchorPoint:{x:g,y:_},isAbsoluteAnchorPoint:!1,size:c,rotation:0,offsetX:0,offsetY:0,transform:{type:"cim-marker-transform-param",params:n},color:[255,255,255,1],outlineColor:[0,0,0,0],outlineWidth:0,scaleX:1,frameHeight:c,widthRatio:1,rotateClockwise:!!e.rotateClockwise,referenceSize:l,sizeRatio:S/o(e.size),isOutline:y,markerPlacement:t,animationParams:re(p),baseSize:C})}_createMarkerPlacementOverrideExpression(e){if(!e)return null;const r=[];return _.findApplicableOverrides(e,this._primitiveOverrides,r),{type:"cim-marker-placement-param",placement:e,overrides:ee(r)}}_createGIFAnimatedSymbolPropertiesOverrideExpression(e){if(!e)return null;const r=[];return _.findApplicableOverrides(e,this._primitiveOverrides,r),{type:"cim-gif-animation-params",animation:e,overrides:ee(r)}}_analyzeCompositeMarkerGraphic(e,r,t,i,o,a,s,l,n,p,c){const m=i.geometry,y=o[0],d=o[1],h=S(m);if(!h)return;const f="Relative"!==e.anchorPointUnits,u=E(y.width,v.CIMSolidStroke.width),{frameSizeRatio:O,anchorX:g,anchorY:_,widthRatio:k,sdfPaddingRatio:b}=M(h,e.frame,e.size,e.anchorPoint,f,u,e.scaleSymbolsProportionally),{path:P}=d,z=d.primitiveName,x=y.primitiveName,I=i.primitiveName;let L=null;d.colorLocked||p||(L=this._maybeGetValueOrOverrideExpression(I,"FillColor"));const V=L??this._getValueOrOverrideExpression(d.type,z,"Color",C(d.color));let N=null;y.colorLocked||p||(N=this._maybeGetValueOrOverrideExpression(I,"StrokeColor"));const R=N??this._getValueOrOverrideExpression(y.type,x,"Color",C(y.color)),A=this._maybeGetValueOrOverrideExpression(I,"StrokeWidth")??this._getValueOrOverrideExpression(y.type,x,"Width",u),w={type:"sprite-rasterization-param",resource:P?{type:"path",path:P,asFill:!0}:{type:"sdf",geom:m,sdfPaddingRatio:b,asFill:!0},overrides:[]};this._cimLayers.push({type:"marker",spriteRasterizationParam:w,colorLocked:p,effects:r,scaleSymbolsProportionally:!!e.scaleSymbolsProportionally,alignment:a,anchorPoint:{x:g,y:_},isAbsoluteAnchorPoint:f,size:n,rotation:0,offsetX:0,offsetY:0,scaleX:1,transform:{type:"cim-marker-transform-param",params:l},frameHeight:n,widthRatio:k,rotateClockwise:!1,referenceSize:s,sizeRatio:O,color:V,outlineColor:R,outlineWidth:A,isOutline:c,markerPlacement:t})}_setPoMap(e,r,t){let i;this._poMap[e]?i=this._poMap[e]:(i={},this._poMap[e]=i),i[r]=t}_maybeGetValueOrOverrideExpression(e,r,t){return this._getValueOrOverrideExpression("",e,r,t,!1)}_getValueOrOverrideExpression(e,r,t,i,o=!0){if(o&&!X(i)&&(i=L(e,t.toLowerCase())),null==r)return i;const a=this._poMap[r];if(null==a)return i;const s=a[t];return"string"==typeof s||"number"==typeof s||Array.isArray(s)?s:s?{valueExpressionInfo:s,defaultValue:i}:i}_analyzePrimitiveOverrides(e,r,t,i){if(null==e)return!1;"string"==typeof e&&(e=[e]);for(const o of this._primitiveOverrides)if(e.includes(o.primitiveName)&&o.valueExpressionInfo)return!0;if(null!=r)for(const o of r)if(o?.overrides.length>0)return!0;if(null!=t)for(const o of t)if(o?.overrides.length>0)return!0;if(null!=i)for(const o of i)if(o?.overrides.length>0)return!0;return!1}_getMaterialOverrides(e,r){if(!e)return[];const t=[];for(const i of e)t.push(...this._getPrimitiveMaterialOverrides(i,r));return t}_getPrimitiveMaterialOverrides(e,r){if(!e)return[];const t=I(this._primitiveOverrides.filter((r=>r.primitiveName===e)));return t.forEach((e=>e.defaultValue=L(r,e.propertyName.toLowerCase()))),t}_analyzeMaterialOverrides(e,r){return this._primitiveOverrides.filter((t=>t.primitiveName!==e||!r.includes(t.propertyName)))}}function B(e,r){return{type:e.type,enable:!0,name:e.name,colorLocked:e.colorLocked,primitiveName:e.primitiveName,anchorPoint:e.anchorPoint,anchorPointUnits:e.anchorPointUnits,offsetX:0,offsetY:0,rotateClockwise:e.rotateClockwise,rotation:0,size:e.size,billboardMode3D:e.billboardMode3D,depth3D:e.depth3D,frame:e.frame,markerGraphics:[r],scaleSymbolsProportionally:e.scaleSymbolsProportionally,respectFrame:e.respectFrame,clippingPath:e.clippingPath}}function q(e){if(e&&0===e.indexOf("Level_")){const r=parseInt(e.slice(6),10);if(!isNaN(r))return r}return 0}function K(e,r){if(!r||0===r.length)return e;const i=t(e);return _.applyOverrides(i,r),i}const Q=e=>e&&2===e.length&&e[0].enable&&e[1].enable&&"CIMSolidStroke"===e[0].type&&"CIMSolidFill"===e[1].type&&null==e[0].path&&null==e[1].path&&!e[0].effects&&!e[1].effects&&!e[0].animations&&!e[1].animations;function Z(e){const r=e.symbolLayers;if(!r)return!1;const t=r.find((e=>e.effects?.find((e=>"CIMGeometricEffectDashes"===e.type&&null!=e.dashTemplate)))),i=r.find((e=>e.effects?.find((e=>"CIMGeometricEffectAddControlPoints"===e.type))));return!!t||!!i}function $(e){return e.some((e=>"CIMSolidFill"!==e.type&&"CIMSolidStroke"!==e.type&&("CIMVectorMarker"!==e.type&&"CIMPictureMarker"!==e.type||null!=e.markerPlacement)))}function ee(e){return t(e).map((e=>({...e,propertyName:Y(e.propertyName)})))}function re(e){return f(e)?{type:"animation-params",params:e}:null}export{J as CIMAnalyzer,K as analyzeCIMResource};
5
+ import{isRGB as e}from"../../core/colorUtils.js";import{getFontFamily as r}from"../../core/fontUtils.js";import{clone as t}from"../../core/lang.js";import i from"../../core/Logger.js";import{pt2px as o,px2pt as a}from"../../core/screenUtils.js";import{numericHash as s}from"../../core/string.js";import{checkForAnimations as l,getAnimationParams as n,handleAbsoluteAnchor as p,handleMarker as c,handleRelativeAnchor as m,getFrameTranslation as y,translate as d,getStaticParam as h,shouldUseAnimatedPath as f}from"./animationUtils.js";import{CIMSymbolHelper as u}from"./CIMSymbolHelper.js";import{defaultCIMValues as v}from"./defaultCIMValues.js";import{Alignment as O,SymbolUnits as g}from"./enums.js";import{fitVectorMarker as _}from"./fitVectorMarker.js";import{OverrideHelper as M}from"./OverrideHelper.js";import{getExtent as S,getSDFMetrics as k,getSDFDimensions as b}from"./SDFHelper.js";import{colorToArray as C,normalizeAlpha as P,getSize as z,isCIMMarkerStrokePlacement as x,getTintColor as E,getNumericValue as I,normalizePrimitiveOverrideProps as L,getDefaultCIMValue as V,getEnum as N,getStrokeWidth as R,getFillColor as A,getStrokeColor as w,fromCIMFontDecoration as G,fromCIMFontStyle as F,fromCIMHorizontalAlignment as T,fromCIMVerticalAlignment as X,isValidCIMValue as Y,uncapitalize as j}from"./utils.js";import{CIMEffectHelper as W}from"./effects/CIMEffectHelper.js";import{rasterizedVectorMarkerMinSize as U,randomInsidePolygonTextureSize as D}from"../../views/2d/engine/webgl/definitions.js";const H=()=>i.getLogger("esri.symbols.cim.cimAnalyzer");function J(e){const r=e.markerPlacement;return r&&r.angleToLine?O.MAP:O.SCREEN}class B{constructor(e){this._cimLayers=[],this._poMap={},this._primitiveOverrides=[],e&&(this._resourceManager=e)}analyzeSymbolReference(r,t,i){if(this._cimLayers=i??[],!r)return this._cimLayers;if(this._reset(),r.primitiveOverrides){this._primitiveOverrides=r.primitiveOverrides;for(const r of this._primitiveOverrides){const t=r.valueExpressionInfo;if(t)this._setPoMap(r.primitiveName,r.propertyName,t);else if(null!=r.value){let t=r.value;r.propertyName.includes("Color")&&(e(t)&&(t=C(t)),t=P(t)),this._setPoMap(r.primitiveName,r.propertyName,t)}}}return this._analyzeSymbol(r.symbol,t),this._cimLayers}_reset(){this._cimLayers=[],this._poMap={},this._primitiveOverrides=[]}_analyzeSymbol(e,r){switch(e?.type){case"CIMPointSymbol":case"CIMLineSymbol":case"CIMPolygonSymbol":this._analyzeMultiLayerSymbol(e,r)}}_analyzeMultiLayerSymbol(e,r){const t=e?.symbolLayers;if(!t)return;for(let l=0;l<t.length;l++){const e=t[l];"CIMVectorMarker"===e.type&&(t[l]=_(e,this._resourceManager.geometryEngine))}const i=e.effects;let o=O.SCREEN;const a=z(e)??0;"CIMPointSymbol"===e.type&&"Map"===e.angleAlignment&&(o=O.MAP);let s={transform:[0,0,0,1],fromColor:[1,1,1,1],toColor:[1,1,1,1],colorMix:[0,0,0,0],toOpacity:[1,1,1,1],opacityMix:[0,0,0,0],hasAnimations:l(e)};s=n(this._poMap,e,s);const p="CIMPolygonSymbol"===e.type;let c=t.length;for(;c--;){const l=t[c];if(!l||!1===l.enable)continue;let n;i?.length&&(n=[...i]);const m=l.effects;m?.length&&(i?n.push(...m):n=[...m]);let y=null;if(n){y=[];for(const e of n){const r=M.findEffectOverrides(e,this._primitiveOverrides);r&&y.push(r)}}const d=[];switch(M.findApplicableOverrides(l,this._primitiveOverrides,d),l.type){case"CIMSolidFill":this._analyzeSolidFill(l,y);break;case"CIMPictureFill":this._analyzePictureFill(l,y);break;case"CIMHatchFill":this._analyzeHatchFill(l,y);break;case"CIMGradientFill":this._analyzeGradientFill(l,y);break;case"CIMSolidStroke":this._analyzeSolidStroke(l,y,p,a);break;case"CIMPictureStroke":this._analyzePictureStroke(l,y,p,a);break;case"CIMGradientStroke":this._analyzeGradientStroke(l,y,p,a);break;case"CIMCharacterMarker":case"CIMPictureMarker":case"CIMVectorMarker":{"CIMLineSymbol"!==e.type&&"CIMPolygonSymbol"!==e.type||(o=J(l));const t=[],i=l.primitiveName;i&&t.push(i);const n=p&&x(l.markerPlacement);this._analyzeMarker(l,y,null,t,o,a,r,[],s,!1,n);break}default:H().error("Cannot analyze CIM layer",l.type)}}}_analyzeSolidFill(e,r){const{primitiveName:t,type:i}=e,o=P(e.color);this._cimLayers.push({type:"fill",spriteRasterizationParam:null,colorLocked:!!e.colorLocked,color:this._getValueOrOverrideExpression(i,t,"Color",o),height:0,angle:0,offsetX:0,offsetY:0,scaleX:1,effects:r,applyRandomOffset:!1,sampleAlphaOnly:!0,hasUnresolvedReplacementColor:!1})}_analyzePictureFill(e,r){const{primitiveName:t,type:i}=e,o=E(e),a=I(e.height,v.CIMPictureFill.height);let s=I(e.scaleX,1);if("width"in e&&"number"==typeof e.width){const r=e.width;let t=1;const i=this._resourceManager.getResource(e.url);null!=i&&(t=i.width/i.height),s/=t*(a/r)}const l={type:"sprite-rasterization-param",resource:e,overrides:this._getPrimitiveMaterialOverrides(t,i)};this._cimLayers.push({type:"fill",spriteRasterizationParam:l,colorLocked:!!e.colorLocked,effects:r,color:this._getValueOrOverrideExpression(i,t,"TintColor",o),height:this._getValueOrOverrideExpression(i,t,"Height",a),scaleX:this._getValueOrOverrideExpression(i,t,"ScaleX",s),angle:this._getValueOrOverrideExpression(i,t,"Rotation",I(e.rotation)),offsetX:this._getValueOrOverrideExpression(i,t,"OffsetX",I(e.offsetX)),offsetY:this._getValueOrOverrideExpression(i,t,"OffsetY",I(e.offsetY)),applyRandomOffset:!1,sampleAlphaOnly:!1,hasUnresolvedReplacementColor:!1})}_analyzeHatchFill(e,r){const{primitiveName:t,type:i}=e,o=this._analyzeMaterialOverrides(t,["Rotation","OffsetX","OffsetY"]),a=L(o);let s=[255,255,255,1],l=!1;if(e.lineSymbol?.symbolLayers)for(const p of e.lineSymbol.symbolLayers){if("CIMSolidStroke"!==p.type)continue;const e=p.primitiveName??t;l||!e||p.colorLocked||null==this._poMap[e]?.Color&&null==this._poMap[e]?.StrokeColor||(s=P(p.color),s=this._maybeGetValueOrOverrideExpression(e,"StrokeColor")??this._getValueOrOverrideExpression(i,e,"Color",s),l=!0);const r=this._maybeGetValueOrOverrideExpression(e,"StrokeWidth");if(r){let t=null,o=null;"number"==typeof r?t=r:o=r.valueExpressionInfo;let s=a.find((e=>"strokeWidth"===e.propertyName));s?s.propertyName="width":(s={type:"CIMPrimitiveOverride",primitiveName:e,propertyName:"width",valueExpressionInfo:o,value:t,defaultValue:V(i,"width")},a.push(s))}}const n={type:"sprite-rasterization-param",resource:e,overrides:a};this._cimLayers.push({type:"fill",spriteRasterizationParam:n,colorLocked:!!e.colorLocked,effects:r,color:s,height:this._getValueOrOverrideExpression(i,t,"Separation",I(e.separation,v.CIMHatchFill.separation)),scaleX:1,angle:this._getValueOrOverrideExpression(i,t,"Rotation",I(e.rotation)),offsetX:this._getValueOrOverrideExpression(i,t,"OffsetX",I(e.offsetX)),offsetY:this._getValueOrOverrideExpression(i,t,"OffsetY",I(e.offsetY)),applyRandomOffset:!1,sampleAlphaOnly:!0,hasUnresolvedReplacementColor:!l})}_analyzeGradientFill(e,r){const{angle:t,gradientMethod:i,gradientSize:o,gradientSizeUnits:a,gradientType:s,interval:l,primitiveName:n,type:p}=e,c=v.CIMGradientFill,m=e.colorRamp;this._cimLayers.push({type:"gradientFill",spriteRasterizationParam:{type:"sprite-rasterization-param",resource:e,overrides:this._getPrimitiveMaterialOverrides(n,p)},colorLocked:!1,effects:r,color:[255,255,255,1],gradientMethod:this._getValueOrOverrideExpression(p,n,"GradientMethod",i??"Linear"),angle:this._getValueOrOverrideExpression(p,n,"Angle",I(t,c.angle)),gradientType:this._getValueOrOverrideExpression(p,n,"GradientType",s??c.gradientType),interval:this._getValueOrOverrideExpression(p,n,"Interval",I(l,"CIMFixedColorRamp"===m.type?m.colors.length:c.interval)),gradientSize:this._getValueOrOverrideExpression(p,n,"GradientSize",I(o,c.gradientSize)),gradientSizeUnits:"Absolute"===a?g.Absolute:"Relative"===a?g.Relative:c.gradientSizeUnits})}_analyzeSolidStroke(e,r,t,i){const{primitiveName:o,type:a}=e,s=P(e.color),l=I(e.width,v.CIMSolidStroke.width),n=N(e.capStyle,v.CIMSolidStroke.capstyle),p=N(e.joinStyle,v.CIMSolidStroke.joinstyle),c=e.miterLimit;let m,y,d,h,f=[];if(this._analyzePrimitiveOverrides(o,r,null,null)&&(f=this._getPrimitiveMaterialOverrides(o,a)),r&&Array.isArray(r)&&r.length>0){const e=r[r.length-1].effect;e&&"CIMGeometricEffectDashes"===e.type&&"NoConstraint"===e.lineDashEnding&&(m=e.dashTemplate,y=e.scaleDash,d=e.offsetAlongLine,h=e.primitiveName,(r=[...r]).pop())}null!=h&&f.push(...this._getPrimitiveMaterialOverrides(h,a).filter((e=>"dashTemplate"===e.propertyName)));const u=void 0!==m?{type:"sprite-rasterization-param",resource:{type:"dash",dashTemplate:m,primitiveName:h},overrides:f}:null;this._cimLayers.push({type:"line",spriteRasterizationParam:u,isOutline:t,colorLocked:!!e.colorLocked,effects:r,color:this._getValueOrOverrideExpression(a,o,"Color",s),width:this._getValueOrOverrideExpression(a,o,"Width",l),cap:this._getValueOrOverrideExpression(a,o,"CapStyle",n),join:this._getValueOrOverrideExpression(a,o,"JoinStyle",p),miterLimit:c&&this._getValueOrOverrideExpression(a,o,"MiterLimit",c),referenceWidth:i,zOrder:K(e.name),dashTemplate:this._maybeGetValueOrOverrideExpression(h,"DashTemplate")??m,offsetAlongLine:this._getValueOrOverrideExpression(a,h,"OffsetAlongLine",d??0),scaleDash:y,sampleAlphaOnly:!0})}_analyzePictureStroke(e,r,t,i){const{primitiveName:o,type:a}=e,s=E(e),l=I(e.width,v.CIMPictureStroke.width),n=N(e.capStyle,v.CIMPictureStroke.capstyle),p=N(e.joinStyle,v.CIMPictureStroke.joinstyle),c=e.miterLimit,m={type:"sprite-rasterization-param",resource:e,overrides:this._getPrimitiveMaterialOverrides(o,a)};this._cimLayers.push({type:"line",spriteRasterizationParam:m,isOutline:t,colorLocked:!!e.colorLocked,effects:r,color:this._getValueOrOverrideExpression(a,o,"TintColor",s),width:this._getValueOrOverrideExpression(a,o,"Width",l),cap:this._getValueOrOverrideExpression(a,o,"CapStyle",n),join:this._getValueOrOverrideExpression(a,o,"JoinStyle",p),miterLimit:c&&this._getValueOrOverrideExpression(a,o,"MiterLimit",c),referenceWidth:i,zOrder:K(e.name),dashTemplate:null,scaleDash:!1,sampleAlphaOnly:!1})}_analyzeGradientStroke(e,r,t,i){const{gradientMethod:o,gradientSize:a,gradientSizeUnits:s,gradientType:l,interval:n,primitiveName:p,type:c}=e,m=v.CIMGradientStroke,y=I(e.width,m.width),d=N(e.capStyle,m.capstyle),h=N(e.joinStyle,m.joinstyle),f=e.miterLimit,u=e.colorRamp;this._cimLayers.push({type:"gradientStroke",spriteRasterizationParam:{type:"sprite-rasterization-param",resource:e,overrides:this._getPrimitiveMaterialOverrides(p,c)},colorLocked:!!e.colorLocked,effects:r,color:[255,255,255,1],width:this._getValueOrOverrideExpression(c,p,"Width",y),cap:this._getValueOrOverrideExpression(c,p,"CapStyle",d),join:this._getValueOrOverrideExpression(c,p,"JoinStyle",h),miterLimit:f&&this._getValueOrOverrideExpression(c,p,"MiterLimit",f),referenceWidth:i,isOutline:t,gradientMethod:this._getValueOrOverrideExpression(c,p,"GradientMethod",o??m.gradientMethod),gradientType:this._getValueOrOverrideExpression(c,p,"GradientType",l??m.gradientType),interval:this._getValueOrOverrideExpression(c,p,"Interval",I(n,"CIMFixedColorRamp"===u.type?u.colors.length:m.interval)),gradientSize:this._getValueOrOverrideExpression(c,p,"GradientSize",I(a,m.gradientSize)),gradientSizeUnits:"Absolute"===s?g.Absolute:"Relative"===s?g.Relative:m.gradientSizeUnits})}_analyzeMarker(e,r,t,i,o,a,s,l,y,d=!1,h=!1){if(d||=!!e.colorLocked,this._analyzeMarkerInsidePolygon(e,r,d))return;const f=I(e.size,v.CIMVectorMarker.size),u=I(e.rotation),O=I(e.offsetX),g=I(e.offsetY),{primitiveName:_,type:M}=e,S=this._getValueOrOverrideExpression(M,_,"Size",f),k=this._getValueOrOverrideExpression(M,_,"Rotation",u),b=this._getValueOrOverrideExpression(M,_,"OffsetX",O),C=this._getValueOrOverrideExpression(M,_,"OffsetY",g);let P=y;switch(P=p(e,P),P=c(this._poMap,e,P),P=m(e,P),P=n(this._poMap,e,P),e.type){case"CIMPictureMarker":this._analyzePictureMarker(e,r,t,i,o,a,S,k,b,C,l,P,d,h);break;case"CIMVectorMarker":this._analyzeVectorMarker(e,r,t,i,o,a,S,k,b,C,l,P,s,d,h)}}_analyzeMarkerInsidePolygon(e,r,t){const{markerPlacement:i,type:o}=e;if(!i||"CIMMarkerPlacementInsidePolygon"!==i.type)return!1;if("CIMVectorMarker"===o||"CIMPictureMarker"===o){const t=e.primitiveName;if(t&&this._analyzePrimitiveOverrides([t],r,null,null))return!1;const a=i.primitiveName;if(a&&this._analyzePrimitiveOverrides([a],r,null,null))return!1;if("CIMVectorMarker"===o){const{markerGraphics:r}=e;if(r)for(const e of r){const{symbol:r}=e;if("CIMPolygonSymbol"===r?.type&&r.symbolLayers){const{symbolLayers:e}=r;for(const r of e)if("CIMSolidStroke"===r.type)return!1}}}else{const{animatedSymbolProperties:r}=e;if(r)return!1}}const s=Math.abs(i.stepX),l=Math.abs(i.stepY);if(0===s||0===l)return!0;let n,p;if("Random"===i.gridType){const e=a(D),r=Math.max(Math.floor(e/s),1);n=l*Math.max(Math.floor(e/l),1);p=r*s/n}else i.shiftOddRows?(n=2*l,p=s/l*.5):(n=l,p=s/l);const c=E(e),m="CIMCharacterMarker"===e.type?null:{type:"sprite-rasterization-param",resource:e,overrides:[]};return this._cimLayers.push({type:"fill",spriteRasterizationParam:m,colorLocked:t,effects:r,color:c,height:n,scaleX:p,angle:i.gridAngle,offsetX:I(i.offsetX),offsetY:I(i.offsetY),applyRandomOffset:"Random"===i.gridType,sampleAlphaOnly:"CIMPictureMarker"!==e.type,hasUnresolvedReplacementColor:!0}),!0}_analyzePictureMarker(e,r,i,o,a,l,n,p,c,m,y,d,h,f){const{animatedSymbolProperties:u,primitiveName:v,type:O}=e;let g=I(e.scaleX,1);const _=E(e);i||(i=this._createMarkerPlacementOverrideExpression(e.markerPlacement));const M=this._createGIFAnimatedSymbolPropertiesOverrideExpression(u),S=e.anchorPoint??{x:0,y:0};if("width"in e&&"number"==typeof e.width){const r=e.width;let t=1;const i=this._resourceManager.getResource(e.url);null!=i&&(t=i.width/i.height);g/=t*(I(e.size)/r)}const k=[...o];let b;e.primitiveName&&k.push(e.primitiveName),u||M?b={type:"animated",url:e.url,urlHash:"H"+s(e.url),playAnimation:e.animatedSymbolProperties?.playAnimation,reverseAnimation:e.animatedSymbolProperties?.reverseAnimation,randomizeStartTime:e.animatedSymbolProperties?.randomizeStartTime,randomizeStartSeed:e.animatedSymbolProperties?.randomizeStartSeed,startTimeOffset:e.animatedSymbolProperties?.startTimeOffset,duration:e.animatedSymbolProperties?.duration,repeatType:e.animatedSymbolProperties?.repeatType,repeatDelay:e.animatedSymbolProperties?.repeatDelay}:(b=t(e),b.markerPlacement=null);const C={type:"sprite-rasterization-param",resource:b,overrides:this._getMaterialOverrides(k,O)};M&&C.overrides.push(...M.overrides);const P=n;this._cimLayers.push({type:"marker",spriteRasterizationParam:C,colorLocked:h,effects:r,scaleSymbolsProportionally:!1,alignment:a,size:n,scaleX:this._getValueOrOverrideExpression(O,v,"ScaleX",g),rotation:p,offsetX:c,offsetY:m,transform:{type:"cim-marker-transform-param",params:y},color:this._getValueOrOverrideExpression(O,v,"TintColor",_),anchorPoint:{x:S.x,y:S.y},isAbsoluteAnchorPoint:"Relative"!==e.anchorPointUnits,outlineColor:[0,0,0,0],outlineWidth:0,frameHeight:0,widthRatio:1,rotateClockwise:!!e.rotateClockwise,referenceSize:l,sizeRatio:1,isOutline:f,markerPlacement:i,animationParams:te(d),baseSize:P})}_analyzeVectorMarker(e,r,t,i,o,a,s,l,p,c,m,f,u,v,O){const g=e.markerGraphics;if(!g)return;const _=e.frame;let M=0;M=_?_.ymax-_.ymin:a;const S=!!e.scaleSymbolsProportionally;if(M){const r={offsetX:p,offsetY:c,rotation:l,size:s,frameHeight:M,rotateClockWise:!!e.rotateClockwise,absoluteAnchorPoint:!1,scaleSymbolsProportionally:S};m=[...m,r]}t||(t=this._createMarkerPlacementOverrideExpression(e.markerPlacement));for(const k of g)if(k){const s=k.symbol;if(!s)continue;const l=k.primitiveName;l&&i.push(l);let p,c=f;if(("CIMPointSymbol"===s.type||"CIMTextSymbol"===s.type)&&_){let r=0,t=0;const i=k.geometry;"x"in i&&"y"in i&&(r+=i.x-.5*(_.xmin+_.xmax),t+=i.y-.5*(_.ymin+_.ymax));const o=e.anchorPoint;let a=!1;o&&("Absolute"===e.anchorPointUnits?(r-=o.x,t-=o.y,a=!0):_&&(r-=(_.xmax-_.xmin)*o.x,t-=(_.ymax-_.ymin)*o.y));const s={offsetX:r,offsetY:t,rotation:0,size:0,frameHeight:0,rotateClockWise:!1,absoluteAnchorPoint:a,scaleSymbolsProportionally:S};p=[...m,s]}const g=k.geometry,[b,C]=y(g,_);switch(0===b&&0===C||(c=d(c,b,C)),"CIMPointSymbol"===s.type&&(c=n(this._poMap,s,c)),s.type){case"CIMPointSymbol":case"CIMLineSymbol":case"CIMPolygonSymbol":u||$(s)?(c={...c,transform:{type:"AnimatedTransform",relativeTranslation:!1,absoluteScale:!0,translation:h([0,0]),rotation:h(0),scale:h(M),parent:f.transform}},this._analyzeMultiLayerGraphicNonSDF(e,r,t,k,i,o,a,p??m,c,M,v,O)):this._analyzeMultiLayerGraphic(e,r,t,k,i,o,a,p??m,c,M,v,O);break;case"CIMTextSymbol":this._analyzeTextGraphic(r,t,k,i,o,a,p??m,v)}l&&i.pop()}}_analyzeMultiLayerGraphic(e,r,t,i,o,a,s,l,n,p,c,m){const y=i.symbol.symbolLayers;y&&(!Z(y)||f(n)?ee(y)?this._analyzeMultiLayerGraphicNonSDF(e,r,t,i,o,a,s,l,n,p,!!c,m):this._analyzeMarkerGraphicSymbolLayers(e,r,t,i,o,a,s,l,n,p,c,m):this._analyzeCompositeMarkerGraphic(e,r,t,i,y,a,s,l,p,c,m))}_analyzeMarkerGraphicSymbolLayers(e,r,t,i,o,a,s,l,p,c,m,y){const d=i.symbol,h=d.symbolLayers;if(!h)return;const f=this._resourceManager.geometryEngine,u=W.applyEffects(d.effects,i.geometry,f);if(!u)return;let O=h.length;for(;O--;){const d=h[O];if(!d||!1===d.enable)continue;const g=d.primitiveName;switch(g&&o.push(g),d.type){case"CIMSolidFill":case"CIMSolidStroke":{const o=W.applyEffects(d.effects,u,f),h=S(o);if(!h)continue;const O="Relative"!==e.anchorPointUnits,_=R(d)??0,{frameSizeRatio:M,anchorX:C,anchorY:z,widthRatio:x,sdfPaddingRatio:E}=k(h,e.frame,e.size,e.anchorPoint,O,_,e.scaleSymbolsProportionally),L="CIMSolidFill"===d.type,V={type:"sdf",geom:o,sdfPaddingRatio:E,asFill:L},{path:N}=d,G=L?P(A(d)):null==N?P(w(d)):[0,0,0,0],F=L?[0,0,0,0]:P(w(d));if(!L&&!_)break;const T=i.primitiveName;let X=null;L&&!d.colorLocked&&(X=this._maybeGetValueOrOverrideExpression(T,"FillColor"));let Y=null;L||d.colorLocked||(Y=this._maybeGetValueOrOverrideExpression(T,"StrokeColor"));const j=X??this._getValueOrOverrideExpression(d.type,g,"Color",G),U=Y??this._getValueOrOverrideExpression(d.type,g,"Color",F),D=this._maybeGetValueOrOverrideExpression(T,"StrokeWidth")??this._getValueOrOverrideExpression(d.type,g,"Width",_),H=N?{type:"sprite-rasterization-param",resource:{type:"path",path:N,asFill:L},overrides:[]}:{type:"sprite-rasterization-param",resource:V,overrides:[]},J=n(this._poMap,d,p),B=I(e.size,v.CIMVectorMarker.size),q=this._getValueOrOverrideExpression(e.type,e.primitiveName,"Size",B);this._cimLayers.push({type:"marker",spriteRasterizationParam:H,colorLocked:!!d.colorLocked||!!m,effects:r,scaleSymbolsProportionally:!!e.scaleSymbolsProportionally,alignment:a,anchorPoint:{x:C,y:z},isAbsoluteAnchorPoint:O,size:c,rotation:0,offsetX:0,offsetY:0,scaleX:1,transform:{type:"cim-marker-transform-param",params:l},frameHeight:c,widthRatio:x,rotateClockwise:!1,referenceSize:s,sizeRatio:M,color:j,outlineColor:U,outlineWidth:D,isOutline:y,markerPlacement:t,animationParams:te(J),isStroke:"CIMSolidFill"!==d.type,baseSize:q,...b(o,E)});break}case"CIMPictureMarker":case"CIMVectorMarker":if(d.markerPlacement){H().error("Error analyzing CIM, got unexpected marker placement");break}this._analyzeMarker(d,r,t,o,a,s,!1,l,p,m,y)}g&&o.pop()}}_analyzeTextGraphic(e,t,i,o,a,s,l,n){const p=[];M.findApplicableOverrides(i,this._primitiveOverrides,p);const c=i.geometry;if(!("x"in c)||!("y"in c))return;const m=i.symbol,y=G(m),d=F(m.fontStyleName),h=r(m.fontFamilyName);m.font={family:h,decoration:y,...d};const f=I(m.height,v.CIMTextSymbol.height),u=I(m.angle),O=I(m.offsetX),g=I(m.offsetY),{haloSymbol:_}=m,S=I(m.haloSize,0);let k=[0,0,0,0];if(_?.symbolLayers?.length){const e=_.symbolLayers;for(const r of e)if(r.color){k=this._getValueOrOverrideExpression(m?.haloSymbol?.type??"CIMPolygonSymbol",r.primitiveName,"Color",P(r.color));break}}const b=i.primitiveName;let C=[0,0,0,1],z=[0,0,0,0],x=0,E=!1;if(m.symbol?.symbolLayers)for(const r of m.symbol.symbolLayers){const e=r.primitiveName;if("CIMSolidStroke"===r.type)z=this._getValueOrOverrideExpression("CIMSolidStroke",e,"Color",P(r.color)),x=this._getValueOrOverrideExpression("CIMSolidStroke",e,"Width",R(r)??0);else if("CIMSolidFill"===r.type){const t=P(r.color);E=E??!!r.colorLocked,C=this._getValueOrOverrideExpression("CIMSolidFill",e??b,"Color",t)}}let L=null,V=null,N=null,A=null,w=null;b&&(L=this._maybeGetValueOrOverrideExpression(b,"TextSize"),V=this._maybeGetValueOrOverrideExpression(b,"TextAngle"),N=this._maybeGetValueOrOverrideExpression(b,"TextOffsetX"),A=this._maybeGetValueOrOverrideExpression(b,"TextOffsetY"),E||(w=this._maybeGetValueOrOverrideExpression(b,"FillColor")));const Y=w??C;let j=null,W=null,U=0;if(m.callout&&"CIMBackgroundCallout"===m.callout.type){const e=m.callout;if(e.backgroundSymbol){const r=e.backgroundSymbol.symbolLayers;if(r)for(const e of r)"CIMSolidFill"===e.type?j=P(e.color):"CIMSolidStroke"===e.type&&(W=P(e.color),U=I(e.width,v.CIMSolidStroke.width))}}const D=this._getValueOrOverrideExpression(m.type,i.primitiveName,"TextString",i.textString??"");if(null==D)return;const{fontStyleName:H}=m,J=h+(H?"-"+H.toLowerCase():"-regular"),B=this._getMaterialOverrides(o,m.type);B.push(...this._getPrimitiveMaterialOverrides(i.primitiveName,m.type));const q={type:"text-rasterization-param",resource:{type:"text",textString:i.textString??"",font:m.font,symbol:m,primitiveName:i.primitiveName},overrides:B};this._cimLayers.push({type:"text",lineWidth:m.lineWidth,textRasterizationParam:q,colorLocked:!!n||!!E,effects:e,alignment:a,anchorPoint:{x:0,y:0},isAbsoluteAnchorPoint:!1,fontName:J,decoration:y,haloSize:S,haloColor:k,weight:d.weight,style:d.style,size:L??f,angle:V??u,offsetX:N??O,offsetY:A??g,transform:{type:"cim-marker-transform-param",params:l},horizontalAlignment:T(m.horizontalAlignment),verticalAlignment:X(m.verticalAlignment),text:D,color:Y,outlineColor:z,outlineSize:x,backgroundColor:j,borderLineColor:W,borderLineWidth:U,referenceSize:s,sizeRatio:1,markerPlacement:t})}_analyzeMultiLayerGraphicNonSDF(e,r,t,i,a,s,l,n,p,c,m,y){const d=q(e,i),h=e.primitiveName,f=this._analyzeMaterialOverrides(h,["Rotation","OffsetX","OffsetY"]),O=L(f),[g,_,M]=u.getTextureAnchor(d,this._resourceManager,U),S=this._getMaterialOverrides(a,e.type);S.push(...O);const k={type:"sprite-rasterization-param",resource:{...d,avoidSDFRasterization:!0},overrides:S},b=I(e.size,v.CIMVectorMarker.size),C=this._getValueOrOverrideExpression(e.type,h,"Size",b);this._cimLayers.push({type:"marker",spriteRasterizationParam:k,colorLocked:m,effects:r,scaleSymbolsProportionally:!!e.scaleSymbolsProportionally,alignment:s,anchorPoint:{x:g,y:_},isAbsoluteAnchorPoint:!1,size:c,rotation:0,offsetX:0,offsetY:0,transform:{type:"cim-marker-transform-param",params:n},color:[255,255,255,1],outlineColor:[0,0,0,0],outlineWidth:0,scaleX:1,frameHeight:c,widthRatio:1,rotateClockwise:!!e.rotateClockwise,referenceSize:l,sizeRatio:M/o(e.size),isOutline:y,markerPlacement:t,animationParams:te(p),baseSize:C})}_createMarkerPlacementOverrideExpression(e){if(!e)return null;const r=[];return M.findApplicableOverrides(e,this._primitiveOverrides,r),{type:"cim-marker-placement-param",placement:e,overrides:re(r)}}_createGIFAnimatedSymbolPropertiesOverrideExpression(e){if(!e)return null;const r=[];return M.findApplicableOverrides(e,this._primitiveOverrides,r),{type:"cim-gif-animation-params",animation:e,overrides:re(r)}}_analyzeCompositeMarkerGraphic(e,r,t,i,o,a,s,l,n,p,c){const m=i.geometry,y=o[0],d=o[1],h=S(m);if(!h)return;const f="Relative"!==e.anchorPointUnits,u=I(y.width,v.CIMSolidStroke.width),{frameSizeRatio:O,anchorX:g,anchorY:_,widthRatio:M,sdfPaddingRatio:b}=k(h,e.frame,e.size,e.anchorPoint,f,u,e.scaleSymbolsProportionally),{path:C}=d,z=d.primitiveName,x=y.primitiveName,E=i.primitiveName;let L=null;d.colorLocked||p||(L=this._maybeGetValueOrOverrideExpression(E,"FillColor"));const V=L??this._getValueOrOverrideExpression(d.type,z,"Color",P(d.color));let N=null;y.colorLocked||p||(N=this._maybeGetValueOrOverrideExpression(E,"StrokeColor"));const R=N??this._getValueOrOverrideExpression(y.type,x,"Color",P(y.color)),A=this._maybeGetValueOrOverrideExpression(E,"StrokeWidth")??this._getValueOrOverrideExpression(y.type,x,"Width",u),w={type:"sprite-rasterization-param",resource:C?{type:"path",path:C,asFill:!0}:{type:"sdf",geom:m,sdfPaddingRatio:b,asFill:!0},overrides:[]};this._cimLayers.push({type:"marker",spriteRasterizationParam:w,colorLocked:p,effects:r,scaleSymbolsProportionally:!!e.scaleSymbolsProportionally,alignment:a,anchorPoint:{x:g,y:_},isAbsoluteAnchorPoint:f,size:n,rotation:0,offsetX:0,offsetY:0,scaleX:1,transform:{type:"cim-marker-transform-param",params:l},frameHeight:n,widthRatio:M,rotateClockwise:!1,referenceSize:s,sizeRatio:O,color:V,outlineColor:R,outlineWidth:A,isOutline:c,markerPlacement:t})}_setPoMap(e,r,t){let i;this._poMap[e]?i=this._poMap[e]:(i={},this._poMap[e]=i),i[r]=t}_maybeGetValueOrOverrideExpression(e,r,t){return this._getValueOrOverrideExpression("",e,r,t,!1)}_getValueOrOverrideExpression(e,r,t,i,o=!0){if(o&&!Y(i)&&(i=V(e,t.toLowerCase())),null==r)return i;const a=this._poMap[r];if(null==a)return i;const s=a[t];return"string"==typeof s||"number"==typeof s||Array.isArray(s)?s:s?{valueExpressionInfo:s,defaultValue:i}:i}_analyzePrimitiveOverrides(e,r,t,i){if(null==e)return!1;"string"==typeof e&&(e=[e]);for(const o of this._primitiveOverrides)if(e.includes(o.primitiveName)&&o.valueExpressionInfo)return!0;if(null!=r)for(const o of r)if(o?.overrides.length>0)return!0;if(null!=t)for(const o of t)if(o?.overrides.length>0)return!0;if(null!=i)for(const o of i)if(o?.overrides.length>0)return!0;return!1}_getMaterialOverrides(e,r){if(!e)return[];const t=[];for(const i of e)t.push(...this._getPrimitiveMaterialOverrides(i,r));return t}_getPrimitiveMaterialOverrides(e,r){if(!e)return[];const t=L(this._primitiveOverrides.filter((r=>r.primitiveName===e)));return t.forEach((e=>e.defaultValue=V(r,e.propertyName.toLowerCase()))),t}_analyzeMaterialOverrides(e,r){return this._primitiveOverrides.filter((t=>t.primitiveName!==e||!r.includes(t.propertyName)))}}function q(e,r){return{type:e.type,enable:!0,name:e.name,colorLocked:e.colorLocked,primitiveName:e.primitiveName,anchorPoint:e.anchorPoint,anchorPointUnits:e.anchorPointUnits,offsetX:0,offsetY:0,rotateClockwise:e.rotateClockwise,rotation:0,size:e.size,billboardMode3D:e.billboardMode3D,depth3D:e.depth3D,frame:e.frame,markerGraphics:[r],scaleSymbolsProportionally:e.scaleSymbolsProportionally,respectFrame:e.respectFrame,clippingPath:e.clippingPath}}function K(e){if(e&&0===e.indexOf("Level_")){const r=parseInt(e.slice(6),10);if(!isNaN(r))return r}return 0}function Q(e,r){if(!r||0===r.length)return e;const i=t(e);return M.applyOverrides(i,r),i}const Z=e=>e&&2===e.length&&e[0].enable&&e[1].enable&&"CIMSolidStroke"===e[0].type&&"CIMSolidFill"===e[1].type&&null==e[0].path&&null==e[1].path&&!e[0].effects&&!e[1].effects&&!e[0].animations&&!e[1].animations;function $(e){const r=e.symbolLayers;if(!r)return!1;const t=r.find((e=>e.effects?.find((e=>"CIMGeometricEffectDashes"===e.type&&null!=e.dashTemplate)))),i=r.find((e=>e.effects?.find((e=>"CIMGeometricEffectAddControlPoints"===e.type))));return!!t||!!i}function ee(e){return e.some((e=>"CIMSolidFill"!==e.type&&"CIMSolidStroke"!==e.type&&("CIMVectorMarker"!==e.type&&"CIMPictureMarker"!==e.type||null!=e.markerPlacement)))}function re(e){return t(e).map((e=>({...e,propertyName:j(e.propertyName)})))}function te(e){return f(e)?{type:"animation-params",params:e}:null}export{B as CIMAnalyzer,Q as analyzeCIMResource};
@@ -0,0 +1,5 @@
1
+ /*
2
+ All material copyright ESRI, All Rights Reserved, unless otherwise specified.
3
+ See https://js.arcgis.com/4.33/esri/copyright.txt for details.
4
+ */
5
+ import{clone as m}from"../../core/lang.js";import{getExtent as e}from"./SDFHelper.js";import{CIMEffectHelper as r}from"./effects/CIMEffectHelper.js";const a=.01;function t(t,f){if(!t.frame)return t;const{markerGraphics:n}=t;if(!n||0===n.length)return t;let o=0,s=0,i=0,x=0;for(const m of n){const{geometry:a,symbol:t}=m;if(!a||!t||!("symbolLayers"in t))continue;const{symbolLayers:n}=t;if(n)for(const m of n){const{effects:t}=m,n=r.applyEffects(t,a,f),c=e(n);c&&(o=Math.min(o,c[0]),s=Math.min(s,c[1]),i=Math.max(i,c[2]),x=Math.max(x,c[3]))}}const{xmin:c,ymin:y,xmax:p,ymax:h}=t.frame,l=(p-c)/2,M=(h-y)/2,u=(p+c)/2,b=(h+y)/2,g=(u-o)/l,j=(i-u)/l,E=(b-s)/M,F=(x-b)/M,H=Math.max(Math.max(g,j),Math.max(E,F));return H<=1+a?t:(t=m(t)).frame?(t.frame.xmin=(t.frame.xmin-u)*H+u,t.frame.ymin=(t.frame.ymin-b)*H+b,t.frame.xmax=(t.frame.xmax-u)*H+u,t.frame.ymax=(t.frame.ymax-b)*H+b,!1!==t.respectFrame&&(t.size*=H),t):t}export{t as fitVectorMarker};
@@ -2,4 +2,4 @@
2
2
  All material copyright ESRI, All Rights Reserved, unless otherwise specified.
3
3
  See https://js.arcgis.com/4.33/esri/copyright.txt for details.
4
4
  */
5
- import{px2pt as e,pt2px as t}from"../../core/screenUtils.js";import{CIMSymbolHelper as i}from"../cim/CIMSymbolHelper.js";import{CIMSymbolRasterizer as l}from"../cim/CIMSymbolRasterizer.js";import{OverrideHelper as r}from"../cim/OverrideHelper.js";import{mapCIMSymbolToGeometryType as n}from"../cim/utils.js";import{SymbolSizeDefaults as a}from"./previewUtils.js";import{renderSymbol as o}from"./renderUtils.js";const s=new l(null),c=e(a.size),m=e(a.maxSize),u=e(a.lineWidth),f=1;async function h(e,t,i){const l=t?.size;let r=null!=l&&"object"==typeof l&&"width"in l?l.width:l,n=null!=l&&"object"==typeof l&&"height"in l?l.height:l;if(null==r||null==n)if("esriGeometryPolygon"===i)r=c,n=c;else{const l=await y(e,t,i);l&&(r=l.width,n=l.height),"esriGeometryPolyline"===i&&(r=u),r=null!=r&&isFinite(r)?Math.min(r,m):c,n=null!=n&&isFinite(n)?Math.max(Math.min(n,m),f):c}return"legend"===t.style&&"esriGeometryPolyline"===i&&(r=u),{width:r,height:n}}async function y(e,t,l){const{feature:n,fieldMap:a,viewParams:o}=t.cimOptions||t,c=await r.resolveSymbolOverrides(e.data,n,null,a,l,null,o);if(!c)return null;(e=e.clone()).data={type:"CIMSymbolReference",symbol:c},e.data.primitiveOverrides=void 0;const m=[];return i.fetchResources(c,s.resourceManager,m),i.fetchFonts(c,s.resourceManager,m),m.length>0&&await Promise.all(m),i.getEnvelope(c,null,s.resourceManager)}async function p(e,i={}){const{node:l,opacity:r,symbolConfig:a}=i,c=null!=a&&"object"==typeof a&&"isSquareFill"in a&&a.isSquareFill,m=i.cimOptions||i,u=m.geometryType||n(e?.data?.symbol),f=await h(e,i,u),{feature:y,fieldMap:p}=m,d=c||"esriGeometryPolygon"!==u?"preview":"legend",g=await s.rasterizeCIMSymbolAsync(e,y,f,d,p,u,null,m.viewParams,m.allowScalingUp);if(!g)return null;const{width:w,height:b}=g,v=document.createElement("canvas");v.width=w,v.height=b;v.getContext("2d").putImageData(g,0,0);const M=t(f.width),j=t(f.height),S=new Image(M,j);S.src=v.toDataURL(),S.ariaLabel=i.ariaLabel??null,S.alt=i.ariaLabel??"",null!=r&&(S.style.opacity=`${r}`);let C=S;if(null!=i.effectView){const e={shape:{type:"image",x:0,y:0,width:M,height:j,src:S.src},fill:null,stroke:null,offset:[0,0]};C=o([[e]],[M,j],{effectView:i.effectView,ariaLabel:i.ariaLabel})}return l&&C&&l.appendChild(C),C}export{p as previewCIMSymbol};
5
+ import{px2pt as e,pt2px as i}from"../../core/screenUtils.js";import{CIMSymbolHelper as t}from"../cim/CIMSymbolHelper.js";import{CIMSymbolRasterizer as l}from"../cim/CIMSymbolRasterizer.js";import{OverrideHelper as a}from"../cim/OverrideHelper.js";import{mapCIMSymbolToGeometryType as r}from"../cim/utils.js";import{SymbolSizeDefaults as n}from"./previewUtils.js";import{renderSymbol as o}from"./renderUtils.js";const s=new l(null),m=e(n.size),c=e(n.maxSize),u=e(n.lineWidth),f=1;async function h(e,i,t){const l=i?.size;let a=null!=l&&"object"==typeof l&&"width"in l?l.width:l,r=null!=l&&"object"==typeof l&&"height"in l?l.height:l;if(null==a||null==r)if("esriGeometryPolygon"===t)a=r=i.maxSize?Math.min(i.maxSize,m):m;else{const l=await y(e,i,t);l&&(a=l.width,r=l.height),"esriGeometryPolyline"===t&&(a=i.maxSize?Math.min(i.maxSize,u):u),a=null!=a&&isFinite(a)?Math.min(a,c):m,r=null!=r&&isFinite(r)?Math.max(Math.min(r,c),f):m}return"legend"===i.style&&"esriGeometryPolyline"===t&&(a=u),{width:a,height:r}}async function y(e,i,l){const{feature:r,fieldMap:n,viewParams:o}=i.cimOptions||i,m=await a.resolveSymbolOverrides(e.data,r,null,n,l,null,o);if(!m)return null;(e=e.clone()).data={type:"CIMSymbolReference",symbol:m},e.data.primitiveOverrides=void 0;const c=[];return t.fetchResources(m,s.resourceManager,c),t.fetchFonts(m,s.resourceManager,c),c.length>0&&await Promise.all(c),t.getEnvelope(m,null,s.resourceManager)}async function p(e,t={}){const{node:l,opacity:a,symbolConfig:n}=t,m=null!=n&&"object"==typeof n&&"isSquareFill"in n&&n.isSquareFill,c=t.cimOptions||t,u=c.geometryType||r(e?.data?.symbol),f=await h(e,t,u),{feature:y,fieldMap:p}=c,d=m||"esriGeometryPolygon"!==u?"preview":"legend",g=await s.rasterizeCIMSymbolAsync(e,y,f,d,p,u,null,c.viewParams,c.allowScalingUp);if(!g)return null;const{width:w,height:b}=g,M=document.createElement("canvas");M.width=w,M.height=b;M.getContext("2d").putImageData(g,0,0);const S=i(f.width),v=i(f.height),j=new Image(S,v);j.src=M.toDataURL(),j.ariaLabel=t.ariaLabel??null,j.alt=t.ariaLabel??"",null!=a&&(j.style.opacity=`${a}`);let x=j;if(null!=t.effectView){const e={shape:{type:"image",x:0,y:0,width:S,height:v,src:j.src},fill:null,stroke:null,offset:[0,0]};x=o([[e]],[S,v],{effectView:t.effectView,ariaLabel:t.ariaLabel})}return l&&x&&l.appendChild(x),x}export{p as previewCIMSymbol};
@@ -2,4 +2,4 @@
2
2
  All material copyright ESRI, All Rights Reserved, unless otherwise specified.
3
3
  See https://js.arcgis.com/4.33/esri/copyright.txt for details.
4
4
  */
5
- import e from"../../../../config.js";import t from"../../../../request.js";import{bidiText as i}from"../../../../core/BidiText.js";import s from"../../../../core/Error.js";import{getFullyQualifiedFontName as r}from"../../../../core/fontUtils.js";import has from"../../../../core/has.js";import a from"../../../../core/Logger.js";import{throwIfAborted as n,isAbortError as o}from"../../../../core/promiseUtils.js";import{QueueProcessor as c}from"../../../../core/QueueProcessor.js";import{pt2px as h}from"../../../../core/screenUtils.js";import{numericHash as l}from"../../../../core/string.js";import u from"../../../../symbols/cim/CIMResourceManager.js";import{CIMSymbolHelper as p}from"../../../../symbols/cim/CIMSymbolHelper.js";import m from"../../../../symbols/cim/Rasterizer.js";import{normalizeDashTemplate as d}from"../../../../symbols/cim/utils.js";import{svgSdfTextureInnerSize as g,textureBindingSpriteAtlas as f,textureBindingGlyphAtlas as y}from"./definitions.js";import{MosaicType as M}from"./enums.js";import _ from"./GlyphMosaic.js";import I from"./GlyphSource.js";import w from"./Rect.js";import S from"./SDFConverter.js";import z from"./SpriteMosaic.js";import{charCodes as R,discardUrlIfHasUrlHash as T,isSVGImage as C}from"./Utils.js";import{AnimatableTextureResource as P}from"./animatedFormats/AnimatableTextureResource.js";import{AnimationStore as x}from"./animations/store/AnimationStore.js";import{TextureSamplingMode as b}from"../../../webgl/enums.js";const j="arial-unicode-ms-regular",v=()=>a.getLogger("esri.views.2d.engine.webgl.TextureManager"),$=(e,t,i)=>v().error(new s(e,t,i));class k{static fromMosaic(e,t){return new k(e,t.page,t.sdf,t.samplingMode)}constructor(e,t,i,s){this.mosaicType=e,this.page=t,this.sdf=i,this.samplingMode=s}}class A{constructor(i){this._requestRender=i,this._resourceManager=new u,this._invalidFontsMap=new Map,this._sdfConverter=new S(g),this._bindingInfos=new Array,this._hashToBindingIndex=new Map,this._ongoingRasterizations=new Map,this._imageRequestQueue=new c({concurrency:10,process:async(e,i)=>{n(i);try{return await t(e,{responseType:"image",signal:i})}catch(r){if(!o(r))throw new s("mapview-invalid-resource",`Could not fetch requested resource at ${e}`,r);throw r}}}),this.animationStore=new x,this._spriteMosaic=new z(2048,2048,500),this._glyphSource=new I(`${e.fontsUrl}/{fontstack}/{range}.pbf`),this._glyphMosaic=new _(1024,1024,this._glyphSource),this._rasterizer=new m(this.resourceManager)}dispose(){this._spriteMosaic.dispose(),this._glyphMosaic.dispose(),this._rasterizer.dispose(),this._sdfConverter.dispose(),this._spriteMosaic=null,this._glyphMosaic=null,this._sdfConverter=null,this._hashToBindingIndex.clear(),this._hashToBindingIndex=null,this._bindingInfos=null,this._ongoingRasterizations.clear(),this._ongoingRasterizations=null,this._imageRequestQueue.clear(),this._imageRequestQueue=null,this._resourceManager.destroy(),this.animationStore.destroy()}get sprites(){return this._spriteMosaic}get glyphs(){return this._glyphMosaic}get resourceManager(){return this._resourceManager}async rasterizeItem(e,t){if(null==e)return $("mapview-null-resource","Unable to rasterize null resource"),null;if("animation-info"===e.type){const{resource:t}=e,i=this.animationStore.add(t),{location:s}=i;return{rect:new w(s.column,s.row,t.length,1),page:s.page,type:"sprite",width:t.length,height:1,rasterizationScale:1,sdfPaddingRatio:.5,samplingMode:"Linear",sdfDecodeCoeff:1,simplePattern:!1}}if("cim-rasterization-info"!==e.type)return $("mapview-unexpected-resource","Unable to rasterize resource"),null;const{resource:i}=e;if("text"===i.type){const e=await this._rasterizeText(i,t);for(const t of e.glyphs)this._setTextureBinding(M.GLYPH,t);return e}const s=await this._rasterizeSprite(i,t);return s&&this._setTextureBinding(M.SPRITE,s),s}getMosaicInfo(e,t,i=!1){const s=this._getTextureBindingInfo(e,t,i);return s?{size:s.size,texture:{texture:s.texture,unit:"sprite"===s.type?f:y}}:($("mapview-invalid-resource",`Unable to find resource for ${t}`),{size:[0,0],texture:{texture:null,unit:0}})}_getTextureBindingInfo(e,t,i){const s=this._bindingInfos[t-1],r=s.page,a="Nearest"===s.samplingMode?b.NEAREST:i?b.LINEAR_MIPMAP_LINEAR:b.LINEAR;switch(s.mosaicType){case M.SPRITE:{const t=[this.sprites.getWidth(r),this.sprites.getHeight(r)],i=this._spriteMosaic.getTexture(e,r);return i.setSamplingMode(a),{type:"sprite",texture:i,size:t}}case M.GLYPH:{const t=[this.glyphs.width,this.glyphs.height],i=this._glyphMosaic.getTexture(e,r);return this._glyphMosaic.bind(e,a,r,y),i.setSamplingMode(a),{type:"glyph",texture:i,size:t}}default:return $("mapview-texture-manager",`Cannot handle unknown type ${s.mosaicType}`),null}}_hashMosaic(e,t){return 1|e<<1|(t.sdf?1:0)<<2|("Nearest"===t.samplingMode?1:0)<<3|t.page<<4}_setTextureBinding(e,t){const i=this._hashMosaic(e,t);if(!this._hashToBindingIndex.has(i)){const s=k.fromMosaic(e,t),r=this._bindingInfos.length+1;this._hashToBindingIndex.set(i,r),this._bindingInfos.push(s)}t.textureBinding=this._hashToBindingIndex.get(i)}async _rasterizeText(e,t){const{font:s,textString:a}=e,n=r(s),o=this._invalidFontsMap.has(n),[c,h]=i(a),l=R(c);try{const e=o?j:n;has("esri-2d-stabilize-glyphs")&&await this._glyphMosaic.preloadASCIIGlyphCache(e);return{type:"glyphs",glyphs:await this._glyphMosaic.getGlyphItems(e,l,t),isRightToLeft:h}}catch(u){$("mapview-invalid-resource",`Couldn't find font ${n}. Falling back to Arial Unicode MS Regular`),this._invalidFontsMap.set(n,!0);return{type:"glyphs",glyphs:await this._glyphMosaic.getGlyphItems(j,l,t),isRightToLeft:h}}}_hashSpriteResource(e){switch(e.type){case"path":return`path:${e.path}.${e.asFill?1:0}`;case"CIMPictureMarker":return`${e.type}:${e.url}:${e.size}`;case"CIMPictureFill":return`${e.type}:${e.url}:${e.height}`;case"CIMPictureStroke":return`${e.type}:${e.url}:${e.width}`;case"dash":return`dash:${e.capStyle}.${d(e.dashTemplate).join("")}`;case"sdf":return`sdf:${JSON.stringify(e.geom)}.${e.asFill?1:0}`;case"fill-style":return`fill_style:${e.style}`;case"animated":return JSON.stringify(T(e));case"CIMGradientFill":case"CIMGradientStroke":return`gradient:${JSON.stringify(e.colorRamp)}.${e.gradientType}.${e.interval}`;case"CIMHatchFill":case"CIMVectorMarker":return JSON.stringify(e)}}async _rasterizeSprite(e,t){if(!e)return null;const i=l(this._hashSpriteResource(e));if(this._spriteMosaic.has(i))return this._spriteMosaic.getSpriteItem(i);if("url"in e&&e.url||"CIMPictureFill"===e.type||"CIMPictureStroke"===e.type||"CIMPictureMarker"===e.type||"CIMVectorMarker"===e.type){const t=[];p.fetchResources({type:"CIMPointSymbol",symbolLayers:[e]},this._resourceManager,t),t.length>0&&await Promise.all(t)}switch(e.type){case"CIMPictureMarker":return"CIMMarkerPlacementInsidePolygon"===e.markerPlacement?.type?this._rasterizeJSONResource(i,e):this._handleAsyncResource(i,e,t);case"animated":case"CIMPictureFill":case"CIMPictureStroke":case"path":return this._handleAsyncResource(i,e,t);case"CIMGradientFill":case"CIMGradientStroke":case"CIMHatchFill":case"CIMVectorMarker":case"dash":case"fill-style":case"sdf":return this._rasterizeJSONResource(i,e)}}_rasterizeJSONResource(e,t){const i=this._rasterizer.rasterizeJSONResource(t);if(i){const{size:s,image:r,sdf:a,simplePattern:n,rasterizationScale:o,samplingMode:c,sdfPaddingRatio:h,sdfDecodeCoeff:l}=i;return this._addItemToMosaic(e,s,{type:"static",data:r},F(t),a,n,o,c,h,l)}return null}async _handleAsyncResource(e,t,i){if(this._ongoingRasterizations.has(e))return this._ongoingRasterizations.get(e);let s;return s="path"===t.type?this._handleSVG(t,e,i):this._handleImage(t,e,i),this._ongoingRasterizations.set(e,s),s.finally((()=>this._ongoingRasterizations.delete(e))),s}async _handleSVG(e,t,i){const s=[g,g],{asFill:r}=e,a=await this._sdfConverter.draw(e.path,r,i);return this._addItemToMosaic(t,s,{type:"static",data:new Uint32Array(a.buffer)},!1,!0,!0)}async _handleGIFOrPNG(e,t,i){const s=e.url,r=this.resourceManager.getResource(s);if(null==r)return null;const{width:a,height:n}=r;if(r instanceof HTMLImageElement){if("animated"===e.type)return $("mapview-unexpected-resource","Attempt to configure animations for a non-animated image."),null;const i="colorSubstitutions"in e?e.colorSubstitutions:void 0,{size:s,sdf:o,image:c}=this._rasterizer.rasterizeImageResource(a,n,r,i);return this._addItemToMosaic(t,s,{type:"static",data:c},F(e),o,!1)}let o,c,h;"animated"===e.type?(o=!1,c={type:"CIMAnimatedSymbolProperties",playAnimation:e.playAnimation,reverseAnimation:e.reverseAnimation,randomizeStartTime:e.randomizeStartTime,randomizeStartSeed:e.randomizeStartSeed,startTimeOffset:e.startTimeOffset,duration:e.duration,repeatType:e.repeatType,repeatDelay:e.repeatDelay},h=e.startGroup||0):(o=F(e),c={type:"CIMAnimatedSymbolProperties"},h=0);const l=new P(r,this._requestRender,c,h);return this._addItemToMosaic(t,[l.width,l.height],{type:"animated",data:l},o,!1,!1)}async _handleImage(e,t,i){const r=e.url;if(N(r)||L(r))return this._handleGIFOrPNG(e,t,i);if("animated"===e.type)return $("mapview-unexpected-resource","Attempt to configure animations for a non-animated image."),null;try{let s;const a=this.resourceManager.getResource(r);if(null!=a&&a instanceof HTMLImageElement)s=a;else{const{data:e}=await this._imageRequestQueue.push(r,{...i});s=e}if(C(r))if("width"in e&&"height"in e)s.width=h(e.width),s.height=h(e.height);else if("cim"in e){const t=e;s.width=h(t.width??t.scaleX*t.size),s.height=h(t.size)}if(!s.width||!s.height)return null;const n=s.width,o=s.height,c="colorSubstitutions"in e?e.colorSubstitutions:void 0,{size:l,sdf:u,image:p}=this._rasterizer.rasterizeImageResource(n,o,s,c);return this._addItemToMosaic(t,l,{type:"static",data:p},F(e),u,!1)}catch($){if(!o($))throw new s("mapview-invalid-resource",`Could not fetch requested resource at ${r}. ${$.message}`);throw $}}_addItemToMosaic(e,t,i,s,r,a,n,o,c,h){return this._spriteMosaic.addSpriteItem(e,t,i,s,r,a,n,o,c,h)}}function F(e){switch(e.type){case"CIMVectorMarker":case"CIMPictureMarker":return O(e);default:return!0}}const G=e=>null!=e&&e.startsWith("data:image/gif"),N=e=>e&&(e.includes(".gif")||G(e)),B=e=>null!=e&&e.startsWith("data:image/png"),L=e=>e&&(e.includes(".png")||B(e)),O=e=>e&&"markerPlacement"in e&&e.markerPlacement&&"CIMMarkerPlacementInsidePolygon"===e.markerPlacement.type;export{A as default};
5
+ import e from"../../../../config.js";import t from"../../../../request.js";import{bidiText as i}from"../../../../core/BidiText.js";import s from"../../../../core/Error.js";import{getFullyQualifiedFontName as r}from"../../../../core/fontUtils.js";import has from"../../../../core/has.js";import a from"../../../../core/Logger.js";import{throwIfAborted as n,isAbortError as o}from"../../../../core/promiseUtils.js";import{QueueProcessor as c}from"../../../../core/QueueProcessor.js";import{pt2px as h}from"../../../../core/screenUtils.js";import{numericHash as l}from"../../../../core/string.js";import u from"../../../../symbols/cim/CIMResourceManager.js";import{CIMSymbolHelper as p}from"../../../../symbols/cim/CIMSymbolHelper.js";import m from"../../../../symbols/cim/Rasterizer.js";import{normalizeDashTemplate as d}from"../../../../symbols/cim/utils.js";import{svgSdfTextureInnerSize as g,textureBindingSpriteAtlas as f,textureBindingGlyphAtlas as y}from"./definitions.js";import{MosaicType as M}from"./enums.js";import _ from"./GlyphMosaic.js";import I from"./GlyphSource.js";import w from"./Rect.js";import S from"./SDFConverter.js";import z from"./SpriteMosaic.js";import{charCodes as R,discardUrlIfHasUrlHash as T,isSVGImage as C}from"./Utils.js";import{AnimatableTextureResource as P}from"./animatedFormats/AnimatableTextureResource.js";import{AnimationStore as x}from"./animations/store/AnimationStore.js";import{TextureSamplingMode as b}from"../../../webgl/enums.js";const j="arial-unicode-ms-regular",v=()=>a.getLogger("esri.views.MapView"),$=(e,t,i)=>v().error(new s(e,t,i)),A=(e,t="")=>v().warnOnce(e,t);class k{static fromMosaic(e,t){return new k(e,t.page,t.sdf,t.samplingMode)}constructor(e,t,i,s){this.mosaicType=e,this.page=t,this.sdf=i,this.samplingMode=s}}class F{constructor(i){this._requestRender=i,this._resourceManager=new u,this._invalidFontsMap=new Map,this._sdfConverter=new S(g),this._bindingInfos=new Array,this._hashToBindingIndex=new Map,this._ongoingRasterizations=new Map,this._imageRequestQueue=new c({concurrency:10,process:async(e,i)=>{n(i);try{return await t(e,{responseType:"image",signal:i})}catch(r){if(!o(r))throw new s("mapview-invalid-resource",`Could not fetch requested resource at ${e}`,r);throw r}}}),this.animationStore=new x,this._spriteMosaic=new z(2048,2048,500),this._glyphSource=new I(`${e.fontsUrl}/{fontstack}/{range}.pbf`),this._glyphMosaic=new _(1024,1024,this._glyphSource),this._rasterizer=new m(this.resourceManager)}dispose(){this._spriteMosaic.dispose(),this._glyphMosaic.dispose(),this._rasterizer.dispose(),this._sdfConverter.dispose(),this._spriteMosaic=null,this._glyphMosaic=null,this._sdfConverter=null,this._hashToBindingIndex.clear(),this._hashToBindingIndex=null,this._bindingInfos=null,this._ongoingRasterizations.clear(),this._ongoingRasterizations=null,this._imageRequestQueue.clear(),this._imageRequestQueue=null,this._resourceManager.destroy(),this.animationStore.destroy()}get sprites(){return this._spriteMosaic}get glyphs(){return this._glyphMosaic}get resourceManager(){return this._resourceManager}async rasterizeItem(e,t){if(null==e)return $("mapview-null-resource","Unable to rasterize null resource"),null;if("animation-info"===e.type){const{resource:t}=e,i=this.animationStore.add(t),{location:s}=i;return{rect:new w(s.column,s.row,t.length,1),page:s.page,type:"sprite",width:t.length,height:1,rasterizationScale:1,sdfPaddingRatio:.5,samplingMode:"Linear",sdfDecodeCoeff:1,simplePattern:!1}}if("cim-rasterization-info"!==e.type)return $("mapview-unexpected-resource","Unable to rasterize resource"),null;const{resource:i}=e;if("text"===i.type){const e=await this._rasterizeText(i,t);for(const t of e.glyphs)this._setTextureBinding(M.GLYPH,t);return e}const s=await this._rasterizeSprite(i,t);return s&&this._setTextureBinding(M.SPRITE,s),s}getMosaicInfo(e,t,i=!1){const s=this._getTextureBindingInfo(e,t,i);return s?{size:s.size,texture:{texture:s.texture,unit:"sprite"===s.type?f:y}}:($("mapview-invalid-resource",`Unable to find resource for ${t}`),{size:[0,0],texture:{texture:null,unit:0}})}_getTextureBindingInfo(e,t,i){const s=this._bindingInfos[t-1],r=s.page,a="Nearest"===s.samplingMode?b.NEAREST:i?b.LINEAR_MIPMAP_LINEAR:b.LINEAR;switch(s.mosaicType){case M.SPRITE:{const t=[this.sprites.getWidth(r),this.sprites.getHeight(r)],i=this._spriteMosaic.getTexture(e,r);return i.setSamplingMode(a),{type:"sprite",texture:i,size:t}}case M.GLYPH:{const t=[this.glyphs.width,this.glyphs.height],i=this._glyphMosaic.getTexture(e,r);return this._glyphMosaic.bind(e,a,r,y),i.setSamplingMode(a),{type:"glyph",texture:i,size:t}}default:return $("mapview-texture-manager",`Cannot handle unknown type ${s.mosaicType}`),null}}_hashMosaic(e,t){return 1|e<<1|(t.sdf?1:0)<<2|("Nearest"===t.samplingMode?1:0)<<3|t.page<<4}_setTextureBinding(e,t){const i=this._hashMosaic(e,t);if(!this._hashToBindingIndex.has(i)){const s=k.fromMosaic(e,t),r=this._bindingInfos.length+1;this._hashToBindingIndex.set(i,r),this._bindingInfos.push(s)}t.textureBinding=this._hashToBindingIndex.get(i)}async _rasterizeText(e,t){const{font:s,textString:a}=e,n=r(s),o=this._invalidFontsMap.has(n),[c,h]=i(a),l=R(c);try{const e=o?j:n;has("esri-2d-stabilize-glyphs")&&await this._glyphMosaic.preloadASCIIGlyphCache(e);return{type:"glyphs",glyphs:await this._glyphMosaic.getGlyphItems(e,l,t),isRightToLeft:h}}catch(u){A(`Font ${n} is not available on the web, using "Arial Unicode MS Regular"`),this._invalidFontsMap.set(n,!0);return{type:"glyphs",glyphs:await this._glyphMosaic.getGlyphItems(j,l,t),isRightToLeft:h}}}_hashSpriteResource(e){switch(e.type){case"path":return`path:${e.path}.${e.asFill?1:0}`;case"CIMPictureMarker":return`${e.type}:${e.url}:${e.size}`;case"CIMPictureFill":return`${e.type}:${e.url}:${e.height}`;case"CIMPictureStroke":return`${e.type}:${e.url}:${e.width}`;case"dash":return`dash:${e.capStyle}.${d(e.dashTemplate).join("")}`;case"sdf":return`sdf:${JSON.stringify(e.geom)}.${e.asFill?1:0}`;case"fill-style":return`fill_style:${e.style}`;case"animated":return JSON.stringify(T(e));case"CIMGradientFill":case"CIMGradientStroke":return`gradient:${JSON.stringify(e.colorRamp)}.${e.gradientType}.${e.interval}`;case"CIMHatchFill":case"CIMVectorMarker":return JSON.stringify(e)}}async _rasterizeSprite(e,t){if(!e)return null;const i=l(this._hashSpriteResource(e));if(this._spriteMosaic.has(i))return this._spriteMosaic.getSpriteItem(i);if("url"in e&&e.url||"CIMPictureFill"===e.type||"CIMPictureStroke"===e.type||"CIMPictureMarker"===e.type||"CIMVectorMarker"===e.type){const t=[];p.fetchResources({type:"CIMPointSymbol",symbolLayers:[e]},this._resourceManager,t),t.length>0&&await Promise.all(t)}switch(e.type){case"CIMPictureMarker":return"CIMMarkerPlacementInsidePolygon"===e.markerPlacement?.type?this._rasterizeJSONResource(i,e):this._handleAsyncResource(i,e,t);case"animated":case"CIMPictureFill":case"CIMPictureStroke":case"path":return this._handleAsyncResource(i,e,t);case"CIMGradientFill":case"CIMGradientStroke":case"CIMHatchFill":case"CIMVectorMarker":case"dash":case"fill-style":case"sdf":return this._rasterizeJSONResource(i,e)}}_rasterizeJSONResource(e,t){const i=this._rasterizer.rasterizeJSONResource(t);if(i){const{size:s,image:r,sdf:a,simplePattern:n,rasterizationScale:o,samplingMode:c,sdfPaddingRatio:h,sdfDecodeCoeff:l}=i;return this._addItemToMosaic(e,s,{type:"static",data:r},G(t),a,n,o,c,h,l)}return null}async _handleAsyncResource(e,t,i){if(this._ongoingRasterizations.has(e))return this._ongoingRasterizations.get(e);let s;return s="path"===t.type?this._handleSVG(t,e,i):this._handleImage(t,e,i),this._ongoingRasterizations.set(e,s),s.finally((()=>this._ongoingRasterizations.delete(e))),s}async _handleSVG(e,t,i){const s=[g,g],{asFill:r}=e,a=await this._sdfConverter.draw(e.path,r,i);return this._addItemToMosaic(t,s,{type:"static",data:new Uint32Array(a.buffer)},!1,!0,!0)}async _handleGIFOrPNG(e,t,i){const s=e.url,r=this.resourceManager.getResource(s);if(null==r)return null;const{width:a,height:n}=r;if(r instanceof HTMLImageElement){if("animated"===e.type)return $("mapview-unexpected-resource","Attempt to configure animations for a non-animated image."),null;const i="colorSubstitutions"in e?e.colorSubstitutions:void 0,{size:s,sdf:o,image:c}=this._rasterizer.rasterizeImageResource(a,n,r,i);return this._addItemToMosaic(t,s,{type:"static",data:c},G(e),o,!1)}let o,c,h;"animated"===e.type?(o=!1,c={type:"CIMAnimatedSymbolProperties",playAnimation:e.playAnimation,reverseAnimation:e.reverseAnimation,randomizeStartTime:e.randomizeStartTime,randomizeStartSeed:e.randomizeStartSeed,startTimeOffset:e.startTimeOffset,duration:e.duration,repeatType:e.repeatType,repeatDelay:e.repeatDelay},h=e.startGroup||0):(o=G(e),c={type:"CIMAnimatedSymbolProperties"},h=0);const l=new P(r,this._requestRender,c,h);return this._addItemToMosaic(t,[l.width,l.height],{type:"animated",data:l},o,!1,!1)}async _handleImage(e,t,i){const r=e.url;if(B(r)||O(r))return this._handleGIFOrPNG(e,t,i);if("animated"===e.type)return $("mapview-unexpected-resource","Attempt to configure animations for a non-animated image."),null;try{let s;const a=this.resourceManager.getResource(r);if(null!=a&&a instanceof HTMLImageElement)s=a;else{const{data:e}=await this._imageRequestQueue.push(r,{...i});s=e}if(C(r))if("width"in e&&"height"in e)s.width=h(e.width),s.height=h(e.height);else if("cim"in e){const t=e;s.width=h(t.width??t.scaleX*t.size),s.height=h(t.size)}if(!s.width||!s.height)return null;const n=s.width,o=s.height,c="colorSubstitutions"in e?e.colorSubstitutions:void 0,{size:l,sdf:u,image:p}=this._rasterizer.rasterizeImageResource(n,o,s,c);return this._addItemToMosaic(t,l,{type:"static",data:p},G(e),u,!1)}catch($){if(!o($))throw new s("mapview-invalid-resource",`Could not fetch requested resource at ${r}. ${$.message}`);throw $}}_addItemToMosaic(e,t,i,s,r,a,n,o,c,h){return this._spriteMosaic.addSpriteItem(e,t,i,s,r,a,n,o,c,h)}}function G(e){switch(e.type){case"CIMVectorMarker":case"CIMPictureMarker":return E(e);default:return!0}}const N=e=>null!=e&&e.startsWith("data:image/gif"),B=e=>e&&(e.includes(".gif")||N(e)),L=e=>null!=e&&e.startsWith("data:image/png"),O=e=>e&&(e.includes(".png")||L(e)),E=e=>e&&"markerPlacement"in e&&e.markerPlacement&&"CIMMarkerPlacementInsidePolygon"===e.markerPlacement.type;export{F as default};
@@ -2,4 +2,4 @@
2
2
  All material copyright ESRI, All Rights Reserved, unless otherwise specified.
3
3
  See https://js.arcgis.com/4.33/esri/copyright.txt for details.
4
4
  */
5
- import{sqlAnd as e}from"../../../../../core/sql.js";function t(t,i,s,l){const o=null!=t.subtypeCode?`${t.subtypeField} = ${t.subtypeCode}`:null,r=e(t.definitionExpression,o),n=t.customParameters??{},a=i.displayFilterEnabled&&t.displayFilterInfo?t.displayFilterInfo.toJSON():null;return l&&(n.token=l),{type:"feature",mutable:{sourceRefreshVersion:s,availableFields:i.availableFields,dataFilter:{definitionExpression:r,displayFilter:a,customParameters:n,gdbVersion:t.gdbVersion,historicMoment:t.historicMoment?.getTime(),queryScaleRanges:t.queryScaleRanges??[],timeExtent:t.timeExtent?.toJSON()}}}}export{t as createFeatureSourceSchema};
5
+ import{sqlAnd as e}from"../../../../../core/sql.js";function t(t,i,s,l){const o=null!=t.subtypeCode?`${t.subtypeField} = ${t.subtypeCode}`:null,r=e(t.definitionExpression,o),n=t.customParameters??{},a=i.displayFilterEnabled&&t.displayFilterInfo?t.displayFilterInfo.toJSON():null;return l&&(n.token=l),{type:"feature",mutable:{sourceRefreshVersion:s,availableFields:i.availableFields,displayFilter:a,dataFilter:{definitionExpression:r,customParameters:n,gdbVersion:t.gdbVersion,historicMoment:t.historicMoment?.getTime(),queryScaleRanges:t.queryScaleRanges??[],timeExtent:t.timeExtent?.toJSON()}}}}export{t as createFeatureSourceSchema};
@@ -2,4 +2,4 @@
2
2
  All material copyright ESRI, All Rights Reserved, unless otherwise specified.
3
3
  See https://js.arcgis.com/4.33/esri/copyright.txt for details.
4
4
  */
5
- import e from"../../../../../request.js";import has from"../../../../../core/has.js";import{ignoreAbortErrors as t,throwIfNotAbortError as s}from"../../../../../core/promiseUtils.js";import{diff as r,hasRootDiffOnly as a,hasRootDiff as i}from"../../../../../core/accessorSupport/diffUtils.js";import{OptimizedFeature as n}from"../../../../../layers/graphics/OptimizedFeature.js";import{QueryEngine as o}from"../../../../../layers/graphics/data/QueryEngine.js";import{executeQueryForCount as d}from"../../../../../rest/query/operations/query.js";import{FeatureStoreStatistics as h}from"../FeatureStoreStatistics.js";import{FeatureSourceQueryInfo as u}from"./FeatureSourceQueryInfo.js";import{StreamMessenger as c}from"./StreamMessenger.js";import{DrillDownTileLoadStrategy as m}from"./strategies/DrillDownTileLoadStrategy.js";import{PagedTileLoadStrategy as p}from"./strategies/PagedTileLoadStrategy.js";import{ParquetLoadStrategy as l}from"./strategies/ParquetLoadStrategy.js";import{SnapshotLoadStrategy as y}from"./strategies/SnapshotLoadStrategy.js";import{StreamLoadStrategy as _}from"./strategies/StreamLoadStrategy.js";import{FeatureSourceChunkStore as g}from"./strategies/chunks/SourceChunkStore.js";import{FeatureMetadata as f}from"../support/FeatureMetadata.js";import{UpdateTracking2D as v}from"../../support/UpdateTracking2D.js";class S{constructor(e,t,s,r){this.service=e,this._aggregateAdapter=t,this._subscriptions=s,this._connection=r,this._updateTracking=new v({debugName:"FeatureSource"}),this._didInvalidateData=!1,this._metadata=f.createFeature(e.metadata),this._store=new g(this._metadata)}destroy(){this._strategy?.destroy(),this._store.destroy(),this._streamMessenger?.destroy(),"memory"===this.service.type&&this.service.source.map((e=>e.close()))}get metadata(){if(!this._metadata)throw new Error("InternalError: Metadata not defined. Was update called?");return this._metadata}get store(){return this._store}get streamMessenger(){return null==this._streamMessenger&&this._initStreamMessenger(),this._streamMessenger}get statistics(){return h.from(this._store)}get updateTracking(){return this._updateTracking}get queryEngine(){if(!this._queryEngine){if(!this._schema)return null;const{dataFilter:e}=this._schema.mutable,t=this._schema.mutable.availableFields,s=this._metadata;this._queryEngine=new o({featureStore:this._store,fieldsIndex:s.fieldsIndex,geometryType:s.geometryType,objectIdField:s.objectIdField,hasM:!1,hasZ:!1,spatialReference:this.service.outSpatialReference,aggregateAdapter:this._aggregateAdapter,timeInfo:s.timeInfo,definitionExpression:e.definitionExpression,availableFields:t})}return this._queryEngine}get isStream(){return"stream"===this._schema.type}chunks(){return Array.from(this._store.chunks())}cleanupRemovedChunks(){return this._store.cleanupRemovedChunks()}onSubscribe(e){this._connection.onEvent({type:"subscribe",tile:e.tile.id});const t=this._strategy?.load(e);t&&(t.then((()=>this._connection.onEvent({type:"loaded",tile:e.tile.id}))).catch((t=>this._connection.onEvent({type:"error",tile:e.tile.id,error:t}))),this._updateTracking.addPromise(t))}onResume(e){this._updateTracking.addPromise(t(this._strategy?.load(e)))}onUnsubscribe(e){this._connection.onEvent({type:"unsubscribe",tile:e.tile.id}),this._strategy?.unload(e)}applyOverride(e){this._didInvalidateData=!0,this._store.applyOverride(e)}takeOverrideUpdate(){return this._store.takeOverrideUpdate()}async update(e,t){const s=e.source,n=r(this._schema?.mutable,s.mutable);if(!n)return!1;if(has("esri-2d-update-debug")&&console.debug(`Version[${t}] FeatureSource.update`,{changes:n}),this._schema=s,this._queryEngine?.destroy(),this._queryEngine=null,"feature-service"===this.service.type&&null!=this.service.queryMetadata.lastEditDate&&(this._lastEditDate=this.service.queryMetadata.lastEditDate),null==this._streamMessenger&&"stream"===this._schema.type&&this._initStreamMessenger(),a(n,"sourceRefreshVersion")&&this._strategy?.refresh)return await this._strategy.refresh(),!0;if(("feature"===s.type||"parquet"===s.type)&&a(n,"availableFields")){if(await this._queryLastEditDateChanged()||this._didInvalidateData)this._didInvalidateData=!1,await this._updateStrategy(t);else{this._connection.onEvent({type:"updateFieldsStart"});try{await this._strategy.updateFields(s.mutable.availableFields),this._connection.onEvent({type:"updateFieldsEnd"})}catch(o){this._connection.onEvent({type:"updateFieldsError",error:o})}}return!1}return!(!i(n,"dataFilter")&&!i(n,"sourceRefreshVersion"))&&(await this._updateStrategy(t),!0)}async addParquetFile(e){this._strategy.addParquetFile(e)}unsafeSetQueryHistoricMoment(e){"feature"===this._schema.type&&(this._schema.mutable.dataFilter.historicMoment=e,this._strategy.unsafeSetQueryHistoricMoment(new Date(e)))}_initStreamMessenger(){null==this._streamMessenger&&(this._streamMessenger=new c(this._connection))}async normalizeOverrides(e){const t={historicMoment:e.historicMoment,commands:{updateWeak:e.commands.updateWeak.map(n.fromJSON),removeWeak:e.commands.removeWeak,update:e.commands.update.map(n.fromJSON),remove:e.commands.remove,release:e.commands.release}},s=e.commands.updateByIdWeak,r=await this._queryOptimizedFeatures(s);return t.commands.updateWeak.push(...r),t}async _queryOptimizedFeatures(e){if(0===e.length)return[];const t=[],s=(await this._strategy.queryByObjectId(e)).getCursor();for(;s.next();)t.push(s.readOptimizedFeatureWorldSpace());return t}getObjectIdsFromGlobalIds(e){const t=new Set(e),s=this.metadata.globalIdField;if(null==s)throw new Error("InternalError: Recieved an edit with globalIds, but not supported by the service");const r=[];return this._store.forEachUnsafe((e=>{const a=e.readAttribute(s);if(t.has(a)){const t=e.getObjectId();null!=t&&r.push(t)}})),r}async _queryLastEditDateChanged(){if(null==this._lastEditDate)return!1;const t=this.service.source,s={...t.query,f:"json"},r=(await e(t.path,{query:s,responseType:"json"})).data.editingInfo.lastEditDate;return r!==this._lastEditDate&&(this._lastEditDate=r,!0)}async _createStrategy(){const e="isSourceHosted"in this.service&&this.service.isSourceHosted,t=Array.isArray(this.service.source),s=this.service.source&&"collection"in this.service.source,r=e||t||s;if("stream"===this._schema.type){const e=new _(this.service,this._schema.mutable.dataFilter,this._store,{outSR:this.service.outSpatialReference},this.metadata);return this._streamMessenger.strategy=e,e}if("parquet"===this._schema.type){const e=this.service;return new l(e,this._metadata,this._schema,this._store)}const a=this.service,i=u.fromSchema(a,this._schema,this._metadata),n=await this._supportSnapshotMode(a,i);return n?new y(a,i,this._store,n.featureCount,this.metadata,this._connection):r?new p(a,i,this._store,this.metadata,this._connection):new m(a,i,this._store,this.metadata,this._connection)}async _updateStrategy(e){const t=await this._createStrategy();this._connection.onEvent({type:"updateStrategyStart",about:t.about});const r=!!this._strategy;this._store.clear(),this._strategy?.destroy(),this._strategy=t,has("esri-2d-update-debug")&&console.debug(`Version[${e}] FeatureSource.updateStrategy`,{strategy:t});const a=Array.from(this._subscriptions.values());if(!a.length)return void this._connection.onEvent({type:"updateStrategyEnd"});const i=Promise.all(a.map((e=>this._strategy.load(e).then((()=>this._connection.onEvent({type:"loaded",tile:e.tile.id}))).catch((t=>this._connection.onEvent({type:"error",tile:e.tile.id,error:t}))))));this._updateTracking.addPromise(i);try{r&&await i}catch(n){s(n)}this._connection.onEvent({type:"updateStrategyEnd"}),has("esri-2d-update-debug")&&console.debug(`Version[${e}] FeatureSource.updateStrategyEnd`,{strategy:t})}async _supportSnapshotMode(e,t){const{queryMetadata:s}=e,r=s.snapshotInfo;if(!r||!r.supportsSnapshotMinThreshold||!r.snapshotCountThresholds)return null;const a=e.source,i=t.createQuery();i.inner.orderByFields=[],i.inner.returnGeometry=!1;const n=(await d(a,i.inner,{query:i.customParameters})).data.count,{min:o,max:h}=r.snapshotCountThresholds;return n<=o||r.supportsSnapshotMaxThreshold&&n<h?{featureCount:n}:null}}export{S as FeatureSource};
5
+ import e from"../../../../../request.js";import has from"../../../../../core/has.js";import{ignoreAbortErrors as t,throwIfNotAbortError as s}from"../../../../../core/promiseUtils.js";import{diff as r,hasRootDiffOnly as a,hasRootDiff as i}from"../../../../../core/accessorSupport/diffUtils.js";import{OptimizedFeature as n}from"../../../../../layers/graphics/OptimizedFeature.js";import{QueryEngine as o}from"../../../../../layers/graphics/data/QueryEngine.js";import{executeQueryForCount as d}from"../../../../../rest/query/operations/query.js";import{FeatureStoreStatistics as h}from"../FeatureStoreStatistics.js";import{FeatureSourceQueryInfo as u}from"./FeatureSourceQueryInfo.js";import{StreamMessenger as c}from"./StreamMessenger.js";import{DrillDownTileLoadStrategy as m}from"./strategies/DrillDownTileLoadStrategy.js";import{PagedTileLoadStrategy as p}from"./strategies/PagedTileLoadStrategy.js";import{ParquetLoadStrategy as l}from"./strategies/ParquetLoadStrategy.js";import{SnapshotLoadStrategy as y}from"./strategies/SnapshotLoadStrategy.js";import{StreamLoadStrategy as _}from"./strategies/StreamLoadStrategy.js";import{FeatureSourceChunkStore as g}from"./strategies/chunks/SourceChunkStore.js";import{FeatureMetadata as f}from"../support/FeatureMetadata.js";import{UpdateTracking2D as v}from"../../support/UpdateTracking2D.js";class S{constructor(e,t,s,r){this.service=e,this._aggregateAdapter=t,this._subscriptions=s,this._connection=r,this._updateTracking=new v({debugName:"FeatureSource"}),this._didInvalidateData=!1,this._metadata=f.createFeature(e.metadata),this._store=new g(this._metadata)}destroy(){this._strategy?.destroy(),this._store.destroy(),this._streamMessenger?.destroy(),"memory"===this.service.type&&this.service.source.map((e=>e.close()))}get metadata(){if(!this._metadata)throw new Error("InternalError: Metadata not defined. Was update called?");return this._metadata}get store(){return this._store}get streamMessenger(){return null==this._streamMessenger&&this._initStreamMessenger(),this._streamMessenger}get statistics(){return h.from(this._store)}get updateTracking(){return this._updateTracking}get queryEngine(){if(!this._queryEngine){if(!this._schema)return null;const{dataFilter:e}=this._schema.mutable,t=this._schema.mutable.availableFields,s=this._metadata;this._queryEngine=new o({featureStore:this._store,fieldsIndex:s.fieldsIndex,geometryType:s.geometryType,objectIdField:s.objectIdField,hasM:!1,hasZ:!1,spatialReference:this.service.outSpatialReference,aggregateAdapter:this._aggregateAdapter,timeInfo:s.timeInfo,definitionExpression:e.definitionExpression,availableFields:t})}return this._queryEngine}get isStream(){return"stream"===this._schema.type}chunks(){return Array.from(this._store.chunks())}cleanupRemovedChunks(){return this._store.cleanupRemovedChunks()}onSubscribe(e){this._connection.onEvent({type:"subscribe",tile:e.tile.id});const t=this._strategy?.load(e);t&&(t.then((()=>this._connection.onEvent({type:"loaded",tile:e.tile.id}))).catch((t=>this._connection.onEvent({type:"error",tile:e.tile.id,error:t}))),this._updateTracking.addPromise(t))}onResume(e){this._updateTracking.addPromise(t(this._strategy?.load(e)))}onUnsubscribe(e){this._connection.onEvent({type:"unsubscribe",tile:e.tile.id}),this._strategy?.unload(e)}applyOverride(e){this._didInvalidateData=!0,this._store.applyOverride(e)}takeOverrideUpdate(){return this._store.takeOverrideUpdate()}async update(e,t){const s=e.source,n=r(this._schema?.mutable,s.mutable);if(!n)return!1;if(has("esri-2d-update-debug")&&console.debug(`Version[${t}] FeatureSource.update`,{changes:n}),this._schema=s,this._queryEngine?.destroy(),this._queryEngine=null,"feature-service"===this.service.type&&null!=this.service.queryMetadata.lastEditDate&&(this._lastEditDate=this.service.queryMetadata.lastEditDate),null==this._streamMessenger&&"stream"===this._schema.type&&this._initStreamMessenger(),a(n,"sourceRefreshVersion")&&this._strategy?.refresh)return await this._strategy.refresh(),!0;if(("feature"===s.type||"parquet"===s.type)&&a(n,"availableFields")){if(await this._queryLastEditDateChanged()||this._didInvalidateData)this._didInvalidateData=!1,await this._updateStrategy(t);else{this._connection.onEvent({type:"updateFieldsStart"});try{await this._strategy.updateFields(s.mutable.availableFields),this._connection.onEvent({type:"updateFieldsEnd"})}catch(o){this._connection.onEvent({type:"updateFieldsError",error:o})}}return!1}return!!(i(n,"dataFilter")||i(n,"sourceRefreshVersion")||this._strategy.about.supportsDisplayFilter&&i(n,"displayFilter"))&&(await this._updateStrategy(t),!0)}async addParquetFile(e){this._strategy.addParquetFile(e)}unsafeSetQueryHistoricMoment(e){"feature"===this._schema.type&&(this._schema.mutable.dataFilter.historicMoment=e,this._strategy.unsafeSetQueryHistoricMoment(new Date(e)))}_initStreamMessenger(){null==this._streamMessenger&&(this._streamMessenger=new c(this._connection))}async normalizeOverrides(e){const t={historicMoment:e.historicMoment,commands:{updateWeak:e.commands.updateWeak.map(n.fromJSON),removeWeak:e.commands.removeWeak,update:e.commands.update.map(n.fromJSON),remove:e.commands.remove,release:e.commands.release}},s=e.commands.updateByIdWeak,r=await this._queryOptimizedFeatures(s);return t.commands.updateWeak.push(...r),t}async _queryOptimizedFeatures(e){if(0===e.length)return[];const t=[],s=(await this._strategy.queryByObjectId(e)).getCursor();for(;s.next();)t.push(s.readOptimizedFeatureWorldSpace());return t}getObjectIdsFromGlobalIds(e){const t=new Set(e),s=this.metadata.globalIdField;if(null==s)throw new Error("InternalError: Recieved an edit with globalIds, but not supported by the service");const r=[];return this._store.forEachUnsafe((e=>{const a=e.readAttribute(s);if(t.has(a)){const t=e.getObjectId();null!=t&&r.push(t)}})),r}async _queryLastEditDateChanged(){if(null==this._lastEditDate)return!1;const t=this.service.source,s={...t.query,f:"json"},r=(await e(t.path,{query:s,responseType:"json"})).data.editingInfo.lastEditDate;return r!==this._lastEditDate&&(this._lastEditDate=r,!0)}async _createStrategy(){const e="isSourceHosted"in this.service&&this.service.isSourceHosted,t=Array.isArray(this.service.source),s=this.service.source&&"collection"in this.service.source,r=e||t||s;if("stream"===this._schema.type){const e=new _(this.service,this._schema.mutable.dataFilter,this._store,{outSR:this.service.outSpatialReference},this.metadata);return this._streamMessenger.strategy=e,e}if("parquet"===this._schema.type){const e=this.service;return new l(e,this._metadata,this._schema,this._store)}const a=this.service,i=u.fromSchema(a,this._schema,this._metadata),n=await this._supportSnapshotMode(a,i);return n?new y(a,i,this._store,n.featureCount,this.metadata,this._connection):r?new p(a,i,this._store,this.metadata,this._connection):new m(a,i,this._store,this.metadata,this._connection)}async _updateStrategy(e){const t=await this._createStrategy();this._connection.onEvent({type:"updateStrategyStart",about:t.about});const r=!!this._strategy;this._store.clear(),this._strategy?.destroy(),this._strategy=t,has("esri-2d-update-debug")&&console.debug(`Version[${e}] FeatureSource.updateStrategy`,{strategy:t});const a=Array.from(this._subscriptions.values());if(!a.length)return void this._connection.onEvent({type:"updateStrategyEnd"});const i=Promise.all(a.map((e=>this._strategy.load(e).then((()=>this._connection.onEvent({type:"loaded",tile:e.tile.id}))).catch((t=>this._connection.onEvent({type:"error",tile:e.tile.id,error:t}))))));this._updateTracking.addPromise(i);try{r&&await i}catch(n){s(n)}this._connection.onEvent({type:"updateStrategyEnd"}),has("esri-2d-update-debug")&&console.debug(`Version[${e}] FeatureSource.updateStrategyEnd`,{strategy:t})}async _supportSnapshotMode(e,t){const{queryMetadata:s}=e,r=s.snapshotInfo;if(!r||!r.supportsSnapshotMinThreshold||!r.snapshotCountThresholds)return null;const a=e.source,i=t.createQuery();i.inner.orderByFields=[],i.inner.returnGeometry=!1;const n=(await d(a,i.inner,{query:i.customParameters})).data.count,{min:o,max:h}=r.snapshotCountThresholds;return n<=o||r.supportsSnapshotMaxThreshold&&n<h?{featureCount:n}:null}}export{S as FeatureSource};
@@ -2,4 +2,4 @@
2
2
  All material copyright ESRI, All Rights Reserved, unless otherwise specified.
3
3
  See https://js.arcgis.com/4.33/esri/copyright.txt for details.
4
4
  */
5
- import has from"../../../../../core/has.js";import{sqlAnd as e}from"../../../../../core/sql.js";import t from"../../../../../geometry/SpatialReference.js";import{isHostedAgolService as r}from"../../../../../layers/support/arcgisLayerUrl.js";import{getClauseForScaleRange as a}from"../../../../../layers/support/displayFilterUtils.js";import i from"../../../../../rest/support/Query.js";import s from"../../../../../time/TimeExtent.js";const o=4;function n(e,a,i){const o=e.orderByFields??i.objectIdField+" ASC",n=e.source,l={returnCentroid:!(null!==n&&"object"==typeof n&&"path"in n&&r(n.path))&&"esriGeometryPolygon"===i.serviceGeometryType,returnGeometry:!0,timeReferenceUnknownClient:i.timeReferenceUnknownClient??void 0,outSpatialReference:t.fromJSON(e.outSpatialReference),orderByFields:"memory"===e.type?[]:[o],where:a.mutable.dataFilter.definitionExpression??"1=1",outFields:a.mutable.availableFields,multipatchOption:"esriGeometryMultiPatch"===i.serviceGeometryType?"xyFootprint":null};if("feature"===a.type){const{gdbVersion:e,historicMoment:t,timeExtent:r}=a.mutable.dataFilter;return{...l,gdbVersion:e,historicMoment:t?new Date(t):null,timeExtent:r?s.fromJSON(r):null,outFields:a.mutable.availableFields}}return l}class l{static fromSchema(e,t,r){const a="feature"===t.type?t.mutable.dataFilter.queryScaleRanges:[],i=t.mutable.dataFilter.displayFilter;return new l(n(e,t,r),i,a,r.subtypeField,t.mutable.dataFilter.customParameters,r.geometryType,e.queryMetadata)}constructor(e,t,r,a,i,s,o){this._queryParams=e,this._displayFilter=t,this._queryScaleRanges=r,this._subtypeField=a,this._customParameters=i,this._geometryType=s,this._queryMetadata=o}get pageSize(){if(null==this._queryMetadata)throw new Error("InternalError: Service does not support paged queries");const e=this._queryMetadata.supportsMaxRecordCountFactor?o:null,t=(this._queryMetadata.maxRecordCount??8e3)*(e??1);return Math.min(8e3,t)}updateHistoricMoment(e){this._queryParams.historicMoment=e}updateFields(e){this._queryParams.outFields=e}createPatchFieldsQuery(e,t,r){if(!t.getSize())return null;const a=e.clone();if("*"===this._queryParams.outFields[0]){if("*"===(a.outFields??[])[0])return null;a.outFields=this._queryParams.outFields}else{const e=new Set(this._queryParams.outFields),r=[];for(const a of e)t.hasField(a)||r.push(a);if(0===r.length)return null;a.outFields=r}a.returnGeometry=!1,a.returnCentroid=!1,a.quantizationParameters=null,a.cacheHint=!0;const i={inner:a,customParameters:this._customParameters};if(has("esri-tiles-debug")&&null!=r){const e=r.chunkId.toString().replaceAll("/",".");i.customParameters=i.customParameters?{...i.customParameters,chunkId:e}:{chunkId:e}}return i}createQuery(e={}){if(!this._queryParams)throw new Error("InternalError: queryInfo should be defined");return{inner:new i({...this._queryParams,...e}),customParameters:this._customParameters}}createTileQuery(t,r){if(null==this._queryMetadata)throw new Error("InternalError: Service does not support tile queries");const i=this.createQuery(r),s=i.inner;if(this._queryScaleRanges.length){const r=this._queryScaleRanges.filter((e=>(!e.minScale||e.minScale>=t.maxScale)&&(!e.maxScale||e.maxScale<=t.minScale))).map((e=>e.subtypeCode));if(r.length){const t=`${this._subtypeField} IN (${r})`;s.where=e(s.where,t)}}if(this._displayFilter&&(s.where=e(s.where,a(this._displayFilter,t.minScale,t.maxScale))),s.quantizationParameters=r.quantizationParameters??t.getQuantizationParameters(),s.resultType="tile",s.geometry=t.extent,this._queryMetadata.supportsQuantization?"esriGeometryPolyline"===this._geometryType&&(s.maxAllowableOffset=t.resolution*has("feature-polyline-generalization-factor")):"esriGeometryPolyline"!==this._geometryType&&"esriGeometryPolygon"!==this._geometryType||(s.maxAllowableOffset=t.resolution,"esriGeometryPolyline"===this._geometryType&&(s.maxAllowableOffset*=has("feature-polyline-generalization-factor"))),s.defaultSpatialReferenceEnabled=this._queryMetadata.supportsDefaultSpatialReference,s.compactGeometryEnabled=this._queryMetadata.supportsCompactGeometry,this._queryMetadata.supportsMaxRecordCountFactor&&(s.maxRecordCountFactor=o),has("esri-tiles-debug")){const e=t.id.replaceAll("/",".");i.customParameters=i.customParameters?{...i.customParameters,tileId:e}:{tileId:e}}return i}createPagedTileQuery(e,t){const r=this.pageSize;return this.createTileQuery(e,{start:r*t,num:r,returnExceededLimitFeatures:!0})}createPagedQuery(e){const t=this.pageSize;return this.createQuery({start:t*e,num:t,returnExceededLimitFeatures:!0,maxRecordCountFactor:o,cacheHint:!0})}}export{l as FeatureSourceQueryInfo};
5
+ import has from"../../../../../core/has.js";import{sqlAnd as e}from"../../../../../core/sql.js";import t from"../../../../../geometry/SpatialReference.js";import{isHostedAgolService as r}from"../../../../../layers/support/arcgisLayerUrl.js";import{getClauseForScaleRange as a}from"../../../../../layers/support/displayFilterUtils.js";import i from"../../../../../rest/support/Query.js";import s from"../../../../../time/TimeExtent.js";const o=4;function n(e,a,i){const o=e.orderByFields??i.objectIdField+" ASC",n=e.source,l={returnCentroid:!(null!==n&&"object"==typeof n&&"path"in n&&r(n.path))&&"esriGeometryPolygon"===i.serviceGeometryType,returnGeometry:!0,timeReferenceUnknownClient:i.timeReferenceUnknownClient??void 0,outSpatialReference:t.fromJSON(e.outSpatialReference),orderByFields:"memory"===e.type?[]:[o],where:a.mutable.dataFilter.definitionExpression??"1=1",outFields:a.mutable.availableFields,multipatchOption:"esriGeometryMultiPatch"===i.serviceGeometryType?"xyFootprint":null};if("feature"===a.type){const{gdbVersion:e,historicMoment:t,timeExtent:r}=a.mutable.dataFilter;return{...l,gdbVersion:e,historicMoment:t?new Date(t):null,timeExtent:r?s.fromJSON(r):null,outFields:a.mutable.availableFields}}return l}class l{static fromSchema(e,t,r){const a="feature"===t.type?t.mutable.dataFilter.queryScaleRanges:[],i=t.mutable.displayFilter;return new l(n(e,t,r),i,a,r.subtypeField,t.mutable.dataFilter.customParameters,r.geometryType,e.queryMetadata)}constructor(e,t,r,a,i,s,o){this._queryParams=e,this._displayFilter=t,this._queryScaleRanges=r,this._subtypeField=a,this._customParameters=i,this._geometryType=s,this._queryMetadata=o}get pageSize(){if(null==this._queryMetadata)throw new Error("InternalError: Service does not support paged queries");const e=this._queryMetadata.supportsMaxRecordCountFactor?o:null,t=(this._queryMetadata.maxRecordCount??8e3)*(e??1);return Math.min(8e3,t)}updateHistoricMoment(e){this._queryParams.historicMoment=e}updateFields(e){this._queryParams.outFields=e}createPatchFieldsQuery(e,t,r){if(!t.getSize())return null;const a=e.clone();if("*"===this._queryParams.outFields[0]){if("*"===(a.outFields??[])[0])return null;a.outFields=this._queryParams.outFields}else{const e=new Set(this._queryParams.outFields),r=[];for(const a of e)t.hasField(a)||r.push(a);if(0===r.length)return null;a.outFields=r}a.returnGeometry=!1,a.returnCentroid=!1,a.quantizationParameters=null,a.cacheHint=!0;const i={inner:a,customParameters:this._customParameters};if(has("esri-tiles-debug")&&null!=r){const e=r.chunkId.toString().replaceAll("/",".");i.customParameters=i.customParameters?{...i.customParameters,chunkId:e}:{chunkId:e}}return i}createQuery(e={}){if(!this._queryParams)throw new Error("InternalError: queryInfo should be defined");return{inner:new i({...this._queryParams,...e}),customParameters:this._customParameters}}createTileQuery(t,r){if(null==this._queryMetadata)throw new Error("InternalError: Service does not support tile queries");const i=this.createQuery(r),s=i.inner;if(this._queryScaleRanges.length){const r=this._queryScaleRanges.filter((e=>(!e.minScale||e.minScale>=t.maxScale)&&(!e.maxScale||e.maxScale<=t.minScale))).map((e=>e.subtypeCode));if(r.length){const t=`${this._subtypeField} IN (${r})`;s.where=e(s.where,t)}}if(this._displayFilter&&(s.where=e(s.where,a(this._displayFilter,t.minScale,t.maxScale))),s.quantizationParameters=r.quantizationParameters??t.getQuantizationParameters(),s.resultType="tile",s.geometry=t.extent,this._queryMetadata.supportsQuantization?"esriGeometryPolyline"===this._geometryType&&(s.maxAllowableOffset=t.resolution*has("feature-polyline-generalization-factor")):"esriGeometryPolyline"!==this._geometryType&&"esriGeometryPolygon"!==this._geometryType||(s.maxAllowableOffset=t.resolution,"esriGeometryPolyline"===this._geometryType&&(s.maxAllowableOffset*=has("feature-polyline-generalization-factor"))),s.defaultSpatialReferenceEnabled=this._queryMetadata.supportsDefaultSpatialReference,s.compactGeometryEnabled=this._queryMetadata.supportsCompactGeometry,this._queryMetadata.supportsMaxRecordCountFactor&&(s.maxRecordCountFactor=o),has("esri-tiles-debug")){const e=t.id.replaceAll("/",".");i.customParameters=i.customParameters?{...i.customParameters,tileId:e}:{tileId:e}}return i}createPagedTileQuery(e,t){const r=this.pageSize;return this.createTileQuery(e,{start:r*t,num:r,returnExceededLimitFeatures:!0})}createPagedQuery(e){const t=this.pageSize;return this.createQuery({start:t*e,num:t,returnExceededLimitFeatures:!0,maxRecordCountFactor:o,cacheHint:!0})}}export{l as FeatureSourceQueryInfo};
@@ -2,4 +2,4 @@
2
2
  All material copyright ESRI, All Rights Reserved, unless otherwise specified.
3
3
  See https://js.arcgis.com/4.33/esri/copyright.txt for details.
4
4
  */
5
- import{handlesGroup as t}from"../../../../../../core/handleUtils.js";import has from"../../../../../../core/has.js";import{throwIfAborted as e,onAbort as s}from"../../../../../../core/promiseUtils.js";import{ATileLoadStrategy as o}from"./ATileLoadStrategy.js";import{DrillDownTileSourceChunk as r}from"./chunks/DrillDownTileSourceChunk.js";import{FeatureSetReaderJSON as i}from"../../support/FeatureSetReaderJSON.js";class l{constructor(e,o){this.subscription=e,this._tileIdToResult=new Map,this._controller=new AbortController,this._handles=t([s(e.signal,(()=>this._controller.abort())),s(o,(()=>this._controller.abort()))])}destroy(){this._controller.abort(),this._handles.remove()}get(t){return this._tileIdToResult.get(t)}set(t,e){this._tileIdToResult.set(t,e)}get options(){return{signal:this._controller.signal}}}class a extends o{constructor(){super(...arguments),this._loadStates=new Map}destroy(){super.destroy();for(const t of this._loadStates.values())t.destroy();this._loadStates.clear()}get about(){return{willQueryAllFeatures:!1,willQueryFullResolutionGeometry:!1}}async load(t){this._loadStates.has(t.key.id)||this._loadStates.set(t.key.id,new l(t,this._options));const s=this._loadStates.get(t.key.id);let o;try{for await(const o of this._fetchChunkInfos(s,t.tile,0)){const{queryJSON:t,reader:i,sourceTile:l,sourceTileDepth:a,tile:n}=o,h=new r(i,t,n,l,a,!1);e(s.options),this._addChunk(h)}}catch(n){o=n}const a=new r(i.empty(this._metadata),null,t.tile,null,-1,!0);if(this._addChunk(a),o)throw o}unload(t){super.unload(t),this._loadStates.get(t.key.id)?.destroy(),this._loadStates.delete(t.key.id)}async*_fetchChunkInfos(t,e,s){let o=t.get(e.id);const r=!!o;if(o||(o=await this._fetchChunkInfo(t,e,s),t.set(e.id,o)),o.reader.exceededTransferLimit&&s<has("featurelayer-query-max-depth"))for(const i of e.createChildTiles())yield*this._fetchChunkInfos(t,i,s+1);else r||(yield o)}async _fetchChunkInfo(t,e,s){const o=t.subscription.tile.getQuantizationParameters(),r=this._queryInfo.createTileQuery(e,{returnExceededLimitFeatures:!1,quantizationParameters:o});return{reader:await this._fetch(r,t.options,{chunkId:e.id}),queryJSON:r.inner.toJSON(),tile:t.subscription.tile,sourceTile:e,sourceTileDepth:s}}}export{a as DrillDownTileLoadStrategy};
5
+ import{handlesGroup as t}from"../../../../../../core/handleUtils.js";import has from"../../../../../../core/has.js";import{throwIfAborted as e,onAbort as s}from"../../../../../../core/promiseUtils.js";import{ATileLoadStrategy as o}from"./ATileLoadStrategy.js";import{DrillDownTileSourceChunk as r}from"./chunks/DrillDownTileSourceChunk.js";import{FeatureSetReaderJSON as i}from"../../support/FeatureSetReaderJSON.js";class l{constructor(e,o){this.subscription=e,this._tileIdToResult=new Map,this._controller=new AbortController,this._handles=t([s(e.signal,(()=>this._controller.abort())),s(o,(()=>this._controller.abort()))])}destroy(){this._controller.abort(),this._handles.remove()}get(t){return this._tileIdToResult.get(t)}set(t,e){this._tileIdToResult.set(t,e)}get options(){return{signal:this._controller.signal}}}class a extends o{constructor(){super(...arguments),this._loadStates=new Map}destroy(){super.destroy();for(const t of this._loadStates.values())t.destroy();this._loadStates.clear()}get about(){return{supportsDisplayFilter:!0,willQueryAllFeatures:!1,willQueryFullResolutionGeometry:!1}}async load(t){this._loadStates.has(t.key.id)||this._loadStates.set(t.key.id,new l(t,this._options));const s=this._loadStates.get(t.key.id);let o;try{for await(const o of this._fetchChunkInfos(s,t.tile,0)){const{queryJSON:t,reader:i,sourceTile:l,sourceTileDepth:a,tile:n}=o,h=new r(i,t,n,l,a,!1);e(s.options),this._addChunk(h)}}catch(n){o=n}const a=new r(i.empty(this._metadata),null,t.tile,null,-1,!0);if(this._addChunk(a),o)throw o}unload(t){super.unload(t),this._loadStates.get(t.key.id)?.destroy(),this._loadStates.delete(t.key.id)}async*_fetchChunkInfos(t,e,s){let o=t.get(e.id);const r=!!o;if(o||(o=await this._fetchChunkInfo(t,e,s),t.set(e.id,o)),o.reader.exceededTransferLimit&&s<has("featurelayer-query-max-depth"))for(const i of e.createChildTiles())yield*this._fetchChunkInfos(t,i,s+1);else r||(yield o)}async _fetchChunkInfo(t,e,s){const o=t.subscription.tile.getQuantizationParameters(),r=this._queryInfo.createTileQuery(e,{returnExceededLimitFeatures:!1,quantizationParameters:o});return{reader:await this._fetch(r,t.options,{chunkId:e.id}),queryJSON:r.inner.toJSON(),tile:t.subscription.tile,sourceTile:e,sourceTileDepth:s}}}export{a as DrillDownTileLoadStrategy};