@arcgis/core 5.0.0-next.41 → 5.0.0-next.43

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 (122) hide show
  1. package/arcade/featureset/sources/FeatureLayerOGC.js +1 -1
  2. package/assets/esri/core/workers/RemoteClient.js +1 -1
  3. package/assets/esri/core/workers/chunks/00ff4ca88c9d291d82c3.js +1 -0
  4. package/assets/esri/core/workers/chunks/04a0685ee53ef74883aa.js +1 -0
  5. package/assets/esri/core/workers/chunks/{c320a29df40e85fb4a8e.js → 15a0750c10b510564a42.js} +1 -1
  6. package/assets/esri/core/workers/chunks/{816227de5bd42b437df4.js → 233f9eb617f3d72995b5.js} +1 -1
  7. package/assets/esri/core/workers/chunks/{fb9643b74cf35221ff98.js → 249504f7d356be80d214.js} +1 -1
  8. package/assets/esri/core/workers/chunks/{9d95f38da21f97214f83.js → 324d66962aeec17d3e28.js} +10 -10
  9. package/assets/esri/core/workers/chunks/385cfd3087f00dbd1146.js +1 -0
  10. package/assets/esri/core/workers/chunks/{4f4d51181ae7db9fbe6d.js → 4404b6f931f681cca342.js} +1 -1
  11. package/assets/esri/core/workers/chunks/555a0ea44ba77819d493.js +1 -0
  12. package/assets/esri/core/workers/chunks/6e8925412fb90f88d688.js +1 -0
  13. package/assets/esri/core/workers/chunks/83da9ee6544ee9d3c124.js +1 -0
  14. package/assets/esri/core/workers/chunks/{da517b4b07d4d27ce94c.js → 8e26831f71634288f834.js} +1 -1
  15. package/assets/esri/core/workers/chunks/{c367c7e553be3682f2db.js → 93c5f097bb7b380bb175.js} +1 -1
  16. package/assets/esri/core/workers/chunks/9c7682b300b877f60095.js +1 -0
  17. package/assets/esri/core/workers/chunks/{f3b3b193959db809c8c6.js → ab520fd1ae917daf07d8.js} +1 -1
  18. package/assets/esri/core/workers/chunks/{2c9865e34f32fb5683e5.js → af8d6e6949930d0e6c7b.js} +1 -1
  19. package/assets/esri/core/workers/chunks/c9942ca57f542582ab4d.js +1 -0
  20. package/assets/esri/core/workers/chunks/d5fd6d0eaf96edfab123.js +1 -0
  21. package/assets/esri/core/workers/chunks/da2ba40bc017bff0fe49.js +1 -0
  22. package/assets/esri/core/workers/chunks/e5a6a646f27715152714.js +1 -0
  23. package/assets/esri/core/workers/chunks/e8a9971c8354569cb81d.js +1 -0
  24. package/assets/esri/core/workers/chunks/ed550bf27f2bbf8d30fa.js +1 -0
  25. package/assets/esri/core/workers/chunks/ee186ddbb1eb5144a790.js +1 -0
  26. package/assets/esri/core/workers/chunks/{1357cc637524cd254974.js → ffcdc7ae03b0570e0db8.js} +1 -1
  27. package/assets/esri/themes/base/widgets/_Attribution.scss +1 -1
  28. package/assets/esri/themes/dark/main.css +1 -1
  29. package/assets/esri/themes/light/main.css +1 -1
  30. package/assets/esri/themes/light/view.css +1 -1
  31. package/config.js +1 -1
  32. package/core/PooledArray.js +1 -1
  33. package/geometry/FlatGeometry.js +1 -1
  34. package/geometry/support/MeshMaterialMetallicRoughness.js +1 -1
  35. package/geometry/support/meshUtils/exporters/gltf/gltf.js +1 -1
  36. package/geometry/support/meshUtils/loadGLTFMesh.js +1 -1
  37. package/interfaces.d.ts +31 -35
  38. package/kernel.js +1 -1
  39. package/layers/graphics/controllers/I3SOnDemandController.js +1 -1
  40. package/layers/graphics/sources/support/clientSideDefaults.js +1 -1
  41. package/package.json +1 -1
  42. package/support/revision.js +1 -1
  43. package/symbols/LabelSymbol3D.js +1 -1
  44. package/symbols/MeshSymbol3D.js +1 -1
  45. package/views/2d/ViewStateManager.js +1 -1
  46. package/views/2d/engine/webgl/cpuMapped/MappedMesh.js +1 -1
  47. package/views/2d/engine/webgl/shaderGraph/typed/TypedShaderProgram.js +1 -1
  48. package/views/2d/engine/webgl/textureUtils.js +1 -1
  49. package/views/2d/layers/CatalogDynamicGroupLayerView2D.js +1 -1
  50. package/views/2d/layers/CatalogFootprintLayerView2D.js +1 -1
  51. package/views/2d/layers/CatalogLayerView2D.js +1 -1
  52. package/views/2d/layers/ImageryTileLayerView2D.js +1 -1
  53. package/views/2d/layers/MediaLayerView2D.js +1 -1
  54. package/views/2d/layers/TileLayerView2D.js +1 -1
  55. package/views/3d/glTF/LoaderResult.js +1 -1
  56. package/views/3d/glTF/internal/Resource.js +1 -1
  57. package/views/3d/glTF/loader.js +1 -1
  58. package/views/3d/layers/CatalogDynamicGroupLayerView3D.js +1 -1
  59. package/views/3d/layers/CatalogFootprintLayerView3D.js +1 -1
  60. package/views/3d/layers/CatalogLayerView3D.js +1 -1
  61. package/views/3d/layers/ImageryTileLayerView3D.js +1 -1
  62. package/views/3d/layers/SceneLayerGraphicsView3D.js +1 -1
  63. package/views/3d/layers/graphics/Graphics3DExtrudeSymbolLayer.js +1 -1
  64. package/views/3d/layers/graphics/Graphics3DMeshFillSymbolLayer.js +1 -1
  65. package/views/3d/layers/graphics/Graphics3DObjectSymbolLayer.js +1 -1
  66. package/views/3d/layers/graphics/Graphics3DPathSymbolLayer.js +1 -1
  67. package/views/3d/layers/graphics/objectResourceUtils.js +1 -1
  68. package/views/3d/layers/i3s/I3SGraphicsMap.js +1 -1
  69. package/views/3d/layers/i3s/I3SIndex.js +1 -1
  70. package/views/3d/support/buffer/glUtil.js +1 -1
  71. package/views/3d/support/gaussianSplatting/GaussianSplatFadeTexture.js +1 -1
  72. package/views/3d/support/gaussianSplatting/GaussianSplatOrderTexture.js +1 -1
  73. package/views/3d/support/gaussianSplatting/GaussianSplatTextureAtlas.js +1 -1
  74. package/views/3d/webgl-engine/collections/Component/Material/ComponentData.glsl.js +1 -1
  75. package/views/3d/webgl-engine/core/shaderLibrary/TextureBackedBuffer.glsl.js +10 -10
  76. package/views/3d/webgl-engine/lib/edgeRendering/bufferLayouts.js +1 -1
  77. package/views/3d/webgl-engine/lib/edgeRendering/edgeProcessing.js +1 -1
  78. package/views/3d/webgl-engine/materials/DefaultLayouts.js +1 -1
  79. package/views/3d/webgl-engine/materials/DefaultMaterial.js +1 -1
  80. package/views/3d/webgl-engine/materials/PathTechnique.js +1 -1
  81. package/views/3d/webgl-engine/shaders/DefaultMaterialTechnique.js +1 -1
  82. package/views/3d/webgl-engine/shaders/sources/edgeRenderer/EdgeUtil.glsl.js +9 -9
  83. package/views/SceneView.js +1 -1
  84. package/views/VideoView.js +1 -1
  85. package/views/View2D.js +1 -1
  86. package/views/layers/BuildingComponentSublayerView.js +1 -1
  87. package/views/layers/CatalogDynamicGroupLayerView.js +1 -1
  88. package/views/layers/CatalogFootprintLayerView.js +1 -1
  89. package/views/layers/CatalogLayerView.js +1 -1
  90. package/views/layers/FeatureLayerView.js +1 -1
  91. package/views/layers/HighlightLayerViewMixin.d.ts +2 -2
  92. package/views/layers/HighlightLayerViewMixin.js +5 -0
  93. package/views/layers/ImageryTileLayerView.js +1 -1
  94. package/views/layers/ImageryTileLayerViewMixin.js +5 -0
  95. package/views/layers/OGCFeatureLayerView.js +1 -1
  96. package/views/layers/SceneLayerView.js +1 -1
  97. package/views/layers/StreamLayerView.js +1 -1
  98. package/views/webgl/ShaderBuilder.js +1 -1
  99. package/views/webgl/Util.js +1 -1
  100. package/views/webgl/VertexElementDescriptor.js +1 -1
  101. package/webscene/support/SlideEnvironment.js +1 -1
  102. package/widgets/AreaMeasurement2D.js +1 -1
  103. package/widgets/AreaMeasurement3D.js +1 -1
  104. package/widgets/Attachments.js +1 -1
  105. package/widgets/BasemapGallery/BasemapGalleryViewModel.js +1 -1
  106. package/widgets/BasemapGallery.js +1 -1
  107. package/widgets/Editor.js +1 -1
  108. package/widgets/VersionManagement/VersionManagementViewModel.js +1 -1
  109. package/assets/esri/core/workers/chunks/0a5427127634738aa239.js +0 -1
  110. package/assets/esri/core/workers/chunks/110429583b28c28c36ee.js +0 -1
  111. package/assets/esri/core/workers/chunks/145c6a7cdcc9893efb27.js +0 -1
  112. package/assets/esri/core/workers/chunks/1bacdd17e199e22b5cd1.js +0 -1
  113. package/assets/esri/core/workers/chunks/1d566539ff6fb6ac798c.js +0 -1
  114. package/assets/esri/core/workers/chunks/5dc0d853c21ccb6054c7.js +0 -1
  115. package/assets/esri/core/workers/chunks/613cbac9cb925cd20b48.js +0 -1
  116. package/assets/esri/core/workers/chunks/800c91302eaad7f00877.js +0 -1
  117. package/assets/esri/core/workers/chunks/926c2a0e21b7aa1a86e4.js +0 -1
  118. package/assets/esri/core/workers/chunks/c4de24582c29fda5a033.js +0 -1
  119. package/assets/esri/core/workers/chunks/d786b17cc9062b1450ac.js +0 -1
  120. package/assets/esri/core/workers/chunks/d9958654c6438f28237b.js +0 -1
  121. package/assets/esri/core/workers/chunks/e6fa6f9c278589c8a713.js +0 -1
  122. package/assets/esri/core/workers/chunks/e7f4d135ef9665de1468.js +0 -1
package/config.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/5.0/esri/copyright.txt for details.
4
4
  */
5
- import"./core/has.js";import{deepMerge as e}from"./core/object.js";const s={apiKey:void 0,apiKeys:{scopes:[]},applicationName:"",applicationUrl:globalThis.location?.href,assetsPath:"",fontsUrl:"https://static.arcgis.com/fonts",geometryServiceUrl:"https://utility.arcgisonline.com/arcgis/rest/services/Geometry/GeometryServer",geoRSSServiceUrl:"https://utility.arcgis.com/sharing/rss",kmlServiceUrl:"https://utility.arcgis.com/sharing/kml",userPrivilegesApplied:!0,portalUrl:"https://www.arcgis.com",respectPrefersReducedMotion:!0,routeServiceUrl:"https://route-api.arcgis.com/arcgis/rest/services/World/Route/NAServer/Route_World",workers:{loaderConfig:{has:{},paths:{},map:{},packages:[]}},request:{crossOriginNoCorsDomains:null,httpsDomains:["arcgis.com","arcgisonline.com","esrikr.com","premiumservices.blackbridge.com","esripremium.accuweather.com","gbm.digitalglobe.com","firstlook.digitalglobe.com","msi.digitalglobe.com"],interceptors:[],internalInterceptors:[],maxUrlLength:2e3,priority:"high",proxyRules:[],proxyUrl:null,timeout:62e3,trustedServers:[],useIdentity:!0},log:{interceptors:[],level:null}};if(globalThis.esriConfig&&(e(s,globalThis.esriConfig,!0),delete s.has),!s.assetsPath){{const e="5.0.0-next.41";s.assetsPath=`https://cdn.jsdelivr.net/npm/@arcgis/core@${e}/assets`}s.defaultAssetsPath=s.assetsPath}export{s as default};
5
+ import"./core/has.js";import{deepMerge as e}from"./core/object.js";const s={apiKey:void 0,apiKeys:{scopes:[]},applicationName:"",applicationUrl:globalThis.location?.href,assetsPath:"",fontsUrl:"https://static.arcgis.com/fonts",geometryServiceUrl:"https://utility.arcgisonline.com/arcgis/rest/services/Geometry/GeometryServer",geoRSSServiceUrl:"https://utility.arcgis.com/sharing/rss",kmlServiceUrl:"https://utility.arcgis.com/sharing/kml",userPrivilegesApplied:!0,portalUrl:"https://www.arcgis.com",respectPrefersReducedMotion:!0,routeServiceUrl:"https://route-api.arcgis.com/arcgis/rest/services/World/Route/NAServer/Route_World",workers:{loaderConfig:{has:{},paths:{},map:{},packages:[]}},request:{crossOriginNoCorsDomains:null,httpsDomains:["arcgis.com","arcgisonline.com","esrikr.com","premiumservices.blackbridge.com","esripremium.accuweather.com","gbm.digitalglobe.com","firstlook.digitalglobe.com","msi.digitalglobe.com"],interceptors:[],internalInterceptors:[],maxUrlLength:2e3,priority:"high",proxyRules:[],proxyUrl:null,timeout:62e3,trustedServers:[],useIdentity:!0},log:{interceptors:[],level:null}};if(globalThis.esriConfig&&(e(s,globalThis.esriConfig,!0),delete s.has),!s.assetsPath){{const e="5.0.0-next.43";s.assetsPath=`https://cdn.jsdelivr.net/npm/@arcgis/core@${e}/assets`}s.defaultAssetsPath=s.assetsPath}export{s 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/5.0/esri/copyright.txt for details.
4
4
  */
5
- import{PositionHint as t,indexOf as h,removeUnorderedMany as i}from"./arrayUtils.js";import{toConst as s}from"./compilerUtils.js";import{sort as a,iterableSort as e}from"./heapSort.js";const l=1.5,n=1.1;class r{constructor(h){this.data=[],this._length=0,this._allocator=void 0,this._deallocator=()=>null,this._shrink=()=>{},this._hint=new t,h&&(h.initialSize&&(this.data=new Array(h.initialSize)),h.allocator&&(this._allocator=h.allocator),void 0!==h.deallocator&&(this._deallocator=h.deallocator),h.shrink&&(this._shrink=()=>o(this)))}toArray(){return this.data.slice(0,this.length)}filter(t){const h=new Array;for(let i=0;i<this._length;i++){const s=this.data[i];t(s)&&h.push(s)}return h}at(t){if((t=Math.trunc(t)||0)<0&&(t+=this._length),!(t<0||t>=this._length))return this.data[t]}includes(t,h){const i=this.data.indexOf(t,h);return-1!==i&&i<this.length}get length(){return this._length}set length(t){if(t>this._length){if(this._allocator){for(;this._length<t;)this.data[this._length++]=this._allocator(this.data[this._length]);return}this._length=t}else{if(this._deallocator)for(let h=t;h<this._length;++h)this.data[h]=this._deallocator(this.data[h]);this._length=t,this._shrink()}}clear(){this.length=0}prune(){this.clear(),this.data=[]}push(t){this.data[this._length++]=t}pushArray(t,h=t.length){for(let i=0;i<h;i++)this.data[this._length++]=t[i]}fill(t,h){for(let i=0;i<h;i++)this.data[this._length++]=t}pushNew(){this._allocator&&(this.data[this.length]=this._allocator(this.data[this.length]));const t=this.data[this._length];return++this._length,t}unshift(t){this.data.unshift(t),this._length++,o(this)}pop(){if(0===this.length)return;const t=this.data[this.length-1];return this.length=this.length-1,this._shrink(),t}remove(t){const i=h(this.data,s(t),this.length,this._hint);if(-1!==i)return this.data.splice(i,1),this.length=this.length-1,t}removeUnordered(t){return this.removeUnorderedIndex(h(this.data,s(t),this.length,this._hint))}removeUnorderedIndex(t){if(!(t>=this.length||t<0))return this.swapElements(t,this.length-1),this.pop()}removeUnorderedMany(t,h=t.length,s){this.length=i(this.data,t,this.length,h,this._hint,s),this._shrink()}front(){if(0!==this.length)return this.data[0]}back(){if(0!==this.length)return this.data[this.length-1]}swapElements(t,h){if(t>=this.length||h>=this.length||t===h)return;const i=this.data[t];this.data[t]=this.data[h],this.data[h]=i}sort(t){a(this.data,0,this.length,t)}iterableSort(t){return e(this.data,0,this.length,t)}some(t,h){for(let i=0;i<this.length;++i)if(t.call(h,this.data[i],i,this.data))return!0;return!1}find(t,h){const{data:i,length:s}=this;for(let a=0;a<s;++a)if(t.call(h,i[a]))return i[a]}filterInPlace(t,h){let i=0;for(let s=0;s<this._length;++s){const a=this.data[s];t.call(h,a,s,this.data)&&(this.data[s]=this.data[i],this.data[i]=a,i++)}if(this._deallocator)for(let s=i;s<this._length;s++)this.data[s]=this._deallocator(this.data[s]);return this._length=i,this._shrink(),this}forAll(t,h){const{data:i,length:s}=this;for(let a=0;a<s;++a)t.call(h,i[a],a,i)}forEach(t,h){this.data.slice(0,this.length).forEach(t,h)}map(t,h){const i=new Array(this.length);for(let s=0;s<this.length;++s)i[s]=t.call(h,this.data[s],s,this.data);return i}reduce(t,h){let i=h;for(let s=0;s<this.length;++s)i=t(i,this.data[s],s,this.data);return i}has(t){const h=this.length,i=this.data;for(let s=0;s<h;++s)if(i[s]===t)return!0;return!1}*[Symbol.iterator](){for(let t=0;t<this.length;t++)yield this.data[t]}}function o(t){t.data.length>l*t.length&&(t.data.length=Math.floor(t.length*n))}export{r as default};
5
+ import{PositionHint as t,indexOf as h,removeUnorderedMany as i}from"./arrayUtils.js";import{toConst as s}from"./compilerUtils.js";import{sort as a,iterableSort as e}from"./heapSort.js";const l=1.5,n=1.1;class r{constructor(h){this.data=[],this._length=0,this._allocator=void 0,this._deallocator=()=>null,this._shrink=()=>{},this._hint=new t,h&&(h.initialSize&&(this.data=new Array(h.initialSize)),h.allocator&&(this._allocator=h.allocator),void 0!==h.deallocator&&(this._deallocator=h.deallocator),h.shrink&&(this._shrink=()=>o(this)))}toArray(){return this.data.slice(0,this.length)}filter(t){const h=new Array;for(let i=0;i<this._length;i++){const s=this.data[i];t(s)&&h.push(s)}return h}at(t){if((t=Math.trunc(t)||0)<0&&(t+=this._length),!(t<0||t>=this._length))return this.data[t]}includes(t,h){const i=this.data.indexOf(t,h);return-1!==i&&i<this.length}get length(){return this._length}set length(t){if(t>this._length){if(this._allocator){for(;this._length<t;)this.data[this._length++]=this._allocator(this.data[this._length]);return}this._length=t}else{if(this._deallocator)for(let h=t;h<this._length;++h)this.data[h]=this._deallocator(this.data[h]);this._length=t,this._shrink()}}clear(){this.length=0}prune(){this.clear(),this.data=[]}push(t){this.data[this._length++]=t}pushArray(t,h=t.length){for(let i=0;i<h;i++)this.data[this._length++]=t[i]}pushAll(t){for(const h of t)this.data[this._length++]=h}fill(t,h){for(let i=0;i<h;i++)this.data[this._length++]=t}pushNew(){this._allocator&&(this.data[this.length]=this._allocator(this.data[this.length]));const t=this.data[this._length];return++this._length,t}unshift(t){this.data.unshift(t),this._length++,o(this)}pop(){if(0===this.length)return;const t=this.data[this.length-1];return this.length=this.length-1,this._shrink(),t}remove(t){const i=h(this.data,s(t),this.length,this._hint);if(-1!==i)return this.data.splice(i,1),this.length=this.length-1,t}removeUnordered(t){return this.removeUnorderedIndex(h(this.data,s(t),this.length,this._hint))}removeUnorderedIndex(t){if(!(t>=this.length||t<0))return this.swapElements(t,this.length-1),this.pop()}removeUnorderedMany(t,h=t.length,s){this.length=i(this.data,t,this.length,h,this._hint,s),this._shrink()}front(){if(0!==this.length)return this.data[0]}back(){if(0!==this.length)return this.data[this.length-1]}swapElements(t,h){if(t>=this.length||h>=this.length||t===h)return;const i=this.data[t];this.data[t]=this.data[h],this.data[h]=i}sort(t){a(this.data,0,this.length,t)}iterableSort(t){return e(this.data,0,this.length,t)}some(t,h){for(let i=0;i<this.length;++i)if(t.call(h,this.data[i],i,this.data))return!0;return!1}find(t,h){const{data:i,length:s}=this;for(let a=0;a<s;++a)if(t.call(h,i[a]))return i[a]}filterInPlace(t,h){let i=0;for(let s=0;s<this._length;++s){const a=this.data[s];t.call(h,a,s,this.data)&&(this.data[s]=this.data[i],this.data[i]=a,i++)}if(this._deallocator)for(let s=i;s<this._length;s++)this.data[s]=this._deallocator(this.data[s]);return this._length=i,this._shrink(),this}forAll(t,h){const{data:i,length:s}=this;for(let a=0;a<s;++a)t.call(h,i[a],a,i)}forEach(t,h){this.data.slice(0,this.length).forEach(t,h)}map(t,h){const i=new Array(this.length);for(let s=0;s<this.length;++s)i[s]=t.call(h,this.data[s],s,this.data);return i}reduce(t,h){let i=h;for(let s=0;s<this.length;++s)i=t(i,this.data[s],s,this.data);return i}has(t){const h=this.length,i=this.data;for(let s=0;s<h;++s)if(i[s]===t)return!0;return!1}*[Symbol.iterator](){for(let t=0;t<this.length;t++)yield this.data[t]}}function o(t){t.data.length>l*t.length&&(t.data.length=Math.floor(t.length*n))}export{r 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/5.0/esri/copyright.txt for details.
4
4
  */
5
- import{__addDisposableResource as t,__disposeResources as e}from"tslib";import r from"./SpatialReference.js";import{empty as s,expandWithExtent as n}from"./support/aaBoundingBox.js";import{empty as i,expandExtentInPlace as a}from"./support/aaBoundingRect.js";import{isPoint as o,isMultipoint as h,isPolyline as u,isGeometryWithM as l,isGeometryWithZ as c}from"./support/jsonUtils.js";import{equals as f}from"./support/spatialReferenceUtils.js";import{interpolateCircle as g}from"./support/curves/circleUtils.js";import{deriveCircleFromCircularArc as m}from"./support/curves/circularArcUtils.js";import{curveExtent as p}from"./support/curves/curveExtent.js";import{getEndpoint as x,isCurvedGeometry as v,isEllipticArc7 as d,isCircularArc as y,isEllipticArc4 as C,isBezierCurve as M}from"./support/curves/curveUtils.js";import{deriveCircleFromEllipticArc4 as E}from"./support/curves/ellipticArc4Utils.js";import{deriveEllipse as O,interpolateEllipse as S}from"./support/curves/ellipticArc7Utils.js";import Z from"../layers/graphics/OptimizedGeometry.js";class _{constructor({type:t,spatialReference:e,vertexCount:r,vertexXY:s,vertexZ:n,vertexM:i,partCount:a,partOffsets:o,partFlags:h,segmentFlags:u,segmentIndices:l,segmentParams:c,segmentCountArc:f,segmentCountBezier:g}){this.segmentCountArc=0,this.segmentCountBezier=0,this.type=t,this.spatialReference=e,this.vertexCount=r,this.vertexXY=s,this.vertexZ=n,this.vertexM=i,this.partCount=a,this.partOffsets=o,this.partFlags=h,this.segmentFlags=u,this.segmentIndices=l,this.segmentParams=c,this.segmentCountArc=f,this.segmentCountBezier=g}get segmentParamCount(){return z(4)*this.segmentCountArc+z(2)*this.segmentCountBezier}get segmentCountLine(){const{segmentCount:t,segmentCountArc:e,segmentCountBezier:r}=this;return t&&t-e-r}get segmentCount(){return"polyline"===this.type?this.vertexCount-this.partCount:"polygon"===this.type?this.vertexCount:0}get hasZ(){return null!=this.vertexZ}get hasM(){return null!=this.vertexM}get hasCurves(){return null!=this.segmentFlags}get isMultipart(){return"polyline"===this.type||"polygon"===this.type}toGeometryJSON(){const t=T(this),{vertexCount:e,partCount:r,hasZ:s,hasM:n}=this,i=L(this);if("point"===this.type){const[t,e]=this.vertexXY,r=this.vertexZ?.[0],s=this.vertexM?.[0];return{x:t,y:e,z:r,m:s,spatialReference:i}}let a=0;if("multipoint"===this.type){const r=[];for(;a<e;)r.push(t(a++));return{points:r,spatialReference:i,hasZ:s,hasM:n}}const o="polygon"===this.type;if(!this.hasCurves){const e=new Array;for(let s=0;s<r;++s){const r=this.partOffsets[s+1],n=new Array;for(;a<r;)n.push(t(a++));o&&n.length>0&&n.push(n[0]),e.push(n)}return o?{rings:e,hasZ:s,hasM:n,spatialReference:i}:{paths:e,hasZ:s,hasM:n,spatialReference:i}}const h=new Array;for(const{segments:u,startVertex:l}of this.parts){const t=[l];for(const{curve:e}of u)t.push(e);h.push(t)}return o?{rings:[],curveRings:h,hasZ:s,hasM:n,spatialReference:i}:{paths:[],curvePaths:h,hasZ:s,hasM:n,spatialReference:i}}toOptimizedGeometry(){const{vertexCount:t,vertexXY:e,vertexZ:r,vertexM:s,partOffsets:n,hasZ:i,hasM:a}=this,o=new Z([],[],i,a),h=Math.max(this.partCount,1),u="polygon"===this.type;let l=0;for(let c=0;c<h;++c){const h=n?.[c+1]??t,f=o.coords.length;for(let t=l;t<h;++t)o.coords.push(e[2*t],e[2*t+1]),i&&o.coords.push(r[t]),a&&o.coords.push(s[t]);if(u){const t=l;o.coords.push(e[2*t],e[2*t+1]),i&&o.coords.push(r[t]),a&&o.coords.push(s[t])}o.lengths.push((o.coords.length-f)/o.stride),l=h}return"point"===this.type&&(o.lengths.length=0),o}clone(){const{type:t,vertexCount:e,partCount:r,hasZ:s,hasM:n,hasCurves:i,segmentCountArc:a,segmentCountBezier:o}=this,h=j(t,e,r,s,n,i,a,o);h.spatialReference=this.spatialReference;const{vertexXY:u,vertexZ:l,vertexM:c}=this;h.vertexXY.set(u.subarray(0,2*e),0),h.vertexZ?.set(l.subarray(0,e),0),h.vertexM?.set(c.subarray(0,e),0);const{partOffsets:f,partFlags:g}=this;h.partFlags?.set(g.subarray(0,r+1)),h.partOffsets?.set(f.subarray(0,r+1));const{segmentFlags:m,segmentIndices:p,segmentParams:x,segmentParamCount:v}=this;return h.segmentFlags?.set(m.subarray(0,e),0),h.segmentIndices?.set(p.subarray(0,e),0),h.segmentParams?.set(x.subarray(0,v),0),h}equals(t){return this.equalsWithinTolerance(t,0)}equalsWithinTolerance(t,e){if(null==t)return!1;if(this===t)return!0;if(!f(this.spatialReference,t.spatialReference))return!1;if(this.vertexCount!==t.vertexCount||this.partCount!==t.partCount)return!1;if(this.hasZ!==t.hasZ||this.hasM!==t.hasM)return!1;if(this.hasCurves!==t.hasCurves||this.segmentCountArc!==t.segmentCountArc||this.segmentCountBezier!==t.segmentCountBezier)return!1;const r=0===e?(t,e)=>t!==e||isNaN(t)!==isNaN(e):(t,r)=>Math.abs(t-r)>e||isNaN(t)!==isNaN(r);for(let s=0;s<this.vertexCount;++s)if(r(this.vertexXY[2*s],t.vertexXY[2*s])||r(this.vertexXY[2*s+1],t.vertexXY[2*s+1]))return!1;if(this.hasZ)for(let s=0;s<this.vertexCount;++s)if(r(this.vertexZ[s],t.vertexZ[s]))return!1;if(this.hasM)for(let s=0;s<this.vertexCount;++s)if(r(this.vertexM[s],t.vertexM[s]))return!1;for(let s=0;s<this.partCount;++s)if(this.partFlags[s]!==t.partFlags[s]||this.partOffsets[s]!==t.partOffsets[s])return!1;if(this.hasCurves){for(let e=0;e<this.vertexCount;++e)if(this.segmentFlags[e]!==t.segmentFlags[e]||this.segmentIndices[e]!==t.segmentIndices[e])return!1;for(let e=0;e<this.segmentParamCount;++e)if(r(this.segmentParams[e],t.segmentParams[e]))return!1}return!0}get parts(){return new Y(this)}}class Y{constructor(t){this.geometry=t,this.value=new P(t)}get done(){return this.value.index>=this.geometry.partCount}next(){return++this.value.index,this}[Symbol.iterator](){return this}}class P{constructor(t){this.geometry=t,this.index=-1,this._readVertex=T(t),this._segments=new R(this)}get segments(){return this._segments.reset(),this._segments}get startVertex(){return this._readVertex(this.geometry.partOffsets[this.index])}get vertexCount(){const t=this.geometry.partOffsets;return t[this.index+1]-t[this.index]}}class R{constructor(t){this._part=t,this._partStart=0,this._partEnd=0,this._isPolygon="polygon"===t.geometry.type,this.value=new A(t.geometry)}get done(){return this.value.indexOfStartVertex>this._partEnd}next(){++this.value.indexOfStartVertex;const t=this.value.indexOfStartVertex>=this._partEnd;return this.value.indexOfEndVertex=t&&this._isPolygon?this._partStart:this.value.indexOfStartVertex+1,this}[Symbol.iterator](){return this}reset(){const{index:t}=this._part,e=this._part.geometry.partOffsets;this._partStart=e[t],this._partEnd=e[t+1]-(this._isPolygon?1:2),this.value.indexOfStartVertex=this._partStart-1}}class A{constructor(t){this.geometry=t,this.indexOfStartVertex=-1,this.indexOfEndVertex=-1,this._readVertex=T(t)}get xStart(){return this.geometry.vertexXY[2*this.indexOfStartVertex]}get yStart(){return this.geometry.vertexXY[2*this.indexOfStartVertex+1]}get zStart(){return this.geometry.vertexZ[this.indexOfStartVertex]}get mStart(){return this.geometry.vertexM[this.indexOfStartVertex]}get xEnd(){return this.geometry.vertexXY[2*this.indexOfEndVertex]}get yEnd(){return this.geometry.vertexXY[2*this.indexOfEndVertex+1]}get zEnd(){return this.geometry.vertexZ[this.indexOfEndVertex]}get mEnd(){return this.geometry.vertexM[this.indexOfEndVertex]}get start(){return this._readVertex(this.indexOfStartVertex)}get end(){return this._readVertex(this.indexOfEndVertex)}get curve(){const t=this.geometry.segmentFlags?.[this.indexOfStartVertex]??1;if(1===t)return this.end;const e=this.geometry.segmentParams;let r=this.geometry.segmentIndices[this.indexOfStartVertex];if(2===t){const t=e[r++],s=e[r++],n=e[r++],i=e[r++];return{b:[this.end,[t,s],[n,i]]}}const s=e[r++],n=e[r++],i=e[r++],a=e[r++],o=e[r++],h=e[r++];r++,r++;const u=e[r++],l=e[r++];if(!(4&s)&&1===i)return{c:[this.end,[u,l]]};const c=2&s?0:1,f=1&s?0:1;return{a:[this.end,[o,h],c,f,a,n,i]}}}function F(r){let s;const{hasCurves:n,vertexCount:a,vertexXY:o,vertexZ:h,vertexM:u}=r,l=L(r);if(n){const n={stack:[],error:void 0,hasError:!1};try{t(n,new N(r,["vertexZ","vertexM"]),!1);const e=i();for(const t of r.parts){let r=t.startVertex;for(const{curve:s}of t.segments)p(e,r,s),r=x(s)}const[a,o,h,u]=e;s={xmin:a,ymin:o,xmax:h,ymax:u,spatialReference:l}}catch(c){n.error=c,n.hasError=!0}finally{e(n)}}else{let t,e,r,n;t=e=1/0,r=n=-1/0;for(let s=0;s<a;++s){const i=o[2*s],a=o[2*s+1];t=Math.min(t,i),r=Math.max(r,i),e=Math.min(e,a),n=Math.max(n,a)}s={xmin:t,ymin:e,xmax:r,ymax:n,spatialReference:l}}if(h){let t=1/0,e=-1/0;for(const r of h)t=Math.min(t,r),e=Math.max(e,r);s.zmin=t,s.zmax=e}if(u){let t=1/0,e=-1/0;for(const r of u)t=Math.min(t,r),e=Math.max(e,r);s.mmin=t,s.mmax=e}return s}function V(r,s){const n={stack:[],error:void 0,hasError:!1};try{s??=i();t(n,new N(r,["vertexZ","vertexM","spatialReference"]),!1);return a(s,F(r)),s}catch(o){n.error=o,n.hasError=!0}finally{e(n)}}function w(r,i){const a={stack:[],error:void 0,hasError:!1};try{i??=s();t(a,new N(r,["vertexM","spatialReference"]),!1);return n(i,F(r)),i}catch(o){a.error=o,a.hasError=!0}finally{e(a)}}function X(t){let e,r,s;if(o(t)){s="point";const{x:n,y:i,z:a,m:o}=t,h=[n,i];null!=a&&h.push(a),null!=o&&h.push(o),r=[[h]],e=1}else h(t)?(s="multipoint",r=[t.points],e=t.points.length):u(t)?(s="polyline",r=t.curvePaths??t.paths,e=r.reduce((t,e)=>t+e.length,0)):(s="polygon",r=t.curveRings??t.rings,e=r.reduce((t,e)=>t+e.length-k(e),0));const n=j(s,e,s.includes("point")?0:r.length,c(t),l(t),v(t));function i(t){n.vertexXY[2*f]=t[0],n.vertexXY[2*f+1]=t[1],n.hasZ&&(n.vertexZ[f]=t[2]),n.hasM&&(n.vertexM[f]=t[a]),++f}n.spatialReference=t.spatialReference??void 0;const a=n.hasZ?3:2;let f=0;if(!n.isMultipart){if(!n.hasZ&&!n.hasM){for(const[t,e]of r[0])n.vertexXY[2*f]=t,n.vertexXY[2*f+1]=e;return n}for(const t of r[0])i(t);return n}const p="polygon"===n.type;let Z=0;if(!n.hasCurves){for(const t of r){n.partOffsets[Z++]=f;let e=t.length;if(p&&(e-=k(t)),n.hasZ||n.hasM)for(let r=0;r<e;++r)i(t[r]);else for(let r=0;r<e;++r){const[e,s]=t[r];n.vertexXY[2*f]=e,n.vertexXY[2*f+1]=s}}return n.partOffsets[Z]=f,n}function _(t){const e=f-1;n.segmentFlags[e]=t;const r=z(t);n.segmentIndices[e]=0===r?U:Y,4===t?++n.segmentCountArc:2===t&&++n.segmentCountBezier;const s=Y+r;if(s<=(n.segmentParams?.length??0))return;let i=s*W;i=20*Math.ceil(i/20);const a=n.segmentParams;if(n.segmentParams=new Float64Array(i),null!=a)for(let o=0;o<a.length;++o)n.segmentParams[o]=a[o]}let Y=0;for(const o of r){n.partOffsets[Z++]=f,i(o[0]);let t=o.length;p&&(t-=k(o));for(let e=1;e<t;++e){const t=o[e];if(d(t)){_(4);const r=n.segmentParams,[s,[a,h],u,l,c,f,g]=t.a;let m=4;l||(m|=1),u||(m|=2);const p=O(x(o[e-1]),t),[v,d]=S(p,.5);r[Y++]=m,r[Y++]=f,r[Y++]=g,r[Y++]=c,r[Y++]=a,r[Y++]=h,r[Y++]=p.u2-p.u1,r[Y++]=p.u1,r[Y++]=v,r[Y++]=d,i(s);continue}if(y(t)||C(t)){_(4);const r=n.segmentParams,s=x(t),a=y(t)?m(x(o[e-1]),t):E(x(o[e-1]),t),{cx:h,cy:u,thetaStart:l,thetaEnd:c,radius:f}=a,p=Math.abs(c-l)<Math.PI,v=l>c;let d=C(t)?4:0;v||(d|=1),p||(d|=2);const[M,O]=y(t)?t.c[1]:g(a,.5);r[Y++]=d,r[Y++]=f,r[Y++]=1,r[Y++]=0,r[Y++]=h,r[Y++]=u,r[Y++]=c-l,r[Y++]=l,r[Y++]=M,r[Y++]=O,i(s);continue}if(M(t)){_(2);const e=n.segmentParams,[r,[s,a],[o,h]]=t.b;e[Y++]=s,e[Y++]=a,e[Y++]=o,e[Y++]=h,i(r);continue}_(1),i(t)}}return n.partOffsets[Z]=f,n}function b(t,{lengths:e,coords:r,hasZ:s,hasM:n},i){const a=t.includes("point")?0:e.length,o="polygon"===t,h="point"===t?1:e.reduce((t,e)=>t+e,0)-(o?a:0);s??=!1,n??=!1;const u=j(t,h,a,s,n,!1,0,0);if(u.spatialReference=i??void 0,!u.isMultipart){for(let t=0,e=0;t<h;++t)u.vertexXY[2*t]=r[e++],u.vertexXY[2*t+1]=r[e++],s&&(u.vertexZ[t]=r[e++]),n&&(u.vertexM[t]=r[e++]);return u}const l=2+Number(s)+Number(n);let c=0,f=0;u.partOffsets[0]=0;for(const g of e){const t=u.partOffsets[f],e=t+g-Number(o);u.partOffsets[++f]=e;for(let i=t;i<e;++i)u.vertexXY[2*i]=r[c++],u.vertexXY[2*i+1]=r[c++],s&&(u.vertexZ[i]=r[c++]),n&&(u.vertexM[i]=r[c++]);o&&(c+=l)}return u}function I(t,e){return"getSpatialReference"in t&&(e=B(t.getSpatialReference()),t=t.getGeometry()),new _({...t.toFlatGeometry(),spatialReference:e})}function B(t){if(null==t)return;const e=t.getText()||void 0,r=t.isCustomWkid()?0:t.getOldID();if(r<=0)return{wkt:e};let s=t.getLatestID();(s<=0||s===r)&&(s=void 0);const n=t.getVCS();if(null==n)return{wkid:r,latestWkid:s,wkt:e};const i=n.isCustomWkid()?0:n.getOldID();if(i<=0)return{wkt:e};let a=t.getLatestVerticalID();return(a<=0||a===i)&&(a=void 0),{wkid:r,wkt:e,latestWkid:s,vcsWkid:i,latestVcsWkid:a}}class N{constructor(t,e){this.target=t,this.keys=e,this.oldValues=e.map(e=>t[e]);for(const r of e)t[r]=void 0}[Symbol.dispose](){this.keys.map((t,e)=>{this.target[t]=this.oldValues[e]})}}function L({spatialReference:t}){return t instanceof r?t.toJSON():t}function T({vertexXY:t,vertexZ:e,vertexM:r}){return e?r?s=>[t[2*s],t[2*s+1],e[s],r[s]]:r=>[t[2*r],t[2*r+1],e[r]]:r?e=>[t[2*e],t[2*e+1],r[e]]:e=>[t[2*e],t[2*e+1]]}function z(t){switch(t){case 1:return 0;case 4:return 10;case 2:return 4}}function k(t){if(t.length>0){const e=t[0],r=x(t.at(-1));return e.every((t,e)=>t===r[e])?1:0}return 0}function j(t,e,r,s,n,i,a,o){const h=null!=a&&null!=o;a??=0,o??=0;const u=new _({type:t,vertexCount:e,vertexXY:null,vertexZ:void 0,vertexM:void 0,partCount:r,partOffsets:void 0,partFlags:void 0,segmentFlags:void 0,segmentIndices:void 0,segmentParams:void 0,segmentCountArc:a,segmentCountBezier:o});let l=2*Float64Array.BYTES_PER_ELEMENT*e;s&&(l+=Float64Array.BYTES_PER_ELEMENT*e),n&&(l+=Float64Array.BYTES_PER_ELEMENT*e),u.isMultipart&&(l+=(r+1)*Int32Array.BYTES_PER_ELEMENT,l+=(r+1)*Int8Array.BYTES_PER_ELEMENT),i&&(l+=e*Int8Array.BYTES_PER_ELEMENT,l+=e*Int32Array.BYTES_PER_ELEMENT,h&&(l+=u.segmentParamCount*Float64Array.BYTES_PER_ELEMENT));const c=new ArrayBuffer(l);let f=0;if(u.vertexXY=new Float64Array(c,f,2*e),f+=u.vertexXY.byteLength,s&&(u.vertexZ=new Float64Array(c,f,e),f+=u.vertexZ.byteLength),n&&(u.vertexM=new Float64Array(c,f,e),f+=u.vertexM.byteLength),i&&(h&&(u.segmentParams=new Float64Array(c,f,u.segmentParamCount),f+=u.segmentParams.byteLength),u.segmentIndices=new Int32Array(c,f,e),u.segmentIndices.fill(U),f+=u.segmentIndices.byteLength),u.isMultipart&&(u.partOffsets=new Int32Array(c,f,r+1),f+=u.partOffsets.byteLength,u.partFlags=new Int8Array(c,f,r+1),f+=u.partFlags.byteLength),i&&(u.segmentFlags=new Int8Array(c,f,e),u.segmentFlags.fill(1),f+=u.segmentFlags.byteLength),"polygon"===u.type)for(let g=0;g<r;++g)u.partFlags[g]=1;return u}const W=1.61803,U=-1;export{_ as FlatGeometry,X as convertGeometryToFlat,I as convertGeometryxToFlat,b as convertOptimizedGeometryToFlat,w as getBoundingBox,V as getBoundingRect,F as getExtentJSON};
5
+ import{__addDisposableResource as t,__disposeResources as e}from"tslib";import r from"./SpatialReference.js";import{empty as s,expandWithExtent as n}from"./support/aaBoundingBox.js";import{empty as i,expandExtentInPlace as a}from"./support/aaBoundingRect.js";import{isPoint as o,isMultipoint as h,isPolyline as u,isGeometryWithM as l,isGeometryWithZ as c}from"./support/jsonUtils.js";import{equals as f}from"./support/spatialReferenceUtils.js";import{interpolateCircle as g}from"./support/curves/circleUtils.js";import{deriveCircleFromCircularArc as m}from"./support/curves/circularArcUtils.js";import{curveExtent as p}from"./support/curves/curveExtent.js";import{getEndpoint as x,isCurvedGeometry as v,isEllipticArc7 as d,isCircularArc as y,isEllipticArc4 as C,isBezierCurve as M}from"./support/curves/curveUtils.js";import{deriveCircleFromEllipticArc4 as E}from"./support/curves/ellipticArc4Utils.js";import{deriveEllipse as O,interpolateEllipse as S}from"./support/curves/ellipticArc7Utils.js";import Z from"../layers/graphics/OptimizedGeometry.js";class _{constructor({type:t,spatialReference:e,vertexCount:r,vertexXY:s,vertexZ:n,vertexM:i,partCount:a,partOffsets:o,partFlags:h,segmentFlags:u,segmentIndices:l,segmentParams:c,segmentCountArc:f,segmentCountBezier:g}){this.segmentCountArc=0,this.segmentCountBezier=0,this.type=t,this.spatialReference=e,this.vertexCount=r,this.vertexXY=s,this.vertexZ=n,this.vertexM=i,this.partCount=a,this.partOffsets=o,this.partFlags=h,this.segmentFlags=u,this.segmentIndices=l,this.segmentParams=c,this.segmentCountArc=f,this.segmentCountBezier=g}get segmentParamCount(){return z(4)*this.segmentCountArc+z(2)*this.segmentCountBezier}get segmentCountLine(){const{segmentCount:t,segmentCountArc:e,segmentCountBezier:r}=this;return t&&t-e-r}get segmentCount(){return"polyline"===this.type?this.vertexCount-this.partCount:"polygon"===this.type?this.vertexCount:0}get hasZ(){return null!=this.vertexZ}get hasM(){return null!=this.vertexM}get hasCurves(){return null!=this.segmentFlags}get isMultipart(){return"polyline"===this.type||"polygon"===this.type}toGeometryJSON(){const t=T(this),{vertexCount:e,partCount:r,hasZ:s,hasM:n}=this,i=L(this);if("point"===this.type){const[t,e]=this.vertexXY,r=this.vertexZ?.[0],s=this.vertexM?.[0];return{x:t,y:e,z:r,m:s,spatialReference:i}}let a=0;if("multipoint"===this.type){const r=[];for(;a<e;)r.push(t(a++));return{points:r,spatialReference:i,hasZ:s,hasM:n}}const o="polygon"===this.type;if(!this.hasCurves){const e=new Array;for(let s=0;s<r;++s){const r=this.partOffsets[s+1],n=new Array;for(;a<r;)n.push(t(a++));o&&n.length>0&&n.push(n[0]),e.push(n)}return o?{rings:e,hasZ:s,hasM:n,spatialReference:i}:{paths:e,hasZ:s,hasM:n,spatialReference:i}}const h=new Array;for(const{segments:u,startVertex:l}of this.parts){const t=[l];for(const{curve:e}of u)t.push(e);h.push(t)}return o?{rings:[],curveRings:h,hasZ:s,hasM:n,spatialReference:i}:{paths:[],curvePaths:h,hasZ:s,hasM:n,spatialReference:i}}toOptimizedGeometry(){const{vertexCount:t,vertexXY:e,vertexZ:r,vertexM:s,partOffsets:n,hasZ:i,hasM:a}=this,o=new Z([],[],i,a),h=Math.max(this.partCount,1),u="polygon"===this.type;let l=0;for(let c=0;c<h;++c){const h=n?.[c+1]??t,f=o.coords.length;for(let t=l;t<h;++t)o.coords.push(e[2*t],e[2*t+1]),i&&o.coords.push(r[t]),a&&o.coords.push(s[t]);if(u){const t=l;o.coords.push(e[2*t],e[2*t+1]),i&&o.coords.push(r[t]),a&&o.coords.push(s[t])}o.lengths.push((o.coords.length-f)/o.stride),l=h}return"point"===this.type&&(o.lengths.length=0),o}clone(){const{type:t,vertexCount:e,partCount:r,hasZ:s,hasM:n,hasCurves:i,segmentCountArc:a,segmentCountBezier:o}=this,h=j(t,e,r,s,n,i,a,o);h.spatialReference=this.spatialReference;const{vertexXY:u,vertexZ:l,vertexM:c}=this;h.vertexXY.set(u.subarray(0,2*e),0),h.vertexZ?.set(l.subarray(0,e),0),h.vertexM?.set(c.subarray(0,e),0);const{partOffsets:f,partFlags:g}=this;h.partFlags?.set(g.subarray(0,r+1)),h.partOffsets?.set(f.subarray(0,r+1));const{segmentFlags:m,segmentIndices:p,segmentParams:x,segmentParamCount:v}=this;return h.segmentFlags?.set(m.subarray(0,e),0),h.segmentIndices?.set(p.subarray(0,e),0),h.segmentParams?.set(x.subarray(0,v),0),h}equals(t){return this.equalsWithinTolerance(t,0)}equalsWithinTolerance(t,e){if(null==t)return!1;if(this===t)return!0;if(!f(this.spatialReference,t.spatialReference))return!1;if(this.vertexCount!==t.vertexCount||this.partCount!==t.partCount)return!1;if(this.hasZ!==t.hasZ||this.hasM!==t.hasM)return!1;if(this.hasCurves!==t.hasCurves||this.segmentCountArc!==t.segmentCountArc||this.segmentCountBezier!==t.segmentCountBezier)return!1;const r=0===e?(t,e)=>t!==e||isNaN(t)!==isNaN(e):(t,r)=>Math.abs(t-r)>e||isNaN(t)!==isNaN(r);for(let s=0;s<this.vertexCount;++s)if(r(this.vertexXY[2*s],t.vertexXY[2*s])||r(this.vertexXY[2*s+1],t.vertexXY[2*s+1]))return!1;if(this.hasZ)for(let s=0;s<this.vertexCount;++s)if(r(this.vertexZ[s],t.vertexZ[s]))return!1;if(this.hasM)for(let s=0;s<this.vertexCount;++s)if(r(this.vertexM[s],t.vertexM[s]))return!1;for(let s=0;s<this.partCount;++s)if(this.partFlags[s]!==t.partFlags[s]||this.partOffsets[s]!==t.partOffsets[s])return!1;if(this.hasCurves){for(let e=0;e<this.vertexCount;++e)if(this.segmentFlags[e]!==t.segmentFlags[e]||this.segmentIndices[e]!==t.segmentIndices[e])return!1;for(let e=0;e<this.segmentParamCount;++e)if(r(this.segmentParams[e],t.segmentParams[e]))return!1}return!0}get parts(){return new Y(this)}}class Y{constructor(t){this.geometry=t,this.value=new P(t)}get done(){return this.value.index>=this.geometry.partCount}next(){return++this.value.index,this}[Symbol.iterator](){return this}}class P{constructor(t){this.geometry=t,this.index=-1,this._readVertex=T(t),this._segments=new R(this)}get segments(){return this._segments.reset(),this._segments}get startVertex(){return this._readVertex(this.geometry.partOffsets[this.index])}get vertexCount(){const t=this.geometry.partOffsets;return t[this.index+1]-t[this.index]}}class R{constructor(t){this._part=t,this._partStart=0,this._partEnd=0,this._isPolygon="polygon"===t.geometry.type,this.value=new A(t.geometry)}get done(){return this.value.indexOfStartVertex>this._partEnd}next(){++this.value.indexOfStartVertex;const t=this.value.indexOfStartVertex>=this._partEnd;return this.value.indexOfEndVertex=t&&this._isPolygon?this._partStart:this.value.indexOfStartVertex+1,this}[Symbol.iterator](){return this}reset(){const{index:t}=this._part,e=this._part.geometry.partOffsets;this._partStart=e[t],this._partEnd=e[t+1]-(this._isPolygon?1:2),this.value.indexOfStartVertex=this._partStart-1}}class A{constructor(t){this.geometry=t,this.indexOfStartVertex=-1,this.indexOfEndVertex=-1,this._readVertex=T(t)}get xStart(){return this.geometry.vertexXY[2*this.indexOfStartVertex]}get yStart(){return this.geometry.vertexXY[2*this.indexOfStartVertex+1]}get zStart(){return this.geometry.vertexZ[this.indexOfStartVertex]}get mStart(){return this.geometry.vertexM[this.indexOfStartVertex]}get xEnd(){return this.geometry.vertexXY[2*this.indexOfEndVertex]}get yEnd(){return this.geometry.vertexXY[2*this.indexOfEndVertex+1]}get zEnd(){return this.geometry.vertexZ[this.indexOfEndVertex]}get mEnd(){return this.geometry.vertexM[this.indexOfEndVertex]}get start(){return this._readVertex(this.indexOfStartVertex)}get end(){return this._readVertex(this.indexOfEndVertex)}get curve(){const t=this.geometry.segmentFlags?.[this.indexOfStartVertex]??1;if(1===t)return this.end;const e=this.geometry.segmentParams;let r=this.geometry.segmentIndices[this.indexOfStartVertex];if(2===t){const t=e[r++],s=e[r++],n=e[r++],i=e[r++];return{b:[this.end,[t,s],[n,i]]}}const s=e[r++],n=e[r++],i=e[r++],a=e[r++],o=e[r++],h=e[r++];r++,r++;const u=e[r++],l=e[r++];if(!(4&s)&&1===i)return{c:[this.end,[u,l]]};const c=2&s?0:1,f=1&s?0:1;return{a:[this.end,[o,h],c,f,a,n,i]}}}function F(r){let s;const{hasCurves:n,vertexCount:a,vertexXY:o,vertexZ:h,vertexM:u}=r,l=L(r);if(n){const n={stack:[],error:void 0,hasError:!1};try{t(n,new N(r,["vertexZ","vertexM"]),!1);const e=i();for(const t of r.parts){let r=t.startVertex;for(const{curve:s}of t.segments)p(e,r,s),r=x(s)}const[a,o,h,u]=e;s={xmin:a,ymin:o,xmax:h,ymax:u,spatialReference:l}}catch(c){n.error=c,n.hasError=!0}finally{e(n)}}else{let t,e,r,n;t=e=1/0,r=n=-1/0;for(let s=0;s<a;++s){const i=o[2*s],a=o[2*s+1];t=Math.min(t,i),r=Math.max(r,i),e=Math.min(e,a),n=Math.max(n,a)}s={xmin:t,ymin:e,xmax:r,ymax:n,spatialReference:l}}if(h){let t=1/0,e=-1/0;for(const r of h)t=Math.min(t,r),e=Math.max(e,r);s.zmin=t,s.zmax=e}if(u){let t=1/0,e=-1/0;for(const r of u)t=Math.min(t,r),e=Math.max(e,r);s.mmin=t,s.mmax=e}return s}function V(r,s){const n={stack:[],error:void 0,hasError:!1};try{s??=i();t(n,new N(r,["vertexZ","vertexM","spatialReference"]),!1);return a(s,F(r)),s}catch(o){n.error=o,n.hasError=!0}finally{e(n)}}function w(r,i){const a={stack:[],error:void 0,hasError:!1};try{i??=s();t(a,new N(r,["vertexM","spatialReference"]),!1);return n(i,F(r)),i}catch(o){a.error=o,a.hasError=!0}finally{e(a)}}function X(t){let e,r,s;if(o(t)){s="point";const{x:n,y:i,z:a,m:o}=t,h=[n,i];null!=a&&h.push(a),null!=o&&h.push(o),r=[[h]],e=1}else h(t)?(s="multipoint",r=[t.points],e=t.points.length):u(t)?(s="polyline",r=t.curvePaths??t.paths,e=r.reduce((t,e)=>t+e.length,0)):(s="polygon",r=t.curveRings??t.rings,e=r.reduce((t,e)=>t+e.length-k(e),0));const n=j(s,e,s.includes("point")?0:r.length,c(t),l(t),v(t));function i(t){n.vertexXY[2*f]=t[0],n.vertexXY[2*f+1]=t[1],n.hasZ&&(n.vertexZ[f]=t[2]),n.hasM&&(n.vertexM[f]=t[a]),++f}n.spatialReference=t.spatialReference??void 0;const a=n.hasZ?3:2;let f=0;if(!n.isMultipart){if(!n.hasZ&&!n.hasM){for(const[t,e]of r[0])n.vertexXY[2*f]=t,n.vertexXY[2*f+1]=e;return n}for(const t of r[0])i(t);return n}const p="polygon"===n.type;let Z=0;if(!n.hasCurves){for(const t of r){n.partOffsets[Z++]=f;let e=t.length;if(p&&(e-=k(t)),n.hasZ||n.hasM)for(let r=0;r<e;++r)i(t[r]);else for(let r=0;r<e;++r){const[e,s]=t[r];n.vertexXY[2*f]=e,n.vertexXY[2*f+1]=s,++f}}return n.partOffsets[Z]=f,n}function _(t){const e=f-1;n.segmentFlags[e]=t;const r=z(t);n.segmentIndices[e]=0===r?U:Y,4===t?++n.segmentCountArc:2===t&&++n.segmentCountBezier;const s=Y+r;if(s<=(n.segmentParams?.length??0))return;let i=s*W;i=20*Math.ceil(i/20);const a=n.segmentParams;if(n.segmentParams=new Float64Array(i),null!=a)for(let o=0;o<a.length;++o)n.segmentParams[o]=a[o]}let Y=0;for(const o of r){n.partOffsets[Z++]=f,i(o[0]);let t=o.length;p&&(t-=k(o));for(let e=1;e<t;++e){const t=o[e];if(d(t)){_(4);const r=n.segmentParams,[s,[a,h],u,l,c,f,g]=t.a;let m=4;l||(m|=1),u||(m|=2);const p=O(x(o[e-1]),t),[v,d]=S(p,.5);r[Y++]=m,r[Y++]=f,r[Y++]=g,r[Y++]=c,r[Y++]=a,r[Y++]=h,r[Y++]=p.u2-p.u1,r[Y++]=p.u1,r[Y++]=v,r[Y++]=d,i(s);continue}if(y(t)||C(t)){_(4);const r=n.segmentParams,s=x(t),a=y(t)?m(x(o[e-1]),t):E(x(o[e-1]),t),{cx:h,cy:u,thetaStart:l,thetaEnd:c,radius:f}=a,p=Math.abs(c-l)<Math.PI,v=l>c;let d=C(t)?4:0;v||(d|=1),p||(d|=2);const[M,O]=y(t)?t.c[1]:g(a,.5);r[Y++]=d,r[Y++]=f,r[Y++]=1,r[Y++]=0,r[Y++]=h,r[Y++]=u,r[Y++]=c-l,r[Y++]=l,r[Y++]=M,r[Y++]=O,i(s);continue}if(M(t)){_(2);const e=n.segmentParams,[r,[s,a],[o,h]]=t.b;e[Y++]=s,e[Y++]=a,e[Y++]=o,e[Y++]=h,i(r);continue}_(1),i(t)}}return n.partOffsets[Z]=f,n}function b(t,{lengths:e,coords:r,hasZ:s,hasM:n},i){const a=t.includes("point")?0:e.length,o="polygon"===t,h="point"===t?1:e.reduce((t,e)=>t+e,0)-(o?a:0);s??=!1,n??=!1;const u=j(t,h,a,s,n,!1,0,0);if(u.spatialReference=i??void 0,!u.isMultipart){for(let t=0,e=0;t<h;++t)u.vertexXY[2*t]=r[e++],u.vertexXY[2*t+1]=r[e++],s&&(u.vertexZ[t]=r[e++]),n&&(u.vertexM[t]=r[e++]);return u}const l=2+Number(s)+Number(n);let c=0,f=0;u.partOffsets[0]=0;for(const g of e){const t=u.partOffsets[f],e=t+g-Number(o);u.partOffsets[++f]=e;for(let i=t;i<e;++i)u.vertexXY[2*i]=r[c++],u.vertexXY[2*i+1]=r[c++],s&&(u.vertexZ[i]=r[c++]),n&&(u.vertexM[i]=r[c++]);o&&(c+=l)}return u}function I(t,e){return"getSpatialReference"in t&&(e=B(t.getSpatialReference()),t=t.getGeometry()),new _({...t.toFlatGeometry(),spatialReference:e})}function B(t){if(null==t)return;const e=t.getText()||void 0,r=t.isCustomWkid()?0:t.getOldID();if(r<=0)return{wkt:e};let s=t.getLatestID();(s<=0||s===r)&&(s=void 0);const n=t.getVCS();if(null==n)return{wkid:r,latestWkid:s,wkt:e};const i=n.isCustomWkid()?0:n.getOldID();if(i<=0)return{wkt:e};let a=t.getLatestVerticalID();return(a<=0||a===i)&&(a=void 0),{wkid:r,wkt:e,latestWkid:s,vcsWkid:i,latestVcsWkid:a}}class N{constructor(t,e){this.target=t,this.keys=e,this.oldValues=e.map(e=>t[e]);for(const r of e)t[r]=void 0}[Symbol.dispose](){this.keys.map((t,e)=>{this.target[t]=this.oldValues[e]})}}function L({spatialReference:t}){return t instanceof r?t.toJSON():t}function T({vertexXY:t,vertexZ:e,vertexM:r}){return e?r?s=>[t[2*s],t[2*s+1],e[s],r[s]]:r=>[t[2*r],t[2*r+1],e[r]]:r?e=>[t[2*e],t[2*e+1],r[e]]:e=>[t[2*e],t[2*e+1]]}function z(t){switch(t){case 1:return 0;case 4:return 10;case 2:return 4}}function k(t){if(t.length>0){const e=t[0],r=x(t.at(-1));return e.every((t,e)=>t===r[e])?1:0}return 0}function j(t,e,r,s,n,i,a,o){const h=null!=a&&null!=o;a??=0,o??=0;const u=new _({type:t,vertexCount:e,vertexXY:null,vertexZ:void 0,vertexM:void 0,partCount:r,partOffsets:void 0,partFlags:void 0,segmentFlags:void 0,segmentIndices:void 0,segmentParams:void 0,segmentCountArc:a,segmentCountBezier:o});let l=2*Float64Array.BYTES_PER_ELEMENT*e;s&&(l+=Float64Array.BYTES_PER_ELEMENT*e),n&&(l+=Float64Array.BYTES_PER_ELEMENT*e),u.isMultipart&&(l+=(r+1)*Int32Array.BYTES_PER_ELEMENT,l+=(r+1)*Int8Array.BYTES_PER_ELEMENT),i&&(l+=e*Int8Array.BYTES_PER_ELEMENT,l+=e*Int32Array.BYTES_PER_ELEMENT,h&&(l+=u.segmentParamCount*Float64Array.BYTES_PER_ELEMENT));const c=new ArrayBuffer(l);let f=0;if(u.vertexXY=new Float64Array(c,f,2*e),f+=u.vertexXY.byteLength,s&&(u.vertexZ=new Float64Array(c,f,e),f+=u.vertexZ.byteLength),n&&(u.vertexM=new Float64Array(c,f,e),f+=u.vertexM.byteLength),i&&(h&&(u.segmentParams=new Float64Array(c,f,u.segmentParamCount),f+=u.segmentParams.byteLength),u.segmentIndices=new Int32Array(c,f,e),u.segmentIndices.fill(U),f+=u.segmentIndices.byteLength),u.isMultipart&&(u.partOffsets=new Int32Array(c,f,r+1),f+=u.partOffsets.byteLength,u.partFlags=new Int8Array(c,f,r+1),f+=u.partFlags.byteLength),i&&(u.segmentFlags=new Int8Array(c,f,e),u.segmentFlags.fill(1),f+=u.segmentFlags.byteLength),"polygon"===u.type)for(let g=0;g<r;++g)u.partFlags[g]=1;return u}const W=1.61803,U=-1;export{_ as FlatGeometry,X as convertGeometryToFlat,I as convertGeometryxToFlat,b as convertOptimizedGeometryToFlat,w as getBoundingBox,V as getBoundingRect,F as getExtentJSON};
@@ -2,4 +2,4 @@
2
2
  All material copyright Esri, All Rights Reserved, unless otherwise specified.
3
3
  See https://js.arcgis.com/5.0/esri/copyright.txt for details.
4
4
  */
5
- import{__decorate as e}from"tslib";import t from"../../Color.js";import{property as s,subclass as r}from"../../core/accessorSupport/decorators.js";import o from"./MeshMaterial.js";import i from"./MeshTexture.js";import l from"./MeshTextureTransform.js";let u=class extends o{constructor(e){super(e),this.emissiveColor=null,this.emissiveTextureTransform=void 0,this.occlusionTextureTransform=void 0,this.metallic=1,this.roughness=1,this.metallicRoughnessTextureTransform=void 0}get emissiveTexture(){return this._get("emissiveTexture")}set emissiveTexture(e){this._set("emissiveTexture",null==e?null:i.from(e))}get occlusionTexture(){return this._get("occlusionTexture")}set occlusionTexture(e){this._set("occlusionTexture",null==e?null:i.from(e))}get metallicRoughnessTexture(){return this._get("metallicRoughnessTexture")}set metallicRoughnessTexture(e){this._set("metallicRoughnessTexture",null==e?null:i.from(e))}getMemoryUsage(){let e=super.getMemoryUsage();return e+=null!=this.emissiveColor?16:0,null!=this.emissiveTexture&&(e+=this.emissiveTexture.memoryUsage),e+=null!=this.emissiveTextureTransform?20:0,null!=this.occlusionTexture&&(e+=this.occlusionTexture.memoryUsage),e+=null!=this.occlusionTextureTransform?20:0,null!=this.metallicRoughnessTexture&&(e+=this.metallicRoughnessTexture.memoryUsage),e+=null!=this.metallicRoughnessTextureTransform?20:0,e}};e([s({type:t,json:{write:!0}})],u.prototype,"emissiveColor",void 0),e([s({type:i,json:{write:!0},value:null})],u.prototype,"emissiveTexture",null),e([s({type:l,json:{write:!0}})],u.prototype,"emissiveTextureTransform",void 0),e([s({type:i,json:{write:!0},value:null})],u.prototype,"occlusionTexture",null),e([s({type:l,json:{write:!0}})],u.prototype,"occlusionTextureTransform",void 0),e([s({type:Number,nonNullable:!0,json:{write:!0},range:{min:0,max:1}})],u.prototype,"metallic",void 0),e([s({type:Number,nonNullable:!0,json:{write:!0},range:{min:0,max:1}})],u.prototype,"roughness",void 0),e([s({type:i,json:{write:!0},value:null})],u.prototype,"metallicRoughnessTexture",null),e([s({type:l,json:{write:!0}})],u.prototype,"metallicRoughnessTextureTransform",void 0),u=e([r("esri.geometry.support.MeshMaterialMetallicRoughness")],u);export{u as default};
5
+ import{__decorate as e}from"tslib";import t from"../../Color.js";import{property as s,subclass as r}from"../../core/accessorSupport/decorators.js";import o from"./MeshMaterial.js";import i from"./MeshTexture.js";import l from"./MeshTextureTransform.js";let u=class extends o{constructor(e){super(e),this.emissiveColor=null,this.emissiveStrength=null,this.emissiveTextureTransform=void 0,this.occlusionTextureTransform=void 0,this.metallic=1,this.roughness=1,this.metallicRoughnessTextureTransform=void 0}get emissiveTexture(){return this._get("emissiveTexture")}set emissiveTexture(e){this._set("emissiveTexture",null==e?null:i.from(e))}get occlusionTexture(){return this._get("occlusionTexture")}set occlusionTexture(e){this._set("occlusionTexture",null==e?null:i.from(e))}get metallicRoughnessTexture(){return this._get("metallicRoughnessTexture")}set metallicRoughnessTexture(e){this._set("metallicRoughnessTexture",null==e?null:i.from(e))}getMemoryUsage(){let e=super.getMemoryUsage();return e+=null!=this.emissiveColor?16:0,null!=this.emissiveTexture&&(e+=this.emissiveTexture.memoryUsage),e+=null!=this.emissiveTextureTransform?20:0,null!=this.occlusionTexture&&(e+=this.occlusionTexture.memoryUsage),e+=null!=this.occlusionTextureTransform?20:0,null!=this.metallicRoughnessTexture&&(e+=this.metallicRoughnessTexture.memoryUsage),e+=null!=this.metallicRoughnessTextureTransform?20:0,e}};e([s({type:t,json:{write:!0}})],u.prototype,"emissiveColor",void 0),e([s({json:{write:!0}})],u.prototype,"emissiveStrength",void 0),e([s({type:i,json:{write:!0},value:null})],u.prototype,"emissiveTexture",null),e([s({type:l,json:{write:!0}})],u.prototype,"emissiveTextureTransform",void 0),e([s({type:i,json:{write:!0},value:null})],u.prototype,"occlusionTexture",null),e([s({type:l,json:{write:!0}})],u.prototype,"occlusionTextureTransform",void 0),e([s({type:Number,nonNullable:!0,json:{write:!0},range:{min:0,max:1}})],u.prototype,"metallic",void 0),e([s({type:Number,nonNullable:!0,json:{write:!0},range:{min:0,max:1}})],u.prototype,"roughness",void 0),e([s({type:i,json:{write:!0},value:null})],u.prototype,"metallicRoughnessTexture",null),e([s({type:l,json:{write:!0}})],u.prototype,"metallicRoughnessTextureTransform",void 0),u=e([r("esri.geometry.support.MeshMaterialMetallicRoughness")],u);export{u as default};
@@ -2,4 +2,4 @@
2
2
  All material copyright Esri, All Rights Reserved, unless otherwise specified.
3
3
  See https://js.arcgis.com/5.0/esri/copyright.txt for details.
4
4
  */
5
- import{colorGamma as e}from"../../../../../colorUtils.js";import t from"../../../../../core/Logger.js";import{getOrCreateMapValue as s}from"../../../../../core/MapUtils.js";import{deg2rad as r}from"../../../../../core/mathUtils.js";import{exactEquals as i}from"../../../../../core/libs/gl-matrix-2/math/quat.js";import{clone as o,IDENTITY as a}from"../../../../../core/libs/gl-matrix-2/factories/quatf64.js";import{m as n}from"../../../../../chunks/vec32.js";import{ZEROS as l,clone as c,ONES as u}from"../../../../../core/libs/gl-matrix-2/factories/vec3f64.js";import h from"../../../MeshMaterialMetallicRoughness.js";import{convertVertexSpace as f}from"../../vertexSpaceConversion.js";import{Buffer as m}from"./buffer.js";import{smoothNormals as p}from"./geometry.js";import{imageToArrayBuffer as d,imageToDataURI as g}from"./imageutils.js";import{isEncodedMeshTexture as x}from"../../../../../views/3d/glTF/internal/resourceUtils.js";import{DataType as T}from"../../../../../views/webgl/enums.js";const b=()=>t.getLogger("esri.geometry.support.meshUtils.exporters.gltf.gltf");class _{constructor(e,t){this.options=t,this._materialMap=new Array,this._imageMap=new Map,this._textureMap=new Map,this.gltf={asset:{version:"2.0",copyright:e.copyright,generator:e.generator},extras:{output:t.output,binChunkBuffer:null,promises:[]}},this._addScenes(e)}_addScenes(e){this.gltf.scene=e.defaultScene;const t=this.gltf.extras,s=2===t.output.buffer||2===t.output.image;s&&(t.binChunkBuffer=new m(this.gltf)),e.forEachScene(e=>{this._addScene(e)}),s&&t.binChunkBuffer.finalize()}_addScene(e){this.gltf.scenes||(this.gltf.scenes=[]);const t={};e.name&&(t.name=e.name),e.forEachNode(e=>{t.nodes||(t.nodes=[]),t.nodes.push(...this._addNodes(e))}),this.gltf.scenes.push(t)}_addNodes(e){this.gltf.nodes||(this.gltf.nodes=[]);const t={};e.name&&(t.name=e.name);const s=e.translation;n(s,l)||(t.translation=c(s));const r=e.rotation;i(r,a)||(t.rotation=o(r));const h=e.scale;n(h,u)||(t.scale=c(h));const f=this.gltf.nodes.length;if(this.gltf.nodes.push(t),e.mesh&&e.mesh.vertexAttributes.position){const s=this._createMeshes(e.mesh),r=[f];if(1===s.length)this._addMesh(t,s[0]);else for(const e of s){const t={};this._addMesh(t,e),r.push(this.gltf.nodes.length),this.gltf.nodes.push(t)}return r}return e.forEachNode(e=>{t.children||(t.children=[]),t.children.push(...this._addNodes(e))}),[f]}_addMesh(e,t){this.gltf.meshes??=[];const s=this.gltf.meshes.length;this.gltf.meshes.push(t),e.mesh=s}_createMeshes(e){const t=this.gltf.extras,s=2===t.output.buffer;let r;r=s?t.binChunkBuffer:new m(this.gltf);const i=this.options.origin,o=e.vertexSpace.clone();o.origin=[i.x,i.y,i.z??0];const a=f({vertexAttributes:e.vertexAttributes,vertexSpace:e.vertexSpace,transform:this.options?.ignoreLocalTransform?null:e.transform,spatialReference:e.spatialReference},o,{targetUnit:this.options.unitConversionDisabled?void 0:"meters"});if(!a)return[];p(e,a),M(a);const{position:n,normal:l,tangent:c}=a,{uv:u,color:h}=e.vertexAttributes,d=r.addBufferView(T.FLOAT,"VEC3",34962);let g,x,b,_;l&&(g=r.addBufferView(T.FLOAT,"VEC3",34962)),u&&(x=r.addBufferView(T.FLOAT,"VEC2",34962)),c&&(b=r.addBufferView(T.FLOAT,"VEC4",34962)),h&&(_=r.addBufferView(T.FLOAT,"VEC4",34962)),d.startAccessor("POSITION"),g&&g.startAccessor("NORMAL"),x&&x.startAccessor("TEXCOORD_0"),b&&b.startAccessor("TANGENT"),_&&_.startAccessor("COLOR_0");const A=a.position.length/3;for(let f=0;f<A;++f)d.push(n[3*f]),d.push(n[3*f+1]),d.push(n[3*f+2]),g&&null!=l&&(g.push(l[3*f]),g.push(l[3*f+1]),g.push(l[3*f+2])),x&&null!=u&&(x.push(u[2*f]),x.push(u[2*f+1])),b&&null!=c&&(b.push(c[4*f]),b.push(c[4*f+1]),b.push(c[4*f+2]),b.push(c[4*f+3])),_&&null!=h&&(_.push(w(h[4*f]/255)),_.push(w(h[4*f+1]/255)),_.push(w(h[4*f+2]/255)),_.push(h[4*f+3]/255));const O=d.endAccessor(),v=this._addAccessor(d.index,O);let R,N,C,S,I;if(g){const e=g.endAccessor();R=this._addAccessor(g.index,e)}if(x){const e=x.endAccessor();N=this._addAccessor(x.index,e)}if(b){const e=b.endAccessor();C=this._addAccessor(b.index,e)}if(_){const e=_.endAccessor();S=this._addAccessor(_.index,e)}const y=[];return e.components&&e.components.length>0&&e.components[0].faces?(I=r.addBufferView(T.UNSIGNED_INT,"SCALAR",34963),this._addMeshVertexIndexed(I,e.components,y,v,R,N,C,S)):this._addMeshVertexNonIndexed(e.components,y,v,R,N,C,S),d.finalize(),g?.finalize(),x?.finalize(),b?.finalize(),I?.finalize(),_?.finalize(),s||r.finalize(),y}_addMaterial(e){if(null==e)return;const t=this._materialMap.indexOf(e);if(-1!==t)return t;this.gltf.materials||(this.gltf.materials=[]);const s={};switch(e.alphaMode){case"mask":s.alphaMode="MASK";break;case"auto":case"blend":s.alphaMode="BLEND"}s.alphaCutoff=e.alphaCutoff,e.doubleSided&&(s.doubleSided=e.doubleSided),s.pbrMetallicRoughness={};const r=e=>{const t=e.toRgba();return t[0]=w(t[0]/255),t[1]=w(t[1]/255),t[2]=w(t[2]/255),t};if(null!=e.color&&(s.pbrMetallicRoughness.baseColorFactor=r(e.color)),null!=e.colorTexture&&(s.pbrMetallicRoughness.baseColorTexture=this._createTextureInfo(e.colorTexture,e.colorTextureTransform)),null!=e.normalTexture&&(s.normalTexture=this._createTextureInfo(e.normalTexture,e.normalTextureTransform)),e instanceof h){if(null!=e.emissiveTexture&&(s.emissiveTexture=this._createTextureInfo(e.emissiveTexture,e.emissiveTextureTransform)),null!=e.emissiveColor){const t=r(e.emissiveColor);s.emissiveFactor=[t[0],t[1],t[2]]}null!=e.occlusionTexture&&(s.occlusionTexture=this._createTextureInfo(e.occlusionTexture,e.occlusionTextureTransform)),null!=e.metallicRoughnessTexture&&(s.pbrMetallicRoughness.metallicRoughnessTexture=this._createTextureInfo(e.metallicRoughnessTexture,e.metallicRoughnessTextureTransform)),s.pbrMetallicRoughness.metallicFactor=e.metallic,s.pbrMetallicRoughness.roughnessFactor=e.roughness}else s.pbrMetallicRoughness.metallicFactor=1,s.pbrMetallicRoughness.roughnessFactor=1,b().warnOnce("Meshes exported to GLTF without MeshMaterialMetallicRoughness material will appear different when imported back.");const i=this.gltf.materials.length;return this.gltf.materials.push(s),this._materialMap.push(e),i}_createTextureInfo(e,t){const s={index:this._addTexture(e)};return t?(s.extensions||(s.extensions={}),s.extensions.KHR_texture_transform={scale:t.scale,offset:t.offset,rotation:r(t.rotation)},s):s}_addTexture(e){const t=this.gltf.textures??[];return this.gltf.textures=t,s(this._textureMap,e,()=>{const s={sampler:this._addSampler(e),source:this._addImage(e)},r=t.length;return t.push(s),r})}_addImage(e){const t=this._imageMap.get(e);if(null!=t)return t;this.gltf.images||(this.gltf.images=[]);const s={};if(e.url)s.uri=e.url;else{const t=e.data;s.extras=t;for(let e=0;e<this.gltf.images.length;++e)if(t===this.gltf.images[e].extras)return e;const r=this.gltf.extras;switch(r.output.image){case 2:{const e=r.binChunkBuffer.addBufferView(T.UNSIGNED_BYTE,"SCALAR");if(x(t))null!=t.data&&e.writeOutToBuffer(t.data.buffer,0);else{const i=d(t,this.options.signal).then(({data:e,type:t})=>(s.mimeType=t,e));r.promises.push(e.writeAsync(i).then(()=>e.finalize()))}s.bufferView=e.index;break}case 1:if(x(t)){b().warnOnce("Image export for basis compressed textures not available.");break}s.uri=g(t);break;default:if(x(t)){b().warnOnce("Image export for basis compressed textures not available.");break}r.promises.push(d(t,this.options.signal).then(({data:e,type:t})=>{s.uri=e,s.mimeType=t}))}}const r=this.gltf.images.length;return this.gltf.images.push(s),this._imageMap.set(e,r),r}_addSampler(e){this.gltf.samplers||(this.gltf.samplers=[]);let t=10497,s=10497;if("string"==typeof e.wrap)switch(e.wrap){case"clamp":t=33071,s=33071;break;case"mirror":t=33648,s=33648}else{switch(e.wrap.vertical){case"clamp":s=33071;break;case"mirror":s=33648}switch(e.wrap.horizontal){case"clamp":t=33071;break;case"mirror":t=33648}}const r={wrapS:t,wrapT:s};for(let o=0;o<this.gltf.samplers.length;++o)if(JSON.stringify(r)===JSON.stringify(this.gltf.samplers[o]))return o;const i=this.gltf.samplers.length;return this.gltf.samplers.push(r),i}_addAccessor(e,t){this.gltf.accessors||(this.gltf.accessors=[]);const s={bufferView:e,byteOffset:t.byteOffset,componentType:t.componentType,count:t.count,type:t.type,min:t.min,max:t.max,name:t.name};t.normalized&&(s.normalized=!0);const r=this.gltf.accessors.length;return this.gltf.accessors.push(s),r}_addMeshVertexIndexed(e,t,s,r,i,o,a,n){const l=new Map;for(const c of t){if(e.startAccessor("INDICES"),c.faces)for(let s=0;s<c.faces.length;++s)e.push(c.faces[s]);const t=e.endAccessor(),u={attributes:{POSITION:r},indices:this._addAccessor(e.index,t),material:this._addMaterial(c.material)};i&&"flat"!==c.shading&&(u.attributes.NORMAL=i),o&&(u.attributes.TEXCOORD_0=o),a&&"flat"!==c.shading&&(u.attributes.TANGENT=a),n&&(u.attributes.COLOR_0=n);const h=l.get(c.name);if(h)h.primitives.push(u);else{const e={name:c.name,primitives:[u]};l.set(c.name,e),s.push(e)}}}_addMeshVertexNonIndexed(e,t,s,r,i,o,a){const n={primitives:[]};t.push(n);const l={attributes:{POSITION:s}};r&&(l.attributes.NORMAL=r),i&&(l.attributes.TEXCOORD_0=i),o&&(l.attributes.TANGENT=o),a&&(l.attributes.COLOR_0=a),e&&(l.material=this._addMaterial(e[0].material)),n.primitives.push(l)}}function M({position:e,normal:t,tangent:s}){A(e,3),A(t,3),A(s,4)}function A(e,t){if(null!=e)for(let s=1,r=2;s<e.length;s+=t,r+=t){const t=e[s],i=e[r];e[s]=i,e[r]=-t}}function w(t){return t**e}export{_ as GLTF};
5
+ import{colorGamma as e}from"../../../../../colorUtils.js";import t from"../../../../../core/Logger.js";import{getOrCreateMapValue as s}from"../../../../../core/MapUtils.js";import{deg2rad as r}from"../../../../../core/mathUtils.js";import{exactEquals as i}from"../../../../../core/libs/gl-matrix-2/math/quat.js";import{clone as o,IDENTITY as a}from"../../../../../core/libs/gl-matrix-2/factories/quatf64.js";import{m as n}from"../../../../../chunks/vec32.js";import{ZEROS as l,clone as c,ONES as u}from"../../../../../core/libs/gl-matrix-2/factories/vec3f64.js";import h from"../../../MeshMaterialMetallicRoughness.js";import{convertVertexSpace as f}from"../../vertexSpaceConversion.js";import{Buffer as m}from"./buffer.js";import{smoothNormals as p}from"./geometry.js";import{imageToArrayBuffer as d,imageToDataURI as g}from"./imageutils.js";import{isEncodedMeshTexture as x}from"../../../../../views/3d/glTF/internal/resourceUtils.js";import{DataType as T}from"../../../../../views/webgl/enums.js";const b=()=>t.getLogger("esri.geometry.support.meshUtils.exporters.gltf.gltf");class _{constructor(e,t){this.options=t,this._materialMap=new Array,this._imageMap=new Map,this._textureMap=new Map,this.gltf={asset:{version:"2.0",copyright:e.copyright,generator:e.generator},extras:{output:t.output,binChunkBuffer:null,promises:[]}},this._addScenes(e)}_addScenes(e){this.gltf.scene=e.defaultScene;const t=this.gltf.extras,s=2===t.output.buffer||2===t.output.image;s&&(t.binChunkBuffer=new m(this.gltf)),e.forEachScene(e=>{this._addScene(e)}),s&&t.binChunkBuffer.finalize()}_addScene(e){this.gltf.scenes||(this.gltf.scenes=[]);const t={};e.name&&(t.name=e.name),e.forEachNode(e=>{t.nodes||(t.nodes=[]),t.nodes.push(...this._addNodes(e))}),this.gltf.scenes.push(t)}_addNodes(e){this.gltf.nodes||(this.gltf.nodes=[]);const t={};e.name&&(t.name=e.name);const s=e.translation;n(s,l)||(t.translation=c(s));const r=e.rotation;i(r,a)||(t.rotation=o(r));const h=e.scale;n(h,u)||(t.scale=c(h));const f=this.gltf.nodes.length;if(this.gltf.nodes.push(t),e.mesh&&e.mesh.vertexAttributes.position){const s=this._createMeshes(e.mesh),r=[f];if(1===s.length)this._addMesh(t,s[0]);else for(const e of s){const t={};this._addMesh(t,e),r.push(this.gltf.nodes.length),this.gltf.nodes.push(t)}return r}return e.forEachNode(e=>{t.children||(t.children=[]),t.children.push(...this._addNodes(e))}),[f]}_addMesh(e,t){this.gltf.meshes??=[];const s=this.gltf.meshes.length;this.gltf.meshes.push(t),e.mesh=s}_createMeshes(e){const t=this.gltf.extras,s=2===t.output.buffer;let r;r=s?t.binChunkBuffer:new m(this.gltf);const i=this.options.origin,o=e.vertexSpace.clone();o.origin=[i.x,i.y,i.z??0];const a=f({vertexAttributes:e.vertexAttributes,vertexSpace:e.vertexSpace,transform:this.options?.ignoreLocalTransform?null:e.transform,spatialReference:e.spatialReference},o,{targetUnit:this.options.unitConversionDisabled?void 0:"meters"});if(!a)return[];p(e,a),M(a);const{position:n,normal:l,tangent:c}=a,{uv:u,color:h}=e.vertexAttributes,d=r.addBufferView(T.FLOAT,"VEC3",34962);let g,x,b,_;l&&(g=r.addBufferView(T.FLOAT,"VEC3",34962)),u&&(x=r.addBufferView(T.FLOAT,"VEC2",34962)),c&&(b=r.addBufferView(T.FLOAT,"VEC4",34962)),h&&(_=r.addBufferView(T.FLOAT,"VEC4",34962)),d.startAccessor("POSITION"),g&&g.startAccessor("NORMAL"),x&&x.startAccessor("TEXCOORD_0"),b&&b.startAccessor("TANGENT"),_&&_.startAccessor("COLOR_0");const A=a.position.length/3;for(let f=0;f<A;++f)d.push(n[3*f]),d.push(n[3*f+1]),d.push(n[3*f+2]),g&&null!=l&&(g.push(l[3*f]),g.push(l[3*f+1]),g.push(l[3*f+2])),x&&null!=u&&(x.push(u[2*f]),x.push(u[2*f+1])),b&&null!=c&&(b.push(c[4*f]),b.push(c[4*f+1]),b.push(c[4*f+2]),b.push(c[4*f+3])),_&&null!=h&&(_.push(w(h[4*f]/255)),_.push(w(h[4*f+1]/255)),_.push(w(h[4*f+2]/255)),_.push(h[4*f+3]/255));const v=d.endAccessor(),O=this._addAccessor(d.index,v);let R,S,N,C,I;if(g){const e=g.endAccessor();R=this._addAccessor(g.index,e)}if(x){const e=x.endAccessor();S=this._addAccessor(x.index,e)}if(b){const e=b.endAccessor();N=this._addAccessor(b.index,e)}if(_){const e=_.endAccessor();C=this._addAccessor(_.index,e)}const y=[];return e.components&&e.components.length>0&&e.components[0].faces?(I=r.addBufferView(T.UNSIGNED_INT,"SCALAR",34963),this._addMeshVertexIndexed(I,e.components,y,O,R,S,N,C)):this._addMeshVertexNonIndexed(e.components,y,O,R,S,N,C),d.finalize(),g?.finalize(),x?.finalize(),b?.finalize(),I?.finalize(),_?.finalize(),s||r.finalize(),y}_addMaterial(e){if(null==e)return;const t=this._materialMap.indexOf(e);if(-1!==t)return t;this.gltf.materials||(this.gltf.materials=[]);const s={};switch(e.alphaMode){case"mask":s.alphaMode="MASK";break;case"auto":case"blend":s.alphaMode="BLEND"}s.alphaCutoff=e.alphaCutoff,e.doubleSided&&(s.doubleSided=e.doubleSided),s.pbrMetallicRoughness={};const r=e=>{const t=e.toRgba();return t[0]=w(t[0]/255),t[1]=w(t[1]/255),t[2]=w(t[2]/255),t};if(null!=e.color&&(s.pbrMetallicRoughness.baseColorFactor=r(e.color)),null!=e.colorTexture&&(s.pbrMetallicRoughness.baseColorTexture=this._createTextureInfo(e.colorTexture,e.colorTextureTransform)),null!=e.normalTexture&&(s.normalTexture=this._createTextureInfo(e.normalTexture,e.normalTextureTransform)),e instanceof h){if(null!=e.emissiveTexture&&(s.emissiveTexture=this._createTextureInfo(e.emissiveTexture,e.emissiveTextureTransform)),null!=e.emissiveColor){const t=r(e.emissiveColor);s.emissiveFactor=[t[0],t[1],t[2]]}null!=e.emissiveStrength&&(s.extensions??={},s.extensions.KHR_materials_emissive_strength={emissiveStrength:e.emissiveStrength}),null!=e.occlusionTexture&&(s.occlusionTexture=this._createTextureInfo(e.occlusionTexture,e.occlusionTextureTransform)),null!=e.metallicRoughnessTexture&&(s.pbrMetallicRoughness.metallicRoughnessTexture=this._createTextureInfo(e.metallicRoughnessTexture,e.metallicRoughnessTextureTransform)),s.pbrMetallicRoughness.metallicFactor=e.metallic,s.pbrMetallicRoughness.roughnessFactor=e.roughness}else s.pbrMetallicRoughness.metallicFactor=1,s.pbrMetallicRoughness.roughnessFactor=1,b().warnOnce("Meshes exported to GLTF without MeshMaterialMetallicRoughness material will appear different when imported back.");const i=this.gltf.materials.length;return this.gltf.materials.push(s),this._materialMap.push(e),i}_createTextureInfo(e,t){const s={index:this._addTexture(e)};return t?(s.extensions||(s.extensions={}),s.extensions.KHR_texture_transform={scale:t.scale,offset:t.offset,rotation:r(t.rotation)},s):s}_addTexture(e){const t=this.gltf.textures??[];return this.gltf.textures=t,s(this._textureMap,e,()=>{const s={sampler:this._addSampler(e),source:this._addImage(e)},r=t.length;return t.push(s),r})}_addImage(e){const t=this._imageMap.get(e);if(null!=t)return t;this.gltf.images||(this.gltf.images=[]);const s={};if(e.url)s.uri=e.url;else{const t=e.data;s.extras=t;for(let e=0;e<this.gltf.images.length;++e)if(t===this.gltf.images[e].extras)return e;const r=this.gltf.extras;switch(r.output.image){case 2:{const e=r.binChunkBuffer.addBufferView(T.UNSIGNED_BYTE,"SCALAR");if(x(t))null!=t.data&&e.writeOutToBuffer(t.data.buffer,0);else{const i=d(t,this.options.signal).then(({data:e,type:t})=>(s.mimeType=t,e));r.promises.push(e.writeAsync(i).then(()=>e.finalize()))}s.bufferView=e.index;break}case 1:if(x(t)){b().warnOnce("Image export for basis compressed textures not available.");break}s.uri=g(t);break;default:if(x(t)){b().warnOnce("Image export for basis compressed textures not available.");break}r.promises.push(d(t,this.options.signal).then(({data:e,type:t})=>{s.uri=e,s.mimeType=t}))}}const r=this.gltf.images.length;return this.gltf.images.push(s),this._imageMap.set(e,r),r}_addSampler(e){this.gltf.samplers||(this.gltf.samplers=[]);let t=10497,s=10497;if("string"==typeof e.wrap)switch(e.wrap){case"clamp":t=33071,s=33071;break;case"mirror":t=33648,s=33648}else{switch(e.wrap.vertical){case"clamp":s=33071;break;case"mirror":s=33648}switch(e.wrap.horizontal){case"clamp":t=33071;break;case"mirror":t=33648}}const r={wrapS:t,wrapT:s};for(let o=0;o<this.gltf.samplers.length;++o)if(JSON.stringify(r)===JSON.stringify(this.gltf.samplers[o]))return o;const i=this.gltf.samplers.length;return this.gltf.samplers.push(r),i}_addAccessor(e,t){this.gltf.accessors||(this.gltf.accessors=[]);const s={bufferView:e,byteOffset:t.byteOffset,componentType:t.componentType,count:t.count,type:t.type,min:t.min,max:t.max,name:t.name};t.normalized&&(s.normalized=!0);const r=this.gltf.accessors.length;return this.gltf.accessors.push(s),r}_addMeshVertexIndexed(e,t,s,r,i,o,a,n){const l=new Map;for(const c of t){if(e.startAccessor("INDICES"),c.faces)for(let s=0;s<c.faces.length;++s)e.push(c.faces[s]);const t=e.endAccessor(),u={attributes:{POSITION:r},indices:this._addAccessor(e.index,t),material:this._addMaterial(c.material)};i&&"flat"!==c.shading&&(u.attributes.NORMAL=i),o&&(u.attributes.TEXCOORD_0=o),a&&"flat"!==c.shading&&(u.attributes.TANGENT=a),n&&(u.attributes.COLOR_0=n);const h=l.get(c.name);if(h)h.primitives.push(u);else{const e={name:c.name,primitives:[u]};l.set(c.name,e),s.push(e)}}}_addMeshVertexNonIndexed(e,t,s,r,i,o,a){const n={primitives:[]};t.push(n);const l={attributes:{POSITION:s}};r&&(l.attributes.NORMAL=r),i&&(l.attributes.TEXCOORD_0=i),o&&(l.attributes.TANGENT=o),a&&(l.attributes.COLOR_0=a),e&&(l.material=this._addMaterial(e[0].material)),n.primitives.push(l)}}function M({position:e,normal:t,tangent:s}){A(e,3),A(t,3),A(s,4)}function A(e,t){if(null!=e)for(let s=1,r=2;s<e.length;s+=t,r+=t){const t=e[s],i=e[r];e[s]=i,e[r]=-t}}function w(t){return t**e}export{_ as GLTF};
@@ -2,4 +2,4 @@
2
2
  All material copyright Esri, All Rights Reserved, unless otherwise specified.
3
3
  See https://js.arcgis.com/5.0/esri/copyright.txt for details.
4
4
  */
5
- import e from"../../../Color.js";import{colorGamma as t}from"../../../colorUtils.js";import r from"../../../core/Error.js";import{getOrCreateMapValue as o}from"../../../core/MapUtils.js";import{rad2deg as n,hasScaling as s}from"../../../core/mathUtils.js";import{normalFromMat4 as i,fromMat4 as a}from"../../../core/libs/gl-matrix-2/math/mat3.js";import{create as l}from"../../../core/libs/gl-matrix-2/factories/mat3f64.js";import{fromValues as c}from"../../../core/libs/gl-matrix-2/factories/vec3f64.js";import{fromValues as f}from"../../../core/libs/gl-matrix-2/factories/vec4f64.js";import u from"../MeshComponent.js";import m from"../MeshMaterialMetallicRoughness.js";import p from"../MeshTexture.js";import d from"../MeshTextureTransform.js";import{MeshVertexAttributes as x}from"../MeshVertexAttributes.js";import{selectVertexSpace as g}from"../meshVertexSpaceUtils.js";import{BufferViewVec4f as h,BufferViewVec4u8 as T,BufferViewVec4u16 as v,BufferViewVec3u8 as w,BufferViewVec3f as j,BufferViewVec3u16 as b,BufferViewVec2f as y,BufferViewVec3f64 as C}from"../buffer/BufferView.js";import{d as M,c as B,e as F,l as R}from"../../../chunks/vec3.js";import{a as $,n as A,l as S}from"../../../chunks/vec4.js";import{createBuffer as U}from"../buffer/utils.js";import{convertVertexSpace as k}from"./vertexSpaceConversion.js";import{DefaultLoadingContext as V}from"../../../views/3d/glTF/DefaultLoadingContext.js";import{loadGLTF as E}from"../../../views/3d/glTF/loader.js";import{convertPrimitiveToTriangles as D}from"../../../views/3d/glTF/internal/indexUtils.js";import{isEncodedMeshTexture as I}from"../../../views/3d/glTF/internal/resourceUtils.js";import{f as L}from"../../../chunks/vec33.js";import{f as z}from"../../../chunks/vec43.js";import{n as N,f as O}from"../../../chunks/vec2.js";async function q(e,t,o){const n=new V(o?.resolveFile),s=await E(n,t,o,!0),i=s.model,a=i.lods.shift(),l=new Map,c=new Map;i.textures.forEach((e,t)=>l.set(t,Q(e))),i.materials.forEach((e,t)=>c.set(t,H(e,l)));const f=P(a);for(const r of f.parts)J(f,r,c);const{position:u,normal:m,tangent:p,color:d,texCoord0:h}=f.vertexAttributes,T=g(e,o),v=e.spatialReference.isGeographic?g(e):T,w=k({vertexAttributes:{position:u.typedBuffer,normal:m?.typedBuffer,tangent:p?.typedBuffer},vertexSpace:v,spatialReference:e.spatialReference},T,{allowBufferReuse:!0,sourceUnit:o?.unitConversionDisabled?void 0:"meters"});if(!w)throw new r("load-gltf-mesh:vertex-space-projection",`Failed to load mesh from glTF because we could not convert the vertex space from ${v.type} to ${T.type}`);return{mesh:{transform:null,vertexSpace:T,components:f.components,spatialReference:e.spatialReference,vertexAttributes:new x({...w,color:d?.typedBuffer,uv:h?.typedBuffer})},meta:s.meta}}function G(e,t){if(null==e)return"-";const r=e.typedBuffer;return`${o(t,r.buffer,()=>t.size)}/${r.byteOffset}/${r.byteLength}`}function K(e){return null!=e?e.toString():"-"}function P(e){let t=0;const has={color:!1,tangent:!1,normal:!1,texCoord0:!1},r=new Map,n=new Map,s=[];for(const i of e.parts){const{position:e,normal:a,color:l,tangent:c,texCoord0:f}=i.attributes,u=`\n ${G(e,r)}/\n ${G(a,r)}/\n ${G(l,r)}/\n ${G(c,r)}/\n ${G(f,r)}/\n ${K(i.transform)}\n `;let m=!1;const p=o(n,u,()=>(m=!0,{start:t,length:e.count}));m&&(t+=e.count),a&&(has.normal=!0),l&&(has.color=!0),c&&(has.tangent=!0),f&&(has.texCoord0=!0),s.push({gltf:i,writeVertices:m,region:p})}return{vertexAttributes:{position:U(C,t),normal:has.normal?U(j,t):null,tangent:has.tangent?U(h,t):null,color:has.color?U(T,t):null,texCoord0:has.texCoord0?U(y,t):null},parts:s,components:[]}}function Q(e){return new p({data:(I(e.data),e.data),wrap:Y(e.parameters.wrap)})}function H(t,r){const o=new e(ee(t.color,t.opacity)),s=t.emissiveFactor?new e(te(t.emissiveFactor)):null,i=e=>e?new d({scale:e.scale?[e.scale[0],e.scale[1]]:[1,1],rotation:n(e.rotation??0),offset:e.offset?[e.offset[0],e.offset[1]]:[0,0]}):null;return new m({color:o,colorTexture:r.get(t.colorTexture),normalTexture:r.get(t.normalTexture),emissiveColor:s,emissiveTexture:r.get(t.emissiveTexture),occlusionTexture:r.get(t.occlusionTexture),alphaMode:X(t.alphaMode),alphaCutoff:t.alphaCutoff,doubleSided:t.doubleSided,metallic:t.metallicFactor,roughness:t.roughnessFactor,metallicRoughnessTexture:r.get(t.metallicRoughnessTexture),colorTextureTransform:i(t.colorTextureTransform),normalTextureTransform:i(t.normalTextureTransform),occlusionTextureTransform:i(t.occlusionTextureTransform),emissiveTextureTransform:i(t.emissiveTextureTransform),metallicRoughnessTextureTransform:i(t.metallicRoughnessTextureTransform)})}function J(e,t,r){t.writeVertices&&W(e,t);const{indices:o,attributes:n,primitiveType:s,material:i}=t.gltf;let a=D(o||n.position.count,s);const l=t.region.start;if(l){const e=new Uint32Array(a);for(let t=0;t<a.length;t++)e[t]+=l;a=e}e.components.push(new u({name:t.gltf.name,faces:a,material:r.get(i),shading:n.normal?"source":"flat",trustSourceNormals:!0}))}function W(e,t){const{position:r,normal:o,tangent:n,color:c,texCoord0:f}=e.vertexAttributes,u=t.region.start,{attributes:m,transform:p}=t.gltf,d=m.position.count;if(M(r.slice(u,d),m.position,p),null!=m.normal&&null!=o){const e=i(l(),p),t=o.slice(u,d);B(t,m.normal,e),s(e)&&F(t,t)}else null!=o&&L(o,0,0,1,{dstIndex:u,count:d});if(null!=m.tangent&&null!=n){const e=a(l(),p),t=n.slice(u,d);$(t,m.tangent,e),s(e)&&A(t,t)}else null!=n&&z(n,0,0,1,1,{dstIndex:u,count:d});if(null!=m.texCoord0&&null!=f?N(f.slice(u,d),m.texCoord0):null!=f&&O(f,0,0,{dstIndex:u,count:d}),null!=m.color&&null!=c){const e=m.color,t=c.slice(u,d);if(4===e.elementCount)e instanceof h?S(t,e,1,255):(e instanceof T||e instanceof v)&&S(t,e,1/255,255);else{z(t,255,255,255,255);const r=w.fromTypedArray(t.typedBuffer,t.typedBufferStride);e instanceof j?R(r,e,1,255):(e instanceof w||e instanceof b)&&R(r,e,1/255,255)}}else null!=c&&z(c.slice(u,d),255,255,255,255)}function X(e){switch(e){case"OPAQUE":return"opaque";case"MASK":return"mask";case"BLEND":return"blend"}}function Y(e){return{horizontal:Z(e.s),vertical:Z(e.t)}}function Z(e){switch(e){case 33071:return"clamp";case 33648:return"mirror";case 10497:return"repeat"}}function _(e){return e**(1/t)*255}function ee(e,t){return f(_(e[0]),_(e[1]),_(e[2]),t)}function te(e){return c(_(e[0]),_(e[1]),_(e[2]))}export{q as loadGLTFMesh};
5
+ import e from"../../../Color.js";import{colorGamma as t}from"../../../colorUtils.js";import r from"../../../core/Error.js";import{getOrCreateMapValue as o}from"../../../core/MapUtils.js";import{rad2deg as n,hasScaling as s}from"../../../core/mathUtils.js";import{normalFromMat4 as i,fromMat4 as a}from"../../../core/libs/gl-matrix-2/math/mat3.js";import{create as l}from"../../../core/libs/gl-matrix-2/factories/mat3f64.js";import{fromValues as c}from"../../../core/libs/gl-matrix-2/factories/vec3f64.js";import{fromValues as f}from"../../../core/libs/gl-matrix-2/factories/vec4f64.js";import u from"../MeshComponent.js";import m from"../MeshMaterialMetallicRoughness.js";import p from"../MeshTexture.js";import d from"../MeshTextureTransform.js";import{MeshVertexAttributes as x}from"../MeshVertexAttributes.js";import{selectVertexSpace as g}from"../meshVertexSpaceUtils.js";import{BufferViewVec4f as h,BufferViewVec4u8 as T,BufferViewVec4u16 as v,BufferViewVec3u8 as w,BufferViewVec3f as j,BufferViewVec3u16 as b,BufferViewVec2f as y,BufferViewVec3f64 as C}from"../buffer/BufferView.js";import{d as M,c as R,e as S,l as B}from"../../../chunks/vec3.js";import{a as F,n as $,l as A}from"../../../chunks/vec4.js";import{createBuffer as U}from"../buffer/utils.js";import{convertVertexSpace as k}from"./vertexSpaceConversion.js";import{DefaultLoadingContext as V}from"../../../views/3d/glTF/DefaultLoadingContext.js";import{loadGLTF as E}from"../../../views/3d/glTF/loader.js";import{convertPrimitiveToTriangles as D}from"../../../views/3d/glTF/internal/indexUtils.js";import{isEncodedMeshTexture as I}from"../../../views/3d/glTF/internal/resourceUtils.js";import{f as L}from"../../../chunks/vec33.js";import{f as z}from"../../../chunks/vec43.js";import{n as K,f as N}from"../../../chunks/vec2.js";async function O(e,t,o){const n=new V(o?.resolveFile),s=await E(n,t,o,!0),i=s.model,a=i.lods.shift(),l=new Map,c=new Map;i.textures.forEach((e,t)=>l.set(t,P(e))),i.materials.forEach((e,t)=>c.set(t,Q(e,l)));const f=H(a);for(const r of f.parts)J(f,r,c);const{position:u,normal:m,tangent:p,color:d,texCoord0:h}=f.vertexAttributes,T=g(e,o),v=e.spatialReference.isGeographic?g(e):T,w=k({vertexAttributes:{position:u.typedBuffer,normal:m?.typedBuffer,tangent:p?.typedBuffer},vertexSpace:v,spatialReference:e.spatialReference},T,{allowBufferReuse:!0,sourceUnit:o?.unitConversionDisabled?void 0:"meters"});if(!w)throw new r("load-gltf-mesh:vertex-space-projection",`Failed to load mesh from glTF because we could not convert the vertex space from ${v.type} to ${T.type}`);return{mesh:{transform:null,vertexSpace:T,components:f.components,spatialReference:e.spatialReference,vertexAttributes:new x({...w,color:d?.typedBuffer,uv:h?.typedBuffer})},meta:s.meta}}function q(e,t){if(null==e)return"-";const r=e.typedBuffer;return`${o(t,r.buffer,()=>t.size)}/${r.byteOffset}/${r.byteLength}`}function G(e){return null!=e?e.toString():"-"}function H(e){let t=0;const has={color:!1,tangent:!1,normal:!1,texCoord0:!1},r=new Map,n=new Map,s=[];for(const i of e.parts){const{position:e,normal:a,color:l,tangent:c,texCoord0:f}=i.attributes,u=`\n ${q(e,r)}/\n ${q(a,r)}/\n ${q(l,r)}/\n ${q(c,r)}/\n ${q(f,r)}/\n ${G(i.transform)}\n `;let m=!1;const p=o(n,u,()=>(m=!0,{start:t,length:e.count}));m&&(t+=e.count),a&&(has.normal=!0),l&&(has.color=!0),c&&(has.tangent=!0),f&&(has.texCoord0=!0),s.push({gltf:i,writeVertices:m,region:p})}return{vertexAttributes:{position:U(C,t),normal:has.normal?U(j,t):null,tangent:has.tangent?U(h,t):null,color:has.color?U(T,t):null,texCoord0:has.texCoord0?U(y,t):null},parts:s,components:[]}}function P(e){return new p({data:(I(e.data),e.data),wrap:Y(e.parameters.wrap)})}function Q(t,r){const o=new e(ee(t.color,t.opacity)),s=t.emissiveFactor?new e(te(t.emissiveFactor)):null,i=e=>e?new d({scale:e.scale?[e.scale[0],e.scale[1]]:[1,1],rotation:n(e.rotation??0),offset:e.offset?[e.offset[0],e.offset[1]]:[0,0]}):null;return new m({color:o,colorTexture:r.get(t.colorTexture),normalTexture:r.get(t.normalTexture),emissiveColor:s,emissiveStrength:t.emissiveStrengthKHR,emissiveTexture:r.get(t.emissiveTexture),occlusionTexture:r.get(t.occlusionTexture),alphaMode:X(t.alphaMode),alphaCutoff:t.alphaCutoff,doubleSided:t.doubleSided,metallic:t.metallicFactor,roughness:t.roughnessFactor,metallicRoughnessTexture:r.get(t.metallicRoughnessTexture),colorTextureTransform:i(t.colorTextureTransform),normalTextureTransform:i(t.normalTextureTransform),occlusionTextureTransform:i(t.occlusionTextureTransform),emissiveTextureTransform:i(t.emissiveTextureTransform),metallicRoughnessTextureTransform:i(t.metallicRoughnessTextureTransform)})}function J(e,t,r){t.writeVertices&&W(e,t);const{indices:o,attributes:n,primitiveType:s,material:i}=t.gltf;let a=D(o||n.position.count,s);const l=t.region.start;if(l){const e=new Uint32Array(a);for(let t=0;t<a.length;t++)e[t]+=l;a=e}e.components.push(new u({name:t.gltf.name,faces:a,material:r.get(i),shading:n.normal?"source":"flat",trustSourceNormals:!0}))}function W(e,t){const{position:r,normal:o,tangent:n,color:c,texCoord0:f}=e.vertexAttributes,u=t.region.start,{attributes:m,transform:p}=t.gltf,d=m.position.count;if(M(r.slice(u,d),m.position,p),null!=m.normal&&null!=o){const e=i(l(),p),t=o.slice(u,d);R(t,m.normal,e),s(e)&&S(t,t)}else null!=o&&L(o,0,0,1,{dstIndex:u,count:d});if(null!=m.tangent&&null!=n){const e=a(l(),p),t=n.slice(u,d);F(t,m.tangent,e),s(e)&&$(t,t)}else null!=n&&z(n,0,0,1,1,{dstIndex:u,count:d});if(null!=m.texCoord0&&null!=f?K(f.slice(u,d),m.texCoord0):null!=f&&N(f,0,0,{dstIndex:u,count:d}),null!=m.color&&null!=c){const e=m.color,t=c.slice(u,d);if(4===e.elementCount)e instanceof h?A(t,e,1,255):(e instanceof T||e instanceof v)&&A(t,e,1/255,255);else{z(t,255,255,255,255);const r=w.fromTypedArray(t.typedBuffer,t.typedBufferStride);e instanceof j?B(r,e,1,255):(e instanceof w||e instanceof b)&&B(r,e,1/255,255)}}else null!=c&&z(c.slice(u,d),255,255,255,255)}function X(e){switch(e){case"OPAQUE":return"opaque";case"MASK":return"mask";case"BLEND":return"blend"}}function Y(e){return{horizontal:Z(e.s),vertical:Z(e.t)}}function Z(e){switch(e){case 33071:return"clamp";case 33648:return"mirror";case 10497:return"repeat"}}function _(e){return e**(1/t)*255}function ee(e,t){return f(_(e[0]),_(e[1]),_(e[2]),t)}function te(e){return c(_(e[0]),_(e[1]),_(e[2]))}export{O as loadGLTFMesh};
package/interfaces.d.ts CHANGED
@@ -14101,6 +14101,12 @@ declare namespace __esri {
14101
14101
  }
14102
14102
 
14103
14103
  export class MeshMaterialMetallicRoughness extends MeshMaterial {
14104
+ /**
14105
+ * Specifies a strength value as multiplier for emissive color for the {@link https://developers.arcgis.com/javascript/latest/api-reference/esri-geometry-support-MeshComponent.html MeshComponent}.
14106
+ *
14107
+ * {@link https://developers.arcgis.com/javascript/latest/api-reference/esri-geometry-support-MeshMaterialMetallicRoughness.html#emissiveStrength Read more...}
14108
+ */
14109
+ emissiveStrength: number | nullish;
14104
14110
  /**
14105
14111
  * Specifies how much the material behaves like a metal.
14106
14112
  *
@@ -14197,6 +14203,12 @@ declare namespace __esri {
14197
14203
  * {@link https://developers.arcgis.com/javascript/latest/api-reference/esri-geometry-support-MeshMaterialMetallicRoughness.html#emissiveColor Read more...}
14198
14204
  */
14199
14205
  emissiveColor?: ColorProperties | nullish;
14206
+ /**
14207
+ * Specifies a strength value as multiplier for emissive color for the {@link https://developers.arcgis.com/javascript/latest/api-reference/esri-geometry-support-MeshComponent.html MeshComponent}.
14208
+ *
14209
+ * {@link https://developers.arcgis.com/javascript/latest/api-reference/esri-geometry-support-MeshMaterialMetallicRoughness.html#emissiveStrength Read more...}
14210
+ */
14211
+ emissiveStrength?: number | nullish;
14200
14212
  /**
14201
14213
  * Specifies a texture from which to get emissive color information.
14202
14214
  *
@@ -137331,7 +137343,7 @@ declare namespace __esri {
137331
137343
  *
137332
137344
  * {@link https://developers.arcgis.com/javascript/latest/api-reference/esri-widgets-Sketch.html#defaultCreateOptions Read more...}
137333
137345
  */
137334
- defaultCreateOptions: SketchDefaultCreateOptions;
137346
+ defaultCreateOptions: CreateOptions;
137335
137347
  /**
137336
137348
  * Default update options set for the Sketch widget.
137337
137349
  *
@@ -137479,7 +137491,7 @@ declare namespace __esri {
137479
137491
  | "multipoint"
137480
137492
  | "freehandPolyline"
137481
137493
  | "freehandPolygon"
137482
- | "text", createOptions?: SketchCreateCreateOptions): Promise<void>;
137494
+ | "text", createOptions?: CreateOptions): Promise<void>;
137483
137495
  /**
137484
137496
  * Deletes the selected graphics used in the update workflow.
137485
137497
  *
@@ -137551,7 +137563,7 @@ declare namespace __esri {
137551
137563
  *
137552
137564
  * {@link https://developers.arcgis.com/javascript/latest/api-reference/esri-widgets-Sketch.html#defaultCreateOptions Read more...}
137553
137565
  */
137554
- defaultCreateOptions?: SketchDefaultCreateOptions;
137566
+ defaultCreateOptions?: CreateOptions;
137555
137567
  /**
137556
137568
  * Default update options set for the Sketch widget.
137557
137569
  *
@@ -137695,7 +137707,7 @@ declare namespace __esri {
137695
137707
  *
137696
137708
  * {@link https://developers.arcgis.com/javascript/latest/api-reference/esri-widgets-Sketch-SketchViewModel.html#defaultCreateOptions Read more...}
137697
137709
  */
137698
- defaultCreateOptions: SketchViewModelDefaultCreateOptions;
137710
+ defaultCreateOptions: CreateOptions;
137699
137711
  /**
137700
137712
  * Default update options set for the SketchViewModel.
137701
137713
  *
@@ -137876,7 +137888,7 @@ declare namespace __esri {
137876
137888
  | "mesh"
137877
137889
  | "freehandPolygon"
137878
137890
  | "freehandPolyline"
137879
- | "text", createOptions?: SketchViewModelCreateCreateOptions): void;
137891
+ | "text", createOptions?: CreateOptions): void;
137880
137892
  /**
137881
137893
  * Deletes the selected graphics used in the update workflow.
137882
137894
  *
@@ -137917,7 +137929,7 @@ declare namespace __esri {
137917
137929
  */
137918
137930
  hasGraphic(graphic: Graphic): boolean;
137919
137931
  /**
137920
- * Allows creation of a graphic similar to create with the
137932
+ * Allows creation of a graphic similar to {@link https://developers.arcgis.com/javascript/latest/api-reference/esri-widgets-Sketch-SketchViewModel.html#create create} with the
137921
137933
  * difference that the geometry can be provided directly for the graphic being created.
137922
137934
  *
137923
137935
  * @param geometry Geometry to place when creating the graphic. Currently only {@link https://developers.arcgis.com/javascript/latest/api-reference/esri-geometry-Mesh.html mesh} geometry is supported.
@@ -137995,7 +138007,7 @@ declare namespace __esri {
137995
138007
  *
137996
138008
  * {@link https://developers.arcgis.com/javascript/latest/api-reference/esri-widgets-Sketch-SketchViewModel.html#defaultCreateOptions Read more...}
137997
138009
  */
137998
- defaultCreateOptions?: SketchViewModelDefaultCreateOptions;
138010
+ defaultCreateOptions?: CreateOptions;
137999
138011
  /**
138000
138012
  * Default update options set for the SketchViewModel.
138001
138013
  *
@@ -138096,6 +138108,18 @@ declare namespace __esri {
138096
138108
  type: "create";
138097
138109
  }
138098
138110
 
138111
+ /**
138112
+ * Options used by the create workflow.
138113
+ *
138114
+ * {@link https://developers.arcgis.com/javascript/latest/api-reference/esri-widgets-Sketch-SketchViewModel.html#CreateOptions Read more...}
138115
+ */
138116
+ export interface CreateOptions {
138117
+ defaultZ?: number;
138118
+ hasZ?: boolean;
138119
+ mode?: "hybrid" | "freehand" | "click";
138120
+ preserveAspectRatio?: boolean;
138121
+ }
138122
+
138099
138123
  export interface SketchViewModelDeleteEvent {
138100
138124
  graphics: Graphic[];
138101
138125
  tool: "move" | "reshape" | "transform";
@@ -138120,20 +138144,6 @@ declare namespace __esri {
138120
138144
  type: "redo";
138121
138145
  }
138122
138146
 
138123
- export interface SketchViewModelCreateCreateOptions {
138124
- defaultZ?: number;
138125
- hasZ?: boolean;
138126
- mode?: "hybrid" | "freehand" | "click";
138127
- preserveAspectRatio?: boolean;
138128
- }
138129
-
138130
- export interface SketchViewModelDefaultCreateOptions {
138131
- defaultZ?: number;
138132
- hasZ?: boolean;
138133
- mode?: "hybrid" | "freehand" | "click";
138134
- preserveAspectRatio?: boolean;
138135
- }
138136
-
138137
138147
  export interface SketchViewModelDefaultUpdateOptions {
138138
138148
  tool?: "move" | "transform" | "reshape";
138139
138149
  enableRotation?: boolean;
@@ -138296,20 +138306,6 @@ declare namespace __esri {
138296
138306
  removed: Graphic[];
138297
138307
  }
138298
138308
 
138299
- export interface SketchCreateCreateOptions {
138300
- defaultZ?: number;
138301
- hasZ?: boolean;
138302
- mode?: "hybrid" | "freehand" | "click";
138303
- preserveAspectRatio?: boolean;
138304
- }
138305
-
138306
- export interface SketchDefaultCreateOptions {
138307
- defaultZ?: number;
138308
- hasZ?: boolean;
138309
- mode?: "hybrid" | "freehand" | "click";
138310
- preserveAspectRatio?: boolean;
138311
- }
138312
-
138313
138309
  export interface SketchDefaultUpdateOptions {
138314
138310
  tool?: "move" | "transform" | "reshape";
138315
138311
  enableRotation?: boolean;
package/kernel.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/5.0/esri/copyright.txt for details.
4
4
  */
5
- import has from"./core/has.js";import{addQueryParameter as o}from"./core/urlUtils.js";export{buildDate,commitHash as revision}from"./support/revision.js";Symbol.dispose??=Symbol("Symbol.dispose"),Symbol.asyncDispose??=Symbol("Symbol.asyncDispose");const e="5.0";let s,r=e;function i(o){s=o}function t(e){const r=s?.findCredential(e);return r?.token?o(e,"token",r.token):e}r="5.0.0-next.41",has("host-webworker")||globalThis.$arcgis||Object.defineProperty(globalThis,"$arcgis",{configurable:!1,enumerable:!0,writable:!1,value:{}}),has("host-webworker");export{t as addTokenParameter,r as fullVersion,s as id,i as setId,e as version};
5
+ import has from"./core/has.js";import{addQueryParameter as o}from"./core/urlUtils.js";export{buildDate,commitHash as revision}from"./support/revision.js";Symbol.dispose??=Symbol("Symbol.dispose"),Symbol.asyncDispose??=Symbol("Symbol.asyncDispose");const e="5.0";let s,r=e;function i(o){s=o}function t(e){const r=s?.findCredential(e);return r?.token?o(e,"token",r.token):e}r="5.0.0-next.43",has("host-webworker")||globalThis.$arcgis||Object.defineProperty(globalThis,"$arcgis",{configurable:!1,enumerable:!0,writable:!1,value:{}}),has("host-webworker");export{t as addTokenParameter,r as fullVersion,s as id,i as setId,e as version};
@@ -2,4 +2,4 @@
2
2
  All material copyright Esri, All Rights Reserved, unless otherwise specified.
3
3
  See https://js.arcgis.com/5.0/esri/copyright.txt for details.
4
4
  */
5
- import{__decorate as e}from"tslib";import t from"../../../core/Accessor.js";import has from"../../../core/has.js";import i from"../../../core/Logger.js";import{destroyMaybe as s}from"../../../core/maybe.js";import r from"../../../core/PooledArray.js";import{EsriPromiseMixin as a}from"../../../core/Promise.js";import{isAbortError as d}from"../../../core/promiseUtils.js";import{watch as n,sync as o,initial as l}from"../../../core/reactiveUtils.js";import{property as h,subclass as u}from"../../../core/accessorSupport/decorators.js";import{m as _}from"../../../chunks/vec32.js";import{UpdatingHandles as c}from"../../../core/support/UpdatingHandles.js";import{projectBoundingRect as g}from"../../../geometry/projection/projectBoundingRect.js";import{create as p}from"../../../geometry/support/aaBoundingRect.js";import{viewingModeFromString as m}from"../../../views/ViewingMode.js";import{I3SClientNodeLoader as y}from"../../../views/3d/layers/i3s/I3SClientNodeLoader.js";import{I3SDataRequester as f}from"../../../views/3d/layers/i3s/I3SDataRequester.js";import{addCallback as x}from"../../../views/3d/layers/i3s/I3SFrameTask.js";import{I3SIndex as N}from"../../../views/3d/layers/i3s/I3SIndex.js";import b from"../../../views/3d/layers/i3s/I3SLodHandling.js";import w from"../../../views/3d/layers/i3s/I3SNodeLoader.js";import{getVertexCrs as v,getIndexCrs as L,findIntersectingNodes as D}from"../../../views/3d/layers/i3s/I3SUtil.js";import C from"../../../views/3d/layers/i3s/I3SViewportQueries.js";import{toBoundingRect as V}from"../../../views/3d/support/extentUtils.js";import{minQuality as A}from"../../../views/3d/support/MemoryController.js";import{PromiseQueue as I}from"../../../views/support/PromiseQueue.js";import{noBudget as M}from"../../../views/support/Scheduler.js";const F=100,O=2,q=1e4,P=1e-4,R=1.2,S=500,G=1.5;let U=class extends(a(t)){get isMeshPyramid(){return"mesh-pyramids"===this.layer.profile||"MeshPyramid"===this.layer.store?.lodType}get isGraphics3D(){return"points"===this.layer.profile}get useMaximumNumberOfFeatures(){return!this.isMeshPyramid&&(null==this.layer.priority||"High"===this.layer.priority)}get indexRequester(){return new f(this.layer.customParameters,this.layer.apiKey)}get dataRequester(){return new f(this.layer.customParameters,this.layer.apiKey)}get crsVertex(){return v(this.layer)}get crsIndex(){return L(this.layer)}get layer(){return this.layerView.i3slayer}get updating(){return this.running||this._updatingHandles.updating}get rootNodeVisible(){if(this._index){const e=this._index.rootNode;if(e)return this._updateViewData(),this._index.isNodeVisible(e.index)}return!0}get index(){return this._index}get requiredAttributes(){return this._requiredAttributes}constructor(e){super(e),this.featureTarget=5e4,this.fixedFeatureTarget=!1,this._updatingHandles=new c,this.running=!0,this.updatingProgress=1,this.leavesReached=!1,this.worker=null,this._featureLOD=1,this._stableFeatureLOD=!1,this._isIdle=!1,this._cameraDirty=!0,this._invisibleDirty=!1,this._newLoadingNodes=new r({deallocator:null}),this._modificationsNodeFilteringArray=new r,this._downloadingCount=0,this._loadingNodes=new Map,this._updatingNodes=new Map,this._progressMaxNumNodes=1,this._requiredAttributes=new Array,this._requiredAttributesDirty=!0,this._updatesDisabled=!1,this.disableIDBCache=!1,this._disableMemCache=!1,this._restartNodeLoading=!1,this._fields=null,this._attributeStorageInfo=null,this._idleQueue=new I,this._elevationUpdateNodes=new r({deallocator:null}),this._errorCount=0}initialize(){const{layerView:e,layer:t}=this;this._disableMemCache=!e.loadCachedGPUData||!e.addCachedGPUData,this._lodHandling=new b(e),this._defaultGeometrySchema=t.store.defaultGeometrySchema,this.disableIDBCache=!!has("disable-feature:idb-cache"),"fields"in t&&(this._fields=t.fields,this._attributeStorageInfo=t.attributeStorageInfo),this.addResolvingPromise(Promise.all([t.indexInfo,t.when(),e.when()]).then(([s])=>{if(this.destroyed||!e||e.destroyed||!s)return;const{view:r,clientGeometry:a}=e;if(this._setClippingArea(r.clippingArea),this.addHandles([this._updatingHandles.add(()=>r?.pointsOfInterest?.focus?.renderLocation,e=>this._pointOfInterestChanged(e),{initial:!0,equals:_}),n(()=>r.quality,()=>this._setCameraDirty(),o),this._updatingHandles.add(()=>2===r.state.mode,t=>{this._updateIdleState(t),t&&(this._index?.resetFailedNodes(),e.contentVisible||this._updateViewData())},l),this._updatingHandles.add(()=>e.contentVisible,e=>{e&&this._index?.invalidateAllElevationRanges(),this.restartNodeLoading()},l),x(e.view.resourceController.scheduler,this),this._updatingHandles.add(()=>[this.featureTarget,this.fixedFeatureTarget],()=>{this._setCameraDirty(),this._stableFeatureLOD=!1}),this._updatingHandles.add(()=>r.state?.contentCamera,()=>this._setCameraDirty()),this._updatingHandles.add(()=>t.elevationInfo,e=>this._elevationInfoChanged(e),o),this._updatingHandles.add(()=>e.lodFactor,()=>this._setCameraDirty()),this._updatingHandles.add(()=>e.availableFields,()=>this._requiredFieldsChange()),this._updatingHandles.add(()=>e.holeFilling,e=>null!=this._index&&(this._index.holeFilling=e))]),this._viewportQueries=new C(this.crsIndex,r.renderCoordsHelper,r.state.contentCamera,!r.state.fixedContentCamera||this.isGraphics3D,this._clippingArea,this.isMeshPyramid?r.groundView:r.elevationProvider,m(r.viewingMode),this.layer.elevationInfo,{progressiveLoadFactor:this._getProgressiveLoadFactor(),screenspaceErrorBias:this._lod,angleDependentLoD:this._lod<.5}),this._clientNodeLoader=new y(this.layer.uid,{indexSR:this.crsIndex,vertexSR:this.crsVertex,renderSR:r.renderCoordsHelper.spatialReference},r.resourceController.memoryController,this.worker),this._index=new N(m(r.viewingMode),t,s,this.indexRequester,this._clientNodeLoader,this._viewportQueries,i.getLogger(this),e.holeFilling,t=>e.isNodeLoaded(t),t=>e.isNodeReloading(t),e=>this._shouldLoadNode(e),e=>this._enableFromGPUCache(e,1),e=>this._needsUpdate(e),t=>e.computeVisibilityObb?.(t)??null,e?.computeNodeFiltering?t=>e.computeNodeFiltering(t):void 0),this._index.updateElevationInfo(this.layer.elevationInfo,this.isMeshPyramid||this.isGraphics3D),this._index.imModificationsChanged(!!e.hasModifications),this._index.layerFilterChanged(!!e.hasGeometryFilter),null!=a){for(const e of a)this._addMesh(e.mesh,e.oid);this.addHandles(a.on("change",e=>{for(const t of e.removed)this._removeMesh(t.oid);for(const t of e.added)this._addMesh(t.mesh,t.oid)}))}this._startNodeLoading()}))}updateNodeModificationStatus(e){const t=this._index,i=this.layerView;null!=t&&i?.updateNodeModificationStatus&&(this._modificationsNodeFilteringArray.clear(),e.forAll(e=>{const i=t.getNode(e);null!=i&&this._modificationsNodeFilteringArray.push(i)}),i.updateNodeModificationStatus(this._modificationsNodeFilteringArray),this._invisibleDirty=!0)}destroy(){this.cancelNodeLoading(),this._updatingHandles.destroy(),this._nodeLoader=null,H.prune(),this._newLoadingNodes.prune(),this._modificationsNodeFilteringArray.prune(),this._elevationUpdateNodes.prune(),this._index=null,this._lodHandling=s(this._lodHandling),this._nodeLoader=null,this._clientNodeLoader=null,this._viewportQueries=null,this._set("worker",null)}get viewportQueries(){return this._viewportQueries}_getRequiredAttributes(){if(null==this._attributeStorageInfo||!this._fields||!this.layerView.availableFields)return[];const e=this._attributeStorageInfo,t=this._fields,i=this.layer.objectIdField;return this.layerView.availableFields.map(i=>{const s=j(e,i),r=j(t,i);return s>=0&&r>=0?{index:s,name:t[r].name,field:t[r],attributeStorageInfo:e[s]}:null}).filter(e=>null!=e&&e.name!==i)}_requiredFieldsChange(){const e=this._getRequiredAttributes();Q(this._requiredAttributes,e)||(this._requiredAttributes=e,this._requiredAttributesDirty=!1,this.restartNodeLoading())}requestUpdate(){this._requiredAttributesDirty=!0,this.restartNodeLoading()}_setClippingArea(e){const t=p();V(e,t,this.layerView.view.renderSpatialReference)?this._clippingArea=t:this._clippingArea=null}_pointOfInterestChanged(e){null!=this._viewportQueries&&(this._viewportQueries.setPointOfInterest(e),null!=this._index&&this._index.requestUpdate())}updateClippingArea(e){this._setClippingArea(e),null!=this._viewportQueries&&null!=this._index&&(this._viewportQueries.updateClippingArea(this._clippingArea),this._index.invalidateVisibilityCache()),this._setCameraDirty()}_setCameraDirty(){this._cameraDirty=!0,this._lodHandling.setLodGlobalDirty(),this._evaluateRunning()}_addMesh(e,t){if(null==this._index)return;const i=this._clientNodeLoader.createMeshNodeInfo(e,t),s=this._index.addClientNodeToIndex(i.id,i.mbs);this._clientNodeLoader.addMeshNode(s,i),this._evaluateRunning(),this.notifyChange("rootNodeVisible")}_removeMesh(e){const t=this._clientNodeLoader.getMeshNodeIndex(e);if(null!=t){if(null==this._index)throw new Error("delayed removal of client side i3s node geometry not supported yet.");{const e=(e,t)=>{this.layerView.removeNode(t),this._clientNodeLoader.removeNode(e),this.layerView.deleteCachedNodeData&&null!=e&&this.layerView.deleteCachedNodeData(e),this.layerView.deleteCachedGPUData?.(this.layerView.loadCachedGPUData?.(t))},i=(e,t,i)=>{this._clientNodeLoader.updateNodeIndex(e,t,i),this.layerView.updateNodeIndex&&this.layerView.updateNodeIndex(t,i)};this._index.removeClientNodeFromIndex(t,e,i),this.notifyChange("rootNodeVisible")}}}updateElevationChanged(e,t){const i=this._index;if(null==i?.rootNode||null==t)return null;this.crsIndex.equals(t)||(g(e,t,T,this.crsIndex),e=T);const s=this._elevationUpdateNodes;return s.clear(),D(e,i.rootNode,i,e=>s.push(e.index)),s.length&&(s.forAll(e=>i.updateElevationChanged(e)),this._setCameraDirty()),s}removeAllGeometryObbs(){null!=this._index&&this._index.removeAllGeometryObbs()}getRenderMbs(e){return null!=this._viewportQueries?this._viewportQueries.getServiceMbsInRenderSR(e):null}_elevationInfoChanged(e){null!=this._index&&(this._index.updateElevationInfo(e,this.isMeshPyramid||this.isGraphics3D),this._setCameraDirty())}restartNodeLoading(){this._restartNodeLoading=!0,this.cancelNodeLoading(),this._evaluateRunning()}schedule(e,t){const i=this._idleQueue.push(e,t);return this._evaluateRunning(),i}reschedule(e,t){const i=this._idleQueue.unshift(e,t);return this._evaluateRunning(),i}get _isIntegratedMesh(){return"integrated-mesh"===this.layer.type}get unloadedMemoryEstimate(){return null!=this._index&&this.layerView.contentVisible?this._index.unloadedMemoryEstimate*this._lodDropFactor:0}async _loadNodeData(e,t){return e.index<0?this._clientNodeLoader.loadNodeData(e.id,t):this._nodeLoader.loadNodeData(e,t)}async _loadAttributes(e,t,i){return(e.index<0?this._clientNodeLoader:this._nodeLoader).loadAttributes(e,t,i)}get indexDepth(){return null!=this._index?this._index.maxLevel:0}set disableMemCache(e){this.layerView.loadCachedGPUData&&this.layerView.addCachedGPUData?this._disableMemCache=e:this._disableMemCache=!0}runTask(e,t){return this.layerView.contentVisible?this.layerView.visible&&null!=this._index?(this._processWithErrorLogging(e,t),this._index.maxPriority):-1/0:(this._updateViewData(),this._evaluateRunning(),-1/0)}_processWithErrorLogging(e,t){try{this._process(e,t)}catch(s){this._errorCount<50?i.getLogger(this).error(`Error during processing: ${s} at ${s.stack}`):50===this._errorCount&&i.getLogger(this).error("Too many errors for this layer. Further errors will not be displayed."),this._errorCount++}}_process(e,t){this._restartNodeLoading&&this._startNodeLoading(),null!=this._nodeLoader&&null!=this._index&&(this._updateViewData(),this._invisibleDirty&&this._removeInvisibleNodes(e)&&(this._invisibleDirty=!1),this._isIntegratedMesh&&(e.enabled=!1),e.run(()=>this._processIndex(e)),this._updateFeatureLOD(),e.run(()=>this._processCache(e)),this._isIntegratedMesh&&(e.enabled=!0),e.run(()=>this._processNodes(e,t)),this._idleQueue.runTask(e),e.run(()=>this._prefetchIndex()),t.numIndexLoading+=this._index.indexLoading,t.numNodesLoading+=this._downloadingCount,e.run(()=>this._lodHandling.lodGlobalHandling(e)),this._evaluateRunning())}_processIndex(e){if(null==this._index)return!1;if(this._index.dirty){this._newLoadingNodes.clear(),this._index.update(Array.from(this._loadingNodes.keys()),e,e=>this.updateNodeModificationStatus(e)),this._disableMemCache||(this._newLoadingNodes.pushArray(this._index.updates.add.data,this._index.updates.add.length),this._newLoadingNodes.pushArray(this._index.updates.missing.data,this._index.updates.missing.length));const t=this._index.featureEstimate.leavesReached;this._index.isLoading||t===this._get("leavesReached")||this._set("leavesReached",t)}return this._index.load()}_prefetchIndex(){return!(null==this._index||this._loadingNodes.size>0||this._index.updates.add.length>0)&&this._index.prefetch()}_updateFeatureLOD(){if(!this.useMaximumNumberOfFeatures||null==this._index||null==this._viewportQueries)return;const e=!this._index.isLoading,t=this.featureTarget*this._baseLOD,i=this._index.featureEstimate;if(i.estimate=i.estimate||t/2,this._index.indexMissing>S){if(this._featureLOD<=P)return;this._featureLOD/=G,this._stableFeatureLOD=!1}else if(e&&i.estimate<t){if(i.leavesReached||this._featureLOD>=q||this._stableFeatureLOD)return;const e=Math.min(10,Math.max(t/i.estimate,1.001));this._featureLOD*=e;const s=this._lod,r=this._index.checkFeatureTarget(t,s);r!==s&&(this._featureLOD=r/this._baseLOD,this._stableFeatureLOD=!0)}else{if(!(i.estimate>t*R||e&&i.estimate>t))return;if(this._featureLOD<=P)return;this._featureLOD/=1+.25*(i.estimate/t-1),this._stableFeatureLOD=!1}this._featureLOD=Math.min(q,Math.max(P,this._featureLOD)),this._viewportQueries.updateScreenSpaceErrorBias(this._lod),this._index.requestUpdate()}_processCache(e){const t=this._index;if(null==t)return!1;for(;this._newLoadingNodes.length>0&&!e.done;){const i=this._newLoadingNodes.pop();for(let s=t.getParent(i);null!=s&&!this.layerView.isNodeLoaded(s.index);s=t.getParent(s.index))if(this._enableFromGPUCache(s,0)){e.madeProgress();break}}return e.hasProgressed}_processNodes(e,t){if(null==this._index)return!1;let i=(this._isIdle?F:O)-this._loadingNodes.size;const s=this._index.updates;for(s.cancel.forEach(this._cancelNode,this),s.cancel=[];s.remove.length>0&&!e.done;)this.layerView.removeNode(s.remove.pop()),e.madeProgress();for(;s.update.length>0&&!e.done;){const t=this._index.getNode(s.update.pop());null!=t&&(this._updateLoadedNode(t),e.madeProgress())}for(;s.add.length>0&&!e.done&&i>0;){--i;const r=this._index.getNode(s.add.back());if(null==r||2!==r.cacheState&&!this._hasNodeLoadToken(t))break;s.add.pop(),this._loadNode(r),e.madeProgress()}return e.hasProgressed}_cancelAllNodes(){this._loadingNodes.forEach(e=>e.abort()),this._loadingNodes.clear(),this._updatingNodes.forEach(e=>e.abort()),this._updatingNodes.clear()}_cancelNode(e){const t=this._loadingNodes.get(e);t&&(t.abort(),this._loadingNodes.delete(e))}_hasNodeLoadToken(e){return!(!this._isIdle&&e.numNodesLoading+this._loadingNodes.size>=O)&&(null==this.index||!this.dataRequester.isFull(this._index.urlPrefix))}_evaluateRunning(){let e=!1,t=0;if(this.layerView){if(this.layerView.contentVisible){const i=(this._index?.indexMissing??0)+3*(this._index?.updates.add.length??0)+2*this._loadingNodes.size;e=!!(i>0||this._updatingNodes.size>0||this._restartNodeLoading||this._cameraDirty||this._idleQueue.updating||this._lodHandling&&this._lodHandling.requiresLODGlobalHandling||null!=this._index&&this._index.isPrefetching),0===i&&(this._progressMaxNumNodes=1),this._progressMaxNumNodes=Math.max(i,this._progressMaxNumNodes),t=1-i/this._progressMaxNumNodes}else e=this._cameraDirty,t=e?0:1;this.running=e,this.updatingProgress=t}}_updateViewData(){if(!this._cameraDirty||null==this._index||null==this._viewportQueries)return;const e=this.layerView.view,{contentCamera:t,fixedContentCamera:i}=e.state;this._viewportQueries.updateCamera(t,!i||this.isGraphics3D),this._viewportQueries.setPointOfInterest(e.pointsOfInterest.focus.renderLocation),this._viewportQueries.updateScreenSpaceErrorBias(this._lod),this._index.invalidateVisibilityCache(),this._index.requestUpdate(),this._stableFeatureLOD=!1,this._invisibleDirty=!0,this._cameraDirty=!1,this.notifyChange("rootNodeVisible")}_getProgressiveLoadFactor(){return this.layerView.view.quality<1?1:this.layerView.progressiveLoadFactor}get _lod(){return this._featureLOD*this._baseLOD}get _baseLOD(){const e=this.layerView.lodFactor;return this.fixedFeatureTarget?1:(e>0?e:1)*this.layerView.view.quality}get _lodDropFactor(){if(this.fixedFeatureTarget)return 1;return(Math.min(this.layerView.view.quality,.5)-A)/(.5-A)}isGeometryVisible(e){return!!this._index?.isGeometryVisible(e.index)}updateVisibility(e){this._index?.invalidateNodeVisibilityCache(e)}invalidateGeometryVisibility(e){this._index?.invalidateGeometryVisibility(e)}invalidateVisibilityObbs(){this._index?.invalidateVisibilityObbs()}modificationsChanged(){this._index?.imModificationsChanged(!!this.layerView.hasModifications),this._invisibleDirty=!0}_shouldLoadNode(e){return!(!this._lodHandling.shouldLoadNode(e)||this._shouldDropNode(e))&&!(null==this._index||!this._index.isGeometryVisible(e.index))}_shouldDropNode(e){if(null==this._viewportQueries)return!1;const t=this._lodDropFactor;if(t>=1||!this._lodHandling.hasNoVisibleChildren(e))return!1;return Math.abs(this._viewportQueries.calcCameraDistanceToCenter(e))-this._viewportQueries.minDistance>(this._viewportQueries.maxDistance-this._viewportQueries.minDistance)*t}_startNodeLoading(){this._restartNodeLoading=!1;const e=this._index;if(this._updatesDisabled||null==e||null==this._viewportQueries)return;this._updateViewData(),this._requiredAttributesDirty&&(this._requiredAttributes=this._getRequiredAttributes(),this._requiredAttributesDirty=!1);const t={textureEncodings:this.layerView.supportedTextureEncodings,textureUsageMask:this.layerView.rendererTextureUsage,loadFeatureData:this.useMaximumNumberOfFeatures};this._nodeLoader=new w(this.layer,this.dataRequester,i.getLogger(this),this._defaultGeometrySchema,this._requiredAttributes,t),e.requestUpdate(),this._lodHandling.startNodeLoading((e,t)=>this._removeNodes(e,t,1),e,{maxLodLevel:this._viewportQueries.maxLodLevel}),this._evaluateRunning()}isNodeLoading(){return null!=this._nodeLoader&&null!=this._index}cancelNodeLoading(){this.isNodeLoading()&&(this.indexRequester.cancelAll(),this.dataRequester.cancelAll(),this._idleQueue.cancelAll(),this._cancelAllNodes(),this._nodeLoader=null,this._evaluateRunning())}_removeInvisibleNodes(e){const t=this._index;if(null==t||null==this._viewportQueries)return!1;H.clear(),this.layerView.getLoadedNodeIndices(H);const i=0===this._viewportQueries.maxDistance,s=i?()=>!1:e=>this._shouldDropNode(e);return H.filterInPlace(e=>{const i=t.getNode(e);return null==i||!t.isGeometryVisible(e)||s(i)}),H.length>0&&this._lodHandling.setLodGlobalDirty(),this._removeNodes(H,e,0),!(i&&this._lodDropFactor<1)&&(0===H.length||(H.clear(),!1))}markNodeToRemove(e){H.push(e)}removeMarkedNodes(){this._removeNodes(H,M,0)}_removeNodes(e,t,i){if(0!==e.length&&!t.done)for(null!=this._index&&this._index.requestUpdate();e.length>0&&!t.done;){const s=e.pop(),r=this._index;1===i&&this.layerView.nodeFadeoutEnabled&&null!=r&&r.isGeometryVisible(s)?this.layerView.fadeNode(s,1,!0):this.layerView.removeNode(s),t.madeProgress()}}_needsUpdate(e){if(e.resources.isEmpty||this._updatingNodes.has(e.index))return!1;const t=this.layerView.getLoadedAttributes(e.index);return null!=t&&t!==this._requiredAttributes}async _updateLoadedNode(e){const t=new AbortController;this._updatingNodes.set(e.index,t),this._evaluateRunning();try{const i=this.layerView.getLoadedAttributes(e.index),s=Q(i,this._requiredAttributes)?this.layerView.getAttributeData(e.index):await this._loadAttributes(e,this._requiredAttributes,t.signal);await this.schedule(()=>this.layerView.updateAttributes(e.index,{loadedAttributes:this._requiredAttributes,attributeData:s},t.signal),t.signal)}catch(i){if(!d(i))return this.layerView.updateAttributes(e.index,{loadedAttributes:this._requiredAttributes,attributeData:{}},t.signal)}this._updatingNodes.delete(e.index),this._evaluateRunning()}_loadNode(e){if(this._loadingNodes.has(e.index))return void i.getLogger(this).error("already loading node "+e.index);const t=new AbortController;this._loadingNodes.set(e.index,t),this._evaluateRunning(),this._loadAndAddNode(e,t.signal).then(i=>{i&&null!=this._index&&this._loadingNodes.get(e.index)===t&&(this._loadingNodes.delete(e.index),this._index.requestUpdate())}).catch(e=>{if(!d(e))throw e}).finally(()=>{this._loadingNodes.get(e.index)===t&&this._loadingNodes.delete(e.index),this._evaluateRunning()})}_loadAndAddNode(e,t){return 1===e.cacheState?this._loadUncached(e,t).then(()=>!1):this._loadCached(e,t).then(t=>!t&&(e.cacheState=1,!0)).catch(t=>!d(t)&&(e.cacheState=1,!0))}_enableFromGPUCache(e,t){if(this._disableMemCache||null==this._index)return!1;if(0===t&&!this._index.useNodeAsHole(e.index))return!0;const i=this._loadCachedGPUData(e);return!!i&&(this.layerView.addCachedGPUData(e,i,t),this._nodeAdded(),!0)}_loadCachedGPUData(e){const t=this.layerView.loadCachedGPUData(e.index);return null!=t?.attributeInfo&&Q(t.attributeInfo.loadedAttributes,this._requiredAttributes)?t:(this.layerView.deleteCachedGPUData(t),null)}_nodeAdded(){null!=this._index&&this._index.requestUpdate(),this._lodHandling.setLodGlobalDirty(),this._evaluateRunning()}updateLoadStatus(e,t){const i=this._index;null!=i&&i.updateChildrenLoaded(e,t?1:-1)}async _loadCached(e,t){if(this._enableFromGPUCache(e,1))return!0;const i=this.layerView;if(this.disableIDBCache||!i.loadCachedNodeData||!i.addCachedNodeData)return!1;const s=(t,i)=>this._nodeLoader.loadTextures(e,t,i),r=t=>this._clientNodeLoader.loadTextures(e,t),a=e.index>=0?s:r,d=await this.schedule(()=>i.loadCachedNodeData(e,t,a),t);if(null==d)return!1;const n=this._requiredAttributes,o=await this.reschedule(()=>this._loadAttributes(e,n,t),t);return await this.reschedule(()=>i.addCachedNodeData(e,d,{loadedAttributes:n,attributeData:o},t),t),this._nodeAdded(),!0}_loadUncached(e,t){return this._downloadingCount++,this._loadNodeData(e,t).catch(e=>{throw this._downloadingCount--,e}).then(i=>(this._downloadingCount--,this.schedule(()=>this.layerView.addNode(e,i,t),t))).then(()=>{this._nodeAdded(),e.cacheState=2}).catch(t=>{if(!d(t))throw i.getLogger(this).error("#loadNodeData()",this.layer,`Failed to load node '${e.id}'`,t),e.failed=!0,this._index?.requestUpdate(),t})}_updateIdleState(e){e!==this._isIdle&&(this._isIdle=e,this._evaluateRunning())}get test(){}notifyLODUpdate(){this._lodHandling.setLodGlobalDirty(),this._evaluateRunning(),null!=this._index&&this._index.requestUpdate()}geometryFilterChanged(e){const t=this._index;null!=t&&t.layerFilterChanged(e),this._setCameraDirty()}};e([h({readOnly:!0})],U.prototype,"isMeshPyramid",null),e([h({readOnly:!0})],U.prototype,"isGraphics3D",null),e([h({readOnly:!0})],U.prototype,"useMaximumNumberOfFeatures",null),e([h({readOnly:!0})],U.prototype,"indexRequester",null),e([h({readOnly:!0})],U.prototype,"dataRequester",null),e([h({readOnly:!0})],U.prototype,"crsVertex",null),e([h({readOnly:!0})],U.prototype,"crsIndex",null),e([h()],U.prototype,"featureTarget",void 0),e([h()],U.prototype,"fixedFeatureTarget",void 0),e([h()],U.prototype,"layerView",void 0),e([h()],U.prototype,"layer",null),e([h()],U.prototype,"_updatingHandles",void 0),e([h()],U.prototype,"updating",null),e([h()],U.prototype,"running",void 0),e([h()],U.prototype,"updatingProgress",void 0),e([h({readOnly:!0})],U.prototype,"leavesReached",void 0),e([h({constructOnly:!0})],U.prototype,"worker",void 0),e([h({readOnly:!0,dependsOn:[]})],U.prototype,"rootNodeVisible",null),U=e([u("esri.layers.graphics.controllers.I3SOnDemandController")],U);const H=new r({deallocator:null});function Q(e,t){return null!=e&&e.length===t.length&&e.every(e=>j(t,e.name)>=0)}function j(e,t){const i=t.toLowerCase();for(let s=0;s<e.length;s++)if(e[s].name.toLowerCase()===i)return s;return-1}const T=p();export{U as default};
5
+ import{__decorate as e}from"tslib";import t from"../../../core/Accessor.js";import has from"../../../core/has.js";import i from"../../../core/Logger.js";import{destroyMaybe as s}from"../../../core/maybe.js";import r from"../../../core/PooledArray.js";import{EsriPromiseMixin as a}from"../../../core/Promise.js";import{isAbortError as d}from"../../../core/promiseUtils.js";import{watch as n,sync as o,initial as l}from"../../../core/reactiveUtils.js";import{property as h,subclass as u}from"../../../core/accessorSupport/decorators.js";import{m as _}from"../../../chunks/vec32.js";import{UpdatingHandles as c}from"../../../core/support/UpdatingHandles.js";import{projectBoundingRect as g}from"../../../geometry/projection/projectBoundingRect.js";import{create as p}from"../../../geometry/support/aaBoundingRect.js";import{viewingModeFromString as m}from"../../../views/ViewingMode.js";import{I3SClientNodeLoader as y}from"../../../views/3d/layers/i3s/I3SClientNodeLoader.js";import{I3SDataRequester as f}from"../../../views/3d/layers/i3s/I3SDataRequester.js";import{addCallback as x}from"../../../views/3d/layers/i3s/I3SFrameTask.js";import{I3SIndex as N}from"../../../views/3d/layers/i3s/I3SIndex.js";import b from"../../../views/3d/layers/i3s/I3SLodHandling.js";import v from"../../../views/3d/layers/i3s/I3SNodeLoader.js";import{getVertexCrs as w,getIndexCrs as L,findIntersectingNodes as D}from"../../../views/3d/layers/i3s/I3SUtil.js";import C from"../../../views/3d/layers/i3s/I3SViewportQueries.js";import{toBoundingRect as V}from"../../../views/3d/support/extentUtils.js";import{minQuality as A}from"../../../views/3d/support/MemoryController.js";import{PromiseQueue as I}from"../../../views/support/PromiseQueue.js";import{noBudget as M}from"../../../views/support/Scheduler.js";const F=100,O=2,q=1e4,P=1e-4,R=1.2,S=500,G=1.5;let U=class extends(a(t)){get isMeshPyramid(){return"mesh-pyramids"===this.layer.profile||"MeshPyramid"===this.layer.store?.lodType}get isGraphics3D(){return"points"===this.layer.profile}get useMaximumNumberOfFeatures(){return!this.isMeshPyramid&&(null==this.layer.priority||"High"===this.layer.priority)}get indexRequester(){return new f(this.layer.customParameters,this.layer.apiKey)}get dataRequester(){return new f(this.layer.customParameters,this.layer.apiKey)}get crsVertex(){return w(this.layer)}get crsIndex(){return L(this.layer)}get layer(){return this.layerView.i3slayer}get updating(){return this.running||this._updatingHandles.updating}get rootNodeVisible(){if(this._index){const e=this._index.rootNode;if(e)return this._updateViewData(),this._index.isNodeVisible(e.index)}return!0}get index(){return this._index}get requiredAttributes(){return this._requiredAttributes}constructor(e){super(e),this.featureTarget=5e4,this.fixedFeatureTarget=!1,this._updatingHandles=new c,this.running=!0,this.updatingProgress=1,this.leavesReached=!1,this.worker=null,this._featureLOD=1,this._stableFeatureLOD=!1,this._isIdle=!1,this._cameraDirty=!0,this._invisibleDirty=!1,this._newLoadingNodes=new r({deallocator:null}),this._modificationsNodeFilteringArray=new r,this._downloadingCount=0,this._loadingNodes=new Map,this._updatingNodes=new Map,this._progressMaxNumNodes=1,this._requiredAttributes=new Array,this._requiredAttributesDirty=!0,this._updatesDisabled=!1,this.disableIDBCache=!1,this._disableMemCache=!1,this._restartNodeLoading=!1,this._fields=null,this._attributeStorageInfo=null,this._idleQueue=new I,this._elevationUpdateNodes=new r({deallocator:null}),this._errorCount=0}initialize(){const{layerView:e,layer:t}=this;this._disableMemCache=!e.loadCachedGPUData||!e.addCachedGPUData,this._lodHandling=new b(e),this._defaultGeometrySchema=t.store.defaultGeometrySchema,this.disableIDBCache=!!has("disable-feature:idb-cache"),"fields"in t&&(this._fields=t.fields,this._attributeStorageInfo=t.attributeStorageInfo),this.addResolvingPromise(Promise.all([t.indexInfo,t.when(),e.when()]).then(([s])=>{if(this.destroyed||!e||e.destroyed||!s)return;const{view:r,clientGeometry:a}=e;if(this._setClippingArea(r.clippingArea),this.addHandles([this._updatingHandles.add(()=>r?.pointsOfInterest?.focus?.renderLocation,e=>this._pointOfInterestChanged(e),{initial:!0,equals:_}),n(()=>r.quality,()=>this._setCameraDirty(),o),this._updatingHandles.add(()=>2===r.state.mode,t=>{this._updateIdleState(t),t&&(this._index?.resetFailedNodes(),e.contentVisible||this._updateViewData())},l),this._updatingHandles.add(()=>e.contentVisible,e=>{e&&this._index?.invalidateAllElevationRanges(),this.restartNodeLoading()},l),x(e.view.resourceController.scheduler,this),this._updatingHandles.add(()=>[this.featureTarget,this.fixedFeatureTarget],()=>{this._setCameraDirty(),this._stableFeatureLOD=!1}),this._updatingHandles.add(()=>r.state?.contentCamera,()=>this._setCameraDirty()),this._updatingHandles.add(()=>t.elevationInfo,e=>this._elevationInfoChanged(e),o),this._updatingHandles.add(()=>e.lodFactor,()=>this._setCameraDirty()),this._updatingHandles.add(()=>e.availableFields,()=>this._requiredFieldsChange()),this._updatingHandles.add(()=>e.holeFilling,e=>null!=this._index&&(this._index.holeFilling=e))]),this._viewportQueries=new C(this.crsIndex,r.renderCoordsHelper,r.state.contentCamera,!r.state.fixedContentCamera||this.isGraphics3D,this._clippingArea,this.isMeshPyramid?r.groundView:r.elevationProvider,m(r.viewingMode),this.layer.elevationInfo,{progressiveLoadFactor:this._getProgressiveLoadFactor(),screenspaceErrorBias:this._lod,angleDependentLoD:this._lod<.5}),this._clientNodeLoader=new y(this.layer.uid,{indexSR:this.crsIndex,vertexSR:this.crsVertex,renderSR:r.renderCoordsHelper.spatialReference},r.resourceController.memoryController,this.worker),this._index=new N(m(r.viewingMode),t,s,this.indexRequester,this._clientNodeLoader,this._viewportQueries,i.getLogger(this),e.holeFilling,t=>e.isNodeLoaded(t),t=>e.isNodeReloading(t),e=>this._shouldLoadNode(e),e=>this._enableFromGPUCache(e,1),e=>this._needsUpdate(e),t=>e.computeVisibilityObb?.(t)??null,e?.computeNodeFiltering?t=>e.computeNodeFiltering(t):void 0),this._index.updateElevationInfo(this.layer.elevationInfo,this.isMeshPyramid||this.isGraphics3D),this._index.imModificationsChanged(!!e.hasModifications),this._index.layerFilterChanged(!!e.hasGeometryFilter),null!=a){for(const e of a)this._addMesh(e.mesh,e.oid);this.addHandles(a.on("change",e=>{for(const t of e.removed)this._removeMesh(t.oid);for(const t of e.added)this._addMesh(t.mesh,t.oid)}))}this._startNodeLoading()}))}updateNodeModificationStatus(e){const t=this._index,i=this.layerView;null!=t&&i?.updateNodeModificationStatus&&(this._modificationsNodeFilteringArray.clear(),e.forAll(e=>{const i=t.getNode(e);null!=i&&this._modificationsNodeFilteringArray.push(i)}),i.updateNodeModificationStatus(this._modificationsNodeFilteringArray),this._invisibleDirty=!0)}destroy(){this.cancelNodeLoading(),this._updatingHandles.destroy(),this._nodeLoader=null,H.prune(),this._newLoadingNodes.prune(),this._modificationsNodeFilteringArray.prune(),this._elevationUpdateNodes.prune(),this._index=null,this._lodHandling=s(this._lodHandling),this._nodeLoader=null,this._clientNodeLoader=null,this._viewportQueries=null,this._set("worker",null)}get viewportQueries(){return this._viewportQueries}_getRequiredAttributes(){if(null==this._attributeStorageInfo||!this._fields||!this.layerView.availableFields)return[];const e=this._attributeStorageInfo,t=this._fields,i=this.layer.objectIdField;return this.layerView.availableFields.map(i=>{const s=j(e,i),r=j(t,i);return s>=0&&r>=0?{index:s,name:t[r].name,field:t[r],attributeStorageInfo:e[s]}:null}).filter(e=>null!=e&&e.name!==i)}_requiredFieldsChange(){const e=this._getRequiredAttributes();Q(this._requiredAttributes,e)||(this._requiredAttributes=e,this._requiredAttributesDirty=!1,this.restartNodeLoading())}requestUpdate(){this._requiredAttributesDirty=!0,this.restartNodeLoading()}_setClippingArea(e){const t=p();V(e,t,this.layerView.view.renderSpatialReference)?this._clippingArea=t:this._clippingArea=null}_pointOfInterestChanged(e){null!=this._viewportQueries&&(this._viewportQueries.setPointOfInterest(e),null!=this._index&&this._index.requestUpdate())}updateClippingArea(e){this._setClippingArea(e),null!=this._viewportQueries&&null!=this._index&&(this._viewportQueries.updateClippingArea(this._clippingArea),this._index.invalidateVisibilityCache()),this._setCameraDirty()}_setCameraDirty(){this._cameraDirty=!0,this._lodHandling.setLodGlobalDirty(),this._evaluateRunning()}_addMesh(e,t){if(null==this._index)return;const i=this._clientNodeLoader.createMeshNodeInfo(e,t),s=this._index.addClientNodeToIndex(i.id,i.mbs);this._clientNodeLoader.addMeshNode(s,i),this._evaluateRunning(),this.notifyChange("rootNodeVisible")}_removeMesh(e){const t=this._clientNodeLoader.getMeshNodeIndex(e);if(null!=t){if(null==this._index)throw new Error("delayed removal of client side i3s node geometry not supported yet.");{const e=(e,t)=>{this.layerView.removeNode(t),this._clientNodeLoader.removeNode(e),this.layerView.deleteCachedNodeData&&null!=e&&this.layerView.deleteCachedNodeData(e),this.layerView.deleteCachedGPUData?.(this.layerView.loadCachedGPUData?.(t))},i=(e,t,i)=>{this._clientNodeLoader.updateNodeIndex(e,t,i),this.layerView.updateNodeIndex&&this.layerView.updateNodeIndex(t,i)};this._index.removeClientNodeFromIndex(t,e,i),this.notifyChange("rootNodeVisible")}}}updateElevationChanged(e,t){const i=this._index;if(null==i?.rootNode||null==t)return null;this.crsIndex.equals(t)||(g(e,t,T,this.crsIndex),e=T);const s=this._elevationUpdateNodes;return s.clear(),D(e,i.rootNode,i,e=>s.push(e.index)),s.length&&(s.forAll(e=>i.updateElevationChanged(e)),this._setCameraDirty()),s}removeAllGeometryObbs(){null!=this._index&&this._index.removeAllGeometryObbs()}getRenderMbs(e){return null!=this._viewportQueries?this._viewportQueries.getServiceMbsInRenderSR(e):null}_elevationInfoChanged(e){null!=this._index&&(this._index.updateElevationInfo(e,this.isMeshPyramid||this.isGraphics3D),this._setCameraDirty())}restartNodeLoading(){this._restartNodeLoading=!0,this.cancelNodeLoading(),this._evaluateRunning()}schedule(e,t){const i=this._idleQueue.push(e,t);return this._evaluateRunning(),i}reschedule(e,t){const i=this._idleQueue.unshift(e,t);return this._evaluateRunning(),i}get _isIntegratedMesh(){return"integrated-mesh"===this.layer.type}get unloadedMemoryEstimate(){return null!=this._index&&this.layerView.contentVisible?this._index.unloadedMemoryEstimate*this._lodDropFactor:0}async _loadNodeData(e,t){return e.index<0?this._clientNodeLoader.loadNodeData(e.id,t):this._nodeLoader.loadNodeData(e,t)}async _loadAttributes(e,t,i){return(e.index<0?this._clientNodeLoader:this._nodeLoader).loadAttributes(e,t,i)}get indexDepth(){return null!=this._index?this._index.maxLevel:0}set disableMemCache(e){this.layerView.loadCachedGPUData&&this.layerView.addCachedGPUData?this._disableMemCache=e:this._disableMemCache=!0}runTask(e,t){return this.layerView.contentVisible?this.layerView.visible&&null!=this._index?(this._processWithErrorLogging(e,t),this._index.maxPriority):-1/0:(this._updateViewData(),this._evaluateRunning(),-1/0)}_processWithErrorLogging(e,t){try{this._process(e,t)}catch(s){this._errorCount<50?i.getLogger(this).error(`Error during processing: ${s} at ${s.stack}`):50===this._errorCount&&i.getLogger(this).error("Too many errors for this layer. Further errors will not be displayed."),this._errorCount++}}_process(e,t){this._restartNodeLoading&&this._startNodeLoading(),null!=this._nodeLoader&&null!=this._index&&(this._updateViewData(),this._invisibleDirty&&this._removeInvisibleNodes(e)&&(this._invisibleDirty=!1),this._isIntegratedMesh&&(e.enabled=!1),e.run(()=>this._processIndex(e)),this._updateFeatureLOD(),e.run(()=>this._processCache(e)),this._isIntegratedMesh&&(e.enabled=!0),e.run(()=>this._processNodes(e,t)),this._idleQueue.runTask(e),e.run(()=>this._prefetchIndex()),t.numIndexLoading+=this._index.indexLoading,t.numNodesLoading+=this._downloadingCount,e.run(()=>this._lodHandling.lodGlobalHandling(e)),this._evaluateRunning())}_processIndex(e){if(null==this._index)return!1;if(this._index.dirty){this._newLoadingNodes.clear(),this._index.update(Array.from(this._loadingNodes.keys()),e,e=>this.updateNodeModificationStatus(e)),this._disableMemCache||(this._newLoadingNodes.pushArray(this._index.updates.add.data,this._index.updates.add.length),this._newLoadingNodes.pushAll(this._index.updates.missing));const t=this._index.featureEstimate.leavesReached;this._index.isLoading||t===this._get("leavesReached")||this._set("leavesReached",t)}return this._index.load()}_prefetchIndex(){return!(null==this._index||this._loadingNodes.size>0||this._index.updates.add.length>0)&&this._index.prefetch()}_updateFeatureLOD(){if(!this.useMaximumNumberOfFeatures||null==this._index||null==this._viewportQueries)return;const e=!this._index.isLoading,t=this.featureTarget*this._baseLOD,i=this._index.featureEstimate;if(i.estimate=i.estimate||t/2,this._index.indexMissing>S){if(this._featureLOD<=P)return;this._featureLOD/=G,this._stableFeatureLOD=!1}else if(e&&i.estimate<t){if(i.leavesReached||this._featureLOD>=q||this._stableFeatureLOD)return;const e=Math.min(10,Math.max(t/i.estimate,1.001));this._featureLOD*=e;const s=this._lod,r=this._index.checkFeatureTarget(t,s);r!==s&&(this._featureLOD=r/this._baseLOD,this._stableFeatureLOD=!0)}else{if(!(i.estimate>t*R||e&&i.estimate>t))return;if(this._featureLOD<=P)return;this._featureLOD/=1+.25*(i.estimate/t-1),this._stableFeatureLOD=!1}this._featureLOD=Math.min(q,Math.max(P,this._featureLOD)),this._viewportQueries.updateScreenSpaceErrorBias(this._lod),this._index.requestUpdate()}_processCache(e){const t=this._index;if(null==t)return!1;for(;this._newLoadingNodes.length>0&&!e.done;){const i=this._newLoadingNodes.pop();for(let s=t.getParent(i);null!=s&&!this.layerView.isNodeLoaded(s.index);s=t.getParent(s.index))if(this._enableFromGPUCache(s,0)){e.madeProgress();break}}return e.hasProgressed}_processNodes(e,t){if(null==this._index)return!1;let i=(this._isIdle?F:O)-this._loadingNodes.size;const s=this._index.updates;for(s.cancel.forEach(this._cancelNode,this),s.cancel=[];s.remove.length>0&&!e.done;)this.layerView.removeNode(s.remove.pop()),e.madeProgress();for(;s.update.length>0&&!e.done;){const t=this._index.getNode(s.update.pop());null!=t&&(this._updateLoadedNode(t),e.madeProgress())}for(;s.add.length>0&&!e.done&&i>0;){--i;const r=this._index.getNode(s.add.back());if(null==r||2!==r.cacheState&&!this._hasNodeLoadToken(t))break;s.add.pop(),this._loadNode(r),e.madeProgress()}return e.hasProgressed}_cancelAllNodes(){this._loadingNodes.forEach(e=>e.abort()),this._loadingNodes.clear(),this._updatingNodes.forEach(e=>e.abort()),this._updatingNodes.clear()}_cancelNode(e){const t=this._loadingNodes.get(e);t&&(t.abort(),this._loadingNodes.delete(e))}_hasNodeLoadToken(e){return!(!this._isIdle&&e.numNodesLoading+this._loadingNodes.size>=O)&&(null==this.index||!this.dataRequester.isFull(this._index.urlPrefix))}_evaluateRunning(){let e=!1,t=0;if(this.layerView){if(this.layerView.contentVisible){const i=(this._index?.indexMissing??0)+3*(this._index?.updates.add.length??0)+2*this._loadingNodes.size;e=!!(i>0||this._updatingNodes.size>0||this._restartNodeLoading||this._cameraDirty||this._idleQueue.updating||this._lodHandling&&this._lodHandling.requiresLODGlobalHandling||null!=this._index&&this._index.isPrefetching),0===i&&(this._progressMaxNumNodes=1),this._progressMaxNumNodes=Math.max(i,this._progressMaxNumNodes),t=1-i/this._progressMaxNumNodes}else e=this._cameraDirty,t=e?0:1;this.running=e,this.updatingProgress=t}}_updateViewData(){if(!this._cameraDirty||null==this._index||null==this._viewportQueries)return;const e=this.layerView.view,{contentCamera:t,fixedContentCamera:i}=e.state;this._viewportQueries.updateCamera(t,!i||this.isGraphics3D),this._viewportQueries.setPointOfInterest(e.pointsOfInterest.focus.renderLocation),this._viewportQueries.updateScreenSpaceErrorBias(this._lod),this._index.invalidateVisibilityCache(),this._index.requestUpdate(),this._stableFeatureLOD=!1,this._invisibleDirty=!0,this._cameraDirty=!1,this.notifyChange("rootNodeVisible")}_getProgressiveLoadFactor(){return this.layerView.view.quality<1?1:this.layerView.progressiveLoadFactor}get _lod(){return this._featureLOD*this._baseLOD}get _baseLOD(){const e=this.layerView.lodFactor;return this.fixedFeatureTarget?1:(e>0?e:1)*this.layerView.view.quality}get _lodDropFactor(){if(this.fixedFeatureTarget)return 1;return(Math.min(this.layerView.view.quality,.5)-A)/(.5-A)}isGeometryVisible(e){return!!this._index?.isGeometryVisible(e.index)}updateVisibility(e){this._index?.invalidateNodeVisibilityCache(e)}invalidateGeometryVisibility(e){this._index?.invalidateGeometryVisibility(e)}invalidateVisibilityObbs(){this._index?.invalidateVisibilityObbs()}modificationsChanged(){this._index?.imModificationsChanged(!!this.layerView.hasModifications),this._invisibleDirty=!0}_shouldLoadNode(e){return!(!this._lodHandling.shouldLoadNode(e)||this._shouldDropNode(e))&&!(null==this._index||!this._index.isGeometryVisible(e.index))}_shouldDropNode(e){if(null==this._viewportQueries)return!1;const t=this._lodDropFactor;if(t>=1||!this._lodHandling.hasNoVisibleChildren(e))return!1;return Math.abs(this._viewportQueries.calcCameraDistanceToCenter(e))-this._viewportQueries.minDistance>(this._viewportQueries.maxDistance-this._viewportQueries.minDistance)*t}_startNodeLoading(){this._restartNodeLoading=!1;const e=this._index;if(this._updatesDisabled||null==e||null==this._viewportQueries)return;this._updateViewData(),this._requiredAttributesDirty&&(this._requiredAttributes=this._getRequiredAttributes(),this._requiredAttributesDirty=!1);const t={textureEncodings:this.layerView.supportedTextureEncodings,textureUsageMask:this.layerView.rendererTextureUsage,loadFeatureData:this.useMaximumNumberOfFeatures};this._nodeLoader=new v(this.layer,this.dataRequester,i.getLogger(this),this._defaultGeometrySchema,this._requiredAttributes,t),e.requestUpdate(),this._lodHandling.startNodeLoading((e,t)=>this._removeNodes(e,t,1),e,{maxLodLevel:this._viewportQueries.maxLodLevel}),this._evaluateRunning()}isNodeLoading(){return null!=this._nodeLoader&&null!=this._index}cancelNodeLoading(){this.isNodeLoading()&&(this.indexRequester.cancelAll(),this.dataRequester.cancelAll(),this._idleQueue.cancelAll(),this._cancelAllNodes(),this._nodeLoader=null,this._evaluateRunning())}_removeInvisibleNodes(e){const t=this._index;if(null==t||null==this._viewportQueries)return!1;H.clear(),this.layerView.getLoadedNodeIndices(H);const i=0===this._viewportQueries.maxDistance,s=i?()=>!1:e=>this._shouldDropNode(e);return H.filterInPlace(e=>{const i=t.getNode(e);return null==i||!t.isGeometryVisible(e)||s(i)}),H.length>0&&this._lodHandling.setLodGlobalDirty(),this._removeNodes(H,e,0),!(i&&this._lodDropFactor<1)&&(0===H.length||(H.clear(),!1))}markNodeToRemove(e){H.push(e)}removeMarkedNodes(){this._removeNodes(H,M,0)}_removeNodes(e,t,i){if(0!==e.length&&!t.done)for(null!=this._index&&this._index.requestUpdate();e.length>0&&!t.done;){const s=e.pop(),r=this._index;1===i&&this.layerView.nodeFadeoutEnabled&&null!=r&&r.isGeometryVisible(s)?this.layerView.fadeNode(s,1,!0):this.layerView.removeNode(s),t.madeProgress()}}_needsUpdate(e){if(e.resources.isEmpty||this._updatingNodes.has(e.index))return!1;const t=this.layerView.getLoadedAttributes(e.index);return null!=t&&t!==this._requiredAttributes}async _updateLoadedNode(e){const t=new AbortController;this._updatingNodes.set(e.index,t),this._evaluateRunning();try{const i=this.layerView.getLoadedAttributes(e.index),s=Q(i,this._requiredAttributes)?this.layerView.getAttributeData(e.index):await this._loadAttributes(e,this._requiredAttributes,t.signal);await this.schedule(()=>this.layerView.updateAttributes(e.index,{loadedAttributes:this._requiredAttributes,attributeData:s},t.signal),t.signal)}catch(i){if(!d(i))return this.layerView.updateAttributes(e.index,{loadedAttributes:this._requiredAttributes,attributeData:{}},t.signal)}this._updatingNodes.delete(e.index),this._evaluateRunning()}_loadNode(e){if(this._loadingNodes.has(e.index))return void i.getLogger(this).error("already loading node "+e.index);const t=new AbortController;this._loadingNodes.set(e.index,t),this._evaluateRunning(),this._loadAndAddNode(e,t.signal).then(i=>{i&&null!=this._index&&this._loadingNodes.get(e.index)===t&&(this._loadingNodes.delete(e.index),this._index.requestUpdate())}).catch(e=>{if(!d(e))throw e}).finally(()=>{this._loadingNodes.get(e.index)===t&&this._loadingNodes.delete(e.index),this._evaluateRunning()})}_loadAndAddNode(e,t){return 1===e.cacheState?this._loadUncached(e,t).then(()=>!1):this._loadCached(e,t).then(t=>!t&&(e.cacheState=1,!0)).catch(t=>!d(t)&&(e.cacheState=1,!0))}_enableFromGPUCache(e,t){if(this._disableMemCache||null==this._index)return!1;if(0===t&&!this._index.useNodeAsHole(e.index))return!0;const i=this._loadCachedGPUData(e);return!!i&&(this.layerView.addCachedGPUData(e,i,t),this._nodeAdded(),!0)}_loadCachedGPUData(e){const t=this.layerView.loadCachedGPUData(e.index);return null!=t?.attributeInfo&&Q(t.attributeInfo.loadedAttributes,this._requiredAttributes)?t:(this.layerView.deleteCachedGPUData(t),null)}_nodeAdded(){null!=this._index&&this._index.requestUpdate(),this._lodHandling.setLodGlobalDirty(),this._evaluateRunning()}updateLoadStatus(e,t){const i=this._index;null!=i&&i.updateChildrenLoaded(e,t?1:-1)}async _loadCached(e,t){if(this._enableFromGPUCache(e,1))return!0;const i=this.layerView;if(this.disableIDBCache||!i.loadCachedNodeData||!i.addCachedNodeData)return!1;const s=(t,i)=>this._nodeLoader.loadTextures(e,t,i),r=t=>this._clientNodeLoader.loadTextures(e,t),a=e.index>=0?s:r,d=await this.schedule(()=>i.loadCachedNodeData(e,t,a),t);if(null==d)return!1;const n=this._requiredAttributes,o=await this.reschedule(()=>this._loadAttributes(e,n,t),t);return await this.reschedule(()=>i.addCachedNodeData(e,d,{loadedAttributes:n,attributeData:o},t),t),this._nodeAdded(),!0}_loadUncached(e,t){return this._downloadingCount++,this._loadNodeData(e,t).then(i=>this.schedule(()=>this.layerView.addNode(e,i,t),t)).finally(()=>this._downloadingCount--).then(()=>{this._nodeAdded(),e.cacheState=2}).catch(t=>{if(!d(t))throw i.getLogger(this).error("#loadNodeData()",this.layer,`Failed to load node '${e.id}'`,t),e.failed=!0,this._index?.requestUpdate(),t})}_updateIdleState(e){e!==this._isIdle&&(this._isIdle=e,this._evaluateRunning())}get test(){}notifyLODUpdate(){this._lodHandling.setLodGlobalDirty(),this._evaluateRunning(),null!=this._index&&this._index.requestUpdate()}geometryFilterChanged(e){const t=this._index;null!=t&&t.layerFilterChanged(e),this._setCameraDirty()}};e([h({readOnly:!0})],U.prototype,"isMeshPyramid",null),e([h({readOnly:!0})],U.prototype,"isGraphics3D",null),e([h({readOnly:!0})],U.prototype,"useMaximumNumberOfFeatures",null),e([h({readOnly:!0})],U.prototype,"indexRequester",null),e([h({readOnly:!0})],U.prototype,"dataRequester",null),e([h({readOnly:!0})],U.prototype,"crsVertex",null),e([h({readOnly:!0})],U.prototype,"crsIndex",null),e([h()],U.prototype,"featureTarget",void 0),e([h()],U.prototype,"fixedFeatureTarget",void 0),e([h()],U.prototype,"layerView",void 0),e([h()],U.prototype,"layer",null),e([h()],U.prototype,"_updatingHandles",void 0),e([h()],U.prototype,"updating",null),e([h()],U.prototype,"running",void 0),e([h()],U.prototype,"updatingProgress",void 0),e([h({readOnly:!0})],U.prototype,"leavesReached",void 0),e([h({constructOnly:!0})],U.prototype,"worker",void 0),e([h({readOnly:!0,dependsOn:[]})],U.prototype,"rootNodeVisible",null),U=e([u("esri.layers.graphics.controllers.I3SOnDemandController")],U);const H=new r({deallocator:null});function Q(e,t){return null!=e&&e.length===t.length&&e.every(e=>j(t,e.name)>=0)}function j(e,t){const i=t.toLowerCase();for(let s=0;s<e.length;s++)if(e[s].name.toLowerCase()===i)return s;return-1}const T=p();export{U as default};
@@ -2,4 +2,4 @@
2
2
  All material copyright Esri, All Rights Reserved, unless otherwise specified.
3
3
  See https://js.arcgis.com/5.0/esri/copyright.txt for details.
4
4
  */
5
- import has from"../../../../core/has.js";import{clone as t}from"../../../../core/lang.js";import{queryBinsCapabilities as s,queryCapabilities as r}from"../../data/QueryEngineCapabilities.js";import{defaultPointSymbolJSON as e,defaultPolylineSymbolJSON as p,defaultPolygonSymbolJSON as o}from"../../../../symbols/support/defaultsJSON.js";function u(t){return{renderer:{type:"simple",symbol:"esriGeometryPoint"===t||"esriGeometryMultipoint"===t?e:"esriGeometryPolyline"===t?p:o}}}const n=/^[_$a-zA-Z][_$a-zA-Z0-9]*$/;let i=1;function a(t,s){if(has("esri-csp-restrictions"))return()=>({[s]:null,...t});try{let r=`this${c(s)} = null;`;for(const s in t){r+=`this${c(s)} = ${JSON.stringify(t[s])};`}const e=new Function(`\n return class AttributesClass$${i++} {\n constructor() {\n ${r};\n }\n }\n `)();return()=>new e}catch(r){return()=>({[s]:null,...t})}}function c(t){return n.test(t)?`.${t}`:`["${t}"]`}function l(s={}){return[{name:"New Feature",description:"",prototype:{attributes:t(s)}}]}function y(t,e){return{analytics:{supportsCacheHint:!1},attachment:null,data:{isVersioned:!1,isBranchVersioned:!1,supportsAttachment:!1,supportsM:!1,supportsZ:t},metadata:{supportsAdvancedFieldProperties:!1},operations:{supportsCalculate:!1,supportsTruncate:!1,supportsValidateSql:!1,supportsAdd:e,supportsDelete:e,supportsEditing:e,supportsChangeTracking:!1,supportsQuery:!0,supportsQueryBins:!0,supportsQueryPivot:!1,supportsQueryAnalytics:!1,supportsQueryAttachments:!1,supportsQueryTopFeatures:!1,supportsResizeAttachments:!1,supportsSync:!1,supportsUpdate:e,supportsExceedsLimitStatistics:!0,supportsAsyncConvert3D:!1},query:r,queryRelated:{supportsCount:!0,supportsOrderBy:!0,supportsPagination:!0,supportsCacheHint:!1},queryTopFeatures:{supportsCacheHint:!1},queryAttributeBins:s,editing:{supportsGeometryUpdate:e,supportsGlobalId:!1,supportsReturnServiceEditsInSourceSpatialReference:!1,supportsRollbackOnFailure:!1,supportsUpdateWithoutM:!1,supportsUploadWithItemId:!1,supportsDeleteByAnonymous:!1,supportsDeleteByOthers:!1,supportsUpdateByAnonymous:!1,supportsUpdateByOthers:!1,supportsAsyncApplyEdits:!1,zDefault:void 0}}}export{y as createCapabilities,a as createDefaultAttributesFunction,l as createDefaultTemplate,u as createDrawingInfo};
5
+ import has from"../../../../core/has.js";import{clone as t}from"../../../../core/lang.js";import{queryBinsCapabilities as s,queryCapabilities as r}from"../../data/QueryEngineCapabilities.js";import{defaultPointSymbolJSON as e,defaultPolylineSymbolJSON as p,defaultPolygonSymbolJSON as o}from"../../../../symbols/support/defaultsJSON.js";function u(t){return{renderer:{type:"simple",symbol:"esriGeometryPoint"===t||"esriGeometryMultipoint"===t?e:"esriGeometryPolyline"===t?p:o}}}const n=/^[_$a-zA-Z][_$a-zA-Z0-9]*$/;let i=1;function a(t,s){if(has("esri-csp-restrictions"))return()=>({[s]:null,...t});try{let r=`this${c(s)} = null;`;for(const s in t){r+=`this${c(s)} = ${JSON.stringify(t[s])};`}const e=new Function(`\n return class AttributesClass$${i++} {\n constructor() {\n ${r};\n }\n }\n `)();return()=>new e}catch(r){return()=>({[s]:null,...t})}}function c(t){return n.test(t)?`.${t}`:`[${JSON.stringify(t)}]`}function l(s={}){return[{name:"New Feature",description:"",prototype:{attributes:t(s)}}]}function y(t,e){return{analytics:{supportsCacheHint:!1},attachment:null,data:{isVersioned:!1,isBranchVersioned:!1,supportsAttachment:!1,supportsM:!1,supportsZ:t},metadata:{supportsAdvancedFieldProperties:!1},operations:{supportsCalculate:!1,supportsTruncate:!1,supportsValidateSql:!1,supportsAdd:e,supportsDelete:e,supportsEditing:e,supportsChangeTracking:!1,supportsQuery:!0,supportsQueryBins:!0,supportsQueryPivot:!1,supportsQueryAnalytics:!1,supportsQueryAttachments:!1,supportsQueryTopFeatures:!1,supportsResizeAttachments:!1,supportsSync:!1,supportsUpdate:e,supportsExceedsLimitStatistics:!0,supportsAsyncConvert3D:!1},query:r,queryRelated:{supportsCount:!0,supportsOrderBy:!0,supportsPagination:!0,supportsCacheHint:!1},queryTopFeatures:{supportsCacheHint:!1},queryAttributeBins:s,editing:{supportsGeometryUpdate:e,supportsGlobalId:!1,supportsReturnServiceEditsInSourceSpatialReference:!1,supportsRollbackOnFailure:!1,supportsUpdateWithoutM:!1,supportsUploadWithItemId:!1,supportsDeleteByAnonymous:!1,supportsDeleteByOthers:!1,supportsUpdateByAnonymous:!1,supportsUpdateByOthers:!1,supportsAsyncApplyEdits:!1,zDefault:void 0}}}export{y as createCapabilities,a as createDefaultAttributesFunction,l as createDefaultTemplate,u as createDrawingInfo};
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@arcgis/core",
3
- "version": "5.0.0-next.41",
3
+ "version": "5.0.0-next.43",
4
4
  "homepage": "https://js.arcgis.com",
5
5
  "description": "ArcGIS Maps SDK for JavaScript: A complete 2D and 3D mapping and data visualization API",
6
6
  "keywords": [
@@ -2,4 +2,4 @@
2
2
  All material copyright Esri, All Rights Reserved, unless otherwise specified.
3
3
  See https://js.arcgis.com/5.0/esri/copyright.txt for details.
4
4
  */
5
- const e="20251116",a="d8feaa93b9a5b1d89cdf4fee0575e263a8d41817";export{e as buildDate,a as commitHash};
5
+ const b="20251118",c="bced93838b5381b86351138064ad715c819f9331";export{b as buildDate,c as commitHash};
@@ -2,4 +2,4 @@
2
2
  All material copyright Esri, All Rights Reserved, unless otherwise specified.
3
3
  See https://js.arcgis.com/5.0/esri/copyright.txt for details.
4
4
  */
5
- import{__decorate as t}from"tslib";import o from"../core/Collection.js";import{clone as e}from"../core/lang.js";import{property as r,subclass as s}from"../core/accessorSupport/decorators.js";import l from"./Symbol3D.js";import i from"./TextSymbol3DLayer.js";import{hasVisibleCallout as a,hasVisibleVerticalOffset as p,calloutProperty as y}from"./callouts/calloutUtils.js";import m from"./support/Symbol3DVerticalOffset.js";import{enumeration as n}from"../core/accessorSupport/decorators/enumeration.js";var c;const u=o.ofType({base:null,key:"type",typeMap:{text:i}});let f=c=class extends l{constructor(t){super(t),this.verticalOffset=null,this.callout=null,this.styleOrigin=null,this.symbolLayers=new u,this.type="label-3d"}supportsCallout(){return!0}hasVisibleCallout(){return a(this)}hasVisibleVerticalOffset(){return p(this)}clone(){return new c({styleOrigin:e(this.styleOrigin),symbolLayers:e(this.symbolLayers),thumbnail:e(this.thumbnail),callout:e(this.callout),verticalOffset:e(this.verticalOffset)})}static fromTextSymbol(t){return new c({symbolLayers:new o([i.fromTextSymbol(t)])})}};t([r({type:m,json:{write:!0}})],f.prototype,"verticalOffset",void 0),t([r(y)],f.prototype,"callout",void 0),t([r({json:{read:!1,write:!1}})],f.prototype,"styleOrigin",void 0),t([r({type:u})],f.prototype,"symbolLayers",void 0),t([n({LabelSymbol3D:"label-3d"},{readOnly:!0})],f.prototype,"type",void 0),f=c=t([s("esri.symbols.LabelSymbol3D")],f);export{f as default};
5
+ import{__decorate as t}from"tslib";import e from"../core/Collection.js";import{referenceSetter as o}from"../core/collectionUtils.js";import{clone as r}from"../core/lang.js";import{property as s,subclass as l}from"../core/accessorSupport/decorators.js";import i from"./Symbol3D.js";import a from"./TextSymbol3DLayer.js";import{hasVisibleCallout as y,hasVisibleVerticalOffset as m,calloutProperty as p}from"./callouts/calloutUtils.js";import n from"./support/Symbol3DVerticalOffset.js";import{enumeration as c}from"../core/accessorSupport/decorators/enumeration.js";var u;const b=e.ofType({base:null,key:"type",typeMap:{text:a}});let f=u=class extends i{constructor(t){super(t),this.verticalOffset=null,this.callout=null,this.styleOrigin=null,this.type="label-3d",this.symbolLayers=new b}get symbolLayers(){return this._get("symbolLayers")}set symbolLayers(t){o(t,this._get("symbolLayers"))}supportsCallout(){return!0}hasVisibleCallout(){return y(this)}hasVisibleVerticalOffset(){return m(this)}clone(){return new u({styleOrigin:r(this.styleOrigin),symbolLayers:r(this.symbolLayers),thumbnail:r(this.thumbnail),callout:r(this.callout),verticalOffset:r(this.verticalOffset)})}static fromTextSymbol(t){return new u({symbolLayers:new e([a.fromTextSymbol(t)])})}};t([s({type:n,json:{write:!0}})],f.prototype,"verticalOffset",void 0),t([s(p)],f.prototype,"callout",void 0),t([s({json:{read:!1,write:!1}})],f.prototype,"styleOrigin",void 0),t([s({type:b})],f.prototype,"symbolLayers",null),t([c({LabelSymbol3D:"label-3d"},{readOnly:!0})],f.prototype,"type",void 0),f=u=t([l("esri.symbols.LabelSymbol3D")],f);export{f as default};
@@ -2,4 +2,4 @@
2
2
  All material copyright Esri, All Rights Reserved, unless otherwise specified.
3
3
  See https://js.arcgis.com/5.0/esri/copyright.txt for details.
4
4
  */
5
- import{__decorate as o}from"tslib";import e from"../core/Collection.js";import{clone as r}from"../core/lang.js";import{property as s,subclass as t}from"../core/accessorSupport/decorators.js";import l from"./FillSymbol3DLayer.js";import m from"./Symbol3D.js";import{enumeration as i}from"../core/accessorSupport/decorators/enumeration.js";var y;const p=e.ofType({base:null,key:"type",typeMap:{fill:l}});let a=y=class extends m{constructor(o){super(o),this.symbolLayers=new p,this.type="mesh-3d"}clone(){return new y({styleOrigin:r(this.styleOrigin),symbolLayers:r(this.symbolLayers),thumbnail:r(this.thumbnail)})}static fromSimpleFillSymbol(o){return new y({symbolLayers:new e([l.fromSimpleFillSymbol(o)])})}};o([s({type:p})],a.prototype,"symbolLayers",void 0),o([i({MeshSymbol3D:"mesh-3d"},{readOnly:!0})],a.prototype,"type",void 0),a=y=o([t("esri.symbols.MeshSymbol3D")],a);export{a as default};
5
+ import{__decorate as o}from"tslib";import e from"../core/Collection.js";import{referenceSetter as r}from"../core/collectionUtils.js";import{clone as s}from"../core/lang.js";import{property as t,subclass as l}from"../core/accessorSupport/decorators.js";import m from"./FillSymbol3DLayer.js";import y from"./Symbol3D.js";import{enumeration as i}from"../core/accessorSupport/decorators/enumeration.js";var p;const a=e.ofType({base:null,key:"type",typeMap:{fill:m}});let n=p=class extends y{constructor(o){super(o),this.type="mesh-3d",this.symbolLayers=new a}get symbolLayers(){return this._get("symbolLayers")}set symbolLayers(o){r(o,this._get("symbolLayers"))}clone(){return new p({styleOrigin:s(this.styleOrigin),symbolLayers:s(this.symbolLayers),thumbnail:s(this.thumbnail)})}static fromSimpleFillSymbol(o){return new p({symbolLayers:new e([m.fromSimpleFillSymbol(o)])})}};o([t({type:a})],n.prototype,"symbolLayers",null),o([i({MeshSymbol3D:"mesh-3d"},{readOnly:!0})],n.prototype,"type",void 0),n=p=o([l("esri.symbols.MeshSymbol3D")],n);export{n as default};