@arcgis/core 5.0.0-next.39 → 5.0.0-next.40

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 (174) hide show
  1. package/Basemap.js +1 -1
  2. package/assets/esri/core/workers/RemoteClient.js +1 -1
  3. package/assets/esri/core/workers/chunks/02d1c48e874dfd985bc4.js +1 -0
  4. package/assets/esri/core/workers/chunks/0429ca6ba562ae29897e.js +1 -0
  5. package/assets/esri/core/workers/chunks/{a6324f5f560ffadc6e5d.js → 061def9163a09c804b5c.js} +1 -1
  6. package/assets/esri/core/workers/chunks/0e4d0213d568f50c231f.js +1 -0
  7. package/assets/esri/core/workers/chunks/{1de216d9850c39c1735d.js → 1357cc637524cd254974.js} +1 -1
  8. package/assets/esri/core/workers/chunks/13839d220e5c62404923.js +1 -0
  9. package/assets/esri/core/workers/chunks/1c0fb4795a52204882a8.js +1 -0
  10. package/assets/esri/core/workers/chunks/1e286fb7bb833f00dd88.js +1 -0
  11. package/assets/esri/core/workers/chunks/{52ecbaa2d32692d6d8df.js → 1f6ead46b723630db897.js} +1 -1
  12. package/assets/esri/core/workers/chunks/218b2b767b40d85fb713.js +1 -0
  13. package/assets/esri/core/workers/chunks/2c9865e34f32fb5683e5.js +1 -0
  14. package/assets/esri/core/workers/chunks/{48d1a443b324753921de.js → 2db7a7607657f1d669f7.js} +1 -1
  15. package/assets/esri/core/workers/chunks/2f8cf7d9ff1f4de19a4c.js +1 -0
  16. package/assets/esri/core/workers/chunks/{6330d8767ba1d5329daa.js → 31b074ae2162a3508d2a.js} +1 -1
  17. package/assets/esri/core/workers/chunks/338570424337be05cef5.js +1 -0
  18. package/assets/esri/core/workers/chunks/{a59433c78ed01febca6d.js → 3767617c0dfc7d801441.js} +1 -1
  19. package/assets/esri/core/workers/chunks/3a16347e17312556e02c.js +1 -0
  20. package/assets/esri/core/workers/chunks/3ac8de121a07c70bae0f.js +1 -0
  21. package/assets/esri/core/workers/chunks/3f33708eb39c7169a226.js +1 -0
  22. package/assets/esri/core/workers/chunks/4278b35fb6fd578c403e.js +1 -0
  23. package/assets/esri/core/workers/chunks/{3f8849c49f0e3ce7eb6b.js → 44f036cc21e3a2308f69.js} +1 -1
  24. package/assets/esri/core/workers/chunks/46daa1ff5b412a97edc9.js +1 -0
  25. package/assets/esri/core/workers/chunks/{a5d25c71aa4dfaa878cf.js → 4c4a55be41ba105c091c.js} +1 -1
  26. package/assets/esri/core/workers/chunks/537de53ef1e9101468f5.js +1 -0
  27. package/assets/esri/core/workers/chunks/679088064420a906aa7f.js +1 -0
  28. package/assets/esri/core/workers/chunks/6e8c20ff1d28ef2fe72c.js +1 -0
  29. package/assets/esri/core/workers/chunks/75643711d9585ee26a15.js +1 -0
  30. package/assets/esri/core/workers/chunks/7ba13b52fce1060fbb2a.js +1 -0
  31. package/assets/esri/core/workers/chunks/800c91302eaad7f00877.js +1 -0
  32. package/assets/esri/core/workers/chunks/804958f3f4ff47a4eff5.js +1 -0
  33. package/assets/esri/core/workers/chunks/816227de5bd42b437df4.js +1 -0
  34. package/assets/esri/core/workers/chunks/926c2a0e21b7aa1a86e4.js +1 -0
  35. package/assets/esri/core/workers/chunks/933dce4d4ff8b90219c8.js +1 -0
  36. package/assets/esri/core/workers/chunks/93d11075f65a5b6625ea.js +1 -0
  37. package/assets/esri/core/workers/chunks/9c0efd06c9000ccbd62d.js +1 -0
  38. package/assets/esri/core/workers/chunks/9f1d3c0b53bef07e39bf.js +1 -0
  39. package/assets/esri/core/workers/chunks/9f2a8445a5848502c7e7.js +1 -0
  40. package/assets/esri/core/workers/chunks/9f6c63a580b28ab715bd.js +1 -0
  41. package/assets/esri/core/workers/chunks/a96742e678a506c461ab.js +1 -0
  42. package/assets/esri/core/workers/chunks/b7bcff9a64f41a0a0b6a.js +1 -0
  43. package/assets/esri/core/workers/chunks/c0b15510a8cab98df77f.js +1 -0
  44. package/assets/esri/core/workers/chunks/c367c7e553be3682f2db.js +1 -0
  45. package/assets/esri/core/workers/chunks/cfd2839e218610a222e5.js +1 -0
  46. package/assets/esri/core/workers/chunks/{014dbe6fa93a277b08f7.js → d0014b4a8c013f59b113.js} +1 -1
  47. package/assets/esri/core/workers/chunks/d08ee45c501102deea20.js +1 -0
  48. package/assets/esri/core/workers/chunks/d42273394f575e71dd55.js +1 -0
  49. package/assets/esri/core/workers/chunks/d723619579cc8f5ef2cd.js +1 -0
  50. package/assets/esri/core/workers/chunks/da1e61f355fb943085dc.js +1 -0
  51. package/assets/esri/core/workers/chunks/dddb6cb44cbe4dc1af97.js +1 -0
  52. package/assets/esri/core/workers/chunks/efc293c8bbc12156096d.js +1 -0
  53. package/assets/esri/core/workers/chunks/f65f1798f398bc549463.js +1 -0
  54. package/assets/esri/core/workers/chunks/f93f0586ce10cb5d98b3.js +1 -0
  55. package/assets/esri/core/workers/chunks/{06462b267ff8d5984882.js → fb9643b74cf35221ff98.js} +1 -1
  56. package/chunks/Envelope.js +1 -1
  57. package/chunks/GaussianSplat.glsl.js +2 -2
  58. package/chunks/MultiPathImpl.js +1 -1
  59. package/chunks/Point2D.js +1 -1
  60. package/chunks/UnitFactory.js +1 -1
  61. package/config.js +1 -1
  62. package/core/has.js +1 -1
  63. package/form/FormTemplate.js +1 -1
  64. package/form/elements/GroupElement.js +1 -1
  65. package/form/elements/inputs/attachments/AttachmentInput.js +1 -1
  66. package/geometry/FlatGeometry.js +5 -0
  67. package/geometry/operators/gx/operatorShapePreservingProject.js +1 -1
  68. package/geometry/operators/support/jsonConverter.js +1 -1
  69. package/geometry/support/aaBoundingBox.js +1 -1
  70. package/geometry/support/aaBoundingRect.js +1 -1
  71. package/geometry/support/boundsUtils.js +1 -1
  72. package/interfaces.d.ts +259 -7
  73. package/kernel.js +1 -1
  74. package/layers/BaseElevationLayer.js +1 -1
  75. package/layers/BaseTileLayer.js +1 -1
  76. package/layers/CSVLayer.js +1 -1
  77. package/layers/FeatureLayer.js +1 -1
  78. package/layers/GeoJSONLayer.js +1 -1
  79. package/layers/GroupLayer.js +1 -1
  80. package/layers/MapImageLayer.js +1 -1
  81. package/layers/MediaLayer.js +1 -1
  82. package/layers/OrientedImageryLayer.js +1 -1
  83. package/layers/ParquetLayer.js +1 -1
  84. package/layers/VectorTileLayer.js +1 -1
  85. package/layers/VideoLayer.js +1 -1
  86. package/layers/WMSLayer.js +1 -1
  87. package/layers/graphics/sources/support/ParquetSourceWorker.js +1 -1
  88. package/layers/knowledgeGraph/KnowledgeGraphSublayer.js +1 -1
  89. package/layers/mixins/ArcGISImageService.js +1 -1
  90. package/layers/mixins/ImageryTileMixin.js +1 -1
  91. package/layers/mixins/PortalLayer.js +1 -1
  92. package/layers/mixins/TemporalLayer.js +1 -1
  93. package/layers/mixins/operationalLayerModuleMap.js +1 -1
  94. package/layers/mixins/operationalLayers.js +1 -1
  95. package/layers/support/LocalMediaElementSource.js +1 -1
  96. package/layers/support/ParquetEncodingBase.js +1 -1
  97. package/layers/support/ParquetEncodingLocation.js +1 -1
  98. package/layers/support/ParquetEncodingWkb.js +1 -1
  99. package/layers/support/Sublayer.js +1 -1
  100. package/layers/support/WMSSublayer.js +1 -1
  101. package/layers/support/layersCreator.js +1 -1
  102. package/layers/support/lazyLayerLoader.js +1 -1
  103. package/layers/support/parquetUtils.js +1 -1
  104. package/libs/parquet/parquet.js +1 -1
  105. package/package.json +2 -2
  106. package/renderers/FlowRenderer.js +1 -1
  107. package/renderers/VectorFieldRenderer.js +1 -1
  108. package/renderers/visualVariables/support/ColorSizeStop.js +1 -1
  109. package/renderers/visualVariables/support/SizeStop.js +1 -1
  110. package/support/LayersMixin.js +1 -1
  111. package/support/TablesMixin.js +1 -1
  112. package/support/revision.js +1 -1
  113. package/symbols/edges/Edges3D.js +1 -1
  114. package/versionManagement/VersionManager.d.ts +4 -0
  115. package/versionManagement/VersionManager.js +5 -0
  116. package/views/2d/engine/webgl/OverlayMultipoint.js +1 -1
  117. package/views/2d/layers/LayerView2D.js +1 -1
  118. package/views/3d/GroundView3D.js +1 -1
  119. package/views/3d/layers/GaussianSplatLayerView3D.js +1 -1
  120. package/views/3d/support/gaussianSplatting/GaussianSplatAtlasPages.js +1 -1
  121. package/views/3d/support/gaussianSplatting/GaussianSplatFadeTexture.js +1 -1
  122. package/views/3d/support/gaussianSplatting/GaussianSplatOrderTexture.js +1 -1
  123. package/views/3d/webgl-engine/lib/GaussianSplatRenderNode.js +1 -1
  124. package/views/3d/webgl-engine/shaders/GaussianSplatTechnique.js +1 -1
  125. package/views/3d/webgl-engine/shaders/GaussianSplatTechniqueConfiguration.js +1 -1
  126. package/views/input/gamepad/GamepadInputDevice.js +1 -1
  127. package/views/layers/support/{Geometry.js → GeometryClipArea.js} +1 -1
  128. package/views/webgl/capabilities/Capabilities.js +1 -1
  129. package/views/webgl/capabilities/load.js +1 -1
  130. package/webdoc/support/writeUtils.js +1 -1
  131. package/widgets/FeatureTable/FieldColumn.js +1 -1
  132. package/widgets/VersionManagement/VersionManagementViewModel.js +1 -1
  133. package/assets/esri/core/workers/chunks/09ac2bbc7327e6e6b5a2.js +0 -1
  134. package/assets/esri/core/workers/chunks/1432e789aa4cba627337.js +0 -1
  135. package/assets/esri/core/workers/chunks/1a9ed3c59a9a8bafb251.js +0 -1
  136. package/assets/esri/core/workers/chunks/1c857191e5898aba50fe.js +0 -1
  137. package/assets/esri/core/workers/chunks/234ffd08c2be03a0b9fe.js +0 -1
  138. package/assets/esri/core/workers/chunks/2d0d8243ed0c21f8a498.js +0 -1
  139. package/assets/esri/core/workers/chunks/31675811cacdb6fd96cf.js +0 -1
  140. package/assets/esri/core/workers/chunks/39d2b540738431adec98.js +0 -1
  141. package/assets/esri/core/workers/chunks/48820e12d94eb49c0a65.js +0 -1
  142. package/assets/esri/core/workers/chunks/4c278fb2d51ca6226050.js +0 -1
  143. package/assets/esri/core/workers/chunks/4d6706d6dbe578653c28.js +0 -1
  144. package/assets/esri/core/workers/chunks/4ff40eea70d19c934504.js +0 -1
  145. package/assets/esri/core/workers/chunks/59ce992d3a5e7c32b9fb.js +0 -1
  146. package/assets/esri/core/workers/chunks/5e30acfda04f7fc2b676.js +0 -1
  147. package/assets/esri/core/workers/chunks/6052eccb9395c8efb295.js +0 -1
  148. package/assets/esri/core/workers/chunks/61369838aa337d0156c5.js +0 -1
  149. package/assets/esri/core/workers/chunks/690a40d2eef52bfc149f.js +0 -1
  150. package/assets/esri/core/workers/chunks/6b820f14c110d9da118e.js +0 -1
  151. package/assets/esri/core/workers/chunks/7fd2366ee1fc81fa8c56.js +0 -1
  152. package/assets/esri/core/workers/chunks/8d9e622cec13f5cea726.js +0 -1
  153. package/assets/esri/core/workers/chunks/9110287f272141f60c35.js +0 -1
  154. package/assets/esri/core/workers/chunks/98997841ec3955287ba2.js +0 -1
  155. package/assets/esri/core/workers/chunks/a716b8fdeda4e16f03ab.js +0 -1
  156. package/assets/esri/core/workers/chunks/a9577a700b6a7b69d6aa.js +0 -1
  157. package/assets/esri/core/workers/chunks/ad4fcb73cfe9a1e4b710.js +0 -1
  158. package/assets/esri/core/workers/chunks/aead7c9830fa310e5b53.js +0 -1
  159. package/assets/esri/core/workers/chunks/b48aceaeefa07214e430.js +0 -1
  160. package/assets/esri/core/workers/chunks/bcfa98b6866a96c194cb.js +0 -1
  161. package/assets/esri/core/workers/chunks/c052fb8c952cda0b5d13.js +0 -1
  162. package/assets/esri/core/workers/chunks/c0d6f8e55349f4f5cd58.js +0 -1
  163. package/assets/esri/core/workers/chunks/c1a4d1ec0125617374b4.js +0 -1
  164. package/assets/esri/core/workers/chunks/c582fb447c89d732cfff.js +0 -1
  165. package/assets/esri/core/workers/chunks/cb500d673ca7ec1ef945.js +0 -1
  166. package/assets/esri/core/workers/chunks/ce99abfdcd71ff9e4e36.js +0 -1
  167. package/assets/esri/core/workers/chunks/cf0e2c91b330b1d0ef77.js +0 -1
  168. package/assets/esri/core/workers/chunks/d764b6273974f4bca31b.js +0 -1
  169. package/assets/esri/core/workers/chunks/d87dc2eeffabd3507143.js +0 -1
  170. package/assets/esri/core/workers/chunks/dca6a61fd239cf1ff90c.js +0 -1
  171. package/assets/esri/core/workers/chunks/edc3d98f33d7bf959154.js +0 -1
  172. package/assets/esri/core/workers/chunks/f1381c5a2a1de1ef9139.js +0 -1
  173. package/assets/esri/core/workers/chunks/f6148611d883a59f8fb8.js +0 -1
  174. package/views/3d/webgl-engine/shaders/GaussianSplatDepthTechnique.js +0 -5
@@ -0,0 +1,5 @@
1
+ /*
2
+ All material copyright Esri, All Rights Reserved, unless otherwise specified.
3
+ See https://js.arcgis.com/5.0/esri/copyright.txt for details.
4
+ */
5
+ import{__decorate as e}from"tslib";import r from"../core/Accessor.js";import o from"../core/Collection.js";import t from"../core/Error.js";import i from"../core/Logger.js";import{watch as s,on as n}from"../core/reactiveUtils.js";import{removeTrailingSlash as a}from"../core/urlUtils.js";import{property as d,subclass as l}from"../core/accessorSupport/decorators.js";import{UpdatingHandles as u}from"../core/support/UpdatingHandles.js";import{getOwningPortalUrl as h}from"../layers/support/layerUtils.js";import p from"../portal/Portal.js";import{hasPrivilege as v}from"../portal/support/utils.js";import m from"../rest/featureService/FeatureService.js";import{createFeatureServices as c}from"../rest/featureService/utils.js";import{getVersioningStates as g}from"./utils.js";import w from"./VersioningState.js";import f from"./VersionManagementService.js";import{createVersionAdapters as _}from"./versionAdapters/utils.js";let E=class extends r{constructor(e){super(e),this._portalLookup=new Map,this._updatingHandlesLoad=new u,this._updatingHandlesExecute=new u,this.executionError=void 0,this.featureServiceLookup=new Map,this.loadError=void 0,this.serverVersionLookup=new Map,this.serviceNameLookup=new Map,this.userLookup=new Map,this.versionAdministratorLookup=new Map,this.versioningStateLookup=new Map,this.view=null,this.versioningStates=null}initialize(){this._viewChangeHandle(),this.addHandles([s(()=>this.view,()=>{this._resetAllLookupProperties(),this._viewChangeHandle()}),s(()=>this.versioningStates,()=>{this._resetVersioningLookupProperties(),this._setVersioningStatesLookups()})])}destroy(){this._updatingHandlesLoad.destroy(),this._updatingHandlesExecute.destroy()}get state(){return this._updatingHandlesLoad.updating?"loading":this.loadError?"disabled":this._updatingHandlesExecute.updating?"executing":this.executionError?"failed":"ready"}async alterVersion(e){return this._updatingHandlesExecute.addPromise(this._alterVersionInternal(e))}async changeVersion(e,r,o){return this._updatingHandlesExecute.addPromise(this._changeVersionInternal(e,r,o))}async createVersion(e){return this._updatingHandlesExecute.addPromise(this._createVersionInternal(e))}async deleteVersion(e,r,o){return this._updatingHandlesExecute.addPromise(this._deleteVersionInternal(e,r,o))}async getVersionInfos(e){return this._updatingHandlesExecute.addPromise(this._getVersionInfosInternal(e))}async _alterVersionInternal(e){if("disabled"===this.state)throw this._logError("version-management-view-model:load-error",this.loadError),new t("version-management-view-model:load-error",this.loadError??"");this._setExecutionError();const r=this.versioningStateLookup.get(e.featureServerUrl);if(!r)throw this._logError("version-management-view-model:execution-error","no-versioning-state-found"),new t("version-management-view-model:execution-error",this.executionError??"");if(!this.serverVersionLookup.has(e.featureServerUrl)||this.serverVersionLookup.get(e.featureServerUrl)<=11.1)throw this._logError("version-management-view-model:execution-error","no-valid-enterprise-version"),new t("version-management-view-model:execution-error",this.executionError??"");const{featureServerUrl:o,versionIdentifier:i,...s}=e,n=await r.alterVersion(i,s).catch(e=>{throw this._logExecutionError(e),e});return await this.getVersionInfos(o),n}async _changeVersionInternal(e,r,o){if("disabled"===this.state)throw this._logError("version-management-view-model:load-error",this.loadError),new t("version-management-view-model:load-error",this.loadError??"");this._setExecutionError();const i=this.versioningStateLookup.get(e);if(!i)throw this._logError("version-management-view-model:execution-error","no-versioning-state-found"),new t("version-management-view-model:execution-error",this.executionError??"");const s={name:r,guid:o};return await i.changeVersion(s).catch(e=>{throw this._logExecutionError(e),e})}_updateVersionableItems(e){this._updatingHandlesLoad.addPromise((async()=>{_(e.added).forEach(e=>{const r=e.featureServiceUrl,o=this.versioningStateLookup.get(r);o&&(o.versionableItems.find(r=>r.versionableItem===e.versionableItem)||o.versionableItems.add(e))});_(e.removed).forEach(e=>{const{allLayers:r,allTables:o}=this.view.map,t=e.featureServiceUrl,i=this.versioningStateLookup.get(t);if(!i)return void this._logError("version-management-view-model:execution-error","no-version-management-service-found");const s=e=>("feature"===e.type||"subtype-group"===e.type)&&(e.url?.includes(t)??!1);[...r.filter(s),...o.filter(s)].length||(this.featureServiceLookup.delete(t),this.serviceNameLookup.delete(t),this.versioningStateLookup.delete(t),this.versioningStates.remove(i));const n=i.versionableItems.find(r=>r.versionableItem===e.versionableItem);n&&i.versionableItems.remove(n)})})())}async _createVersionInternal(e){if("disabled"===this.state)throw this._logError("version-management-view-model:load-error",this.loadError),new t("version-management-view-model:load-error",this.loadError??"");this._setExecutionError();const r=e.featureServerUrl,o=this.versioningStateLookup.get(r);if(!o)throw this._logError("version-management-view-model:execution-error","no-versioning-state-found"),new t("version-management-view-model:execution-error",this.executionError??"");const i=this.userLookup.get(r).toUpperCase(),s=this._isEmptyString(e.ownerName)?i:e.ownerName?.trim().toUpperCase();if(s!==i&&this.serverVersionLookup.get(r)<=11.1)throw this._logError("version-management-view-model:execution-error","versioning-api-error"),new t("version-management-view-model:execution-error",this.executionError??"");let n=await(this.versioningStateLookup.get(r)?.getVersionInfos());if("SDE"===s?.toUpperCase()&&"DEFAULT"===e.versionName.toUpperCase()||n?.find(r=>r.versionIdentifier.name.toUpperCase()===(s+"."+e.versionName).toUpperCase()||r.versionIdentifier.name.toUpperCase()===(i+"."+e.versionName).toUpperCase()))throw this._logError("version-management-view-model:execution-error","no-valid-version-name"),new t("version-management-view-model:execution-error",this.executionError??"");const a=await o.versionManagementService.createVersion({versionName:e.versionName,access:s!==i?"public":e.access,description:e.description}).catch(e=>{throw this._logExecutionError(e),e});if(s!==i){const{guid:o,name:t}=a.versionIdentifier,n={featureServerUrl:r,versionIdentifier:{guid:o,name:t},access:e.access,ownerName:s};await this.alterVersion(n)||this.deleteVersion(r,i+"."+e.versionName,a.versionIdentifier.guid)}return await this.getVersionInfos(r),n=await(this.versioningStateLookup.get(r)?.getVersionInfos()),n?.find(e=>e.versionIdentifier.guid===a.versionIdentifier.guid)}async _deleteVersionInternal(e,r,o){if("disabled"===this.state)throw this._logError("version-management-view-model:load-error",this.loadError),new t("version-management-view-model:load-error",this.loadError??"");this._setExecutionError();const i=this.versioningStateLookup.get(e);if(!i)throw this._logError("version-management-view-model:execution-error","no-versioning-state-found"),new t("version-management-view-model:execution-error",this.executionError??"");if(this.serverVersionLookup.get(e)<=11.1)throw this._logError("version-management-view-model:execution-error","versioning-api-error"),new t("version-management-view-model:execution-error",this.executionError??"");const s={name:r,guid:o};return await i.deleteVersion(s).catch(e=>{throw this._logExecutionError(e),new t("version-management-view-model:execution-error",this.executionError??"")})}async _getVersionInfosInternal(e){if("disabled"===this.state)throw this._logError("version-management-view-model:load-error",this.loadError),new t("version-management-view-model:load-error",this.loadError??"");this._setExecutionError();const r=this.featureServiceLookup.get(e)?.featureService;if(!r)throw this._logError("version-management-view-model:execution-error","no-feature-service-found"),new t("version-management-view-model:execution-error",this.executionError??"");r.loaded||await r.load().catch(e=>{throw this._logExecutionError(e),e});const o=r.url;this.serverVersionLookup.set(o,r.sourceJSON?.currentVersion??0);const i=this.userLookup.get(e);this._portalLookup.get(e)&&i?this.versionAdministratorLookup.set(o,await v(this._portalLookup.get(e),i,"features:user:manageVersions")):this.versionAdministratorLookup.set(o,!1);const s=this.versioningStateLookup.get(e);if(!s)throw this._logError("version-management-view-model:execution-error","no-versioning-state-found"),new t("version-management-view-model:execution-error",this.executionError??"");s.loaded||await s.load().catch(e=>{throw this._logExecutionError(e),e});return await s.getVersionInfos(!0).catch(e=>{throw this._logExecutionError(e),e})}_isEmptyString(e){return!e||0===e.trim().length}_logError(e,r){switch(i.getLogger(this).error(new t(e,r??"")),e){case"version-management-view-model:load-error":this._setLoadError(r);break;case"version-management-view-model:execution-error":this._setExecutionError(r)}}_logExecutionError(e){this._logError("version-management-view-model:execution-error",e.message)}async _viewChangeHandle(){this._updatingHandlesLoad.addPromise((async()=>{if(this._setLoadError(),!this.view)return void this._setLoadError("no-view-property");if(this.view&&"2d"!==this.view.type)return void this._logError("version-management-view-model:load-error","sceneView-not-supported");this.removeHandles("map-change-handle"),this.addHandles([s(()=>this.view?.map,()=>{this._resetAllLookupProperties(),this._mapChangeHandle(this.versioningStates)})],"map-change-handle");const e=await this._getVersioningStates();await this._mapChangeHandle(e)})())}async _mapChangeHandle(e){this._updatingHandlesLoad.addPromise((async()=>{this._setLoadError(),this.removeHandles("map-layers-tables-change-handle"),this.addHandles([n(()=>this.view?.map.allLayers,"change",e=>{(e.added.some(({type:e})=>"feature"===e)||e.removed.some(({type:e})=>"feature"===e)||e.added.some(({type:e})=>"subtype-group"===e)||e.removed.some(({type:e})=>"subtype-group"===e))&&(this._resetServiceRelatedLookupProperties(),this._propertiesChangeInternal(this.versioningStates),this._updateVersionableItems(e))}),n(()=>this.view?.map.allTables,"change",e=>{(e.added.some(({type:e})=>"feature"===e)||e.removed.some(({type:e})=>"feature"===e)||e.added.some(({type:e})=>"subtype-group"===e)||e.removed.some(({type:e})=>"subtype-group"===e))&&(this._resetServiceRelatedLookupProperties(),this._propertiesChangeInternal(this.versioningStates),this._updateVersionableItems(e))})],"map-layers-tables-change-handle"),await this._propertiesChangeInternal(e)})())}async _propertiesChangeInternal(e){this._updatingHandlesLoad.addPromise((async()=>{const r=e=>"feature"===e.type||"subtype-group"===e.type,{allLayers:o,allTables:t}=this.view.map;if(this._setLoadError(),this.featureServiceLookup=c([...o.filter(r),...t.filter(r)]),this.featureServiceLookup.size){this._updateFeatureServiceLookup(e),this.serviceNameLookup=new Map;for(const e of this.featureServiceLookup.values()){const{featureService:r,featureService:{url:o}}=e;if(!this.serviceNameLookup.has(o)){if(r.loaded||await r.load().catch(e=>{i.getLogger(this).error(e)}),!r.versionManagementServiceUrl){this.featureServiceLookup.delete(o);continue}const e=await h(o),t=new p({authMode:"immediate",url:e});await t.load().catch(e=>{i.getLogger(this).error(e)});const s=t.user?.username;if(!r.loaded||!t.loaded||!s)continue;this.serviceNameLookup.set(a(o),o.split("/").at(-2)),this.userLookup.set(o,s),this._portalLookup.set(o,t)}}e.forEach(e=>this._handleVersioningStateLookupUpdate(e)),await this._updateVersioningStates(e),this.versioningStates=e}else this._logError("version-management-view-model:load-error","no-feature-services")})())}_updateFeatureServiceLookup(e){for(const r of e){const e=r.featureServiceUrl;if(!this.featureServiceLookup.has(e)){const o=new m({url:e}),t=r.versionableItems.toArray().flatMap(e=>"network"===e.type?null:e.versionableItem).filter(e=>!!e);this.featureServiceLookup.set(e,{featureService:o,layers:t})}}}async _updateVersioningStates(e){for(const r of this.featureServiceLookup.values()){const t=r.featureService;if(!t.versionManagementServiceUrl)continue;if(!e.find(e=>e.featureServiceUrl===t.url)&&t.versionManagementServiceUrl){const i=new o(_(r.layers)),s=new w({versionManagementService:new f({url:t.versionManagementServiceUrl}),versionableItems:i});e.add(s),this._handleVersioningStateLookupUpdate(s)}await this.getVersionInfos(t.url)}}async _getVersioningStates(){return this.versioningStates&&this.versioningStates.length?this.versioningStates:this.view?await g(this.view,!1):(this._logError("version-management-view-model:load-error","no-view-property"),new o)}_handleVersioningStateLookupUpdate(e){this.versioningStateLookup.set(e.featureServiceUrl,e)}async _setVersioningStatesLookups(){this._updatingHandlesLoad.addPromise((async()=>{this.versioningStates&&(this._updateFeatureServiceLookup(this.versioningStates),this.versioningStates.forEach(e=>this._handleVersioningStateLookupUpdate(e)),await this._updateVersioningStates(this.versioningStates))})())}_resetVersioningLookupProperties(){this.versioningStateLookup=new Map}_resetAllLookupProperties(){this._portalLookup=new Map,this.serverVersionLookup=new Map,this.userLookup=new Map,this.versioningStates=new o,this._resetVersioningLookupProperties(),this._resetServiceRelatedLookupProperties()}_resetServiceRelatedLookupProperties(){this.featureServiceLookup=new Map,this.serviceNameLookup=new Map}_setExecutionError(e){this._set("executionError",e)}_setLoadError(e){this._set("loadError",e)}};e([d()],E.prototype,"_portalLookup",void 0),e([d({readOnly:!0})],E.prototype,"executionError",void 0),e([d()],E.prototype,"featureServiceLookup",void 0),e([d({readOnly:!0})],E.prototype,"loadError",void 0),e([d()],E.prototype,"serverVersionLookup",void 0),e([d()],E.prototype,"serviceNameLookup",void 0),e([d({readOnly:!0})],E.prototype,"state",null),e([d()],E.prototype,"userLookup",void 0),e([d()],E.prototype,"versionAdministratorLookup",void 0),e([d()],E.prototype,"versioningStateLookup",void 0),e([d()],E.prototype,"view",void 0),e([d()],E.prototype,"versioningStates",void 0),E=e([l("esri.versionManagement.VersionManager")],E);const L=E;export{L 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{on as t}from"../../../../core/events.js";import e from"../../../../core/Handles.js";import{disposeMaybe as r}from"../../../../core/maybe.js";import{when as i,initial as o}from"../../../../core/reactiveUtils.js";import{createScreenPoint as s}from"../../../../core/screenUtils.js";import{create as n}from"../../../../core/libs/gl-matrix-2/factories/vec2f64.js";import a from"../../../../geometry/Point.js";import l from"../../../../geometry/Polygon.js";import{project as h}from"../../../../geometry/projectionUtils.js";import u from"../../../../layers/support/ControlPoint.js";import{DisplayObject as m}from"../DisplayObject.js";import p from"../../../layers/support/Geometry.js";import{Texture as d}from"../../../webgl/Texture.js";import{TextureDescriptor as c}from"../../../webgl/TextureDescriptor.js";const f=2;class x extends m{constructor(r){super(),this.element=r,this._handles=new e,this.isWrapAround=!1,this.perspectiveTransform=n(),this.wrapAroundShift=0,this.clipGeometry=null,this._handles.add(i(()=>this.element,()=>{const e=this.element;this.ready(),e&&this._handles.add(t(e,"play",()=>this.requestRender()))},o))}getMesh(t){throw new Error("Method not implemented.")}destroy(){super.destroy(),this._handles.destroy(),this.texture=r(this.texture)}get textureSize(){if(!this.texture)return[1,1];const t=this.texture.descriptor;return[t.width,t.height]}get dvsMat3(){return this.parent.dvsMat3}beforeRender(t){const e=this.element;if(null==e)return;const{context:r}=t,{videoWidth:i,videoHeight:o}=e;if(0!==i&&0!==o){if(this.texture)e.paused||t.animationsEnabled&&this.texture.setData(e);else{const t=new c(i,o);t.wrapMode=33071,t.preMultiplyAlpha=!0,this.texture=new d(r,t,e)}e.paused||this.texture.generateMipmap(),super.beforeRender(t)}}_createTransforms(){return null}updateDrawCoords(t,e,r,i){const o=this.element,s=this._getFrameInfo();if(!o||!s)return;const{spatialReference:n}=r;this._initializeData(t,s,n);const{controlPoints:a,horizon:u}=s,m=Math.sqrt(a.length),d=m,{x:c,y:x}=t,y=this._vertices,g=a[0],w=a[m-1],P=a[(d-1)*m],_=a[(d-1)*m+m-1],v=h(u?u[0].mapPoint:g.mapPoint,n),j=h(u?u[1].mapPoint:w.mapPoint,n),M=h(P.mapPoint,n),A=h(_.mapPoint,n);this.clipGeometry=u?new p({geometry:l.fromJSON({rings:[[[M.x,M.y],[A.x,A.y],[j.x,j.y],[v.x,v.y],[M.x,M.y]]],spatialReference:n})}):null;for(let l=0;l<a.length;l++){const t=a[l],{sourcePoint:e,mapPoint:r}=t;if(null==e||null==r)continue;const i=h(r,n);y[l*f+0]=i.x-c,y[l*f+1]=i.y-x}let b=e;if(i){const t=Math.min(v.x,j.x,M.x,A.x),e=Math.max(v.x,j.x,M.x,A.x),{worldWidth:r,xBounds:o}=i,[s,n]=o;t<s&&e>s?b=r:e>n&&t<n&&(b=-r)}this.wrapAroundShift=b,this.isWrapAround=0!==b}draw(t,e){if(!this.visible)return;if(!(this.isReady&&this._vertices&&this._indices&&this._texCoords))return void this.requestRender();this.stage||console.warn("OverlayMultipoint: stage is null"),e.render(t,{transform:{dvs:this.dvsMat3},config:{perspective:this.perspectiveTransform,texSize:this.textureSize,wrapAroundShift:this.wrapAroundShift,isWrapAround:this.isWrapAround,opacity:this.opacity,texture:{texture:this.texture,unit:0}},position:this._vertices,tex:this._texCoords,index:this._indices})}_initializeData(t,e,r){if(null!=this._vertices&&null!=this._indices)return;const{controlPoints:i}=e,o=Math.sqrt(i.length),s=o,n=new Float32Array(f*i.length),a=new Uint16Array(2*i.length);for(let m=0;m<i.length;m++){const e=i[m],{sourcePoint:o,mapPoint:s}=e;if(null==o||null==s)continue;const l=h(s,r);n[m*f+0]=l.x-t.x,n[m*f+1]=l.y-t.y,a[2*m+0]=o.x,a[2*m+1]=o.y}const l=new Uint16Array(s*o+(s-2)*(o+2));let u=0;for(let h=0;h<s;h++){for(let t=0;t<o;t++)l[u++]=h*o+t,l[u++]=(h+1)*o+t;h<s-2&&(l[u++]=(h+1)*o+(o-1),l[u++]=(h+1)*o)}this._vertices=n,this._texCoords=a,this._indices=l}_getFrameInfo(){if(!this.groundControlPoints)return null;const t=this._getFrameControlPoints(),e=this.frameHorizonPoints;let r=null;if(e){const t=e.startX,i=e.startY,o=e.endX,n=e.endY;r=[new u({sourcePoint:s(t,i),mapPoint:new a(e.startLongitude,e.startLatitude)}),new u({sourcePoint:s(o,n),mapPoint:new a(e.endLongitude,e.endLatitude)})]}return{controlPoints:t,horizon:r}}_getFrameControlPoints(){const t=this.groundControlPoints,e=t?.length;if(!e)return[];const r=new Array(e),i=Math.max(...t.map(({x:t})=>t)),o=this.element.videoWidth/i;for(let n=0;n<e;n++){const{x:e,y:i,lat:l,lon:h}=t[n];r[n]=new u({sourcePoint:s(e*o,-i*o),mapPoint:new a(h,l)})}return r}}export{x as default};
5
+ import{on as t}from"../../../../core/events.js";import e from"../../../../core/Handles.js";import{disposeMaybe as r}from"../../../../core/maybe.js";import{when as i,initial as o}from"../../../../core/reactiveUtils.js";import{createScreenPoint as s}from"../../../../core/screenUtils.js";import{create as n}from"../../../../core/libs/gl-matrix-2/factories/vec2f64.js";import a from"../../../../geometry/Point.js";import l from"../../../../geometry/Polygon.js";import{project as h}from"../../../../geometry/projectionUtils.js";import u from"../../../../layers/support/ControlPoint.js";import{DisplayObject as p}from"../DisplayObject.js";import m from"../../../layers/support/GeometryClipArea.js";import{Texture as d}from"../../../webgl/Texture.js";import{TextureDescriptor as c}from"../../../webgl/TextureDescriptor.js";const f=2;class x extends p{constructor(r){super(),this.element=r,this._handles=new e,this.isWrapAround=!1,this.perspectiveTransform=n(),this.wrapAroundShift=0,this.clipGeometry=null,this._handles.add(i(()=>this.element,()=>{const e=this.element;this.ready(),e&&this._handles.add(t(e,"play",()=>this.requestRender()))},o))}getMesh(t){throw new Error("Method not implemented.")}destroy(){super.destroy(),this._handles.destroy(),this.texture=r(this.texture)}get textureSize(){if(!this.texture)return[1,1];const t=this.texture.descriptor;return[t.width,t.height]}get dvsMat3(){return this.parent.dvsMat3}beforeRender(t){const e=this.element;if(null==e)return;const{context:r}=t,{videoWidth:i,videoHeight:o}=e;if(0!==i&&0!==o){if(this.texture)e.paused||t.animationsEnabled&&this.texture.setData(e);else{const t=new c(i,o);t.wrapMode=33071,t.preMultiplyAlpha=!0,this.texture=new d(r,t,e)}e.paused||this.texture.generateMipmap(),super.beforeRender(t)}}_createTransforms(){return null}updateDrawCoords(t,e,r,i){const o=this.element,s=this._getFrameInfo();if(!o||!s)return;const{spatialReference:n}=r;this._initializeData(t,s,n);const{controlPoints:a,horizon:u}=s,p=Math.sqrt(a.length),d=p,{x:c,y:x}=t,y=this._vertices,g=a[0],w=a[p-1],P=a[(d-1)*p],_=a[(d-1)*p+p-1],v=h(u?u[0].mapPoint:g.mapPoint,n),j=h(u?u[1].mapPoint:w.mapPoint,n),A=h(P.mapPoint,n),M=h(_.mapPoint,n);this.clipGeometry=u?new m({geometry:l.fromJSON({rings:[[[A.x,A.y],[M.x,M.y],[j.x,j.y],[v.x,v.y],[A.x,A.y]]],spatialReference:n})}):null;for(let l=0;l<a.length;l++){const t=a[l],{sourcePoint:e,mapPoint:r}=t;if(null==e||null==r)continue;const i=h(r,n);y[l*f+0]=i.x-c,y[l*f+1]=i.y-x}let C=e;if(i){const t=Math.min(v.x,j.x,A.x,M.x),e=Math.max(v.x,j.x,A.x,M.x),{worldWidth:r,xBounds:o}=i,[s,n]=o;t<s&&e>s?C=r:e>n&&t<n&&(C=-r)}this.wrapAroundShift=C,this.isWrapAround=0!==C}draw(t,e){if(!this.visible)return;if(!(this.isReady&&this._vertices&&this._indices&&this._texCoords))return void this.requestRender();this.stage||console.warn("OverlayMultipoint: stage is null"),e.render(t,{transform:{dvs:this.dvsMat3},config:{perspective:this.perspectiveTransform,texSize:this.textureSize,wrapAroundShift:this.wrapAroundShift,isWrapAround:this.isWrapAround,opacity:this.opacity,texture:{texture:this.texture,unit:0}},position:this._vertices,tex:this._texCoords,index:this._indices})}_initializeData(t,e,r){if(null!=this._vertices&&null!=this._indices)return;const{controlPoints:i}=e,o=Math.sqrt(i.length),s=o,n=new Float32Array(f*i.length),a=new Uint16Array(2*i.length);for(let p=0;p<i.length;p++){const e=i[p],{sourcePoint:o,mapPoint:s}=e;if(null==o||null==s)continue;const l=h(s,r);n[p*f+0]=l.x-t.x,n[p*f+1]=l.y-t.y,a[2*p+0]=o.x,a[2*p+1]=o.y}const l=new Uint16Array(s*o+(s-2)*(o+2));let u=0;for(let h=0;h<s;h++){for(let t=0;t<o;t++)l[u++]=h*o+t,l[u++]=(h+1)*o+t;h<s-2&&(l[u++]=(h+1)*o+(o-1),l[u++]=(h+1)*o)}this._vertices=n,this._texCoords=a,this._indices=l}_getFrameInfo(){if(!this.groundControlPoints)return null;const t=this._getFrameControlPoints(),e=this.frameHorizonPoints;let r=null;if(e){const t=e.startX,i=e.startY,o=e.endX,n=e.endY;r=[new u({sourcePoint:s(t,i),mapPoint:new a(e.startLongitude,e.startLatitude)}),new u({sourcePoint:s(o,n),mapPoint:new a(e.endLongitude,e.endLatitude)})]}return{controlPoints:t,horizon:r}}_getFrameControlPoints(){const t=this.groundControlPoints,e=t?.length;if(!e)return[];const r=new Array(e),i=Math.max(...t.map(({x:t})=>t)),o=this.element.videoWidth/i;for(let n=0;n<e;n++){const{x:e,y:i,lat:l,lon:h}=t[n];r[n]=new u({sourcePoint:s(e*o,-i*o),mapPoint:new a(h,l)})}return r}}export{x 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 t}from"tslib";import e from"../../../core/Collection.js";import{referenceSetter as i}from"../../../core/collectionUtils.js";import{deprecatedFunction as s}from"../../../core/deprecate.js";import r from"../../../core/Error.js";import h from"../../../core/Logger.js";import{watch as o,on as a,syncAndInitial as n}from"../../../core/reactiveUtils.js";import{property as l,subclass as p}from"../../../core/accessorSupport/decorators.js";import{isLinkChartView as c}from"../../../linkChart/utils.js";import{Container as d}from"../engine/Container.js";import{HighlightCounter as g}from"./support/HighlightCounter.js";import{createOrReuseHighlightGradient as u}from"./support/util.js";import{getDefaultHighlightOptions as m,setDefaultHighlightOptions as f}from"../support/highlightOptionsUtils.js";import y from"../../layers/support/ClipRect.js";import v from"../../layers/support/Geometry.js";import w from"../../layers/support/Path.js";import R from"../../support/HighlightOptions.js";import{isInEffectiveScaleRange as _}from"../../support/layerViewUtils.js";const S=e.ofType({key:"type",base:null,typeMap:{rect:y,path:w,geometry:v}}),H=new(e.ofType(R)),b=y=>{const v=y;let w=class extends v{constructor(){super(...arguments),this._highlightCounter=new g,this.attached=!1,this.clips=new S,this.highlights=null,this.lastUpdateId=-1,this.moving=!1,this.updateRequested=!1,this._visibleAtCurrentScale=!0}initialize(){const t=this.view?.spatialReferenceLocked??!0,e=this.view?.spatialReference;e&&t&&!this.spatialReferenceSupported?this.addResolvingPromise(Promise.reject(new r("layerview:spatial-reference-incompatible","The spatial reference of this layer does not meet the requirements of the view",{layer:this.layer}))):(this.container||(this.container=new d),this.container.fadeTransitionEnabled=!0,this.container.visible=!1,this.container.endTransitions(),this.addHandles([o(()=>this.suspended,t=>{this.container&&(this.container.visible=!t)},n),o(()=>this.updateSuspended,t=>{this.view&&!t&&this.updateRequested&&this.view.requestUpdate()},n),o(()=>this.layer?.opacity??1,t=>{this.container&&(this.container.opacity=t)},n),o(()=>this.layer&&"blendMode"in this.layer?this.layer.blendMode:"normal",t=>{this.container&&(this.container.blendMode=t)},n),o(()=>this.layer&&"effect"in this.layer?this.layer.effect:null,t=>{this.container&&(this.container.effect=t)},n),o(()=>this._mergedHighlights.items.map(t=>({name:t.name,options:{fillColor:t.color,haloColor:t.haloColor,fillOpacity:t.fillOpacity,haloOpacity:t.haloOpacity,haloWidth:t.haloWidth,haloBlur:t.haloBlur}})),()=>{this.container.highlightGradient=u(this.container.highlightGradient,this._mergedHighlights.items)},n),o(()=>this._mergedHighlights.items.map(t=>t.name),()=>{this._processHighlight()}),a(()=>this.clips,"change",()=>{this.container&&(this.container.clips=this.clips)},n),o(()=>({scale:this.view?.scale,scaleRange:this.layer&&"effectiveScaleRange"in this.layer?this.layer.effectiveScaleRange:null}),({scale:t,scaleRange:e})=>{const i=_(e,t);i!==this._visibleAtCurrentScale&&(this._visibleAtCurrentScale=i)},n)],"constructor"),this.view?.whenLayerView?this.view.whenLayerView(this.layer).then(t=>{t===this&&this.processAttach()},()=>{}):this.when().then(()=>{this.processAttach()},()=>{}))}destroy(){this.processDetach(),this.updateRequested=!1}get highlightOptions(){return this._logHighlightOptionsDeprecation(),m(this)}set highlightOptions(t){this._logHighlightOptionsDeprecation(),f(this,t)}_logHighlightOptionsDeprecation(){s(h.getLogger(this),"`LayerView.highlightOptions` is deprecated in favor of View.highlights",{replacement:"View.highlights",version:"4.34",see:"https://arcg.is/inbTa1#highlights",warnOnce:!0})}get hasHighlight(){return this._highlightCounter.size>0}get _mergedHighlights(){if(!this.view)return H;if(!this.highlights)return this.view.highlights;const t=this.view.highlights.clone();for(const e of this.highlights){const i=t.find(t=>t.name===e.name);i&&i.assignFrom(e)}return t}get highlightIds(){return Array.from(this._highlightCounter.objectIds)}get scheduler(){return this.view.scheduler}get spatialReferenceSupported(){const t=this.view?.spatialReference;return null==t||this.supportsSpatialReference(t)}get updating(){return this.spatialReferenceSupported&&(!this.attached||!this.suspended&&(this.updateRequested||this.isUpdating())||!!this._updatingHandles?.updating||this.container.transitioning)}get visibleAtCurrentScale(){return this._visibleAtCurrentScale}processAttach(){this.isResolved()&&!this.attached&&!this.destroyed&&this.spatialReferenceSupported&&(this.attach(),this.attached=!0,this.requestUpdate())}processDetach(){this.attached&&(this.attached=!1,this.removeHandles("attach"),this.detach(),this.updateRequested=!1)}requestUpdate(){this.destroyed||this.updateRequested||(this.updateRequested=!0,this.updateSuspended||this.view.requestUpdate())}processUpdate(t){!this.isFulfilled()||this.isResolved()?(this._set("updateParameters",t),this.updateRequested&&!this.updateSuspended&&(this.updateRequested=!1,this.update(t))):this.updateRequested=!1}hitTest(t,e){return Promise.resolve(null)}supportsSpatialReference(t){return!0}canResume(){if(!this.spatialReferenceSupported)return!1;switch(this.layer?.type){case"link-chart":case"knowledge-graph-sublayer":case"graphics":break;default:if(c(this.view)&&!this.view.inGeographicLayout)return!1}return!!super.canResume()&&this.visibleAtCurrentScale}getSuspendInfo(){const t=super.getSuspendInfo(),e=!this.spatialReferenceSupported;return e&&(t.spatialReferenceNotSupported=e),t}addAttachHandles(t){this.addHandles(t,"attach")}_addHighlights(t,e){this._highlightCounter.add(t,e)&&this._processHighlight()}_removeHighlights(t,e){this._highlightCounter.delete(t,e)&&this._processHighlight()}_processHighlight(){}_getHighlights(){const t=[];for(const[e,i]of this._highlightCounter.highlightNamesByObjectId){const s=this._getHighlightBits(i);t.push({objectId:e,highlightFlags:s})}return t}_getHighlightBits(t){const e=new Set(t);let i=1,s=0;if(!this.view)return 0;const r=this._mergedHighlights;for(const{name:h}of r)e.delete(h)&&(s=i),i<<=1;return s}};return t([l()],w.prototype,"attached",void 0),t([l({type:S,set(t){const e=i(t,this._get("clips"),S);this._set("clips",e)}})],w.prototype,"clips",void 0),t([l()],w.prototype,"container",void 0),t([l({type:R})],w.prototype,"highlightOptions",null),t([l({type:e.ofType(R)})],w.prototype,"highlights",void 0),t([l()],w.prototype,"_mergedHighlights",null),t([l()],w.prototype,"moving",void 0),t([l({readOnly:!0})],w.prototype,"spatialReferenceSupported",null),t([l({readOnly:!0})],w.prototype,"updateParameters",void 0),t([l()],w.prototype,"updateRequested",void 0),t([l()],w.prototype,"updating",null),t([l()],w.prototype,"view",void 0),t([l()],w.prototype,"_visibleAtCurrentScale",void 0),t([l({readOnly:!0})],w.prototype,"visibleAtCurrentScale",null),w=t([p("esri.views.2d.layers.LayerView2D")],w),w};export{b as LayerView2DMixin};
5
+ import{__decorate as t}from"tslib";import e from"../../../core/Collection.js";import{referenceSetter as i}from"../../../core/collectionUtils.js";import{deprecatedFunction as s}from"../../../core/deprecate.js";import r from"../../../core/Error.js";import h from"../../../core/Logger.js";import{watch as o,on as a,syncAndInitial as n}from"../../../core/reactiveUtils.js";import{property as l,subclass as p}from"../../../core/accessorSupport/decorators.js";import{isLinkChartView as c}from"../../../linkChart/utils.js";import{Container as d}from"../engine/Container.js";import{HighlightCounter as g}from"./support/HighlightCounter.js";import{createOrReuseHighlightGradient as u}from"./support/util.js";import{getDefaultHighlightOptions as m,setDefaultHighlightOptions as f}from"../support/highlightOptionsUtils.js";import y from"../../layers/support/ClipRect.js";import v from"../../layers/support/GeometryClipArea.js";import w from"../../layers/support/Path.js";import R from"../../support/HighlightOptions.js";import{isInEffectiveScaleRange as _}from"../../support/layerViewUtils.js";const S=e.ofType({key:"type",base:null,typeMap:{rect:y,path:w,geometry:v}}),H=new(e.ofType(R)),b=y=>{const v=y;let w=class extends v{constructor(){super(...arguments),this._highlightCounter=new g,this.attached=!1,this.clips=new S,this.highlights=null,this.lastUpdateId=-1,this.moving=!1,this.updateRequested=!1,this._visibleAtCurrentScale=!0}initialize(){const t=this.view?.spatialReferenceLocked??!0,e=this.view?.spatialReference;e&&t&&!this.spatialReferenceSupported?this.addResolvingPromise(Promise.reject(new r("layerview:spatial-reference-incompatible","The spatial reference of this layer does not meet the requirements of the view",{layer:this.layer}))):(this.container||(this.container=new d),this.container.fadeTransitionEnabled=!0,this.container.visible=!1,this.container.endTransitions(),this.addHandles([o(()=>this.suspended,t=>{this.container&&(this.container.visible=!t)},n),o(()=>this.updateSuspended,t=>{this.view&&!t&&this.updateRequested&&this.view.requestUpdate()},n),o(()=>this.layer?.opacity??1,t=>{this.container&&(this.container.opacity=t)},n),o(()=>this.layer&&"blendMode"in this.layer?this.layer.blendMode:"normal",t=>{this.container&&(this.container.blendMode=t)},n),o(()=>this.layer&&"effect"in this.layer?this.layer.effect:null,t=>{this.container&&(this.container.effect=t)},n),o(()=>this._mergedHighlights.items.map(t=>({name:t.name,options:{fillColor:t.color,haloColor:t.haloColor,fillOpacity:t.fillOpacity,haloOpacity:t.haloOpacity,haloWidth:t.haloWidth,haloBlur:t.haloBlur}})),()=>{this.container.highlightGradient=u(this.container.highlightGradient,this._mergedHighlights.items)},n),o(()=>this._mergedHighlights.items.map(t=>t.name),()=>{this._processHighlight()}),a(()=>this.clips,"change",()=>{this.container&&(this.container.clips=this.clips)},n),o(()=>({scale:this.view?.scale,scaleRange:this.layer&&"effectiveScaleRange"in this.layer?this.layer.effectiveScaleRange:null}),({scale:t,scaleRange:e})=>{const i=_(e,t);i!==this._visibleAtCurrentScale&&(this._visibleAtCurrentScale=i)},n)],"constructor"),this.view?.whenLayerView?this.view.whenLayerView(this.layer).then(t=>{t===this&&this.processAttach()},()=>{}):this.when().then(()=>{this.processAttach()},()=>{}))}destroy(){this.processDetach(),this.updateRequested=!1}get highlightOptions(){return this._logHighlightOptionsDeprecation(),m(this)}set highlightOptions(t){this._logHighlightOptionsDeprecation(),f(this,t)}_logHighlightOptionsDeprecation(){s(h.getLogger(this),"`LayerView.highlightOptions` is deprecated in favor of View.highlights",{replacement:"View.highlights",version:"4.34",see:"https://arcg.is/inbTa1#highlights",warnOnce:!0})}get hasHighlight(){return this._highlightCounter.size>0}get _mergedHighlights(){if(!this.view)return H;if(!this.highlights)return this.view.highlights;const t=this.view.highlights.clone();for(const e of this.highlights){const i=t.find(t=>t.name===e.name);i&&i.assignFrom(e)}return t}get highlightIds(){return Array.from(this._highlightCounter.objectIds)}get scheduler(){return this.view.scheduler}get spatialReferenceSupported(){const t=this.view?.spatialReference;return null==t||this.supportsSpatialReference(t)}get updating(){return this.spatialReferenceSupported&&(!this.attached||!this.suspended&&(this.updateRequested||this.isUpdating())||!!this._updatingHandles?.updating||this.container.transitioning)}get visibleAtCurrentScale(){return this._visibleAtCurrentScale}processAttach(){this.isResolved()&&!this.attached&&!this.destroyed&&this.spatialReferenceSupported&&(this.attach(),this.attached=!0,this.requestUpdate())}processDetach(){this.attached&&(this.attached=!1,this.removeHandles("attach"),this.detach(),this.updateRequested=!1)}requestUpdate(){this.destroyed||this.updateRequested||(this.updateRequested=!0,this.updateSuspended||this.view.requestUpdate())}processUpdate(t){!this.isFulfilled()||this.isResolved()?(this._set("updateParameters",t),this.updateRequested&&!this.updateSuspended&&(this.updateRequested=!1,this.update(t))):this.updateRequested=!1}hitTest(t,e){return Promise.resolve(null)}supportsSpatialReference(t){return!0}canResume(){if(!this.spatialReferenceSupported)return!1;switch(this.layer?.type){case"link-chart":case"knowledge-graph-sublayer":case"graphics":break;default:if(c(this.view)&&!this.view.inGeographicLayout)return!1}return!!super.canResume()&&this.visibleAtCurrentScale}getSuspendInfo(){const t=super.getSuspendInfo(),e=!this.spatialReferenceSupported;return e&&(t.spatialReferenceNotSupported=e),t}addAttachHandles(t){this.addHandles(t,"attach")}_addHighlights(t,e){this._highlightCounter.add(t,e)&&this._processHighlight()}_removeHighlights(t,e){this._highlightCounter.delete(t,e)&&this._processHighlight()}_processHighlight(){}_getHighlights(){const t=[];for(const[e,i]of this._highlightCounter.highlightNamesByObjectId){const s=this._getHighlightBits(i);t.push({objectId:e,highlightFlags:s})}return t}_getHighlightBits(t){const e=new Set(t);let i=1,s=0;if(!this.view)return 0;const r=this._mergedHighlights;for(const{name:h}of r)e.delete(h)&&(s=i),i<<=1;return s}};return t([l()],w.prototype,"attached",void 0),t([l({type:S,set(t){const e=i(t,this._get("clips"),S);this._set("clips",e)}})],w.prototype,"clips",void 0),t([l()],w.prototype,"container",void 0),t([l({type:R})],w.prototype,"highlightOptions",null),t([l({type:e.ofType(R)})],w.prototype,"highlights",void 0),t([l()],w.prototype,"_mergedHighlights",null),t([l()],w.prototype,"moving",void 0),t([l({readOnly:!0})],w.prototype,"spatialReferenceSupported",null),t([l({readOnly:!0})],w.prototype,"updateParameters",void 0),t([l()],w.prototype,"updateRequested",void 0),t([l()],w.prototype,"updating",null),t([l()],w.prototype,"view",void 0),t([l()],w.prototype,"_visibleAtCurrentScale",void 0),t([l({readOnly:!0})],w.prototype,"visibleAtCurrentScale",null),w=t([p("esri.views.2d.layers.LayerView2D")],w),w};export{b as LayerView2DMixin};
@@ -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/Error.js";import{EventedMixin as r}from"../../core/Evented.js";import{when as n}from"../../core/reactiveUtils.js";import{property as i}from"../../core/accessorSupport/decorators/property.js";import{subclass as a}from"../../core/accessorSupport/decorators/subclass.js";import{fromValues as s,create as o,equals as l,intersection as u}from"../../geometry/support/aaBoundingRect.js";import d from"../GroundView.js";import{ElevationRange as p}from"./support/ElevationRange.js";import{toBoundingRect as g}from"./support/extentUtils.js";import{webMercatorWorldExtent as h,geographicWorldExtent as c}from"./terrain/TerrainConst.js";import{isIntegratedMeshLayerView as v}from"../support/layerViewUtils.js";let y=class extends(r(d)){constructor(){super(...arguments),this._integratedMeshElevationUpdateHandles=new Map}initialize(){super.initialize(),this.addHandles(n(()=>this._terrainSurface,e=>e.on("elevation-change",e=>this._elevationChange(e))));const e=this._integratedMeshElevationUpdateHandles;this.addHandles(this.view.allLayerViews.on("change",t=>{t.added.forEach(t=>{v(t)&&e.set(t,t.elevationProvider.on("elevation-change",e=>this._elevationChange(e)))}),t.removed.forEach(t=>{v(t)&&(e.get(t)?.remove(),e.delete(t))})}))}destroy(){this._integratedMeshElevationUpdateHandles.forEach(e=>e.remove()),this._integratedMeshElevationUpdateHandles.clear()}_elevationChange(e){this.emit("elevation-change",e)}get _integratedMeshGroundLayerView(){const e=this.ground?.integratedMeshGround;if(e)return this.view.basemapView?.groundLayerViews.find(t=>t.layer===e)}get _terrainSurface(){return this.view.basemapTerrain}get _usingTerrain(){return this._terrainSurface?.enabled??!1}get _usingIntegratedMesh(){return this._integratedMeshGroundLayerView?.visible??!1}get spatialReference(){return this._terrainSurface?.spatialReference}get userClippingExtent(){const{spatialReference:e}=this,{clippingArea:t}=this.view;if(null==t||null==e)return null;const r=o(),n=g(t,r,e)?r:null,i=this._get("userClippingExtent");return l(n,i)?i:n}intersect(e,t,r,n){this._usingTerrain&&this._terrainSurface?.intersect(e,t,r,n);for(const i of this._integratedMeshElevationUpdateHandles.keys())i.intersect(e,t,r,n)}get updating(){return!this.suspended&&((this._source?.updating??!1)||this.layerViews.some(({updating:e})=>e))}getElevation(e,t,r,n){return this._elevationProvider?.getElevation(e,t,r,n)}getElevations(e,t,r){const{_elevationProvider:n}=this;if(n?.getElevations)return n.getElevations(e,t,r);for(let i=0;i<t;++i)r(i,null)}getSphereElevationRange(e,t,r){return this._elevationProvider?.getSphereElevationRange?.(e,t)}getRootElevationRange(){return this._elevationProvider?.getRootElevationRange?.()}get _elevationProvider(){return this._usingIntegratedMesh?this._integratedMeshGroundLayerView?.elevationProvider:this._terrainSurface}get elevationQueryCache(){return this._usingTerrain?this._terrainSurface?.elevationQueryCache:null}get groundExtent(){const{fullGroundExtent:e}=this;return e?this.userClippingExtent?u(e,this.userClippingExtent,o()):this.fullGroundExtent:null}get fullGroundExtent(){if(this._usingTerrain)return this._terrainSurface.fullGroundExtent;if(this._usingIntegratedMesh){const e=this.view.spatialReference;if(e.isWebMercator||e.isWGS84)return _(this.view.state.viewingMode,e);throw new t("GroundView:unsupportedSpatialReference","View spatial reference incompatible with groundLayer")}return null}get visibleElevationRange(){return this._source?.visibleElevationRange??f}get baseOpacity(){return this.ground?.opacity??1}get wireframe(){return!!this._usingTerrain&&(this._terrainSurface?.wireframe??!1)}get suspended(){return this._source?.suspended??!1}get ready(){return this._source?.ready??!1}updateOverlayParameters(){this._terrainSurface?.updateOverlayParameters()}get _source(){return this._usingTerrain?this._terrainSurface:this._usingIntegratedMesh?this._integratedMeshGroundLayerView:null}requestRender(e){this.view.stage.renderView?.requestRender(e)}};e([i({readOnly:!0})],y.prototype,"_integratedMeshGroundLayerView",null),e([i({readOnly:!0})],y.prototype,"_terrainSurface",null),e([i({readOnly:!0})],y.prototype,"_usingTerrain",null),e([i({readOnly:!0})],y.prototype,"_usingIntegratedMesh",null),e([i({readOnly:!0})],y.prototype,"spatialReference",null),e([i({readOnly:!0})],y.prototype,"userClippingExtent",null),e([i({type:Boolean,readOnly:!0})],y.prototype,"updating",null),e([i({readOnly:!0})],y.prototype,"elevationQueryCache",null),e([i({readOnly:!0})],y.prototype,"groundExtent",null),e([i({readOnly:!0})],y.prototype,"fullGroundExtent",null),e([i({readOnly:!0})],y.prototype,"visibleElevationRange",null),e([i({readOnly:!0})],y.prototype,"baseOpacity",null),e([i({readOnly:!0})],y.prototype,"wireframe",null),e([i({readOnly:!0})],y.prototype,"suspended",null),e([i({readOnly:!0})],y.prototype,"ready",null),y=e([a("esri.views.3d.GroundView3D")],y);const f=new p(0,0);function _(e,t){return 1===e?t.isWebMercator?h:c:t.isWebMercator?E:c}const m=85.0511,E=s(h[0],h[1]*m/90,h[2],h[3]*m/90);export{y as GroundView3D};
5
+ import{__decorate as e}from"tslib";import t from"../../core/Error.js";import{EventedMixin as r}from"../../core/Evented.js";import{when as n}from"../../core/reactiveUtils.js";import{property as i}from"../../core/accessorSupport/decorators/property.js";import{subclass as a}from"../../core/accessorSupport/decorators/subclass.js";import{create as s,equals as o,intersection as l}from"../../geometry/support/aaBoundingRect.js";import u from"../GroundView.js";import{ElevationRange as d}from"./support/ElevationRange.js";import{toBoundingRect as p}from"./support/extentUtils.js";import{webMercatorWorldExtent as g,geographicWorldExtent as h}from"./terrain/TerrainConst.js";import{isIntegratedMeshLayerView as c}from"../support/layerViewUtils.js";let v=class extends(r(u)){constructor(){super(...arguments),this._integratedMeshElevationUpdateHandles=new Map}initialize(){super.initialize(),this.addHandles(n(()=>this._terrainSurface,e=>e.on("elevation-change",e=>this._elevationChange(e))));const e=this._integratedMeshElevationUpdateHandles;this.addHandles(this.view.allLayerViews.on("change",t=>{t.added.forEach(t=>{c(t)&&e.set(t,t.elevationProvider.on("elevation-change",e=>this._elevationChange(e)))}),t.removed.forEach(t=>{c(t)&&(e.get(t)?.remove(),e.delete(t))})}))}destroy(){this._integratedMeshElevationUpdateHandles.forEach(e=>e.remove()),this._integratedMeshElevationUpdateHandles.clear()}_elevationChange(e){this.emit("elevation-change",e)}get _integratedMeshGroundLayerView(){const e=this.ground?.integratedMeshGround;if(e)return this.view.basemapView?.groundLayerViews.find(t=>t.layer===e)}get _terrainSurface(){return this.view.basemapTerrain}get _usingTerrain(){return this._terrainSurface?.enabled??!1}get _usingIntegratedMesh(){return this._integratedMeshGroundLayerView?.visible??!1}get spatialReference(){return this._terrainSurface?.spatialReference}get userClippingExtent(){const{spatialReference:e}=this,{clippingArea:t}=this.view;if(null==t||null==e)return null;const r=s(),n=p(t,r,e)?r:null,i=this._get("userClippingExtent");return o(n,i)?i:n}intersect(e,t,r,n){this._usingTerrain&&this._terrainSurface?.intersect(e,t,r,n);for(const i of this._integratedMeshElevationUpdateHandles.keys())i.intersect(e,t,r,n)}get updating(){return!this.suspended&&((this._source?.updating??!1)||this.layerViews.some(({updating:e})=>e))}getElevation(e,t,r,n){return this._elevationProvider?.getElevation(e,t,r,n)}getElevations(e,t,r){const{_elevationProvider:n}=this;if(n?.getElevations)return n.getElevations(e,t,r);for(let i=0;i<t;++i)r(i,null)}getSphereElevationRange(e,t,r){return this._elevationProvider?.getSphereElevationRange?.(e,t)}getRootElevationRange(){return this._elevationProvider?.getRootElevationRange?.()}get _elevationProvider(){return this._usingIntegratedMesh?this._integratedMeshGroundLayerView?.elevationProvider:this._terrainSurface}get elevationQueryCache(){return this._usingTerrain?this._terrainSurface?.elevationQueryCache:null}get groundExtent(){const{fullGroundExtent:e}=this;return e?this.userClippingExtent?l(e,this.userClippingExtent,s()):this.fullGroundExtent:null}get fullGroundExtent(){if(this._usingTerrain)return this._terrainSurface.fullGroundExtent;if(this._usingIntegratedMesh){const e=this.view.spatialReference;if(e.isWebMercator||e.isWGS84)return f(e);throw new t("GroundView:unsupportedSpatialReference","View spatial reference incompatible with groundLayer")}return null}get visibleElevationRange(){return this._source?.visibleElevationRange??y}get baseOpacity(){return this.ground?.opacity??1}get wireframe(){return!!this._usingTerrain&&(this._terrainSurface?.wireframe??!1)}get suspended(){return this._source?.suspended??!1}get ready(){return this._source?.ready??!1}updateOverlayParameters(){this._terrainSurface?.updateOverlayParameters()}get _source(){return this._usingTerrain?this._terrainSurface:this._usingIntegratedMesh?this._integratedMeshGroundLayerView:null}requestRender(e){this.view.stage.renderView?.requestRender(e)}};e([i({readOnly:!0})],v.prototype,"_integratedMeshGroundLayerView",null),e([i({readOnly:!0})],v.prototype,"_terrainSurface",null),e([i({readOnly:!0})],v.prototype,"_usingTerrain",null),e([i({readOnly:!0})],v.prototype,"_usingIntegratedMesh",null),e([i({readOnly:!0})],v.prototype,"spatialReference",null),e([i({readOnly:!0})],v.prototype,"userClippingExtent",null),e([i({type:Boolean,readOnly:!0})],v.prototype,"updating",null),e([i({readOnly:!0})],v.prototype,"elevationQueryCache",null),e([i({readOnly:!0})],v.prototype,"groundExtent",null),e([i({readOnly:!0})],v.prototype,"fullGroundExtent",null),e([i({readOnly:!0})],v.prototype,"visibleElevationRange",null),e([i({readOnly:!0})],v.prototype,"baseOpacity",null),e([i({readOnly:!0})],v.prototype,"wireframe",null),e([i({readOnly:!0})],v.prototype,"suspended",null),e([i({readOnly:!0})],v.prototype,"ready",null),v=e([a("esri.views.3d.GroundView3D")],v);const y=new d(0,0);function f(e){return e.isWebMercator?g:h}export{v as GroundView3D};
@@ -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/Logger.js";import{removeMaybe as s}from"../../../core/maybe.js";import{watch as i,syncAndInitial as r}from"../../../core/reactiveUtils.js";import{convertUnit as a}from"../../../core/units.js";import{property as n,subclass as o}from"../../../core/accessorSupport/decorators.js";import{fromValues as l}from"../../../core/libs/gl-matrix-2/factories/quatf64.js";import{isCompatible as h}from"../../../geometry/support/heightModelInfoUtils.js";import{isPlateCarree as d,isWebMercator as u,equals as p}from"../../../geometry/support/spatialReferenceUtils.js";import{getHeightModelInfoFromVCS as c}from"../../../layers/support/tiles3DUtils.js";import{getElevationOffsetInMeters as f}from"../../../support/elevationInfoUtils.js";import{getMetersPerUnit as m}from"../../../symbols/support/unitConversionUtils.js";import{GaussianSplatLayerViewPerformanceInfo as y}from"./GaussianSplatLayerViewPerformanceInfo.js";import{LayerView3D as _}from"./LayerView3D.js";import{addLayerViewToWasm as g,getLyr3DWasm as w,removeLayerViewFromWasm as b}from"./Lyr3DWasm.js";import{Obb as v}from"../support/orientedBoundingBox.js";import{splatPageSizeInU32 as C,elementsPerSplatPage as M,packedGaussianSizeInU32 as S,splatPageSizeInU32WithoutHeader as H,gaussiansPerSplatPage as x,splatAtlasTextureWidth as U}from"../support/gaussianSplatting/GaussianSplatAtlasPages.js";import{GaussianSplatFadeHelper as V}from"../support/gaussianSplatting/GaussianSplatFadeHelper.js";import{GaussianTile as j}from"../support/gaussianSplatting/GaussianTile.js";import{GaussianSplatRenderNode as A}from"../webgl-engine/lib/GaussianSplatRenderNode.js";import I from"../../layers/LayerView.js";import{spatialReferenceIncompatibleError as L,isInEffectiveScaleRange as R}from"../../support/layerViewUtils.js";const E=()=>t.getLogger("esri.views.3d.layers.GaussianSPlatLayerView3D");let O=class extends(_(I)){constructor(e){super(e),this.type="gaussian-splat-3d",this.ignoresMemoryFactor=!1,this._tileHandles=new Map,this._pageBuffer=new Uint32Array(C),this._wasmLayerId=-1,this._metersPerVCSUnit=1,this._usedMemory=0,this._cacheMemory=0,this._useEsriCrs=!1,this.fullExtentInLocalViewSpatialReference=null,this._suspendedHandle=null,this._conversionBuffer=new ArrayBuffer(4),this._u32View=new Uint32Array(this._conversionBuffer),this._f32View=new Float32Array(this._conversionBuffer);const{view:t}=e;this._memCache=t.resourceController.memoryController.newCache(`GaussianSplat-${this.uid}`,e=>this._deleteTile(e)),this._fadeHelper=new V(this),this._renderNode=new A({view:t,fadeHelper:this._fadeHelper})}initialize(){if(!this._canProjectWithoutEngine())throw L("layer",this.layer.spatialReference.wkid,this.view.renderSpatialReference?.wkid);const e=g(this).then(e=>{this._wasmLayerId=e,this.addHandles([i(()=>this.layer.elevationInfo,e=>this._elevationInfoChanged(e))]),this._suspendedHandle=i(()=>this.suspended,e=>this._wasm?.setEnabled(this,!e),r)});this.addHandles([i(()=>this.view.qualitySettings.fadeDuration,e=>{this._fadeHelper.onFadeDurationChanged(e),this.data.fadingTexture.updateTexture(this.data.textureAtlas.pageAllocator.pageCount)})]),this.addResolvingPromise(e)}get wasmLayerId(){return this._wasmLayerId}get metersPerVCSUnit(){return this._metersPerVCSUnit}get tileHandles(){return this._tileHandles}get _wasm(){return w(this.view)}get usedMemory(){return this._usedMemory}get cachedMemory(){return this._cacheMemory}get unloadedMemory(){return 0}get useEsriCrs(){return this._useEsriCrs}get data(){return this._renderNode.data}get visibleAtCurrentScale(){return R(this.layer.effectiveScaleRange,this.view.scale)}isUpdating(){const e=this._wasm;return!(this._wasmLayerId<0||null==e)&&(e.isUpdating(this._wasmLayerId)||this._renderNode.data.isUpdating()||this._fadeHelper.isUpdating())}updatingFlagChanged(){this.notifyChange("updating")}async createRenderable(e){const t=e.meshData;if(null==t.data)throw new Error("meshData.data undefined");if(t.desc=JSON.parse(t.desc),null==t.desc)throw new Error("meshData.desc undefined");const s=t.desc.prims[0],i=s.vertexCount,r=s.atrbs[0].view,a=s.atrbs[0].view.byteCount,n=s.atrbs[0].view.byteOffset;let o=null;if("U32"!==r.type)return E().warnOnce("unexpected meshData.data format"),{memUsageBytes:0};o=new Uint32Array(t.data.buffer,n,a/4);const h=this.extractHeader(o),d=Math.ceil(i/x),u=new Uint32Array(i),p=[];for(let l=0;l<d;l++){let e=this.data.textureAtlas.requestPage();if(null===e&&(this._freeInvisibleTiles(),e=this.data.textureAtlas.requestPage()),null===e)return E().warnOnce("ran out of gaussian splat memory"),{memUsageBytes:0};{p.push(e);const t=i-l*x,s=Math.min(t,x),r=l*x;for(let i=0;i<s;i++)u[i+r]=i+M*e;const a=l*H;this._pageBuffer.set(o.subarray(a,a+s*S)),this._pageBuffer.set(h.packedHeader,H);const n=e*M,d=n%U,c=Math.floor(n/U);this.data.textureAtlas.update(d,c,this._pageBuffer)}}const c=new Float64Array(3*i),f=new Float64Array(i),m=2.048,y=h.tileOrigin.x*m,_=h.tileOrigin.y*m,g=h.tileOrigin.z*m,w=h.invPosScale;let b=0,C=0;for(let l=0;l<i;l++){const e=l*S,{rawX:t,rawY:s,rawZ:i}=this._extractGaussianPosition(o,e),r=this._extractGaussianSphericalScale(o,e);c[b]=t*w+y,c[b+1]=s*w+_,c[b+2]=i*w+g,f[l]=r*r,C=Math.max(C,r),b+=3}let V=null;if(t.desc.obb){const e=t.desc.obb.quaternion;V=new v(t.desc.obb.center,t.desc.obb.halfSize,l(...e))}V||(E().warnOnce("encountered tile without a bounding box"),V=new v);const A=new j(e.handle,V,u,p,c,f,C);return this._memCache.put(`${A.handle}`,A),this._tileHandles.set(e.handle,A),this._cacheMemory+=A.usedMemory,{memUsageBytes:A.usedMemory}}_extractGaussianPosition(e,t){const s=e[t+1];return{rawX:16383&s,rawY:s>>>14&16383,rawZ:s>>>28&15|(1023&e[t+2])<<4}}_extractGaussianSphericalScale(e,t){const s=e[t+2],i=s>>>10&255,r=s>>>18&255,a=s>>>26&63|(3&e[t+3])<<6,n=Math.exp(i/16-10),o=Math.exp(r/16-10),l=Math.exp(a/16-10);return Math.max(n,o,l)}freeRenderable(e){const t=this._tileHandles.get(e);t&&(t.isVisible&&!this._fadeHelper.isTileFadingOut(t)?this._usedMemory-=t.usedMemory:this._cacheMemory-=t.usedMemory,t.pageIds.forEach(e=>this.data.textureAtlas.freePage(e)),this.freeObject(t),this._tileHandles.delete(e)),this.updateGaussians()}freeObject(e){this._memCache.pop(`${e.handle}`)}setRenderableVisibility(e,t,s){for(let i=0;i<s;i++){if(!t[i])continue;const s=e[i],r=this._tileHandles.get(s);r&&(r.isVisible&&!this._fadeHelper.isTileFadingOut(r)||(r.isVisible=!0,this._fadeHelper.isTileFadingOut(r)||this._popTileFromCache(r),this._fadeHelper.fadeTile(r,0)))}for(let i=0;i<s;i++){if(t[i])continue;const s=e[i],r=this._tileHandles.get(s);r&&r.isVisible&&this._fadeHelper.fadeTile(r,1)}this.updateGaussians()}_popTileFromCache(e){this._usedMemory+=e.usedMemory,this._cacheMemory-=e.usedMemory,this._memCache.pop(`${e.handle}`)}moveTileToCache(e){this._usedMemory-=e.usedMemory,this._cacheMemory+=e.usedMemory,this._memCache.put(`${e.handle}`,e)}destroy(){b(this),this._suspendedHandle&&(this._suspendedHandle=s(this._suspendedHandle)),this._renderNode.destroy(),this._memCache.destroy()}_canProjectWithoutEngine(){if(1===this.view.state.viewingMode)return!0;if(d(this.view.renderSpatialReference)||u(this.view.renderSpatialReference))return!0;if(this.layer.esriCrsSpatialReference&&p(this.layer.esriCrsSpatialReference,this.view.renderSpatialReference)){const e=c(this.layer.esriCrsSpatialReference),t=this.view.heightModelInfo;return this._useEsriCrs=0===h(e,t,!1),this._useEsriCrs&&e&&(this._metersPerVCSUnit=a(1,"meters",e.heightUnit),this.fullExtentInLocalViewSpatialReference=this.layer.esriCrsFullExtent),this._useEsriCrs}return!1}_elevationInfoChanged(e){if(e?.offset)if(this._useEsriCrs){const t=m(e?.unit)/this._metersPerVCSUnit,s=e?.offset??0;this._wasm?.setLayerOffset(this,s*t)}else this._wasm?.setLayerOffset(this,f(e));else this._wasm?.setLayerOffset(this,0)}updateGaussians(){const e=new Array;for(const t of this._tileHandles.values())t.isVisible&&e.push(t);this.data.updateGaussianVisibility(e),this.notifyChange("updating")}_freeInvisibleTiles(){for(const e of this._tileHandles.values())e.isVisible||this._deleteTile(e)}extractHeader(e){const t=e.length-4,s=this.reinterpretU32AsFloat(e[t]),i=this.reinterpretU32AsFloat(e[t+1]),r=this.reinterpretU32AsFloat(e[t+2]),a=1/(1<<(255&e[t+3]));return{packedHeader:e.subarray(t,t+4),tileOrigin:{x:s,y:i,z:r},invPosScale:a}}_deleteTile(e){this._wasm?.onRenderableEvicted(this,e.handle,e.usedMemory),this.freeRenderable(e.handle)}reinterpretU32AsFloat(e){return this._u32View[0]=e,this._f32View[0]}get performanceInfo(){let e=0,t=0;return this._tileHandles.forEach(s=>{s.isVisible?e++:t++}),new y(this.usedMemory,e,t,this.cachedMemory)}};e([n()],O.prototype,"layer",void 0),e([n({readOnly:!0})],O.prototype,"visibleAtCurrentScale",null),e([n()],O.prototype,"fullExtentInLocalViewSpatialReference",void 0),O=e([o("esri.views.3d.layers.GaussianSplatLayerView3D")],O);const P=O;export{P as default};
5
+ import{__decorate as e}from"tslib";import t from"../../../core/Logger.js";import{removeMaybe as s}from"../../../core/maybe.js";import{watch as i,syncAndInitial as r}from"../../../core/reactiveUtils.js";import{convertUnit as a}from"../../../core/units.js";import{property as n,subclass as o}from"../../../core/accessorSupport/decorators.js";import{fromValues as l}from"../../../core/libs/gl-matrix-2/factories/quatf64.js";import{isCompatible as h}from"../../../geometry/support/heightModelInfoUtils.js";import{isPlateCarree as d,isWebMercator as u,equals as p}from"../../../geometry/support/spatialReferenceUtils.js";import{getHeightModelInfoFromVCS as c}from"../../../layers/support/tiles3DUtils.js";import{getElevationOffsetInMeters as f}from"../../../support/elevationInfoUtils.js";import{getMetersPerUnit as m}from"../../../symbols/support/unitConversionUtils.js";import{GaussianSplatLayerViewPerformanceInfo as y}from"./GaussianSplatLayerViewPerformanceInfo.js";import{LayerView3D as _}from"./LayerView3D.js";import{addLayerViewToWasm as g,getLyr3DWasm as w,removeLayerViewFromWasm as b}from"./Lyr3DWasm.js";import{Obb as v}from"../support/orientedBoundingBox.js";import{splatPageSizeInU32 as C,elementsPerSplatPage as M,packedGaussianSizeInU32 as S,splatPageSizeInU32WithoutHeader as H,gaussiansPerSplatPage as x,splatAtlasTextureWidth as U}from"../support/gaussianSplatting/GaussianSplatAtlasPages.js";import{GaussianSplatFadeHelper as V}from"../support/gaussianSplatting/GaussianSplatFadeHelper.js";import{GaussianTile as j}from"../support/gaussianSplatting/GaussianTile.js";import{GaussianSplatRenderNode as A}from"../webgl-engine/lib/GaussianSplatRenderNode.js";import I from"../../layers/LayerView.js";import{spatialReferenceIncompatibleError as L,isInEffectiveScaleRange as R}from"../../support/layerViewUtils.js";const E=()=>t.getLogger("esri.views.3d.layers.GaussianSplatLayerView3D");let O=class extends(_(I)){constructor(e){super(e),this.type="gaussian-splat-3d",this.ignoresMemoryFactor=!1,this._tileHandles=new Map,this._pageBuffer=new Uint32Array(C),this._wasmLayerId=-1,this._metersPerVCSUnit=1,this._usedMemory=0,this._cacheMemory=0,this._useEsriCrs=!1,this.fullExtentInLocalViewSpatialReference=null,this._suspendedHandle=null,this._conversionBuffer=new ArrayBuffer(4),this._u32View=new Uint32Array(this._conversionBuffer),this._f32View=new Float32Array(this._conversionBuffer);const{view:t}=e;this._memCache=t.resourceController.memoryController.newCache(`GaussianSplat-${this.uid}`,e=>this._deleteTile(e)),this._fadeHelper=new V(this),this._renderNode=new A({view:t,fadeHelper:this._fadeHelper})}initialize(){if(!this._canProjectWithoutEngine())throw L("layer",this.layer.spatialReference.wkid,this.view.renderSpatialReference?.wkid);const e=g(this).then(e=>{this._wasmLayerId=e,this.addHandles([i(()=>this.layer.elevationInfo,e=>this._elevationInfoChanged(e))]),this._suspendedHandle=i(()=>this.suspended,e=>this._wasm?.setEnabled(this,!e),r)});this.addHandles([i(()=>this.view.qualitySettings.fadeDuration,e=>{this._fadeHelper.onFadeDurationChanged(e),this.data.fadingTexture.updateTexture(this.data.textureAtlas.pageAllocator.pageCount)})]),this.addResolvingPromise(e)}get wasmLayerId(){return this._wasmLayerId}get metersPerVCSUnit(){return this._metersPerVCSUnit}get tileHandles(){return this._tileHandles}get _wasm(){return w(this.view)}get usedMemory(){return this._usedMemory}get cachedMemory(){return this._cacheMemory}get unloadedMemory(){return 0}get useEsriCrs(){return this._useEsriCrs}get data(){return this._renderNode.data}get visibleAtCurrentScale(){return R(this.layer.effectiveScaleRange,this.view.scale)}isUpdating(){const e=this._wasm;return!(this._wasmLayerId<0||null==e)&&(e.isUpdating(this._wasmLayerId)||this._renderNode.data.isUpdating()||this._fadeHelper.isUpdating())}updatingFlagChanged(){this.notifyChange("updating")}async createRenderable(e){const t=e.meshData;if(null==t.data)throw new Error("meshData.data undefined");if(t.desc=JSON.parse(t.desc),null==t.desc)throw new Error("meshData.desc undefined");const s=t.desc.prims[0],i=s.vertexCount,r=s.atrbs[0].view,a=s.atrbs[0].view.byteCount,n=s.atrbs[0].view.byteOffset;let o=null;if("U32"!==r.type)return E().warnOnce("unexpected meshData.data format"),{memUsageBytes:0};o=new Uint32Array(t.data.buffer,n,a/4);const h=this.extractHeader(o),d=Math.ceil(i/x),u=new Uint32Array(i),p=[];for(let l=0;l<d;l++){let e=this.data.textureAtlas.requestPage();if(null===e&&(this._freeInvisibleTiles(),e=this.data.textureAtlas.requestPage()),null===e)return E().warnOnce("ran out of gaussian splat memory"),{memUsageBytes:0};{p.push(e);const t=i-l*x,s=Math.min(t,x),r=l*x;for(let i=0;i<s;i++)u[i+r]=i+M*e;const a=l*H;this._pageBuffer.set(o.subarray(a,a+s*S)),this._pageBuffer.set(h.packedHeader,H);const n=e*M,d=n%U,c=Math.floor(n/U);this.data.textureAtlas.update(d,c,this._pageBuffer)}}const c=new Float64Array(3*i),f=new Float64Array(i),m=2.048,y=h.tileOrigin.x*m,_=h.tileOrigin.y*m,g=h.tileOrigin.z*m,w=h.invPosScale;let b=0,C=0;for(let l=0;l<i;l++){const e=l*S,{rawX:t,rawY:s,rawZ:i}=this._extractGaussianPosition(o,e),r=this._extractGaussianSphericalScale(o,e);c[b]=t*w+y,c[b+1]=s*w+_,c[b+2]=i*w+g,f[l]=r*r,C=Math.max(C,r),b+=3}let V=null;if(t.desc.obb){const e=t.desc.obb.quaternion;V=new v(t.desc.obb.center,t.desc.obb.halfSize,l(...e))}V||(E().warnOnce("encountered tile without a bounding box"),V=new v);const A=new j(e.handle,V,u,p,c,f,C);return this._memCache.put(`${A.handle}`,A),this._tileHandles.set(e.handle,A),this._cacheMemory+=A.usedMemory,{memUsageBytes:A.usedMemory}}_extractGaussianPosition(e,t){const s=e[t+1];return{rawX:16383&s,rawY:s>>>14&16383,rawZ:s>>>28&15|(1023&e[t+2])<<4}}_extractGaussianSphericalScale(e,t){const s=e[t+2],i=s>>>10&255,r=s>>>18&255,a=s>>>26&63|(3&e[t+3])<<6,n=Math.exp(i/16-10),o=Math.exp(r/16-10),l=Math.exp(a/16-10);return Math.max(n,o,l)}freeRenderable(e){const t=this._tileHandles.get(e);t&&(t.isVisible&&!this._fadeHelper.isTileFadingOut(t)?this._usedMemory-=t.usedMemory:this._cacheMemory-=t.usedMemory,t.pageIds.forEach(e=>this.data.textureAtlas.freePage(e)),this.freeObject(t),this._tileHandles.delete(e)),this.updateGaussians()}freeObject(e){this._memCache.pop(`${e.handle}`)}setRenderableVisibility(e,t,s){for(let i=0;i<s;i++){if(!t[i])continue;const s=e[i],r=this._tileHandles.get(s);r&&(r.isVisible&&!this._fadeHelper.isTileFadingOut(r)||(r.isVisible=!0,this._fadeHelper.isTileFadingOut(r)||this._popTileFromCache(r),this._fadeHelper.fadeTile(r,0)))}for(let i=0;i<s;i++){if(t[i])continue;const s=e[i],r=this._tileHandles.get(s);r&&r.isVisible&&this._fadeHelper.fadeTile(r,1)}this.updateGaussians()}_popTileFromCache(e){this._usedMemory+=e.usedMemory,this._cacheMemory-=e.usedMemory,this._memCache.pop(`${e.handle}`)}moveTileToCache(e){this._usedMemory-=e.usedMemory,this._cacheMemory+=e.usedMemory,this._memCache.put(`${e.handle}`,e)}destroy(){b(this),this._suspendedHandle&&(this._suspendedHandle=s(this._suspendedHandle)),this._renderNode.destroy(),this._memCache.destroy()}_canProjectWithoutEngine(){if(1===this.view.state.viewingMode)return!0;if(d(this.view.renderSpatialReference)||u(this.view.renderSpatialReference))return!0;if(this.layer.esriCrsSpatialReference&&p(this.layer.esriCrsSpatialReference,this.view.renderSpatialReference)){const e=c(this.layer.esriCrsSpatialReference),t=this.view.heightModelInfo;return this._useEsriCrs=0===h(e,t,!1),this._useEsriCrs&&e&&(this._metersPerVCSUnit=a(1,"meters",e.heightUnit),this.fullExtentInLocalViewSpatialReference=this.layer.esriCrsFullExtent),this._useEsriCrs}return!1}_elevationInfoChanged(e){if(e?.offset)if(this._useEsriCrs){const t=m(e?.unit)/this._metersPerVCSUnit,s=e?.offset??0;this._wasm?.setLayerOffset(this,s*t)}else this._wasm?.setLayerOffset(this,f(e));else this._wasm?.setLayerOffset(this,0)}updateGaussians(){const e=new Array;for(const t of this._tileHandles.values())t.isVisible&&e.push(t);this.data.updateGaussianVisibility(e),this.notifyChange("updating")}_freeInvisibleTiles(){for(const e of this._tileHandles.values())e.isVisible||this._deleteTile(e)}extractHeader(e){const t=e.length-4,s=this.reinterpretU32AsFloat(e[t]),i=this.reinterpretU32AsFloat(e[t+1]),r=this.reinterpretU32AsFloat(e[t+2]),a=1/(1<<(255&e[t+3]));return{packedHeader:e.subarray(t,t+4),tileOrigin:{x:s,y:i,z:r},invPosScale:a}}_deleteTile(e){this._wasm?.onRenderableEvicted(this,e.handle,e.usedMemory),this.freeRenderable(e.handle)}reinterpretU32AsFloat(e){return this._u32View[0]=e,this._f32View[0]}get performanceInfo(){let e=0,t=0;return this._tileHandles.forEach(s=>{s.isVisible?e++:t++}),new y(this.usedMemory,e,t,this.cachedMemory)}};e([n()],O.prototype,"layer",void 0),e([n({readOnly:!0})],O.prototype,"visibleAtCurrentScale",null),e([n()],O.prototype,"fullExtentInLocalViewSpatialReference",void 0),O=e([o("esri.views.3d.layers.GaussianSplatLayerView3D")],O);const F=O;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
- const t=4096,s=16,e=1023,i=e+1,n=t*s/i,r=4,o=i*r,h=e*r;class a{constructor(t=n){this._pageCount=t;const s=Math.ceil(t/32);this._bitset=new Uint32Array(s)}get pageCount(){return this._pageCount}isAllocated(t){const s=t/32|0,e=t%32;return!!(this._bitset[s]&1<<e)}allocate(t){const s=t/32|0,e=t%32;this._bitset[s]|=1<<e}free(t){const s=t/32|0,e=t%32;this._bitset[s]&=~(1<<e)}findFirstFreePage(){for(let t=0;t<this._bitset.length;t++)if(4294967295!==this._bitset[t])for(let s=0;s<32;s++){const e=32*t+s;if(e>=this._pageCount)break;if(!(this._bitset[t]&1<<s))return e}return null}resize(t){this._pageCount=t;const s=Math.ceil(t/32),e=this._bitset.length;if(s!==e){const t=new Uint32Array(s),i=Math.min(e,s);t.set(this._bitset.subarray(0,i)),this._bitset=t}this._clearExcessBits(this._bitset,t)}_clearExcessBits(t,s){const e=Math.floor((s-1)/32),i=(s-1)%32;if(s>0&&i<31){const s=(1<<i+1)-1;t[e]&=s}e+1<t.length&&t.fill(0,e+1)}}export{a as GaussianSplatAtlasPages,i as elementsPerSplatPage,e as gaussiansPerSplatPage,s as initialSplatAtlasTextureHeight,n as initialSplatAtlasTexturePages,r as packedGaussianSizeInU32,t as splatAtlasTextureWidth,o as splatPageSizeInU32,h as splatPageSizeInU32WithoutHeader};
5
+ const t=4096,s=64,e=1023,i=e+1,n=t*s/i,r=4,o=i*r,h=e*r,a=t*s;class c{constructor(t=n){this._pageCount=t;const s=Math.ceil(t/32);this._bitset=new Uint32Array(s)}get pageCount(){return this._pageCount}isAllocated(t){const s=t/32|0,e=t%32;return!!(this._bitset[s]&1<<e)}allocate(t){const s=t/32|0,e=t%32;this._bitset[s]|=1<<e}free(t){const s=t/32|0,e=t%32;this._bitset[s]&=~(1<<e)}findFirstFreePage(){for(let t=0;t<this._bitset.length;t++)if(4294967295!==this._bitset[t])for(let s=0;s<32;s++){const e=32*t+s;if(e>=this._pageCount)break;if(!(this._bitset[t]&1<<s))return e}return null}resize(t){this._pageCount=t;const s=Math.ceil(t/32),e=this._bitset.length;if(s!==e){const t=new Uint32Array(s),i=Math.min(e,s);t.set(this._bitset.subarray(0,i)),this._bitset=t}this._clearExcessBits(this._bitset,t)}_clearExcessBits(t,s){const e=Math.floor((s-1)/32),i=(s-1)%32;if(s>0&&i<31){const s=(1<<i+1)-1;t[e]&=s}e+1<t.length&&t.fill(0,e+1)}}export{c as GaussianSplatAtlasPages,i as elementsPerSplatPage,e as gaussiansPerSplatPage,s as initialSplatAtlasTextureHeight,n as initialSplatAtlasTexturePages,a as minExpectedGaussianCount,r as packedGaussianSizeInU32,t as splatAtlasTextureWidth,o as splatPageSizeInU32,h as splatPageSizeInU32WithoutHeader};
@@ -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{reallocGrowthFactor as e}from"../../../../core/arrayUtils.js";import{fromValues as t}from"../../../../core/libs/gl-matrix-2/factories/vec2f64.js";import"../../../webgl/BufferObject.js";import"../../../webgl/FramebufferObject.js";import"../../../webgl/Program.js";import"../../../../core/has.js";import"../../../webgl/Renderbuffer.js";import{Texture as r}from"../../../webgl/Texture.js";import"../../../../core/Logger.js";import{PixelType as i,SizedPixelFormat as s}from"../../../webgl/enums.js";import"../../../webgl/checkWebGLError.js";import{TextureDescriptor as a}from"../../../webgl/TextureDescriptor.js";class o{constructor(e){this.texture=null,this._fadeTextureCapacity=0,this._rctx=e}ensureCapacity(t){if(this._fadeTextureCapacity>t)return;const o=Math.ceil(t*e),[u,f]=this._evalTextureSize(o),c=u*f,p=this._fadeBuffer,h=new Uint8Array(c);p&&h.set(p.subarray(0,this._fadeTextureCapacity)),this._fadeBuffer=h,this._fadeTextureCapacity=c,this.texture?.dispose();const m=new a;m.width=u,m.height=f,m.pixelFormat=36244,m.dataType=i.UNSIGNED_BYTE,m.internalFormat=s.R8UI,m.unpackAlignment=1,m.wrapMode=33071,m.samplingMode=9728,m.isImmutable=!0,this.texture=new r(this._rctx,m)}updateTexture(e){this.ensureCapacity(e),this.texture?.setData(this._fadeBuffer)}updateBuffer(e,t){this.ensureCapacity(t+1),this._fadeBuffer&&(this._fadeBuffer[t]=e)}destroy(){this.texture?.dispose()}_evalTextureSize(e){const r=Math.ceil(Math.sqrt(e)),i=Math.ceil(e/r);return t(r,i)}}export{o as GaussianSplatFadeTexture};
5
+ import{reallocGrowthFactor as e}from"../../../../core/arrayUtils.js";import{fromValues as t}from"../../../../core/libs/gl-matrix-2/factories/vec2f64.js";import"../../../webgl/BufferObject.js";import"../../../webgl/FramebufferObject.js";import"../../../webgl/Program.js";import"../../../../core/has.js";import"../../../webgl/Renderbuffer.js";import{Texture as r}from"../../../webgl/Texture.js";import"../../../../core/Logger.js";import{PixelType as i,SizedPixelFormat as s}from"../../../webgl/enums.js";import"../../../webgl/checkWebGLError.js";import{minExpectedGaussianCount as a}from"./GaussianSplatAtlasPages.js";import{TextureDescriptor as o}from"../../../webgl/TextureDescriptor.js";class u{constructor(e){this.texture=null,this._fadeTextureCapacity=0,this._rctx=e}ensureCapacity(t){if(this._fadeTextureCapacity>t)return;const u=Math.max(Math.ceil(t*e),a),[f,p]=this._evalTextureSize(u),c=f*p,h=this._fadeBuffer,m=new Uint8Array(c);h&&m.set(h.subarray(0,this._fadeTextureCapacity)),this._fadeBuffer=m,this._fadeTextureCapacity=c,this.texture?.dispose();const l=new o;l.width=f,l.height=p,l.pixelFormat=36244,l.dataType=i.UNSIGNED_BYTE,l.internalFormat=s.R8UI,l.unpackAlignment=1,l.wrapMode=33071,l.samplingMode=9728,l.isImmutable=!0,this.texture=new r(this._rctx,l)}updateTexture(e){this.ensureCapacity(e);const t=this.texture.descriptor.width,r=Math.ceil(e/t),i=t*r;this.texture.updateData(0,0,0,t,r,this._fadeBuffer.subarray(0,i))}updateBuffer(e,t){this.ensureCapacity(t+1),this._fadeBuffer&&(this._fadeBuffer[t]=e)}destroy(){this.texture?.dispose()}_evalTextureSize(e){const r=Math.ceil(Math.sqrt(e)),i=Math.ceil(e/r);return t(r,i)}}export{u as GaussianSplatFadeTexture};
@@ -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{reallocGrowthFactor as e}from"../../../../core/arrayUtils.js";import{fromValues as t}from"../../../../core/libs/gl-matrix-2/factories/vec2f64.js";import"../../../webgl/BufferObject.js";import"../../../webgl/FramebufferObject.js";import"../../../webgl/Program.js";import"../../../../core/has.js";import"../../../webgl/Renderbuffer.js";import{Texture as r}from"../../../webgl/Texture.js";import"../../../../core/Logger.js";import{PixelType as i,SizedPixelFormat as s}from"../../../webgl/enums.js";import"../../../webgl/checkWebGLError.js";import{TextureDescriptor as o}from"../../../webgl/TextureDescriptor.js";class a{constructor(e){this.texture=null,this._orderTextureCapacity=0,this._rctx=e}ensureCapacity(t){if(this._orderTextureCapacity>=t)return;const a=Math.ceil(t*e),[u,c]=this._evalTextureSize(a),h=u*c;this._orderBuffer=new Uint32Array(h),this._orderTextureCapacity=h,this.texture?.dispose();const p=new o;p.width=u,p.height=c,p.pixelFormat=36244,p.dataType=i.UNSIGNED_INT,p.internalFormat=s.R32UI,p.wrapMode=33071,p.samplingMode=9728,p.isImmutable=!0,this.texture=new r(this._rctx,p),this._orderTextureCapacity=h}setData(e,t){this.ensureCapacity(t),this._orderBuffer?.set(e),this.texture?.setData(this._orderBuffer)}clear(){this._orderTextureCapacity=0,this.texture?.dispose(),this.texture=null}destroy(){this.texture?.dispose()}_evalTextureSize(e){const r=Math.ceil(Math.sqrt(e)),i=Math.ceil(e/r);return t(r,i)}}export{a as GaussianSplatOrderTexture};
5
+ import{reallocGrowthFactor as e}from"../../../../core/arrayUtils.js";import{fromValues as t}from"../../../../core/libs/gl-matrix-2/factories/vec2f64.js";import"../../../webgl/BufferObject.js";import"../../../webgl/FramebufferObject.js";import"../../../webgl/Program.js";import"../../../../core/has.js";import"../../../webgl/Renderbuffer.js";import{Texture as r}from"../../../webgl/Texture.js";import"../../../../core/Logger.js";import{PixelType as s,SizedPixelFormat as i}from"../../../webgl/enums.js";import"../../../webgl/checkWebGLError.js";import{minExpectedGaussianCount as a}from"./GaussianSplatAtlasPages.js";import{TextureDescriptor as o}from"../../../webgl/TextureDescriptor.js";class u{constructor(e){this.texture=null,this._orderTextureCapacity=0,this._rctx=e}ensureCapacity(t){if(this._orderTextureCapacity>=t)return;const u=Math.max(Math.ceil(t*e),a),[c,h]=this._evalTextureSize(u),p=c*h;this._orderBuffer=new Uint32Array(p),this._orderTextureCapacity=p,this.texture?.dispose();const l=new o;l.width=c,l.height=h,l.pixelFormat=36244,l.dataType=s.UNSIGNED_INT,l.internalFormat=i.R32UI,l.wrapMode=33071,l.samplingMode=9728,l.isImmutable=!0,this.texture=new r(this._rctx,l),this._orderTextureCapacity=p}setData(e,t){this.ensureCapacity(t),this._orderBuffer.set(e);const r=this.texture.descriptor.width,s=Math.ceil(t/r),i=r*s;this.texture.updateData(0,0,0,r,s,this._orderBuffer.subarray(0,i))}clear(){this._orderTextureCapacity=0,this.texture?.dispose(),this.texture=null}destroy(){this.texture?.dispose()}_evalTextureSize(e){const r=Math.ceil(Math.sqrt(e)),s=Math.ceil(e/r);return t(r,s)}}export{u as GaussianSplatOrderTexture};
@@ -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{watch as e}from"../../../../core/reactiveUtils.js";import{property as s,subclass as i}from"../../../../core/accessorSupport/decorators.js";import{set as a}from"../../../../core/libs/gl-matrix-2/math/vec2.js";import{e as r,b as n,j as o,q as h,g as l,E as p,d as m,J as u}from"../../../../chunks/vec32.js";import{create as c,clone as d}from"../../../../core/libs/gl-matrix-2/factories/vec3f64.js";import{c as f}from"../../../../chunks/vec42.js";import{create as _}from"../../../../geometry/support/plane.js";import{fromPoints as g}from"../../../../geometry/support/ray.js";import{Sphere as P}from"../../../../geometry/support/sphere.js";import{RenderCategory as b}from"../../webgl.js";import{GaussianSplatTarget as C}from"../../layers/i3s/Intersector.js";import{GaussianSplatDataStore as v}from"../../support/gaussianSplatting/GaussianSplatDataStore.js";import w from"../../webgl/RenderNode.js";import{IntersectorResult as y}from"./IntersectorResult.js";import{G as S}from"../../../../chunks/GaussianSplat.glsl.js";import{G as x}from"../../../../chunks/GaussianSplatComposition.glsl.js";import{GaussianSplatCompositionTechnique as q}from"../shaders/GaussianSplatCompositionTechnique.js";import{G as T}from"../../../../chunks/GaussianSplatDepthComposition.glsl.js";import{GaussianSplatDepthCompositionTechnique as j}from"../shaders/GaussianSplatDepthCompositionTechnique.js";import{GaussianSplatDepthTechnique as D}from"../shaders/GaussianSplatDepthTechnique.js";import{GaussianSplatTechnique as G}from"../shaders/GaussianSplatTechnique.js";import{GaussianSplatTechniqueConfiguration as A}from"../shaders/GaussianSplatTechniqueConfiguration.js";import{DepthStencilAttachment as R,PrimitiveType as E}from"../../../webgl/enums.js";var F;let H=class extends w{static{F=this}constructor(t){super(t),this.gaussianPosition=c(),this.intersectionRayDir=c(),this.intersectionPlane=_(),this._slicePlaneEnabled=!1,this._data=null,this.produces=b.OPAQUE,this.type=0,this.isGround=!1,this.layerViewUid="",this._passParameters=new S,this._compositionPassParameters=new x,this._depthCompositionPassParameters=new T,this._previousCameraPosition=c(),this._previousCameraDirection=c(),this.fadeHelper=null,this._configuration=new A(t.view.state.isGlobal),this._depthConfiguration=new A(t.view.state.isGlobal,!0)}async initialize(){this._data=new v(this),this.view.sceneIntersectionHelper.addIntersectionHandler(this),this.addHandles([e(()=>this.view.state.camera,()=>this._onCameraChange())])}precompile(){this._configuration.alphaCutoff=this.view.qualitySettings.gaussianSplat.minimumOpacity,this._configuration.terrainDepthTest=this.bindParameters.terrainDepthTest,this._configuration.fadingEnabled=this.fadeHelper.fadingEnabled,this.techniques.precompile(G,this._configuration),this._depthConfiguration.alphaCutoff=this.view.qualitySettings.gaussianSplat.minimumOpacity,this._depthConfiguration.terrainDepthTest=this.bindParameters.terrainDepthTest,this.techniques.precompile(D,this._depthConfiguration),this.techniques.precompile(q),this.techniques.precompile(j)}render(t){const e=t.find(({name:t})=>t===b.OPAQUE);if(this._handleFading(),!this._data.visibleGaussians||!this._data.orderTexture.texture||!this._data.textureAtlas.texture)return e;const s=this.techniques.get(G,this._configuration),i=this.techniques.get(D,this._depthConfiguration),r=this.techniques.get(q),n=this.techniques.get(j);if(!(s.compiled&&i.compiled&&n.compiled&&r.compiled))return this.requestRender(1),e;const{fullWidth:o,fullHeight:h}=this.bindParameters.camera,l=this.fboCache,p=l.acquire(o,h,"gaussian color output");p.attachDepth(e.getAttachment(R));const m=this.renderingContext;m.bindFramebuffer(p.fbo),m.setClearColor(0,0,0,0),m.clear(16384),this._passParameters.totalGaussians=this._data.visibleGaussians,this._passParameters.splatOrder=this._data.orderTexture.texture,this._passParameters.splatFading=this._data.fadingTexture.texture,this._passParameters.splatAtlas=this._data.textureAtlas.texture;const u=Math.tan(.5*this.camera.fovY),c=u/h*o;a(this._passParameters.tanFov,c,u),this._passParameters.focalLength=h/(2*u);const d=this.view.qualitySettings.gaussianSplat.minimumSplatPixelRadius;this._passParameters.minSplatRadius=d*Math.sqrt(o*h)/Math.sqrt(2073600),this._prepareHighPrecisionCameraPosition(),this.renderingContext.bindTechnique(s,this.bindParameters,this._passParameters),this.renderingContext.drawArraysInstanced(E.TRIANGLE_STRIP,0,4,this._data.visibleGaussians);const f=l.acquire(o,h,"splat depth",8);f.attachDepth(e.getAttachment(R)),m.bindFramebuffer(f.fbo),m.setClearColor(0,0,0,0),m.clear(16384),this.renderingContext.bindTechnique(i,this.bindParameters,this._passParameters),this.renderingContext.drawArraysInstanced(E.TRIANGLE_STRIP,0,4,this._data.visibleGaussians);const _=l.acquire(o,h,this.produces);return this._depthCompositionPassParameters.splatDepth=f.getTexture(),_.attachDepth(e.getAttachment(R)),m.bindFramebuffer(_.fbo),m.bindTechnique(n,this.bindParameters,this._depthCompositionPassParameters),m.screen.draw(),this._compositionPassParameters.color=e.getTexture(),this._compositionPassParameters.splatColor=p.getTexture(),m.bindFramebuffer(_.fbo),m.bindTechnique(r,this.bindParameters,this._compositionPassParameters),m.screen.draw(),p.release(),f.release(),_}intersect(t,e,s,i){const{gaussianPosition:a,intersectionRayDir:m,intersectionPlane:u,layerViewUid:_}=this,b=g(s,i);r(m,i,s);const v=1/n(m);o(m,m,v);const w=c();h(w,m),f(u,m[0],m[1],m[2],-l(m,s));const S=new M,x=new M,q=new Array;this._data.visibleGaussianTiles.forEach(r=>{const{maxScale:n}=r,o=r.obb.minimumDistancePlane(u),h=r.obb.maximumDistancePlane(u),c=h<0,f=null!=S.dist&&null!=x.dist&&S.dist<o*v&&x.dist>h*v;if(c||f)return;if(!new P(r.obb.center,r.obb.radius+n).intersectRay(b,null))return;if(!r.obb.intersectRay(s,m,n))return;const{positions:g,squaredScales:C,gaussianAtlasIndices:y}=r,T=y.length;for(let u=0;u<T;u++){const r=3*u;a[0]=g[r]-s[0],a[1]=g[r+1]-s[1],a[2]=g[r+2]-s[2];const n=C[u],o=l(a,m),h=o*o;if(p(a)-h>n)continue;const c=o*v,f=t=>(t.point=t.point?t.point.fill(a[0],a[1],a[2]):d(a),t.dist=c,t.normal=w,t.layerViewUid=_,t);if((null==S.dist||c<S.dist)&&(null==e||e(s,i,c))&&f(S),0!==t.options.store&&(null==x.dist||c>x.dist)&&(null==e||e(s,i,c))&&f(x),2===t.options.store&&(null==e||e(s,i,c))){const t=new M;q.push(f(t))}}});const T=(t,e)=>{const{layerViewUid:s}=e,i=new C(e.point,s);t.set(0,i,e.dist,e.normal)};if(I(S)){const e=t.results.min;(null==e.distance||S.dist<e.distance)&&T(e,S)}if(I(x)&&0!==t.options.store){const e=t.results.max;(null==e.distance||x.dist>e.distance)&&T(e,x)}if(2===t.options.store)for(const r of q){const e=new y(b);T(e,r),t.results.all.push(e)}}get slicePlaneEnabled(){return this._slicePlaneEnabled}set slicePlaneEnabled(t){this._slicePlaneEnabled!==t&&(this._slicePlaneEnabled=t,this.requestRender(1))}get data(){return this._data}destroy(){this._data.destroy(),super.destroy()}_onCameraChange(){const t=this.view.state.camera.eye,e=this.view.state.camera.ray.direction,s=.001;(Math.abs(t[0]-this._previousCameraPosition[0])>s||Math.abs(t[1]-this._previousCameraPosition[1])>s||Math.abs(t[2]-this._previousCameraPosition[2])>s||Math.abs(e[0]-this._previousCameraDirection[0])>s||Math.abs(e[1]-this._previousCameraDirection[1])>s||Math.abs(e[2]-this._previousCameraDirection[2])>s)&&(m(this._previousCameraPosition,t),m(this._previousCameraDirection,e),this._data.requestSort())}_prepareHighPrecisionCameraPosition(){o(this._passParameters.tileCameraPosition,this.camera.eye,1/F.tileSize),u(this._passParameters.tileCameraPosition,this._passParameters.tileCameraPosition),o(this._passParameters.cameraDelta,this._passParameters.tileCameraPosition,F.tileSize),r(this._passParameters.cameraDelta,this.camera.eye,this._passParameters.cameraDelta)}_handleFading(){if(0===this.fadeHelper.numFadingTiles)return void(this._previousFrameStart=null);this._previousFrameStart??=this.view.stage.renderer.renderContext.time;const t=this.view.stage?.renderer.renderContext.time-this._previousFrameStart;this.fadeHelper.updateAllTileFading(t),this._previousFrameStart=this.view.stage.renderer.renderContext.time,this._data.fadingTexture.updateTexture(this._data.textureAtlas.pageAllocator.pageCount)}static{this.tileSize=2.048}};function I(t){return null!=t.dist&&null!=t.point}t([s({constructOnly:!0})],H.prototype,"fadeHelper",void 0),H=F=t([i("esri.views.3d.webgl-engine.lib.GaussianSplatRenderNode")],H);class M{constructor(){this.point=null,this.dist=null,this.normal=null,this.layerViewUid=""}}export{H as GaussianSplatRenderNode};
5
+ import{__decorate as t}from"tslib";import e from"../../../../core/Logger.js";import{watch as s}from"../../../../core/reactiveUtils.js";import{property as i,subclass as a}from"../../../../core/accessorSupport/decorators.js";import{set as r}from"../../../../core/libs/gl-matrix-2/math/vec2.js";import{e as n,b as o,j as l,q as h,g as p,E as u,d as c,J as m}from"../../../../chunks/vec32.js";import{create as d,clone as _}from"../../../../core/libs/gl-matrix-2/factories/vec3f64.js";import{c as f}from"../../../../chunks/vec42.js";import{create as g}from"../../../../geometry/support/plane.js";import{fromPoints as P}from"../../../../geometry/support/ray.js";import{Sphere as b}from"../../../../geometry/support/sphere.js";import{RenderCategory as S}from"../../webgl.js";import{GaussianSplatTarget as C}from"../../layers/i3s/Intersector.js";import{GaussianSplatDataStore as v}from"../../support/gaussianSplatting/GaussianSplatDataStore.js";import w from"../../webgl/RenderNode.js";import{IntersectorResult as D}from"./IntersectorResult.js";import{G as x}from"../../../../chunks/GaussianSplat.glsl.js";import{G as y}from"../../../../chunks/GaussianSplatComposition.glsl.js";import{GaussianSplatCompositionTechnique as E}from"../shaders/GaussianSplatCompositionTechnique.js";import{G as A}from"../../../../chunks/GaussianSplatDepthComposition.glsl.js";import{GaussianSplatDepthCompositionTechnique as q}from"../shaders/GaussianSplatDepthCompositionTechnique.js";import{GaussianSplatTechnique as T}from"../shaders/GaussianSplatTechnique.js";import{GaussianSplatTechniqueConfiguration as j}from"../shaders/GaussianSplatTechniqueConfiguration.js";import{ColorAttachment1 as G,DepthStencilAttachment as N,PrimitiveType as F}from"../../../webgl/enums.js";var O;const H=()=>e.getLogger("esri/views/3d/webgl-engine/lib/GaussianSplatRenderNode");let U=class extends w{static{O=this}constructor(t){super(t),this.gaussianPosition=d(),this.intersectionRayDir=d(),this.intersectionPlane=g(),this._slicePlaneEnabled=!1,this._data=null,this.produces=S.OPAQUE,this.type=0,this.isGround=!1,this.layerViewUid="",this._passParameters=new x,this._compositionPassParameters=new y,this._depthCompositionPassParameters=new A,this._previousCameraPosition=d(),this._previousCameraDirection=d(),this.fadeHelper=null,this._configuration=new j(t.view.state.isGlobal)}async initialize(){this._data=new v(this),this.view.sceneIntersectionHelper.addIntersectionHandler(this),this.addHandles([s(()=>this.view.state.camera,()=>this._onCameraChange())])}precompile(){this._configuration.alphaCutoff=this.view.qualitySettings.gaussianSplat.minimumOpacity,this._configuration.terrainDepthTest=this.bindParameters.terrainDepthTest,this._configuration.fadingEnabled=this.fadeHelper.fadingEnabled,this.techniques.precompile(T,this._configuration),this.techniques.precompile(E),this.techniques.precompile(q)}render(t){const e=t.find(({name:t})=>t===S.OPAQUE),s=this.renderingContext.capabilities.drawBuffersIndexed;if(!s)return H().warnOnce("Gaussian Splatting is not supported on this device."),e;if(this._handleFading(),!this._data.visibleGaussians||!this._data.orderTexture.texture||!this._data.textureAtlas.texture)return e;const i=this.techniques.get(T,this._configuration),a=this.techniques.get(E),n=this.techniques.get(q);if(!i.compiled||!n.compiled||!a.compiled)return this.requestRender(1),e;const{fullWidth:o,fullHeight:l}=this.bindParameters.camera,h=this.fboCache,p=h.acquire(o,l,"gaussian color output");p.acquireColor(G,8,"gaussian depth output"),p.attachDepth(e.getAttachment(N));const u=this.renderingContext;this._passParameters.totalGaussians=this._data.visibleGaussians,this._passParameters.splatOrder=this._data.orderTexture.texture,this._passParameters.splatFading=this._data.fadingTexture.texture,this._passParameters.splatAtlas=this._data.textureAtlas.texture;const c=Math.tan(.5*this.camera.fovY),m=c/l*o;r(this._passParameters.tanFov,m,c),this._passParameters.focalLength=l/(2*c);const d=this.view.qualitySettings.gaussianSplat.minimumSplatPixelRadius;this._passParameters.minSplatRadius=d*Math.sqrt(o*l)/Math.sqrt(2073600),this._prepareHighPrecisionCameraPosition(),u.bindFramebuffer(p.fbo),u.setClearColor(0,0,0,0),u.clear(16384),this.renderingContext.bindTechnique(i,this.bindParameters,this._passParameters);const _=u.gl;s.enableiOES(_.BLEND,0),s.blendEquationSeparateiOES(0,_.FUNC_ADD,_.FUNC_ADD),s.blendFuncSeparateiOES(0,_.ONE_MINUS_DST_ALPHA,_.ONE,_.ONE_MINUS_DST_ALPHA,_.ONE),s.enableiOES(_.BLEND,1),s.blendEquationSeparateiOES(1,_.FUNC_ADD,_.FUNC_ADD),s.blendFuncSeparateiOES(1,_.ONE_MINUS_DST_ALPHA,_.DST_ALPHA,_.ONE_MINUS_DST_ALPHA,_.ONE),this.renderingContext.drawArraysInstanced(F.TRIANGLE_STRIP,0,4,this._data.visibleGaussians);const f=h.acquire(o,l,this.produces);return this._depthCompositionPassParameters.splatDepth=p.getTexture(G),f.attachDepth(e.getAttachment(N)),u.bindFramebuffer(f.fbo),u.bindTechnique(n,this.bindParameters,this._depthCompositionPassParameters),u.screen.draw(),this._compositionPassParameters.color=e.getTexture(),this._compositionPassParameters.splatColor=p.getTexture(),u.bindFramebuffer(f.fbo),u.bindTechnique(a,this.bindParameters,this._compositionPassParameters),u.screen.draw(),p.release(),f}intersect(t,e,s,i){const{gaussianPosition:a,intersectionRayDir:r,intersectionPlane:c,layerViewUid:m}=this,g=P(s,i);n(r,i,s);const S=1/o(r);l(r,r,S);const v=d();h(v,r),f(c,r[0],r[1],r[2],-p(r,s));const w=new I,x=new I,y=new Array;this._data.visibleGaussianTiles.forEach(n=>{const{maxScale:o}=n,l=n.obb.minimumDistancePlane(c),h=n.obb.maximumDistancePlane(c),d=h<0,f=null!=w.dist&&null!=x.dist&&w.dist<l*S&&x.dist>h*S;if(d||f)return;if(!new b(n.obb.center,n.obb.radius+o).intersectRay(g,null))return;if(!n.obb.intersectRay(s,r,o))return;const{positions:P,squaredScales:C,gaussianAtlasIndices:D}=n,E=D.length;for(let c=0;c<E;c++){const n=3*c;a[0]=P[n]-s[0],a[1]=P[n+1]-s[1],a[2]=P[n+2]-s[2];const o=C[c],l=p(a,r),h=l*l;if(u(a)-h>o)continue;const d=l*S,f=t=>(t.point=t.point?t.point.fill(a[0],a[1],a[2]):_(a),t.dist=d,t.normal=v,t.layerViewUid=m,t);if((null==w.dist||d<w.dist)&&(null==e||e(s,i,d))&&f(w),0!==t.options.store&&(null==x.dist||d>x.dist)&&(null==e||e(s,i,d))&&f(x),2===t.options.store&&(null==e||e(s,i,d))){const t=new I;y.push(f(t))}}});const E=(t,e)=>{const{layerViewUid:s}=e,i=new C(e.point,s);t.set(0,i,e.dist,e.normal)};if(R(w)){const e=t.results.min;(null==e.distance||w.dist<e.distance)&&E(e,w)}if(R(x)&&0!==t.options.store){const e=t.results.max;(null==e.distance||x.dist>e.distance)&&E(e,x)}if(2===t.options.store)for(const n of y){const e=new D(g);E(e,n),t.results.all.push(e)}}get slicePlaneEnabled(){return this._slicePlaneEnabled}set slicePlaneEnabled(t){this._slicePlaneEnabled!==t&&(this._slicePlaneEnabled=t,this.requestRender(1))}get data(){return this._data}destroy(){this._data.destroy(),super.destroy()}_onCameraChange(){const t=this.view.state.camera.eye,e=this.view.state.camera.ray.direction,s=.001;(Math.abs(t[0]-this._previousCameraPosition[0])>s||Math.abs(t[1]-this._previousCameraPosition[1])>s||Math.abs(t[2]-this._previousCameraPosition[2])>s||Math.abs(e[0]-this._previousCameraDirection[0])>s||Math.abs(e[1]-this._previousCameraDirection[1])>s||Math.abs(e[2]-this._previousCameraDirection[2])>s)&&(c(this._previousCameraPosition,t),c(this._previousCameraDirection,e),this._data.requestSort())}_prepareHighPrecisionCameraPosition(){l(this._passParameters.tileCameraPosition,this.camera.eye,1/O.tileSize),m(this._passParameters.tileCameraPosition,this._passParameters.tileCameraPosition),l(this._passParameters.cameraDelta,this._passParameters.tileCameraPosition,O.tileSize),n(this._passParameters.cameraDelta,this.camera.eye,this._passParameters.cameraDelta)}_handleFading(){if(0===this.fadeHelper.numFadingTiles)return void(this._previousFrameStart=null);this._previousFrameStart??=this.view.stage.renderer.renderContext.time;const t=this.view.stage?.renderer.renderContext.time-this._previousFrameStart;this.fadeHelper.updateAllTileFading(t),this._previousFrameStart=this.view.stage.renderer.renderContext.time,this._data.fadingTexture.updateTexture(this._data.textureAtlas.pageAllocator.pageCount)}static{this.tileSize=2.048}};function R(t){return null!=t.dist&&null!=t.point}t([i({constructOnly:!0})],U.prototype,"fadeHelper",void 0),U=O=t([a("esri.views.3d.webgl-engine.lib.GaussianSplatRenderNode")],U);class I{constructor(){this.point=null,this.dist=null,this.normal=null,this.layerViewUid=""}}export{U as GaussianSplatRenderNode};
@@ -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{subclass as r}from"../../../../core/accessorSupport/decorators.js";import{ReloadableShader as s}from"../core/shaderTechnique/ReloadableShader.js";import{ShaderTechnique as i}from"../core/shaderTechnique/ShaderTechnique.js";import{a as o}from"../../../../chunks/GaussianSplat.glsl.js";import{makePipelineState as t,defaultColorWrite as a,separateBlendingParams as n}from"../../../webgl/renderState.js";let l=class extends i{constructor(){super(...arguments),this.shader=new s(o,()=>import("./GaussianSplat.glsl.js"))}initializePipeline(){return t({blending:n(773,773,1,1,32774,32774),depthTest:{func:515},colorWrite:a})}};l=e([r("esri.views.3d.webgl-engine.shaders.GaussianSplatTechnique")],l);export{l as GaussianSplatTechnique};
5
+ import{__decorate as e}from"tslib";import{subclass as r}from"../../../../core/accessorSupport/decorators.js";import{ReloadableShader as s}from"../core/shaderTechnique/ReloadableShader.js";import{ShaderTechnique as i}from"../core/shaderTechnique/ShaderTechnique.js";import{a as o}from"../../../../chunks/GaussianSplat.glsl.js";import{ColorAttachment0 as t,ColorAttachment1 as a}from"../../../webgl/enums.js";import{makePipelineState as n,defaultColorWrite as l,separateBlendingParams as p}from"../../../webgl/renderState.js";let c=class extends i{constructor(){super(...arguments),this.shader=new s(o,()=>import("./GaussianSplat.glsl.js"))}initializePipeline(){return n({blending:p(773,773,1,1,32774,32774),depthTest:{func:515},colorWrite:l,drawBuffers:{buffers:[t,a]}})}};c=e([r("esri.views.3d.webgl-engine.shaders.GaussianSplatTechnique")],c);export{c as GaussianSplatTechnique};
@@ -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{ShaderTechniqueConfiguration as e,parameter as i}from"../core/shaderTechnique/ShaderTechniqueConfiguration.js";class o extends e{constructor(t,e=!1){super(),this.spherical=t,this.depthPass=e,this.alphaCutoff=1,this.fadingEnabled=!1,this.terrainDepthTest=!1,this.cullAboveTerrain=!1,this.occlusionPass=!1,this.receiveAmbientOcclusion=!1,this.pbrMode=0,this.useCustomDTRExponentForWater=!1,this.useFillLights=!1,this.hasColorTexture=!0}}function r(t){switch(t){case 2:return.005;case 0:return.05;default:return.01}}t([i({count:3})],o.prototype,"alphaCutoff",void 0),t([i()],o.prototype,"fadingEnabled",void 0),t([i()],o.prototype,"terrainDepthTest",void 0),t([i()],o.prototype,"cullAboveTerrain",void 0),t([i()],o.prototype,"receiveAmbientOcclusion",void 0);export{o as GaussianSplatTechniqueConfiguration,r as getGaussianSplatAlphaCutoffValue};
5
+ import{__decorate as t}from"tslib";import{ShaderTechniqueConfiguration as e,parameter as i}from"../core/shaderTechnique/ShaderTechniqueConfiguration.js";class o extends e{constructor(t){super(),this.spherical=t,this.alphaCutoff=1,this.fadingEnabled=!1,this.terrainDepthTest=!1,this.cullAboveTerrain=!1,this.occlusionPass=!1,this.receiveAmbientOcclusion=!1,this.pbrMode=0,this.useCustomDTRExponentForWater=!1,this.useFillLights=!1,this.hasColorTexture=!0}}function r(t){switch(t){case 2:return.005;case 0:return.05;default:return.01}}t([i({count:3})],o.prototype,"alphaCutoff",void 0),t([i()],o.prototype,"fadingEnabled",void 0),t([i()],o.prototype,"terrainDepthTest",void 0),t([i()],o.prototype,"cullAboveTerrain",void 0),t([i()],o.prototype,"receiveAmbientOcclusion",void 0);export{o as GaussianSplatTechniqueConfiguration,r as getGaussianSplatAlphaCutoffValue};
@@ -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{property as n,subclass as o}from"../../../core/accessorSupport/decorators.js";const a={standard:.15,spacemouse:.025,unknown:0},p=new RegExp("^(3dconnexion|space(mouse|navigator|pilot|explorer))","i");function r(e){return"standard"===e.mapping?"standard":p.test(e.id)?"spacemouse":"unknown"}let s=class extends t{constructor(e){super(e),this._gamepadInfo=null}get axisThreshold(){return a[this.deviceType]}get deviceType(){return this._gamepadInfo?.device??"unknown"}set gamepad(e){this._gamepadInfo={device:r(e),index:e.index}}get native(){return this._gamepadInfo?navigator.getGamepads().at(this._gamepadInfo.index):null}};e([n()],s.prototype,"_gamepadInfo",void 0),e([n({type:Number})],s.prototype,"axisThreshold",null),e([n({type:String})],s.prototype,"deviceType",null),e([n({constructOnly:!0})],s.prototype,"gamepad",null),e([n({type:Gamepad,readOnly:!0})],s.prototype,"native",null),s=e([o("esri.views.input.gamepad.GamepadInputDevice")],s);const i=s;export{i as default};
5
+ import{__decorate as e}from"tslib";import t from"../../../core/Accessor.js";import{property as n,subclass as o}from"../../../core/accessorSupport/decorators.js";const p={standard:.15,spacemouse:.025,unknown:0},r=new RegExp("^(3dconnexion|space(mouse|navigator|pilot|explorer))","i");function s(e){return"standard"===e.mapping?"standard":r.test(e.id)?"spacemouse":"unknown"}let a=class extends t{constructor(e){super(e),this._deviceType=null,this._gamepadIndex=null}get axisThreshold(){return p[this.deviceType]}get deviceType(){return this._deviceType??"unknown"}set gamepad(e){this._deviceType=s(e),this._gamepadIndex=e.index}get native(){return navigator.getGamepads()[this._gamepadIndex??-1]}};e([n()],a.prototype,"_deviceType",void 0),e([n({type:Number})],a.prototype,"axisThreshold",null),e([n({type:String})],a.prototype,"deviceType",null),e([n({constructOnly:!0})],a.prototype,"gamepad",null),a=e([o("esri.views.input.gamepad.GamepadInputDevice")],a);const i=a;export{i 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 e}from"tslib";import{property as o,subclass as t}from"../../../core/accessorSupport/decorators.js";import r from"../../../geometry/Extent.js";import s from"../../../geometry/Geometry.js";import m from"../../../geometry/Polygon.js";import{fromJSON as p}from"../../../geometry/support/jsonUtils.js";import i from"./ClipArea.js";var y;const n={base:s,key:"type",typeMap:{extent:r,polygon:m}};let l=y=class extends i{constructor(e){super(e),this.type="geometry",this.geometry=null}clone(){return new y({geometry:this.geometry?.clone()??null})}commitVersionProperties(){this.commitProperty("geometry")}};e([o({types:n,json:{read:p,write:!0}})],l.prototype,"geometry",void 0),l=y=e([t("esri.views.layers.support.Geometry")],l);export{l as default};
5
+ import{__decorate as e}from"tslib";import{property as o,subclass as r}from"../../../core/accessorSupport/decorators.js";import t from"../../../geometry/Extent.js";import s from"../../../geometry/Geometry.js";import m from"../../../geometry/Polygon.js";import{fromJSON as p}from"../../../geometry/support/jsonUtils.js";import i from"./ClipArea.js";var y;const l={base:s,key:"type",typeMap:{extent:t,polygon:m}};let n=y=class extends i{constructor(e){super(e),this.type="geometry",this.geometry=null}clone(){return new y({geometry:this.geometry?.clone()??null})}commitVersionProperties(){this.commitProperty("geometry")}};e([o({types:l,json:{read:p,write:!0}})],n.prototype,"geometry",void 0),n=y=e([r("esri.views.layers.support.GeometryClipArea")],n);export{n 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{loadRendererInfo as e}from"./DebugRendererInfo.js";import{createDisjointTimerQuery as t}from"./DisjointTimerQuery.js";import{loadCompressedTextureETC as s,loadCompressedTextureS3TC as r,loadTextureFilterAnisotropicCapability as i,loadColorBufferFloat as l,loadTextureNorm16 as o,loadBooleanExtension as n}from"./load.js";import{load as h}from"./LoseContext.js";class _{constructor(e,t){this._gl=e,this._compressedTextureETC=null,this._compressedTextureS3TC=null,this._textureFilterAnisotropic=null,this._colorBufferFloat=null,this._loseContext=null,this._textureNorm16=null,this._textureFloatLinear=null,this._parallelShaderCompile=null,this._rendererInfo=null,this._disabledExtensions=t.disabledExtensions,this._debugWebGLExtensions=t.debugWebGLExtensions}get compressedTextureETC(){return this._compressedTextureETC??=s(this._gl,this._disabledExtensions),this._compressedTextureETC}get compressedTextureS3TC(){return this._compressedTextureS3TC??=r(this._gl,this._disabledExtensions),this._compressedTextureS3TC}get textureFilterAnisotropic(){return this._textureFilterAnisotropic??=i(this._gl,this._disabledExtensions),this._textureFilterAnisotropic}get disjointTimerQuery(){return this._disjointTimerQuery??=t(this._gl,this._disabledExtensions),this._disjointTimerQuery}get colorBufferFloat(){return this._colorBufferFloat??=l(this._gl,this._disabledExtensions),this._colorBufferFloat}get textureNorm16(){return this._textureNorm16??=o(this._gl,this._disabledExtensions),this._textureNorm16}get textureFloatLinear(){return this._textureFloatLinear??=n(this._gl,this._disabledExtensions,"textureFloatLinear",!1,["OES_texture_float_linear"]),this._textureFloatLinear}get parallelShaderCompile(){return this._parallelShaderCompile??=n(this._gl,this._disabledExtensions,"parallelShaderCompile",!1,["KHR_parallel_shader_compile"]),this._parallelShaderCompile}get loseContext(){return this._loseContext??=h(this._gl,this._debugWebGLExtensions),this._loseContext}get rendererInfo(){return this._rendererInfo??=e(this._gl),this._rendererInfo}enable(e){return this[e]}}export{_ as Capabilities};
5
+ import{loadRendererInfo as e}from"./DebugRendererInfo.js";import{createDisjointTimerQuery as t}from"./DisjointTimerQuery.js";import{loadCompressedTextureETC as s,loadCompressedTextureS3TC as r,loadTextureFilterAnisotropicCapability as i,loadColorBufferFloat as l,loadTextureNorm16 as o,loadBooleanExtension as n,loadDrawBuffersIndexed as h}from"./load.js";import{load as _}from"./LoseContext.js";class u{constructor(e,t){this._gl=e,this._compressedTextureETC=null,this._compressedTextureS3TC=null,this._textureFilterAnisotropic=null,this._colorBufferFloat=null,this._loseContext=null,this._textureNorm16=null,this._textureFloatLinear=null,this._parallelShaderCompile=null,this._rendererInfo=null,this._drawBuffersIndexed=null,this._disabledExtensions=t.disabledExtensions,this._debugWebGLExtensions=t.debugWebGLExtensions}get compressedTextureETC(){return this._compressedTextureETC??=s(this._gl,this._disabledExtensions),this._compressedTextureETC}get compressedTextureS3TC(){return this._compressedTextureS3TC??=r(this._gl,this._disabledExtensions),this._compressedTextureS3TC}get textureFilterAnisotropic(){return this._textureFilterAnisotropic??=i(this._gl,this._disabledExtensions),this._textureFilterAnisotropic}get disjointTimerQuery(){return this._disjointTimerQuery??=t(this._gl,this._disabledExtensions),this._disjointTimerQuery}get colorBufferFloat(){return this._colorBufferFloat??=l(this._gl,this._disabledExtensions),this._colorBufferFloat}get textureNorm16(){return this._textureNorm16??=o(this._gl,this._disabledExtensions),this._textureNorm16}get textureFloatLinear(){return this._textureFloatLinear??=n(this._gl,this._disabledExtensions,"textureFloatLinear",!1,["OES_texture_float_linear"]),this._textureFloatLinear}get parallelShaderCompile(){return this._parallelShaderCompile??=n(this._gl,this._disabledExtensions,"parallelShaderCompile",!1,["KHR_parallel_shader_compile"]),this._parallelShaderCompile}get loseContext(){return this._loseContext??=_(this._gl,this._debugWebGLExtensions),this._loseContext}get rendererInfo(){return this._rendererInfo??=e(this._gl),this._rendererInfo}get drawBuffersIndexed(){return this._drawBuffersIndexed??=h(this._gl,this._disabledExtensions),this._drawBuffersIndexed}enable(e){return this[e]}}export{u as Capabilities};
@@ -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
- function _(_,E){if(E.compressedTextureETC)return null;const R=_.getExtension("WEBGL_compressed_texture_etc");return R?{COMPRESSED_R11_EAC:R.COMPRESSED_R11_EAC,COMPRESSED_SIGNED_R11_EAC:R.COMPRESSED_SIGNED_R11_EAC,COMPRESSED_RG11_EAC:R.COMPRESSED_RG11_EAC,COMPRESSED_SIGNED_RG11_EAC:R.COMPRESSED_SIGNED_RG11_EAC,COMPRESSED_RGB8_ETC2:R.COMPRESSED_RGB8_ETC2,COMPRESSED_SRGB8_ETC2:R.COMPRESSED_SRGB8_ETC2,COMPRESSED_RGB8_PUNCHTHROUGH_ALPHA1_ETC2:R.COMPRESSED_RGB8_PUNCHTHROUGH_ALPHA1_ETC2,COMPRESSED_SRGB8_PUNCHTHROUGH_ALPHA1_ETC2:R.COMPRESSED_SRGB8_PUNCHTHROUGH_ALPHA1_ETC2,COMPRESSED_RGBA8_ETC2_EAC:R.COMPRESSED_RGBA8_ETC2_EAC,COMPRESSED_SRGB8_ALPHA8_ETC2_EAC:R.COMPRESSED_SRGB8_ALPHA8_ETC2_EAC}:null}function E(_,E){if(E.compressedTextureS3TC)return null;const R=_.getExtension("WEBGL_compressed_texture_s3tc");return R?{COMPRESSED_RGB_S3TC_DXT1:R.COMPRESSED_RGB_S3TC_DXT1_EXT,COMPRESSED_RGBA_S3TC_DXT1:R.COMPRESSED_RGBA_S3TC_DXT1_EXT,COMPRESSED_RGBA_S3TC_DXT3:R.COMPRESSED_RGBA_S3TC_DXT3_EXT,COMPRESSED_RGBA_S3TC_DXT5:R.COMPRESSED_RGBA_S3TC_DXT5_EXT}:null}function R(_,E){if(E.textureFilterAnisotropic)return null;const R=_.getExtension("EXT_texture_filter_anisotropic")||_.getExtension("MOZ_EXT_texture_filter_anisotropic")||_.getExtension("WEBKIT_EXT_texture_filter_anisotropic");return R?{MAX_TEXTURE_MAX_ANISOTROPY:R.MAX_TEXTURE_MAX_ANISOTROPY_EXT,TEXTURE_MAX_ANISOTROPY:R.TEXTURE_MAX_ANISOTROPY_EXT}:null}function t(_,E){const R=!E.colorBufferHalfFloat&&_.getExtension("EXT_color_buffer_half_float")||!E.colorBufferFloat&&_.getExtension("EXT_color_buffer_float"),t=!E.colorBufferFloat&&_.getExtension("EXT_color_buffer_float"),S=!E.floatBlend&&!E.colorBufferFloat&&_.getExtension("EXT_float_blend");return R||t||S?{textureFloat:!!t,textureHalfFloat:!!R,floatBlend:!!S,R16F:_.R16F,RG16F:_.RG16F,RGBA16F:_.RGBA16F,R32F:_.R32F,RG32F:_.RG32F,RGBA32F:_.RGBA32F,R11F_G11F_B10F:_.R11F_G11F_B10F,RGB16F:_.RGB16F}:null}function S(_,E,R,t,S){if(t)return!0;if(E[R])return!1;for(const e of S)if(_.getExtension(e))return!0;return!1}function e(_,E){if(E.textureNorm16)return null;const R=_.getExtension("EXT_texture_norm16");return R?{R16:R.R16_EXT,RG16:R.RG16_EXT,RGB16:R.RGB16_EXT,RGBA16:R.RGBA16_EXT,R16_SNORM:R.R16_SNORM_EXT,RG16_SNORM:R.RG16_SNORM_EXT,RGB16_SNORM:R.RGB16_SNORM_EXT,RGBA16_SNORM:R.RGBA16_SNORM_EXT}:null}export{S as loadBooleanExtension,t as loadColorBufferFloat,_ as loadCompressedTextureETC,E as loadCompressedTextureS3TC,R as loadTextureFilterAnisotropicCapability,e as loadTextureNorm16};
5
+ function _(_,E){if(E.compressedTextureETC)return null;const R=_.getExtension("WEBGL_compressed_texture_etc");return R?{COMPRESSED_R11_EAC:R.COMPRESSED_R11_EAC,COMPRESSED_SIGNED_R11_EAC:R.COMPRESSED_SIGNED_R11_EAC,COMPRESSED_RG11_EAC:R.COMPRESSED_RG11_EAC,COMPRESSED_SIGNED_RG11_EAC:R.COMPRESSED_SIGNED_RG11_EAC,COMPRESSED_RGB8_ETC2:R.COMPRESSED_RGB8_ETC2,COMPRESSED_SRGB8_ETC2:R.COMPRESSED_SRGB8_ETC2,COMPRESSED_RGB8_PUNCHTHROUGH_ALPHA1_ETC2:R.COMPRESSED_RGB8_PUNCHTHROUGH_ALPHA1_ETC2,COMPRESSED_SRGB8_PUNCHTHROUGH_ALPHA1_ETC2:R.COMPRESSED_SRGB8_PUNCHTHROUGH_ALPHA1_ETC2,COMPRESSED_RGBA8_ETC2_EAC:R.COMPRESSED_RGBA8_ETC2_EAC,COMPRESSED_SRGB8_ALPHA8_ETC2_EAC:R.COMPRESSED_SRGB8_ALPHA8_ETC2_EAC}:null}function E(_,E){if(E.compressedTextureS3TC)return null;const R=_.getExtension("WEBGL_compressed_texture_s3tc");return R?{COMPRESSED_RGB_S3TC_DXT1:R.COMPRESSED_RGB_S3TC_DXT1_EXT,COMPRESSED_RGBA_S3TC_DXT1:R.COMPRESSED_RGBA_S3TC_DXT1_EXT,COMPRESSED_RGBA_S3TC_DXT3:R.COMPRESSED_RGBA_S3TC_DXT3_EXT,COMPRESSED_RGBA_S3TC_DXT5:R.COMPRESSED_RGBA_S3TC_DXT5_EXT}:null}function R(_,E){if(E.drawBuffersIndexed)return null;const R=_.getExtension("OES_draw_buffers_indexed");return R||null}function t(_,E){if(E.textureFilterAnisotropic)return null;const R=_.getExtension("EXT_texture_filter_anisotropic")||_.getExtension("MOZ_EXT_texture_filter_anisotropic")||_.getExtension("WEBKIT_EXT_texture_filter_anisotropic");return R?{MAX_TEXTURE_MAX_ANISOTROPY:R.MAX_TEXTURE_MAX_ANISOTROPY_EXT,TEXTURE_MAX_ANISOTROPY:R.TEXTURE_MAX_ANISOTROPY_EXT}:null}function e(_,E){const R=!E.colorBufferHalfFloat&&_.getExtension("EXT_color_buffer_half_float")||!E.colorBufferFloat&&_.getExtension("EXT_color_buffer_float"),t=!E.colorBufferFloat&&_.getExtension("EXT_color_buffer_float"),e=!E.floatBlend&&!E.colorBufferFloat&&_.getExtension("EXT_float_blend");return R||t||e?{textureFloat:!!t,textureHalfFloat:!!R,floatBlend:!!e,R16F:_.R16F,RG16F:_.RG16F,RGBA16F:_.RGBA16F,R32F:_.R32F,RG32F:_.RG32F,RGBA32F:_.RGBA32F,R11F_G11F_B10F:_.R11F_G11F_B10F,RGB16F:_.RGB16F}:null}function S(_,E,R,t,e){if(t)return!0;if(E[R])return!1;for(const S of e)if(_.getExtension(S))return!0;return!1}function n(_,E){if(E.textureNorm16)return null;const R=_.getExtension("EXT_texture_norm16");return R?{R16:R.R16_EXT,RG16:R.RG16_EXT,RGB16:R.RGB16_EXT,RGBA16:R.RGBA16_EXT,R16_SNORM:R.R16_SNORM_EXT,RG16_SNORM:R.RG16_SNORM_EXT,RGB16_SNORM:R.RGB16_SNORM_EXT,RGBA16_SNORM:R.RGBA16_SNORM_EXT}:null}export{S as loadBooleanExtension,e as loadColorBufferFloat,_ as loadCompressedTextureETC,E as loadCompressedTextureS3TC,R as loadDrawBuffersIndexed,t as loadTextureFilterAnisotropicCapability,n as loadTextureNorm16};
@@ -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"../../core/Error.js";import{clone as t}from"../../core/lang.js";import{getDeepValue as n}from"../../core/object.js";import{numberToJSON as r}from"../../core/accessorSupport/extensions/serializableProperty/writer.js";import{isFeatureCollectionLayer as i}from"../../layers/support/layerUtils.js";const o=new Set(["bing-maps","imagery","imagery-tile","map-image","open-street-map","tile","unknown","unsupported","vector-tile","web-tile","wcs","wms","wmts"]),l=new Set(["integrated-mesh-3dtiles"]),a=new Set(["catalog","csv","feature","geo-rss","geojson","group","imagery","imagery-tile","kml","knowledge-graph","map-image","map-notes","media","ogc-feature","oriented-imagery","route","stream","subtype-group","tile","unknown","unsupported","vector-tile","video","web-tile","wcs","wfs","wms","wmts"]),s=new Set([...a,"link-chart"]);function c(e){o.delete(e),a.delete(e)}function d(e){o.add(e),a.add(e)}function u(e){switch(e.layerContainerType){case"basemap-base-layers":return o;case"basemap-ground-layers":return l;case"operational-layers":return"link-chart"===e.origin?s:a;default:return null}}function m(e,t){if(t.restrictedWebMapWriting){const n=u(t);return null==n||n.has(e.type)&&!i(e)}return!0}function p(e,t){if(t)if(i(e)){const r=n("featureCollection.layers",t),i=r?.[0]?.layerDefinition;i&&f(e,i)}else"group"!==e.type&&f(e,t)}function f(e,t){"maxScale"in e&&(t.maxScale=r(e.maxScale)??void 0),"minScale"in e&&(t.minScale=r(e.minScale)??void 0)}function g(e,t){if(p(e,t),t&&(t.id=e.id,"blendMode"in e&&(t.blendMode=e.blendMode,"normal"===t.blendMode&&delete t.blendMode),t.opacity=r(e.opacity)??void 0,t.title=e.title||"Layer",t.visibility=e.visible,"legendEnabled"in e&&"wmts"!==e.type))if(i(e)){const n=t.featureCollection;n&&(n.showLegend=e.legendEnabled)}else t.showLegend=e.legendEnabled}function y(n,r,o){if(!n.persistenceEnabled)return null;if(!("write"in n)||!n.write)return o?.messages&&o.messages.push(new e("layer:unsupported",`Layers (${n.title}, ${n.id}) of type '${n.declaredClass}' cannot be persisted`,{layer:n})),null;if(i(n)&&!n.isTable)r=n.resourceInfo;else if(m(n,o)){const e={};return n.write(e,o)?e:null}return null!=r&&g(n,r=t(r)),r}export{d as disableRestrictedWriting,c as enableRestrictedWriting,y as getLayerJSON};
5
+ import e from"../../core/Error.js";import{clone as t}from"../../core/lang.js";import{getDeepValue as r}from"../../core/object.js";import{numberToJSON as n}from"../../core/accessorSupport/extensions/serializableProperty/writer.js";import{isFeatureCollectionLayer as i}from"../../layers/support/layerUtils.js";const o=new Set(["bing-maps","imagery","imagery-tile","map-image","open-street-map","tile","unknown","unsupported","vector-tile","web-tile","wcs","wms","wmts"]),a=new Set(["integrated-mesh-3dtiles"]),l=new Set(["catalog","csv","feature","geo-rss","geojson","group","imagery","imagery-tile","kml","knowledge-graph","map-image","map-notes","media","ogc-feature","oriented-imagery","parquet","route","stream","subtype-group","tile","unknown","unsupported","vector-tile","video","web-tile","wcs","wfs","wms","wmts"]),s=new Set([...l,"link-chart"]);function c(e){o.delete(e),l.delete(e)}function u(e){o.add(e),l.add(e)}function d(e){switch(e.layerContainerType){case"basemap-base-layers":return o;case"basemap-ground-layers":return a;case"operational-layers":return"link-chart"===e.origin?s:l;default:return null}}function p(e,t){if(t.restrictedWebMapWriting){const r=d(t);return null==r||r.has(e.type)&&!i(e)}return!0}function m(e,t){if(t)if(i(e)){const n=r("featureCollection.layers",t),i=n?.[0]?.layerDefinition;i&&f(e,i)}else"group"!==e.type&&f(e,t)}function f(e,t){"maxScale"in e&&(t.maxScale=n(e.maxScale)??void 0),"minScale"in e&&(t.minScale=n(e.minScale)??void 0)}function g(e,t){if(m(e,t),t&&(t.id=e.id,"blendMode"in e&&(t.blendMode=e.blendMode,"normal"===t.blendMode&&delete t.blendMode),t.opacity=n(e.opacity)??void 0,t.title=e.title||"Layer",t.visibility=e.visible,"legendEnabled"in e&&"wmts"!==e.type))if(i(e)){const r=t.featureCollection;r&&(r.showLegend=e.legendEnabled)}else t.showLegend=e.legendEnabled}function y(r,n,o){if(!r.persistenceEnabled)return null;if(!("write"in r)||!r.write)return o?.messages&&o.messages.push(new e("layer:unsupported",`Layers (${r.title}, ${r.id}) of type '${r.declaredClass}' cannot be persisted`,{layer:r})),null;if(i(r)&&!r.isTable)n=r.resourceInfo;else if(p(r,o)){const e={};return r.write(e,o)?e:null}return null!=n&&g(r,n=t(n)),n}export{u as disableRestrictedWriting,c as enableRestrictedWriting,y as getLayerJSON};
@@ -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"../../core/has.js";import t from"../../core/Logger.js";import{on as i,sync as n}from"../../core/reactiveUtils.js";import{property as o,subclass as l}from"../../core/accessorSupport/decorators.js";import{getEffectiveFieldAlias as r}from"../../editing/fieldUtils.js";import{convertDateFormatToIntlOptions as a,defaultFormatterOptionsNoTime as s,convertDateTimeFieldFormatToIntlOptions as u,defaultFormatterOptions as p}from"../../intl/date.js";import{formatNumber as d,convertNumberFormatToIntlOptions as m,convertNumberFieldFormatToIntlOptions as c}from"../../intl/number.js";import{isEditableLayer as f}from"../../layers/support/editableLayers.js";import{computeDomainFromTypes as h}from"../../layers/support/featureLayerUtils.js";import y from"../../layers/support/Field.js";import{defaultFieldFormat as g}from"../../layers/support/fieldFormatUtils.js";import{validateFieldValue as v,isDateField as F,isTimeOnlyField as _,isIntegerField as C,isNumericField as b,isStringField as D,isDateOnlyField as I,isTimestampOffsetField as x}from"../../layers/support/fieldUtils.js";import{isAnyDateField as T}from"../../smartMapping/support/utils.js";import{system as O}from"../../time/constants.js";import{getTimeZoneFormattingOptions as w}from"../../time/timeZoneUtils.js";import V from"../FeatureForm/FieldInput.js";import E from"./Grid/EditorColumn.js";import{isIFeatureTableSupportedLayerWithFieldConfigurations as Z,isEmptyStringOrWhitespace as L}from"./support/tableUtils.js";import{valueIsInRange as j,dateTimeIsInRange as R,getUnixFieldValueFromDateComponents as S,getISOFieldValueFromDateComponents as N,normalizeTimeOnlyString as A,getLabelForDateFieldValue as U,prepareISOFieldValueForDateComponents as q,prepareUnixFieldValueForDateComponents as k}from"../support/dateUtils.js";import{setFocus as B}from"../support/widgetUtils.js";const H={cancelEdit:"Escape"},z=Symbol(),P="esri-column",M={input:`${P}__cell-input`,inputContainer:`${P}__cell__input-container`};let W=class extends E{constructor(e){super(e),this._activeFieldInput=null,this.cellValueFormatFunction=({root:e,rowData:t,value:i})=>{const{formatFunction:n}=this;if(n&&t){const{index:o,item:{attachments:l,feature:r,relatedRecords:a}}=t;return n({attachments:l,column:this,feature:r,field:this.field,index:o,relatedRecords:a,value:this.sanitizeContent(i),virtualIndex:this.getVirtualRowIndex(e)})}if(null===i)return"&nbsp;";const o=this._getDomainForFeature(t?.item?.feature),l=this._getComputedDomain(i,o)||i;return this._isAnyDateOrTimeField&&"coded-value"!==o?.type?this._formatDateValueForDisplay(this.field,l):this._isNumericField&&"coded-value"!==o?.type?d(parseFloat(l),this._numberFormatOptions):this.sanitizeContent(l)},this.cellValueValidatorFunction=({oldValue:e,value:i})=>{const{_effectiveRange:n,field:o}=this,{max:l,min:r}=n;if(this.effectiveRequired&&(null==i||""===i))return!1;if(this._isNumericField&&(v(o,i)||!j({max:l,min:r,value:i})))return t.getLogger(this).warn("value-exceeds-valid-range","Field value exceeds valid range. Attempted edit was rejected."),!1;if(this._isAnyDateOrTimeField){const e=o.type;if(!R({type:e,range:n,value:i}))return!1}return e!==i},this.field=null,this.formatFunction=null,this.inputRenderFunction=async({root:e,column:i,rowData:n})=>{if(this.editInfo||!this.effectiveEditable)return;const o=this.getCellValue(n),{field:l}=this;if("big-integer"===l.type&&v(l,o))return void t.getLogger(this).warn("value-exceeds-valid-range","Field value is beyond supported limit. Editing is disabled for this field value.");const r=n?.item.feature;if(!r)return;this._activeFieldInput=this._setUpFieldInput(r,o);const a=document.createElement("div");a.classList.add(M.inputContainer);const s=[],u="coded-value"===this._effectiveDomain?.type;if(this._isAnyDateOrTimeField&&!u){const e=document.createElement("div"),t=this._setUpDateComponents(o),i=this._setUpDateActionBar();t.forEach(t=>e.appendChild(t)),a.appendChild(e),a.appendChild(i),s.push(...t)}else{const e=this.createInputElement({value:o});a.appendChild(e),s.push(e)}this._set("editInfo",{column:i,inputs:s,root:e,rowData:n,oldValue:o}),this.removeCellContent(e),e.appendChild(a),this._syncRowEditingState(e,!0),this.grid?.generateCellPartNames();const p=s[0];await B(p),"selectText"in p&&await p.selectText()},this.layer=null,this.parseInputValueFunction=({inputs:e})=>{const{editInfo:t,field:i,includeTime:n}=this;if(!t||!e.length)return null;const o=e[0];if(this._isAnyDateOrTimeField){if("coded-value"===this._effectiveDomain?.type){if(null==o.value||""===o.value)return null;const e=String(o.value);return F(i)?parseFloat(e):e}const{timeZone:l}=this.effectiveTimeZoneOptions,r=t.oldValue??void 0;switch(i.type){case"date-only":{const e=o.value;return""!==e?e:null}case"time-only":{const e=A(o.value);return""!==e?e:null}case"timestamp-offset":{const t=n?e[1]:void 0,i=e.at(-1);return N({oldValue:r,dateComponent:o,timeComponent:t,timeZoneComponent:i,defaultTimeZone:l})}case"date":{const{max:t,min:i}=this._effectiveRange;return S({oldValue:r,dateComponent:o,timeComponent:e[1],timeZone:l,max:t,min:i})}}return null}const l=o.value,{effectiveRequired:r}=this;return r||null!=l&&""!==l?this._isNumericField?parseFloat(l):this._isStringField?l.trim():l:null},this.sortable=!0,this.store=null,this.template=null,this.view=null}get _effectiveDomain(){const e=this._activeFieldInput?.feature;return e?this._getDomainForFeature(e):null}get _effectiveRange(){return this._activeFieldInput?.range??{max:null,min:null}}get _isAnyDateOrTimeField(){const{field:e}=this;return T(e)||_(e)}get _isIntegerField(){return C(this.field)}get _isNumericField(){return b(this.field)}get _isStringField(){return D(this.field)}get _isSubtypeField(){const{layer:e}=this;if(e?.subtypeField){const{subtypeField:t,fieldsIndex:i}=e;return(i.get(t)?.name??t)===this.fieldName}return!1}get _layerWithFieldConfigurations(){const{layer:e}=this;return Z(e)?e:null}get _dateTimeFormatOptions(){const{layerFieldConfigurationFormat:e,template:t}=this;return t?.format?.dateFormat?a(t.format.dateFormat):t?.input&&"includeTime"in t.input&&!1===t.input.includeTime?s:"date-time"===e?.type?u(e):this._isAnyDateOrTimeField?p:void 0}get _numberFormatOptions(){const{layerFieldConfigurationFormat:e,template:t}=this;return t?.format?m(t.format):"number"===e?.type?c(e):this._isNumericField?{useGrouping:!0,maximumFractionDigits:20}:void 0}get alias(){return r(this.field,this._layerWithFieldConfigurations)}get defaultValue(){return this.field?.defaultValue}get effectiveDescription(){const{description:e,field:t}=this,i=t.description,n=L(e)?L(i)?null:i:e;return null==n?null:this.sanitizeLabel(n)}get effectiveEditable(){const{editable:e,field:t,layer:i,tableEditingEnabled:n}=this;if(!t||!i)return!1;const o=f(i),l=i.effectiveCapabilities??i.capabilities,r=l?.operations?.supportsUpdate;return!!(t.editable&&o&&r&&"oid"!==t.type&&n)&&e}get effectiveLabel(){return this.sanitizeLabel(this.label||this.alias||this.fieldName)}get effectiveRequired(){return!this.nullable||this._isSubtypeField||this._activeFieldInput?.required||this.required}get effectiveSortable(){return!(!this.layer?.capabilities?.query?.supportsOrderBy||!this.sortable)}get effectiveTimeZoneOptions(){const{layer:e,field:t}=this;if(!e||"date"!==t?.type&&"timestamp-offset"!==t?.type)return{timeZone:void 0,timeZoneName:void 0};const{tableTimeZone:i,timeZone:n,view:o}=this;return w(e.preferredTimeZone||null,!!e.datesInUnknownTimezone,n??i??o?.timeZone??O,this._dateTimeFormatOptions??p,t.type)}get includeTime(){const{field:e,template:t}=this;return"time-only"===e.type||"date-only"!==e.type&&(!t?.input||"includeTime"in t.input&&!1!==t.input.includeTime)}get layerFieldConfigurationFormat(){const{_layerWithFieldConfigurations:e}=this;if(e)return e.getFieldConfiguration(this.fieldName)?.fieldFormat??g(this.field)}get loadingMessage(){return this.messages?.loading||"..."}get maxLength(){const{field:e,template:t}=this,i=e?.length??-1,n=t?.input&&"maxLength"in t.input?t.input.maxLength:null;return null!=n&&!isNaN(n)&&n>=-1&&(-1===i||n<=i)?n:i}get minLength(){const{template:e,maxLength:t}=this,i=e?.input&&"minLength"in e.input?e.input.minLength:null;return t&&i<=t?i:null}get name(){return this.field?.name}get nullable(){return!1!==this.field.nullable}get shouldShowPrompt(){return this._isSubtypeField}createInputElement({value:e}){const{_effectiveDomain:t,maxLength:o,minLength:l,effectiveRequired:r}=this;let a;if("coded-value"===t?.type)a=this.createCalciteSelect(e,t.codedValues.map(({code:e,name:t})=>({value:e,name:t}))),this.addHandles([i(()=>a,"calciteSelectChange",()=>this.onInputBlur(),n)],z);else if(this._isNumericField){const{_effectiveRange:{max:t,min:i}}=this;a=document.createElement("calcite-input"),a.type="number",this._isIntegerField&&(a.step=1),null!=t&&(a.max=t),null!=i&&(a.min=i),a.status=j({max:t,min:i,value:e})?"idle":"invalid"}else a=document.createElement("calcite-input"),this.addHandles([i(()=>a,"calciteInputChange",()=>this.onInputBlur(),n)],z),o>-1&&(a.maxLength=o),l>0&&(a.minLength=l);return a.classList.add(M.input),a.required=r,a.value=null!=e?e.toString():"",this.addHandles([i(()=>a,"keydown",e=>{e.key===H.cancelEdit&&this.onInputBlur(!0)},n),i(()=>a,"blur",()=>this.onInputBlur(),n)],z),a}onInputBlur(e=!1){this.removeHandles(z),super.onInputBlur(e)}onEditComplete(){const e=this.editInfo?.root;e&&this._syncRowEditingState(e,!1),this._activeFieldInput=null,super.onEditComplete()}get test(){}_clearActiveEditValues(){this.editInfo?.inputs?.forEach(e=>e.value="")}_setUpDateActionBar(){const{messagesCommon:e}=this,t=e?.cancel??"",i=e?.clear??"",n=e?.save??"",o=document.createElement("calcite-action-bar");return o.expandDisabled=!0,o.layout="horizontal",o.appendChild(this.createCalciteAction({text:n,icon:"save",onclick:()=>this.submit()})),this.effectiveRequired||o.appendChild(this.createCalciteAction({text:i,icon:"trash",onclick:()=>{this._clearActiveEditValues(),this.submit()}})),o.appendChild(this.createCalciteAction({text:t,icon:"x",onclick:()=>this.cancel()})),o}_formatDateValueForDisplay(e,t){const{timeZone:i,timeZoneName:n}=this.effectiveTimeZoneOptions;return null!=t?U(e,t,{...this._dateTimeFormatOptions,timeZone:i,timeZoneName:n}):null}_setUpDateComponents(e){const{_effectiveRange:{max:t,min:n,rawMax:o,rawMin:l},field:r,effectiveRequired:a}=this,s=this._getDateFieldValuesForComponents(r,e),u=[];if(T(r)){const e=this.createDateComponent(),p=I(r)||x(r)?o:t,d=I(r)||x(r)?l:n,m=this._getDateFieldValuesForComponents(r,p??null),c=this._getDateFieldValuesForComponents(r,d??null);e.value=s.date??"",e.max=m.date??"",e.min=c.date??"",e.required=a,this.addHandles([i(()=>e,"calciteInputDatePickerOpen",()=>this._onDateComponentOpen(e))],z),u.push(e)}if(this.includeTime){const e=this.createTimeComponent();e.value=s.time??"",e.required=a,this.addHandles([i(()=>e,"calciteInputTimePickerOpen",()=>this._onDateComponentOpen(e))],z),u.push(e)}if("timestamp-offset"===r.type){const e=this.createTimeZoneComponent();e.value=s.timeZoneOffset??"0",this.addHandles([i(()=>e,"calciteInputTimeZoneOpen",()=>this._onDateComponentOpen(e))],z),u.push(e)}return u}_onDateComponentOpen(e){this.editInfo?.inputs.forEach(t=>{t!==e&&"open"in t&&(t.open=!1)})}_syncRowEditingState(e,t=!1){const i=this.grid?.getRowContainingNode(e);i&&(t?i.setAttribute("editing","true"):i.removeAttribute("editing"))}_getDateFieldValuesForComponents(e,t){switch(e.type){case"date":return k(t,this.effectiveTimeZoneOptions.timeZone);case"date-only":return{date:t};case"time-only":return{time:t};case"timestamp-offset":return q(t);default:return{}}}_setUpFieldInput(e,t){const{field:i,layer:n,effectiveTimeZoneOptions:{timeZone:o}}=this,l=new V({feature:e,field:i,initialFeature:e.clone(),layer:n,timeZone:o});return l.set("value",t),l}_isDomainCompatible(e){if(!e)return!1;const{_isNumericField:t,_isStringField:i}=this,{type:n}=e;if("coded-value"===n){const n=typeof e.codedValues[0].code;if("string"===n&&i||"number"===n&&t)return!0}return!("range"!==n||!t)}_getDomainForFeature(e){const{fieldName:t,layer:i,template:n}=this;if(!e||!i?.getFieldDomain)return null;if("wfs"===i.type||"geojson"===i.type||"csv"===i.type||"knowledge-graph-sublayer"===i.type)return null;if(n?.domain&&this._isDomainCompatible(n.domain))return n.domain;if("feature"!==i.type&&"subtype-group"!==i.type&&null==i.getField(t)?.domain){const e=h(i,t);if(e)return e}return i.getFieldDomain(t,{feature:e})}_getComputedDomain(e,t){if(!t)return null;if("range"===t.type)return e;if("coded-value"===t.type){const i=t.codedValues.filter(t=>t.hasOwnProperty("code")&&t.code===e);return i&&i.length?i[0].name:e}return null}};e([o()],W.prototype,"_effectiveDomain",null),e([o()],W.prototype,"_activeFieldInput",void 0),e([o()],W.prototype,"_effectiveRange",null),e([o()],W.prototype,"_isAnyDateOrTimeField",null),e([o()],W.prototype,"_isIntegerField",null),e([o()],W.prototype,"_isNumericField",null),e([o()],W.prototype,"_isStringField",null),e([o()],W.prototype,"_isSubtypeField",null),e([o()],W.prototype,"_layerWithFieldConfigurations",null),e([o()],W.prototype,"_dateTimeFormatOptions",null),e([o()],W.prototype,"_numberFormatOptions",null),e([o({readOnly:!0})],W.prototype,"alias",null),e([o()],W.prototype,"cellValueFormatFunction",void 0),e([o()],W.prototype,"cellValueValidatorFunction",void 0),e([o({readOnly:!0})],W.prototype,"defaultValue",null),e([o()],W.prototype,"effectiveDescription",null),e([o()],W.prototype,"effectiveEditable",null),e([o()],W.prototype,"effectiveLabel",null),e([o()],W.prototype,"effectiveRequired",null),e([o()],W.prototype,"effectiveSortable",null),e([o()],W.prototype,"effectiveTimeZoneOptions",null),e([o({type:y})],W.prototype,"field",void 0),e([o()],W.prototype,"formatFunction",void 0),e([o()],W.prototype,"includeTime",null),e([o()],W.prototype,"inputRenderFunction",void 0),e([o()],W.prototype,"layer",void 0),e([o()],W.prototype,"layerFieldConfigurationFormat",null),e([o({readOnly:!0})],W.prototype,"loadingMessage",null),e([o()],W.prototype,"maxLength",null),e([o()],W.prototype,"minLength",null),e([o({readOnly:!0})],W.prototype,"name",null),e([o({readOnly:!0})],W.prototype,"nullable",null),e([o()],W.prototype,"parseInputValueFunction",void 0),e([o()],W.prototype,"shouldShowPrompt",null),e([o()],W.prototype,"sortable",void 0),e([o()],W.prototype,"store",void 0),e([o()],W.prototype,"template",void 0),e([o()],W.prototype,"view",void 0),W=e([l("esri.widgets.FeatureTable.FieldColumn")],W);const G=W;export{G as default};
5
+ import{__decorate as e}from"tslib";import"../../core/has.js";import t from"../../core/Logger.js";import{on as i,sync as n}from"../../core/reactiveUtils.js";import{property as o,subclass as l}from"../../core/accessorSupport/decorators.js";import{getEffectiveFieldAlias as r}from"../../editing/fieldUtils.js";import{convertDateFormatToIntlOptions as a,defaultFormatterOptionsNoTime as s,convertDateTimeFieldFormatToIntlOptions as u,defaultFormatterOptions as p}from"../../intl/date.js";import{formatNumber as d,convertNumberFormatToIntlOptions as m,convertNumberFieldFormatToIntlOptions as c}from"../../intl/number.js";import{isEditableLayer as f}from"../../layers/support/editableLayers.js";import{computeDomainFromTypes as h}from"../../layers/support/featureLayerUtils.js";import y from"../../layers/support/Field.js";import{defaultFieldFormat as g}from"../../layers/support/fieldFormatUtils.js";import{validateFieldValue as v,isDateField as F,isTimeOnlyField as _,isIntegerField as C,isNumericField as b,isStringField as D,isDateOnlyField as I,isTimestampOffsetField as x}from"../../layers/support/fieldUtils.js";import{isAnyDateField as T}from"../../smartMapping/support/utils.js";import{system as O}from"../../time/constants.js";import{getTimeZoneFormattingOptions as w}from"../../time/timeZoneUtils.js";import V from"../FeatureForm/FieldInput.js";import E from"./Grid/EditorColumn.js";import{isIFeatureTableSupportedLayerWithFieldConfigurations as Z,isEmptyStringOrWhitespace as L}from"./support/tableUtils.js";import{valueIsInRange as j,dateTimeIsInRange as R,getUnixFieldValueFromDateComponents as S,getISOFieldValueFromDateComponents as N,normalizeTimeOnlyString as A,getLabelForDateFieldValue as U,prepareISOFieldValueForDateComponents as q,prepareUnixFieldValueForDateComponents as B}from"../support/dateUtils.js";import{setFocus as k}from"../support/widgetUtils.js";const H={cancelEdit:"Escape"},z=Symbol(),P="esri-column",M={input:`${P}__cell-input`,inputContainer:`${P}__cell__input-container`};let W=class extends E{constructor(e){super(e),this._activeFieldInput=null,this.cellValueFormatFunction=({root:e,rowData:t,value:i})=>{const{formatFunction:n}=this;if(n&&t){const{index:o,item:{attachments:l,feature:r,relatedRecords:a}}=t;return n({attachments:l,column:this,feature:r,field:this.field,index:o,relatedRecords:a,value:this.sanitizeContent(i),virtualIndex:this.getVirtualRowIndex(e)})}if(null===i)return"&nbsp;";const o=this._getDomainForFeature(t?.item?.feature),l=this._getComputedDomain(i,o)||i;return this._isAnyDateOrTimeField&&"coded-value"!==o?.type?this._formatDateValueForDisplay(this.field,l):this._isNumericField&&"coded-value"!==o?.type?d(parseFloat(l),this._numberFormatOptions):this.sanitizeContent(l)},this.cellValueValidatorFunction=({oldValue:e,value:i})=>{const{_effectiveRange:n,field:o}=this,{max:l,min:r}=n;if(this.effectiveRequired&&(null==i||""===i))return!1;if(this._isNumericField&&(v(o,i)||!j({max:l,min:r,value:i})))return t.getLogger(this).warn("value-exceeds-valid-range","Field value exceeds valid range. Attempted edit was rejected."),!1;if(this._isAnyDateOrTimeField){const e=o.type;if(!R({type:e,range:n,value:i}))return!1}return e!==i},this.field=null,this.formatFunction=null,this.inputRenderFunction=async({root:e,column:i,rowData:n})=>{if(this.editInfo||!this.effectiveEditable)return;const o=this.getCellValue(n),{field:l}=this;if("big-integer"===l.type&&v(l,o))return void t.getLogger(this).warn("value-exceeds-valid-range","Field value is beyond supported limit. Editing is disabled for this field value.");const r=n?.item.feature;if(!r)return;this._activeFieldInput=this._setUpFieldInput(r,o);const a=document.createElement("div");a.classList.add(M.inputContainer);const s=[],u="coded-value"===this._effectiveDomain?.type;if(this._isAnyDateOrTimeField&&!u){const e=document.createElement("div"),t=this._setUpDateComponents(o),i=this._setUpDateActionBar();t.forEach(t=>e.appendChild(t)),a.appendChild(e),a.appendChild(i),s.push(...t)}else{const e=this.createInputElement({value:o});a.appendChild(e),s.push(e)}this._set("editInfo",{column:i,inputs:s,root:e,rowData:n,oldValue:o}),this.removeCellContent(e),e.appendChild(a),this._syncRowEditingState(e,!0),this.grid?.generateCellPartNames();const p=s[0];await k(p),"selectText"in p&&await p.selectText()},this.layer=null,this.parseInputValueFunction=({inputs:e})=>{const{editInfo:t,field:i,includeTime:n}=this;if(!t||!e.length)return null;const o=e[0];if(this._isAnyDateOrTimeField){if("coded-value"===this._effectiveDomain?.type){if(null==o.value||""===o.value)return null;const e=String(o.value);return F(i)?parseFloat(e):e}const{timeZone:l}=this.effectiveTimeZoneOptions,r=t.oldValue??void 0;switch(i.type){case"date-only":{const e=o.value;return""!==e?e:null}case"time-only":{const e=A(o.value);return""!==e?e:null}case"timestamp-offset":{const t=n?e[1]:void 0,i=e.at(-1);return N({oldValue:r,dateComponent:o,timeComponent:t,timeZoneComponent:i,defaultTimeZone:l})}case"date":{const{max:t,min:i}=this._effectiveRange;return S({oldValue:r,dateComponent:o,timeComponent:e[1],timeZone:l,max:t,min:i})}}return null}const l=o.value,{effectiveRequired:r}=this;return r||null!=l&&""!==l?this._isNumericField?parseFloat(l):this._isStringField?l.trim():l:null},this.sortable=!0,this.store=null,this.template=null,this.view=null}get _effectiveDomain(){const e=this._activeFieldInput?.feature;return e?this._getDomainForFeature(e):null}get _effectiveRange(){return this._activeFieldInput?.range??{max:null,min:null}}get _isAnyDateOrTimeField(){const{field:e}=this;return T(e)||_(e)}get _isIntegerField(){return C(this.field)}get _isNumericField(){return b(this.field)}get _isStringField(){return D(this.field)}get _isSubtypeField(){const{layer:e}=this;if(e?.subtypeField){const{subtypeField:t,fieldsIndex:i}=e;return(i.get(t)?.name??t)===this.fieldName}return!1}get _layerWithFieldConfigurations(){const{layer:e}=this;return Z(e)?e:null}get _dateTimeFormatOptions(){const{layerFieldConfigurationFormat:e,template:t}=this;return t?.format?.dateFormat?a(t.format.dateFormat):t?.input&&"includeTime"in t.input&&!1===t.input.includeTime?s:"date-time"===e?.type?u(e):this._isAnyDateOrTimeField?p:void 0}get _numberFormatOptions(){const{layerFieldConfigurationFormat:e,template:t}=this;return t?.format?m(t.format):"number"===e?.type?c(e):this._isNumericField?{useGrouping:!0,maximumFractionDigits:20}:void 0}get alias(){return r(this.field,this._layerWithFieldConfigurations)}get defaultValue(){return this.field?.defaultValue}get effectiveDescription(){const{description:e,field:t}=this,i=t.description,n=L(e)?L(i)?null:i:e;return null==n?null:this.sanitizeLabel(n)}get effectiveEditable(){const{editable:e,field:t,layer:i,tableEditingEnabled:n}=this;if(!t||!i)return!1;const o=f(i),l=i.effectiveCapabilities??i.capabilities,r=l?.operations?.supportsUpdate;return!!(t.editable&&o&&r&&"oid"!==t.type&&n)&&e}get effectiveLabel(){return this.sanitizeLabel(this.label||this.alias||this.fieldName)}get effectiveRequired(){return!this.nullable||this._isSubtypeField||this._activeFieldInput?.required||this.required}get effectiveSortable(){return!(!this.layer?.capabilities?.query?.supportsOrderBy||!this.sortable)}get effectiveTimeZoneOptions(){const{layer:e,field:t}=this;if(!e||"date"!==t?.type&&"timestamp-offset"!==t?.type)return{timeZone:void 0,timeZoneName:void 0};const{tableTimeZone:i,timeZone:n,view:o}=this;return w(e.preferredTimeZone||null,!!e.datesInUnknownTimezone,n??i??o?.timeZone??O,this._dateTimeFormatOptions??p,t.type)}get includeTime(){const{field:e,template:t}=this;return"time-only"===e.type||"date-only"!==e.type&&(!t?.input||"includeTime"in t.input&&!1!==t.input.includeTime)}get layerFieldConfigurationFormat(){const{_layerWithFieldConfigurations:e}=this;if(e)return e.getFieldConfiguration(this.fieldName)?.fieldFormat??g(this.field)}get loadingMessage(){return this.messages?.loading||"..."}get maxLength(){const{field:e,template:t}=this,i=e?.length??-1,n=t?.input&&"maxLength"in t.input?t.input.maxLength:null;return null!=n&&!isNaN(n)&&n>=-1&&(-1===i||n<=i)?n:i}get minLength(){const{template:e,maxLength:t}=this,i=e?.input&&"minLength"in e.input?e.input.minLength:null;return t&&i<=t?i:null}get name(){return this.field?.name}get nullable(){return!1!==this.field.nullable}get shouldShowPrompt(){return this._isSubtypeField}createInputElement({value:e}){const{_effectiveDomain:t,maxLength:o,minLength:l,effectiveRequired:r}=this;let a;if("coded-value"===t?.type)a=this.createCalciteSelect(e,t.codedValues.map(({code:e,name:t})=>({value:e,name:t}))),this.addHandles([i(()=>a,"calciteSelectChange",()=>this.onInputBlur(),n)],z);else if(this._isNumericField){const{_effectiveRange:{max:t,min:i}}=this;a=document.createElement("calcite-input"),a.type="number",this._isIntegerField&&(a.step=1),null!=t&&(a.max=t),null!=i&&(a.min=i),a.status=j({max:t,min:i,value:e})?"idle":"invalid"}else a=document.createElement("calcite-input"),this.addHandles([i(()=>a,"calciteInputChange",()=>this.onInputBlur(),n)],z),o>-1&&(a.maxLength=o),l>0&&(a.minLength=l);return a.classList.add(M.input),a.required=r,a.value=null!=e?e.toString():"",this.addHandles([i(()=>a,"keydown",e=>{e.key===H.cancelEdit&&this.onInputBlur(!0)},n),i(()=>a,"blur",()=>this.onInputBlur(),n)],z),a}onInputBlur(e=!1){this.removeHandles(z),super.onInputBlur(e)}onEditComplete(){const e=this.editInfo?.root;e&&this._syncRowEditingState(e,!1),this._activeFieldInput=null,super.onEditComplete()}get test(){}_clearActiveEditValues(){this.editInfo?.inputs?.forEach(e=>e.value="")}_setUpDateActionBar(){const{messagesCommon:e}=this,t=e?.cancel??"",i=e?.clear??"",n=e?.save??"",o=document.createElement("calcite-action-bar");return o.expandDisabled=!0,o.layout="horizontal",o.appendChild(this.createCalciteAction({text:n,icon:"save",onclick:()=>this.submit()})),this.effectiveRequired||o.appendChild(this.createCalciteAction({text:i,icon:"trash",onclick:()=>{this._clearActiveEditValues(),this.submit()}})),o.appendChild(this.createCalciteAction({text:t,icon:"x",onclick:()=>this.cancel()})),o}_formatDateValueForDisplay(e,t){const{timeZone:i,timeZoneName:n}=this.effectiveTimeZoneOptions;return null!=t?U(e,t,{...this._dateTimeFormatOptions,timeZone:i,timeZoneName:n}):null}_setUpDateComponents(e){const{_effectiveRange:{max:t,min:n,rawMax:o,rawMin:l},field:r,effectiveRequired:a}=this,s=this._getDateFieldValuesForComponents(r,e),u=[];if(T(r)){const e=this.createDateComponent(),p=I(r)||x(r)?o:t,d=I(r)||x(r)?l:n,m=this._getDateFieldValuesForComponents(r,p??null),c=this._getDateFieldValuesForComponents(r,d??null);e.value=s.date??"",e.max=m.date??"",e.min=c.date??"",e.required=a,this.addHandles([i(()=>e,"calciteInputDatePickerOpen",()=>this._onDateComponentOpen(e))],z),u.push(e)}if(this.includeTime){const e=this.createTimeComponent();e.value=s.time??"",e.required=a,this.addHandles([i(()=>e,"calciteInputTimePickerOpen",()=>this._onDateComponentOpen(e))],z),u.push(e)}if("timestamp-offset"===r.type){const e=this.createTimeZoneComponent();e.value=s.timeZoneOffset??"0",this.addHandles([i(()=>e,"calciteInputTimeZoneOpen",()=>this._onDateComponentOpen(e))],z),u.push(e)}return u}_onDateComponentOpen(e){this.editInfo?.inputs.forEach(t=>{t!==e&&"open"in t&&(t.open=!1)})}_syncRowEditingState(e,t=!1){const i=this.grid?.getRowContainingNode(e);i&&(t?i.setAttribute("editing","true"):i.removeAttribute("editing"))}_getDateFieldValuesForComponents(e,t){switch(e.type){case"date":return B(t,this.effectiveTimeZoneOptions.timeZone);case"date-only":return{date:t};case"time-only":return{time:t};case"timestamp-offset":return q(t);default:return{}}}_setUpFieldInput(e,t){const{field:i,layer:n,effectiveTimeZoneOptions:{timeZone:o}}=this,l=new V({feature:e,field:i,initialFeature:e.clone(),layer:n,timeZone:o});return l.set("value",t),l}_isDomainCompatible(e){if(!e)return!1;const{_isNumericField:t,_isStringField:i}=this,{type:n}=e;if("coded-value"===n){const n=typeof e.codedValues[0].code;if("string"===n&&i||"number"===n&&t)return!0}return!("range"!==n||!t)}_getDomainForFeature(e){const{fieldName:t,layer:i,template:n}=this;if(!e||!i?.getFieldDomain)return null;if("wfs"===i.type||"geojson"===i.type||"csv"===i.type)return null;if(n?.domain&&this._isDomainCompatible(n.domain))return n.domain;if("feature"!==i.type&&"subtype-group"!==i.type&&null==i.getField(t)?.domain){const e=h(i,t);if(e)return e}return i.getFieldDomain(t,{feature:e})}_getComputedDomain(e,t){if(!t)return null;if("range"===t.type)return e;if("coded-value"===t.type){const i=t.codedValues.filter(t=>t.hasOwnProperty("code")&&t.code===e);return i&&i.length?i[0].name:e}return null}};e([o()],W.prototype,"_effectiveDomain",null),e([o()],W.prototype,"_activeFieldInput",void 0),e([o()],W.prototype,"_effectiveRange",null),e([o()],W.prototype,"_isAnyDateOrTimeField",null),e([o()],W.prototype,"_isIntegerField",null),e([o()],W.prototype,"_isNumericField",null),e([o()],W.prototype,"_isStringField",null),e([o()],W.prototype,"_isSubtypeField",null),e([o()],W.prototype,"_layerWithFieldConfigurations",null),e([o()],W.prototype,"_dateTimeFormatOptions",null),e([o()],W.prototype,"_numberFormatOptions",null),e([o({readOnly:!0})],W.prototype,"alias",null),e([o()],W.prototype,"cellValueFormatFunction",void 0),e([o()],W.prototype,"cellValueValidatorFunction",void 0),e([o({readOnly:!0})],W.prototype,"defaultValue",null),e([o()],W.prototype,"effectiveDescription",null),e([o()],W.prototype,"effectiveEditable",null),e([o()],W.prototype,"effectiveLabel",null),e([o()],W.prototype,"effectiveRequired",null),e([o()],W.prototype,"effectiveSortable",null),e([o()],W.prototype,"effectiveTimeZoneOptions",null),e([o({type:y})],W.prototype,"field",void 0),e([o()],W.prototype,"formatFunction",void 0),e([o()],W.prototype,"includeTime",null),e([o()],W.prototype,"inputRenderFunction",void 0),e([o()],W.prototype,"layer",void 0),e([o()],W.prototype,"layerFieldConfigurationFormat",null),e([o({readOnly:!0})],W.prototype,"loadingMessage",null),e([o()],W.prototype,"maxLength",null),e([o()],W.prototype,"minLength",null),e([o({readOnly:!0})],W.prototype,"name",null),e([o({readOnly:!0})],W.prototype,"nullable",null),e([o()],W.prototype,"parseInputValueFunction",void 0),e([o()],W.prototype,"shouldShowPrompt",null),e([o()],W.prototype,"sortable",void 0),e([o()],W.prototype,"store",void 0),e([o()],W.prototype,"template",void 0),e([o()],W.prototype,"view",void 0),W=e([l("esri.widgets.FeatureTable.FieldColumn")],W);const G=W;export{G 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 e}from"tslib";import r from"../../core/Accessor.js";import t from"../../core/Collection.js";import o from"../../core/Error.js";import i from"../../core/Logger.js";import{watch as s,on as n}from"../../core/reactiveUtils.js";import{removeTrailingSlash as a}from"../../core/urlUtils.js";import{property as d,subclass as l}from"../../core/accessorSupport/decorators.js";import{UpdatingHandles as u}from"../../core/support/UpdatingHandles.js";import{getOwningPortalUrl as h}from"../../layers/support/layerUtils.js";import p from"../../portal/Portal.js";import{hasPrivilege as v}from"../../portal/support/utils.js";import m from"../../rest/featureService/FeatureService.js";import{createFeatureServices as c}from"../../rest/featureService/utils.js";import{getVersioningStates as g}from"../../versionManagement/utils.js";import w from"../../versionManagement/VersioningState.js";import f from"../../versionManagement/VersionManagementService.js";import{createVersionAdapters as _}from"../../versionManagement/versionAdapters/utils.js";let E=class extends r{constructor(e){super(e),this._portalLookup=new Map,this._updatingHandlesLoad=new u,this._updatingHandlesExecute=new u,this.executionError=void 0,this.featureServiceLookup=new Map,this.loadError=void 0,this.serverVersionLookup=new Map,this.serviceNameLookup=new Map,this.userLookup=new Map,this.versionAdministratorLookup=new Map,this.versioningStateLookup=new Map,this.view=null,this.versioningStates=null}initialize(){this._viewChangeHandle(),this.addHandles([s(()=>this.view,()=>{this._resetAllLookupProperties(),this._viewChangeHandle()}),s(()=>this.versioningStates,()=>{this._resetVersioningLookupProperties(),this._setVersioningStatesLookups()})])}destroy(){this._updatingHandlesLoad.destroy(),this._updatingHandlesExecute.destroy()}get state(){return this._updatingHandlesLoad.updating?"loading":this.loadError?"disabled":this._updatingHandlesExecute.updating?"executing":this.executionError?"failed":"ready"}async alterVersion(e){return this._updatingHandlesExecute.addPromise(this._alterVersionInternal(e))}async changeVersion(e,r,t){return this._updatingHandlesExecute.addPromise(this._changeVersionInternal(e,r,t))}async createVersion(e){return this._updatingHandlesExecute.addPromise(this._createVersionInternal(e))}async deleteVersion(e,r,t){return this._updatingHandlesExecute.addPromise(this._deleteVersionInternal(e,r,t))}async getVersionInfos(e){return this._updatingHandlesExecute.addPromise(this._getVersionInfosInternal(e))}async _alterVersionInternal(e){if("disabled"===this.state)throw this._logError("version-management-view-model:load-error",this.loadError),new o("version-management-view-model:load-error",this.loadError??"");this._setExecutionError();const r=this.versioningStateLookup.get(e.featureServerUrl);if(!r)throw this._logError("version-management-view-model:execution-error","no-versioning-state-found"),new o("version-management-view-model:execution-error",this.executionError??"");if(!this.serverVersionLookup.has(e.featureServerUrl)||this.serverVersionLookup.get(e.featureServerUrl)<=11.1)throw this._logError("version-management-view-model:execution-error","no-valid-enterprise-version"),new o("version-management-view-model:execution-error",this.executionError??"");const{featureServerUrl:t,versionIdentifier:i,...s}=e,n=await r.alterVersion(i,s).catch(e=>{throw this._logExecutionError(e),e});return await this.getVersionInfos(t),n}async _changeVersionInternal(e,r,t){if("disabled"===this.state)throw this._logError("version-management-view-model:load-error",this.loadError),new o("version-management-view-model:load-error",this.loadError??"");this._setExecutionError();const i=this.versioningStateLookup.get(e);if(!i)throw this._logError("version-management-view-model:execution-error","no-versioning-state-found"),new o("version-management-view-model:execution-error",this.executionError??"");const s={name:r,guid:t};return await i.changeVersion(s).catch(e=>{throw this._logExecutionError(e),e})}_updateVersionableItems(e){this._updatingHandlesLoad.addPromise((async()=>{_(e.added).forEach(e=>{const r=e.featureServiceUrl,t=this.versioningStateLookup.get(r);t&&(t.versionableItems.find(r=>r.versionableItem===e.versionableItem)||t.versionableItems.add(e))});_(e.removed).forEach(e=>{const{allLayers:r,allTables:t}=this.view.map,o=e.featureServiceUrl,i=this.versioningStateLookup.get(o);if(!i)return void this._logError("version-management-view-model:execution-error","no-version-management-service-found");const s=e=>("feature"===e.type||"subtype-group"===e.type)&&(e.url?.includes(o)??!1);[...r.filter(s),...t.filter(s)].length||(this.featureServiceLookup.delete(o),this.serviceNameLookup.delete(o),this.versioningStateLookup.delete(o),this.versioningStates.remove(i));const n=i.versionableItems.find(r=>r.versionableItem===e.versionableItem);n&&i.versionableItems.remove(n)})})())}async _createVersionInternal(e){if("disabled"===this.state)throw this._logError("version-management-view-model:load-error",this.loadError),new o("version-management-view-model:load-error",this.loadError??"");this._setExecutionError();const r=e.featureServerUrl,t=this.versioningStateLookup.get(r);if(!t)throw this._logError("version-management-view-model:execution-error","no-versioning-state-found"),new o("version-management-view-model:execution-error",this.executionError??"");const i=this.userLookup.get(r).toUpperCase(),s=this._isEmptyString(e.ownerName)?i:e.ownerName?.trim().toUpperCase();if(s!==i&&this.serverVersionLookup.get(r)<=11.1)throw this._logError("version-management-view-model:execution-error","versioning-api-error"),new o("version-management-view-model:execution-error",this.executionError??"");let n=await(this.versioningStateLookup.get(r)?.getVersionInfos());if("SDE"===s?.toUpperCase()&&"DEFAULT"===e.versionName.toUpperCase()||n?.find(r=>r.versionIdentifier.name.toUpperCase()===(s+"."+e.versionName).toUpperCase()||r.versionIdentifier.name.toUpperCase()===(i+"."+e.versionName).toUpperCase()))throw this._logError("version-management-view-model:execution-error","no-valid-version-name"),new o("version-management-view-model:execution-error",this.executionError??"");const a=await t.versionManagementService.createVersion({versionName:e.versionName,access:s!==i?"public":e.access,description:e.description}).catch(e=>{throw this._logExecutionError(e),e});if(s!==i){const{guid:t,name:o}=a.versionIdentifier,n={featureServerUrl:r,versionIdentifier:{guid:t,name:o},access:e.access,ownerName:s};await this.alterVersion(n)||this.deleteVersion(r,i+"."+e.versionName,a.versionIdentifier.guid)}return await this.getVersionInfos(r),n=await(this.versioningStateLookup.get(r)?.getVersionInfos()),n?.find(e=>e.versionIdentifier.guid===a.versionIdentifier.guid)}async _deleteVersionInternal(e,r,t){if("disabled"===this.state)throw this._logError("version-management-view-model:load-error",this.loadError),new o("version-management-view-model:load-error",this.loadError??"");this._setExecutionError();const i=this.versioningStateLookup.get(e);if(!i)throw this._logError("version-management-view-model:execution-error","no-versioning-state-found"),new o("version-management-view-model:execution-error",this.executionError??"");if(this.serverVersionLookup.get(e)<=11.1)throw this._logError("version-management-view-model:execution-error","versioning-api-error"),new o("version-management-view-model:execution-error",this.executionError??"");const s={name:r,guid:t};return await i.deleteVersion(s).catch(e=>{throw this._logExecutionError(e),new o("version-management-view-model:execution-error",this.executionError??"")})}async _getVersionInfosInternal(e){if("disabled"===this.state)throw this._logError("version-management-view-model:load-error",this.loadError),new o("version-management-view-model:load-error",this.loadError??"");this._setExecutionError();const r=this.featureServiceLookup.get(e)?.featureService;if(!r)throw this._logError("version-management-view-model:execution-error","no-feature-service-found"),new o("version-management-view-model:execution-error",this.executionError??"");r.loaded||await r.load().catch(e=>{throw this._logExecutionError(e),e});const t=r.url;this.serverVersionLookup.set(t,r.sourceJSON?.currentVersion??0);const i=this.userLookup.get(e);this._portalLookup.get(e)&&i?this.versionAdministratorLookup.set(t,await v(this._portalLookup.get(e),i,"features:user:manageVersions")):this.versionAdministratorLookup.set(t,!1);const s=this.versioningStateLookup.get(e);if(!s)throw this._logError("version-management-view-model:execution-error","no-versioning-state-found"),new o("version-management-view-model:execution-error",this.executionError??"");s.loaded||await s.load().catch(e=>{throw this._logExecutionError(e),e});return await s.getVersionInfos(!0).catch(e=>{throw this._logExecutionError(e),e})}_isEmptyString(e){return!e||0===e.trim().length}_logError(e,r){switch(i.getLogger(this).error(new o(e,r??"")),e){case"version-management-view-model:load-error":this._setLoadError(r);break;case"version-management-view-model:execution-error":this._setExecutionError(r)}}_logExecutionError(e){this._logError("version-management-view-model:execution-error",e.message)}async _viewChangeHandle(){this._updatingHandlesLoad.addPromise((async()=>{if(this._setLoadError(),!this.view)return void this._setLoadError("no-view-property");if(this.view&&"2d"!==this.view.type)return void this._logError("version-management-view-model:load-error","sceneView-not-supported");this.removeHandles("map-change-handle"),this.addHandles([s(()=>this.view?.map,()=>{this._resetAllLookupProperties(),this._mapChangeHandle(this.versioningStates)})],"map-change-handle");const e=await this._getVersioningStates();await this._mapChangeHandle(e)})())}async _mapChangeHandle(e){this._updatingHandlesLoad.addPromise((async()=>{this._setLoadError(),this.removeHandles("map-layers-tables-change-handle"),this.addHandles([n(()=>this.view?.map.allLayers,"change",e=>{(e.added.some(({type:e})=>"feature"===e)||e.removed.some(({type:e})=>"feature"===e)||e.added.some(({type:e})=>"subtype-group"===e)||e.removed.some(({type:e})=>"subtype-group"===e))&&(this._resetServiceRelatedLookupProperties(),this._propertiesChangeInternal(this.versioningStates),this._updateVersionableItems(e))}),n(()=>this.view?.map.allTables,"change",e=>{(e.added.some(({type:e})=>"feature"===e)||e.removed.some(({type:e})=>"feature"===e)||e.added.some(({type:e})=>"subtype-group"===e)||e.removed.some(({type:e})=>"subtype-group"===e))&&(this._resetServiceRelatedLookupProperties(),this._propertiesChangeInternal(this.versioningStates),this._updateVersionableItems(e))})],"map-layers-tables-change-handle"),await this._propertiesChangeInternal(e)})())}async _propertiesChangeInternal(e){this._updatingHandlesLoad.addPromise((async()=>{const r=e=>"feature"===e.type||"subtype-group"===e.type,{allLayers:t,allTables:o}=this.view.map;if(this._setLoadError(),this.featureServiceLookup=c([...t.filter(r),...o.filter(r)]),this.featureServiceLookup.size){this._updateFeatureServiceLookup(e),this.serviceNameLookup=new Map;for(const e of this.featureServiceLookup.values()){const{featureService:r,featureService:{url:t}}=e;if(!this.serviceNameLookup.has(t)){if(r.loaded||await r.load().catch(e=>{i.getLogger(this).error(e)}),!r.versionManagementServiceUrl){this.featureServiceLookup.delete(t);continue}const e=await h(t),o=new p({authMode:"immediate",url:e});await o.load().catch(e=>{i.getLogger(this).error(e)});const s=o.user?.username;if(!r.loaded||!o.loaded||!s)continue;this.serviceNameLookup.set(a(t),t.split("/").at(-2)),this.userLookup.set(t,s),this._portalLookup.set(t,o)}}e.forEach(e=>this._handleVersioningStateLookupUpdate(e)),await this._updateVersioningStates(e),this.versioningStates=e}else this._logError("version-management-view-model:load-error","no-feature-services")})())}_updateFeatureServiceLookup(e){for(const r of e){const e=r.featureServiceUrl;if(!this.featureServiceLookup.has(e)){const t=new m({url:e}),o=r.versionableItems.toArray().flatMap(e=>"network"===e.type?null:e.versionableItem).filter(e=>!!e);this.featureServiceLookup.set(e,{featureService:t,layers:o})}}}async _updateVersioningStates(e){for(const r of this.featureServiceLookup.values()){const o=r.featureService;if(!o.versionManagementServiceUrl)continue;if(!e.find(e=>e.featureServiceUrl===o.url)&&o.versionManagementServiceUrl){const i=new t(_(r.layers)),s=new w({versionManagementService:new f({url:o.versionManagementServiceUrl}),versionableItems:i});e.add(s),this._handleVersioningStateLookupUpdate(s)}await this.getVersionInfos(o.url)}}async _getVersioningStates(){return this.versioningStates&&this.versioningStates.length?this.versioningStates:this.view?await g(this.view,!1):(this._logError("version-management-view-model:load-error","no-view-property"),new t)}_handleVersioningStateLookupUpdate(e){this.versioningStateLookup.set(e.featureServiceUrl,e)}async _setVersioningStatesLookups(){this._updatingHandlesLoad.addPromise((async()=>{this.versioningStates&&(this._updateFeatureServiceLookup(this.versioningStates),this.versioningStates.forEach(e=>this._handleVersioningStateLookupUpdate(e)),await this._updateVersioningStates(this.versioningStates))})())}_resetVersioningLookupProperties(){this.versioningStateLookup=new Map}_resetAllLookupProperties(){this._portalLookup=new Map,this.serverVersionLookup=new Map,this.userLookup=new Map,this.versioningStates=new t,this._resetVersioningLookupProperties(),this._resetServiceRelatedLookupProperties()}_resetServiceRelatedLookupProperties(){this.featureServiceLookup=new Map,this.serviceNameLookup=new Map}_setExecutionError(e){this._set("executionError",e)}_setLoadError(e){this._set("loadError",e)}};e([d()],E.prototype,"_portalLookup",void 0),e([d({readOnly:!0})],E.prototype,"executionError",void 0),e([d()],E.prototype,"featureServiceLookup",void 0),e([d({readOnly:!0})],E.prototype,"loadError",void 0),e([d()],E.prototype,"serverVersionLookup",void 0),e([d()],E.prototype,"serviceNameLookup",void 0),e([d({readOnly:!0})],E.prototype,"state",null),e([d()],E.prototype,"userLookup",void 0),e([d()],E.prototype,"versionAdministratorLookup",void 0),e([d()],E.prototype,"versioningStateLookup",void 0),e([d()],E.prototype,"view",void 0),e([d()],E.prototype,"versioningStates",void 0),E=e([l("esri.widgets.VersionManagement.VersionManagementViewModel")],E);const L=E;export{L as default};
5
+ import{__decorate as e}from"tslib";import r from"../../core/Accessor.js";import o from"../../core/Collection.js";import{deprecatedModule as t}from"../../core/deprecate.js";import i from"../../core/Error.js";import s from"../../core/Logger.js";import{watch as n,on as a}from"../../core/reactiveUtils.js";import{removeTrailingSlash as d}from"../../core/urlUtils.js";import{property as l,subclass as u}from"../../core/accessorSupport/decorators.js";import{UpdatingHandles as h}from"../../core/support/UpdatingHandles.js";import{getOwningPortalUrl as p}from"../../layers/support/layerUtils.js";import v from"../../portal/Portal.js";import{hasPrivilege as m}from"../../portal/support/utils.js";import g from"../../rest/featureService/FeatureService.js";import{createFeatureServices as c}from"../../rest/featureService/utils.js";import{getVersioningStates as w}from"../../versionManagement/utils.js";import f from"../../versionManagement/VersioningState.js";import _ from"../../versionManagement/VersionManagementService.js";import{createVersionAdapters as E}from"../../versionManagement/versionAdapters/utils.js";t(s.getLogger("esri.widgets.verisonManagement.VersionManagementViewModel"),"VersionManagementViewModel",{replacement:"Use esri/versionManagement/VersionManager instead",version:"5.0",warnOnce:!0});let L=class extends r{constructor(e){super(e),this._portalLookup=new Map,this._updatingHandlesLoad=new h,this._updatingHandlesExecute=new h,this.executionError=void 0,this.featureServiceLookup=new Map,this.loadError=void 0,this.serverVersionLookup=new Map,this.serviceNameLookup=new Map,this.userLookup=new Map,this.versionAdministratorLookup=new Map,this.versioningStateLookup=new Map,this.view=null,this.versioningStates=null}initialize(){this._viewChangeHandle(),this.addHandles([n(()=>this.view,()=>{this._resetAllLookupProperties(),this._viewChangeHandle()}),n(()=>this.versioningStates,()=>{this._resetVersioningLookupProperties(),this._setVersioningStatesLookups()})])}destroy(){this._updatingHandlesLoad.destroy(),this._updatingHandlesExecute.destroy()}get state(){return this._updatingHandlesLoad.updating?"loading":this.loadError?"disabled":this._updatingHandlesExecute.updating?"executing":this.executionError?"failed":"ready"}async alterVersion(e){return this._updatingHandlesExecute.addPromise(this._alterVersionInternal(e))}async changeVersion(e,r,o){return this._updatingHandlesExecute.addPromise(this._changeVersionInternal(e,r,o))}async createVersion(e){return this._updatingHandlesExecute.addPromise(this._createVersionInternal(e))}async deleteVersion(e,r,o){return this._updatingHandlesExecute.addPromise(this._deleteVersionInternal(e,r,o))}async getVersionInfos(e){return this._updatingHandlesExecute.addPromise(this._getVersionInfosInternal(e))}async _alterVersionInternal(e){if("disabled"===this.state)throw this._logError("version-management-view-model:load-error",this.loadError),new i("version-management-view-model:load-error",this.loadError??"");this._setExecutionError();const r=this.versioningStateLookup.get(e.featureServerUrl);if(!r)throw this._logError("version-management-view-model:execution-error","no-versioning-state-found"),new i("version-management-view-model:execution-error",this.executionError??"");if(!this.serverVersionLookup.has(e.featureServerUrl)||this.serverVersionLookup.get(e.featureServerUrl)<=11.1)throw this._logError("version-management-view-model:execution-error","no-valid-enterprise-version"),new i("version-management-view-model:execution-error",this.executionError??"");const{featureServerUrl:o,versionIdentifier:t,...s}=e,n=await r.alterVersion(t,s).catch(e=>{throw this._logExecutionError(e),e});return await this.getVersionInfos(o),n}async _changeVersionInternal(e,r,o){if("disabled"===this.state)throw this._logError("version-management-view-model:load-error",this.loadError),new i("version-management-view-model:load-error",this.loadError??"");this._setExecutionError();const t=this.versioningStateLookup.get(e);if(!t)throw this._logError("version-management-view-model:execution-error","no-versioning-state-found"),new i("version-management-view-model:execution-error",this.executionError??"");const s={name:r,guid:o};return await t.changeVersion(s).catch(e=>{throw this._logExecutionError(e),e})}_updateVersionableItems(e){this._updatingHandlesLoad.addPromise((async()=>{E(e.added).forEach(e=>{const r=e.featureServiceUrl,o=this.versioningStateLookup.get(r);o&&(o.versionableItems.find(r=>r.versionableItem===e.versionableItem)||o.versionableItems.add(e))});E(e.removed).forEach(e=>{const{allLayers:r,allTables:o}=this.view.map,t=e.featureServiceUrl,i=this.versioningStateLookup.get(t);if(!i)return void this._logError("version-management-view-model:execution-error","no-version-management-service-found");const s=e=>("feature"===e.type||"subtype-group"===e.type)&&(e.url?.includes(t)??!1);[...r.filter(s),...o.filter(s)].length||(this.featureServiceLookup.delete(t),this.serviceNameLookup.delete(t),this.versioningStateLookup.delete(t),this.versioningStates.remove(i));const n=i.versionableItems.find(r=>r.versionableItem===e.versionableItem);n&&i.versionableItems.remove(n)})})())}async _createVersionInternal(e){if("disabled"===this.state)throw this._logError("version-management-view-model:load-error",this.loadError),new i("version-management-view-model:load-error",this.loadError??"");this._setExecutionError();const r=e.featureServerUrl,o=this.versioningStateLookup.get(r);if(!o)throw this._logError("version-management-view-model:execution-error","no-versioning-state-found"),new i("version-management-view-model:execution-error",this.executionError??"");const t=this.userLookup.get(r).toUpperCase(),s=this._isEmptyString(e.ownerName)?t:e.ownerName?.trim().toUpperCase();if(s!==t&&this.serverVersionLookup.get(r)<=11.1)throw this._logError("version-management-view-model:execution-error","versioning-api-error"),new i("version-management-view-model:execution-error",this.executionError??"");let n=await(this.versioningStateLookup.get(r)?.getVersionInfos());if("SDE"===s?.toUpperCase()&&"DEFAULT"===e.versionName.toUpperCase()||n?.find(r=>r.versionIdentifier.name.toUpperCase()===(s+"."+e.versionName).toUpperCase()||r.versionIdentifier.name.toUpperCase()===(t+"."+e.versionName).toUpperCase()))throw this._logError("version-management-view-model:execution-error","no-valid-version-name"),new i("version-management-view-model:execution-error",this.executionError??"");const a=await o.versionManagementService.createVersion({versionName:e.versionName,access:s!==t?"public":e.access,description:e.description}).catch(e=>{throw this._logExecutionError(e),e});if(s!==t){const{guid:o,name:i}=a.versionIdentifier,n={featureServerUrl:r,versionIdentifier:{guid:o,name:i},access:e.access,ownerName:s};await this.alterVersion(n)||this.deleteVersion(r,t+"."+e.versionName,a.versionIdentifier.guid)}return await this.getVersionInfos(r),n=await(this.versioningStateLookup.get(r)?.getVersionInfos()),n?.find(e=>e.versionIdentifier.guid===a.versionIdentifier.guid)}async _deleteVersionInternal(e,r,o){if("disabled"===this.state)throw this._logError("version-management-view-model:load-error",this.loadError),new i("version-management-view-model:load-error",this.loadError??"");this._setExecutionError();const t=this.versioningStateLookup.get(e);if(!t)throw this._logError("version-management-view-model:execution-error","no-versioning-state-found"),new i("version-management-view-model:execution-error",this.executionError??"");if(this.serverVersionLookup.get(e)<=11.1)throw this._logError("version-management-view-model:execution-error","versioning-api-error"),new i("version-management-view-model:execution-error",this.executionError??"");const s={name:r,guid:o};return await t.deleteVersion(s).catch(e=>{throw this._logExecutionError(e),new i("version-management-view-model:execution-error",this.executionError??"")})}async _getVersionInfosInternal(e){if("disabled"===this.state)throw this._logError("version-management-view-model:load-error",this.loadError),new i("version-management-view-model:load-error",this.loadError??"");this._setExecutionError();const r=this.featureServiceLookup.get(e)?.featureService;if(!r)throw this._logError("version-management-view-model:execution-error","no-feature-service-found"),new i("version-management-view-model:execution-error",this.executionError??"");r.loaded||await r.load().catch(e=>{throw this._logExecutionError(e),e});const o=r.url;this.serverVersionLookup.set(o,r.sourceJSON?.currentVersion??0);const t=this.userLookup.get(e);this._portalLookup.get(e)&&t?this.versionAdministratorLookup.set(o,await m(this._portalLookup.get(e),t,"features:user:manageVersions")):this.versionAdministratorLookup.set(o,!1);const s=this.versioningStateLookup.get(e);if(!s)throw this._logError("version-management-view-model:execution-error","no-versioning-state-found"),new i("version-management-view-model:execution-error",this.executionError??"");s.loaded||await s.load().catch(e=>{throw this._logExecutionError(e),e});return await s.getVersionInfos(!0).catch(e=>{throw this._logExecutionError(e),e})}_isEmptyString(e){return!e||0===e.trim().length}_logError(e,r){switch(s.getLogger(this).error(new i(e,r??"")),e){case"version-management-view-model:load-error":this._setLoadError(r);break;case"version-management-view-model:execution-error":this._setExecutionError(r)}}_logExecutionError(e){this._logError("version-management-view-model:execution-error",e.message)}async _viewChangeHandle(){this._updatingHandlesLoad.addPromise((async()=>{if(this._setLoadError(),!this.view)return void this._setLoadError("no-view-property");if(this.view&&"2d"!==this.view.type)return void this._logError("version-management-view-model:load-error","sceneView-not-supported");this.removeHandles("map-change-handle"),this.addHandles([n(()=>this.view?.map,()=>{this._resetAllLookupProperties(),this._mapChangeHandle(this.versioningStates)})],"map-change-handle");const e=await this._getVersioningStates();await this._mapChangeHandle(e)})())}async _mapChangeHandle(e){this._updatingHandlesLoad.addPromise((async()=>{this._setLoadError(),this.removeHandles("map-layers-tables-change-handle"),this.addHandles([a(()=>this.view?.map.allLayers,"change",e=>{(e.added.some(({type:e})=>"feature"===e)||e.removed.some(({type:e})=>"feature"===e)||e.added.some(({type:e})=>"subtype-group"===e)||e.removed.some(({type:e})=>"subtype-group"===e))&&(this._resetServiceRelatedLookupProperties(),this._propertiesChangeInternal(this.versioningStates),this._updateVersionableItems(e))}),a(()=>this.view?.map.allTables,"change",e=>{(e.added.some(({type:e})=>"feature"===e)||e.removed.some(({type:e})=>"feature"===e)||e.added.some(({type:e})=>"subtype-group"===e)||e.removed.some(({type:e})=>"subtype-group"===e))&&(this._resetServiceRelatedLookupProperties(),this._propertiesChangeInternal(this.versioningStates),this._updateVersionableItems(e))})],"map-layers-tables-change-handle"),await this._propertiesChangeInternal(e)})())}async _propertiesChangeInternal(e){this._updatingHandlesLoad.addPromise((async()=>{const r=e=>"feature"===e.type||"subtype-group"===e.type,{allLayers:o,allTables:t}=this.view.map;if(this._setLoadError(),this.featureServiceLookup=c([...o.filter(r),...t.filter(r)]),this.featureServiceLookup.size){this._updateFeatureServiceLookup(e),this.serviceNameLookup=new Map;for(const e of this.featureServiceLookup.values()){const{featureService:r,featureService:{url:o}}=e;if(!this.serviceNameLookup.has(o)){if(r.loaded||await r.load().catch(e=>{s.getLogger(this).error(e)}),!r.versionManagementServiceUrl){this.featureServiceLookup.delete(o);continue}const e=await p(o),t=new v({authMode:"immediate",url:e});await t.load().catch(e=>{s.getLogger(this).error(e)});const i=t.user?.username;if(!r.loaded||!t.loaded||!i)continue;this.serviceNameLookup.set(d(o),o.split("/").at(-2)),this.userLookup.set(o,i),this._portalLookup.set(o,t)}}e.forEach(e=>this._handleVersioningStateLookupUpdate(e)),await this._updateVersioningStates(e),this.versioningStates=e}else this._logError("version-management-view-model:load-error","no-feature-services")})())}_updateFeatureServiceLookup(e){for(const r of e){const e=r.featureServiceUrl;if(!this.featureServiceLookup.has(e)){const o=new g({url:e}),t=r.versionableItems.toArray().flatMap(e=>"network"===e.type?null:e.versionableItem).filter(e=>!!e);this.featureServiceLookup.set(e,{featureService:o,layers:t})}}}async _updateVersioningStates(e){for(const r of this.featureServiceLookup.values()){const t=r.featureService;if(!t.versionManagementServiceUrl)continue;if(!e.find(e=>e.featureServiceUrl===t.url)&&t.versionManagementServiceUrl){const i=new o(E(r.layers)),s=new f({versionManagementService:new _({url:t.versionManagementServiceUrl}),versionableItems:i});e.add(s),this._handleVersioningStateLookupUpdate(s)}await this.getVersionInfos(t.url)}}async _getVersioningStates(){return this.versioningStates&&this.versioningStates.length?this.versioningStates:this.view?await w(this.view,!1):(this._logError("version-management-view-model:load-error","no-view-property"),new o)}_handleVersioningStateLookupUpdate(e){this.versioningStateLookup.set(e.featureServiceUrl,e)}async _setVersioningStatesLookups(){this._updatingHandlesLoad.addPromise((async()=>{this.versioningStates&&(this._updateFeatureServiceLookup(this.versioningStates),this.versioningStates.forEach(e=>this._handleVersioningStateLookupUpdate(e)),await this._updateVersioningStates(this.versioningStates))})())}_resetVersioningLookupProperties(){this.versioningStateLookup=new Map}_resetAllLookupProperties(){this._portalLookup=new Map,this.serverVersionLookup=new Map,this.userLookup=new Map,this.versioningStates=new o,this._resetVersioningLookupProperties(),this._resetServiceRelatedLookupProperties()}_resetServiceRelatedLookupProperties(){this.featureServiceLookup=new Map,this.serviceNameLookup=new Map}_setExecutionError(e){this._set("executionError",e)}_setLoadError(e){this._set("loadError",e)}};e([l()],L.prototype,"_portalLookup",void 0),e([l({readOnly:!0})],L.prototype,"executionError",void 0),e([l()],L.prototype,"featureServiceLookup",void 0),e([l({readOnly:!0})],L.prototype,"loadError",void 0),e([l()],L.prototype,"serverVersionLookup",void 0),e([l()],L.prototype,"serviceNameLookup",void 0),e([l({readOnly:!0})],L.prototype,"state",null),e([l()],L.prototype,"userLookup",void 0),e([l()],L.prototype,"versionAdministratorLookup",void 0),e([l()],L.prototype,"versioningStateLookup",void 0),e([l()],L.prototype,"view",void 0),e([l()],L.prototype,"versioningStates",void 0),L=e([u("esri.widgets.VersionManagement.VersionManagementViewModel")],L);const S=L;export{S as default};