@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
@@ -2,4 +2,4 @@
2
2
  All material copyright ESRI, All Rights Reserved, unless otherwise specified.
3
3
  See https://js.arcgis.com/4.27/esri/copyright.txt for details.
4
4
  */
5
- import{_ as t}from"../../../chunks/tslib.es6.js";import e from"../../../Graphic.js";import o from"../../../core/Accessor.js";import{HandleOwnerMixin as r}from"../../../core/HandleOwner.js";import{watch as n,initial as s}from"../../../core/reactiveUtils.js";import{throttle as i}from"../../../core/throttle.js";import{property as l}from"../../../core/accessorSupport/decorators/property.js";import"../../../core/accessorSupport/ensureType.js";import"../../../core/arrayUtils.js";import"../../../core/has.js";import{subclass as p}from"../../../core/accessorSupport/decorators/subclass.js";import"../../../popup/content/AttachmentsContent.js";import"../../../popup/content/Content.js";import"../../../popup/content/CustomContent.js";import"../../../popup/content/ExpressionContent.js";import a from"../../../popup/content/FieldsContent.js";import c from"../../../popup/content/MediaContent.js";import"../../../popup/content/RelationshipContent.js";import m from"../../../popup/content/TextContent.js";import h from"../../../popup/ElementExpressionInfo.js";import u from"../FeatureContent/FeatureContentViewModel.js";import d from"../FeatureFields/FeatureFieldsViewModel.js";import f from"../FeatureMedia/FeatureMediaViewModel.js";import{loadArcadeUtils as y,createCompiledExpression as _}from"../support/arcadeFeatureUtils.js";const w=1;let j=class extends(r(o)){constructor(t){super(t),this._abortController=null,this.expressionInfo=null,this.graphic=null,this.contentElement=null,this.contentElementViewModel=null,this.interceptor=null,this.view=null,this._cancelQuery=()=>{const{_abortController:t}=this;t&&t.abort(),this._abortController=null},this._createVM=()=>{const t=this.contentElement?.type;this.contentElementViewModel?.destroy();const e="fields"===t?new d:"media"===t?new f:"text"===t?new u:null;this._set("contentElementViewModel",e)},this._compile=async()=>{this._cancelQuery();const t=new AbortController;this._abortController=t,await this._compileExpression(),this._abortController===t&&(this._abortController=null)},this._compileThrottled=i(this._compile,w,this),this._compileExpression=async()=>{const{expressionInfo:t,graphic:e,interceptor:o,spatialReference:r,map:n,view:s,_abortController:i}=this;if(!(t&&e&&r&&n))return void this._set("contentElement",null);const l=await y();if(i!==this._abortController)return;const p=await _({arcadeUtils:l,expressionInfo:t,graphic:e,interceptor:o,map:n,spatialReference:r,view:s});if(!p||"esri.arcade.Dictionary"!==p.declaredClass)return void this._set("contentElement",null);const h=await p.castAsJsonAsync(i?.signal),u=h?.type,d="media"===u?c.fromJSON(h):"text"===u?m.fromJSON(h):"fields"===u?a.fromJSON(h):null;this._set("contentElement",d)},this.handles.add([n((()=>[this.expressionInfo,this.graphic,this.map,this.spatialReference,this.view]),(()=>this._compileThrottled()),s),n((()=>[this.contentElement]),(()=>this._createVM()),s)])}destroy(){this._cancelQuery(),this.contentElementViewModel?.destroy(),this._set("contentElementViewModel",null),this._set("contentElement",null)}get spatialReference(){return this.view?.spatialReference??null}set spatialReference(t){this._override("spatialReference",t)}get state(){const{_abortController:t,contentElement:e,contentElementViewModel:o}=this;return t?"loading":e||o?"ready":"disabled"}get map(){return this.view?.map??null}set map(t){this._override("map",t)}};t([l()],j.prototype,"_abortController",void 0),t([l({type:h})],j.prototype,"expressionInfo",void 0),t([l({type:e})],j.prototype,"graphic",void 0),t([l({readOnly:!0})],j.prototype,"contentElement",void 0),t([l({readOnly:!0})],j.prototype,"contentElementViewModel",void 0),t([l()],j.prototype,"interceptor",void 0),t([l()],j.prototype,"spatialReference",null),t([l({readOnly:!0})],j.prototype,"state",null),t([l()],j.prototype,"map",null),t([l()],j.prototype,"view",void 0),j=t([p("esri.widgets.Feature.FeatureExpression.FeatureExpressionViewModel")],j);const C=j;export{C as default};
5
+ import{_ as t}from"../../../chunks/tslib.es6.js";import e from"../../../Graphic.js";import o from"../../../core/Accessor.js";import{HandleOwnerMixin as r}from"../../../core/HandleOwner.js";import{watch as n,initial as s}from"../../../core/reactiveUtils.js";import{throttle as i}from"../../../core/throttle.js";import{property as l}from"../../../core/accessorSupport/decorators/property.js";import"../../../core/accessorSupport/ensureType.js";import"../../../core/arrayUtils.js";import"../../../core/has.js";import{subclass as p}from"../../../core/accessorSupport/decorators/subclass.js";import"../../../popup/content/AttachmentsContent.js";import"../../../popup/content/Content.js";import"../../../popup/content/CustomContent.js";import"../../../popup/content/ExpressionContent.js";import a from"../../../popup/content/FieldsContent.js";import c from"../../../popup/content/MediaContent.js";import"../../../popup/content/RelationshipContent.js";import m from"../../../popup/content/TextContent.js";import h from"../../../popup/ElementExpressionInfo.js";import d from"../FeatureContent/FeatureContentViewModel.js";import u from"../FeatureFields/FeatureFieldsViewModel.js";import f from"../FeatureMedia/FeatureMediaViewModel.js";import{loadArcadeUtils as y,createCompiledExpression as _}from"../support/arcadeFeatureUtils.js";const w=1;let j=class extends(r(o)){constructor(t){super(t),this._abortController=null,this.expressionInfo=null,this.graphic=null,this.contentElement=null,this.contentElementViewModel=null,this.interceptor=null,this.view=null,this._cancelQuery=()=>{const{_abortController:t}=this;t&&t.abort(),this._abortController=null},this._createVM=()=>{const t=this.contentElement?.type;this.contentElementViewModel?.destroy();const e="fields"===t?new u:"media"===t?new f:"text"===t?new d:null;this._set("contentElementViewModel",e)},this._compile=async()=>{this._cancelQuery();const t=new AbortController;this._abortController=t,await this._compileExpression(),this._abortController===t&&(this._abortController=null)},this._compileThrottled=i(this._compile,w,this),this._compileExpression=async()=>{const{expressionInfo:t,graphic:e,interceptor:o,spatialReference:r,map:n,view:s,_abortController:i}=this;if(!(t&&e&&r&&n))return void this._set("contentElement",null);const l=await y();if(i!==this._abortController)return;const p=await _({arcadeUtils:l,expressionInfo:t,graphic:e,interceptor:o,map:n,spatialReference:r,view:s});if(!p||"esri.arcade.Dictionary"!==p.declaredClass)return void this._set("contentElement",null);const h=await p.castAsJsonAsync(i?.signal),d=h?.type,u="media"===d?c.fromJSON(h):"text"===d?m.fromJSON(h):"fields"===d?a.fromJSON(h):null;this._set("contentElement",u)},this.handles.add([n((()=>[this.expressionInfo,this.graphic,this.map,this.spatialReference,this.view]),(()=>this._compileThrottled()),s),n((()=>[this.contentElement]),(()=>this._createVM()),s)])}initialize(){this.addHandles(this._compileThrottled)}destroy(){this._cancelQuery(),this.contentElementViewModel?.destroy(),this._set("contentElementViewModel",null),this._set("contentElement",null)}get spatialReference(){return this.view?.spatialReference??null}set spatialReference(t){this._override("spatialReference",t)}get state(){const{_abortController:t,contentElement:e,contentElementViewModel:o}=this;return t?"loading":e||o?"ready":"disabled"}get map(){return this.view?.map??null}set map(t){this._override("map",t)}};t([l()],j.prototype,"_abortController",void 0),t([l({type:h})],j.prototype,"expressionInfo",void 0),t([l({type:e})],j.prototype,"graphic",void 0),t([l({readOnly:!0})],j.prototype,"contentElement",void 0),t([l({readOnly:!0})],j.prototype,"contentElementViewModel",void 0),t([l()],j.prototype,"interceptor",void 0),t([l()],j.prototype,"spatialReference",null),t([l({readOnly:!0})],j.prototype,"state",null),t([l()],j.prototype,"map",null),t([l()],j.prototype,"view",void 0),j=t([p("esri.widgets.Feature.FeatureExpression.FeatureExpressionViewModel")],j);const C=j;export{C as default};
@@ -2,4 +2,4 @@
2
2
  All material copyright ESRI, All Rights Reserved, unless otherwise specified.
3
3
  See https://js.arcgis.com/4.27/esri/copyright.txt for details.
4
4
  */
5
- import{_ as e}from"../../../chunks/tslib.es6.js";import t from"../../../Graphic.js";import r from"../../../core/Accessor.js";import{isSome as o}from"../../../core/arrayUtils.js";import{ClonableMixin as l}from"../../../core/Clonable.js";import s from"../../../core/Collection.js";import{HandleOwnerMixin as a}from"../../../core/HandleOwner.js";import{IdentifiableMixin as i}from"../../../core/Identifiable.js";import{ignoreAbortErrors as n}from"../../../core/promiseUtils.js";import{watch as u,initial as d}from"../../../core/reactiveUtils.js";import{throttle as h}from"../../../core/throttle.js";import{property as y}from"../../../core/accessorSupport/decorators/property.js";import"../../../core/accessorSupport/ensureType.js";import"../../../core/has.js";import{subclass as p}from"../../../core/accessorSupport/decorators/subclass.js";import c from"../../../rest/support/RelationshipQuery.js";import{getFixedFieldName as C,findRelatedLayer as _}from"../support/featureUtils.js";const g=100;let b=class extends(l(i(a(r)))){constructor(e){super(e),this._queryAbortController=null,this._queryPageAbortController=null,this._queryFeatureCountAbortController=null,this.featuresPerPage=10,this.description=null,this.graphic=null,this.layer=null,this.map=null,this.orderByFields=null,this.featureCount=0,this.relationshipId=null,this.showAllEnabled=!1,this.title=null,this._cancelQuery=()=>{const{_queryAbortController:e}=this;e&&e.abort(),this._queryAbortController=null},this._cancelQueryFeatureCount=()=>{const{_queryFeatureCountAbortController:e}=this;e&&e.abort(),this._queryFeatureCountAbortController=null},this._cancelQueryPage=()=>{const{_queryPageAbortController:e}=this;e&&e.abort(),this._queryPageAbortController=null},this._queryController=async()=>{this._cancelQuery();const e=new AbortController;this._queryAbortController=e,await n(this._query()),this._queryAbortController===e&&(this._queryAbortController=null)},this._queryFeatureCountController=async()=>{this._cancelQueryFeatureCount();const e=new AbortController;this._queryFeatureCountAbortController=e,await n(this._queryFeatureCount()),this._queryFeatureCountAbortController===e&&(this._queryFeatureCountAbortController=null)},this._queryPageController=async()=>{const e=new AbortController;this._queryPageAbortController=e,await n(this._queryPage()),this._queryPageAbortController===e&&(this._queryPageAbortController=null)},this._queryThrottled=h(this._queryController,g,this),this._queryFeatureCountThrottled=h(this._queryFeatureCountController,g,this),this._queryPageThrottled=h(this._queryPageController,g,this),this._query=async()=>{const{_queryAbortController:e,relatedFeatures:t}=this;this._destroyRelatedFeatureViewModels(),this.featurePage=1,t.removeAll(),t.addMany(this._sliceFeatures(await this._queryRelatedFeatures({signal:e?.signal})))},this.handles.add([u((()=>[this.displayCount,this.graphic,this.layer,this.map,this.orderByFieldsFixedCasing,this.relationshipId,this.featuresPerPage,this.showAllEnabled,this.canQuery,this.featureCount]),(()=>this._queryThrottled()),d),u((()=>[this.featurePage,this.showAllEnabled]),(()=>this._queryPageThrottled())),u((()=>[this.layer,this.relationshipId,this.objectId,this.canQuery]),(()=>this._queryFeatureCountThrottled()))])}destroy(){this._destroyRelatedFeatureViewModels(),this.relatedFeatures.removeAll(),this._cancelQuery(),this._cancelQueryFeatureCount(),this._cancelQueryPage()}set featurePage(e){const{featuresPerPage:t,featureCount:r}=this,o=1,l=Math.ceil(r/t)||1;this._set("featurePage",Math.min(Math.max(e,o),l))}get featurePage(){return this._get("featurePage")}get orderByFieldsFixedCasing(){const{orderByFields:e,relatedLayer:t}=this;return e&&t?.loaded?e.map((e=>{const r=e.clone();return r.field=C(e.field,t),r})):e??[]}get supportsCacheHint(){return!!this.layer?.capabilities?.queryRelated?.supportsCacheHint}get canQuery(){const e=this.layer?.capabilities?.queryRelated;return!!(this.relatedLayer&&this.relationship&&"number"==typeof this.relationshipId&&"number"==typeof this.objectId&&e?.supportsCount&&e?.supportsPagination)}get itemDescriptionFieldName(){return this.orderByFieldsFixedCasing[0]?.field||null}set displayCount(e){const t=0,r=10;this._set("displayCount",Math.min(Math.max(e,t),r))}get displayCount(){return this._get("displayCount")}get objectId(){return(this.objectIdField&&this.graphic?.attributes?.[this.objectIdField])??null}get objectIdField(){return this.layer?.objectIdField||null}get relatedFeatures(){return this._get("relatedFeatures")||new s}get relatedLayer(){const{layer:e,map:t,relationship:r}=this;return e?.loaded&&t&&r?_(t,e,r)??null:null}get relationship(){const{relationshipId:e,layer:t}=this;return"number"==typeof e?t?.relationships?.find((({id:t})=>t===e))??null:null}get relatedFeatureViewModels(){return this._get("relatedFeatureViewModels")||new s}get state(){const{_queryAbortController:e,_queryFeatureCountAbortController:t,_queryPageAbortController:r,canQuery:o}=this;return t?"loading":e||r?"querying":o?"ready":"disabled"}_destroyRelatedFeatureViewModels(){this.relatedFeatureViewModels?.forEach((e=>!e.destroyed&&e.destroy())),this.relatedFeatureViewModels.removeAll()}async _queryFeatureCount(){const{layer:e,relatedLayer:t,relationshipId:r,objectId:o,_queryFeatureCountAbortController:l,canQuery:s,supportsCacheHint:a}=this;if(await(e?.load()),await(t?.load()),!s||!e||!t)return void this._set("featureCount",0);const i=t.createQuery(),n=new c({cacheHint:a,relationshipId:r,returnGeometry:!1,objectIds:[o],where:i.where??void 0}),u=await e.queryRelatedFeaturesCount(n,{signal:l?.signal});this._set("featureCount",u[o]||0)}_sliceFeatures(e){const{showAllEnabled:t,displayCount:r}=this;return t?e:r?e.slice(0,r):[]}async _queryPage(){const{relatedFeatures:e,featurePage:t,showAllEnabled:r,_queryPageAbortController:o}=this;!r||t<2||e.addMany(await this._queryRelatedFeatures({signal:o?.signal}))}async _queryRelatedFeatures(e){const{orderByFieldsFixedCasing:t,showAllEnabled:r,featuresPerPage:l,displayCount:s,layer:a,relationshipId:i,featurePage:n,featureCount:u,relatedLayer:d,supportsCacheHint:h}=this,{canQuery:y,objectId:p}=this;if(!y||!a||!d)return[];const C=r?((n-1)*l+u)%u:0,_=r?l:s,g=d.objectIdField,b=[...t.map((e=>e.field)),g].filter(o),F=t.map((e=>`${e.field} ${e.order}`)),m=d.createQuery(),f=new c({orderByFields:F,start:C,num:_,outFields:b,cacheHint:h,relationshipId:i,returnGeometry:!1,objectIds:[p],where:m.where??void 0}),q=await a.queryRelatedFeatures(f,{signal:e?.signal}),A=q[p]?.features||[];return A.forEach((e=>{e.sourceLayer=d,e.layer=d})),A}};e([y()],b.prototype,"_queryAbortController",void 0),e([y()],b.prototype,"_queryPageAbortController",void 0),e([y()],b.prototype,"_queryFeatureCountAbortController",void 0),e([y({value:1})],b.prototype,"featurePage",null),e([y()],b.prototype,"featuresPerPage",void 0),e([y({readOnly:!0})],b.prototype,"orderByFieldsFixedCasing",null),e([y({readOnly:!0})],b.prototype,"supportsCacheHint",null),e([y({readOnly:!0})],b.prototype,"canQuery",null),e([y()],b.prototype,"description",void 0),e([y({readOnly:!0})],b.prototype,"itemDescriptionFieldName",null),e([y({value:3})],b.prototype,"displayCount",null),e([y({type:t})],b.prototype,"graphic",void 0),e([y()],b.prototype,"layer",void 0),e([y()],b.prototype,"map",void 0),e([y({readOnly:!0})],b.prototype,"objectId",null),e([y({readOnly:!0})],b.prototype,"objectIdField",null),e([y()],b.prototype,"orderByFields",void 0),e([y({readOnly:!0})],b.prototype,"relatedFeatures",null),e([y({readOnly:!0})],b.prototype,"relatedLayer",null),e([y({readOnly:!0})],b.prototype,"relationship",null),e([y()],b.prototype,"featureCount",void 0),e([y({readOnly:!0})],b.prototype,"relatedFeatureViewModels",null),e([y()],b.prototype,"relationshipId",void 0),e([y()],b.prototype,"showAllEnabled",void 0),e([y()],b.prototype,"state",null),e([y()],b.prototype,"title",void 0),b=e([p("esri.widgets.Feature.FeatureRelationship.FeatureRelationshipViewModel")],b);const F=b;export{F as default};
5
+ import{_ as e}from"../../../chunks/tslib.es6.js";import t from"../../../Graphic.js";import r from"../../../core/Accessor.js";import{isSome as o}from"../../../core/arrayUtils.js";import{ClonableMixin as l}from"../../../core/Clonable.js";import s from"../../../core/Collection.js";import{HandleOwnerMixin as a}from"../../../core/HandleOwner.js";import{IdentifiableMixin as i}from"../../../core/Identifiable.js";import{ignoreAbortErrors as n}from"../../../core/promiseUtils.js";import{watch as u,initial as d}from"../../../core/reactiveUtils.js";import{throttle as h}from"../../../core/throttle.js";import{property as y}from"../../../core/accessorSupport/decorators/property.js";import"../../../core/accessorSupport/ensureType.js";import"../../../core/has.js";import{subclass as p}from"../../../core/accessorSupport/decorators/subclass.js";import c from"../../../rest/support/RelationshipQuery.js";import{getFixedFieldName as C,findRelatedLayer as _}from"../support/featureUtils.js";const g=100;let b=class extends(l(i(a(r)))){constructor(e){super(e),this._queryAbortController=null,this._queryPageAbortController=null,this._queryFeatureCountAbortController=null,this.featuresPerPage=10,this.description=null,this.graphic=null,this.layer=null,this.map=null,this.orderByFields=null,this.featureCount=0,this.relationshipId=null,this.showAllEnabled=!1,this.title=null,this._cancelQuery=()=>{const{_queryAbortController:e}=this;e&&e.abort(),this._queryAbortController=null},this._cancelQueryFeatureCount=()=>{const{_queryFeatureCountAbortController:e}=this;e&&e.abort(),this._queryFeatureCountAbortController=null},this._cancelQueryPage=()=>{const{_queryPageAbortController:e}=this;e&&e.abort(),this._queryPageAbortController=null},this._queryController=async()=>{this._cancelQuery();const e=new AbortController;this._queryAbortController=e,await n(this._query()),this._queryAbortController===e&&(this._queryAbortController=null)},this._queryFeatureCountController=async()=>{this._cancelQueryFeatureCount();const e=new AbortController;this._queryFeatureCountAbortController=e,await n(this._queryFeatureCount()),this._queryFeatureCountAbortController===e&&(this._queryFeatureCountAbortController=null)},this._queryPageController=async()=>{const e=new AbortController;this._queryPageAbortController=e,await n(this._queryPage()),this._queryPageAbortController===e&&(this._queryPageAbortController=null)},this._queryThrottled=h(this._queryController,g,this),this._queryFeatureCountThrottled=h(this._queryFeatureCountController,g,this),this._queryPageThrottled=h(this._queryPageController,g,this),this._query=async()=>{const{_queryAbortController:e,relatedFeatures:t}=this;this._destroyRelatedFeatureViewModels(),this.featurePage=1,t.removeAll(),t.addMany(this._sliceFeatures(await this._queryRelatedFeatures({signal:e?.signal})))},this.handles.add([u((()=>[this.displayCount,this.graphic,this.layer,this.map,this.orderByFieldsFixedCasing,this.relationshipId,this.featuresPerPage,this.showAllEnabled,this.canQuery,this.featureCount]),(()=>this._queryThrottled()),d),u((()=>[this.featurePage,this.showAllEnabled]),(()=>this._queryPageThrottled())),u((()=>[this.layer,this.relationshipId,this.objectId,this.canQuery]),(()=>this._queryFeatureCountThrottled()))])}initialize(){this.addHandles(this._queryThrottled)}destroy(){this._destroyRelatedFeatureViewModels(),this.relatedFeatures.removeAll(),this._cancelQuery(),this._cancelQueryFeatureCount(),this._cancelQueryPage()}set featurePage(e){const{featuresPerPage:t,featureCount:r}=this,o=1,l=Math.ceil(r/t)||1;this._set("featurePage",Math.min(Math.max(e,o),l))}get featurePage(){return this._get("featurePage")}get orderByFieldsFixedCasing(){const{orderByFields:e,relatedLayer:t}=this;return e&&t?.loaded?e.map((e=>{const r=e.clone();return r.field=C(e.field,t),r})):e??[]}get supportsCacheHint(){return!!this.layer?.capabilities?.queryRelated?.supportsCacheHint}get canQuery(){const e=this.layer?.capabilities?.queryRelated;return!!(this.relatedLayer&&this.relationship&&"number"==typeof this.relationshipId&&"number"==typeof this.objectId&&e?.supportsCount&&e?.supportsPagination)}get itemDescriptionFieldName(){return this.orderByFieldsFixedCasing[0]?.field||null}set displayCount(e){const t=0,r=10;this._set("displayCount",Math.min(Math.max(e,t),r))}get displayCount(){return this._get("displayCount")}get objectId(){return(this.objectIdField&&this.graphic?.attributes?.[this.objectIdField])??null}get objectIdField(){return this.layer?.objectIdField||null}get relatedFeatures(){return this._get("relatedFeatures")||new s}get relatedLayer(){const{layer:e,map:t,relationship:r}=this;return e?.loaded&&t&&r?_(t,e,r)??null:null}get relationship(){const{relationshipId:e,layer:t}=this;return"number"==typeof e?t?.relationships?.find((({id:t})=>t===e))??null:null}get relatedFeatureViewModels(){return this._get("relatedFeatureViewModels")||new s}get state(){const{_queryAbortController:e,_queryFeatureCountAbortController:t,_queryPageAbortController:r,canQuery:o}=this;return t?"loading":e||r?"querying":o?"ready":"disabled"}_destroyRelatedFeatureViewModels(){this.relatedFeatureViewModels?.forEach((e=>!e.destroyed&&e.destroy())),this.relatedFeatureViewModels.removeAll()}async _queryFeatureCount(){const{layer:e,relatedLayer:t,relationshipId:r,objectId:o,_queryFeatureCountAbortController:l,canQuery:s,supportsCacheHint:a}=this;if(await(e?.load()),await(t?.load()),!s||!e||!t)return void this._set("featureCount",0);const i=t.createQuery(),n=new c({cacheHint:a,relationshipId:r,returnGeometry:!1,objectIds:[o],where:i.where??void 0}),u=await e.queryRelatedFeaturesCount(n,{signal:l?.signal});this._set("featureCount",u[o]||0)}_sliceFeatures(e){const{showAllEnabled:t,displayCount:r}=this;return t?e:r?e.slice(0,r):[]}async _queryPage(){const{relatedFeatures:e,featurePage:t,showAllEnabled:r,_queryPageAbortController:o}=this;!r||t<2||e.addMany(await this._queryRelatedFeatures({signal:o?.signal}))}async _queryRelatedFeatures(e){const{orderByFieldsFixedCasing:t,showAllEnabled:r,featuresPerPage:l,displayCount:s,layer:a,relationshipId:i,featurePage:n,featureCount:u,relatedLayer:d,supportsCacheHint:h}=this,{canQuery:y,objectId:p}=this;if(!y||!a||!d)return[];const C=r?((n-1)*l+u)%u:0,_=r?l:s,g=d.objectIdField,b=[...t.map((e=>e.field)),g].filter(o),F=t.map((e=>`${e.field} ${e.order}`)),m=d.createQuery(),f=new c({orderByFields:F,start:C,num:_,outFields:b,cacheHint:h,relationshipId:i,returnGeometry:!1,objectIds:[p],where:m.where??void 0}),q=await a.queryRelatedFeatures(f,{signal:e?.signal}),A=q[p]?.features||[];return A.forEach((e=>{e.sourceLayer=d,e.layer=d})),A}};e([y()],b.prototype,"_queryAbortController",void 0),e([y()],b.prototype,"_queryPageAbortController",void 0),e([y()],b.prototype,"_queryFeatureCountAbortController",void 0),e([y({value:1})],b.prototype,"featurePage",null),e([y()],b.prototype,"featuresPerPage",void 0),e([y({readOnly:!0})],b.prototype,"orderByFieldsFixedCasing",null),e([y({readOnly:!0})],b.prototype,"supportsCacheHint",null),e([y({readOnly:!0})],b.prototype,"canQuery",null),e([y()],b.prototype,"description",void 0),e([y({readOnly:!0})],b.prototype,"itemDescriptionFieldName",null),e([y({value:3})],b.prototype,"displayCount",null),e([y({type:t})],b.prototype,"graphic",void 0),e([y()],b.prototype,"layer",void 0),e([y()],b.prototype,"map",void 0),e([y({readOnly:!0})],b.prototype,"objectId",null),e([y({readOnly:!0})],b.prototype,"objectIdField",null),e([y()],b.prototype,"orderByFields",void 0),e([y({readOnly:!0})],b.prototype,"relatedFeatures",null),e([y({readOnly:!0})],b.prototype,"relatedLayer",null),e([y({readOnly:!0})],b.prototype,"relationship",null),e([y()],b.prototype,"featureCount",void 0),e([y({readOnly:!0})],b.prototype,"relatedFeatureViewModels",null),e([y()],b.prototype,"relationshipId",void 0),e([y()],b.prototype,"showAllEnabled",void 0),e([y()],b.prototype,"state",null),e([y()],b.prototype,"title",void 0),b=e([p("esri.widgets.Feature.FeatureRelationship.FeatureRelationshipViewModel")],b);const F=b;export{F as default};
@@ -2,4 +2,4 @@
2
2
  All material copyright ESRI, All Rights Reserved, unless otherwise specified.
3
3
  See https://js.arcgis.com/4.27/esri/copyright.txt for details.
4
4
  */
5
- import{_ as e}from"../../chunks/tslib.es6.js";import t from"../../Graphic.js";import{FeatureSetQueryInterceptor as r}from"../../arcade/featureset/support/FeatureSetQueryInterceptor.js";import i from"../../core/Accessor.js";import{isSome as s}from"../../core/arrayUtils.js";import o from"../../core/Handles.js";import{IdentifiableMixin as n}from"../../core/Identifiable.js";import a from"../../core/Logger.js";import{isAbortError as l,eachAlways as p}from"../../core/promiseUtils.js";import{watch as c,on as d,initial as u}from"../../core/reactiveUtils.js";import{throttle as h}from"../../core/throttle.js";import{property as f}from"../../core/accessorSupport/decorators/property.js";import{cast as m}from"../../core/accessorSupport/decorators/cast.js";import"../../core/has.js";import{subclass as _}from"../../core/accessorSupport/decorators/subclass.js";import y from"../../popup/content/TextContent.js";import b from"./FeatureAttachments/FeatureAttachmentsViewModel.js";import g from"./FeatureContent/FeatureContentViewModel.js";import I from"./FeatureExpression/FeatureExpressionViewModel.js";import A from"./FeatureFields/FeatureFieldsViewModel.js";import M from"./FeatureMedia/FeatureMediaViewModel.js";import w from"./FeatureRelationship/FeatureRelationshipViewModel.js";import{createCompiledExpressions as x}from"./support/arcadeFeatureUtils.js";import{createfieldInfoMap as F,getAllFieldInfos as v,getSourceLayer as C,querySourceLayer as E,isRelatableFeatureSupportedLayer as T,substituteFieldsInLinksAndAttributes as V,isExpressionField as j,isRelatedField as P,formatEditInfo as R,graphicCallback as L,queryUpdatedFeature as O,formatAttributes as S,preLayerQueryCallback as k,preRequestCallback as U}from"./support/featureUtils.js";import{queryLayerInfos as D,queryRelatedFeatures as N,setRelatedFeatures as q,getRelatedFieldInfo as B,createRelatedInfo as Q,updateRelatedInfo as G}from"./support/relatedFeatureUtils.js";var H;const z=1,J="content-view-models",K="relationship-view-models",W={attachmentsContent:!0,chartAnimation:!0,customContent:!0,expressionContent:!0,fieldsContent:!0,mediaContent:!0,textContent:!0,relationshipContent:!0};let X=H=class extends(n(i)){constructor(e){super(e),this._handles=new o,this._error=null,this._featureAbortController=null,this._graphicChangedThrottled=h(this._graphicChanged,z,this),this._expressionAttributes=null,this._graphicExpressionAttributes=null,this.abilities={...W},this.content=null,this.contentViewModels=[],this.description=null,this.defaultPopupTemplateEnabled=!1,this.formattedAttributes=null,this.lastEditInfo=null,this.relatedInfos=new Map,this.title="",this.view=null,this._isAllowedContentType=e=>{const{abilities:t}=this;return"attachments"===e.type&&!!t.attachmentsContent||"custom"===e.type&&!!t.customContent||"fields"===e.type&&!!t.fieldsContent||"media"===e.type&&!!t.mediaContent||"text"===e.type&&!!t.textContent||"expression"===e.type&&!!t.expressionContent||"relationship"===e.type&&!!t.relationshipContent},this._handles.add(c((()=>[this.graphic,this._effectivePopupTemplate,this.abilities]),(()=>this._graphicChangedThrottled()),u))}destroy(){this._clear(),this._cancelFeatureQuery(),this._error=null,this._handles.destroy(),this.graphic=null,this._destroyContentViewModels(),this.relatedInfos.clear()}get _effectivePopupTemplate(){return null!=this.graphic?this.graphic.getEffectivePopupTemplate(this.defaultPopupTemplateEnabled):null}get _fieldInfoMap(){return F(v(this._effectivePopupTemplate),this._sourceLayer)}get _sourceLayer(){return C(this.graphic)}castAbilities(e){return{...W,...e}}get isTable(){return this._sourceLayer?.isTable||!1}get state(){return this.graphic?this._error?"error":this.waitingForContent?"loading":"ready":"disabled"}set graphic(e){this._set("graphic",e?e.clone():null)}get spatialReference(){return this.view?.spatialReference??null}set spatialReference(e){this._override("spatialReference",e)}get map(){return this.view?.map||null}set map(e){this._override("map",e)}get waitingForContent(){return!!this._featureAbortController}setActiveMedia(e,t){const r=this.contentViewModels[e];r instanceof M&&r.setActiveMedia(t)}nextMedia(e){const t=this.contentViewModels[e];t instanceof M&&t.next()}previousMedia(e){const t=this.contentViewModels[e];t instanceof M&&t.previous()}async updateGeometry(){const{graphic:e,spatialReference:t,_sourceLayer:r}=this;await(r?.load());const i=r?.objectIdField;if(!i||!e||!r)return;const s=e?.attributes?.[i];if(null==s)return;const o=[s];if(!e.geometry){const i=await E({layer:r,graphic:e,outFields:[],objectIds:o,returnGeometry:!0,spatialReference:t}),s=i?.geometry;s&&(e.geometry=s)}}_clear(){this._set("title",""),this._set("content",null),this._set("formattedAttributes",null)}async _graphicChanged(){this._cancelFeatureQuery(),this._error=null,this._clear();const{graphic:e}=this;if(!e)return;const t=new AbortController;this._featureAbortController=t;try{await this._queryFeature({signal:t.signal})}catch(r){l(r)||(this._error=r,a.getLogger(this.declaredClass).error("error","The popupTemplate could not be displayed for this feature.",{error:r,graphic:e,popupTemplate:this._effectivePopupTemplate}))}this._featureAbortController===t&&(this._featureAbortController=null)}_cancelFeatureQuery(){const{_featureAbortController:e}=this;e&&e.abort(),this._featureAbortController=null}_compileContentElement(e,t){return"attachments"===e.type?this._compileAttachments(e,t):"custom"===e.type?this._compileCustom(e,t):"fields"===e.type?this._compileFields(e,t):"media"===e.type?this._compileMedia(e,t):"text"===e.type?this._compileText(e,t):"expression"===e.type?this._compileExpression(e,t):"relationship"===e.type?this._compileRelationship(e,t):void 0}_compileContent(e){if(this._destroyContentViewModels(),this.graphic)return Array.isArray(e)?e.filter(this._isAllowedContentType).map(((e,t)=>this._compileContentElement(e,t))).filter(s):"string"==typeof e?this._compileText(new y({text:e}),0).text:e}_destroyContentViewModels(){this._handles?.remove(K),this._handles?.remove(J),this.contentViewModels.forEach((e=>e&&!e.destroyed&&e.destroy())),this._set("contentViewModels",[])}_matchesFeature(e,t){const r=e?.graphic?.getObjectId(),i=t?.getObjectId();return null!=r&&null!=i&&r===i}_setRelatedFeaturesViewModels({relatedFeatureViewModels:e,relatedFeatures:t,map:r}){const{view:i,spatialReference:s}=this;t?.filter(Boolean).forEach((t=>{e.find((e=>this._matchesFeature(e,t)))||e.add(new H({abilities:{relationshipContent:!1},map:r,view:i,spatialReference:s,graphic:t}))})),e.forEach((r=>{const i=t?.find((e=>this._matchesFeature(r,e)));i||e.remove(r)}))}_setExpressionContentVM(e,t){const r=this.formattedAttributes,{contentElement:i,contentElementViewModel:s}=e,o=i?.type;s&&o&&("fields"===o&&(this._createFieldsFormattedAttributes({contentElement:i,contentElementIndex:t,formattedAttributes:r}),s.set(this._createFieldsVMParams(i,t))),"media"===o&&(this._createMediaFormattedAttributes({contentElement:i,contentElementIndex:t,formattedAttributes:r}),s.set(this._createMediaVMParams(i,t))),"text"===o&&s.set(this._createTextVMParams(i)))}_compileRelationship(e,t){const{displayCount:r,orderByFields:i,relationshipId:s,title:o,description:n}=e,{_sourceLayer:a,graphic:l,map:p}=this;if(!T(a))return;const c=new w({displayCount:r,graphic:l,orderByFields:i,relationshipId:s,layer:a,map:p,...this._compileTitleAndDesc({title:o,description:n})});return this.contentViewModels[t]=c,this._handles.add(d((()=>c.relatedFeatures),"change",(()=>this._setRelatedFeaturesViewModels(c))),K),e}_compileExpression(e,t){const{expressionInfo:r}=e,{graphic:i,map:s,spatialReference:o,view:n}=this,a=new I({expressionInfo:r,graphic:i,interceptor:H.interceptor,map:s,spatialReference:o,view:n});return this.contentViewModels[t]=a,this._handles.add(c((()=>a.contentElementViewModel),(()=>this._setExpressionContentVM(a,t)),u),J),e}_compileAttachments(e,t){const{graphic:r}=this,{description:i,title:s}=e;return this.contentViewModels[t]=new b({graphic:r,...this._compileTitleAndDesc({title:s,description:i})}),e}_compileCustom(e,t){const{graphic:r}=this,{creator:i,destroyer:s}=e;return this.contentViewModels[t]=new g({graphic:r,creator:i,destroyer:s}),e}_compileTitleAndDesc({title:e,description:t}){const{_fieldInfoMap:r,_sourceLayer:i,graphic:s,formattedAttributes:o}=this,n=s?.attributes,a=this._expressionAttributes,l=o.global;return{title:V({attributes:n,fieldInfoMap:r,globalAttributes:l,expressionAttributes:a,layer:i,text:e}),description:V({attributes:n,fieldInfoMap:r,globalAttributes:l,expressionAttributes:a,layer:i,text:t})}}_createFieldsVMParams(e,t){const r=this._effectivePopupTemplate,i=this.formattedAttributes,s={...i?.global,...i?.content[t]},o=e?.fieldInfos||r?.fieldInfos,n=o?.filter((({fieldName:e})=>j(e)||P(e)||s.hasOwnProperty(e))),a=r?.expressionInfos,{description:l,title:p}=e;return{attributes:s,expressionInfos:a,fieldInfos:n,...this._compileTitleAndDesc({title:p,description:l})}}_compileFields(e,t){const r=e.clone(),i=new A(this._createFieldsVMParams(e,t));return this.contentViewModels[t]=i,r.fieldInfos=i.formattedFieldInfos.slice(0),r}_createMediaVMParams(e,t){const{abilities:r,graphic:i,_fieldInfoMap:s,_effectivePopupTemplate:o,relatedInfos:n,_sourceLayer:a,_expressionAttributes:l}=this,p=this.formattedAttributes,c=i?.attributes??{},{description:d,mediaInfos:u,title:h}=e;return{abilities:{chartAnimation:r.chartAnimation},activeMediaInfoIndex:e.activeMediaInfoIndex||0,attributes:c,isAggregate:i?.isAggregate,layer:a,fieldInfoMap:s,formattedAttributes:{...p?.global,...p?.content[t]},expressionAttributes:l,mediaInfos:u,popupTemplate:o,relatedInfos:n,...this._compileTitleAndDesc({title:h,description:d})}}_compileMedia(e,t){const r=e.clone(),i=new M(this._createMediaVMParams(e,t));return r.mediaInfos=i.formattedMediaInfos.slice(0),this.contentViewModels[t]=i,r}_createTextVMParams(e){const{graphic:t,_fieldInfoMap:r,_sourceLayer:i,_expressionAttributes:s}=this;if(e&&e.text){const o=t?.attributes??{},n=this.formattedAttributes?.global??{};e.text=V({attributes:o,fieldInfoMap:r,globalAttributes:n,expressionAttributes:s,layer:i,text:e.text})}return{graphic:t,creator:e.text}}_compileText(e,t){const r=e.clone();return this.contentViewModels[t]=new g(this._createTextVMParams(r)),r}_compileLastEditInfo(){const{_effectivePopupTemplate:e,_sourceLayer:t,graphic:r}=this;if(!e)return;const{lastEditInfoEnabled:i}=e,s=t?.editFieldsInfo;return i&&s?R(s,r?.attributes):void 0}_compileTitle(e){const{_fieldInfoMap:t,_sourceLayer:r,graphic:i,_expressionAttributes:s}=this,o=i?.attributes??{},n=this.formattedAttributes?.global??{};return V({attributes:o,fieldInfoMap:t,globalAttributes:n,expressionAttributes:s,layer:r,text:e})}async _getTitle(){const{_effectivePopupTemplate:e,graphic:t}=this;if(!t)return null;const r=e?.title;return L(r,{graphic:t})}async _getContent(){const{_effectivePopupTemplate:e,graphic:t}=this;if(!t)return null;const r=e?.content;return L(r,{graphic:t})}async _queryFeature(e){const{_featureAbortController:t,_sourceLayer:r,graphic:i,_effectivePopupTemplate:s}=this,o=this.map,n=this.view,a=this.spatialReference;if(t!==this._featureAbortController||!i)return;await O({graphic:i,popupTemplate:s,layer:r,spatialReference:a},e);const{content:{value:l},title:{value:c}}=await p({content:this._getContent(),title:this._getTitle()}),{expressionAttributes:{value:d}}=await p({checkForRelatedFeatures:this._checkForRelatedFeatures(e),expressionAttributes:x({expressionInfos:s?.expressionInfos,spatialReference:a,graphic:i,map:o,interceptor:H.interceptor,view:n})});t===this._featureAbortController&&i&&(this._expressionAttributes=d,this._graphicExpressionAttributes={...i.attributes,...d},this._set("formattedAttributes",this._createFormattedAttributes(l)),this._set("title",this._compileTitle(c)),this._set("lastEditInfo",this._compileLastEditInfo()||null),this._set("content",this._compileContent(l)||null))}_createMediaFormattedAttributes({contentElement:e,contentElementIndex:t,formattedAttributes:r}){const{_effectivePopupTemplate:i,graphic:s,relatedInfos:o,_sourceLayer:n,_fieldInfoMap:a,_graphicExpressionAttributes:l}=this;r.content[t]=S({fieldInfos:i?.fieldInfos,graphic:s,attributes:{...l,...e.attributes},layer:n,fieldInfoMap:a,relatedInfos:o})}_createFieldsFormattedAttributes({contentElement:e,contentElementIndex:t,formattedAttributes:r}){if(e.fieldInfos){const{graphic:i,relatedInfos:s,_sourceLayer:o,_fieldInfoMap:n,_graphicExpressionAttributes:a}=this;r.content[t]=S({fieldInfos:e.fieldInfos,graphic:i,attributes:{...a,...e.attributes},layer:o,fieldInfoMap:n,relatedInfos:s})}}_createFormattedAttributes(e){const{_effectivePopupTemplate:t,graphic:r,relatedInfos:i,_sourceLayer:s,_fieldInfoMap:o,_graphicExpressionAttributes:n}=this,a=t?.fieldInfos,l={global:S({fieldInfos:a,graphic:r,attributes:n,layer:s,fieldInfoMap:o,relatedInfos:i}),content:[]};return Array.isArray(e)&&e.forEach(((e,t)=>{"fields"===e.type&&this._createFieldsFormattedAttributes({contentElement:e,contentElementIndex:t,formattedAttributes:l}),"media"===e.type&&this._createMediaFormattedAttributes({contentElement:e,contentElementIndex:t,formattedAttributes:l})})),l}_checkForRelatedFeatures(e){const{graphic:t,_effectivePopupTemplate:r}=this;return this._queryRelatedInfos(t,v(r),e)}async _queryRelatedInfos(e,t,r){const{relatedInfos:i,_sourceLayer:s}=this;i.clear();const o=null!=s?.associatedLayer?await(s?.associatedLayer.load(r)):s;if(!o||!e)return;const n=t.filter((e=>e&&P(e.fieldName)));if(!n||!n.length)return;t.forEach((e=>this._configureRelatedInfo(e,o)));const a=await D({relatedInfos:i,layer:o},r);Object.keys(a).forEach((e=>{const t=i.get(e.toString()),r=a[e]?.value;t&&r&&(t.layerInfo=r.data)}));const l=await N({graphic:e,relatedInfos:i,layer:o},r);Object.keys(l).forEach((e=>{q(l[e]?.value,i.get(e.toString()))}))}_configureRelatedInfo(e,t){const{relatedInfos:r}=this,i=B(e.fieldName);if(!i)return;const{layerId:s,fieldName:o}=i;if(!s)return;const n=r.get(s.toString())||Q(s,t);n&&(G({relatedInfo:n,fieldName:o,fieldInfo:e}),this.relatedInfos.set(s,n))}};X.interceptor=new r(k,U),e([f()],X.prototype,"_error",void 0),e([f()],X.prototype,"_featureAbortController",void 0),e([f({readOnly:!0})],X.prototype,"_effectivePopupTemplate",null),e([f({readOnly:!0})],X.prototype,"_fieldInfoMap",null),e([f({readOnly:!0})],X.prototype,"_sourceLayer",null),e([f()],X.prototype,"abilities",void 0),e([m("abilities")],X.prototype,"castAbilities",null),e([f({readOnly:!0})],X.prototype,"content",void 0),e([f({readOnly:!0})],X.prototype,"contentViewModels",void 0),e([f()],X.prototype,"description",void 0),e([f({type:Boolean})],X.prototype,"defaultPopupTemplateEnabled",void 0),e([f({readOnly:!0})],X.prototype,"isTable",null),e([f({readOnly:!0})],X.prototype,"state",null),e([f({readOnly:!0})],X.prototype,"formattedAttributes",void 0),e([f({type:t,value:null})],X.prototype,"graphic",null),e([f({readOnly:!0})],X.prototype,"lastEditInfo",void 0),e([f({readOnly:!0})],X.prototype,"relatedInfos",void 0),e([f()],X.prototype,"spatialReference",null),e([f({readOnly:!0})],X.prototype,"title",void 0),e([f()],X.prototype,"map",null),e([f({readOnly:!0})],X.prototype,"waitingForContent",null),e([f()],X.prototype,"view",void 0),X=H=e([_("esri.widgets.FeatureViewModel")],X);const Y=X;export{Y as default};
5
+ import{_ as e}from"../../chunks/tslib.es6.js";import t from"../../Graphic.js";import{FeatureSetQueryInterceptor as i}from"../../arcade/featureset/support/FeatureSetQueryInterceptor.js";import r from"../../core/Accessor.js";import{isSome as s}from"../../core/arrayUtils.js";import o from"../../core/Handles.js";import{IdentifiableMixin as n}from"../../core/Identifiable.js";import a from"../../core/Logger.js";import{isAbortError as l,eachAlways as p}from"../../core/promiseUtils.js";import{watch as c,on as d,initial as u}from"../../core/reactiveUtils.js";import{throttle as h}from"../../core/throttle.js";import{property as f}from"../../core/accessorSupport/decorators/property.js";import{cast as m}from"../../core/accessorSupport/decorators/cast.js";import"../../core/has.js";import{subclass as _}from"../../core/accessorSupport/decorators/subclass.js";import y from"../../popup/content/TextContent.js";import g from"./FeatureAttachments/FeatureAttachmentsViewModel.js";import b from"./FeatureContent/FeatureContentViewModel.js";import I from"./FeatureExpression/FeatureExpressionViewModel.js";import A from"./FeatureFields/FeatureFieldsViewModel.js";import M from"./FeatureMedia/FeatureMediaViewModel.js";import w from"./FeatureRelationship/FeatureRelationshipViewModel.js";import{createCompiledExpressions as x}from"./support/arcadeFeatureUtils.js";import{createfieldInfoMap as F,getAllFieldInfos as v,getSourceLayer as C,querySourceLayer as T,isRelatableFeatureSupportedLayer as E,substituteFieldsInLinksAndAttributes as V,isExpressionField as j,isRelatedField as P,formatEditInfo as R,graphicCallback as L,queryUpdatedFeature as O,formatAttributes as S,preLayerQueryCallback as k,preRequestCallback as U}from"./support/featureUtils.js";import{queryLayerInfos as D,queryRelatedFeatures as N,setRelatedFeatures as q,getRelatedFieldInfo as B,createRelatedInfo as Q,updateRelatedInfo as G}from"./support/relatedFeatureUtils.js";var H;const z=1,J="content-view-models",K="relationship-view-models",W={attachmentsContent:!0,chartAnimation:!0,customContent:!0,expressionContent:!0,fieldsContent:!0,mediaContent:!0,textContent:!0,relationshipContent:!0};let X=H=class extends(n(r)){constructor(e){super(e),this._handles=new o,this._error=null,this._featureAbortController=null,this._graphicChangedThrottled=h(this._graphicChanged,z,this),this._expressionAttributes=null,this._graphicExpressionAttributes=null,this.abilities={...W},this.content=null,this.contentViewModels=[],this.description=null,this.defaultPopupTemplateEnabled=!1,this.formattedAttributes=null,this.lastEditInfo=null,this.relatedInfos=new Map,this.title="",this.view=null,this._isAllowedContentType=e=>{const{abilities:t}=this;return"attachments"===e.type&&!!t.attachmentsContent||"custom"===e.type&&!!t.customContent||"fields"===e.type&&!!t.fieldsContent||"media"===e.type&&!!t.mediaContent||"text"===e.type&&!!t.textContent||"expression"===e.type&&!!t.expressionContent||"relationship"===e.type&&!!t.relationshipContent},this._handles.add(c((()=>[this.graphic,this._effectivePopupTemplate,this.abilities]),(()=>this._graphicChangedThrottled()),u))}initialize(){this.addHandles(this._graphicChangedThrottled)}destroy(){this._clear(),this._cancelFeatureQuery(),this._error=null,this._handles.destroy(),this.graphic=null,this._destroyContentViewModels(),this.relatedInfos.clear()}get _effectivePopupTemplate(){return null!=this.graphic?this.graphic.getEffectivePopupTemplate(this.defaultPopupTemplateEnabled):null}get _fieldInfoMap(){return F(v(this._effectivePopupTemplate),this._sourceLayer)}get _sourceLayer(){return C(this.graphic)}castAbilities(e){return{...W,...e}}get isTable(){return this._sourceLayer?.isTable||!1}get state(){return this.graphic?this._error?"error":this.waitingForContent?"loading":"ready":"disabled"}set graphic(e){this._set("graphic",e?e.clone():null)}get spatialReference(){return this.view?.spatialReference??null}set spatialReference(e){this._override("spatialReference",e)}get map(){return this.view?.map||null}set map(e){this._override("map",e)}get waitingForContent(){return!!this._featureAbortController}setActiveMedia(e,t){const i=this.contentViewModels[e];i instanceof M&&i.setActiveMedia(t)}nextMedia(e){const t=this.contentViewModels[e];t instanceof M&&t.next()}previousMedia(e){const t=this.contentViewModels[e];t instanceof M&&t.previous()}async updateGeometry(){const{graphic:e,spatialReference:t,_sourceLayer:i}=this;await(i?.load());const r=i?.objectIdField;if(!r||!e||!i)return;const s=e?.attributes?.[r];if(null==s)return;const o=[s];if(!e.geometry){const r=await T({layer:i,graphic:e,outFields:[],objectIds:o,returnGeometry:!0,spatialReference:t}),s=r?.geometry;s&&(e.geometry=s)}}_clear(){this._set("title",""),this._set("content",null),this._set("formattedAttributes",null)}async _graphicChanged(){this._cancelFeatureQuery(),this._error=null,this._clear();const{graphic:e}=this;if(!e)return;const t=new AbortController;this._featureAbortController=t;try{await this._queryFeature({signal:t.signal})}catch(i){l(i)||(this._error=i,a.getLogger(this.declaredClass).error("error","The popupTemplate could not be displayed for this feature.",{error:i,graphic:e,popupTemplate:this._effectivePopupTemplate}))}this._featureAbortController===t&&(this._featureAbortController=null)}_cancelFeatureQuery(){const{_featureAbortController:e}=this;e&&e.abort(),this._featureAbortController=null}_compileContentElement(e,t){return"attachments"===e.type?this._compileAttachments(e,t):"custom"===e.type?this._compileCustom(e,t):"fields"===e.type?this._compileFields(e,t):"media"===e.type?this._compileMedia(e,t):"text"===e.type?this._compileText(e,t):"expression"===e.type?this._compileExpression(e,t):"relationship"===e.type?this._compileRelationship(e,t):void 0}_compileContent(e){if(this._destroyContentViewModels(),this.graphic)return Array.isArray(e)?e.filter(this._isAllowedContentType).map(((e,t)=>this._compileContentElement(e,t))).filter(s):"string"==typeof e?this._compileText(new y({text:e}),0).text:e}_destroyContentViewModels(){this._handles?.remove(K),this._handles?.remove(J),this.contentViewModels.forEach((e=>e&&!e.destroyed&&e.destroy())),this._set("contentViewModels",[])}_matchesFeature(e,t){const i=e?.graphic?.getObjectId(),r=t?.getObjectId();return null!=i&&null!=r&&i===r}_setRelatedFeaturesViewModels({relatedFeatureViewModels:e,relatedFeatures:t,map:i}){const{view:r,spatialReference:s}=this;t?.filter(Boolean).forEach((t=>{e.find((e=>this._matchesFeature(e,t)))||e.add(new H({abilities:{relationshipContent:!1},map:i,view:r,spatialReference:s,graphic:t}))})),e.forEach((i=>{const r=t?.find((e=>this._matchesFeature(i,e)));r||e.remove(i)}))}_setExpressionContentVM(e,t){const i=this.formattedAttributes,{contentElement:r,contentElementViewModel:s}=e,o=r?.type;s&&o&&("fields"===o&&(this._createFieldsFormattedAttributes({contentElement:r,contentElementIndex:t,formattedAttributes:i}),s.set(this._createFieldsVMParams(r,t))),"media"===o&&(this._createMediaFormattedAttributes({contentElement:r,contentElementIndex:t,formattedAttributes:i}),s.set(this._createMediaVMParams(r,t))),"text"===o&&s.set(this._createTextVMParams(r)))}_compileRelationship(e,t){const{displayCount:i,orderByFields:r,relationshipId:s,title:o,description:n}=e,{_sourceLayer:a,graphic:l,map:p}=this;if(!E(a))return;const c=new w({displayCount:i,graphic:l,orderByFields:r,relationshipId:s,layer:a,map:p,...this._compileTitleAndDesc({title:o,description:n})});return this.contentViewModels[t]=c,this._handles.add(d((()=>c.relatedFeatures),"change",(()=>this._setRelatedFeaturesViewModels(c))),K),e}_compileExpression(e,t){const{expressionInfo:i}=e,{graphic:r,map:s,spatialReference:o,view:n}=this,a=new I({expressionInfo:i,graphic:r,interceptor:H.interceptor,map:s,spatialReference:o,view:n});return this.contentViewModels[t]=a,this._handles.add(c((()=>a.contentElementViewModel),(()=>this._setExpressionContentVM(a,t)),u),J),e}_compileAttachments(e,t){const{graphic:i}=this,{description:r,title:s}=e;return this.contentViewModels[t]=new g({graphic:i,...this._compileTitleAndDesc({title:s,description:r})}),e}_compileCustom(e,t){const{graphic:i}=this,{creator:r,destroyer:s}=e;return this.contentViewModels[t]=new b({graphic:i,creator:r,destroyer:s}),e}_compileTitleAndDesc({title:e,description:t}){const{_fieldInfoMap:i,_sourceLayer:r,graphic:s,formattedAttributes:o}=this,n=s?.attributes,a=this._expressionAttributes,l=o.global;return{title:V({attributes:n,fieldInfoMap:i,globalAttributes:l,expressionAttributes:a,layer:r,text:e}),description:V({attributes:n,fieldInfoMap:i,globalAttributes:l,expressionAttributes:a,layer:r,text:t})}}_createFieldsVMParams(e,t){const i=this._effectivePopupTemplate,r=this.formattedAttributes,s={...r?.global,...r?.content[t]},o=e?.fieldInfos||i?.fieldInfos,n=o?.filter((({fieldName:e})=>j(e)||P(e)||s.hasOwnProperty(e))),a=i?.expressionInfos,{description:l,title:p}=e;return{attributes:s,expressionInfos:a,fieldInfos:n,...this._compileTitleAndDesc({title:p,description:l})}}_compileFields(e,t){const i=e.clone(),r=new A(this._createFieldsVMParams(e,t));return this.contentViewModels[t]=r,i.fieldInfos=r.formattedFieldInfos.slice(0),i}_createMediaVMParams(e,t){const{abilities:i,graphic:r,_fieldInfoMap:s,_effectivePopupTemplate:o,relatedInfos:n,_sourceLayer:a,_expressionAttributes:l}=this,p=this.formattedAttributes,c=r?.attributes??{},{description:d,mediaInfos:u,title:h}=e;return{abilities:{chartAnimation:i.chartAnimation},activeMediaInfoIndex:e.activeMediaInfoIndex||0,attributes:c,isAggregate:r?.isAggregate,layer:a,fieldInfoMap:s,formattedAttributes:{...p?.global,...p?.content[t]},expressionAttributes:l,mediaInfos:u,popupTemplate:o,relatedInfos:n,...this._compileTitleAndDesc({title:h,description:d})}}_compileMedia(e,t){const i=e.clone(),r=new M(this._createMediaVMParams(e,t));return i.mediaInfos=r.formattedMediaInfos.slice(0),this.contentViewModels[t]=r,i}_createTextVMParams(e){const{graphic:t,_fieldInfoMap:i,_sourceLayer:r,_expressionAttributes:s}=this;if(e&&e.text){const o=t?.attributes??{},n=this.formattedAttributes?.global??{};e.text=V({attributes:o,fieldInfoMap:i,globalAttributes:n,expressionAttributes:s,layer:r,text:e.text})}return{graphic:t,creator:e.text}}_compileText(e,t){const i=e.clone();return this.contentViewModels[t]=new b(this._createTextVMParams(i)),i}_compileLastEditInfo(){const{_effectivePopupTemplate:e,_sourceLayer:t,graphic:i}=this;if(!e)return;const{lastEditInfoEnabled:r}=e,s=t?.editFieldsInfo;return r&&s?R(s,i?.attributes):void 0}_compileTitle(e){const{_fieldInfoMap:t,_sourceLayer:i,graphic:r,_expressionAttributes:s}=this,o=r?.attributes??{},n=this.formattedAttributes?.global??{};return V({attributes:o,fieldInfoMap:t,globalAttributes:n,expressionAttributes:s,layer:i,text:e})}async _getTitle(){const{_effectivePopupTemplate:e,graphic:t}=this;if(!t)return null;const i=e?.title;return L(i,{graphic:t})}async _getContent(){const{_effectivePopupTemplate:e,graphic:t}=this;if(!t)return null;const i=e?.content;return L(i,{graphic:t})}async _queryFeature(e){const{_featureAbortController:t,_sourceLayer:i,graphic:r,_effectivePopupTemplate:s}=this,o=this.map,n=this.view,a=this.spatialReference;if(t!==this._featureAbortController||!r)return;await O({graphic:r,popupTemplate:s,layer:i,spatialReference:a},e);const{content:{value:l},title:{value:c}}=await p({content:this._getContent(),title:this._getTitle()}),{expressionAttributes:{value:d}}=await p({checkForRelatedFeatures:this._checkForRelatedFeatures(e),expressionAttributes:x({expressionInfos:s?.expressionInfos,spatialReference:a,graphic:r,map:o,interceptor:H.interceptor,view:n})});t===this._featureAbortController&&r&&(this._expressionAttributes=d,this._graphicExpressionAttributes={...r.attributes,...d},this._set("formattedAttributes",this._createFormattedAttributes(l)),this._set("title",this._compileTitle(c)),this._set("lastEditInfo",this._compileLastEditInfo()||null),this._set("content",this._compileContent(l)||null))}_createMediaFormattedAttributes({contentElement:e,contentElementIndex:t,formattedAttributes:i}){const{_effectivePopupTemplate:r,graphic:s,relatedInfos:o,_sourceLayer:n,_fieldInfoMap:a,_graphicExpressionAttributes:l}=this;i.content[t]=S({fieldInfos:r?.fieldInfos,graphic:s,attributes:{...l,...e.attributes},layer:n,fieldInfoMap:a,relatedInfos:o})}_createFieldsFormattedAttributes({contentElement:e,contentElementIndex:t,formattedAttributes:i}){if(e.fieldInfos){const{graphic:r,relatedInfos:s,_sourceLayer:o,_fieldInfoMap:n,_graphicExpressionAttributes:a}=this;i.content[t]=S({fieldInfos:e.fieldInfos,graphic:r,attributes:{...a,...e.attributes},layer:o,fieldInfoMap:n,relatedInfos:s})}}_createFormattedAttributes(e){const{_effectivePopupTemplate:t,graphic:i,relatedInfos:r,_sourceLayer:s,_fieldInfoMap:o,_graphicExpressionAttributes:n}=this,a=t?.fieldInfos,l={global:S({fieldInfos:a,graphic:i,attributes:n,layer:s,fieldInfoMap:o,relatedInfos:r}),content:[]};return Array.isArray(e)&&e.forEach(((e,t)=>{"fields"===e.type&&this._createFieldsFormattedAttributes({contentElement:e,contentElementIndex:t,formattedAttributes:l}),"media"===e.type&&this._createMediaFormattedAttributes({contentElement:e,contentElementIndex:t,formattedAttributes:l})})),l}_checkForRelatedFeatures(e){const{graphic:t,_effectivePopupTemplate:i}=this;return this._queryRelatedInfos(t,v(i),e)}async _queryRelatedInfos(e,t,i){const{relatedInfos:r,_sourceLayer:s}=this;r.clear();const o=null!=s?.associatedLayer?await(s?.associatedLayer.load(i)):s;if(!o||!e)return;const n=t.filter((e=>e&&P(e.fieldName)));if(!n||!n.length)return;t.forEach((e=>this._configureRelatedInfo(e,o)));const a=await D({relatedInfos:r,layer:o},i);Object.keys(a).forEach((e=>{const t=r.get(e.toString()),i=a[e]?.value;t&&i&&(t.layerInfo=i.data)}));const l=await N({graphic:e,relatedInfos:r,layer:o},i);Object.keys(l).forEach((e=>{q(l[e]?.value,r.get(e.toString()))}))}_configureRelatedInfo(e,t){const{relatedInfos:i}=this,r=B(e.fieldName);if(!r)return;const{layerId:s,fieldName:o}=r;if(!s)return;const n=i.get(s.toString())||Q(s,t);n&&(G({relatedInfo:n,fieldName:o,fieldInfo:e}),this.relatedInfos.set(s,n))}};X.interceptor=new i(k,U),e([f()],X.prototype,"_error",void 0),e([f()],X.prototype,"_featureAbortController",void 0),e([f({readOnly:!0})],X.prototype,"_effectivePopupTemplate",null),e([f({readOnly:!0})],X.prototype,"_fieldInfoMap",null),e([f({readOnly:!0})],X.prototype,"_sourceLayer",null),e([f()],X.prototype,"abilities",void 0),e([m("abilities")],X.prototype,"castAbilities",null),e([f({readOnly:!0})],X.prototype,"content",void 0),e([f({readOnly:!0})],X.prototype,"contentViewModels",void 0),e([f()],X.prototype,"description",void 0),e([f({type:Boolean})],X.prototype,"defaultPopupTemplateEnabled",void 0),e([f({readOnly:!0})],X.prototype,"isTable",null),e([f({readOnly:!0})],X.prototype,"state",null),e([f({readOnly:!0})],X.prototype,"formattedAttributes",void 0),e([f({type:t,value:null})],X.prototype,"graphic",null),e([f({readOnly:!0})],X.prototype,"lastEditInfo",void 0),e([f({readOnly:!0})],X.prototype,"relatedInfos",void 0),e([f()],X.prototype,"spatialReference",null),e([f({readOnly:!0})],X.prototype,"title",void 0),e([f()],X.prototype,"map",null),e([f({readOnly:!0})],X.prototype,"waitingForContent",null),e([f()],X.prototype,"view",void 0),X=H=e([_("esri.widgets.FeatureViewModel")],X);const Y=X;export{Y 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"../../../intl.js";import e from"../../../core/Logger.js";import{replace as t}from"../../../core/string.js";import{formatDate as r,convertDateFormatToIntlOptions as n}from"../../../intl/date.js";import{formatNumber as i,convertNumberFormatToIntlOptions as o}from"../../../intl/number.js";import{isRasterPixelValueField as a,featureHasFields as l}from"../../../layers/support/fieldUtils.js";import{getEffectiveLayerCapabilities as u}from"../../../layers/support/layerUtils.js";import s from"../../../popup/support/FieldInfoFormat.js";import{loadArcade as f}from"../../../support/arcadeOnDemand.js";const c="esri.widgets.Feature.support.featureUtils",d=e.getLogger(c),p=/href=(""|'')/gi,y=/(\{([^\{\r\n]+)\})/g,m=/\'/g,g=/^\s*expression\//i,h=/(\n)/gi,I=/[\u00A0-\u9999<>\&]/gim,b=/href\s*=\s*(?:\"([^\"]+)\"|\'([^\']+)\')/gi,F=/^(?:mailto:|tel:)/,w="relationships/",j=n("short-date-short-time");function N(e){if(null!=e)return e.get("sourceLayer")||e.get("layer")}async function E(e,t){return"function"==typeof e?e.call(null,t):e}function T(e=""){if(e)return!F.test(e.trim().toLowerCase())}function x(e){return!!e&&g.test(e)}function C(e,t){if(!x(t)||!e)return null;const r=t.replace(g,"").toLowerCase();let n=null;return e.some((e=>e.name.toLowerCase()===r&&(n=e,!0))),n}function q(e,t){const r=C(t,e?.fieldName);return r?r.title||null:e?e.label||e.fieldName:null}function M(e,t){const r=t.get(e.toLowerCase());return`{${r&&r.fieldName||e}}`}function R(e){return e.replace(p,"")}function D(e,t){const r=L(t,e);return r?r.name:e}function v(e,t){return e&&e.map((e=>D(e,t)))}function L(e,t){return e&&"function"==typeof e.getField&&t?e.getField(t)??null:null}function A(e){return`${e}`.trim()}function U({attributes:e,globalAttributes:t,layer:r,text:n,expressionAttributes:i,fieldInfoMap:o}){return n?$({formattedAttributes:t,template:P(n,{...t,...i,...e},r),fieldInfoMap:o}):""}function $({formattedAttributes:e,template:r,fieldInfoMap:n}){return A(R(t(t(r,(e=>M(e,n))),e)))}function O(e,t,r=!1){const n=t[e];if("string"==typeof n){const i="%27",o=(r?encodeURIComponent(n):n).replace(m,i);t[e]=o}}function S(e,t=!1){const r={...e};return Object.keys(r).forEach((e=>O(e,r,t))),r}function G(e,r,n){const i=(r=A(r))&&"{"!==r[0];return t(e,S(n,i||!1))}function k(e,t){return e.replace(y,((e,r,n)=>{const i=L(t,n);return i?`{${i.name}}`:r}))}function P(e,t,r){const n=k(e,r);return n?n.replace(b,((e,r,n)=>G(e,r||n,t))):n}function Q(e,t){if("string"==typeof e&&t&&null==t.dateFormat&&(null!=t.places||null!=t.digitSeparator)){const t=Number(e);if(!isNaN(t))return t}return e}function _(e){return null!=e&&"object"==typeof e&&"type"in e&&"feature"===e.type}function z(e){return null!=e&&"object"==typeof e&&"layer"in e&&!!e.layer}function H(e){return null!=e&&"object"==typeof e&&"type"in e&&"map-image"===e.type}function V(e){return null!=e&&"object"==typeof e&&"fieldsIndex"in e&&"geometryType"in e&&"getField"in e&&"load"in e&&"loaded"in e&&"objectIdField"in e&&"spatialReference"in e&&"type"in e&&"feature"===e.type&&"when"in e}function Z(e){return null!=e&&"object"==typeof e&&"createQuery"in e&&"queryFeatureCount"in e&&"queryObjectIds"in e&&"queryRelatedFeatures"in e&&"queryRelatedFeaturesCount"in e&&"relationships"in e}function B(e){return V(e)&&Z(e)}function J(e,t){const{fieldInfos:r,fieldName:n,preventPlacesFormatting:l,layer:u}=t,f=K(r,n),c=f?.clone(),d=L(u,n);if(c&&!a(n)){const t=d?.type;if("date"===t||"date-only"===t||"time-only"===t||"timestamp-offset"===t){const r=c.format??new s;if(r.dateFormat??(r.dateFormat="date-only"===t?"short-date":"short-date-short-time"),"number"==typeof e){const t=!z(u)&&_(u)&&u.datesInUnknownTimezone||z(u)&&H(u.layer)&&u.layer.datesInUnknownTimezone;return r.formatDate(e,t)}switch(t){case"date-only":return r.formatDateOnly(e);case"time-only":return r.formatTimeOnly(e);case"timestamp-offset":return r.formatTimestamp(e)}}}const p=c?.format;return"string"==typeof e&&a(n)&&p?p.formatRasterPixelValue(e):"string"==typeof(e=Q(e,p))||null==e||null==p?ne(e):l?i(e,{...o(p),minimumFractionDigits:0,maximumFractionDigits:20}):p.formatNumber(e)}function K(e,t){if(e&&e.length&&t)return e.find((e=>e.fieldName?.toLowerCase()===t.toLowerCase()))}function W({fieldName:e,graphic:t,layer:r}){if(se(e))return null;if(!r||"function"!=typeof r.getFeatureType)return null;const{typeIdField:n}=r;if(!n||e!==n)return null;const i=r.getFeatureType(t);return i?i.name:null}function X({fieldName:e,value:t,graphic:r,layer:n}){if(se(e))return null;if(!n||"function"!=typeof n.getFieldDomain)return null;const i=r&&n.getFieldDomain(e,{feature:r});return i&&"coded-value"===i.type?i.getName(t):null}function Y(e,t){const{creatorField:n,creationDateField:i,editorField:o,editDateField:a}=e;if(!t)return;const l=t[a];if("number"==typeof l){const e=t[o];return{type:"edit",date:r(l,j),user:e}}const u=t[i];if("number"==typeof u){const e=t[n];return{type:"create",date:r(u,j),user:e}}return null}function ee(e,t){const r=new Map;return e?(e.forEach((e=>{const n=D(e.fieldName,t);e.fieldName=n,r.set(n.toLowerCase(),e)})),r):r}function te(e){const t=[];if(!e)return t;const{fieldInfos:r,content:n}=e;return r&&t.push(...r),n&&Array.isArray(n)?(n.forEach((e=>{if("fields"===e.type){const r=e&&e.fieldInfos;r&&t.push(...r)}})),t):t}function re(e){return e.replace(I,(e=>`&#${e.charCodeAt(0)};`))}function ne(e){return"string"==typeof e?e.replace(h,'<br class="esri-text-new-line" />'):e}function ie(e){const{value:t,fieldName:n,fieldInfos:i,fieldInfoMap:o,layer:a,graphic:l}=e;if(null==t)return"";const u=X({fieldName:n,value:t,graphic:l,layer:a});if(u)return u;const s=W({fieldName:n,graphic:l,layer:a});if(s)return s;if(o.get(n.toLowerCase()))return J(t,{fieldInfos:i||Array.from(o.values()),fieldName:n,layer:a});const f=a&&a.fieldsIndex;return f&&f.isDateField(n)?r(t,j):ne(t)}function oe({fieldInfos:e,attributes:t,layer:r,graphic:n,fieldInfoMap:i,relatedInfos:o}){const a={};return o?.forEach((t=>de({attributes:a,relatedInfo:t,fieldInfoMap:i,fieldInfos:e,layer:r}))),t&&Object.keys(t).forEach((o=>{const l=t[o];a[o]=ie({fieldName:o,fieldInfos:e,fieldInfoMap:i,layer:r,value:l,graphic:n})})),a}async function ae(e,t){const{layer:r,graphic:n,outFields:i,objectIds:o,returnGeometry:a,spatialReference:l}=e,s=o[0];if("number"!=typeof s&&"string"!=typeof s){const e="Could not query required fields for the specified feature. The feature's ID is invalid.",t={layer:r,graphic:n,objectId:s,requiredFields:i};return d.warn(e,t),null}if(!u(r)?.operations?.supportsQuery){const e="The specified layer cannot be queried. The following fields will not be available.",t={layer:r,graphic:n,requiredFields:i,returnGeometry:a};return d.warn(e,t),null}const f=r.createQuery();f.objectIds=o,f.outFields=i?.length?i:[r.objectIdField],f.returnGeometry=!!a,f.returnZ=!!a,f.returnM=!!a,f.outSpatialReference=l;return(await r.queryFeatures(f,t)).features[0]}async function le(e){if(!e.expressionInfos?.length)return!1;const t=await f(),{arcadeUtils:{hasGeometryFunctions:r}}=t;return r(e)}async function ue({graphic:e,popupTemplate:t,layer:r,spatialReference:n},i){if(!r||!t)return;if("function"==typeof r.load&&await r.load(i),!e.attributes)return;const o=e.attributes[r.objectIdField];if(null==o)return;const a=[o],u=await t.getRequiredFields(r.fieldsIndex),s=l(u,e),f=s?[]:u,c=t.returnGeometry||await le(t);if(s&&!c)return;const d=await ae({layer:r,graphic:e,outFields:f,objectIds:a,returnGeometry:c,spatialReference:n},i);d&&(d.geometry&&(e.geometry=d.geometry),d.attributes&&(e.attributes={...e.attributes,...d.attributes}))}function se(e=""){return!!e&&e.includes(w)}function fe(e){return e?`${w}${e.layerId}/${e.fieldName}`:""}function ce({attributes:e,graphic:t,relatedInfo:r,fieldInfos:n,fieldInfoMap:i,layer:o}){e&&t&&r&&Object.keys(t.attributes).forEach((a=>{const l=fe({layerId:r.relation.id.toString(),fieldName:a}),u=t.attributes[a];e[l]=ie({fieldName:l,fieldInfos:n,fieldInfoMap:i,layer:o,value:u,graphic:t})}))}function de({attributes:e,relatedInfo:t,fieldInfoMap:r,fieldInfos:n,layer:i}){e&&t&&(t.relatedFeatures&&t.relatedFeatures&&t.relatedFeatures.forEach((o=>ce({attributes:e,graphic:o,relatedInfo:t,fieldInfoMap:r,fieldInfos:n,layer:i}))),t.relatedStatsFeatures&&t.relatedStatsFeatures&&t.relatedStatsFeatures.forEach((o=>ce({attributes:e,graphic:o,relatedInfo:t,fieldInfoMap:r,fieldInfos:n,layer:i}))))}const pe=e=>{if(!e)return!1;const t=e.toUpperCase();return t.includes("CURRENT_TIMESTAMP")||t.includes("CURRENT_DATE")||t.includes("CURRENT_TIME")},ye=({layer:e,method:t,query:r,definitionExpression:n})=>{if(!e.capabilities?.query?.supportsCacheHint||"attachments"===t)return;const i=null!=r.where?r.where:null,o=null!=r.geometry?r.geometry:null;pe(n)||pe(i)||"extent"===o?.type||"tile"===r.resultType||(r.cacheHint=!0)},me=({query:e,layer:t,method:r})=>{ye({layer:t,method:r,query:e,definitionExpression:`${t.definitionExpression} ${t.serviceDefinitionExpression}`})},ge=({queryPayload:e,layer:t,method:r})=>{ye({layer:t,method:r,query:e,definitionExpression:`${t.definitionExpression} ${t.serviceDefinitionExpression}`})};function he(e,t,r){return e&&t&&r?Ie(e.allLayers,t,r)||Ie(e.allTables,t,r):null}function Ie(e,t,r){return e.filter(B).find((e=>e!==t&&e.url===t.url&&e.layerId===r.relatedTableId))}export{ne as applyTextFormattingHTML,ee as createfieldInfoMap,he as findRelatedLayer,k as fixTokens,oe as formatAttributes,Y as formatEditInfo,J as formatValueToFieldInfo,te as getAllFieldInfos,K as getFieldInfo,q as getFieldInfoLabel,D as getFixedFieldName,v as getFixedFieldNames,N as getSourceLayer,E as graphicCallback,re as htmlEntities,x as isExpressionField,V as isFeatureSupportedLayer,B as isRelatableFeatureSupportedLayer,Z as isRelatableLayer,se as isRelatedField,me as preLayerQueryCallback,ge as preRequestCallback,ae as querySourceLayer,ue as queryUpdatedFeature,T as shouldOpenInNewTab,$ as substituteAttributes,U as substituteFieldsInLinksAndAttributes};
5
+ import"../../../intl.js";import e from"../../../core/Logger.js";import{replace as t}from"../../../core/string.js";import{formatDate as r,convertDateFormatToIntlOptions as n}from"../../../intl/date.js";import{formatNumber as i,convertNumberFormatToIntlOptions as o}from"../../../intl/number.js";import{isRasterPixelValueField as a,featureHasFields as l}from"../../../layers/support/fieldUtils.js";import{getEffectiveLayerCapabilities as u}from"../../../layers/support/layerUtils.js";import s from"../../../popup/support/FieldInfoFormat.js";import{loadArcade as f}from"../../../support/arcadeOnDemand.js";const c="esri.widgets.Feature.support.featureUtils",d=e.getLogger(c),p=/href=(""|'')/gi,y=/(\{([^\{\r\n]+)\})/g,m=/\'/g,g=/^\s*expression\//i,h=/(\n)/gi,I=/[\u00A0-\u9999<>\&]/gim,b=/href\s*=\s*(?:\"([^\"]+)\"|\'([^\']+)\')/gi,F=/^(?:mailto:|tel:)/,w="relationships/",j=n("short-date-short-time");function N(e){if(null!=e)return e.get("sourceLayer")||e.get("layer")}async function E(e,t){return"function"==typeof e?e(t):e}function T(e=""){if(e)return!F.test(e.trim().toLowerCase())}function x(e){return!!e&&g.test(e)}function C(e,t){if(!x(t)||!e)return null;const r=t.replace(g,"").toLowerCase();let n=null;return e.some((e=>e.name.toLowerCase()===r&&(n=e,!0))),n}function q(e,t){const r=C(t,e?.fieldName);return r?r.title||null:e?e.label||e.fieldName:null}function M(e,t){const r=t.get(e.toLowerCase());return`{${r&&r.fieldName||e}}`}function R(e){return e.replace(p,"")}function D(e,t){const r=L(t,e);return r?r.name:e}function v(e,t){return e&&e.map((e=>D(e,t)))}function L(e,t){return e&&"function"==typeof e.getField&&t?e.getField(t)??null:null}function A(e){return`${e}`.trim()}function U({attributes:e,globalAttributes:t,layer:r,text:n,expressionAttributes:i,fieldInfoMap:o}){return n?$({formattedAttributes:t,template:P(n,{...t,...i,...e},r),fieldInfoMap:o}):""}function $({formattedAttributes:e,template:r,fieldInfoMap:n}){return A(R(t(t(r,(e=>M(e,n))),e)))}function O(e,t,r=!1){const n=t[e];if("string"==typeof n){const i="%27",o=(r?encodeURIComponent(n):n).replace(m,i);t[e]=o}}function S(e,t=!1){const r={...e};return Object.keys(r).forEach((e=>O(e,r,t))),r}function G(e,r,n){const i=(r=A(r))&&"{"!==r[0];return t(e,S(n,i||!1))}function k(e,t){return e.replace(y,((e,r,n)=>{const i=L(t,n);return i?`{${i.name}}`:r}))}function P(e,t,r){const n=k(e,r);return n?n.replace(b,((e,r,n)=>G(e,r||n,t))):n}function Q(e,t){if("string"==typeof e&&t&&null==t.dateFormat&&(null!=t.places||null!=t.digitSeparator)){const t=Number(e);if(!isNaN(t))return t}return e}function _(e){return null!=e&&"object"==typeof e&&"type"in e&&"feature"===e.type}function z(e){return null!=e&&"object"==typeof e&&"layer"in e&&!!e.layer}function H(e){return null!=e&&"object"==typeof e&&"type"in e&&"map-image"===e.type}function V(e){return null!=e&&"object"==typeof e&&"fieldsIndex"in e&&"geometryType"in e&&"getField"in e&&"load"in e&&"loaded"in e&&"objectIdField"in e&&"spatialReference"in e&&"type"in e&&"feature"===e.type&&"when"in e}function Z(e){return null!=e&&"object"==typeof e&&"createQuery"in e&&"queryFeatureCount"in e&&"queryObjectIds"in e&&"queryRelatedFeatures"in e&&"queryRelatedFeaturesCount"in e&&"relationships"in e}function B(e){return V(e)&&Z(e)}function J(e,t){const{fieldInfos:r,fieldName:n,preventPlacesFormatting:l,layer:u}=t,f=K(r,n),c=f?.clone(),d=L(u,n);if(c&&!a(n)){const t=d?.type;if("date"===t||"date-only"===t||"time-only"===t||"timestamp-offset"===t){const r=c.format??new s;if(r.dateFormat??(r.dateFormat="date-only"===t?"short-date":"short-date-short-time"),"number"==typeof e){const t=!z(u)&&_(u)&&u.datesInUnknownTimezone||z(u)&&H(u.layer)&&u.layer.datesInUnknownTimezone;return r.formatDate(e,t)}switch(t){case"date-only":return r.formatDateOnly(e);case"time-only":return r.formatTimeOnly(e);case"timestamp-offset":return r.formatTimestamp(e)}}}const p=c?.format;return"string"==typeof e&&a(n)&&p?p.formatRasterPixelValue(e):"string"==typeof(e=Q(e,p))||null==e||null==p?ne(e):l?i(e,{...o(p),minimumFractionDigits:0,maximumFractionDigits:20}):p.formatNumber(e)}function K(e,t){if(e&&e.length&&t)return e.find((e=>e.fieldName?.toLowerCase()===t.toLowerCase()))}function W({fieldName:e,graphic:t,layer:r}){if(se(e))return null;if(!r||"function"!=typeof r.getFeatureType)return null;const{typeIdField:n}=r;if(!n||e!==n)return null;const i=r.getFeatureType(t);return i?i.name:null}function X({fieldName:e,value:t,graphic:r,layer:n}){if(se(e))return null;if(!n||"function"!=typeof n.getFieldDomain)return null;const i=r&&n.getFieldDomain(e,{feature:r});return i&&"coded-value"===i.type?i.getName(t):null}function Y(e,t){const{creatorField:n,creationDateField:i,editorField:o,editDateField:a}=e;if(!t)return;const l=t[a];if("number"==typeof l){const e=t[o];return{type:"edit",date:r(l,j),user:e}}const u=t[i];if("number"==typeof u){const e=t[n];return{type:"create",date:r(u,j),user:e}}return null}function ee(e,t){const r=new Map;return e?(e.forEach((e=>{const n=D(e.fieldName,t);e.fieldName=n,r.set(n.toLowerCase(),e)})),r):r}function te(e){const t=[];if(!e)return t;const{fieldInfos:r,content:n}=e;return r&&t.push(...r),n&&Array.isArray(n)?(n.forEach((e=>{if("fields"===e.type){const r=e&&e.fieldInfos;r&&t.push(...r)}})),t):t}function re(e){return e.replace(I,(e=>`&#${e.charCodeAt(0)};`))}function ne(e){return"string"==typeof e?e.replace(h,'<br class="esri-text-new-line" />'):e}function ie(e){const{value:t,fieldName:n,fieldInfos:i,fieldInfoMap:o,layer:a,graphic:l}=e;if(null==t)return"";const u=X({fieldName:n,value:t,graphic:l,layer:a});if(u)return u;const s=W({fieldName:n,graphic:l,layer:a});if(s)return s;if(o.get(n.toLowerCase()))return J(t,{fieldInfos:i||Array.from(o.values()),fieldName:n,layer:a});const f=a&&a.fieldsIndex;return f&&f.isDateField(n)?r(t,j):ne(t)}function oe({fieldInfos:e,attributes:t,layer:r,graphic:n,fieldInfoMap:i,relatedInfos:o}){const a={};return o?.forEach((t=>de({attributes:a,relatedInfo:t,fieldInfoMap:i,fieldInfos:e,layer:r}))),t&&Object.keys(t).forEach((o=>{const l=t[o];a[o]=ie({fieldName:o,fieldInfos:e,fieldInfoMap:i,layer:r,value:l,graphic:n})})),a}async function ae(e,t){const{layer:r,graphic:n,outFields:i,objectIds:o,returnGeometry:a,spatialReference:l}=e,s=o[0];if("number"!=typeof s&&"string"!=typeof s){const e="Could not query required fields for the specified feature. The feature's ID is invalid.",t={layer:r,graphic:n,objectId:s,requiredFields:i};return d.warn(e,t),null}if(!u(r)?.operations?.supportsQuery){const e="The specified layer cannot be queried. The following fields will not be available.",t={layer:r,graphic:n,requiredFields:i,returnGeometry:a};return d.warn(e,t),null}const f=r.createQuery();f.objectIds=o,f.outFields=i?.length?i:[r.objectIdField],f.returnGeometry=!!a,f.returnZ=!!a,f.returnM=!!a,f.outSpatialReference=l;return(await r.queryFeatures(f,t)).features[0]}async function le(e){if(!e.expressionInfos?.length)return!1;const t=await f(),{arcadeUtils:{hasGeometryFunctions:r}}=t;return r(e)}async function ue({graphic:e,popupTemplate:t,layer:r,spatialReference:n},i){if(!r||!t)return;if("function"==typeof r.load&&await r.load(i),!e.attributes)return;const o=e.attributes[r.objectIdField];if(null==o)return;const a=[o],u=await t.getRequiredFields(r.fieldsIndex),s=l(u,e),f=s?[]:u,c=t.returnGeometry||await le(t);if(s&&!c)return;const d=await ae({layer:r,graphic:e,outFields:f,objectIds:a,returnGeometry:c,spatialReference:n},i);d&&(d.geometry&&(e.geometry=d.geometry),d.attributes&&(e.attributes={...e.attributes,...d.attributes}))}function se(e=""){return!!e&&e.includes(w)}function fe(e){return e?`${w}${e.layerId}/${e.fieldName}`:""}function ce({attributes:e,graphic:t,relatedInfo:r,fieldInfos:n,fieldInfoMap:i,layer:o}){e&&t&&r&&Object.keys(t.attributes).forEach((a=>{const l=fe({layerId:r.relation.id.toString(),fieldName:a}),u=t.attributes[a];e[l]=ie({fieldName:l,fieldInfos:n,fieldInfoMap:i,layer:o,value:u,graphic:t})}))}function de({attributes:e,relatedInfo:t,fieldInfoMap:r,fieldInfos:n,layer:i}){e&&t&&(t.relatedFeatures&&t.relatedFeatures&&t.relatedFeatures.forEach((o=>ce({attributes:e,graphic:o,relatedInfo:t,fieldInfoMap:r,fieldInfos:n,layer:i}))),t.relatedStatsFeatures&&t.relatedStatsFeatures&&t.relatedStatsFeatures.forEach((o=>ce({attributes:e,graphic:o,relatedInfo:t,fieldInfoMap:r,fieldInfos:n,layer:i}))))}const pe=e=>{if(!e)return!1;const t=e.toUpperCase();return t.includes("CURRENT_TIMESTAMP")||t.includes("CURRENT_DATE")||t.includes("CURRENT_TIME")},ye=({layer:e,method:t,query:r,definitionExpression:n})=>{if(!e.capabilities?.query?.supportsCacheHint||"attachments"===t)return;const i=null!=r.where?r.where:null,o=null!=r.geometry?r.geometry:null;pe(n)||pe(i)||"extent"===o?.type||"tile"===r.resultType||(r.cacheHint=!0)},me=({query:e,layer:t,method:r})=>{ye({layer:t,method:r,query:e,definitionExpression:`${t.definitionExpression} ${t.serviceDefinitionExpression}`})},ge=({queryPayload:e,layer:t,method:r})=>{ye({layer:t,method:r,query:e,definitionExpression:`${t.definitionExpression} ${t.serviceDefinitionExpression}`})};function he(e,t,r){return e&&t&&r?Ie(e.allLayers,t,r)||Ie(e.allTables,t,r):null}function Ie(e,t,r){return e.filter(B).find((e=>e!==t&&e.url===t.url&&e.layerId===r.relatedTableId))}export{ne as applyTextFormattingHTML,ee as createfieldInfoMap,he as findRelatedLayer,k as fixTokens,oe as formatAttributes,Y as formatEditInfo,J as formatValueToFieldInfo,te as getAllFieldInfos,K as getFieldInfo,q as getFieldInfoLabel,D as getFixedFieldName,v as getFixedFieldNames,N as getSourceLayer,E as graphicCallback,re as htmlEntities,x as isExpressionField,V as isFeatureSupportedLayer,B as isRelatableFeatureSupportedLayer,Z as isRelatableLayer,se as isRelatedField,me as preLayerQueryCallback,ge as preRequestCallback,ae as querySourceLayer,ue as queryUpdatedFeature,T as shouldOpenInNewTab,$ as substituteAttributes,U as substituteFieldsInLinksAndAttributes};