@arcgis/core 5.1.0-next.123 → 5.1.0-next.125

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 (96) hide show
  1. package/assets/esri/core/workers/RemoteClient.js +1 -1
  2. package/assets/esri/core/workers/chunks/{1d7e1bbd321d6f99776c.js → 00da56b977a7c61b5c94.js} +1 -1
  3. package/assets/esri/core/workers/chunks/034a5c55ceeb1f85ccba.js +1 -0
  4. package/assets/esri/core/workers/chunks/{a043e8c49ac8e4d1d0a6.js → 100130a80bc151f2e493.js} +1 -1
  5. package/assets/esri/core/workers/chunks/17e68828ca6ff6912d3e.js +1 -0
  6. package/assets/esri/core/workers/chunks/{688fe64be39e9ac35ffd.js → 1c16f3db1c98da8730b9.js} +1 -1
  7. package/assets/esri/core/workers/chunks/1e340536d3c5f94920b5.js +1 -0
  8. package/assets/esri/core/workers/chunks/3c5534c576528c1921d2.js +1 -0
  9. package/assets/esri/core/workers/chunks/41f12eb7c9b7086528d5.js +1 -0
  10. package/assets/esri/core/workers/chunks/{bb867fec068e26bb0c8e.js → 47f65ffcf23713f0fd5c.js} +1 -1
  11. package/assets/esri/core/workers/chunks/{e69d03917e28c8213b27.js → 5bd7ee40a1c469c24013.js} +2 -2
  12. package/assets/esri/core/workers/chunks/629099f05ca5c9ca1973.js +1 -0
  13. package/assets/esri/core/workers/chunks/62f78fa455d556008f6a.js +1 -0
  14. package/assets/esri/core/workers/chunks/{4e293c4006bdc7cc4c08.js → 77214e6081c1c28f1345.js} +1 -1
  15. package/assets/esri/core/workers/chunks/{e16b7ff4bf24fb99f7ea.js → 7c6f4104f5325ce0afbc.js} +1 -1
  16. package/assets/esri/core/workers/chunks/{4894997bfa438f66da36.js → 81808c3aead7dfac3049.js} +1 -1
  17. package/assets/esri/core/workers/chunks/{c357c0a08b99c1e7f290.js → 9331969046f2b277d620.js} +1 -1
  18. package/assets/esri/core/workers/chunks/c9fefb6316c51cbdc61f.js +1 -0
  19. package/assets/esri/core/workers/chunks/cc3e895cff019e811c07.js +1 -0
  20. package/assets/esri/core/workers/chunks/{7cb1afb32ec043e23ec2.js → d63f532dd7d60ee8ef2c.js} +1 -1
  21. package/assets/esri/core/workers/chunks/e2de13810dce01b98520.js +1 -0
  22. package/assets/esri/core/workers/chunks/f25bb204cf6727f6fdef.js +1 -0
  23. package/assets/esri/core/workers/chunks/{aa118c1bcd922b8ac328.js → f274a8e8c7ca4294e876.js} +1 -1
  24. package/assets/esri/core/workers/chunks/f4f642ddd4d5db7cbbb4.js +1 -0
  25. package/assets/esri/core/workers/chunks/f80613cce68dc3df8303.js +2 -0
  26. package/assets/esri/libs/parquet/pkg/bundle_bg.wasm +0 -0
  27. package/chunks/Path.glsl.js +23 -20
  28. package/chunks/bundle2.js +1 -1
  29. package/config.js +1 -1
  30. package/geohash/GeohashCell.js +1 -1
  31. package/kernel.js +1 -1
  32. package/layers/AnnotationLayer.js +1 -1
  33. package/layers/support/arcgisLayers.js +1 -1
  34. package/layers/support/fetchService.js +1 -1
  35. package/package.json +4 -4
  36. package/portal/support/loadUtils.js +1 -1
  37. package/portal/support/portalLayers.js +1 -1
  38. package/renderers/support/types.d.ts +1 -1
  39. package/renderers/visualVariables/RotationVariable.d.ts +1 -16
  40. package/renderers/visualVariables/RotationVariable.js +1 -1
  41. package/support/revision.js +1 -1
  42. package/undoredo/support/ApplySet.js +1 -1
  43. package/undoredo/support/ApplySetItem.js +1 -1
  44. package/views/2d/engine/AFeatureContainer.js +1 -1
  45. package/views/2d/engine/webgl/AttributeStoreView.js +1 -1
  46. package/views/2d/engine/webgl/FeatureTile.js +1 -1
  47. package/views/2d/engine/webgl/cpuMapped/GpuMeshState.js +1 -1
  48. package/views/2d/engine/webgl/mesh/MeshData.js +1 -1
  49. package/views/2d/engine/webgl/shaders/sources/shaderRepository.js +1 -1
  50. package/views/2d/layers/features/FeatureContainer.js +1 -1
  51. package/views/2d/layers/features/Processor.js +1 -1
  52. package/views/2d/layers/features/RenderState.js +1 -1
  53. package/views/2d/layers/features/aggregation/GeohashSpatialIndex.js +1 -1
  54. package/views/2d/layers/features/aggregation/GridCell.js +1 -1
  55. package/views/2d/layers/features/aggregation/GridIndexCell.js +1 -1
  56. package/views/2d/layers/features/aggregation/GridSpatialIndex.js +1 -1
  57. package/views/2d/layers/features/processor/AProcessorStrategy.js +1 -1
  58. package/views/2d/layers/features/processor/BinningStrategy.js +1 -1
  59. package/views/2d/layers/features/processor/ClusterStrategy.js +1 -1
  60. package/views/2d/layers/features/processor/FeatureUpdateStrategy.js +1 -1
  61. package/views/2d/layers/features/processor/TrackStrategy.js +1 -1
  62. package/views/2d/layers/features/sources/strategies/chunks/ByReferenceTileSourceChunk.js +1 -1
  63. package/views/2d/layers/features/sources/strategies/chunks/DrillDownTileSourceChunk.js +1 -1
  64. package/views/2d/layers/features/sources/strategies/chunks/FeatureSnapshotSourceChunk.js +1 -1
  65. package/views/2d/layers/features/sources/strategies/chunks/Overrides.js +1 -1
  66. package/views/2d/layers/features/sources/strategies/chunks/PagedTileSourceChunk.js +1 -1
  67. package/views/2d/layers/features/sources/strategies/chunks/ParquetSnapshotSourceChunk.js +1 -1
  68. package/views/2d/layers/features/sources/strategies/chunks/ParquetSourceChunk.js +1 -1
  69. package/views/2d/layers/features/sources/strategies/chunks/StreamSourceChunk.js +1 -1
  70. package/views/2d/layers/features/support/FeatureSetReaderParquet.js +1 -1
  71. package/views/3d/webgl-engine/materials/Path.glsl.js +1 -1
  72. package/views/3d/webgl-engine/materials/PathMaterial.js +1 -1
  73. package/views/3d/webgl-engine/materials/PathTechnique.js +1 -1
  74. package/views/3d/webgl-engine/materials/PathTechniqueConfiguration.js +1 -1
  75. package/views/3d/webgl-engine/shaders/DefaultMaterialTechnique.js +1 -1
  76. package/widgets/Attachments/support/attachmentUtils.js +1 -1
  77. package/widgets/BatchAttributeForm/BatchAttributeFormViewModel.js +1 -1
  78. package/widgets/BatchAttributeForm/attachmentUtils.js +1 -1
  79. package/widgets/BatchAttributeForm/inputs/AttachmentElementInput.d.ts +2 -0
  80. package/widgets/BatchAttributeForm/inputs/AttachmentElementInput.js +1 -1
  81. package/widgets/BatchAttributeForm.js +1 -1
  82. package/assets/esri/core/workers/chunks/04895de94657e7f3d7e1.js +0 -1
  83. package/assets/esri/core/workers/chunks/2dbc2fd0f2dde505c465.js +0 -1
  84. package/assets/esri/core/workers/chunks/3e65b4b18760bde8ceee.js +0 -1
  85. package/assets/esri/core/workers/chunks/434c1dd3f48e6f0802fc.js +0 -1
  86. package/assets/esri/core/workers/chunks/5500dc39e11a0057ae16.js +0 -1
  87. package/assets/esri/core/workers/chunks/6aabde21b0b376d95888.js +0 -1
  88. package/assets/esri/core/workers/chunks/7f5ecb67fa459f92d067.js +0 -1
  89. package/assets/esri/core/workers/chunks/99e5296192ab98fd0d99.js +0 -1
  90. package/assets/esri/core/workers/chunks/c49c078be08c38a6088d.js +0 -1
  91. package/assets/esri/core/workers/chunks/d13e003c9293cb7e2852.js +0 -1
  92. package/assets/esri/core/workers/chunks/e6a7272b59a4c2e34dca.js +0 -1
  93. package/assets/esri/core/workers/chunks/f69df22a5c64389ebe28.js +0 -1
  94. package/assets/esri/core/workers/chunks/fde12f5b7989c0fac67b.js +0 -2
  95. /package/assets/esri/core/workers/chunks/{e69d03917e28c8213b27.js.LICENSE.txt → 5bd7ee40a1c469c24013.js.LICENSE.txt} +0 -0
  96. /package/assets/esri/core/workers/chunks/{fde12f5b7989c0fac67b.js.LICENSE.txt → f80613cce68dc3df8303.js.LICENSE.txt} +0 -0
@@ -1,2 +1,2 @@
1
1
  /* COPYRIGHT Esri - https://js.arcgis.com/5.1/LICENSE.txt */
2
- import e from"../../../../core/CircularArray.js";import t from"../../../../core/Error.js";import has from"../../../../core/has.js";import i from"../../../../core/Logger.js";import{signal as s}from"../../../../core/signal.js";import{create as r}from"../../../../geometry/support/aaBoundingRect.js";import"../../tiling/TileInfoView.js";import n from"../../tiling/TileKey.js";import"../../tiling/TileQueue.js";import"../../tiling/TileStrategy.js";import{FeatureTile as o}from"../../engine/webgl/FeatureTile.js";const d=1e3;class u{constructor(t,i,r,n,o){this.getStage=t,this.getSubscriptionVersion=i,this.version=r,this._container=n,this._tileInfoView=o,this._pendingUpdates=new e(d),this._locked=!1,this._tiles=new Map,this._updating=s(!1)}destroy(){for(const e of this.tiles())this._fader?.unregisterFeatureTile(e),e.destroy();this._pendingUpdates.clear(),this._tiles.clear(),this._container=null}get _fader(){return this.getStage()?.labelManager.symbolFader}tiles(){return Array.from(this._tiles.values())}size(){return this._tiles.size}get usedMemory(){let e=0;for(const t of this._tiles.values())e+=t.usedMemory;for(const t of this._pendingUpdates.entries)t&&(e+=a(t.inner));return e}get requiresRefresh(){for(const e of this._tiles.values())if(e.requiresRefresh)return!0;return!1}get updating(){return this._updating.value}getTile(e){return this._tiles.get(e)}setTiles(e){this._tiles.clear();for(const t of e)this._tiles.set(t.key.id,t)}lockUploads(){this._locked=!0}unlockUploads(){this._locked=!1}enqueueUpdate(e){this._pendingUpdates.enqueue(e),this._notify()}update(e){if(!this._locked)for(;this._pendingUpdates.size;){const t=this._pendingUpdates.peek();if(null==t||t.inner.attributeEpoch>e)break;this._updateTile(t),this._pendingUpdates.dequeue()}this._notify()}flush(e){for(;this._pendingUpdates.size;){const t=this._pendingUpdates.dequeue();null!=t&&(t.inner.attributeEpoch>e&&console.warn("Tried to flush RenderState, but patch more recent than current",{patchEpoch:t.inner.attributeEpoch,currentEpoch:e}),this._updateTile(t))}this._notify()}removeTile(e){const t=this._tiles.get(e);has("esri-2d-update-debug")&&console.debug(`Tile[${e}] RenderState.removeTile`),t&&(this._fader?.unregisterFeatureTile(t),t.destroy()),this._tiles.delete(e)}_notify(){this._updating.mutate(e=>0!==this._pendingUpdates.size)}_updateTile(e){const{inner:t,objectIdMap:i}=e,s=this.getSubscriptionVersion(t.id);if(s!==t.subscriptionVesrion){if(has("esri-2d-update-debug")){const e=`${t.subscriptionVesrion} != ${s}`;console.debug(`Version[${e}] Tile[${t.id}] FeatureContainer - Dropping message, outdated version]`,t)}return}if(has("esri-2d-update-debug")){const e=t.debugInfo?.chunkId??"<EnsureEnd>";console.debug(`Version[${t.version}] Tile[${t.id}] Chunk[${e}] RenderState.updateTile [${t.type}]`,t)}const r=this._ensureTile(t.id);if("update"===t.type){const[e,...s]=t.modify;r.update({type:"update",modify:e,remove:t.remove,end:t.end,attributeEpoch:t.attributeEpoch,objectIdMap:i});for(const r of s){const e=this._tiles.get(r.tileId);e&&e.update({type:"update",modify:r,remove:t.remove,end:!1,isPixelBuffer:!0,attributeEpoch:null,objectIdMap:i})}return}if(null==t.append)return void r.update({type:"append",debugInfo:t.debugInfo,end:t.end,attributeEpoch:t.attributeEpoch,objectIdMap:i});const[n,...o]=t.append;r.update({type:"append",append:n,debugInfo:t.debugInfo,end:t.end,attributeEpoch:t.attributeEpoch,objectIdMap:i});for(const d of o){const e=this._tiles.get(d.tileId);e&&e.update({type:"update",modify:d,remove:[],sort:!1,end:!1,isPixelBuffer:!0,attributeEpoch:null,objectIdMap:i})}}_ensureTile(e){if(!this._tiles.has(e)){const t=this._createTile(e);this._copyPixelBufferedEntitiesInto(t),this._tiles.set(e,t)}return this._tiles.get(e)}_createTile(e){has("esri-2d-update-debug")&&console.debug(`Version[${this.version}] Tile[${e}] RenderState.createTile`);const s=new n(e),d=this._tileInfoView.getTileBounds(r(),s),u=d[0],a=d[3],l=this._tileInfoView.getTileResolution(s.level),p=this._container.instanceStore.find(20)?.instanceId,c=new o(s,l,u,a,this._fader,p);if(this._fader?.registerFeatureTile(c),c.stage=this.getStage(),!c.stage){const e=new t("featurelayerview:webgl","Cannot create tile with empty stage");i.getLogger("esri.views.2d.layers.features.RenderState").error(e)}return c}_copyPixelBufferedEntitiesInto(e){let t=7;const i=this._tileInfoView.getLODInfoAt(e.key);for(let s=-1;s<=1;s++)for(let r=-1;r<=1;r++){if(0===s&&0===r)continue;const n=e.key.getNormalizedNeighbor(r,s,i).id,o=this._tiles.get(n);if(null!=o){const i=1<<t;e.copyPixelBufferedEntitesFrom(o,i,r,s)}t--}}}function a(e){switch(e.type){case"update":return e.modify.reduce((e,t)=>e+l(t),0);case"append":return e.append?e.append.reduce((e,t)=>e+l(t),0):0}}function l(e){return e.entities.byteLength+e.data.reduce((e,t)=>e+p(t),0)}function p(e){return e.indices.byteLength+e.vertices.byteLength+(e.metrics?.byteLength??0)}export{u as RenderState};
2
+ import e from"../../../../core/CircularArray.js";import t from"../../../../core/Error.js";import has from"../../../../core/has.js";import i from"../../../../core/Logger.js";import{signal as s}from"../../../../core/signal.js";import{create as r}from"../../../../geometry/support/aaBoundingRect.js";import"../../tiling/TileInfoView.js";import n from"../../tiling/TileKey.js";import"../../tiling/TileQueue.js";import"../../tiling/TileStrategy.js";import{FeatureTile as o}from"../../engine/webgl/FeatureTile.js";const d=1e3;class a{constructor(t,i,r,n,o){this.getStage=t,this.getSubscriptionVersion=i,this.version=r,this._container=n,this._tileInfoView=o,this._pendingUpdates=new e(d),this._locked=!1,this._tiles=new Map,this._updating=s(!1)}destroy(){for(const e of this.tiles())this._fader?.unregisterFeatureTile(e),e.destroy();this._pendingUpdates.clear(),this._tiles.clear(),this._container=null}get _fader(){return this.getStage()?.labelManager.symbolFader}tiles(){return Array.from(this._tiles.values())}size(){return this._tiles.size}get usedMemory(){let e=0;for(const t of this._tiles.values())e+=t.usedMemory;for(const t of this._pendingUpdates.entries)t&&(e+=u(t.inner));return e}get requiresRefresh(){for(const e of this._tiles.values())if(e.requiresRefresh)return!0;return!1}get updating(){return this._updating.value}clearLevelCpuState(e){for(const t of this._tiles.values())t.key.level===e&&t.clearCpuState()}getTile(e){return this._tiles.get(e)}setTiles(e){this._tiles.clear();for(const t of e)this._tiles.set(t.key.id,t)}lockUploads(){this._locked=!0}unlockUploads(){this._locked=!1}enqueueUpdate(e){this._pendingUpdates.enqueue(e),this._notify()}update(e){if(!this._locked)for(;this._pendingUpdates.size;){const t=this._pendingUpdates.peek();if(null==t||t.inner.attributeEpoch>e)break;this._updateTile(t),this._pendingUpdates.dequeue()}this._notify()}flush(e){for(;this._pendingUpdates.size;){const t=this._pendingUpdates.dequeue();null!=t&&(t.inner.attributeEpoch>e&&console.warn("Tried to flush RenderState, but patch more recent than current",{patchEpoch:t.inner.attributeEpoch,currentEpoch:e}),this._updateTile(t))}this._notify()}removeTile(e){const t=this._tiles.get(e);has("esri-2d-update-debug")&&console.debug(`Tile[${e}] RenderState.removeTile`),t&&(this._fader?.unregisterFeatureTile(t),t.destroy()),this._tiles.delete(e)}_notify(){this._updating.mutate(e=>0!==this._pendingUpdates.size)}_updateTile(e){const{inner:t,objectIdMap:i}=e,s=this.getSubscriptionVersion(t.id);if(s!==t.subscriptionVesrion){if(has("esri-2d-update-debug")){const e=`${t.subscriptionVesrion} != ${s}`;console.debug(`Version[${e}] Tile[${t.id}] FeatureContainer - Dropping message, outdated version]`,t)}return}if(has("esri-2d-update-debug")){const e=t.debugInfo?.chunkId??"<EnsureEnd>";console.debug(`Version[${t.version}] Tile[${t.id}] Chunk[${e}] RenderState.updateTile [${t.type}]`,t)}const r=this._ensureTile(t.id);if("update"===t.type){const[e,...s]=t.modify;r.update({type:"update",modify:e,remove:t.remove,end:t.end,attributeEpoch:t.attributeEpoch,objectIdMap:i});for(const r of s){const e=this._tiles.get(r.tileId);e&&e.update({type:"update",modify:r,remove:t.remove,end:!1,isPixelBuffer:!0,attributeEpoch:null,objectIdMap:i})}return}if(null==t.append)return void r.update({type:"append",debugInfo:t.debugInfo,end:t.end,attributeEpoch:t.attributeEpoch,objectIdMap:i});const[n,...o]=t.append;r.update({type:"append",append:n,debugInfo:t.debugInfo,end:t.end,attributeEpoch:t.attributeEpoch,objectIdMap:i});for(const d of o){const e=this._tiles.get(d.tileId);e&&e.update({type:"update",modify:d,remove:[],sort:!1,end:!1,isPixelBuffer:!0,attributeEpoch:null,objectIdMap:i})}}_ensureTile(e){if(!this._tiles.has(e)){const t=this._createTile(e);this._copyPixelBufferedEntitiesInto(t),this._tiles.set(e,t)}return this._tiles.get(e)}_createTile(e){has("esri-2d-update-debug")&&console.debug(`Version[${this.version}] Tile[${e}] RenderState.createTile`);const s=new n(e),d=this._tileInfoView.getTileBounds(r(),s),a=d[0],u=d[3],l=this._tileInfoView.getTileResolution(s.level),p=this._container.instanceStore.find(20)?.instanceId,c=new o(s,l,a,u,this._fader,p);if(this._fader?.registerFeatureTile(c),c.stage=this.getStage(),!c.stage){const e=new t("featurelayerview:webgl","Cannot create tile with empty stage");i.getLogger("esri.views.2d.layers.features.RenderState").error(e)}return c}_copyPixelBufferedEntitiesInto(e){let t=7;const i=this._tileInfoView.getLODInfoAt(e.key);for(let s=-1;s<=1;s++)for(let r=-1;r<=1;r++){if(0===s&&0===r)continue;const n=e.key.getNormalizedNeighbor(r,s,i).id,o=this._tiles.get(n);if(null!=o){const i=1<<t;e.copyPixelBufferedEntitesFrom(o,i,r,s)}t--}}}function u(e){switch(e.type){case"update":return e.modify.reduce((e,t)=>e+l(t),0);case"append":return e.append?e.append.reduce((e,t)=>e+l(t),0):0}}function l(e){return e.entities.byteLength+e.data.reduce((e,t)=>e+p(t),0)}function p(e){return e.indices.byteLength+e.vertices.byteLength+(e.metrics?.byteLength??0)}export{a as RenderState};
@@ -1,2 +1,2 @@
1
1
  /* COPYRIGHT Esri - https://js.arcgis.com/5.1/LICENSE.txt */
2
- import{getOrCreateMapValue as e}from"../../../../../core/MapUtils.js";import{GeohashCell as r}from"../../../../../geohash/GeohashCell.js";import{GeohashTree as t}from"../../../../../geohash/GeohashTree.js";import{getGeohash as o,getGeohashBounds as s}from"../../../../../geohash/geohashUtils.js";import{AAggregateSpatialIndex as i}from"./AAggregateSpatialIndex.js";import{createArcadeEvaluationOptions as n}from"../support/arcadeUtils.js";class a extends i{constructor(e,r){super(e),this._reader=r,this._tree=new t,this.insert(this._reader)}get usedMemory(){return this._tree.usedMemory}forEachInCell(e,r){throw new Error("Not supported.")}insert(e){const r=e.getCursor(),{featureFilter:t,sqlOptions:s,geohashLevel:i,spatialReference:n}=this.options.inner;for(;r.next();){const e=r;if(null!==t&&!t.check(e,s))continue;let a=0,h=0;if("esriGeometryPoint"===e.geometryType)a=e.readXWorldSpace(),h=e.readYWorldSpace();else{const r=e.readCentroidWorldSpace();if(null==r)return;[a,h]=r.coords}const d=o(a,h,i,n);d&&this._tree.insert(e,d[0],d[1],i)}}putBounded(t,o,i,a){const{arcadeContextInfo:h,scale:d,geohashLevel:l,spatialReference:c,fields:p}=this.options.inner,f=n(d,h),u=s(i,a,l,c);null!=u&&this._tree.forEachInBounds(u,s=>{let i=null;for(const n of s.indices){this._reader.setIndex(n);const a=this._reader.getObjectId();o.has(a)||(i??=e(t,s.id,()=>r.create(p,s.xNode,s.yNode,s.depth)),i.insert(this._reader,l,c,f),o.add(a))}})}}export{a as GeohashSpatialIndex};
2
+ import{getOrCreateMapValue as e}from"../../../../../core/MapUtils.js";import{GeohashCell as r}from"../../../../../geohash/GeohashCell.js";import{GeohashTree as t}from"../../../../../geohash/GeohashTree.js";import{getGeohash as o,getGeohashBounds as s}from"../../../../../geohash/geohashUtils.js";import{AAggregateSpatialIndex as i}from"./AAggregateSpatialIndex.js";import{createArcadeEvaluationOptions as n}from"../support/arcadeUtils.js";class a extends i{constructor(e,r){super(e),this._reader=r,this._tree=new t,this.insert(this._reader)}get usedMemory(){return this._tree.usedMemory}forEachInCell(e,r){throw new Error("Not supported.")}insert(e){const r=e.getCursor(),{featureFilter:t,sqlOptions:s,geohashLevel:i,spatialReference:n}=this.options.inner;for(;r.next();){const e=r;if(null!==t&&!t.check(e,s))continue;let a=0,h=0;if("esriGeometryPoint"===e.geometryType)a=e.readXWorldSpace(),h=e.readYWorldSpace();else{const r=e.readCentroidWorldSpace();if(null==r)return;[a,h]=r.coords}const d=o(a,h,i,n);d&&this._tree.insert(e,d[0],d[1],i)}}put(e,r){throw new Error("Not supported.")}putBounded(t,o,i,a){const{arcadeContextInfo:h,scale:d,geohashLevel:l,spatialReference:c,fields:p}=this.options.inner,u=n(d,h),f=s(i,a,l,c);null!=f&&this._tree.forEachInBounds(f,s=>{let i=null;for(const n of s.indices){this._reader.setIndex(n);const a=this._reader.getObjectId();o.has(a)||(i??=e(t,s.id,()=>r.create(p,s.xNode,s.yNode,s.depth)),i.insert(this._reader,l,c,u),o.add(a))}})}}export{a as GeohashSpatialIndex};
@@ -1,2 +1,2 @@
1
1
  /* COPYRIGHT Esri - https://js.arcgis.com/5.1/LICENSE.txt */
2
- import{quantizeX as t,quantizeY as e,quantizeOptimizedGeometry as r}from"../../../../../layers/graphics/featureConversionUtils.js";import i from"../../../../../layers/graphics/OptimizedGeometry.js";import{AAggregateCell as s}from"./AAggregateCell.js";import{AccumulatedStatistics as o}from"./AccumulatedStatistics.js";class l extends s{static createId(t,e){return`${t}.${e}`}static create(t,e,r,i){return new l(t,e,o.create(r),i)}constructor(t,e,r,i){super(r),this.gridX=t,this.gridY=e,this._worldUnitsPerCell=i,this._count=0,this._xWorldTotal=0,this._yWorldTotal=0,this._objectIds=new Set}get id(){return l.createId(this.gridX,this.gridY)}get containedObjectIds(){return this._objectIds}get count(){return this._count}get firstObjectId(){return this._objectIds.values().next().value}get centroidXWorld(){return this._xWorldTotal/this._count}get centroidYWorld(){return this._yWorldTotal/this._count}get usedMemory(){return 48}clone(){const t=new l(this.gridX,this.gridY,this._statistics.clone(),this._worldUnitsPerCell);return t._count=this._count,t._xWorldTotal=this._xWorldTotal,t._yWorldTotal=this._yWorldTotal,t._firstFeatureAttributes=this._firstFeatureAttributes,t._objectIds=new Set(this._objectIds),t}insert(t,e){let r=0,i=0;if("esriGeometryPoint"===t.geometryType)r=t.readXWorldSpace(),i=t.readYWorldSpace();else{const e=t.readCentroidWorldSpace();if(null==e)return;[r,i]=e.coords}0===this._count?this._firstFeatureAttributes=t.readAttributes():this._firstFeatureAttributes=null,this._count+=1,this._xWorldTotal+=r,this._yWorldTotal+=i,this._statistics.insert(t,e),this._objectIds.add(t.getObjectId())}merge(t){if(0!==t._count){this._count+=t._count,this._firstFeatureAttributes=t._firstFeatureAttributes,this._xWorldTotal+=t._xWorldTotal,this._yWorldTotal+=t._yWorldTotal,this._statistics.merge(t._statistics);for(const e of t._objectIds.values())this._objectIds.add(e)}}getCentroidX(e){return null==e?this.centroidXWorld:t(e,this.centroidXWorld)}getCentroidY(t){return null==t?this.centroidYWorld:e(t,this.centroidYWorld)}getGeometry(t,e){const s=this.gridX*this._worldUnitsPerCell,o=this.gridY*this._worldUnitsPerCell,l=new i([4],[s,o,s+this._worldUnitsPerCell,o,s+this._worldUnitsPerCell,o+this._worldUnitsPerCell,s,o+this._worldUnitsPerCell]);return null!=e?r(l,"esriGeometryPolygon",e):l}getCentroid(t){const e=new i([],[this.centroidXWorld,this.centroidYWorld]);return null!=t?r(e,"esriGeometryPoint",t):e}getGeometricCentroid(t,e){const s=this.gridX*this._worldUnitsPerCell+.5*this._worldUnitsPerCell,o=this.gridY*this._worldUnitsPerCell+.5*this._worldUnitsPerCell,l=new i([],[s,o]);return null!=e?r(l,"esriGeometryPoint",e):l}getAttributes(){const t={aggregateId:this.id};for(const e of this._statistics.values())t[e.field.name]=e.value;return null!=this._firstFeatureAttributes?{...t,...this._firstFeatureAttributes}:t}}export{l as GridCell};
2
+ import{quantizeX as t,quantizeY as e,quantizeOptimizedGeometry as r}from"../../../../../layers/graphics/featureConversionUtils.js";import i from"../../../../../layers/graphics/OptimizedGeometry.js";import{AAggregateCell as s}from"./AAggregateCell.js";import{AccumulatedStatistics as o}from"./AccumulatedStatistics.js";class l extends s{static createId(t,e){return`${t}.${e}`}static create(t,e,r,i){return new l(t,e,o.create(r),i)}constructor(t,e,r,i){super(r),this.gridX=t,this.gridY=e,this._worldUnitsPerCell=i,this._count=0,this._xWorldTotal=0,this._yWorldTotal=0,this._objectIds=[new Set]}get id(){return l.createId(this.gridX,this.gridY)}get containedObjectIds(){return this._objectIds}get count(){return this._count}get firstObjectId(){return this._objectIds[0].values().next().value}get centroidXWorld(){return this._xWorldTotal/this._count}get centroidYWorld(){return this._yWorldTotal/this._count}get usedMemory(){return 48}clone(){const t=new l(this.gridX,this.gridY,this._statistics.clone(),this._worldUnitsPerCell);return t._count=this._count,t._xWorldTotal=this._xWorldTotal,t._yWorldTotal=this._yWorldTotal,t._firstFeatureAttributes=this._firstFeatureAttributes,t._objectIds=this._objectIds.map(t=>new Set(t)),t}insert(t,e){let r=0,i=0;if("esriGeometryPoint"===t.geometryType)r=t.readXWorldSpace(),i=t.readYWorldSpace();else{const e=t.readCentroidWorldSpace();if(null==e)return;[r,i]=e.coords}0===this._count?this._firstFeatureAttributes=t.readAttributes():this._firstFeatureAttributes=null,this._count+=1,this._xWorldTotal+=r,this._yWorldTotal+=i,this._statistics.insert(t,e),this._objectIds[0].add(t.getObjectId())}merge(t){0!==t._count&&(this._count+=t._count,this._firstFeatureAttributes=t._firstFeatureAttributes,this._xWorldTotal+=t._xWorldTotal,this._yWorldTotal+=t._yWorldTotal,this._statistics.merge(t._statistics),this._objectIds.push(...t._objectIds))}getCentroidX(e){return null==e?this.centroidXWorld:t(e,this.centroidXWorld)}getCentroidY(t){return null==t?this.centroidYWorld:e(t,this.centroidYWorld)}getGeometry(t,e){const s=this.gridX*this._worldUnitsPerCell,o=this.gridY*this._worldUnitsPerCell,l=new i([4],[s,o,s+this._worldUnitsPerCell,o,s+this._worldUnitsPerCell,o+this._worldUnitsPerCell,s,o+this._worldUnitsPerCell]);return null!=e?r(l,"esriGeometryPolygon",e):l}getCentroid(t){const e=new i([],[this.centroidXWorld,this.centroidYWorld]);return null!=t?r(e,"esriGeometryPoint",t):e}getGeometricCentroid(t,e){const s=this.gridX*this._worldUnitsPerCell+.5*this._worldUnitsPerCell,o=this.gridY*this._worldUnitsPerCell+.5*this._worldUnitsPerCell,l=new i([],[s,o]);return null!=e?r(l,"esriGeometryPoint",e):l}getAttributes(){const t={aggregateId:this.id};for(const e of this._statistics.values())t[e.field.name]=e.value;return null!=this._firstFeatureAttributes?{...t,...this._firstFeatureAttributes}:t}}export{l as GridCell};
@@ -1,2 +1,2 @@
1
1
  /* COPYRIGHT Esri - https://js.arcgis.com/5.1/LICENSE.txt */
2
- class s{static createId(s,t){return`${s}.${t}`}constructor(t,i){this._indices=[],this.id=s.createId(t,i)}push(s){this._indices.push(s)}}export{s as GridIndexCell};
2
+ class i{static createId(i,s){return`${i}.${s}`}constructor(s,t){this.gridX=s,this.gridY=t,this._indices=[],this.id=i.createId(s,t)}push(i){this._indices.push(i)}}export{i as GridIndexCell};
@@ -1,2 +1,2 @@
1
1
  /* COPYRIGHT Esri - https://js.arcgis.com/5.1/LICENSE.txt */
2
- import{getOrCreateMapValue as e}from"../../../../../core/MapUtils.js";import{getMetersPerUnitForSR as t,inchesPerMeter as r}from"../../../../../core/units.js";import{AAggregateSpatialIndex as i}from"./AAggregateSpatialIndex.js";import{GridCell as s}from"./GridCell.js";import{GridIndexCell as n}from"./GridIndexCell.js";import{createArcadeEvaluationOptions as o}from"../support/arcadeUtils.js";const l=96;function a(e,i){return t(e)*r*l/i}class c extends i{constructor(e,t){super(e),this._reader=t,this._cells=new Map,this._pixelsPerMapUnit=a(e.inner.spatialReference,e.inner.scale),this.insert(this._reader)}get worldUnitsPerCell(){return 1*this.options.inner.cellSize/this._pixelsPerMapUnit}insert(e){const t=e.getCursor();for(;t.next();){const e=t,{featureFilter:r,sqlOptions:i,cellSize:s}=this.options.inner;if(null!==r&&!r.check(e,i))continue;let n=0,o=0;if("esriGeometryPoint"===e.geometryType)n=e.readXWorldSpace(),o=e.readYWorldSpace();else{const t=e.readCentroidWorldSpace();if(null==t)return;[n,o]=t.coords}const l=n*this._pixelsPerMapUnit,a=o*this._pixelsPerMapUnit,c=Math.floor(l/s),p=Math.floor(a/s);this._getCellOrCreate(c,p).push(t.getIndex())}}get usedMemory(){return 0}forEachInCell(e,t){const r=this._cells.get(e);if(r)for(const i of r._indices)this._reader.setIndex(i),t(this._reader)}putBounded(t,r,i,n){const{arcadeContextInfo:l,scale:a,cellSize:c,fields:p}=this.options.inner,d=o(a,l),h=[i.xmin,i.ymin,i.xmax,i.ymax],[f,_,u,x]=h,m=Math.floor(f*this._pixelsPerMapUnit/c),M=Math.floor(_*this._pixelsPerMapUnit/c),g=Math.ceil(u*this._pixelsPerMapUnit/c),C=Math.ceil(x*this._pixelsPerMapUnit/c);for(let o=M;o<=C;o++)for(let i=m;i<=g;i++){const n=s.createId(i,o),l=this._cells.get(n);if(!l)continue;let a=null;for(const c of l._indices){this._reader.setIndex(c);const n=this._reader.getObjectId();r.has(n)||(a??=e(t,l.id,()=>s.create(i,o,p,this.worldUnitsPerCell)),a.insert(this._reader,d),r.add(n))}}}_getCellOrCreate(e,t){const r=n.createId(e,t);let i=this._cells.get(r);return i||(i=new n(e,t),this._cells.set(r,i)),i}}export{c as GridSpatialIndex,a as pixelsPerMapUnit};
2
+ import{getOrCreateMapValue as e}from"../../../../../core/MapUtils.js";import{getMetersPerUnitForSR as t,inchesPerMeter as r}from"../../../../../core/units.js";import{AAggregateSpatialIndex as i}from"./AAggregateSpatialIndex.js";import{GridCell as s}from"./GridCell.js";import{GridIndexCell as n}from"./GridIndexCell.js";import{createArcadeEvaluationOptions as o}from"../support/arcadeUtils.js";const l=96;function a(e,i){return t(e)*r*l/i}class c extends i{constructor(e,t){super(e),this._reader=t,this._cells=new Map,this._pixelsPerMapUnit=a(e.inner.spatialReference,e.inner.scale),this.insert(this._reader)}get worldUnitsPerCell(){return 1*this.options.inner.cellSize/this._pixelsPerMapUnit}insert(e){const t=e.getCursor();for(;t.next();){const e=t,{featureFilter:r,sqlOptions:i,cellSize:s}=this.options.inner;if(null!==r&&!r.check(e,i))continue;let n=0,o=0;if("esriGeometryPoint"===e.geometryType)n=e.readXWorldSpace(),o=e.readYWorldSpace();else{const t=e.readCentroidWorldSpace();if(null==t)return;[n,o]=t.coords}const l=n*this._pixelsPerMapUnit,a=o*this._pixelsPerMapUnit,c=Math.floor(l/s),d=Math.floor(a/s);this._getCellOrCreate(c,d).push(t.getIndex())}}get usedMemory(){return 0}forEachInCell(e,t){const r=this._cells.get(e);if(r)for(const i of r._indices)this._reader.setIndex(i),t(this._reader)}put(t,r){const{arcadeContextInfo:i,scale:n,fields:l}=this.options.inner,a=o(n,i);this._cells.forEach(i=>{let n=null;for(const o of i._indices){this._reader.setIndex(o);const c=this._reader.getObjectId();r.has(c)||(n??=e(t,i.id,()=>s.create(i.gridX,i.gridY,l,this.worldUnitsPerCell)),n.insert(this._reader,a),r.add(c))}})}putBounded(t,r,i,n){const{arcadeContextInfo:l,scale:a,cellSize:c,fields:d}=this.options.inner,h=o(a,l),p=[i.xmin,i.ymin,i.xmax,i.ymax],[f,_,u,x]=p,m=Math.floor(f*this._pixelsPerMapUnit/c),g=Math.floor(_*this._pixelsPerMapUnit/c),M=Math.ceil(u*this._pixelsPerMapUnit/c),C=Math.ceil(x*this._pixelsPerMapUnit/c);for(let o=g;o<=C;o++)for(let i=m;i<=M;i++){const n=s.createId(i,o),l=this._cells.get(n);if(!l)continue;let a=null;for(const c of l._indices){this._reader.setIndex(c);const n=this._reader.getObjectId();r.has(n)||(a??=e(t,l.id,()=>s.create(i,o,d,this.worldUnitsPerCell)),a.insert(this._reader,h),r.add(n))}}}_getCellOrCreate(e,t){const r=n.createId(e,t);let i=this._cells.get(r);return i||(i=new n(e,t),this._cells.set(r,i)),i}}export{c as GridSpatialIndex,a as pixelsPerMapUnit};
@@ -1,2 +1,2 @@
1
1
  /* COPYRIGHT Esri - https://js.arcgis.com/5.1/LICENSE.txt */
2
- import has from"../../../../../core/has.js";class e{constructor(e){this.subscription=e,this.handledChunks=new Set,has("esri-2d-update-debug")&&console.debug(`Tile[${e.tile.id}] ASendState.create`)}destroy(){}}class t{constructor(e,t,s){this._source=e,this._attributeStore=t,this._sqlOptions=s,this._sendStates=new Map}destroy(){}get enablePixelBuffering(){return!0}get isAggregate(){return!1}get usedMemory(){return 0}onSubscribe(e){const t=this.createState(e);this._sendStates.set(e.key.id,t)}onUnsubscribe(e){this._sendStates.get(e.key.id)?.destroy(),this._sendStates.delete(e.key.id)}get hasSubscribers(){return this._sendStates.size>0}requiresInvalidation(e){return!1}invalidate(){const e=Array.from(this._sendStates.values());this._sendStates.clear();for(const t of e)t.destroy(),this.onSubscribe(t.subscription)}invalidateAttributeData(e){}hasArcadeDependency(e){return!1}getFeatureObjectIdsForAggregate(e){throw new Error("InternalError: AggregateId lookup not supported")}getDisplayIds(e){return this.displayMap(e,e=>e,e=>e)}getDisplayAndObjectIds(e){return this.displayMap(e,e=>e,(e,t,s)=>[e,s])}afterUpdateChunks(){}}export{t as AProcessorStrategy,e as ASendState};
2
+ import has from"../../../../../core/has.js";class e{constructor(e){this.subscription=e,this.handledChunks=new Set,has("esri-2d-update-debug")&&console.debug(`Tile[${e.tile.id}] ASendState.create`)}destroy(){}}class t{constructor(){this.type="append",this.messages=[]}}class s{constructor(){this.type="update",this.messages=[]}}class r{constructor(e){this.level=e,this.type="level-replace",this.messages=[]}}class i{constructor(e,t,s){this._source=e,this._attributeStore=t,this._sqlOptions=s,this._sendStates=new Map}destroy(){}get enablePixelBuffering(){return!0}get isAggregate(){return!1}get usedMemory(){return 0}onSubscribe(e){const t=this.createState(e);this._sendStates.set(e.key.id,t)}onUnsubscribe(e){this._sendStates.get(e.key.id)?.destroy(),this._sendStates.delete(e.key.id)}get hasSubscribers(){return this._sendStates.size>0}requiresInvalidation(e){return!1}invalidate(){const e=Array.from(this._sendStates.values());this._sendStates.clear();for(const t of e)t.destroy(),this.onSubscribe(t.subscription)}invalidateAttributeData(e){}hasArcadeDependency(e){return!1}getFeatureObjectIdsForAggregate(e){throw new Error("InternalError: AggregateId lookup not supported")}getDisplayIds(e){return this.displayMap(e,e=>e,e=>e)}getDisplayAndObjectIds(e){return this.displayMap(e,e=>e,(e,t,s)=>[e,s])}afterUpdateChunks(){}}export{i as AProcessorStrategy,e as ASendState,t as AppendBatch,r as LevelReplaceBatch,s as UpdateBatch};
@@ -1,2 +1,2 @@
1
1
  /* COPYRIGHT Esri - https://js.arcgis.com/5.1/LICENSE.txt */
2
- import{equals as e}from"../../../../../core/SetUtils.js";import t from"../../../../../geometry/SpatialReference.js";import{convertToFeature as s,unquantizeOptimizedGeometryInPlace as a}from"../../../../../layers/graphics/featureConversionUtils.js";import{OptimizedFeature as r}from"../../../../../layers/graphics/OptimizedFeature.js";import{checkProjectionSupport as i}from"../../../../../layers/graphics/data/projectionSupport.js";import o from"../../../../../layers/support/FieldsIndex.js";import{ComputedAggregateField as n}from"../aggregation/ComputedAggregateField.js";import{AAggregateStrategy as l}from"./AAggregateStrategy.js";import{ASendState as d}from"./AProcessorStrategy.js";import{FeatureTileUpdateMessage as c}from"../sources/FeatureSourceMessage.js";import{ComputedAttributeStorage as f}from"../support/ComputedAttributeStorage.js";import u from"../support/FeatureFilterEvaluator.js";import{FeatureMetadata as p}from"../support/FeatureMetadata.js";import{FeatureSetReaderJSON as h}from"../support/FeatureSetReaderJSON.js";import{Hashed as m}from"../support/Hashed.js";class g extends d{constructor(e,t){super(e),this.bins=new Map,this.featureCache=new Map,this.done=!1,this._store=t}take(){const e=this.bins,t=this.featureCache;return this.bins=new Map,this.featureCache=new Map,{bins:e,featureCache:t}}destroy(){const e=this.subscription.tile.key.level;for(const t of this.featureCache.keys())this._store.releaseDisplayIdForObjectId(`${t}.${e}`);this.bins.clear(),this.featureCache.clear(),this.handledChunks.clear()}get tile(){return this.subscription.tile}*featuresWorldSpace(){for(const e of this.featureCache.values()){const t=e.clone();t.geometry&&a(t.geometry,this.subscription.tile.transform),yield t}}}class y extends l{static async create(e,s,a,r,o){const l=s.metadata.outSpatialReference,d=new f({spatialReference:l}),c=await Promise.all(e.fields.map(async e=>n.create(d,e))),p=e.featureFilter?await u.create({geometryType:s.metadata.geometryType,hasM:!1,hasZ:!1,timeInfo:s.metadata.timeInfo,fieldsIndex:s.metadata.fieldsIndex,spatialReference:l,filterJSON:e.featureFilter}):null;return"geohash"===e.index.type&&await i(l,t.WGS84),new y(e,p,r,c,l,s,a,o)}constructor(e,t,s,a,r,i,n,l){super(i,n,r,a,l),this._schema=e,this._featureFilter=t,this._arcadeContextInfo=s,this._handled=new Set,this._invalidated=!1,this._metadata=p.createFeature({geometryType:"esriGeometryPolygon",hasZ:!1,hasM:!1,featureIdInfo:{type:"object-id",fieldName:"aggregateId"},fieldsIndex:new o(e.fields).toJSON(),globalIdField:null,spatialReference:i.metadata.spatialReference,outSpatialReference:i.metadata.outSpatialReference,subtypeField:null,subtypes:null,timeInfo:null,timeReferenceUnknownClient:null,dateFieldsTimeZone:null,typeIdField:null,types:null}),this._getIndex=this._createGetIndex()}requiresInvalidation(t){for(const e of this._sendStates.values())if(!e.done)return!0;const s=new Set;for(const e of t)s.add(e.chunkId);return!e(s,this._handled)&&(this._handled=s,!0)}invalidate(){this._invalidated=!0}createState(e){return new g(e,this._attributeStore)}async*applyOverrideUpdate(e){}displayMap(e,t,s){const a=new Map(e.map(e=>[t(e),e])),r=[];for(const i of this._sendStates.values())for(const e of i.featuresWorldSpace()){const{objectId:t,displayId:i}=e,o=a.get(t);if(null!=o){const e=s(i,o,t);r.push(e),a.delete(t)}}return r}getDisplayFeatures(e){const t=new Set(e),a=new Set,r=[];for(const i of this._sendStates.values())for(const e of i.featuresWorldSpace())t.has(e.displayId)&&!a.has(e.objectId)&&(e.geometry&&r.push({...s(e,this._metadata.geometryType,!1,!1),displayId:e.displayId}),a.add(e.objectId));return{features:[],aggregates:r,tracks:[]}}getFeatureObjectIdsForAggregate(e){for(const t of this._sendStates.values())for(const s of t.bins.values())if(s.id===e)return Array.from(s.containedObjectIds);return[]}async*updateChunks(e,t){if(this._invalidated){this._invalidated=!1;for(const s of this._sendStates.values())yield*this._update(s,e,t)}}forEachAggregateWorldSpace(e){const t=new Set;for(const s of this._sendStates.values())for(const a of s.featuresWorldSpace())t.has(a.objectId)||(e(a),t.add(a.objectId))}_createGetIndex(){return(e,t)=>{switch(this._schema.index.type){case"geohash":return e.getGeohashIndex(new m({type:"geohash",fields:this.aggregateFields,featureFilter:this._featureFilter,geohashLevel:this._schema.index.fixBinLevel,spatialReference:this.spatialReference,arcadeContextInfo:this._arcadeContextInfo,scale:t.scale,sqlOptions:this._sqlOptions}));case"grid":{const s=this._schema.index.fixedBinLevel,a=null!=s?t.tileInfoView.getLODInfoAt(s).scale:t.scale;return e.getGridIndex(new m({type:"grid",fields:this.aggregateFields,cellSize:this._schema.index.size,featureFilter:this._featureFilter,spatialReference:this.spatialReference,arcadeContextInfo:this._arcadeContextInfo,scale:a,sqlOptions:this._sqlOptions}))}}}}async*_update(e,t,s){const{subscription:a}=e,i=e.take(),{bins:o,featureCache:n}=e,l=a.tile,d=new Set;for(const r of t){this._getIndex(r,l).putBounded(o,d,e.tile.extent,e.tile.resolution)}const f=[],u=a.tile.transform,p=a.tile.key.level;for(const c of o.values()){const e=c.getGeometry(this.spatialReference,u),t=new r(e,c.getAttributes(),null,c.id);e||(t.centroid=c.getGeometricCentroid(this.spatialReference,u)),t.displayId=this._attributeStore.createDisplayIdForObjectId(`${t.objectId}.${p}`),n.set(c.id,t),f.push(t)}this.events.emit("changed"),e.done||=!s;const m=h.fromOptimizedFeatures(f,this._metadata,u),g=m.getCursor(),y=e.subscription.tile.createArcadeEvaluationOptions(this._arcadeContextInfo);for(;g.next();)this._attributeStore.setAttributeData(g.getDisplayId(),g,y,this._sqlOptions);const I=new c(e.subscription,m,[],e.done,{});for(const r of i.featureCache.keys())this._attributeStore.releaseDisplayIdForObjectId(`${r}.${p}`);yield I}}export{g as BinningState,y as BinningStrategy};
2
+ import{equals as e}from"../../../../../core/SetUtils.js";import t from"../../../../../geometry/SpatialReference.js";import{convertToFeature as s,unquantizeOptimizedGeometryInPlace as a}from"../../../../../layers/graphics/featureConversionUtils.js";import{OptimizedFeature as r}from"../../../../../layers/graphics/OptimizedFeature.js";import{checkProjectionSupport as i}from"../../../../../layers/graphics/data/projectionSupport.js";import o from"../../../../../layers/support/FieldsIndex.js";import{ComputedAggregateField as n}from"../aggregation/ComputedAggregateField.js";import{AAggregateStrategy as l}from"./AAggregateStrategy.js";import{UpdateBatch as d,ASendState as c}from"./AProcessorStrategy.js";import{FeatureTileUpdateMessage as u}from"../sources/FeatureSourceMessage.js";import{ComputedAttributeStorage as f}from"../support/ComputedAttributeStorage.js";import p from"../support/FeatureFilterEvaluator.js";import{FeatureMetadata as h}from"../support/FeatureMetadata.js";import{FeatureSetReaderJSON as m}from"../support/FeatureSetReaderJSON.js";import{Hashed as g}from"../support/Hashed.js";class y extends c{constructor(e,t){super(e),this.bins=new Map,this.featureCache=new Map,this.done=!1,this._store=t}take(){const e=this.bins,t=this.featureCache;return this.bins=new Map,this.featureCache=new Map,{bins:e,featureCache:t}}destroy(){const e=this.subscription.tile.key.level;for(const t of this.featureCache.keys())this._store.releaseDisplayIdForObjectId(`${t}.${e}`);this.bins.clear(),this.featureCache.clear(),this.handledChunks.clear()}get tile(){return this.subscription.tile}*featuresWorldSpace(){for(const e of this.featureCache.values()){const t=e.clone();t.geometry&&a(t.geometry,this.subscription.tile.transform),yield t}}}class I extends l{static async create(e,s,a,r,o){const l=s.metadata.outSpatialReference,d=new f({spatialReference:l}),c=await Promise.all(e.fields.map(async e=>n.create(d,e))),u=e.featureFilter?await p.create({geometryType:s.metadata.geometryType,hasM:!1,hasZ:!1,timeInfo:s.metadata.timeInfo,fieldsIndex:s.metadata.fieldsIndex,spatialReference:l,filterJSON:e.featureFilter}):null;return"geohash"===e.index.type&&await i(l,t.WGS84),new I(e,u,r,c,l,s,a,o)}constructor(e,t,s,a,r,i,n,l){super(i,n,r,a,l),this._schema=e,this._featureFilter=t,this._arcadeContextInfo=s,this._handled=new Set,this._invalidated=!1,this._metadata=h.createFeature({geometryType:"esriGeometryPolygon",hasZ:!1,hasM:!1,featureIdInfo:{type:"object-id",fieldName:"aggregateId"},fieldsIndex:new o(e.fields).toJSON(),globalIdField:null,spatialReference:i.metadata.spatialReference,outSpatialReference:i.metadata.outSpatialReference,subtypeField:null,subtypes:null,timeInfo:null,timeReferenceUnknownClient:null,dateFieldsTimeZone:null,typeIdField:null,types:null}),this._getIndex=this._createGetIndex()}requiresInvalidation(t){for(const e of this._sendStates.values())if(!e.done)return!0;const s=new Set;for(const e of t)s.add(e.chunkId);return!e(s,this._handled)&&(this._handled=s,!0)}invalidate(){this._invalidated=!0}createState(e){return new y(e,this._attributeStore)}async applyOverrideUpdate(e){return null}displayMap(e,t,s){const a=new Map(e.map(e=>[t(e),e])),r=[];for(const i of this._sendStates.values())for(const e of i.featuresWorldSpace()){const{objectId:t,displayId:i}=e,o=a.get(t);if(null!=o){const e=s(i,o,t);r.push(e),a.delete(t)}}return r}getDisplayFeatures(e){const t=new Set(e),a=new Set,r=[];for(const i of this._sendStates.values())for(const e of i.featuresWorldSpace())t.has(e.displayId)&&!a.has(e.objectId)&&(e.geometry&&r.push({...s(e,this._metadata.geometryType,!1,!1),displayId:e.displayId}),a.add(e.objectId));return{features:[],aggregates:r,tracks:[]}}getFeatureObjectIdsForAggregate(e){for(const t of this._sendStates.values())for(const s of t.bins.values())if(s.id===e){const e=[];for(const t of s.containedObjectIds)for(const s of t.values())e.push(s);return e}return[]}async updateChunks(e,t){if(!this._invalidated)return null;this._invalidated=!1;const s=new d;for(const a of this._sendStates.values())s.messages.push(this._update(a,e,t));return s}forEachAggregateWorldSpace(e){const t=new Set;for(const s of this._sendStates.values())for(const a of s.featuresWorldSpace())t.has(a.objectId)||(e(a),t.add(a.objectId))}_createGetIndex(){return(e,t)=>{switch(this._schema.index.type){case"geohash":return e.getGeohashIndex(new g({type:"geohash",fields:this.aggregateFields,featureFilter:this._featureFilter,geohashLevel:this._schema.index.fixBinLevel,spatialReference:this.spatialReference,arcadeContextInfo:this._arcadeContextInfo,scale:t.scale,sqlOptions:this._sqlOptions}));case"grid":{const s=this._schema.index.fixedBinLevel,a=null!=s?t.tileInfoView.getLODInfoAt(s).scale:t.scale;return e.getGridIndex(new g({type:"grid",fields:this.aggregateFields,cellSize:this._schema.index.size,featureFilter:this._featureFilter,spatialReference:this.spatialReference,arcadeContextInfo:this._arcadeContextInfo,scale:a,sqlOptions:this._sqlOptions}))}}}}_update(e,t,s){const{subscription:a}=e,i=e.take(),{bins:o,featureCache:n}=e,l=a.tile,d=new Set;for(const r of t){this._getIndex(r,l).putBounded(o,d,e.tile.extent,e.tile.resolution)}const c=[],f=a.tile.transform,p=a.tile.key.level;for(const u of o.values()){const e=u.getGeometry(this.spatialReference,f),t=new r(e,u.getAttributes(),null,u.id);e||(t.centroid=u.getGeometricCentroid(this.spatialReference,f)),t.displayId=this._attributeStore.createDisplayIdForObjectId(`${t.objectId}.${p}`),n.set(u.id,t),c.push(t)}this.events.emit("changed"),e.done||=!s;const h=m.fromOptimizedFeatures(c,this._metadata,f),g=h.getCursor(),y=e.subscription.tile.createArcadeEvaluationOptions(this._arcadeContextInfo);for(;g.next();)this._attributeStore.setAttributeData(g.getDisplayId(),g,y,this._sqlOptions);const I=new u(e.subscription,h,[],e.done,{});for(const r of i.featureCache.keys())this._attributeStore.releaseDisplayIdForObjectId(`${r}.${p}`);return I}}export{y as BinningState,I as BinningStrategy};
@@ -1,2 +1,2 @@
1
1
  /* COPYRIGHT Esri - https://js.arcgis.com/5.1/LICENSE.txt */
2
- import has from"../../../../../core/has.js";import{getOrCreateMapValue as e}from"../../../../../core/MapUtils.js";import{equals as t}from"../../../../../core/SetUtils.js";import{convertToFeature as s}from"../../../../../layers/graphics/featureConversionUtils.js";import{OptimizedFeature as i}from"../../../../../layers/graphics/OptimizedFeature.js";import r from"../../../../../layers/graphics/OptimizedGeometry.js";import a from"../../../../../layers/support/FieldsIndex.js";import{tileSize as n}from"../../../engine/webgl/definitions.js";import{ComputedAggregateField as l}from"../aggregation/ComputedAggregateField.js";import{GridCell as o}from"../aggregation/GridCell.js";import{GridIndexCell as d}from"../aggregation/GridIndexCell.js";import{pixelsPerMapUnit as c}from"../aggregation/GridSpatialIndex.js";import{AAggregateStrategy as u}from"./AAggregateStrategy.js";import{ASendState as p}from"./AProcessorStrategy.js";import{WithDisplayId as f}from"./support/WithDisplayId.js";import{FeatureTileAppendMessage as h}from"../sources/FeatureSourceMessage.js";import{createArcadeEvaluationOptions as g}from"../support/arcadeUtils.js";import{ComputedAttributeStorage as m}from"../support/ComputedAttributeStorage.js";import _ from"../support/FeatureFilterEvaluator.js";import{FeatureMetadata as y}from"../support/FeatureMetadata.js";import{FeatureSetReaderJSON as x}from"../support/FeatureSetReaderJSON.js";import{Hashed as S}from"../support/Hashed.js";const I=128;class M extends p{constructor(e){super(e),this.didSend=!1,this.done=!1}}class v{constructor(e,t,s,i,r){this.level=e,this._scale=t,this._indexOptions=s,this._clusterRadius=i,this._store=r,this._statistics=new Map,this._clusters=new Map}destroy(){this._clearClusters()}_clearClusters(){for(const e of this._clusters.values())this._store.releaseDisplayIdForObjectId(e.inner.id);this._clusters.clear()}*aggregatesWorldSpace(){for(const e of this._clusters.values()){const t=e.inner.getCentroid(null),s=new i(t,e.inner.getAttributes(),null,e.inner.id,e.displayId);yield s}}clusters(){return this._clusters.values()}updateChunks(e,t){const s={xMin:1/0,yMin:1/0,xMax:-1/0,yMax:-1/0},i=c(this._indexOptions.spatialReference,this._scale),r=this._indexOptions.cellSize;for(const{subscription:a}of t){const e=a.tile.bounds,t=Math.floor(e[0]*i/r),n=Math.floor(e[1]*i/r),l=Math.ceil(e[2]*i/r),o=Math.ceil(e[3]*i/r);s.xMin=Math.min(s.xMin,t),s.yMin=Math.min(s.yMin,n),s.xMax=Math.max(s.xMax,l),s.yMax=Math.max(s.yMax,o)}null!=this._lastCellBounds&&s.xMin===this._lastCellBounds.xMin&&s.yMin===this._lastCellBounds.yMin&&s.yMin===this._lastCellBounds.yMin&&s.yMax===this._lastCellBounds.yMax||(this._lastCellBounds=s),this._clusterCells(e,s)}async updateStatistics(e){let t=!1;for(const s of this._clusters.values())s.inner.count>1&&(t=this._updateAggregateStatistics(this._statistics,s.inner)||t);if(t){const t=Array.from(this._statistics.entries()).map(([e,t])=>({fieldName:e,minValue:t.minValue,maxValue:t.maxValue}));await e.container.updateStatistics(this.level,t)}}createAggregateFeatures(e,t){const s=e.subscription,a=[],l=s.tile.transform,o=Array.from(this._clusters.values()),d=o.length;for(const u of o){const e=u.inner.getCentroidX(l),t=u.inner.getCentroidY(l),s=1===u.inner.count?u.inner.firstObjectId:u.inner.id,o=u.displayId;if(e<n+I&&e>=-I&&t<n+I&&t>=-I){const n=new r([],[e,t]),l=new i(n,u.inner.getAttributes(),null,s,o);a.push(l)}}const c=x.fromOptimizedFeatures(a,t,s.tile.transform);return has("esri-2d-update-debug")&&console.debug(`Tile[${e.subscription.tile.id}] ClusterStrategy.createAggregateFeatures`,{clusters:c,levelClusterCount:d}),c}_clusterCells(t,s){this._clearClusters();const i=this._clusterRadius*(1/c(this._indexOptions.spatialReference,this._scale)),{arcadeContextInfo:r}=this._indexOptions,a=g(this._scale,r),n=new S({...this._indexOptions,scale:this._scale}),l=new Set,u=new Map;for(let c=s.yMin;c<=s.yMax;c++)for(let i=s.xMin;i<=s.xMax;i++){const s=d.createId(i,c),r=o.createId(i,c);for(const d of t){const t=d.getGridIndex(n);t.forEachInCell(s,s=>{const n=s.getObjectId();if(l.has(n))return;l.add(n);e(u,r,()=>o.create(i,c,this._indexOptions.fields,t.worldUnitsPerCell)).insert(s,a)})}}let p=Array.from(u.values());p=p.sort((e,t)=>t.count-e.count);const h=new Set;for(const e of p){if(h.has(e.id))continue;if(e.gridX<s.xMin||e.gridX>s.xMax||e.gridY<s.yMin||e.gridY>s.yMax)continue;const t=1+this._clusterRadius/this._indexOptions.cellSize,r=this._store.createDisplayIdForObjectId(e.id),a=new f(e.clone(),r);h.add(e.id),this._clusters.set(e.id,a);const n=e.centroidXWorld,l=e.centroidYWorld;for(let s=e.gridY-t;s<=e.gridY+t;s++)for(let r=e.gridX-t;r<=e.gridX+t;r++){if(s===e.gridY&&r===e.gridX)continue;const t=u.get(o.createId(r,s));if(!t||h.has(t.id))continue;const d=Math.abs(t.centroidXWorld-n),c=Math.abs(t.centroidYWorld-l);d<i&&c<i&&(a.inner.merge(t),h.add(t.id))}}}_updateAggregateStatistics(e,t){let s=!1;for(const i of t.statistics.values()){if("esriFieldTypeString"===i.field.type)continue;const t=i.value,r=i.field,a=e.get(r.name);if(a){const{minValue:e,maxValue:i}=a,r=Math.min(a.minValue,t),n=Math.max(a.maxValue,t);e===r&&i===n||(a.minValue=r,a.maxValue=n,s=!0);continue}e.set(r.name,{minValue:t,maxValue:t}),s=!0}return s}}class b extends u{static async create(e,t,s,i,r,a){const n=s.metadata.outSpatialReference,o=new m({spatialReference:n}),d={type:"grid",fields:await Promise.all(t.fields.map(async e=>l.create(o,e))),spatialReference:n,featureFilter:t.featureFilter?await _.create({geometryType:s.metadata.geometryType,hasM:!1,hasZ:!1,timeInfo:s.metadata.timeInfo,fieldsIndex:s.metadata.fieldsIndex,spatialReference:n,filterJSON:t.featureFilter}):null,cellSize:t.clusterRadius/4,arcadeContextInfo:r,sqlOptions:a};return new b(e,t.clusterRadius,d,t.fields,s,i,a)}constructor(e,t,s,i,r,n,l){super(r,n,s.spatialReference,s.fields,l),this._connection=e,this._clusterRadius=t,this._indexOptions=s,this._cellsPerLevel=new Map,this._handled=new Set,this._invalidated=!1,this._metadata=y.createFeature({geometryType:"esriGeometryPoint",hasZ:!1,hasM:!1,featureIdInfo:{type:"object-id",fieldName:"aggregateId"},fieldsIndex:new a([...i,...this._source.metadata.fieldsIndex.fields,{name:"aggregateId",alias:"aggregateId",type:"esriFieldTypeOID"}]).toJSON(),globalIdField:null,spatialReference:r.metadata.spatialReference,outSpatialReference:r.metadata.outSpatialReference,subtypeField:null,subtypes:null,timeInfo:null,timeReferenceUnknownClient:null,dateFieldsTimeZone:null,typeIdField:null,types:null})}get enablePixelBuffering(){return!0}onSubscribe(e){super.onSubscribe(e),this._lastSubscribedLevel=e.tile.level}requiresInvalidation(e){for(const t of this._sendStates.values())if(!t.done)return!0;const s=new Set;for(const t of e)s.add(t.chunkId);return!t(s,this._handled)&&(this._handled=s,!0)}invalidate(){this._invalidated=!0;for(const e of this._cellsPerLevel.values())e.destroy();this._cellsPerLevel.clear()}createState(e){return new M(e)}async*applyOverrideUpdate(e){for(const t of this._cellsPerLevel.values())t.destroy();this._cellsPerLevel.clear();for(const t of this._sendStates.values())t.done=!1}displayMap(e,t,s){const i=new Map(e.map(e=>[t(e),e])),r=[];for(const a of this._getRequiredClusterStates())for(const e of a.clusters()){const t=i.get(e.inner.id);if(null!=t){const a=s(e.displayId,t,e.inner.id);r.push(a),i.delete(e.inner.id);continue}if(1===e.inner.count){const{firstObjectId:t}=e.inner,a=t?i.get(t):null;if(null!=a){const n=s(e.displayId,a,t);r.push(n),i.delete(t)}}}return r}getDisplayFeatures(e){const t=new Set(e),i=new Set,r=[],a=[];for(const n of this._getRequiredClusterStates())for(const e of n.aggregatesWorldSpace())if(t.has(e.displayId)&&!i.has(e.displayId)){const t=s(e,this._metadata.geometryType,!1,!1);if(i.add(e.displayId),1===t.attributes.cluster_count){r.push({...t,displayId:e.displayId});continue}a.push({...t,displayId:e.displayId})}return{features:r,aggregates:a,tracks:[]}}getFeatureObjectIdsForAggregate(e){for(const t of this._getRequiredClusterStates())for(const s of t.clusters())if(s.inner.id===e)return Array.from(s.inner.containedObjectIds);return[]}async*updateChunks(e,t){if(this._invalidated){this._invalidated=!1;for(const s of this._getRequiredClusterStates()){s.updateChunks(e,Array.from(this._sendStates.values()));for(const e of this._sendStates.values())e.subscription.tile.level===s.level&&(yield*this._update(e,s,t));await s.updateStatistics(this._connection)}}}forEachAggregateWorldSpace(e){if(!this._lastSubscribedLevel)return;const t=this._cellsPerLevel.get(this._lastSubscribedLevel);if(t)for(const s of t.aggregatesWorldSpace())e(s)}_getRequiredClusterStates(){return this._getRequiredLevels().map(({level:e,scale:t})=>this._getClusterState(e,t))}_getRequiredLevels(){const e=[],t=new Set;for(const{subscription:s}of this._sendStates.values()){const{level:i,scale:r}=s.tile;t.has(i)||(t.add(i),e.push({level:i,scale:r}))}return e}_getClusterState(e,t){if(null==e)throw new Error("InternalError: Level and scale must be defined");let s=this._cellsPerLevel.get(e);return s||(s=new v(e,t,this._indexOptions,this._clusterRadius,this._attributeStore),this._cellsPerLevel.set(e,s)),s}async*_update(e,t,s){const i=t.createAggregateFeatures(e,this._metadata);this.events.emit("changed"),e.done=e.done||!s;const r=i.getCursor(),a=e.subscription.tile.createArcadeEvaluationOptions(this._indexOptions.arcadeContextInfo);for(;r.next();)this._attributeStore.setAttributeData(r.getDisplayId(),r,a,this._sqlOptions);has("esri-2d-update-debug")&&console.debug(`Tile[${e.subscription.tile.id}] ClusterStrategy._update`,{done:e.done});const n=new h(e.subscription,i,e.done,{});yield n}}export{M as ClusterState,b as ClusterStrategy};
2
+ import has from"../../../../../core/has.js";import{convertToFeature as e}from"../../../../../layers/graphics/featureConversionUtils.js";import{OptimizedFeature as t}from"../../../../../layers/graphics/OptimizedFeature.js";import s from"../../../../../layers/graphics/OptimizedGeometry.js";import i from"../../../../../layers/support/FieldsIndex.js";import{tileSize as r}from"../../../engine/webgl/definitions.js";import{ComputedAggregateField as a}from"../aggregation/ComputedAggregateField.js";import{GridCell as n}from"../aggregation/GridCell.js";import{pixelsPerMapUnit as l}from"../aggregation/GridSpatialIndex.js";import{AAggregateStrategy as o}from"./AAggregateStrategy.js";import{LevelReplaceBatch as d,ASendState as u}from"./AProcessorStrategy.js";import{WithDisplayId as c}from"./support/WithDisplayId.js";import{FeatureTileAppendMessage as p}from"../sources/FeatureSourceMessage.js";import{ComputedAttributeStorage as f}from"../support/ComputedAttributeStorage.js";import h from"../support/FeatureFilterEvaluator.js";import{FeatureMetadata as g}from"../support/FeatureMetadata.js";import{FeatureSetReaderJSON as m}from"../support/FeatureSetReaderJSON.js";import{Hashed as _}from"../support/Hashed.js";const y=128;class I extends u{constructor(e){super(e),this.didSend=!1,this.done=!1}}class x{constructor(e,t,s,i,r){this.level=e,this._scale=t,this._indexOptions=s,this._clusterRadius=i,this._store=r,this._statistics=new Map,this._handledChunks=new Set,this._handledIds=new Set,this._cells=new Map,this._clusters=new Map}destroy(){this._clearClusters()}_clearClusters(){for(const e of this._clusters.values())this._store.releaseDisplayIdForObjectId(e.inner.id);this._clusters.clear()}invalidate(){this._cells.clear(),this._handledChunks.clear(),this._handledIds.clear()}*aggregatesWorldSpace(){for(const e of this._clusters.values()){const s=e.inner.getCentroid(null),i=new t(s,e.inner.getAttributes(),null,e.inner.id,e.displayId);yield i}}clusters(){return this._clusters.values()}update(e,t){let s=!1;const i=new _({...this._indexOptions,scale:this._scale});for(const l of e){if(this._handledChunks.has(l.normalizedChunkId))continue;if(this._handledChunks.add(l.normalizedChunkId),null!=l.lodInfo&&l.lodInfo.level!==this.level)continue;l.getGridIndex(i).put(this._cells,this._handledIds),s=!0}const r=l(this._indexOptions.spatialReference,this._scale),a=this._indexOptions.cellSize,n={xMin:1/0,yMin:1/0,xMax:-1/0,yMax:-1/0};for(const{subscription:l}of t){const e=l.tile.bounds,t=Math.floor(e[0]*r/a),s=Math.floor(e[1]*r/a),i=Math.ceil(e[2]*r/a),o=Math.ceil(e[3]*r/a);n.xMin=Math.min(n.xMin,t),n.yMin=Math.min(n.yMin,s),n.xMax=Math.max(n.xMax,i),n.yMax=Math.max(n.yMax,o)}return null!=this._lastCellBounds&&n.xMin===this._lastCellBounds.xMin&&n.xMax===this._lastCellBounds.xMax&&n.yMin===this._lastCellBounds.yMin&&n.yMax===this._lastCellBounds.yMax||(this._lastCellBounds=n,s=!0),s&&this._clusterCells(n),s}_clusterCells(e){const t=this._clusters;this._clusters=new Map;const s=this._clusterRadius*(1/l(this._indexOptions.spatialReference,this._scale));let i=Array.from(this._cells.values());i=i.sort((e,t)=>t.count-e.count);const r=new Set;for(const a of i){if(r.has(a.id))continue;if(a.gridX<e.xMin||a.gridX>e.xMax||a.gridY<e.yMin||a.gridY>e.yMax)continue;const t=1+this._clusterRadius/this._indexOptions.cellSize,i=this._store.createDisplayIdForObjectId(a.id),l=new c(a.clone(),i);r.add(a.id),this._clusters.set(a.id,l);const o=a.centroidXWorld,d=a.centroidYWorld;for(let e=a.gridY-t;e<=a.gridY+t;e++)for(let i=a.gridX-t;i<=a.gridX+t;i++){if(e===a.gridY&&i===a.gridX)continue;const t=this._cells.get(n.createId(i,e));if(!t||r.has(t.id))continue;const u=Math.abs(t.centroidXWorld-o),c=Math.abs(t.centroidYWorld-d);u<s&&c<s&&(l.inner.merge(t),r.add(t.id))}}for(const a of t.values())this._store.releaseDisplayIdForObjectId(a.inner.id)}async updateStatistics(e){let t=!1;for(const s of this._clusters.values())s.inner.count>1&&(t=this._updateAggregateStatistics(this._statistics,s.inner)||t);if(t){const t=Array.from(this._statistics.entries()).map(([e,t])=>({fieldName:e,minValue:t.minValue,maxValue:t.maxValue}));await e.container.updateStatistics(this.level,t)}}createAggregateFeatures(e,i){const a=e.subscription,n=[],l=a.tile.transform,o=Array.from(this._clusters.values()),d=o.length;for(const c of o){const e=c.inner.getCentroidX(l),i=c.inner.getCentroidY(l),a=1===c.inner.count?c.inner.firstObjectId:c.inner.id,o=c.displayId;if(e<r+y&&e>=-y&&i<r+y&&i>=-y){const r=new s([],[e,i]),l=new t(r,c.inner.getAttributes(),null,a,o);n.push(l)}}const u=m.fromOptimizedFeatures(n,i,a.tile.transform);return has("esri-2d-update-debug")&&console.debug(`Tile[${e.subscription.tile.id}] ClusterStrategy.createAggregateFeatures`,{clusters:u,levelClusterCount:d}),u}_updateAggregateStatistics(e,t){let s=!1;for(const i of t.statistics.values()){if("esriFieldTypeString"===i.field.type)continue;const t=i.value,r=i.field,a=e.get(r.name);if(a){const{minValue:e,maxValue:i}=a,r=Math.min(a.minValue,t),n=Math.max(a.maxValue,t);e===r&&i===n||(a.minValue=r,a.maxValue=n,s=!0);continue}e.set(r.name,{minValue:t,maxValue:t}),s=!0}return s}}class v extends o{static async create(e,t,s,i,r,n){const l=s.metadata.outSpatialReference,o=new f({spatialReference:l}),d={type:"grid",fields:await Promise.all(t.fields.map(async e=>a.create(o,e))),spatialReference:l,featureFilter:t.featureFilter?await h.create({geometryType:s.metadata.geometryType,hasM:!1,hasZ:!1,timeInfo:s.metadata.timeInfo,fieldsIndex:s.metadata.fieldsIndex,spatialReference:l,filterJSON:t.featureFilter}):null,cellSize:t.clusterRadius/4,arcadeContextInfo:r,sqlOptions:n};return new v(e,t.clusterRadius,d,t.fields,s,i,n)}constructor(e,t,s,r,a,n,l){super(a,n,s.spatialReference,s.fields,l),this._connection=e,this._clusterRadius=t,this._indexOptions=s,this._cellsPerLevel=new Map,this._metadata=g.createFeature({geometryType:"esriGeometryPoint",hasZ:!1,hasM:!1,featureIdInfo:{type:"object-id",fieldName:"aggregateId"},fieldsIndex:new i([...r,...this._source.metadata.fieldsIndex.fields,{name:"aggregateId",alias:"aggregateId",type:"esriFieldTypeOID"}]).toJSON(),globalIdField:null,spatialReference:a.metadata.spatialReference,outSpatialReference:a.metadata.outSpatialReference,subtypeField:null,subtypes:null,timeInfo:null,timeReferenceUnknownClient:null,dateFieldsTimeZone:null,typeIdField:null,types:null})}get enablePixelBuffering(){return!0}onSubscribe(e){super.onSubscribe(e);const{scale:t,level:s}=e.tile;this._lastSubscribedLodInfo={level:s,scale:t}}requiresInvalidation(e){return!1}invalidate(){for(const e of this._cellsPerLevel.values())e.invalidate()}createState(e){return new I(e)}async applyOverrideUpdate(e){for(const t of this._cellsPerLevel.values())t.invalidate();return null}displayMap(e,t,s){const i=new Map(e.map(e=>[t(e),e])),r=[],a=this._getActiveClusterState();if(a)for(const n of a.clusters()){const e=i.get(n.inner.id);if(null!=e){const t=s(n.displayId,e,n.inner.id);r.push(t),i.delete(n.inner.id);continue}if(1===n.inner.count){const{firstObjectId:e}=n.inner,t=e?i.get(e):null;if(null!=t){const a=s(n.displayId,t,e);r.push(a),i.delete(e)}}}return r}getDisplayFeatures(t){const s=new Set(t),i=new Set,r=[],a=[],n=this._getActiveClusterState();if(n)for(const l of n.aggregatesWorldSpace())if(s.has(l.displayId)&&!i.has(l.displayId)){const t=e(l,this._metadata.geometryType,!1,!1);if(i.add(l.displayId),1===t.attributes.cluster_count){r.push({...t,displayId:l.displayId});continue}a.push({...t,displayId:l.displayId})}return{features:r,aggregates:a,tracks:[]}}getFeatureObjectIdsForAggregate(e){const t=this._getActiveClusterState();if(t)for(const s of t.clusters())if(s.inner.id===e){const e=[];for(const t of s.inner.containedObjectIds)for(const s of t.values())e.push(s);return e}return[]}async updateChunks(e,t){const s=this._lastSubscribedLodInfo;if(!s)return null;const i=this._getOrCreateClusterState(s),r=Array.from(this._sendStates.values()).filter(e=>e.subscription.tile.level===s.level);i.update(e,r);const a=new d(s.level);for(const n of r)a.messages.push(this._update(n,i,t));return await i.updateStatistics(this._connection),a}forEachAggregateWorldSpace(e){const t=this._getActiveClusterState();if(t)for(const s of t.aggregatesWorldSpace())e(s)}_getActiveClusterState(){return this._lastSubscribedLodInfo?this._cellsPerLevel.get(this._lastSubscribedLodInfo.level):null}_getOrCreateClusterState(e){if(null==e.level)throw new Error("InternalError: Level and scale must be defined");let t=this._cellsPerLevel.get(e.level);return t||(t=new x(e.level,e.scale,this._indexOptions,this._clusterRadius,this._attributeStore),this._cellsPerLevel.set(e.level,t)),t}_update(e,t,s){const i=t.createAggregateFeatures(e,this._metadata);this.events.emit("changed"),e.done=e.done||!s;const r=i.getCursor(),a=e.subscription.tile.createArcadeEvaluationOptions(this._indexOptions.arcadeContextInfo);for(;r.next();)this._attributeStore.setAttributeData(r.getDisplayId(),r,a,this._sqlOptions);return has("esri-2d-update-debug")&&console.debug(`Tile[${e.subscription.tile.id}] ClusterStrategy._update`,{done:e.done}),new p(e.subscription,i,e.done,{})}}export{I as ClusterSendState,v as ClusterStrategy};
@@ -1,2 +1,2 @@
1
1
  /* COPYRIGHT Esri - https://js.arcgis.com/5.1/LICENSE.txt */
2
- import has from"../../../../../core/has.js";import{AProcessorStrategy as e,ASendState as t}from"./AProcessorStrategy.js";import{FeatureTileUpdateMessage as s,FeatureTileAppendMessage as r}from"../sources/FeatureSourceMessage.js";import{OverrideChunk as a}from"../sources/strategies/chunks/Overrides.js";import{createArcadeEvaluationOptions as o}from"../support/arcadeUtils.js";import{FeatureSetReaderJSON as n}from"../support/FeatureSetReaderJSON.js";class d extends t{}class i extends e{constructor(e,t,s,r){super(e,t,r),this._arcadeContextInfo=s,this.handledChunks=new Set,this.handledChunksForIdCreation=new Set,this.handledChunksForAttributeData=new Set,this._streamLayerDeferredObjectIdsToRemove=[]}destroy(){super.destroy();for(const e of this._source.chunks())this._cleanupChunkIds(e)}invalidateAttributeData(e){this.handledChunksForAttributeData.clear(),this._arcadeContextInfo=e,null!=this._evalOptions&&(this._evalOptions=o(this._evalOptions.$view.scale,e))}onSubscribe(e){super.onSubscribe(e),this._evalOptions=e.tile.createArcadeEvaluationOptions(this._arcadeContextInfo)}createState(e){return new d(e)}get aggregateQueryEngine(){return null}displayMap(e,t,s){const r=new Map(e.map(e=>[t(e),e])),a=[];for(const o of this._source.chunks()){const e=o.reader.getCursor();for(;e.next();){const t=e.getObjectId(),o=e.getDisplayId(),n=r.get(t);if(null!=n){const e=s(o,n,t);a.push(e),r.delete(t)}}}return a}getDisplayFeatures(e){const t=new Set(e),s=new Set,r=[];for(const a of this._source.chunks()){const e=a.reader.getCursor();for(;e.next();){const a=e.getObjectId(),o=e.getDisplayId();t.has(o)&&!s.has(a)&&(r.push({...e.readLegacyFeatureWorldSpace(),displayId:o}),s.add(a))}}return{features:r,aggregates:[],tracks:[]}}async*applyOverrideUpdate(e){const t=[];for(const s of e.modified.values()){const e=this._attributeStore.createDisplayIdForObjectId(s.objectId);s.displayId=e,t.push(e)}const r=n.fromOptimizedFeatures(Array.from(e.modified.values()),this._source.metadata).getCursor();for(;r.next();)this._attributeStore.setAttributeData(r.getDisplayId(),r,this._evalOptions,this._sqlOptions);const o=[];for(const s of e.removed){const e=this._attributeStore.getDisplayIdForObjectId(s);null!=e&&o.push(e)}has("esri-2d-update-debug")&&console.debug("FeatureUpdateStrategy.applyLocalEdit",{message:e,modifiedDisplayIds:t,removedDisplayIds:o});const d=a.fromFeatures(Array.from(e.modified.values()),this._source.metadata);this.handledChunks.add(d.chunkId),this.handledChunksForAttributeData.add(d.chunkId),this.handledChunksForIdCreation.add(d.chunkId);for(const a of this._sendStates.values())a.handledChunks.add(d.chunkId),yield new s(a.subscription,null,t,!1,d.queryInfo);for(const a of this._sendStates.values()){const e=d.getTileReader(a.subscription.tile);yield new s(a.subscription,e,o,!1,d.queryInfo)}for(const s of e.removed)this._attributeStore.releaseDisplayIdForObjectId(s)}async*updateChunks(e,t){if(e.length){this._updateAttributeData();for(const e of this._sendStates.values())yield*this._update(e)}}removeChunks(e){for(const t of e)this.handledChunks.delete(t.chunkId),this.handledChunksForAttributeData.delete(t.chunkId),this._cleanupChunkIds(t)}afterUpdateChunks(){for(const e of this._streamLayerDeferredObjectIdsToRemove)this._attributeStore.releaseDisplayIdForObjectId(e);this._streamLayerDeferredObjectIdsToRemove=[]}_cleanupChunkIds(e){if(this.handledChunksForIdCreation.has(e.chunkId)){const t=e.reader.getCursor();for(;t.next();){const e=t.getObjectId();this._source.isStream?this._streamLayerDeferredObjectIdsToRemove.push(e):this._attributeStore.releaseDisplayIdForObjectId(e)}this.handledChunksForIdCreation.delete(e.chunkId)}}_updateAttributeData(){for(const e of this._source.chunks()){const{chunkId:t,reader:s}=e;if(!this.handledChunksForIdCreation.has(t)){this.handledChunksForIdCreation.add(t);const e=s.getCursor();for(;e.next();){const t=this._attributeStore.createDisplayIdForObjectId(e.getObjectId());e.setDisplayId(t)}}}for(const e of this._source.chunks())if(this._attributeStore.referencesScale()||!this.handledChunksForAttributeData.has(e.chunkId)){this.handledChunksForAttributeData.add(e.chunkId);const t=e.reader.getCursor();for(;t.next();){const e=t.getDisplayId();this._attributeStore.setAttributeData(e,t,this._evalOptions,this._sqlOptions)}}}*_update(e){const{subscription:t,handledChunks:s}=e;for(const a of this._source.chunks()){const{chunkId:o}=a;if(s.has(o)||!this.handledChunksForIdCreation.has(o)||!this.handledChunksForAttributeData.has(o))continue;s.add(o);const n=a.getTileReader(t.tile);n&&(yield new r(e.subscription,n,a.end,a.queryInfo))}}}export{d as DefaultSendState,i as FeatureUpdateStrategy};
2
+ import has from"../../../../../core/has.js";import{AProcessorStrategy as e,UpdateBatch as t,AppendBatch as s,ASendState as r}from"./AProcessorStrategy.js";import{FeatureTileUpdateMessage as a,FeatureTileAppendMessage as o}from"../sources/FeatureSourceMessage.js";import{OverrideChunk as n}from"../sources/strategies/chunks/Overrides.js";import{createArcadeEvaluationOptions as d}from"../support/arcadeUtils.js";import{FeatureSetReaderJSON as i}from"../support/FeatureSetReaderJSON.js";class u extends r{}class h extends e{constructor(e,t,s,r){super(e,t,r),this._arcadeContextInfo=s,this.handledChunks=new Set,this.handledChunksForIdCreation=new Set,this.handledChunksForAttributeData=new Set,this._streamLayerDeferredObjectIdsToRemove=[]}destroy(){super.destroy();for(const e of this._source.chunks())this._cleanupChunkIds(e)}invalidateAttributeData(e){this.handledChunksForAttributeData.clear(),this._arcadeContextInfo=e,null!=this._evalOptions&&(this._evalOptions=d(this._evalOptions.$view.scale,e))}onSubscribe(e){super.onSubscribe(e),this._evalOptions=e.tile.createArcadeEvaluationOptions(this._arcadeContextInfo)}createState(e){return new u(e)}get aggregateQueryEngine(){return null}displayMap(e,t,s){const r=new Map(e.map(e=>[t(e),e])),a=[];for(const o of this._source.chunks()){const e=o.reader.getCursor();for(;e.next();){const t=e.getObjectId(),o=e.getDisplayId(),n=r.get(t);if(null!=n){const e=s(o,n,t);a.push(e),r.delete(t)}}}return a}getDisplayFeatures(e){const t=new Set(e),s=new Set,r=[];for(const a of this._source.chunks()){const e=a.reader.getCursor();for(;e.next();){const a=e.getObjectId(),o=e.getDisplayId();t.has(o)&&!s.has(a)&&(r.push({...e.readLegacyFeatureWorldSpace(),displayId:o}),s.add(a))}}return{features:r,aggregates:[],tracks:[]}}async applyOverrideUpdate(e){const s=new t,r=[];for(const t of e.modified.values()){const e=this._attributeStore.createDisplayIdForObjectId(t.objectId);t.displayId=e,r.push(e)}const o=i.fromOptimizedFeatures(Array.from(e.modified.values()),this._source.metadata).getCursor();for(;o.next();)this._attributeStore.setAttributeData(o.getDisplayId(),o,this._evalOptions,this._sqlOptions);const d=[];for(const t of e.removed){const e=this._attributeStore.getDisplayIdForObjectId(t);null!=e&&d.push(e)}has("esri-2d-update-debug")&&console.debug("FeatureUpdateStrategy.applyLocalEdit",{message:e,modifiedDisplayIds:r,removedDisplayIds:d});const u=n.fromFeatures(Array.from(e.modified.values()),this._source.metadata);this.handledChunks.add(u.chunkId),this.handledChunksForAttributeData.add(u.chunkId),this.handledChunksForIdCreation.add(u.chunkId);for(const t of this._sendStates.values())t.handledChunks.add(u.chunkId),s.messages.push(new a(t.subscription,null,r,!1,u.queryInfo));for(const t of this._sendStates.values()){const e=u.getTileReader(t.subscription.tile);s.messages.push(new a(t.subscription,e,d,!1,u.queryInfo))}for(const t of e.removed)this._attributeStore.releaseDisplayIdForObjectId(t);return s}async updateChunks(e,t){const r=new s;if(!e.length)return r;this._updateAttributeData();for(const s of this._sendStates.values()){const{subscription:t,handledChunks:a}=s;for(const n of e){const{chunkId:e}=n;if(a.has(e)||!this.handledChunksForIdCreation.has(e)||!this.handledChunksForAttributeData.has(e))continue;a.add(e);const d=n.getTileReader(t.tile);if(!d)continue;const i=new o(s.subscription,d,n.end,n.queryInfo);r.messages.push(i)}}return r}removeChunks(e){for(const t of e)this.handledChunks.delete(t.chunkId),this.handledChunksForAttributeData.delete(t.chunkId),this._cleanupChunkIds(t)}afterUpdateChunks(){for(const e of this._streamLayerDeferredObjectIdsToRemove)this._attributeStore.releaseDisplayIdForObjectId(e);this._streamLayerDeferredObjectIdsToRemove=[]}_cleanupChunkIds(e){if(this.handledChunksForIdCreation.has(e.chunkId)){const t=e.reader.getCursor();for(;t.next();){const e=t.getObjectId();this._source.isStream?this._streamLayerDeferredObjectIdsToRemove.push(e):this._attributeStore.releaseDisplayIdForObjectId(e)}this.handledChunksForIdCreation.delete(e.chunkId)}}_updateAttributeData(){for(const e of this._source.chunks()){const{chunkId:t,reader:s}=e;if(!this.handledChunksForIdCreation.has(t)){this.handledChunksForIdCreation.add(t);const e=s.getCursor();for(;e.next();){const t=this._attributeStore.createDisplayIdForObjectId(e.getObjectId());e.setDisplayId(t)}}}for(const e of this._source.chunks())if(this._attributeStore.referencesScale()||!this.handledChunksForAttributeData.has(e.chunkId)){this.handledChunksForAttributeData.add(e.chunkId);const t=e.reader.getCursor();for(;t.next();){const e=t.getDisplayId();this._attributeStore.setAttributeData(e,t,this._evalOptions,this._sqlOptions)}}}}export{u as DefaultSendState,h as FeatureUpdateStrategy};
@@ -1,2 +1,2 @@
1
1
  /* COPYRIGHT Esri - https://js.arcgis.com/5.1/LICENSE.txt */
2
- import{isSome as t}from"../../../../../core/arrayUtils.js";import e from"../../../../../core/Logger.js";import{assertIsSome as s}from"../../../../../core/maybe.js";import{isLoaded as r,load as i,execute as a}from"../../../../../geometry/operators/gx/operatorGeodeticDensify.js";import{geodeticCurveType as o}from"../../../../../geometry/operators/support/geodeticCurveType.js";import{intersectsWithMargin as n,fromValues as l,intersects as c,empty as d,expandPointInPlace as u}from"../../../../../geometry/support/aaBoundingRect.js";import{getClosestDenormalizedXToReference as h}from"../../../../../geometry/support/normalizeUtils.js";import{normalizeCentralMeridianForDisplay as p}from"../../../../../geometry/support/normalizeUtilsSync.js";import{quantizeOptimizedGeometry as m,convertToGeometry as f,convertFromPolyline as _}from"../../../../../layers/graphics/featureConversionUtils.js";import{OptimizedFeature as b}from"../../../../../layers/graphics/OptimizedFeature.js";import g from"../../../../../layers/graphics/OptimizedGeometry.js";import{internalTrackPartField as y,externalTrackLineOidPrefix as I,internalTimeReceivedField as v}from"../../../../../layers/support/streamLayerUtils.js";import{tileSize as k}from"../../../engine/webgl/definitions.js";import{AccumulatedStatistics as F}from"../aggregation/AccumulatedStatistics.js";import{ComputedAggregateField as O}from"../aggregation/ComputedAggregateField.js";import{AAggregateStrategy as j}from"./AAggregateStrategy.js";import{ASendState as x}from"./AProcessorStrategy.js";import{FeatureTileAppendMessage as S}from"../sources/FeatureSourceMessage.js";import{createArcadeEvaluationOptions as T}from"../support/arcadeUtils.js";import{ComputedAttributeStorage as R}from"../support/ComputedAttributeStorage.js";import D from"../support/FeatureFilterEvaluator.js";import{FeatureMetadata as w}from"../support/FeatureMetadata.js";import{FeatureSetReaderIndirect as L}from"../support/FeatureSetReaderIndirect.js";import{FeatureSetReaderJSON as A}from"../support/FeatureSetReaderJSON.js";let C;const G=()=>e.getLogger("esri.views.2d.layers.features.processor.TrackStrategy"),P=32;class M{constructor(t,e,s,r,i){this.chunkIndex=t,this.featureIndex=e,this.objectId=s,this.displayId=r,this.time=i}}class W{static getOid(t){return I+t}constructor(t,e,s,r,i,a,o,n){this._schema=t,this.trackId=e,this.objectId=s,this.displayId=r,this._fields=i,this._spatialReference=a,this._metadata=o,this._isStream=n,this._maxDisplayDuration=this._schema.maxDisplayDuration>0?this._schema.maxDisplayDuration:1/0,this._maxDisplayObservationsPerTrack=this._schema.maxDisplayObservationsPerTrack>=1?this._schema.maxDisplayObservationsPerTrack:1/0,this._observationRecords=[],this._nextObservationRecords=[],this._trackLinePath=[],this._bounds=[],this._trackLineGeometry=new g}get _trackLineAttributes(){const t={...this._latestObservationFeature?.attributes,aggregateId:this.objectId,[y]:0};if(null!=this._statistics)for(const e of this._statistics.values())t[e.field.name]=e.value;return t}get _startTimeField(){return this._metadata.timeInfo?.startTimeField}get length(){return this._observationRecords.length}*observations(){yield*this._observationRecords}*previousObservations(){for(let t=0;t<this._observationRecords.length-1;t++)yield this._observationRecords[t]}get latestObservationFeature(){return this._latestObservationFeature}get latestObservationRecord(){return this._latestObservationRecord}stageObservation(t,e){this._nextObservationRecords.push(new M(t,e.getIndex(),e.getObjectId(),e.getDisplayId(),null!=this._startTimeField?e.readAttributeAsTimestamp(this._startTimeField):null))}commitObservations(t,e,r){const i=new Set(this._nextObservationRecords.map(t=>t.objectId)),a=this._observationRecords.filter(t=>!i.has(t.objectId)).map(t=>t.objectId);let o,n;switch(this._observationRecords=[],this._trackLinePath=[],this._isStream||null==this._startTimeField||this._nextObservationRecords.sort((t,e)=>{const s=t.time,r=e.time;return null!=s&&null!=r?s-r:0}),this._schema.timeField){case"startTimeField":o=this._metadata.timeInfo?.startTimeField;break;case"endTimeField":o=this._metadata.timeInfo?.endTimeField;break;case"timeReceived":o=this._isStream?v:null}n=this._isStream?r?.end??Date.now():r?.end??-1/0;const l=e.map(t=>t.reader.getCursor());let c;for(let d=this._nextObservationRecords.length-1;d>=0&&!(this._observationRecords.length>=this._maxDisplayObservationsPerTrack);d--){const t=this._nextObservationRecords[d],e=l[t.chunkIndex];s(e),e.setIndex(t.featureIndex);const r=null!=o?e.readAttributeAsTimestamp(o):null;(null!=r?n-r:0)>=this._maxDisplayDuration||(this._commitObservation(t,e),c??=t)}if(null!=c){const{chunkIndex:e,featureIndex:r}=c,i=`${c.objectId}.latest`,o=t.createDisplayIdForObjectId(i),n=l[e];s(n),n.setIndex(r);const d=new b(n.readGeometryWorldSpace(),{...n.readAttributes(),[y]:1},null,i,o);this._latestObservationFeature&&a.push(this._latestObservationFeature.objectId),this._latestObservationFeature=d,this._latestObservationRecord=c}else this._latestObservationFeature=null;return this._trackLineGeometry=q(this._trackLinePath,this._spatialReference),this._bounds=E(this._trackLineGeometry),this._nextObservationRecords=[],a}updateStatistics(t,e){this._statistics=F.create(this._fields);const r=t.map(t=>t.reader.getCursor());for(const{chunkIndex:i,featureIndex:a}of this._observationRecords){const t=r[i];s(t),t.setIndex(a),this._statistics.insert(t,e)}}overlapsTile(t){for(const e of this._bounds)if(n(e,t.bounds,P))return!0;return!1}getLatestObservationFeatureForTile(t){if(null==this._latestObservationFeature)return null;const{objectId:e,displayId:s,geometry:r,attributes:i}=this._latestObservationFeature,a=m(r,this._metadata.geometryType,t.subscription.tile.transform)??new g,o=l(1/0,1/0,-1/0,-1/0);Z(a,(t,e)=>u(o,[t,e]));if(!c(o,l(0,0,k,k)))return null;return new b(a,i,null,e,s)}getTrackLineFeatureForTile(t){const e=m(this._trackLineGeometry,"esriGeometryPolyline",t.subscription.tile.transform)??new g;return new b(e,this._trackLineAttributes,null,this.objectId,this.displayId)}getTrackLineOptimizedFeature(){return new b(this._trackLineGeometry,this._trackLineAttributes,null,this.objectId,this.displayId)}getTrackLineDisplayFeature(){const{_trackLineGeometry:t,_trackLineAttributes:e,displayId:s}=this;return{geometry:f(t,"esriGeometryPolyline",!1,!1),attributes:e,displayId:s}}_commitObservation(t,e){const s=e.readCentroidWorldSpace();let r=s?.coords[0],i=s?.coords[1];null==s&&(r=e.readXWorldSpace(),i=e.readYWorldSpace()),null!=r&&null!=i&&(this._observationRecords.unshift(t),this._trackLinePath.unshift([r,i]))}}class z extends x{constructor(t){super(t),this.done=!1}}class U extends j{static async create(t,e,s,a,o){const n=e.metadata.outSpatialReference,l=new R({spatialReference:n}),c=await Promise.all(t.fields.map(async t=>O.create(l,t))),d=t.featureFilter?await D.create({geometryType:e.metadata.geometryType,hasM:!1,hasZ:!1,timeInfo:e.metadata.timeInfo,fieldsIndex:e.metadata.fieldsIndex,spatialReference:n,filterJSON:t.featureFilter}):null;return n.isWrappable||r()||await Promise.all([import("../../../../../geometry/operators/support/apiConverter.js"),import("../../../../../geometry/operators/support/jsonConverter.js"),i()]).then(([t,e,s])=>{C={fromGeometryToGXGeometry:e.fromGeometryToGXGeometry,toGeometry:e.toGeometry,fromSpatialReference:t.fromSpatialReference}}),new U(t,e,s,n,c,d,a,o)}constructor(t,e,s,r,i,a,o,n){super(e,s,r,i,n),this._schema=t,this._featureFilter=a,this._arcadeContextInfo=o,this._tracks=new Map,this._handledChunks=new Set,this._metadata=e.metadata.weakCloneWithAdditionalFields([{name:y,alias:"trackPart",type:"esriFieldTypeSmallInteger"}]),this._trackLineMetadata=w.createFeature({geometryType:"esriGeometryPolyline",featureIdInfo:{type:"object-id",fieldName:"aggregateId"},fieldsIndex:{fields:[...this._source.metadata.fieldsIndex.fields,...this.aggregateFields,{name:y,alias:"trackPart",type:"esriFieldTypeSmallInteger"},{name:"aggregateId",alias:"aggregateId",type:"esriFieldTypeOID"}],timeZoneByFieldName:null},globalIdField:null,spatialReference:e.metadata.spatialReference,outSpatialReference:e.metadata.outSpatialReference,subtypeField:null,subtypes:null,timeInfo:e.metadata.timeInfo,timeReferenceUnknownClient:null,dateFieldsTimeZone:null,typeIdField:null,types:null,hasZ:!1,hasM:!1})}destroy(){super.destroy(),this._clear()}get _isStream(){return this._source.isStream}get enablePixelBuffering(){return!0}get isAggregate(){return!1}requiresInvalidation(){return!0}invalidate(){super.invalidate(),this._clear()}createState(t){return new z(t)}async*applyOverrideUpdate(t){G().error("Applying override to tracks is not supported")}displayMap(t,e,s){const r=new Map(t.map(t=>[e(t),t])),i=[];for(const a of this._tracks.values()){const t=r.get(a.objectId);if(null!=t){const e=s(a.displayId,t,a.objectId);i.push(e),r.delete(a.objectId);continue}const e=a.latestObservationFeature;if(e?.objectId){const t=r.get(e.objectId);if(null!=t){const a=s(e.displayId,t,e.objectId);i.push(a),r.delete(e.objectId);continue}}for(const o of a.observations()){const t=r.get(o.objectId);if(null!=t){const e=s(o.displayId,t,o.objectId);i.push(e),r.delete(o.objectId)}}}return i}getDisplayFeatures(t){const e=new Set(t),s=[],r=[],i=this._source.chunks().map(t=>t.reader.getCursor());for(const a of this._tracks.values()){if(e.has(a.displayId)&&r.push(a.getTrackLineDisplayFeature()),null!=a.latestObservationFeature&&e.has(a.latestObservationFeature.displayId)){const{displayId:t,chunkIndex:e,featureIndex:r}=a.latestObservationRecord,o=i[e];o.setIndex(r),s.push({displayId:t,...o.readLegacyFeatureWorldSpace()})}for(const{displayId:t,chunkIndex:r,featureIndex:o}of a.observations())if(e.has(t)){const e=i[r];e.setIndex(o),s.push({displayId:t,...e.readLegacyFeatureWorldSpace()})}}return{features:s,aggregates:[],tracks:r}}getFeatureObjectIdsForAggregate(t){for(const e of this._tracks.values())if(e.objectId===t)return Array.from(e.observations(),t=>t.objectId);return[]}async*updateChunks(){0===this._handledChunks.size&&this._rebuildTracks();for(const t of this._sendStates.values())yield*this._update(t)}forEachAggregateWorldSpace(t){for(const e of this._tracks.values())t(e.getTrackLineOptimizedFeature())}_clear(){for(const t of this._source.chunks())if(this._handledChunks.has(t.chunkId)){const e=t.reader.getCursor();for(;e.next();){const t=e.getObjectId();this._attributeStore.releaseDisplayIdForObjectId(t)}}this._handledChunks.clear();for(const t of this._tracks.values())this._removeTrack(t);this._tracks.clear()}_rebuildTracks(){const t=this._source.chunks();if(!t.length)return;const e=this._metadata.timeInfo?.trackIdField;if(null==e)return;const s=new Set;for(let r=0;r<t.length;r++){const i=t[r];if(this._handledChunks.has(i.chunkId))continue;this._handledChunks.add(i.chunkId);const a=i.reader.getCursor();for(;a.next();){const t=a.getObjectId();a.setDisplayId(this._attributeStore.createDisplayIdForObjectId(t));const i=a.readAttribute(e);if(null!=i&&null!=t&&(null===this._featureFilter||this._featureFilter.check(a,this._sqlOptions))){if(!this._tracks.has(i)){const t=W.getOid(i),e=this._attributeStore.createDisplayIdForObjectId(t),s=new W(this._schema,i,t,e,this.aggregateFields,this.spatialReference,this._source.metadata,this._isStream);this._tracks.set(i,s)}this._tracks.get(i).stageObservation(r,a),s.add(i)}}}for(const r of this._tracks.values())if(s.has(r.trackId)){const e=r.commitObservations(this._attributeStore,t,this._featureFilter?.timeExtent);for(const t of e)this._attributeStore.releaseDisplayIdForObjectId(t);r.updateStatistics(t,T(1,this._arcadeContextInfo))}else this._removeTrack(r)}_removeTrack(t){this._tracks.delete(t.trackId),this._attributeStore.releaseDisplayIdForObjectId(t.objectId),null!=t.latestObservationFeature&&this._attributeStore.releaseDisplayIdForObjectId(t.latestObservationFeature.objectId)}*_update(e){if(e.done)return;e.done=!this._source.updateTracking.updating;const s=[],r=[];for(const t of this._tracks.values())if(t.length>0){if(this._schema.showLatestObservation){const r=t.getLatestObservationFeatureForTile(e);null!=r&&s.push(r)}this._schema.showTrackLine&&t.overlapsTile(e.subscription.tile)&&r.push(t.getTrackLineFeatureForTile(e))}const i=A.fromOptimizedFeatures(s,this._metadata,e.subscription.tile.transform),a=A.fromOptimizedFeatures(r,this._trackLineMetadata,e.subscription.tile.transform);let o=[];if(this._schema.showPreviousObservations){const s=this._source.chunks().map(()=>[]);for(const t of this._tracks.values())for(const{chunkIndex:e,featureIndex:r}of t.previousObservations())s[e].push(r);o=this._source.chunks().map((t,r)=>{const i=t.getTileReader(e.subscription.tile);if(null==i)return null;const a=L.from(i,s[r]);return a.setProcessorAttributes({[y]:2}),"esriGeometryPoint"!==a.geometryType&&null!=a.getInTransform()||a.setTransformForDisplay(e.subscription.tile.transform),a}).filter(t)}this.events.emit("changed");const n=e.subscription.tile.createArcadeEvaluationOptions(this._arcadeContextInfo),l=a.getCursor();for(;l.next();)this._attributeStore.setAttributeData(l.getDisplayId(),l,n,this._sqlOptions);for(const t of o){const e=t.getCursor();for(;e.next();)this._attributeStore.setAttributeData(e.getDisplayId(),e,n,this._sqlOptions)}const c=i.getCursor();for(;c.next();)this._attributeStore.setAttributeData(c.getDisplayId(),c,n,this._sqlOptions);yield new S(e.subscription,a,!1,{});for(const t of o)yield new S(e.subscription,t,!1,{});yield new S(e.subscription,i,e.done,{})}}function q(t,e){if(t.length<2)return _({paths:[t]},!1,!1);if(e.isWrappable){let s=!1;for(let r=1;r<t.length;r++){const i=t[r][0],a=h(i,t[r-1][0],e);i!==a&&(t[r][0]=a,s=!0)}if(s){const s=p({paths:[t],spatialReference:e});if(null!=s)return _({paths:s.paths},!1,!1)}return _({paths:[t]},!1,!1)}const s=C.fromGeometryToGXGeometry({hasM:!1,hasZ:!1,paths:[t]}),r=C.fromSpatialReference(e);if(null!=r){const t=a(s,1e6,r,o.geodesic);if(null!=t){const e=C.toGeometry(t,r);if(null!=e&&"paths"in e)return _({paths:e.paths},!1,!1)}}return _({paths:[t]},!1,!1)}function Z(t,e){const s=2,{coords:r,lengths:i}=t;if(!i.length)return void e(r[0],r[1]);let a=0;for(let o=0;o<i.length;o++){const t=i[o];let n=0,l=0;for(let i=0;i<t;i++)n+=r[s*(i+a)],l+=r[s*(i+a)+1],e(n,l);a+=t}}function E(t){const{lengths:e,coords:s}=t,r=2;if(!e.length)return[d()];const i=[];let a=0;for(let o=0;o<e.length;o++){const t=e[o],n=d();i.push(n);for(let e=0;e<t;e++){const t=s[r*(e+a)],i=s[r*(e+a)+1];u(n,[t,i])}a+=t}return i}export{U as TrackStrategy};
2
+ import{isSome as t}from"../../../../../core/arrayUtils.js";import e from"../../../../../core/Logger.js";import{assertIsSome as s}from"../../../../../core/maybe.js";import{isLoaded as r,load as a,execute as i}from"../../../../../geometry/operators/gx/operatorGeodeticDensify.js";import{geodeticCurveType as o}from"../../../../../geometry/operators/support/geodeticCurveType.js";import{intersectsWithMargin as n,fromValues as l,intersects as c,empty as u,expandPointInPlace as d}from"../../../../../geometry/support/aaBoundingRect.js";import{getClosestDenormalizedXToReference as h}from"../../../../../geometry/support/normalizeUtils.js";import{normalizeCentralMeridianForDisplay as p}from"../../../../../geometry/support/normalizeUtilsSync.js";import{quantizeOptimizedGeometry as m,convertToGeometry as f,convertFromPolyline as _}from"../../../../../layers/graphics/featureConversionUtils.js";import{OptimizedFeature as g}from"../../../../../layers/graphics/OptimizedFeature.js";import b from"../../../../../layers/graphics/OptimizedGeometry.js";import{internalTrackPartField as y,externalTrackLineOidPrefix as I,internalTimeReceivedField as v}from"../../../../../layers/support/streamLayerUtils.js";import{tileSize as k}from"../../../engine/webgl/definitions.js";import{AccumulatedStatistics as F}from"../aggregation/AccumulatedStatistics.js";import{ComputedAggregateField as O}from"../aggregation/ComputedAggregateField.js";import{AAggregateStrategy as j}from"./AAggregateStrategy.js";import{AppendBatch as x,ASendState as S}from"./AProcessorStrategy.js";import{FeatureTileAppendMessage as T}from"../sources/FeatureSourceMessage.js";import{createArcadeEvaluationOptions as R}from"../support/arcadeUtils.js";import{ComputedAttributeStorage as w}from"../support/ComputedAttributeStorage.js";import D from"../support/FeatureFilterEvaluator.js";import{FeatureMetadata as L}from"../support/FeatureMetadata.js";import{FeatureSetReaderIndirect as A}from"../support/FeatureSetReaderIndirect.js";import{FeatureSetReaderJSON as C}from"../support/FeatureSetReaderJSON.js";let G;const P=()=>e.getLogger("esri.views.2d.layers.features.processor.TrackStrategy"),M=32;class W{constructor(t,e,s,r,a){this.chunkIndex=t,this.featureIndex=e,this.objectId=s,this.displayId=r,this.time=a}}class z{static getOid(t){return I+t}constructor(t,e,s,r,a,i,o,n){this._schema=t,this.trackId=e,this.objectId=s,this.displayId=r,this._fields=a,this._spatialReference=i,this._metadata=o,this._isStream=n,this._maxDisplayDuration=this._schema.maxDisplayDuration>0?this._schema.maxDisplayDuration:1/0,this._maxDisplayObservationsPerTrack=this._schema.maxDisplayObservationsPerTrack>=1?this._schema.maxDisplayObservationsPerTrack:1/0,this._observationRecords=[],this._nextObservationRecords=[],this._trackLinePath=[],this._bounds=[],this._trackLineGeometry=new b}get _trackLineAttributes(){const t={...this._latestObservationFeature?.attributes,aggregateId:this.objectId,[y]:0};if(null!=this._statistics)for(const e of this._statistics.values())t[e.field.name]=e.value;return t}get _startTimeField(){return this._metadata.timeInfo?.startTimeField}get length(){return this._observationRecords.length}*observations(){yield*this._observationRecords}*previousObservations(){for(let t=0;t<this._observationRecords.length-1;t++)yield this._observationRecords[t]}get latestObservationFeature(){return this._latestObservationFeature}get latestObservationRecord(){return this._latestObservationRecord}stageObservation(t,e){this._nextObservationRecords.push(new W(t,e.getIndex(),e.getObjectId(),e.getDisplayId(),null!=this._startTimeField?e.readAttributeAsTimestamp(this._startTimeField):null))}commitObservations(t,e,r){const a=new Set(this._nextObservationRecords.map(t=>t.objectId)),i=this._observationRecords.filter(t=>!a.has(t.objectId)).map(t=>t.objectId);let o,n;switch(this._observationRecords=[],this._trackLinePath=[],this._isStream||null==this._startTimeField||this._nextObservationRecords.sort((t,e)=>{const s=t.time,r=e.time;return null!=s&&null!=r?s-r:0}),this._schema.timeField){case"startTimeField":o=this._metadata.timeInfo?.startTimeField;break;case"endTimeField":o=this._metadata.timeInfo?.endTimeField;break;case"timeReceived":o=this._isStream?v:null}n=this._isStream?r?.end??Date.now():r?.end??-1/0;const l=e.map(t=>t.reader.getCursor());let c;for(let u=this._nextObservationRecords.length-1;u>=0&&!(this._observationRecords.length>=this._maxDisplayObservationsPerTrack);u--){const t=this._nextObservationRecords[u],e=l[t.chunkIndex];s(e),e.setIndex(t.featureIndex);const r=null!=o?e.readAttributeAsTimestamp(o):null;(null!=r?n-r:0)>=this._maxDisplayDuration||(this._commitObservation(t,e),c??=t)}if(null!=c){const{chunkIndex:e,featureIndex:r}=c,a=`${c.objectId}.latest`,o=t.createDisplayIdForObjectId(a),n=l[e];s(n),n.setIndex(r);const u=new g(n.readGeometryWorldSpace(),{...n.readAttributes(),[y]:1},null,a,o);this._latestObservationFeature&&i.push(this._latestObservationFeature.objectId),this._latestObservationFeature=u,this._latestObservationRecord=c}else this._latestObservationFeature=null;return this._trackLineGeometry=Z(this._trackLinePath,this._spatialReference),this._bounds=N(this._trackLineGeometry),this._nextObservationRecords=[],i}updateStatistics(t,e){this._statistics=F.create(this._fields);const r=t.map(t=>t.reader.getCursor());for(const{chunkIndex:a,featureIndex:i}of this._observationRecords){const t=r[a];s(t),t.setIndex(i),this._statistics.insert(t,e)}}overlapsTile(t){for(const e of this._bounds)if(n(e,t.bounds,M))return!0;return!1}getLatestObservationFeatureForTile(t){if(null==this._latestObservationFeature)return null;const{objectId:e,displayId:s,geometry:r,attributes:a}=this._latestObservationFeature,i=m(r,this._metadata.geometryType,t.subscription.tile.transform)??new b,o=l(1/0,1/0,-1/0,-1/0);E(i,(t,e)=>d(o,[t,e]));if(!c(o,l(0,0,k,k)))return null;return new g(i,a,null,e,s)}getTrackLineFeatureForTile(t){const e=m(this._trackLineGeometry,"esriGeometryPolyline",t.subscription.tile.transform)??new b;return new g(e,this._trackLineAttributes,null,this.objectId,this.displayId)}getTrackLineOptimizedFeature(){return new g(this._trackLineGeometry,this._trackLineAttributes,null,this.objectId,this.displayId)}getTrackLineDisplayFeature(){const{_trackLineGeometry:t,_trackLineAttributes:e,displayId:s}=this;return{geometry:f(t,"esriGeometryPolyline",!1,!1),attributes:e,displayId:s}}_commitObservation(t,e){const s=e.readCentroidWorldSpace();let r=s?.coords[0],a=s?.coords[1];null==s&&(r=e.readXWorldSpace(),a=e.readYWorldSpace()),null!=r&&null!=a&&(this._observationRecords.unshift(t),this._trackLinePath.unshift([r,a]))}}class U extends S{constructor(t){super(t),this.done=!1}}class q extends j{static async create(t,e,s,i,o){const n=e.metadata.outSpatialReference,l=new w({spatialReference:n}),c=await Promise.all(t.fields.map(async t=>O.create(l,t))),u=t.featureFilter?await D.create({geometryType:e.metadata.geometryType,hasM:!1,hasZ:!1,timeInfo:e.metadata.timeInfo,fieldsIndex:e.metadata.fieldsIndex,spatialReference:n,filterJSON:t.featureFilter}):null;return n.isWrappable||r()||await Promise.all([import("../../../../../geometry/operators/support/apiConverter.js"),import("../../../../../geometry/operators/support/jsonConverter.js"),a()]).then(([t,e,s])=>{G={fromGeometryToGXGeometry:e.fromGeometryToGXGeometry,toGeometry:e.toGeometry,fromSpatialReference:t.fromSpatialReference}}),new q(t,e,s,n,c,u,i,o)}constructor(t,e,s,r,a,i,o,n){super(e,s,r,a,n),this._schema=t,this._featureFilter=i,this._arcadeContextInfo=o,this._tracks=new Map,this._handledChunks=new Set,this._metadata=e.metadata.weakCloneWithAdditionalFields([{name:y,alias:"trackPart",type:"esriFieldTypeSmallInteger"}]),this._trackLineMetadata=L.createFeature({geometryType:"esriGeometryPolyline",featureIdInfo:{type:"object-id",fieldName:"aggregateId"},fieldsIndex:{fields:[...this._source.metadata.fieldsIndex.fields,...this.aggregateFields,{name:y,alias:"trackPart",type:"esriFieldTypeSmallInteger"},{name:"aggregateId",alias:"aggregateId",type:"esriFieldTypeOID"}],timeZoneByFieldName:null},globalIdField:null,spatialReference:e.metadata.spatialReference,outSpatialReference:e.metadata.outSpatialReference,subtypeField:null,subtypes:null,timeInfo:e.metadata.timeInfo,timeReferenceUnknownClient:null,dateFieldsTimeZone:null,typeIdField:null,types:null,hasZ:!1,hasM:!1})}destroy(){super.destroy(),this._clear()}get _isStream(){return this._source.isStream}get enablePixelBuffering(){return!0}get isAggregate(){return!1}requiresInvalidation(){return!0}invalidate(){super.invalidate(),this._clear()}createState(t){return new U(t)}async applyOverrideUpdate(t){return P().error("Applying override to tracks is not supported"),null}displayMap(t,e,s){const r=new Map(t.map(t=>[e(t),t])),a=[];for(const i of this._tracks.values()){const t=r.get(i.objectId);if(null!=t){const e=s(i.displayId,t,i.objectId);a.push(e),r.delete(i.objectId);continue}const e=i.latestObservationFeature;if(e?.objectId){const t=r.get(e.objectId);if(null!=t){const i=s(e.displayId,t,e.objectId);a.push(i),r.delete(e.objectId);continue}}for(const o of i.observations()){const t=r.get(o.objectId);if(null!=t){const e=s(o.displayId,t,o.objectId);a.push(e),r.delete(o.objectId)}}}return a}getDisplayFeatures(t){const e=new Set(t),s=[],r=[],a=this._source.chunks().map(t=>t.reader.getCursor());for(const i of this._tracks.values()){if(e.has(i.displayId)&&r.push(i.getTrackLineDisplayFeature()),null!=i.latestObservationFeature&&e.has(i.latestObservationFeature.displayId)){const{displayId:t,chunkIndex:e,featureIndex:r}=i.latestObservationRecord,o=a[e];o.setIndex(r),s.push({displayId:t,...o.readLegacyFeatureWorldSpace()})}for(const{displayId:t,chunkIndex:r,featureIndex:o}of i.observations())if(e.has(t)){const e=a[r];e.setIndex(o),s.push({displayId:t,...e.readLegacyFeatureWorldSpace()})}}return{features:s,aggregates:[],tracks:r}}getFeatureObjectIdsForAggregate(t){for(const e of this._tracks.values())if(e.objectId===t)return Array.from(e.observations(),t=>t.objectId);return[]}async updateChunks(){0===this._handledChunks.size&&this._rebuildTracks();const t=new x;for(const e of this._sendStates.values())this._update(t,e);return t}forEachAggregateWorldSpace(t){for(const e of this._tracks.values())t(e.getTrackLineOptimizedFeature())}_clear(){for(const t of this._source.chunks())if(this._handledChunks.has(t.chunkId)){const e=t.reader.getCursor();for(;e.next();){const t=e.getObjectId();this._attributeStore.releaseDisplayIdForObjectId(t)}}this._handledChunks.clear();for(const t of this._tracks.values())this._removeTrack(t);this._tracks.clear()}_rebuildTracks(){const t=this._source.chunks();if(!t.length)return;const e=this._metadata.timeInfo?.trackIdField;if(null==e)return;const s=new Set;for(let r=0;r<t.length;r++){const a=t[r];if(this._handledChunks.has(a.chunkId))continue;this._handledChunks.add(a.chunkId);const i=a.reader.getCursor();for(;i.next();){const t=i.getObjectId();i.setDisplayId(this._attributeStore.createDisplayIdForObjectId(t));const a=i.readAttribute(e);if(null!=a&&null!=t&&(null===this._featureFilter||this._featureFilter.check(i,this._sqlOptions))){if(!this._tracks.has(a)){const t=z.getOid(a),e=this._attributeStore.createDisplayIdForObjectId(t),s=new z(this._schema,a,t,e,this.aggregateFields,this.spatialReference,this._source.metadata,this._isStream);this._tracks.set(a,s)}this._tracks.get(a).stageObservation(r,i),s.add(a)}}}for(const r of this._tracks.values())if(s.has(r.trackId)){const e=r.commitObservations(this._attributeStore,t,this._featureFilter?.timeExtent);for(const t of e)this._attributeStore.releaseDisplayIdForObjectId(t);r.updateStatistics(t,R(1,this._arcadeContextInfo))}else this._removeTrack(r)}_removeTrack(t){this._tracks.delete(t.trackId),this._attributeStore.releaseDisplayIdForObjectId(t.objectId),null!=t.latestObservationFeature&&this._attributeStore.releaseDisplayIdForObjectId(t.latestObservationFeature.objectId)}_update(e,s){if(s.done)return;s.done=!this._source.updateTracking.updating;const r=[],a=[];for(const t of this._tracks.values())if(t.length>0){if(this._schema.showLatestObservation){const e=t.getLatestObservationFeatureForTile(s);null!=e&&r.push(e)}this._schema.showTrackLine&&t.overlapsTile(s.subscription.tile)&&a.push(t.getTrackLineFeatureForTile(s))}const i=C.fromOptimizedFeatures(r,this._metadata,s.subscription.tile.transform),o=C.fromOptimizedFeatures(a,this._trackLineMetadata,s.subscription.tile.transform);let n=[];if(this._schema.showPreviousObservations){const e=this._source.chunks().map(()=>[]);for(const t of this._tracks.values())for(const{chunkIndex:s,featureIndex:r}of t.previousObservations())e[s].push(r);n=this._source.chunks().map((t,r)=>{const a=t.getTileReader(s.subscription.tile);if(null==a)return null;const i=A.from(a,e[r]);return i.setProcessorAttributes({[y]:2}),"esriGeometryPoint"!==i.geometryType&&null!=i.getInTransform()||i.setTransformForDisplay(s.subscription.tile.transform),i}).filter(t)}this.events.emit("changed");const l=s.subscription.tile.createArcadeEvaluationOptions(this._arcadeContextInfo),c=o.getCursor();for(;c.next();)this._attributeStore.setAttributeData(c.getDisplayId(),c,l,this._sqlOptions);for(const t of n){const e=t.getCursor();for(;e.next();)this._attributeStore.setAttributeData(e.getDisplayId(),e,l,this._sqlOptions)}const u=i.getCursor();for(;u.next();)this._attributeStore.setAttributeData(u.getDisplayId(),u,l,this._sqlOptions);e.messages.push(new T(s.subscription,o,!1,{}));for(const t of n)e.messages.push(new T(s.subscription,t,!1,{}));e.messages.push(new T(s.subscription,i,s.done,{}))}}function Z(t,e){if(t.length<2)return _({paths:[t]},!1,!1);if(e.isWrappable){let s=!1;for(let r=1;r<t.length;r++){const a=t[r][0],i=h(a,t[r-1][0],e);a!==i&&(t[r][0]=i,s=!0)}if(s){const s=p({paths:[t],spatialReference:e});if(null!=s)return _({paths:s.paths},!1,!1)}return _({paths:[t]},!1,!1)}const s=G.fromGeometryToGXGeometry({hasM:!1,hasZ:!1,paths:[t]}),r=G.fromSpatialReference(e);if(null!=r){const t=i(s,1e6,r,o.geodesic);if(null!=t){const e=G.toGeometry(t,r);if(null!=e&&"paths"in e)return _({paths:e.paths},!1,!1)}}return _({paths:[t]},!1,!1)}function E(t,e){const s=2,{coords:r,lengths:a}=t;if(!a.length)return void e(r[0],r[1]);let i=0;for(let o=0;o<a.length;o++){const t=a[o];let n=0,l=0;for(let a=0;a<t;a++)n+=r[s*(a+i)],l+=r[s*(a+i)+1],e(n,l);i+=t}}function N(t){const{lengths:e,coords:s}=t,r=2;if(!e.length)return[u()];const a=[];let i=0;for(let o=0;o<e.length;o++){const t=e[o],n=u();a.push(n);for(let e=0;e<t;e++){const t=s[r*(e+i)],a=s[r*(e+i)+1];d(n,[t,a])}i+=t}return a}export{q as TrackStrategy};
@@ -1,2 +1,2 @@
1
1
  /* COPYRIGHT Esri - https://js.arcgis.com/5.1/LICENSE.txt */
2
- import{ASourceChunk as e}from"./ASourceChunk.js";class t extends e{constructor(e,t){super(),this._reader=e,this._tile=t;const r=this._reader.getCursor();r.next();const s=r.getObjectId();this.chunkId=`${this._tile.key.id}.${s}${this.end?"e":""}`,this.normalizedChunkId=this.chunkId}get reader(){return this._reader}get first(){return!1}get end(){return!1}get queryInfo(){return{type:"snapshot",chunkId:this.chunkId,size:this.size(),end:this.end}}get isTiled(){return!1}get tile(){return this._tile}getTileReader(e){if(this._tile.key.id!==e.key.id)return null;const t=this.queryFeaturesInBounds(e.bounds);return t.setTransformForDisplay(e.transform),t}}export{t as ByReferenceTileSourceChunk};
2
+ import{ASourceChunk as e}from"./ASourceChunk.js";class t extends e{constructor(e,t){super(),this._reader=e,this._tile=t;const r=this._reader.getCursor();r.next();const s=r.getObjectId();this.chunkId=`${this._tile.key.id}.${s}${this.end?"e":""}`,this.normalizedChunkId=this.chunkId}get reader(){return this._reader}get first(){return!1}get end(){return!1}get queryInfo(){return{type:"snapshot",chunkId:this.chunkId,size:this.size(),end:this.end}}get lodInfo(){return null}get tile(){return this._tile}getTileReader(e){if(this._tile.key.id!==e.key.id)return null;const t=this.queryFeaturesInBounds(e.bounds);return t.setTransformForDisplay(e.transform),t}}export{t as ByReferenceTileSourceChunk};
@@ -1,2 +1,2 @@
1
1
  /* COPYRIGHT Esri - https://js.arcgis.com/5.1/LICENSE.txt */
2
- import{ASourceChunk as e}from"./ASourceChunk.js";class i extends e{constructor(e,i,t,r,s,h){super(),this._reader=e,this._queryJSON=i,this._tile=t,this._sourceTile=r,this._sourceTileDepth=s,this._end=h,this.chunkId=`${this._tile.key.id}.${this._sourceTile?.key.id}${this._end?"e":""}`,this.normalizedChunkId=`${this._tile.key.normalizedId}.${this._sourceTile?.key.normalizedId}${this._end?"e":""}`}get queryInfo(){return{type:"drill-down-tile",chunkId:this.chunkId,tileId:this._tile.key.id,queryJSON:this._queryJSON,sourceTileDepth:this._sourceTileDepth,sourceTileId:this._sourceTile?.key.id,size:this.size(),end:this.end}}get first(){return 0===this._sourceTileDepth}get reader(){return this._reader}get end(){return this._end}get tile(){return this._tile}get isTiled(){return!0}getTileReader(e){return this._tile.key.id===e.key.id?this.reader:null}}export{i as DrillDownTileSourceChunk};
2
+ import{ASourceChunk as e}from"./ASourceChunk.js";class t extends e{constructor(e,t,i,r,s,h){super(),this._reader=e,this._queryJSON=t,this._tile=i,this._sourceTile=r,this._sourceTileDepth=s,this._end=h,this.chunkId=`${this._tile.key.id}.${this._sourceTile?.key.id}${this._end?"e":""}`,this.normalizedChunkId=`${this._tile.key.normalizedId}.${this._sourceTile?.key.normalizedId}${this._end?"e":""}`}get queryInfo(){return{type:"drill-down-tile",chunkId:this.chunkId,tileId:this._tile.key.id,queryJSON:this._queryJSON,sourceTileDepth:this._sourceTileDepth,sourceTileId:this._sourceTile?.key.id,size:this.size(),end:this.end}}get first(){return 0===this._sourceTileDepth}get reader(){return this._reader}get end(){return this._end}get tile(){return this._tile}get lodInfo(){return{level:this.tile.level}}getTileReader(e){return this._tile.key.id===e.key.id?this.reader:null}}export{t as DrillDownTileSourceChunk};
@@ -1,2 +1,2 @@
1
1
  /* COPYRIGHT Esri - https://js.arcgis.com/5.1/LICENSE.txt */
2
- import{ASourceChunk as e}from"./ASourceChunk.js";class t extends e{constructor(e,t,s,r,i=0){super(),this._reader=e,this._queryJSON=t,this._page=s,this._end=r,this.fileIndex=i,this.chunkId=`${this.fileIndex}.${this._page}${this.end?"e":""}`,this.normalizedChunkId=this.chunkId}get reader(){return this._reader}get first(){return 0===this._page}get end(){return this._end}get queryInfo(){return{type:"snapshot",chunkId:this.chunkId,queryJSON:this._queryJSON,page:this._page,size:this.size(),end:this.end}}get isTiled(){return!1}getTileReader(e){const t=this.queryFeaturesInBounds(e.bounds);return t.setTransformForDisplay(e.transform),t}}export{t as FeatureSnapshotSourceChunk};
2
+ import{ASourceChunk as e}from"./ASourceChunk.js";class t extends e{constructor(e,t,r,s,n=0){super(),this._reader=e,this._queryJSON=t,this._page=r,this._end=s,this.fileIndex=n,this.chunkId=`${this.fileIndex}.${this._page}${this.end?"e":""}`,this.normalizedChunkId=this.chunkId}get reader(){return this._reader}get first(){return 0===this._page}get end(){return this._end}get queryInfo(){return{type:"snapshot",chunkId:this.chunkId,queryJSON:this._queryJSON,page:this._page,size:this.size(),end:this.end}}get lodInfo(){return null}getTileReader(e){const t=this.queryFeaturesInBounds(e.bounds);return t.setTransformForDisplay(e.transform),t}}export{t as FeatureSnapshotSourceChunk};
@@ -1,2 +1,2 @@
1
1
  /* COPYRIGHT Esri - https://js.arcgis.com/5.1/LICENSE.txt */
2
- import{parseWhereClause as e}from"../../../../../../../core/sql.js";import{ASourceChunk as t}from"./ASourceChunk.js";import{FeatureSetReaderJSON as s}from"../../../support/FeatureSetReaderJSON.js";const r=1e4,i=1e3;class a{static async create(t){const{metadata:s,definitionExpression:r}=t,i=r?await e(r,s.fieldsIndex):null;return new a(s,i,r)}constructor(e,t,s){this.metadata=e,this._clause=t,this._definitionExpression=s}get hash(){return this._definitionExpression}testFeature(e){return null==this._clause||this._clause.testFeature(e)}}class o{constructor(){this.modified=new Map,this.removed=new Set}modify(e){this.modified.set(e.objectId,e),this.removed.has(e.objectId)&&this.removed.delete(e.objectId)}remove(e){this.modified.delete(e),this.removed.add(e)}get isEmpty(){return 0===this.modified.size&&0===this.removed.size}applyWhereClause(e){const t=new o;for(const[s,r]of this.modified)e.testFeature(r)?t.modified.set(s,r):t.removed.add(r.objectId);for(const s of this.removed)t.removed.add(s);return t}}class n extends t{constructor(e){super(),this._reader=e,this.chunkId="override",this.normalizedChunkId="override"}static fromFeatures(e,t){const r=s.fromOptimizedFeatures(e,t);return new n(r)}get reader(){return this._reader}get queryInfo(){return{}}get first(){return!1}get end(){return!1}get isTiled(){return!1}getTileReader(e){if(!this._reader.getSize())return null;const t=this.queryFeaturesInBounds(e.bounds);return t.setTransformForDisplay(e.transform),t}}class d{constructor(e,t){this.inner=e,this.isWeak=t,this.lastWeak=null}get isStrong(){return!this.isWeak}}class h{constructor(e){this._parameters=e,this._overrides=new Map,this._update=new o,this._lastCleanup=0}update(e){this._parameters=e}hasOverride(e){return this._overrides.has(e)}onChunkInsert(e){if(this._overrides.size){const t=e.reader.getCursor();for(;t.next();){const e=t.getObjectId(),s=this._overrides.get(e);if(s?.lastWeak&&(s.lastWeak=null),s?.isWeak){const e=t.readOptimizedFeatureWorldSpace(),r=s.inner?.attributes??{};e.attributes={...r,...e.attributes},s.inner=e,this._update.modify(e),this.invalidate()}}}e.registerOverrides(this)}apply(e,t){const{updateWeak:s,removeWeak:r,update:i,remove:a,release:o}=e.commands;this.invalidate();for(const n of s){const e=new d(n,!0),t=this._overrides.get(n.objectId);t?.isStrong?t.lastWeak=e:(this._overrides.set(n.objectId,e),this._update.modify(n))}for(const n of i){const e=new d(n,!1),t=this._overrides.get(n.objectId);e.lastWeak=t?.isWeak?t:t?.lastWeak??null,this._overrides.set(n.objectId,e),this._update.modify(n)}for(const n of r){const e=new d(null,!0),t=this._overrides.get(n);t?.isStrong?t.lastWeak=e:(this._overrides.set(n,e),this._update.remove(n))}for(const n of a){const e=new d(null,!1),t=this._overrides.get(n);e.lastWeak=t?.isWeak?t:t?.lastWeak??null,this._overrides.set(n,e),this._update.remove(n)}if(o.length){const e=new Set;for(const t of o){const s=this._overrides.get(t);s?.lastWeak?(this._overrides.set(t,s.lastWeak),null==s.lastWeak.inner?this._update.remove(t):this._update.modify(s.lastWeak.inner)):s&&!s.isWeak&&(this._overrides.delete(t),e.add(t))}t.forEachUnsafe(t=>{const s=t.getObjectId();e.has(s)&&(this._update.modify(t.readOptimizedFeatureWorldSpace()),e.delete(s))});for(const t of e.values())this._update.remove(t)}}clearWeakOverrides(){for(const[e,t]of this._overrides.entries())t.isWeak&&this._overrides.delete(e);this.invalidate()}cleanup(e){if(this._overrides.size<r)return;const t=performance.now();if(t-this._lastCleanup<i)return;this._lastCleanup=t;const s=this._getWeakDeletions();if(!(s.size<r)){for(const t of e){const e=t.reader.withoutOverrides().getCursor();for(;e.next();){const t=e.getObjectId();s.delete(t)}}for(const e of s)this._overrides.delete(e);s.size&&this.invalidate()}}takeOverrideUpdate(){const e=this._update;return e.isEmpty?null:(this._update=new o,e.applyWhereClause(this._parameters))}asChunk(){const e=this._parameters;if(this._lastOverrideParametersHash!==e.hash&&(this._lastOverrideParametersHash=e.hash,this._chunk=null),!this._chunk){const t=[];for(const s of this._overrides.values())null!=s.inner&&e.testFeature(s.inner)&&t.push(s.inner);this._chunk=n.fromFeatures(t,e.metadata)}return this._chunk}invalidate(){this._chunk=null}putWeakObjectIdsFromGlobalIds(e,t,s){for(const[r,i]of this._overrides.entries()){if(i.isWeak&&null!=i.inner){const a=i.inner.attributes[s];a&&t.has(a)&&!e.has(a)&&e.set(a,r);continue}if(null!=i.lastWeak&&null!=i.lastWeak.inner){const a=i.lastWeak.inner.attributes[s];a&&t.has(a)&&!e.has(a)&&e.set(a,r)}}}_getWeakDeletions(){const e=new Set;for(const[t,s]of this._overrides.entries())s.isWeak&&null==s.inner&&e.add(t);return e}}export{n as OverrideChunk,a as OverrideParameters,h as OverrideState,o as OverrideUpdate};
2
+ import{parseWhereClause as e}from"../../../../../../../core/sql.js";import{ASourceChunk as t}from"./ASourceChunk.js";import{FeatureSetReaderJSON as s}from"../../../support/FeatureSetReaderJSON.js";const r=1e4,i=1e3;class a{static async create(t){const{metadata:s,definitionExpression:r}=t,i=r?await e(r,s.fieldsIndex):null;return new a(s,i,r)}constructor(e,t,s){this.metadata=e,this._clause=t,this._definitionExpression=s}get hash(){return this._definitionExpression}testFeature(e){return null==this._clause||this._clause.testFeature(e)}}class o{constructor(){this.modified=new Map,this.removed=new Set}modify(e){this.modified.set(e.objectId,e),this.removed.has(e.objectId)&&this.removed.delete(e.objectId)}remove(e){this.modified.delete(e),this.removed.add(e)}get isEmpty(){return 0===this.modified.size&&0===this.removed.size}applyWhereClause(e){const t=new o;for(const[s,r]of this.modified)e.testFeature(r)?t.modified.set(s,r):t.removed.add(r.objectId);for(const s of this.removed)t.removed.add(s);return t}}class n extends t{constructor(e){super(),this._reader=e,this.chunkId="override",this.normalizedChunkId="override"}static fromFeatures(e,t){const r=s.fromOptimizedFeatures(e,t);return new n(r)}get reader(){return this._reader}get queryInfo(){return{}}get first(){return!1}get end(){return!1}get lodInfo(){return null}getTileReader(e){if(!this._reader.getSize())return null;const t=this.queryFeaturesInBounds(e.bounds);return t.setTransformForDisplay(e.transform),t}}class d{constructor(e,t){this.inner=e,this.isWeak=t,this.lastWeak=null}get isStrong(){return!this.isWeak}}class h{constructor(e){this._parameters=e,this._overrides=new Map,this._update=new o,this._lastCleanup=0}update(e){this._parameters=e}hasOverride(e){return this._overrides.has(e)}onChunkInsert(e){if(this._overrides.size){const t=e.reader.getCursor();for(;t.next();){const e=t.getObjectId(),s=this._overrides.get(e);if(s?.lastWeak&&(s.lastWeak=null),s?.isWeak){const e=t.readOptimizedFeatureWorldSpace(),r=s.inner?.attributes??{};e.attributes={...r,...e.attributes},s.inner=e,this._update.modify(e),this.invalidate()}}}e.registerOverrides(this)}apply(e,t){const{updateWeak:s,removeWeak:r,update:i,remove:a,release:o}=e.commands;this.invalidate();for(const n of s){const e=new d(n,!0),t=this._overrides.get(n.objectId);t?.isStrong?t.lastWeak=e:(this._overrides.set(n.objectId,e),this._update.modify(n))}for(const n of i){const e=new d(n,!1),t=this._overrides.get(n.objectId);e.lastWeak=t?.isWeak?t:t?.lastWeak??null,this._overrides.set(n.objectId,e),this._update.modify(n)}for(const n of r){const e=new d(null,!0),t=this._overrides.get(n);t?.isStrong?t.lastWeak=e:(this._overrides.set(n,e),this._update.remove(n))}for(const n of a){const e=new d(null,!1),t=this._overrides.get(n);e.lastWeak=t?.isWeak?t:t?.lastWeak??null,this._overrides.set(n,e),this._update.remove(n)}if(o.length){const e=new Set;for(const t of o){const s=this._overrides.get(t);s?.lastWeak?(this._overrides.set(t,s.lastWeak),null==s.lastWeak.inner?this._update.remove(t):this._update.modify(s.lastWeak.inner)):s&&!s.isWeak&&(this._overrides.delete(t),e.add(t))}t.forEachUnsafe(t=>{const s=t.getObjectId();e.has(s)&&(this._update.modify(t.readOptimizedFeatureWorldSpace()),e.delete(s))});for(const t of e.values())this._update.remove(t)}}clearWeakOverrides(){for(const[e,t]of this._overrides.entries())t.isWeak&&this._overrides.delete(e);this.invalidate()}cleanup(e){if(this._overrides.size<r)return;const t=performance.now();if(t-this._lastCleanup<i)return;this._lastCleanup=t;const s=this._getWeakDeletions();if(!(s.size<r)){for(const t of e){const e=t.reader.withoutOverrides().getCursor();for(;e.next();){const t=e.getObjectId();s.delete(t)}}for(const e of s)this._overrides.delete(e);s.size&&this.invalidate()}}takeOverrideUpdate(){const e=this._update;return e.isEmpty?null:(this._update=new o,e.applyWhereClause(this._parameters))}asChunk(){const e=this._parameters;if(this._lastOverrideParametersHash!==e.hash&&(this._lastOverrideParametersHash=e.hash,this._chunk=null),!this._chunk){const t=[];for(const s of this._overrides.values())null!=s.inner&&e.testFeature(s.inner)&&t.push(s.inner);this._chunk=n.fromFeatures(t,e.metadata)}return this._chunk}invalidate(){this._chunk=null}putWeakObjectIdsFromGlobalIds(e,t,s){for(const[r,i]of this._overrides.entries()){if(i.isWeak&&null!=i.inner){const a=i.inner.attributes[s];a&&t.has(a)&&!e.has(a)&&e.set(a,r);continue}if(null!=i.lastWeak&&null!=i.lastWeak.inner){const a=i.lastWeak.inner.attributes[s];a&&t.has(a)&&!e.has(a)&&e.set(a,r)}}}_getWeakDeletions(){const e=new Set;for(const[t,s]of this._overrides.entries())s.isWeak&&null==s.inner&&e.add(t);return e}}export{n as OverrideChunk,a as OverrideParameters,h as OverrideState,o as OverrideUpdate};
@@ -1,2 +1,2 @@
1
1
  /* COPYRIGHT Esri - https://js.arcgis.com/5.1/LICENSE.txt */
2
- import{ASourceChunk as e}from"./ASourceChunk.js";class t extends e{constructor(e,t,i,r,s){super(),this._reader=e,this._queryJSON=t,this._tile=i,this._page=r,this._end=s,this.chunkId=`${this._tile.key.id}.${this._page}${this.end?"e":""}`,this.normalizedChunkId=`${this._tile.key.normalizedId}.${this._page}${this.end?"e":""}`}get queryInfo(){return{type:"paged-tile",chunkId:this.chunkId,tileId:this._tile.key.id,queryJSON:this._queryJSON,page:this._page,size:this.size(),end:this.end}}get reader(){return this._reader}get first(){return 0===this._page}get end(){return this._end}get page(){return this._page}get tile(){return this._tile}get isTiled(){return!0}getTileReader(e){return this._tile.key.id===e.key.id?this.reader:null}}export{t as PagedTileSourceChunk};
2
+ import{ASourceChunk as e}from"./ASourceChunk.js";class t extends e{constructor(e,t,i,r,s){super(),this._reader=e,this._queryJSON=t,this._tile=i,this._page=r,this._end=s,this.chunkId=`${this._tile.key.id}.${this._page}${this.end?"e":""}`,this.normalizedChunkId=`${this._tile.key.normalizedId}.${this._page}${this.end?"e":""}`}get queryInfo(){return{type:"paged-tile",chunkId:this.chunkId,tileId:this._tile.key.id,queryJSON:this._queryJSON,page:this._page,size:this.size(),end:this.end}}get reader(){return this._reader}get first(){return 0===this._page}get end(){return this._end}get page(){return this._page}get tile(){return this._tile}get lodInfo(){return{level:this.tile.level}}getTileReader(e){return this._tile.key.id===e.key.id?this.reader:null}}export{t as PagedTileSourceChunk};
@@ -1,2 +1,2 @@
1
1
  /* COPYRIGHT Esri - https://js.arcgis.com/5.1/LICENSE.txt */
2
- import{ASourceChunk as e}from"./ASourceChunk.js";import{FeatureSetReaderJSON as t}from"../../../support/FeatureSetReaderJSON.js";class s extends e{constructor(e,t,s,r,i){super(),this._metadata=e,this._reader=t,this._page=s,this._end=r,this._fileId=i,this.chunkId=`${this._fileId}.${this._page}${this.end?"e":""}`,this.normalizedChunkId=this.chunkId}get reader(){return this._reader??t.empty(this._metadata)}get first(){return 0===this._page}get end(){return this._end}get queryInfo(){return{type:"snapshot",chunkId:this.chunkId,page:this._page,size:this.size(),end:this.end}}get isTiled(){return!1}async updateFields(e,t,s){if(null!=this._fileId)return this._reader?.updateFields(e,this._fileId,t,s)}getTileReader(e){const t=this.queryFeaturesInBounds(e.bounds);return t.setTransformForDisplay(e.transform),t}}export{s as ParquetSnapshotSourceChunk};
2
+ import{ASourceChunk as e}from"./ASourceChunk.js";import{FeatureSetReaderJSON as t}from"../../../support/FeatureSetReaderJSON.js";class s extends e{constructor(e,t,s,r,i){super(),this._metadata=e,this._reader=t,this._page=s,this._end=r,this._fileId=i,this.chunkId=`${this._fileId}.${this._page}${this.end?"e":""}`,this.normalizedChunkId=this.chunkId}get reader(){return this._reader??t.empty(this._metadata)}get first(){return 0===this._page}get end(){return this._end}get queryInfo(){return{type:"snapshot",chunkId:this.chunkId,page:this._page,size:this.size(),end:this.end}}get lodInfo(){return null}async updateFields(e,t,s){if(null!=this._fileId)return this._reader?.updateFields(e,this._fileId,t,s)}getTileReader(e){const t=this.queryFeaturesInBounds(e.bounds);return t.setTransformForDisplay(e.transform),t}}export{s as ParquetSnapshotSourceChunk};
@@ -1,2 +1,2 @@
1
1
  /* COPYRIGHT Esri - https://js.arcgis.com/5.1/LICENSE.txt */
2
- import{ASourceChunk as e}from"./ASourceChunk.js";import{FeatureSetReaderJSON as t}from"../../../support/FeatureSetReaderJSON.js";class i extends e{constructor(e,t,i,s,r,d){super(),this._metadata=e,this._reader=t,this._tile=i,this._fileId=s,this._page=r,this._end=d,this.chunkId=`${this._tile.key.id}.${this._fileId}.${this._page}${this.end?"e":""}`,this.normalizedChunkId=`${this._tile.key.normalizedId}.${this._fileId}.${this._page}${this.end?"e":""}`}get reader(){return this._reader??t.empty(this._metadata)}get first(){return 0===this._page}get end(){return this._end}get tile(){return this._tile}get queryInfo(){return{type:"parquet",chunkId:this.chunkId,queryJSON:null,page:this._page,size:this.size(),tileId:this._tile.id,end:this.end}}get isTiled(){return!0}async updateFields(e,t,i){if(null!=this._fileId)return this._reader?.updateFields(e,this._fileId,t,i)}getTileReader(e){return this._tile.key.id===e.key.id?this.reader:null}}export{i as ParquetSourceChunk};
2
+ import{ASourceChunk as e}from"./ASourceChunk.js";import{FeatureSetReaderJSON as t}from"../../../support/FeatureSetReaderJSON.js";class i extends e{constructor(e,t,i,s,r,d){super(),this._metadata=e,this._reader=t,this._tile=i,this._fileId=s,this._page=r,this._end=d,this.chunkId=`${this._tile.key.id}.${this._fileId}.${this._page}${this.end?"e":""}`,this.normalizedChunkId=`${this._tile.key.normalizedId}.${this._fileId}.${this._page}${this.end?"e":""}`}get reader(){return this._reader??t.empty(this._metadata)}get first(){return 0===this._page}get end(){return this._end}get tile(){return this._tile}get queryInfo(){return{type:"parquet",chunkId:this.chunkId,queryJSON:null,page:this._page,size:this.size(),tileId:this._tile.id,end:this.end}}get lodInfo(){return{level:this._tile.level}}async updateFields(e,t,i){if(null!=this._fileId)return this._reader?.updateFields(e,this._fileId,t,i)}getTileReader(e){return this._tile.key.id===e.key.id?this.reader:null}}export{i as ParquetSourceChunk};
@@ -1,2 +1,2 @@
1
1
  /* COPYRIGHT Esri - https://js.arcgis.com/5.1/LICENSE.txt */
2
- import{ASourceChunk as e}from"./ASourceChunk.js";class r extends e{constructor(e){super(),this._reader=e,this.chunkId="stream-chunk",this.normalizedChunkId="stream-chunk"}get reader(){return this._reader}get first(){return!0}get end(){return!0}get queryInfo(){return{type:"stream",chunkId:this.chunkId,size:this.size(),end:this.end}}get isTiled(){return!1}getTileReader(e){const r=this.queryFeaturesInBounds(e.bounds);return r.setTransformForDisplay(e.transform),r}}export{r as StreamSourceChunk};
2
+ import{ASourceChunk as e}from"./ASourceChunk.js";class r extends e{constructor(e){super(),this._reader=e,this.chunkId="stream-chunk",this.normalizedChunkId="stream-chunk"}get reader(){return this._reader}get first(){return!0}get end(){return!0}get queryInfo(){return{type:"stream",chunkId:this.chunkId,size:this.size(),end:this.end}}get lodInfo(){return null}getTileReader(e){const r=this.queryFeaturesInBounds(e.bounds);return r.setTransformForDisplay(e.transform),r}}export{r as StreamSourceChunk};
@@ -1,2 +1,2 @@
1
1
  /* COPYRIGHT Esri - https://js.arcgis.com/5.1/LICENSE.txt */
2
- import"../../../../../core/has.js";import{baseObjectMemory as e}from"../../../../../core/memoryEstimations.js";import t from"../../../../../layers/graphics/OptimizedGeometry.js";import{getParquetObjectId as r}from"../../../../../layers/graphics/sources/support/parquetIdUtils.js";import{QuantizedGeometryBuffer as s}from"../../../../../chunks/bundle2.js";import{FeatureSetReader as n}from"./FeatureSetReader.js";let i;const d=new TextDecoder;class o extends n{constructor(t,r,s,n,i,d=new Uint32Array(s.size())){super(t),this._indexMap=r,this._inner=s,this._fileId=n,this._transform=i,this._displayIds=d,this._index=-1,this.usedMemory=e,this._size=this._inner.size();t.featureIdInfo.type}destroy(){super.destroy(),this._inner.free()}get fields(){return this.metadata.fieldsIndex}get geometryType(){return this.metadata.geometryType}get hasFeatures(){return!0}get hasNext(){throw new Error("Method not implemented.")}get exceededTransferLimit(){return!1}get hasZ(){return!1}get hasM(){return!1}async updateFields(e,t,r,s){const n=this._inner.rowGroup(),i=new Uint32Array(this._inner.readIdsUnsafe()),d=await e.createPatch(t,n,i,r,s);this._inner.insertPatchBytes(new Uint8Array(d))}getInTransform(){return this._transform}getSize(){return this._size}getCursor(){return this.copy()}getAttributeHash(){let e="";for(const t of this.fields.fields)e+=this._readAttribute(t.name,!1)+".";return e}getObjectId(){return r(this._fileId,this._inner.rowId(this._index))}getDisplayId(){return this._displayIds[this._index]}setDisplayId(e){this._displayIds[this._index]=e}setIndex(e){this._index=e}getBoundsXMin(){return this._inner.boundsXMin(this._index)}getBoundsYMin(){return this._inner.boundsYMin(this._index)}getBoundsXMax(){return this._inner.boundsXMax(this._index)}getBoundsYMax(){return this._inner.boundsYMax(this._index)}setBoundsXMin(e){throw new Error("InternalError: Setting bounds is unsupported")}setBoundsYMin(e){throw new Error("InternalError: Setting bounds is unsupported")}setBoundsXMax(e){throw new Error("InternalError: Setting bounds is unsupported")}setBoundsYMax(e){throw new Error("InternalError: Setting bounds is unsupported")}getIndex(){return this._index}next(){for(;++this._index<this._size&&!this._getExists(););return this._index<this._size}readGeometryArea(){return this.readGeometryForDisplay()?.area()??0}copy(){const e=new o(this.metadata,this._indexMap,this._inner,this._fileId,this._transform,this._displayIds);return this.copyInto(e),e}copyInto(e){super.copyInto(e),e._index=this._index}readGeometryForDisplayTransformed(e){const[r,n]=e.translate,[d,o]=e.scale;i||(i=s.new());return this._inner.transformGeometry(i,r,n,d,o,this._index)?new t(i.readLengthsUnsafe(),i.readCoordsUnsafe(),this.hasZ,this.hasM):null}_readGeometry(e){const r=this._inner.readCoordsUnsafe(this._index),s=this._inner.readLengthsUnsafe(this._index);return r&&s?new t(s,r,this.hasZ,this.hasM):null}_readX(){return this._inner.readX(this._index)}_readY(){return this._inner.readY(this._index)}_readServerCentroid(){return null}supportsDeltaEncoding(){return!1}_readAttribute(e,t){const r=this.fields.get(e);if(!r)return;const s=this._indexMap[r.name];if(null==s)return this.getObjectId();const n=this._inner.readAttribute(this._index,s);if(null==n)return n;if("esriFieldTypeString"===r.type||"esriFieldTypeDateOnly"===r.type||"esriFieldTypeTimeOnly"===r.type||"esriFieldTypeTimestampOffset"===r.type){const e=this._inner.readAttribute(this._index,s);return d.decode(e)}const i=this.fields.isDateField(r.name);return t?null==n?n:i?new Date(n):n:n}_readAttributes(){const e={};for(const t of this.metadata.fieldsIndex.fields){if(null==this._indexMap[t.name])continue;const r=this._readAttribute(t.name,!1);void 0!==r&&(e[t.name]=r)}return e.__OBJECTID=this.getObjectId(),e}}export{o as FeatureSetReaderParquet};
2
+ import"../../../../../core/has.js";import{baseObjectMemory as e}from"../../../../../core/memoryEstimations.js";import{minInt16 as t}from"../../../../../core/typedArrayUtil.js";import s from"../../../../../layers/graphics/OptimizedGeometry.js";import{getParquetObjectId as r}from"../../../../../layers/graphics/sources/support/parquetIdUtils.js";import{QuantizedGeometryBuffer as i}from"../../../../../chunks/bundle2.js";import{FeatureSetReader as n}from"./FeatureSetReader.js";let o;const d=new TextDecoder;class a extends n{constructor(s,r,i,n,o,d=new Uint32Array(i.size()),a,h){if(super(s),this._indexMap=r,this._inner=i,this._fileId=n,this._transform=o,this._displayIds=d,this._points=a,this._rowIds=h,this._index=-1,this._emptyNumberValue=0,this.usedMemory=e,this._size=this._inner.size(),this._rowIds||(this._rowIds=this._inner.readIdsUnsafe().slice()),!this._points&&"esriGeometryPoint"===this.geometryType){const e=this._inner.readPointCoordsQuantizedUnsafe()?.slice();e?(this._emptyNumberValue=t,this._points=e):(this._emptyNumberValue=NaN,this._points=this._inner.readPointCoordsUnsafe()?.slice())}s.featureIdInfo.type}destroy(){super.destroy(),this._inner.free()}get fields(){return this.metadata.fieldsIndex}get geometryType(){return this.metadata.geometryType}get hasFeatures(){return!0}get hasNext(){throw new Error("Method not implemented.")}get exceededTransferLimit(){return!1}get hasZ(){return!1}get hasM(){return!1}async updateFields(e,t,s,r){const i=this._inner.rowGroup(),n=new Uint32Array(this._inner.readIdsUnsafe()),o=await e.createPatch(t,i,n,s,r);this._inner.insertPatchBytes(new Uint8Array(o))}getInTransform(){return this._transform}getSize(){return this._size}getCursor(){return this.copy()}getAttributeHash(){let e="";for(const t of this.fields.fields)e+=this._readAttribute(t.name,!1)+".";return e}getObjectId(){const e=this._rowIds[this._index];return r(this._fileId,e)}getDisplayId(){return this._displayIds[this._index]}setDisplayId(e){this._displayIds[this._index]=e}setIndex(e){this._index=e}getBoundsXMin(){return this._inner.boundsXMin(this._index)}getBoundsYMin(){return this._inner.boundsYMin(this._index)}getBoundsXMax(){return this._inner.boundsXMax(this._index)}getBoundsYMax(){return this._inner.boundsYMax(this._index)}setBoundsXMin(e){throw new Error("InternalError: Setting bounds is unsupported")}setBoundsYMin(e){throw new Error("InternalError: Setting bounds is unsupported")}setBoundsXMax(e){throw new Error("InternalError: Setting bounds is unsupported")}setBoundsYMax(e){throw new Error("InternalError: Setting bounds is unsupported")}getIndex(){return this._index}next(){for(;++this._index<this._size&&!this._getExists(););return this._index<this._size}readGeometryArea(){return this.readGeometryForDisplay()?.area()??0}copy(){const e=new a(this.metadata,this._indexMap,this._inner,this._fileId,this._transform,this._displayIds,this._points,this._rowIds);return this.copyInto(e),e}copyInto(e){super.copyInto(e),e._index=this._index}readGeometryForDisplayTransformed(e){const[t,r]=e.translate,[n,d]=e.scale;o||(o=i.new());return this._inner.transformGeometry(o,t,r,n,d,this._index)?new s(o.readLengthsUnsafe(),o.readCoordsUnsafe(),this.hasZ,this.hasM):null}_readGeometry(e){const t=this._inner.readCoordsUnsafe(this._index),r=this._inner.readLengthsUnsafe(this._index);return t&&r?new s(r,t,this.hasZ,this.hasM):null}_readX(){if(this._points){const e=this._points[2*this._index];return e===this._emptyNumberValue?NaN:e}return this._inner.readX(this._index)}_readY(){if(this._points){const e=this._points[2*this._index+1];return e===this._emptyNumberValue?NaN:e}return this._inner.readY(this._index)}_readServerCentroid(){return null}supportsDeltaEncoding(){return!1}_readAttribute(e,t){const s=this.fields.get(e);if(!s)return;const r=this._indexMap[s.name];if(null==r)return this.getObjectId();const i=this._inner.readAttribute(this._index,r);if(null==i)return i;if("esriFieldTypeString"===s.type||"esriFieldTypeDateOnly"===s.type||"esriFieldTypeTimeOnly"===s.type||"esriFieldTypeTimestampOffset"===s.type){const e=this._inner.readAttribute(this._index,r);return d.decode(e)}const n=this.fields.isDateField(s.name);return t?null==i?i:n?new Date(i):i:i}_readAttributes(){const e={};for(const t of this.metadata.fieldsIndex.fields){if(null==this._indexMap[t.name])continue;const s=this._readAttribute(t.name,!1);void 0!==s&&(e[t.name]=s)}return e.__OBJECTID=this.getObjectId(),e}}export{a as FeatureSetReaderParquet};
@@ -1,2 +1,2 @@
1
1
  /* COPYRIGHT Esri - https://js.arcgis.com/5.1/LICENSE.txt */
2
- import"../core/shaderLibrary/ForwardLinearDepthToWriteShadowMap.glsl.js";import"../core/shaderLibrary/ShaderOutput.js";import"../core/shaderLibrary/Slice.glsl.js";import"../core/shaderLibrary/Transform.glsl.js";import"../core/shaderLibrary/attributes/ObjectAndLayerIdColor.glsl.js";import"../core/shaderLibrary/attributes/PathVertexPosition.glsl.js";import"../core/shaderLibrary/output/OutputDepth.glsl.js";import"../core/shaderLibrary/output/OutputHighlight.glsl.js";import"../core/shaderLibrary/shading/EvaluateAmbientOcclusion.glsl.js";import"../core/shaderLibrary/shading/EvaluateSceneLighting.glsl.js";import"../core/shaderLibrary/shading/MainLighting.glsl.js";import"../core/shaderLibrary/shading/Normals.glsl.js";import"../core/shaderLibrary/shading/NormalUtils.glsl.js";import"../core/shaderLibrary/shading/PhysicallyBasedRenderingParameters.glsl.js";import"../core/shaderLibrary/shading/ReadShadowMap.glsl.js";import"../core/shaderLibrary/util/ColorConversion.glsl.js";import"../core/shaderLibrary/util/View.glsl.js";import"../core/shaderModules/Float3PassUniform.js";import"../core/shaderModules/FloatPassUniform.js";import"../core/shaderModules/glsl.js";import"../effects/snowcover/SnowCover.glsl.js";import"../shaders/OutputColorHighlightOLID.glsl.js";import"../../../webgl/ShaderBuilder.js";export{b as build}from"../../../../chunks/Path.glsl.js";
2
+ import"../core/shaderLibrary/ForwardLinearDepthToWriteShadowMap.glsl.js";import"../core/shaderLibrary/Offset.glsl.js";import"../core/shaderLibrary/ShaderOutput.js";import"../core/shaderLibrary/Slice.glsl.js";import"../core/shaderLibrary/Transform.glsl.js";import"../core/shaderLibrary/attributes/ObjectAndLayerIdColor.glsl.js";import"../core/shaderLibrary/attributes/PathVertexPosition.glsl.js";import"../core/shaderLibrary/output/OutputDepth.glsl.js";import"../core/shaderLibrary/output/OutputHighlight.glsl.js";import"../core/shaderLibrary/shading/EvaluateAmbientOcclusion.glsl.js";import"../core/shaderLibrary/shading/EvaluateSceneLighting.glsl.js";import"../core/shaderLibrary/shading/MainLighting.glsl.js";import"../core/shaderLibrary/shading/Normals.glsl.js";import"../core/shaderLibrary/shading/NormalUtils.glsl.js";import"../core/shaderLibrary/shading/PhysicallyBasedRenderingParameters.glsl.js";import"../core/shaderLibrary/shading/ReadShadowMap.glsl.js";import"../core/shaderLibrary/util/ColorConversion.glsl.js";import"../core/shaderLibrary/util/View.glsl.js";import"../core/shaderModules/Float3PassUniform.js";import"../core/shaderModules/FloatPassUniform.js";import"../core/shaderModules/glsl.js";import"../effects/snowcover/SnowCover.glsl.js";import"../shaders/OutputColorHighlightOLID.glsl.js";import"../../../webgl/ShaderBuilder.js";export{b as build}from"../../../../chunks/Path.glsl.js";
@@ -1,2 +1,2 @@
1
1
  /* COPYRIGHT Esri - https://js.arcgis.com/5.1/LICENSE.txt */
2
- import{clamp as t}from"../../../../core/mathUtils.js";import{clone as e}from"../../../../core/libs/gl-matrix-2/factories/vec2f64.js";import{fromValues as i}from"../../../../core/libs/gl-matrix-2/factories/vec3f64.js";import{fromValues as r}from"../../../../geometry/support/aaBoundingBox.js";import{BufferViewUint32 as s,BufferViewVec3f as o,BufferViewVec2Snorm16 as a,BufferViewSnorm16 as n,BufferViewFloat16 as p,BufferViewFloat as h}from"../../../../geometry/support/buffer/BufferView.js";import{isShadowLike as u,is3DGeometry as f,isColor as c}from"../core/shaderLibrary/ShaderOutput.js";import l from"../lib/GLMaterial.js";import{isPathGeometry as m}from"../lib/PathGeometry.js";import{MeshIntersectionOptions as g,intersectAabbInvDir as d}from"../lib/RayIntersections.js";import{assert as b}from"../lib/Util.js";import{getLayout as _,getTextureLayout as S}from"./PathLayouts.js";import{PathPassParameters as y,PathTechnique as x}from"./PathTechnique.js";import{PathTechniqueConfiguration as V}from"./PathTechniqueConfiguration.js";import{TriangleMaterial as w}from"./TriangleMaterial.js";import{writeAttributes as z,writeTextureElementIndex as v,writeBufferUint32 as F,writePosition as j,writeBufferVec2 as M,writeBufferInt16 as C,writeBufferFloat16 as A,writeBufferFloat as R}from"./internal/bufferWriterUtils.js";import{hasShadowHighlights as T}from"../shaders/ReceiveShadowsConfiguration.js";import{alphaCutoff as O}from"../../../../webscene/support/AlphaCutoff.js";class P extends w{constructor(t,e){super(t,I),this.supportsEdges=!0,this._pp0=i(0,0,1),this._pp1=i(0,0,0),this.produces=new Map([[2,t=>(this.parameters.castShadows&&u(t)||f(t))&&!this.transparent],[4,t=>(this.parameters.castShadows&&u(t)||f(t))&&this.transparent]]),this._configuration=new V(e.spherical)}get hasEmissions(){return this.parameters.emissiveStrength>0?this.transparent?2:1:0}updateConfiguration(t){super.updateConfiguration(t),this._configuration.hasVVSize=this.parameters.hasVVSize,this._configuration.hasVVColor=this.parameters.hasVVColor,this._configuration.hasVVOpacity=this.parameters.hasVVOpacity,this._configuration.hasSlicePlane=this.parameters.hasSlicePlane,this._configuration.transparent=this.transparent,this._configuration.hasOccludees=t.hasOccludees,c(t.output)?(this._configuration.doubleSidedMode=this.parameters.doubleSided&&"normal"===this.parameters.doubleSidedType?1:this.parameters.doubleSided&&"winding-order"===this.parameters.doubleSidedType?2:0,this._configuration.receiveShadows=t.shadowMap.enabled,this._configuration.hasShadowHighlights=T(this._configuration,t),this._configuration.receiveAmbientOcclusion=null!=t.ssao):this._configuration.receiveShadows=this._configuration.hasShadowHighlights=this._configuration.receiveAmbientOcclusion=!1,this._configuration.pbrMode=this.parameters.usePBR?2:0,this._configuration.emissionSource=this.parameters.usePBR?1:0,this._configuration.snowCover=t.snowCover>0,this._configuration.upVectorAlignment=this.parameters.upVectorAlignment,this._configuration.pathCapType=this.parameters.pathCapType,this._configuration.pathProfileType=this.parameters.profile.type}isVisibleForOutput(t){return 5!==t&&7!==t&&6!==t||this.parameters.castShadows}get visible(){return this.parameters.opacity>=O}intersect(t,e,i,r,s,o){this._intersect(t,i,r,s,o)}intersectDraped(t,e,i,r){return this._pp0[0]=this._pp1[0]=i[0],this._pp0[1]=this._pp1[1]=i[1],this._intersect(t,e,this._pp0,this._pp1,r)}_intersect(i,s,o,a,n){const p=i;if(!m(p))return;const h=p.path,u=e(this.parameters.size);if(this.parameters.vvSize){const{offset:e,factor:i,minSize:r,maxSize:s,fallback:o}=this.parameters.vvSize,a=h.sizeAttributeValue;Number.isNaN(a)?(u[0]*=o[0],u[1]*=o[2]):(u[0]*=t(e[0]+a*i[0],r[0],s[0]),u[1]*=t(e[2]+a*i[2],r[2],s[2]))}const f=new g(s.tolerance,!1,s.options.normalRequired),c=Math.max(u[0],u[1]),l=i.boundingInfo;if(null==l)return void k(h,u,o,a,f,n);const b=r(l.bbMin[0]-c,l.bbMin[1]-c,l.bbMin[2]-c,l.bbMax[0]+c,l.bbMax[1]+c,l.bbMax[2]+c),_=[a[0]-o[0],a[1]-o[1],a[2]-o[2]],S=Math.sqrt(_[0]*_[0]+_[1]*_[1]+_[2]*_[2]),y=[S/_[0],S/_[1],S/_[2]];d(b,o,y,s.tolerance)&&k(h,u,o,a,f,n)}createBufferWriter(){return new U(_(),S(this.parameters))}createGLMaterial(t){return new B(t)}get transparent(){const{parameters:t}=this;return t.drivenOpacity||t.opacity<1}}class B extends l{beginSlot(t){return this.getTechnique(x,t)}}function k(t,e,i,r,s,o){t.baked.size&&t.baked.size[0]===e[0]&&t.baked.size[1]===e[1]||t.baked.bake(e),t.baked.intersect(i,r,s,o)}class I extends y{constructor(){super(...arguments),this.doubleSided=!1,this.doubleSidedType="normal",this.polygonOffset=0,this.castShadows=!0,this.hasSlicePlane=!1,this.drivenOpacity=!1,this.usePBR=!1,this.upVectorAlignment=0,this.pathCapType=1}}class U{constructor(t,e){this.layout=t,this.textureBufferLayout=e}elementCount(t){return t.get("pathVertexInfo")?.indices.length??0}elementCountTextureBuffer(t){return t.get("position")?.indices.length??0}write(t,e,i,r,u,f){b(null!=f,"Texture buffer is required for path material"),z(i,r,this.layout,t,e,u);const c=u.buffer.getField("textureElementIndex",s),l=i.get("textureElementIndex"),m=f.offset,g=f.textureBufferRange.from;c&&l&&v(l,c,u.offset,g);const d=u.buffer.getField("pathVertexInfo",s),_=i.get("pathVertexInfo");d&&_&&(b(1===_.size),F(_,d,u.offset));const S=f.buffer.getField("position",o),y=i.get("position");S&&y&&(b(3===y.size),j(y,t,S,m));const x=f.buffer.getField("profileRight",a),V=i.get("profileRight");x&&V&&(b(2===V.size),M(V,x,m));const w=f.buffer.getField("profileUp",a),T=i.get("profileUp");w&&T&&(b(2===T.size),M(T,w,m));const O=f.buffer.getField("profileRotation",n),P=i.get("profileRotation");O&&P&&(b(1===P.size),C(P,O,m));const B=f.buffer.getField("pathRotationUp",a),k=i.get("pathRotationUp");B&&k&&(b(2===k.size),M(k,B,m));const I=f.buffer.getField("pathMaxStretchDistance",p),U=i.get("pathMaxStretchDistance");I&&U&&(b(1===U.size),A(U,I,m));const q=f.buffer.getField("sizeFeatureAttribute",h),L=i.get("sizeFeatureAttribute");q&&L&&R(L,q,m);const E=f.buffer.getField("opacityFeatureAttribute",h),D=i.get("opacityFeatureAttribute");E&&D&&R(D,E,m);const G=f.buffer.getField("colorFeatureAttribute",h),N=i.get("colorFeatureAttribute");G&&N&&R(N,G,m)}}export{I as Parameters,U as PathBufferWriter,P as PathMaterial};
2
+ import{clamp as t}from"../../../../core/mathUtils.js";import{clone as e}from"../../../../core/libs/gl-matrix-2/factories/vec2f64.js";import{fromValues as i}from"../../../../core/libs/gl-matrix-2/factories/vec3f64.js";import{fromValues as r}from"../../../../geometry/support/aaBoundingBox.js";import{BufferViewUint32 as s,BufferViewVec3f as a,BufferViewVec2Snorm16 as o,BufferViewSnorm16 as n,BufferViewFloat16 as h,BufferViewFloat as p}from"../../../../geometry/support/buffer/BufferView.js";import{isShadowLike as u,is3DGeometry as c,isColor as f}from"../core/shaderLibrary/ShaderOutput.js";import l from"../lib/GLMaterial.js";import{isPathGeometry as m}from"../lib/PathGeometry.js";import{MeshIntersectionOptions as g,intersectAabbInvDir as b}from"../lib/RayIntersections.js";import{assert as d}from"../lib/Util.js";import{getLayout as _,getTextureLayout as x}from"./PathLayouts.js";import{PathPassParameters as S,PathTechnique as y}from"./PathTechnique.js";import{PathTechniqueConfiguration as V}from"./PathTechniqueConfiguration.js";import{TriangleMaterial as F}from"./TriangleMaterial.js";import{writeAttributes as w,writeTextureElementIndex as z,writeBufferUint32 as v,writePosition as j,writeBufferVec2 as M,writeBufferInt16 as C,writeBufferFloat16 as A,writeBufferFloat as R}from"./internal/bufferWriterUtils.js";import{hasShadowHighlights as P}from"../shaders/ReceiveShadowsConfiguration.js";import{alphaCutoff as B}from"../../../../webscene/support/AlphaCutoff.js";class O extends F{constructor(t,e){super(t,I),this.supportsEdges=!0,this._pp0=i(0,0,1),this._pp1=i(0,0,0),this.produces=new Map([[2,t=>(this.parameters.castShadows&&u(t)||c(t))&&!this.transparent],[4,t=>(this.parameters.castShadows&&u(t)||c(t))&&this.transparent]]),this._configuration=new V(e.spherical)}get hasEmissions(){return this.parameters.emissiveStrength>0?this.transparent?2:1:0}updateConfiguration(t){super.updateConfiguration(t),this._configuration.hasVVSize=this.parameters.hasVVSize,this._configuration.hasVVColor=this.parameters.hasVVColor,this._configuration.hasVVOpacity=this.parameters.hasVVOpacity,this._configuration.hasSlicePlane=this.parameters.hasSlicePlane,this._configuration.transparent=this.transparent,this._configuration.hasOccludees=t.hasOccludees,this._configuration.cullFace=this.parameters.hasSlicePlane?0:this.parameters.cullFace,this._configuration.offsetBackfaces=this.transparent,f(t.output)?(this._configuration.receiveShadows=t.shadowMap.enabled,this._configuration.hasShadowHighlights=P(this._configuration,t),this._configuration.receiveAmbientOcclusion=null!=t.ssao):this._configuration.receiveShadows=this._configuration.hasShadowHighlights=this._configuration.receiveAmbientOcclusion=!1,this._configuration.pbrMode=this.parameters.usePBR?2:0,this._configuration.emissionSource=this.parameters.usePBR?1:0,this._configuration.snowCover=t.snowCover>0,this._configuration.upVectorAlignment=this.parameters.upVectorAlignment,this._configuration.pathCapType=this.parameters.pathCapType,this._configuration.pathProfileType=this.parameters.profile.type}isVisibleForOutput(t){return 5!==t&&7!==t&&6!==t||this.parameters.castShadows}get visible(){return this.parameters.opacity>=B}intersect(t,e,i,r,s,a){this._intersect(t,i,r,s,a)}intersectDraped(t,e,i,r){return this._pp0[0]=this._pp1[0]=i[0],this._pp0[1]=this._pp1[1]=i[1],this._intersect(t,e,this._pp0,this._pp1,r)}_intersect(i,s,a,o,n){const h=i;if(!m(h))return;const p=h.path,u=e(this.parameters.size);if(this.parameters.vvSize){const{offset:e,factor:i,minSize:r,maxSize:s,fallback:a}=this.parameters.vvSize,o=p.sizeAttributeValue;Number.isNaN(o)?(u[0]*=a[0],u[1]*=a[2]):(u[0]*=t(e[0]+o*i[0],r[0],s[0]),u[1]*=t(e[2]+o*i[2],r[2],s[2]))}const c=new g(s.tolerance,!1,s.options.normalRequired),f=Math.max(u[0],u[1]),l=i.boundingInfo;if(null==l)return void k(p,u,a,o,c,n);const d=r(l.bbMin[0]-f,l.bbMin[1]-f,l.bbMin[2]-f,l.bbMax[0]+f,l.bbMax[1]+f,l.bbMax[2]+f),_=[o[0]-a[0],o[1]-a[1],o[2]-a[2]],x=Math.sqrt(_[0]*_[0]+_[1]*_[1]+_[2]*_[2]),S=[x/_[0],x/_[1],x/_[2]];b(d,a,S,s.tolerance)&&k(p,u,a,o,c,n)}createBufferWriter(){return new U(_(),x(this.parameters))}createGLMaterial(t){return new T(t)}get transparent(){const{parameters:t}=this;return t.drivenOpacity||t.opacity<1}}class T extends l{beginSlot(t){return this.getTechnique(y,t)}}function k(t,e,i,r,s,a){t.baked.size&&t.baked.size[0]===e[0]&&t.baked.size[1]===e[1]||t.baked.bake(e),t.baked.intersect(i,r,s,a)}class I extends S{constructor(){super(...arguments),this.polygonOffset=0,this.castShadows=!0,this.hasSlicePlane=!1,this.drivenOpacity=!1,this.usePBR=!1,this.upVectorAlignment=0,this.pathCapType=1,this.cullFace=2}}class U{constructor(t,e){this.layout=t,this.textureBufferLayout=e}elementCount(t){return t.get("pathVertexInfo")?.indices.length??0}elementCountTextureBuffer(t){return t.get("position")?.indices.length??0}write(t,e,i,r,u,c){d(null!=c,"Texture buffer is required for path material"),w(i,r,this.layout,t,e,u);const f=u.buffer.getField("textureElementIndex",s),l=i.get("textureElementIndex"),m=c.offset,g=c.textureBufferRange.from;f&&l&&z(l,f,u.offset,g);const b=u.buffer.getField("pathVertexInfo",s),_=i.get("pathVertexInfo");b&&_&&(d(1===_.size),v(_,b,u.offset));const x=c.buffer.getField("position",a),S=i.get("position");x&&S&&(d(3===S.size),j(S,t,x,m));const y=c.buffer.getField("profileRight",o),V=i.get("profileRight");y&&V&&(d(2===V.size),M(V,y,m));const F=c.buffer.getField("profileUp",o),P=i.get("profileUp");F&&P&&(d(2===P.size),M(P,F,m));const B=c.buffer.getField("profileRotation",n),O=i.get("profileRotation");B&&O&&(d(1===O.size),C(O,B,m));const T=c.buffer.getField("pathRotationUp",o),k=i.get("pathRotationUp");T&&k&&(d(2===k.size),M(k,T,m));const I=c.buffer.getField("pathMaxStretchDistance",h),U=i.get("pathMaxStretchDistance");I&&U&&(d(1===U.size),A(U,I,m));const q=c.buffer.getField("sizeFeatureAttribute",p),L=i.get("sizeFeatureAttribute");q&&L&&R(L,q,m);const E=c.buffer.getField("opacityFeatureAttribute",p),D=i.get("opacityFeatureAttribute");E&&D&&R(D,E,m);const G=c.buffer.getField("colorFeatureAttribute",p),N=i.get("colorFeatureAttribute");G&&N&&R(N,G,m)}}export{I as Parameters,U as PathBufferWriter,O as PathMaterial};
@@ -1,2 +1,2 @@
1
1
  /* COPYRIGHT Esri - https://js.arcgis.com/5.1/LICENSE.txt */
2
- import{__decorate as e}from"tslib";import{subclass as r}from"../../../../core/accessorSupport/decorators.js";import{freeze as t,create as s,ZEROS as i}from"../../../../core/libs/gl-matrix-2/factories/vec3f64.js";import{glLayout as o}from"../../support/buffer/glUtil.js";import{isOITColor as l}from"../core/shaderLibrary/ShaderOutput.js";import{PathVertexPositionPassParameters as n}from"../core/shaderLibrary/attributes/PathVertexPosition.glsl.js";import{ReloadableShader as m}from"../core/shaderTechnique/ReloadableShader.js";import{ShaderTechnique as a}from"../core/shaderTechnique/ShaderTechnique.js";import{depthTest as h,blending as c}from"../lib/OrderIndependentTransparency.js";import{stencilBaseAllZeros as p,stencilWriteMaskOn as u}from"../lib/StencilUtils.js";import{P as d}from"../../../../chunks/Path.glsl.js";import{getLayout as f}from"./PathLayouts.js";import{advancedMRRFactors as b}from"./pbrUtils.js";import{polygonOffset as g}from"./PolygonOffset.js";import{makePipelineState as j,defaultColorWrite as S,defaultDepthWrite as P,frontFaceCullingParams as y}from"../../../webgl/renderState.js";class T extends n{constructor(){super(...arguments),this.ambient=t(.2,.2,.2),this.diffuse=t(.8,.8,.8),this.opacity=1,this.origin=s(),this.modelTransformation=null,this.mrrFactors=b,this.emissiveStrengthFromSymbol=0,this.emissiveSource=1,this.emissiveBaseColor=i}get emissiveStrength(){return this.emissiveStrengthFromSymbol}}let v=class extends a{constructor(e,r){super(e,r,o(f())),this.shader=new m(d,()=>import("./Path.glsl.js"))}initializePipeline(e){const{output:r,transparent:t,hasSlicePlane:s,doubleSidedMode:i,hasOccludees:o}=e,n=!l(r);return j({blending:t?c(r):null,culling:s&&!t&&0!==i?y:null,depthTest:h(r),depthWrite:n?P:null,colorWrite:S,stencilWrite:o?u:null,stencilTest:o?p:null,polygonOffset:g(e)})}};v=e([r("esri.views.3d.webgl-engine.materials.PathTechnique")],v);export{T as PathPassParameters,v as PathTechnique};
2
+ import{__decorate as e}from"tslib";import{subclass as r}from"../../../../core/accessorSupport/decorators.js";import{freeze as t,create as i,ZEROS as s}from"../../../../core/libs/gl-matrix-2/factories/vec3f64.js";import{glLayout as o}from"../../support/buffer/glUtil.js";import{isOITColor as l}from"../core/shaderLibrary/ShaderOutput.js";import{PathVertexPositionPassParameters as n}from"../core/shaderLibrary/attributes/PathVertexPosition.glsl.js";import{ReloadableShader as a}from"../core/shaderTechnique/ReloadableShader.js";import{ShaderTechnique as m}from"../core/shaderTechnique/ShaderTechnique.js";import{depthTest as p,blending as c}from"../lib/OrderIndependentTransparency.js";import{stencilToolMaskBase as h,stencilBaseAllZeros as u,stencilWriteMaskOn as f}from"../lib/StencilUtils.js";import{P as d}from"../../../../chunks/Path.glsl.js";import{getLayout as g}from"./PathLayouts.js";import{advancedMRRFactors as b}from"./pbrUtils.js";import{polygonOffset as j}from"./PolygonOffset.js";import{isCullingRequired as P}from"../shaders/DefaultMaterialTechnique.js";import{makePipelineState as S,defaultColorWrite as y,defaultDepthWrite as T,cullingParams as v}from"../../../webgl/renderState.js";class q extends n{constructor(){super(...arguments),this.ambient=t(.2,.2,.2),this.diffuse=t(.8,.8,.8),this.opacity=1,this.origin=i(),this.modelTransformation=null,this.mrrFactors=b,this.emissiveStrengthFromSymbol=0,this.emissiveSource=1,this.emissiveBaseColor=s}get emissiveStrength(){return this.emissiveStrengthFromSymbol}}let x=class extends m{constructor(e,r){super(e,r,o(g())),this.shader=new a(d,()=>import("./Path.glsl.js"))}initializePipeline(e){return this._occludeePipelineState=this._makePipeline(e,!0),this._makePipeline(e,!1)}_makePipeline(e,r){const{output:t,transparent:i,cullFace:s,hasOccludees:o}=e,n=!l(t);return S({blending:i?c(t):null,culling:P(e)?v(s):null,depthTest:p(t),depthWrite:n?T:null,colorWrite:y,stencilWrite:o?f:null,stencilTest:o?r?h:u:null,polygonOffset:j(e)})}getPipeline(e,r,t){return t?this._occludeePipelineState:super.getPipeline(e,r,t)}};x=e([r("esri.views.3d.webgl-engine.materials.PathTechnique")],x);export{q as PathPassParameters,x as PathTechnique};
@@ -1,2 +1,2 @@
1
1
  /* COPYRIGHT Esri - https://js.arcgis.com/5.1/LICENSE.txt */
2
- import{__decorate as o}from"tslib";import{parameter as t}from"../core/shaderTechnique/ShaderTechniqueConfiguration.js";import{TriangleTechniqueConfiguration as e}from"./TriangleTechniqueConfiguration.js";class i extends e{constructor(o){super(),this.spherical=o,this.pbrMode=0,this.doubleSidedMode=0,this.emissionSource=0,this.upVectorAlignment=0,this.pathCapType=3,this.pathProfileType=0,this.receiveShadows=!1,this.hasShadowHighlights=!1,this.receiveAmbientOcclusion=!1,this.hasVVSize=!1,this.hasVVColor=!1,this.hasVVOpacity=!1,this.hasOccludees=!1,this.snowCover=!1,this.receiveGlobalIllumination=!1,this.supportNaN=!0,this.textureCoordinateType=0,this.hasVVInstancing=!1,this.useCustomDTRExponentForWater=!1,this.useFillLights=!1,this.hasColorTexture=!1,this.hasMetallicRoughnessTexture=!1,this.hasOcclusionTexture=!1,this.hasNormalTexture=!1,this.draped=!1,this.overlayEnabled=!1}get discardInvisibleFragments(){return this.transparent}}o([t({count:7})],i.prototype,"pbrMode",void 0),o([t({count:3})],i.prototype,"doubleSidedMode",void 0),o([t({count:8})],i.prototype,"emissionSource",void 0),o([t({count:2})],i.prototype,"upVectorAlignment",void 0),o([t({count:4})],i.prototype,"pathCapType",void 0),o([t({count:2})],i.prototype,"pathProfileType",void 0),o([t()],i.prototype,"receiveShadows",void 0),o([t()],i.prototype,"hasShadowHighlights",void 0),o([t()],i.prototype,"receiveAmbientOcclusion",void 0),o([t()],i.prototype,"hasVVSize",void 0),o([t()],i.prototype,"hasVVColor",void 0),o([t()],i.prototype,"hasVVOpacity",void 0),o([t()],i.prototype,"hasOccludees",void 0),o([t()],i.prototype,"snowCover",void 0),o([t()],i.prototype,"receiveGlobalIllumination",void 0);export{i as PathTechniqueConfiguration};
2
+ import{__decorate as t}from"tslib";import{parameter as o}from"../core/shaderTechnique/ShaderTechniqueConfiguration.js";import{TriangleTechniqueConfiguration as e}from"./TriangleTechniqueConfiguration.js";class i extends e{constructor(t){super(),this.spherical=t,this.offsetBackfaces=!1,this.cullFace=0,this.pbrMode=0,this.emissionSource=0,this.upVectorAlignment=0,this.pathCapType=3,this.pathProfileType=0,this.receiveShadows=!1,this.hasShadowHighlights=!1,this.receiveAmbientOcclusion=!1,this.hasVVSize=!1,this.hasVVColor=!1,this.hasVVOpacity=!1,this.hasOccludees=!1,this.snowCover=!1,this.receiveGlobalIllumination=!1,this.supportNaN=!0,this.textureCoordinateType=0,this.hasVVInstancing=!1,this.useCustomDTRExponentForWater=!1,this.useFillLights=!0,this.hasColorTexture=!1,this.hasMetallicRoughnessTexture=!1,this.hasOcclusionTexture=!1,this.hasNormalTexture=!1,this.draped=!1,this.overlayEnabled=!1,this.doubleSidedMode=0}get discardInvisibleFragments(){return this.transparent}}t([o()],i.prototype,"offsetBackfaces",void 0),t([o({count:3})],i.prototype,"cullFace",void 0),t([o({count:7})],i.prototype,"pbrMode",void 0),t([o({count:8})],i.prototype,"emissionSource",void 0),t([o({count:2})],i.prototype,"upVectorAlignment",void 0),t([o({count:4})],i.prototype,"pathCapType",void 0),t([o({count:2})],i.prototype,"pathProfileType",void 0),t([o()],i.prototype,"receiveShadows",void 0),t([o()],i.prototype,"hasShadowHighlights",void 0),t([o()],i.prototype,"receiveAmbientOcclusion",void 0),t([o()],i.prototype,"hasVVSize",void 0),t([o()],i.prototype,"hasVVColor",void 0),t([o()],i.prototype,"hasVVOpacity",void 0),t([o()],i.prototype,"hasOccludees",void 0),t([o()],i.prototype,"snowCover",void 0),t([o()],i.prototype,"receiveGlobalIllumination",void 0);export{i as PathTechniqueConfiguration};
@@ -1,2 +1,2 @@
1
1
  /* COPYRIGHT Esri - https://js.arcgis.com/5.1/LICENSE.txt */
2
- import{__decorate as e}from"tslib";import{subclass as t}from"../../../../core/accessorSupport/decorators.js";import{ZEROS as i,freeze as s,create as r}from"../../../../core/libs/gl-matrix-2/factories/vec3f64.js";import{fromValues as o}from"../../../../core/libs/gl-matrix-2/factories/vec4f64.js";import{glLayout as l}from"../../support/buffer/glUtil.js";import{newLayout as n}from"../../support/buffer/InterleavedLayout.js";import{VertexNormalPassParameters as a,VertexNormalDrawParameters as c}from"../core/shaderLibrary/attributes/VertexNormal.glsl.js";import{ReloadableShader as h}from"../core/shaderTechnique/ReloadableShader.js";import{ShaderTechnique as u}from"../core/shaderTechnique/ShaderTechnique.js";import{olidEnabled as m}from"../effects/geometry/olidUtils.js";import{depthWrite as p,blending as d,depthTest as f}from"../lib/OrderIndependentTransparency.js";import{stencilToolMaskBase as g,stencilBaseAllZeros as v,stencilWriteMaskOn as b}from"../lib/StencilUtils.js";import{getRenderInstanceDataLayout as S}from"../lib/lodRendering/RenderInstanceData.js";import{advancedMRRFactors as y}from"../materials/pbrUtils.js";import{polygonOffset as j}from"../materials/PolygonOffset.js";import{D as P}from"../../../../chunks/DefaultMaterial.glsl.js";import{makePipelineState as T,cullingParams as x,defaultColorWrite as C}from"../../../webgl/renderState.js";import{alphaCutoff as O}from"../../../../webscene/support/AlphaCutoff.js";class D extends a{constructor(){super(...arguments),this.isSchematic=!1,this.usePBR=!1,this.mrrFactors=y,this.hasVertexColors=!1,this.hasSymbolColors=!1,this.doubleSided=!1,this.doubleSidedType="normal",this.cullFace=2,this.instanced=!1,this.instancedFeatureAttribute=!1,this.instancedColor=!1,this.instanceColorEncodesAlphaIgnore=!1,this.emissiveStrengthFromSymbol=0,this.emissiveStrengthKHR=1,this.emissiveSource=1,this.emissiveBaseColor=i,this.instancedDoublePrecision=!1,this.normalType=0,this.receiveShadows=!0,this.receiveAmbientOcclusion=!0,this.castShadows=!0,this.ambient=s(.2,.2,.2),this.diffuse=s(.8,.8,.8),this.externalColor=o(1,1,1,1),this.colorMixMode="multiply",this.opacity=1,this.layerOpacity=1,this.origin=r(),this.hasSlicePlane=!1,this.offsetTransparentBackfaces=!1,this.vvSize=null,this.vvColor=null,this.vvOpacity=null,this.modelTransformation=null,this.drivenOpacity=!1,this.writeDepth=!0,this.customDepthTest=0,this.textureAlphaMode=0,this.textureAlphaCutoff=O,this.textureAlphaPremultiplied=!1,this.renderOccluded=1,this.testsTransparentRenderOrder=0,this.isDecoration=!1}get hasVVSize(){return!!this.vvSize}get hasVVColor(){return!!this.vvColor}get hasVVOpacity(){return!!this.vvOpacity}}class V extends c{constructor(){super(...arguments),this.origin=r(),this.slicePlaneLocalOrigin=this.origin}}let w=class extends u{constructor(e,t){let i=l(z(t));t.instanced&&t.instancedDoublePrecision&&(i=i.concat(l(S(t)))),super(e,t,i),this.shader=new h(P,()=>import("./DefaultMaterial.glsl.js")),this.ignoreUnused=!0}_makePipeline(e,t){const{output:i,transparent:s,cullFace:r,customDepthTest:o,hasOccludees:l}=e;return T({blending:s?d(i,!1,e.emissionDimmingPass):null,culling:M(e)?x(r):null,depthTest:f(i,A(o)),depthWrite:p(e),colorWrite:C,stencilWrite:l?b:null,stencilTest:l?t?g:v:null,polygonOffset:j(e)})}initializePipeline(e){return this._occludeePipelineState=this._makePipeline(e,!0),this._makePipeline(e,!1)}getPipeline(e,t,i){return i?this._occludeePipelineState:super.getPipeline(e,t,i)}};function A(e){switch(e){case 1:return 515;case 0:case 3:return 513;case 2:return 516}}function M(e){return 0!==e.cullFace||!e.hasSlicePlane&&(!e.transparent&&!e.doubleSidedMode)}function z(e){const t=n().vec3f("position");return 1===e.normalType?t.vec2i16("normalCompressed",{glNormalized:!0}):t.vec3f("normal"),e.hasVertexTangents&&t.vec4f("tangent"),e.hasTextures&&t.vec2f16("uv0"),e.hasVertexColors&&t.vec4u8("color",{glNormalized:!0}),e.hasSymbolColors&&t.vec4u8("symbolColor"),!e.instanced&&m()&&t.vec4u8("olidColor"),t}w=e([t("esri.views.3d.webgl-engine.shaders.DefaultMaterialTechnique")],w);export{V as DefaultMaterialDrawParameters,D as DefaultMaterialPassParameters,w as DefaultMaterialTechnique,z as getLayout};
2
+ import{__decorate as e}from"tslib";import{subclass as t}from"../../../../core/accessorSupport/decorators.js";import{ZEROS as i,freeze as s,create as r}from"../../../../core/libs/gl-matrix-2/factories/vec3f64.js";import{fromValues as o}from"../../../../core/libs/gl-matrix-2/factories/vec4f64.js";import{glLayout as l}from"../../support/buffer/glUtil.js";import{newLayout as n}from"../../support/buffer/InterleavedLayout.js";import{VertexNormalPassParameters as a,VertexNormalDrawParameters as c}from"../core/shaderLibrary/attributes/VertexNormal.glsl.js";import{ReloadableShader as h}from"../core/shaderTechnique/ReloadableShader.js";import{ShaderTechnique as u}from"../core/shaderTechnique/ShaderTechnique.js";import{olidEnabled as m}from"../effects/geometry/olidUtils.js";import{depthWrite as p,blending as d,depthTest as f}from"../lib/OrderIndependentTransparency.js";import{stencilToolMaskBase as g,stencilBaseAllZeros as v,stencilWriteMaskOn as b}from"../lib/StencilUtils.js";import{getRenderInstanceDataLayout as S}from"../lib/lodRendering/RenderInstanceData.js";import{advancedMRRFactors as y}from"../materials/pbrUtils.js";import{polygonOffset as j}from"../materials/PolygonOffset.js";import{D as P}from"../../../../chunks/DefaultMaterial.glsl.js";import{makePipelineState as T,cullingParams as x,defaultColorWrite as C}from"../../../webgl/renderState.js";import{alphaCutoff as O}from"../../../../webscene/support/AlphaCutoff.js";class D extends a{constructor(){super(...arguments),this.isSchematic=!1,this.usePBR=!1,this.mrrFactors=y,this.hasVertexColors=!1,this.hasSymbolColors=!1,this.doubleSided=!1,this.doubleSidedType="normal",this.cullFace=2,this.instanced=!1,this.instancedFeatureAttribute=!1,this.instancedColor=!1,this.instanceColorEncodesAlphaIgnore=!1,this.emissiveStrengthFromSymbol=0,this.emissiveStrengthKHR=1,this.emissiveSource=1,this.emissiveBaseColor=i,this.instancedDoublePrecision=!1,this.normalType=0,this.receiveShadows=!0,this.receiveAmbientOcclusion=!0,this.castShadows=!0,this.ambient=s(.2,.2,.2),this.diffuse=s(.8,.8,.8),this.externalColor=o(1,1,1,1),this.colorMixMode="multiply",this.opacity=1,this.layerOpacity=1,this.origin=r(),this.hasSlicePlane=!1,this.offsetTransparentBackfaces=!1,this.vvSize=null,this.vvColor=null,this.vvOpacity=null,this.modelTransformation=null,this.drivenOpacity=!1,this.writeDepth=!0,this.customDepthTest=0,this.textureAlphaMode=0,this.textureAlphaCutoff=O,this.textureAlphaPremultiplied=!1,this.renderOccluded=1,this.testsTransparentRenderOrder=0,this.isDecoration=!1}get hasVVSize(){return!!this.vvSize}get hasVVColor(){return!!this.vvColor}get hasVVOpacity(){return!!this.vvOpacity}}class V extends c{constructor(){super(...arguments),this.origin=r(),this.slicePlaneLocalOrigin=this.origin}}let w=class extends u{constructor(e,t){let i=l(z(t));t.instanced&&t.instancedDoublePrecision&&(i=i.concat(l(S(t)))),super(e,t,i),this.shader=new h(P,()=>import("./DefaultMaterial.glsl.js")),this.ignoreUnused=!0}_makePipeline(e,t){const{output:i,transparent:s,cullFace:r,customDepthTest:o,hasOccludees:l}=e;return T({blending:s?d(i,!1,e.emissionDimmingPass):null,culling:M(e)?x(r):null,depthTest:f(i,A(o)),depthWrite:p(e),colorWrite:C,stencilWrite:l?b:null,stencilTest:l?t?g:v:null,polygonOffset:j(e)})}initializePipeline(e){return this._occludeePipelineState=this._makePipeline(e,!0),this._makePipeline(e,!1)}getPipeline(e,t,i){return i?this._occludeePipelineState:super.getPipeline(e,t,i)}};function A(e){switch(e){case 1:return 515;case 0:case 3:return 513;case 2:return 516}}function M(e){return 0!==e.cullFace||!e.hasSlicePlane&&(!e.transparent&&!e.doubleSidedMode)}function z(e){const t=n().vec3f("position");return 1===e.normalType?t.vec2i16("normalCompressed",{glNormalized:!0}):t.vec3f("normal"),e.hasVertexTangents&&t.vec4f("tangent"),e.hasTextures&&t.vec2f16("uv0"),e.hasVertexColors&&t.vec4u8("color",{glNormalized:!0}),e.hasSymbolColors&&t.vec4u8("symbolColor"),!e.instanced&&m()&&t.vec4u8("olidColor"),t}w=e([t("esri.views.3d.webgl-engine.shaders.DefaultMaterialTechnique")],w);export{V as DefaultMaterialDrawParameters,D as DefaultMaterialPassParameters,w as DefaultMaterialTechnique,z as getLayout,M as isCullingRequired};
@@ -1,2 +1,2 @@
1
1
  /* COPYRIGHT Esri - https://js.arcgis.com/5.1/LICENSE.txt */
2
- import{getAssetUrl as i}from"../../../assets.js";function e(i){return i?i.startsWith("image/")?"image":i.startsWith("audio/")?"audio":i.startsWith("video/")?"video":i.startsWith("text/")||i.startsWith("application/")||i.startsWith("model/")?"document":"unknown":"unknown"}function p(i){const e=i.toLowerCase();return"image/bmp"===e||"image/emf"===e||"image/exif"===e||"image/gif"===e||"image/x-icon"===e||"image/jpeg"===e||"image/png"===e||"image/tiff"===e||"image/x-wmf"===e}function a(e){const p=i("esri/themes/base/images/files/");return e?"text/plain"===e?`${p}text-32.svg`:"application/pdf"===e?`${p}pdf-32.svg`:"text/csv"===e?`${p}csv-32.svg`:"application/gpx+xml"===e?`${p}gpx-32.svg`:"application/x-dwf"===e?`${p}cad-32.svg`:"application/postscript"===e||"application/json"===e||"text/xml"===e||"model/vrml"===e?`${p}code-32.svg`:"application/x-zip-compressed"===e||"application/x-7z-compressed"===e||"application/x-gzip"===e||"application/x-tar"===e||"application/x-gtar"===e||"application/x-bzip2"===e||"application/gzip"===e||"application/x-compress"===e||"application/x-apple-diskimage"===e||"application/x-rar-compressed"===e||"application/zip"===e?`${p}zip-32.svg`:e.includes("image/")?`${p}image-32.svg`:e.includes("audio/")?`${p}sound-32.svg`:e.includes("video/")?`${p}video-32.svg`:e.includes("msexcel")||e.includes("ms-excel")||e.includes("spreadsheetml")?`${p}excel-32.svg`:e.includes("msword")||e.includes("ms-word")||e.includes("wordprocessingml")?`${p}word-32.svg`:e.includes("powerpoint")||e.includes("presentationml")?`${p}report-32.svg`:`${p}generic-32.svg`:`${p}generic-32.svg`}function s(i){return i?"text/plain"===i?"file-text":"application/pdf"===i?"file-pdf":"text/csv"===i?"file-csv":"application/gpx+xml"===i?"file-gpx":"application/x-dwf"===i?"file-cad":"application/postscript"===i||"application/json"===i||"text/xml"===i||"model/vrml"===i?"file-code":"application/x-zip-compressed"===i||"application/x-7z-compressed"===i||"application/x-gzip"===i||"application/x-tar"===i||"application/x-gtar"===i||"application/x-bzip2"===i||"application/gzip"===i||"application/x-compress"===i||"application/x-apple-diskimage"===i||"application/x-rar-compressed"===i||"application/zip"===i?"file-zip":i.includes("image/")?"file-image":i.includes("audio/")?"file-sound":i.includes("video/")?"file-video":i.includes("msexcel")||i.includes("ms-excel")||i.includes("spreadsheetml")?"file-excel":i.includes("msword")||i.includes("ms-word")||i.includes("wordprocessingml")?"file-word":i.includes("powerpoint")||i.includes("presentationml")?"file-ppt":"file":"file"}export{e as getAttachmentTypeCategory,s as getCalciteIconForAttachment,a as getIconPath,p as isSupportedImage};
2
+ import{getAssetUrl as i}from"../../../assets.js";import{getPathExtension as e}from"../../../core/urlUtils.js";const o=new Map([["7z","document"],["aac","audio"],["aif","audio"],["avi","video"],["bmp","image"],["csv","document"],["doc","document"],["docx","document"],["dot","document"],["dwf","document"],["dwg","document"],["ecw","image"],["emf","image"],["eps","document"],["flac","audio"],["geojson","document"],["gif","image"],["gml","document"],["gpx","document"],["gpkg","document"],["gtar","document"],["gz","document"],["heic","image"],["heif","image"],["img","image"],["j2k","image"],["jp2","image"],["jpc","image"],["jpe","image"],["jpeg","image"],["jpf","image"],["jpg","image"],["json","document"],["kml","document"],["kmz","document"],["m4a","audio"],["mdb","document"],["mid","audio"],["mov","video"],["mp2","audio"],["mp3","audio"],["mp4","video"],["mpa","audio"],["mpe","video"],["mpeg","video"],["mpg","video"],["mpv2","video"],["ogg","audio"],["pdf","document"],["png","image"],["ps","document"],["psd","image"],["ppt","document"],["pptx","document"],["qt","video"],["ra","audio"],["ram","audio"],["rar","document"],["raw","image"],["rmi","audio"],["rtf","document"],["sid","image"],["tar","document"],["tgz","document"],["tif","image"],["tiff","image"],["txt","document"],["vrml","document"],["wav","audio"],["webm","video"],["wma","audio"],["wmf","image"],["wmv","video"],["wps","document"],["xls","document"],["xlsx","document"],["xlt","document"],["xml","document"],["zip","document"]]);function t(i){return i?i.startsWith("image/")?"image":i.startsWith("audio/")?"audio":i.startsWith("video/")?"video":i.startsWith("text/")||i.startsWith("application/")||i.startsWith("model/")?"document":"unknown":"unknown"}function a(i){const e=p(i.type);return e&&"unknown"!==e?e:i instanceof File?c(i.name):null}function n(i){const e=p(i.contentType);return e&&"unknown"!==e?e:c(i.name)}function p(i){if(!i)return null;const e=i.toLowerCase().split(";",1)[0].trim();return e&&"application/octet-stream"!==e?t(e):null}function c(i){const t=e(i)?.toLowerCase();return t?o.get(t)??null:null}function m(i){const e=i.toLowerCase();return"image/bmp"===e||"image/emf"===e||"image/exif"===e||"image/gif"===e||"image/x-icon"===e||"image/jpeg"===e||"image/png"===e||"image/tiff"===e||"image/x-wmf"===e}function d(e){const o=i("esri/themes/base/images/files/");return e?"text/plain"===e?`${o}text-32.svg`:"application/pdf"===e?`${o}pdf-32.svg`:"text/csv"===e?`${o}csv-32.svg`:"application/gpx+xml"===e?`${o}gpx-32.svg`:"application/x-dwf"===e?`${o}cad-32.svg`:"application/postscript"===e||"application/json"===e||"text/xml"===e||"model/vrml"===e?`${o}code-32.svg`:"application/x-zip-compressed"===e||"application/x-7z-compressed"===e||"application/x-gzip"===e||"application/x-tar"===e||"application/x-gtar"===e||"application/x-bzip2"===e||"application/gzip"===e||"application/x-compress"===e||"application/x-apple-diskimage"===e||"application/x-rar-compressed"===e||"application/zip"===e?`${o}zip-32.svg`:e.includes("image/")?`${o}image-32.svg`:e.includes("audio/")?`${o}sound-32.svg`:e.includes("video/")?`${o}video-32.svg`:e.includes("msexcel")||e.includes("ms-excel")||e.includes("spreadsheetml")?`${o}excel-32.svg`:e.includes("msword")||e.includes("ms-word")||e.includes("wordprocessingml")?`${o}word-32.svg`:e.includes("powerpoint")||e.includes("presentationml")?`${o}report-32.svg`:`${o}generic-32.svg`:`${o}generic-32.svg`}function s(i){return i?"text/plain"===i?"file-text":"application/pdf"===i?"file-pdf":"text/csv"===i?"file-csv":"application/gpx+xml"===i?"file-gpx":"application/x-dwf"===i?"file-cad":"application/postscript"===i||"application/json"===i||"text/xml"===i||"model/vrml"===i?"file-code":"application/x-zip-compressed"===i||"application/x-7z-compressed"===i||"application/x-gzip"===i||"application/x-tar"===i||"application/x-gtar"===i||"application/x-bzip2"===i||"application/gzip"===i||"application/x-compress"===i||"application/x-apple-diskimage"===i||"application/x-rar-compressed"===i||"application/zip"===i?"file-zip":i.includes("image/")?"file-image":i.includes("audio/")?"file-sound":i.includes("video/")?"file-video":i.includes("msexcel")||i.includes("ms-excel")||i.includes("spreadsheetml")?"file-excel":i.includes("msword")||i.includes("ms-word")||i.includes("wordprocessingml")?"file-word":i.includes("powerpoint")||i.includes("presentationml")?"file-ppt":"file":"file"}export{n as getAttachmentCategoryForAttachment,c as getAttachmentCategoryForExtension,a as getAttachmentCategoryForFile,p as getAttachmentCategoryForMimeType,t as getAttachmentTypeCategory,s as getCalciteIconForAttachment,d as getIconPath,m as isSupportedImage};