@arcgis/core 4.27.0-next.20230419 → 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 (203) hide show
  1. package/WebMap.js +1 -1
  2. package/WebScene.js +1 -1
  3. package/arcade/arcadeAsyncRuntime.js +1 -1
  4. package/arcade/arcadeCompiler.js +1 -1
  5. package/arcade/arcadeRuntime.js +1 -1
  6. package/arcade/executionError.js +1 -1
  7. package/assets/esri/core/workers/RemoteClient.js +1 -1
  8. package/assets/esri/core/workers/chunks/{f64f95623d9296a91f95.js → 059ec6fd9b971de4b4c1.js} +1 -1
  9. package/assets/esri/core/workers/chunks/0d805fd9cd9ff3a636ca.js +1 -0
  10. package/assets/esri/core/workers/chunks/{1fe31a412479815e5e2d.js → 10770939900946feb20d.js} +1 -1
  11. package/assets/esri/core/workers/chunks/{5252f3cc244204edc299.js → 1216e939d363f96b6cc6.js} +1 -1
  12. package/assets/esri/core/workers/chunks/156dad2b7fed6749bae7.js +1 -0
  13. package/assets/esri/core/workers/chunks/15a97d3e42b00ac42984.js +1 -0
  14. package/assets/esri/core/workers/chunks/{d72c0c97cc4e30f1e4f2.js → 18704903814b9d73c708.js} +1 -1
  15. package/assets/esri/core/workers/chunks/1db5e4c8244dbc21590c.js +1 -0
  16. package/assets/esri/core/workers/chunks/2a1a5a1969e80a10dcca.js +1 -0
  17. package/assets/esri/core/workers/chunks/33b735faa582e6f39e9a.js +1 -0
  18. package/assets/esri/core/workers/chunks/34025ac04ca02531923a.js +1 -0
  19. package/assets/esri/core/workers/chunks/3e9f3479fd8558d9e3e3.js +1 -0
  20. package/assets/esri/core/workers/chunks/{d59274ac695dfcff1143.js → 46090b69e9161bc05141.js} +1 -1
  21. package/assets/esri/core/workers/chunks/{f7aa972cb3903847b3bf.js → 47bf38d910e71ac39bb8.js} +1 -1
  22. package/assets/esri/core/workers/chunks/{3978f4f68ada540ee3a3.js → 4f8a09b61267e5e26712.js} +1 -1
  23. package/assets/esri/core/workers/chunks/5183ecab7eddae7b70e8.js +1 -0
  24. package/assets/esri/core/workers/chunks/{a5c33b24b7ee042cb473.js → 51a0d1dabe7415515c77.js} +2 -2
  25. package/assets/esri/core/workers/chunks/541e6efc3b491e507410.js +1 -0
  26. package/assets/esri/core/workers/chunks/588256e65685ff21d2e9.js +1 -0
  27. package/assets/esri/core/workers/chunks/5c64fd3bf057a1a5527f.js +1 -0
  28. package/assets/esri/core/workers/chunks/6047bdaf4855506f8fdb.js +1 -0
  29. package/assets/esri/core/workers/chunks/6adb58f1bffc5d1c03bd.js +1 -0
  30. package/assets/esri/core/workers/chunks/770940417e6ddbdbb9d6.js +1 -0
  31. package/assets/esri/core/workers/chunks/{1c1d8be85297c483a606.js → 77c98121223a144170e3.js} +1 -1
  32. package/assets/esri/core/workers/chunks/80117007d86be4eb3bc3.js +1 -0
  33. package/assets/esri/core/workers/chunks/812cba53143565a825f1.js +1 -0
  34. package/assets/esri/core/workers/chunks/838849b751805615833a.js +1 -0
  35. package/assets/esri/core/workers/chunks/{9ca395f7bc8d397b5240.js → 88197520501fcc20b6e8.js} +1 -1
  36. package/assets/esri/core/workers/chunks/88f9dededcf60fd011ef.js +1 -0
  37. package/assets/esri/core/workers/chunks/88fdd288ef799a7ac48a.js +1 -0
  38. package/assets/esri/core/workers/chunks/8ae7fea9f7fda38dd207.js +1 -0
  39. package/assets/esri/core/workers/chunks/{0d080dd1ca6a71597409.js → 9265d4e9cfab2c7bbce5.js} +1 -1
  40. package/assets/esri/core/workers/chunks/{8d41305509fedb3603ac.js → 94041a9ced04aa281d40.js} +1 -1
  41. package/assets/esri/core/workers/chunks/98540791fcef86069e44.js +1 -0
  42. package/assets/esri/core/workers/chunks/9c1b2f82877ff79969f5.js +1 -0
  43. package/assets/esri/core/workers/chunks/a7b3cd537c9127b5e65e.js +1 -0
  44. package/assets/esri/core/workers/chunks/{3d1c697182237807ab49.js → abea316f2eac0f3086ab.js} +1 -1
  45. package/assets/esri/core/workers/chunks/ad85ade6a2cfb56cf328.js +1 -0
  46. package/assets/esri/core/workers/chunks/b833b4ea2973bb16792e.js +1 -0
  47. package/assets/esri/core/workers/chunks/be4aa835a7abfc809126.js +1 -0
  48. package/assets/esri/core/workers/chunks/c2ec6e904f96173a7b83.js +1 -0
  49. package/assets/esri/core/workers/chunks/{c25aa08b869f2777dc26.js → c4488a8d857c765da30e.js} +1 -1
  50. package/assets/esri/core/workers/chunks/c5c56b6d99db96a6755a.js +2 -0
  51. package/assets/esri/core/workers/chunks/{7f3b0856f594df2b044e.js → c727d38f71e52bee17e1.js} +1 -1
  52. package/assets/esri/core/workers/chunks/cf315d255f0dc8d50f21.js +1 -0
  53. package/assets/esri/core/workers/chunks/cf7676fdc09ad4835680.js +1 -0
  54. package/assets/esri/core/workers/chunks/cfad34c949cbe8a31ef8.js +1 -0
  55. package/assets/esri/core/workers/chunks/{edb4568fe281b5609092.js → d244e50c981146f018d2.js} +1 -1
  56. package/assets/esri/core/workers/chunks/{a2c9cb23f3e35e88da1d.js → d399b1b9cbf0737d1735.js} +1 -1
  57. package/assets/esri/core/workers/chunks/{df7dcd035997881cf2ef.js → d5c8119d6d34628d3126.js} +1 -1
  58. package/assets/esri/core/workers/chunks/d6b6bb8aecc85d2a3f6b.js +1 -0
  59. package/assets/esri/core/workers/chunks/{8dfa32cc8453f85faab0.js → dd1f8bade9c5c3b7929b.js} +1 -1
  60. package/assets/esri/core/workers/chunks/e11e60759821746259c6.js +1 -0
  61. package/assets/esri/core/workers/chunks/{e4b65c5a4575a5c1c49f.js → e356c576f9a7521a49b3.js} +1 -1
  62. package/assets/esri/core/workers/chunks/f02edf71645eb33bf92f.js +1 -0
  63. package/assets/esri/core/workers/chunks/f1a4165c2710ca90e5ea.js +1 -0
  64. package/assets/esri/core/workers/chunks/f57a3ee17869ced3dd33.js +1 -0
  65. package/assets/esri/core/workers/chunks/fc07f6e103d7f69a9909.js +1 -0
  66. package/chunks/WaterSurface.glsl.js +35 -20
  67. package/chunks/index.js +1 -1
  68. package/core/Loadable.js +1 -1
  69. package/core/Promise.js +1 -1
  70. package/core/accessorSupport/ensureType.js +1 -1
  71. package/core/accessorSupport/watch.js +1 -1
  72. package/core/accessorSupport/write.js +1 -1
  73. package/core/promiseUtils.js +1 -1
  74. package/core/watchUtils.js +1 -1
  75. package/core/workers/Connection.js +1 -1
  76. package/core/workers/RemoteClient.js +1 -1
  77. package/core/workers/workerFactory.js +1 -1
  78. package/geometry/support/geodesicUtils.js +1 -1
  79. package/geometry/support/meshUtils/External.js +1 -1
  80. package/geometry/support/meshUtils/Metadata.js +1 -1
  81. package/intl/messages.js +1 -1
  82. package/layers/graphics/controllers/FeatureTileController3D.js +1 -1
  83. package/layers/graphics/controllers/I3SOnDemandController.js +1 -1
  84. package/layers/graphics/data/attributeSupport.js +1 -1
  85. package/layers/graphics/sources/FeatureLayerSource.js +1 -1
  86. package/layers/mixins/ArcGISMapService.js +1 -1
  87. package/layers/support/PromiseQueue.js +1 -1
  88. package/layers/support/Sublayer.js +1 -1
  89. package/layers/support/TileKey.js +1 -1
  90. package/layers/support/rasterFormats/TiffDecoder.js +1 -1
  91. package/networks/Network.js +1 -1
  92. package/package.json +1 -1
  93. package/portal/schemas/definitions.js +1 -1
  94. package/renderers/support/RasterSymbolizer.js +1 -1
  95. package/renderers/support/rasterRendererChecks.js +5 -0
  96. package/renderers/support/rasterRendererHelper.js +1 -1
  97. package/request.js +1 -1
  98. package/rest/query/operations/query.js +1 -1
  99. package/smartMapping/raster/renderers/uniqueValue.js +1 -1
  100. package/support/featureFlags.js +1 -1
  101. package/support/revision.js +1 -1
  102. package/symbols/support/previewSymbol3D.js +1 -1
  103. package/symbols/support/styleUtils.js +1 -1
  104. package/symbols/support/symbolLayerUtils.js +1 -1
  105. package/symbols/support/utils.js +1 -1
  106. package/symbols/support/webStyleSymbolUtils.js +1 -1
  107. package/views/2d/engine/webgl/TextureManager.js +1 -1
  108. package/views/2d/layers/FeatureLayerView2D.js +1 -1
  109. package/views/2d/layers/features/controllers/FeatureController2D.js +1 -1
  110. package/views/2d/layers/features/sources/DataTileSource.js +1 -1
  111. package/views/2d/layers/features/sources/DataTileSubscription.js +1 -1
  112. package/views/2d/layers/features/sources/DrillDownFeatureSource.js +1 -1
  113. package/views/2d/layers/features/sources/PagedFeatureSource.js +1 -1
  114. package/views/2d/layers/features/support/FeatureSetReaderPBFHeader.js +1 -1
  115. package/views/2d/layers/features/tileRenderers/HeatmapTileRenderer.js +1 -1
  116. package/views/2d/layers/features/tileRenderers/SymbolTileRenderer.js +1 -1
  117. package/views/2d/layers/features/tileRenderers.js +1 -1
  118. package/views/2d/layers/graphics/GraphicsView2D.js +1 -1
  119. package/views/2d/layers/support/webStyleUtils.js +1 -1
  120. package/views/3d/input/SceneInputManager.js +1 -1
  121. package/views/3d/interactive/manipulatorUtils.js +1 -1
  122. package/views/3d/interactive/visualElements/LineVisualElement.js +1 -1
  123. package/views/3d/layers/GraphicsView3D.js +1 -1
  124. package/views/3d/layers/I3SMeshView3D.js +1 -1
  125. package/views/3d/layers/graphics/ElevationQuery.js +1 -1
  126. package/views/3d/layers/graphics/Graphics3DCore.js +1 -1
  127. package/views/3d/layers/graphics/Graphics3DObjectSymbolLayer.js +1 -1
  128. package/views/3d/layers/graphics/Graphics3DWaterSymbolLayer.js +1 -1
  129. package/views/3d/layers/graphics/polygonUtils.js +1 -1
  130. package/views/3d/layers/graphics/symbolComplexity.js +1 -1
  131. package/views/3d/layers/graphics/webStyleUtils.js +5 -0
  132. package/views/3d/layers/i3s/I3SClientNodeLoader.js +1 -1
  133. package/views/3d/layers/i3s/I3SIndex.js +1 -1
  134. package/views/3d/layers/i3s/I3SOverrides.js +1 -1
  135. package/views/3d/webgl-engine/materials/WaterMaterial.js +1 -1
  136. package/views/3d/webgl-engine/materials/WaterTechnique.js +1 -1
  137. package/views/3d/webgl-engine/shaders/WaterSurface.glsl.js +1 -1
  138. package/views/LayerViewManager.js +1 -1
  139. package/views/PopupView.js +1 -1
  140. package/views/SceneView.js +1 -1
  141. package/views/ViewAnimation.js +1 -1
  142. package/views/input/BrowserEventSource.js +1 -1
  143. package/views/input/InputManager.js +1 -1
  144. package/views/interactive/coordinateHelper.js +1 -1
  145. package/views/interactive/snapping/featureSources/featureServiceSource/FeatureServiceSnappingSourceWorker.js +1 -1
  146. package/views/layers/support/MapServiceLayerViewHelper.js +1 -1
  147. package/views/support/QueueProcessor.js +1 -1
  148. package/views/ui/DefaultUI.js +1 -1
  149. package/views/ui/UI.js +1 -1
  150. package/widgets/BasemapGallery/support/PortalBasemapsSource.js +1 -1
  151. package/widgets/Editor/CreateFeaturesWorkflow.js +1 -1
  152. package/widgets/Editor/Upload.js +1 -1
  153. package/widgets/Editor/deprecationUtils.js +1 -1
  154. package/widgets/Editor/modelUploadUtils.js +1 -1
  155. package/widgets/Editor.js +1 -1
  156. package/widgets/Feature/FeatureExpression/FeatureExpressionViewModel.js +1 -1
  157. package/widgets/Feature/FeatureRelationship/FeatureRelationshipViewModel.js +1 -1
  158. package/widgets/Feature/FeatureViewModel.js +1 -1
  159. package/widgets/Feature/support/featureUtils.js +1 -1
  160. package/widgets/FeatureTable/Grid/Grid.js +1 -1
  161. package/widgets/Popup.js +1 -1
  162. package/widgets/support/decorators/accessibleHandler.js +1 -1
  163. package/assets/esri/core/workers/chunks/0948a40569b2408edefb.js +0 -1
  164. package/assets/esri/core/workers/chunks/192e3eeed50768c77c65.js +0 -1
  165. package/assets/esri/core/workers/chunks/1d1b9856f2f44d0c2144.js +0 -1
  166. package/assets/esri/core/workers/chunks/203115cc836e7b364eec.js +0 -1
  167. package/assets/esri/core/workers/chunks/20ad44b1a7adfed4c6c4.js +0 -1
  168. package/assets/esri/core/workers/chunks/27353056c3e4e8d8b8d3.js +0 -1
  169. package/assets/esri/core/workers/chunks/41ae9037c70461d5fdc7.js +0 -1
  170. package/assets/esri/core/workers/chunks/4b6a903d4aeeb4eeb615.js +0 -1
  171. package/assets/esri/core/workers/chunks/4bf9bc8b52d618f395c5.js +0 -1
  172. package/assets/esri/core/workers/chunks/5ec4fedbbcbb0053cf74.js +0 -2
  173. package/assets/esri/core/workers/chunks/60e29d172a2dcf45e8d0.js +0 -1
  174. package/assets/esri/core/workers/chunks/68a15cc7c51645d31572.js +0 -1
  175. package/assets/esri/core/workers/chunks/6b065e581bcf743079cf.js +0 -1
  176. package/assets/esri/core/workers/chunks/6c54579981a7bd483f1a.js +0 -1
  177. package/assets/esri/core/workers/chunks/778ecf61f07dafc51bbc.js +0 -1
  178. package/assets/esri/core/workers/chunks/7da1fd3629362b81b43c.js +0 -1
  179. package/assets/esri/core/workers/chunks/80d335bec34d60b7bbdc.js +0 -1
  180. package/assets/esri/core/workers/chunks/810da30f13151b72a293.js +0 -1
  181. package/assets/esri/core/workers/chunks/81485a5056aed94b3d8d.js +0 -1
  182. package/assets/esri/core/workers/chunks/8374d89e995f0d15c042.js +0 -1
  183. package/assets/esri/core/workers/chunks/8ebda132068f6b962dd9.js +0 -1
  184. package/assets/esri/core/workers/chunks/8f553ae2f1aba4e0371f.js +0 -1
  185. package/assets/esri/core/workers/chunks/8fec9979ae2b0e3a878f.js +0 -1
  186. package/assets/esri/core/workers/chunks/979ea2e3b1b164334634.js +0 -1
  187. package/assets/esri/core/workers/chunks/a0e92dd27c8f6b642dbf.js +0 -1
  188. package/assets/esri/core/workers/chunks/a6240bf258b3886a6661.js +0 -1
  189. package/assets/esri/core/workers/chunks/b059cd03f31ead61abb4.js +0 -1
  190. package/assets/esri/core/workers/chunks/b1a8024bf8cdd0cd3884.js +0 -1
  191. package/assets/esri/core/workers/chunks/b366e0db9b5f27dd53a3.js +0 -1
  192. package/assets/esri/core/workers/chunks/b976d5599672665561ec.js +0 -1
  193. package/assets/esri/core/workers/chunks/c260ac058e63a5c0cf60.js +0 -1
  194. package/assets/esri/core/workers/chunks/c646dc9da08b509e39d6.js +0 -1
  195. package/assets/esri/core/workers/chunks/db5598944b691e43f13e.js +0 -1
  196. package/assets/esri/core/workers/chunks/eb163a2ddeb27c690308.js +0 -1
  197. package/assets/esri/core/workers/chunks/eec12b5666819bf2119d.js +0 -1
  198. package/assets/esri/core/workers/chunks/ef05496c1faf08d247f1.js +0 -1
  199. package/assets/esri/core/workers/chunks/f05634909c9449533193.js +0 -1
  200. package/assets/esri/core/workers/chunks/fcebd70b089dea833c75.js +0 -1
  201. package/views/layers/GraphicsView.js +0 -5
  202. /package/assets/esri/core/workers/chunks/{a5c33b24b7ee042cb473.js.LICENSE.txt → 51a0d1dabe7415515c77.js.LICENSE.txt} +0 -0
  203. /package/assets/esri/core/workers/chunks/{5ec4fedbbcbb0053cf74.js.LICENSE.txt → c5c56b6d99db96a6755a.js.LICENSE.txt} +0 -0
package/core/Loadable.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 o}from"../chunks/tslib.es6.js";import t from"./Error.js";import{abortMaybe as s}from"./maybe.js";import{EsriPromise as r}from"./Promise.js";import{onAbortOrThrow as l,onAbort as e}from"./promiseUtils.js";import a from"./Warning.js";import{property as n}from"./accessorSupport/decorators/property.js";import{subclass as i}from"./accessorSupport/decorators/subclass.js";const d="not-loaded",h="loading",c="failed",u="loaded",p=r=>{let p=class extends r{constructor(...o){super(...o),this._loadController=null,this.loadError=null,this.loadStatus="not-loaded",this._set("loadWarnings",[]),this.addResolvingPromise(new Promise((o=>{const s=this.load.bind(this);this.load=r=>{const a=new Promise(((o,s)=>{const e=l(r,s);this.destroyed&&s(new t("load:instance-destroyed",`Instance of '${this.declaredClass||this.constructor.name}' is already destroyed`,{instance:this})),this._promiseProps.when(o,s).finally((()=>{e&&e.remove()}))}));if(this.loadStatus===d){this._set("loadStatus",h);const o=this._loadController=new AbortController;s({signal:o.signal}),e(o.signal,(()=>{this._promiseProps.abort()}))}return o(),a}}))),this.when((()=>{this._set("loadStatus",u),this._loadController=null}),(o=>{this._set("loadStatus",c),this._set("loadError",o),this._loadController=null}))}destroy(){this._loadController=s(this._loadController),this._set("loadError",null),this._set("loadWarnings",[])}get loaded(){return this.loadStatus===u}get loadWarnings(){return this._get("loadWarnings")}load(){return null}cancelLoad(){return this.isFulfilled()||(this._set("loadError",new t("load:cancelled","Cancelled")),this._loadController?.abort()),this}};return o([n({readOnly:!0})],p.prototype,"loaded",null),o([n({readOnly:!0})],p.prototype,"loadError",void 0),o([n({clonable:!1})],p.prototype,"loadStatus",void 0),o([n({type:[a],readOnly:!0})],p.prototype,"loadWarnings",null),p=o([i("esri.core.Loadable")],p),p};let m=class extends(p(r)){};m=o([i("esri.core.Loadable")],m),function(o){function t(o){return!(!o||!o.load)}o.LoadableMixin=p,o.isLoadable=t}(m||(m={}));const _=m;export{_ as default};
5
+ import{_ as o}from"../chunks/tslib.es6.js";import t from"./Error.js";import{abortMaybe as s}from"./maybe.js";import{EsriPromise as r}from"./Promise.js";import{onAbortOrThrow as l,onAbort as e}from"./promiseUtils.js";import a from"./Warning.js";import{property as n}from"./accessorSupport/decorators/property.js";import{subclass as i}from"./accessorSupport/decorators/subclass.js";const d="not-loaded",h="loading",c="failed",u="loaded",p=r=>{let p=class extends r{constructor(...o){super(...o),this._loadController=null,this.loadError=null,this.loadStatus="not-loaded",this._set("loadWarnings",[]),this.addResolvingPromise(new Promise((o=>{const s=this.load.bind(this);this.load=r=>{const a=new Promise(((o,s)=>{const e=l(r,s);this.destroyed&&s(new t("load:instance-destroyed",`Instance of '${this.declaredClass||this.constructor.name}' is already destroyed`,{instance:this})),this.when(o,s).finally((()=>{e&&e.remove()}))}));if(this.loadStatus===d){this._set("loadStatus",h);const o=this._loadController=new AbortController;s({signal:o.signal}),e(o.signal,(()=>{this._promiseProps.abort()}))}return o(),a}}))),this.when((()=>{this._set("loadStatus",u),this._loadController=null}),(o=>{this._set("loadStatus",c),this._set("loadError",o),this._loadController=null}))}destroy(){this._loadController=s(this._loadController),this._set("loadError",null),this._set("loadWarnings",[])}get loaded(){return this.loadStatus===u}get loadWarnings(){return this._get("loadWarnings")}load(){return null}cancelLoad(){return this.isFulfilled()||(this._set("loadError",new t("load:cancelled","Cancelled")),this._loadController?.abort()),this}};return o([n({readOnly:!0})],p.prototype,"loaded",null),o([n({readOnly:!0})],p.prototype,"loadError",void 0),o([n({clonable:!1})],p.prototype,"loadStatus",void 0),o([n({type:[a],readOnly:!0})],p.prototype,"loadWarnings",null),p=o([i("esri.core.Loadable")],p),p};let m=class extends(p(r)){};m=o([i("esri.core.Loadable")],m),function(o){function t(o){return!(!o||!o.load)}o.LoadableMixin=p,o.isLoadable=t}(m||(m={}));const _=m;export{_ as default};
package/core/Promise.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 s}from"../chunks/tslib.es6.js";import e from"./Accessor.js";import{assumeNonNull as r}from"./maybe.js";import{createDeferred as i,createAbortError as t,isAbortError as o}from"./promiseUtils.js";import{subclass as l}from"./accessorSupport/decorators/subclass.js";var h;!function(s){s[s.PENDING=0]="PENDING",s[s.RESOLVED=1]="RESOLVED",s[s.REJECTED=2]="REJECTED"}(h||(h={}));class n{constructor(s){this.instance=s,this._resolver=i(),this._status=h.PENDING,this._resolvingPromises=[],this._resolver.promise.then((()=>{this._status=h.RESOLVED,this._cleanUp()}),(()=>{this._status=h.REJECTED,this._cleanUp()}))}destroy(){this._cleanUp()}addResolvingPromise(s){this._resolvingPromises.push(s),this._tryResolve()}isResolved(){return this._status===h.RESOLVED}isRejected(){return this._status===h.REJECTED}isFulfilled(){return this._status!==h.PENDING}abort(){this._resolver.reject(t())}when(s,e){return this._resolver.promise.then(s,e)}_cleanUp(){this._allPromise=null,this._resolvingPromises=null}_tryResolve(){if(this.isFulfilled())return;const s=i(),e=[...this._resolvingPromises,r(s.promise)],t=this._allPromise=Promise.all(e);t.then((()=>{this.isFulfilled()||this._allPromise!==t||this._resolver.resolve(this.instance)}),(s=>{this.isFulfilled()||this._allPromise!==t||o(s)||this._resolver.reject(s)})),s.resolve()}}const m=e=>{let r=class extends e{constructor(...s){super(...s),this._promiseProps=new n(this),this.addResolvingPromise(Promise.resolve())}destroy(){this._promiseProps?.destroy()}isResolved(){return this._promiseProps.isResolved()}isRejected(){return this._promiseProps.isRejected()}isFulfilled(){return this._promiseProps.isFulfilled()}when(s,e){return new Promise(((s,e)=>{this._promiseProps.when(s,e)})).then(s,e)}catch(s){return this.when(null,s)}addResolvingPromise(s){s&&!this._promiseProps.isFulfilled()&&this._promiseProps.addResolvingPromise("_promiseProps"in s?s.when():s)}};return r=s([l("esri.core.Promise")],r),r};let p=class extends(m(e)){};p=s([l("esri.core.Promise")],p);export{p as EsriPromise,m as EsriPromiseMixin};
5
+ import{_ as s}from"../chunks/tslib.es6.js";import e from"./Accessor.js";import{assumeNonNull as r}from"./maybe.js";import{createResolver as i,createAbortError as t,isAbortError as o}from"./promiseUtils.js";import{subclass as l}from"./accessorSupport/decorators/subclass.js";var h;!function(s){s[s.PENDING=0]="PENDING",s[s.RESOLVED=1]="RESOLVED",s[s.REJECTED=2]="REJECTED"}(h||(h={}));class n{constructor(){this._resolver=i(),this._status=h.PENDING,this._resolvingPromises=[],this._resolver.promise.then((()=>{this._status=h.RESOLVED,this._cleanUp()}),(()=>{this._status=h.REJECTED,this._cleanUp()})),this.promise=this._resolver.promise}destroy(){this._cleanUp()}addResolvingPromise(s){this._resolvingPromises.push(s),this._tryResolve()}isResolved(){return this._status===h.RESOLVED}isRejected(){return this._status===h.REJECTED}isFulfilled(){return this._status!==h.PENDING}abort(){this._resolver.reject(t())}_cleanUp(){this._allPromise=null,this._resolvingPromises=null}_tryResolve(){if(this.isFulfilled())return;const s=i(),e=[...this._resolvingPromises,r(s.promise)],t=this._allPromise=Promise.all(e);t.then((()=>{this.isFulfilled()||this._allPromise!==t||this._resolver.resolve()}),(s=>{this.isFulfilled()||this._allPromise!==t||o(s)||this._resolver.reject(s)})),s.resolve()}}const m=e=>{let r=class extends e{constructor(...s){super(...s),this._promiseProps=new n,this.addResolvingPromise(Promise.resolve())}destroy(){this._promiseProps?.destroy()}isResolved(){return this._promiseProps.isResolved()}isRejected(){return this._promiseProps.isRejected()}isFulfilled(){return this._promiseProps.isFulfilled()}when(s,e){return this._promiseProps.promise.then((()=>this)).then(s,e)}catch(s){return this.when(null,s)}addResolvingPromise(s){s&&!this._promiseProps.isFulfilled()&&this._promiseProps.addResolvingPromise("_promiseProps"in s?s.when():s)}};return r=s([l("esri.core.Promise")],r),r};let p=class extends(m(e)){};p=s([l("esri.core.Promise")],p);export{p as EsriPromise,m as EsriPromiseMixin};
@@ -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.js";import e from"../Logger.js";import{getOrCreateMapValue as n}from"../MapUtils.js";const r=e.getLogger("esri.core.accessorSupport.ensureTypes");function t(e){return null==e?e:new Date(e)}function o(e){return null==e?e:!!e}function u(e){return null==e?e:e.toString()}function a(e){return null==e?e:(e=parseFloat(e),isNaN(e)?0:e)}function s(e){return null==e?e:Math.round(parseFloat(e))}function i(e){return e&&e.constructor&&void 0!==e.constructor.__accessorMetadata__}function l(e,n){return null!=n&&e&&!(n instanceof e)}function c(e){return e&&"isCollection"in e}function f(e){return e&&e.Type?"function"==typeof e.Type?e.Type:e.Type.base:null}function p(e,n){if(!n||!n.constructor||!c(n.constructor))return y(e,n)?n:new e(n);const r=f(e.prototype.itemType),t=f(n.constructor.prototype.itemType);return r?t?r===t?n:r.prototype.isPrototypeOf(t.prototype)?new e(n):(y(e,n),n):new e(n):n}function y(e,n){return!!i(n)&&(r.error("Accessor#set","Assigning an instance of '"+(n.declaredClass||"unknown")+"' which is not a subclass of '"+g(e)+"'"),!0)}function v(e,n){return null==n?n:c(e)?p(e,n):l(e,n)?y(e,n)?n:new e(n):n}function g(e){return e&&e.prototype&&e.prototype.declaredClass||"unknown"}const d=new WeakMap;function h(e){switch(e){case Number:return a;case T:return s;case Boolean:return o;case String:return u;case Date:return t;default:return n(d,e,(()=>v.bind(null,e)))}}function b(e,n){const r=h(e);return 1===arguments.length?r:r(n)}function m(e,n,r){return 1===arguments.length?m.bind(null,e):n?Array.isArray(n)?n.map((n=>e(n,r))):[e(n,r)]:n}function w(e,n){return 1===arguments.length?m(b.bind(null,e)):m(b.bind(null,e),n)}function A(e,n,r){return 0!==n&&Array.isArray(r)?r.map((r=>A(e,n-1,r))):e(r)}function $(e,n,r){if(2===arguments.length)return $.bind(null,e,n);if(!r)return r;let t=n,o=r=A(e,n,r);for(;t>0&&Array.isArray(o);)t--,o=o[0];if(void 0!==o)for(let u=0;u<t;u++)r=[r];return r}function j(e,n,r){return 2===arguments.length?$(b.bind(null,e),n):$(b.bind(null,e),n,r)}function k(e){return!!Array.isArray(e)&&!e.some((n=>{const r=typeof n;return!("string"===r||"number"===r||"function"===r&&e.length>1)}))}function M(e,n){if(2===arguments.length)return M(e).call(null,n);const t=new Set,o=e.filter((e=>"function"!=typeof e)),u=e.filter((e=>"function"==typeof e));for(const r of e)"string"!=typeof r&&"number"!=typeof r||t.add(r);let a=null,s=null;return(e,n)=>{if(null==e)return e;const i=typeof e,c="string"===i||"number"===i;return c&&(t.has(e)||u.some((e=>"string"===i&&e===String||"number"===i&&e===Number)))||"object"===i&&u.some((n=>!l(e,n)))?e:(c&&o.length?(a||(a=o.map((e=>"string"==typeof e?`'${e}'`:`${e}`)).join(", ")),r.error("Accessor#set",`'${e}' is not a valid value for this property, only the following values are valid: ${a}`)):"object"==typeof e&&u.length?(s||(s=u.map((e=>g(e))).join(", ")),r.error("Accessor#set",`'${e}' is not a valid value for this property, value must be one of ${s}`)):r.error("Accessor#set",`'${e}' is not a valid value for this property`),n&&(n.valid=!1),null)}}function S(e,n){if(2===arguments.length)return S(e).call(null,n);const t={},o=[],u=[];for(const r in e.typeMap){const n=e.typeMap[r];t[r]=b(n),o.push(g(n)),u.push(r)}const a=()=>`'${o.join("', '")}'`,s=()=>`'${u.join("', '")}'`,c="string"==typeof e.key?n=>n[e.key]:e.key;return n=>{if(e.base&&!l(e.base,n))return n;if(null==n)return n;const o=c(n)||e.defaultKeyValue,u=t[o];if(!u)return r.error("Accessor#set",`Invalid property value, value needs to be one of ${a()}, or a plain object that can autocast (having .type = ${s()})`),null;if(!l(e.typeMap[o],n))return n;if("string"==typeof e.key&&!i(n)){const r={};for(const t in n)t!==e.key&&(r[t]=n[t]);return u(r)}return u(n)}}class T{}const N={native:e=>({type:"native",value:e}),array:e=>({type:"array",value:e}),oneOf:e=>({type:"one-of",values:e})};function _(e){if(!e||!("type"in e))return!1;switch(e.type){case"native":case"array":case"one-of":return!0}return!1}function B(e){switch(e.type){case"native":return b(e.value);case"array":return m(B(e.value));case"one-of":return C(e);default:return null}}function C(e){let n=null;return(t,o)=>F(t,e)?t:(null==n&&(n=D(e)),r.error("Accessor#set",`Invalid property value, value needs to be of type ${n}`),o&&(o.valid=!1),null)}function D(e){switch(e.type){case"native":switch(e.value){case Number:return"number";case String:return"string";case Boolean:return"boolean";case T:return"integer";case Date:return"date";default:return g(e.value)}case"array":return`array of ${D(e.value)}`;case"one-of":{const n=e.values.map((e=>D(e)));return`one of ${n.slice(0,n.length-1)} or ${n[n.length-1]}`}}return"unknown"}function F(e,n){if(null==e)return!0;switch(n.type){case"native":switch(n.value){case Number:case T:return"number"==typeof e;case Boolean:return"boolean"==typeof e;case String:return"string"==typeof e}return e instanceof n.value;case"array":return!!Array.isArray(e)&&!e.some((e=>!F(e,n.value)));case"one-of":return n.values.some((n=>F(e,n)))}}export{T as Integer,w as ensureArray,m as ensureArrayTyped,o as ensureBoolean,v as ensureClass,t as ensureDate,s as ensureInteger,B as ensureLongFormType,j as ensureNArray,$ as ensureNArrayTyped,a as ensureNumber,M as ensureOneOf,S as ensureOneOfType,u as ensureString,b as ensureType,i as isClassedType,_ as isLongFormType,k as isOneOf,l as requiresType,N as types};
5
+ import"../has.js";import e from"../Logger.js";import{getOrCreateMapValue as n}from"../MapUtils.js";const r=e.getLogger("esri.core.accessorSupport.ensureTypes");function t(e){return null==e?e:new Date(e)}function o(e){return null==e?e:!!e}function u(e){return null==e?e:e.toString()}function a(e){return null==e?e:(e=parseFloat(e),isNaN(e)?0:e)}function s(e){return null==e?e:Math.round(parseFloat(e))}function i(e){return e&&e.constructor&&void 0!==e.constructor.__accessorMetadata__}function c(e,n){return null!=n&&e&&!(n instanceof e)}function l(e){return e&&"isCollection"in e}function f(e){return e&&e.Type?"function"==typeof e.Type?e.Type:e.Type.base:null}function p(e,n){if(!n||!n.constructor||!l(n.constructor))return y(e,n)?n:new e(n);const r=f(e.prototype.itemType),t=f(n.constructor.prototype.itemType);return r?t?r===t?n:r.prototype.isPrototypeOf(t.prototype)?new e(n):(y(e,n),n):new e(n):n}function y(e,n){return!!i(n)&&(r.error("Accessor#set","Assigning an instance of '"+(n.declaredClass||"unknown")+"' which is not a subclass of '"+g(e)+"'"),!0)}function v(e,n){return null==n?n:l(e)?p(e,n):c(e,n)?y(e,n)?n:new e(n):n}function g(e){return e&&e.prototype&&e.prototype.declaredClass||"unknown"}const h=new WeakMap;function m(e){switch(e){case Number:return a;case T:return s;case Boolean:return o;case String:return u;case Date:return t;default:return n(h,e,(()=>v.bind(null,e)))}}function d(e,n){const r=m(e);return 1===arguments.length?r:r(n)}function b(e,n,r){return 1===arguments.length?b.bind(null,e):n?Array.isArray(n)?n.map((n=>e(n,r))):[e(n,r)]:n}function w(e,n){return 1===arguments.length?b((n=>d(e,n))):b((n=>d(e,n)),n)}function A(e,n,r){return 0!==n&&Array.isArray(r)?r.map((r=>A(e,n-1,r))):e(r)}function $(e,n,r){if(2===arguments.length)return r=>$(e,n,r);if(!r)return r;r=A(e,n,r);let t=n,o=r;for(;t>0&&Array.isArray(o);)t--,o=o[0];if(void 0!==o)for(let u=0;u<t;u++)r=[r];return r}function j(e,n,r){return 2===arguments.length?$((n=>d(e,n)),n):$((n=>d(e,n)),n,r)}function k(e){return!!Array.isArray(e)&&!e.some((n=>{const r=typeof n;return!("string"===r||"number"===r||"function"===r&&e.length>1)}))}function M(e,n){if(2===arguments.length)return M(e).call(null,n);const t=new Set,o=e.filter((e=>"function"!=typeof e)),u=e.filter((e=>"function"==typeof e));for(const r of e)"string"!=typeof r&&"number"!=typeof r||t.add(r);let a=null,s=null;return(e,n)=>{if(null==e)return e;const i=typeof e,l="string"===i||"number"===i;return l&&(t.has(e)||u.some((e=>"string"===i&&e===String||"number"===i&&e===Number)))||"object"===i&&u.some((n=>!c(e,n)))?e:(l&&o.length?(a||(a=o.map((e=>"string"==typeof e?`'${e}'`:`${e}`)).join(", ")),r.error("Accessor#set",`'${e}' is not a valid value for this property, only the following values are valid: ${a}`)):"object"==typeof e&&u.length?(s||(s=u.map((e=>g(e))).join(", ")),r.error("Accessor#set",`'${e}' is not a valid value for this property, value must be one of ${s}`)):r.error("Accessor#set",`'${e}' is not a valid value for this property`),n&&(n.valid=!1),null)}}function S(e,n){if(2===arguments.length)return S(e).call(null,n);const t={},o=[],u=[];for(const r in e.typeMap){const n=e.typeMap[r];t[r]=d(n),o.push(g(n)),u.push(r)}const a=()=>`'${o.join("', '")}'`,s=()=>`'${u.join("', '")}'`,l="string"==typeof e.key?n=>n[e.key]:e.key;return n=>{if(e.base&&!c(e.base,n))return n;if(null==n)return n;const o=l(n)||e.defaultKeyValue,u=t[o];if(!u)return r.error("Accessor#set",`Invalid property value, value needs to be one of ${a()}, or a plain object that can autocast (having .type = ${s()})`),null;if(!c(e.typeMap[o],n))return n;if("string"==typeof e.key&&!i(n)){const r={};for(const t in n)t!==e.key&&(r[t]=n[t]);return u(r)}return u(n)}}class T{}const N={native:e=>({type:"native",value:e}),array:e=>({type:"array",value:e}),oneOf:e=>({type:"one-of",values:e})};function _(e){if(!e||!("type"in e))return!1;switch(e.type){case"native":case"array":case"one-of":return!0}return!1}function B(e){switch(e.type){case"native":return d(e.value);case"array":return b(B(e.value));case"one-of":return C(e);default:return null}}function C(e){let n=null;return(t,o)=>F(t,e)?t:(null==n&&(n=D(e)),r.error("Accessor#set",`Invalid property value, value needs to be of type ${n}`),o&&(o.valid=!1),null)}function D(e){switch(e.type){case"native":switch(e.value){case Number:return"number";case String:return"string";case Boolean:return"boolean";case T:return"integer";case Date:return"date";default:return g(e.value)}case"array":return`array of ${D(e.value)}`;case"one-of":{const n=e.values.map((e=>D(e)));return`one of ${n.slice(0,n.length-1)} or ${n[n.length-1]}`}}return"unknown"}function F(e,n){if(null==e)return!0;switch(n.type){case"native":switch(n.value){case Number:case T:return"number"==typeof e;case Boolean:return"boolean"==typeof e;case String:return"string"==typeof e}return e instanceof n.value;case"array":return!!Array.isArray(e)&&!e.some((e=>!F(e,n.value)));case"one-of":return n.values.some((n=>F(e,n)))}}export{T as Integer,w as ensureArray,b as ensureArrayTyped,o as ensureBoolean,v as ensureClass,t as ensureDate,s as ensureInteger,B as ensureLongFormType,j as ensureNArray,$ as ensureNArrayTyped,a as ensureNumber,M as ensureOneOf,S as ensureOneOfType,u as ensureString,d as ensureType,i as isClassedType,_ as isLongFormType,k as isOneOf,c as requiresType,N as types};
@@ -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 e from"../ArrayPool.js";import{equals as t,equalsShallow as r}from"../lang.js";import{ReentrantObjectPool as o}from"../ReentrantObjectPool.js";import{schedule as l}from"../scheduling.js";import{someSet as n}from"../SetUtils.js";import{generateUID as i}from"../uid.js";import{valueOf as s}from"./get.js";import{reactionDeferred as u,reaction as a}from"./trackingUtils.js";import{parse as c,once as d}from"./utils.js";var h;!function(e){e[e.Untracked=0]="Untracked",e[e.Tracked=1]="Tracked"}(h||(h={}));class f{constructor(){this.uid=i(),this.removed=!1,this.type=null,this.oldValue=null,this.callback=null,this.getValue=null,this.target=null,this.path=null,this.equals=null}static acquireUntracked(e,r,o,l,n){return this.pool.acquire(h.Untracked,e,r,o,l,n,t)}static acquireTracked(e,t,r,o){return this.pool.acquire(h.Tracked,e,t,r,null,null,o)}notify(e,t){this.type===h.Untracked?this.callback.call(this.target,e,t,this.path,this.target):this.callback.call(null,e,t)}acquire(e,t,r,o,l,n,s){this.uid=i(),this.removed=!1,this.type=e,this.oldValue=t,this.callback=r,this.getValue=o,this.target=l,this.path=n,this.equals=s}release(){this.target=this.path=this.oldValue=this.callback=this.getValue=null,this.uid=i(),this.removed=!0}}f.pool=new o(f);const m=new e,p=new Set;let v;function k(e){p.delete(e),p.add(e),v||(v=l(q))}function _(e){if(e.removed)return;const t=e.oldValue,r=e.getValue();e.equals(t,r)||(e.oldValue=r,e.notify(r,t))}function g(e){for(const t of p.values())t.target===e&&(t.removed=!0)}function q(){let e=10;for(;v&&e--;){v=null;const e=j(),t=m.acquire();for(const r of e){const e=r.uid;_(r),e===r.uid&&r.removed&&t.push(r)}for(const r of p)r.removed&&(t.push(r),p.delete(r));for(const r of t)f.pool.release(r);m.release(t),m.release(e),V.forEach((e=>e()))}}function j(){const e=m.acquire();e.length=p.size;let t=0;for(const r of p)e[t]=r,++t;return p.clear(),e}const V=new Set;function y(e){return V.add(e),{remove(){V.delete(e)}}}function U(e,t,r){let o=c(e,t,r,((e,t,r)=>{let l,n,i=u((()=>s(e,t)),((i,s)=>{e.__accessor__.destroyed||l&&l.uid!==n?o.remove():(l||(l=f.acquireUntracked(i,r,s,e,t),n=l.uid),k(l))}));return{remove:d((()=>{i.remove(),l&&(l.uid!==n||l.removed||(l.removed=!0,k(l)),l=null),o=i=null}))}}));return o}function b(e,r,o){const l=c(e,r,o,((e,r,o)=>{let n=!1;return a((()=>s(e,r)),((i,s)=>{e.__accessor__.destroyed?l.remove():n||(n=!0,t(s,i)||o.call(e,i,s,r,e),n=!1)}))}));return l}function T(e,t,r,o=!1){return!e.__accessor__||e.__accessor__.destroyed?{remove(){}}:o?b(e,t,r):U(e,t,r)}function w(e,t,r){let o,l,n=u(e,((e,i)=>{o&&o.uid!==l?n.remove():(o||(o=f.acquireTracked(e,t,i,r),l=o.uid),k(o))}));return{remove:d((()=>{n.remove(),o&&(o.uid!==l||o.removed||(o.removed=!0,k(o)),o=null),n=null}))}}function S(e,t,r){let o=!1;return a(e,((e,l)=>{o||(o=!0,r(l,e)||t(e,l),o=!1)}))}function P(e,t,o=!1,l=r){return o?S(e,t,l):w(e,t,l)}function x(e){return n(p,(t=>t.oldValue===e))}export{y as afterDispatch,q as dispatch,x as isValueInUse,g as removeTarget,T as watch,P as watchTracked};
5
+ import e from"../ArrayPool.js";import{equals as t,equalsShallow as r}from"../lang.js";import{ReentrantObjectPool as o}from"../ReentrantObjectPool.js";import{schedule as l}from"../scheduling.js";import{someSet as i}from"../SetUtils.js";import{generateUID as n}from"../uid.js";import{valueOf as s}from"./get.js";import{reactionDeferred as u,reaction as a}from"./trackingUtils.js";import{parse as c,once as d}from"./utils.js";var h;!function(e){e[e.Untracked=0]="Untracked",e[e.Tracked=1]="Tracked"}(h||(h={}));class f{constructor(){this.uid=n(),this.removed=!1,this.type=null,this.oldValue=null,this.callback=null,this.getValue=null,this.target=null,this.path=null,this.equals=null}static acquireUntracked(e,r,o,l,i){return this.pool.acquire(h.Untracked,e,r,o,l,i,t)}static acquireTracked(e,t,r,o){return this.pool.acquire(h.Tracked,e,t,r,null,null,o)}notify(e,t){this.type===h.Untracked?this.callback.call(this.target,e,t,this.path,this.target):this.callback.call(null,e,t,void 0,void 0)}acquire(e,t,r,o,l,i,s){this.uid=n(),this.removed=!1,this.type=e,this.oldValue=t,this.callback=r,this.getValue=o,this.target=l,this.path=i,this.equals=s}release(){this.target=this.path=this.oldValue=this.callback=this.getValue=null,this.uid=n(),this.removed=!0}}f.pool=new o(f);const m=new e,v=new Set;let p;function k(e){v.delete(e),v.add(e),p||(p=l(q))}function _(e){if(e.removed)return;const t=e.oldValue,r=e.getValue();e.equals(t,r)||(e.oldValue=r,e.notify(r,t))}function g(e){for(const t of v.values())t.target===e&&(t.removed=!0)}function q(){let e=10;for(;p&&e--;){p=null;const e=j(),t=m.acquire();for(const r of e){const e=r.uid;_(r),e===r.uid&&r.removed&&t.push(r)}for(const r of v)r.removed&&(t.push(r),v.delete(r));for(const r of t)f.pool.release(r);m.release(t),m.release(e),V.forEach((e=>e()))}}function j(){const e=m.acquire();e.length=v.size;let t=0;for(const r of v)e[t]=r,++t;return v.clear(),e}const V=new Set;function y(e){return V.add(e),{remove(){V.delete(e)}}}function U(e,t,r){let o=c(e,t,r,((e,t,r)=>{let l,i,n=u((()=>s(e,t)),((n,s)=>{e.__accessor__.destroyed||l&&l.uid!==i?o.remove():(l||(l=f.acquireUntracked(n,r,s,e,t),i=l.uid),k(l))}));return{remove:d((()=>{n.remove(),l&&(l.uid!==i||l.removed||(l.removed=!0,k(l)),l=null),o=n=null}))}}));return o}function b(e,r,o){const l=c(e,r,o,((e,r,o)=>{let i=!1;return a((()=>s(e,r)),((n,s)=>{e.__accessor__.destroyed?l.remove():i||(i=!0,t(s,n)||o.call(e,n,s,r,e),i=!1)}))}));return l}function T(e,t,r,o=!1){return!e.__accessor__||e.__accessor__.destroyed?{remove(){}}:o?b(e,t,r):U(e,t,r)}function w(e,t,r){let o,l,i=u(e,((e,n)=>{o&&o.uid!==l?i.remove():(o||(o=f.acquireTracked(e,t,n,r),l=o.uid),k(o))}));return{remove:d((()=>{i.remove(),o&&(o.uid!==l||o.removed||(o.removed=!0,k(o)),o=null),i=null}))}}function S(e,t,r){let o=!1;return a(e,((e,l)=>{o||(o=!0,r(l,e)||t(e,l),o=!1)}))}function P(e,t,o=!1,l=r){return o?S(e,t,l):w(e,t,l)}function x(e){return i(v,(t=>t.oldValue===e))}export{y as afterDispatch,q as dispatch,x as isValueInUse,g as removeTarget,T as watch,P as watchTracked};
@@ -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{equals as r}from"../arrayUtils.js";import e from"../Error.js";import t from"../Logger.js";import{idToReadableName as i,OriginId as o,nameToId as n}from"./PropertyOrigin.js";import{getProperties as s,merge as u}from"./utils.js";import{originSpecificWritePropertyDefinition as l}from"./extensions/serializableProperty.js";function a(r,e,t,i,o){const n={};return e.write?.writer?.call(r,i,n,t,o),n}function f(r,i,s,u,l,a){if(!u||!u.write)return!1;const f=r.get(s);if(!l&&u.write.overridePolicy){const e=u.write.overridePolicy.call(r,f,s,a);void 0!==e&&(l=e)}if(l||(l=u.write),!l||!1===l.enabled)return!1;if((null===f&&!l.allowNull&&!l.writerEnsuresNonNull||void 0===f)&&l.isRequired){const i=new e("web-document-write:property-required",`Missing value for required property '${s}' on '${r.declaredClass}'`,{propertyName:s,target:r});return i&&a&&a.messages?a.messages.push(i):i&&!a&&t.getLogger("esri.core.accessorSupport.write").error(i.name,i.message),!1}if(void 0===f)return!1;if(null===f&&!l.allowNull&&!l.writerEnsuresNonNull)return!1;if((!i.store.multipleOriginsSupported||i.store.originOf(s)===o.DEFAULTS)&&p(r,s,a,u,f))return!1;if(!l.ignoreOrigin&&a&&a.origin&&i.store.multipleOriginsSupported){if(i.store.originOf(s)<n(a.origin))return!1}return!0}function p(e,t,i,o,n){const s=o.default;if(void 0===s)return!1;if(null!=o.defaultEquals)return o.defaultEquals(n);if("function"==typeof s){if(Array.isArray(n)){const o=s.call(e,t,i);return r(o,n)}return!1}return s===n}function c(r,e,t,i){const o=s(r),n=o.metadatas,u=l(n[e],i);return!!u&&f(r,o,e,u,t,i)}function g(r,e,t){if(r&&"function"==typeof r.toJSON&&(!r.toJSON.isDefaultToJSON||!r.write))return u(e,r.toJSON(t));const o=s(r),n=o.metadatas;for(const s in n){const p=l(n[s],t);if(!f(r,o,s,p,void 0,t))continue;const c=r.get(s),g=a(r,p,p.write&&"string"==typeof p.write.target?p.write.target:s,c,t);Object.keys(g).length>0&&(e=u(e,g),t?.resources?.pendingOperations?.length&&t.resources.pendingOperations.push(Promise.all(t.resources.pendingOperations).then((()=>u(e,g,(()=>"replace-arrays"))))),t&&t.writtenProperties&&t.writtenProperties.push({target:r,propName:s,oldOrigin:i(o.store.originOf(s)),newOrigin:t.origin}))}return e}export{c as willPropertyWrite,g as write};
5
+ import{equals as r}from"../arrayUtils.js";import e from"../Error.js";import t from"../Logger.js";import{idToReadableName as i,OriginId as o,nameToId as n}from"./PropertyOrigin.js";import{getProperties as s,merge as u}from"./utils.js";import{originSpecificWritePropertyDefinition as l}from"./extensions/serializableProperty.js";function a(r,e,t,i,o){const n={};return e.write?.writer?.call(r,i,n,t,o),n}function f(r,i,s,u,l,a){if(!u||!u.write)return!1;const f=r.get(s);if(!l&&u.write.overridePolicy){const e=u.write.overridePolicy.call(r,f,s,a??void 0);void 0!==e&&(l=e)}if(l||(l=u.write),!l||!1===l.enabled)return!1;if((null===f&&!l.allowNull&&!l.writerEnsuresNonNull||void 0===f)&&l.isRequired){const i=new e("web-document-write:property-required",`Missing value for required property '${s}' on '${r.declaredClass}'`,{propertyName:s,target:r});return i&&a&&a.messages?a.messages.push(i):i&&!a&&t.getLogger("esri.core.accessorSupport.write").error(i.name,i.message),!1}if(void 0===f)return!1;if(null===f&&!l.allowNull&&!l.writerEnsuresNonNull)return!1;if((!i.store.multipleOriginsSupported||i.store.originOf(s)===o.DEFAULTS)&&p(r,s,a,u,f))return!1;if(!l.ignoreOrigin&&a&&a.origin&&i.store.multipleOriginsSupported){if(i.store.originOf(s)<n(a.origin))return!1}return!0}function p(e,t,i,o,n){const s=o.default;if(void 0===s)return!1;if(null!=o.defaultEquals)return o.defaultEquals(n);if("function"==typeof s){if(Array.isArray(n)){const o=s.call(e,t,i??void 0);return r(o,n)}return!1}return s===n}function c(r,e,t,i){const o=s(r),n=o.metadatas,u=l(n[e],i);return!!u&&f(r,o,e,u,t,i)}function g(r,e,t){if(r&&"function"==typeof r.toJSON&&(!r.toJSON.isDefaultToJSON||!r.write))return u(e,r.toJSON(t));const o=s(r),n=o.metadatas;for(const s in n){const p=l(n[s],t);if(!f(r,o,s,p,void 0,t))continue;const c=r.get(s),g=a(r,p,p.write&&"string"==typeof p.write.target?p.write.target:s,c,t);Object.keys(g).length>0&&(e=u(e,g),t?.resources?.pendingOperations?.length&&t.resources.pendingOperations.push(Promise.all(t.resources.pendingOperations).then((()=>u(e,g,(()=>"replace-arrays"))))),t&&t.writtenProperties&&t.writtenProperties.push({target:r,propName:s,oldOrigin:i(o.store.originOf(s)),newOrigin:t.origin}))}return e}export{c as willPropertyWrite,g as write};
@@ -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{clock as t}from"./clock.js";import n from"./Error.js";import{once as r}from"./events.js";import e from"./Logger.js";import{removeMaybe as o,assumeNonNull as i}from"./maybe.js";async function u(t,n){const r=t.slice(),e=await Promise.all(t.map(((t,r)=>n(t,r))));return r.filter(((t,n)=>e[n]))}function s(t="Aborted"){return new n("AbortError",t)}function c(t,n="Aborted"){if(f(t))throw s(n)}function l(t){return null!=t?"aborted"in t?t:t.signal:t}function f(t){const n=l(t);return null!=n&&n.aborted}function a(t){if(d(t))throw t}function m(t){if(!d(t))throw t}function w(t,n){const e=l(t);if(null!=e){if(!e.aborted)return r(e,"abort",(()=>n()));n()}}function h(t,n){const e=l(t);if(null!=e)return c(e),r(e,"abort",(()=>n(s())))}function p(t,n){return null==l(n)?t:new Promise(((r,e)=>{let i=w(n,(()=>e(s())));const u=()=>i=o(i);t.then(u,u),t.then(r,e)}))}function b(t,r,e){return Promise.race([t,A(r).then((()=>{throw new n("timeout",`Did not resolve within ${r} milliseconds (${e??"timeout"})`)}))])}function d(t){return"AbortError"===t?.name}async function v(t){try{return await t}catch(n){if(!d(n))throw n;return}}async function y(t,n=e.getLogger("esri")){try{return await t}catch(r){d(r)||n.error(r)}}function j(){let t=null;const n=new Promise(((n,r)=>{t={promise:void 0,resolve:n,reject:r}}));return t.promise=n,t}async function P(t){if(!t)return;if("function"!=typeof t.forEach){const n=Object.keys(t),r=n.map((n=>t[n])),e=await P(r),o={};return n.map(((t,n)=>o[t]=e[n])),o}const n=t;return Promise.allSettled(n).then((t=>Array.from(n,((n,r)=>{const e=t[r];return"fulfilled"===e.status?{promise:n,value:e.value}:{promise:n,error:e.reason}}))))}async function g(t){return(await P(t)).filter((t=>!!t.value)).map((t=>t.value))}function A(t,n=undefined,r){const e=new AbortController;return w(r,(()=>e.abort())),new Promise(((r,o)=>{let i=setTimeout((()=>{i=0,r(n)}),t);w(e,(()=>{i&&(clearTimeout(i),o(s()))}))}))}function T(t,r,e,o){const i=e&&"abort"in e?e:null;null!=o||i||(o=e);let u=setTimeout((()=>{u=0,i&&i.abort()}),r);const s=()=>o||new n("promiseUtils:timeout","The wrapped promise did not resolve within "+r+" ms");return t.then((t=>{if(0===u)throw s();return clearTimeout(u),t}),(t=>{throw clearTimeout(u),0===u?s():t}))}function E(t){return t&&"function"==typeof t.then}function k(t){return E(t)?t:Promise.resolve(t)}function C(t,n=-1){let r,e,o,u,c=null;const l=(...f)=>{if(r){e=f,u&&u.reject(s()),u=j();const t=i(u.promise);if(c){const t=c;c=null,t.abort()}return t}if(o=u||j(),u=null,n>0){const e=new AbortController;r=k(t(...f,e.signal));const o=r;A(n).then((()=>{r===o&&(u?e.abort():c=e)}))}else r=1,r=k(t(...f));const a=()=>{const t=e;e=o=r=c=null,null!=t&&l(...t)},m=r,w=o;return m.then(a,a),m.then(w.resolve,w.reject),i(w.promise)};return l}function L(){let n,r;const e=new Promise(((t,e)=>{n=t,r=e})),o=t=>{n(t)};return o.resolve=t=>n(t),o.reject=t=>r(t),o.timeout=(n,r)=>t.setTimeout((()=>o.reject(r)),n),o.promise=e,o}function $(t,n){return t.then(n,n)}async function x(t){await Promise.resolve(),c(t)}export{A as after,$ as always,s as createAbortError,j as createDeferred,L as createResolver,C as debounce,P as eachAlways,g as eachAlwaysValues,u as filter,v as ignoreAbortErrors,d as isAbortError,f as isAborted,E as isPromiseLike,y as logOnError,w as onAbort,h as onAbortOrThrow,a as throwIfAbortError,c as throwIfAborted,m as throwIfNotAbortError,T as timeout,x as waitTick,k as when,p as whenOrAbort,b as whenOrTimeout};
5
+ import{clock as t}from"./clock.js";import r from"./Error.js";import{once as n}from"./events.js";import e from"./Logger.js";import{removeMaybe as o,assumeNonNull as i}from"./maybe.js";async function u(t,r){const n=t.slice(),e=await Promise.all(t.map(((t,n)=>r(t,n))));return n.filter(((t,r)=>e[r]))}function c(t="Aborted"){return new r("AbortError",t)}function s(t,r="Aborted"){if(a(t))throw c(r)}function l(t){return null!=t?"aborted"in t?t:t.signal:t}function a(t){const r=l(t);return null!=r&&r.aborted}function f(t){if(d(t))throw t}function m(t){if(!d(t))throw t}function w(t,r){const e=l(t);if(null!=e){if(!e.aborted)return n(e,"abort",(()=>r()));r()}}function h(t,r){const e=l(t);if(null!=e)return s(e),n(e,"abort",(()=>r(c())))}function p(t,r){return null==l(r)?t:new Promise(((n,e)=>{let i=w(r,(()=>e(c())));const u=()=>i=o(i);t.then(u,u),t.then(n,e)}))}function b(t,n,e){return Promise.race([t,g(n).then((()=>{throw new r("timeout",`Did not resolve within ${n} milliseconds (${e??"timeout"})`)}))])}function d(t){return"AbortError"===t?.name}async function y(t){try{return await t}catch(r){if(!d(r))throw r;return}}async function v(t,r=e.getLogger("esri")){try{return await t}catch(n){d(n)||r.error(n)}}async function j(t){if(!t)return;if("function"!=typeof t.forEach){const r=Object.keys(t),n=r.map((r=>t[r])),e=await j(n),o={};return r.map(((t,r)=>o[t]=e[r])),o}const r=t;return Promise.allSettled(r).then((t=>Array.from(r,((r,n)=>{const e=t[n];return"fulfilled"===e.status?{promise:r,value:e.value}:{promise:r,error:e.reason}}))))}async function P(t){return(await j(t)).filter((t=>!!t.value)).map((t=>t.value))}function g(t,r=void 0,n){const e=new AbortController;return w(n,(()=>e.abort())),new Promise(((n,o)=>{let i=setTimeout((()=>{i=0,n(r)}),t);w(e,(()=>{i&&(clearTimeout(i),o(c()))}))}))}function A(t,n,e,o){const i=e&&"abort"in e?e:null;null!=o||i||(o=e);let u=setTimeout((()=>{u=0,i&&i.abort()}),n);const c=()=>o||new r("promiseUtils:timeout","The wrapped promise did not resolve within "+n+" ms");return t.then((t=>{if(0===u)throw c();return clearTimeout(u),t}),(t=>{throw clearTimeout(u),0===u?c():t}))}function T(t){return t&&"function"==typeof t.then}function E(t){return T(t)?t:Promise.resolve(t)}function k(t,r=-1){let n,e,o,u,s=null;const l=(...a)=>{if(n){e=a,u&&u.reject(c()),u=C();const t=i(u.promise);if(s){const t=s;s=null,t.abort()}return t}if(o=u||C(),u=null,r>0){const e=new AbortController;n=E(t(...a,e.signal));const o=n;g(r).then((()=>{n===o&&(u?e.abort():s=e)}))}else n=1,n=E(t(...a));const f=()=>{const t=e;e=o=n=s=null,null!=t&&l(...t)},m=n,w=o;return m.then(f,f),m.then(w.resolve,w.reject),i(w.promise)};return l}function C(){let r,n;const e=new Promise(((t,e)=>{r=t,n=e})),o=t=>{r(t)};return o.resolve=t=>r(t),o.reject=t=>n(t),o.timeout=(r,n)=>t.setTimeout((()=>o.reject(n)),r),o.promise=e,o}function L(t,r){return t.then(r,r)}async function $(t){await Promise.resolve(),s(t)}export{g as after,L as always,c as createAbortError,C as createResolver,k as debounce,j as eachAlways,P as eachAlwaysValues,u as filter,y as ignoreAbortErrors,d as isAbortError,a as isAborted,T as isPromiseLike,v as logOnError,w as onAbort,h as onAbortOrThrow,f as throwIfAbortError,s as throwIfAborted,m as throwIfNotAbortError,A as timeout,$ as waitTick,E as when,p as whenOrAbort,b as whenOrTimeout};
@@ -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{deprecatedModule as n}from"./deprecate.js";import{isEventTarget as t,on as r}from"./events.js";import{equals as e}from"./lang.js";import o from"./Logger.js";import{createDeferred as c,onAbort as u,createAbortError as i}from"./promiseUtils.js";n(o.getLogger("esri.core.watchUtils"),"esri/core/watchUtils",{see:"https://arcg.is/1LTnuf",replacement:"esri/core/reactiveUtils",warnOnce:!0,version:"4.24"});const s=/\?(\.|$)/g;function f(n,t,r,e){const o=Array.isArray(t)?t:t.includes(",")?t.split(","):[t],c=l(n,t,r,e);for(const u of o){const t=u.trim().replace(s,"$1"),e=n.get(t);r.call(n,e,e,t,n)}return c}function l(n,t,r,e){return n.watch(t,r,e)}function a(n,t,r,e){return N(n,t,null,r,e)}function m(n,t,r,e){return z(n,t,T,r,e)}function p(n,t,r,e){return N(n,t,T,r,e)}function g(n,t,r,e){return z(n,t,V,r,e)}function v(n,t,r,e){return N(n,t,V,r,e)}function h(n,t,r,e){return z(n,t,k,r,e)}function d(n,t,r,e){return N(n,t,k,r,e)}function j(n,t,r,e){return z(n,t,q,r,e)}function y(n,t,r,e){return N(n,t,q,r,e)}function w(n,t,r,e){return z(n,t,B,r,e)}function b(n,t,r,e){return N(n,t,B,r,e)}function A(n,t,r,e){return z(n,t,C,r,e)}function U(n,t,r,e){return N(n,t,C,r,e)}function L(n,t,r,o,c){return z(n,t,(n=>e(r,n)),o,c)}function O(n,t,r,o,c){return N(n,t,(n=>e(r,n)),o,c)}function $(n,t,r,e){let o=!1;const c=n.watch(t,((t,e,c,u)=>{o||r.call(n,t,e,c,u)}),e);return{remove(){c.remove()},pause(){o=!0},resume(){o=!1}}}function x(n,e,o,c,u,i,s){const l={};function a(t){const r=l[t];r&&(i&&i(r.target,t,n,o),r.handle.remove(),delete l[t])}const m=f(n,e,((e,i,s)=>{a(s),t(e)&&(l[s]={handle:r(e,o,c),target:e},u&&u(e,s,n,o))}),s);return{remove(){m.remove();for(const n in l)a(n)}}}function z(n,t,r,e,o){const c=n.watch(t,((t,o,c,u)=>{r&&!r(t)||e?.call(n,t,o,c,u)}),o);if(Array.isArray(t))for(const u of t){const o=n.get(u);r&&r(o)&&e?.call(n,o,o,t,n)}else{const o=n.get(t);r&&r(o)&&e?.call(n,o,o,t,n)}return c}function N(n,t,r,e,o){const s="function"==typeof e?e:null,f="object"==typeof e?e:null;"boolean"==typeof e&&(o=e);let l,a=!1;function m(){l&&(l.remove(),l=null)}const p=c();u(f,(()=>{m(),p.reject(i())}));const g={then:p.promise.then.bind(p.promise),catch:p.promise.catch.bind(p.promise),remove:m};return Object.freeze(g),l=z(n,t,r,((t,r,e,o)=>{a=!0,m(),s&&s.call(n,t,r,e,o),p.resolve({value:t,oldValue:r,propertyName:e,target:o})}),o),a&&m(),g}function T(n){return!!n}function V(n){return!n}function k(n){return!0===n}function q(n){return!1===n}function B(n){return void 0!==n}function C(n){return void 0===n}export{f as init,x as on,a as once,$ as pausable,l as watch,m as when,w as whenDefined,b as whenDefinedOnce,L as whenEqual,O as whenEqualOnce,j as whenFalse,y as whenFalseOnce,g as whenNot,v as whenNotOnce,p as whenOnce,h as whenTrue,d as whenTrueOnce,A as whenUndefined,U as whenUndefinedOnce,N as whenValidOnce};
5
+ import{deprecatedModule as n}from"./deprecate.js";import{isEventTarget as t,on as r}from"./events.js";import{equals as e}from"./lang.js";import o from"./Logger.js";import{createResolver as c,onAbort as u,createAbortError as i}from"./promiseUtils.js";n(o.getLogger("esri.core.watchUtils"),"esri/core/watchUtils",{see:"https://arcg.is/1LTnuf",replacement:"esri/core/reactiveUtils",warnOnce:!0,version:"4.24"});const s=/\?(\.|$)/g;function f(n,t,r,e){const o=Array.isArray(t)?t:t.includes(",")?t.split(","):[t],c=l(n,t,r,e);for(const u of o){const t=u.trim().replace(s,"$1"),e=n.get(t);r.call(n,e,e,t,n)}return c}function l(n,t,r,e){return n.watch(t,r,e)}function a(n,t,r,e){return N(n,t,null,r,e)}function m(n,t,r,e){return z(n,t,T,r,e)}function p(n,t,r,e){return N(n,t,T,r,e)}function g(n,t,r,e){return z(n,t,V,r,e)}function v(n,t,r,e){return N(n,t,V,r,e)}function h(n,t,r,e){return z(n,t,k,r,e)}function d(n,t,r,e){return N(n,t,k,r,e)}function j(n,t,r,e){return z(n,t,q,r,e)}function y(n,t,r,e){return N(n,t,q,r,e)}function w(n,t,r,e){return z(n,t,B,r,e)}function b(n,t,r,e){return N(n,t,B,r,e)}function A(n,t,r,e){return z(n,t,C,r,e)}function U(n,t,r,e){return N(n,t,C,r,e)}function L(n,t,r,o,c){return z(n,t,(n=>e(r,n)),o,c)}function O(n,t,r,o,c){return N(n,t,(n=>e(r,n)),o,c)}function $(n,t,r,e){let o=!1;const c=n.watch(t,((t,e,c,u)=>{o||r.call(n,t,e,c,u)}),e);return{remove(){c.remove()},pause(){o=!0},resume(){o=!1}}}function x(n,e,o,c,u,i,s){const l={};function a(t){const r=l[t];r&&(i&&i(r.target,t,n,o),r.handle.remove(),delete l[t])}const m=f(n,e,((e,i,s)=>{a(s),t(e)&&(l[s]={handle:r(e,o,c),target:e},u&&u(e,s,n,o))}),s);return{remove(){m.remove();for(const n in l)a(n)}}}function z(n,t,r,e,o){const c=n.watch(t,((t,o,c,u)=>{r&&!r(t)||e?.call(n,t,o,c,u)}),o);if(Array.isArray(t))for(const u of t){const o=n.get(u);r&&r(o)&&e?.call(n,o,o,t,n)}else{const o=n.get(t);r&&r(o)&&e?.call(n,o,o,t,n)}return c}function N(n,t,r,e,o){const s="function"==typeof e?e:null,f="object"==typeof e?e:null;"boolean"==typeof e&&(o=e);let l,a=!1;function m(){l&&(l.remove(),l=null)}const p=c();u(f,(()=>{m(),p.reject(i())}));const g={then:p.promise.then.bind(p.promise),catch:p.promise.catch.bind(p.promise),remove:m};return Object.freeze(g),l=z(n,t,r,((t,r,e,o)=>{a=!0,m(),s&&s.call(n,t,r,e,o),p.resolve({value:t,oldValue:r,propertyName:e,target:o})}),o),a&&m(),g}function T(n){return!!n}function V(n){return!n}function k(n){return!0===n}function q(n){return!1===n}function B(n){return void 0!==n}function C(n){return void 0===n}export{f as init,x as on,a as once,$ as pausable,l as watch,m as when,w as whenDefined,b as whenDefinedOnce,L as whenEqual,O as whenEqualOnce,j as whenFalse,y as whenFalseOnce,g as whenNot,v as whenNotOnce,p as whenOnce,h as whenTrue,d as whenTrueOnce,A as whenUndefined,U as whenUndefinedOnce,N as whenValidOnce};
@@ -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{handlesGroup as e}from"../handleUtils.js";import t from"../Logger.js";import{isPromiseLike as s,createAbortError as n,createDeferred as i,throwIfAborted as o}from"../promiseUtils.js";import r from"../Queue.js";import l from"./RemoteClient.js";class h{constructor(){this._inUseClients=new Array,this._clients=new Array,this._clientPromises=new Array,this._ongoingJobsQueue=new r}destroy(){this.close()}get closed(){return!this._clients||!this._clients.length}open(e,t){return new Promise(((n,i)=>{let r=!0;const h=e=>{o(t.signal),r&&(r=!1,e())};this._clients.length=e.length,this._clientPromises.length=e.length,this._inUseClients.length=e.length;for(let o=0;o<e.length;++o){const r=e[o];s(r)?this._clientPromises[o]=r.then((e=>(this._clients[o]=new l(e,t,(()=>this._ongoingJobsQueue.pop()??null)),h(n),this._clients[o])),(()=>(h(i),null))):(this._clients[o]=new l(r,t,(()=>this._ongoingJobsQueue.pop()??null)),this._clientPromises[o]=Promise.resolve(this._clients[o]),h(n))}}))}broadcast(e,t,s){const n=new Array(this._clientPromises.length);for(let i=0;i<this._clientPromises.length;++i){const o=this._clientPromises[i];n[i]=o.then((n=>n?.invoke(e,t,s)))}return n}close(){let e;for(;e=this._ongoingJobsQueue.pop();)e.deferred.reject(n(`Worker closing, aborting job calling '${e.methodName}'`));for(const t of this._clientPromises)t.then((e=>e?.close()));this._clients.length=0,this._clientPromises.length=0,this._inUseClients.length=0}invoke(e,s,n){let o;Array.isArray(n)?(t.getLogger("esri.core.workers.Connection").warn("invoke()","The transferList parameter is deprecated, use the options object instead"),o={transferList:n}):o=n;const r=i();this._ongoingJobsQueue.push({methodName:e,data:s,invokeOptions:o,deferred:r});for(let t=0;t<this._clientPromises.length;t++){const e=this._clients[t];e?e.jobAdded():this._clientPromises[t].then((e=>e?.jobAdded()))}return r.promise}on(t,s){return Promise.all(this._clientPromises).then((()=>e(this._clients.map((e=>e.on(t,s))))))}openPorts(){return new Promise((e=>{const t=new Array(this._clientPromises.length);let s=t.length;for(let n=0;n<this._clientPromises.length;++n){this._clientPromises[n].then((i=>{i&&(t[n]=i.openPort()),0==--s&&e(t)}))}}))}get test(){return{numClients:this._clients.length}}}export{h as default};
5
+ import{handlesGroup as e}from"../handleUtils.js";import t from"../Logger.js";import{isPromiseLike as s,createAbortError as n,createResolver as i,throwIfAborted as o}from"../promiseUtils.js";import r from"../Queue.js";import l from"./RemoteClient.js";class h{constructor(){this._inUseClients=new Array,this._clients=new Array,this._clientPromises=new Array,this._ongoingJobsQueue=new r}destroy(){this.close()}get closed(){return!this._clients||!this._clients.length}open(e,t){return new Promise(((n,i)=>{let r=!0;const h=e=>{o(t.signal),r&&(r=!1,e())};this._clients.length=e.length,this._clientPromises.length=e.length,this._inUseClients.length=e.length;for(let o=0;o<e.length;++o){const r=e[o];s(r)?this._clientPromises[o]=r.then((e=>(this._clients[o]=new l(e,t,(()=>this._ongoingJobsQueue.pop()??null)),h(n),this._clients[o])),(()=>(h(i),null))):(this._clients[o]=new l(r,t,(()=>this._ongoingJobsQueue.pop()??null)),this._clientPromises[o]=Promise.resolve(this._clients[o]),h(n))}}))}broadcast(e,t,s){const n=new Array(this._clientPromises.length);for(let i=0;i<this._clientPromises.length;++i){const o=this._clientPromises[i];n[i]=o.then((n=>n?.invoke(e,t,s)))}return n}close(){let e;for(;e=this._ongoingJobsQueue.pop();)e.resolver.reject(n(`Worker closing, aborting job calling '${e.methodName}'`));for(const t of this._clientPromises)t.then((e=>e?.close()));this._clients.length=0,this._clientPromises.length=0,this._inUseClients.length=0}invoke(e,s,n){let o;Array.isArray(n)?(t.getLogger("esri.core.workers.Connection").warn("invoke()","The transferList parameter is deprecated, use the options object instead"),o={transferList:n}):o=n;const r=i();this._ongoingJobsQueue.push({methodName:e,data:s,invokeOptions:o,resolver:r});for(let t=0;t<this._clientPromises.length;t++){const e=this._clients[t];e?e.jobAdded():this._clientPromises[t].then((e=>e?.jobAdded()))}return r.promise}on(t,s){return Promise.all(this._clientPromises).then((()=>e(this._clients.map((e=>e.on(t,s))))))}openPorts(){return new Promise((e=>{const t=new Array(this._clientPromises.length);let s=t.length;for(let n=0;n<this._clientPromises.length;++n){this._clientPromises[n].then((i=>{i&&(t[n]=i.openPort()),0==--s&&e(t)}))}}))}get test(){return{numClients:this._clients.length}}}export{h 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{fullVersion as e}from"../../kernel.js";import s from"../Error.js";import{on as t}from"../events.js";import{removeMaybe as o}from"../maybe.js";import{isAborted as n,createAbortError as r,onAbort as i,isPromiseLike as l,isAbortError as a}from"../promiseUtils.js";import{registry as h}from"./registry.js";import{newJobId as c,MessageType as _,receiveMessage as p,toInvokeError as d,postMessage as u}from"./utils.js";import{buildDate as b,commitHash as g}from"../../support/revision.js";const{CLOSE:m,ABORT:f,INVOKE:v,RESPONSE:M,OPEN_PORT:k,ON:j}=_,y=2;class I{constructor(e){this._timer=null,this._cancelledJobIds=new Set,this._invokeMessages=[],this._invoke=e,this._timer=null,this._process=this._process.bind(this)}push(e){e.type===_.ABORT?this._cancelledJobIds.add(e.jobId):(this._invokeMessages.push(e),null===this._timer&&(this._timer=setTimeout(this._process,0)))}clear(){this._invokeMessages.length=0,this._cancelledJobIds.clear(),this._timer=null}_process(){this._timer=null;for(const e of this._invokeMessages)this._cancelledJobIds.has(e.jobId)||this._invoke(e);this._cancelledJobIds.clear(),this._invokeMessages.length=0}}class J{static connect(e){const s=new MessageChannel;let t;t="function"==typeof e?new e:"default"in e&&"function"==typeof e.default?new e.default:e;const o=new J(s.port1,{channel:s,client:t},(()=>null));return"object"==typeof t&&"remoteClient"in t&&(t.remoteClient=o),J.clients.set(o,t),s.port2}static loadWorker(e){const s=h[e];return s?s():Promise.resolve(null)}constructor(e,s,t){this._port=e,this._getNextJob=t,this._outJobs=new Map,this._inJobs=new Map,this._invokeQueue=new I((e=>this._onInvokeMessage(e))),this._client=s.client,this._onMessage=this._onMessage.bind(this),this._channel=s.channel,this._schedule=s.schedule,this._port.addEventListener("message",this._onMessage),this._port.start()}close(){this._post({type:m}),this._close()}isBusy(){return this._outJobs.size>0}invoke(e,t,l){const a=l?.signal,h=l?.transferList;if(!this._port)return Promise.reject(new s("worker:port-closed",`Cannot call invoke('${e}'), port is closed`,{methodName:e,data:t}));const _=c();return new Promise(((s,l)=>{if(n(a))return this._processWork(),void l(r());const c=i(a,(()=>{const e=this._outJobs.get(_);e&&(this._outJobs.delete(_),this._processWork(),o(e.abortHandle),this._post({type:f,jobId:_}),l(r()))})),p={resolve:s,reject:l,abortHandle:c,debugInfo:e};this._outJobs.set(_,p),this._post({type:v,jobId:_,methodName:e,abortable:null!=a},t,h)}))}on(e,s){const t=new MessageChannel;function o(e){s(e.data)}return this._port.postMessage({type:_.ON,eventType:e,port:t.port2},[t.port2]),t.port1.addEventListener("message",o),t.port1.start(),{remove(){t.port1.postMessage({type:_.CLOSE}),t.port1.close(),t.port1.removeEventListener("message",o)}}}jobAdded(){this._processWork()}openPort(){const e=new MessageChannel;return this._post({type:k,port:e.port2}),e.port1}_processWork(){if(this._outJobs.size>=y)return;const e=this._getNextJob();if(!e)return;const{methodName:s,data:t,invokeOptions:o,deferred:n}=e;this.invoke(s,t,o).then((e=>n.resolve(e))).catch((e=>n.reject(e)))}_close(){this._channel&&(this._channel=void 0),this._port.removeEventListener("message",this._onMessage),this._port.close(),this._outJobs.forEach((e=>{o(e.abortHandle),e.reject(r(`Worker closing, aborting job calling '${e.debugInfo}'`))})),this._inJobs.clear(),this._outJobs.clear(),this._invokeQueue.clear(),this._port=null,this._client=null,this._schedule=null}_onMessage(e){null!=this._schedule?this._schedule((()=>this._processMessage(e))):this._processMessage(e)}_processMessage(e){const s=p(e);if(s)switch(s.type){case M:this._onResponseMessage(s);break;case v:this._invokeQueue.push(s);break;case f:this._onAbortMessage(s);break;case m:this._onCloseMessage();break;case k:this._onOpenPortMessage(s);break;case j:this._onOnMessage(s)}}_onAbortMessage(e){const s=this._inJobs,t=e.jobId,o=s.get(t);this._invokeQueue.push(e),o&&(o.controller&&o.controller.abort(),s.delete(t))}_onCloseMessage(){const e=this._client;this._close(),e&&"destroy"in e&&J.clients.get(this)===e&&e.destroy(),J.clients.delete(this),e?.remoteClient&&(e.remoteClient=null)}_onInvokeMessage(e){const{methodName:s,jobId:t,data:o,abortable:n}=e,r=n?new AbortController:null,i=this._inJobs;let h,c=this._client,_=c[s];try{if(!_&&s&&s.includes(".")){const e=s.split(".");for(let s=0;s<e.length-1;s++)c=c[e[s]],_=c[e[s+1]]}if("function"!=typeof _)throw new TypeError(`${s} is not a function`);h=_.call(c,o,{client:this,signal:r?r.signal:null})}catch(p){return void this._post({type:M,jobId:t,error:d(p)})}l(h)?(i.set(t,{controller:r,promise:h}),h.then((e=>{i.has(t)&&(i.delete(t),this._post({type:M,jobId:t},e))}),(e=>{i.has(t)&&(i.delete(t),a(e)||this._post({type:M,jobId:t,error:d(e||{message:`Error encountered at method ${s}`})}))}))):this._post({type:M,jobId:t},h)}_onOpenPortMessage(e){new J(e.port,{client:this._client},(()=>null))}_onOnMessage(e){const{port:s}=e,o=this._client.on(e.eventType,(e=>{s.postMessage(e)})),n=t(e.port,"message",(e=>{const t=p(e);t?.type===_.CLOSE&&(n.remove(),o.remove(),s.close())}))}_onResponseMessage(e){const{jobId:t,error:n,data:r}=e,i=this._outJobs;if(!i.has(t))return;const l=i.get(t);i.delete(t),this._processWork(),o(l.abortHandle),n?l.reject(s.fromJSON(JSON.parse(n))):l.resolve(r)}_post(e,s,t){return u(this._port,e,s,t)}}J.kernelInfo={buildDate:b,fullVersion:e,revision:g},J.clients=new Map;export{J as default};
5
+ import{fullVersion as e}from"../../kernel.js";import s from"../Error.js";import{on as t}from"../events.js";import{removeMaybe as o}from"../maybe.js";import{isAborted as n,createAbortError as r,onAbort as i,isPromiseLike as l,isAbortError as a}from"../promiseUtils.js";import{registry as h}from"./registry.js";import{newJobId as c,MessageType as _,receiveMessage as p,toInvokeError as u,postMessage as d}from"./utils.js";import{buildDate as b,commitHash as g}from"../../support/revision.js";const{CLOSE:m,ABORT:f,INVOKE:v,RESPONSE:M,OPEN_PORT:k,ON:j}=_,y=2;class I{constructor(e){this._timer=null,this._cancelledJobIds=new Set,this._invokeMessages=[],this._invoke=e,this._timer=null,this._process=this._process.bind(this)}push(e){e.type===_.ABORT?this._cancelledJobIds.add(e.jobId):(this._invokeMessages.push(e),null===this._timer&&(this._timer=setTimeout(this._process,0)))}clear(){this._invokeMessages.length=0,this._cancelledJobIds.clear(),this._timer=null}_process(){this._timer=null;for(const e of this._invokeMessages)this._cancelledJobIds.has(e.jobId)||this._invoke(e);this._cancelledJobIds.clear(),this._invokeMessages.length=0}}class J{static connect(e){const s=new MessageChannel;let t;t="function"==typeof e?new e:"default"in e&&"function"==typeof e.default?new e.default:e;const o=new J(s.port1,{channel:s,client:t},(()=>null));return"object"==typeof t&&"remoteClient"in t&&(t.remoteClient=o),J.clients.set(o,t),s.port2}static loadWorker(e){const s=h[e];return s?s():Promise.resolve(null)}constructor(e,s,t){this._port=e,this._getNextJob=t,this._outJobs=new Map,this._inJobs=new Map,this._invokeQueue=new I((e=>this._onInvokeMessage(e))),this._client=s.client,this._onMessage=this._onMessage.bind(this),this._channel=s.channel,this._schedule=s.schedule,this._port.addEventListener("message",this._onMessage),this._port.start()}close(){this._post({type:m}),this._close()}isBusy(){return this._outJobs.size>0}invoke(e,t,l){const a=l?.signal,h=l?.transferList;if(!this._port)return Promise.reject(new s("worker:port-closed",`Cannot call invoke('${e}'), port is closed`,{methodName:e,data:t}));const _=c();return new Promise(((s,l)=>{if(n(a))return this._processWork(),void l(r());const c=i(a,(()=>{const e=this._outJobs.get(_);e&&(this._outJobs.delete(_),this._processWork(),o(e.abortHandle),this._post({type:f,jobId:_}),l(r()))})),p={resolve:s,reject:l,abortHandle:c,debugInfo:e};this._outJobs.set(_,p),this._post({type:v,jobId:_,methodName:e,abortable:null!=a},t,h)}))}on(e,s){const t=new MessageChannel;function o(e){s(e.data)}return this._port.postMessage({type:_.ON,eventType:e,port:t.port2},[t.port2]),t.port1.addEventListener("message",o),t.port1.start(),{remove(){t.port1.postMessage({type:_.CLOSE}),t.port1.close(),t.port1.removeEventListener("message",o)}}}jobAdded(){this._processWork()}openPort(){const e=new MessageChannel;return this._post({type:k,port:e.port2}),e.port1}_processWork(){if(this._outJobs.size>=y)return;const e=this._getNextJob();if(!e)return;const{methodName:s,data:t,invokeOptions:o,resolver:n}=e;this.invoke(s,t,o).then((e=>n.resolve(e))).catch((e=>n.reject(e)))}_close(){this._channel&&(this._channel=void 0),this._port.removeEventListener("message",this._onMessage),this._port.close(),this._outJobs.forEach((e=>{o(e.abortHandle),e.reject(r(`Worker closing, aborting job calling '${e.debugInfo}'`))})),this._inJobs.clear(),this._outJobs.clear(),this._invokeQueue.clear(),this._port=null,this._client=null,this._schedule=null}_onMessage(e){null!=this._schedule?this._schedule((()=>this._processMessage(e))):this._processMessage(e)}_processMessage(e){const s=p(e);if(s)switch(s.type){case M:this._onResponseMessage(s);break;case v:this._invokeQueue.push(s);break;case f:this._onAbortMessage(s);break;case m:this._onCloseMessage();break;case k:this._onOpenPortMessage(s);break;case j:this._onOnMessage(s)}}_onAbortMessage(e){const s=this._inJobs,t=e.jobId,o=s.get(t);this._invokeQueue.push(e),o&&(o.controller&&o.controller.abort(),s.delete(t))}_onCloseMessage(){const e=this._client;this._close(),e&&"destroy"in e&&J.clients.get(this)===e&&e.destroy(),J.clients.delete(this),e?.remoteClient&&(e.remoteClient=null)}_onInvokeMessage(e){const{methodName:s,jobId:t,data:o,abortable:n}=e,r=n?new AbortController:null,i=this._inJobs;let h,c=this._client,_=c[s];try{if(!_&&s&&s.includes(".")){const e=s.split(".");for(let s=0;s<e.length-1;s++)c=c[e[s]],_=c[e[s+1]]}if("function"!=typeof _)throw new TypeError(`${s} is not a function`);h=_.call(c,o,{client:this,signal:r?r.signal:null})}catch(p){return void this._post({type:M,jobId:t,error:u(p)})}l(h)?(i.set(t,{controller:r,promise:h}),h.then((e=>{i.has(t)&&(i.delete(t),this._post({type:M,jobId:t},e))}),(e=>{i.has(t)&&(i.delete(t),a(e)||this._post({type:M,jobId:t,error:u(e||{message:`Error encountered at method ${s}`})}))}))):this._post({type:M,jobId:t},h)}_onOpenPortMessage(e){new J(e.port,{client:this._client},(()=>null))}_onOnMessage(e){const{port:s}=e,o=this._client.on(e.eventType,(e=>{s.postMessage(e)})),n=t(e.port,"message",(e=>{const t=p(e);t?.type===_.CLOSE&&(n.remove(),o.remove(),s.close())}))}_onResponseMessage(e){const{jobId:t,error:n,data:r}=e,i=this._outJobs;if(!i.has(t))return;const l=i.get(t);i.delete(t),this._processWork(),o(l.abortHandle),n?l.reject(s.fromJSON(JSON.parse(n))):l.resolve(r)}_post(e,s,t){return d(this._port,e,s,t)}}J.kernelInfo={buildDate:b,fullVersion:e,revision:g},J.clients=new Map;export{J 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{getAssetUrl as e}from"../../assets.js";import r from"../../config.js";import"../../intl.js";import{fullVersion as o}from"../../kernel.js";import has from"../has.js";import t from"../Logger.js";import{makeAbsolute as s}from"../urlUtils.js";import{loaderConfig as n}from"./loaderConfig.js";import{receiveMessage as i,MessageType as a}from"./utils.js";import l from"./WorkerFallback.js";import{getLocale as f}from"../../intl/locale.js";import{buildDate as c,commitHash as d}from"../../support/revision.js";const u=t.getLogger("esri.core.workers.workerFactory"),{HANDSHAKE:m}=a,p='let globalId=0;const outgoing=new Map,configuration=JSON.parse("{CONFIGURATION}");self.esriConfig=configuration.esriConfig;const workerPath=self.esriConfig.workers.workerPath,HANDSHAKE=0,OPEN=1,OPENED=2,RESPONSE=3,INVOKE=4,ABORT=5;function createAbortError(){const e=new Error("Aborted");return e.name="AbortError",e}function receiveMessage(e){return e&&e.data?"string"==typeof e.data?JSON.parse(e.data):e.data:null}function invokeStaticMessage(e,o,r){const t=r&&r.signal,n=globalId++;return new Promise(((r,s)=>{if(t){if(t.aborted)return s(createAbortError());t.addEventListener("abort",(()=>{outgoing.get(n)&&(outgoing.delete(n),self.postMessage({type:ABORT,jobId:n}),s(createAbortError()))}))}outgoing.set(n,{resolve:r,reject:s}),self.postMessage({type:INVOKE,jobId:n,methodName:e,abortable:null!=t,data:o})}))}let workerRevisionChecked=!1;function checkWorkerRevision(e){if(!workerRevisionChecked&&e.kernelInfo){workerRevisionChecked=!0;const{revision:o,fullVersion:r}=configuration.kernelInfo,{revision:t,fullVersion:n,version:s}=e.kernelInfo;esriConfig.assetsPath!==esriConfig.defaultAssetsPath&&o!==t&&console.warn(`Version mismatch detected between ArcGIS Maps SDK for JavaScript modules and assets. For more information visit https://bit.ly/3QnsuSo.\\nModules version: ${r}\\nAssets version: ${n??s}\\nAssets path: ${esriConfig.assetsPath}`)}}function messageHandler(e){const o=receiveMessage(e);if(!o)return;const r=o.jobId;switch(o.type){case OPEN:let n;function t(e){const o=n.connect(e);self.postMessage({type:OPENED,jobId:r,data:o},[o])}"function"==typeof define&&define.amd?require([workerPath],(e=>{n=e.default||e,checkWorkerRevision(n),n.loadWorker(o.modulePath).then((e=>e||new Promise((e=>{require([o.modulePath],e)})))).then(t)})):"System"in self&&"function"==typeof System.import?System.import(workerPath).then((e=>(n=e.default,checkWorkerRevision(n),n.loadWorker(o.modulePath)))).then((e=>e||System.import(o.modulePath))).then(t):esriConfig.workers.useDynamicImport?import(workerPath).then((e=>{n=e.default||e,checkWorkerRevision(n),n.loadWorker(o.modulePath).then((e=>e||import(o.modulePath))).then(t)})):(self.RemoteClient||importScripts(workerPath),n=self.RemoteClient.default||self.RemoteClient,checkWorkerRevision(n),n.loadWorker(o.modulePath).then(t));break;case RESPONSE:if(outgoing.has(r)){const s=outgoing.get(r);outgoing.delete(r),o.error?s.reject(JSON.parse(o.error)):s.resolve(o.data)}}}self.dojoConfig=configuration.loaderConfig,esriConfig.workers.loaderUrl&&(self.importScripts(esriConfig.workers.loaderUrl),"function"==typeof require&&"function"==typeof require.config&&require.config(configuration.loaderConfig)),self.addEventListener("message",messageHandler),self.postMessage({type:0});';let g,k;const h="Failed to create Worker. Fallback to execute module in main thread";async function w(){if(!has("esri-workers")||(has("mozilla"),0))return y(new l);if(!g&&!k)try{const e=p.split('"{CONFIGURATION}"').join(`'${b()}'`);g=URL.createObjectURL(new Blob([e],{type:"text/javascript"}))}catch(r){k=r||{}}let e;if(g)try{e=new Worker(g,{name:"esri-worker-"+v++})}catch(r){u.warn(h,k),e=new l}else u.warn(h,k),e=new l;return y(e)}async function y(e){return new Promise((r=>{function o(s){const n=i(s);n&&n.type===m&&(e.removeEventListener("message",o),e.removeEventListener("error",t),r(e))}function t(r){r.preventDefault(),e.removeEventListener("message",o),e.removeEventListener("error",t),u.warn("Failed to create Worker. Fallback to execute module in main thread",r),(e=new l).addEventListener("message",o),e.addEventListener("error",t)}e.addEventListener("message",o),e.addEventListener("error",t)}))}function b(){let t;if(null!=r.default){const e={...r};delete e.default,t=JSON.parse(JSON.stringify(e))}else t=JSON.parse(JSON.stringify(r));t.assetsPath=s(t.assetsPath),t.defaultAssetsPath=t.defaultAssetsPath?s(t.defaultAssetsPath):void 0,t.request.interceptors=[],t.log.interceptors=[],t.locale=f(),t.has={"esri-csp-restrictions":has("esri-csp-restrictions"),"esri-2d-debug":!1,"esri-2d-update-debug":has("esri-2d-update-debug"),"featurelayer-pbf":has("featurelayer-pbf"),"featurelayer-simplify-thresholds":has("featurelayer-simplify-thresholds"),"featurelayer-simplify-payload-size-factors":has("featurelayer-simplify-payload-size-factors"),"featurelayer-simplify-mobile-factor":has("featurelayer-simplify-mobile-factor"),"esri-atomics":has("esri-atomics"),"esri-shared-array-buffer":has("esri-shared-array-buffer"),"esri-tiles-debug":has("esri-tiles-debug"),"esri-workers-arraybuffer-transfer":has("esri-workers-arraybuffer-transfer"),"feature-polyline-generalization-factor":has("feature-polyline-generalization-factor"),"host-webworker":1,"polylabel-placement-enabled":has("polylabel-placement-enabled")},t.workers.loaderUrl&&(t.workers.loaderUrl=s(t.workers.loaderUrl)),t.workers.workerPath?t.workers.workerPath=s(t.workers.workerPath):t.workers.workerPath=s(e("esri/core/workers/RemoteClient.js")),t.workers.useDynamicImport=!1;const i=r.workers.loaderConfig,a=n({baseUrl:i?.baseUrl,locale:f(),has:{"csp-restrictions":1,"dojo-test-sniff":0,"host-webworker":1,...i?.has},map:{...i?.map},paths:{...i?.paths},packages:i?.packages||[]}),l={buildDate:c,fullVersion:o,revision:d};return JSON.stringify({esriConfig:t,loaderConfig:a,kernelInfo:l})}let v=0;export{w as createWorker};
5
+ import{getAssetUrl as e}from"../../assets.js";import r from"../../config.js";import"../../intl.js";import{fullVersion as o}from"../../kernel.js";import has from"../has.js";import t from"../Logger.js";import{makeAbsolute as s}from"../urlUtils.js";import{loaderConfig as n}from"./loaderConfig.js";import{receiveMessage as i,MessageType as a}from"./utils.js";import l from"./WorkerFallback.js";import{getLocale as f}from"../../intl/locale.js";import{buildDate as c,commitHash as d}from"../../support/revision.js";const u=t.getLogger("esri.core.workers.workerFactory"),{HANDSHAKE:m}=a,p='let globalId=0;const outgoing=new Map,configuration=JSON.parse("{CONFIGURATION}");self.esriConfig=configuration.esriConfig;const workerPath=self.esriConfig.workers.workerPath,HANDSHAKE=0,OPEN=1,OPENED=2,RESPONSE=3,INVOKE=4,ABORT=5;function createAbortError(){const e=new Error("Aborted");return e.name="AbortError",e}function receiveMessage(e){return e&&e.data?"string"==typeof e.data?JSON.parse(e.data):e.data:null}function invokeStaticMessage(e,o,r){const t=r&&r.signal,n=globalId++;return new Promise(((r,s)=>{if(t){if(t.aborted)return s(createAbortError());t.addEventListener("abort",(()=>{outgoing.get(n)&&(outgoing.delete(n),self.postMessage({type:ABORT,jobId:n}),s(createAbortError()))}))}outgoing.set(n,{resolve:r,reject:s}),self.postMessage({type:INVOKE,jobId:n,methodName:e,abortable:null!=t,data:o})}))}let workerRevisionChecked=!1;function checkWorkerRevision(e){if(!workerRevisionChecked&&e.kernelInfo){workerRevisionChecked=!0;const{revision:o,fullVersion:r}=configuration.kernelInfo,{revision:t,fullVersion:n,version:s}=e.kernelInfo;esriConfig.assetsPath!==esriConfig.defaultAssetsPath&&o!==t&&console.warn(`Version mismatch detected between ArcGIS Maps SDK for JavaScript modules and assets. For more information visit https://bit.ly/3QnsuSo.\\nModules version: ${r}\\nAssets version: ${n??s}\\nAssets path: ${esriConfig.assetsPath}`)}}function messageHandler(e){const o=receiveMessage(e);if(!o)return;const r=o.jobId;switch(o.type){case OPEN:let n;function t(e){const o=n.connect(e);self.postMessage({type:OPENED,jobId:r,data:o},[o])}"function"==typeof define&&define.amd?require([workerPath],(e=>{n=e.default||e,checkWorkerRevision(n),n.loadWorker(o.modulePath).then((e=>e||new Promise((e=>{require([o.modulePath],e)})))).then(t)})):"System"in self&&"function"==typeof System.import?System.import(workerPath).then((e=>(n=e.default,checkWorkerRevision(n),n.loadWorker(o.modulePath)))).then((e=>e||System.import(o.modulePath))).then(t):esriConfig.workers.useDynamicImport?import(workerPath).then((e=>{n=e.default||e,checkWorkerRevision(n),n.loadWorker(o.modulePath).then((e=>e||import(o.modulePath))).then(t)})):(self.RemoteClient||importScripts(workerPath),n=self.RemoteClient.default||self.RemoteClient,checkWorkerRevision(n),n.loadWorker(o.modulePath).then(t));break;case RESPONSE:if(outgoing.has(r)){const s=outgoing.get(r);outgoing.delete(r),o.error?s.reject(JSON.parse(o.error)):s.resolve(o.data)}}}self.dojoConfig=configuration.loaderConfig,esriConfig.workers.loaderUrl&&(self.importScripts(esriConfig.workers.loaderUrl),"function"==typeof require&&"function"==typeof require.config&&require.config(configuration.loaderConfig)),self.addEventListener("message",messageHandler),self.postMessage({type:0});';let g,k;const h="Failed to create Worker. Fallback to execute module in main thread";async function w(){if(!has("esri-workers")||(has("mozilla"),0))return y(new l);if(!g&&!k)try{const e=p.split('"{CONFIGURATION}"').join(`'${b()}'`);g=URL.createObjectURL(new Blob([e],{type:"text/javascript"}))}catch(r){k=r||{}}let e;if(g)try{e=new Worker(g,{name:"esri-worker-"+v++})}catch(r){u.warn(h,k),e=new l}else u.warn(h,k),e=new l;return y(e)}async function y(e){return new Promise((r=>{function o(s){const n=i(s);n&&n.type===m&&(e.removeEventListener("message",o),e.removeEventListener("error",t),r(e))}function t(r){r.preventDefault(),e.removeEventListener("message",o),e.removeEventListener("error",t),u.warn("Failed to create Worker. Fallback to execute module in main thread",r),(e=new l).addEventListener("message",o),e.addEventListener("error",t)}e.addEventListener("message",o),e.addEventListener("error",t)}))}function b(){let t;if(null!=r.default){const e={...r};delete e.default,t=JSON.parse(JSON.stringify(e))}else t=JSON.parse(JSON.stringify(r));t.assetsPath=s(t.assetsPath),t.defaultAssetsPath=t.defaultAssetsPath?s(t.defaultAssetsPath):void 0,t.request.interceptors=[],t.log.interceptors=[],t.locale=f(),t.has={"esri-csp-restrictions":has("esri-csp-restrictions"),"esri-2d-debug":!1,"esri-2d-update-debug":has("esri-2d-update-debug"),"esri-2d-log-updating":has("esri-2d-log-updating"),"featurelayer-pbf":has("featurelayer-pbf"),"featurelayer-simplify-thresholds":has("featurelayer-simplify-thresholds"),"featurelayer-simplify-payload-size-factors":has("featurelayer-simplify-payload-size-factors"),"featurelayer-simplify-mobile-factor":has("featurelayer-simplify-mobile-factor"),"esri-atomics":has("esri-atomics"),"esri-shared-array-buffer":has("esri-shared-array-buffer"),"esri-tiles-debug":has("esri-tiles-debug"),"esri-workers-arraybuffer-transfer":has("esri-workers-arraybuffer-transfer"),"feature-polyline-generalization-factor":has("feature-polyline-generalization-factor"),"host-webworker":1,"polylabel-placement-enabled":has("polylabel-placement-enabled")},t.workers.loaderUrl&&(t.workers.loaderUrl=s(t.workers.loaderUrl)),t.workers.workerPath?t.workers.workerPath=s(t.workers.workerPath):t.workers.workerPath=s(e("esri/core/workers/RemoteClient.js")),t.workers.useDynamicImport=!1;const i=r.workers.loaderConfig,a=n({baseUrl:i?.baseUrl,locale:f(),has:{"csp-restrictions":1,"dojo-test-sniff":0,"host-webworker":1,...i?.has},map:{...i?.map},paths:{...i?.paths},packages:i?.packages||[]}),l={buildDate:c,fullVersion:o,revision:d};return JSON.stringify({esriConfig:t,loaderConfig:a,kernelInfo:l})}let v=0;export{w as createWorker};
@@ -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"../../geometry.js";import e from"../../core/Error.js";import{convertUnit as t}from"../../core/unitUtils.js";import{toRadians as n,spheroids as i,WKT_SPHEROID_REGEX as s}from"./geodesicConstants.js";import{equals as r,isGeographic as a}from"./spatialReferenceUtils.js";import o from"../Polyline.js";import c from"../Polygon.js";import h from"../Point.js";import l from"../SpatialReference.js";function f(e){if(!e)return null;if(a(e)&&e.wkid){const t=i[e.wkid];if(t)return t}if(e.wkt){const t=p(e.wkt);if(t)return t}return null}function p(e){const t=s.exec(e);if(!t||2!==t.length)return null;const n=t[1].split(",");if(!n||n.length<3)return null;const i=parseFloat(n[1]),r=parseFloat(n[2]);if(isNaN(i)||isNaN(r))return null;return{a:i,f:0===r?0:1/r}}function u(e){const t=f(e??l.WGS84);if(d(t))return t;const n=t.a*(1-t.f);return Object.assign(t,{b:n,eSq:1-(n/t.a)**2,radius:(2*t.a+n)/3,densificationRatio:1e4/((2*t.a+n)/3)})}function d(e){return null!=e&&"b"in e&&"eSq"in e&&"radius"in e}function m(e){return null!=e&&e<0?e+360:e}function g(e,t,i){const{a:s,eSq:r}=u(i),a=Math.sqrt(r),o=Math.sin(t[1]*n),c=s*t[0]*n;let h;if(r>0){h=s*((1-r)*(o/(1-r*(o*o))-1/(2*a)*Math.log((1-a*o)/(1+a*o))))*.5}else h=s*o;return e[0]=c,e[1]=h,e}function M(e){return null!==f(e)}function w(n,i="square-meters"){if(n.some((e=>!M(e.spatialReference))))throw new e("geodesic-areas:invalid-spatial-reference","the input geometries spatial reference is not supported");const s=[];for(let e=0;e<n.length;e++){const t=n[e],i=t.spatialReference,{radius:r,densificationRatio:a}=u(i),o=r*a;s.push(R(t,o))}const r=[],a=[0,0],o=[0,0];for(let e=0;e<s.length;e++){const{rings:n,spatialReference:c}=s[e];let h=0;for(let e=0;e<n.length;e++){const t=n[e];g(a,t[0],c),g(o,t[t.length-1],c);let i=o[0]*a[1]-a[0]*o[1];for(let e=0;e<t.length-1;e++)g(a,t[e+1],c),g(o,t[e],c),i+=o[0]*a[1]-a[0]*o[1];h+=i}h=t(h,"square-meters",i),r.push(h/-2)}return r}function y(n,i="meters"){if(!n)throw new e("geodesic-lengths:invalid-geometries","the input geometries type is not supported");if(n.some((e=>!M(e.spatialReference))))throw new e("geodesic-lengths:invalid-spatial-reference","the input geometries spatial reference is not supported");const s=[];for(let e=0;e<n.length;e++){const r=n[e],{spatialReference:a}=r,o="polyline"===r.type?r.paths:r.rings;let c=0;for(let e=0;e<o.length;e++){const t=o[e];let n=0;for(let e=1;e<t.length;e++){const i=t[e-1][0],s=t[e][0],r=t[e-1][1],o=t[e][1];if(r!==o||i!==s){const e=new v;b(e,[i,r],[s,o],a),n+=e.distance}}c+=n}c=t(c,"meters",i),s.push(c)}return s}function R(t,n){if("polyline"!==t.type&&"polygon"!==t.type)throw new e("geodesic-densify:invalid-geometry","the input geometry is neither polyline nor polygon");const{spatialReference:i}=t;if(!M(i))throw new e("geodesic-densify:invalid-spatial-reference","the input geometry spatial reference is not supported");const s="polyline"===t.type?t.paths:t.rings,r=[],a=[0,0],h=new v;for(const e of s){const t=[];r.push(t),t.push([e[0][0],e[0][1]]);let s,o,c=e[0][0],l=e[0][1];for(let r=0;r<e.length-1;r++){if(s=e[r+1][0],o=e[r+1][1],c===s&&l===o)continue;const f=[c,l];b(h,[c,l],[s,o],i);const{azimuth:p,distance:u}=h,d=u/n;if(d>1){for(let e=1;e<=d-1;e++){z(a,f,p,e*n,i),t.push(a.slice(0))}z(a,f,p,(u+Math.floor(d-1)*n)/2,i),t.push(a.slice(0))}z(a,f,p,u,i),t.push(a.slice(0)),c=a[0],l=a[1]}}return"polyline"===t.type?new o({paths:r,spatialReference:i}):new c({rings:r,spatialReference:i})}class v{constructor(e=0,t=undefined,n=undefined){this.distance=e,this.azimuth=t,this.reverseAzimuth=n}}function z(e,t,i,s,r){const a=t[0],o=t[1],c=a*n,h=o*n,l=(i??0)*n,{a:f,b:p,f:d}=u(r),m=Math.sin(l),g=Math.cos(l),M=(1-d)*Math.tan(h),w=1/Math.sqrt(1+M*M),y=M*w,R=Math.atan2(M,g),v=w*m,z=v*v,b=1-z,j=b*(f*f-p*p)/(p*p),q=1+j/16384*(4096+j*(j*(320-175*j)-768)),x=j/1024*(256+j*(j*(74-47*j)-128));let A,N,S,k,P=s/(p*q),F=2*Math.PI;for(;Math.abs(P-F)>1e-12;)S=Math.cos(2*R+P),A=Math.sin(P),N=Math.cos(P),k=x*A*(S+x/4*(N*(2*S*S-1)-x/6*S*(4*A*A-3)*(4*S*S-3))),F=P,P=s/(p*q)+k;const U=y*A-w*N*g,C=Math.atan2(y*N+w*A*g,(1-d)*Math.sqrt(z+U*U)),E=Math.atan2(A*m,w*N-y*A*g),G=d/16*b*(4+d*(4-3*b)),I=C/n,O=(c+(E-(1-G)*d*v*(P+G*A*(S+G*N*(2*S*S-1)))))/n;return e[0]=O,e[1]=I,e}function b(e,t,i,s){const r=t[0]*n,a=t[1]*n,o=i[0]*n,c=i[1]*n,{a:h,b:l,f,radius:p}=u(s),d=o-r,m=Math.atan((1-f)*Math.tan(a)),g=Math.atan((1-f)*Math.tan(c)),M=Math.sin(m),w=Math.cos(m),y=Math.sin(g),R=Math.cos(g);let v,z,b,j,q,x,A,N,S,k,P=1e3,F=d;do{if(A=Math.sin(F),N=Math.cos(F),b=Math.sqrt(R*A*(R*A)+(w*y-M*R*N)*(w*y-M*R*N)),0===b)return e.distance=0,e.azimuth=void 0,e.reverseAzimuth=void 0,e;q=M*y+w*R*N,x=Math.atan2(b,q),S=w*R*A/b,z=1-S*S,j=q-2*M*y/z,isNaN(j)&&(j=0),k=f/16*z*(4+f*(4-3*z)),v=F,F=d+(1-k)*f*S*(x+k*b*(j+k*q*(2*j*j-1)))}while(Math.abs(F-v)>1e-12&&--P>0);if(0===P){const t=p,i=Math.acos(Math.sin(a)*Math.sin(c)+Math.cos(a)*Math.cos(c)*Math.cos(o-r))*t,s=o-r,h=Math.sin(s)*Math.cos(c),l=Math.cos(a)*Math.sin(c)-Math.sin(a)*Math.cos(c)*Math.cos(s),f=Math.atan2(h,l);return e.azimuth=f/n,e.distance=i,e.reverseAzimuth=void 0,e}const U=z*(h*h-l*l)/(l*l),C=U/1024*(256+U*(U*(74-47*U)-128)),E=l*(1+U/16384*(4096+U*(U*(320-175*U)-768)))*(x-C*b*(j+C/4*(q*(2*j*j-1)-C/6*j*(4*b*b-3)*(4*j*j-3)))),G=Math.atan2(R*Math.sin(F),w*y-M*R*Math.cos(F)),I=Math.atan2(w*Math.sin(F),w*y*Math.cos(F)-M*R);return e.azimuth=G/n,e.distance=E,e.reverseAzimuth=I/n,e}function j(n,i,s="meters"){if(!n||!i)throw new e("geodesic-distance:missing-parameters","one or both input parameters are missing");if(!n.spatialReference||!i.spatialReference)throw new e("geodesic-distance:invalid-parameters","one or both input points do not have a spatial reference");if(!r(n.spatialReference,i.spatialReference))throw new e("geodesic-distance:invalid-parameters","spatial references of input parameters do not match");const{spatialReference:a}=n;if(!M(a))throw new e("geodesic-distance:not-supported","input geometry spatial reference is not supported");if(n.x===i.x&&n.y===i.y)return new v(0,0,0);const o=new v;return b(o,[n.x,n.y],[i.x,i.y],a),o.distance=t(o.distance,"meters",s),o.azimuth=m(o.azimuth),o.reverseAzimuth=m(o.reverseAzimuth),o}function q(t,n,i){if(!t||null==n||null==i)throw new e("point-from-distance:missing-parameters","one or more input parameters are missing or undefined");if(i<0||i>360)throw new e("point-from-distance:-of-bounds","azimuth is restricted to angles between, and including, 0° to 360° degrees");if(!t.spatialReference)throw new e("point-from-distance:missing-spatial-reference","the input point must have a spatial reference");const{spatialReference:s}=t;if(!M(s))throw new e("geodesic-distance:not-supported","input geometry spatial reference is not supported");const r=[0,0];return z(r,[t.x,t.y],i,n,s),new h({x:r[0],y:r[1],spatialReference:s})}export{v as InverseGeodeticSolverResult,z as directGeodeticSolver,w as geodesicAreas,R as geodesicDensify,j as geodesicDistance,y as geodesicLengths,b as inverseGeodeticSolver,M as isSupported,q as pointFromDistance};
5
+ import"../../geometry.js";import e from"../../core/Error.js";import{convertUnit as t}from"../../core/unitUtils.js";import{toRadians as n,spheroids as i,WKT_SPHEROID_REGEX as s}from"./geodesicConstants.js";import{equals as r,isGeographic as a}from"./spatialReferenceUtils.js";import o from"../Polyline.js";import c from"../Polygon.js";import h from"../Point.js";import l from"../SpatialReference.js";function f(e){if(!e)return null;if(a(e)&&e.wkid){const t=i[e.wkid];if(t)return t}if(e.wkt){const t=p(e.wkt);if(t)return t}return null}function p(e){const t=s.exec(e);if(!t||2!==t.length)return null;const n=t[1].split(",");if(!n||n.length<3)return null;const i=parseFloat(n[1]),r=parseFloat(n[2]);if(isNaN(i)||isNaN(r))return null;return{a:i,f:0===r?0:1/r}}function u(e){const t=f(e??l.WGS84);if(d(t))return t;const n=t.a*(1-t.f);return Object.assign(t,{b:n,eSq:1-(n/t.a)**2,radius:(2*t.a+n)/3,densificationRatio:1e4/((2*t.a+n)/3)})}function d(e){return null!=e&&"b"in e&&"eSq"in e&&"radius"in e}function m(e){return null!=e&&e<0?e+360:e}function g(e,t,i){const{a:s,eSq:r}=u(i),a=Math.sqrt(r),o=Math.sin(t[1]*n),c=s*t[0]*n;let h;if(r>0){h=s*((1-r)*(o/(1-r*(o*o))-1/(2*a)*Math.log((1-a*o)/(1+a*o))))*.5}else h=s*o;return e[0]=c,e[1]=h,e}function M(e){return null!==f(e)}function w(n,i="square-meters"){if(n.some((e=>!M(e.spatialReference))))throw new e("geodesic-areas:invalid-spatial-reference","the input geometries spatial reference is not supported");const s=[];for(let e=0;e<n.length;e++){const t=n[e],i=t.spatialReference,{radius:r,densificationRatio:a}=u(i),o=r*a;s.push(v(t,o))}const r=[],a=[0,0],o=[0,0];for(let e=0;e<s.length;e++){const{rings:n,spatialReference:c}=s[e];let h=0;for(let e=0;e<n.length;e++){const t=n[e];g(a,t[0],c),g(o,t[t.length-1],c);let i=o[0]*a[1]-a[0]*o[1];for(let e=0;e<t.length-1;e++)g(a,t[e+1],c),g(o,t[e],c),i+=o[0]*a[1]-a[0]*o[1];h+=i}h=t(h,"square-meters",i),r.push(h/-2)}return r}function y(n,i="meters"){if(!n)throw new e("geodesic-lengths:invalid-geometries","the input geometries type is not supported");if(n.some((e=>!M(e.spatialReference))))throw new e("geodesic-lengths:invalid-spatial-reference","the input geometries spatial reference is not supported");const s=[];for(let e=0;e<n.length;e++){const r=n[e],{spatialReference:a}=r,o="polyline"===r.type?r.paths:r.rings;let c=0;for(let e=0;e<o.length;e++){const t=o[e];let n=0;for(let e=1;e<t.length;e++){const i=t[e-1][0],s=t[e][0],r=t[e-1][1],o=t[e][1];if(r!==o||i!==s){const e=new R;b(e,[i,r],[s,o],a),n+=e.distance}}c+=n}c=t(c,"meters",i),s.push(c)}return s}function v(t,n){if("polyline"!==t.type&&"polygon"!==t.type)throw new e("geodesic-densify:invalid-geometry","the input geometry is neither polyline nor polygon");const{spatialReference:i}=t;if(!M(i))throw new e("geodesic-densify:invalid-spatial-reference","the input geometry spatial reference is not supported");const s="polyline"===t.type?t.paths:t.rings,r=[],a=[0,0],h=new R;for(const e of s){const t=[];r.push(t),t.push([e[0][0],e[0][1]]);let s,o,c=e[0][0],l=e[0][1];for(let r=0;r<e.length-1;r++){if(s=e[r+1][0],o=e[r+1][1],c===s&&l===o)continue;const f=[c,l];b(h,[c,l],[s,o],i);const{azimuth:p,distance:u}=h,d=u/n;if(d>1){for(let e=1;e<=d-1;e++){z(a,f,p,e*n,i),t.push(a.slice(0))}z(a,f,p,(u+Math.floor(d-1)*n)/2,i),t.push(a.slice(0))}z(a,f,p,u,i),t.push(a.slice(0)),c=a[0],l=a[1]}}return"polyline"===t.type?new o({paths:r,spatialReference:i}):new c({rings:r,spatialReference:i})}class R{constructor(e=0,t=void 0,n=void 0){this.distance=e,this.azimuth=t,this.reverseAzimuth=n}}function z(e,t,i,s,r){const a=t[0],o=t[1],c=a*n,h=o*n,l=(i??0)*n,{a:f,b:p,f:d}=u(r),m=Math.sin(l),g=Math.cos(l),M=(1-d)*Math.tan(h),w=1/Math.sqrt(1+M*M),y=M*w,v=Math.atan2(M,g),R=w*m,z=R*R,b=1-z,j=b*(f*f-p*p)/(p*p),q=1+j/16384*(4096+j*(j*(320-175*j)-768)),x=j/1024*(256+j*(j*(74-47*j)-128));let A,N,S,k,P=s/(p*q),F=2*Math.PI;for(;Math.abs(P-F)>1e-12;)S=Math.cos(2*v+P),A=Math.sin(P),N=Math.cos(P),k=x*A*(S+x/4*(N*(2*S*S-1)-x/6*S*(4*A*A-3)*(4*S*S-3))),F=P,P=s/(p*q)+k;const U=y*A-w*N*g,C=Math.atan2(y*N+w*A*g,(1-d)*Math.sqrt(z+U*U)),E=Math.atan2(A*m,w*N-y*A*g),G=d/16*b*(4+d*(4-3*b)),I=C/n,O=(c+(E-(1-G)*d*R*(P+G*A*(S+G*N*(2*S*S-1)))))/n;return e[0]=O,e[1]=I,e}function b(e,t,i,s){const r=t[0]*n,a=t[1]*n,o=i[0]*n,c=i[1]*n,{a:h,b:l,f,radius:p}=u(s),d=o-r,m=Math.atan((1-f)*Math.tan(a)),g=Math.atan((1-f)*Math.tan(c)),M=Math.sin(m),w=Math.cos(m),y=Math.sin(g),v=Math.cos(g);let R,z,b,j,q,x,A,N,S,k,P=1e3,F=d;do{if(A=Math.sin(F),N=Math.cos(F),b=Math.sqrt(v*A*(v*A)+(w*y-M*v*N)*(w*y-M*v*N)),0===b)return e.distance=0,e.azimuth=void 0,e.reverseAzimuth=void 0,e;q=M*y+w*v*N,x=Math.atan2(b,q),S=w*v*A/b,z=1-S*S,j=q-2*M*y/z,isNaN(j)&&(j=0),k=f/16*z*(4+f*(4-3*z)),R=F,F=d+(1-k)*f*S*(x+k*b*(j+k*q*(2*j*j-1)))}while(Math.abs(F-R)>1e-12&&--P>0);if(0===P){const t=p,i=Math.acos(Math.sin(a)*Math.sin(c)+Math.cos(a)*Math.cos(c)*Math.cos(o-r))*t,s=o-r,h=Math.sin(s)*Math.cos(c),l=Math.cos(a)*Math.sin(c)-Math.sin(a)*Math.cos(c)*Math.cos(s),f=Math.atan2(h,l);return e.azimuth=f/n,e.distance=i,e.reverseAzimuth=void 0,e}const U=z*(h*h-l*l)/(l*l),C=U/1024*(256+U*(U*(74-47*U)-128)),E=l*(1+U/16384*(4096+U*(U*(320-175*U)-768)))*(x-C*b*(j+C/4*(q*(2*j*j-1)-C/6*j*(4*b*b-3)*(4*j*j-3)))),G=Math.atan2(v*Math.sin(F),w*y-M*v*Math.cos(F)),I=Math.atan2(w*Math.sin(F),w*y*Math.cos(F)-M*v);return e.azimuth=G/n,e.distance=E,e.reverseAzimuth=I/n,e}function j(n,i,s="meters"){if(!n||!i)throw new e("geodesic-distance:missing-parameters","one or both input parameters are missing");if(!n.spatialReference||!i.spatialReference)throw new e("geodesic-distance:invalid-parameters","one or both input points do not have a spatial reference");if(!r(n.spatialReference,i.spatialReference))throw new e("geodesic-distance:invalid-parameters","spatial references of input parameters do not match");const{spatialReference:a}=n;if(!M(a))throw new e("geodesic-distance:not-supported","input geometry spatial reference is not supported");if(n.x===i.x&&n.y===i.y)return new R(0,0,0);const o=new R;return b(o,[n.x,n.y],[i.x,i.y],a),o.distance=t(o.distance,"meters",s),o.azimuth=m(o.azimuth),o.reverseAzimuth=m(o.reverseAzimuth),o}function q(t,n,i){if(!t||null==n||null==i)throw new e("point-from-distance:missing-parameters","one or more input parameters are missing or undefined");if(i<0||i>360)throw new e("point-from-distance:-of-bounds","azimuth is restricted to angles between, and including, 0° to 360° degrees");if(!t.spatialReference)throw new e("point-from-distance:missing-spatial-reference","the input point must have a spatial reference");const{spatialReference:s}=t;if(!M(s))throw new e("geodesic-distance:not-supported","input geometry spatial reference is not supported");const r=[0,0];return z(r,[t.x,t.y],i,n,s),new h({x:r[0],y:r[1],spatialReference:s})}export{R as InverseGeodeticSolverResult,z as directGeodeticSolver,w as geodesicAreas,v as geodesicDensify,j as geodesicDistance,y as geodesicLengths,b as inverseGeodeticSolver,M as isSupported,q as pointFromDistance};
@@ -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{filenameFormatId as t,mimeTypeFormatId as e}from"../../../layers/support/infoFor3D.js";function s(t){const e=t?.source;return!!e&&(Array.isArray(e)?e.some((t=>o(t))):o(e))}const r=/^(model\/gltf\+json)|(model\/gltf-binary)$/,n=/\.(gltf|glb)/i;function o(t){if(t instanceof File){const{type:e,name:s}=t;return r.test(e)||n.test(s)}return r.test(t.assetMimeType)||n.test(t.assetName)||n.test(t.assetUrl)}function i(t,e){if(!t)return!1;const{source:s}=t;return Array.isArray(s)?a(s,e):u(s,e)}function a(t,e){return t.every((t=>u(t,e)))}function u(t,e){return!(t instanceof File)&&t.assetUrl.startsWith(`${e.path}/assets/`)}function f(s,r){return s instanceof File?t(s.name,r)??e(s.type,r):e(s.assetMimeType,r)??t(s.assetName,r)}export{f as assetFormatId,u as assetIsOnService,i as externalIsOnService,o as isDisplayAsset,s as isDisplayExternal,a as multiPartAssetIsOnService};
5
+ import{filenameFormatId as r,mimeTypeFormatId as t}from"../../../layers/support/infoFor3D.js";function e(r){const t=r?.source;return!!t&&(Array.isArray(t)?t.some((r=>i(r))):i(t))}function s(r){return Array.isArray(r)?0!==r.length&&s(r[0]):!(r instanceof File)}const n=/^(model\/gltf\+json)|(model\/gltf-binary)$/,a=/\.(gltf|glb)/i;function i(r){if(r instanceof File){const{type:t,name:e}=r;return n.test(t)||a.test(e)}return n.test(r.assetMimeType)||a.test(r.assetName)||a.test(r.assetUrl)}function o(r,t){if(!r)return!1;const{source:e}=r;return Array.isArray(e)?c(e,t):y(e,t)}function u(r,t){if(r===t)return!0;const{source:e}=r,{source:n}=t;if(e===n)return!0;if(s(e)&&s(n)){if(Array.isArray(e)&&Array.isArray(n)){if(e.length!==n.length)return!1;const r=(r,t)=>r.assetHash<t.assetHash?-1:r.assetHash>t.assetHash?1:0,t=[...e].sort(r),s=[...n].sort(r);for(let e=0;e<t.length;++e)if(!f(t[e],s[e]))return!1;return!0}if(!Array.isArray(e)&&!Array.isArray(n))return f(e,n)}return!1}function f(r,t){return r.assetUrl===t.assetUrl}function c(r,t){return r.every((r=>y(r,t)))}function y(r,t){return!(r instanceof File)&&r.assetUrl.startsWith(`${t.path}/assets/`)}function l(e,s){return e instanceof File?r(e.name,s)??t(e.type,s):t(e.assetMimeType,s)??r(e.assetName,s)}export{l as assetFormatId,y as assetIsOnService,o as externalIsOnService,u as externalSourcesAreEqual,i as isDisplayAsset,e as isDisplayExternal,c as multiPartAssetIsOnService};
@@ -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 r}from"../../../chunks/tslib.es6.js";import{Clonable as e}from"../../../core/Clonable.js";import o from"../../../core/Collection.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 t}from"../../../core/accessorSupport/decorators/subclass.js";import{isDisplayExternal as i}from"./External.js";let p=class extends e{constructor(){super(),this.externalSources=new o,this._explicitDisplaySource=null}get displaySource(){return this._explicitDisplaySource??this._implicitDisplaySource}set displaySource(r){if(null!=r&&!i(r))throw new Error("Cannot use this source for display: it is not in a supported format.");this._explicitDisplaySource=r,r&&!this.externalSources.includes(r)&&this.externalSources.add(r)}clearSources(){this.displaySource=null,this.externalSources.removeAll()}get _implicitDisplaySource(){return this.externalSources.find(i)}};r([s()],p.prototype,"externalSources",void 0),r([s()],p.prototype,"displaySource",null),r([s()],p.prototype,"_implicitDisplaySource",null),r([s()],p.prototype,"_explicitDisplaySource",void 0),p=r([t("esri.geometry.support.meshUtils.Metadata")],p);export{p as Metadata};
5
+ import{_ as r}from"../../../chunks/tslib.es6.js";import{Clonable as e}from"../../../core/Clonable.js";import o from"../../../core/Collection.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 t}from"../../../core/accessorSupport/decorators/subclass.js";import{isDisplayExternal as i,externalSourcesAreEqual as p}from"./External.js";let l=class extends e{constructor(){super(),this.externalSources=new o,this._explicitDisplaySource=null}get displaySource(){return this._explicitDisplaySource??this._implicitDisplaySource}set displaySource(r){if(null!=r&&!i(r))throw new Error("Cannot use this source for display: it is not in a supported format.");this._explicitDisplaySource=r,r&&!this.externalSources.some((e=>p(e,r)))&&this.externalSources.add(r)}clearSources(){this.displaySource=null,this.externalSources.removeAll()}get _implicitDisplaySource(){return this.externalSources.find(i)}};r([s()],l.prototype,"externalSources",void 0),r([s()],l.prototype,"displaySource",null),r([s()],l.prototype,"_implicitDisplaySource",null),r([s()],l.prototype,"_explicitDisplaySource",void 0),l=r([t("esri.geometry.support.meshUtils.Metadata")],l);export{l as Metadata};
package/intl/messages.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 t from"../core/Error.js";import{createDeferred as e}from"../core/promiseUtils.js";import{beforeLocaleChange as n,getLocale as s}from"./locale.js";const r=/^([a-z]{2})(?:[-_]([A-Za-z]{2}))?$/,o={ar:!0,bg:!0,bs:!0,ca:!0,cs:!0,da:!0,de:!0,el:!0,en:!0,es:!0,et:!0,fi:!0,fr:!0,he:!0,hr:!0,hu:!0,id:!0,it:!0,ja:!0,ko:!0,lt:!0,lv:!0,nb:!0,nl:!0,pl:!0,"pt-BR":!0,"pt-PT":!0,ro:!0,ru:!0,sk:!0,sl:!0,sr:!0,sv:!0,th:!0,tr:!0,uk:!0,vi:!0,"zh-CN":!0,"zh-HK":!0,"zh-TW":!0};function i(t){return t in o}const a=[],c=new Map;function d(t){for(const e of c.keys())_(t.pattern,e)&&c.delete(e)}function l(t){return a.includes(t)||(d(t),a.unshift(t)),{remove(){const e=a.indexOf(t);e>-1&&(a.splice(e,1),d(t))}}}async function u(t){const e=s();c.has(t)||c.set(t,f(t,e));const n=c.get(t);return n&&await m.add(n),n}function h(t){if(!r.test(t))return null;const e=r.exec(t);if(null===e)return null;const[,n,s]=e,o=n+(s?"-"+s.toUpperCase():"");return i(o)?o:i(n)?n:null}async function f(e,n){const s=[];for(const t of a)if(_(t.pattern,e))try{return await t.fetchMessageBundle(e,n)}catch(r){s.push(r)}if(s.length)throw new t("intl:message-bundle-error",`Errors occurred while loading "${e}"`,{errors:s});throw new t("intl:no-message-bundle-loader",`No loader found for message bundle "${e}"`)}function _(t,e){return"string"==typeof t?e.startsWith(t):t.test(e)}n((()=>{c.clear()}));const m=new class{constructor(){this._numLoading=0,this._dfd=null}async waitForAll(){this._dfd&&await this._dfd.promise}add(t){return this._increase(),t.then((()=>this._decrease()),(()=>this._decrease())),this.waitForAll()}_increase(){this._numLoading++,this._dfd||(this._dfd=e())}_decrease(){this._numLoading=Math.max(this._numLoading-1,0),this._dfd&&0===this._numLoading&&(this._dfd.resolve(),this._dfd=null)}},p={cache:c,loaders:a};export{u as fetchMessageBundle,h as normalizeMessageBundleLocale,l as registerMessageBundleLoader,p as test};
5
+ import t from"../core/Error.js";import{createResolver as e}from"../core/promiseUtils.js";import{beforeLocaleChange as n,getLocale as s}from"./locale.js";const r=/^([a-z]{2})(?:[-_]([A-Za-z]{2}))?$/,o={ar:!0,bg:!0,bs:!0,ca:!0,cs:!0,da:!0,de:!0,el:!0,en:!0,es:!0,et:!0,fi:!0,fr:!0,he:!0,hr:!0,hu:!0,id:!0,it:!0,ja:!0,ko:!0,lt:!0,lv:!0,nb:!0,nl:!0,pl:!0,"pt-BR":!0,"pt-PT":!0,ro:!0,ru:!0,sk:!0,sl:!0,sr:!0,sv:!0,th:!0,tr:!0,uk:!0,vi:!0,"zh-CN":!0,"zh-HK":!0,"zh-TW":!0};function i(t){return t in o}const a=[],c=new Map;function d(t){for(const e of c.keys())_(t.pattern,e)&&c.delete(e)}function l(t){return a.includes(t)||(d(t),a.unshift(t)),{remove(){const e=a.indexOf(t);e>-1&&(a.splice(e,1),d(t))}}}async function u(t){const e=s();c.has(t)||c.set(t,f(t,e));const n=c.get(t);return n&&await m.add(n),n}function h(t){if(!r.test(t))return null;const e=r.exec(t);if(null===e)return null;const[,n,s]=e,o=n+(s?"-"+s.toUpperCase():"");return i(o)?o:i(n)?n:null}async function f(e,n){const s=[];for(const t of a)if(_(t.pattern,e))try{return await t.fetchMessageBundle(e,n)}catch(r){s.push(r)}if(s.length)throw new t("intl:message-bundle-error",`Errors occurred while loading "${e}"`,{errors:s});throw new t("intl:no-message-bundle-loader",`No loader found for message bundle "${e}"`)}function _(t,e){return"string"==typeof t?e.startsWith(t):t.test(e)}n((()=>{c.clear()}));const m=new class{constructor(){this._numLoading=0,this._dfd=null}async waitForAll(){this._dfd&&await this._dfd.promise}add(t){return this._increase(),t.then((()=>this._decrease()),(()=>this._decrease())),this.waitForAll()}_increase(){this._numLoading++,this._dfd||(this._dfd=e())}_decrease(){this._numLoading=Math.max(this._numLoading-1,0),this._dfd&&0===this._numLoading&&(this._dfd.resolve(),this._dfd=null)}},p={cache:c,loaders:a};export{u as fetchMessageBundle,h as normalizeMessageBundleLocale,l as registerMessageBundleLoader,p as test};
@@ -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{result as i}from"../../../core/asyncUtils.js";import r from"../../../core/Collection.js";import has from"../../../core/has.js";import s from"../../../core/Error.js";import a from"../../../core/Handles.js";import{clone as l}from"../../../core/lang.js";import n from"../../../core/Logger.js";import{destroyMaybe as o,removeMaybe as h,abortMaybe as c}from"../../../core/maybe.js";import{EsriPromiseMixin as u}from"../../../core/Promise.js";import{createAbortError as d,isAbortError as m,eachAlways as p}from"../../../core/promiseUtils.js";import{initial as _,whenOnce as f,watch as y,syncAndInitial as g,sync as x}from"../../../core/reactiveUtils.js";import{property as F}from"../../../core/accessorSupport/decorators/property.js";import"../../../core/accessorSupport/ensureType.js";import{subclass as v}from"../../../core/accessorSupport/decorators/subclass.js";import{WatchUpdatingTracking as T}from"../../../core/support/WatchUpdatingTracking.js";import{isHostedAgolService as E}from"../../support/arcgisLayerUrl.js";import{getEffectiveLayerCapabilities as w}from"../../support/layerUtils.js";import{projectGeometry as C}from"../../../portal/support/geometryServiceUtils.js";import b from"../../../rest/support/StatisticDefinition.js";import{FeatureTileFetcher3D as D}from"../../../views/3d/layers/support/FeatureTileFetcher3D.js";import{FeatureTileFetcher3DDebugger as S}from"../../../views/3d/layers/support/FeatureTileFetcher3DDebugger.js";import O from"../../../views/3d/support/debugFlags.js";let I=class extends(u(t)){set extent(e){if(null!=e&&!e.spatialReference.equals(this.layerView.view.spatialReference))return void n.getLogger(this.declaredClass).error("#extent=","extent needs to be in the same spatial reference as the view");const t=this._get("extent");if(t===e)return;if(null!=t&&e&&t.equals(e))return;const i=null!=e?e.clone():null;this._set("extent",i)}get updating(){return!!(null!=this._tileFetcher&&this._tileFetcher.updating||null!=this._fetchDataInfoPromise||"tiles"===this.mode&&this.layerView.view.featureTiles&&this.layerView.view.featureTiles.updating||this._watchUpdatingTracking&&this._watchUpdatingTracking.updating)}get updatingTotal(){return this.updating&&null!=this._tileFetcher?this._tileFetcher.updatingTotal:0}get updatingRemaining(){return this.updating&&null!=this._tileFetcher?this._tileFetcher.updatingRemaining:0}get expectedFeatureDiff(){return this.updating&&null!=this._tileFetcher?this._tileFetcher.expectedFeatureDiff:0}get memoryForUnusedFeatures(){return null!=this._tileFetcher?this._tileFetcher.memoryForUnusedFeatures:0}get maximumNumberOfFeaturesExceeded(){return!(null==this._tileFetcher||!this._tileFetcher.maximumNumberOfFeaturesExceeded)}get maximumNumberOfFeatures(){return null!=this.displayFeatureLimit?this.displayFeatureLimit.maximumNumberOfFeatures:0}set maximumNumberOfFeatures(e){e!==this.maximumNumberOfFeatures&&this._overrideIfSome("maximumNumberOfFeatures",e)}get hasMaximumNumberOfFeaturesOverride(){return this._isOverridden("maximumNumberOfFeatures")}get mode(){const e=this.layerView.layer;if("feature"===e.type&&null!=e.infoFor3D)return"snapshot";if(!1===this.layerView.view.qualitySettings?.graphics3D?.snapshotAvailable||this.serviceDataCount===P.NO_SERVICE_DATA_COUNT||this.vertexLimitExceeded)return"tiles";const t=this.layerView.view,i=t&&t.featureTiles,r=i&&i.tilingScheme;if(e&&e.minScale&&this.serviceDataExtent&&r){const t=this._approximateExtentSizeAtScale(e.minScale,r);if((this.serviceDataExtent.width/t+this.serviceDataExtent.height/t)/2>P.MAX_SNAPSHOT_MIN_SCALE_FACTOR)return"tiles"}return!this.maximumNumberOfFeatures||this.serviceDataCount<=this.maximumNumberOfFeatures?"snapshot":"tiles"}get maxTotalSnapshotVertices(){const e=this._get("maxTotalSnapshotVertices")||0,t="snapshot"===this.mode&&null!=this._tileFetcher&&this._tileFetcher.totalVertices||0;return Math.max(e,t)}_approximateExtentSizeAtScale(e,t){const i=this.layerView.view,r=Math.ceil((i.width/t.pixelSize+i.height/t.pixelSize)/2),s=t.levels[0];return r*((s.tileSize[0]/(s.scale/e)+s.tileSize[1]/(s.scale/e))/2)}get tileDescriptors(){return"snapshot"===this.mode?new r([{id:"dummy-tile-full-extent",lij:[0,0,0]}]):this.layerView.view.featureTiles?this.layerView.view.featureTiles.tiles:new r}get test(){return{fetchDataInfoPromise:this._fetchDataInfoPromise,tileFetcher:this._tileFetcher}}constructor(e){super(e),this.type="feature-tile-3d",this._watchUpdatingTracking=new T,this.serviceDataExtent=null,this.serviceDataCount=P.NO_SERVICE_DATA_COUNT,this.vertexLimitExceeded=!1,this.displayFeatureLimit=null,this._suspended=!1,this._tileFetcher=null,this._handles=new a,this._fetchDataInfoPromise=null,this._fetchDataInfoAbortController=null,this._lifeCycleAbortController=new AbortController}initialize(){this._watchUpdatingTracking.add((()=>this.vertexLimitInfo),(()=>this._watchUpdatingTracking.addPromise(this._updateVertexLimitExceeded(null,this._lifeCycleAbortController.signal)))),this._watchUpdatingTracking.add((()=>this.mode),(()=>this._modeChanged()),_),this.addResolvingPromise(Promise.resolve().then((()=>this._verifyCapabilities())).then((()=>this._watchUpdatingTracking.addPromise(this._fetchServiceDataInfo()))).then((()=>this._initializeTileFetcher())))}_verifyCapabilities(){const e=this.layerView.layer;if("ogc-feature"!==e.type&&!w(e)?.operations.supportsQuery)throw new s("graphicscontroller:query-capability-required","Service requires query capabilities to be used as a feature layer",{layer:e})}destroy(){this._cancelFetchServiceDataInfo(),this._tileFetcher=o(this._tileFetcher),this._handles=o(this._handles),this._tilesHandle=h(this._tilesHandle),this._lifeCycleAbortController=c(this._lifeCycleAbortController),this._watchUpdatingTracking.destroy(),this._set("_watchUpdatingTracking",null)}suspend(){this._suspended||(this._suspended=!0,null!=this._tileFetcher&&this._tileFetcher.suspend())}resume(){this._suspended&&(this._suspended=!1,null!=this._tileFetcher&&this._tileFetcher.resume())}restart(){const e=()=>{null!=this._tileFetcher&&this._tileFetcher.restart()};this._watchUpdatingTracking.addPromise(this._fetchServiceDataInfo().then(e,e))}refetch(){const e=()=>{null!=this._tileFetcher&&this._tileFetcher.refetch()};this._watchUpdatingTracking.addPromise(this._fetchServiceDataInfo().then(e,e))}_initializeTileFetcher(){const e=this.layerView.view;if(!e)return;const t=f((()=>e.featureTiles?.tilingScheme),this._lifeCycleAbortController.signal);this._watchUpdatingTracking.addPromise(t),t.then((()=>{const{layerView:t,tileDescriptors:i}=this,r=t.layer,s=new D({context:this.context,filterExtent:this.extent,tileDescriptors:i,features:this.graphics});this._tileFetcher=s,this._suspended?this._tileFetcher.suspend():this._tileFetcher.resume();const a=this.layerView.view.resourceController;a&&this._handles.add(y((()=>a.memoryController?.memoryFactor),(e=>s.memoryFactor=e),g));const l="polygon"===this.context.geometryType?"polygonLodFactor":"polyline"===this.context.geometryType?"polylineLodFactor":null;l&&this._handles.add(y((()=>this.layerView.view?.qualitySettings?.graphics3D?.[l]),(e=>s.lodFactor=e||1),_));const n=e=>{s.maximumNumberOfFeatures=e,s.useTileCount=this.serviceDataCount>e},o=e=>s.useTileCount=e>this.maximumNumberOfFeatures;"ogc-feature"!==r.type&&this._watchUpdatingTracking.add((()=>r.createQueryVersion),(()=>this._dataFilterChanged())),this._watchUpdatingTracking.add((()=>t.availableFields),((e,t)=>this._availableFieldsChanged(t,e))),this._watchUpdatingTracking.add((()=>t.requiredFields),((e,t)=>this._requiredFieldsChanged(t,e))),this._handles.add([r.on("apply-edits",(e=>this._applyEdits(e))),y((()=>this.extent),(e=>s.filterExtent=e),x),y((()=>this.tileDescriptors),(e=>s.tileDescriptors=e),x),y((()=>this.maximumNumberOfFeatures),n,g),y((()=>this.serviceDataCount),o,g),y((()=>O.FEATURE_TILE_FETCH_SHOW_TILES),(t=>{t&&s&&!s.debugger?(s.debugger=new S(s,e.featureTiles.tilingScheme.toTileInfo(),e),s.debugger.update()):!t&&this._tileFetcher&&s.debugger&&(s.debugger.destroy(),s.debugger=null)}),g)]),this._supportsExceedsLimitQuery||this._watchUpdatingTracking.add((()=>this.maxTotalSnapshotVertices),(()=>this._watchUpdatingTracking.addPromise(this._updateVertexLimitExceeded(null,this._lifeCycleAbortController.signal))))})).catch((()=>{}))}_modeChanged(){switch(this.mode){case"tiles":this._tilesHandle||(this._tilesHandle=this.layerView.view.featureTiles.addClient());break;default:n.getLogger(this.declaredClass).warn("Unhandled feature layer mode "+this.mode);case"snapshot":null!=this._tilesHandle&&(this._tilesHandle.remove(),this._tilesHandle=null)}}_dataFilterChanged(){this._set("maxTotalSnapshotVertices",0),this.notifyChange("maxTotalSnapshotVertices"),this.refetch()}_applyEdits(e){null!=this._tileFetcher&&this._tileFetcher.applyEdits(e).then((e=>{if(e){if(!this._lifeCycleAbortController)throw d();e.exceededTransferLimit?this.layerView.layer.refresh():(e.deletedFeatures.length||e.updatedFeatures.length||e.addedFeatures.length)&&this._watchUpdatingTracking.addPromise(this._updateServiceDataExtent(this._lifeCycleAbortController.signal))}})).catch((e=>{if(!m(e))throw e}))}_availableFieldsChanged(e,t){null!=this._tileFetcher&&L(this._tileFetcher.availableFields,t)&&this.refetch()}_requiredFieldsChanged(e,t){null!=this._tileFetcher&&L(this._tileFetcher.availableFields,t)&&this.restart()}_createVertexLimitExceededQuery(e){const t=this.layerView.layer,i=t.createQuery();return i.outStatistics=[new b({statisticType:"exceedslimit",maxVertexCount:e,outStatisticFieldName:"exceedslimit",maxPointCount:1e8,maxRecordCount:1e8})],t.capabilities?.query.supportsCacheHint&&(i.cacheHint=!0),i}_createDataInfoQuery(){const e=this.layerView.layer,t=e.createQuery();return t.outSpatialReference=this.layerView.view.spatialReference,e.capabilities?.query.supportsCacheHint&&(t.cacheHint=!0),t}_fullExtentIsAccurate(){const e=this.layerView.layer;if(e.definitionExpression)return!1;switch(e.type){case"feature":case"oriented-imagery":return E(e.url);case"csv":case"geojson":case"ogc-feature":case"wfs":return!0;default:return}}async _updateServiceDataExtent(e){try{await this._tryUpdateServiceDataExtent(e)}catch(t){m(t)||this._set("serviceDataExtent",l(this.layerView.fullExtentInLocalViewSpatialReference))}}async _tryUpdateServiceDataExtent(e){const t=this.layerView,i=t.layer,r=i.capabilities?.query.supportsExtent??!1,s=l(t.fullExtentInLocalViewSpatialReference),a=i.fullExtent,n=this._fullExtentIsAccurate(),o=this.serviceDataCount;if(r&&o<=P.MAX_FEATURE_COUNT_FOR_EXTENT&&(!s||!n)&&"queryExtent"in i){const t=this._createDataInfoQuery(),r=await i.queryExtent(t,{timeout:P.QUERY_EXTENT_TIMEOUT,signal:e});this._set("serviceDataExtent",r.extent)}else if(s)this._set("serviceDataExtent",s);else if(null!=a){const r="portalItem"in i?i.portalItem:null,s=await C(a,t.view.spatialReference,r,e);this._set("serviceDataExtent",s)}else this._set("serviceDataExtent",null)}async _updateServiceDataCount(e){const t=this.layerView.layer;if(!("queryFeatureCount"in t)||!has("featurelayer-snapshot-enabled"))return void this._set("serviceDataCount",P.NO_SERVICE_DATA_COUNT);const r=await i(t.queryFeatureCount(this._createDataInfoQuery(),{timeout:P.QUERY_STATISTICS_TIMEOUT,signal:e}));if(!0===r.ok)this._set("serviceDataCount",r.value);else{if(m(r.error))throw r.error;this._set("serviceDataCount",P.NO_SERVICE_DATA_COUNT)}}get vertexLimitInfo(){if(null==this.displayFeatureLimit||null==this.displayFeatureLimit.averageSymbolComplexity)return null;const{averageSymbolComplexity:e,maximumTotalNumberOfPrimitives:t}=this.displayFeatureLimit,{primitivesPerCoordinate:i,primitivesPerFeature:r}=e,s=this._get("vertexLimitInfo");return null==s||s.maximumTotalNumberOfPrimitives!==t||s.primitivesPerCoordinate!==i||s.primitivesPerFeature!==r?{primitivesPerCoordinate:i,primitivesPerFeature:r,maximumTotalNumberOfPrimitives:t}:s}get _supportsExceedsLimitQuery(){const e=this.layerView.layer;return null!=e.capabilities&&e.capabilities.operations&&e.capabilities.operations.supportsExceedsLimitStatistics}get _minimumNumberOfVerticesForGeometry(){switch(this.layerView.layer.geometryType){case"point":case"multipoint":return 1;case"polygon":return 4;case"polyline":return 2;case"multipatch":case"mesh":return 3;default:return 0}}async _updateVertexLimitExceeded(e,t){const r=this.vertexLimitInfo;if(null==r)return void this._set("vertexLimitExceeded",!1);const s=r.primitivesPerFeature<=0,a=this._minimumNumberOfVerticesForGeometry>1;if(!s&&!a)return void this._set("vertexLimitExceeded",!1);const{primitivesPerFeature:l,primitivesPerCoordinate:n,maximumTotalNumberOfPrimitives:o}=r;let h;0!==l&&null!=e&&await e;const c=this.serviceDataCount,u=c!==P.NO_SERVICE_DATA_COUNT;if(h=u?Math.ceil((o-c*l)/(n||1)):Math.ceil(o/(n||1)),a&&(h=Math.min(h,N)),u&&this._minimumNumberOfVerticesForGeometry*c>h)return void this._set("vertexLimitExceeded",!0);if(!this._supportsExceedsLimitQuery||!has("featurelayer-snapshot-enabled"))return void this._set("vertexLimitExceeded",this.maxTotalSnapshotVertices>h);const d=await i(this.layerView.layer.queryFeatures(this._createVertexLimitExceededQuery(h),{timeout:P.QUERY_STATISTICS_TIMEOUT,signal:t}));if(!1===d.ok){if(m(d.error))throw d.error;return void this._set("vertexLimitExceeded",!1)}const p=d.value.features[0];p&&p.attributes?this._set("vertexLimitExceeded",!!p.attributes.exceedslimit):this._set("vertexLimitExceeded",!1)}async _fetchServiceDataInfo(){this._cancelFetchServiceDataInfo();let e=new AbortController;const t=e.signal,i=this._updateServiceDataCount(t),r=p([i,this._updateVertexLimitExceeded(i,t)]),s=r.then((()=>this._updateServiceDataExtent(t))).catch((e=>{m(e)||n.getLogger(this.declaredClass).error("#fetchServiceDataInfo()",e)})).then((()=>{s===this._fetchDataInfoPromise&&(this._fetchDataInfoPromise=null,this._fetchDataInfoAbortController=null),e=null}));return e&&(this._fetchDataInfoPromise=s),this._fetchDataInfoAbortController=e,r.then((()=>{}),(()=>{}))}_cancelFetchServiceDataInfo(){const e=this._fetchDataInfoAbortController;e&&(this._fetchDataInfoAbortController=null,this._fetchDataInfoPromise=null,e.abort())}get debug(){return{storedFeatures:null!=this._tileFetcher?this._tileFetcher.storedFeatures:0,totalFeatures:null!=this._tileFetcher?this._tileFetcher.totalFeatures:0,totalVertices:null!=this._tileFetcher?this._tileFetcher.totalVertices:0,missingTiles:null!=this._tileFetcher?this._tileFetcher.missingTiles:0}}};e([F({readOnly:!0})],I.prototype,"type",void 0),e([F({constructOnly:!0})],I.prototype,"graphics",void 0),e([F({constructOnly:!0})],I.prototype,"layerView",void 0),e([F({constructOnly:!0})],I.prototype,"context",void 0),e([F()],I.prototype,"extent",null),e([F()],I.prototype,"updating",null),e([F({readOnly:!0})],I.prototype,"_watchUpdatingTracking",void 0),e([F()],I.prototype,"updatingTotal",null),e([F()],I.prototype,"updatingRemaining",null),e([F()],I.prototype,"expectedFeatureDiff",null),e([F()],I.prototype,"memoryForUnusedFeatures",null),e([F()],I.prototype,"maximumNumberOfFeaturesExceeded",null),e([F({readOnly:!0})],I.prototype,"serviceDataExtent",void 0),e([F({readOnly:!0})],I.prototype,"serviceDataCount",void 0),e([F({readOnly:!0})],I.prototype,"vertexLimitExceeded",void 0),e([F()],I.prototype,"displayFeatureLimit",void 0),e([F({type:Number})],I.prototype,"maximumNumberOfFeatures",null),e([F({readOnly:!0})],I.prototype,"mode",null),e([F({readOnly:!0})],I.prototype,"maxTotalSnapshotVertices",null),e([F({readOnly:!0,dependsOn:["mode"]})],I.prototype,"tileDescriptors",null),e([F()],I.prototype,"_tileFetcher",void 0),e([F()],I.prototype,"_fetchDataInfoPromise",void 0),e([F({readOnly:!0})],I.prototype,"vertexLimitInfo",null),I=e([v("esri.layers.graphics.controllers.FeatureTileController3D")],I);const V=1e4,U=12e3,A=1e4,N=5e6;function L(e,t){if(!t)return!1;for(const i of t)if(!e.has(i))return!0;return!1}var P;!function(e){function t(){e.MAX_FEATURE_COUNT_FOR_EXTENT=V,e.QUERY_STATISTICS_TIMEOUT=U,e.QUERY_EXTENT_TIMEOUT=A}e.NO_SERVICE_DATA_COUNT=1/0,e.MAX_SNAPSHOT_MIN_SCALE_FACTOR=5,e.reset=t}(P||(P={})),P.reset();export{I as FeatureTileController3D,P as FeatureTileController3DConstants};
5
+ import{_ as e}from"../../../chunks/tslib.es6.js";import t from"../../../core/Accessor.js";import{result as i}from"../../../core/asyncUtils.js";import r from"../../../core/Collection.js";import has from"../../../core/has.js";import s from"../../../core/Error.js";import a from"../../../core/Handles.js";import{clone as l}from"../../../core/lang.js";import n from"../../../core/Logger.js";import{destroyMaybe as o,removeMaybe as h,abortMaybe as c}from"../../../core/maybe.js";import{EsriPromiseMixin as u}from"../../../core/Promise.js";import{createAbortError as d,isAbortError as m,eachAlways as p}from"../../../core/promiseUtils.js";import{initial as _,whenOnce as f,watch as y,syncAndInitial as g,sync as x}from"../../../core/reactiveUtils.js";import{property as F}from"../../../core/accessorSupport/decorators/property.js";import"../../../core/accessorSupport/ensureType.js";import{subclass as v}from"../../../core/accessorSupport/decorators/subclass.js";import{WatchUpdatingTracking as T}from"../../../core/support/WatchUpdatingTracking.js";import{isHostedAgolService as E}from"../../support/arcgisLayerUrl.js";import{getEffectiveLayerCapabilities as w}from"../../support/layerUtils.js";import{projectGeometry as C}from"../../../portal/support/geometryServiceUtils.js";import b from"../../../rest/support/StatisticDefinition.js";import{FeatureTileFetcher3D as D}from"../../../views/3d/layers/support/FeatureTileFetcher3D.js";import{FeatureTileFetcher3DDebugger as S}from"../../../views/3d/layers/support/FeatureTileFetcher3DDebugger.js";import O from"../../../views/3d/support/debugFlags.js";let I=class extends(u(t)){set extent(e){if(null!=e&&!e.spatialReference.equals(this.layerView.view.spatialReference))return void n.getLogger(this.declaredClass).error("#extent=","extent needs to be in the same spatial reference as the view");const t=this._get("extent");if(t===e)return;if(null!=t&&e&&t.equals(e))return;const i=null!=e?e.clone():null;this._set("extent",i)}get updating(){return!!(null!=this._tileFetcher&&this._tileFetcher.updating||null!=this._fetchDataInfoPromise||"tiles"===this.mode&&this.layerView.view.featureTiles&&this.layerView.view.featureTiles.updating||this._watchUpdatingTracking&&this._watchUpdatingTracking.updating)}get updatingTotal(){return this.updating&&null!=this._tileFetcher?this._tileFetcher.updatingTotal:0}get updatingRemaining(){return this.updating&&null!=this._tileFetcher?this._tileFetcher.updatingRemaining:0}get expectedFeatureDiff(){return this.updating&&null!=this._tileFetcher?this._tileFetcher.expectedFeatureDiff:0}get memoryForUnusedFeatures(){return null!=this._tileFetcher?this._tileFetcher.memoryForUnusedFeatures:0}get maximumNumberOfFeaturesExceeded(){return!(null==this._tileFetcher||!this._tileFetcher.maximumNumberOfFeaturesExceeded)}get maximumNumberOfFeatures(){return null!=this.displayFeatureLimit?this.displayFeatureLimit.maximumNumberOfFeatures:0}set maximumNumberOfFeatures(e){e!==this.maximumNumberOfFeatures&&this._overrideIfSome("maximumNumberOfFeatures",e)}get hasMaximumNumberOfFeaturesOverride(){return this._isOverridden("maximumNumberOfFeatures")}get mode(){const e=this.layerView.layer;if("feature"===e.type&&null!=e.infoFor3D)return"snapshot";if(!1===this.layerView.view.qualitySettings?.graphics3D?.snapshotAvailable||this.serviceDataCount===P.NO_SERVICE_DATA_COUNT||this.vertexLimitExceeded)return"tiles";const t=this.layerView.view,i=t&&t.featureTiles,r=i&&i.tilingScheme;if(e&&e.minScale&&this.serviceDataExtent&&r){const t=this._approximateExtentSizeAtScale(e.minScale,r);if((this.serviceDataExtent.width/t+this.serviceDataExtent.height/t)/2>P.MAX_SNAPSHOT_MIN_SCALE_FACTOR)return"tiles"}return!this.maximumNumberOfFeatures||this.serviceDataCount<=this.maximumNumberOfFeatures?"snapshot":"tiles"}get maxTotalSnapshotVertices(){const e=this._get("maxTotalSnapshotVertices")||0,t="snapshot"===this.mode&&null!=this._tileFetcher&&this._tileFetcher.totalVertices||0;return Math.max(e,t)}_approximateExtentSizeAtScale(e,t){const i=this.layerView.view,r=Math.ceil((i.width/t.pixelSize+i.height/t.pixelSize)/2),s=t.levels[0];return r*((s.tileSize[0]/(s.scale/e)+s.tileSize[1]/(s.scale/e))/2)}get tileDescriptors(){return"snapshot"===this.mode?new r([{id:"dummy-tile-full-extent",lij:[0,0,0]}]):this.layerView.view.featureTiles?this.layerView.view.featureTiles.tiles:new r}get test(){return{fetchDataInfoPromise:this._fetchDataInfoPromise,tileFetcher:this._tileFetcher}}constructor(e){super(e),this.type="feature-tile-3d",this._watchUpdatingTracking=new T,this.serviceDataExtent=null,this.serviceDataCount=P.NO_SERVICE_DATA_COUNT,this.vertexLimitExceeded=!1,this.displayFeatureLimit=null,this._suspended=!1,this._tileFetcher=null,this._handles=new a,this._fetchDataInfoPromise=null,this._fetchDataInfoAbortController=null,this._lifeCycleAbortController=new AbortController}initialize(){this._watchUpdatingTracking.add((()=>this.vertexLimitInfo),(()=>this._watchUpdatingTracking.addPromise(this._updateVertexLimitExceeded(null,this._lifeCycleAbortController.signal)))),this._watchUpdatingTracking.add((()=>this.mode),(()=>this._modeChanged()),_),this.addResolvingPromise(Promise.resolve().then((()=>this._verifyCapabilities())).then((()=>this._watchUpdatingTracking.addPromise(this._fetchServiceDataInfo()))).then((()=>this._initializeTileFetcher())))}_verifyCapabilities(){const e=this.layerView.layer;if("ogc-feature"!==e.type&&!w(e)?.operations.supportsQuery)throw new s("graphicscontroller:query-capability-required","Service requires query capabilities to be used as a feature layer",{layer:e})}destroy(){this._cancelFetchServiceDataInfo(),this._tileFetcher=o(this._tileFetcher),this._handles=o(this._handles),this._tilesHandle=h(this._tilesHandle),this._lifeCycleAbortController=c(this._lifeCycleAbortController),this._watchUpdatingTracking.destroy(),this._set("_watchUpdatingTracking",null)}suspend(){this._suspended||(this._suspended=!0,null!=this._tileFetcher&&this._tileFetcher.suspend())}resume(){this._suspended&&(this._suspended=!1,null!=this._tileFetcher&&this._tileFetcher.resume())}restart(){const e=()=>{null!=this._tileFetcher&&this._tileFetcher.restart()};this._watchUpdatingTracking.addPromise(this._fetchServiceDataInfo().then(e,e))}refetch(){const e=()=>{null!=this._tileFetcher&&this._tileFetcher.refetch()};this._watchUpdatingTracking.addPromise(this._fetchServiceDataInfo().then(e,e))}_initializeTileFetcher(){const e=this.layerView.view;if(!e)return;const t=f((()=>e.featureTiles?.tilingScheme),this._lifeCycleAbortController.signal);this._watchUpdatingTracking.addPromise(t),t.then((()=>{const{layerView:t,tileDescriptors:i}=this,r=t.layer,s=new D({context:this.context,filterExtent:this.extent,tileDescriptors:i,features:this.graphics});this._tileFetcher=s,this._suspended?this._tileFetcher.suspend():this._tileFetcher.resume();const a=this.layerView.view.resourceController;a&&this._handles.add(y((()=>a.memoryController?.memoryFactor),(e=>s.memoryFactor=e),g));const l="polygon"===this.context.geometryType?"polygonLodFactor":"polyline"===this.context.geometryType?"polylineLodFactor":null;l&&this._handles.add(y((()=>this.layerView.view?.qualitySettings?.graphics3D?.[l]),(e=>s.lodFactor=e||1),_));const n=e=>{s.maximumNumberOfFeatures=e,s.useTileCount=this.serviceDataCount>e},o=e=>s.useTileCount=e>this.maximumNumberOfFeatures;"ogc-feature"!==r.type&&this._watchUpdatingTracking.add((()=>r.createQueryVersion),(()=>this._dataFilterChanged())),this._watchUpdatingTracking.add((()=>t.availableFields),((e,t)=>this._availableFieldsChanged(t,e))),this._watchUpdatingTracking.add((()=>t.requiredFields),((e,t)=>this._requiredFieldsChanged(t,e))),this._handles.add([r.on("apply-edits",(e=>this._applyEdits(e))),y((()=>this.extent),(e=>s.filterExtent=e),x),y((()=>this.tileDescriptors),(e=>s.tileDescriptors=e),x),y((()=>this.maximumNumberOfFeatures),n,g),y((()=>this.serviceDataCount),o,g),y((()=>O.FEATURE_TILE_FETCH_SHOW_TILES),(t=>{t&&s&&!s.debugger?(s.debugger=new S(s,e.featureTiles.tilingScheme.toTileInfo(),e),s.debugger.update()):!t&&this._tileFetcher&&s.debugger&&(s.debugger.destroy(),s.debugger=null)}),g)]),this._supportsExceedsLimitQuery||this._watchUpdatingTracking.add((()=>this.maxTotalSnapshotVertices),(()=>this._watchUpdatingTracking.addPromise(this._updateVertexLimitExceeded(null,this._lifeCycleAbortController.signal))))})).catch((()=>{}))}_modeChanged(){switch(this.mode){case"tiles":this._tilesHandle||(this._tilesHandle=this.layerView.view.featureTiles.addClient());break;default:n.getLogger(this.declaredClass).warn("Unhandled feature layer mode "+this.mode);case"snapshot":null!=this._tilesHandle&&(this._tilesHandle.remove(),this._tilesHandle=null)}}_dataFilterChanged(){this._set("maxTotalSnapshotVertices",0),this.notifyChange("maxTotalSnapshotVertices"),this.refetch()}_applyEdits(e){null!=this._tileFetcher&&this._tileFetcher.applyEdits(e).then((e=>{if(e){if(!this._lifeCycleAbortController)throw d();e.exceededTransferLimit?this.layerView.layer.refresh():(e.deletedFeatures.length||e.updatedFeatures.length||e.addedFeatures.length)&&this._watchUpdatingTracking.addPromise(this._updateServiceDataExtent(this._lifeCycleAbortController.signal))}})).catch((e=>{if(!m(e))throw e}))}_availableFieldsChanged(e,t){null!=this._tileFetcher&&L(this._tileFetcher.availableFields,t)&&this.refetch()}_requiredFieldsChanged(e,t){null!=this._tileFetcher&&L(this._tileFetcher.availableFields,t)&&this.restart()}_createVertexLimitExceededQuery(e){const t=this.layerView.layer,i=t.createQuery();return i.returnGeometry=!1,i.outStatistics=[new b({statisticType:"exceedslimit",maxVertexCount:e,outStatisticFieldName:"exceedslimit",maxPointCount:1e8,maxRecordCount:1e8})],t.capabilities?.query.supportsCacheHint&&(i.cacheHint=!0),i}_createDataInfoQuery(){const e=this.layerView.layer,t=e.createQuery();return t.returnGeometry=!1,t.outSpatialReference=this.layerView.view.spatialReference,e.capabilities?.query.supportsCacheHint&&(t.cacheHint=!0),t}_fullExtentIsAccurate(){const e=this.layerView.layer;if(e.definitionExpression)return!1;switch(e.type){case"feature":case"oriented-imagery":return E(e.url);case"csv":case"geojson":case"ogc-feature":case"wfs":return!0;default:return}}async _updateServiceDataExtent(e){try{await this._tryUpdateServiceDataExtent(e)}catch(t){m(t)||this._set("serviceDataExtent",l(this.layerView.fullExtentInLocalViewSpatialReference))}}async _tryUpdateServiceDataExtent(e){const t=this.layerView,i=t.layer,r=i.capabilities?.query.supportsExtent??!1,s=l(t.fullExtentInLocalViewSpatialReference),a=i.fullExtent,n=this._fullExtentIsAccurate(),o=this.serviceDataCount;if(r&&o<=P.MAX_FEATURE_COUNT_FOR_EXTENT&&(!s||!n)&&"queryExtent"in i){const t=this._createDataInfoQuery(),r=await i.queryExtent(t,{timeout:P.QUERY_EXTENT_TIMEOUT,signal:e});this._set("serviceDataExtent",r.extent)}else if(s)this._set("serviceDataExtent",s);else if(null!=a){const r="portalItem"in i?i.portalItem:null,s=await C(a,t.view.spatialReference,r,e);this._set("serviceDataExtent",s)}else this._set("serviceDataExtent",null)}async _updateServiceDataCount(e){const t=this.layerView.layer;if(!("queryFeatureCount"in t)||!has("featurelayer-snapshot-enabled"))return void this._set("serviceDataCount",P.NO_SERVICE_DATA_COUNT);const r=await i(t.queryFeatureCount(this._createDataInfoQuery(),{timeout:P.QUERY_STATISTICS_TIMEOUT,signal:e}));if(!0===r.ok)this._set("serviceDataCount",r.value);else{if(m(r.error))throw r.error;this._set("serviceDataCount",P.NO_SERVICE_DATA_COUNT)}}get vertexLimitInfo(){if(null==this.displayFeatureLimit||null==this.displayFeatureLimit.averageSymbolComplexity)return null;const{averageSymbolComplexity:e,maximumTotalNumberOfPrimitives:t}=this.displayFeatureLimit,{primitivesPerCoordinate:i,primitivesPerFeature:r}=e,s=this._get("vertexLimitInfo");return null==s||s.maximumTotalNumberOfPrimitives!==t||s.primitivesPerCoordinate!==i||s.primitivesPerFeature!==r?{primitivesPerCoordinate:i,primitivesPerFeature:r,maximumTotalNumberOfPrimitives:t}:s}get _supportsExceedsLimitQuery(){const e=this.layerView.layer;return null!=e.capabilities&&e.capabilities.operations&&e.capabilities.operations.supportsExceedsLimitStatistics}get _minimumNumberOfVerticesForGeometry(){switch(this.layerView.layer.geometryType){case"point":case"multipoint":return 1;case"polygon":return 4;case"polyline":return 2;case"multipatch":case"mesh":return 3;default:return 0}}async _updateVertexLimitExceeded(e,t){const r=this.vertexLimitInfo;if(null==r)return void this._set("vertexLimitExceeded",!1);const s=r.primitivesPerFeature<=0,a=this._minimumNumberOfVerticesForGeometry>1;if(!s&&!a)return void this._set("vertexLimitExceeded",!1);const{primitivesPerFeature:l,primitivesPerCoordinate:n,maximumTotalNumberOfPrimitives:o}=r;let h;0!==l&&null!=e&&await e;const c=this.serviceDataCount,u=c!==P.NO_SERVICE_DATA_COUNT;if(h=u?Math.ceil((o-c*l)/(n||1)):Math.ceil(o/(n||1)),a&&(h=Math.min(h,N)),u&&this._minimumNumberOfVerticesForGeometry*c>h)return void this._set("vertexLimitExceeded",!0);if(!this._supportsExceedsLimitQuery||!has("featurelayer-snapshot-enabled"))return void this._set("vertexLimitExceeded",this.maxTotalSnapshotVertices>h);const d=await i(this.layerView.layer.queryFeatures(this._createVertexLimitExceededQuery(h),{timeout:P.QUERY_STATISTICS_TIMEOUT,signal:t}));if(!1===d.ok){if(m(d.error))throw d.error;return void this._set("vertexLimitExceeded",!1)}const p=d.value.features[0];p&&p.attributes?this._set("vertexLimitExceeded",!!p.attributes.exceedslimit):this._set("vertexLimitExceeded",!1)}async _fetchServiceDataInfo(){this._cancelFetchServiceDataInfo();let e=new AbortController;const t=e.signal,i=this._updateServiceDataCount(t),r=p([i,this._updateVertexLimitExceeded(i,t)]),s=r.then((()=>this._updateServiceDataExtent(t))).catch((e=>{m(e)||n.getLogger(this.declaredClass).error("#fetchServiceDataInfo()",e)})).then((()=>{s===this._fetchDataInfoPromise&&(this._fetchDataInfoPromise=null,this._fetchDataInfoAbortController=null),e=null}));return e&&(this._fetchDataInfoPromise=s),this._fetchDataInfoAbortController=e,r.then((()=>{}),(()=>{}))}_cancelFetchServiceDataInfo(){const e=this._fetchDataInfoAbortController;e&&(this._fetchDataInfoAbortController=null,this._fetchDataInfoPromise=null,e.abort())}get debug(){return{storedFeatures:null!=this._tileFetcher?this._tileFetcher.storedFeatures:0,totalFeatures:null!=this._tileFetcher?this._tileFetcher.totalFeatures:0,totalVertices:null!=this._tileFetcher?this._tileFetcher.totalVertices:0,missingTiles:null!=this._tileFetcher?this._tileFetcher.missingTiles:0}}};e([F({readOnly:!0})],I.prototype,"type",void 0),e([F({constructOnly:!0})],I.prototype,"graphics",void 0),e([F({constructOnly:!0})],I.prototype,"layerView",void 0),e([F({constructOnly:!0})],I.prototype,"context",void 0),e([F()],I.prototype,"extent",null),e([F()],I.prototype,"updating",null),e([F({readOnly:!0})],I.prototype,"_watchUpdatingTracking",void 0),e([F()],I.prototype,"updatingTotal",null),e([F()],I.prototype,"updatingRemaining",null),e([F()],I.prototype,"expectedFeatureDiff",null),e([F()],I.prototype,"memoryForUnusedFeatures",null),e([F()],I.prototype,"maximumNumberOfFeaturesExceeded",null),e([F({readOnly:!0})],I.prototype,"serviceDataExtent",void 0),e([F({readOnly:!0})],I.prototype,"serviceDataCount",void 0),e([F({readOnly:!0})],I.prototype,"vertexLimitExceeded",void 0),e([F()],I.prototype,"displayFeatureLimit",void 0),e([F({type:Number})],I.prototype,"maximumNumberOfFeatures",null),e([F({readOnly:!0})],I.prototype,"mode",null),e([F({readOnly:!0})],I.prototype,"maxTotalSnapshotVertices",null),e([F({readOnly:!0,dependsOn:["mode"]})],I.prototype,"tileDescriptors",null),e([F()],I.prototype,"_tileFetcher",void 0),e([F()],I.prototype,"_fetchDataInfoPromise",void 0),e([F({readOnly:!0})],I.prototype,"vertexLimitInfo",null),I=e([v("esri.layers.graphics.controllers.FeatureTileController3D")],I);const V=1e4,U=12e3,A=1e4,N=5e6;function L(e,t){if(!t)return!1;for(const i of t)if(!e.has(i))return!0;return!1}var P;!function(e){function t(){e.MAX_FEATURE_COUNT_FOR_EXTENT=V,e.QUERY_STATISTICS_TIMEOUT=U,e.QUERY_EXTENT_TIMEOUT=A}e.NO_SERVICE_DATA_COUNT=1/0,e.MAX_SNAPSHOT_MIN_SCALE_FACTOR=5,e.reset=t}(P||(P={})),P.reset();export{I as FeatureTileController3D,P as FeatureTileController3DConstants};
@@ -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 i from"../../../core/Handles.js";import has from"../../../core/has.js";import s from"../../../core/Logger.js";import r from"../../../core/PooledArray.js";import{EsriPromiseMixin as a}from"../../../core/Promise.js";import{isAbortError as d}from"../../../core/promiseUtils.js";import{watch as o,initial as n,sync as l}from"../../../core/reactiveUtils.js";import{property as h}from"../../../core/accessorSupport/decorators/property.js";import"../../../core/accessorSupport/ensureType.js";import"../../../core/arrayUtils.js";import{subclass as u}from"../../../core/accessorSupport/decorators/subclass.js";import{projectBoundingRect as _}from"../../../geometry/projection.js";import{create as c,intersectsSphere as p}from"../../../geometry/support/aaBoundingRect.js";import{makeDehydratedPoint as g}from"../dehydratedFeatures.js";import{PromiseQueue as m}from"../../support/PromiseQueue.js";import{viewingModeFromString as y}from"../../../views/ViewingMode.js";import{I3SClientNodeLoader as x}from"../../../views/3d/layers/i3s/I3SClientNodeLoader.js";import{addCallback as f}from"../../../views/3d/layers/i3s/I3SFrameTask.js";import{I3SIndex as b}from"../../../views/3d/layers/i3s/I3SIndex.js";import N from"../../../views/3d/layers/i3s/I3SLodHandling.js";import{NodeState as v,CacheState as w}from"../../../views/3d/layers/i3s/I3SNode.js";import C from"../../../views/3d/layers/i3s/I3SNodeLoader.js";import{I3SStreamDataController as D}from"../../../views/3d/layers/i3s/I3SStreamDataController.js";import{getVertexCrs as L,getIndexCrs as S,findIntersectingNodes as I}from"../../../views/3d/layers/i3s/I3SUtil.js";import V from"../../../views/3d/layers/i3s/I3SViewportQueries.js";import{FadeDirection as A}from"../../../views/3d/layers/support/I3SLayerView.js";import{toBoundingRect as F}from"../../../views/3d/support/extentUtils.js";import{ClientType as M,maxDownloadSlots as O}from"../../../views/3d/support/index.js";import{extractSafeScaleBounds as P,scaleBoundsPredicate as U}from"../../../views/support/layerViewUtils.js";import{noBudget as G}from"../../../views/support/Scheduler.js";const q="esri.layers.graphics.controllers.I3SOnDemandController",j=s.getLogger(q),Q=100,T=2,E=1e4,H=1e-4,R=1.2,k=500,B=1.5;let z=class extends(a(t)){get isMeshPyramid(){return"mesh-pyramids"===this.layer.profile||"MeshPyramid"===this.layer.store?.lodType}get isGraphics3D(){return"points"===this.layer.profile}get useMaximumNumberOfFeatures(){return!this.isMeshPyramid&&(null==this.layer.priority||"High"===this.layer.priority)}get indexStreamController(){const e=this.layerView.view.resourceController.createStreamDataRequester(M.I3S_INDEX);return new D(e,this.layer.apiKey)}get dataStreamController(){const e=this.layerView.view.resourceController.createStreamDataRequester(M.I3S_DATA);return new D(e,this.layer.apiKey)}get crsVertex(){return L(this.layer)}get crsIndex(){return S(this.layer)}get layer(){return this.layerView.i3slayer}get running(){return this.updating}get rootNodeVisible(){if(null!=this._index){const e=this._index.rootNode;if(null!=e)return this._updateViewData(),this._index.isNodeVisible(e.index)}return!0}get index(){return this._index}constructor(e){super(e),this.screenSizeFactor=0,this.featureTarget=5e4,this.fixedFeatureTarget=!1,this.updating=!0,this.updatingProgress=1,this.leavesReached=!1,this.scaleVisibilityEnabled=!0,this._featureLOD=1,this._stableFeatureLOD=!1,this._isIdle=!1,this._cameraDirty=!0,this._invisibleDirty=!1,this._idleStateCallbacks=null,this._newLoadingNodes=new r({deallocator:null}),this._loadedNodeScales=new Map,this._modificationsNodeFilteringArray=new r,this._downloadingCount=0,this._loadingNodes=new Map,this._updatingNodes=new Map,this._progressMaxNumNodes=1,this._requiredAttributes=new Array,this._requiredAttributesDirty=!0,this._updatesDisabled=!1,this.disableIDBCache=!1,this._disableMemCache=!1,this._restartNodeLoading=!1,this._fields=null,this._attributeStorageInfo=null,this._handles=new i,this._idleQueue=new m,this._elevationUpdateNodes=new r({deallocator:null}),this._errorCount=0}initialize(){const{layerView:e,layer:t}=this;this._disableMemCache=!e.loadCachedGPUData||!e.addCachedGPUData,this._lodHandling=new N(e),this._defaultGeometrySchema=t.store.defaultGeometrySchema,this.disableIDBCache=has("disable-feature:idb-cache"),"fields"in t&&(this._fields=t.fields,this._attributeStorageInfo=t.attributeStorageInfo),this.addResolvingPromise(Promise.all([t.indexInfo,t.when(),e.when()]).then((([i])=>{if(this.destroyed||!e||e.destroyed||!i)return;const{view:s,clientGeometry:r}=e,{resourceController:a}=s;if(this._setClippingArea(s.clippingArea),this.addHandles([o((()=>s?.pointsOfInterest?.focus?.renderLocation),(e=>this._pointOfInterestChanged(e)),n),o((()=>a.memoryController.memoryFactor),(()=>this._setCameraDirty()),l),o((()=>e.suspended),(e=>{const t=e?()=>this._updateViewData():()=>this._updateIdleState(!0),i=e?()=>{}:()=>this._updateIdleState(!1);e||null==this._index||this._index.invalidateAllElevationRanges(),this._idleStateCallbacks?(e&&this.cancelNodeLoading(),this.restartNodeLoading(),this._idleStateCallbacks.idleBegin=t,this._idleStateCallbacks.idleEnd=i):this._idleStateCallbacks=a.scheduler.registerIdleStateCallbacks(t,i)}),n),f(e.view.resourceController.scheduler,this),o((()=>e.uncompressedTextureDownsamplingEnabled),(()=>this.restartNodeLoading())),o((()=>[this.featureTarget,this.fixedFeatureTarget]),(()=>{this._setCameraDirty(),this._stableFeatureLOD=!1})),o((()=>s.state?.contentCamera),(()=>this._setCameraDirty())),o((()=>t.elevationInfo),(e=>this._elevationInfoChanged(e))),o((()=>t.effectiveScaleRange),(()=>this._scaleBoundsChanged())),o((()=>e.lodFactor),(()=>this._setCameraDirty())),o((()=>e.availableFields),(()=>this._requiredFieldsChange())),o((()=>e.holeFilling),(e=>null!=this._index&&(this._index.holeFilling=e)))]),this._updateScaleHandles(),this._viewportQueries=new V(this.crsIndex,s.renderCoordsHelper,s.state.contentCamera,!s.state.fixedContentCamera||this.isGraphics3D,this._clippingArea,this.isMeshPyramid?s.basemapTerrain:s.elevationProvider,y(s.viewingMode),this.layer.elevationInfo,{progressiveLoadFactor:this._getProgressiveLoadFactor(),screenspaceErrorBias:this._lod,angleDependentLoD:this._lod<.5}),this._clientNodeLoader=new x(this.crsIndex,s.renderCoordsHelper.spatialReference),this._index=new b(t,i,this.indexStreamController,this._clientNodeLoader,this._viewportQueries,j,e.holeFilling,(t=>e.isNodeLoaded(t)),(t=>e.isNodeReloading(t)),(e=>this._shouldLoadNode(e)),(e=>this._enableFromGPUCache(e,v.Leaf)),(e=>this._needsUpdate(e)),(()=>!this.indexStreamController.busy),(t=>e.computeVisibilityObb?e.computeVisibilityObb(t):null),e?.computeNodeFiltering?t=>e.computeNodeFiltering(t):void 0),this._index.updateElevationInfo(this.layer.elevationInfo,this.isMeshPyramid||this.isGraphics3D),this._index.imModificationsChanged(!!e.hasModifications),null!=r){for(const e of r)this._addMesh(e.mesh,e.oid);this.addHandles(r.on("change",(e=>{for(const t of e.added)this._addMesh(t.mesh,t.oid);for(const t of e.removed)this._removeMesh(t.oid)})))}this._startNodeLoading()}))),this._tmpPoint=g(0,0,0,this.crsIndex)}updateNodeModificationStatus(e){const t=this._index,i=this.layerView;null!=t&&i?.updateNodeModificationStatus&&(this._modificationsNodeFilteringArray.clear(),e.forAll((e=>{const i=t.getNode(e);null!=i&&this._modificationsNodeFilteringArray.push(i)})),i.updateNodeModificationStatus(this._modificationsNodeFilteringArray),this._invisibleDirty=!0)}destroy(){this.cancelNodeLoading(),this._idleStateCallbacks&&(this._isIdle=!1,this._idleStateCallbacks.remove(),this._idleStateCallbacks=null),this._handles.destroy(),this._nodeLoader=null,K.prune(),null!=W&&(W.hide(),W=null)}_getRequiredAttributes(){if(null==this._attributeStorageInfo||!this._fields||!this.layerView.availableFields)return[];const e=this._attributeStorageInfo,t=this._fields,i=this.layer.objectIdField;return this.layerView.availableFields.map((i=>{const s=$(e,i),r=$(t,i);return s>=0&&r>=0?{index:s,name:t[r].name,field:t[r],attributeStorageInfo:e[s]}:null})).filter((e=>null!=e&&e.name!==i))}_requiredFieldsChange(){const e=this._getRequiredAttributes();X(this._requiredAttributes,e)||(this._requiredAttributes=e,this._requiredAttributesDirty=!1,this.restartNodeLoading())}requestUpdate(){this._requiredAttributesDirty=!0,this.restartNodeLoading()}_setClippingArea(e){const t=c();F(e,t,this.layerView.view.renderSpatialReference)?this._clippingArea=t:this._clippingArea=null}_pointOfInterestChanged(e){null!=this._viewportQueries&&(this._viewportQueries.setPointOfInterest(e),null!=this._index&&(this._index.progressiveLoadPenalty=J.distancePenalty*this._viewportQueries.distCameraToPOI(),this._index.requestUpdate()))}updateClippingArea(e){this._setClippingArea(e),null!=this._viewportQueries&&null!=this._index&&(this._viewportQueries.updateClippingArea(this._clippingArea),this._index.invalidateVisibilityCache()),this._setCameraDirty()}_setCameraDirty(){this._cameraDirty=!0,this._lodHandling.setLodGlobalDirty(),this._evaluateUpdating()}_addMesh(e,t){if(null==this._index)return;const i=this._clientNodeLoader.createMeshNodeInfo(e,t),s=this._index.addClientNodeToIndex(i.id,i.mbs);this._clientNodeLoader.addMeshNode(s,i),this.notifyChange("rootNodeVisible")}_removeMesh(e){const t=this._clientNodeLoader.getMeshNodeIndex(e);if(null==this._index||null==t)throw new Error("delayed removal of client side i3s node geometry not supported yet.");{const e=(e,t)=>{this.layerView.removeNode(t),this._loadedNodeScales.delete(t),this._clientNodeLoader.removeNode(e)},i=(e,t,i)=>{this._clientNodeLoader.updateNodeIndex(e,t,i),this.layerView.updateNodeIndex&&this.layerView.updateNodeIndex(t,i)};this._index.removeClientNodeFromIndex(t,e,i),this.notifyChange("rootNodeVisible")}}updateElevationChanged(e,t){const i=this._index;if(null==i||null==i.rootNode||null==t)return null;this.crsIndex.equals(t)||(_(e,t,Y,this.crsIndex),e=Y);const s=this._elevationUpdateNodes;return s.clear(),I(e,i.rootNode,i,(e=>s.push(e.index))),s.length&&(s.forAll((e=>i.updateElevationChanged(e))),this._setCameraDirty()),s}removeAllGeometryObbs(){null!=this._index&&this._index.removeAllGeometryObbs()}getRenderMbs(e){return null!=this._viewportQueries?this._viewportQueries.getRenderMbs(e):null}_elevationInfoChanged(e){null!=this._index&&(this._index.updateElevationInfo(e,this.isMeshPyramid||this.isGraphics3D),this._setCameraDirty())}_updateScaleHandles(){const e="scale-bounds";this._handles.remove(e),this._areScaleBoundsActive&&this._handles.add(this.layerView.view.basemapTerrain.on("scale-change",(e=>this._scaleUpdateHandler(e))),e)}_scaleBoundsChanged(){this._areScaleBoundsActive||this._loadedNodeScales.clear(),this._updateScaleHandles(),this._setCameraDirty()}_scaleUpdateHandler(e){this._updateScaleInBoundingRect(e.extent,e.spatialReference),this._setCameraDirty()}_updateScaleInBoundingRect(e,t){const i=this._index;if(null==i)return;null!=i.rootNode&&_(e,t,Y,this.crsIndex)&&this._loadedNodeScales.forEach(((e,t)=>{const s=i.getNode(t);null!=s&&p(Y,s.mbs)&&this._loadedNodeScales.set(t,this._computeScale(s))}))}restartNodeLoading(){this._restartNodeLoading=!0,this.cancelNodeLoading(),this._evaluateUpdating()}schedule(e,t){return this._idleQueue.push(e,t)}reschedule(e,t){return this._idleQueue.unshift(e,t)}get _isIntegratedMesh(){return"integrated-mesh"===this.layer.type}get _areScaleBoundsActive(){const{minScale:e,maxScale:t}=P(this.layer);return this.scaleVisibilityEnabled&&(e>0||t>0)}get unloadedMemoryEstimate(){return null==this._index||this.layerView.suspended?0:this._index.unloadedMemoryEstimate*this._lodDropFactor}async _loadNodeData(e,t){return(e.index<0?this._clientNodeLoader:this._nodeLoader).loadNodeData(e,t)}get indexDepth(){return null!=this._index?this._index.maxLevel:0}set disableMemCache(e){this.layerView.loadCachedGPUData&&this.layerView.addCachedGPUData||(this._disableMemCache=!0),this._disableMemCache=e}runTask(e,t){return this.layerView.suspended?(this._updateViewData(),this._evaluateUpdating(),-1/0):this.layerView.visible&&null!=this._index?(this._processWithErrorLogging(e,t),this._index.maxPriority):-1/0}_processWithErrorLogging(e,t){try{this._process(e,t)}catch(i){this._errorCount<50?j.error("Error during processing: "+i):50===this._errorCount&&j.error("Too many errors for this layer. Further errors will not be displayed."),this._errorCount++}}_process(e,t){this._restartNodeLoading&&this._startNodeLoading(),null!=this._nodeLoader&&null!=this._index&&(this._updateViewData(),this._invisibleDirty&&this._removeInvisibleNodes(e)&&(this._invisibleDirty=!1),this._isIntegratedMesh&&(e.enabled=!1),e.run((()=>this._processIndex(e))),this._updateFeatureLOD(),e.run((()=>this._processCache(e))),this._isIntegratedMesh&&(e.enabled=!0),e.run((()=>this._processNodes(e,t))),this._idleQueue.runTask(e),e.run((()=>this._prefetchIndex())),t.numIndexLoading+=this._index.indexLoading,t.numNodesLoading+=this._downloadingCount,e.run((()=>this._lodHandling.lodGlobalHandling(e))),this._evaluateUpdating())}_processIndex(e){if(null==this._index)return!1;if(this._index.dirty){this._newLoadingNodes.clear(),this._index.update(Array.from(this._loadingNodes.keys()),e,(e=>this.updateNodeModificationStatus(e))),this._disableMemCache||(this._newLoadingNodes.pushArray(this._index.updates.add.data,this._index.updates.add.length),this._newLoadingNodes.pushArray(this._index.updates.missing.data,this._index.updates.missing.length));const t=this._index.featureEstimate.leavesReached;this._index.isLoading||t===this._get("leavesReached")||this._set("leavesReached",t)}return this._index.load()}_prefetchIndex(){return!(null==this._index||this._loadingNodes.size>0||this._index.updates.add.length>0)&&this._index.prefetch()}_updateFeatureLOD(){if(!this.useMaximumNumberOfFeatures||null==this._index||null==this._viewportQueries)return;const e=!this._index.isLoading,t=this.featureTarget*this._baseLOD,i=this._index.featureEstimate;if(i.estimate=i.estimate||t/2,this._index.indexMissing>k){if(this._featureLOD<=H)return;this._featureLOD/=B,this._stableFeatureLOD=!1}else if(e&&i.estimate<t){if(i.leavesReached||this._featureLOD>=E||this._stableFeatureLOD)return;const e=Math.min(10,Math.max(t/i.estimate,1.001));this._featureLOD*=e;const s=this._lod,r=this._index.checkFeatureTarget(t,s);r!==s&&(this._featureLOD=r/this._baseLOD,this._stableFeatureLOD=!0)}else{if(!(i.estimate>t*R||e&&i.estimate>t))return;if(this._featureLOD<=H)return;this._featureLOD/=1+.25*(i.estimate/t-1),this._stableFeatureLOD=!1}this._featureLOD=Math.min(E,Math.max(H,this._featureLOD)),this._viewportQueries.updateScreenSpaceErrorBias(this._lod),this._index.requestUpdate()}_processCache(e){const t=this._index;if(null==t)return!1;for(;this._newLoadingNodes.length>0&&!e.done;){const i=this._newLoadingNodes.pop();for(let s=t.getParent(i);null!=s&&(!this.layerView.isNodeLoaded(s.index)&&this._isNodeInScaleBounds(s));s=t.getParent(s.index))if(this._enableFromGPUCache(s,v.Hole)){e.madeProgress();break}}return e.hasProgressed}_processNodes(e,t){if(null==this._index)return!1;let i=(this._isIdle?Q:T)-this._loadingNodes.size;const s=this._index.updates;for(s.cancel.forEach(this._cancelNode,this),s.cancel=[];s.remove.length>0&&!e.done;)this.layerView.removeNode(s.remove.pop()),e.madeProgress();for(;s.update.length>0&&!e.done;){const t=this._index.getNode(s.update.pop());null!=t&&(this._updateLoadedNode(t),e.madeProgress())}for(;s.add.length>0&&!e.done&&i>0;){--i;const r=this._index.getNode(s.add.back());if(null==r||r.cacheState!==w.Cached&&!this._hasNodeLoadToken(t))break;s.add.pop(),this._loadNode(r),e.madeProgress()}return e.hasProgressed}_cancelAllNodes(){this._loadingNodes.forEach((e=>e.abort())),this._loadingNodes.clear(),this._updatingNodes.forEach((e=>e.abort())),this._updatingNodes.clear()}_cancelNode(e){const t=this._loadingNodes.get(e);t&&(t.abort(),this._loadingNodes.delete(e))}_hasNodeLoadToken(e){return!(!this._isIdle&&e.numNodesLoading+this._loadingNodes.size>=T)&&(this._downloadingCount<O&&!this.dataStreamController.busy)}_evaluateUpdating(){let e=!1,t=0;if(this.layerView){if(this.layerView.suspended)e=this._cameraDirty,t=e?0:1;else{const i=(null!=this._index?this._index.indexMissing:0)+3*(null!=this._index?this._index.updates.add.length:0)+2*this._loadingNodes.size;e=!!(i>0||this._updatingNodes.size>0||this._restartNodeLoading||this._cameraDirty||this._idleQueue.running||this._lodHandling&&this._lodHandling.requiresLODGlobalHandling||null!=this._index&&this._index.isPrefetching),0===i&&(this._progressMaxNumNodes=1),this._progressMaxNumNodes=Math.max(i,this._progressMaxNumNodes),t=1-i/this._progressMaxNumNodes}this.updating=e,this.updatingProgress=t}}_updateViewData(){if(!this._cameraDirty||null==this._index||null==this._viewportQueries)return;const e=this.layerView.view,{contentCamera:t,fixedContentCamera:i}=e.state;this.screenSizeFactor=1/(t.perScreenPixelRatio/2),this._viewportQueries.updateCamera(t,!i||this.isGraphics3D),this._viewportQueries.setPointOfInterest(e.pointsOfInterest.focus.renderLocation),this._viewportQueries.updateScreenSpaceErrorBias(this._lod),this._index.invalidateVisibilityCache(),this._index.progressiveLoadPenalty=J.distancePenalty*this._viewportQueries.distCameraToPOI(),this._index.requestUpdate(),this._stableFeatureLOD=!1,this._invisibleDirty=!0,this._cameraDirty=!1,this.notifyChange("rootNodeVisible")}_getProgressiveLoadFactor(){return this.layerView.view.resourceController.memoryController.memoryFactor<1?1:this.layerView.progressiveLoadFactor}get _lod(){return this._featureLOD*this._baseLOD}get _baseLOD(){const e=this.layerView.lodFactor,t=this.layerView.view.resourceController.memoryController.memoryFactor;return this.fixedFeatureTarget?1:(e>0?e:1)*t}get _lodDropFactor(){if(this.fixedFeatureTarget)return 1;const e=this.layerView.view.resourceController.memoryController;return(Math.min(e.memoryFactor,.5)-e.minQuality)/(.5-e.minQuality)}isGeometryVisible(e){return null!=this._index&&this._index.isGeometryVisible(e.index)}updateVisibility(e){null!=this._index&&this._index.invalidateNodeVisibilityCache(e)}invalidateGeometryVisibility(e){null!=this._index&&this._index.invalidateGeometryVisibility(e)}invalidateVisibilityObbs(){null!=this._index&&this._index.invalidateVisibilityObbs()}modificationsChanged(){null!=this._index&&this._index.imModificationsChanged(!!this.layerView.hasModifications),this._invisibleDirty=!0}_shouldLoadNode(e){return!(!this._lodHandling.shouldLoadNode(e)||this._shouldDropNode(e))&&(!(null==this._index||!this._index.isGeometryVisible(e.index))&&this._isNodeInScaleBounds(e))}_shouldDropNode(e){if(null==this._viewportQueries)return!1;const t=this._lodDropFactor;if(t>=1||!this._lodHandling.hasNoVisibleChildren(e))return!1;return Math.abs(this._viewportQueries.calcCameraDistanceToCenter(e))-this._viewportQueries.minDistance>(this._viewportQueries.maxDistance-this._viewportQueries.minDistance)*t}_startNodeLoading(){this._restartNodeLoading=!1;const e=this._index;if(this._updatesDisabled||null==e||null==this._viewportQueries)return;this._updateViewData(),this._requiredAttributesDirty&&(this._requiredAttributes=this._getRequiredAttributes(),this._requiredAttributesDirty=!1);const t={textureEncodings:this.layerView.supportedTextureEncodings,uncompressedTextureDownsamplingEnabled:this.layerView.uncompressedTextureDownsamplingEnabled,textureUsageMask:this.layerView.rendererTextureUsage,loadFeatureData:this.useMaximumNumberOfFeatures};this._nodeLoader=new C(this.layer,this.dataStreamController,j,this._defaultGeometrySchema,this._requiredAttributes,t),e.requestUpdate(),this._lodHandling.startNodeLoading((e=>this._isNodeInScaleBounds(e)),((e,t)=>this._removeNodes(e,t,Z.fadeout)),e,{maxLodLevel:this._viewportQueries.maxLodLevel}),this._evaluateUpdating()}isNodeLoading(){return null!=this._nodeLoader&&null!=this._index}cancelNodeLoading(){this.isNodeLoading()&&(this.indexStreamController.cancelAll(),this.dataStreamController.cancelAll(),this._idleQueue.cancelAll(),this._cancelAllNodes(),this._nodeLoader=null,this._evaluateUpdating())}_removeInvisibleNodes(e){const t=this._index;if(null==t||null==this._viewportQueries)return!1;K.clear(),this.layerView.getLoadedNodeIndices(K);const i=0===this._viewportQueries.maxDistance,s=i?()=>!1:e=>this._shouldDropNode(e);return K.filterInPlace((e=>{const i=t.getNode(e);return null==i||!t.isGeometryVisible(e)||s(i)||!this._isNodeInScaleBounds(i)})),K.length>0&&this._lodHandling.setLodGlobalDirty(),this._removeNodes(K,e,Z.pop),!(i&&this._lodDropFactor<1)&&(0===K.length||(K.clear(),!1))}markNodeToRemove(e){K.push(e)}removeMarkedNodes(){this._removeNodes(K,G,Z.pop)}_removeNodes(e,t,i){const s=e.length;if(0!==s&&!t.done){for(null!=this._index&&this._index.requestUpdate();e.length>0&&!t.done;){const s=e.pop(),r=this._index;i===Z.fadeout&&this.layerView.nodeFadeoutEnabled&&null!=r&&r.isGeometryVisible(s)?this.layerView.fadeNode(s,A.FadeOut,!0):this.layerView.removeNode(s),t.madeProgress()}if(this._loadedNodeScales.size>0)for(let t=e.length;t<s;t++){const i=e.data[t];this._loadedNodeScales.delete(i)}}}_needsUpdate(e){if(e.resources.isEmpty||this._updatingNodes.has(e.index))return!1;const t=this.layerView.getLoadedAttributes(e.index);return null!=t&&t!==this._requiredAttributes}_updateLoadedNode(e){const t=new AbortController;this._updatingNodes.set(e.index,t);(X(this.layerView.getLoadedAttributes(e.index),this._requiredAttributes)?Promise.resolve(this.layerView.getAttributeData(e.index)):this._nodeLoader.loadAttributes(e,this._requiredAttributes,t.signal)).then((i=>this.schedule((()=>this.layerView.updateAttributes(e.index,{loadedAttributes:this._requiredAttributes,attributeData:i},t.signal)),t.signal))).catch((i=>{if(!d(i))return this.layerView.updateAttributes(e.index,{loadedAttributes:this._requiredAttributes,attributeData:{}},t.signal)})).catch((()=>{})).then((()=>{this._updatingNodes.delete(e.index),this._evaluateUpdating()})),this._evaluateUpdating()}_loadNode(e){if(this._loadingNodes.has(e.index))return void j.error("already loading node "+e.index);const t=new AbortController;this._loadingNodes.set(e.index,t),this._evaluateUpdating(),this._loadAndAddNode(e,t.signal).then((i=>{i&&null!=this._index&&this._loadingNodes.get(e.index)===t&&(this._loadingNodes.delete(e.index),this._index.requestUpdate())})).catch((e=>{if(!d(e))throw e})).finally((()=>{this._loadingNodes.get(e.index)===t&&this._loadingNodes.delete(e.index),this._evaluateUpdating()}))}_loadAndAddNode(e,t){return e.cacheState===w.Uncached?this._loadUncached(e,t).then((()=>!1)):this._loadCached(e,t).then((t=>!t&&(e.cacheState=w.Uncached,!0))).catch((t=>!d(t)&&(e.cacheState=w.Uncached,!0)))}_enableFromGPUCache(e,t){if(this._disableMemCache||null==this._index)return!1;if(t===v.Hole&&!this._index.useNodeAsHole(e.index))return!0;const i=this._loadCachedGPUData(e);return!!i&&(this.layerView.addCachedGPUData(e,i,t),this._nodeAdded(),!0)}_loadCachedGPUData(e){const t=this.layerView.loadCachedGPUData(e);return null!=t&&null!=t.attributeInfo&&X(t.attributeInfo.loadedAttributes,this._requiredAttributes)?t:(this.layerView.deleteCachedGPUData(t),null)}_nodeAdded(){null!=this._index&&this._index.requestUpdate(),this._lodHandling.setLodGlobalDirty(),this._evaluateUpdating()}updateLoadStatus(e,t){const i=this._index;null!=i&&i.updateChildrenLoaded(e,t?1:-1)}async _loadCached(e,t){if(this._enableFromGPUCache(e,v.Leaf))return!0;const i=this.layerView;if(this.disableIDBCache||!i.loadCachedNodeData||!i.addCachedNodeData)return!1;const s=await this.schedule((()=>i.loadCachedNodeData(e,t,((t,i)=>this._nodeLoader.loadTextures(e,t,i)))),t);if(null==s)return!1;const r=this._requiredAttributes,a=e.index>=0?await this.reschedule((()=>this._nodeLoader.loadAttributes(e,r,t)),t):null;return await this.reschedule((()=>i.addCachedNodeData(e,s,{loadedAttributes:r,attributeData:a},t)),t),this._nodeAdded(),!0}_loadUncached(e,t){return this._downloadingCount++,this._loadNodeData(e,t).catch((e=>{throw this._downloadingCount--,e})).then((i=>(this._downloadingCount--,this.schedule((()=>this.layerView.addNode(e,i,t)),t)))).then((()=>{this._nodeAdded(),e.cacheState=w.Cached})).catch((t=>{if(!d(t))throw j.error("#loadNodeData()",this.layer,`Failed to load node '${e.id}'`,t),e.failed=!0,null!=this._index&&this._index.requestUpdate(),t}))}_updateIdleState(e){e!==this._isIdle&&(this._isIdle=e,this._evaluateUpdating(),e&&this._index&&null!=this._index&&this._index.resetFailedNodes())}_getScale(e){if(this._loadedNodeScales.has(e.index))return this._loadedNodeScales.get(e.index);const t=this._computeScale(e);return this.layerView.isNodeLoaded(e.index)&&this._loadedNodeScales.set(e.index,t),t}_computeScale(e){this._tmpPoint.x=e.mbs[0],this._tmpPoint.y=e.mbs[1],this._tmpPoint.z=e.mbs[2];const t=e.mbs[3];return this.layerView.view.basemapTerrain.getSphereScale(this._tmpPoint,t)}_isNodeInScaleBounds(e){if(!this._areScaleBoundsActive)return!0;const t=this._getScale(e),{minScale:i,maxScale:s}=P(this.layer);return U(t,i,s)}updateStats(e){e.index=null!=this._index?this._index.size:0,this.isGraphics3D&&(e.detail=this._featureLOD,e.target=this.featureTarget*this._baseLOD),null!=this._index&&this._index.updateStats(e)}get test(){const e=this;return{index:this._index,set disableUpdates(t){e._updatesDisabled=t,t?e.cancelNodeLoading():e.requestUpdate()},set disableIDBCache(t){e.disableIDBCache=t},set ignoreServiceObb(t){null!=e._index&&(e._index.ignoreServiceObb=t)},shouldLoadNode:t=>e._shouldLoadNode(t)}}notifyLODUpdate(){this._lodHandling.setLodGlobalDirty(),this._evaluateUpdating(),null!=this._index&&this._index.requestUpdate()}geometryFilterChanged(e){const t=this._index;null!=t&&t.layerFilterChanged(e),this._setCameraDirty()}};e([h({readOnly:!0})],z.prototype,"isMeshPyramid",null),e([h({readOnly:!0})],z.prototype,"isGraphics3D",null),e([h({readOnly:!0})],z.prototype,"useMaximumNumberOfFeatures",null),e([h({readOnly:!0})],z.prototype,"indexStreamController",null),e([h({readOnly:!0})],z.prototype,"dataStreamController",null),e([h({readOnly:!0})],z.prototype,"crsVertex",null),e([h({readOnly:!0})],z.prototype,"crsIndex",null),e([h()],z.prototype,"screenSizeFactor",void 0),e([h()],z.prototype,"featureTarget",void 0),e([h()],z.prototype,"fixedFeatureTarget",void 0),e([h()],z.prototype,"layerView",void 0),e([h()],z.prototype,"layer",null),e([h()],z.prototype,"updating",void 0),e([h({readOnly:!0})],z.prototype,"running",null),e([h()],z.prototype,"updatingProgress",void 0),e([h({readOnly:!0})],z.prototype,"leavesReached",void 0),e([h({constructOnly:!0})],z.prototype,"scaleVisibilityEnabled",void 0),e([h({readOnly:!0,dependsOn:[]})],z.prototype,"rootNodeVisible",null),z=e([u(q)],z);const K=new r({deallocator:null});let W;function X(e,t){return null!=e&&e.length===t.length&&e.every((e=>$(t,e.name)>=0))}function $(e,t){const i=t.toLowerCase();for(let s=0;s<e.length;s++)if(e[s].name.toLowerCase()===i)return s;return-1}const J={factorIM:.2,factor3dObject:.05,distancePenalty:10},Y=c();var Z;!function(e){e[e.pop=0]="pop",e[e.fadeout=1]="fadeout"}(Z||(Z={}));const ee=z;export{ee as default};
5
+ import{_ as e}from"../../../chunks/tslib.es6.js";import t from"../../../core/Accessor.js";import i from"../../../core/Handles.js";import has from"../../../core/has.js";import s from"../../../core/Logger.js";import a from"../../../core/PooledArray.js";import{EsriPromiseMixin as r}from"../../../core/Promise.js";import{isAbortError as d}from"../../../core/promiseUtils.js";import{watch as o,initial as n,sync as l}from"../../../core/reactiveUtils.js";import{property as h}from"../../../core/accessorSupport/decorators/property.js";import"../../../core/accessorSupport/ensureType.js";import"../../../core/arrayUtils.js";import{subclass as u}from"../../../core/accessorSupport/decorators/subclass.js";import{projectBoundingRect as _}from"../../../geometry/projection.js";import{create as c,intersectsSphere as p}from"../../../geometry/support/aaBoundingRect.js";import{makeDehydratedPoint as g}from"../dehydratedFeatures.js";import{PromiseQueue as m}from"../../support/PromiseQueue.js";import{viewingModeFromString as y}from"../../../views/ViewingMode.js";import{I3SClientNodeLoader as x}from"../../../views/3d/layers/i3s/I3SClientNodeLoader.js";import{addCallback as f}from"../../../views/3d/layers/i3s/I3SFrameTask.js";import{I3SIndex as b}from"../../../views/3d/layers/i3s/I3SIndex.js";import N from"../../../views/3d/layers/i3s/I3SLodHandling.js";import{NodeState as v,CacheState as w}from"../../../views/3d/layers/i3s/I3SNode.js";import C from"../../../views/3d/layers/i3s/I3SNodeLoader.js";import{I3SStreamDataController as D}from"../../../views/3d/layers/i3s/I3SStreamDataController.js";import{getVertexCrs as L,getIndexCrs as S,findIntersectingNodes as I}from"../../../views/3d/layers/i3s/I3SUtil.js";import V from"../../../views/3d/layers/i3s/I3SViewportQueries.js";import{FadeDirection as A}from"../../../views/3d/layers/support/I3SLayerView.js";import{toBoundingRect as F}from"../../../views/3d/support/extentUtils.js";import{ClientType as M,maxDownloadSlots as O}from"../../../views/3d/support/index.js";import{extractSafeScaleBounds as U,scaleBoundsPredicate as P}from"../../../views/support/layerViewUtils.js";import{noBudget as G}from"../../../views/support/Scheduler.js";const q="esri.layers.graphics.controllers.I3SOnDemandController",j=s.getLogger(q),Q=100,T=2,E=1e4,H=1e-4,R=1.2,k=500,B=1.5;let z=class extends(r(t)){get isMeshPyramid(){return"mesh-pyramids"===this.layer.profile||"MeshPyramid"===this.layer.store?.lodType}get isGraphics3D(){return"points"===this.layer.profile}get useMaximumNumberOfFeatures(){return!this.isMeshPyramid&&(null==this.layer.priority||"High"===this.layer.priority)}get indexStreamController(){const e=this.layerView.view.resourceController.createStreamDataRequester(M.I3S_INDEX);return new D(e,this.layer.apiKey)}get dataStreamController(){const e=this.layerView.view.resourceController.createStreamDataRequester(M.I3S_DATA);return new D(e,this.layer.apiKey)}get crsVertex(){return L(this.layer)}get crsIndex(){return S(this.layer)}get layer(){return this.layerView.i3slayer}get running(){return this.updating}get rootNodeVisible(){if(null!=this._index){const e=this._index.rootNode;if(null!=e)return this._updateViewData(),this._index.isNodeVisible(e.index)}return!0}get index(){return this._index}constructor(e){super(e),this.screenSizeFactor=0,this.featureTarget=5e4,this.fixedFeatureTarget=!1,this.updating=!0,this.updatingProgress=1,this.leavesReached=!1,this.scaleVisibilityEnabled=!0,this._featureLOD=1,this._stableFeatureLOD=!1,this._isIdle=!1,this._cameraDirty=!0,this._invisibleDirty=!1,this._idleStateCallbacks=null,this._newLoadingNodes=new a({deallocator:null}),this._loadedNodeScales=new Map,this._modificationsNodeFilteringArray=new a,this._downloadingCount=0,this._loadingNodes=new Map,this._updatingNodes=new Map,this._progressMaxNumNodes=1,this._requiredAttributes=new Array,this._requiredAttributesDirty=!0,this._updatesDisabled=!1,this.disableIDBCache=!1,this._disableMemCache=!1,this._restartNodeLoading=!1,this._fields=null,this._attributeStorageInfo=null,this._handles=new i,this._idleQueue=new m,this._elevationUpdateNodes=new a({deallocator:null}),this._errorCount=0}initialize(){const{layerView:e,layer:t}=this;this._disableMemCache=!e.loadCachedGPUData||!e.addCachedGPUData,this._lodHandling=new N(e),this._defaultGeometrySchema=t.store.defaultGeometrySchema,this.disableIDBCache=has("disable-feature:idb-cache"),"fields"in t&&(this._fields=t.fields,this._attributeStorageInfo=t.attributeStorageInfo),this.addResolvingPromise(Promise.all([t.indexInfo,t.when(),e.when()]).then((([i])=>{if(this.destroyed||!e||e.destroyed||!i)return;const{view:s,clientGeometry:a}=e,{resourceController:r}=s;if(this._setClippingArea(s.clippingArea),this.addHandles([o((()=>s?.pointsOfInterest?.focus?.renderLocation),(e=>this._pointOfInterestChanged(e)),n),o((()=>r.memoryController.memoryFactor),(()=>this._setCameraDirty()),l),o((()=>e.suspended),(e=>{const t=e?()=>this._updateViewData():()=>this._updateIdleState(!0),i=e?()=>{}:()=>this._updateIdleState(!1);e||null==this._index||this._index.invalidateAllElevationRanges(),this._idleStateCallbacks?(e&&this.cancelNodeLoading(),this.restartNodeLoading(),this._idleStateCallbacks.idleBegin=t,this._idleStateCallbacks.idleEnd=i):this._idleStateCallbacks=r.scheduler.registerIdleStateCallbacks(t,i)}),n),f(e.view.resourceController.scheduler,this),o((()=>e.uncompressedTextureDownsamplingEnabled),(()=>this.restartNodeLoading())),o((()=>[this.featureTarget,this.fixedFeatureTarget]),(()=>{this._setCameraDirty(),this._stableFeatureLOD=!1})),o((()=>s.state?.contentCamera),(()=>this._setCameraDirty())),o((()=>t.elevationInfo),(e=>this._elevationInfoChanged(e))),o((()=>t.effectiveScaleRange),(()=>this._scaleBoundsChanged())),o((()=>e.lodFactor),(()=>this._setCameraDirty())),o((()=>e.availableFields),(()=>this._requiredFieldsChange())),o((()=>e.holeFilling),(e=>null!=this._index&&(this._index.holeFilling=e)))]),this._updateScaleHandles(),this._viewportQueries=new V(this.crsIndex,s.renderCoordsHelper,s.state.contentCamera,!s.state.fixedContentCamera||this.isGraphics3D,this._clippingArea,this.isMeshPyramid?s.basemapTerrain:s.elevationProvider,y(s.viewingMode),this.layer.elevationInfo,{progressiveLoadFactor:this._getProgressiveLoadFactor(),screenspaceErrorBias:this._lod,angleDependentLoD:this._lod<.5}),this._clientNodeLoader=new x(this.crsIndex,s.renderCoordsHelper.spatialReference),this._index=new b(t,i,this.indexStreamController,this._clientNodeLoader,this._viewportQueries,j,e.holeFilling,(t=>e.isNodeLoaded(t)),(t=>e.isNodeReloading(t)),(e=>this._shouldLoadNode(e)),(e=>this._enableFromGPUCache(e,v.Leaf)),(e=>this._needsUpdate(e)),(()=>!this.indexStreamController.busy),(t=>e.computeVisibilityObb?e.computeVisibilityObb(t):null),e?.computeNodeFiltering?t=>e.computeNodeFiltering(t):void 0),this._index.updateElevationInfo(this.layer.elevationInfo,this.isMeshPyramid||this.isGraphics3D),this._index.imModificationsChanged(!!e.hasModifications),null!=a){for(const e of a)this._addMesh(e.mesh,e.oid);this.addHandles(a.on("change",(e=>{for(const t of e.removed)this._removeMesh(t.oid);for(const t of e.added)this._addMesh(t.mesh,t.oid)})))}this._startNodeLoading()}))),this._tmpPoint=g(0,0,0,this.crsIndex)}updateNodeModificationStatus(e){const t=this._index,i=this.layerView;null!=t&&i?.updateNodeModificationStatus&&(this._modificationsNodeFilteringArray.clear(),e.forAll((e=>{const i=t.getNode(e);null!=i&&this._modificationsNodeFilteringArray.push(i)})),i.updateNodeModificationStatus(this._modificationsNodeFilteringArray),this._invisibleDirty=!0)}destroy(){this.cancelNodeLoading(),this._idleStateCallbacks&&(this._isIdle=!1,this._idleStateCallbacks.remove(),this._idleStateCallbacks=null),this._handles.destroy(),this._nodeLoader=null,K.prune(),null!=W&&(W.hide(),W=null)}_getRequiredAttributes(){if(null==this._attributeStorageInfo||!this._fields||!this.layerView.availableFields)return[];const e=this._attributeStorageInfo,t=this._fields,i=this.layer.objectIdField;return this.layerView.availableFields.map((i=>{const s=$(e,i),a=$(t,i);return s>=0&&a>=0?{index:s,name:t[a].name,field:t[a],attributeStorageInfo:e[s]}:null})).filter((e=>null!=e&&e.name!==i))}_requiredFieldsChange(){const e=this._getRequiredAttributes();X(this._requiredAttributes,e)||(this._requiredAttributes=e,this._requiredAttributesDirty=!1,this.restartNodeLoading())}requestUpdate(){this._requiredAttributesDirty=!0,this.restartNodeLoading()}_setClippingArea(e){const t=c();F(e,t,this.layerView.view.renderSpatialReference)?this._clippingArea=t:this._clippingArea=null}_pointOfInterestChanged(e){null!=this._viewportQueries&&(this._viewportQueries.setPointOfInterest(e),null!=this._index&&(this._index.progressiveLoadPenalty=J.distancePenalty*this._viewportQueries.distCameraToPOI(),this._index.requestUpdate()))}updateClippingArea(e){this._setClippingArea(e),null!=this._viewportQueries&&null!=this._index&&(this._viewportQueries.updateClippingArea(this._clippingArea),this._index.invalidateVisibilityCache()),this._setCameraDirty()}_setCameraDirty(){this._cameraDirty=!0,this._lodHandling.setLodGlobalDirty(),this._evaluateUpdating()}_addMesh(e,t){if(null==this._index)return;const i=this._clientNodeLoader.createMeshNodeInfo(e,t),s=this._index.addClientNodeToIndex(i.id,i.mbs);this._clientNodeLoader.addMeshNode(s,i),this._evaluateUpdating(),this.notifyChange("rootNodeVisible")}_removeMesh(e){const t=this._clientNodeLoader.getMeshNodeIndex(e);if(null==this._index||null==t)throw new Error("delayed removal of client side i3s node geometry not supported yet.");{const e=(e,t)=>{this.layerView.removeNode(t),this._loadedNodeScales.delete(t),this._clientNodeLoader.removeNode(e),this.layerView.deleteCachedNodeData&&null!=e&&this.layerView.deleteCachedNodeData(e),this.layerView.deleteCachedGPUData?.(this.layerView.loadCachedGPUData?.(t))},i=(e,t,i)=>{this._clientNodeLoader.updateNodeIndex(e,t,i),this.layerView.updateNodeIndex&&this.layerView.updateNodeIndex(t,i)};this._index.removeClientNodeFromIndex(t,e,i),this.notifyChange("rootNodeVisible")}}updateElevationChanged(e,t){const i=this._index;if(null==i||null==i.rootNode||null==t)return null;this.crsIndex.equals(t)||(_(e,t,Y,this.crsIndex),e=Y);const s=this._elevationUpdateNodes;return s.clear(),I(e,i.rootNode,i,(e=>s.push(e.index))),s.length&&(s.forAll((e=>i.updateElevationChanged(e))),this._setCameraDirty()),s}removeAllGeometryObbs(){null!=this._index&&this._index.removeAllGeometryObbs()}getRenderMbs(e){return null!=this._viewportQueries?this._viewportQueries.getRenderMbs(e):null}_elevationInfoChanged(e){null!=this._index&&(this._index.updateElevationInfo(e,this.isMeshPyramid||this.isGraphics3D),this._setCameraDirty())}_updateScaleHandles(){const e="scale-bounds";this._handles.remove(e),this._areScaleBoundsActive&&this._handles.add(this.layerView.view.basemapTerrain.on("scale-change",(e=>this._scaleUpdateHandler(e))),e)}_scaleBoundsChanged(){this._areScaleBoundsActive||this._loadedNodeScales.clear(),this._updateScaleHandles(),this._setCameraDirty()}_scaleUpdateHandler(e){this._updateScaleInBoundingRect(e.extent,e.spatialReference),this._setCameraDirty()}_updateScaleInBoundingRect(e,t){const i=this._index;if(null==i)return;null!=i.rootNode&&_(e,t,Y,this.crsIndex)&&this._loadedNodeScales.forEach(((e,t)=>{const s=i.getNode(t);null!=s&&p(Y,s.mbs)&&this._loadedNodeScales.set(t,this._computeScale(s))}))}restartNodeLoading(){this._restartNodeLoading=!0,this.cancelNodeLoading(),this._evaluateUpdating()}schedule(e,t){return this._idleQueue.push(e,t)}reschedule(e,t){return this._idleQueue.unshift(e,t)}get _isIntegratedMesh(){return"integrated-mesh"===this.layer.type}get _areScaleBoundsActive(){const{minScale:e,maxScale:t}=U(this.layer);return this.scaleVisibilityEnabled&&(e>0||t>0)}get unloadedMemoryEstimate(){return null==this._index||this.layerView.suspended?0:this._index.unloadedMemoryEstimate*this._lodDropFactor}async _loadNodeData(e,t){return(e.index<0?this._clientNodeLoader:this._nodeLoader).loadNodeData(e,t)}get indexDepth(){return null!=this._index?this._index.maxLevel:0}set disableMemCache(e){this.layerView.loadCachedGPUData&&this.layerView.addCachedGPUData||(this._disableMemCache=!0),this._disableMemCache=e}runTask(e,t){return this.layerView.suspended?(this._updateViewData(),this._evaluateUpdating(),-1/0):this.layerView.visible&&null!=this._index?(this._processWithErrorLogging(e,t),this._index.maxPriority):-1/0}_processWithErrorLogging(e,t){try{this._process(e,t)}catch(i){this._errorCount<50?j.error("Error during processing: "+i):50===this._errorCount&&j.error("Too many errors for this layer. Further errors will not be displayed."),this._errorCount++}}_process(e,t){this._restartNodeLoading&&this._startNodeLoading(),null!=this._nodeLoader&&null!=this._index&&(this._updateViewData(),this._invisibleDirty&&this._removeInvisibleNodes(e)&&(this._invisibleDirty=!1),this._isIntegratedMesh&&(e.enabled=!1),e.run((()=>this._processIndex(e))),this._updateFeatureLOD(),e.run((()=>this._processCache(e))),this._isIntegratedMesh&&(e.enabled=!0),e.run((()=>this._processNodes(e,t))),this._idleQueue.runTask(e),e.run((()=>this._prefetchIndex())),t.numIndexLoading+=this._index.indexLoading,t.numNodesLoading+=this._downloadingCount,e.run((()=>this._lodHandling.lodGlobalHandling(e))),this._evaluateUpdating())}_processIndex(e){if(null==this._index)return!1;if(this._index.dirty){this._newLoadingNodes.clear(),this._index.update(Array.from(this._loadingNodes.keys()),e,(e=>this.updateNodeModificationStatus(e))),this._disableMemCache||(this._newLoadingNodes.pushArray(this._index.updates.add.data,this._index.updates.add.length),this._newLoadingNodes.pushArray(this._index.updates.missing.data,this._index.updates.missing.length));const t=this._index.featureEstimate.leavesReached;this._index.isLoading||t===this._get("leavesReached")||this._set("leavesReached",t)}return this._index.load()}_prefetchIndex(){return!(null==this._index||this._loadingNodes.size>0||this._index.updates.add.length>0)&&this._index.prefetch()}_updateFeatureLOD(){if(!this.useMaximumNumberOfFeatures||null==this._index||null==this._viewportQueries)return;const e=!this._index.isLoading,t=this.featureTarget*this._baseLOD,i=this._index.featureEstimate;if(i.estimate=i.estimate||t/2,this._index.indexMissing>k){if(this._featureLOD<=H)return;this._featureLOD/=B,this._stableFeatureLOD=!1}else if(e&&i.estimate<t){if(i.leavesReached||this._featureLOD>=E||this._stableFeatureLOD)return;const e=Math.min(10,Math.max(t/i.estimate,1.001));this._featureLOD*=e;const s=this._lod,a=this._index.checkFeatureTarget(t,s);a!==s&&(this._featureLOD=a/this._baseLOD,this._stableFeatureLOD=!0)}else{if(!(i.estimate>t*R||e&&i.estimate>t))return;if(this._featureLOD<=H)return;this._featureLOD/=1+.25*(i.estimate/t-1),this._stableFeatureLOD=!1}this._featureLOD=Math.min(E,Math.max(H,this._featureLOD)),this._viewportQueries.updateScreenSpaceErrorBias(this._lod),this._index.requestUpdate()}_processCache(e){const t=this._index;if(null==t)return!1;for(;this._newLoadingNodes.length>0&&!e.done;){const i=this._newLoadingNodes.pop();for(let s=t.getParent(i);null!=s&&(!this.layerView.isNodeLoaded(s.index)&&this._isNodeInScaleBounds(s));s=t.getParent(s.index))if(this._enableFromGPUCache(s,v.Hole)){e.madeProgress();break}}return e.hasProgressed}_processNodes(e,t){if(null==this._index)return!1;let i=(this._isIdle?Q:T)-this._loadingNodes.size;const s=this._index.updates;for(s.cancel.forEach(this._cancelNode,this),s.cancel=[];s.remove.length>0&&!e.done;)this.layerView.removeNode(s.remove.pop()),e.madeProgress();for(;s.update.length>0&&!e.done;){const t=this._index.getNode(s.update.pop());null!=t&&(this._updateLoadedNode(t),e.madeProgress())}for(;s.add.length>0&&!e.done&&i>0;){--i;const a=this._index.getNode(s.add.back());if(null==a||a.cacheState!==w.Cached&&!this._hasNodeLoadToken(t))break;s.add.pop(),this._loadNode(a),e.madeProgress()}return e.hasProgressed}_cancelAllNodes(){this._loadingNodes.forEach((e=>e.abort())),this._loadingNodes.clear(),this._updatingNodes.forEach((e=>e.abort())),this._updatingNodes.clear()}_cancelNode(e){const t=this._loadingNodes.get(e);t&&(t.abort(),this._loadingNodes.delete(e))}_hasNodeLoadToken(e){return!(!this._isIdle&&e.numNodesLoading+this._loadingNodes.size>=T)&&(this._downloadingCount<O&&!this.dataStreamController.busy)}_evaluateUpdating(){let e=!1,t=0;if(this.layerView){if(this.layerView.suspended)e=this._cameraDirty,t=e?0:1;else{const i=(null!=this._index?this._index.indexMissing:0)+3*(null!=this._index?this._index.updates.add.length:0)+2*this._loadingNodes.size;e=!!(i>0||this._updatingNodes.size>0||this._restartNodeLoading||this._cameraDirty||this._idleQueue.running||this._lodHandling&&this._lodHandling.requiresLODGlobalHandling||null!=this._index&&this._index.isPrefetching),0===i&&(this._progressMaxNumNodes=1),this._progressMaxNumNodes=Math.max(i,this._progressMaxNumNodes),t=1-i/this._progressMaxNumNodes}this.updating=e,this.updatingProgress=t}}_updateViewData(){if(!this._cameraDirty||null==this._index||null==this._viewportQueries)return;const e=this.layerView.view,{contentCamera:t,fixedContentCamera:i}=e.state;this.screenSizeFactor=1/(t.perScreenPixelRatio/2),this._viewportQueries.updateCamera(t,!i||this.isGraphics3D),this._viewportQueries.setPointOfInterest(e.pointsOfInterest.focus.renderLocation),this._viewportQueries.updateScreenSpaceErrorBias(this._lod),this._index.invalidateVisibilityCache(),this._index.progressiveLoadPenalty=J.distancePenalty*this._viewportQueries.distCameraToPOI(),this._index.requestUpdate(),this._stableFeatureLOD=!1,this._invisibleDirty=!0,this._cameraDirty=!1,this.notifyChange("rootNodeVisible")}_getProgressiveLoadFactor(){return this.layerView.view.resourceController.memoryController.memoryFactor<1?1:this.layerView.progressiveLoadFactor}get _lod(){return this._featureLOD*this._baseLOD}get _baseLOD(){const e=this.layerView.lodFactor,t=this.layerView.view.resourceController.memoryController.memoryFactor;return this.fixedFeatureTarget?1:(e>0?e:1)*t}get _lodDropFactor(){if(this.fixedFeatureTarget)return 1;const e=this.layerView.view.resourceController.memoryController;return(Math.min(e.memoryFactor,.5)-e.minQuality)/(.5-e.minQuality)}isGeometryVisible(e){return null!=this._index&&this._index.isGeometryVisible(e.index)}updateVisibility(e){null!=this._index&&this._index.invalidateNodeVisibilityCache(e)}invalidateGeometryVisibility(e){null!=this._index&&this._index.invalidateGeometryVisibility(e)}invalidateVisibilityObbs(){null!=this._index&&this._index.invalidateVisibilityObbs()}modificationsChanged(){null!=this._index&&this._index.imModificationsChanged(!!this.layerView.hasModifications),this._invisibleDirty=!0}_shouldLoadNode(e){return!(!this._lodHandling.shouldLoadNode(e)||this._shouldDropNode(e))&&(!(null==this._index||!this._index.isGeometryVisible(e.index))&&this._isNodeInScaleBounds(e))}_shouldDropNode(e){if(null==this._viewportQueries)return!1;const t=this._lodDropFactor;if(t>=1||!this._lodHandling.hasNoVisibleChildren(e))return!1;return Math.abs(this._viewportQueries.calcCameraDistanceToCenter(e))-this._viewportQueries.minDistance>(this._viewportQueries.maxDistance-this._viewportQueries.minDistance)*t}_startNodeLoading(){this._restartNodeLoading=!1;const e=this._index;if(this._updatesDisabled||null==e||null==this._viewportQueries)return;this._updateViewData(),this._requiredAttributesDirty&&(this._requiredAttributes=this._getRequiredAttributes(),this._requiredAttributesDirty=!1);const t={textureEncodings:this.layerView.supportedTextureEncodings,uncompressedTextureDownsamplingEnabled:this.layerView.uncompressedTextureDownsamplingEnabled,textureUsageMask:this.layerView.rendererTextureUsage,loadFeatureData:this.useMaximumNumberOfFeatures};this._nodeLoader=new C(this.layer,this.dataStreamController,j,this._defaultGeometrySchema,this._requiredAttributes,t),e.requestUpdate(),this._lodHandling.startNodeLoading((e=>this._isNodeInScaleBounds(e)),((e,t)=>this._removeNodes(e,t,Z.fadeout)),e,{maxLodLevel:this._viewportQueries.maxLodLevel}),this._evaluateUpdating()}isNodeLoading(){return null!=this._nodeLoader&&null!=this._index}cancelNodeLoading(){this.isNodeLoading()&&(this.indexStreamController.cancelAll(),this.dataStreamController.cancelAll(),this._idleQueue.cancelAll(),this._cancelAllNodes(),this._nodeLoader=null,this._evaluateUpdating())}_removeInvisibleNodes(e){const t=this._index;if(null==t||null==this._viewportQueries)return!1;K.clear(),this.layerView.getLoadedNodeIndices(K);const i=0===this._viewportQueries.maxDistance,s=i?()=>!1:e=>this._shouldDropNode(e);return K.filterInPlace((e=>{const i=t.getNode(e);return null==i||!t.isGeometryVisible(e)||s(i)||!this._isNodeInScaleBounds(i)})),K.length>0&&this._lodHandling.setLodGlobalDirty(),this._removeNodes(K,e,Z.pop),!(i&&this._lodDropFactor<1)&&(0===K.length||(K.clear(),!1))}markNodeToRemove(e){K.push(e)}removeMarkedNodes(){this._removeNodes(K,G,Z.pop)}_removeNodes(e,t,i){const s=e.length;if(0!==s&&!t.done){for(null!=this._index&&this._index.requestUpdate();e.length>0&&!t.done;){const s=e.pop(),a=this._index;i===Z.fadeout&&this.layerView.nodeFadeoutEnabled&&null!=a&&a.isGeometryVisible(s)?this.layerView.fadeNode(s,A.FadeOut,!0):this.layerView.removeNode(s),t.madeProgress()}if(this._loadedNodeScales.size>0)for(let t=e.length;t<s;t++){const i=e.data[t];this._loadedNodeScales.delete(i)}}}_needsUpdate(e){if(e.resources.isEmpty||this._updatingNodes.has(e.index))return!1;const t=this.layerView.getLoadedAttributes(e.index);return null!=t&&t!==this._requiredAttributes}_updateLoadedNode(e){const t=new AbortController;this._updatingNodes.set(e.index,t);(X(this.layerView.getLoadedAttributes(e.index),this._requiredAttributes)?Promise.resolve(this.layerView.getAttributeData(e.index)):this._nodeLoader.loadAttributes(e,this._requiredAttributes,t.signal)).then((i=>this.schedule((()=>this.layerView.updateAttributes(e.index,{loadedAttributes:this._requiredAttributes,attributeData:i},t.signal)),t.signal))).catch((i=>{if(!d(i))return this.layerView.updateAttributes(e.index,{loadedAttributes:this._requiredAttributes,attributeData:{}},t.signal)})).catch((()=>{})).then((()=>{this._updatingNodes.delete(e.index),this._evaluateUpdating()})),this._evaluateUpdating()}_loadNode(e){if(this._loadingNodes.has(e.index))return void j.error("already loading node "+e.index);const t=new AbortController;this._loadingNodes.set(e.index,t),this._evaluateUpdating(),this._loadAndAddNode(e,t.signal).then((i=>{i&&null!=this._index&&this._loadingNodes.get(e.index)===t&&(this._loadingNodes.delete(e.index),this._index.requestUpdate())})).catch((e=>{if(!d(e))throw e})).finally((()=>{this._loadingNodes.get(e.index)===t&&this._loadingNodes.delete(e.index),this._evaluateUpdating()}))}_loadAndAddNode(e,t){return e.cacheState===w.Uncached?this._loadUncached(e,t).then((()=>!1)):this._loadCached(e,t).then((t=>!t&&(e.cacheState=w.Uncached,!0))).catch((t=>!d(t)&&(e.cacheState=w.Uncached,!0)))}_enableFromGPUCache(e,t){if(this._disableMemCache||null==this._index)return!1;if(t===v.Hole&&!this._index.useNodeAsHole(e.index))return!0;const i=this._loadCachedGPUData(e);return!!i&&(this.layerView.addCachedGPUData(e,i,t),this._nodeAdded(),!0)}_loadCachedGPUData(e){const t=this.layerView.loadCachedGPUData(e.index);return null!=t&&null!=t.attributeInfo&&X(t.attributeInfo.loadedAttributes,this._requiredAttributes)?t:(this.layerView.deleteCachedGPUData(t),null)}_nodeAdded(){null!=this._index&&this._index.requestUpdate(),this._lodHandling.setLodGlobalDirty(),this._evaluateUpdating()}updateLoadStatus(e,t){const i=this._index;null!=i&&i.updateChildrenLoaded(e,t?1:-1)}async _loadCached(e,t){if(this._enableFromGPUCache(e,v.Leaf))return!0;const i=this.layerView;if(this.disableIDBCache||!i.loadCachedNodeData||!i.addCachedNodeData)return!1;const s=await this.schedule((()=>i.loadCachedNodeData(e,t,((t,i)=>this._nodeLoader.loadTextures(e,t,i)))),t);if(null==s)return!1;const a=this._requiredAttributes,r=e.index>=0?await this.reschedule((()=>this._nodeLoader.loadAttributes(e,a,t)),t):null;return await this.reschedule((()=>i.addCachedNodeData(e,s,{loadedAttributes:a,attributeData:r},t)),t),this._nodeAdded(),!0}_loadUncached(e,t){return this._downloadingCount++,this._loadNodeData(e,t).catch((e=>{throw this._downloadingCount--,e})).then((i=>(this._downloadingCount--,this.schedule((()=>this.layerView.addNode(e,i,t)),t)))).then((()=>{this._nodeAdded(),e.cacheState=w.Cached})).catch((t=>{if(!d(t))throw j.error("#loadNodeData()",this.layer,`Failed to load node '${e.id}'`,t),e.failed=!0,null!=this._index&&this._index.requestUpdate(),t}))}_updateIdleState(e){e!==this._isIdle&&(this._isIdle=e,this._evaluateUpdating(),e&&this._index&&null!=this._index&&this._index.resetFailedNodes())}_getScale(e){if(this._loadedNodeScales.has(e.index))return this._loadedNodeScales.get(e.index);const t=this._computeScale(e);return this.layerView.isNodeLoaded(e.index)&&this._loadedNodeScales.set(e.index,t),t}_computeScale(e){this._tmpPoint.x=e.mbs[0],this._tmpPoint.y=e.mbs[1],this._tmpPoint.z=e.mbs[2];const t=e.mbs[3];return this.layerView.view.basemapTerrain.getSphereScale(this._tmpPoint,t)}_isNodeInScaleBounds(e){if(!this._areScaleBoundsActive)return!0;const t=this._getScale(e),{minScale:i,maxScale:s}=U(this.layer);return P(t,i,s)}updateStats(e){e.index=null!=this._index?this._index.size:0,this.isGraphics3D&&(e.detail=this._featureLOD,e.target=this.featureTarget*this._baseLOD),null!=this._index&&this._index.updateStats(e)}get test(){const e=this;return{index:this._index,set disableUpdates(t){e._updatesDisabled=t,t?e.cancelNodeLoading():e.requestUpdate()},set disableIDBCache(t){e.disableIDBCache=t},set ignoreServiceObb(t){null!=e._index&&(e._index.ignoreServiceObb=t)},shouldLoadNode:t=>e._shouldLoadNode(t)}}notifyLODUpdate(){this._lodHandling.setLodGlobalDirty(),this._evaluateUpdating(),null!=this._index&&this._index.requestUpdate()}geometryFilterChanged(e){const t=this._index;null!=t&&t.layerFilterChanged(e),this._setCameraDirty()}};e([h({readOnly:!0})],z.prototype,"isMeshPyramid",null),e([h({readOnly:!0})],z.prototype,"isGraphics3D",null),e([h({readOnly:!0})],z.prototype,"useMaximumNumberOfFeatures",null),e([h({readOnly:!0})],z.prototype,"indexStreamController",null),e([h({readOnly:!0})],z.prototype,"dataStreamController",null),e([h({readOnly:!0})],z.prototype,"crsVertex",null),e([h({readOnly:!0})],z.prototype,"crsIndex",null),e([h()],z.prototype,"screenSizeFactor",void 0),e([h()],z.prototype,"featureTarget",void 0),e([h()],z.prototype,"fixedFeatureTarget",void 0),e([h()],z.prototype,"layerView",void 0),e([h()],z.prototype,"layer",null),e([h()],z.prototype,"updating",void 0),e([h({readOnly:!0})],z.prototype,"running",null),e([h()],z.prototype,"updatingProgress",void 0),e([h({readOnly:!0})],z.prototype,"leavesReached",void 0),e([h({constructOnly:!0})],z.prototype,"scaleVisibilityEnabled",void 0),e([h({readOnly:!0,dependsOn:[]})],z.prototype,"rootNodeVisible",null),z=e([u(q)],z);const K=new a({deallocator:null});let W;function X(e,t){return null!=e&&e.length===t.length&&e.every((e=>$(t,e.name)>=0))}function $(e,t){const i=t.toLowerCase();for(let s=0;s<e.length;s++)if(e[s].name.toLowerCase()===i)return s;return-1}const J={factorIM:.2,factor3dObject:.05,distancePenalty:10},Y=c();var Z;!function(e){e[e.pop=0]="pop",e[e.fadeout=1]="fadeout"}(Z||(Z={}));const ee=z;export{ee as default};