@arcgis/core 4.32.0-next.20241021 → 4.32.0-next.20241022

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 (95) hide show
  1. package/applications/MapViewer/templateUtils.d.ts +4 -0
  2. package/applications/MapViewer/templateUtils.js +5 -0
  3. package/assets/esri/core/workers/RemoteClient.js +1 -1
  4. package/assets/esri/core/workers/chunks/{1ba1d9c867ec6a492af9.js → 0f3912bca9fe25eea75c.js} +1 -1
  5. package/assets/esri/core/workers/chunks/{842ebde78db9bfcaf07b.js → 1678d1d0ecb9b2af69a8.js} +1 -1
  6. package/assets/esri/core/workers/chunks/1d16ca7791f64dd7c7fb.js +1 -0
  7. package/assets/esri/core/workers/chunks/{b292758308dfac4ba8ee.js → 2d8aa31dc96bbd014036.js} +1 -1
  8. package/assets/esri/core/workers/chunks/{88bd9e023764da377aa7.js → 2ee26f77d8e8c15a51ea.js} +1 -1
  9. package/assets/esri/core/workers/chunks/{53f648321c5fde26bfe4.js → 319e06888467f9f460ab.js} +1 -1
  10. package/assets/esri/core/workers/chunks/{303f39b9b7bd33109df8.js → 587df97288a83721d251.js} +1 -1
  11. package/assets/esri/core/workers/chunks/5caa02a7a85d05e253b4.js +1 -0
  12. package/assets/esri/core/workers/chunks/5cfecb320e1dcd258b2e.js +1 -0
  13. package/assets/esri/core/workers/chunks/67018ef25736f0722f6e.js +1 -0
  14. package/assets/esri/core/workers/chunks/{03eba36affe6ed1f5a11.js → 757fe331381da1b7edad.js} +2 -2
  15. package/assets/esri/core/workers/chunks/772cc80923d5e2c6436d.js +1 -0
  16. package/assets/esri/core/workers/chunks/89f74819ac1b5884c149.js +1 -0
  17. package/assets/esri/core/workers/chunks/92b2d81ef16877341f97.js +1 -0
  18. package/assets/esri/core/workers/chunks/{e6e77cbdeb99d90caad1.js → 97f62fad6d416a666319.js} +1 -1
  19. package/assets/esri/core/workers/chunks/{63719f892a7d1025c7d3.js → b42c1ab7579a3c464f72.js} +1 -1
  20. package/assets/esri/core/workers/chunks/{c71304c88fce556340ef.js → c859f73b57a764e99b02.js} +1 -1
  21. package/assets/esri/core/workers/chunks/e71fa25ed45bae5a1adb.js +320 -0
  22. package/core/MemCache.js +1 -1
  23. package/core/MemCachePool.js +1 -1
  24. package/geometry/Mesh.js +1 -1
  25. package/geometry/support/MeshVertexAttributes.js +1 -1
  26. package/interfaces.d.ts +128 -0
  27. package/layers/LinkChartLayer.js +1 -1
  28. package/layers/SceneLayer.js +1 -1
  29. package/layers/knowledgeGraph/supportUtils.js +1 -1
  30. package/layers/support/ElevationQueryTileCache.js +1 -1
  31. package/layers/support/ElevationTileData.js +1 -1
  32. package/layers/support/mediaUtils.js +1 -1
  33. package/layers/support/rasterFunctions/ClipFunction.js +1 -1
  34. package/layers/support/rasterFunctions/clipUtils.js +1 -1
  35. package/layers/support/rasterFunctions/localUtils.js +1 -1
  36. package/linkChart/LinkChartProperties.js +1 -1
  37. package/package.json +1 -1
  38. package/smartMapping/raster/renderers/classBreaks.js +1 -1
  39. package/smartMapping/raster/renderers/rgb.js +1 -1
  40. package/smartMapping/raster/renderers/stretch.js +1 -1
  41. package/smartMapping/raster/support/adapters/ImageryTileLayerAdapter.js +1 -1
  42. package/smartMapping/raster/support/adapters/RasterLayerAdapter.js +1 -1
  43. package/smartMapping/renderers/support/rendererUtils.d.ts +4 -0
  44. package/support/revision.js +1 -1
  45. package/views/2d/engine/vectorTiles/RenderBucket.js +1 -1
  46. package/views/2d/engine/vectorTiles/TileHandler3D.js +1 -1
  47. package/views/2d/engine/vectorTiles/VectorTile.js +1 -1
  48. package/views/2d/grid/GridView2D.js +1 -1
  49. package/views/2d/layers/FeatureLayerView2D.js +1 -1
  50. package/views/3d/camera/constraintUtils/tilt.js +1 -1
  51. package/views/3d/glTF/loader.js +1 -1
  52. package/views/3d/layers/I3SMeshView3D.js +1 -1
  53. package/views/3d/layers/IntegratedMesh3DTilesLayerView3D.js +1 -1
  54. package/views/3d/layers/PointCloudLayerView3D.js +1 -1
  55. package/views/3d/layers/SceneLayerGraphicsView3D.js +1 -1
  56. package/views/3d/layers/graphics/Graphics3DCore.js +1 -1
  57. package/views/3d/layers/graphics/Graphics3DSymbol.js +1 -1
  58. package/views/3d/layers/graphics/Graphics3DWebStyleSymbol.js +1 -1
  59. package/views/3d/layers/graphics/ObjectResourceCache.js +1 -1
  60. package/views/3d/layers/graphics/wosrLoader.js +1 -1
  61. package/views/3d/layers/i3s/CachedMeshData.js +5 -0
  62. package/views/3d/layers/i3s/I3SClientNodeLoader.js +1 -1
  63. package/views/3d/layers/i3s/I3SOverrides.js +1 -1
  64. package/views/3d/layers/i3s/PointRenderer.js +1 -1
  65. package/views/3d/layers/support/FeatureTile.js +1 -1
  66. package/views/3d/layers/support/FeatureTileFetcher3D.js +1 -1
  67. package/views/3d/support/buffer/InterleavedLayout.js +1 -1
  68. package/views/3d/terrain/Tile.js +1 -1
  69. package/views/3d/terrain/TileTexture.js +1 -1
  70. package/views/3d/webgl/ManagedFBO.js +1 -1
  71. package/views/3d/webgl/ManagedFBOAttachment.js +1 -1
  72. package/views/3d/webgl-engine/core/FBOCache.js +1 -1
  73. package/views/3d/webgl-engine/core/FBOPool.js +1 -1
  74. package/views/3d/webgl-engine/core/shaderLibrary/output/OutputHighlight.glsl.js +1 -1
  75. package/views/3d/webgl-engine/lib/edgeRendering/EdgeView.js +1 -1
  76. package/views/3d/webgl-engine/materials/ProceduralTextureRepository.js +1 -1
  77. package/views/3d/webgl-engine/materials/renderers/MergedRenderer.js +1 -1
  78. package/views/webgl/Texture.js +1 -1
  79. package/views/webgl/VertexArrayObject.js +1 -1
  80. package/webdoc/support/webdocSaveUtils.js +1 -1
  81. package/widgets/FeatureTable/FeatureTableViewModel.js +1 -1
  82. package/widgets/FeatureTable/Grid/GridViewModel.js +1 -1
  83. package/widgets/FeatureTable/support/columnUtils.js +1 -1
  84. package/widgets/FeatureTable/support/tableUtils.js +1 -1
  85. package/widgets/FeatureTable/support/templateUtils.js +5 -0
  86. package/widgets/support/GridControls/GridControlsViewModel.js +1 -1
  87. package/widgets/support/GridControls.js +1 -1
  88. package/assets/esri/core/workers/chunks/0c40cac18711f79f0a7d.js +0 -1
  89. package/assets/esri/core/workers/chunks/1a97f98facfc62a9fc69.js +0 -1
  90. package/assets/esri/core/workers/chunks/1fc064e37d030e449d5e.js +0 -1
  91. package/assets/esri/core/workers/chunks/77d129134c2a66cd86d8.js +0 -1
  92. package/assets/esri/core/workers/chunks/92ce57cb12d9a7a3699e.js +0 -1
  93. package/assets/esri/core/workers/chunks/a5675c989d00b7400f98.js +0 -1
  94. package/assets/esri/core/workers/chunks/c06c5c815b5e37717fa1.js +0 -1
  95. package/assets/esri/core/workers/chunks/ce8c1208916f54af7e68.js +0 -320
package/core/MemCache.js CHANGED
@@ -2,4 +2,4 @@
2
2
  All material copyright ESRI, All Rights Reserved, unless otherwise specified.
3
3
  See https://js.arcgis.com/4.32/esri/copyright.txt for details.
4
4
  */
5
- import t from"./PooledArray.js";const e=-3,s=e-1;var i;!function(t){t[t.ALL=0]="ALL",t[t.SOME=1]="SOME"}(i||(i={}));class r{constructor(t,e,s){this.name=t,this._storage=e,this.id=o+++":",this.size=0,this.maxSize=-1,this._removeFunc=!1,this._hit=0,this._miss=0,this._storage.register(this),s&&(this._storage.registerRemoveFunc(this.id,s),this._removeFunc=!0)}destroy(){this._storage.clear(this),this._removeFunc&&this._storage.deregisterRemoveFunc(this.id),this._storage.deregister(this),this._storage=null}get hitRate(){return this._hit/(this._hit+this._miss)}get storageSize(){return this._storage.size}getSize(t){return this._storage.getSize(this,t)}resetHitRate(){this._hit=this._miss=0}put(t,e,s,i=0){this._storage.put(this,t,e,s,i)}pop(t){const e=this._storage.pop(this,t);return void 0===e?++this._miss:++this._hit,e}get(t){const e=this._storage.get(this,t);return void 0===e?++this._miss:++this._hit,e}peek(t){return this._storage.peek(this,t)}updateSize(t,e,s){this._storage.updateSize(this,t,e,s)}clear(){this._storage.clear(this)}clearAll(){this._storage.clearAll()}get performanceInfo(){return this._storage.performanceInfo}resetStats(){this._storage.resetStats()}}class h{get size(){return this._size}constructor(e=10485760){this._maxSize=e,this._db=new Map,this._size=0,this._hit=0,this._miss=0,this._removeFuncs=new t,this._users=new t}destroy(){this.clearAll(),this._removeFuncs.clear(),this._users.clear(),this._db=null}register(t){this._users.push(t)}deregister(t){this._users.removeUnordered(t)}registerRemoveFunc(t,e){this._removeFuncs.push([t,e])}deregisterRemoveFunc(t){this._removeFuncs.filterInPlace((e=>e[0]!==t))}get maxSize(){return this._maxSize}set maxSize(t){this._maxSize=Math.max(t,-1),this._checkSize()}getSize(t,e){const s=this._db.get(t.id+e);return s?.size??0}put(t,r,h,o,_){r=t.id+r;const a=this._db.get(r);if(a&&(this._size-=a.size,t.size-=a.size,this._db.delete(r),a.entry!==h&&this._notifyRemove(r,a.entry,a.size,i.ALL)),o>this._maxSize)return void this._notifyRemove(r,h,o,i.ALL);if(void 0===h)return void console.warn("Refusing to cache undefined entry ");if(!o||o<0)return console.warn(`Refusing to cache entry with size ${o} for key ${r}`),void this._notifyRemove(r,h,0,i.ALL);const c=1+Math.max(_,s)-e;this._db.set(r,new n(h,o,c)),this._size+=o,t.size+=o,this._checkSize()}updateSize(t,e,s,r){e=t.id+e;const h=this._db.get(e);if(h&&h.entry===s){for(this._size-=h.size,t.size-=h.size;r>this._maxSize;){const t=this._notifyRemove(e,s,r,i.SOME);if(!(null!=t&&t>0))return void this._db.delete(e);r=t}h.size=r,this._size+=r,t.size+=r,this._checkSize()}}pop(t,e){e=t.id+e;const s=this._db.get(e);if(s)return this._size-=s.size,t.size-=s.size,this._db.delete(e),++this._hit,s.entry;++this._miss}get(t,e){e=t.id+e;const s=this._db.get(e);if(void 0!==s)return this._db.delete(e),s.lives=s.lifetime,this._db.set(e,s),++this._hit,s.entry;++this._miss}peek(t,e){const s=this._db.get(t.id+e);return s?++this._hit:++this._miss,s?.entry}get performanceInfo(){const t={Size:Math.round(this._size/1048576)+"/"+Math.round(this._maxSize/1048576)+"MB","Hit rate":Math.round(100*this._getHitRate())+"%",Entries:this._db.size.toString()},s={},i=new Array;this._db.forEach(((t,e)=>{const r=t.lifetime;i[r]=(i[r]||0)+t.size,this._users.forAll((i=>{const{id:r,name:h}=i;if(e.startsWith(r)){const e=s[h]||0;s[h]=e+t.size}}))}));const r={};this._users.forAll((t=>{const e=t.name;if("hitRate"in t&&"number"==typeof t.hitRate&&!isNaN(t.hitRate)&&t.hitRate>0){const i=s[e]||0;s[e]=i,r[e]=Math.round(100*t.hitRate)+"%"}else r[e]="0%"}));const h=Object.keys(s);h.sort(((t,e)=>s[e]-s[t])),h.forEach((e=>t[e]=Math.round(s[e]/2**20)+"MB / "+r[e]));for(let o=i.length-1;o>=0;--o){const s=i[o];s&&(t["Priority "+(o+e-1)]=Math.round(s/this._size*100)+"%")}return t}resetStats(){this._hit=this._miss=0,this._users.forAll((t=>t.resetHitRate()))}clear(t){const e=t.id;this._db.forEach(((t,s)=>{s.startsWith(e)&&(this._size-=t.size,this._db.delete(s),this._notifyRemove(s,t.entry,t.size,i.ALL))})),t.size=0}clearAll(){this._db.forEach(((t,e)=>this._notifyRemove(e,t.entry,t.size,i.ALL))),this._users.forAll((t=>t.size=0)),this._size=0,this._db.clear()}_getHitRate(){return this._hit/(this._hit+this._miss)}_notifyRemove(t,e,s,i){let r;return this._removeFuncs.some((h=>{if(t.startsWith(h[0])){const t=h[1](e,i,s);return"number"==typeof t&&(r=t),!0}return!1})),r}_checkSize(){this._users.forAll((t=>this._checkSizeLimits(t))),this._checkSizeLimits()}_checkSizeLimits(t){const e=t??this;if(e.maxSize<0||e.size<=e.maxSize)return;const s=t?.id;let i=!0;for(;i;){i=!1;for(const[r,h]of this._db)if(0===h.lifetime&&(!s||r.startsWith(s))){if(this._purgeItem(r,h,t),e.size<=.9*e.maxSize)return;i||=this._db.has(r)}}for(const[r,h]of this._db)if((!s||r.startsWith(s))&&(this._purgeItem(r,h,t),e.size<=.9*e.maxSize))return}_purgeItem(t,e,s=this._users.find((e=>t.startsWith(e.id)))){if(this._db.delete(t),e.lives<=1){this._size-=e.size,s&&(s.size-=e.size);const r=this._notifyRemove(t,e.entry,e.size,i.SOME);null!=r&&r>0&&(this._size+=r,s&&(s.size+=r),e.lives=e.lifetime,e.size=r,this._db.set(t,e))}else--e.lives,this._db.set(t,e)}}let o=0;class n{constructor(t,e,s){this.entry=t,this.size=e,this.lifetime=s,this.lives=s}}export{r as MemCache,h as MemCacheStorage,e as MinPriority,s as NoPriority,i as RemoveMode};
5
+ import t from"./PooledArray.js";const e=-3,s=e-1;var i;!function(t){t[t.ALL=0]="ALL",t[t.SOME=1]="SOME"}(i||(i={}));class r{constructor(t,e,s){this.name=t,this._storage=e,this.id=o+++":",this.size=0,this.maxSize=-1,this._removeFunc=!1,this._hit=0,this._miss=0,this._storage.register(this),s&&(this._storage.registerRemoveFunc(this.id,s),this._removeFunc=!0)}destroy(){this._storage.clear(this),this._removeFunc&&this._storage.deregisterRemoveFunc(this.id),this._storage.deregister(this),this._storage=null}get hitRate(){return this._hit/(this._hit+this._miss)}get storageSize(){return this._storage.size}getSize(t){return this._storage.getSize(this,t)}resetHitRate(){this._hit=this._miss=0}put(t,e,s=0){this._storage.put(this,t,e,e.cachedMemory,s)}pop(t){const e=this._storage.pop(this,t);return void 0===e?++this._miss:++this._hit,e}get(t){const e=this._storage.get(this,t);return void 0===e?++this._miss:++this._hit,e}peek(t){return this._storage.peek(this,t)}updateSize(t,e){this._storage.updateSize(this,t,e,e.cachedMemory)}clear(){this._storage.clear(this)}clearAll(){this._storage.clearAll()}get performanceInfo(){return this._storage.performanceInfo}resetStats(){this._storage.resetStats()}}class h{get size(){return this._size}constructor(e=10485760){this._maxSize=e,this._db=new Map,this._size=0,this._hit=0,this._miss=0,this._removeFuncs=new t,this._users=new t}destroy(){this.clearAll(),this._removeFuncs.clear(),this._users.clear(),this._db=null}register(t){this._users.push(t)}deregister(t){this._users.removeUnordered(t)}registerRemoveFunc(t,e){this._removeFuncs.push([t,e])}deregisterRemoveFunc(t){this._removeFuncs.filterInPlace((e=>e[0]!==t))}get maxSize(){return this._maxSize}set maxSize(t){this._maxSize=Math.max(t,-1),this._checkSize()}getSize(t,e){const s=this._db.get(t.id+e);return s?.size??0}put(t,r,h,o,_){r=t.id+r;const a=this._db.get(r);if(a&&(this._size-=a.size,t.size-=a.size,this._db.delete(r),a.entry!==h&&this._notifyRemove(r,a.entry,a.size,i.ALL)),o>this._maxSize)return void this._notifyRemove(r,h,o,i.ALL);if(void 0===h)return void console.warn("Refusing to cache undefined entry ");if(!o||o<0)return console.warn(`Refusing to cache entry with size ${o} for key ${r}`),void this._notifyRemove(r,h,0,i.ALL);const c=1+Math.max(_,s)-e;this._db.set(r,new n(h,o,c)),this._size+=o,t.size+=o,this._checkSize()}updateSize(t,e,s,r){e=t.id+e;const h=this._db.get(e);if(h&&h.entry===s){for(this._size-=h.size,t.size-=h.size;r>this._maxSize;){const t=this._notifyRemove(e,s,r,i.SOME);if(!(null!=t&&t>0))return void this._db.delete(e);r=t}h.size=r,this._size+=r,t.size+=r,this._checkSize()}}pop(t,e){e=t.id+e;const s=this._db.get(e);if(s)return this._size-=s.size,t.size-=s.size,this._db.delete(e),++this._hit,s.entry;++this._miss}get(t,e){e=t.id+e;const s=this._db.get(e);if(void 0!==s)return this._db.delete(e),s.lives=s.lifetime,this._db.set(e,s),++this._hit,s.entry;++this._miss}peek(t,e){const s=this._db.get(t.id+e);return s?++this._hit:++this._miss,s?.entry}get performanceInfo(){const t={Size:Math.round(this._size/1048576)+"/"+Math.round(this._maxSize/1048576)+"MB","Hit rate":Math.round(100*this._getHitRate())+"%",Entries:this._db.size.toString()},s={},i=new Array;this._db.forEach(((t,e)=>{const r=t.lifetime;i[r]=(i[r]||0)+t.size,this._users.forAll((i=>{const{id:r,name:h}=i;if(e.startsWith(r)){const e=s[h]||0;s[h]=e+t.size}}))}));const r={};this._users.forAll((t=>{const e=t.name;if("hitRate"in t&&"number"==typeof t.hitRate&&!isNaN(t.hitRate)&&t.hitRate>0){const i=s[e]||0;s[e]=i,r[e]=Math.round(100*t.hitRate)+"%"}else r[e]="0%"}));const h=Object.keys(s);h.sort(((t,e)=>s[e]-s[t])),h.forEach((e=>t[e]=Math.round(s[e]/2**20)+"MB / "+r[e]));for(let o=i.length-1;o>=0;--o){const s=i[o];s&&(t["Priority "+(o+e-1)]=Math.round(s/this._size*100)+"%")}return t}resetStats(){this._hit=this._miss=0,this._users.forAll((t=>t.resetHitRate()))}clear(t){const e=t.id;this._db.forEach(((t,s)=>{s.startsWith(e)&&(this._size-=t.size,this._db.delete(s),this._notifyRemove(s,t.entry,t.size,i.ALL))})),t.size=0}clearAll(){this._db.forEach(((t,e)=>this._notifyRemove(e,t.entry,t.size,i.ALL))),this._users.forAll((t=>t.size=0)),this._size=0,this._db.clear()}_getHitRate(){return this._hit/(this._hit+this._miss)}_notifyRemove(t,e,s,i){let r;return this._removeFuncs.some((h=>{if(t.startsWith(h[0])){const t=h[1](e,i,s);return"number"==typeof t&&(r=t),!0}return!1})),r}_checkSize(){this._users.forAll((t=>this._checkSizeLimits(t))),this._checkSizeLimits()}_checkSizeLimits(t){const e=t??this;if(e.maxSize<0||e.size<=e.maxSize)return;const s=t?.id;let i=!0;for(;i;){i=!1;for(const[r,h]of this._db)if(0===h.lifetime&&(!s||r.startsWith(s))){if(this._purgeItem(r,h,t),e.size<=.9*e.maxSize)return;i||=this._db.has(r)}}for(const[r,h]of this._db)if((!s||r.startsWith(s))&&(this._purgeItem(r,h,t),e.size<=.9*e.maxSize))return}_purgeItem(t,e,s=this._users.find((e=>t.startsWith(e.id)))){if(this._db.delete(t),e.lives<=1){this._size-=e.size,s&&(s.size-=e.size);const r=this._notifyRemove(t,e.entry,e.size,i.SOME);null!=r&&r>0&&(this._size+=r,s&&(s.size+=r),e.lives=e.lifetime,e.size=r,this._db.set(t,e))}else--e.lives,this._db.set(t,e)}}let o=0;class n{constructor(t,e,s){this.entry=t,this.size=e,this.lifetime=s,this.lives=s}}export{r as MemCache,h as MemCacheStorage,e as MinPriority,s as NoPriority,i as RemoveMode};
@@ -2,4 +2,4 @@
2
2
  All material copyright ESRI, All Rights Reserved, unless otherwise specified.
3
3
  See https://js.arcgis.com/4.32/esri/copyright.txt for details.
4
4
  */
5
- import{RemoveMode as e,NoPriority as t}from"./MemCache.js";class c{constructor(t,c){this._cache=t(c,((t,c,s)=>{switch(c){case e.ALL:return t.forEach((e=>e.dispose())),0;case e.SOME:{const e=t.shift();return e&&(s-=Math.round(e.usedMemory),e.dispose()),s}}}))}hitrate(){return this._cache.hitRate}destroy(){this._cache.destroy()}clear(){this._cache.clear()}getSize(e){return this._cache.getSize(e)}pop(e){const t=this._cache.peek(e);if(!t)return;const c=t.pop();if(t.length>0){if(c){const s=this._cache.getSize(e)-Math.round(c.usedMemory);this._cache.updateSize(e,t,s)}}else this._cache.pop(e);return c}put(e,c,s=t){const h=this._cache.peek(e);if(!h)return void this._cache.put(e,[c],c.usedMemory,s);h.push(c);const r=this._cache.getSize(e)+Math.round(c.usedMemory);this._cache.updateSize(e,h,r)}}export{c as MemCachePool};
5
+ import{RemoveMode as e,NoPriority as c}from"./MemCache.js";class t{constructor(c,t){this._cache=c(t,((c,t,h)=>{switch(t){case e.ALL:return c.forEach((e=>e.dispose())),0;case e.SOME:{const e=c.shift();return e&&(h-=Math.round(e.cachedMemory),e.dispose()),h}}}))}hitrate(){return this._cache.hitRate}destroy(){this._cache.destroy()}clear(){this._cache.clear()}getSize(e){return this._cache.getSize(e)}pop(e){const c=this._cache.peek(e);if(!c)return;const t=c.pop();return c.length>0?t&&(c.cachedMemory=this._cache.getSize(e)-Math.round(t.cachedMemory),this._cache.updateSize(e,c)):this._cache.pop(e),t}put(e,t,s=c){const r=this._cache.peek(e);if(r)r.push(t),r.cachedMemory=this._cache.getSize(e)+Math.round(t.cachedMemory),this._cache.updateSize(e,r);else{const c=new h(t);this._cache.put(e,c,s)}}}class h extends Array{constructor(e){super(),this.item=e,this.cachedMemory=e.cachedMemory,this.push(e)}}export{t as MemCachePool};
package/geometry/Mesh.js CHANGED
@@ -2,4 +2,4 @@
2
2
  All material copyright ESRI, All Rights Reserved, unless otherwise specified.
3
3
  See https://js.arcgis.com/4.32/esri/copyright.txt for details.
4
4
  */
5
- import{_ as e}from"../chunks/tslib.es6.js";import{deprecatedFunction as t}from"../core/deprecate.js";import r from"../core/Error.js";import o from"../core/Loadable.js";import s from"../core/Logger.js";import{EsriPromiseMixin as n}from"../core/Promise.js";import{throwIfAborted as i,whenOrAbort as a}from"../core/promiseUtils.js";import{watch as c}from"../core/reactiveUtils.js";import{property as p}from"../core/accessorSupport/decorators/property.js";import"../core/has.js";import"../core/RandomLCG.js";import{subclass as l}from"../core/accessorSupport/decorators/subclass.js";import{fromValues as m}from"../core/libs/gl-matrix-2/factories/vec3f64.js";import h from"./Geometry.js";import u from"./Point.js";import f from"./Polygon.js";import{create as d,fromBuffer as x,zero as y}from"./support/aaBoundingBox.js";import{composeAxes as v,create as g}from"./support/axisAngleDegrees.js";import j from"./support/MeshComponent.js";import{componentNotFoundMessage as w,meshNotLoadedMessage as S,invalidLocationMessage as b,invalidPolygonMessage as A,InvalidLocationError as M}from"./support/meshErrors.js";import L from"./support/MeshGeoreferencedVertexSpace.js";import F from"./support/MeshLocalVertexSpace.js";import R from"./support/MeshTransform.js";import{MeshVertexAttributes as U}from"./support/MeshVertexAttributes.js";import{vertexSpaceOriginToPoint as _,isRelativeVertexSpace as C,selectVertexSpace as P}from"./support/meshVertexSpaceUtils.js";import{triangulate as E}from"./support/triangulationUtils.js";import{centerAt as B}from"./support/meshUtils/centerAt.js";import{computeMeshExtent as G}from"./support/meshUtils/extent.js";import{loadExternal as k}from"./support/meshUtils/loadExternal.js";import{Metadata as I}from"./support/meshUtils/Metadata.js";import{convertUnitGeometry as T,createUnitSizeBox as V,extractSingleFaceOfBox as O,createUnitSizeSphere as z,createUnitSizeCylinder as D,convertPlaneSizeParameter as N,createUnitSizePlane as W}from"./support/meshUtils/primitives.js";import{rotate as Z}from"./support/meshUtils/rotate.js";import{scale as q}from"./support/meshUtils/scale.js";var H;const K="esri.geometry.Mesh";function J(){return s.getLogger(K)}const Q={base:null,key:"type",defaultKeyValue:"georeferenced",typeMap:{georeferenced:L,local:F}};let X=H=class extends(o.LoadableMixin(n(h))){constructor(e){super(e),this.components=null,this.vertexSpace=new L,this.transform=null,this.metadata=new I,this.hasZ=!0,this.hasM=!1,this.vertexAttributes=new U,this.type="mesh"}initialize(){(0===this.metadata.externalSources.length||this.vertexAttributes.position.length)&&(this.loadStatus="loaded"),this.when((()=>{this.addHandles(c((()=>({vertexAttributes:this.vertexAttributes,components:this.components?.map((e=>e.clone()))})),(()=>this._clearSources()),{once:!0,sync:!0}))}))}get hasExtent(){return this.loaded?this.vertexAttributes.position.length>0&&(!this.components||this.components.length>0):null!=this.metadata.displaySource?.extent}get _transformedExtent(){const{spatialReference:e,vertexSpace:t}=this,r=this;return G({get transform(){return r.transform},vertexSpace:t,spatialReference:e,untransformedBounds:this._untransformedBounds})}get _untransformedBounds(){const{vertexAttributes:{position:e},components:t}=this;return 0===e.length||0===t?.length?d(y):x(e)}get origin(){const e=_(this.vertexSpace,this.spatialReference);if(null!=e)return e;const{center:t,zmin:r}=this._transformedExtent;return new u({x:t.x,y:t.y,z:r,spatialReference:this.spatialReference})}get extent(){return this.loaded||null==this.metadata?.displaySource?.extent?this._transformedExtent:this.metadata.displaySource.extent.clone()}addComponent(e){this._checkIfLoaded("addComponent()")&&(this.components||(this.components=[]),this.components.push(j.from(e)),this.notifyChange("components"))}removeComponent(e){if(this._checkIfLoaded("removeComponent()")){if(this.components){const t=this.components.indexOf(e);if(-1!==t)return this.components.splice(t,1),void this.notifyChange("components")}J().error("removeComponent()",w)}}rotate(e,t,r,o){return v(e,t,r,Y),Z(this,Y,o),this}offset(e,t,r){if(!this._checkIfLoaded("offset()"))return this;const{vertexSpace:o,vertexAttributes:s}=this,n=s?.position;if(!n)return this;if(C(o)){const[s,n,i]=o.origin;o.origin=m(s+e,n+t,i+r)}else{for(let o=0;o<n.length;o+=3)n[o]+=e,n[o+1]+=t,n[o+2]+=r;this.vertexAttributesChanged()}return this}scale(e,t){return this._checkIfLoaded("scale()")?(q(this,e,t),this):this}centerAt(e,t){return this._checkIfLoaded("centerAt()")?(B(this,e,t),this):this}load(e){const{metadata:{displaySource:t}}=this;return t&&this.addResolvingPromise(k(this,t,e)),Promise.resolve(this)}addExternalSources(e){this.metadata.externalSources.addMany(e)}updateDisplaySource(e){this.metadata.displaySource=e}clone(){return this.cloneAndModifyVertexAttributes(this.vertexAttributes.clone(),this.vertexSpace.clone(),{preserveMetadata:!0})}cloneAndModifyVertexAttributes(e,t,r){let o=null;if(this.components){const e=new Map,t=new Map;o=this.components.map((r=>r.cloneWithDeduplication(e,t)))}const s={components:o,spatialReference:this.spatialReference,vertexAttributes:e,vertexSpace:t,transform:this.transform?.clone()??null,metadata:r?.preserveMetadata?this.metadata.clone():new I};return new H(s)}cloneShallow(){return new H({components:this.components,spatialReference:this.spatialReference,vertexAttributes:this.vertexAttributes,vertexSpace:this.vertexSpace.clone(),transform:this.transform,metadata:this.metadata})}vertexAttributesChanged(){this.notifyChange("vertexAttributes")}async toBinaryGLTF(e){const[{toBinaryGLTF:t}]=await Promise.all([import("./support/meshUtils/exporters/gltf/gltfexport.js"),this.load(e)]);return i(e),await t(this,e)}get memoryUsage(){let e=0;if(e+=this.vertexAttributes.memoryUsage,null!=this.components)for(const t of this.components)e+=t.memoryUsage;return e}_clearSources(){this.metadata.clearSources()}_checkIfLoaded(e){return!!this.loaded||(J().error(e,S),!1)}static createBox(e,t){if(!(e instanceof u))return J().error(".createBox()",b),null;const r=new H(T(V(),e,t));return t?.imageFace&&"all"!==t.imageFace?O(r,t.imageFace):r}static createSphere(e,t){return e instanceof u?new H(T(z(t?.densificationFactor||0),e,t)):(J().error(".createSphere()",b),null)}static createCylinder(e,t){return e instanceof u?new H(T(D(t?.densificationFactor||0),e,t)):(J().error(".createCylinder()",b),null)}static createPlane(e,t){if(!(e instanceof u))return J().error(".createPlane()",b),null;const r=t?.facing??"up",o=N(r,t?.size);return new H(T(W(r),e,{...t,size:o}))}static createFromPolygon(e,t){if(!(e instanceof f))return J().error(".createFromPolygon()",A),null;const r=E(e);return new H({vertexAttributes:new U({position:r.position}),components:[new j({faces:r.faces,shading:"flat",material:t?.material??null})],spatialReference:e.spatialReference,vertexSpace:new L})}static async createFromGLTF(e,t,r){if(!(e instanceof u)){const e=new M;throw J().error(".createfromGLTF()",e.message),e}const{loadGLTFMesh:o}=await a(import("./support/meshUtils/loadGLTFMesh.js"),r);return new H(await o(e,t,r))}static async createFromFiles(e,o,s){t(J(),"`Mesh.createFromFiles` is deprecated in favor of 'SceneLayer.convertMesh'",{replacement:"SceneLayer.convertMesh",version:"4.29"});const n=e=>J().error(".createFromFiles()",e.message);if(!(e instanceof u)){const e=new M;throw n(e),e}if(!s?.layer)throw new r("invalid:no-layer","SceneLayer required for file to mesh conversion.");return s.layer.convertMesh(o,{location:e,...s})}static createWithExternalSource(e,t,r){const o=r?.extent??null,{spatialReference:s}=e,n=r?.transform?.clone()??new R,i=P(e,r),a={source:t,extent:o},c=new I;return c.externalSources.push(a),new H({metadata:c,transform:n,vertexSpace:i,spatialReference:s})}static createIncomplete(e,t){const{spatialReference:o}=e,s=t?.transform?.clone()??new R,n=P(e,t),i=new H({transform:s,vertexSpace:n,spatialReference:o});return i.addResolvingPromise(Promise.reject(new r("mesh-incomplete","Mesh resources are not complete"))),i}};e([p({type:[j],json:{write:!0}})],X.prototype,"components",void 0),e([p({nonNullable:!0,types:Q,constructOnly:!0,json:{write:!0}})],X.prototype,"vertexSpace",void 0),e([p({type:R,json:{write:!0}})],X.prototype,"transform",void 0),e([p({constructOnly:!0})],X.prototype,"metadata",void 0),e([p()],X.prototype,"hasExtent",null),e([p()],X.prototype,"_transformedExtent",null),e([p()],X.prototype,"_untransformedBounds",null),e([p()],X.prototype,"origin",null),e([p({readOnly:!0,json:{read:!1}})],X.prototype,"extent",null),e([p({readOnly:!0,json:{read:!1,write:!0,default:!0}})],X.prototype,"hasZ",void 0),e([p({readOnly:!0,json:{read:!1,write:!0,default:!1}})],X.prototype,"hasM",void 0),e([p({type:U,nonNullable:!0,json:{write:!0}})],X.prototype,"vertexAttributes",void 0),X=H=e([l(K)],X);const Y=g(),$=X;export{$ as default};
5
+ import{_ as e}from"../chunks/tslib.es6.js";import{deprecatedFunction as t}from"../core/deprecate.js";import r from"../core/Error.js";import o from"../core/Loadable.js";import s from"../core/Logger.js";import{EsriPromiseMixin as n}from"../core/Promise.js";import{throwIfAborted as i,whenOrAbort as a}from"../core/promiseUtils.js";import{watch as c}from"../core/reactiveUtils.js";import{property as p}from"../core/accessorSupport/decorators/property.js";import"../core/has.js";import"../core/RandomLCG.js";import{subclass as l}from"../core/accessorSupport/decorators/subclass.js";import{fromValues as m}from"../core/libs/gl-matrix-2/factories/vec3f64.js";import h from"./Geometry.js";import u from"./Point.js";import f from"./Polygon.js";import{create as d,fromBuffer as x,zero as y}from"./support/aaBoundingBox.js";import{composeAxes as v,create as g}from"./support/axisAngleDegrees.js";import j from"./support/MeshComponent.js";import{componentNotFoundMessage as w,meshNotLoadedMessage as S,invalidLocationMessage as b,invalidPolygonMessage as M,InvalidLocationError as A}from"./support/meshErrors.js";import L from"./support/MeshGeoreferencedVertexSpace.js";import F from"./support/MeshLocalVertexSpace.js";import R from"./support/MeshTransform.js";import{MeshVertexAttributes as _}from"./support/MeshVertexAttributes.js";import{vertexSpaceOriginToPoint as C,isRelativeVertexSpace as U,selectVertexSpace as P}from"./support/meshVertexSpaceUtils.js";import{triangulate as E}from"./support/triangulationUtils.js";import{centerAt as B}from"./support/meshUtils/centerAt.js";import{computeMeshExtent as G}from"./support/meshUtils/extent.js";import{loadExternal as k}from"./support/meshUtils/loadExternal.js";import{Metadata as I}from"./support/meshUtils/Metadata.js";import{convertUnitGeometry as T,createUnitSizeBox as V,extractSingleFaceOfBox as O,createUnitSizeSphere as z,createUnitSizeCylinder as D,convertPlaneSizeParameter as N,createUnitSizePlane as W}from"./support/meshUtils/primitives.js";import{rotate as Z}from"./support/meshUtils/rotate.js";import{scale as q}from"./support/meshUtils/scale.js";var H;const K="esri.geometry.Mesh";function J(){return s.getLogger(K)}const Q={base:null,key:"type",defaultKeyValue:"georeferenced",typeMap:{georeferenced:L,local:F}};let X=H=class extends(o.LoadableMixin(n(h))){constructor(e){super(e),this.components=null,this.vertexSpace=new L,this.transform=null,this.metadata=new I,this.hasZ=!0,this.hasM=!1,this.vertexAttributes=new _,this.type="mesh"}initialize(){(0===this.metadata.externalSources.length||this.vertexAttributes.position.length)&&(this.loadStatus="loaded"),this.when((()=>{this.addHandles(c((()=>({vertexAttributes:this.vertexAttributes,components:this.components?.map((e=>e.clone()))})),(()=>this._clearSources()),{once:!0,sync:!0}))}))}get hasExtent(){return this.loaded?this.vertexAttributes.position.length>0&&(!this.components||this.components.length>0):null!=this.metadata.displaySource?.extent}get _transformedExtent(){const{spatialReference:e,vertexSpace:t}=this,r=this;return G({get transform(){return r.transform},vertexSpace:t,spatialReference:e,untransformedBounds:this._untransformedBounds})}get _untransformedBounds(){const{vertexAttributes:{position:e},components:t}=this;return 0===e.length||0===t?.length?d(y):x(e)}get origin(){const e=C(this.vertexSpace,this.spatialReference);if(null!=e)return e;const{center:t,zmin:r}=this._transformedExtent;return new u({x:t.x,y:t.y,z:r,spatialReference:this.spatialReference})}get extent(){return this.loaded||null==this.metadata?.displaySource?.extent?this._transformedExtent:this.metadata.displaySource.extent.clone()}addComponent(e){this._checkIfLoaded("addComponent()")&&(this.components||(this.components=[]),this.components.push(j.from(e)),this.notifyChange("components"))}removeComponent(e){if(this._checkIfLoaded("removeComponent()")){if(this.components){const t=this.components.indexOf(e);if(-1!==t)return this.components.splice(t,1),void this.notifyChange("components")}J().error("removeComponent()",w)}}rotate(e,t,r,o){return v(e,t,r,Y),Z(this,Y,o),this}offset(e,t,r){if(!this._checkIfLoaded("offset()"))return this;const{vertexSpace:o,vertexAttributes:s}=this,n=s?.position;if(!n)return this;if(U(o)){const[s,n,i]=o.origin;o.origin=m(s+e,n+t,i+r)}else{for(let o=0;o<n.length;o+=3)n[o]+=e,n[o+1]+=t,n[o+2]+=r;this.vertexAttributesChanged()}return this}scale(e,t){return this._checkIfLoaded("scale()")?(q(this,e,t),this):this}centerAt(e,t){return this._checkIfLoaded("centerAt()")?(B(this,e,t),this):this}load(e){const{metadata:{displaySource:t}}=this;return t&&this.addResolvingPromise(k(this,t,e)),Promise.resolve(this)}addExternalSources(e){this.metadata.externalSources.addMany(e)}updateDisplaySource(e){this.metadata.displaySource=e}clone(){return this.cloneAndModifyVertexAttributes(this.vertexAttributes.clone(),this.vertexSpace.clone(),{preserveMetadata:!0})}cloneAndModifyVertexAttributes(e,t,r){let o=null;if(this.components){const e=new Map,t=new Map;o=this.components.map((r=>r.cloneWithDeduplication(e,t)))}const s={components:o,spatialReference:this.spatialReference,vertexAttributes:e,vertexSpace:t,transform:this.transform?.clone()??null,metadata:r?.preserveMetadata?this.metadata.clone():new I};return new H(s)}cloneShallow(){return new H({components:this.components,spatialReference:this.spatialReference,vertexAttributes:this.vertexAttributes,vertexSpace:this.vertexSpace.clone(),transform:this.transform,metadata:this.metadata})}vertexAttributesChanged(){this.notifyChange("vertexAttributes")}async toBinaryGLTF(e){const[{toBinaryGLTF:t}]=await Promise.all([import("./support/meshUtils/exporters/gltf/gltfexport.js"),this.load(e)]);return i(e),await t(this,e)}get usedMemory(){return this.components?this.components.reduce(((e,t)=>e+t.memoryUsage),this.vertexAttributes.usedMemory):this.vertexAttributes.usedMemory}_clearSources(){this.metadata.clearSources()}_checkIfLoaded(e){return!!this.loaded||(J().error(e,S),!1)}static createBox(e,t){if(!(e instanceof u))return J().error(".createBox()",b),null;const r=new H(T(V(),e,t));return t?.imageFace&&"all"!==t.imageFace?O(r,t.imageFace):r}static createSphere(e,t){return e instanceof u?new H(T(z(t?.densificationFactor||0),e,t)):(J().error(".createSphere()",b),null)}static createCylinder(e,t){return e instanceof u?new H(T(D(t?.densificationFactor||0),e,t)):(J().error(".createCylinder()",b),null)}static createPlane(e,t){if(!(e instanceof u))return J().error(".createPlane()",b),null;const r=t?.facing??"up",o=N(r,t?.size);return new H(T(W(r),e,{...t,size:o}))}static createFromPolygon(e,t){if(!(e instanceof f))return J().error(".createFromPolygon()",M),null;const r=E(e);return new H({vertexAttributes:new _({position:r.position}),components:[new j({faces:r.faces,shading:"flat",material:t?.material??null})],spatialReference:e.spatialReference,vertexSpace:new L})}static async createFromGLTF(e,t,r){if(!(e instanceof u)){const e=new A;throw J().error(".createfromGLTF()",e.message),e}const{loadGLTFMesh:o}=await a(import("./support/meshUtils/loadGLTFMesh.js"),r);return new H(await o(e,t,r))}static async createFromFiles(e,o,s){t(J(),"`Mesh.createFromFiles` is deprecated in favor of 'SceneLayer.convertMesh'",{replacement:"SceneLayer.convertMesh",version:"4.29"});const n=e=>J().error(".createFromFiles()",e.message);if(!(e instanceof u)){const e=new A;throw n(e),e}if(!s?.layer)throw new r("invalid:no-layer","SceneLayer required for file to mesh conversion.");return s.layer.convertMesh(o,{location:e,...s})}static createWithExternalSource(e,t,r){const o=r?.extent??null,{spatialReference:s}=e,n=r?.transform?.clone()??new R,i=P(e,r),a={source:t,extent:o},c=new I;return c.externalSources.push(a),new H({metadata:c,transform:n,vertexSpace:i,spatialReference:s})}static createIncomplete(e,t){const{spatialReference:o}=e,s=t?.transform?.clone()??new R,n=P(e,t),i=new H({transform:s,vertexSpace:n,spatialReference:o});return i.addResolvingPromise(Promise.reject(new r("mesh-incomplete","Mesh resources are not complete"))),i}};e([p({type:[j],json:{write:!0}})],X.prototype,"components",void 0),e([p({nonNullable:!0,types:Q,constructOnly:!0,json:{write:!0}})],X.prototype,"vertexSpace",void 0),e([p({type:R,json:{write:!0}})],X.prototype,"transform",void 0),e([p({constructOnly:!0})],X.prototype,"metadata",void 0),e([p()],X.prototype,"hasExtent",null),e([p()],X.prototype,"_transformedExtent",null),e([p()],X.prototype,"_untransformedBounds",null),e([p()],X.prototype,"origin",null),e([p({readOnly:!0,json:{read:!1}})],X.prototype,"extent",null),e([p({readOnly:!0,json:{read:!1,write:!0,default:!0}})],X.prototype,"hasZ",void 0),e([p({readOnly:!0,json:{read:!1,write:!0,default:!1}})],X.prototype,"hasM",void 0),e([p({type:_,nonNullable:!0,json:{write:!0}})],X.prototype,"vertexAttributes",void 0),X=H=e([l(K)],X);const Y=g(),$=X;export{$ as default};
@@ -2,4 +2,4 @@
2
2
  All material copyright ESRI, All Rights Reserved, unless otherwise specified.
3
3
  See https://js.arcgis.com/4.32/esri/copyright.txt for details.
4
4
  */
5
- import{_ as t}from"../../chunks/tslib.es6.js";import{JSONSupport as o}from"../../core/JSONSupport.js";import{clone as r}from"../../core/lang.js";import e from"../../core/Logger.js";import{property as s}from"../../core/accessorSupport/decorators/property.js";import{cast as n}from"../../core/accessorSupport/decorators/cast.js";import{subclass as i}from"../../core/accessorSupport/decorators/subclass.js";import{castArray as a,writeTypedArray as l}from"./meshProperties.js";var g;let p=g=class extends o{constructor(t){super(t),this.color=null,this.position=new Float64Array(0),this.uv=null,this.normal=null,this.tangent=null}castColor(t){return a(t,Uint8Array,[Uint8ClampedArray],{loggerTag:".color=",stride:4},e.getLogger(this))}castPosition(t){t&&t instanceof Float32Array&&e.getLogger(this).warn(".position=","Setting position attribute from a Float32Array may cause precision problems. Consider storing data in a Float64Array or a regular number array");return a(t,Float64Array,[Float32Array],{loggerTag:".position=",stride:3},e.getLogger(this))}castUv(t){return a(t,Float32Array,[Float64Array],{loggerTag:".uv=",stride:2},e.getLogger(this))}castNormal(t){return a(t,Float32Array,[Float64Array],{loggerTag:".normal=",stride:3},e.getLogger(this))}castTangent(t){return a(t,Float32Array,[Float64Array],{loggerTag:".tangent=",stride:4},e.getLogger(this))}clone(){const t={position:r(this.position),uv:r(this.uv),normal:r(this.normal),tangent:r(this.tangent),color:r(this.color)};return new g(t)}clonePositional(){const t={position:r(this.position),normal:r(this.normal),tangent:r(this.tangent),uv:this.uv,color:this.color};return new g(t)}get memoryUsage(){let t=0;return t+=this.position.byteLength,null!=this.uv&&(t+=this.uv.byteLength),null!=this.normal&&(t+=this.normal.byteLength),null!=this.tangent&&(t+=this.tangent.byteLength),null!=this.color&&(t+=this.color.byteLength),t}};t([s({json:{write:l}})],p.prototype,"color",void 0),t([n("color")],p.prototype,"castColor",null),t([s({nonNullable:!0,json:{write:l}})],p.prototype,"position",void 0),t([n("position")],p.prototype,"castPosition",null),t([s({json:{write:l}})],p.prototype,"uv",void 0),t([n("uv")],p.prototype,"castUv",null),t([s({json:{write:l}})],p.prototype,"normal",void 0),t([n("normal")],p.prototype,"castNormal",null),t([s({json:{write:l}})],p.prototype,"tangent",void 0),t([n("tangent")],p.prototype,"castTangent",null),p=g=t([i("esri.geometry.support.MeshVertexAttributes")],p);export{p as MeshVertexAttributes};
5
+ import{_ as t}from"../../chunks/tslib.es6.js";import{JSONSupport as o}from"../../core/JSONSupport.js";import{clone as r}from"../../core/lang.js";import e from"../../core/Logger.js";import{property as s}from"../../core/accessorSupport/decorators/property.js";import{cast as n}from"../../core/accessorSupport/decorators/cast.js";import{subclass as a}from"../../core/accessorSupport/decorators/subclass.js";import{castArray as i,writeTypedArray as l}from"./meshProperties.js";var g;let p=g=class extends o{constructor(t){super(t),this.color=null,this.position=new Float64Array(0),this.uv=null,this.normal=null,this.tangent=null}castColor(t){return i(t,Uint8Array,[Uint8ClampedArray],{loggerTag:".color=",stride:4},e.getLogger(this))}castPosition(t){t&&t instanceof Float32Array&&e.getLogger(this).warn(".position=","Setting position attribute from a Float32Array may cause precision problems. Consider storing data in a Float64Array or a regular number array");return i(t,Float64Array,[Float32Array],{loggerTag:".position=",stride:3},e.getLogger(this))}castUv(t){return i(t,Float32Array,[Float64Array],{loggerTag:".uv=",stride:2},e.getLogger(this))}castNormal(t){return i(t,Float32Array,[Float64Array],{loggerTag:".normal=",stride:3},e.getLogger(this))}castTangent(t){return i(t,Float32Array,[Float64Array],{loggerTag:".tangent=",stride:4},e.getLogger(this))}clone(){const t={position:r(this.position),uv:r(this.uv),normal:r(this.normal),tangent:r(this.tangent),color:r(this.color)};return new g(t)}clonePositional(){const t={position:r(this.position),normal:r(this.normal),tangent:r(this.tangent),uv:this.uv,color:this.color};return new g(t)}get usedMemory(){return this.position.byteLength+(this.uv?.byteLength??0)+(this.normal?.byteLength??0)+(this.tangent?.byteLength??0)+(this.color?.byteLength??0)}};t([s({json:{write:l}})],p.prototype,"color",void 0),t([n("color")],p.prototype,"castColor",null),t([s({nonNullable:!0,json:{write:l}})],p.prototype,"position",void 0),t([n("position")],p.prototype,"castPosition",null),t([s({json:{write:l}})],p.prototype,"uv",void 0),t([n("uv")],p.prototype,"castUv",null),t([s({json:{write:l}})],p.prototype,"normal",void 0),t([n("normal")],p.prototype,"castNormal",null),t([s({json:{write:l}})],p.prototype,"tangent",void 0),t([n("tangent")],p.prototype,"castTangent",null),p=g=t([a("esri.geometry.support.MeshVertexAttributes")],p);export{p as MeshVertexAttributes};
package/interfaces.d.ts CHANGED
@@ -1491,6 +1491,124 @@ declare namespace __esri {
1491
1491
 
1492
1492
  export const mediaUtils: mediaUtils;
1493
1493
 
1494
+ /**
1495
+ * Note: reserved for internal use only, this is not part of the stable public API.
1496
+ *
1497
+ * Table template utilities for the map viewer application.
1498
+ */
1499
+ interface templateUtils {
1500
+ /**
1501
+ * Note: reserved for internal use only, this is not part of the stable public API.
1502
+ *
1503
+ * Generates an AttributeTableTemplate based on the default layer fields.
1504
+ */
1505
+ createDefaultAttributeTableTemplateFromLayer(options: templateUtilsCreateDefaultAttributeTableTemplateFromLayerOptions): Promise<AttributeTableTemplate>;
1506
+ /**
1507
+ * Note: reserved for internal use only, this is not part of the stable public API.
1508
+ *
1509
+ * Generates a TableTemplate based on the default layer fields.
1510
+ */
1511
+ createDefaultTableTemplateFromLayer(options: templateUtilsCreateDefaultTableTemplateFromLayerOptions): Promise<TableTemplate>;
1512
+ /**
1513
+ * Note: reserved for internal use only, this is not part of the stable public API.
1514
+ *
1515
+ * Generates a TableTemplate based on a pre-existing AttributeTableTemplate.
1516
+ */
1517
+ createTableTemplateFromAttributeTableTemplate(options: templateUtilsCreateTableTemplateFromAttributeTableTemplateOptions): Promise<TableTemplate>;
1518
+ /**
1519
+ * Note: reserved for internal use only, this is not part of the stable public API.
1520
+ *
1521
+ * Syncs a provided AttributeTableTemplate with the current state of a provided FeatureTable, using the 'columns' Collection on FeatureTable specifically.
1522
+ */
1523
+ syncAttributeTableTemplate(table: FeatureTable, template: AttributeTableTemplate): AttributeTableTemplate;
1524
+ }
1525
+
1526
+ export const templateUtils: templateUtils;
1527
+
1528
+ export interface templateUtilsCreateDefaultAttributeTableTemplateFromLayerOptions {
1529
+ /**
1530
+ * Layer from which to generate a default template.
1531
+ *
1532
+ * [Read more...](https://developers.arcgis.com/javascript/latest/api-reference/esri-applications-MapViewer-templateUtils.html#createDefaultAttributeTableTemplateFromLayer)
1533
+ */
1534
+ layer: | CatalogFootprintLayer
1535
+ | CSVLayer
1536
+ | FeatureLayer
1537
+ | GeoJSONLayer
1538
+ | ImageryLayer
1539
+ | KnowledgeGraphSublayer
1540
+ | SceneLayer
1541
+ | WFSLayer;
1542
+ /**
1543
+ * Indicates 'attachment' columns should be excluded.
1544
+ *
1545
+ * [Read more...](https://developers.arcgis.com/javascript/latest/api-reference/esri-applications-MapViewer-templateUtils.html#createDefaultAttributeTableTemplateFromLayer)
1546
+ */
1547
+ excludeAttachments?: boolean;
1548
+ /**
1549
+ * Indicates 'relationship' columns should be excluded.
1550
+ *
1551
+ * [Read more...](https://developers.arcgis.com/javascript/latest/api-reference/esri-applications-MapViewer-templateUtils.html#createDefaultAttributeTableTemplateFromLayer)
1552
+ */
1553
+ excludeRelationships?: boolean;
1554
+ }
1555
+
1556
+ export interface templateUtilsCreateDefaultTableTemplateFromLayerOptions {
1557
+ /**
1558
+ * Layer from which to generate a default template.
1559
+ *
1560
+ * [Read more...](https://developers.arcgis.com/javascript/latest/api-reference/esri-applications-MapViewer-templateUtils.html#createDefaultTableTemplateFromLayer)
1561
+ */
1562
+ layer: | CatalogFootprintLayer
1563
+ | CSVLayer
1564
+ | FeatureLayer
1565
+ | GeoJSONLayer
1566
+ | ImageryLayer
1567
+ | KnowledgeGraphSublayer
1568
+ | SceneLayer
1569
+ | WFSLayer;
1570
+ /**
1571
+ * Indicates 'attachment' columns should be excluded.
1572
+ *
1573
+ * [Read more...](https://developers.arcgis.com/javascript/latest/api-reference/esri-applications-MapViewer-templateUtils.html#createDefaultTableTemplateFromLayer)
1574
+ */
1575
+ excludeAttachments?: boolean;
1576
+ /**
1577
+ * Indicates 'relationship' columns should be excluded.
1578
+ *
1579
+ * [Read more...](https://developers.arcgis.com/javascript/latest/api-reference/esri-applications-MapViewer-templateUtils.html#createDefaultTableTemplateFromLayer)
1580
+ */
1581
+ excludeRelationships?: boolean;
1582
+ }
1583
+
1584
+ export interface templateUtilsCreateTableTemplateFromAttributeTableTemplateOptions {
1585
+ /**
1586
+ * Layer from which to generate a default template.
1587
+ *
1588
+ * [Read more...](https://developers.arcgis.com/javascript/latest/api-reference/esri-applications-MapViewer-templateUtils.html#createTableTemplateFromAttributeTableTemplate)
1589
+ */
1590
+ layer: | CatalogFootprintLayer
1591
+ | CSVLayer
1592
+ | FeatureLayer
1593
+ | GeoJSONLayer
1594
+ | ImageryLayer
1595
+ | KnowledgeGraphSublayer
1596
+ | SceneLayer
1597
+ | WFSLayer;
1598
+ /**
1599
+ * Instance of an AttributeTableTemplate used to configure a new TableTemplate.
1600
+ *
1601
+ * [Read more...](https://developers.arcgis.com/javascript/latest/api-reference/esri-applications-MapViewer-templateUtils.html#createTableTemplateFromAttributeTableTemplate)
1602
+ */
1603
+ template: AttributeTableTemplate;
1604
+ /**
1605
+ * Indicates columns should be generated for fields without associated elements.
1606
+ *
1607
+ * [Read more...](https://developers.arcgis.com/javascript/latest/api-reference/esri-applications-MapViewer-templateUtils.html#createTableTemplateFromAttributeTableTemplate)
1608
+ */
1609
+ includeHiddenFields?: boolean;
1610
+ }
1611
+
1494
1612
  /**
1495
1613
  * Note: reserved for internal use only, this is not part of the stable public API.
1496
1614
  *
@@ -74875,6 +74993,16 @@ declare namespace __esri {
74875
74993
  isGrid?: boolean;
74876
74994
  }
74877
74995
 
74996
+ /**
74997
+ * This module provides a function for regenerating renderers based on the current state of the layer and view.
74998
+ *
74999
+ * [Read more...](https://developers.arcgis.com/javascript/latest/api-reference/esri-smartMapping-renderers-support-rendererUtils.html)
75000
+ */
75001
+ interface rendererUtils {
75002
+ }
75003
+
75004
+ export const rendererUtils: rendererUtils;
75005
+
74878
75006
  /**
74879
75007
  * This object contains helper methods for generating data-driven visualizations with unique types (or categories) based on a field value from features in a [Layer](https://developers.arcgis.com/javascript/latest/api-reference/esri-layers-Layer.html).
74880
75008
  *
@@ -2,4 +2,4 @@
2
2
  All material copyright ESRI, All Rights Reserved, unless otherwise specified.
3
3
  See https://js.arcgis.com/4.32/esri/copyright.txt for details.
4
4
  */
5
- import{_ as e}from"../chunks/tslib.es6.js";import"../geometry.js";import t from"../core/Collection.js";import a from"../core/Error.js";import i from"../core/Logger.js";import{getOrCreateMapValue as n}from"../core/MapUtils.js";import{MultiOriginJSONMixin as o}from"../core/MultiOriginJSONSupport.js";import{throwIfAborted as s}from"../core/promiseUtils.js";import{watch as r,sync as l}from"../core/reactiveUtils.js";import{property as h}from"../core/accessorSupport/decorators/property.js";import"../core/has.js";import"../core/RandomLCG.js";import{subclass as d}from"../core/accessorSupport/decorators/subclass.js";import{OriginId as u}from"../core/accessorSupport/PropertyOrigin.js";import p from"./Layer.js";import{convertFromGeometry as c}from"./graphics/featureConversionUtils.js";import y from"./graphics/OptimizedGeometry.js";import{IdealEdgeLengthTypeOptions as g}from"./knowledgeGraph/IdealEdgeLengthTypeOptions.js";import{KnowledgeGraphLayerDataManager as m}from"./knowledgeGraph/KnowledgeGraphLayerDataManager.js";import f from"./knowledgeGraph/KnowledgeGraphSublayer.js";import{systemOidFieldName as L,systemOriginIdFieldName as C,systemDestinationIdFieldName as w,systemLayoutGeometryFieldName as M,systemAggregationCountFieldName as b,initializeLayersFromClientData as k}from"./knowledgeGraph/layerUtils.js";import T from"./knowledgeGraph/SessionMemoryStorage.js";import{getRelationshipEndNodeIds as E}from"./knowledgeGraph/supportUtils.js";import{BlendLayer as N}from"./mixins/BlendLayer.js";import{OperationalLayer as I}from"./mixins/OperationalLayer.js";import{ScaleRangeLayer as D}from"./mixins/ScaleRangeLayer.js";import{LCChronologicalLayout as x,LCSimpleLayout as O,LCSmartTreeLayout as R,LCRadialTreeLayout as _,LCHierarchicalLayout as A,LCCommunityLayout as G,LCForceDirectedLayout as v,NodeFlag as S,load as j,LinkType as P}from"../libs/linkchartlayout/LinkChartLayout.js";import{fetchKnowledgeGraph as H}from"../rest/knowledgeGraphService.js";import F from"../geometry/Extent.js";import U from"../geometry/Point.js";import B from"../geometry/Polyline.js";let z=class extends(I(N(D(o(p))))){constructor(e){if(super(e),this.dataPreloadedInLocalCache=!1,this.defaultLinkChartConfig=null,this._currentLinkChartConfig={layoutMode:"RADIAL_TREE"},this._graphTypeLookup=new Map,this.dataManager=null,this.knowledgeGraph=null,this.layers=new(t.ofType(f)),this.entityLinkChartDiagramLookup=new Map,this.relationshipLinkChartDiagramLookup=new Map,this.linkChartExtent=new F({xmin:-1e-7,ymin:-1e-7,xmax:1e-7,ymax:1e-7}),this.memberEntityTypes=null,this.memberRelationshipTypes=null,this.operationalLayerType="LinkChartLayer",this.sublayerIdsCache=new Map,this.tables=new(t.ofType(f)),this.type="link-chart",this.chronologicalAuxiliaryGraphics=null,this._originalInclusionList=e?.inclusionModeDefinition,e?.dataPreloadedInLocalCache&&!e?.inclusionModeDefinition)throw new a("knowledge-graph:linkchart-layer-constructor","If creating a link chart composite layer and configured that data is already loaded in the cache, you must specify an inclusion list so the Composite Layer knows what records belong to it");this.addHandles(r((()=>this.layers.concat(this.tables)),((e,t)=>this._handleSublayersChange(e,t)),l))}normalizeCtorArgs(e){if(!e)return{};const{url:t,title:a,dataPreloadedInLocalCache:i,defaultLinkChartConfig:n}=e;return{url:t,title:a,dataPreloadedInLocalCache:i,defaultLinkChartConfig:n}}_initializeLayerProperties(e){if(!this.title&&this.url){const e=this.url.split("/");this.title=e[e.length-2]}const t=new Set;let n=[],o=[];if(e.inclusionModeDefinition&&(!e.inclusionModeDefinition.namedTypeDefinitions||e.inclusionModeDefinition.namedTypeDefinitions.size<1))throw new a("knowledge-graph:composite-layer-constructor","If an explicit inclusion definition is defined, at least one namedTypeDefinition must also be defined");e.knowledgeGraph.dataModel.entityTypes?.forEach((e=>{e.name&&this._graphTypeLookup.set(e.name,e)})),e.knowledgeGraph.dataModel.relationshipTypes?.forEach((e=>{e.name&&this._graphTypeLookup.set(e.name,e)})),e.inclusionModeDefinition?.generateAllSublayers?(n=e.knowledgeGraph.dataModel.entityTypes??[],o=e.knowledgeGraph.dataModel.relationshipTypes??[]):e.inclusionModeDefinition?.namedTypeDefinitions&&e.inclusionModeDefinition?.namedTypeDefinitions.size>0?e.inclusionModeDefinition?.namedTypeDefinitions.forEach(((a,s)=>{const r=this._graphTypeLookup.get(s);if(!r)return i.getLogger(this).warn(`A named type, ${s}, was in the inclusion list that wasn't in the data model and will be removed`),void e.inclusionModeDefinition?.namedTypeDefinitions.delete(s);"relationship"===r.type?t.has(s)||(t.add(s),o.push(r)):"entity"===r.type?t.has(s)||(t.add(s),n.push(r)):(i.getLogger(this).warn(`A named type, ${s}, was in the inclusion list that wasn't properly modeled and will be removed`),e.inclusionModeDefinition?.namedTypeDefinitions.delete(s))})):(n=e.knowledgeGraph.dataModel.entityTypes??[],o=e.knowledgeGraph.dataModel.relationshipTypes??[]);const s=new m({knowledgeGraph:e.knowledgeGraph,inclusionModeDefinition:e.inclusionModeDefinition});this.knowledgeGraph=e.knowledgeGraph,this.memberEntityTypes=n,this.memberRelationshipTypes=o,this.dataManager=s}load(e){const t=async()=>{const e=[],t=[];this.loadLayerAssumingLocalCache(),await k(this),this.dataManager.inclusionModeDefinition&&(this.dataManager.inclusionModeDefinition.generateAllSublayers=!1),this.dataManager.inclusionModeDefinition?.namedTypeDefinitions.forEach((e=>{e.useAllData=!1})),await this._initializeDiagram(),this.layers.forEach((a=>{t.push(a.refreshCachedQueryEngine()),e.push(new Promise((e=>{a.on("layerview-create",(()=>{e(null)}))})))})),this.tables.forEach((e=>{t.push(e.refreshCachedQueryEngine())})),await Promise.all(t)};return this.addResolvingPromise(new Promise((a=>{H(this.url).then((async i=>{if(this._initializeLayerProperties({knowledgeGraph:i,inclusionModeDefinition:this._originalInclusionList}),this.dataManager.inclusionModeDefinition?.namedTypeDefinitions?.size||(this.dataManager.inclusionModeDefinition={generateAllSublayers:!1,namedTypeDefinitions:new Map},this.dataManager.knowledgeGraph.dataModel.entityTypes?.forEach((e=>{e.name&&this.dataManager.inclusionModeDefinition?.namedTypeDefinitions.set(e.name,{useAllData:!0})})),this.dataManager.knowledgeGraph.dataModel.relationshipTypes?.forEach((e=>{e.name&&this.dataManager.inclusionModeDefinition?.namedTypeDefinitions.set(e.name,{useAllData:!0})}))),this.dataPreloadedInLocalCache){const e=T.getInstance();for(const[t,a]of this.dataManager.inclusionModeDefinition?.namedTypeDefinitions??[])for(const i of a.members?.values()??[]){const a=e.readFromStoreById(`${t}__${i.id}`);if(a){n(this.dataManager.sublayerCaches,t,(()=>new Map)).set(i.id,a)}}await t()}else{const a="GEOGRAPHIC"===this.defaultLinkChartConfig?.layoutMode;this.addResolvingPromise(this.dataManager.refreshCacheContent(void 0,!1,a,!0).then((async()=>{s(e),await t()})))}a(null)}))}))),Promise.resolve(this)}async addRecords(e,t){let a=[];t?.cascadeAddRelationshipEndNodes&&this.dataManager.knowledgeGraph.dataModel&&(a=await E(e,this.dataManager.knowledgeGraph));const i=e.concat(a).filter((e=>!this.sublayerIdsCache.get(e.typeName)?.has(e.id)));await this._handleNewRecords(i)}async removeRecords(e,{cascadeRemoveRelationships:t=!0,recalculateLayout:a=!1}={cascadeRemoveRelationships:!0,recalculateLayout:!1}){let i=[];for(const o of e)!1===this.dataManager.inclusionModeDefinition?.namedTypeDefinitions?.get(o.typeName)?.useAllData&&this.dataManager.inclusionModeDefinition?.namedTypeDefinitions?.get(o.typeName)?.members?.has(o.id)&&i.push(o);if(t){const e=new Set,t=[];for(const a of i)if(this.dataManager.nodeConnectionsLookup.has(a.id))for(const t of this.dataManager.nodeConnectionsLookup.get(a.id))e.add(t);for(const a of e)if(this.dataManager.memberIdTypeLookup.has(a))for(const e of this.dataManager.memberIdTypeLookup.get(a))this.dataManager.relationshipTypeNames.has(e)&&t.push({id:a,typeName:e});i=i.concat(t)}this.dataManager.removeFromLayer(i);for(const o of i)this.sublayerIdsCache.get(o.typeName)?.delete(o.id),this.dataManager.relationshipTypeNames.has(o.typeName)?this.relationshipLinkChartDiagramLookup.delete(o.id):this.entityLinkChartDiagramLookup.delete(o.id);a&&await this._calculateLayoutWithSublayerTimeInfo(this._currentLinkChartConfig.layoutMode,this._currentLinkChartConfig.layoutOptions);const n=[];return this.layers.forEach((e=>{n.push(e.refreshCachedQueryEngine())})),await Promise.all(n),this._refreshNamedTypes(),i}async expand(e,t){const a=await this.dataManager.getConnectedRecordIds(e,t),i=a.filter((e=>!this.sublayerIdsCache.get(e.typeName)?.has(e.id)));return await this._handleNewRecords(a),{records:i}}loadLayerAssumingLocalCache(){const e=[...this.memberRelationshipTypes,...this.memberEntityTypes];this.originIdOf("layers")===u.DEFAULTS?this._createSublayers(e,this.layers,(e=>!!e.geometryType)):this._updateSublayers(e,this.layers),this.originIdOf("tables")===u.DEFAULTS?this._createSublayers(e,this.tables,(e=>!e.geometryType)):this._updateSublayers(e,this.tables),this.dataManager.inclusionModeDefinition?.namedTypeDefinitions?.forEach(((e,t)=>{const a=n(this.sublayerIdsCache,t,(()=>new Set));e.members?.forEach((({id:e,linkChartLocation:i})=>{if(a.add(e),i){const a=i instanceof y?i:c(i);this.dataManager.relationshipTypeNames.has(t)?this.relationshipLinkChartDiagramLookup.set(e,a):this.entityLinkChartDiagramLookup.set(e,a)}}))}))}async calculateLinkChartLayout(e="RADIAL_TREE",t){const n=[],o=[],s=[];this.dataManager.sublayerCaches.forEach(((e,t)=>{this.dataManager.entityTypeNames.has(t)?e.forEach((e=>{n.push({typeName:t,feature:e})})):this.dataManager.relationshipTypeNames.has(t)&&e.forEach((e=>{o.push({typeName:t,feature:e})}))})),this.entityLinkChartDiagramLookup=new Map,this.relationshipLinkChartDiagramLookup=new Map;const r=new Map,l=new Map,h=new Map,d=new Map,u=new Uint8Array(n.length),p=new Float64Array(n.length),y=new Float64Array(n.length),g=new Float64Array(n.length),m=new Float64Array(n.length),f=new Uint32Array(o.length),k=new Uint32Array(o.length),T=new Float64Array(o.length),E=new Float64Array(o.length),N=[],I="FORCE_DIRECTED",D=new F({xmin:-1e-7,ymin:-1e-7,xmax:1e-7,ymax:1e-7});let H,z="FORCE_DIRECTED",W=0,Q=0;const $=x.apply;switch(z="GEOGRAPHIC"===e?I:e,z){case"FORCE_DIRECTED":H=v.apply;break;case"COMMUNITY":H=G.apply;break;case"HIERARCHICAL":H=A.apply;break;case"RADIAL_TREE":H=_.apply;break;case"SMART_TREE":H=R.apply;break;default:H=O.apply}let K=!1;n.forEach((({typeName:a,feature:i})=>{if("CHRONOLOGICAL_SINGLE"!==e&&"CHRONOLOGICAL_MULTIPLE"!==e&&t?.lockedNodeLocations?.has(i.attributes[L])){"GEOGRAPHIC"===e&&this.dataManager.geographicLookup.has(a)?u[W]=S.IsGeographic:u[W]=S.None;const n=t.lockedNodeLocations.get(i.attributes[L]);p[W]=n.x,y[W]=n.y}else if("GEOGRAPHIC"===e&&this.dataManager.geographicLookup.has(a)){u[W]=S.IsGeographic;let e=null;const t=i.attributes[this.dataManager.geographicLookup.get(a).name],n=this.dataManager.geographicLookup.get(a)?.geometryType;switch(n){case"esriGeometryPoint":p[W]=t?.x,y[W]=t?.y;break;case"esriGeometryPolygon":e=t?.centroid,null!=e?.x&&null!=e?.y?(p[W]=e.x,y[W]=e.y):u[W]=S.IsMovable;break;case"esriGeometryPolyline":case"esriGeometryMultipoint":e=t?.extent?.center,null!=e?.x&&null!=e?.y?(p[W]=e.x,y[W]=e.y):u[W]=S.IsMovable;break;default:u[W]=S.IsMovable}(null==p[W]||null==y[W]||Number.isNaN(p[W])||Number.isNaN(y[W]))&&(u[W]=S.IsMovable,p[W]=0,y[W]=0)}else if("CHRONOLOGICAL_SINGLE"===e||"CHRONOLOGICAL_MULTIPLE"===e){!K&&t?.lockedNodeLocations?.has(i.attributes[L])&&(K=!0);const e=t?.timeInfoByTypeName?.get(a),n=e?.startField,o=n&&e?.startField?i.attributes[n]:null;g[W]=o?new Date(o).getTime():NaN;const s=e?.endField,r=s&&e?.endField?i.attributes[s]:null;m[W]=r?new Date(r).getTime():NaN,p[W]=0,y[W]=0,u[W]=S.IsMovable}else u[W]=S.IsMovable,p[W]=0,y[W]=0;d.set(i.attributes[L],W),N[W]={feature:i,typeName:a},W++})),K&&i.getLogger(this).warn("Locked node locations are not supported for chronological layout at this time. Requested node locations were ignored");let Y=!1;const q=new Map;o.forEach((a=>{const i=a.feature.attributes[C],n=a.feature.attributes[w],o=d.get(i),r=d.get(n),l=t?.timeInfoByTypeName?.get(a.typeName),h=t?.timeInfoByTypeName?l?.startField:null,u=h?a.feature.attributes[h]:null,p=l?.endField,c=p?a.feature.attributes[p]:null;if(void 0!==o&&void 0!==r){let t=i+"-"+n;"CHRONOLOGICAL_SINGLE"!==e&&"CHRONOLOGICAL_MULTIPLE"!==e||(t=t+"-"+u+"-"+c);const l=q.get(t),h=l?.has(a.typeName);h||(f[Q]=o,k[Q]=r,"CHRONOLOGICAL_SINGLE"!==e&&"CHRONOLOGICAL_MULTIPLE"!==e||(T[Q]=u?new Date(u).getTime():NaN,E[Q]=c?new Date(c).getTime():NaN),void 0===l?q.set(t,new Map([[a.typeName,Q]])):l.set(a.typeName,Q),Q++),s.push(a)}else Y=!0,this.relationshipLinkChartDiagramLookup.set(i,null)})),Y&&i.getLogger(this).warn("A relationship is a member of this layer that has either origin or destination entity nodes that are not members. The diagram geometry will be set to null");const J=this._validateLayoutSettings(e,t),V=this._convertLayoutSettingsToCalculationSettings(J);await j();let X=!1,Z=null;if("CHRONOLOGICAL_SINGLE"===e||"CHRONOLOGICAL_MULTIPLE"===e){let a;({success:X,links:Z,graphics:a}=$(u,p,y,g,m,f.subarray(0,Q),k.subarray(0,Q),T.subarray(0,Q),E.subarray(0,Q),"CHRONOLOGICAL_MULTIPLE"===e,t?.chronologicalLayoutSettings??{})),X&&(this.chronologicalAuxiliaryGraphics=a)}else({success:X,links:Z}=H(u,p,y,f.subarray(0,Q),k.subarray(0,Q),V.computationBudgetTime,V.idealEdgeLengthMultiplier,V.repulsionRadiusMultiplier));if(!X)throw new a("knowledge-graph:layout-failed","Attempting to arrange the records in the specified layout failed");for(let a=0;a<N.length;a++){if(y[a]>84.9999?y[a]=84.9999:y[a]<-84.9999&&(y[a]=-84.9999),p[a]>179.9999?p[a]=179.9999:p[a]<-179.9999&&(p[a]=-179.9999),N[a].feature.attributes[M]=new U(p[a],y[a]),r.has(N[a].typeName)){const e=r.get(N[a].typeName);e?.set(N[a].feature.attributes[L],N[a].feature)}else{const e=new Map;e.set(N[a].feature.attributes[L],N[a].feature),r.set(N[a].typeName,e)}h.set(N[a].feature.attributes[L],N[a].feature);const e=c(N[a].feature.attributes[M]);this.entityLinkChartDiagramLookup.set(N[a].feature.attributes[L],N[a].feature.attributes[M]?e:null),N[a].feature.attributes[M].x<D.xmin&&(D.xmin=N[a].feature.attributes[M].x),N[a].feature.attributes[M].x>D.xmax&&(D.xmax=N[a].feature.attributes[M].x),N[a].feature.attributes[M].y<D.ymin&&(D.ymin=N[a].feature.attributes[M].y),N[a].feature.attributes[M].y>D.ymax&&(D.ymax=N[a].feature.attributes[M].y)}if(this.linkChartExtent.xmin=D.xmin,this.linkChartExtent.xmax=D.xmax,this.linkChartExtent.ymin=D.ymin,this.linkChartExtent.ymax=D.ymax,!Z)throw new a("knowledge-graph:layout-failed","Attempting to retrieve link geometry from diagram engine failed");const ee=new Map,te=new Map,ae=new Map,ie=new Set;for(let a=0;a<s.length;a++){const n=[],o=s[a],r=o.feature.attributes[C],u=o.feature.attributes[w];let p=r+"-"+u;if("CHRONOLOGICAL_SINGLE"===e||"CHRONOLOGICAL_MULTIPLE"===e){const e=t?.timeInfoByTypeName?.get(o.typeName),a=t?.timeInfoByTypeName?e?.startField:null,i=a?o.feature.attributes[a]:null,n=e?.endField;p+="-"+i+"-"+(n?o.feature.attributes[n]:null)}const y=q.get(p).get(o.typeName),g=0===y?0:Z?.vertexEndIndex[y-1];if(!ie.has(y)){if(ie.add(y),Z.types[y]===P.Recursive){const e=[Z.vertices[2*g],Z.vertices[2*g+1]],t=[Z.vertices[2*(g+1)],Z.vertices[2*(g+1)+1]],a=[.5*(e[0]+t[0]),.5*(e[1]+t[1])],i=[a[0]-e[0],a[1]-e[1]],o=[a[0]+i[1],a[1]-i[0]],s=[a[0]-i[1],a[1]+i[0]];n.push(e),n.push(o),n.push(t),n.push(s),n.push(e)}else{if(Z.types[y]!==P.Regular){i.getLogger(this).warn("A relationship generated an unsupported link geometry type. It will not be rendered");continue}for(let e=g;e<Z.vertexEndIndex[y];e++)n.push([Z.vertices[2*e],Z.vertices[2*e+1]])}if("CHRONOLOGICAL_SINGLE"!==e&&"CHRONOLOGICAL_MULTIPLE"!==e){const e=N[d.get(r)]?.feature.attributes[M],t=N[d.get(u)]?.feature.attributes[M];n[0][0]===e.x&&n[0][1]===e.y||(n[0]=[e.x,e.y]),n[n.length-1][0]===t.x&&n[n.length-1][1]===t.y||(n[n.length-1]=[t.x,t.y])}for(let e=1;e<n.length-1;e++)n[e][1]>85.5?n[e][1]=85.5:n[e][1]<-85.5&&(n[e][1]=-85.5),n[e][0]>179.9999?n[e][0]=179.9999:n[e][0]<-179.9999&&(n[e][0]=-179.9999);ee.has(p)?ee.get(p).push(n):ee.set(p,[n])}const m=ee.get(p);te.has(p)||(te.set(p,new Map),ae.set(p,new Map));const f=te.get(p),b=ae.get(p);f.has(o.typeName)||(f.set(o.typeName,m.shift()),b.set(o.typeName,0));const k=f.get(o.typeName);b.set(o.typeName,b.get(o.typeName)+1);const T=new B({paths:[k]});if(o.feature.attributes[M]=T,l.has(o.typeName)){const e=l.get(o.typeName);e?.set(o.feature.attributes[L],o.feature)}else{const e=new Map;e.set(o.feature.attributes[L],o.feature),l.set(o.typeName,e)}h.set(o.feature.attributes[L],o.feature);const E=c(o.feature.attributes[M]);this.relationshipLinkChartDiagramLookup.set(o.feature.attributes[L],o.feature.attributes[M]?E:null)}for(const a of s)a.feature.attributes[b]=ae.get(a.feature.attributes[C]+"-"+a.feature.attributes[w])?.get(a.typeName)??null;return this._currentLinkChartConfig={layoutMode:e,layoutOptions:J},{nodes:r,links:l,idMap:h}}async applyNewLinkChartLayout(e="RADIAL_TREE",t){const a=[];await this._calculateLayoutWithSublayerTimeInfo(e,t),this.layers.forEach((e=>{a.push(e.refreshCachedQueryEngine())})),await Promise.all(a),this._refreshNamedTypes()}getCurrentNodeLocations(){const e=new Map;return this.dataManager.inclusionModeDefinition?.namedTypeDefinitions?.forEach((t=>{t?.members?.forEach((t=>{const a=t.linkChartLocation;let i;const n=t.id;a&&(i="x"in a?{x:a.x,y:a.y}:{x:a.coords[0],y:a.coords[1]},e.set(n,new U({x:i.x,y:i.y})))}))})),e}async synchronizeInclusionListWithCache(){return new Promise((e=>{this.dataManager.inclusionModeDefinition?.namedTypeDefinitions.forEach(((e,t)=>{if(e.useAllData=!1,e.members&&e.members.size>0){if(!this.dataManager.sublayerCaches.get(t))return;const a=new Set(Array.from(this.dataManager.sublayerCaches.get(t).keys()));Array.from(e.members.keys()).filter((e=>!a.has(e))).forEach((t=>{e.members?.delete(t)}))}})),e()}))}async refreshLinkChartCache(e){await this.dataManager.refreshCacheContent(e);const t=[];this.layers.forEach((e=>{t.push(e.refreshCachedQueryEngine())})),await Promise.all(t),this._refreshNamedTypes()}async connectBetweenEntities(e){if(!e.length)return{records:[]};let t=[];for(const i of this.dataManager.relationshipTypeNames){const e=this.sublayerIdsCache.get(i);e&&(t=t.concat(Array.from(e.keys())))}const a=await this.dataManager.getRelationshipsBetweenNodes(e,t);return await this._handleNewRecords(a),{records:a}}async connectFromEntities(e){if(!e.length)return{records:[]};let t=[];for(const n of this.dataManager.relationshipTypeNames){const e=this.sublayerIdsCache.get(n);e&&(t=t.concat(Array.from(e.keys())))}let a=[];for(const n of this.dataManager.entityTypeNames){const e=this.sublayerIdsCache.get(n);e&&(a=a.concat(Array.from(e)))}const i=await this.dataManager.getRelationshipsFromNodes(e,a,t);return await this._handleNewRecords(i),{records:i}}getCurrentLayout(){return this._currentLinkChartConfig.layoutMode}async _calculateLayoutWithSublayerTimeInfo(e="RADIAL_TREE",t){const a=new Map;this.layers.forEach((e=>{a.set(e.objectType.name,e.timeInfo)})),await this.calculateLinkChartLayout(e,{timeInfoByTypeName:a,...t})}async _handleNewRecords(e){const t=[];this.dataManager.addToLayer(e);for(const i of e)this.sublayerIdsCache.has(i.typeName)||(this.sublayerIdsCache.set(i.typeName,new Set),t.push(i.typeName)),this.sublayerIdsCache.get(i.typeName).add(i.id);for(const i of t){const e=this._graphTypeLookup.get(i);if(e){const t=this._createSublayer(e);"entity"===e.type?this.dataManager.entityTypeNames.add(i):this.dataManager.relationshipTypeNames.add(i),t.geometryType?this.layers.push(t):this.tables.push(t),this.dataManager.sublayerCaches.set(i,new Map)}}await k(this,t),await this.dataManager.refreshCacheContent(e.map((e=>e.id)));const a=Object.assign({},this._currentLinkChartConfig.layoutOptions);a.lockedNodeLocations=new Map;for(const[i,n]of this.entityLinkChartDiagramLookup.entries())n&&a.lockedNodeLocations.set(i,new U(n.coords[0],n.coords[1]));await this.applyNewLinkChartLayout(this._currentLinkChartConfig.layoutMode,a)}_createSublayers(e,t,a){e.forEach((e=>{const i=this._createSublayer(e);a(i)&&t.push(i),this._updateSublayerCaches(e)}))}_updateSublayers(e,t){t.forEach((t=>{t.parentCompositeLayer=this;const a=e.find((e=>e.type===t.graphType&&e.name===t.graphTypeName));a&&(t.objectType=a,t.read({title:a.name},{origin:"service"}),this._updateSublayerCaches(a))}))}_updateSublayerCaches(e){const t=this.dataManager.sublayerCaches;t.has(e.name)||t.set(e.name,new Map)}async _initializeDiagram(){this.defaultLinkChartConfig?this.defaultLinkChartConfig.doNotRecalculateLayout?(this.dataManager.inclusionModeDefinition?.namedTypeDefinitions?.forEach(((e,t)=>{e?.members?.forEach((e=>{const a=e.linkChartLocation;let i;const n=e.id;if(!a)return;i="x"in a?{x:a.x,y:a.y}:{x:a.coords[0],y:a.coords[1]};const o=c(i);this.dataManager.relationshipTypeNames.has(t)?this.relationshipLinkChartDiagramLookup.set(n,o):this.entityLinkChartDiagramLookup.set(n,o),this.linkChartExtent.xmin>i.x&&(this.linkChartExtent.xmin=i.x),this.linkChartExtent.xmax<i.x&&(this.linkChartExtent.xmax=i.x),this.linkChartExtent.ymin>i.y&&(this.linkChartExtent.ymin=i.y),this.linkChartExtent.ymax<i.y&&(this.linkChartExtent.ymax=i.y)}))})),this.memberRelationshipTypes.forEach((e=>{e.name&&this.dataManager.sublayerCaches.get(e.name)?.forEach((e=>{const t=this.relationshipLinkChartDiagramLookup.get(e.attributes[C]),a=this.relationshipLinkChartDiagramLookup.get(e.attributes[w]);if(t&&a){const i=c(new B({paths:[[[t.coords[0],t.coords[1]],[a.coords[0],a.coords[1]]]]}));this.relationshipLinkChartDiagramLookup.set(e.attributes[L],i)}else this.relationshipLinkChartDiagramLookup.set(e.attributes[L],null)}))}))):await this._calculateLayoutWithSublayerTimeInfo(this.defaultLinkChartConfig.layoutMode,{lockedNodeLocations:this.getCurrentNodeLocations(),...this.defaultLinkChartConfig.layoutOptions||{}}):await this._calculateLayoutWithSublayerTimeInfo("RADIAL_TREE",{lockedNodeLocations:this.getCurrentNodeLocations()})}_refreshNamedTypes(){for(const e of this.layers)e.emit("refresh",{dataChanged:!0});for(const e of this.tables)e.emit("refresh",{dataChanged:!0})}_validateLayoutSettings(e,t){const a=e=>"number"==typeof e&&!isNaN(e),n=e=>a(e)&&e>=1,o=e=>a(e)&&e>=1,s=e=>Object.values(g).includes(e),r=e=>a(e)&&e>=0,l={organicLayoutSettings:{},chronologicalLayoutSettings:{}};if(!new Set(["FORCE_DIRECTED","COMMUNITY","GEOGRAPHIC","CHRONOLOGICAL_MULTIPLE","CHRONOLOGICAL_SINGLE"]).has(e)||!t)return l;t.organicLayoutSettings??={};const{computationBudgetTime:h,repulsionRadiusMultiplier:d,idealEdgeLength:u,idealEdgeLengthType:p}=t.organicLayoutSettings;o(h)?l.organicLayoutSettings.computationBudgetTime=h:void 0!==h&&i.getLogger(this).warn("Invalid layout computationBudgetTime setting, will revert to default setting"),n(d)?l.organicLayoutSettings.repulsionRadiusMultiplier=d:void 0!==d&&i.getLogger(this).warn("Invalid layout repulsionRadiusMultiplier setting, will revert to default setting");if("GEOGRAPHIC"===e&&(void 0!==u||void 0!==p)&&(s(p)?l.organicLayoutSettings.idealEdgeLengthType=p:void 0!==p&&i.getLogger(this).warn('Invalid layout idealEdgeLengthType setting, will revert to "multiplier" setting'),r(u)?l.organicLayoutSettings.idealEdgeLength=u:void 0!==u&&i.getLogger(this).warn("Invalid layout idealEdgeLength setting, will revert to default setting")),("CHRONOLOGICAL_MULTIPLE"===e||"CHRONOLOGICAL_SINGLE"===e)&&t.chronologicalLayoutSettings){const e=t.chronologicalLayoutSettings;e.durationLineWidth&&e.durationLineWidth<0&&i.getLogger(this).warn("Invalid layout durationLineWidth setting, will revert to default setting")}return l}_convertLayoutSettingsToCalculationSettings(e){e.organicLayoutSettings??={};let t=e.organicLayoutSettings.idealEdgeLength;return e.organicLayoutSettings.idealEdgeLengthType===g.ABSOLUTE&&(void 0===t?t=-1:t*=-1),{computationBudgetTime:e.organicLayoutSettings.computationBudgetTime,repulsionRadiusMultiplier:e.organicLayoutSettings.repulsionRadiusMultiplier,idealEdgeLengthMultiplier:t}}_createSublayer(e){return new f({objectType:e,parentCompositeLayer:this,graphType:e.type})}_handleSublayersChange(e,t){t&&(t.forEach((e=>{e.parent=null})),this.removeHandles("sublayers-owner")),e&&(e.forEach((e=>{e.parent=this})),this.addHandles([e.on("after-add",(({item:e})=>{e.parent=this})),e.on("after-remove",(({item:e})=>{e.parent=null}))],"sublayers-owner"))}};e([h()],z.prototype,"dataPreloadedInLocalCache",void 0),e([h()],z.prototype,"defaultLinkChartConfig",void 0),e([h()],z.prototype,"dataManager",void 0),e([h()],z.prototype,"knowledgeGraph",void 0),e([h({type:t.ofType(f),json:{write:{ignoreOrigin:!0}}})],z.prototype,"layers",void 0),e([h()],z.prototype,"entityLinkChartDiagramLookup",void 0),e([h()],z.prototype,"relationshipLinkChartDiagramLookup",void 0),e([h()],z.prototype,"linkChartExtent",void 0),e([h()],z.prototype,"memberEntityTypes",void 0),e([h()],z.prototype,"memberRelationshipTypes",void 0),e([h({type:["LinkChartLayer"]})],z.prototype,"operationalLayerType",void 0),e([h()],z.prototype,"sublayerIdsCache",void 0),e([h({type:t.ofType(f),json:{write:{ignoreOrigin:!0}}})],z.prototype,"tables",void 0),e([h({json:{read:!1}})],z.prototype,"type",void 0),e([h({json:{read:!1}})],z.prototype,"chronologicalAuxiliaryGraphics",void 0),z=e([d("esri.layers.LinkChartLayer")],z);const W=z;export{W as default};
5
+ import{_ as e}from"../chunks/tslib.es6.js";import"../geometry.js";import t from"../core/Collection.js";import a from"../core/Error.js";import i from"../core/Logger.js";import{getOrCreateMapValue as n}from"../core/MapUtils.js";import{MultiOriginJSONMixin as s}from"../core/MultiOriginJSONSupport.js";import{throwIfAborted as o}from"../core/promiseUtils.js";import{watch as r,sync as l}from"../core/reactiveUtils.js";import{property as h}from"../core/accessorSupport/decorators/property.js";import"../core/has.js";import"../core/RandomLCG.js";import{subclass as d}from"../core/accessorSupport/decorators/subclass.js";import{OriginId as p}from"../core/accessorSupport/PropertyOrigin.js";import u from"./Layer.js";import{convertFromGeometry as y}from"./graphics/featureConversionUtils.js";import c from"./graphics/OptimizedGeometry.js";import{IdealEdgeLengthTypeOptions as g}from"./knowledgeGraph/IdealEdgeLengthTypeOptions.js";import{KnowledgeGraphLayerDataManager as m}from"./knowledgeGraph/KnowledgeGraphLayerDataManager.js";import f from"./knowledgeGraph/KnowledgeGraphSublayer.js";import{systemOidFieldName as L,systemOriginIdFieldName as C,systemDestinationIdFieldName as b,systemLayoutGeometryFieldName as M,systemAggregationCountFieldName as w,initializeLayersFromClientData as k}from"./knowledgeGraph/layerUtils.js";import T from"./knowledgeGraph/SessionMemoryStorage.js";import{graphLayersSupportUtilsModuleWrapper as N,convertLayoutSettingsJSON as E,convertLayoutTypeJSON as I,getRelationshipEndNodeIds as D}from"./knowledgeGraph/supportUtils.js";import{BlendLayer as _}from"./mixins/BlendLayer.js";import{OperationalLayer as x}from"./mixins/OperationalLayer.js";import{ScaleRangeLayer as A}from"./mixins/ScaleRangeLayer.js";import{LCChronologicalLayout as O,LCSimpleLayout as R,LCSmartTreeLayout as v,LCRadialTreeLayout as S,LCHierarchicalLayout as G,LCCommunityLayout as P,LCForceDirectedLayout as j,NodeFlag as H,load as U,LinkType as F}from"../libs/linkchartlayout/LinkChartLayout.js";import{fetchKnowledgeGraph as B}from"../rest/knowledgeGraphService.js";import z from"../geometry/Extent.js";import W from"../geometry/Point.js";import Q from"../geometry/Polyline.js";let $=class extends(x(_(A(s(u))))){constructor(e){if(super(e),this.dataPreloadedInLocalCache=!1,this.defaultLinkChartConfig=null,this.membershipModified=!0,this._currentLinkChartConfig={layoutMode:"RADIAL_TREE"},this._graphTypeLookup=new Map,this.dataManager=null,this.knowledgeGraph=null,this.layers=new(t.ofType(f)),this.entityLinkChartDiagramLookup=new Map,this.relationshipLinkChartDiagramLookup=new Map,this.linkChartExtent=new z({xmin:-1e-7,ymin:-1e-7,xmax:1e-7,ymax:1e-7}),this.memberEntityTypes=null,this.memberRelationshipTypes=null,this.operationalLayerType="LinkChartLayer",this.sublayerIdsCache=new Map,this.tables=new(t.ofType(f)),this.type="link-chart",this.chronologicalAuxiliaryGraphics=null,this._originalInclusionList=e?.inclusionModeDefinition,e?.dataPreloadedInLocalCache&&!e?.inclusionModeDefinition)throw new a("knowledge-graph:linkchart-layer-constructor","If creating a link chart composite layer and configured that data is already loaded in the cache, you must specify an inclusion list so the Composite Layer knows what records belong to it");this.addHandles(r((()=>this.layers.concat(this.tables)),((e,t)=>this._handleSublayersChange(e,t)),l))}normalizeCtorArgs(e){if(!e)return{};const{url:t,title:a,dataPreloadedInLocalCache:i,defaultLinkChartConfig:n}=e;return{url:t,title:a,dataPreloadedInLocalCache:i,defaultLinkChartConfig:n}}_initializeLayerProperties(e){if(!this.title&&this.url){const e=this.url.split("/");this.title=e[e.length-2]}const t=new Set;let n=[],s=[];if(e.inclusionModeDefinition&&(!e.inclusionModeDefinition.namedTypeDefinitions||e.inclusionModeDefinition.namedTypeDefinitions.size<1))throw new a("knowledge-graph:composite-layer-constructor","If an explicit inclusion definition is defined, at least one namedTypeDefinition must also be defined");e.inclusionModeDefinition?.generateAllSublayers?(n=e.knowledgeGraph.dataModel.entityTypes??[],s=e.knowledgeGraph.dataModel.relationshipTypes??[]):e.inclusionModeDefinition?.namedTypeDefinitions&&e.inclusionModeDefinition?.namedTypeDefinitions.size>0?e.inclusionModeDefinition?.namedTypeDefinitions.forEach(((a,o)=>{const r=this._graphTypeLookup.get(o);if(!r)return i.getLogger(this).warn(`A named type, ${o}, was in the inclusion list that wasn't in the data model and will be removed`),void e.inclusionModeDefinition?.namedTypeDefinitions.delete(o);"relationship"===r.type?t.has(o)||(t.add(o),s.push(r)):"entity"===r.type?t.has(o)||(t.add(o),n.push(r)):(i.getLogger(this).warn(`A named type, ${o}, was in the inclusion list that wasn't properly modeled and will be removed`),e.inclusionModeDefinition?.namedTypeDefinitions.delete(o))})):(n=e.knowledgeGraph.dataModel.entityTypes??[],s=e.knowledgeGraph.dataModel.relationshipTypes??[]);const o=new m({knowledgeGraph:e.knowledgeGraph,inclusionModeDefinition:e.inclusionModeDefinition});this.knowledgeGraph=e.knowledgeGraph,this.memberEntityTypes=n,this.memberRelationshipTypes=s,this.dataManager=o}load(e){const t=async()=>{const e=[],t=[];this.loadLayerAssumingLocalCache(),await k(this),this.dataManager.inclusionModeDefinition&&(this.dataManager.inclusionModeDefinition.generateAllSublayers=!1),this.dataManager.inclusionModeDefinition?.namedTypeDefinitions.forEach((e=>{e.useAllData=!1})),await this._initializeDiagram(),this.layers.forEach((a=>{t.push(a.refreshCachedQueryEngine()),e.push(new Promise((e=>{a.on("layerview-create",(()=>{e(null)}))})))})),this.tables.forEach((e=>{t.push(e.refreshCachedQueryEngine())})),await Promise.all(t)};return this.addResolvingPromise(new Promise((a=>{B(this.url).then((async i=>{i.dataModel.entityTypes?.forEach((e=>{e.name&&this._graphTypeLookup.set(e.name,e)})),i.dataModel.relationshipTypes?.forEach((e=>{e.name&&this._graphTypeLookup.set(e.name,e)}));const s=this.parent?.linkChartProperties;if(s?.originIdOf("entitiesUrl")===p.LINK_CHART&&(this.membershipModified=!1,this._originalInclusionList=await N.fetchAndConvertSerializedLinkChart({entitiesUrl:this.parent.linkChartProperties.entitiesUrl,relationshipsUrl:this.parent.linkChartProperties.relationshipsUrl}),this._alignLayersDataModelAndInclusionDefinition(i.dataModel),this.defaultLinkChartConfig={layoutOptions:s?.layoutSettings?E(s.layoutSettings,void 0):void 0,layoutMode:s?.layoutType?I(s.layoutType):"RADIAL_TREE"}),this._initializeLayerProperties({knowledgeGraph:i,inclusionModeDefinition:this._originalInclusionList}),this.dataManager.inclusionModeDefinition?.namedTypeDefinitions?.size||(this.dataManager.inclusionModeDefinition={generateAllSublayers:!1,namedTypeDefinitions:new Map},this.dataManager.knowledgeGraph.dataModel.entityTypes?.forEach((e=>{e.name&&this.dataManager.inclusionModeDefinition?.namedTypeDefinitions.set(e.name,{useAllData:!0})})),this.dataManager.knowledgeGraph.dataModel.relationshipTypes?.forEach((e=>{e.name&&this.dataManager.inclusionModeDefinition?.namedTypeDefinitions.set(e.name,{useAllData:!0})}))),this.dataPreloadedInLocalCache){const e=T.getInstance();for(const[t,a]of this.dataManager.inclusionModeDefinition?.namedTypeDefinitions??[])for(const i of a.members?.values()??[]){const a=e.readFromStoreById(`${t}__${i.id}`);if(a){n(this.dataManager.sublayerCaches,t,(()=>new Map)).set(i.id,a)}}await t()}else{const a="GEOGRAPHIC"===this.defaultLinkChartConfig?.layoutMode;this.addResolvingPromise(this.dataManager.refreshCacheContent(void 0,!1,a,!0).then((async()=>{o(e),await t()})))}a(null)}))}))),Promise.resolve(this)}async addRecords(e,t){let a=[];t?.cascadeAddRelationshipEndNodes&&this.dataManager.knowledgeGraph.dataModel&&(a=await D(e,this.dataManager.knowledgeGraph));const i=e.concat(a).filter((e=>!this.sublayerIdsCache.get(e.typeName)?.has(e.id)));i.length>0&&(this.membershipModified=!0),await this._handleNewRecords(i)}async removeRecords(e,{cascadeRemoveRelationships:t=!0,recalculateLayout:a=!1}={cascadeRemoveRelationships:!0,recalculateLayout:!1}){let i=[];for(const s of e)!1===this.dataManager.inclusionModeDefinition?.namedTypeDefinitions?.get(s.typeName)?.useAllData&&this.dataManager.inclusionModeDefinition?.namedTypeDefinitions?.get(s.typeName)?.members?.has(s.id)&&i.push(s);if(t){const e=new Set,t=[];for(const a of i)if(this.dataManager.nodeConnectionsLookup.has(a.id))for(const t of this.dataManager.nodeConnectionsLookup.get(a.id))e.add(t);for(const a of e)if(this.dataManager.memberIdTypeLookup.has(a))for(const e of this.dataManager.memberIdTypeLookup.get(a))this.dataManager.relationshipTypeNames.has(e)&&t.push({id:a,typeName:e});i=i.concat(t)}this.dataManager.removeFromLayer(i);for(const s of i)this.sublayerIdsCache.get(s.typeName)?.delete(s.id),this.dataManager.relationshipTypeNames.has(s.typeName)?this.relationshipLinkChartDiagramLookup.delete(s.id):this.entityLinkChartDiagramLookup.delete(s.id);a&&await this._calculateLayoutWithSublayerTimeInfo(this._currentLinkChartConfig.layoutMode,this._currentLinkChartConfig.layoutOptions),i.length>0&&(this.membershipModified=!0);const n=[];return this.layers.forEach((e=>{n.push(e.refreshCachedQueryEngine())})),await Promise.all(n),this._refreshNamedTypes(),i}async expand(e,t){const a=await this.dataManager.getConnectedRecordIds(e,t),i=a.filter((e=>!this.sublayerIdsCache.get(e.typeName)?.has(e.id)));return await this._handleNewRecords(a),a.length>0&&(this.membershipModified=!0),{records:i}}loadLayerAssumingLocalCache(){const e=[...this.memberRelationshipTypes,...this.memberEntityTypes];this.originIdOf("layers")===p.DEFAULTS?this._createSublayers(e,this.layers,(e=>!!e.geometryType)):this._updateSublayers(e,this.layers),this.originIdOf("tables")===p.DEFAULTS?this._createSublayers(e,this.tables,(e=>!e.geometryType)):this._updateSublayers(e,this.tables),this.dataManager.inclusionModeDefinition?.namedTypeDefinitions?.forEach(((e,t)=>{const a=n(this.sublayerIdsCache,t,(()=>new Set));e.members?.forEach((({id:e,linkChartLocation:i})=>{if(a.add(e),i){const a=i instanceof c?i:y(i);this.dataManager.relationshipTypeNames.has(t)?this.relationshipLinkChartDiagramLookup.set(e,a):this.entityLinkChartDiagramLookup.set(e,a)}}))}))}async calculateLinkChartLayout(e="RADIAL_TREE",t){const s=[],o=[],r=[];this.dataManager.sublayerCaches.forEach(((e,t)=>{this.dataManager.entityTypeNames.has(t)?e.forEach((e=>{s.push({typeName:t,feature:e})})):this.dataManager.relationshipTypeNames.has(t)&&e.forEach((e=>{o.push({typeName:t,feature:e})}))})),this.entityLinkChartDiagramLookup=new Map,this.relationshipLinkChartDiagramLookup=new Map;const l=new Map,h=new Map,d=new Map,p=new Map,u=new Uint8Array(s.length),c=new Float64Array(s.length),g=new Float64Array(s.length),m=new Float64Array(s.length),f=new Float64Array(s.length),k=new Uint32Array(o.length),T=new Uint32Array(o.length),N=new Float64Array(o.length),E=new Float64Array(o.length),I=[],D="FORCE_DIRECTED",_=new z({xmin:-1e-7,ymin:-1e-7,xmax:1e-7,ymax:1e-7});let x,A="FORCE_DIRECTED",B=0,$=0;const K=O.apply;switch(A="GEOGRAPHIC"===e?D:e,A){case"FORCE_DIRECTED":x=j.apply;break;case"COMMUNITY":x=P.apply;break;case"HIERARCHICAL":x=G.apply;break;case"RADIAL_TREE":x=S.apply;break;case"SMART_TREE":x=v.apply;break;default:x=R.apply}let Y=!1;s.forEach((({typeName:a,feature:i})=>{if("CHRONOLOGICAL_SINGLE"!==e&&"CHRONOLOGICAL_MULTIPLE"!==e&&t?.lockedNodeLocations?.has(i.attributes[L])){"GEOGRAPHIC"===e&&this.dataManager.geographicLookup.has(a)?u[B]=H.IsGeographic:u[B]=H.None;const n=t.lockedNodeLocations.get(i.attributes[L]);c[B]=n.x,g[B]=n.y}else if("GEOGRAPHIC"===e&&this.dataManager.geographicLookup.has(a)){u[B]=H.IsGeographic;let e=null;const t=i.attributes[this.dataManager.geographicLookup.get(a).name],n=this.dataManager.geographicLookup.get(a)?.geometryType;switch(n){case"esriGeometryPoint":c[B]=t?.x,g[B]=t?.y;break;case"esriGeometryPolygon":e=t?.centroid,null!=e?.x&&null!=e?.y?(c[B]=e.x,g[B]=e.y):u[B]=H.IsMovable;break;case"esriGeometryPolyline":case"esriGeometryMultipoint":e=t?.extent?.center,null!=e?.x&&null!=e?.y?(c[B]=e.x,g[B]=e.y):u[B]=H.IsMovable;break;default:u[B]=H.IsMovable}(null==c[B]||null==g[B]||Number.isNaN(c[B])||Number.isNaN(g[B]))&&(u[B]=H.IsMovable,c[B]=0,g[B]=0)}else if("CHRONOLOGICAL_SINGLE"===e||"CHRONOLOGICAL_MULTIPLE"===e){!Y&&t?.lockedNodeLocations?.has(i.attributes[L])&&(Y=!0);const e=t?.timeInfoByTypeName?.get(a),n=e?.startField,s=n&&e?.startField?i.attributes[n]:null;m[B]=s?new Date(s).getTime():NaN;const o=e?.endField,r=o&&e?.endField?i.attributes[o]:null;f[B]=r?new Date(r).getTime():NaN,c[B]=0,g[B]=0,u[B]=H.IsMovable}else u[B]=H.IsMovable,c[B]=0,g[B]=0;p.set(i.attributes[L],B),I[B]={feature:i,typeName:a},B++})),Y&&i.getLogger(this).warn("Locked node locations are not supported for chronological layout at this time. Requested node locations were ignored");let q=!1;const J=new Map;o.forEach((a=>{const i=a.feature.attributes[C],n=a.feature.attributes[b],s=p.get(i),o=p.get(n),l=t?.timeInfoByTypeName?.get(a.typeName),h=t?.timeInfoByTypeName?l?.startField:null,d=h?a.feature.attributes[h]:null,u=l?.endField,y=u?a.feature.attributes[u]:null;if(void 0!==s&&void 0!==o){let t=i+"-"+n;"CHRONOLOGICAL_SINGLE"!==e&&"CHRONOLOGICAL_MULTIPLE"!==e||(t=t+"-"+d+"-"+y);const l=J.get(t),h=l?.has(a.typeName);h||(k[$]=s,T[$]=o,"CHRONOLOGICAL_SINGLE"!==e&&"CHRONOLOGICAL_MULTIPLE"!==e||(N[$]=d?new Date(d).getTime():NaN,E[$]=y?new Date(y).getTime():NaN),void 0===l?J.set(t,new Map([[a.typeName,$]])):l.set(a.typeName,$),$++),r.push(a)}else q=!0,this.relationshipLinkChartDiagramLookup.set(i,null)})),q&&i.getLogger(this).warn("A relationship is a member of this layer that has either origin or destination entity nodes that are not members. The diagram geometry will be set to null");const V=this._validateLayoutSettings(e,t),X=this._convertLayoutSettingsToCalculationSettings(V);await U();let Z=!1,ee=null;if("CHRONOLOGICAL_SINGLE"===e||"CHRONOLOGICAL_MULTIPLE"===e){let a;({success:Z,links:ee,graphics:a}=K(u,c,g,m,f,k.subarray(0,$),T.subarray(0,$),N.subarray(0,$),E.subarray(0,$),"CHRONOLOGICAL_MULTIPLE"===e,t?.chronologicalLayoutSettings??{})),Z&&(this.chronologicalAuxiliaryGraphics=a)}else({success:Z,links:ee}=x(u,c,g,k.subarray(0,$),T.subarray(0,$),X.computationBudgetTime,X.idealEdgeLengthMultiplier,X.repulsionRadiusMultiplier));if(!Z)throw new a("knowledge-graph:layout-failed","Attempting to arrange the records in the specified layout failed");for(let a=0;a<I.length;a++){if(g[a]>84.9999?g[a]=84.9999:g[a]<-84.9999&&(g[a]=-84.9999),c[a]>179.9999?c[a]=179.9999:c[a]<-179.9999&&(c[a]=-179.9999),I[a].feature.attributes[M]=new W(c[a],g[a]),l.has(I[a].typeName)){const e=l.get(I[a].typeName);e?.set(I[a].feature.attributes[L],I[a].feature)}else{const e=new Map;e.set(I[a].feature.attributes[L],I[a].feature),l.set(I[a].typeName,e)}d.set(I[a].feature.attributes[L],I[a].feature);const e=y(I[a].feature.attributes[M]);this.entityLinkChartDiagramLookup.set(I[a].feature.attributes[L],I[a].feature.attributes[M]?e:null);const t=n(this.dataManager.inclusionModeDefinition.namedTypeDefinitions,I[a].typeName,(()=>({useAllData:!1,members:new Map})));n(t.members,I[a].feature.attributes[L],(()=>({id:I[a].feature.attributes[L],linkChartLocation:void 0}))).linkChartLocation=I[a].feature.attributes[M],I[a].feature.attributes[M].x<_.xmin&&(_.xmin=I[a].feature.attributes[M].x),I[a].feature.attributes[M].x>_.xmax&&(_.xmax=I[a].feature.attributes[M].x),I[a].feature.attributes[M].y<_.ymin&&(_.ymin=I[a].feature.attributes[M].y),I[a].feature.attributes[M].y>_.ymax&&(_.ymax=I[a].feature.attributes[M].y)}if(this.linkChartExtent.xmin=_.xmin,this.linkChartExtent.xmax=_.xmax,this.linkChartExtent.ymin=_.ymin,this.linkChartExtent.ymax=_.ymax,!ee)throw new a("knowledge-graph:layout-failed","Attempting to retrieve link geometry from diagram engine failed");const te=new Map,ae=new Map,ie=new Map,ne=new Set;for(let a=0;a<r.length;a++){const s=[],o=r[a],l=o.feature.attributes[C],u=o.feature.attributes[b];let c=l+"-"+u;if("CHRONOLOGICAL_SINGLE"===e||"CHRONOLOGICAL_MULTIPLE"===e){const e=t?.timeInfoByTypeName?.get(o.typeName),a=t?.timeInfoByTypeName?e?.startField:null,i=a?o.feature.attributes[a]:null,n=e?.endField;c+="-"+i+"-"+(n?o.feature.attributes[n]:null)}const g=J.get(c).get(o.typeName),m=0===g?0:ee?.vertexEndIndex[g-1];if(!ne.has(g)){if(ne.add(g),ee.types[g]===F.Recursive){const e=[ee.vertices[2*m],ee.vertices[2*m+1]],t=[ee.vertices[2*(m+1)],ee.vertices[2*(m+1)+1]],a=[.5*(e[0]+t[0]),.5*(e[1]+t[1])],i=[a[0]-e[0],a[1]-e[1]],n=[a[0]+i[1],a[1]-i[0]],o=[a[0]-i[1],a[1]+i[0]];s.push(e),s.push(n),s.push(t),s.push(o),s.push(e)}else{if(ee.types[g]!==F.Regular){i.getLogger(this).warn("A relationship generated an unsupported link geometry type. It will not be rendered");continue}for(let e=m;e<ee.vertexEndIndex[g];e++)s.push([ee.vertices[2*e],ee.vertices[2*e+1]])}if("CHRONOLOGICAL_SINGLE"!==e&&"CHRONOLOGICAL_MULTIPLE"!==e){const e=I[p.get(l)]?.feature.attributes[M],t=I[p.get(u)]?.feature.attributes[M];s[0][0]===e.x&&s[0][1]===e.y||(s[0]=[e.x,e.y]),s[s.length-1][0]===t.x&&s[s.length-1][1]===t.y||(s[s.length-1]=[t.x,t.y])}for(let e=1;e<s.length-1;e++)s[e][1]>85.5?s[e][1]=85.5:s[e][1]<-85.5&&(s[e][1]=-85.5),s[e][0]>179.9999?s[e][0]=179.9999:s[e][0]<-179.9999&&(s[e][0]=-179.9999);te.has(c)?te.get(c).push(s):te.set(c,[s])}const f=te.get(c);ae.has(c)||(ae.set(c,new Map),ie.set(c,new Map));const w=ae.get(c),k=ie.get(c);w.has(o.typeName)||(w.set(o.typeName,f.shift()),k.set(o.typeName,0));const T=w.get(o.typeName);k.set(o.typeName,k.get(o.typeName)+1);const N=new Q({paths:[T]});if(o.feature.attributes[M]=N,h.has(o.typeName)){const e=h.get(o.typeName);e?.set(o.feature.attributes[L],o.feature)}else{const e=new Map;e.set(o.feature.attributes[L],o.feature),h.set(o.typeName,e)}d.set(o.feature.attributes[L],o.feature);const E=y(o.feature.attributes[M]);this.relationshipLinkChartDiagramLookup.set(o.feature.attributes[L],o.feature.attributes[M]?E:null);const D=n(this.dataManager.inclusionModeDefinition.namedTypeDefinitions,o.typeName,(()=>({useAllData:!1,members:new Map})));n(D.members,o.feature.attributes[L],(()=>({id:o.feature.attributes[L],linkChartLocation:void 0}))).linkChartLocation=o.feature.attributes[M]}for(const a of r)a.feature.attributes[w]=ie.get(a.feature.attributes[C]+"-"+a.feature.attributes[b])?.get(a.typeName)??null;return this._currentLinkChartConfig={layoutMode:e,layoutOptions:V},{nodes:l,links:h,idMap:d}}async applyNewLinkChartLayout(e="RADIAL_TREE",t){const a=[];await this._calculateLayoutWithSublayerTimeInfo(e,t),this.layers.forEach((e=>{a.push(e.refreshCachedQueryEngine())})),this.membershipModified=!0,await Promise.all(a),this._refreshNamedTypes()}getCurrentNodeLocations(){const e=new Map;for(const[t,a]of this.dataManager.inclusionModeDefinition?.namedTypeDefinitions.entries()??[])this.dataManager.relationshipTypeNames.has(t)||a?.members?.forEach((t=>{const a=t.linkChartLocation;let i;const n=t.id;a&&(i="x"in a?{x:a.x,y:a.y}:{x:a.coords[0],y:a.coords[1]},e.set(n,new W({x:i.x,y:i.y})))}));return e}async synchronizeInclusionListWithCache(){return new Promise((e=>{this.dataManager.inclusionModeDefinition?.namedTypeDefinitions.forEach(((e,t)=>{if(e.useAllData=!1,e.members&&e.members.size>0){if(!this.dataManager.sublayerCaches.get(t))return;const a=new Set(Array.from(this.dataManager.sublayerCaches.get(t).keys()));Array.from(e.members.keys()).filter((e=>!a.has(e))).forEach((t=>{e.members?.delete(t)}))}})),this.membershipModified=!0,e()}))}async refreshLinkChartCache(e){await this.dataManager.refreshCacheContent(e);const t=[];this.layers.forEach((e=>{t.push(e.refreshCachedQueryEngine())})),await Promise.all(t),this._refreshNamedTypes()}async connectBetweenEntities(e){if(!e.length)return{records:[]};let t=[];for(const i of this.dataManager.relationshipTypeNames){const e=this.sublayerIdsCache.get(i);e&&(t=t.concat(Array.from(e.keys())))}const a=await this.dataManager.getRelationshipsBetweenNodes(e,t);return await this._handleNewRecords(a),{records:a}}async connectFromEntities(e){if(!e.length)return{records:[]};let t=[];for(const n of this.dataManager.relationshipTypeNames){const e=this.sublayerIdsCache.get(n);e&&(t=t.concat(Array.from(e.keys())))}let a=[];for(const n of this.dataManager.entityTypeNames){const e=this.sublayerIdsCache.get(n);e&&(a=a.concat(Array.from(e)))}const i=await this.dataManager.getRelationshipsFromNodes(e,a,t);return await this._handleNewRecords(i),i.length>0&&(this.membershipModified=!0),{records:i}}getCurrentLayout(){return this._currentLinkChartConfig.layoutMode}async _calculateLayoutWithSublayerTimeInfo(e="RADIAL_TREE",t){const a=new Map;this.layers.forEach((e=>{a.set(e.objectType.name,e.timeInfo)})),await this.calculateLinkChartLayout(e,{timeInfoByTypeName:a,...t})}async _handleNewRecords(e){const t=[];this.dataManager.addToLayer(e);for(const i of e)this.sublayerIdsCache.has(i.typeName)||(this.sublayerIdsCache.set(i.typeName,new Set),t.push(i.typeName)),this.sublayerIdsCache.get(i.typeName).add(i.id);for(const i of t){const e=this._graphTypeLookup.get(i);if(e){const t=this._createSublayer(e);"entity"===e.type?this.dataManager.entityTypeNames.add(i):this.dataManager.relationshipTypeNames.add(i),t.geometryType?this.layers.push(t):this.tables.push(t),this.dataManager.sublayerCaches.set(i,new Map)}}await k(this,t),await this.dataManager.refreshCacheContent(e.map((e=>e.id)));const a=Object.assign({},this._currentLinkChartConfig.layoutOptions);a.lockedNodeLocations=new Map;for(const[i,n]of this.entityLinkChartDiagramLookup.entries())n&&a.lockedNodeLocations.set(i,new W(n.coords[0],n.coords[1]));await this.applyNewLinkChartLayout(this._currentLinkChartConfig.layoutMode,a)}_createSublayers(e,t,a){e.forEach((e=>{const i=this._createSublayer(e);a(i)&&t.push(i),this._updateSublayerCaches(e)}))}_updateSublayers(e,t){t.forEach((t=>{t.parentCompositeLayer=this;const a=e.find((e=>e.type===t.graphType&&e.name===t.graphTypeName));a&&(t.objectType=a,t.read({title:a.name},{origin:"service"}),this._updateSublayerCaches(a))}))}_updateSublayerCaches(e){const t=this.dataManager.sublayerCaches;t.has(e.name)||t.set(e.name,new Map)}async _initializeDiagram(){this.defaultLinkChartConfig?this.defaultLinkChartConfig.doNotRecalculateLayout?(this.dataManager.inclusionModeDefinition?.namedTypeDefinitions?.forEach(((e,t)=>{e?.members?.forEach((e=>{const a=e.linkChartLocation;let i;const n=e.id;if(!a)return;i="x"in a?{x:a.x,y:a.y}:{x:a.coords[0],y:a.coords[1]};const s=y(i);this.dataManager.relationshipTypeNames.has(t)?this.relationshipLinkChartDiagramLookup.set(n,s):this.entityLinkChartDiagramLookup.set(n,s),this.linkChartExtent.xmin>i.x&&(this.linkChartExtent.xmin=i.x),this.linkChartExtent.xmax<i.x&&(this.linkChartExtent.xmax=i.x),this.linkChartExtent.ymin>i.y&&(this.linkChartExtent.ymin=i.y),this.linkChartExtent.ymax<i.y&&(this.linkChartExtent.ymax=i.y)}))})),this.memberRelationshipTypes.forEach((e=>{e.name&&this.dataManager.sublayerCaches.get(e.name)?.forEach((e=>{const t=this.relationshipLinkChartDiagramLookup.get(e.attributes[C]),a=this.relationshipLinkChartDiagramLookup.get(e.attributes[b]);if(t&&a){const i=y(new Q({paths:[[[t.coords[0],t.coords[1]],[a.coords[0],a.coords[1]]]]}));this.relationshipLinkChartDiagramLookup.set(e.attributes[L],i)}else this.relationshipLinkChartDiagramLookup.set(e.attributes[L],null)}))}))):await this._calculateLayoutWithSublayerTimeInfo(this.defaultLinkChartConfig.layoutMode,{lockedNodeLocations:this.getCurrentNodeLocations(),...this.defaultLinkChartConfig.layoutOptions||{}}):await this._calculateLayoutWithSublayerTimeInfo("RADIAL_TREE",{lockedNodeLocations:this.getCurrentNodeLocations()})}_refreshNamedTypes(){for(const e of this.layers)e.emit("refresh",{dataChanged:!0});for(const e of this.tables)e.emit("refresh",{dataChanged:!0})}_validateLayoutSettings(e,t){const a=e=>"number"==typeof e&&!isNaN(e),n=e=>a(e)&&e>=1,s=e=>a(e)&&e>=1,o=e=>Object.values(g).includes(e),r=e=>a(e)&&e>=0,l={organicLayoutSettings:{},chronologicalLayoutSettings:{}};if(!new Set(["FORCE_DIRECTED","COMMUNITY","GEOGRAPHIC","CHRONOLOGICAL_MULTIPLE","CHRONOLOGICAL_SINGLE"]).has(e)||!t)return l;t.organicLayoutSettings??={};const{computationBudgetTime:h,repulsionRadiusMultiplier:d,idealEdgeLength:p,idealEdgeLengthType:u}=t.organicLayoutSettings;s(h)?l.organicLayoutSettings.computationBudgetTime=h:void 0!==h&&i.getLogger(this).warn("Invalid layout computationBudgetTime setting, will revert to default setting"),n(d)?l.organicLayoutSettings.repulsionRadiusMultiplier=d:void 0!==d&&i.getLogger(this).warn("Invalid layout repulsionRadiusMultiplier setting, will revert to default setting");if("GEOGRAPHIC"===e&&(void 0!==p||void 0!==u)&&(o(u)?l.organicLayoutSettings.idealEdgeLengthType=u:void 0!==u&&i.getLogger(this).warn('Invalid layout idealEdgeLengthType setting, will revert to "multiplier" setting'),r(p)?l.organicLayoutSettings.idealEdgeLength=p:void 0!==p&&i.getLogger(this).warn("Invalid layout idealEdgeLength setting, will revert to default setting")),("CHRONOLOGICAL_MULTIPLE"===e||"CHRONOLOGICAL_SINGLE"===e)&&t.chronologicalLayoutSettings){const e=t.chronologicalLayoutSettings;e.durationLineWidth&&e.durationLineWidth<0&&i.getLogger(this).warn("Invalid layout durationLineWidth setting, will revert to default setting")}return l}_convertLayoutSettingsToCalculationSettings(e){e.organicLayoutSettings??={};let t=e.organicLayoutSettings.idealEdgeLength;return e.organicLayoutSettings.idealEdgeLengthType===g.ABSOLUTE&&(void 0===t?t=-1:t*=-1),{computationBudgetTime:e.organicLayoutSettings.computationBudgetTime,repulsionRadiusMultiplier:e.organicLayoutSettings.repulsionRadiusMultiplier,idealEdgeLengthMultiplier:t}}_createSublayer(e){return new f({objectType:e,parentCompositeLayer:this,graphType:e.type})}_handleSublayersChange(e,t){t&&(t.forEach((e=>{e.parent=null})),this.removeHandles("sublayers-owner")),e&&(e.forEach((e=>{e.parent=this})),this.addHandles([e.on("after-add",(({item:e})=>{e.parent=this})),e.on("after-remove",(({item:e})=>{e.parent=null}))],"sublayers-owner"))}_alignLayersDataModelAndInclusionDefinition(e){const a=new Set((e.entityTypes??[]).map((e=>e.name)).concat((e.relationshipTypes??[]).map((e=>e.name)))),n=new Set((e.entityTypes??[]).map((e=>e.name))),s=new Set((e.relationshipTypes??[]).map((e=>e.name)));if(this.layers){for(const e of this.layers)!e.graphType&&a.has(e.graphTypeName)&&(e.graphType=n.has(e.graphTypeName)?"entity":"relationship");this.layers=this.layers.filter((e=>a.has(e.graphTypeName)&&("entity"===e.graphType?n.has(e.graphTypeName):s.has(e.graphTypeName))))}else this.layers=new t;if(this.layers&&this._originalInclusionList){const e=new Set(this._originalInclusionList.namedTypeDefinitions.keys()),t=this.tables?.map((e=>e.graphTypeName))??[],a=this.layers.map((e=>e.graphTypeName)).concat(t);for(const i of a)e.has(i)||this._originalInclusionList.namedTypeDefinitions.set(i,{useAllData:!1,members:new Map});const n=[];for(const s of this._originalInclusionList.namedTypeDefinitions.keys())a.includes(s)||(i.getLogger(this).warn(`A named type, ${s}, was in the serialized feature collection but did not have a sublayer config in the item, so will be removed`),n.push(s));for(const i of n)this._originalInclusionList.namedTypeDefinitions.delete(i)}}};e([h()],$.prototype,"dataPreloadedInLocalCache",void 0),e([h()],$.prototype,"defaultLinkChartConfig",void 0),e([h()],$.prototype,"membershipModified",void 0),e([h()],$.prototype,"dataManager",void 0),e([h()],$.prototype,"knowledgeGraph",void 0),e([h({type:t.ofType(f),json:{write:{ignoreOrigin:!0}}})],$.prototype,"layers",void 0),e([h()],$.prototype,"entityLinkChartDiagramLookup",void 0),e([h()],$.prototype,"relationshipLinkChartDiagramLookup",void 0),e([h()],$.prototype,"linkChartExtent",void 0),e([h()],$.prototype,"memberEntityTypes",void 0),e([h()],$.prototype,"memberRelationshipTypes",void 0),e([h({type:["LinkChartLayer"]})],$.prototype,"operationalLayerType",void 0),e([h()],$.prototype,"sublayerIdsCache",void 0),e([h({type:t.ofType(f),json:{write:{ignoreOrigin:!0}}})],$.prototype,"tables",void 0),e([h({json:{read:!1}})],$.prototype,"type",void 0),e([h({json:{read:!1}})],$.prototype,"chronologicalAuxiliaryGraphics",void 0),$=e([d("esri.layers.LinkChartLayer")],$);const K=$;export{K as default};
@@ -2,4 +2,4 @@
2
2
  All material copyright ESRI, All Rights Reserved, unless otherwise specified.
3
3
  See https://js.arcgis.com/4.32/esri/copyright.txt for details.
4
4
  */
5
- import{_ as e}from"../chunks/tslib.es6.js";import t from"../Graphic.js";import r from"../PopupTemplate.js";import"../renderers/ClassBreaksRenderer.js";import"../renderers/DictionaryRenderer.js";import"../renderers/DotDensityRenderer.js";import"../renderers/HeatmapRenderer.js";import"../renderers/PieChartRenderer.js";import"../renderers/Renderer.js";import"../renderers/SimpleRenderer.js";import"../renderers/UniqueValueRenderer.js";import"../renderers/support/jsonUtils.js";import{webSceneRendererTypes as i}from"../renderers/support/types.js";import{ClonableMixin as s}from"../core/Clonable.js";import o from"../core/Collection.js";import a from"../core/Error.js";import n from"../core/Logger.js";import{MultiOriginJSONMixin as l}from"../core/MultiOriginJSONSupport.js";import{throwIfAbortError as p,isAbortError as d}from"../core/promiseUtils.js";import{whenOnce as u}from"../core/reactiveUtils.js";import{property as y}from"../core/accessorSupport/decorators/property.js";import"../core/has.js";import"../core/RandomLCG.js";import{getProperties as c}from"../core/accessorSupport/utils.js";import{reader as h}from"../core/accessorSupport/decorators/reader.js";import{subclass as m}from"../core/accessorSupport/decorators/subclass.js";import{OriginId as f}from"../core/accessorSupport/PropertyOrigin.js";import g from"../geometry/Mesh.js";import v from"../geometry/Point.js";import b from"./Layer.js";import{NoModelError as w,MultipleModelsError as I}from"./graphics/sources/support/uploadAssetErrors.js";import{APIKeyMixin as L}from"./mixins/APIKeyMixin.js";import{ArcGISService as j}from"./mixins/ArcGISService.js";import{CustomParametersMixin as F}from"./mixins/CustomParametersMixin.js";import{EditBusLayer as S}from"./mixins/EditBusLayer.js";import{OperationalLayer as _}from"./mixins/OperationalLayer.js";import{PortalLayer as P}from"./mixins/PortalLayer.js";import{ScaleRangeLayer as A}from"./mixins/ScaleRangeLayer.js";import{SceneService as O,SaveOperationType as T}from"./mixins/SceneService.js";import{useViewTimeProperty as E}from"./mixins/TemporalLayer.js";import{TemporalSceneLayer as x}from"./mixins/TemporalSceneLayer.js";import{isHostedAgolService as D}from"./support/arcgisLayerUrl.js";import{findAssociatedFeatureService as R}from"./support/associatedFeatureServiceUtils.js";import{zeroCapabilities as U}from"./support/capabilities.js";import{elevationInfo as q,labelsVisible as C,legendEnabled as G,popupEnabled as N,screenSizePerspectiveEnabled as Q}from"./support/commonProperties.js";import{computeEffectiveEditingEnabled as V,getGlobalIdToObjectIdMap as k}from"./support/featureLayerUtils.js";import{FeatureReduction as M}from"./support/FeatureReduction.js";import K from"./support/FeatureReductionSelection.js";import{defineFieldProperties as $}from"./support/fieldProperties.js";import H from"./support/FieldsIndex.js";import{fixRendererFields as z,unpackFieldNames as W}from"./support/fieldUtils.js";import{I3SNodePageDefinition as B,I3SMaterialDefinition as Z,I3STextureSetDefinition as J,I3SGeometryDefinition as X}from"./support/I3SLayerDefinitions.js";import{isFileEditFormat as Y,isFileSupported as ee}from"./support/infoFor3D.js";import te from"./support/LabelClass.js";import{reader as re}from"./support/labelingInfo.js";import ie from"./support/LayerFloorInfo.js";import{layerLookupMap as se}from"./support/lazyLayerLoader.js";import{RangeInfo as oe}from"./support/RangeInfo.js";import ae from"./support/SceneFilter.js";import{cacheIsOutOfSync as ne}from"./support/sceneLayerCacheUtils.js";import{fetchStatistics as le}from"./support/sceneLayerStatistics.js";import{loadStyleRenderer as pe}from"../renderers/support/styleUtils.js";import de from"../rest/support/Query.js";import{logInvalidElevationInfoWarning as ue,elevationModeUnsupportedMessage as ye,featureExpressionUnsupportedMessage as ce}from"../support/elevationInfoUtils.js";import{createPopupTemplate as he}from"../support/popupUtils.js";import{extractZipFiles as me}from"../support/zipUtils.js";import{queryAttributesFromCachedAttributesId as fe}from"../views/3d/layers/i3s/I3SUtil.js";import{getRequiredFields as ge,getFetchPopupTemplate as ve}from"../views/layers/support/popupUtils.js";import{transparencyToOpacity as be}from"../webdoc/support/opacityUtils.js";const we=new Set(["3DObject","Point"]),Ie=$();let Le=class extends(x(S(O(j(_(P(A(l(F(L(s(b)))))))))))){constructor(...e){super(...e),this.featureReduction=null,this.rangeInfos=null,this.operationalLayerType="ArcGISSceneServiceLayer",this.type="scene",this.fields=null,this.floorInfo=null,this.outFields=null,this.nodePages=null,this.materialDefinitions=null,this.textureSetDefinitions=null,this.geometryDefinitions=null,this.serviceUpdateTimeStamp=null,this.excludeObjectIds=new o,this.definitionExpression=null,this.filter=null,this.path=null,this.labelsVisible=!0,this.labelingInfo=null,this.legendEnabled=!0,this.priority=null,this.semantic=null,this.cachedDrawingInfo={color:!1},this.popupEnabled=!0,this.popupTemplate=null,this.objectIdField=null,this.globalIdField=null,this._fieldUsageInfo={},this.screenSizePerspectiveEnabled=!0,this.serviceItemId=void 0}normalizeCtorArgs(e,t){return"string"==typeof e?{url:e,...t}:e}destroy(){this._set("renderer",null)}getField(e){return this.fieldsIndex.get(e)}getFieldDomain(e,t){const r=this.getFeatureType(t?.feature)?.domains?.[e];return r&&"inherited"!==r.type?r:this.getField(e)?.domain??null}getFeatureType(e){return e&&this.associatedLayer?this.associatedLayer.getFeatureType(e):null}get types(){return this.associatedLayer?.types??[]}get typeIdField(){return this.associatedLayer?.typeIdField??null}get templates(){return this.associatedLayer?.templates??null}get formTemplate(){return this.associatedLayer?.formTemplate??null}get attributeTableTemplate(){return this.associatedLayer?.attributeTableTemplate??null}get fieldsIndex(){return new H(this.fields)}readNodePages(e,t,r){return"Point"===t.layerType&&(e=t.pointNodePages),null==e||"object"!=typeof e?null:B.fromJSON(e,r)}set elevationInfo(e){this._set("elevationInfo",e),this.loaded&&this._validateElevationInfo()}get effectiveCapabilities(){return this._capabilitiesFromAssociatedFeatureLayer(this.associatedLayer?.effectiveCapabilities)}get effectiveEditingEnabled(){return null!=this.associatedLayer&&V(this.associatedLayer)}get geometryType(){return Fe[this.profile]||"mesh"}set renderer(e){z(e,this.fieldsIndex),this._set("renderer",e)}readCachedDrawingInfo(e){return null!=e&&"object"==typeof e||(e={}),null==e.color&&(e.color=!1),e}get capabilities(){return this._capabilitiesFromAssociatedFeatureLayer(this.associatedLayer?.capabilities)}_capabilitiesFromAssociatedFeatureLayer(e){e=null!=e?e:U;const{query:t,queryRelated:r,editing:{supportsGlobalId:i,supportsRollbackOnFailure:s,supportsUploadWithItemId:o,supportsGeometryUpdate:a,supportsReturnServiceEditsInSourceSpatialReference:n},data:{supportsZ:l,supportsM:p,isVersioned:d,supportsAttachment:u},operations:{supportsEditing:y,supportsAdd:c,supportsUpdate:h,supportsDelete:m,supportsQuery:f,supportsQueryAttachments:g,supportsAsyncConvert3D:v}}=e,b=e.operations.supportsChangeTracking,w=!!this.associatedLayer?.infoFor3D;return{query:t,queryRelated:r,editing:{supportsGlobalId:i,supportsReturnServiceEditsInSourceSpatialReference:n,supportsRollbackOnFailure:s,supportsGeometryUpdate:w&&a,supportsUploadWithItemId:o},data:{supportsAttachment:u,supportsZ:l,supportsM:p,isVersioned:d},operations:{supportsQuery:f,supportsQueryAttachments:g,supportsEditing:y&&b,supportsAdd:w&&c&&b,supportsDelete:w&&m&&b,supportsUpdate:h&&b,supportsAsyncConvert3D:v}}}get editingEnabled(){return this._isOverridden("editingEnabled")?this._get("editingEnabled"):this.associatedLayer?.editingEnabled??!1}set editingEnabled(e){this._overrideIfSome("editingEnabled",e)}get infoFor3D(){return this.associatedLayer?.infoFor3D??null}get relationships(){return this.associatedLayer?.relationships}get defaultPopupTemplate(){return this.associatedLayer||this.attributeStorageInfo?this.createPopupTemplate():null}readObjectIdField(e,t){return!e&&t.fields&&t.fields.some((t=>("esriFieldTypeOID"===t.type&&(e=t.name),!!e))),e||void 0}readGlobalIdField(e,t){return!e&&t.fields&&t.fields.some((t=>("esriFieldTypeGlobalID"===t.type&&(e=t.name),!!e))),e||void 0}get displayField(){return this.associatedLayer?.displayField??null}readProfile(e,t){const r=t.store.profile;return null!=r&&je[r]?je[r]:(n.getLogger(this).error("Unknown or missing profile",{profile:r,layer:this}),"mesh-pyramids")}get useViewTime(){return this.associatedLayer?.useViewTime??!0}set useViewTime(e){this._override("useViewTime",e)}load(e){return this.addResolvingPromise(this._load(e)),Promise.resolve(this)}async _load(e){const t=null!=e?e.signal:null;await this.loadFromPortal({supportedTypes:["Scene Service"]},e).catch(p),await this._fetchService(t),await Promise.all([this._fetchIndexAndUpdateExtent(this.nodePages,t),this._setAssociatedFeatureLayer(t),this._loadFilterGeometries()]),this._validateElevationInfo(),this._applyAssociatedLayerOverrides(),this._populateFieldUsageInfo(),await this.loadTimeInfoFromService(e),await pe(this,{origin:"service"},t),z(this.renderer,this.fieldsIndex),await this.finishLoadEditablePortalLayer(e)}async beforeSave(){null!=this.filter&&(this.filter=this.filter.clone(),await this.load())}async _loadFilterGeometries(){if(this.filter)try{await this.filter.loadGeometries(this.spatialReference)}catch(e){n.getLogger(this).error("#_loadFilterGeometries()",this,"Failed to load filter geometries. Geometry filter will not be applied for this layer.",{error:e}),this.filter=null}}createQuery(){const e=new de;return"mesh"===this.geometryType?this.associatedLayer?.infoFor3D&&(e.returnGeometry=!0):(e.returnGeometry=!0,e.returnZ=!0),e.where=this.definitionExpression||"1=1",e.sqlFormat="standard",e.outFields=["*"],e}queryExtent(e,t){return this._getAssociatedLayerForQuery().then((r=>r.queryExtent(e||this.createQuery(),t)))}queryFeatureCount(e,t){return this._getAssociatedLayerForQuery().then((r=>r.queryFeatureCount(e||this.createQuery(),t)))}queryFeatures(e,t){return this._getAssociatedLayerForQuery().then((r=>r.queryFeatures(e||this.createQuery(),t))).then((e=>{if(e?.features)for(const t of e.features)t.layer=this,t.sourceLayer=this;return e}))}async queryRelatedFeatures(e,t){if(await this.load(),!this.associatedLayer)throw new a("scenelayer:query-not-available","SceneLayer queries are not available without an associated feature layer",{layer:this});return this.associatedLayer.queryRelatedFeatures(e,t)}async queryRelatedFeaturesCount(e,t){if(await this.load(),!this.associatedLayer)throw new a("scenelayer:query-not-available","SceneLayer queries are not available without an associated feature layer",{layer:this});return this.associatedLayer.queryRelatedFeaturesCount(e,t)}async queryCachedAttributes(e,t){const r=W(this.fieldsIndex,await ge(this,ve(this)));return fe(this.parsedUrl?.path??"",this.attributeStorageInfo??[],e,t,r,this.apiKey,this.customParameters)}async queryCachedFeature(e,r){const i=await this.queryCachedAttributes(e,[r]);if(!i||0===i.length)throw new a("scenelayer:feature-not-in-cached-data","Feature not found in cached data");const s=new t;return s.attributes=i[0],s.layer=this,s.sourceLayer=this,s}queryObjectIds(e,t){return this._getAssociatedLayerForQuery().then((r=>r.queryObjectIds(e||this.createQuery(),t)))}queryAttachments(e,t){return this._getAssociatedLayerForQuery().then((r=>r.queryAttachments(e,t)))}getFieldUsageInfo(e){const t={supportsLabelingInfo:!1,supportsRenderer:!1,supportsPopupTemplate:!1,supportsLayerQuery:!1};return this.loaded?this._fieldUsageInfo[e]||t:(n.getLogger(this).error("#getFieldUsageInfo()","Unavailable until layer is loaded"),t)}createPopupTemplate(e){return he(this,e)}_getAssociatedLayerForQuery(){const e=this.associatedLayer;return e?.loaded?Promise.resolve(e):this._loadAssociatedLayerForQuery()}async _loadAssociatedLayerForQuery(){if(await this.load(),!this.associatedLayer)throw new a("scenelayer:query-not-available","SceneLayer queries are not available without an associated feature layer",{layer:this});try{await this.associatedLayer.load()}catch(e){throw new a("scenelayer:query-not-available","SceneLayer associated feature layer could not be loaded",{layer:this,error:e})}return this.associatedLayer}hasCachedStatistics(e){return null!=this.statisticsInfo&&this.statisticsInfo.some((t=>t.name===e))}async queryCachedStatistics(e,t){return await this.load(t),await this.fetchStatistics(e,t)}async saveAs(e,t){return this._debouncedSaveOperations(T.SAVE_AS,{...t,getTypeKeywords:()=>this._getTypeKeywords(),portalItemLayerType:"scene"},e)}async save(){const e={getTypeKeywords:()=>this._getTypeKeywords(),portalItemLayerType:"scene"};return this._debouncedSaveOperations(T.SAVE,e)}async applyEdits(e,t){const{applyEdits:r}=await import("./graphics/editingSupport.js");let i=t;await this.load();const s=this.associatedLayer;if(!s)throw new a(`${this.type}-layer:not-editable`,"Service is not editable");await s.load();const{globalIdField:o}=s,n=!!s.infoFor3D,l=i?.globalIdUsed??!0;if(n&&null==o)throw new a(`${this.type}-layer:not-editable`,"Valid globalIdField expected on editable SceneLayer");if(n&&!l)throw new a(`${this.type}-layer:globalid-required`,"globalIdUsed must not be false for SceneLayer editing as globalIds are required.");return D(s.url)&&n&&null!=e.deleteFeatures&&null!=o&&(i={...i,globalIdToObjectId:await k(s,e.deleteFeatures,o)}),r(this,s.source,e,i)}async uploadAssets(e,t){if(await this.load(),null==this.associatedLayer)throw new a(`${this.type}-layer:not-editable`,"Service is not editable");return await this.associatedLayer.load(),this.associatedLayer.uploadAssets(e,t)}on(e,t){return super.on(e,t)}async convertMesh(e,t){t??={};const r=e=>{throw n.getLogger(this).error(".convertMesh()",e.message),e};await this.load(),this.infoFor3D||r(new a("invalid:layer","SceneLayer has no capability for mesh conversion"));const i=await this.extractAndFilterFiles(e),s=i.reduce(((e,t)=>Y(this.infoFor3D,t)?e+1:e),0);0===s&&r(new w),s>1&&r(new I);const o=this.spatialReference,l=t.location??new v({x:0,y:0,z:0,spatialReference:o}),p=l.spatialReference.isGeographic?"local":"georeferenced",d=g.createWithExternalSource(l,i,{vertexSpace:p}),[u]=await this.uploadAssets([d],{...t,useAssetOrigin:!t.location});return u}async extractAndFilterFiles(e){await this.load();const t=this.infoFor3D;if(!t)return e;return(await me(e)).filter((e=>ee(t,e)))}validateLayer(e){if(e.layerType&&!we.has(e.layerType))throw new a("scenelayer:layer-type-not-supported","SceneLayer does not support this layer type",{layerType:e.layerType});if(isNaN(this.version.major)||isNaN(this.version.minor))throw new a("layer:service-version-not-supported","Service version is not supported.",{serviceVersion:this.version.versionString,supportedVersions:"1.x, 2.x"});if(this.version.major>2)throw new a("layer:service-version-too-new","Service version is too new.",{serviceVersion:this.version.versionString,supportedVersions:"1.x, 2.x"});function t(e,t){let r=!1,i=!1;if(null==e)r=!0,i=!0;else{const s=t&&t.isGeographic;switch(e){case"east-north-up":case"earth-centered":r=!0,i=s;break;case"vertex-reference-frame":r=!0,i=!s;break;default:r=!1}}if(!r)throw new a("scenelayer:unsupported-normal-reference-frame","Normal reference frame is invalid.");if(!i)throw new a("scenelayer:incompatible-normal-reference-frame","Normal reference frame is incompatible with layer spatial reference.")}t(this.normalReferenceFrame,this.spatialReference)}_getTypeKeywords(){const e=[];if("points"===this.profile)e.push("Point");else{if("mesh-pyramids"!==this.profile)throw new a("scenelayer:unknown-profile","SceneLayer:save() encountered an unknown SceneLayer profile: "+this.profile);e.push("3DObject")}return e}_populateFieldUsageInfo(){if(this._fieldUsageInfo={},this.fields)for(const e of this.fields){const t=!!this.attributeStorageInfo?.some((t=>t.name===e.name)),r=!!this.associatedLayer?.fields?.some((t=>t&&e.name===t.name)),i={supportsLabelingInfo:t,supportsRenderer:t,supportsPopupTemplate:t||r,supportsLayerQuery:r};this._fieldUsageInfo[e.name]=i}}_applyAssociatedLayerOverrides(){this._applyAssociatedLayerFieldsOverrides(),this._applyAssociatedLayerPopupOverrides(),this._applyAssociatedLayerExtentOverride(),this._applyAssociatedLayerPrivileges()}_applyAssociatedLayerFieldsOverrides(){if(!this.associatedLayer?.fields)return;let e=null;for(const t of this.associatedLayer.fields){const r=this.getField(t.name);r?(!r.domain&&t.domain&&(r.domain=t.domain.clone()),r.editable=t.editable,r.nullable=t.nullable,r.length=t.length):(e||(e=this.fields?this.fields.slice():[]),e.push(t.clone()))}e&&this._set("fields",e)}_applyAssociatedLayerPopupOverrides(){if(!this.associatedLayer)return;const e=["popupTemplate","popupEnabled"],t=c(this);for(let r=0;r<e.length;r++){const i=e[r],s=this.originIdOf(i),o=this.associatedLayer.originIdOf(i);s<o&&(o===f.SERVICE||o===f.PORTAL_ITEM)&&t.setAtOrigin(i,this.associatedLayer[i],o)}}_applyAssociatedLayerExtentOverride(){const e=this.associatedLayer?.getAtOrigin("fullExtent","service");if(null==this.associatedLayer?.infoFor3D||!e||!D(this.associatedLayer?.url)||!ne(this))return;c(this).setAtOrigin("fullExtent",e.clone(),f.SERVICE)}_applyAssociatedLayerPrivileges(){const e=this.associatedLayer;e&&(this._set("userHasEditingPrivileges",e.userHasEditingPrivileges),this._set("userHasFullEditingPrivileges",e.userHasFullEditingPrivileges),this._set("userHasUpdateItemPrivileges",e.userHasUpdateItemPrivileges))}async _setAssociatedFeatureLayer(e){if(["mesh-pyramids","points"].includes(this.profile))try{const{serverUrl:t,layerId:r,portalItem:i}=await R(`${this.url}/layers/${this.layerId}`,{sceneLayerItem:this.portalItem,customParameters:this.customParameters,apiKey:this.apiKey,signal:e}),s=await se.FeatureLayer();this.associatedLayer=new s({url:t,customParameters:this.customParameters,layerId:r,portalItem:i}),await this.associatedLayer.load()}catch(t){d(t)||this._logWarningOnPopupEnabled()}}async _logWarningOnPopupEnabled(){await u((()=>this.popupEnabled&&null!=this.popupTemplate));const e=`this SceneLayer: ${this.title}`;null==this.attributeStorageInfo?n.getLogger(this).warn(`Associated FeatureLayer could not be loaded and no binary attributes found. Popups will not work on ${e}`):n.getLogger(this).info(`Associated FeatureLayer could not be loaded. Falling back to binary attributes for Popups on ${e}`)}_validateElevationInfo(){const e=this.elevationInfo;"mesh-pyramids"===this.profile&&ue(n.getLogger(this),ye("Mesh scene layers","relative-to-scene",e)),ue(n.getLogger(this),ce("Scene layers",e))}async fetchStatistics(e,t){return await le({fieldName:e,statisticsInfo:this.statisticsInfo,errorContext:"scenelayer",fieldsIndex:this.fieldsIndex,path:this.parsedUrl?.path??"",customParameters:this.customParameters,apiKey:this.apiKey,signal:t?.signal})}};e([y({types:{key:"type",base:M,typeMap:{selection:K}},json:{origins:{"web-scene":{name:"layerDefinition.featureReduction",write:!0},"portal-item":{name:"layerDefinition.featureReduction",write:!0}}}})],Le.prototype,"featureReduction",void 0),e([y({type:[oe],json:{read:!1,origins:{"web-scene":{name:"layerDefinition.rangeInfos",write:!0},"portal-item":{name:"layerDefinition.rangeInfos",write:!0}}}})],Le.prototype,"rangeInfos",void 0),e([y({json:{read:!1}})],Le.prototype,"associatedLayer",void 0),e([y({type:["show","hide"]})],Le.prototype,"listMode",void 0),e([y({type:["ArcGISSceneServiceLayer"]})],Le.prototype,"operationalLayerType",void 0),e([y({json:{read:!1},readOnly:!0})],Le.prototype,"type",void 0),e([y({...Ie.fields,readOnly:!0,json:{read:!1,origins:{service:{read:!0}}}})],Le.prototype,"fields",void 0),e([y()],Le.prototype,"types",null),e([y()],Le.prototype,"typeIdField",null),e([y()],Le.prototype,"templates",null),e([y()],Le.prototype,"formTemplate",null),e([y()],Le.prototype,"attributeTableTemplate",null),e([y({readOnly:!0,clonable:!1})],Le.prototype,"fieldsIndex",null),e([y({type:ie,json:{read:{source:"layerDefinition.floorInfo"},write:{target:"layerDefinition.floorInfo"}}})],Le.prototype,"floorInfo",void 0),e([y(Ie.outFields)],Le.prototype,"outFields",void 0),e([y({type:B,readOnly:!0,json:{read:!1}})],Le.prototype,"nodePages",void 0),e([h("service","nodePages",["nodePages","pointNodePages"])],Le.prototype,"readNodePages",null),e([y({type:[Z],readOnly:!0})],Le.prototype,"materialDefinitions",void 0),e([y({type:[J],readOnly:!0})],Le.prototype,"textureSetDefinitions",void 0),e([y({type:[X],readOnly:!0})],Le.prototype,"geometryDefinitions",void 0),e([y({readOnly:!0})],Le.prototype,"serviceUpdateTimeStamp",void 0),e([y({readOnly:!0})],Le.prototype,"attributeStorageInfo",void 0),e([y({readOnly:!0})],Le.prototype,"statisticsInfo",void 0),e([y({type:o.ofType(Number),nonNullable:!0,json:{origins:{service:{read:!1,write:!1}},name:"layerDefinition.excludeObjectIds",write:{enabled:!0}}})],Le.prototype,"excludeObjectIds",void 0),e([y({type:String,json:{origins:{service:{read:!1,write:!1}},name:"layerDefinition.definitionExpression",write:{enabled:!0,allowNull:!0}}})],Le.prototype,"definitionExpression",void 0),e([y({type:ae,json:{name:"layerDefinition.polygonFilter",write:{enabled:!0,allowNull:!0},origins:{service:{read:!1,write:!1}}}})],Le.prototype,"filter",void 0),e([y({type:String,json:{origins:{"web-scene":{read:!0,write:!0}},read:!1}})],Le.prototype,"path",void 0),e([y(q)],Le.prototype,"elevationInfo",null),e([y({readOnly:!0,json:{read:!1}})],Le.prototype,"effectiveCapabilities",null),e([y({readOnly:!0})],Le.prototype,"effectiveEditingEnabled",null),e([y({type:String})],Le.prototype,"geometryType",null),e([y(C)],Le.prototype,"labelsVisible",void 0),e([y({type:[te],json:{origins:{service:{name:"drawingInfo.labelingInfo",read:{reader:re},write:!1}},name:"layerDefinition.drawingInfo.labelingInfo",read:{reader:re},write:!0}})],Le.prototype,"labelingInfo",void 0),e([y(G)],Le.prototype,"legendEnabled",void 0),e([y({type:Number,json:{origins:{"web-document":{default:1,write:{enabled:!0,target:{opacity:{type:Number},"layerDefinition.drawingInfo.transparency":{type:Number}}},read:{source:["opacity","layerDefinition.drawingInfo.transparency"],reader(e,t){if("number"==typeof e&&e>=0&&e<=1)return e;const r=t.layerDefinition?.drawingInfo?.transparency;return void 0!==r?be(r):void 0}}},"portal-item":{write:!0},service:{read:!1}}}})],Le.prototype,"opacity",void 0),e([y({type:["Low","High"],readOnly:!0,json:{read:!1,origins:{service:{read:!0}}}})],Le.prototype,"priority",void 0),e([y({type:["Labels"],readOnly:!0,json:{read:!1,origins:{service:{read:!0}}}})],Le.prototype,"semantic",void 0),e([y({types:i,json:{origins:{service:{read:{source:"drawingInfo.renderer"}}},name:"layerDefinition.drawingInfo.renderer",write:!0},value:null})],Le.prototype,"renderer",null),e([y({json:{read:!1}})],Le.prototype,"cachedDrawingInfo",void 0),e([h("service","cachedDrawingInfo")],Le.prototype,"readCachedDrawingInfo",null),e([y({readOnly:!0,json:{read:!1}})],Le.prototype,"capabilities",null),e([y({type:Boolean,json:{read:!1}})],Le.prototype,"editingEnabled",null),e([y({readOnly:!0,json:{write:!1,read:!1}})],Le.prototype,"infoFor3D",null),e([y({readOnly:!0,json:{write:!1,read:!1}})],Le.prototype,"relationships",null),e([y(N)],Le.prototype,"popupEnabled",void 0),e([y({type:r,json:{name:"popupInfo",write:!0}})],Le.prototype,"popupTemplate",void 0),e([y({readOnly:!0,json:{read:!1}})],Le.prototype,"defaultPopupTemplate",null),e([y({type:String,json:{read:!1}})],Le.prototype,"objectIdField",void 0),e([h("service","objectIdField",["objectIdField","fields"])],Le.prototype,"readObjectIdField",null),e([y({type:String,json:{read:!1}})],Le.prototype,"globalIdField",void 0),e([h("service","globalIdField",["globalIdField","fields"])],Le.prototype,"readGlobalIdField",null),e([y({readOnly:!0,type:String,json:{read:!1}})],Le.prototype,"displayField",null),e([y({type:String,json:{read:!1}})],Le.prototype,"profile",void 0),e([h("service","profile",["store.profile"])],Le.prototype,"readProfile",null),e([y({readOnly:!0,type:String,json:{origins:{service:{read:{source:"store.normalReferenceFrame"}}},read:!1}})],Le.prototype,"normalReferenceFrame",void 0),e([y(Q)],Le.prototype,"screenSizePerspectiveEnabled",void 0),e([y({json:{read:!1,origins:{service:{read:!0}}}})],Le.prototype,"serviceItemId",void 0),e([y(E)],Le.prototype,"useViewTime",null),Le=e([m("esri.layers.SceneLayer")],Le);const je={"mesh-pyramids":"mesh-pyramids",meshpyramids:"mesh-pyramids","features-meshes":"mesh-pyramids",points:"points","features-points":"points",lines:"lines","features-lines":"lines",polygons:"polygons","features-polygons":"polygons"},Fe={"mesh-pyramids":"mesh",points:"point"},Se=Le;export{Se as default};
5
+ import{_ as e}from"../chunks/tslib.es6.js";import t from"../Graphic.js";import r from"../PopupTemplate.js";import"../renderers/ClassBreaksRenderer.js";import"../renderers/DictionaryRenderer.js";import"../renderers/DotDensityRenderer.js";import"../renderers/HeatmapRenderer.js";import"../renderers/PieChartRenderer.js";import"../renderers/Renderer.js";import"../renderers/SimpleRenderer.js";import"../renderers/UniqueValueRenderer.js";import"../renderers/support/jsonUtils.js";import{webSceneRendererTypes as i}from"../renderers/support/types.js";import{ClonableMixin as s}from"../core/Clonable.js";import o from"../core/Collection.js";import a from"../core/Error.js";import n from"../core/Logger.js";import{destroyMaybe as l}from"../core/maybe.js";import{MultiOriginJSONMixin as p}from"../core/MultiOriginJSONSupport.js";import{throwIfAbortError as d,isAbortError as u}from"../core/promiseUtils.js";import{whenOnce as y}from"../core/reactiveUtils.js";import{property as c}from"../core/accessorSupport/decorators/property.js";import"../core/has.js";import"../core/RandomLCG.js";import{getProperties as h}from"../core/accessorSupport/utils.js";import{reader as m}from"../core/accessorSupport/decorators/reader.js";import{subclass as f}from"../core/accessorSupport/decorators/subclass.js";import{OriginId as g}from"../core/accessorSupport/PropertyOrigin.js";import v from"../geometry/Mesh.js";import b from"../geometry/Point.js";import w from"./Layer.js";import{NoModelError as I,MultipleModelsError as L}from"./graphics/sources/support/uploadAssetErrors.js";import{APIKeyMixin as j}from"./mixins/APIKeyMixin.js";import{ArcGISService as F}from"./mixins/ArcGISService.js";import{CustomParametersMixin as S}from"./mixins/CustomParametersMixin.js";import{EditBusLayer as _}from"./mixins/EditBusLayer.js";import{OperationalLayer as P}from"./mixins/OperationalLayer.js";import{PortalLayer as A}from"./mixins/PortalLayer.js";import{ScaleRangeLayer as O}from"./mixins/ScaleRangeLayer.js";import{SceneService as T,SaveOperationType as E}from"./mixins/SceneService.js";import{useViewTimeProperty as x}from"./mixins/TemporalLayer.js";import{TemporalSceneLayer as D}from"./mixins/TemporalSceneLayer.js";import{isHostedAgolService as R}from"./support/arcgisLayerUrl.js";import{findAssociatedFeatureService as U}from"./support/associatedFeatureServiceUtils.js";import{zeroCapabilities as q}from"./support/capabilities.js";import{elevationInfo as C,labelsVisible as G,legendEnabled as N,popupEnabled as Q,screenSizePerspectiveEnabled as V}from"./support/commonProperties.js";import{computeEffectiveEditingEnabled as k,getGlobalIdToObjectIdMap as M}from"./support/featureLayerUtils.js";import{FeatureReduction as K}from"./support/FeatureReduction.js";import $ from"./support/FeatureReductionSelection.js";import{defineFieldProperties as H}from"./support/fieldProperties.js";import z from"./support/FieldsIndex.js";import{fixRendererFields as W,unpackFieldNames as B}from"./support/fieldUtils.js";import{I3SNodePageDefinition as Z,I3SMaterialDefinition as J,I3STextureSetDefinition as X,I3SGeometryDefinition as Y}from"./support/I3SLayerDefinitions.js";import{isFileEditFormat as ee,isFileSupported as te}from"./support/infoFor3D.js";import re from"./support/LabelClass.js";import{reader as ie}from"./support/labelingInfo.js";import se from"./support/LayerFloorInfo.js";import{layerLookupMap as oe}from"./support/lazyLayerLoader.js";import{RangeInfo as ae}from"./support/RangeInfo.js";import ne from"./support/SceneFilter.js";import{cacheIsOutOfSync as le}from"./support/sceneLayerCacheUtils.js";import{fetchStatistics as pe}from"./support/sceneLayerStatistics.js";import{loadStyleRenderer as de}from"../renderers/support/styleUtils.js";import ue from"../rest/support/Query.js";import{logInvalidElevationInfoWarning as ye,elevationModeUnsupportedMessage as ce,featureExpressionUnsupportedMessage as he}from"../support/elevationInfoUtils.js";import{createPopupTemplate as me}from"../support/popupUtils.js";import{extractZipFiles as fe}from"../support/zipUtils.js";import{queryAttributesFromCachedAttributesId as ge}from"../views/3d/layers/i3s/I3SUtil.js";import{getRequiredFields as ve,getFetchPopupTemplate as be}from"../views/layers/support/popupUtils.js";import{transparencyToOpacity as we}from"../webdoc/support/opacityUtils.js";const Ie=new Set(["3DObject","Point"]),Le=H();let je=class extends(D(_(T(F(P(A(O(p(S(j(s(w)))))))))))){constructor(...e){super(...e),this.featureReduction=null,this.rangeInfos=null,this.operationalLayerType="ArcGISSceneServiceLayer",this.type="scene",this.fields=null,this.floorInfo=null,this.outFields=null,this.nodePages=null,this.materialDefinitions=null,this.textureSetDefinitions=null,this.geometryDefinitions=null,this.serviceUpdateTimeStamp=null,this.excludeObjectIds=new o,this.definitionExpression=null,this.filter=null,this.path=null,this.labelsVisible=!0,this.labelingInfo=null,this.legendEnabled=!0,this.priority=null,this.semantic=null,this.cachedDrawingInfo={color:!1},this.popupEnabled=!0,this.popupTemplate=null,this.objectIdField=null,this.globalIdField=null,this._fieldUsageInfo={},this.screenSizePerspectiveEnabled=!0,this.serviceItemId=void 0}normalizeCtorArgs(e,t){return"string"==typeof e?{url:e,...t}:e}destroy(){this._set("renderer",null),this.associatedLayer=l(this.associatedLayer)}getField(e){return this.fieldsIndex.get(e)}getFieldDomain(e,t){const r=this.getFeatureType(t?.feature)?.domains?.[e];return r&&"inherited"!==r.type?r:this.getField(e)?.domain??null}getFeatureType(e){return e&&this.associatedLayer?this.associatedLayer.getFeatureType(e):null}get types(){return this.associatedLayer?.types??[]}get typeIdField(){return this.associatedLayer?.typeIdField??null}get templates(){return this.associatedLayer?.templates??null}get formTemplate(){return this.associatedLayer?.formTemplate??null}get attributeTableTemplate(){return this.associatedLayer?.attributeTableTemplate??null}get fieldsIndex(){return new z(this.fields)}readNodePages(e,t,r){return"Point"===t.layerType&&(e=t.pointNodePages),null==e||"object"!=typeof e?null:Z.fromJSON(e,r)}set elevationInfo(e){this._set("elevationInfo",e),this.loaded&&this._validateElevationInfo()}get effectiveCapabilities(){return this._capabilitiesFromAssociatedFeatureLayer(this.associatedLayer?.effectiveCapabilities)}get effectiveEditingEnabled(){return null!=this.associatedLayer&&k(this.associatedLayer)}get geometryType(){return Se[this.profile]||"mesh"}set renderer(e){W(e,this.fieldsIndex),this._set("renderer",e)}readCachedDrawingInfo(e){return null!=e&&"object"==typeof e||(e={}),null==e.color&&(e.color=!1),e}get capabilities(){return this._capabilitiesFromAssociatedFeatureLayer(this.associatedLayer?.capabilities)}_capabilitiesFromAssociatedFeatureLayer(e){e=null!=e?e:q;const{query:t,queryRelated:r,editing:{supportsGlobalId:i,supportsRollbackOnFailure:s,supportsUploadWithItemId:o,supportsGeometryUpdate:a,supportsReturnServiceEditsInSourceSpatialReference:n},data:{supportsZ:l,supportsM:p,isVersioned:d,supportsAttachment:u},operations:{supportsEditing:y,supportsAdd:c,supportsUpdate:h,supportsDelete:m,supportsQuery:f,supportsQueryAttachments:g,supportsAsyncConvert3D:v}}=e,b=e.operations.supportsChangeTracking,w=!!this.associatedLayer?.infoFor3D;return{query:t,queryRelated:r,editing:{supportsGlobalId:i,supportsReturnServiceEditsInSourceSpatialReference:n,supportsRollbackOnFailure:s,supportsGeometryUpdate:w&&a,supportsUploadWithItemId:o},data:{supportsAttachment:u,supportsZ:l,supportsM:p,isVersioned:d},operations:{supportsQuery:f,supportsQueryAttachments:g,supportsEditing:y&&b,supportsAdd:w&&c&&b,supportsDelete:w&&m&&b,supportsUpdate:h&&b,supportsAsyncConvert3D:v}}}get editingEnabled(){return this._isOverridden("editingEnabled")?this._get("editingEnabled"):this.associatedLayer?.editingEnabled??!1}set editingEnabled(e){this._overrideIfSome("editingEnabled",e)}get infoFor3D(){return this.associatedLayer?.infoFor3D??null}get relationships(){return this.associatedLayer?.relationships}get defaultPopupTemplate(){return this.associatedLayer||this.attributeStorageInfo?this.createPopupTemplate():null}readObjectIdField(e,t){return!e&&t.fields&&t.fields.some((t=>("esriFieldTypeOID"===t.type&&(e=t.name),!!e))),e||void 0}readGlobalIdField(e,t){return!e&&t.fields&&t.fields.some((t=>("esriFieldTypeGlobalID"===t.type&&(e=t.name),!!e))),e||void 0}get displayField(){return this.associatedLayer?.displayField??null}readProfile(e,t){const r=t.store.profile;return null!=r&&Fe[r]?Fe[r]:(n.getLogger(this).error("Unknown or missing profile",{profile:r,layer:this}),"mesh-pyramids")}get useViewTime(){return this.associatedLayer?.useViewTime??!0}set useViewTime(e){this._override("useViewTime",e)}load(e){return this.addResolvingPromise(this._load(e)),Promise.resolve(this)}async _load(e){const t=null!=e?e.signal:null;await this.loadFromPortal({supportedTypes:["Scene Service"]},e).catch(d),await this._fetchService(t),await Promise.all([this._fetchIndexAndUpdateExtent(this.nodePages,t),this._setAssociatedFeatureLayer(t),this._loadFilterGeometries()]),this._validateElevationInfo(),this._applyAssociatedLayerOverrides(),this._populateFieldUsageInfo(),await this.loadTimeInfoFromService(e),await de(this,{origin:"service"},t),W(this.renderer,this.fieldsIndex),await this.finishLoadEditablePortalLayer(e)}async beforeSave(){null!=this.filter&&(this.filter=this.filter.clone(),await this.load())}async _loadFilterGeometries(){if(this.filter)try{await this.filter.loadGeometries(this.spatialReference)}catch(e){n.getLogger(this).error("#_loadFilterGeometries()",this,"Failed to load filter geometries. Geometry filter will not be applied for this layer.",{error:e}),this.filter=null}}createQuery(){const e=new ue;return"mesh"===this.geometryType?this.associatedLayer?.infoFor3D&&(e.returnGeometry=!0):(e.returnGeometry=!0,e.returnZ=!0),e.where=this.definitionExpression||"1=1",e.sqlFormat="standard",e.outFields=["*"],e}queryExtent(e,t){return this._getAssociatedLayerForQuery().then((r=>r.queryExtent(e||this.createQuery(),t)))}queryFeatureCount(e,t){return this._getAssociatedLayerForQuery().then((r=>r.queryFeatureCount(e||this.createQuery(),t)))}queryFeatures(e,t){return this._getAssociatedLayerForQuery().then((r=>r.queryFeatures(e||this.createQuery(),t))).then((e=>{if(e?.features)for(const t of e.features)t.layer=this,t.sourceLayer=this;return e}))}async queryRelatedFeatures(e,t){if(await this.load(),!this.associatedLayer)throw new a("scenelayer:query-not-available","SceneLayer queries are not available without an associated feature layer",{layer:this});return this.associatedLayer.queryRelatedFeatures(e,t)}async queryRelatedFeaturesCount(e,t){if(await this.load(),!this.associatedLayer)throw new a("scenelayer:query-not-available","SceneLayer queries are not available without an associated feature layer",{layer:this});return this.associatedLayer.queryRelatedFeaturesCount(e,t)}async queryCachedAttributes(e,t){const r=B(this.fieldsIndex,await ve(this,be(this)));return ge(this.parsedUrl?.path??"",this.attributeStorageInfo??[],e,t,r,this.apiKey,this.customParameters)}async queryCachedFeature(e,r){const i=await this.queryCachedAttributes(e,[r]);if(!i||0===i.length)throw new a("scenelayer:feature-not-in-cached-data","Feature not found in cached data");const s=new t;return s.attributes=i[0],s.layer=this,s.sourceLayer=this,s}queryObjectIds(e,t){return this._getAssociatedLayerForQuery().then((r=>r.queryObjectIds(e||this.createQuery(),t)))}queryAttachments(e,t){return this._getAssociatedLayerForQuery().then((r=>r.queryAttachments(e,t)))}getFieldUsageInfo(e){const t={supportsLabelingInfo:!1,supportsRenderer:!1,supportsPopupTemplate:!1,supportsLayerQuery:!1};return this.loaded?this._fieldUsageInfo[e]||t:(n.getLogger(this).error("#getFieldUsageInfo()","Unavailable until layer is loaded"),t)}createPopupTemplate(e){return me(this,e)}_getAssociatedLayerForQuery(){const e=this.associatedLayer;return e?.loaded?Promise.resolve(e):this._loadAssociatedLayerForQuery()}async _loadAssociatedLayerForQuery(){if(await this.load(),!this.associatedLayer)throw new a("scenelayer:query-not-available","SceneLayer queries are not available without an associated feature layer",{layer:this});try{await this.associatedLayer.load()}catch(e){throw new a("scenelayer:query-not-available","SceneLayer associated feature layer could not be loaded",{layer:this,error:e})}return this.associatedLayer}hasCachedStatistics(e){return null!=this.statisticsInfo&&this.statisticsInfo.some((t=>t.name===e))}async queryCachedStatistics(e,t){return await this.load(t),await this.fetchStatistics(e,t)}async saveAs(e,t){return this._debouncedSaveOperations(E.SAVE_AS,{...t,getTypeKeywords:()=>this._getTypeKeywords(),portalItemLayerType:"scene"},e)}async save(){const e={getTypeKeywords:()=>this._getTypeKeywords(),portalItemLayerType:"scene"};return this._debouncedSaveOperations(E.SAVE,e)}async applyEdits(e,t){const{applyEdits:r}=await import("./graphics/editingSupport.js");let i=t;await this.load();const s=this.associatedLayer;if(!s)throw new a(`${this.type}-layer:not-editable`,"Service is not editable");await s.load();const{globalIdField:o}=s,n=!!s.infoFor3D,l=i?.globalIdUsed??!0;if(n&&null==o)throw new a(`${this.type}-layer:not-editable`,"Valid globalIdField expected on editable SceneLayer");if(n&&!l)throw new a(`${this.type}-layer:globalid-required`,"globalIdUsed must not be false for SceneLayer editing as globalIds are required.");return R(s.url)&&n&&null!=e.deleteFeatures&&null!=o&&(i={...i,globalIdToObjectId:await M(s,e.deleteFeatures,o)}),r(this,s.source,e,i)}async uploadAssets(e,t){if(await this.load(),null==this.associatedLayer)throw new a(`${this.type}-layer:not-editable`,"Service is not editable");return await this.associatedLayer.load(),this.associatedLayer.uploadAssets(e,t)}on(e,t){return super.on(e,t)}async convertMesh(e,t){t??={};const r=e=>{throw n.getLogger(this).error(".convertMesh()",e.message),e};await this.load(),this.infoFor3D||r(new a("invalid:layer","SceneLayer has no capability for mesh conversion"));const i=await this.extractAndFilterFiles(e),s=i.reduce(((e,t)=>ee(this.infoFor3D,t)?e+1:e),0);0===s&&r(new I),s>1&&r(new L);const o=this.spatialReference,l=t.location??new b({x:0,y:0,z:0,spatialReference:o}),p=l.spatialReference.isGeographic?"local":"georeferenced",d=v.createWithExternalSource(l,i,{vertexSpace:p}),[u]=await this.uploadAssets([d],{...t,useAssetOrigin:!t.location});return u}async extractAndFilterFiles(e){await this.load();const t=this.infoFor3D;if(!t)return e;return(await fe(e)).filter((e=>te(t,e)))}validateLayer(e){if(e.layerType&&!Ie.has(e.layerType))throw new a("scenelayer:layer-type-not-supported","SceneLayer does not support this layer type",{layerType:e.layerType});if(isNaN(this.version.major)||isNaN(this.version.minor))throw new a("layer:service-version-not-supported","Service version is not supported.",{serviceVersion:this.version.versionString,supportedVersions:"1.x, 2.x"});if(this.version.major>2)throw new a("layer:service-version-too-new","Service version is too new.",{serviceVersion:this.version.versionString,supportedVersions:"1.x, 2.x"});function t(e,t){let r=!1,i=!1;if(null==e)r=!0,i=!0;else{const s=t&&t.isGeographic;switch(e){case"east-north-up":case"earth-centered":r=!0,i=s;break;case"vertex-reference-frame":r=!0,i=!s;break;default:r=!1}}if(!r)throw new a("scenelayer:unsupported-normal-reference-frame","Normal reference frame is invalid.");if(!i)throw new a("scenelayer:incompatible-normal-reference-frame","Normal reference frame is incompatible with layer spatial reference.")}t(this.normalReferenceFrame,this.spatialReference)}_getTypeKeywords(){const e=[];if("points"===this.profile)e.push("Point");else{if("mesh-pyramids"!==this.profile)throw new a("scenelayer:unknown-profile","SceneLayer:save() encountered an unknown SceneLayer profile: "+this.profile);e.push("3DObject")}return e}_populateFieldUsageInfo(){if(this._fieldUsageInfo={},this.fields)for(const e of this.fields){const t=!!this.attributeStorageInfo?.some((t=>t.name===e.name)),r=!!this.associatedLayer?.fields?.some((t=>t&&e.name===t.name)),i={supportsLabelingInfo:t,supportsRenderer:t,supportsPopupTemplate:t||r,supportsLayerQuery:r};this._fieldUsageInfo[e.name]=i}}_applyAssociatedLayerOverrides(){this._applyAssociatedLayerFieldsOverrides(),this._applyAssociatedLayerPopupOverrides(),this._applyAssociatedLayerExtentOverride(),this._applyAssociatedLayerPrivileges()}_applyAssociatedLayerFieldsOverrides(){if(!this.associatedLayer?.fields)return;let e=null;for(const t of this.associatedLayer.fields){const r=this.getField(t.name);r?(!r.domain&&t.domain&&(r.domain=t.domain.clone()),r.editable=t.editable,r.nullable=t.nullable,r.length=t.length):(e||(e=this.fields?this.fields.slice():[]),e.push(t.clone()))}e&&this._set("fields",e)}_applyAssociatedLayerPopupOverrides(){if(!this.associatedLayer)return;const e=["popupTemplate","popupEnabled"],t=h(this);for(let r=0;r<e.length;r++){const i=e[r],s=this.originIdOf(i),o=this.associatedLayer.originIdOf(i);s<o&&(o===g.SERVICE||o===g.PORTAL_ITEM)&&t.setAtOrigin(i,this.associatedLayer[i],o)}}_applyAssociatedLayerExtentOverride(){const e=this.associatedLayer?.getAtOrigin("fullExtent","service");if(null==this.associatedLayer?.infoFor3D||!e||!R(this.associatedLayer?.url)||!le(this))return;h(this).setAtOrigin("fullExtent",e.clone(),g.SERVICE)}_applyAssociatedLayerPrivileges(){const e=this.associatedLayer;e&&(this._set("userHasEditingPrivileges",e.userHasEditingPrivileges),this._set("userHasFullEditingPrivileges",e.userHasFullEditingPrivileges),this._set("userHasUpdateItemPrivileges",e.userHasUpdateItemPrivileges))}async _setAssociatedFeatureLayer(e){if(["mesh-pyramids","points"].includes(this.profile))try{const{serverUrl:t,layerId:r,portalItem:i}=await U(`${this.url}/layers/${this.layerId}`,{sceneLayerItem:this.portalItem,customParameters:this.customParameters,apiKey:this.apiKey,signal:e}),s=await oe.FeatureLayer();this.associatedLayer=new s({url:t,customParameters:this.customParameters,layerId:r,portalItem:i}),await this.associatedLayer.load()}catch(t){u(t)||this._logWarningOnPopupEnabled()}}async _logWarningOnPopupEnabled(){await y((()=>this.popupEnabled&&null!=this.popupTemplate));const e=`this SceneLayer: ${this.title}`;null==this.attributeStorageInfo?n.getLogger(this).warn(`Associated FeatureLayer could not be loaded and no binary attributes found. Popups will not work on ${e}`):n.getLogger(this).info(`Associated FeatureLayer could not be loaded. Falling back to binary attributes for Popups on ${e}`)}_validateElevationInfo(){const e=this.elevationInfo;"mesh-pyramids"===this.profile&&ye(n.getLogger(this),ce("Mesh scene layers","relative-to-scene",e)),ye(n.getLogger(this),he("Scene layers",e))}async fetchStatistics(e,t){return await pe({fieldName:e,statisticsInfo:this.statisticsInfo,errorContext:"scenelayer",fieldsIndex:this.fieldsIndex,path:this.parsedUrl?.path??"",customParameters:this.customParameters,apiKey:this.apiKey,signal:t?.signal})}};e([c({types:{key:"type",base:K,typeMap:{selection:$}},json:{origins:{"web-scene":{name:"layerDefinition.featureReduction",write:!0},"portal-item":{name:"layerDefinition.featureReduction",write:!0}}}})],je.prototype,"featureReduction",void 0),e([c({type:[ae],json:{read:!1,origins:{"web-scene":{name:"layerDefinition.rangeInfos",write:!0},"portal-item":{name:"layerDefinition.rangeInfos",write:!0}}}})],je.prototype,"rangeInfos",void 0),e([c({json:{read:!1}})],je.prototype,"associatedLayer",void 0),e([c({type:["show","hide"]})],je.prototype,"listMode",void 0),e([c({type:["ArcGISSceneServiceLayer"]})],je.prototype,"operationalLayerType",void 0),e([c({json:{read:!1},readOnly:!0})],je.prototype,"type",void 0),e([c({...Le.fields,readOnly:!0,json:{read:!1,origins:{service:{read:!0}}}})],je.prototype,"fields",void 0),e([c()],je.prototype,"types",null),e([c()],je.prototype,"typeIdField",null),e([c()],je.prototype,"templates",null),e([c()],je.prototype,"formTemplate",null),e([c()],je.prototype,"attributeTableTemplate",null),e([c({readOnly:!0,clonable:!1})],je.prototype,"fieldsIndex",null),e([c({type:se,json:{read:{source:"layerDefinition.floorInfo"},write:{target:"layerDefinition.floorInfo"}}})],je.prototype,"floorInfo",void 0),e([c(Le.outFields)],je.prototype,"outFields",void 0),e([c({type:Z,readOnly:!0,json:{read:!1}})],je.prototype,"nodePages",void 0),e([m("service","nodePages",["nodePages","pointNodePages"])],je.prototype,"readNodePages",null),e([c({type:[J],readOnly:!0})],je.prototype,"materialDefinitions",void 0),e([c({type:[X],readOnly:!0})],je.prototype,"textureSetDefinitions",void 0),e([c({type:[Y],readOnly:!0})],je.prototype,"geometryDefinitions",void 0),e([c({readOnly:!0})],je.prototype,"serviceUpdateTimeStamp",void 0),e([c({readOnly:!0})],je.prototype,"attributeStorageInfo",void 0),e([c({readOnly:!0})],je.prototype,"statisticsInfo",void 0),e([c({type:o.ofType(Number),nonNullable:!0,json:{origins:{service:{read:!1,write:!1}},name:"layerDefinition.excludeObjectIds",write:{enabled:!0}}})],je.prototype,"excludeObjectIds",void 0),e([c({type:String,json:{origins:{service:{read:!1,write:!1}},name:"layerDefinition.definitionExpression",write:{enabled:!0,allowNull:!0}}})],je.prototype,"definitionExpression",void 0),e([c({type:ne,json:{name:"layerDefinition.polygonFilter",write:{enabled:!0,allowNull:!0},origins:{service:{read:!1,write:!1}}}})],je.prototype,"filter",void 0),e([c({type:String,json:{origins:{"web-scene":{read:!0,write:!0}},read:!1}})],je.prototype,"path",void 0),e([c(C)],je.prototype,"elevationInfo",null),e([c({readOnly:!0,json:{read:!1}})],je.prototype,"effectiveCapabilities",null),e([c({readOnly:!0})],je.prototype,"effectiveEditingEnabled",null),e([c({type:String})],je.prototype,"geometryType",null),e([c(G)],je.prototype,"labelsVisible",void 0),e([c({type:[re],json:{origins:{service:{name:"drawingInfo.labelingInfo",read:{reader:ie},write:!1}},name:"layerDefinition.drawingInfo.labelingInfo",read:{reader:ie},write:!0}})],je.prototype,"labelingInfo",void 0),e([c(N)],je.prototype,"legendEnabled",void 0),e([c({type:Number,json:{origins:{"web-document":{default:1,write:{enabled:!0,target:{opacity:{type:Number},"layerDefinition.drawingInfo.transparency":{type:Number}}},read:{source:["opacity","layerDefinition.drawingInfo.transparency"],reader(e,t){if("number"==typeof e&&e>=0&&e<=1)return e;const r=t.layerDefinition?.drawingInfo?.transparency;return void 0!==r?we(r):void 0}}},"portal-item":{write:!0},service:{read:!1}}}})],je.prototype,"opacity",void 0),e([c({type:["Low","High"],readOnly:!0,json:{read:!1,origins:{service:{read:!0}}}})],je.prototype,"priority",void 0),e([c({type:["Labels"],readOnly:!0,json:{read:!1,origins:{service:{read:!0}}}})],je.prototype,"semantic",void 0),e([c({types:i,json:{origins:{service:{read:{source:"drawingInfo.renderer"}}},name:"layerDefinition.drawingInfo.renderer",write:!0},value:null})],je.prototype,"renderer",null),e([c({json:{read:!1}})],je.prototype,"cachedDrawingInfo",void 0),e([m("service","cachedDrawingInfo")],je.prototype,"readCachedDrawingInfo",null),e([c({readOnly:!0,json:{read:!1}})],je.prototype,"capabilities",null),e([c({type:Boolean,json:{read:!1}})],je.prototype,"editingEnabled",null),e([c({readOnly:!0,json:{write:!1,read:!1}})],je.prototype,"infoFor3D",null),e([c({readOnly:!0,json:{write:!1,read:!1}})],je.prototype,"relationships",null),e([c(Q)],je.prototype,"popupEnabled",void 0),e([c({type:r,json:{name:"popupInfo",write:!0}})],je.prototype,"popupTemplate",void 0),e([c({readOnly:!0,json:{read:!1}})],je.prototype,"defaultPopupTemplate",null),e([c({type:String,json:{read:!1}})],je.prototype,"objectIdField",void 0),e([m("service","objectIdField",["objectIdField","fields"])],je.prototype,"readObjectIdField",null),e([c({type:String,json:{read:!1}})],je.prototype,"globalIdField",void 0),e([m("service","globalIdField",["globalIdField","fields"])],je.prototype,"readGlobalIdField",null),e([c({readOnly:!0,type:String,json:{read:!1}})],je.prototype,"displayField",null),e([c({type:String,json:{read:!1}})],je.prototype,"profile",void 0),e([m("service","profile",["store.profile"])],je.prototype,"readProfile",null),e([c({readOnly:!0,type:String,json:{origins:{service:{read:{source:"store.normalReferenceFrame"}}},read:!1}})],je.prototype,"normalReferenceFrame",void 0),e([c(V)],je.prototype,"screenSizePerspectiveEnabled",void 0),e([c({json:{read:!1,origins:{service:{read:!0}}}})],je.prototype,"serviceItemId",void 0),e([c(x)],je.prototype,"useViewTime",null),je=e([f("esri.layers.SceneLayer")],je);const Fe={"mesh-pyramids":"mesh-pyramids",meshpyramids:"mesh-pyramids","features-meshes":"mesh-pyramids",points:"points","features-points":"points",lines:"lines","features-lines":"lines",polygons:"polygons","features-polygons":"polygons"},Se={"mesh-pyramids":"mesh",points:"point"},_e=je;export{_e as default};