@arcgis/core 4.27.0-next.20230420 → 4.27.0-next.20230421

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 (152) hide show
  1. package/WebMap.js +1 -1
  2. package/WebScene.js +1 -1
  3. package/assets/esri/core/workers/RemoteClient.js +1 -1
  4. package/assets/esri/core/workers/chunks/{f64f95623d9296a91f95.js → 059ec6fd9b971de4b4c1.js} +1 -1
  5. package/assets/esri/core/workers/chunks/{1fe31a412479815e5e2d.js → 10770939900946feb20d.js} +1 -1
  6. package/assets/esri/core/workers/chunks/{5252f3cc244204edc299.js → 1216e939d363f96b6cc6.js} +1 -1
  7. package/assets/esri/core/workers/chunks/156dad2b7fed6749bae7.js +1 -0
  8. package/assets/esri/core/workers/chunks/15a97d3e42b00ac42984.js +1 -0
  9. package/assets/esri/core/workers/chunks/{d72c0c97cc4e30f1e4f2.js → 18704903814b9d73c708.js} +1 -1
  10. package/assets/esri/core/workers/chunks/{852b4a6c0f3feb57cf54.js → 1db5e4c8244dbc21590c.js} +1 -1
  11. package/assets/esri/core/workers/chunks/{f0953e41d1653e66ba57.js → 2a1a5a1969e80a10dcca.js} +1 -1
  12. package/assets/esri/core/workers/chunks/33b735faa582e6f39e9a.js +1 -0
  13. package/assets/esri/core/workers/chunks/34025ac04ca02531923a.js +1 -0
  14. package/assets/esri/core/workers/chunks/3e9f3479fd8558d9e3e3.js +1 -0
  15. package/assets/esri/core/workers/chunks/{d59274ac695dfcff1143.js → 46090b69e9161bc05141.js} +1 -1
  16. package/assets/esri/core/workers/chunks/{1b647446a6a27798c5cf.js → 47bf38d910e71ac39bb8.js} +1 -1
  17. package/assets/esri/core/workers/chunks/{3978f4f68ada540ee3a3.js → 4f8a09b61267e5e26712.js} +1 -1
  18. package/assets/esri/core/workers/chunks/5183ecab7eddae7b70e8.js +1 -0
  19. package/assets/esri/core/workers/chunks/{a5c33b24b7ee042cb473.js → 51a0d1dabe7415515c77.js} +2 -2
  20. package/assets/esri/core/workers/chunks/541e6efc3b491e507410.js +1 -0
  21. package/assets/esri/core/workers/chunks/5c64fd3bf057a1a5527f.js +1 -0
  22. package/assets/esri/core/workers/chunks/6047bdaf4855506f8fdb.js +1 -0
  23. package/assets/esri/core/workers/chunks/{b2358c2e27be7a5709cf.js → 6adb58f1bffc5d1c03bd.js} +1 -1
  24. package/assets/esri/core/workers/chunks/770940417e6ddbdbb9d6.js +1 -0
  25. package/assets/esri/core/workers/chunks/{1c1d8be85297c483a606.js → 77c98121223a144170e3.js} +1 -1
  26. package/assets/esri/core/workers/chunks/80117007d86be4eb3bc3.js +1 -0
  27. package/assets/esri/core/workers/chunks/838849b751805615833a.js +1 -0
  28. package/assets/esri/core/workers/chunks/{9ca395f7bc8d397b5240.js → 88197520501fcc20b6e8.js} +1 -1
  29. package/assets/esri/core/workers/chunks/{89e8ba4fc325838bf1a9.js → 88f9dededcf60fd011ef.js} +1 -1
  30. package/assets/esri/core/workers/chunks/88fdd288ef799a7ac48a.js +1 -0
  31. package/assets/esri/core/workers/chunks/{f11ec68ceb7c973cde74.js → 8ae7fea9f7fda38dd207.js} +1 -1
  32. package/assets/esri/core/workers/chunks/{0d080dd1ca6a71597409.js → 9265d4e9cfab2c7bbce5.js} +1 -1
  33. package/assets/esri/core/workers/chunks/{8d41305509fedb3603ac.js → 94041a9ced04aa281d40.js} +1 -1
  34. package/assets/esri/core/workers/chunks/98540791fcef86069e44.js +1 -0
  35. package/assets/esri/core/workers/chunks/9c1b2f82877ff79969f5.js +1 -0
  36. package/assets/esri/core/workers/chunks/a7b3cd537c9127b5e65e.js +1 -0
  37. package/assets/esri/core/workers/chunks/{3d1c697182237807ab49.js → abea316f2eac0f3086ab.js} +1 -1
  38. package/assets/esri/core/workers/chunks/ad85ade6a2cfb56cf328.js +1 -0
  39. package/assets/esri/core/workers/chunks/{25862269952c1bda910f.js → b833b4ea2973bb16792e.js} +1 -1
  40. package/assets/esri/core/workers/chunks/{e50d1afdc878258c437e.js → be4aa835a7abfc809126.js} +1 -1
  41. package/assets/esri/core/workers/chunks/{4fed7c08b5f4de23bb75.js → c2ec6e904f96173a7b83.js} +1 -1
  42. package/assets/esri/core/workers/chunks/{c25aa08b869f2777dc26.js → c4488a8d857c765da30e.js} +1 -1
  43. package/assets/esri/core/workers/chunks/c5c56b6d99db96a6755a.js +2 -0
  44. package/assets/esri/core/workers/chunks/{b28883e2a13f360310b3.js → c727d38f71e52bee17e1.js} +1 -1
  45. package/assets/esri/core/workers/chunks/cf315d255f0dc8d50f21.js +1 -0
  46. package/assets/esri/core/workers/chunks/cf7676fdc09ad4835680.js +1 -0
  47. package/assets/esri/core/workers/chunks/cfad34c949cbe8a31ef8.js +1 -0
  48. package/assets/esri/core/workers/chunks/{a2c9cb23f3e35e88da1d.js → d399b1b9cbf0737d1735.js} +1 -1
  49. package/assets/esri/core/workers/chunks/{df7dcd035997881cf2ef.js → d5c8119d6d34628d3126.js} +1 -1
  50. package/assets/esri/core/workers/chunks/d6b6bb8aecc85d2a3f6b.js +1 -0
  51. package/assets/esri/core/workers/chunks/{8dfa32cc8453f85faab0.js → dd1f8bade9c5c3b7929b.js} +1 -1
  52. package/assets/esri/core/workers/chunks/e11e60759821746259c6.js +1 -0
  53. package/assets/esri/core/workers/chunks/{e4b65c5a4575a5c1c49f.js → e356c576f9a7521a49b3.js} +1 -1
  54. package/assets/esri/core/workers/chunks/f02edf71645eb33bf92f.js +1 -0
  55. package/assets/esri/core/workers/chunks/{3dff550c29115dd625fa.js → f1a4165c2710ca90e5ea.js} +1 -1
  56. package/assets/esri/core/workers/chunks/f57a3ee17869ced3dd33.js +1 -0
  57. package/assets/esri/core/workers/chunks/fc07f6e103d7f69a9909.js +1 -0
  58. package/chunks/WaterSurface.glsl.js +35 -20
  59. package/chunks/index.js +1 -1
  60. package/core/Loadable.js +1 -1
  61. package/core/Promise.js +1 -1
  62. package/core/accessorSupport/ensureType.js +1 -1
  63. package/core/accessorSupport/watch.js +1 -1
  64. package/core/accessorSupport/write.js +1 -1
  65. package/core/promiseUtils.js +1 -1
  66. package/core/watchUtils.js +1 -1
  67. package/core/workers/Connection.js +1 -1
  68. package/core/workers/RemoteClient.js +1 -1
  69. package/geometry/support/geodesicUtils.js +1 -1
  70. package/intl/messages.js +1 -1
  71. package/layers/graphics/data/attributeSupport.js +1 -1
  72. package/layers/graphics/sources/FeatureLayerSource.js +1 -1
  73. package/layers/mixins/ArcGISMapService.js +1 -1
  74. package/layers/support/PromiseQueue.js +1 -1
  75. package/layers/support/Sublayer.js +1 -1
  76. package/layers/support/TileKey.js +1 -1
  77. package/layers/support/rasterFormats/TiffDecoder.js +1 -1
  78. package/networks/Network.js +1 -1
  79. package/package.json +1 -1
  80. package/portal/schemas/definitions.js +1 -1
  81. package/request.js +1 -1
  82. package/support/revision.js +1 -1
  83. package/symbols/support/previewSymbol3D.js +1 -1
  84. package/symbols/support/styleUtils.js +1 -1
  85. package/symbols/support/symbolLayerUtils.js +1 -1
  86. package/symbols/support/utils.js +1 -1
  87. package/symbols/support/webStyleSymbolUtils.js +1 -1
  88. package/views/2d/engine/webgl/TextureManager.js +1 -1
  89. package/views/2d/layers/support/webStyleUtils.js +1 -1
  90. package/views/3d/input/SceneInputManager.js +1 -1
  91. package/views/3d/interactive/manipulatorUtils.js +1 -1
  92. package/views/3d/interactive/visualElements/LineVisualElement.js +1 -1
  93. package/views/3d/layers/graphics/ElevationQuery.js +1 -1
  94. package/views/3d/layers/graphics/Graphics3DCore.js +1 -1
  95. package/views/3d/layers/graphics/Graphics3DObjectSymbolLayer.js +1 -1
  96. package/views/3d/layers/graphics/Graphics3DWaterSymbolLayer.js +1 -1
  97. package/views/3d/layers/graphics/polygonUtils.js +1 -1
  98. package/views/3d/layers/graphics/symbolComplexity.js +1 -1
  99. package/views/3d/layers/graphics/webStyleUtils.js +5 -0
  100. package/views/3d/webgl-engine/materials/WaterMaterial.js +1 -1
  101. package/views/3d/webgl-engine/materials/WaterTechnique.js +1 -1
  102. package/views/3d/webgl-engine/shaders/WaterSurface.glsl.js +1 -1
  103. package/views/LayerViewManager.js +1 -1
  104. package/views/PopupView.js +1 -1
  105. package/views/SceneView.js +1 -1
  106. package/views/ViewAnimation.js +1 -1
  107. package/views/input/BrowserEventSource.js +1 -1
  108. package/views/input/InputManager.js +1 -1
  109. package/views/interactive/coordinateHelper.js +1 -1
  110. package/views/interactive/snapping/featureSources/featureServiceSource/FeatureServiceSnappingSourceWorker.js +1 -1
  111. package/views/support/QueueProcessor.js +1 -1
  112. package/views/ui/DefaultUI.js +1 -1
  113. package/views/ui/UI.js +1 -1
  114. package/widgets/BasemapGallery/support/PortalBasemapsSource.js +1 -1
  115. package/widgets/Editor/CreateFeaturesWorkflow.js +1 -1
  116. package/widgets/Editor/Upload.js +1 -1
  117. package/widgets/Editor/deprecationUtils.js +1 -1
  118. package/widgets/Editor/modelUploadUtils.js +1 -1
  119. package/widgets/Editor.js +1 -1
  120. package/widgets/Feature/FeatureExpression/FeatureExpressionViewModel.js +1 -1
  121. package/widgets/Feature/FeatureRelationship/FeatureRelationshipViewModel.js +1 -1
  122. package/widgets/Feature/FeatureViewModel.js +1 -1
  123. package/widgets/FeatureTable/Grid/Grid.js +1 -1
  124. package/widgets/Popup.js +1 -1
  125. package/assets/esri/core/workers/chunks/0cec1c16b25406858ae6.js +0 -1
  126. package/assets/esri/core/workers/chunks/27353056c3e4e8d8b8d3.js +0 -1
  127. package/assets/esri/core/workers/chunks/337d59d624ef8a89aae5.js +0 -1
  128. package/assets/esri/core/workers/chunks/4b6a903d4aeeb4eeb615.js +0 -1
  129. package/assets/esri/core/workers/chunks/4bf9bc8b52d618f395c5.js +0 -1
  130. package/assets/esri/core/workers/chunks/5ec4fedbbcbb0053cf74.js +0 -2
  131. package/assets/esri/core/workers/chunks/60e29d172a2dcf45e8d0.js +0 -1
  132. package/assets/esri/core/workers/chunks/68a15cc7c51645d31572.js +0 -1
  133. package/assets/esri/core/workers/chunks/778ecf61f07dafc51bbc.js +0 -1
  134. package/assets/esri/core/workers/chunks/7e67e071789c6d264280.js +0 -1
  135. package/assets/esri/core/workers/chunks/80d335bec34d60b7bbdc.js +0 -1
  136. package/assets/esri/core/workers/chunks/810da30f13151b72a293.js +0 -1
  137. package/assets/esri/core/workers/chunks/81485a5056aed94b3d8d.js +0 -1
  138. package/assets/esri/core/workers/chunks/8ebda132068f6b962dd9.js +0 -1
  139. package/assets/esri/core/workers/chunks/914a0c78c80aa897b1a1.js +0 -1
  140. package/assets/esri/core/workers/chunks/979ea2e3b1b164334634.js +0 -1
  141. package/assets/esri/core/workers/chunks/a0e92dd27c8f6b642dbf.js +0 -1
  142. package/assets/esri/core/workers/chunks/a6240bf258b3886a6661.js +0 -1
  143. package/assets/esri/core/workers/chunks/b1a8024bf8cdd0cd3884.js +0 -1
  144. package/assets/esri/core/workers/chunks/b366e0db9b5f27dd53a3.js +0 -1
  145. package/assets/esri/core/workers/chunks/c564055cb906857c8641.js +0 -1
  146. package/assets/esri/core/workers/chunks/c646dc9da08b509e39d6.js +0 -1
  147. package/assets/esri/core/workers/chunks/db5598944b691e43f13e.js +0 -1
  148. package/assets/esri/core/workers/chunks/eb163a2ddeb27c690308.js +0 -1
  149. package/assets/esri/core/workers/chunks/f05634909c9449533193.js +0 -1
  150. package/assets/esri/core/workers/chunks/fcebd70b089dea833c75.js +0 -1
  151. /package/assets/esri/core/workers/chunks/{a5c33b24b7ee042cb473.js.LICENSE.txt → 51a0d1dabe7415515c77.js.LICENSE.txt} +0 -0
  152. /package/assets/esri/core/workers/chunks/{5ec4fedbbcbb0053cf74.js.LICENSE.txt → c5c56b6d99db96a6755a.js.LICENSE.txt} +0 -0
@@ -2,4 +2,4 @@
2
2
  All material copyright ESRI, All Rights Reserved, unless otherwise specified.
3
3
  See https://js.arcgis.com/4.27/esri/copyright.txt for details.
4
4
  */
5
- import{_ as e}from"../chunks/tslib.es6.js";import r from"../core/Accessor.js";import i from"../core/Error.js";import t from"../core/Logger.js";import{someMap as s}from"../core/MapUtils.js";import{removeMaybe as a}from"../core/maybe.js";import{createDeferred as o,createAbortError as l,isAbortError as n,onAbort as y,throwIfAborted as h}from"../core/promiseUtils.js";import{on as c,watch as w,syncAndInitial as p}from"../core/reactiveUtils.js";import{schedule as d}from"../core/scheduling.js";import{property as m}from"../core/accessorSupport/decorators/property.js";import"../core/accessorSupport/ensureType.js";import"../core/arrayUtils.js";import"../core/has.js";import{subclass as f}from"../core/accessorSupport/decorators/subclass.js";import{WatchUpdatingTracking as u}from"../core/support/WatchUpdatingTracking.js";import{destroyMap as _}from"../support/collectionUtils.js";function g(e){return"tryRecycleWith"in e}class v{constructor(e,r,t){this.layer=e,this.view=r,this.layerViewImporter=t,this._controller=new AbortController,this._deferred=o(),this._started=!1,this.done=!1,this.promise=this._deferred.promise,y(this._controller.signal,(()=>{const r=new i("cancelled:layerview-create","layerview creation cancelled",{layer:e});this._deferred.reject(r)}))}tryRecycle(e){if(!this.done||!this.layerView||!g(this.layerView))return null;const r=this.layer.type,i=this._controller.signal;for(let t=0;t<e.length;t++){const s=e[t];if(s.type!==r)continue;const a=this.layerView.tryRecycleWith(s,{signal:i});if(a){e.splice(t,1),this.layer=s;const r=this.layerView,i=r.view;return this.promise=Promise.race([a.then((()=>(h(this._controller.signal),s.emit("layerview-destroy",{view:i,layerView:r}),i.emit("layerview-destroy",{view:i,layerView:r}),s.emit("layerview-create",{view:i,layerView:r}),i.emit("layerview-create",{view:i,layerView:r}),r))),new Promise(((e,r)=>y(this._controller.signal,(()=>r(l())))))]),this.promise}}return null}destroy(){this._controller.abort();const{layerView:e}=this;if(e){const{layer:r,view:i}=this;r.emit("layerview-destroy",{view:i,layerView:e}),i.emit("layerview-destroy",{layer:r,layerView:e})}this.done=!0,this.layer=null,this.layerView=null,this.view=null,this.layerViewImporter=null,this._map=null}async start(){if(this._started)return;this._started=!0;const{_controller:{signal:e},layer:r,view:t}=this;this._map=t.map;try{let o,l;if(await r.load({signal:e}),"prefetchResources"in r&&await(r.prefetchResources?.({signal:e})),M(r))o=await r.createLayerView(t,{signal:e});else{if(!this.layerViewImporter.hasLayerViewModule(r))throw new i("layer:view-not-supported","No layerview implementation was found");const s=await this.layerViewImporter.importLayerView(r);h(e),o="default"in s?new s.default({layer:r,view:t}):new s({layer:r,view:t})}const n=()=>{l=a(l),o.destroyed||o.destroy(),o.layer=null,o.parent=null,o.view=null,this.done=!0};l=y(e,n),h(e);try{await o.when()}catch(s){throw n(),s}const c=this._map?.allLayers?.includes(r);if(!c)return n(),void this._deferred.reject(new i("view:no-layerview-for-layer","The layer has been removed from the map",{layer:r}));this.layerView=o,r.emit("layerview-create",{view:t,layerView:o}),t.emit("layerview-create",{layer:r,layerView:o}),this.done=!0,this._deferred.resolve(o)}catch(s){r.emit("layerview-create-error",{view:t,error:s}),t.emit("layerview-create-error",{layer:r,error:s}),this.done=!0,this._deferred.reject(new i("layerview:create-error","layerview creation failed",{layer:r,error:s}))}}}let V=class extends r{constructor(e){super(e),this._layerLayerViewInfoMap=new Map,this._recyclingInfoMap=new Map,this._watchUpdatingTracking=new u,this.supportsGround=!0,this._preloadLayerViewModules=()=>{const e=this.view.map?.allLayers;if(e)for(const r of e)this.layerViewImporter.hasLayerViewModule(r)&&this.layerViewImporter.importLayerView(r)},this._reschedule=()=>this.destroyed?Promise.reject():(null==this._workPromise&&(this._workPromise=o(),this._workPromise.promise.catch((()=>{}))),this.removeHandles("reschedule"),this.addHandles(d(this._doWork),"reschedule"),this._workPromise.promise),this._doWork=()=>{if(this.destroyed)return;const e=this.view.map;if(this._map!==e&&(this.clear(),this._map=e),null==this._workPromise)return void this.notifyChange("updating");this.removeHandles("reschedule"),this.removeHandles("collection-change");const r=new Set,i=[],t=this.view.ready,s=e=>{if(null!=e)for(const a of e)if(a){r.add(a);const e=this._layerLayerViewInfoMap.get(a);e&&t?e.start():e||this._recyclingInfoMap.has(a)||i.push(a),"layers"in a&&a.layers&&s(a.layers)}};for(const o of this._rootCollectionNames)s(this.get(o));for(const[o,l]of this._layerLayerViewInfoMap)if(!r.has(o)){this._layerLayerViewInfoMap.delete(l.layer);const e=l.tryRecycle(i);e?(this._recyclingInfoMap.set(l.layer,l),e.then((()=>{this._recyclingInfoMap.delete(l.layer),this._layerLayerViewInfoMap.set(l.layer,l),this._reschedule()})).catch((()=>{this._recyclingInfoMap.delete(l.layer),l.destroy(),this._reschedule()}))):l.destroy()}for(const[o,l]of this._recyclingInfoMap)r.has(o)||(this._recyclingInfoMap.delete(l.layer),l.destroy());for(const o of i)this._createLayerView(o);this._refreshCollections();const a=[e?.ground?.layers,e?.basemap?.baseLayers,e?.basemap?.referenceLayers,e?.layers].filter((e=>!!e));r.forEach((e=>"layers"in e&&a.push(e.layers))),this.addHandles(a.map((e=>this._watchUpdatingTracking.addOnCollectionChange((()=>e),this._reschedule))),"collection-change"),this._workPromise.resolve(),this._workPromise=null}}initialize(){this.own([c((()=>this.view?.map?.allLayers),"change",this._preloadLayerViewModules,{onListenerAdd:this._preloadLayerViewModules}),w((()=>{const e=this.view,r=e?.map;return[r?.basemap,r?.ground,r?.layers,e?.ready]}),(()=>this._reschedule()),p)]),this._preloadLayerViewModules(),this._reschedule()}destroy(){this.clear(),_(this._recyclingInfoMap),_(this._layerLayerViewInfoMap),this._watchUpdatingTracking.destroy(),this._map=null,null!=this._workPromise&&(this._workPromise.reject(l()),this._workPromise=null)}get _layersToLayerViews(){const e=[["view.map.basemap.baseLayers","view.basemapView.baseLayerViews"],["view.map.layers","view.layerViews"],["view.map.basemap.referenceLayers","view.basemapView.referenceLayerViews"]];return this.supportsGround&&e.push(["view.map.ground.layers","view.groundView.layerViews"]),new Map(e)}get _rootCollectionNames(){return Array.from(this._layersToLayerViews.keys())}get updating(){return null!=this._workPromise||this._watchUpdatingTracking.updating||s(this._layerLayerViewInfoMap,(e=>!e.done))}get updatingRemaining(){let e=0;for(const r of this._layerLayerViewInfoMap.values())r.done||++e;return e}clear(){this.destroyed||(_(this._layerLayerViewInfoMap),this._refreshCollections())}async whenLayerView(e){if(await this._reschedule(),!this._layerLayerViewInfoMap.has(e)){if(this._recyclingInfoMap.has(e))return this._recyclingInfoMap.get(e).promise;throw new i("view:no-layerview-for-layer","No layerview has been found for the layer",{layer:e})}return this._layerLayerViewInfoMap.get(e).promise}_refreshCollections(){for(const[e,r]of this._layersToLayerViews)this._populateLayerViewsOwners(this.get(e),this.get(r),this.view);this.notifyChange("updating"),this.notifyChange("updatingRemaining")}_populateLayerViewsOwners(e,r,i){if(!e||!r)return void(r&&r.removeAll());let t=0;for(const s of e){const e=this._layerLayerViewInfoMap.get(s);if(!e||!e.layerView)continue;const a=e.layerView;a.layer=s,a.parent=i,r.getItemAt(t)!==a&&r.splice(t,0,a),s.layers&&this._populateLayerViewsOwners(s.layers,a.layerViews,a),t+=1}t<r.length&&r.splice(t,r.length)}_createLayerView(e){e.load().catch((()=>{})),this.layerViewImporter.hasLayerViewModule(e)&&this.layerViewImporter.importLayerView(e);const r=new v(e,this.view,this.layerViewImporter);r.promise.then((()=>this._refreshCollections()),(r=>{r&&(n(r)||"cancelled:layerview-create"===r.name)||t.getLogger(this.declaredClass).error(`Failed to create layerview for layer title:'${e.title??"no title"}', id:'${e.id??"no id"}' of type '${e.type}'.`,{layer:e,error:r}),this._refreshCollections()})),this._layerLayerViewInfoMap.set(e,r),this.view.ready&&r.start(),this.notifyChange("updating"),this.notifyChange("updatingRemaining")}};e([m()],V.prototype,"_workPromise",void 0),e([m({readOnly:!0})],V.prototype,"_watchUpdatingTracking",void 0),e([m({readOnly:!0})],V.prototype,"_layersToLayerViews",null),e([m({readOnly:!0})],V.prototype,"_rootCollectionNames",null),e([m()],V.prototype,"layerViewImporter",void 0),e([m()],V.prototype,"supportsGround",void 0),e([m({readOnly:!0})],V.prototype,"updating",null),e([m({readOnly:!0})],V.prototype,"updatingRemaining",null),e([m({constructOnly:!0})],V.prototype,"view",void 0),V=e([f("esri.views.LayerViewManager")],V);const L=V;function M(e){return"createLayerView"in e&&null!=e.createLayerView}export{L as default};
5
+ import{_ as e}from"../chunks/tslib.es6.js";import r from"../core/Accessor.js";import i from"../core/Error.js";import t from"../core/Logger.js";import{someMap as s}from"../core/MapUtils.js";import{removeMaybe as a}from"../core/maybe.js";import{createResolver as o,createAbortError as l,isAbortError as n,onAbort as y,throwIfAborted as h}from"../core/promiseUtils.js";import{on as c,watch as w,syncAndInitial as p}from"../core/reactiveUtils.js";import{schedule as d}from"../core/scheduling.js";import{property as m}from"../core/accessorSupport/decorators/property.js";import"../core/accessorSupport/ensureType.js";import"../core/arrayUtils.js";import"../core/has.js";import{subclass as f}from"../core/accessorSupport/decorators/subclass.js";import{WatchUpdatingTracking as u}from"../core/support/WatchUpdatingTracking.js";import{destroyMap as _}from"../support/collectionUtils.js";function g(e){return"tryRecycleWith"in e}class v{constructor(e,r,t){this.layer=e,this.view=r,this.layerViewImporter=t,this._controller=new AbortController,this._deferred=o(),this._started=!1,this.done=!1,this.promise=this._deferred.promise,y(this._controller.signal,(()=>{const r=new i("cancelled:layerview-create","layerview creation cancelled",{layer:e});this._deferred.reject(r)}))}tryRecycle(e){if(!this.done||!this.layerView||!g(this.layerView))return null;const r=this.layer.type,i=this._controller.signal;for(let t=0;t<e.length;t++){const s=e[t];if(s.type!==r)continue;const a=this.layerView.tryRecycleWith(s,{signal:i});if(a){e.splice(t,1),this.layer=s;const r=this.layerView,i=r.view;return this.promise=Promise.race([a.then((()=>(h(this._controller.signal),s.emit("layerview-destroy",{view:i,layerView:r}),i.emit("layerview-destroy",{view:i,layerView:r}),s.emit("layerview-create",{view:i,layerView:r}),i.emit("layerview-create",{view:i,layerView:r}),r))),new Promise(((e,r)=>y(this._controller.signal,(()=>r(l())))))]),this.promise}}return null}destroy(){this._controller.abort();const{layerView:e}=this;if(e){const{layer:r,view:i}=this;r.emit("layerview-destroy",{view:i,layerView:e}),i.emit("layerview-destroy",{layer:r,layerView:e})}this.done=!0,this.layer=null,this.layerView=null,this.view=null,this.layerViewImporter=null,this._map=null}async start(){if(this._started)return;this._started=!0;const{_controller:{signal:e},layer:r,view:t}=this;this._map=t.map;try{let o,l;if(await r.load({signal:e}),"prefetchResources"in r&&await(r.prefetchResources?.({signal:e})),M(r))o=await r.createLayerView(t,{signal:e});else{if(!this.layerViewImporter.hasLayerViewModule(r))throw new i("layer:view-not-supported","No layerview implementation was found");const s=await this.layerViewImporter.importLayerView(r);h(e),o="default"in s?new s.default({layer:r,view:t}):new s({layer:r,view:t})}const n=()=>{l=a(l),o.destroyed||o.destroy(),o.layer=null,o.parent=null,o.view=null,this.done=!0};l=y(e,n),h(e);try{await o.when()}catch(s){throw n(),s}const c=this._map?.allLayers?.includes(r);if(!c)return n(),void this._deferred.reject(new i("view:no-layerview-for-layer","The layer has been removed from the map",{layer:r}));this.layerView=o,r.emit("layerview-create",{view:t,layerView:o}),t.emit("layerview-create",{layer:r,layerView:o}),this.done=!0,this._deferred.resolve(o)}catch(s){r.emit("layerview-create-error",{view:t,error:s}),t.emit("layerview-create-error",{layer:r,error:s}),this.done=!0,this._deferred.reject(new i("layerview:create-error","layerview creation failed",{layer:r,error:s}))}}}let V=class extends r{constructor(e){super(e),this._layerLayerViewInfoMap=new Map,this._recyclingInfoMap=new Map,this._watchUpdatingTracking=new u,this.supportsGround=!0,this._preloadLayerViewModules=()=>{const e=this.view.map?.allLayers;if(e)for(const r of e)this.layerViewImporter.hasLayerViewModule(r)&&this.layerViewImporter.importLayerView(r)},this._reschedule=()=>this.destroyed?Promise.reject():(null==this._workPromise&&(this._workPromise=o(),this._workPromise.promise.catch((()=>{}))),this.removeHandles("reschedule"),this.addHandles(d(this._doWork),"reschedule"),this._workPromise.promise),this._doWork=()=>{if(this.destroyed)return;const e=this.view.map;if(this._map!==e&&(this.clear(),this._map=e),null==this._workPromise)return void this.notifyChange("updating");this.removeHandles("reschedule"),this.removeHandles("collection-change");const r=new Set,i=[],t=this.view.ready,s=e=>{if(null!=e)for(const a of e)if(a){r.add(a);const e=this._layerLayerViewInfoMap.get(a);e&&t?e.start():e||this._recyclingInfoMap.has(a)||i.push(a),"layers"in a&&a.layers&&s(a.layers)}};for(const o of this._rootCollectionNames)s(this.get(o));for(const[o,l]of this._layerLayerViewInfoMap)if(!r.has(o)){this._layerLayerViewInfoMap.delete(l.layer);const e=l.tryRecycle(i);e?(this._recyclingInfoMap.set(l.layer,l),e.then((()=>{this._recyclingInfoMap.delete(l.layer),this._layerLayerViewInfoMap.set(l.layer,l),this._reschedule()})).catch((()=>{this._recyclingInfoMap.delete(l.layer),l.destroy(),this._reschedule()}))):l.destroy()}for(const[o,l]of this._recyclingInfoMap)r.has(o)||(this._recyclingInfoMap.delete(l.layer),l.destroy());for(const o of i)this._createLayerView(o);this._refreshCollections();const a=[e?.ground?.layers,e?.basemap?.baseLayers,e?.basemap?.referenceLayers,e?.layers].filter((e=>!!e));r.forEach((e=>"layers"in e&&a.push(e.layers))),this.addHandles(a.map((e=>this._watchUpdatingTracking.addOnCollectionChange((()=>e),this._reschedule))),"collection-change"),this._workPromise.resolve(),this._workPromise=null}}initialize(){this.own([c((()=>this.view?.map?.allLayers),"change",this._preloadLayerViewModules,{onListenerAdd:this._preloadLayerViewModules}),w((()=>{const e=this.view,r=e?.map;return[r?.basemap,r?.ground,r?.layers,e?.ready]}),(()=>this._reschedule()),p)]),this._preloadLayerViewModules(),this._reschedule()}destroy(){this.clear(),_(this._recyclingInfoMap),_(this._layerLayerViewInfoMap),this._watchUpdatingTracking.destroy(),this._map=null,null!=this._workPromise&&(this._workPromise.reject(l()),this._workPromise=null)}get _layersToLayerViews(){const e=[["view.map.basemap.baseLayers","view.basemapView.baseLayerViews"],["view.map.layers","view.layerViews"],["view.map.basemap.referenceLayers","view.basemapView.referenceLayerViews"]];return this.supportsGround&&e.push(["view.map.ground.layers","view.groundView.layerViews"]),new Map(e)}get _rootCollectionNames(){return Array.from(this._layersToLayerViews.keys())}get updating(){return null!=this._workPromise||this._watchUpdatingTracking.updating||s(this._layerLayerViewInfoMap,(e=>!e.done))}get updatingRemaining(){let e=0;for(const r of this._layerLayerViewInfoMap.values())r.done||++e;return e}clear(){this.destroyed||(_(this._layerLayerViewInfoMap),this._refreshCollections())}async whenLayerView(e){if(await this._reschedule(),!this._layerLayerViewInfoMap.has(e)){if(this._recyclingInfoMap.has(e))return this._recyclingInfoMap.get(e).promise;throw new i("view:no-layerview-for-layer","No layerview has been found for the layer",{layer:e})}return this._layerLayerViewInfoMap.get(e).promise}_refreshCollections(){for(const[e,r]of this._layersToLayerViews)this._populateLayerViewsOwners(this.get(e),this.get(r),this.view);this.notifyChange("updating"),this.notifyChange("updatingRemaining")}_populateLayerViewsOwners(e,r,i){if(!e||!r)return void(r&&r.removeAll());let t=0;for(const s of e){const e=this._layerLayerViewInfoMap.get(s);if(!e||!e.layerView)continue;const a=e.layerView;a.layer=s,a.parent=i,r.getItemAt(t)!==a&&r.splice(t,0,a),s.layers&&this._populateLayerViewsOwners(s.layers,a.layerViews,a),t+=1}t<r.length&&r.splice(t,r.length)}_createLayerView(e){e.load().catch((()=>{})),this.layerViewImporter.hasLayerViewModule(e)&&this.layerViewImporter.importLayerView(e);const r=new v(e,this.view,this.layerViewImporter);r.promise.then((()=>this._refreshCollections()),(r=>{r&&(n(r)||"cancelled:layerview-create"===r.name)||t.getLogger(this.declaredClass).error(`Failed to create layerview for layer title:'${e.title??"no title"}', id:'${e.id??"no id"}' of type '${e.type}'.`,{layer:e,error:r}),this._refreshCollections()})),this._layerLayerViewInfoMap.set(e,r),this.view.ready&&r.start(),this.notifyChange("updating"),this.notifyChange("updatingRemaining")}};e([m()],V.prototype,"_workPromise",void 0),e([m({readOnly:!0})],V.prototype,"_watchUpdatingTracking",void 0),e([m({readOnly:!0})],V.prototype,"_layersToLayerViews",null),e([m({readOnly:!0})],V.prototype,"_rootCollectionNames",null),e([m()],V.prototype,"layerViewImporter",void 0),e([m()],V.prototype,"supportsGround",void 0),e([m({readOnly:!0})],V.prototype,"updating",null),e([m({readOnly:!0})],V.prototype,"updatingRemaining",null),e([m({constructOnly:!0})],V.prototype,"view",void 0),V=e([f("esri.views.LayerViewManager")],V);const L=V;function M(e){return"createLayerView"in e&&null!=e.createLayerView}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/4.27/esri/copyright.txt for details.
4
4
  */
5
- import{_ as e}from"../chunks/tslib.es6.js";import{createTask as p}from"../core/asyncUtils.js";import{deprecated as t}from"../core/deprecate.js";import s from"../core/Error.js";import i from"../core/Logger.js";import{eachAlwaysValues as o,throwIfAborted as r}from"../core/promiseUtils.js";import{watch as a,initial as u,whenOnce as n}from"../core/reactiveUtils.js";import{property as l}from"../core/accessorSupport/decorators/property.js";import"../core/accessorSupport/ensureType.js";import"../core/arrayUtils.js";import"../core/has.js";import{subclass as c}from"../core/accessorSupport/decorators/subclass.js";import{ViewEventPriorities as h}from"./input/InputManager.js";function d(e){return null!=e&&"open"in e&&"declaredClass"in e}const y=y=>{let w=class extends y{constructor(){super(...arguments),this._popupSetupTask=null,this.popup={},this.popupEnabled=!0}initialize(){this.addHandles([a((()=>[this.ui,this.popup]),(([e,p],t)=>{const s="popup",i="manual";if(t){const[e,p]=t;e&&d(p)&&(p.view=null,e.remove(p,s))}e&&d(p)&&(p.view=this,e.add(p,{key:s,position:i}))}),u),this.on("click",(e=>{this.popup&&this.popupEnabled&&("mouse"!==e.pointerType||0===e.button)&&(d(this.popup)||!1!==this.popup?.autoOpenEnabled)&&(d(this.popup)?this.popup.viewModel.handleViewClick(e):e.async((()=>this.setupPopup())).then((()=>{d(this.popup)&&!this.destroyed&&this.ready&&this.popupEnabled&&this.popup.viewModel.handleViewClick(e)}),(()=>{})))}),h.WIDGET)]),n((()=>this.ready&&this.popupEnabled&&!this.updating)).then((()=>{import("../widgets/Popup.js")}))}destroy(){this.destroyed||this.closePopup()}async openPopup(e){d(this.popup)&&this.popup.open(e);try{if(await this.setupPopup(),!this.popup)return void i.getLogger(this.declaredClass).error(new s("view:null-popup","Popup is null and can't be opened"));this.popup.open(e)}catch{}}closePopup(){this._popupSetupTask?.abort(),d(this.popup)&&this.popup.close()}async fetchPopupFeatures(e,p){await this.when();const{location:t,queryArea:s,layerViewsAndGraphics:i,clientOnlyGraphics:r}=await this._prepareFetchPopupFeatures(e,p),a=Promise.resolve(r),u=this._queryLayerPopupFeatures(s,i,p),n=u.map((e=>e.promise));return{location:t,clientOnlyGraphics:r,allGraphicsPromise:o([a,...n]).then((e=>Array.from(new Set(e.flat())))),promisesPerLayerView:u}}async setupPopup(){if(this._popupSetupTask?.abort(),this.popup&&!d(this.popup))return this._popupSetupTask=p((async e=>{const{default:p}=await import("../widgets/Popup.js");if(r(e),!this.popup||d(this.popup))return;const t=this.popup;delete t.open,delete t.close,this.popup=new p(t)})),this._popupSetupTask.promise}_queryLayerPopupFeatures(e,p,t){return p.map((({layerView:p,graphics:s})=>{const i={clientGraphics:s,event:null!=t?t.event:void 0,signal:null!=t?t.signal:void 0,defaultPopupTemplateEnabled:null!=t&&!!t.defaultPopupTemplateEnabled},o=p.fetchPopupFeatures(e,i);return{layerView:p,promise:o}}))}_isValidPopupGraphic(e,p){return e&&!!e.getEffectivePopupTemplate(null!=p&&p.defaultPopupTemplateEnabled)}async _prepareFetchPopupFeatures(e,p){const{clientGraphics:t,queryArea:s,location:i}=await this._popupHitTestGraphics(e,p),o=this._getFetchPopupLayerViews(),{layerViewsAndGraphics:r,clientOnlyGraphics:a}=this._graphicsPerFetchPopupLayerView(t,o);return{clientOnlyGraphics:a,layerViewsAndGraphics:r,queryArea:s,location:i}}async _popupHitTestGraphics(e,p){const t=await this.popupHitTest(e),s=t.results,i=t.mapPoint,o=s.filter((e=>"graphic"===e.type&&this._isValidPopupGraphic(e.graphic,p))),r=o.length?o[0].mapPoint:null;return{clientGraphics:o.map((e=>e.graphic)),queryArea:i,location:i||r}}_getFetchPopupLayerViews(){const e=[];return this.allLayerViews.forEach((p=>{this._isValidPopupLayerView(p)&&e.push(p)})),null!=this.graphicsView&&this._isValidPopupLayerView(this.graphicsView)&&e.push(this.graphicsView),e.reverse()}_isValidPopupLayerView(e){return null!=e&&(!("layer"in e)||!e.suspended)&&"fetchPopupFeatures"in e}_graphicsPerFetchPopupLayerView(e,p){const t=[],s=new Map,i=p.map((e=>{const p=[];return"layer"in e?s.set(e.layer,p):s.set(e.graphics,p),{layerView:e,graphics:p}}));for(const o of e){const e=s.get(o.layer)||s.get(o.sourceLayer)||null;e?e.push(o):t.push(o)}return{layerViewsAndGraphics:i,clientOnlyGraphics:t}}};return e([l({cast(e){return!e||d(e)||"object"==typeof e&&(e.open=e=>(t(i.getLogger(this.declaredClass),"view.popup is no longer created by default. view.popup.open() will stop working when the popup isn't created",{replacement:"Use view.openPopup() instead.",version:"4.27"}),this.openPopup(e)),e.close=()=>(t(i.getLogger(this.declaredClass),"view.popup is no longer created by default. view.popup.close() will stop working when the popup isn't created",{replacement:"Use view.closePopup() instead.",version:"4.27"}),this.closePopup())),e}})],w.prototype,"popup",void 0),e([l()],w.prototype,"popupEnabled",void 0),w=e([c("esri.views.PopupView")],w),w};export{y as PopupView};
5
+ import{_ as e}from"../chunks/tslib.es6.js";import{createTask as p}from"../core/asyncUtils.js";import{deprecated as t}from"../core/deprecate.js";import s from"../core/Error.js";import i from"../core/Logger.js";import{eachAlwaysValues as o,throwIfAborted as r}from"../core/promiseUtils.js";import{watch as a,initial as u,whenOnce as n}from"../core/reactiveUtils.js";import{property as l}from"../core/accessorSupport/decorators/property.js";import"../core/accessorSupport/ensureType.js";import"../core/arrayUtils.js";import"../core/has.js";import{subclass as c}from"../core/accessorSupport/decorators/subclass.js";import{ViewEventPriorities as h}from"./input/InputManager.js";function d(e){return null!=e&&"open"in e&&"declaredClass"in e}const y=y=>{let w=class extends y{constructor(){super(...arguments),this._popupSetupTask=null,this.popup={},this.popupEnabled=!0}initialize(){this.addHandles([a((()=>[this.ui,this.popup]),(([e,p],t)=>{const s="popup",i="manual";if(t){const[e,p]=t;e&&d(p)&&(p.view=null,e.remove(p,s))}e&&d(p)&&(p.view=this,e.add(p,{key:s,position:i}))}),u),this.on("click",(e=>{this.popup&&this.popupEnabled&&("mouse"!==e.pointerType||0===e.button)&&(d(this.popup)||!1!==this.popup?.autoOpenEnabled)&&(d(this.popup)?this.popup.viewModel.handleViewClick(e):e.async((async()=>{await this.setupPopup(),d(this.popup)&&!this.destroyed&&this.ready&&this.popupEnabled&&this.popup.viewModel.handleViewClick(e)})))}),h.WIDGET)]),n((()=>this.ready&&this.popupEnabled&&!this.updating)).then((()=>{import("../widgets/Popup.js")}))}destroy(){this.destroyed||this.closePopup()}async openPopup(e){d(this.popup)&&this.popup.open(e);try{if(await this.setupPopup(),!this.popup)return void i.getLogger(this.declaredClass).error(new s("view:null-popup","Popup is null and can't be opened"));this.popup.open(e)}catch{}}closePopup(){this._popupSetupTask?.abort(),d(this.popup)&&this.popup.close()}async fetchPopupFeatures(e,p){await this.when();const{location:t,queryArea:s,layerViewsAndGraphics:i,clientOnlyGraphics:r}=await this._prepareFetchPopupFeatures(e,p),a=Promise.resolve(r),u=this._queryLayerPopupFeatures(s,i,p),n=u.map((e=>e.promise));return{location:t,clientOnlyGraphics:r,allGraphicsPromise:o([a,...n]).then((e=>Array.from(new Set(e.flat())))),promisesPerLayerView:u}}async setupPopup(){if(this._popupSetupTask?.abort(),this.popup&&!d(this.popup))return this._popupSetupTask=p((async e=>{const{default:p}=await import("../widgets/Popup.js");if(r(e),!this.popup||d(this.popup))return;const t=this.popup;delete t.open,delete t.close,this.popup=new p(t)})),this._popupSetupTask.promise}_queryLayerPopupFeatures(e,p,t){return p.map((({layerView:p,graphics:s})=>{const i={clientGraphics:s,event:null!=t?t.event:void 0,signal:null!=t?t.signal:void 0,defaultPopupTemplateEnabled:null!=t&&!!t.defaultPopupTemplateEnabled},o=p.fetchPopupFeatures(e,i);return{layerView:p,promise:o}}))}_isValidPopupGraphic(e,p){return e&&!!e.getEffectivePopupTemplate(null!=p&&p.defaultPopupTemplateEnabled)}async _prepareFetchPopupFeatures(e,p){const{clientGraphics:t,queryArea:s,location:i}=await this._popupHitTestGraphics(e,p),o=this._getFetchPopupLayerViews(),{layerViewsAndGraphics:r,clientOnlyGraphics:a}=this._graphicsPerFetchPopupLayerView(t,o);return{clientOnlyGraphics:a,layerViewsAndGraphics:r,queryArea:s,location:i}}async _popupHitTestGraphics(e,p){const t=await this.popupHitTest(e),s=t.results,i=t.mapPoint,o=s.filter((e=>"graphic"===e.type&&this._isValidPopupGraphic(e.graphic,p))),r=o.length?o[0].mapPoint:null;return{clientGraphics:o.map((e=>e.graphic)),queryArea:i,location:i||r}}_getFetchPopupLayerViews(){const e=[];return this.allLayerViews.forEach((p=>{this._isValidPopupLayerView(p)&&e.push(p)})),null!=this.graphicsView&&this._isValidPopupLayerView(this.graphicsView)&&e.push(this.graphicsView),e.reverse()}_isValidPopupLayerView(e){return null!=e&&(!("layer"in e)||!e.suspended)&&"fetchPopupFeatures"in e}_graphicsPerFetchPopupLayerView(e,p){const t=[],s=new Map,i=p.map((e=>{const p=[];return"layer"in e?s.set(e.layer,p):s.set(e.graphics,p),{layerView:e,graphics:p}}));for(const o of e){const e=s.get(o.layer)||s.get(o.sourceLayer)||null;e?e.push(o):t.push(o)}return{layerViewsAndGraphics:i,clientOnlyGraphics:t}}};return e([l({cast(e){return!e||d(e)||"object"==typeof e&&(e.open=e=>(t(i.getLogger(this.declaredClass),"view.popup is no longer created by default. view.popup.open() will stop working when the popup isn't created",{replacement:"Use view.openPopup() instead.",version:"4.27"}),this.openPopup(e)),e.close=()=>(t(i.getLogger(this.declaredClass),"view.popup is no longer created by default. view.popup.close() will stop working when the popup isn't created",{replacement:"Use view.closePopup() instead.",version:"4.27"}),this.closePopup())),e}})],w.prototype,"popup",void 0),e([l()],w.prototype,"popupEnabled",void 0),w=e([c("esri.views.PopupView")],w),w};export{y as PopupView};
@@ -2,4 +2,4 @@
2
2
  All material copyright ESRI, All Rights Reserved, unless otherwise specified.
3
3
  See https://js.arcgis.com/4.27/esri/copyright.txt for details.
4
4
  */
5
- import{_ as e}from"../chunks/tslib.es6.js";import t from"../Camera.js";import"../geometry.js";import i from"../Graphic.js";import r from"../Viewpoint.js";import s from"../core/Collection.js";import{byId as n}from"../core/domUtils.js";import a from"../core/Error.js";import{on as o}from"../core/events.js";import{handlesGroup as l,makeHandle as p}from"../core/handleUtils.js";import has from"../core/has.js";import{isIterable as h}from"../core/iteratorUtils.js";import d from"../core/Logger.js";import{destroyMaybe as c}from"../core/maybe.js";import{ObservableChangesType as u}from"../core/ObservableChangesType.js";import{throwIfAborted as g}from"../core/promiseUtils.js";import{on as m,watch as y,initial as f,syncAndInitial as w,whenOnce as v,sync as _}from"../core/reactiveUtils.js";import{setFrameDuration as b}from"../core/scheduling.js";import{screenPointObjectToArray as M,createScreenPoint as S,createScreenPointArray as C}from"../core/screenUtils.js";import{initialize as R}from"../core/workers/workers.js";import{property as V}from"../core/accessorSupport/decorators/property.js";import{cast as x}from"../core/accessorSupport/decorators/cast.js";import"../core/arrayUtils.js";import{subclass as T}from"../core/accessorSupport/decorators/subclass.js";import{ensureType as O,ensureClass as j}from"../core/accessorSupport/ensureType.js";import{c as E}from"../chunks/vec3f64.js";import{owningCollectionProperty as I}from"../core/support/OwningCollection.js";import L from"../geometry/HeightModelInfo.js";import{projectPointToVector as P,projectVectorToVector as H,canProjectWithoutEngine as A,project as G,projectBoundingRect as U}from"../geometry/projection.js";import{create as W,toExtent as D}from"../geometry/support/aaBoundingRect.js";import{B as F,c as k}from"../chunks/boundedPlane.js";import{renderSRFromViewSR as q}from"../geometry/support/coordinateSystem.js";import{getResolutionForScale as z}from"../geometry/support/scaleUtils.js";import{fallbackObjectIDAttribute as B}from"../layers/LayerConstants.js";import{isImageryTileLayer as N,isTiledLayer as Q,isVoxelLayer as $}from"../layers/support/layerUtils.js";import{AnalysesCollection as X}from"../support/AnalysesCollection.js";import{BreakpointsOwner as Y}from"./BreakpointsOwner.js";import{DOMContainer as Z}from"./DOMContainer.js";import J from"./GroundView.js";import{PopupView as K}from"./PopupView.js";import ee from"./View.js";import te from"./ViewAnimation.js";import{ViewingMode as ie,stringFromViewingMode as re,viewingModeFromString as se}from"./ViewingMode.js";import{layerView3DImporter as ne}from"./3d/layerViewModuleImportUtils.js";import ae from"./3d/analysis/AnalysisViewManager3D.js";import{Constraints as oe}from"./3d/constraints/Constraints.js";import le from"./3d/environment/SceneViewEnvironment.js";import{SceneViewEnvironmentManager as pe}from"./3d/environment/SceneViewEnvironmentManager.js";import he from"./3d/input/SceneInputManager.js";import{GraphicsDeconflictor as de}from"./3d/layers/graphics/GraphicsDeconflictor.js";import{Labeler as ce}from"./3d/layers/graphics/Labeler.js";import{FeatureTileTree3D as ue}from"./3d/layers/support/FeatureTileTree3D.js";import ge from"./3d/state/ViewState.js";import{ViewStateManager as me}from"./3d/state/ViewStateManager.js";import{SceneIntersectionHelper as ye}from"./3d/state/helpers/SceneIntersectionHelper.js";import{CombinedElevationProvider as fe}from"./3d/support/CombinedElevationProvider.js";import we from"./3d/support/debugFlags.js";import ve from"./3d/support/DisplayQualityProfile.js";import{getElevationAtPoint as _e}from"./3d/support/ElevationProvider.js";import be from"./3d/support/HighlightOptions.js";import{MapCoordsHelper as Me}from"./3d/support/MapCoordsHelper.js";import{PropertiesPool as Se}from"./3d/support/PropertiesPool.js";import Ce from"./3d/support/QualitySettings.js";import{RenderCoordsHelper as Re}from"./3d/support/RenderCoordsHelper.js";import{newResourceController as Ve}from"./3d/support/ResourceController.js";import xe from"./3d/support/SceneViewPerformanceInfo.js";import{SharedSymbolResources as Te}from"./3d/support/SharedSymbolResources.js";import{PointsOfInterest as Oe}from"./3d/support/pointsOfInterest/PointsOfInterest.js";import je from"./3d/terrain/TerrainSurface.js";import{isSurfaceLayerView as Ee,getTiledLayerInfo as Ie,checkIfTileInfoSupportedForView as Le}from"./3d/terrain/terrainUtils.js";import{Stage as Pe}from"./3d/webgl-engine/Stage.js";import{newIntersector as He,DEFAULT_TOLERANCE as Ae}from"./3d/webgl-engine/lib/Intersector.js";import{StoreResults as Ge,IntersectorType as Ue}from"./3d/webgl-engine/lib/IntersectorInterfaces.js";import{isValidIntersectorResult as We}from"./3d/webgl-engine/lib/intersectorUtils.js";import{toHit as De,toOwner as Fe}from"./3d/webgl-engine/lib/intersectorUtilsConversions.js";import{TERRAIN_ID as ke}from"./3d/webgl-engine/lib/verticalOffsetUtils.js";import{hitTestSelectSimilarDistance as qe}from"./support/hitTestSelectUtils.js";import{occludeesSupported as ze}from"./support/layerViewUtils.js";import{encode as Be,encodeData as Ne,toRenderSettings as Qe,screenshotSuperSampleSettings as $e}from"./support/screenshotUtils.js";import{isSupportedScreenPointEvent as Xe,createScreenPointFromSupportedEvent as Ye}from"./support/screenUtils.js";import{isSpatialReferenceSupported as Ze}from"./support/spatialReferenceSupport.js";import{check as Je}from"./support/WebGLRequirements.js";import Ke from"./ui/DefaultUI.js";import et from"./ui/3d/DefaultUI3D.js";import tt from"../webscene/Environment.js";import it from"../geometry/Extent.js";import rt from"../geometry/SpatialReference.js";import st from"../geometry/Point.js";let nt=class extends(Y(K(Z(ee)))){constructor(e){super(e),this._userClippingArea=null,this._clippingArea=null,this._initialDefaultSpatialReference=null,this._defaults={},this._externallySet={environment:!1},this._createGraphicsViewController=null,this._resolveWhenReady=[],this._propertiesPool=new Se({slicePlane:F},this),this._resourceController=Ve(this),this._defaultToMapOptions={include:new Set},this._defaultHitTestOptions={exclude:new Set},this.deconflictor=new de({view:this}),this.labeler=new ce({view:this,deconflictor:this.deconflictor.labels}),this.sharedSymbolResources=null,this.analyses=new X,this.basemapTerrain=null,this.elevationProvider=null,this.canvas=null,this.constraints=new oe,this.environmentManager=new pe,this.floors=new s,this.fullOpacity=1,this.graphicsView=null,this.analysisViewManager=new ae({view:this}),this.groundView=null,this.map=null,this.screenSizePerspectiveEnabled=!0,this.state=new ge,this.spatialReference=null,this.alphaCompositingEnabled=!1,this.preserveDrawingBufferEnabled=!1,this.supersampleScreenshotsEnabled=!0,this.type="3d",this.ui=new et,this._numUpdating=0,this._lastUpdateTime=0,this.updatingProgress=.5,this.highlightOptions=new be,this.voxelWasm=null,this.voxelWasmPromise=null,R(),e&&e.environment||(this._defaults.environment=new le,this.environment=this._defaults.environment);const t=(e=null)=>{null!=e&&e.type===u.MOVE||(this._updatingChanged(),this.map&&this.map.allLayers.forEach((async e=>{try{await e.when()}catch{}this._updatingChanged()})))};this.addHandles([m((()=>this.map?.allLayers),"after-changes",(e=>t(e)),{onListenerAdd:()=>t(),onListenerRemove:()=>t(),sync:!0}),this.allLayerViews.on("after-changes",(e=>this._updateUpdatingMonitors(e))),y((()=>this.map),(e=>{e&&"load"in e&&e.load&&e.load().catch((()=>{}))}))]),this.inputManager=new he({view:this}),this.stateManager=new me({view:this})}initialize(){this.groundView=new J({view:this}),this._updateUpdatingMonitors();const e=()=>this._updateDefaultToMapOptions();this.addHandles(m((()=>this.map?.allLayers),"after-changes",e,{onListenerAdd:e,onListenerRemove:e})),this.updatingHandles.add((()=>this.qualitySettings.memoryLimit),(e=>{this.resourceController&&(this.resourceController.memoryController.maxMemory=e)}),f),this.updatingHandles.add((()=>this.qualitySettings.additionalCacheMemory),(e=>{this.resourceController&&(this.resourceController.memoryController.additionalCacheMemory=e)}),f),this.updatingHandles.add((()=>this.qualitySettings.frameRate??0),(e=>b(e>0?1e3/Math.ceil(e):0)),f),this.updatingHandles.add((()=>this.map?.ground),e,w),this.updatingHandles.add((()=>this.map?.ground?.opacity),(()=>this._updateDefaultHitTestOptions()),w),this.addHandles(y((()=>this.spatialReference),(()=>this.notifyChange("clippingArea")),_))}destroy(){this.destroyed||(this.updatingHandles.removeAll(),this.removeAllHandles(),this.invalidate(),this.activeTool=null,this.layerViewManager.clear(),this._exitSurface(),this._disposeGraphicsView(),this.sharedSymbolResources=c(this.sharedSymbolResources),this._set("labeler",c(this.labeler)),this._set("deconflictor",c(this.deconflictor)),this._resourceController=c(this._resourceController),this._set("stateManager",c(this.stateManager)),this._set("inputManager",c(this.inputManager)),this.state.destroy(),this._propertiesPool.destroy(),this.removeHandles("updatingMonitors"),this._set("environmentManager",c(this.environmentManager)),this.groundView=c(this.groundView),this._exitBasemapTerrain(),this._stage?.destroy(),this.removeAllHandles(),this.updatingHandles.removeAll(),this.handles.removeAll())}get renderSpatialReference(){return this.renderCoordsHelper&&this.renderCoordsHelper.spatialReference}get basemapSpatialReference(){return this.basemapTerrain?.spatialReference}get animation(){return this.state?.animation}get camera(){return this.stateManager?.camera}set camera(e){this.stateManager&&(this.stateManager.camera=e)}get contentCamera(){return this.stateManager?.contentCamera}set contentCamera(e){this.stateManager&&(this.stateManager.contentCamera=e)}installContentCameraReset(e={sticky:!1}){return this.stateManager.installContentCameraReset(e)}get center(){return this.stateManager?.center}set center(e){this.stateManager&&(this.stateManager.center=e)}get clippingArea(){if("global"===this.viewingMode)return null;let e=this._userClippingArea||("clippingArea"in this.map?this.map?.clippingArea:void 0);return!this._userClippingArea&&!this.get("map.clippingEnabled")||null==e?(this._clippingArea=null,null):e instanceof it?this.spatialReference&&(e=lt(e,this.spatialReference),null==e)?(d.getLogger(this.declaredClass).error("#clippingArea","setting clippingArea with incompatible SpatialReference"),this._clippingArea):(e=e.clone(),null==e.intersection(this._groundAndLayersExtent)&&(e.xmin=e.xmax,e.ymin=e.ymax),e.zmin=void 0,e.zmax=void 0,e.equals(this._clippingArea)||(this._clippingArea=e),this._clippingArea):(d.getLogger(this.declaredClass).error("#clippingArea","only clippingArea geometries of type Extent are supported"),this._clippingArea)}set clippingArea(e){this.ready&&"global"===this.viewingMode&&null!=e?d.getLogger(this.declaredClass).error("#clippingArea=","Clipping area is only supported in local viewingMode"):this._userClippingArea=e}get renderDataExtent(){if(this.state.viewingMode===ie.Global)return null;const e=this.renderSpatialReference,t=this.dataExtent;return null==t||null==e||t.spatialReference.equals(e)?t:lt(t,e)}get dataExtent(){let e=this._groundAndLayersExtent;const t=this.spatialReference||rt.WGS84,i=lt(this.clippingArea,t);null!=i&&(e=null!=e?e.intersection(i):i);const r=this._get("dataExtent");return null!=e&&e.equals(r)?r:e}get _groundAndLayersExtent(){const e=this.spatialReference||rt.WGS84;let t;const i=i=>{const r=lt(i,e);null!=r&&(null!=t?t.union(r):t=r.clone())},r=this.basemapTerrain;if(r?.spatialReference){const e=r.groundExtent;i(new it({xmin:e[0],ymin:e[1],zmin:0,xmax:e[2],ymax:e[3],zmax:0,spatialReference:r.spatialReference}))}if(this.map){const e=e=>{null==e.fullExtent||"graphics"===e.type&&e.internal||i(e.fullExtent)};this.map.allLayers.forEach((t=>e(t)))}if(null==t)return null;t.hasZ?(t.zmin=Math.min(0,t.zmin??0),t.zmax=Math.max(0,t.zmax??0)):(t.zmin=0,t.zmax=0);const s=this._get("_groundAndLayersExtent");return t.equals(s)?s:t}set environment(e){e!==this._defaults.environment&&(this._externallySet.environment=!0),this._set("environment",e)}castEnvironment(e){return e?e instanceof le?e:e instanceof tt?null!=this.environment?this.environment.cloneWithWebsceneEnvironment(e):le.fromWebsceneEnvironment(e):O(le,e):new le}get extent(){return this.stateManager?.extent}set extent(e){this.stateManager&&(this.stateManager.extent=e)}get screenCenter(){return this.stateManager?.screenCenter}get frustum(){return this.stateManager?.frustum}get initialExtentRequired(){return this.stateManager&&!this.stateManager.hasInitialView}get _defaultsFromMapSettings(){return{required:{tileInfo:!1,heightModelInfo:!0,extent:!1}}}get interacting(){return this.navigating||(this.toolViewManager?.interacting??!1)}get stationary(){return!this.animation&&!this.resizing&&(null==this.state||this.state.stationary)}get navigating(){return this.state?.navigating??!1}get padding(){return this.stateManager?.padding}set padding(e){this.stateManager&&(this.stateManager.padding=e)}set qualityProfile(e){ve.isValidProfile(e)&&(ve.apply(e,this.qualitySettings),this._set("qualityProfile",e))}get qualityProfile(){return this._get("qualityProfile")||ve.getDefaultProfile()}set slicePlane(e){if(null!=this._stage&&this._stage.renderer.setParameters({slicePlane:e}),null==e)return void this._set("slicePlane",null);const t=this._propertiesPool.get("slicePlane");k(e,t),this._set("slicePlane",t)}get typeSpecificPreconditionsReady(){return!!this.viewingMode}get resolution(){return null!=this.spatialReference?z(this.scale,this.spatialReference):0}get scale(){return this.stateManager?.scale}set scale(e){this.stateManager&&(this.stateManager.scale=e)}get heightModelInfo(){const e=this.getDefaultHeightModelInfo();return null!=e?L.deriveUnitFromSR(e,this.spatialReference):null}get updating(){if(this.destroyed)return!1;let e=0,t=this.layerViewManager.updating,i=t?this.layerViewManager.updatingRemaining:0;this.allLayerViews.forEach((r=>{if(r.isFulfilled()){if(r.updating){if(t=!0,r.suspended||Ee(r))return;++i,e+=r.updatingProgress}}else++i}));for(const s of this._updatingObjects)if(null!=s&&s.updating){const t=.1;i+=t,e+=.5*t}for(const s of this._updatingObjectsWithProgress)null!=s&&s.updating&&(++i,e+=s.updatingProgress);const r=!this.stateManager.test.updatingIgnoreRenderState&&this.state.updating;if(t=!!(t||i>0||this.updatingHandles.updating||!this.ready||!this.stationary||r||this._createGraphicsViewController||this.inputManager?.hasPendingInputs||this.map?.allLayers?.some((e=>!e.isFulfilled()))),t?(this._numUpdating=Math.max(i,this._numUpdating),e+=this._numUpdating-i):this._numUpdating=0,this._numUpdating>0?e/=this._numUpdating:e=t?0:1,this._get("updatingProgress")!==e){const i=performance.now();if(e<1){const t=Math.min((i-this._lastUpdateTime)/2e3,1);e=this.updatingProgress*(1-t)+e*t}this._set("updatingProgress",e),this._lastUpdateTime=t&&e<1?i:0}return t}get _updatingObjects(){return[this.graphicsView,this.basemapView,this._resourceController,this._stage,this.featureTiles,this.pointsOfInterest,this.environmentManager,this.overlay,this._featureTreeDebugger,this.toolViewManager,this.analysisViewManager]}get _updatingObjectsWithProgress(){return[this.deconflictor,this.labeler,this.basemapTerrain]}get viewingMode(){const e=this._predeterminedViewingMode;if(null!=e)return re(e);const t=this.spatialReference;return t?null!=this.defaultsFromMap?.viewingMode&&t.equals(this.defaultsFromMap.spatialReference)?re(this.defaultsFromMap.viewingMode):Ze(t,ie.Global)?"global":"local":"global"}set viewingMode(e){this.ready?d.getLogger(this.declaredClass).error("#viewingMode","viewingMode cannot be set once view is ready"):this._overrideIfSome("viewingMode",e)}get viewpoint(){return this.stateManager?.viewpoint}set viewpoint(e){this.stateManager&&(this.stateManager.viewpoint=e)}get zoom(){return this.stateManager.zoom}set zoom(e){this.stateManager&&(this.stateManager.zoom=e)}get resourceController(){return this._resourceController}get performanceInfo(){return new xe(this)}on(e,t,i,r){const s=this.viewEvents.on(e,t,i,r);return s||super.on(e,t)}hasEventListener(e){return super.hasEventListener(e)||this.viewEvents.hasHandler(e)}toMap(e,t){if(!this.ready)return d.getLogger(this.declaredClass).error("#toMap()","Scene view cannot be used before it is ready"),null;const i=t?this.externalToInternalIntersectOptions(t):this._defaultToMapOptions,r=null!=i.graphics&&(null!=i.graphics.include||null!=i.graphics.exclude),s=Xe(e)?Ye(this,e):e,n=M(s);i.enableDraped=i.include&&!i.include.has(ke)||i.exclude&&i.exclude.has(ke);const a=this.sceneIntersectionHelper,o=He(this.state.viewingMode);if(o.options.selectionMode=!0,o.options.store=r?Ge.ALL:Ge.MIN,a.intersectIntersectorScreen(n,o,i),r){for(const e of o.results.all){const t=De(e,this);if(null==t)return this._intersectResultToMapPoint(e);if("graphic"!==t.type||this._testGraphicUidFilter(i.graphics,t.graphic))return this._intersectResultToMapPoint(e)}return null}return this._intersectResultToMapPoint(o.results.min)}toScreen(e){if(!this.ready)return d.getLogger(this.declaredClass).error("#toScreen()","Scene view cannot be used before it is ready"),null;const t=(null==e.z?_e(this.elevationProvider,e):null)??0;return P(e,ht,this.renderSpatialReference,t),this.state.camera.projectToScreen(ht,dt),S(dt[0],dt[1])}pixelSizeAt(e){return this.ready?e?(P(e,ht,this.renderSpatialReference),this.state.camera.computeScreenPixelSizeAt(ht)):0:(d.getLogger(this.declaredClass).error("#pixelSizeAt()","Scene view cannot be used before it is ready"),null)}overlayPixelSizeInMapUnits(e){const t=this.basemapTerrain.overlayManager;return t?t.overlayPixelSizeInMapUnits(e):1}hitTest(e,t){if(!this.ready)return d.getLogger(this.declaredClass).error("#hitTest()","Scene view cannot be used before it is ready"),null;const i=Xe(e)?Ye(this,e):e,r=C(i.x,i.y),s=t?this.externalToInternalIntersectOptions(t):this._defaultHitTestOptions;s.requiresGroundFeedback=!0,s.enableDraped=!0;const n=He(this.state.viewingMode);n.options.selectionMode=!0,n.options.store=Ge.ALL,this.sceneIntersectionHelper.intersectIntersectorScreen(r,n,s);const a=this._intersectResultsToHits(n.results.all,s.graphics),o=n.results.ground,l=Fe(o,this),p=null!=l&&"type"in l&&"integrated-mesh"===l.type?l:null,h={screenPoint:i,results:a,ground:{mapPoint:this._intersectResultToMapPoint(o),distance:We(o)?o.distanceInRenderSpace:0,layer:p}};return we.SCENEVIEW_HITTEST_RETURN_INTERSECTOR&&(h.intersector=n),Promise.resolve(h)}async popupHitTest(e){const{results:t,ground:i}=await qe(this,e);let r=null;return!(0===t.length||Math.abs((t[0].distance??0)-i.distance)<1e-5)||i.layer&&"integrated-mesh"===i.layer.type||(r=i.mapPoint),{results:t,screenPoint:e,mapPoint:r}}goTo(e,t){return this.updatingHandles.addPromise(this.stateManager.goTo(e,t))}async whenAnalysisView(e){if(null==e.parent)throw new a("view:no-analysisview-for-analysis","The analysis has not been added to view.analyses",{analysis:e});switch(e.parent.type){case"line-of-sight":case"dimension":return(await this.whenLayerView(e.parent)).whenAnalysisView();default:return this.analysisViewManager.whenAnalysisView(e)}}whenLayerView(e){return super.whenLayerView(e)}async takeScreenshot(e){const t=this._completeSettings(e);await this.whenReady();const i=await this._stage.renderView.takeScreenshot(t);return Be(i,t,this._pixelFormat())}async _takeScreenshot(e){const t=this._completeSettings(e);await this.whenReady();const i=await this._stage.renderView.takeScreenshot(t);return Ne(i,this._pixelFormat())}async _takeScreenshotWithObjectAndLayerId(e){const t=this._completeSettings(e);await this.whenReady();const i=await this._stage.renderView.takeScreenshotWithOID(t);return[Ne(i[0],this._pixelFormat()),Ne(i[1],this._pixelFormat())]}_completeSettings(e){const t=Qe(e,this);return t.pixelRatio/=this.state.pixelRatio,$e(t,this.supersampleScreenshotsEnabled,this.padding)}_pixelFormat(){return{flipY:!0,premultipliedAlpha:this._stage.renderView.getAlpha()}}get test(){return{takeScreenshot:e=>this._takeScreenshot(e),takeScreenshotWithObjectAndLayerId:e=>this._takeScreenshotWithObjectAndLayerId(e)}}async takeScreenshotWithObjectAndLayerId(e){if(!has("enable-feature:objectAndLayerId-rendering"))throw new Error("has enable-feature:objectAndLayerId-rendering must be true");const t=this._completeSettings(e);await this.whenReady();const i=await this._stage.renderView.takeScreenshotWithOID(t),r=Be(i[0],t,this._pixelFormat()),s=this._completeSettings(e);s.format="png";return[r,Be(i[1],s,this._pixelFormat())]}getColorToObjectAndLayerIdMapping(){if(null==this._stage.renderView.objectAndLayerIdRenderHelper)throw new Error("has enable-feature:objectAndLayerId-rendering must be true");return this._stage.renderView.objectAndLayerIdRenderHelper.getColorToObjectAndLayerIdMapping()}addUpdatingPromise(e){return this.updatingHandles.addPromise(e)}importLayerView(e){return ne.importLayerView(e)}hasLayerViewModule(e){return ne.hasLayerViewModule(e)}forceDOMReadyCycle(){this.forceReadyCycle()}getDefaultSpatialReference(){return this.map&&"initialViewProperties"in this.map&&this.map?.initialViewProperties?.spatialReference||this.defaultsFromMap?.spatialReference||this.defaultsFromMap?.ready&&this._initialDefaultSpatialReference||null}async validate(){let e=Je(this.type);const t=has("safari");if(t&&t<9&&(e=new a("sceneview:browser-not-supported","This browser is not supported by SceneView (Safari < 9)",{type:"safari",requiredVersion:9,detectedVersion:t})),null!=e)throw d.getLogger(this.declaredClass).warn("#validate()",e.message),e}get _predeterminedViewingMode(){const e=this._isOverridden("viewingMode")?this._get("viewingMode"):(this.map&&"initialViewProperties"in this.map?this.map.initialViewProperties?.viewingMode:null)??null;return null!=e?se(e):null}getSpatialReferenceSupport({spatialReference:e,layer:t}){const i=this._predeterminedViewingMode;if(null!=i)return this._validateSpatialReferenceForViewingMode(e,t,i)?{constraints:this._makeSpatialReferenceConstraints(e,t,i)}:null;const r=this._validateSpatialReferenceForViewingMode(e,t,ie.Local),s=this._validateSpatialReferenceForViewingMode(e,t,ie.Global);return r||s?r&&s?{constraints:this._makeSpatialReferenceConstraints(e,t,null)}:r?{constraints:this._makeSpatialReferenceConstraints(e,t,ie.Local)}:{constraints:this._makeSpatialReferenceConstraints(e,t,ie.Global)}:null}_validateSpatialReferenceForViewingMode(e,t,i){return!!Ze(e,i)&&(null==t||(!!N(t)||(!Q(t)||null!=Ie(t,e,i))&&(!$(t)||i!==ie.Global)))}_makeSpatialReferenceConstraints(e,t,i){if(null==t)return[{spatialReference:e,viewingMode:i}];const r=e.isWebMercator,s=e.isWGS84;if(N(t)&&(r||s)){return!s||i===ie.Local||null===Le(t.tileInfo,t.fullExtent,e,ie.Global)?[{spatialReference:e,viewingMode:i},{spatialReference:rt.WebMercator,viewingMode:i}]:[{spatialReference:r?rt.WGS84:rt.WebMercator,viewingMode:i}]}return Q(t)||$(t)||!r&&!s?Q(t)&&r&&i!==ie.Global?[{spatialReference:e,viewingMode:i},{spatialReference:rt.WGS84,viewingMode:ie.Local}]:[{spatialReference:e,viewingMode:i}]:[{spatialReference:e,viewingMode:i},{spatialReference:r?rt.WGS84:rt.WebMercator,viewingMode:i}]}_validateSpatialReference(e){const t=null!=this.getSpatialReferenceSupport({spatialReference:e}),i=this._predeterminedViewingMode;return t||(null!=i?d.getLogger(this.declaredClass).warnOnce(`Spatial reference defined on view not supported in ${re(i)} viewing mode.`):e.isGeographic&&d.getLogger(this.declaredClass).warnOnce("Spatial reference is geographic but not supported.")),t}whenReady(){return new Promise((e=>{this.ready?e(this):this._resolveWhenReady.push(e)}))}computeMapPointFromVec3d(e,t){let i=this.spatialReference||rt.WGS84;return H(e,this.renderSpatialReference,e,i)||(i=rt.WGS84,H(e,this.renderSpatialReference,e,i)),t?(t.x=e[0],t.y=e[1],t.z=e[2],t.spatialReference=i):t=new st(e,i),t}trackGraphicState(e){if(!e.graphic)return d.getLogger(this.declaredClass).error("trackGraphicState","GraphicState.graphic must not be null or undefined to start tracking"),null;const t=this.getViewForGraphic(e.graphic);let i=null,r=!1;const s=t=>{!r&&null!=t&&"processor"in t&&"graphics-3d"===t.processor?.type&&t.processor.graphicsCore&&(i=t.processor.graphicsCore.trackGraphicState(e))};return null!=t?s(t):this.whenViewForGraphic(e.graphic,{waitForLayer:!0}).then((e=>s(e)),(()=>{})).catch((()=>{})),{remove:()=>{r=!0,null!=i&&(i.remove(),i=null)}}}highlight(e){if(Array.isArray(e))return l(e.map((e=>this.highlight(e))));if(s.isCollection(e))return l(e.toArray().map((e=>this.highlight(e))));const t=this.getViewForGraphic(e);return t&&"highlight"in t?t.highlight(e):p()}maskOccludee(e){if(!e)return d.getLogger(this.declaredClass).error("maskOccludee","GraphicState.graphic must not be null or undefined to mask an occludee"),null;const t=this.getViewForGraphic(e);let i=null,r=!1;const s=t=>{!r&&null!=t&&ze(t)&&(i=t.maskOccludee(e))};return null!=t?s(t):this.whenViewForGraphic(e,{waitForLayer:!0}).then((e=>s(e)),(()=>{})).catch((()=>{})),{remove:()=>{r=!0,null!=i&&(i.remove(),i=null)}}}getViewForGraphic(e){return e.layer===this.graphics?this.graphicsView:e.layer?this.allLayerViews.find((t=>t.layer===e.layer)):null}graphicChanged(e){null!=this.graphicsView&&this.graphicsView.graphicChanged(e)}async whenViewForGraphic(e,t){if(e.layer===this)return await v((()=>this.graphicsView)),this.graphicsView;if(!e.layer||!this.map)throw new a("no-view-for-graphic");return t&&t.waitForLayer&&!this.map.allLayers.includes(e.layer)?new Promise(((t,i)=>{const r=this.map.allLayers.on("change",(s=>{s.added.includes(e.layer)&&(r.remove(),this.whenLayerView(e.layer).then(t,i))}))})):this.whenLayerView(e.layer)}externalToInternalIntersectOptions(e){const t=this._externalToInternalRenderItems(e.include,pt.INCLUDE),i=this._externalToInternalRenderItems(e.exclude,pt.EXCLUDE);return{include:t.layerUids,exclude:i.layerUids,graphics:{include:t.graphicUids,exclude:i.graphicUids}}}_intersectResultToMapPoint(e,t){return e.getIntersectionPoint(ht)?(t=this.computeMapPointFromVec3d(ht,t),e.intersector===Ue.TERRAIN&&this.basemapTerrain&&(t.z=_e(this.basemapTerrain,t)??0),t):null}_intersectResultsToHits(e,t){const i=new Array;let r=null;for(let s=0;s<e.length;s++){const n=e[s],a=Fe(n,this);if(null!=a&&(a===this.map.ground||"type"in a&&"integrated-mesh"===a.type))break;const o=De(n,this);if(null==o)continue;if("graphic"===o.type){if(null==r&&s!==e.length-1&&(r=new Set),null!=r){const e=this._getGraphicFilterUid(o.graphic);if(r.has(e))continue;r.add(e)}if(!this._testGraphicUidFilter(t,o.graphic))continue}const l=this._intersectResultToMapPoint(n),p=n.distanceInRenderSpace;i.push({...o,mapPoint:l,distance:p})}return i}_getGraphicFilterUid(e){const t=e.sourceLayer,i=e.layer,r=t&&"objectIdField"in t?t:i&&"objectIdField"in i?i:t;if(r){const t=r.objectIdField??B,i=e.attributes?.[t];if(i)return`o-${r.id}-${i}`}return`u-${e.uid}`}_testGraphicUidFilter(e,t){const i=this._getGraphicFilterUid(t);return null==e||(null==e.include||e.include.has(i))&&(null==e.exclude||!e.exclude.has(i))}_externalToInternalRenderItems(e,t,r={layerUids:void 0,graphicUids:void 0}){if(!e)return r;if(e instanceof i)ot(r,this._getGraphicFilterUid(e)),t===pt.INCLUDE&&(null!=this.graphicsView&&e.layer===this?at(r,this.graphicsView.processor.layer.id):e.layer&&at(r,e.layer.uid));else if(h(e))for(const i of e)i===this.graphics&&null!=this.graphicsView?at(r,this.graphicsView.processor.layer.id):i===this.map.ground?at(r,ke):this._externalToInternalRenderItems(i,t,r);else"uid"in e&&at(r,e.uid);return r}_initBasemapTerrain(){this._set("basemapTerrain",new je({view:this})),this._set("elevationProvider",new fe({view:this})),this.elevationProvider.register("ground",this.basemapTerrain)}_exitBasemapTerrain(){this.basemapTerrain&&(this.elevationProvider.unregister(this.basemapTerrain),this.elevationProvider.destroy(),this._set("elevationProvider",null),this.basemapTerrain.destroy(),this._set("basemapTerrain",null))}_initGlobe(){this._initCoordinateSystem(),this.state.createInitialCamera(),this._initBasemapTerrain(),this._set("pointsOfInterest",new Oe({view:this})),this._set("featureTiles",new ue({renderCoordsHelper:this.renderCoordsHelper,cameraOnSurface:this.pointsOfInterest.cameraOnSurface,focus:this.pointsOfInterest.focus,tilingSchemeOwner:this.basemapTerrain,viewState:this.state,scheduler:this._resourceController.scheduler,terrain:this.basemapTerrain}));const e=()=>{const e=this.basemapTerrain?.extent;if(this.clippingArea||e)if(e&&this.basemapTerrain.spatialReference){const e=null!=this.basemapTerrain.extent&&null!=this.basemapTerrain.spatialReference?G(D(this.basemapTerrain.extent,this.basemapTerrain.spatialReference),this.spatialReference):null;null!=this.clippingArea?this.featureTiles.filterExtent=this.clippingArea.intersection(e):this.featureTiles.filterExtent=e}else this.featureTiles.filterExtent=this.clippingArea;else this.featureTiles.filterExtent=null};this.addHandles([this.updatingHandles.add((()=>we.FEATURE_TILE_TREE_SHOW_TILES),(e=>{e&&this.featureTiles&&!this._featureTreeDebugger?this.updatingHandles.addPromise(import("./3d/layers/support/FeatureTileTree3DDebugger.js")).then((({FeatureTileTree3DDebugger:e})=>{!this._featureTreeDebugger&&we.FEATURE_TILE_TREE_SHOW_TILES&&(this._featureTreeDebugger=new e({view:this}))})):e||!this._featureTreeDebugger||we.FEATURE_TILE_TREE_SHOW_TILES||(this._featureTreeDebugger.destroy(),this._featureTreeDebugger=null)}),w),this.updatingHandles.add((()=>this.clippingArea),e,w),this.updatingHandles.add((()=>this.basemapTerrain.extent),e,w)],"feature-tiles"),this.stateManager.init()}_exitGlobe(){this.state&&(this.stateManager.exit(),this.removeHandles("render-coords-helper"),this.removeHandles("feature-tiles"),this.featureTiles.destroy(),this._set("featureTiles",null),this.pointsOfInterest.destroy(),this._set("pointsOfInterest",null),this._exitBasemapTerrain(),this.state.exit(),this._exitCoordinateSystem())}_initCoordinateSystem(){if(this.spatialReference){const e=this.spatialReference;this.mapCoordsHelper&&this.mapCoordsHelper.spatialReference.equals(e)||this._set("mapCoordsHelper",new Me(this.map,e));const t=this.state.isGlobal,i=q(t,e);i!==this.renderSpatialReference&&(this._set("renderCoordsHelper",Re.create(this.state.viewingMode,i)),t||this.addHandles(y((()=>this.basemapTerrain?.extent),(e=>{const t=this.renderCoordsHelper.spatialReference;null==e||0===e[0]&&0===e[1]&&0===e[2]&&0===e[3]||!U(e,this.basemapTerrain.spatialReference,ct,t)||(this.renderCoordsHelper.extent=ct)}),_),"render-coords-helper"),this.sceneIntersectionHelper&&this.sceneIntersectionHelper.setTolerance(Ae/this.renderCoordsHelper.unitInMeters))}else this._set("mapCoordsHelper",null),this._set("renderCoordsHelper",null)}_exitCoordinateSystem(){this.mapCoordsHelper&&(this.removeHandles("render-coords-helper"),this._set("renderCoordsHelper",null),this._set("mapCoordsHelper",null))}_updatingChanged(){this.notifyChange("updating")}_updateUpdatingMonitors(e=null){null!=e&&e.type===u.MOVE||(this.removeHandles("updatingMonitors"),this.allLayerViews.forEach((e=>{e.destroyed||(this.addHandles(y((()=>[e.updating,e.updatingProgress]),(()=>this._updatingChanged()),_),"updatingMonitors"),e.when((()=>this._updatingChanged()),(()=>this._updatingChanged())))})),this._updatingChanged())}async _prepareScreenshotOverlay(){this.overlay&&await this.overlay.prepare()}_renderScreenshotOverlay(e,t){if(!this.overlay||!this.overlay.hasVisibleItems)return t;const i=e.getContext("2d");return i.putImageData(t,0,0),this.overlay.renderCanvas(e),i.getImageData(0,0,t.width,t.height)}_initStage(){const e={deactivatedWebGLExtensions:this.deactivatedWebGLExtensions,debugWebGLExtensions:this.debugWebGLExtensions,alpha:this.alphaCompositingEnabled,preserveDrawingBuffer:this.preserveDrawingBufferEnabled,canvas:this.renderCanvas,screenshot:{prepareOverlay:()=>this._prepareScreenshotOverlay(),renderOverlay:(e,t)=>this._renderScreenshotOverlay(e,t)}},t=new ye(this.state.viewingMode,(e=>this._stage.layers.forAll(e)),this);this._set("sceneIntersectionHelper",t);const i=n(this.surface);this._stage=new Pe({view:this,options:e,container:i}),this._stage.renderer.setParameters({slicePlane:this.slicePlane}),this.addHandles([this.updatingHandles.add((()=>this.qualitySettings.antialiasingEnabled),(()=>this._stage.renderer.setParameters({antialiasingEnabled:this.qualitySettings.antialiasingEnabled})),f),this.updatingHandles.add((()=>this.qualitySettings.highQualityTransparency),(e=>this._stage.renderer.setParameters({highQualityTransparency:e})),f),y((()=>this.magnifier),(e=>this._stage.renderView.magnifier=e),w),this.on("pointer-move",(()=>this._stage?.renderer.resetAnimation())),o(this._stage.renderView.canvas,"webglcontextlost",(e=>this.fatalError=new a("webgl-context-lost",e.statusMessage)))],"stage");const r=()=>{this._stage.renderer.setParameters({defaultHighlightOptions:be.toEngineOptions(this.highlightOptions)})};this.addHandles(this.updatingHandles.add((()=>[this.highlightOptions.color,this.highlightOptions.haloColor,this.highlightOptions.haloOpacity,this.highlightOptions.fillOpacity,this.highlightOptions.shadowOpacity,this.highlightOptions.shadowColor,this.highlightOptions.shadowDifference]),r),"stage"),r(),this.renderCoordsHelper&&this.sceneIntersectionHelper.setTolerance(Ae/this.renderCoordsHelper.unitInMeters),this._set("canvas",this._stage.renderView.canvas)}_exitStage(){this._set("sceneIntersectionHelper",null),this._stage=c(this._stage),this.removeHandles("stage"),this._set("canvas",null)}_initSurface(e){this._exitSurface(),this.state.init(e,this.spatialReference),this._initStage(),this._initGlobe(),this.sharedSymbolResources=new Te({view:this,viewingMode:e,resourceController:this._resourceController,pointsOfInterest:this.pointsOfInterest,viewState:this.state})}_exitSurface(){this.sharedSymbolResources&&(this.sharedSymbolResources.objectResourceCache.destroy(),this.sharedSymbolResources.destroy(),this.sharedSymbolResources=null,this._exitGlobe(),this._exitStage())}_createGraphicsViewIfNeeded(){if(this.graphicsView||this._createGraphicsViewController)return;if(0===this.graphics.length)return;this.removeHandles("graphics-view"),this._createGraphicsViewController=new AbortController;const e=()=>{this._createGraphicsViewController=null,this._updatingChanged()};this._createGraphicsViewAsync(this._createGraphicsViewController.signal).then(e,e),this._updatingChanged()}async _createGraphicsViewAsync(e){const t=(await import("./3d/layers/GraphicsView3D.js")).default;g(e),await v((()=>this.basemapTerrain?.ready),e),this._set("graphicsView",new t({view:this}))}_disposeGraphicsView(){this._createGraphicsViewController&&(this._createGraphicsViewController.abort(),this._createGraphicsViewController=null),this.removeHandles("graphics-view"),null!=this.graphicsView&&(this.removeHandles(this.graphicsView.processor.layer.id),this.graphicsView.destroy(),this._set("graphicsView",null))}_startup(){const e=se(this.viewingMode);if(e===ie.Global&&(this._clippingArea=null),this._initSurface(e),this._set("ready",!0),this.addHandles(m((()=>this.graphics),"after-changes",(()=>this._createGraphicsViewIfNeeded())),"graphics-view"),this._createGraphicsViewIfNeeded(),!this._externallySet.environment){const e=this.get("map.initialViewProperties.environment");e&&(this.environment=e)}this.labeler.setup(),this.environmentManager.connectView(this),this.inputManager.connect();const t=this._resolveWhenReady;this._resolveWhenReady=[],t.forEach((e=>e(this)))}_teardown(){this._initialDefaultSpatialReference=null,this.inputManager.disconnect(),this.environmentManager.disconnectView(),this.labeler.dispose(),this._disposeGraphicsView(),this.removeHandles("graphics-view"),this._exitSurface(),this._set("ready",!1)}_updateDefaultToMapOptions(){if(this._defaultToMapOptions.include.clear(),this.map){this.map.ground&&this._defaultToMapOptions.include.add(ke);for(const e of this.map.allLayers.items)"integrated-mesh"===e.type&&this._defaultToMapOptions.include.add(e.uid)}}_updateDefaultHitTestOptions(){if(this._defaultHitTestOptions.exclude.clear(),this.map){this.map.ground&&this.map.ground.opacity<1&&this._defaultHitTestOptions.exclude.add(ke);for(const e of this.map.allLayers.items)"integrated-mesh"===e.type&&e.opacity<1&&this._defaultHitTestOptions.exclude.add(e.uid)}}addVoxelLayerViewToWasm(e){return null==this.voxelWasm?(null==this.voxelWasmPromise&&(this.voxelWasmPromise=import("../layers/VoxelWasmPerSceneView.js").then((e=>(this.voxelWasm=new e.default(this),this.voxelWasm)))),this.voxelWasmPromise.then((t=>t.addVoxelLayer(e)))):this.voxelWasm.addVoxelLayer(e)}removeVoxelLayerViewFromWasm(e){if(null!=this.voxelWasm){this.voxelWasm.removeVoxelLayer(e)<1&&(this.voxelWasm=null,this.voxelWasmPromise=null)}}};function at(e,t){e.layerUids||(e.layerUids=new Set),e.layerUids.add(t)}function ot(e,t){e.graphicUids||(e.graphicUids=new Set),e.graphicUids.add(t)}function lt(e,t){return null!=e&&A(e.spatialReference,t)?G(e,t):null}var pt;nt.type="3d",e([V()],nt.prototype,"_userClippingArea",void 0),e([V()],nt.prototype,"_resourceController",void 0),e([V()],nt.prototype,"_stage",void 0),e([V({readOnly:!0})],nt.prototype,"deconflictor",void 0),e([V({readOnly:!0})],nt.prototype,"labeler",void 0),e([V(I(X,"analyses"))],nt.prototype,"analyses",void 0),e([V({type:te,readOnly:!0})],nt.prototype,"animation",null),e([V({readOnly:!0})],nt.prototype,"basemapTerrain",void 0),e([V({readOnly:!0})],nt.prototype,"elevationProvider",void 0),e([V()],nt.prototype,"camera",null),e([V({type:t})],nt.prototype,"contentCamera",null),e([V({readOnly:!0})],nt.prototype,"canvas",void 0),e([V({type:st})],nt.prototype,"center",null),e([V({type:it})],nt.prototype,"clippingArea",null),e([V({type:oe})],nt.prototype,"constraints",void 0),e([V({type:it,readOnly:!0})],nt.prototype,"renderDataExtent",null),e([V({type:it,readOnly:!0})],nt.prototype,"dataExtent",null),e([V({type:it,readOnly:!0})],nt.prototype,"_groundAndLayersExtent",null),e([V({value:null,type:le})],nt.prototype,"environment",null),e([x("environment")],nt.prototype,"castEnvironment",null),e([V({readOnly:!0})],nt.prototype,"environmentManager",void 0),e([V({type:it})],nt.prototype,"extent",null),e([V()],nt.prototype,"floors",void 0),e([V()],nt.prototype,"screenCenter",null),e([V()],nt.prototype,"frustum",null),e([V({type:Number,readOnly:!0})],nt.prototype,"fullOpacity",void 0),e([V({readOnly:!0})],nt.prototype,"graphicsView",void 0),e([V({readOnly:!0})],nt.prototype,"analysisViewManager",void 0),e([V()],nt.prototype,"groundView",void 0),e([V({type:Boolean})],nt.prototype,"initialExtentRequired",null),e([V()],nt.prototype,"_defaultsFromMapSettings",null),e([V()],nt.prototype,"interacting",null),e([V()],nt.prototype,"stationary",null),e([V()],nt.prototype,"navigating",null),e([V()],nt.prototype,"map",void 0),e([V({readOnly:!0})],nt.prototype,"mapCoordsHelper",void 0),e([V()],nt.prototype,"padding",null),e([V({type:Oe,readOnly:!0})],nt.prototype,"pointsOfInterest",void 0),e([V({type:ue,readOnly:!0})],nt.prototype,"featureTiles",void 0),e([V()],nt.prototype,"_featureTreeDebugger",void 0),e([V({type:Boolean})],nt.prototype,"screenSizePerspectiveEnabled",void 0),e([V({constructOnly:!0})],nt.prototype,"deactivatedWebGLExtensions",void 0),e([V({constructOnly:!0})],nt.prototype,"debugWebGLExtensions",void 0),e([V({constructOnly:!0})],nt.prototype,"renderCanvas",void 0),e([V({constructOnly:!0})],nt.prototype,"state",void 0),e([V({readOnly:!0})],nt.prototype,"inputManager",void 0),e([V({readOnly:!0})],nt.prototype,"stateManager",void 0),e([V({type:["low","medium","high"]})],nt.prototype,"qualityProfile",null),e([V({type:Ce,get(){let e=this._get("qualitySettings");return e||(e=new Ce,ve.apply(this.qualityProfile,e)),e}})],nt.prototype,"qualitySettings",void 0),e([V()],nt.prototype,"slicePlane",null),e([V({readOnly:!0})],nt.prototype,"typeSpecificPreconditionsReady",null),e([V({readOnly:!0})],nt.prototype,"renderCoordsHelper",void 0),e([V({readOnly:!0})],nt.prototype,"sceneIntersectionHelper",void 0),e([V({type:Number,dependsOn:["scale","spatialReference"],readOnly:!0})],nt.prototype,"resolution",null),e([V({type:Number})],nt.prototype,"scale",null),e([V()],nt.prototype,"heightModelInfo",null),e([V()],nt.prototype,"spatialReference",void 0),e([V({type:Boolean,constructOnly:!0})],nt.prototype,"alphaCompositingEnabled",void 0),e([V({constructOnly:!0})],nt.prototype,"preserveDrawingBufferEnabled",void 0),e([V({type:Boolean})],nt.prototype,"supersampleScreenshotsEnabled",void 0),e([V({readOnly:!0})],nt.prototype,"type",void 0),e([V(),x((e=>e instanceof Ke?e:j(et,e)))],nt.prototype,"ui",void 0),e([V({type:Boolean,readOnly:!0,dependsOn:["graphicsView.updating","basemapView.updating","basemapTerrain.updating","layerViewManager.updating","layerViewManager.updatingRemaining","_resourceController.updating","_stage.updating","featureTiles.updating","pointsOfInterest.updating","environmentManager.updating","overlay.updating","updatingHandles.updating","featureTreeDebugger.updating","labeler.updating","deconflictor.updating","ready","stationary","inputManager.hasPendingInputs","toolViewManager.updating","analysisViewManager.updating","state.updating"]})],nt.prototype,"updating",null),e([V()],nt.prototype,"_updatingObjects",null),e([V()],nt.prototype,"_updatingObjectsWithProgress",null),e([V({type:Number,readOnly:!0,dependsOn:["updating"]})],nt.prototype,"updatingProgress",void 0),e([V({type:["global","local"]})],nt.prototype,"viewingMode",null),e([V({type:r})],nt.prototype,"viewpoint",null),e([V({type:Number})],nt.prototype,"zoom",null),e([V({type:be})],nt.prototype,"highlightOptions",void 0),nt=e([T("esri.views.SceneView")],nt),function(e){e[e.INCLUDE=0]="INCLUDE",e[e.EXCLUDE=1]="EXCLUDE"}(pt||(pt={}));const ht=E(),dt=C(),ct=W(),ut=nt;export{ut as default};
5
+ import{_ as e}from"../chunks/tslib.es6.js";import t from"../Camera.js";import"../geometry.js";import i from"../Graphic.js";import r from"../Viewpoint.js";import s from"../core/Collection.js";import{byId as n}from"../core/domUtils.js";import a from"../core/Error.js";import{on as o}from"../core/events.js";import{handlesGroup as l,makeHandle as p}from"../core/handleUtils.js";import has from"../core/has.js";import{isIterable as h}from"../core/iteratorUtils.js";import d from"../core/Logger.js";import{destroyMaybe as c}from"../core/maybe.js";import{ObservableChangesType as u}from"../core/ObservableChangesType.js";import{throwIfAborted as g}from"../core/promiseUtils.js";import{on as m,watch as y,initial as f,syncAndInitial as w,whenOnce as v,sync as _}from"../core/reactiveUtils.js";import{setFrameDuration as b}from"../core/scheduling.js";import{screenPointObjectToArray as M,createScreenPoint as S,createScreenPointArray as C}from"../core/screenUtils.js";import{initialize as R}from"../core/workers/workers.js";import{property as V}from"../core/accessorSupport/decorators/property.js";import{cast as x}from"../core/accessorSupport/decorators/cast.js";import"../core/arrayUtils.js";import{subclass as T}from"../core/accessorSupport/decorators/subclass.js";import{ensureType as O,ensureClass as j}from"../core/accessorSupport/ensureType.js";import{c as E}from"../chunks/vec3f64.js";import{owningCollectionProperty as I}from"../core/support/OwningCollection.js";import L from"../geometry/HeightModelInfo.js";import{projectPointToVector as P,projectVectorToVector as H,canProjectWithoutEngine as A,project as G,projectBoundingRect as U}from"../geometry/projection.js";import{create as W,toExtent as D}from"../geometry/support/aaBoundingRect.js";import{B as F,c as k}from"../chunks/boundedPlane.js";import{renderSRFromViewSR as q}from"../geometry/support/coordinateSystem.js";import{getResolutionForScale as z}from"../geometry/support/scaleUtils.js";import{fallbackObjectIDAttribute as B}from"../layers/LayerConstants.js";import{isImageryTileLayer as N,isTiledLayer as Q,isVoxelLayer as $}from"../layers/support/layerUtils.js";import{AnalysesCollection as X}from"../support/AnalysesCollection.js";import{BreakpointsOwner as Y}from"./BreakpointsOwner.js";import{DOMContainer as Z}from"./DOMContainer.js";import J from"./GroundView.js";import{PopupView as K}from"./PopupView.js";import ee from"./View.js";import te from"./ViewAnimation.js";import{ViewingMode as ie,stringFromViewingMode as re,viewingModeFromString as se}from"./ViewingMode.js";import{layerView3DImporter as ne}from"./3d/layerViewModuleImportUtils.js";import ae from"./3d/analysis/AnalysisViewManager3D.js";import{Constraints as oe}from"./3d/constraints/Constraints.js";import le from"./3d/environment/SceneViewEnvironment.js";import{SceneViewEnvironmentManager as pe}from"./3d/environment/SceneViewEnvironmentManager.js";import he from"./3d/input/SceneInputManager.js";import{GraphicsDeconflictor as de}from"./3d/layers/graphics/GraphicsDeconflictor.js";import{Labeler as ce}from"./3d/layers/graphics/Labeler.js";import{FeatureTileTree3D as ue}from"./3d/layers/support/FeatureTileTree3D.js";import ge from"./3d/state/ViewState.js";import{ViewStateManager as me}from"./3d/state/ViewStateManager.js";import{SceneIntersectionHelper as ye}from"./3d/state/helpers/SceneIntersectionHelper.js";import{CombinedElevationProvider as fe}from"./3d/support/CombinedElevationProvider.js";import we from"./3d/support/debugFlags.js";import ve from"./3d/support/DisplayQualityProfile.js";import{getElevationAtPoint as _e}from"./3d/support/ElevationProvider.js";import be from"./3d/support/HighlightOptions.js";import{MapCoordsHelper as Me}from"./3d/support/MapCoordsHelper.js";import{PropertiesPool as Se}from"./3d/support/PropertiesPool.js";import Ce from"./3d/support/QualitySettings.js";import{RenderCoordsHelper as Re}from"./3d/support/RenderCoordsHelper.js";import{newResourceController as Ve}from"./3d/support/ResourceController.js";import xe from"./3d/support/SceneViewPerformanceInfo.js";import{SharedSymbolResources as Te}from"./3d/support/SharedSymbolResources.js";import{PointsOfInterest as Oe}from"./3d/support/pointsOfInterest/PointsOfInterest.js";import je from"./3d/terrain/TerrainSurface.js";import{isSurfaceLayerView as Ee,getTiledLayerInfo as Ie,checkIfTileInfoSupportedForView as Le}from"./3d/terrain/terrainUtils.js";import{Stage as Pe}from"./3d/webgl-engine/Stage.js";import{newIntersector as He,DEFAULT_TOLERANCE as Ae}from"./3d/webgl-engine/lib/Intersector.js";import{StoreResults as Ge,IntersectorType as Ue}from"./3d/webgl-engine/lib/IntersectorInterfaces.js";import{isValidIntersectorResult as We}from"./3d/webgl-engine/lib/intersectorUtils.js";import{toHit as De,toOwner as Fe}from"./3d/webgl-engine/lib/intersectorUtilsConversions.js";import{TERRAIN_ID as ke}from"./3d/webgl-engine/lib/verticalOffsetUtils.js";import{hitTestSelectSimilarDistance as qe}from"./support/hitTestSelectUtils.js";import{occludeesSupported as ze}from"./support/layerViewUtils.js";import{encode as Be,encodeData as Ne,toRenderSettings as Qe,screenshotSuperSampleSettings as $e}from"./support/screenshotUtils.js";import{isSupportedScreenPointEvent as Xe,createScreenPointFromSupportedEvent as Ye}from"./support/screenUtils.js";import{isSpatialReferenceSupported as Ze}from"./support/spatialReferenceSupport.js";import{check as Je}from"./support/WebGLRequirements.js";import Ke from"./ui/DefaultUI.js";import et from"./ui/3d/DefaultUI3D.js";import tt from"../webscene/Environment.js";import it from"../geometry/Extent.js";import rt from"../geometry/SpatialReference.js";import st from"../geometry/Point.js";let nt=class extends(Y(K(Z(ee)))){constructor(e){super(e),this._userClippingArea=null,this._clippingArea=null,this._initialDefaultSpatialReference=null,this._defaults={},this._externallySet={environment:!1},this._createGraphicsViewController=null,this._resolveWhenReady=[],this._propertiesPool=new Se({slicePlane:F},this),this._resourceController=Ve(this),this._defaultToMapOptions={include:new Set},this._defaultHitTestOptions={exclude:new Set},this.deconflictor=new de({view:this}),this.labeler=new ce({view:this,deconflictor:this.deconflictor.labels}),this.sharedSymbolResources=null,this.analyses=new X,this.basemapTerrain=null,this.elevationProvider=null,this.canvas=null,this.constraints=new oe,this.environmentManager=new pe,this.floors=new s,this.fullOpacity=1,this.graphicsView=null,this.analysisViewManager=new ae({view:this}),this.groundView=null,this.map=null,this.screenSizePerspectiveEnabled=!0,this.state=new ge,this.spatialReference=null,this.alphaCompositingEnabled=!1,this.preserveDrawingBufferEnabled=!1,this.supersampleScreenshotsEnabled=!0,this.type="3d",this.ui=new et,this._numUpdating=0,this._lastUpdateTime=0,this.updatingProgress=.5,this.highlightOptions=new be,this.voxelWasm=null,this.voxelWasmPromise=null,R(),e&&e.environment||(this._defaults.environment=new le,this.environment=this._defaults.environment);const t=(e=null)=>{null!=e&&e.type===u.MOVE||(this._updatingChanged(),this.map&&this.map.allLayers.forEach((async e=>{try{await e.when()}catch{}this._updatingChanged()})))};this.addHandles([m((()=>this.map?.allLayers),"after-changes",(e=>t(e)),{onListenerAdd:()=>t(),onListenerRemove:()=>t(),sync:!0}),this.allLayerViews.on("after-changes",(e=>this._updateUpdatingMonitors(e))),y((()=>this.map),(e=>{e&&"load"in e&&e.load&&e.load().catch((()=>{}))}))]),this.inputManager=new he({view:this}),this.stateManager=new me({view:this})}initialize(){this.groundView=new J({view:this}),this._updateUpdatingMonitors();const e=()=>this._updateDefaultToMapOptions();this.addHandles(m((()=>this.map?.allLayers),"after-changes",e,{onListenerAdd:e,onListenerRemove:e})),this.updatingHandles.add((()=>this.qualitySettings.memoryLimit),(e=>{this.resourceController&&(this.resourceController.memoryController.maxMemory=e)}),f),this.updatingHandles.add((()=>this.qualitySettings.additionalCacheMemory),(e=>{this.resourceController&&(this.resourceController.memoryController.additionalCacheMemory=e)}),f),this.updatingHandles.add((()=>this.qualitySettings.frameRate??0),(e=>b(e>0?1e3/Math.ceil(e):0)),f),this.updatingHandles.add((()=>this.map?.ground),e,w),this.updatingHandles.add((()=>this.map?.ground?.opacity),(()=>this._updateDefaultHitTestOptions()),w),this.addHandles(y((()=>this.spatialReference),(()=>this.notifyChange("clippingArea")),_))}destroy(){this.destroyed||(this.updatingHandles.removeAll(),this.removeAllHandles(),this.invalidate(),this.activeTool=null,this.layerViewManager.clear(),this._exitSurface(),this._disposeGraphicsView(),this.sharedSymbolResources=c(this.sharedSymbolResources),this._set("labeler",c(this.labeler)),this._set("deconflictor",c(this.deconflictor)),this._resourceController=c(this._resourceController),this._set("stateManager",c(this.stateManager)),this._set("inputManager",c(this.inputManager)),this.state.destroy(),this._propertiesPool.destroy(),this.removeHandles("updatingMonitors"),this._set("environmentManager",c(this.environmentManager)),this.groundView=c(this.groundView),this._exitBasemapTerrain(),this._stage?.destroy(),this.removeAllHandles(),this.updatingHandles.removeAll(),this.handles.removeAll())}get renderSpatialReference(){return this.renderCoordsHelper&&this.renderCoordsHelper.spatialReference}get basemapSpatialReference(){return this.basemapTerrain?.spatialReference}get animation(){return this.state?.animation}get camera(){return this.stateManager?.camera}set camera(e){this.stateManager&&(this.stateManager.camera=e)}get contentCamera(){return this.stateManager?.contentCamera}set contentCamera(e){this.stateManager&&(this.stateManager.contentCamera=e)}installContentCameraReset(e={sticky:!1}){return this.stateManager.installContentCameraReset(e)}get center(){return this.stateManager?.center}set center(e){this.stateManager&&(this.stateManager.center=e)}get clippingArea(){if("global"===this.viewingMode)return null;let e=this._userClippingArea||("clippingArea"in this.map?this.map?.clippingArea:void 0);return!this._userClippingArea&&!this.get("map.clippingEnabled")||null==e?(this._clippingArea=null,null):e instanceof it?this.spatialReference&&(e=lt(e,this.spatialReference),null==e)?(d.getLogger(this.declaredClass).error("#clippingArea","setting clippingArea with incompatible SpatialReference"),this._clippingArea):(e=e.clone(),null==e.intersection(this._groundAndLayersExtent)&&(e.xmin=e.xmax,e.ymin=e.ymax),e.zmin=void 0,e.zmax=void 0,e.equals(this._clippingArea)||(this._clippingArea=e),this._clippingArea):(d.getLogger(this.declaredClass).error("#clippingArea","only clippingArea geometries of type Extent are supported"),this._clippingArea)}set clippingArea(e){this.ready&&"global"===this.viewingMode&&null!=e?d.getLogger(this.declaredClass).error("#clippingArea=","Clipping area is only supported in local viewingMode"):this._userClippingArea=e}get renderDataExtent(){if(this.state.viewingMode===ie.Global)return null;const e=this.renderSpatialReference,t=this.dataExtent;return null==t||null==e||t.spatialReference.equals(e)?t:lt(t,e)}get dataExtent(){let e=this._groundAndLayersExtent;const t=this.spatialReference||rt.WGS84,i=lt(this.clippingArea,t);null!=i&&(e=null!=e?e.intersection(i):i);const r=this._get("dataExtent");return null!=e&&e.equals(r)?r:e}get _groundAndLayersExtent(){const e=this.spatialReference||rt.WGS84;let t;const i=i=>{const r=lt(i,e);null!=r&&(null!=t?t.union(r):t=r.clone())},r=this.basemapTerrain;if(r?.spatialReference){const e=r.groundExtent;i(new it({xmin:e[0],ymin:e[1],zmin:0,xmax:e[2],ymax:e[3],zmax:0,spatialReference:r.spatialReference}))}if(this.map){const e=e=>{null==e.fullExtent||"graphics"===e.type&&e.internal||i(e.fullExtent)};this.map.allLayers.forEach((t=>e(t)))}if(null==t)return null;t.hasZ?(t.zmin=Math.min(0,t.zmin??0),t.zmax=Math.max(0,t.zmax??0)):(t.zmin=0,t.zmax=0);const s=this._get("_groundAndLayersExtent");return t.equals(s)?s:t}set environment(e){e!==this._defaults.environment&&(this._externallySet.environment=!0),this._set("environment",e)}castEnvironment(e){return e?e instanceof le?e:e instanceof tt?null!=this.environment?this.environment.cloneWithWebsceneEnvironment(e):le.fromWebsceneEnvironment(e):O(le,e):new le}get extent(){return this.stateManager?.extent}set extent(e){this.stateManager&&(this.stateManager.extent=e)}get screenCenter(){return this.stateManager?.screenCenter}get frustum(){return this.stateManager?.frustum}get initialExtentRequired(){return this.stateManager&&!this.stateManager.hasInitialView}get _defaultsFromMapSettings(){return{required:{tileInfo:!1,heightModelInfo:!0,extent:!1}}}get interacting(){return this.navigating||(this.toolViewManager?.interacting??!1)}get stationary(){return!this.animation&&!this.resizing&&(null==this.state||this.state.stationary)}get navigating(){return this.state?.navigating??!1}get padding(){return this.stateManager?.padding}set padding(e){this.stateManager&&(this.stateManager.padding=e)}set qualityProfile(e){ve.isValidProfile(e)&&(ve.apply(e,this.qualitySettings),this._set("qualityProfile",e))}get qualityProfile(){return this._get("qualityProfile")||ve.getDefaultProfile()}set slicePlane(e){if(null!=this._stage&&this._stage.renderer.setParameters({slicePlane:e}),null==e)return void this._set("slicePlane",null);const t=this._propertiesPool.get("slicePlane");k(e,t),this._set("slicePlane",t)}get typeSpecificPreconditionsReady(){return!!this.viewingMode}get resolution(){return null!=this.spatialReference?z(this.scale,this.spatialReference):0}get scale(){return this.stateManager?.scale}set scale(e){this.stateManager&&(this.stateManager.scale=e)}get heightModelInfo(){const e=this.getDefaultHeightModelInfo();return null!=e?L.deriveUnitFromSR(e,this.spatialReference):null}get updating(){if(this.destroyed)return!1;let e=0,t=this.layerViewManager.updating,i=t?this.layerViewManager.updatingRemaining:0;this.allLayerViews.forEach((r=>{if(r.isFulfilled()){if(r.updating){if(t=!0,r.suspended||Ee(r))return;++i,e+=r.updatingProgress}}else++i}));for(const s of this._updatingObjects)if(null!=s&&s.updating){const t=.1;i+=t,e+=.5*t}for(const s of this._updatingObjectsWithProgress)null!=s&&s.updating&&(++i,e+=s.updatingProgress);const r=!this.stateManager.test.updatingIgnoreRenderState&&this.state.updating;if(t=!!(t||i>0||this.updatingHandles.updating||!this.ready||!this.stationary||r||this._createGraphicsViewController||this.inputManager?.updating||this.map?.allLayers?.some((e=>!e.isFulfilled()))),t?(this._numUpdating=Math.max(i,this._numUpdating),e+=this._numUpdating-i):this._numUpdating=0,this._numUpdating>0?e/=this._numUpdating:e=t?0:1,this._get("updatingProgress")!==e){const i=performance.now();if(e<1){const t=Math.min((i-this._lastUpdateTime)/2e3,1);e=this.updatingProgress*(1-t)+e*t}this._set("updatingProgress",e),this._lastUpdateTime=t&&e<1?i:0}return t}get _updatingObjects(){return[this.graphicsView,this.basemapView,this._resourceController,this._stage,this.featureTiles,this.pointsOfInterest,this.environmentManager,this.overlay,this._featureTreeDebugger,this.toolViewManager,this.analysisViewManager]}get _updatingObjectsWithProgress(){return[this.deconflictor,this.labeler,this.basemapTerrain]}get viewingMode(){const e=this._predeterminedViewingMode;if(null!=e)return re(e);const t=this.spatialReference;return t?null!=this.defaultsFromMap?.viewingMode&&t.equals(this.defaultsFromMap.spatialReference)?re(this.defaultsFromMap.viewingMode):Ze(t,ie.Global)?"global":"local":"global"}set viewingMode(e){this.ready?d.getLogger(this.declaredClass).error("#viewingMode","viewingMode cannot be set once view is ready"):this._overrideIfSome("viewingMode",e)}get viewpoint(){return this.stateManager?.viewpoint}set viewpoint(e){this.stateManager&&(this.stateManager.viewpoint=e)}get zoom(){return this.stateManager.zoom}set zoom(e){this.stateManager&&(this.stateManager.zoom=e)}get resourceController(){return this._resourceController}get performanceInfo(){return new xe(this)}on(e,t,i,r){const s=this.viewEvents.on(e,t,i,r);return s||super.on(e,t)}hasEventListener(e){return super.hasEventListener(e)||this.viewEvents.hasHandler(e)}toMap(e,t){if(!this.ready)return d.getLogger(this.declaredClass).error("#toMap()","Scene view cannot be used before it is ready"),null;const i=t?this.externalToInternalIntersectOptions(t):this._defaultToMapOptions,r=null!=i.graphics&&(null!=i.graphics.include||null!=i.graphics.exclude),s=Xe(e)?Ye(this,e):e,n=M(s);i.enableDraped=i.include&&!i.include.has(ke)||i.exclude&&i.exclude.has(ke);const a=this.sceneIntersectionHelper,o=He(this.state.viewingMode);if(o.options.selectionMode=!0,o.options.store=r?Ge.ALL:Ge.MIN,a.intersectIntersectorScreen(n,o,i),r){for(const e of o.results.all){const t=De(e,this);if(null==t)return this._intersectResultToMapPoint(e);if("graphic"!==t.type||this._testGraphicUidFilter(i.graphics,t.graphic))return this._intersectResultToMapPoint(e)}return null}return this._intersectResultToMapPoint(o.results.min)}toScreen(e){if(!this.ready)return d.getLogger(this.declaredClass).error("#toScreen()","Scene view cannot be used before it is ready"),null;const t=(null==e.z?_e(this.elevationProvider,e):null)??0;return P(e,ht,this.renderSpatialReference,t),this.state.camera.projectToScreen(ht,dt),S(dt[0],dt[1])}pixelSizeAt(e){return this.ready?e?(P(e,ht,this.renderSpatialReference),this.state.camera.computeScreenPixelSizeAt(ht)):0:(d.getLogger(this.declaredClass).error("#pixelSizeAt()","Scene view cannot be used before it is ready"),null)}overlayPixelSizeInMapUnits(e){const t=this.basemapTerrain.overlayManager;return t?t.overlayPixelSizeInMapUnits(e):1}hitTest(e,t){if(!this.ready)return d.getLogger(this.declaredClass).error("#hitTest()","Scene view cannot be used before it is ready"),null;const i=Xe(e)?Ye(this,e):e,r=C(i.x,i.y),s=t?this.externalToInternalIntersectOptions(t):this._defaultHitTestOptions;s.requiresGroundFeedback=!0,s.enableDraped=!0;const n=He(this.state.viewingMode);n.options.selectionMode=!0,n.options.store=Ge.ALL,this.sceneIntersectionHelper.intersectIntersectorScreen(r,n,s);const a=this._intersectResultsToHits(n.results.all,s.graphics),o=n.results.ground,l=Fe(o,this),p=null!=l&&"type"in l&&"integrated-mesh"===l.type?l:null,h={screenPoint:i,results:a,ground:{mapPoint:this._intersectResultToMapPoint(o),distance:We(o)?o.distanceInRenderSpace:0,layer:p}};return we.SCENEVIEW_HITTEST_RETURN_INTERSECTOR&&(h.intersector=n),Promise.resolve(h)}async popupHitTest(e){const{results:t,ground:i}=await qe(this,e);let r=null;return!(0===t.length||Math.abs((t[0].distance??0)-i.distance)<1e-5)||i.layer&&"integrated-mesh"===i.layer.type||(r=i.mapPoint),{results:t,screenPoint:e,mapPoint:r}}goTo(e,t){return this.updatingHandles.addPromise(this.stateManager.goTo(e,t))}async whenAnalysisView(e){if(null==e.parent)throw new a("view:no-analysisview-for-analysis","The analysis has not been added to view.analyses",{analysis:e});switch(e.parent.type){case"line-of-sight":case"dimension":return(await this.whenLayerView(e.parent)).whenAnalysisView();default:return this.analysisViewManager.whenAnalysisView(e)}}whenLayerView(e){return super.whenLayerView(e)}async takeScreenshot(e){const t=this._completeSettings(e);await this.whenReady();const i=await this._stage.renderView.takeScreenshot(t);return Be(i,t,this._pixelFormat())}async _takeScreenshot(e){const t=this._completeSettings(e);await this.whenReady();const i=await this._stage.renderView.takeScreenshot(t);return Ne(i,this._pixelFormat())}async _takeScreenshotWithObjectAndLayerId(e){const t=this._completeSettings(e);await this.whenReady();const i=await this._stage.renderView.takeScreenshotWithOID(t);return[Ne(i[0],this._pixelFormat()),Ne(i[1],this._pixelFormat())]}_completeSettings(e){const t=Qe(e,this);return t.pixelRatio/=this.state.pixelRatio,$e(t,this.supersampleScreenshotsEnabled,this.padding)}_pixelFormat(){return{flipY:!0,premultipliedAlpha:this._stage.renderView.getAlpha()}}get test(){return{takeScreenshot:e=>this._takeScreenshot(e),takeScreenshotWithObjectAndLayerId:e=>this._takeScreenshotWithObjectAndLayerId(e)}}async takeScreenshotWithObjectAndLayerId(e){if(!has("enable-feature:objectAndLayerId-rendering"))throw new Error("has enable-feature:objectAndLayerId-rendering must be true");const t=this._completeSettings(e);await this.whenReady();const i=await this._stage.renderView.takeScreenshotWithOID(t),r=Be(i[0],t,this._pixelFormat()),s=this._completeSettings(e);s.format="png";return[r,Be(i[1],s,this._pixelFormat())]}getColorToObjectAndLayerIdMapping(){if(null==this._stage.renderView.objectAndLayerIdRenderHelper)throw new Error("has enable-feature:objectAndLayerId-rendering must be true");return this._stage.renderView.objectAndLayerIdRenderHelper.getColorToObjectAndLayerIdMapping()}addUpdatingPromise(e){return this.updatingHandles.addPromise(e)}importLayerView(e){return ne.importLayerView(e)}hasLayerViewModule(e){return ne.hasLayerViewModule(e)}forceDOMReadyCycle(){this.forceReadyCycle()}getDefaultSpatialReference(){return this.map&&"initialViewProperties"in this.map&&this.map?.initialViewProperties?.spatialReference||this.defaultsFromMap?.spatialReference||this.defaultsFromMap?.ready&&this._initialDefaultSpatialReference||null}async validate(){let e=Je(this.type);const t=has("safari");if(t&&t<9&&(e=new a("sceneview:browser-not-supported","This browser is not supported by SceneView (Safari < 9)",{type:"safari",requiredVersion:9,detectedVersion:t})),null!=e)throw d.getLogger(this.declaredClass).warn("#validate()",e.message),e}get _predeterminedViewingMode(){const e=this._isOverridden("viewingMode")?this._get("viewingMode"):(this.map&&"initialViewProperties"in this.map?this.map.initialViewProperties?.viewingMode:null)??null;return null!=e?se(e):null}getSpatialReferenceSupport({spatialReference:e,layer:t}){const i=this._predeterminedViewingMode;if(null!=i)return this._validateSpatialReferenceForViewingMode(e,t,i)?{constraints:this._makeSpatialReferenceConstraints(e,t,i)}:null;const r=this._validateSpatialReferenceForViewingMode(e,t,ie.Local),s=this._validateSpatialReferenceForViewingMode(e,t,ie.Global);return r||s?r&&s?{constraints:this._makeSpatialReferenceConstraints(e,t,null)}:r?{constraints:this._makeSpatialReferenceConstraints(e,t,ie.Local)}:{constraints:this._makeSpatialReferenceConstraints(e,t,ie.Global)}:null}_validateSpatialReferenceForViewingMode(e,t,i){return!!Ze(e,i)&&(null==t||(!!N(t)||(!Q(t)||null!=Ie(t,e,i))&&(!$(t)||i!==ie.Global)))}_makeSpatialReferenceConstraints(e,t,i){if(null==t)return[{spatialReference:e,viewingMode:i}];const r=e.isWebMercator,s=e.isWGS84;if(N(t)&&(r||s)){return!s||i===ie.Local||null===Le(t.tileInfo,t.fullExtent,e,ie.Global)?[{spatialReference:e,viewingMode:i},{spatialReference:rt.WebMercator,viewingMode:i}]:[{spatialReference:r?rt.WGS84:rt.WebMercator,viewingMode:i}]}return Q(t)||$(t)||!r&&!s?Q(t)&&r&&i!==ie.Global?[{spatialReference:e,viewingMode:i},{spatialReference:rt.WGS84,viewingMode:ie.Local}]:[{spatialReference:e,viewingMode:i}]:[{spatialReference:e,viewingMode:i},{spatialReference:r?rt.WGS84:rt.WebMercator,viewingMode:i}]}_validateSpatialReference(e){const t=null!=this.getSpatialReferenceSupport({spatialReference:e}),i=this._predeterminedViewingMode;return t||(null!=i?d.getLogger(this.declaredClass).warnOnce(`Spatial reference defined on view not supported in ${re(i)} viewing mode.`):e.isGeographic&&d.getLogger(this.declaredClass).warnOnce("Spatial reference is geographic but not supported.")),t}whenReady(){return new Promise((e=>{this.ready?e(this):this._resolveWhenReady.push(e)}))}computeMapPointFromVec3d(e,t){let i=this.spatialReference||rt.WGS84;return H(e,this.renderSpatialReference,e,i)||(i=rt.WGS84,H(e,this.renderSpatialReference,e,i)),t?(t.x=e[0],t.y=e[1],t.z=e[2],t.spatialReference=i):t=new st(e,i),t}trackGraphicState(e){if(!e.graphic)return d.getLogger(this.declaredClass).error("trackGraphicState","GraphicState.graphic must not be null or undefined to start tracking"),null;const t=this.getViewForGraphic(e.graphic);let i=null,r=!1;const s=t=>{!r&&null!=t&&"processor"in t&&"graphics-3d"===t.processor?.type&&t.processor.graphicsCore&&(i=t.processor.graphicsCore.trackGraphicState(e))};return null!=t?s(t):this.whenViewForGraphic(e.graphic,{waitForLayer:!0}).then((e=>s(e)),(()=>{})).catch((()=>{})),{remove:()=>{r=!0,null!=i&&(i.remove(),i=null)}}}highlight(e){if(Array.isArray(e))return l(e.map((e=>this.highlight(e))));if(s.isCollection(e))return l(e.toArray().map((e=>this.highlight(e))));const t=this.getViewForGraphic(e);return t&&"highlight"in t?t.highlight(e):p()}maskOccludee(e){if(!e)return d.getLogger(this.declaredClass).error("maskOccludee","GraphicState.graphic must not be null or undefined to mask an occludee"),null;const t=this.getViewForGraphic(e);let i=null,r=!1;const s=t=>{!r&&null!=t&&ze(t)&&(i=t.maskOccludee(e))};return null!=t?s(t):this.whenViewForGraphic(e,{waitForLayer:!0}).then((e=>s(e)),(()=>{})).catch((()=>{})),{remove:()=>{r=!0,null!=i&&(i.remove(),i=null)}}}getViewForGraphic(e){return e.layer===this.graphics?this.graphicsView:e.layer?this.allLayerViews.find((t=>t.layer===e.layer)):null}graphicChanged(e){null!=this.graphicsView&&this.graphicsView.graphicChanged(e)}async whenViewForGraphic(e,t){if(e.layer===this)return await v((()=>this.graphicsView)),this.graphicsView;if(!e.layer||!this.map)throw new a("no-view-for-graphic");return t&&t.waitForLayer&&!this.map.allLayers.includes(e.layer)?new Promise(((t,i)=>{const r=this.map.allLayers.on("change",(s=>{s.added.includes(e.layer)&&(r.remove(),this.whenLayerView(e.layer).then(t,i))}))})):this.whenLayerView(e.layer)}externalToInternalIntersectOptions(e){const t=this._externalToInternalRenderItems(e.include,pt.INCLUDE),i=this._externalToInternalRenderItems(e.exclude,pt.EXCLUDE);return{include:t.layerUids,exclude:i.layerUids,graphics:{include:t.graphicUids,exclude:i.graphicUids}}}_intersectResultToMapPoint(e,t){return e.getIntersectionPoint(ht)?(t=this.computeMapPointFromVec3d(ht,t),e.intersector===Ue.TERRAIN&&this.basemapTerrain&&(t.z=_e(this.basemapTerrain,t)??0),t):null}_intersectResultsToHits(e,t){const i=new Array;let r=null;for(let s=0;s<e.length;s++){const n=e[s],a=Fe(n,this);if(null!=a&&(a===this.map.ground||"type"in a&&"integrated-mesh"===a.type))break;const o=De(n,this);if(null==o)continue;if("graphic"===o.type){if(null==r&&s!==e.length-1&&(r=new Set),null!=r){const e=this._getGraphicFilterUid(o.graphic);if(r.has(e))continue;r.add(e)}if(!this._testGraphicUidFilter(t,o.graphic))continue}const l=this._intersectResultToMapPoint(n),p=n.distanceInRenderSpace;i.push({...o,mapPoint:l,distance:p})}return i}_getGraphicFilterUid(e){const t=e.sourceLayer,i=e.layer,r=t&&"objectIdField"in t?t:i&&"objectIdField"in i?i:t;if(r){const t=r.objectIdField??B,i=e.attributes?.[t];if(i)return`o-${r.id}-${i}`}return`u-${e.uid}`}_testGraphicUidFilter(e,t){const i=this._getGraphicFilterUid(t);return null==e||(null==e.include||e.include.has(i))&&(null==e.exclude||!e.exclude.has(i))}_externalToInternalRenderItems(e,t,r={layerUids:void 0,graphicUids:void 0}){if(!e)return r;if(e instanceof i)ot(r,this._getGraphicFilterUid(e)),t===pt.INCLUDE&&(null!=this.graphicsView&&e.layer===this?at(r,this.graphicsView.processor.layer.id):e.layer&&at(r,e.layer.uid));else if(h(e))for(const i of e)i===this.graphics&&null!=this.graphicsView?at(r,this.graphicsView.processor.layer.id):i===this.map.ground?at(r,ke):this._externalToInternalRenderItems(i,t,r);else"uid"in e&&at(r,e.uid);return r}_initBasemapTerrain(){this._set("basemapTerrain",new je({view:this})),this._set("elevationProvider",new fe({view:this})),this.elevationProvider.register("ground",this.basemapTerrain)}_exitBasemapTerrain(){this.basemapTerrain&&(this.elevationProvider.unregister(this.basemapTerrain),this.elevationProvider.destroy(),this._set("elevationProvider",null),this.basemapTerrain.destroy(),this._set("basemapTerrain",null))}_initGlobe(){this._initCoordinateSystem(),this.state.createInitialCamera(),this._initBasemapTerrain(),this._set("pointsOfInterest",new Oe({view:this})),this._set("featureTiles",new ue({renderCoordsHelper:this.renderCoordsHelper,cameraOnSurface:this.pointsOfInterest.cameraOnSurface,focus:this.pointsOfInterest.focus,tilingSchemeOwner:this.basemapTerrain,viewState:this.state,scheduler:this._resourceController.scheduler,terrain:this.basemapTerrain}));const e=()=>{const e=this.basemapTerrain?.extent;if(this.clippingArea||e)if(e&&this.basemapTerrain.spatialReference){const e=null!=this.basemapTerrain.extent&&null!=this.basemapTerrain.spatialReference?G(D(this.basemapTerrain.extent,this.basemapTerrain.spatialReference),this.spatialReference):null;null!=this.clippingArea?this.featureTiles.filterExtent=this.clippingArea.intersection(e):this.featureTiles.filterExtent=e}else this.featureTiles.filterExtent=this.clippingArea;else this.featureTiles.filterExtent=null};this.addHandles([this.updatingHandles.add((()=>we.FEATURE_TILE_TREE_SHOW_TILES),(e=>{e&&this.featureTiles&&!this._featureTreeDebugger?this.updatingHandles.addPromise(import("./3d/layers/support/FeatureTileTree3DDebugger.js")).then((({FeatureTileTree3DDebugger:e})=>{!this._featureTreeDebugger&&we.FEATURE_TILE_TREE_SHOW_TILES&&(this._featureTreeDebugger=new e({view:this}))})):e||!this._featureTreeDebugger||we.FEATURE_TILE_TREE_SHOW_TILES||(this._featureTreeDebugger.destroy(),this._featureTreeDebugger=null)}),w),this.updatingHandles.add((()=>this.clippingArea),e,w),this.updatingHandles.add((()=>this.basemapTerrain.extent),e,w)],"feature-tiles"),this.stateManager.init()}_exitGlobe(){this.state&&(this.stateManager.exit(),this.removeHandles("render-coords-helper"),this.removeHandles("feature-tiles"),this.featureTiles.destroy(),this._set("featureTiles",null),this.pointsOfInterest.destroy(),this._set("pointsOfInterest",null),this._exitBasemapTerrain(),this.state.exit(),this._exitCoordinateSystem())}_initCoordinateSystem(){if(this.spatialReference){const e=this.spatialReference;this.mapCoordsHelper&&this.mapCoordsHelper.spatialReference.equals(e)||this._set("mapCoordsHelper",new Me(this.map,e));const t=this.state.isGlobal,i=q(t,e);i!==this.renderSpatialReference&&(this._set("renderCoordsHelper",Re.create(this.state.viewingMode,i)),t||this.addHandles(y((()=>this.basemapTerrain?.extent),(e=>{const t=this.renderCoordsHelper.spatialReference;null==e||0===e[0]&&0===e[1]&&0===e[2]&&0===e[3]||!U(e,this.basemapTerrain.spatialReference,ct,t)||(this.renderCoordsHelper.extent=ct)}),_),"render-coords-helper"),this.sceneIntersectionHelper&&this.sceneIntersectionHelper.setTolerance(Ae/this.renderCoordsHelper.unitInMeters))}else this._set("mapCoordsHelper",null),this._set("renderCoordsHelper",null)}_exitCoordinateSystem(){this.mapCoordsHelper&&(this.removeHandles("render-coords-helper"),this._set("renderCoordsHelper",null),this._set("mapCoordsHelper",null))}_updatingChanged(){this.notifyChange("updating")}_updateUpdatingMonitors(e=null){null!=e&&e.type===u.MOVE||(this.removeHandles("updatingMonitors"),this.allLayerViews.forEach((e=>{e.destroyed||(this.addHandles(y((()=>[e.updating,e.updatingProgress]),(()=>this._updatingChanged()),_),"updatingMonitors"),e.when((()=>this._updatingChanged()),(()=>this._updatingChanged())))})),this._updatingChanged())}async _prepareScreenshotOverlay(){this.overlay&&await this.overlay.prepare()}_renderScreenshotOverlay(e,t){if(!this.overlay||!this.overlay.hasVisibleItems)return t;const i=e.getContext("2d");return i.putImageData(t,0,0),this.overlay.renderCanvas(e),i.getImageData(0,0,t.width,t.height)}_initStage(){const e={deactivatedWebGLExtensions:this.deactivatedWebGLExtensions,debugWebGLExtensions:this.debugWebGLExtensions,alpha:this.alphaCompositingEnabled,preserveDrawingBuffer:this.preserveDrawingBufferEnabled,canvas:this.renderCanvas,screenshot:{prepareOverlay:()=>this._prepareScreenshotOverlay(),renderOverlay:(e,t)=>this._renderScreenshotOverlay(e,t)}},t=new ye(this.state.viewingMode,(e=>this._stage.layers.forAll(e)),this);this._set("sceneIntersectionHelper",t);const i=n(this.surface);this._stage=new Pe({view:this,options:e,container:i}),this._stage.renderer.setParameters({slicePlane:this.slicePlane}),this.addHandles([this.updatingHandles.add((()=>this.qualitySettings.antialiasingEnabled),(()=>this._stage.renderer.setParameters({antialiasingEnabled:this.qualitySettings.antialiasingEnabled})),f),this.updatingHandles.add((()=>this.qualitySettings.highQualityTransparency),(e=>this._stage.renderer.setParameters({highQualityTransparency:e})),f),y((()=>this.magnifier),(e=>this._stage.renderView.magnifier=e),w),this.on("pointer-move",(()=>this._stage?.renderer.resetAnimation())),o(this._stage.renderView.canvas,"webglcontextlost",(e=>this.fatalError=new a("webgl-context-lost",e.statusMessage)))],"stage");const r=()=>{this._stage.renderer.setParameters({defaultHighlightOptions:be.toEngineOptions(this.highlightOptions)})};this.addHandles(this.updatingHandles.add((()=>[this.highlightOptions.color,this.highlightOptions.haloColor,this.highlightOptions.haloOpacity,this.highlightOptions.fillOpacity,this.highlightOptions.shadowOpacity,this.highlightOptions.shadowColor,this.highlightOptions.shadowDifference]),r),"stage"),r(),this.renderCoordsHelper&&this.sceneIntersectionHelper.setTolerance(Ae/this.renderCoordsHelper.unitInMeters),this._set("canvas",this._stage.renderView.canvas)}_exitStage(){this._set("sceneIntersectionHelper",null),this._stage=c(this._stage),this.removeHandles("stage"),this._set("canvas",null)}_initSurface(e){this._exitSurface(),this.state.init(e,this.spatialReference),this._initStage(),this._initGlobe(),this.sharedSymbolResources=new Te({view:this,viewingMode:e,resourceController:this._resourceController,pointsOfInterest:this.pointsOfInterest,viewState:this.state})}_exitSurface(){this.sharedSymbolResources&&(this.sharedSymbolResources.objectResourceCache.destroy(),this.sharedSymbolResources.destroy(),this.sharedSymbolResources=null,this._exitGlobe(),this._exitStage())}_createGraphicsViewIfNeeded(){if(this.graphicsView||this._createGraphicsViewController)return;if(0===this.graphics.length)return;this.removeHandles("graphics-view"),this._createGraphicsViewController=new AbortController;const e=()=>{this._createGraphicsViewController=null,this._updatingChanged()};this._createGraphicsViewAsync(this._createGraphicsViewController.signal).then(e,e),this._updatingChanged()}async _createGraphicsViewAsync(e){const t=(await import("./3d/layers/GraphicsView3D.js")).default;g(e),await v((()=>this.basemapTerrain?.ready),e),this._set("graphicsView",new t({view:this}))}_disposeGraphicsView(){this._createGraphicsViewController&&(this._createGraphicsViewController.abort(),this._createGraphicsViewController=null),this.removeHandles("graphics-view"),null!=this.graphicsView&&(this.removeHandles(this.graphicsView.processor.layer.id),this.graphicsView.destroy(),this._set("graphicsView",null))}_startup(){const e=se(this.viewingMode);if(e===ie.Global&&(this._clippingArea=null),this._initSurface(e),this._set("ready",!0),this.addHandles(m((()=>this.graphics),"after-changes",(()=>this._createGraphicsViewIfNeeded())),"graphics-view"),this._createGraphicsViewIfNeeded(),!this._externallySet.environment){const e=this.get("map.initialViewProperties.environment");e&&(this.environment=e)}this.labeler.setup(),this.environmentManager.connectView(this),this.inputManager.connect();const t=this._resolveWhenReady;this._resolveWhenReady=[],t.forEach((e=>e(this)))}_teardown(){this._initialDefaultSpatialReference=null,this.inputManager.disconnect(),this.environmentManager.disconnectView(),this.labeler.dispose(),this._disposeGraphicsView(),this.removeHandles("graphics-view"),this._exitSurface(),this._set("ready",!1)}_updateDefaultToMapOptions(){if(this._defaultToMapOptions.include.clear(),this.map){this.map.ground&&this._defaultToMapOptions.include.add(ke);for(const e of this.map.allLayers.items)"integrated-mesh"===e.type&&this._defaultToMapOptions.include.add(e.uid)}}_updateDefaultHitTestOptions(){if(this._defaultHitTestOptions.exclude.clear(),this.map){this.map.ground&&this.map.ground.opacity<1&&this._defaultHitTestOptions.exclude.add(ke);for(const e of this.map.allLayers.items)"integrated-mesh"===e.type&&e.opacity<1&&this._defaultHitTestOptions.exclude.add(e.uid)}}addVoxelLayerViewToWasm(e){return null==this.voxelWasm?(null==this.voxelWasmPromise&&(this.voxelWasmPromise=import("../layers/VoxelWasmPerSceneView.js").then((e=>(this.voxelWasm=new e.default(this),this.voxelWasm)))),this.voxelWasmPromise.then((t=>t.addVoxelLayer(e)))):this.voxelWasm.addVoxelLayer(e)}removeVoxelLayerViewFromWasm(e){if(null!=this.voxelWasm){this.voxelWasm.removeVoxelLayer(e)<1&&(this.voxelWasm=null,this.voxelWasmPromise=null)}}};function at(e,t){e.layerUids||(e.layerUids=new Set),e.layerUids.add(t)}function ot(e,t){e.graphicUids||(e.graphicUids=new Set),e.graphicUids.add(t)}function lt(e,t){return null!=e&&A(e.spatialReference,t)?G(e,t):null}var pt;nt.type="3d",e([V()],nt.prototype,"_userClippingArea",void 0),e([V()],nt.prototype,"_resourceController",void 0),e([V()],nt.prototype,"_stage",void 0),e([V({readOnly:!0})],nt.prototype,"deconflictor",void 0),e([V({readOnly:!0})],nt.prototype,"labeler",void 0),e([V(I(X,"analyses"))],nt.prototype,"analyses",void 0),e([V({type:te,readOnly:!0})],nt.prototype,"animation",null),e([V({readOnly:!0})],nt.prototype,"basemapTerrain",void 0),e([V({readOnly:!0})],nt.prototype,"elevationProvider",void 0),e([V()],nt.prototype,"camera",null),e([V({type:t})],nt.prototype,"contentCamera",null),e([V({readOnly:!0})],nt.prototype,"canvas",void 0),e([V({type:st})],nt.prototype,"center",null),e([V({type:it})],nt.prototype,"clippingArea",null),e([V({type:oe})],nt.prototype,"constraints",void 0),e([V({type:it,readOnly:!0})],nt.prototype,"renderDataExtent",null),e([V({type:it,readOnly:!0})],nt.prototype,"dataExtent",null),e([V({type:it,readOnly:!0})],nt.prototype,"_groundAndLayersExtent",null),e([V({value:null,type:le})],nt.prototype,"environment",null),e([x("environment")],nt.prototype,"castEnvironment",null),e([V({readOnly:!0})],nt.prototype,"environmentManager",void 0),e([V({type:it})],nt.prototype,"extent",null),e([V()],nt.prototype,"floors",void 0),e([V()],nt.prototype,"screenCenter",null),e([V()],nt.prototype,"frustum",null),e([V({type:Number,readOnly:!0})],nt.prototype,"fullOpacity",void 0),e([V({readOnly:!0})],nt.prototype,"graphicsView",void 0),e([V({readOnly:!0})],nt.prototype,"analysisViewManager",void 0),e([V()],nt.prototype,"groundView",void 0),e([V({type:Boolean})],nt.prototype,"initialExtentRequired",null),e([V()],nt.prototype,"_defaultsFromMapSettings",null),e([V()],nt.prototype,"interacting",null),e([V()],nt.prototype,"stationary",null),e([V()],nt.prototype,"navigating",null),e([V()],nt.prototype,"map",void 0),e([V({readOnly:!0})],nt.prototype,"mapCoordsHelper",void 0),e([V()],nt.prototype,"padding",null),e([V({type:Oe,readOnly:!0})],nt.prototype,"pointsOfInterest",void 0),e([V({type:ue,readOnly:!0})],nt.prototype,"featureTiles",void 0),e([V()],nt.prototype,"_featureTreeDebugger",void 0),e([V({type:Boolean})],nt.prototype,"screenSizePerspectiveEnabled",void 0),e([V({constructOnly:!0})],nt.prototype,"deactivatedWebGLExtensions",void 0),e([V({constructOnly:!0})],nt.prototype,"debugWebGLExtensions",void 0),e([V({constructOnly:!0})],nt.prototype,"renderCanvas",void 0),e([V({constructOnly:!0})],nt.prototype,"state",void 0),e([V({readOnly:!0})],nt.prototype,"inputManager",void 0),e([V({readOnly:!0})],nt.prototype,"stateManager",void 0),e([V({type:["low","medium","high"]})],nt.prototype,"qualityProfile",null),e([V({type:Ce,get(){let e=this._get("qualitySettings");return e||(e=new Ce,ve.apply(this.qualityProfile,e)),e}})],nt.prototype,"qualitySettings",void 0),e([V()],nt.prototype,"slicePlane",null),e([V({readOnly:!0})],nt.prototype,"typeSpecificPreconditionsReady",null),e([V({readOnly:!0})],nt.prototype,"renderCoordsHelper",void 0),e([V({readOnly:!0})],nt.prototype,"sceneIntersectionHelper",void 0),e([V({type:Number,dependsOn:["scale","spatialReference"],readOnly:!0})],nt.prototype,"resolution",null),e([V({type:Number})],nt.prototype,"scale",null),e([V()],nt.prototype,"heightModelInfo",null),e([V()],nt.prototype,"spatialReference",void 0),e([V({type:Boolean,constructOnly:!0})],nt.prototype,"alphaCompositingEnabled",void 0),e([V({constructOnly:!0})],nt.prototype,"preserveDrawingBufferEnabled",void 0),e([V({type:Boolean})],nt.prototype,"supersampleScreenshotsEnabled",void 0),e([V({readOnly:!0})],nt.prototype,"type",void 0),e([V(),x((e=>e instanceof Ke?e:j(et,e)))],nt.prototype,"ui",void 0),e([V({type:Boolean,readOnly:!0,dependsOn:["graphicsView.updating","basemapView.updating","basemapTerrain.updating","layerViewManager.updating","layerViewManager.updatingRemaining","_resourceController.updating","_stage.updating","featureTiles.updating","pointsOfInterest.updating","environmentManager.updating","overlay.updating","updatingHandles.updating","featureTreeDebugger.updating","labeler.updating","deconflictor.updating","ready","stationary","inputManager.updating","toolViewManager.updating","analysisViewManager.updating","state.updating"]})],nt.prototype,"updating",null),e([V()],nt.prototype,"_updatingObjects",null),e([V()],nt.prototype,"_updatingObjectsWithProgress",null),e([V({type:Number,readOnly:!0,dependsOn:["updating"]})],nt.prototype,"updatingProgress",void 0),e([V({type:["global","local"]})],nt.prototype,"viewingMode",null),e([V({type:r})],nt.prototype,"viewpoint",null),e([V({type:Number})],nt.prototype,"zoom",null),e([V({type:be})],nt.prototype,"highlightOptions",void 0),nt=e([T("esri.views.SceneView")],nt),function(e){e[e.INCLUDE=0]="INCLUDE",e[e.EXCLUDE=1]="EXCLUDE"}(pt||(pt={}));const ht=E(),dt=C(),ct=W(),ut=nt;export{ut as default};
@@ -2,4 +2,4 @@
2
2
  All material copyright ESRI, All Rights Reserved, unless otherwise specified.
3
3
  See https://js.arcgis.com/4.27/esri/copyright.txt for details.
4
4
  */
5
- import{_ as t}from"../chunks/tslib.es6.js";import s from"../core/Error.js";import{EsriPromise as e}from"../core/Promise.js";import{isPromiseLike as r}from"../core/promiseUtils.js";import{property as i}from"../core/accessorSupport/decorators/property.js";import"../core/accessorSupport/ensureType.js";import"../core/arrayUtils.js";import"../core/has.js";import{subclass as o}from"../core/accessorSupport/decorators/subclass.js";let p=class extends e{constructor(t){super(t),this.state="running",this.target=null,this._dfd=null}initialize(){this.addResolvingPromise(new Promise(((t,s)=>this._dfd={resolve:t,reject:s})))}get done(){return"finished"===this.state||"stopped"===this.state}stop(){"stopped"!==this.state&&"finished"!==this.state&&(this._set("state","stopped"),this._dfd?.reject(new s("ViewAnimation stopped")))}finish(){"stopped"!==this.state&&"finished"!==this.state&&(this._set("state","finished"),this._dfd?.resolve())}update(t,s){s||(s=r(t)?"waiting-for-target":"running"),this._set("target",t),this._set("state",s)}};t([i({readOnly:!0})],p.prototype,"done",null),t([i({readOnly:!0,type:String})],p.prototype,"state",void 0),t([i()],p.prototype,"target",void 0),p=t([o("esri.views.ViewAnimation")],p),function(t){t.State={RUNNING:"running",STOPPED:"stopped",FINISHED:"finished",WAITING_FOR_TARGET:"waiting-for-target"}}(p||(p={}));const n=p;export{n as default};
5
+ import{_ as t}from"../chunks/tslib.es6.js";import s from"../core/Error.js";import{EsriPromise as e}from"../core/Promise.js";import{createResolver as r,isPromiseLike as o}from"../core/promiseUtils.js";import{property as i}from"../core/accessorSupport/decorators/property.js";import"../core/accessorSupport/ensureType.js";import"../core/arrayUtils.js";import"../core/has.js";import{subclass as p}from"../core/accessorSupport/decorators/subclass.js";let n=class extends e{constructor(t){super(t),this.state="running",this.target=null,this._resolver=null}initialize(){this._resolver=r(),this.addResolvingPromise(this._resolver.promise)}get done(){return"finished"===this.state||"stopped"===this.state}stop(){"stopped"!==this.state&&"finished"!==this.state&&(this._set("state","stopped"),this._resolver?.reject(new s("ViewAnimation stopped")))}finish(){"stopped"!==this.state&&"finished"!==this.state&&(this._set("state","finished"),this._resolver?.resolve())}update(t,s){s||(s=o(t)?"waiting-for-target":"running"),this._set("target",t),this._set("state",s)}};t([i({readOnly:!0})],n.prototype,"done",null),t([i({readOnly:!0,type:String})],n.prototype,"state",void 0),t([i()],n.prototype,"target",void 0),n=t([p("esri.views.ViewAnimation")],n),function(t){t.State={RUNNING:"running",STOPPED:"stopped",FINISHED:"finished",WAITING_FOR_TARGET:"waiting-for-target"}}(n||(n={}));const a=n;export{a as default};
@@ -2,4 +2,4 @@
2
2
  All material copyright ESRI, All Rights Reserved, unless otherwise specified.
3
3
  See https://js.arcgis.com/4.27/esri/copyright.txt for details.
4
4
  */
5
- import has from"../../core/has.js";import{destroyMaybe as e}from"../../core/maybe.js";import{eventKey as t}from"./keys.js";import{GamepadSource as n}from"./gamepad/GamepadSource.js";import{createScreenPointFromNativeEvent as i}from"../support/screenUtils.js";const o=has("edge"),a=has("chrome"),s=has("ff"),r=has("safari"),h="esri-view-surface",l={touchNone:`${h}--touch-none`,touchPan:`${h}--touch-pan`};class c{constructor(e,t){this._input=t,this._active={},this._callback=()=>{},this._activePointerCaptures=new Set,this._keyDownState=new Set,this._eventId=1,this._browserTouchPanningEnabled=!1,this._element=e,e.getAttribute("tabindex")||e.setAttribute("tabindex","0"),this._eventHandlers={"key-down":this._handleKey,"key-up":this._handleKey,"pointer-down":this._handlePointer,"pointer-move":this._handlePointerPreventDefault,"pointer-up":this._handlePointerPreventDefault,"pointer-enter":this._handlePointer,"pointer-leave":this._handlePointer,"pointer-cancel":this._handlePointer,"mouse-wheel":this._handleMouseWheel,"pointer-capture-lost":this._handlePointerCaptureLost},this._updateTouchAction(),this._element.addEventListener("keydown",this._preventAltKeyDefault),this._gamepadSource=new n(e,this._input),this._gamepadSource.onEvent=e=>this._callback("gamepad",e)}destroy(){this._callback=()=>{},this.activeEvents=null,this._activePointerCaptures.forEach((e=>{this._releasePointerCaptureSafe(e)})),this._gamepadSource=e(this._gamepadSource),this._activePointerCaptures=null,this._removeTouchAction(),this._element.removeEventListener("keydown",this._preventAltKeyDefault)}get browserTouchPanningEnabled(){return this._browserTouchPanningEnabled}set browserTouchPanningEnabled(e){this._browserTouchPanningEnabled=e,this._updateTouchAction(),this._updateTouchEventHandling()}set onEventReceived(e){this._callback=e}set activeEvents(e){for(const t in this._active)if(!e||!e.has(t)){const e=this._active[t];this._element.removeEventListener(u[t],e),delete this._active[t]}e&&e.forEach((e=>{if(!this._active[e]&&u[e]){const t=(this._eventHandlers[e]||this._handleDefault).bind(this,e);this._element.addEventListener(u[e],t),this._active[e]=t}})),this._gamepadSource.hasEventListeners=e?.has("gamepad")??!1}setPointerCapture(e,t){t?(this._element.setPointerCapture(e.pointerId),this._activePointerCaptures.add(e.pointerId)):(this._releasePointerCaptureSafe(e.pointerId),this._activePointerCaptures.delete(e.pointerId))}_updateTouchAction(){this._element.classList.remove(this._browserTouchPanningEnabled?l.touchNone:l.touchPan),this._element.classList.add(this._browserTouchPanningEnabled?l.touchPan:l.touchNone)}_updateTouchEventHandling(){this._browserTouchPanningEnabled?this._element.addEventListener("touchmove",this._preventMultiTouchPanning):this._element.removeEventListener("touchmove",this._preventMultiTouchPanning)}_removeTouchAction(){this._element.classList.remove(l.touchNone),this._element.classList.remove(l.touchPan),this._element.removeEventListener("touchmove",this._preventMultiTouchPanning)}_releasePointerCaptureSafe(e){try{if(this._element.hasPointerCapture&&!this._element.hasPointerCapture(e))return;this._element.releasePointerCapture(e)}catch(t){}}_updateNormalizedPointerLikeEvent(e,t){const n=i(this._element,e);return c.test.disableSubpixelCoordinates&&(n.x=Math.round(n.x),n.y=Math.round(n.y)),t.x=n.x,t.y=n.y,t}_handleKey(e,n){const i=t(n);i&&"key-up"===e&&this._keyDownState.delete(i);const o={native:n,key:i,repeat:!!i&&this._keyDownState.has(i)};i&&"key-down"===e&&this._keyDownState.add(o.key),this._callback(e,o)}_handlePointer(e,t){const n=this._updateNormalizedPointerLikeEvent(t,{native:t,x:0,y:0,pointerType:t.pointerType,button:t.button,buttons:t.buttons,eventId:this._eventId++});this._callback(e,n)}_handlePointerPreventDefault(e,t){const n=this._updateNormalizedPointerLikeEvent(t,{native:t,x:0,y:0,pointerType:t.pointerType,button:t.button,buttons:t.buttons,eventId:this._eventId++});t.preventDefault(),this._callback(e,n)}_handleMouseWheel(e,t){let n=t.deltaY;switch(t.deltaMode){case 0:o&&(n=n/document.documentElement.clientHeight*600);break;case 1:n*=30;break;case 2:n*=900}o?n*=.7:a||r?n*=.6:s&&(n*=1.375);const i=100,h=Math.abs(n);if(h>i){const e=.02;n=n/h*200/(1+Math.exp(-e*(h-i)))}const l=this._updateNormalizedPointerLikeEvent(t,{native:t,x:0,y:0,deltaY:n});this._callback(e,l)}_handlePointerCaptureLost(e,t){this._activePointerCaptures.delete(t.pointerId),this._handleDefault(e,t)}_handleDefault(e,t){const n={native:t};t.preventDefault(),this._callback(e,n)}_preventAltKeyDefault(e){"Alt"===e.key&&e.preventDefault()}_preventMultiTouchPanning(e){e.touches.length>1&&e.preventDefault()}}c.test={disableSubpixelCoordinates:!1};const u={"key-down":"keydown","key-up":"keyup","pointer-down":"pointerdown","pointer-up":"pointerup","pointer-move":"pointermove","mouse-wheel":"wheel","pointer-capture-got":"gotpointercapture","pointer-capture-lost":"lostpointercapture","context-menu":"contextmenu","pointer-enter":"pointerenter","pointer-leave":"pointerleave","pointer-cancel":"pointercancel",focus:"focus",blur:"blur"};export{c as BrowserEventSource};
5
+ import has from"../../core/has.js";import{destroyMaybe as e}from"../../core/maybe.js";import{eventKey as t}from"./keys.js";import{GamepadSource as n}from"./gamepad/GamepadSource.js";import{createScreenPointFromNativeEvent as i}from"../support/screenUtils.js";const o=has("edge"),a=has("chrome"),s=has("ff"),r=has("safari"),h="esri-view-surface",l={touchNone:`${h}--touch-none`,touchPan:`${h}--touch-pan`};class c{constructor(e,t){this._input=t,this._active={},this._callback=()=>{},this._activePointerCaptures=new Set,this._keyDownState=new Set,this._eventId=1,this._browserTouchPanningEnabled=!1,this._element=e,e.getAttribute("tabindex")||e.setAttribute("tabindex","0"),this._eventHandlers={"key-down":this._handleKey,"key-up":this._handleKey,"pointer-down":this._handlePointer,"pointer-move":this._handlePointerPreventDefault,"pointer-up":this._handlePointerPreventDefault,"pointer-enter":this._handlePointer,"pointer-leave":this._handlePointer,"pointer-cancel":this._handlePointer,"mouse-wheel":this._handleMouseWheel,"pointer-capture-lost":this._handlePointerCaptureLost},this._updateTouchAction(),this._element.addEventListener("keydown",this._preventAltKeyDefault),this._gamepadSource=new n(e,this._input),this._gamepadSource.onEvent=e=>this._callback("gamepad",e)}destroy(){this._callback=()=>{},this.activeEvents=null,this._activePointerCaptures.forEach((e=>{this._releasePointerCaptureSafe(e)})),this._gamepadSource=e(this._gamepadSource),this._activePointerCaptures=null,this._removeTouchAction(),this._element.removeEventListener("keydown",this._preventAltKeyDefault)}get browserTouchPanningEnabled(){return this._browserTouchPanningEnabled}set browserTouchPanningEnabled(e){this._browserTouchPanningEnabled=e,this._updateTouchAction(),this._updateTouchEventHandling()}set onEventReceived(e){this._callback=e}set activeEvents(e){for(const t in this._active)if(!e||!e.has(t)){const e=this._active[t];this._element.removeEventListener(u[t],e),delete this._active[t]}e&&e.forEach((e=>{if(!this._active[e]&&u[e]){const t=(this._eventHandlers[e]||this._handleDefault).bind(this,e);this._element.addEventListener(u[e],t),this._active[e]=t}})),this._gamepadSource.hasEventListeners=e?.has("gamepad")??!1}setPointerCapture(e,t){t?this._setPointerCatpureSafe(e.pointerId):(this._releasePointerCaptureSafe(e.pointerId),this._activePointerCaptures.delete(e.pointerId))}_updateTouchAction(){this._element.classList.remove(this._browserTouchPanningEnabled?l.touchNone:l.touchPan),this._element.classList.add(this._browserTouchPanningEnabled?l.touchPan:l.touchNone)}_updateTouchEventHandling(){this._browserTouchPanningEnabled?this._element.addEventListener("touchmove",this._preventMultiTouchPanning):this._element.removeEventListener("touchmove",this._preventMultiTouchPanning)}_removeTouchAction(){this._element.classList.remove(l.touchNone),this._element.classList.remove(l.touchPan),this._element.removeEventListener("touchmove",this._preventMultiTouchPanning)}_setPointerCatpureSafe(e){try{this._element.setPointerCapture(e),this._activePointerCaptures.add(e)}catch{}}_releasePointerCaptureSafe(e){try{if(this._element.hasPointerCapture&&!this._element.hasPointerCapture(e))return;this._element.releasePointerCapture(e)}catch(t){}}_updateNormalizedPointerLikeEvent(e,t){const n=i(this._element,e);return c.test.disableSubpixelCoordinates&&(n.x=Math.round(n.x),n.y=Math.round(n.y)),t.x=n.x,t.y=n.y,t}_handleKey(e,n){const i=t(n);i&&"key-up"===e&&this._keyDownState.delete(i);const o={native:n,key:i,repeat:!!i&&this._keyDownState.has(i)};i&&"key-down"===e&&this._keyDownState.add(o.key),this._callback(e,o)}_handlePointer(e,t){const n=this._updateNormalizedPointerLikeEvent(t,{native:t,x:0,y:0,pointerType:t.pointerType,button:t.button,buttons:t.buttons,eventId:this._eventId++});this._callback(e,n)}_handlePointerPreventDefault(e,t){const n=this._updateNormalizedPointerLikeEvent(t,{native:t,x:0,y:0,pointerType:t.pointerType,button:t.button,buttons:t.buttons,eventId:this._eventId++});t.preventDefault(),this._callback(e,n)}_handleMouseWheel(e,t){let n=t.deltaY;switch(t.deltaMode){case 0:o&&(n=n/document.documentElement.clientHeight*600);break;case 1:n*=30;break;case 2:n*=900}o?n*=.7:a||r?n*=.6:s&&(n*=1.375);const i=100,h=Math.abs(n);if(h>i){const e=.02;n=n/h*200/(1+Math.exp(-e*(h-i)))}const l=this._updateNormalizedPointerLikeEvent(t,{native:t,x:0,y:0,deltaY:n});this._callback(e,l)}_handlePointerCaptureLost(e,t){this._activePointerCaptures.delete(t.pointerId),this._handleDefault(e,t)}_handleDefault(e,t){const n={native:t};t.preventDefault(),this._callback(e,n)}_preventAltKeyDefault(e){"Alt"===e.key&&e.preventDefault()}_preventMultiTouchPanning(e){e.touches.length>1&&e.preventDefault()}}c.test={disableSubpixelCoordinates:!1};const u={"key-down":"keydown","key-up":"keyup","pointer-down":"pointerdown","pointer-up":"pointerup","pointer-move":"pointermove","mouse-wheel":"wheel","pointer-capture-got":"gotpointercapture","pointer-capture-lost":"lostpointercapture","context-menu":"contextmenu","pointer-enter":"pointerenter","pointer-leave":"pointerleave","pointer-cancel":"pointercancel",focus:"focus",blur:"blur"};export{c as BrowserEventSource};
@@ -2,4 +2,4 @@
2
2
  All material copyright ESRI, All Rights Reserved, unless otherwise specified.
3
3
  See https://js.arcgis.com/4.27/esri/copyright.txt for details.
4
4
  */
5
- import{_ as e}from"../../chunks/tslib.es6.js";import t from"../../core/Accessor.js";import r from"../../core/Logger.js";import{unwrapOrThrow as i}from"../../core/maybe.js";import n from"../../core/Queue.js";import{property as s}from"../../core/accessorSupport/decorators/property.js";import"../../core/accessorSupport/ensureType.js";import"../../core/arrayUtils.js";import"../../core/has.js";import{subclass as o}from"../../core/accessorSupport/decorators/subclass.js";import{PropertiesPool as a}from"../3d/support/PropertiesPool.js";import{primaryKey as l,isSystemModifier as h}from"./keys.js";import{LatestPointer as p}from"./handlers/LatestPointer.js";import{MultiTouch as d}from"./handlers/MultiTouch.js";let c=class extends t{constructor(e){super(e),this._pointerCaptures=new Map,this._nameToGroup={},this._handlers=[],this._handlersPriority=[],this._currentPropagation=null,this._updateDependenciesAfterPropagation=!1,this._sourceEvents=new Set,this._keyModifiers=new Set,this._activeKeyModifiers=new Set,this._stoppedPropagationEventIds=new Set,this.primaryKey=l,this._latestPointerType="mouse",this._propertiesPool=new a({latestPointerLocation:v},this),this.latestPointerLocation=null,this.test={timestamp:void 0,hasCurrentPropagation:()=>!!this._currentPropagation}}initialize(){this.eventSource.onEventReceived=this._onEventReceived.bind(this),this._installRecognizers()}destroy(){const e=Object.keys(this._nameToGroup);for(const t of e)this.uninstallHandlers(t);this.eventSource.destroy(),this._currentPropagation=null,this._propertiesPool.destroy()}get hasPendingInputs(){return this._handlers.some((e=>e.handler.hasPendingInputs))}get latestPointerType(){return this._latestPointerType}get multiTouchActive(){return this._multiTouchHandler.multiTouchActive}installHandlers(e,t,i=g.INTERNAL){if(this._nameToGroup[e])return void r.getLogger(this.declaredClass).error("There is already an InputHandler group registered under the name `"+e+"`");if(0===t.length)return void r.getLogger(this.declaredClass).error("Can't register a group of zero handlers");const n={name:e,handlers:t.map((e=>({handler:e,active:!0,removed:!1,priorityIndex:0,groupPriority:i,eventCallback:null,uninstallCallback:null})))};this._nameToGroup[e]=n;for(let r=n.handlers.length-1;r>=0;r--){const e=n.handlers[r];this._handlers.push(e),e.handler.onInstall({updateDependencies:()=>{this.updateDependencies()},emit:(t,r,i,n,s)=>{this._emitInputEvent(e.priorityIndex+1,t,r,i,s,n)},setPointerCapture:(t,r)=>{this._setPointerCapture(n,e,t,r)},setEventCallback:t=>{e.eventCallback=t},setUninstallCallback:t=>{e.uninstallCallback=t},refreshHasPendingInputs:()=>{this.notifyChange("hasPendingInputs")}})}this.updateDependencies()}uninstallHandlers(e){const t=this._nameToGroup[e];t?(t.handlers.forEach((e=>{e.removed=!0,e.uninstallCallback?.()})),delete this._nameToGroup[e],this._currentPropagation?this._currentPropagation.needsHandlerGarbageCollect=!0:this._garbageCollectRemovedHandlers()):r.getLogger(this.declaredClass).error("There is no InputHandler group registered under the name `"+e+"`")}hasHandlers(e){return void 0!==this._nameToGroup[e]}updateDependencies(){if(this._currentPropagation)return void(this._updateDependenciesAfterPropagation=!0);this._updateDependenciesAfterPropagation=!1;const e=new Set,t=new Set;this._handlersPriority=[];for(let r=this._handlers.length-1;r>=0;r--){const e=this._handlers[r];e.priorityIndex=r,this._handlersPriority.push(e)}this._handlersPriority=this._sortHandlersPriority(this._handlersPriority);for(let r=this._handlersPriority.length-1;r>=0;r--){const i=this._handlersPriority[r];i.priorityIndex=r;let n=i.handler.hasSideEffects;if(!n)for(const t of i.handler.outgoingEventTypes)if(e.has(t)){n=!0;break}if(n)for(const r of i.handler.incomingEventMatches){e.add(r.eventType);for(const e of r.keyModifiers)h(e)||t.add(e)}i.active=n}this._sourceEvents=e,this._keyModifiers=t,this._pointerCaptures.size>0&&this._sourceEvents.add("pointer-capture-lost"),this._keyModifiers.size>0&&(this._sourceEvents.add("key-down"),this._sourceEvents.add("key-up")),this.eventSource&&(this.eventSource.activeEvents=this._sourceEvents)}_setLatestPointer(e,t,r){this._latestPointerType=e;const i=this._get("latestPointerLocation");if(null==i||i.x!==t||i.y!==r){const e=this._propertiesPool.get("latestPointerLocation");e.x=t,e.y=r,this._set("latestPointerLocation",e)}}_onEventReceived(e,t){if("pointer-capture-lost"===e){const e=t;this._pointerCaptures.delete(e.native.pointerId)}this._updateKeyModifiers(e,t);const r=null!=this.test.timestamp?this.test.timestamp:t.native?t.native.timestamp:void 0,i=t.native?t.native.cancelable:void 0;this._emitInputEventFromSource(e,t,r,i)}_updateKeyModifiers(e,t){if(!t)return;let r=!1;const i=()=>{if(!r){const e=new Set;this._activeKeyModifiers.forEach((t=>{e.add(t)})),this._activeKeyModifiers=e,r=!0}},n=(e,t)=>{t&&!this._activeKeyModifiers.has(e)?(i(),this._activeKeyModifiers.add(e)):!t&&this._activeKeyModifiers.has(e)&&(i(),this._activeKeyModifiers.delete(e))};if("key-down"===e||"key-up"===e){const r=t.key;this._keyModifiers.has(r)&&n(r,"key-down"===e)}const s=t.native;n("Alt",!(!s||!s.altKey)),n("Ctrl",!(!s||!s.ctrlKey)),n("Shift",!(!s||!s.shiftKey)),n("Meta",!(!s||!s.metaKey)),n("Primary",this._activeKeyModifiers.has(this.primaryKey))}_installRecognizers(){this._latestPointerHandler=new p(((e,t,r)=>this._setLatestPointer(e,t,r))),this._multiTouchHandler=new d,this.installHandlers("input-manager-logic",[this._latestPointerHandler,this._multiTouchHandler],g.ALWAYS),this.recognizers.length>0&&this.installHandlers("default",this.recognizers,g.INTERNAL)}_setPointerCapture(e,t,r,i){const n=e.name+"-"+t.priorityIndex,s=this._pointerCaptures.get(r.pointerId)||new Set;this._pointerCaptures.set(r.pointerId,s),i?(s.add(n),1===s.size&&this.eventSource&&this.eventSource.setPointerCapture(r,!0)):s.has(n)&&(s.delete(n),0===s.size&&(this._pointerCaptures.delete(r.pointerId),this.eventSource&&this.eventSource.setPointerCapture(r,!1)))}_garbageCollectRemovedHandlers(){this._handlers=this._handlers.filter((e=>!e.removed)),this.updateDependencies()}_emitInputEventFromSource(e,t,r,i){this._emitInputEvent(0,e,t,r,i)}_emitInputEvent(e,t,r,i,n,s){const o=void 0!==i?i:this._currentPropagation?this._currentPropagation.timestamp:performance.now(),a=void 0!==n&&n,l={event:new u(t,r,o,s||this._activeKeyModifiers,a),priorityIndex:e};this._currentPropagation?this._currentPropagation.events.push(l):this._doNewPropagation(l)}_doNewPropagation(e){this._currentPropagation={events:new n,currentHandler:null,needsHandlerGarbageCollect:!1,timestamp:e.event.timestamp},this._currentPropagation.events.push(e),this._continuePropagation()}_continuePropagation(){const e=i(this._currentPropagation);for(;e.events.length>0;){const{event:t,priorityIndex:r}=e.events.pop(),i=t.data&&t.data.eventId;if(!(null!=i&&this._stoppedPropagationEventIds.has(i)))for(e.currentHandler=this._handlersPriority[r];e.currentHandler;){if(e.currentHandler.removed)e.needsHandlerGarbageCollect=!0;else{if(e.currentHandler.active&&!t.shouldStopPropagation()&&e.currentHandler.eventCallback?.(t),t.shouldStopPropagation()){null!=i&&this._stoppedPropagationEventIds.add(i);break}if(t.shouldPausePropagation((()=>this._continuePropagation())))return void this._pausePropagation({event:t,priorityIndex:e.currentHandler.priorityIndex+1})}e.currentHandler=this._handlersPriority[e.currentHandler.priorityIndex+1]}}e.needsHandlerGarbageCollect&&this._garbageCollectRemovedHandlers(),this.hasPendingInputs||this._stoppedPropagationEventIds.clear(),this._currentPropagation=null,this._updateDependenciesAfterPropagation&&this.updateDependencies()}_pausePropagation(e){const t=new n;t.push(e);const r=this._currentPropagation;if(r){for(;r.events.length;)t.push(r.events.pop());r.events=t,r.currentHandler=null}}_compareHandlerPriority(e,t){if(e.handler.hasSideEffects!==t.handler.hasSideEffects)return e.handler.hasSideEffects?1:-1;if(e.groupPriority!==t.groupPriority)return e.groupPriority>t.groupPriority?-1:1;for(const r of e.handler.incomingEventMatches)for(const e of t.handler.incomingEventMatches){if(r.eventType!==e.eventType)continue;const t=r.keyModifiers.filter((t=>e.keyModifiers.includes(t)));if(t.length===r.keyModifiers.length!==(t.length===e.keyModifiers.length))return r.keyModifiers.length>e.keyModifiers.length?-1:1}return e.priorityIndex>t.priorityIndex?-1:1}_sortHandlersPriority(e){const t=[];for(const r of e){let e=0;for(;e<t.length&&this._compareHandlerPriority(r,t[e])>=0;)e++;t.splice(e,0,r)}return t}get debug(){const e=e=>{const t=this._setPointerCapture;this._setPointerCapture=()=>{},e(),this._setPointerCapture=t};return{injectEvent:(t,r)=>{e((()=>{this._onEventReceived(t,r)}))},disablePointerCapture:e}}};e([s({readOnly:!0})],c.prototype,"hasPendingInputs",null),e([s({constructOnly:!0})],c.prototype,"eventSource",void 0),e([s({constructOnly:!0})],c.prototype,"recognizers",void 0),e([s()],c.prototype,"_latestPointerType",void 0),e([s()],c.prototype,"latestPointerType",null),e([s()],c.prototype,"multiTouchActive",null),e([s({readOnly:!0})],c.prototype,"latestPointerLocation",void 0),c=e([o("esri.views.input.InputManager")],c);class u{constructor(e,t,r,i,n){this.type=e,this.data=t,this.timestamp=r,this.modifiers=i,this.cancelable=n,this._propagationState=_.NONE,this._resumeCallback=null}stopPropagation(){this._propagationState|=_.STOPPED}shouldStopPropagation(){return 0!=(this._propagationState&_.STOPPED)}async(e){this._propagationState|=_.PAUSED;const t=(e,t)=>{this._propagationState&=~_.PAUSED;const r=this._resumeCallback;if(this._resumeCallback=null,r&&r(),t)throw e;return e};return("function"==typeof e?e():e).then((e=>t(e,!1)),(e=>t(e,!0)))}shouldPausePropagation(e){return!!(this._propagationState&_.PAUSED)&&(this._resumeCallback=e,!0)}preventDefault(){this.data.native.preventDefault()}}var _;!function(e){e[e.NONE=0]="NONE",e[e.STOPPED=1]="STOPPED",e[e.PAUSED=2]="PAUSED"}(_||(_={}));const g={ALWAYS:1,DEFAULT:0,TOOL:-1,WIDGET:-2,INTERNAL:-3};class P{}const v=P;export{c as InputManager,g as ViewEventPriorities};
5
+ import{_ as e}from"../../chunks/tslib.es6.js";import t from"../../core/Accessor.js";import r from"../../core/Logger.js";import i from"../../core/Queue.js";import{property as n}from"../../core/accessorSupport/decorators/property.js";import"../../core/accessorSupport/ensureType.js";import"../../core/arrayUtils.js";import"../../core/has.js";import{subclass as s}from"../../core/accessorSupport/decorators/subclass.js";import{PropertiesPool as o}from"../3d/support/PropertiesPool.js";import{primaryKey as a,isSystemModifier as l}from"./keys.js";import{LatestPointer as p}from"./handlers/LatestPointer.js";import{MultiTouch as h}from"./handlers/MultiTouch.js";let d=class extends t{constructor(e){super(e),this._pointerCaptures=new Map,this._nameToGroup={},this._handlers=[],this._handlersPriority=[],this._currentPropagation=null,this._updateDependenciesAfterPropagation=!1,this._sourceEvents=new Set,this._keyModifiers=new Set,this._activeKeyModifiers=new Set,this._stoppedPropagationEventIds=new Set,this.primaryKey=a,this._latestPointerType="mouse",this._propertiesPool=new o({latestPointerLocation:P},this),this.latestPointerLocation=null,this._paused=!1,this.test={timestamp:void 0,hasCurrentPropagation:()=>!!this._currentPropagation}}initialize(){this.eventSource.onEventReceived=this._onEventReceived.bind(this),this._installRecognizers()}destroy(){const e=Object.keys(this._nameToGroup);for(const t of e)this.uninstallHandlers(t);this.eventSource.destroy(),this._currentPropagation=null,this._propertiesPool.destroy()}get hasPendingInputs(){return this._handlers.some((e=>e.handler.hasPendingInputs))}get latestPointerType(){return this._latestPointerType}get multiTouchActive(){return this._multiTouchHandler.multiTouchActive}get updating(){return this.hasPendingInputs||this._paused}installHandlers(e,t,i=_.INTERNAL){if(this._nameToGroup[e])return void r.getLogger(this.declaredClass).error("There is already an InputHandler group registered under the name `"+e+"`");if(0===t.length)return void r.getLogger(this.declaredClass).error("Can't register a group of zero handlers");const n={name:e,handlers:t.map((e=>({handler:e,active:!0,removed:!1,priorityIndex:0,groupPriority:i,eventCallback:null,uninstallCallback:null})))};this._nameToGroup[e]=n;for(let r=n.handlers.length-1;r>=0;r--){const e=n.handlers[r];this._handlers.push(e),e.handler.onInstall({updateDependencies:()=>{this.updateDependencies()},emit:(t,r,i,n,s)=>{this._emitInputEvent(e.priorityIndex+1,t,r,i,s,n)},setPointerCapture:(t,r)=>{this._setPointerCapture(n,e,t,r)},setEventCallback:t=>{e.eventCallback=t},setUninstallCallback:t=>{e.uninstallCallback=t},refreshHasPendingInputs:()=>{this.notifyChange("hasPendingInputs")}})}this.updateDependencies()}uninstallHandlers(e){const t=this._nameToGroup[e];t?(t.handlers.forEach((e=>{e.removed=!0,e.uninstallCallback?.()})),delete this._nameToGroup[e],this._currentPropagation?this._currentPropagation.needsHandlerGarbageCollect=!0:this._garbageCollectRemovedHandlers()):r.getLogger(this.declaredClass).error("There is no InputHandler group registered under the name `"+e+"`")}hasHandlers(e){return void 0!==this._nameToGroup[e]}updateDependencies(){if(this._currentPropagation)return void(this._updateDependenciesAfterPropagation=!0);this._updateDependenciesAfterPropagation=!1;const e=new Set,t=new Set;this._handlersPriority=[];for(let r=this._handlers.length-1;r>=0;r--){const e=this._handlers[r];e.priorityIndex=r,this._handlersPriority.push(e)}this._handlersPriority=this._sortHandlersPriority(this._handlersPriority);for(let r=this._handlersPriority.length-1;r>=0;r--){const i=this._handlersPriority[r];i.priorityIndex=r;let n=i.handler.hasSideEffects;if(!n)for(const t of i.handler.outgoingEventTypes)if(e.has(t)){n=!0;break}if(n)for(const r of i.handler.incomingEventMatches){e.add(r.eventType);for(const e of r.keyModifiers)l(e)||t.add(e)}i.active=n}this._sourceEvents=e,this._keyModifiers=t,this._pointerCaptures.size>0&&this._sourceEvents.add("pointer-capture-lost"),this._keyModifiers.size>0&&(this._sourceEvents.add("key-down"),this._sourceEvents.add("key-up")),this.eventSource&&(this.eventSource.activeEvents=this._sourceEvents)}_setLatestPointer(e,t,r){this._latestPointerType=e;const i=this._get("latestPointerLocation");if(null==i||i.x!==t||i.y!==r){const e=this._propertiesPool.get("latestPointerLocation");e.x=t,e.y=r,this._set("latestPointerLocation",e)}}_onEventReceived(e,t){if("pointer-capture-lost"===e){const e=t;this._pointerCaptures.delete(e.native.pointerId)}this._updateKeyModifiers(e,t);const r=null!=this.test.timestamp?this.test.timestamp:t.native?t.native.timestamp:void 0,i=t.native?t.native.cancelable:void 0;this._emitInputEventFromSource(e,t,r,i)}_updateKeyModifiers(e,t){if(!t)return;let r=!1;const i=()=>{if(!r){const e=new Set;this._activeKeyModifiers.forEach((t=>{e.add(t)})),this._activeKeyModifiers=e,r=!0}},n=(e,t)=>{t&&!this._activeKeyModifiers.has(e)?(i(),this._activeKeyModifiers.add(e)):!t&&this._activeKeyModifiers.has(e)&&(i(),this._activeKeyModifiers.delete(e))};if("key-down"===e||"key-up"===e){const r=t.key;this._keyModifiers.has(r)&&n(r,"key-down"===e)}const s=t.native;n("Alt",!(!s||!s.altKey)),n("Ctrl",!(!s||!s.ctrlKey)),n("Shift",!(!s||!s.shiftKey)),n("Meta",!(!s||!s.metaKey)),n("Primary",this._activeKeyModifiers.has(this.primaryKey))}_installRecognizers(){this._latestPointerHandler=new p(((e,t,r)=>this._setLatestPointer(e,t,r))),this._multiTouchHandler=new h,this.installHandlers("input-manager-logic",[this._latestPointerHandler,this._multiTouchHandler],_.ALWAYS),this.recognizers.length>0&&this.installHandlers("default",this.recognizers,_.INTERNAL)}_setPointerCapture(e,t,r,i){const n=e.name+"-"+t.priorityIndex,s=this._pointerCaptures.get(r.pointerId)||new Set;this._pointerCaptures.set(r.pointerId,s),i?(s.add(n),1===s.size&&this.eventSource&&this.eventSource.setPointerCapture(r,!0)):s.has(n)&&(s.delete(n),0===s.size&&(this._pointerCaptures.delete(r.pointerId),this.eventSource&&this.eventSource.setPointerCapture(r,!1)))}_garbageCollectRemovedHandlers(){this._handlers=this._handlers.filter((e=>!e.removed)),this.updateDependencies()}_emitInputEventFromSource(e,t,r,i){this._emitInputEvent(0,e,t,r,i)}_emitInputEvent(e,t,r,i,n,s){const o=void 0!==i?i:this._currentPropagation?this._currentPropagation.timestamp:performance.now(),a=void 0!==n&&n,l={event:new u(t,r,o,s||this._activeKeyModifiers,a),priorityIndex:e};this._currentPropagation?this._currentPropagation.events.push(l):this._doNewPropagation(l)}_doNewPropagation(e){this._currentPropagation={events:new i,currentHandler:null,needsHandlerGarbageCollect:!1,timestamp:e.event.timestamp},this._currentPropagation.events.push(e),this._continuePropagation()}_continuePropagation(){this._paused=!1;const e=this._currentPropagation;if(e){for(;e.events.length>0;){const{event:t,priorityIndex:r}=e.events.pop(),i=t.data&&t.data.eventId;if(!(null!=i&&this._stoppedPropagationEventIds.has(i)))for(e.currentHandler=this._handlersPriority[r];e.currentHandler;){if(e.currentHandler.removed)e.needsHandlerGarbageCollect=!0;else{if(e.currentHandler.active&&!t.shouldStopPropagation()&&e.currentHandler.eventCallback?.(t),t.shouldStopPropagation()){null!=i&&this._stoppedPropagationEventIds.add(i);break}if(t.shouldPausePropagation((()=>this._continuePropagation())))return void this._pausePropagation({event:t,priorityIndex:e.currentHandler.priorityIndex+1})}e.currentHandler=this._handlersPriority[e.currentHandler.priorityIndex+1]}}e.needsHandlerGarbageCollect&&this._garbageCollectRemovedHandlers(),this.hasPendingInputs||this._stoppedPropagationEventIds.clear(),this._currentPropagation=null,this._updateDependenciesAfterPropagation&&this.updateDependencies()}}_pausePropagation(e){const t=new i;t.push(e);const r=this._currentPropagation;if(r){for(;r.events.length;)t.push(r.events.pop());r.events=t,r.currentHandler=null,this._paused=!0}}_compareHandlerPriority(e,t){if(e.handler.hasSideEffects!==t.handler.hasSideEffects)return e.handler.hasSideEffects?1:-1;if(e.groupPriority!==t.groupPriority)return e.groupPriority>t.groupPriority?-1:1;for(const r of e.handler.incomingEventMatches)for(const e of t.handler.incomingEventMatches){if(r.eventType!==e.eventType)continue;const t=r.keyModifiers.filter((t=>e.keyModifiers.includes(t)));if(t.length===r.keyModifiers.length!==(t.length===e.keyModifiers.length))return r.keyModifiers.length>e.keyModifiers.length?-1:1}return e.priorityIndex>t.priorityIndex?-1:1}_sortHandlersPriority(e){const t=[];for(const r of e){let e=0;for(;e<t.length&&this._compareHandlerPriority(r,t[e])>=0;)e++;t.splice(e,0,r)}return t}get debug(){const e=e=>{const t=this._setPointerCapture;this._setPointerCapture=()=>{},e(),this._setPointerCapture=t};return{injectEvent:(t,r)=>{e((()=>{this._onEventReceived(t,r)}))},disablePointerCapture:e}}};e([n({readOnly:!0})],d.prototype,"hasPendingInputs",null),e([n({constructOnly:!0})],d.prototype,"eventSource",void 0),e([n({constructOnly:!0})],d.prototype,"recognizers",void 0),e([n()],d.prototype,"_latestPointerType",void 0),e([n()],d.prototype,"latestPointerType",null),e([n()],d.prototype,"multiTouchActive",null),e([n({readOnly:!0})],d.prototype,"latestPointerLocation",void 0),e([n()],d.prototype,"_paused",void 0),e([n({readOnly:!0})],d.prototype,"updating",null),d=e([s("esri.views.input.InputManager")],d);class u{constructor(e,t,r,i,n){this.type=e,this.data=t,this.timestamp=r,this.modifiers=i,this.cancelable=n,this._propagationState=c.NONE,this._resumeCallback=null}stopPropagation(){this._propagationState|=c.STOPPED}shouldStopPropagation(){return 0!=(this._propagationState&c.STOPPED)}async(e){this._propagationState|=c.PAUSED;const t=(e,t)=>{this._propagationState&=~c.PAUSED;const r=this._resumeCallback;if(this._resumeCallback=null,r&&r(),t)throw e;return e};return("function"==typeof e?e():e).then((e=>t(e,!1)),(e=>t(e,!0)))}shouldPausePropagation(e){return!!(this._propagationState&c.PAUSED)&&(this._resumeCallback=e,!0)}preventDefault(){this.data.native.preventDefault()}}var c;!function(e){e[e.NONE=0]="NONE",e[e.STOPPED=1]="STOPPED",e[e.PAUSED=2]="PAUSED"}(c||(c={}));const _={ALWAYS:1,DEFAULT:0,TOOL:-1,WIDGET:-2,INTERNAL:-3};class g{}const P=g;export{d as InputManager,_ as ViewEventPriorities};
@@ -2,4 +2,4 @@
2
2
  All material copyright ESRI, All Rights Reserved, unless otherwise specified.
3
3
  See https://js.arcgis.com/4.27/esri/copyright.txt for details.
4
4
  */
5
- import{l as e,d as t,c as r,o as a}from"../../chunks/vec2.js";import{a as n,f as i,b as s}from"../../chunks/vec2f64.js";import{s as o,h as u,i as c,c as h,F as p}from"../../chunks/vec3.js";import{c as v,f as y,g as l}from"../../chunks/vec3f64.js";import{l as d,c as f,h as T}from"../../chunks/vec4.js";import{c as Z,f as _,b as m}from"../../chunks/vec4f64.js";import g from"../../geometry/Point.js";var R;!function(e){e[e.Z=0]="Z",e[e.M=1]="M"}(R||(R={}));class x{constructor(e){this.spatialReference=e}createVector(){return this._tag(n())}pointToVector(e){return this._tag(i(e.x,e.y))}arrayToVector(e){return this._tag(i(e[0],e[1]))}vectorToArray(e){return[e[0],e[1]]}pointToArray(e){return[e.x,e.y]}vectorToPoint(e,t=new g){return t.x=e[0],t.y=e[1],t.z=void 0,t.m=void 0,t.spatialReference=this.spatialReference,t}arrayToPoint(e,t=new g){return t.x=e[0],t.y=e[1],t.z=void 0,t.m=void 0,t.spatialReference=this.spatialReference,t}vectorToDehydratedPoint(e,t={x:void 0,y:void 0,z:void 0,m:void 0,hasZ:void 0,hasM:void 0,spatialReference:void 0,type:"point"}){return t.x=e[0],t.y=e[1],t.z=void 0,t.m=void 0,t.hasZ=!1,t.hasM=!1,t.spatialReference=this.spatialReference,t}lerp(t,r,a,n){return e(n,t,r,a)}addDelta(e,t,r){e[0]+=t,e[1]+=r}distance(e,r){return t(e,r)}getZ(e,t=undefined){return t}hasZ(){return!1}getM(e,t=undefined){return t}hasM(){return!1}clone(e){return this._tag(s(e))}copy(e,t){return r(t,e)}fromXYZ(e){return this._tag(i(e[0],e[1]))}toXYZ(e,t=v()){return o(t,e[0],e[1],0)}pointToXYZ(e,t=v()){return o(t,e.x,e.y,0)}equals(e,t){return a(e,t)}_tag(e){return e}}class M{constructor(e,t){this._valueType=e,this.spatialReference=t}createVector(){return this._tag(v())}pointToVector(e){return this._tag(y(e.x,e.y,this._valueType===R.Z?e.z:e.m))}arrayToVector(e){return this._tag(y(e[0],e[1],e[2]||0))}vectorToArray(e){return[e[0],e[1],e[2]]}pointToArray(e){return this._valueType===R.Z?[e.x,e.y,e.z]:[e.x,e.y,e.m]}vectorToPoint(e,t=new g){return t.x=e[0],t.y=e[1],t.z=this._valueType===R.Z?e[2]:void 0,t.m=this._valueType===R.M?e[2]:void 0,t.spatialReference=this.spatialReference,t}arrayToPoint(e,t=new g){return t.x=e[0],t.y=e[1],t.z=this._valueType===R.Z?e[2]:void 0,t.m=this._valueType===R.M?e[2]:void 0,t.spatialReference=this.spatialReference,t}vectorToDehydratedPoint(e,t={x:void 0,y:void 0,z:void 0,m:void 0,hasZ:void 0,hasM:void 0,spatialReference:void 0,type:"point"}){const r=this._valueType===R.Z,a=this._valueType===R.M;return t.x=e[0],t.y=e[1],t.z=r?e[2]:void 0,t.m=a?e[2]:void 0,t.hasZ=r,t.hasM=a,t.spatialReference=this.spatialReference,t}lerp(e,t,r,a){return u(a,e,t,r)}addDelta(e,t,r,a){e[0]+=t,e[1]+=r,this._valueType===R.Z&&(e[2]+=a)}distance(e,r){return this._valueType===R.Z?c(e,r):t(e,r)}getZ(e,t=undefined){return this._valueType===R.Z?e[2]:t}hasZ(){return this._valueType===R.Z}getM(e,t=undefined){return this._valueType===R.M?e[2]:t}hasM(){return this._valueType===R.M}clone(e){return this._tag(l(e))}copy(e,t){return h(t,e)}fromXYZ(e,t=0,r=0){return this._tag(y(e[0],e[1],this._valueType===R.Z?e.length>2?e[2]:t:r))}toXYZ(e,t=v()){return o(t,e[0],e[1],this._valueType===R.Z?e[2]:0)}pointToXYZ(e,t=v()){return o(t,e.x,e.y,this._valueType===R.Z?e.z??0:0)}equals(e,t){return p(e,t)}_tag(e){return e}}class z{constructor(e){this.spatialReference=e}createVector(){return this._tag(Z())}pointToVector(e){return this._tag(_(e.x,e.y,e.z,e.m))}arrayToVector(e){return this._tag(_(e[0],e[1],e[2]||0,e[3]||0))}vectorToArray(e){return[e[0],e[1],e[2],e[3]]}pointToArray(e){return[e.x,e.y,e.z,e.m]}vectorToPoint(e,t=new g){return t.x=e[0],t.y=e[1],t.z=e[2],t.m=e[3],t.spatialReference=this.spatialReference,t}arrayToPoint(e,t=new g){return t.x=e[0],t.y=e[1],t.z=e[2],t.m=e[3],t.spatialReference=this.spatialReference,t}vectorToDehydratedPoint(e,t={x:void 0,y:void 0,z:void 0,m:void 0,hasZ:void 0,hasM:void 0,spatialReference:void 0,type:"point"}){return t.x=e[0],t.y=e[1],t.z=e[2],t.m=e[3],t.hasZ=!0,t.hasM=!0,t.spatialReference=this.spatialReference,t}lerp(e,t,r,a){return d(a,e,t,r)}addDelta(e,t,r,a){e[0]+=t,e[1]+=r,e[2]+=a}distance(e,t){return c(e,t)}getZ(e){return e[2]}hasZ(){return!0}getM(e){return e[3]}hasM(){return!0}clone(e){return this._tag(m(e))}copy(e,t){return f(t,e)}fromXYZ(e,t=0,r=0){return this._tag(_(e[0],e[1],e.length>2?e[2]:t,r))}toXYZ(e,t=v()){return o(t,e[0],e[1],e[2])}pointToXYZ(e,t=v()){return o(t,e.x,e.y,e.z??0)}equals(e,t){return T(e,t)}_tag(e){return e}}function w(e,t,r){return e&&t?new z(r):t?new M(R.M,r):e?new M(R.Z,r):new x(r)}export{x as CoordinateHelper2D,M as CoordinateHelper3D,z as CoordinateHelper4D,w as createCoordinateHelper};
5
+ import{l as e,d as t,c as r,o as a}from"../../chunks/vec2.js";import{a as n,f as i,b as o}from"../../chunks/vec2f64.js";import{s,h as u,i as c,c as h,F as p}from"../../chunks/vec3.js";import{c as v,f as y,g as l}from"../../chunks/vec3f64.js";import{l as d,c as f,h as T}from"../../chunks/vec4.js";import{c as Z,f as _,b as m}from"../../chunks/vec4f64.js";import g from"../../geometry/Point.js";var R;!function(e){e[e.Z=0]="Z",e[e.M=1]="M"}(R||(R={}));class x{constructor(e){this.spatialReference=e}createVector(){return this._tag(n())}pointToVector(e){return this._tag(i(e.x,e.y))}arrayToVector(e){return this._tag(i(e[0],e[1]))}vectorToArray(e){return[e[0],e[1]]}pointToArray(e){return[e.x,e.y]}vectorToPoint(e,t=new g){return t.x=e[0],t.y=e[1],t.z=void 0,t.m=void 0,t.spatialReference=this.spatialReference,t}arrayToPoint(e,t=new g){return t.x=e[0],t.y=e[1],t.z=void 0,t.m=void 0,t.spatialReference=this.spatialReference,t}vectorToDehydratedPoint(e,t={x:void 0,y:void 0,z:void 0,m:void 0,hasZ:void 0,hasM:void 0,spatialReference:void 0,type:"point"}){return t.x=e[0],t.y=e[1],t.z=void 0,t.m=void 0,t.hasZ=!1,t.hasM=!1,t.spatialReference=this.spatialReference,t}lerp(t,r,a,n){return e(n,t,r,a)}addDelta(e,t,r){e[0]+=t,e[1]+=r}distance(e,r){return t(e,r)}getZ(e,t=void 0){return t}hasZ(){return!1}getM(e,t=void 0){return t}hasM(){return!1}clone(e){return this._tag(o(e))}copy(e,t){return r(t,e)}fromXYZ(e){return this._tag(i(e[0],e[1]))}toXYZ(e,t=v()){return s(t,e[0],e[1],0)}pointToXYZ(e,t=v()){return s(t,e.x,e.y,0)}equals(e,t){return a(e,t)}_tag(e){return e}}class M{constructor(e,t){this._valueType=e,this.spatialReference=t}createVector(){return this._tag(v())}pointToVector(e){return this._tag(y(e.x,e.y,this._valueType===R.Z?e.z:e.m))}arrayToVector(e){return this._tag(y(e[0],e[1],e[2]||0))}vectorToArray(e){return[e[0],e[1],e[2]]}pointToArray(e){return this._valueType===R.Z?[e.x,e.y,e.z]:[e.x,e.y,e.m]}vectorToPoint(e,t=new g){return t.x=e[0],t.y=e[1],t.z=this._valueType===R.Z?e[2]:void 0,t.m=this._valueType===R.M?e[2]:void 0,t.spatialReference=this.spatialReference,t}arrayToPoint(e,t=new g){return t.x=e[0],t.y=e[1],t.z=this._valueType===R.Z?e[2]:void 0,t.m=this._valueType===R.M?e[2]:void 0,t.spatialReference=this.spatialReference,t}vectorToDehydratedPoint(e,t={x:void 0,y:void 0,z:void 0,m:void 0,hasZ:void 0,hasM:void 0,spatialReference:void 0,type:"point"}){const r=this._valueType===R.Z,a=this._valueType===R.M;return t.x=e[0],t.y=e[1],t.z=r?e[2]:void 0,t.m=a?e[2]:void 0,t.hasZ=r,t.hasM=a,t.spatialReference=this.spatialReference,t}lerp(e,t,r,a){return u(a,e,t,r)}addDelta(e,t,r,a){e[0]+=t,e[1]+=r,this._valueType===R.Z&&(e[2]+=a)}distance(e,r){return this._valueType===R.Z?c(e,r):t(e,r)}getZ(e,t=void 0){return this._valueType===R.Z?e[2]:t}hasZ(){return this._valueType===R.Z}getM(e,t=void 0){return this._valueType===R.M?e[2]:t}hasM(){return this._valueType===R.M}clone(e){return this._tag(l(e))}copy(e,t){return h(t,e)}fromXYZ(e,t=0,r=0){return this._tag(y(e[0],e[1],this._valueType===R.Z?e.length>2?e[2]:t:r))}toXYZ(e,t=v()){return s(t,e[0],e[1],this._valueType===R.Z?e[2]:0)}pointToXYZ(e,t=v()){return s(t,e.x,e.y,this._valueType===R.Z?e.z??0:0)}equals(e,t){return p(e,t)}_tag(e){return e}}class z{constructor(e){this.spatialReference=e}createVector(){return this._tag(Z())}pointToVector(e){return this._tag(_(e.x,e.y,e.z,e.m))}arrayToVector(e){return this._tag(_(e[0],e[1],e[2]||0,e[3]||0))}vectorToArray(e){return[e[0],e[1],e[2],e[3]]}pointToArray(e){return[e.x,e.y,e.z,e.m]}vectorToPoint(e,t=new g){return t.x=e[0],t.y=e[1],t.z=e[2],t.m=e[3],t.spatialReference=this.spatialReference,t}arrayToPoint(e,t=new g){return t.x=e[0],t.y=e[1],t.z=e[2],t.m=e[3],t.spatialReference=this.spatialReference,t}vectorToDehydratedPoint(e,t={x:void 0,y:void 0,z:void 0,m:void 0,hasZ:void 0,hasM:void 0,spatialReference:void 0,type:"point"}){return t.x=e[0],t.y=e[1],t.z=e[2],t.m=e[3],t.hasZ=!0,t.hasM=!0,t.spatialReference=this.spatialReference,t}lerp(e,t,r,a){return d(a,e,t,r)}addDelta(e,t,r,a){e[0]+=t,e[1]+=r,e[2]+=a}distance(e,t){return c(e,t)}getZ(e){return e[2]}hasZ(){return!0}getM(e){return e[3]}hasM(){return!0}clone(e){return this._tag(m(e))}copy(e,t){return f(t,e)}fromXYZ(e,t=0,r=0){return this._tag(_(e[0],e[1],e.length>2?e[2]:t,r))}toXYZ(e,t=v()){return s(t,e[0],e[1],e[2])}pointToXYZ(e,t=v()){return s(t,e.x,e.y,e.z??0)}equals(e,t){return T(e,t)}_tag(e){return e}}function w(e,t,r){return e&&t?new z(r):t?new M(R.M,r):e?new M(R.Z,r):new x(r)}export{x as CoordinateHelper2D,M as CoordinateHelper3D,z as CoordinateHelper4D,w as createCoordinateHelper};
@@ -2,4 +2,4 @@
2
2
  All material copyright ESRI, All Rights Reserved, unless otherwise specified.
3
3
  See https://js.arcgis.com/4.27/esri/copyright.txt for details.
4
4
  */
5
- import{_ as e}from"../../../../../chunks/tslib.es6.js";import t from"../../../../../core/Evented.js";import i from"../../../../../core/Handles.js";import{createDeferred as s,throwIfAborted as r}from"../../../../../core/promiseUtils.js";import{watch as n,whenOnce as a,sync as o}from"../../../../../core/reactiveUtils.js";import{property as l}from"../../../../../core/accessorSupport/decorators/property.js";import"../../../../../core/accessorSupport/ensureType.js";import"../../../../../core/arrayUtils.js";import"../../../../../core/has.js";import{subclass as d}from"../../../../../core/accessorSupport/decorators/subclass.js";import{WatchUpdatingTracking as p}from"../../../../../core/support/WatchUpdatingTracking.js";import u from"../../../../../geometry/SpatialReference.js";import c from"../../../../../layers/graphics/data/FeatureStore.js";import{QueryEngine as h}from"../../../../../layers/graphics/data/QueryEngine.js";import f from"../../../../../layers/support/TileInfo.js";import g from"../../../../../rest/support/Query.js";import m from"../../../../../symbols/support/ElevationInfo.js";import{getSnappingCandidateElevationAligner as y}from"../snappingCandidateElevationAlignment.js";import{getSnappingCandidateElevationFilter as _}from"../snappingCandidateElevationFilter.js";import{getSymbologySnappingCandidatesFetcher as S}from"../symbologySnappingCandidates.js";import{FeatureServiceTiledFetcher as v}from"./FeatureServiceTiledFetcher.js";import{FeatureServiceTileStore as F}from"./FeatureServiceTileStore.js";let I=class extends t.EventedAccessor{constructor(){super(...arguments),this._isInitializing=!0,this.remoteClient=null,this._whenSetup=s(),this._elevationAligner=y(),this._elevationFilter=_(),this._symbologyCandidatesFetcher=S(),this._handles=new i,this._updatingHandles=new p,this._editsUpdatingHandles=new p,this._pendingApplyEdits=new Map,this._alignPointsInFeatures=async(e,t)=>{const i={points:e},s=await this.remoteClient.invoke("alignElevation",i,{signal:t});return r(t),s},this._getSymbologyCandidates=async(e,t)=>{const i={candidates:e,spatialReference:this._spatialReference.toJSON()},s=await this.remoteClient.invoke("getSymbologyCandidates",i,{signal:t});return r(t),s}}get updating(){return this.updatingExcludingEdits||this._editsUpdatingHandles.updating||this._featureFetcher.updating}get updatingExcludingEdits(){return this._featureFetcher.updatingExcludingEdits||this._isInitializing||this._updatingHandles.updating}destroy(){this._featureFetcher?.destroy(),this._queryEngine?.destroy(),this._featureStore?.clear(),this._handles?.destroy()}async setup(e){if(this.destroyed)return{result:{}};const{geometryType:t,objectIdField:i,timeInfo:s,fields:r}=e.serviceInfo,{hasZ:a}=e,l=u.fromJSON(e.spatialReference);this._spatialReference=l,this._featureStore=new c({...e.serviceInfo,hasZ:a,hasM:!1}),this._queryEngine=new h({spatialReference:e.spatialReference,featureStore:this._featureStore,geometryType:t,fields:r,hasZ:a,hasM:!1,objectIdField:i,timeInfo:s}),this._featureFetcher=new v({store:new F({featureStore:this._featureStore}),url:e.serviceInfo.url,objectIdField:e.serviceInfo.objectIdField,globalIdField:e.serviceInfo.globalIdField,capabilities:e.serviceInfo.capabilities,spatialReference:l,sourceSpatialReference:u.fromJSON(e.serviceInfo.spatialReference)});const d="3d"===e.configuration.viewType;return this._elevationAligner=y(d,{elevationInfo:null!=e.elevationInfo?m.fromJSON(e.elevationInfo):null,alignPointsInFeatures:this._alignPointsInFeatures,spatialReference:l}),this._elevationFilter=_(d),this._handles.add([n((()=>this._featureFetcher.availability),(e=>this.emit("notify-availability",{availability:e})),o),n((()=>this.updating),(()=>this._notifyUpdating()))]),this._whenSetup.resolve(),this._isInitializing=!1,this.configure(e.configuration)}async configure(e){return await this._updatingHandles.addPromise(this._whenSetup.promise),this._updateFeatureFetcherConfiguration(e),{result:{}}}async fetchCandidates(e,t){await this._whenSetup.promise,r(t);const i=b(e),s=null!=t?t.signal:null,n=await this._queryEngine.executeQueryForSnapping(i,s);r(s);const a=await this._elevationAligner.alignCandidates(n.candidates,s);r(s);const o=await this._symbologyCandidatesFetcher.fetch(a,s);r(s);const l=0===o.length?a:a.concat(o);return{result:{candidates:this._elevationFilter.filter(i,l)}}}async updateTiles(e,t){return await this._updatingHandles.addPromise(this._whenSetup.promise),r(t),this._featureFetcher.tileSize=e.tileSize,this._featureFetcher.tilesOfInterest=e.tiles,this._featureFetcher.tileInfo=null!=e.tileInfo?f.fromJSON(e.tileInfo):null,E}async refresh(e,t){return await this._updatingHandles.addPromise(this._whenSetup.promise),r(t),this._featureFetcher.refresh(),E}async whenNotUpdating(e,t){return await this._updatingHandles.addPromise(this._whenSetup.promise),r(t),await a((()=>!this.updatingExcludingEdits),t),r(t),E}async getDebugInfo(e,t){return r(t),{result:this._featureFetcher.debugInfo}}async beginApplyEdits(e,t){this._updatingHandles.addPromise(this._whenSetup.promise),r(t);const i=s();return this._pendingApplyEdits.set(e.id,i),this._featureFetcher.applyEdits(i.promise),this._editsUpdatingHandles.addPromise(i.promise),E}async endApplyEdits(e,t){const i=this._pendingApplyEdits.get(e.id);return i&&i.resolve(e.edits),r(t),E}async notifyElevationSourceChange(e,t){return this._elevationAligner.notifyElevationSourceChange(),E}async notifySymbologyChange(e,t){return this._symbologyCandidatesFetcher.notifySymbologyChange(),E}async setSymbologySnappingSupported(e){return this._symbologyCandidatesFetcher=S(e,this._getSymbologyCandidates),E}_updateFeatureFetcherConfiguration(e){this._featureFetcher.filter=null!=e.filter?g.fromJSON(e.filter):null,this._featureFetcher.customParameters=e.customParameters}_notifyUpdating(){this.emit("notify-updating",{updating:this.updating})}};e([l({readOnly:!0})],I.prototype,"updating",null),e([l({readOnly:!0})],I.prototype,"updatingExcludingEdits",null),e([l()],I.prototype,"_isInitializing",void 0),I=e([d("esri.views.interactive.snapping.featureSources.featureServiceSource.FeatureServiceSnappingSourceWorker")],I);const w=I;function b(e){return{point:e.point,mode:e.mode,distance:e.distance,types:e.types,query:null!=e.filter?e.filter:{where:"1=1"}}}const E={result:{}};export{w as default};
5
+ import{_ as e}from"../../../../../chunks/tslib.es6.js";import t from"../../../../../core/Evented.js";import i from"../../../../../core/Handles.js";import{createResolver as s,throwIfAborted as r}from"../../../../../core/promiseUtils.js";import{watch as n,whenOnce as a,sync as o}from"../../../../../core/reactiveUtils.js";import{property as l}from"../../../../../core/accessorSupport/decorators/property.js";import"../../../../../core/accessorSupport/ensureType.js";import"../../../../../core/arrayUtils.js";import"../../../../../core/has.js";import{subclass as d}from"../../../../../core/accessorSupport/decorators/subclass.js";import{WatchUpdatingTracking as p}from"../../../../../core/support/WatchUpdatingTracking.js";import u from"../../../../../geometry/SpatialReference.js";import c from"../../../../../layers/graphics/data/FeatureStore.js";import{QueryEngine as h}from"../../../../../layers/graphics/data/QueryEngine.js";import f from"../../../../../layers/support/TileInfo.js";import g from"../../../../../rest/support/Query.js";import m from"../../../../../symbols/support/ElevationInfo.js";import{getSnappingCandidateElevationAligner as y}from"../snappingCandidateElevationAlignment.js";import{getSnappingCandidateElevationFilter as _}from"../snappingCandidateElevationFilter.js";import{getSymbologySnappingCandidatesFetcher as S}from"../symbologySnappingCandidates.js";import{FeatureServiceTiledFetcher as v}from"./FeatureServiceTiledFetcher.js";import{FeatureServiceTileStore as F}from"./FeatureServiceTileStore.js";let I=class extends t.EventedAccessor{constructor(){super(...arguments),this._isInitializing=!0,this.remoteClient=null,this._whenSetup=s(),this._elevationAligner=y(),this._elevationFilter=_(),this._symbologyCandidatesFetcher=S(),this._handles=new i,this._updatingHandles=new p,this._editsUpdatingHandles=new p,this._pendingApplyEdits=new Map,this._alignPointsInFeatures=async(e,t)=>{const i={points:e},s=await this.remoteClient.invoke("alignElevation",i,{signal:t});return r(t),s},this._getSymbologyCandidates=async(e,t)=>{const i={candidates:e,spatialReference:this._spatialReference.toJSON()},s=await this.remoteClient.invoke("getSymbologyCandidates",i,{signal:t});return r(t),s}}get updating(){return this.updatingExcludingEdits||this._editsUpdatingHandles.updating||this._featureFetcher.updating}get updatingExcludingEdits(){return this._featureFetcher.updatingExcludingEdits||this._isInitializing||this._updatingHandles.updating}destroy(){this._featureFetcher?.destroy(),this._queryEngine?.destroy(),this._featureStore?.clear(),this._handles?.destroy()}async setup(e){if(this.destroyed)return{result:{}};const{geometryType:t,objectIdField:i,timeInfo:s,fields:r}=e.serviceInfo,{hasZ:a}=e,l=u.fromJSON(e.spatialReference);this._spatialReference=l,this._featureStore=new c({...e.serviceInfo,hasZ:a,hasM:!1}),this._queryEngine=new h({spatialReference:e.spatialReference,featureStore:this._featureStore,geometryType:t,fields:r,hasZ:a,hasM:!1,objectIdField:i,timeInfo:s}),this._featureFetcher=new v({store:new F({featureStore:this._featureStore}),url:e.serviceInfo.url,objectIdField:e.serviceInfo.objectIdField,globalIdField:e.serviceInfo.globalIdField,capabilities:e.serviceInfo.capabilities,spatialReference:l,sourceSpatialReference:u.fromJSON(e.serviceInfo.spatialReference)});const d="3d"===e.configuration.viewType;return this._elevationAligner=y(d,{elevationInfo:null!=e.elevationInfo?m.fromJSON(e.elevationInfo):null,alignPointsInFeatures:this._alignPointsInFeatures,spatialReference:l}),this._elevationFilter=_(d),this._handles.add([n((()=>this._featureFetcher.availability),(e=>this.emit("notify-availability",{availability:e})),o),n((()=>this.updating),(()=>this._notifyUpdating()))]),this._whenSetup.resolve(),this._isInitializing=!1,this.configure(e.configuration)}async configure(e){return await this._updatingHandles.addPromise(this._whenSetup.promise),this._updateFeatureFetcherConfiguration(e),{result:{}}}async fetchCandidates(e,t){await this._whenSetup.promise,r(t);const i=b(e),s=null!=t?t.signal:null,n=await this._queryEngine.executeQueryForSnapping(i,s);r(s);const a=await this._elevationAligner.alignCandidates(n.candidates,s);r(s);const o=await this._symbologyCandidatesFetcher.fetch(a,s);r(s);const l=0===o.length?a:a.concat(o);return{result:{candidates:this._elevationFilter.filter(i,l)}}}async updateTiles(e,t){return await this._updatingHandles.addPromise(this._whenSetup.promise),r(t),this._featureFetcher.tileSize=e.tileSize,this._featureFetcher.tilesOfInterest=e.tiles,this._featureFetcher.tileInfo=null!=e.tileInfo?f.fromJSON(e.tileInfo):null,E}async refresh(e,t){return await this._updatingHandles.addPromise(this._whenSetup.promise),r(t),this._featureFetcher.refresh(),E}async whenNotUpdating(e,t){return await this._updatingHandles.addPromise(this._whenSetup.promise),r(t),await a((()=>!this.updatingExcludingEdits),t),r(t),E}async getDebugInfo(e,t){return r(t),{result:this._featureFetcher.debugInfo}}async beginApplyEdits(e,t){this._updatingHandles.addPromise(this._whenSetup.promise),r(t);const i=s();return this._pendingApplyEdits.set(e.id,i),this._featureFetcher.applyEdits(i.promise),this._editsUpdatingHandles.addPromise(i.promise),E}async endApplyEdits(e,t){const i=this._pendingApplyEdits.get(e.id);return i&&i.resolve(e.edits),r(t),E}async notifyElevationSourceChange(e,t){return this._elevationAligner.notifyElevationSourceChange(),E}async notifySymbologyChange(e,t){return this._symbologyCandidatesFetcher.notifySymbologyChange(),E}async setSymbologySnappingSupported(e){return this._symbologyCandidatesFetcher=S(e,this._getSymbologyCandidates),E}_updateFeatureFetcherConfiguration(e){this._featureFetcher.filter=null!=e.filter?g.fromJSON(e.filter):null,this._featureFetcher.customParameters=e.customParameters}_notifyUpdating(){this.emit("notify-updating",{updating:this.updating})}};e([l({readOnly:!0})],I.prototype,"updating",null),e([l({readOnly:!0})],I.prototype,"updatingExcludingEdits",null),e([l()],I.prototype,"_isInitializing",void 0),I=e([d("esri.views.interactive.snapping.featureSources.featureServiceSource.FeatureServiceSnappingSourceWorker")],I);const w=I;function b(e){return{point:e.point,mode:e.mode,distance:e.distance,types:e.types,query:null!=e.filter?e.filter:{where:"1=1"}}}const E={result:{}};export{w as default};
@@ -2,4 +2,4 @@
2
2
  All material copyright ESRI, All Rights Reserved, unless otherwise specified.
3
3
  See https://js.arcgis.com/4.27/esri/copyright.txt for details.
4
4
  */
5
- import{removeMaybe as e}from"../../core/maybe.js";import{onAbort as s,onAbortOrThrow as t,createDeferred as r,isPromiseLike as i,createAbortError as h}from"../../core/promiseUtils.js";import o from"../../core/Queue.js";import{schedule as c}from"../../core/scheduling.js";class n{constructor(e,s){this.item=e,this.controller=s,this.promise=null}}class u{constructor(e){this._deferreds=new Map,this._controllers=new Map,this._processingItems=new Map,this._isPaused=!1,this._schedule=null,this._task=null,this.concurrency=1,e.concurrency&&(this.concurrency=e.concurrency),this._queue=new o(e.peeker),this.process=e.process;const s=e.scheduler;e.priority&&s&&(this._task=s.registerTask(e.priority,this))}destroy(){this.clear(),this._schedule=e(this._schedule),this._task=e(this._task)}get length(){return this._processingItems.size+this._queue.length}abort(e){const s=this._controllers.get(e);s&&s.abort()}clear(){this._queue.clear();const e=[];this._controllers.forEach((s=>e.push(s))),this._controllers.clear(),e.forEach((e=>e.abort())),this._processingItems.clear(),this._cancelNext()}forEach(e){this._deferreds.forEach(((s,t)=>e(t)))}get(e){const s=this._deferreds.get(e);return s?s.promise:void 0}isOngoing(e){return this._processingItems.has(e)}has(e){return this._deferreds.has(e)}pause(){this._isPaused||(this._isPaused=!0,this._cancelNext())}push(e,i){const o=this.get(e);if(o)return o;const c=new AbortController;let n=null;i&&(n=s(i,(()=>c.abort())));const u=()=>{const s=this._processingItems.get(e);s&&s.controller.abort(),l(),p.reject(h())},l=()=>{_.remove(),null!=n&&n.remove(),this._deferreds.delete(e),this._controllers.delete(e),this._queue.remove(e),this._processingItems.delete(e),this._scheduleNext()},_=t(c.signal,u),p=r();return this._deferreds.set(e,p),this._controllers.set(e,c),p.promise.then(l,l),this._queue.push(e),this._scheduleNext(),p.promise}last(){return this._queue.last()}peek(){return this._queue.peek()}popLast(){return this._queue.popLast()}reset(){const e=[];this._processingItems.forEach((s=>e.push(s))),this._processingItems.clear();for(const s of e)this._queue.push(s.item),s.controller.abort();this._scheduleNext()}resume(){this._isPaused&&(this._isPaused=!1,this._scheduleNext())}takeAll(){const e=[];for(;this._queue.length;)e.push(this._queue.pop());return this.clear(),e}get running(){return!this._isPaused&&this._queue.length>0&&this._processingItems.size<this.concurrency}runTask(e){for(;!e.done&&this._queue.length>0&&this._processingItems.size<this.concurrency;)this._process(this._queue.pop()),e.madeProgress()}_scheduleNext(){this._task||this._isPaused||this._schedule||(this._schedule=c((()=>{this._schedule=null,this._next()})))}_next(){for(;this._queue.length>0&&this._processingItems.size<this.concurrency;)this._process(this._queue.pop())}_cancelNext(){this._schedule&&(this._schedule.remove(),this._schedule=null)}_processResult(e,s){this._canProcessFulfillment(e)&&(this._scheduleNext(),this._deferreds.get(e.item).resolve(s))}_processError(e,s){this._canProcessFulfillment(e)&&(this._scheduleNext(),this._deferreds.get(e.item).reject(s))}_canProcessFulfillment(e){return!!this._deferreds.get(e.item)&&this._processingItems.get(e.item)===e}_process(e){if(null==e)return;let s;const t=new AbortController,r=new n(e,t);this._processingItems.set(e,r);try{s=this.process(e,t.signal)}catch(h){this._processError(r,h)}i(s)?(r.promise=s,s.then((e=>this._processResult(r,e)),(e=>this._processError(r,e)))):this._processResult(r,s)}get test(){return{update:e=>this.runTask(e)}}}export{u as QueueProcessor};
5
+ import{removeMaybe as e}from"../../core/maybe.js";import{onAbort as s,onAbortOrThrow as t,createResolver as r,isPromiseLike as i,createAbortError as h}from"../../core/promiseUtils.js";import o from"../../core/Queue.js";import{schedule as c}from"../../core/scheduling.js";class n{constructor(e,s){this.item=e,this.controller=s,this.promise=null}}class u{constructor(e){this._deferreds=new Map,this._controllers=new Map,this._processingItems=new Map,this._isPaused=!1,this._schedule=null,this._task=null,this.concurrency=1,e.concurrency&&(this.concurrency=e.concurrency),this._queue=new o(e.peeker),this.process=e.process;const s=e.scheduler;e.priority&&s&&(this._task=s.registerTask(e.priority,this))}destroy(){this.clear(),this._schedule=e(this._schedule),this._task=e(this._task)}get length(){return this._processingItems.size+this._queue.length}abort(e){const s=this._controllers.get(e);s&&s.abort()}clear(){this._queue.clear();const e=[];this._controllers.forEach((s=>e.push(s))),this._controllers.clear(),e.forEach((e=>e.abort())),this._processingItems.clear(),this._cancelNext()}forEach(e){this._deferreds.forEach(((s,t)=>e(t)))}get(e){const s=this._deferreds.get(e);return s?s.promise:void 0}isOngoing(e){return this._processingItems.has(e)}has(e){return this._deferreds.has(e)}pause(){this._isPaused||(this._isPaused=!0,this._cancelNext())}push(e,i){const o=this.get(e);if(o)return o;const c=new AbortController;let n=null;i&&(n=s(i,(()=>c.abort())));const u=()=>{const s=this._processingItems.get(e);s&&s.controller.abort(),l(),p.reject(h())},l=()=>{_.remove(),null!=n&&n.remove(),this._deferreds.delete(e),this._controllers.delete(e),this._queue.remove(e),this._processingItems.delete(e),this._scheduleNext()},_=t(c.signal,u),p=r();return this._deferreds.set(e,p),this._controllers.set(e,c),p.promise.then(l,l),this._queue.push(e),this._scheduleNext(),p.promise}last(){return this._queue.last()}peek(){return this._queue.peek()}popLast(){return this._queue.popLast()}reset(){const e=[];this._processingItems.forEach((s=>e.push(s))),this._processingItems.clear();for(const s of e)this._queue.push(s.item),s.controller.abort();this._scheduleNext()}resume(){this._isPaused&&(this._isPaused=!1,this._scheduleNext())}takeAll(){const e=[];for(;this._queue.length;)e.push(this._queue.pop());return this.clear(),e}get running(){return!this._isPaused&&this._queue.length>0&&this._processingItems.size<this.concurrency}runTask(e){for(;!e.done&&this._queue.length>0&&this._processingItems.size<this.concurrency;)this._process(this._queue.pop()),e.madeProgress()}_scheduleNext(){this._task||this._isPaused||this._schedule||(this._schedule=c((()=>{this._schedule=null,this._next()})))}_next(){for(;this._queue.length>0&&this._processingItems.size<this.concurrency;)this._process(this._queue.pop())}_cancelNext(){this._schedule&&(this._schedule.remove(),this._schedule=null)}_processResult(e,s){this._canProcessFulfillment(e)&&(this._scheduleNext(),this._deferreds.get(e.item).resolve(s))}_processError(e,s){this._canProcessFulfillment(e)&&(this._scheduleNext(),this._deferreds.get(e.item).reject(s))}_canProcessFulfillment(e){return!!this._deferreds.get(e.item)&&this._processingItems.get(e.item)===e}_process(e){if(null==e)return;let s;const t=new AbortController,r=new n(e,t);this._processingItems.set(e,r);try{s=this.process(e,t.signal)}catch(h){this._processError(r,h)}i(s)?(r.promise=s,s.then((e=>this._processResult(r,e)),(e=>this._processError(r,e)))):this._processResult(r,s)}get test(){return{update:e=>this.runTask(e)}}}export{u as QueueProcessor};
@@ -2,4 +2,4 @@
2
2
  All material copyright ESRI, All Rights Reserved, unless otherwise specified.
3
3
  See https://js.arcgis.com/4.27/esri/copyright.txt for details.
4
4
  */
5
- import{_ as t}from"../../chunks/tslib.es6.js";import"../../core/has.js";import"../../core/Logger.js";import{watch as o,initial as e}from"../../core/reactiveUtils.js";import{property as i}from"../../core/accessorSupport/decorators/property.js";import"../../core/accessorSupport/ensureType.js";import"../../core/arrayUtils.js";import{subclass as s}from"../../core/accessorSupport/decorators/subclass.js";import r from"./Component.js";import n from"./UI.js";import a from"../../widgets/Attribution.js";import p from"../../widgets/Compass.js";import d from"../../widgets/NavigationToggle.js";import c from"../../widgets/Zoom.js";function m(t){return void 0!==t?.view}let u=class extends n{constructor(t){super(t),this._defaultPositionLookup={attribution:"manual",compass:"top-left","navigation-toggle":"top-left",zoom:"top-left"},this.components=[]}initialize(){this.addHandles([o((()=>this.components),this._componentsWatcher.bind(this),e),o((()=>this.view),this._updateViewAwareWidgets.bind(this),e)])}_add(t,o,e,i){let s=t;if("string"==typeof t&&this._defaultPositionLookup[t]){if(this._find(t))return;s=this._createComponent(t)}super._add(s,o,e,i)}_removeComponents(t){t.forEach((t=>{const o=this._find(t);o&&(this.remove(o),o.destroy())}))}_updateViewAwareWidgets(t){this.components.forEach((o=>{const e=this._find(o),i=e&&e.widget;m(i)&&(i.view=t)}))}_componentsWatcher(t,o){this._removeComponents(o),this._addComponents(t),this._adjustPadding(t)}_adjustPadding(t){if(!t.includes("attribution")&&!this._isOverridden("padding")){const{top:t}=this.padding;this.padding=t}}_addComponents(t){this.constructed&&t.forEach((t=>this.add(this._createComponent(t),this._defaultPositionLookup[t])))}_createComponent(t){const o=this._createWidget(t);if(o)return new r({id:t,node:o})}_createWidget(t){const{view:o}=this;switch(t){case"attribution":return new a({view:o});case"compass":return new p({view:o});case"navigation-toggle":return new d({view:o});case"zoom":return new c({view:o})}}};t([i()],u.prototype,"components",void 0),u=t([s("esri.views.ui.DefaultUI")],u);const h=u;export{h as default};
5
+ import{_ as t}from"../../chunks/tslib.es6.js";import"../../core/has.js";import"../../core/Logger.js";import{watch as o,initial as e}from"../../core/reactiveUtils.js";import{property as s}from"../../core/accessorSupport/decorators/property.js";import"../../core/accessorSupport/ensureType.js";import"../../core/arrayUtils.js";import{subclass as i}from"../../core/accessorSupport/decorators/subclass.js";import r from"./Component.js";import n from"./UI.js";import a from"../../widgets/Attribution.js";import p from"../../widgets/Compass.js";import d from"../../widgets/NavigationToggle.js";import c from"../../widgets/Zoom.js";function m(t){return void 0!==t?.view}let u=class extends n{constructor(t){super(t),this._defaultPositionLookup={attribution:"manual",compass:"top-left","navigation-toggle":"top-left",zoom:"top-left"},this.components=[],this._updateViewAwareWidgets=t=>{this.components.forEach((o=>{const e=this._find(o),s=e&&e.widget;m(s)&&(s.view=t)}))},this._componentsWatcher=(t,o)=>{this._removeComponents(o),this._addComponents(t),this._adjustPadding(t)}}initialize(){this.addHandles([o((()=>this.components),this._componentsWatcher,e),o((()=>this.view),this._updateViewAwareWidgets,e)])}_add(t,o,e,s){let i=t;if("string"==typeof t&&this._defaultPositionLookup[t]){if(this._find(t))return;i=this._createComponent(t)}super._add(i,o,e,s)}_removeComponents(t){t.forEach((t=>{const o=this._find(t);o&&(this.remove(o),o.destroy())}))}_adjustPadding(t){if(!t.includes("attribution")&&!this._isOverridden("padding")){const{top:t}=this.padding;this.padding=t}}_addComponents(t){this.constructed&&t.forEach((t=>this.add(this._createComponent(t),this._defaultPositionLookup[t])))}_createComponent(t){const o=this._createWidget(t);if(o)return new r({id:t,node:o})}_createWidget(t){const{view:o}=this;switch(t){case"attribution":return new a({view:o});case"compass":return new p({view:o});case"navigation-toggle":return new d({view:o});case"zoom":return new c({view:o})}}};t([s()],u.prototype,"components",void 0),u=t([i("esri.views.ui.DefaultUI")],u);const h=u;export{h as default};
package/views/ui/UI.js CHANGED
@@ -2,4 +2,4 @@
2
2
  All material copyright ESRI, All Rights Reserved, unless otherwise specified.
3
3
  See https://js.arcgis.com/4.27/esri/copyright.txt for details.
4
4
  */
5
- import{_ as t}from"../../chunks/tslib.es6.js";import"../../intl.js";import{isSome as o}from"../../core/arrayUtils.js";import{empty as n,insertBefore as i}from"../../core/domUtils.js";import e from"../../core/Evented.js";import{watch as r,initial as s}from"../../core/reactiveUtils.js";import{property as a}from"../../core/accessorSupport/decorators/property.js";import{cast as p}from"../../core/accessorSupport/decorators/cast.js";import"../../core/has.js";import{subclass as d}from"../../core/accessorSupport/decorators/subclass.js";import{setCalciteThemeClass as c}from"../../support/themeUtils.js";import l from"./Component.js";import{isRTL as h}from"../../widgets/support/widgetUtils.js";import{getLocale as m,onLocaleChange as u}from"../../intl/locale.js";const f={left:0,top:0,bottom:0,right:0},_={bottom:30,top:15,right:15,left:15},g="esri-ui",y={ui:g,corner:`${g}-corner`,innerContainer:`${g}-inner-container`,manualContainer:`${g}-manual-container`,cornerContainer:`${g}-corner-container`,topLeft:`${g}-top-left`,topRight:`${g}-top-right`,bottomLeft:`${g}-bottom-left`,bottomRight:`${g}-bottom-right`};function C(t){return t&&!t._started&&"function"==typeof t.postMixInProperties&&"function"==typeof t.buildRendering&&"function"==typeof t.postCreate&&"function"==typeof t.startup}function v(t){return 0===t?"0":`${t}px`}function b(t){const o="object"==typeof t&&null!==t&&Object.getPrototypeOf(t);return(null===o||o===Object.prototype)&&("component"in t||"index"in t||"position"in t)?t:null}function w(t,{top:o,bottom:n,left:i,right:e}){t.style.top=o,t.style.bottom=n,t.style.left=i,t.style.right=e}let P=class extends e.EventedAccessor{constructor(t){super(t),this._cornerNameToContainerLookup={},this._positionNameToContainerLookup={},this._components=new Array,this._componentToKey=new Map,this._locale=m(),this.view=null,this._applyViewPadding=()=>{const t=this.container;t&&w(t,this._toPixelPosition(this._getViewPadding()))},this._applyUIPadding=()=>{const t=this._innerContainer;t&&w(t,this._toPixelPosition(this.padding))},this._initContainers()}initialize(){this.addHandles([r((()=>[this.view?.padding,this.container]),this._applyViewPadding,s),r((()=>this.padding),this._applyUIPadding,s),r((()=>[this.container,this._locale]),(([t,o])=>{t&&t.setAttribute("lang",o)}),s),u((t=>{this._locale=t}))])}destroy(){this.container=null;for(const t of this._components)t.destroy();this._components.length=0,this._componentToKey.clear()}set container(t){const o=this._get("container");t!==o&&(t&&(t.classList.add(y.ui),c(t),this._attachContainers(t)),o&&(o.classList.remove(y.ui),w(o,{top:"",bottom:"",left:"",right:""}),n(o)),this._set("container",t))}get height(){const t=this.view?.height??0;if(0===t)return t;const o=this._getViewPadding(),{top:n,bottom:i}=o;return Math.max(t-n-i,0)}get padding(){return this._get("padding")}set padding(t){this._overrideIfSome("padding",t)}castPadding(t){return"number"==typeof t?{bottom:t,top:t,right:t,left:t}:{..._,...t}}get width(){const t=this.view?.width??0;if(0===t)return t;const o=this._getViewPadding(),{left:n,right:i}=o;return Math.max(t-n-i,0)}get test(){return{components:this._components}}add(t,o){let n,i;if(Array.isArray(t))return void t.forEach((t=>this.add(t,o)));const e=b(t);e&&({index:n,position:o,component:t,key:i}=e),o&&"object"==typeof o&&({index:n,key:i,position:o}=o),!t||o&&!this._isValidPosition(o)||this._add(t,o,n,i)}remove(t,o){if(!t)return;if(Array.isArray(t))return t.map((t=>this.remove(t,o)));const n=this._find(t);if(n){if(this._componentToKey.has(t)&&this._componentToKey.get(t)!==o)return;const i=this._components.indexOf(n),e=n.node.parentNode;return e?.removeChild(n.node),this._componentToKey.delete(t),this._components.splice(i,1)[0]}}empty(t){if(Array.isArray(t))return t.map((t=>this.empty(t))).reduce(((t,o)=>t.concat(o)));if(t??(t="manual"),"manual"===t){return Array.prototype.slice.call(this._manualContainer.children).filter((t=>!t.classList.contains(y.corner))).map((t=>this.remove(t)))}return this._isValidPosition(t)?Array.prototype.slice.call(this._cornerNameToContainerLookup[t].children).map(this.remove,this):null}move(t,o){if(Array.isArray(t)&&t.forEach((t=>this.move(t,o))),!t)return;let n;const i=b(t)||b(o);if(i&&(n=i.index,o=i.position,t=i.component||t),o&&!this._isValidPosition(o))return;const e=this.remove(t);e&&this.add(e,{position:o,index:n})}find(t){if(!t)return null;const o=this._findById(t);return o&&(o.widget||o.node)}getComponents(t){return t?Array.isArray(t)?t.map((t=>this._getComponentsAtPosition(t))).flat():this._getComponentsAtPosition(t):this._components.map((({widget:t,node:o})=>t??o))}getPosition(t){for(const o in this._positionNameToContainerLookup){if(this._positionNameToContainerLookup[o].contains(t))return o}return null}_add(t,o,n,i){t instanceof l||(t=new l({node:t})),this._place({component:t,position:o,index:n}),this._components.push(t),i&&this._componentToKey.set(t,i)}_find(t){return t?t instanceof l?this._findByComponent(t):"string"==typeof t?this._findById(t):this._findByNode(t.domNode||t):null}_getViewPadding(){return this.view?.padding??f}_attachContainers(t){t.appendChild(this._innerContainer),t.appendChild(this._manualContainer)}_initContainers(){const t=document.createElement("div");t.classList.add(y.innerContainer,y.cornerContainer);const o=document.createElement("div");o.classList.add(y.innerContainer,y.manualContainer);const n=document.createElement("div");n.classList.add(y.topLeft,y.corner),t.appendChild(n);const i=document.createElement("div");i.classList.add(y.topRight,y.corner),t.appendChild(i);const e=document.createElement("div");e.classList.add(y.bottomLeft,y.corner),t.appendChild(e);const r=document.createElement("div");r.classList.add(y.bottomRight,y.corner),t.appendChild(r),this._innerContainer=t,this._manualContainer=o;const s=h();this._cornerNameToContainerLookup={"top-left":n,"top-right":i,"bottom-left":e,"bottom-right":r,"top-leading":s?i:n,"top-trailing":s?n:i,"bottom-leading":s?r:e,"bottom-trailing":s?e:r},this._positionNameToContainerLookup={manual:o,...this._cornerNameToContainerLookup}}_isValidPosition(t){return!!this._positionNameToContainerLookup[t]}_place(t){const o=t.position??"manual",{component:n,index:e}=t,r=this._positionNameToContainerLookup[o],s=null!=e&&e>-1;if(C(n.widget)&&n.widget.startup(),!s)return void r.appendChild(n.node);const a=Array.prototype.slice.call(r.children);if(0===e)return void(r.firstChild?i(n.node,r.firstChild):r.appendChild(n.node));e>=a.length?r.appendChild(n.node):i(n.node,a[e])}_toPixelPosition(t){return{top:v(t.top),left:v(t.left),right:v(t.right),bottom:v(t.bottom)}}_findByComponent(t){return this._components.find((o=>o===t))??null}_findById(t){return this._components.find((({id:o})=>o===t))??null}_findByNode(t){return this._components.find((({node:o})=>o===t))??null}_getComponentsAtPosition(t){const n=this._positionNameToContainerLookup[t];return Array.prototype.slice.call(n.children).map((t=>this._findByNode(t))).filter(o).map((({widget:t,node:o})=>t??o))}};t([a()],P.prototype,"_locale",void 0),t([a()],P.prototype,"container",null),t([a()],P.prototype,"height",null),t([a({value:_})],P.prototype,"padding",null),t([p("padding")],P.prototype,"castPadding",null),t([a()],P.prototype,"view",void 0),t([a()],P.prototype,"width",null),P=t([d("esri.views.ui.UI")],P);const L=P;export{L as default};
5
+ import{_ as t}from"../../chunks/tslib.es6.js";import"../../intl.js";import{isSome as o}from"../../core/arrayUtils.js";import{empty as n,insertBefore as i}from"../../core/domUtils.js";import e from"../../core/Evented.js";import{watch as r,initial as s}from"../../core/reactiveUtils.js";import{property as a}from"../../core/accessorSupport/decorators/property.js";import{cast as p}from"../../core/accessorSupport/decorators/cast.js";import"../../core/has.js";import{subclass as d}from"../../core/accessorSupport/decorators/subclass.js";import{setCalciteThemeClass as c}from"../../support/themeUtils.js";import l from"./Component.js";import{isRTL as h}from"../../widgets/support/widgetUtils.js";import{getLocale as m,onLocaleChange as u}from"../../intl/locale.js";const f={left:0,top:0,bottom:0,right:0},_={bottom:30,top:15,right:15,left:15},g="esri-ui",y={ui:g,corner:`${g}-corner`,innerContainer:`${g}-inner-container`,manualContainer:`${g}-manual-container`,cornerContainer:`${g}-corner-container`,topLeft:`${g}-top-left`,topRight:`${g}-top-right`,bottomLeft:`${g}-bottom-left`,bottomRight:`${g}-bottom-right`};function C(t){return t&&!t._started&&"function"==typeof t.postMixInProperties&&"function"==typeof t.buildRendering&&"function"==typeof t.postCreate&&"function"==typeof t.startup}function v(t){return 0===t?"0":`${t}px`}function b(t){const o="object"==typeof t&&null!==t&&Object.getPrototypeOf(t);return(null===o||o===Object.prototype)&&("component"in t||"index"in t||"position"in t)?t:null}function w(t,{top:o,bottom:n,left:i,right:e}){t.style.top=o,t.style.bottom=n,t.style.left=i,t.style.right=e}let P=class extends e.EventedAccessor{constructor(t){super(t),this._cornerNameToContainerLookup={},this._positionNameToContainerLookup={},this._components=new Array,this._componentToKey=new Map,this._locale=m(),this.view=null,this._applyViewPadding=()=>{const t=this.container;t&&w(t,this._toPixelPosition(this._getViewPadding()))},this._applyUIPadding=()=>{const t=this._innerContainer;t&&w(t,this._toPixelPosition(this.padding))},this._initContainers()}initialize(){this.addHandles([r((()=>[this.view?.padding,this.container]),this._applyViewPadding,s),r((()=>this.padding),this._applyUIPadding,s),r((()=>[this.container,this._locale]),(([t,o])=>{t&&t.setAttribute("lang",o)}),s),u((t=>{this._locale=t}))])}destroy(){this.container=null;for(const t of this._components)t.destroy();this._components.length=0,this._componentToKey.clear()}set container(t){const o=this._get("container");t!==o&&(t&&(t.classList.add(y.ui),c(t),this._attachContainers(t)),o&&(o.classList.remove(y.ui),w(o,{top:"",bottom:"",left:"",right:""}),n(o)),this._set("container",t))}get height(){const t=this.view?.height??0;if(0===t)return t;const o=this._getViewPadding(),{top:n,bottom:i}=o;return Math.max(t-n-i,0)}get padding(){return this._get("padding")}set padding(t){this._overrideIfSome("padding",t)}castPadding(t){return"number"==typeof t?{bottom:t,top:t,right:t,left:t}:{..._,...t}}get width(){const t=this.view?.width??0;if(0===t)return t;const o=this._getViewPadding(),{left:n,right:i}=o;return Math.max(t-n-i,0)}get test(){return{components:this._components}}add(t,o){let n,i;if(Array.isArray(t))return void t.forEach((t=>this.add(t,o)));const e=b(t);e&&({index:n,position:o,component:t,key:i}=e),o&&"object"==typeof o&&({index:n,key:i,position:o}=o),!t||o&&!this._isValidPosition(o)||this._add(t,o,n,i)}remove(t,o){if(!t)return;if(Array.isArray(t))return t.map((t=>this.remove(t,o)));const n=this._find(t);if(n){if(this._componentToKey.has(t)&&this._componentToKey.get(t)!==o)return;const i=this._components.indexOf(n),e=n.node.parentNode;return e?.removeChild(n.node),this._componentToKey.delete(t),this._components.splice(i,1)[0]}}empty(t){if(Array.isArray(t))return t.map((t=>this.empty(t))).reduce(((t,o)=>t.concat(o)));if(t??(t="manual"),"manual"===t){return Array.from(this._manualContainer.children).filter((t=>!t.classList.contains(y.corner))).map((t=>this.remove(t)))}return this._isValidPosition(t)?Array.from(this._cornerNameToContainerLookup[t].children).map((t=>this.remove(t)),this):null}move(t,o){if(Array.isArray(t)&&t.forEach((t=>this.move(t,o))),!t)return;let n;const i=b(t)||b(o);if(i&&(n=i.index,o=i.position,t=i.component||t),o&&!this._isValidPosition(o))return;const e=this.remove(t);e&&this.add(e,{position:o,index:n})}find(t){if(!t)return null;const o=this._findById(t);return o&&(o.widget||o.node)}getComponents(t){return t?Array.isArray(t)?t.map((t=>this._getComponentsAtPosition(t))).flat():this._getComponentsAtPosition(t):this._components.map((({widget:t,node:o})=>t??o))}getPosition(t){for(const o in this._positionNameToContainerLookup){if(this._positionNameToContainerLookup[o].contains(t))return o}return null}_add(t,o,n,i){t instanceof l||(t=new l({node:t})),this._place({component:t,position:o,index:n}),this._components.push(t),i&&this._componentToKey.set(t,i)}_find(t){return t?t instanceof l?this._findByComponent(t):"string"==typeof t?this._findById(t):this._findByNode(t.domNode||t):null}_getViewPadding(){return this.view?.padding??f}_attachContainers(t){t.appendChild(this._innerContainer),t.appendChild(this._manualContainer)}_initContainers(){const t=document.createElement("div");t.classList.add(y.innerContainer,y.cornerContainer);const o=document.createElement("div");o.classList.add(y.innerContainer,y.manualContainer);const n=document.createElement("div");n.classList.add(y.topLeft,y.corner),t.appendChild(n);const i=document.createElement("div");i.classList.add(y.topRight,y.corner),t.appendChild(i);const e=document.createElement("div");e.classList.add(y.bottomLeft,y.corner),t.appendChild(e);const r=document.createElement("div");r.classList.add(y.bottomRight,y.corner),t.appendChild(r),this._innerContainer=t,this._manualContainer=o;const s=h();this._cornerNameToContainerLookup={"top-left":n,"top-right":i,"bottom-left":e,"bottom-right":r,"top-leading":s?i:n,"top-trailing":s?n:i,"bottom-leading":s?r:e,"bottom-trailing":s?e:r},this._positionNameToContainerLookup={manual:o,...this._cornerNameToContainerLookup}}_isValidPosition(t){return!!this._positionNameToContainerLookup[t]}_place(t){const o=t.position??"manual",{component:n,index:e}=t,r=this._positionNameToContainerLookup[o],s=null!=e&&e>-1;if(C(n.widget)&&n.widget.startup(),!s)return void r.appendChild(n.node);const a=Array.prototype.slice.call(r.children);if(0===e)return void(r.firstChild?i(n.node,r.firstChild):r.appendChild(n.node));e>=a.length?r.appendChild(n.node):i(n.node,a[e])}_toPixelPosition(t){return{top:v(t.top),left:v(t.left),right:v(t.right),bottom:v(t.bottom)}}_findByComponent(t){return this._components.find((o=>o===t))??null}_findById(t){return this._components.find((({id:o})=>o===t))??null}_findByNode(t){return this._components.find((({node:o})=>o===t))??null}_getComponentsAtPosition(t){const n=this._positionNameToContainerLookup[t];return Array.prototype.slice.call(n.children).map((t=>this._findByNode(t))).filter(o).map((({widget:t,node:o})=>t??o))}};t([a()],P.prototype,"_locale",void 0),t([a()],P.prototype,"container",null),t([a()],P.prototype,"height",null),t([a({value:_})],P.prototype,"padding",null),t([p("padding")],P.prototype,"castPadding",null),t([a()],P.prototype,"view",void 0),t([a()],P.prototype,"width",null),P=t([d("esri.views.ui.UI")],P);const L=P;export{L as default};