@arcgis/core 4.34.0-next.93 → 4.34.0-next.94

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 (165) hide show
  1. package/analysis/ElevationProfile/ElevationProfileDisplayUnits.d.ts +4 -0
  2. package/analysis/ElevationProfile/{ElevationProfileUnits.js → ElevationProfileDisplayUnits.js} +1 -1
  3. package/analysis/ElevationProfile/ElevationProfileUnits.d.ts +1 -1
  4. package/analysis/ElevationProfile/ElevationProfileViewOptions.js +1 -1
  5. package/analysis/ElevationProfileAnalysis.js +1 -1
  6. package/assets/esri/core/workers/RemoteClient.js +1 -1
  7. package/assets/esri/core/workers/chunks/{db5a985ccc6b7d0ad855.js → 176f56de787bf486be9f.js} +1 -1
  8. package/assets/esri/core/workers/chunks/{ad67e5eb4b8c0c14cea6.js → 1fc7df018c8f802565a6.js} +1 -1
  9. package/assets/esri/core/workers/chunks/20f4c6d8b310ecab97be.js +1 -0
  10. package/assets/esri/core/workers/chunks/25639559336109ff3df1.js +1 -0
  11. package/assets/esri/core/workers/chunks/26081b6486c623735657.js +1 -0
  12. package/assets/esri/core/workers/chunks/2698f656405876f4bd20.js +1 -0
  13. package/assets/esri/core/workers/chunks/{4660798b3b45dcb5cecb.js → 2b9c9a35a6e1f56920b5.js} +2 -2
  14. package/assets/esri/core/workers/chunks/98381404f2d99a1f9341.js +1 -0
  15. package/assets/esri/core/workers/chunks/{992b1389710d716d3450.js → a410dcf80d17a2383337.js} +1 -1
  16. package/assets/esri/core/workers/chunks/{d9d86cf0500fa29d1d43.js → a98b284b147258629947.js} +1 -1
  17. package/assets/esri/core/workers/chunks/b1ccbc2fef7f7e5e04f7.js +1 -0
  18. package/assets/esri/core/workers/chunks/c4641c2c130c7b8bcdee.js +1 -0
  19. package/assets/esri/core/workers/chunks/c9159ebf930af3f336f3.js +1 -0
  20. package/assets/esri/core/workers/chunks/{8de9e50de0ac66ae1573.js → ce2fcaa21d6efcdf4da5.js} +1 -1
  21. package/assets/esri/core/workers/chunks/d2df6e685d6cffc5f486.js +1 -0
  22. package/assets/esri/core/workers/chunks/{c27783ce7ea51a5e49c5.js → e153b61560a7a869db63.js} +1 -1
  23. package/assets/esri/core/workers/chunks/e2c293331515f3bd0355.js +1 -0
  24. package/assets/esri/core/workers/chunks/ec7b156425f25d231078.js +1 -0
  25. package/assets/esri/core/workers/chunks/fb456e7425e09df17d8c.js +1 -0
  26. package/assets/esri/core/workers/chunks/{f6806780ca2aa591475a.js → fe1dcf9f81da4adbb1fe.js} +1 -1
  27. package/assets/esri/libs/parquet/pkg/bundle_bg.wasm +0 -0
  28. package/chunks/WaterSurface.glsl.js +0 -1
  29. package/chunks/bundle.js +1 -1
  30. package/colorUtils.js +1 -1
  31. package/config.js +1 -1
  32. package/interfaces.d.ts +229 -97
  33. package/kernel.js +1 -1
  34. package/layers/GaussianSplatLayer.js +1 -1
  35. package/layers/graphics/controllers/I3SOnDemandController.js +1 -1
  36. package/layers/graphics/dehydratedFeatureComparison.js +1 -1
  37. package/layers/orientedImagery/transformations/imageToWorld.js +1 -1
  38. package/layers/support/rasterDatasets/InMemoryRaster.js +1 -1
  39. package/networks/UtilityNetwork.js +1 -1
  40. package/networks/support/NetworkSystemLayers.js +1 -1
  41. package/package.json +2 -1
  42. package/popup/content/AttachmentsContent.js +1 -1
  43. package/portal/schemas/definitions.js +1 -1
  44. package/rest/knowledgeGraphService.js +1 -1
  45. package/support/revision.js +1 -1
  46. package/views/2d/analysis/ElevationProfile/ElevationProfileInputVisualization2D.js +1 -1
  47. package/views/2d/analysis/ElevationProfile/ElevationProfileLineVisualization2D.js +1 -1
  48. package/views/2d/analysis/ElevationProfileAnalysisView2D.js +1 -1
  49. package/views/2d/layers/imagery/BaseImageryTileSubView2D.js +1 -1
  50. package/views/2d/layers/imagery/ImageryTileView2D.js +1 -1
  51. package/views/3d/analysis/ElevationProfile/ElevationProfileInputVisualization3D.js +1 -1
  52. package/views/3d/analysis/ElevationProfile/ElevationProfileLineSceneComputation.js +1 -1
  53. package/views/3d/analysis/ElevationProfile/ElevationProfileLineVisualization3D.js +1 -1
  54. package/views/3d/analysis/ElevationProfileAnalysisView3D.js +1 -1
  55. package/views/3d/layers/FlowSubView3D.js +1 -1
  56. package/views/3d/layers/graphics/Graphics3DMeshFillSymbolLayer.js +1 -1
  57. package/views/3d/layers/graphics/objectResourceUtils.js +1 -1
  58. package/views/3d/support/GaussianSplatSortWorker.js +1 -1
  59. package/views/3d/support/flow/FlowSubViewTiles3D.js +1 -1
  60. package/views/3d/support/gaussianSplatting/GaussianSplatDataStore.js +1 -1
  61. package/views/3d/webgl-engine/core/shaderTechnique/ShaderTechnique.js +1 -1
  62. package/views/3d/webgl-engine/effects/blit/Blit.js +1 -1
  63. package/views/3d/webgl-engine/effects/transparency/OITBlendTechnique.js +1 -1
  64. package/views/3d/webgl-engine/lib/CompositingHelper.js +1 -1
  65. package/views/3d/webgl-engine/shaders/GaussianSplatDepthCompositionTechnique.js +1 -1
  66. package/views/PopupView.js +1 -1
  67. package/views/View.js +1 -1
  68. package/views/View2D.js +1 -1
  69. package/views/analysis/ElevationProfile/ElevationProfileChart.js +1 -1
  70. package/views/analysis/ElevationProfile/ElevationProfileController.js +1 -1
  71. package/views/analysis/ElevationProfile/ElevationProfileHoveredPointsVisualization.js +1 -1
  72. package/views/analysis/ElevationProfile/ElevationProfileLineComputation.js +1 -1
  73. package/views/analysis/ElevationProfile/ElevationProfileLineInputComputation.js +1 -1
  74. package/views/analysis/ElevationProfile/ElevationProfileResult.js +1 -1
  75. package/views/analysis/ElevationProfile/ElevationProfileTool.js +1 -1
  76. package/views/analysis/ElevationProfile/elevationProfileGeometryUtils.js +1 -1
  77. package/views/analysis/ElevationProfile/elevationProfileInputVisualizationUtils.js +1 -1
  78. package/views/interactive/snapping/LineSnapper.js +1 -1
  79. package/views/interactive/snapping/ParallelLineSnapper.js +1 -1
  80. package/views/interactive/snapping/RightAngleSnapper.js +1 -1
  81. package/views/interactive/snapping/RightAngleTriangleSnapper.js +1 -1
  82. package/views/interactive/snapping/snappingUtils.js +1 -1
  83. package/views/popupAdapter.js +5 -0
  84. package/views/webgl/ContextState.js +1 -1
  85. package/views/webgl/RenderingContext.js +1 -1
  86. package/views/webgl/enums.js +1 -1
  87. package/widgets/Attachments/AttachmentsViewModel.js +1 -1
  88. package/widgets/Attachments.js +1 -1
  89. package/widgets/ElevationProfile/support/chartUtils.js +1 -1
  90. package/widgets/Feature/FeatureMedia/chartCommon.js +1 -1
  91. package/widgets/Feature/FeatureMedia/pieChart.js +1 -1
  92. package/widgets/Feature/FeatureMedia/xyChart.js +1 -1
  93. package/widgets/Feature/FeatureViewModel.js +1 -1
  94. package/widgets/FeatureTable/support/ColumnTemplateBase.js +1 -1
  95. package/widgets/FeatureTable/support/TableTemplate.js +1 -1
  96. package/widgets/Features/FeaturesViewModel.js +1 -1
  97. package/widgets/Legend/LegendViewModel.js +1 -1
  98. package/widgets/Legend/support/ActiveLayerInfo.js +1 -1
  99. package/widgets/Legend.js +1 -1
  100. package/widgets/Search/SearchResultRenderer.js +1 -1
  101. package/widgets/Search/SearchViewModel.js +1 -1
  102. package/widgets/Search.js +1 -1
  103. package/widgets/support/chartUtilsAm5.js +1 -1
  104. package/assets/esri/core/workers/chunks/0b24a6c06d1becbb6815.js +0 -1
  105. package/assets/esri/core/workers/chunks/19f1bfe815896d4983af.js +0 -1
  106. package/assets/esri/core/workers/chunks/22c3a21bc9f32c429c48.js +0 -1
  107. package/assets/esri/core/workers/chunks/3b2ef975831eb75b40fb.js +0 -1
  108. package/assets/esri/core/workers/chunks/5eb7f6f5121c8830c561.js +0 -1
  109. package/assets/esri/core/workers/chunks/6c3b585b9cb6bb640fb0.js +0 -1
  110. package/assets/esri/core/workers/chunks/8b9a50cfaa5a7df02dad.js +0 -1
  111. package/assets/esri/core/workers/chunks/8ff2daef892881ff2019.js +0 -1
  112. package/assets/esri/core/workers/chunks/a6a2d4602dfeb62e0ecc.js +0 -1
  113. package/assets/esri/core/workers/chunks/c95e6bef8c97cf647869.js +0 -1
  114. package/assets/esri/core/workers/chunks/ce175801937e80e3c487.js +0 -1
  115. package/assets/esri/core/workers/chunks/d71836cf70b9604832f1.js +0 -1
  116. package/chunks/Button.js +0 -5
  117. package/chunks/ColorSet.js +0 -5
  118. package/chunks/DefaultTheme.js +0 -5
  119. package/chunks/LineSeries.js +0 -5
  120. package/chunks/ResponsiveTheme.js +0 -5
  121. package/chunks/Theme.js +0 -5
  122. package/chunks/Tick.js +0 -5
  123. package/chunks/Tooltip.js +0 -5
  124. package/chunks/ar.js +0 -5
  125. package/chunks/bg_BG.js +0 -5
  126. package/chunks/bs_BA.js +0 -5
  127. package/chunks/ca_ES.js +0 -5
  128. package/chunks/chartUtilsAm5.js +0 -5
  129. package/chunks/cs_CZ.js +0 -5
  130. package/chunks/da_DK.js +0 -5
  131. package/chunks/de_CH.js +0 -5
  132. package/chunks/de_DE.js +0 -5
  133. package/chunks/el_GR.js +0 -5
  134. package/chunks/en_CA.js +0 -5
  135. package/chunks/en_US.js +0 -5
  136. package/chunks/es_ES.js +0 -5
  137. package/chunks/et_EE.js +0 -5
  138. package/chunks/fi_FI.js +0 -5
  139. package/chunks/fr_FR.js +0 -5
  140. package/chunks/he_IL.js +0 -5
  141. package/chunks/hr_HR.js +0 -5
  142. package/chunks/hu_HU.js +0 -5
  143. package/chunks/id_ID.js +0 -5
  144. package/chunks/it_IT.js +0 -5
  145. package/chunks/ja_JP.js +0 -5
  146. package/chunks/ko_KR.js +0 -5
  147. package/chunks/lt_LT.js +0 -5
  148. package/chunks/lv_LV.js +0 -5
  149. package/chunks/nb_NO.js +0 -5
  150. package/chunks/nl_NL.js +0 -5
  151. package/chunks/pl_PL.js +0 -5
  152. package/chunks/pt_BR.js +0 -5
  153. package/chunks/pt_PT.js +0 -5
  154. package/chunks/ro_RO.js +0 -5
  155. package/chunks/ru_RU.js +0 -5
  156. package/chunks/sk_SK.js +0 -5
  157. package/chunks/sl_SL.js +0 -5
  158. package/chunks/sr_RS.js +0 -5
  159. package/chunks/sv_SE.js +0 -5
  160. package/chunks/th_TH.js +0 -5
  161. package/chunks/tr_TR.js +0 -5
  162. package/chunks/uk_UA.js +0 -5
  163. package/chunks/vi_VN.js +0 -5
  164. package/chunks/zh_Hans.js +0 -5
  165. package/chunks/zh_Hant.js +0 -5
@@ -2,4 +2,4 @@
2
2
  All material copyright ESRI, All Rights Reserved, unless otherwise specified.
3
3
  See https://js.arcgis.com/4.34/esri/copyright.txt for details.
4
4
  */
5
- import{__decorate as t}from"tslib";import e from"../../Graphic.js";import i from"../../core/Accessor.js";import a from"../../core/Collection.js";import n from"../../core/Error.js";import{watch as r,initial as s}from"../../core/reactiveUtils.js";import{property as o}from"../../core/accessorSupport/decorators/property.js";import{cast as c}from"../../core/accessorSupport/decorators/cast.js";import"../../core/has.js";import"../../core/RandomLCG.js";import{subclass as h}from"../../core/accessorSupport/decorators/subclass.js";import d from"../../popup/support/AttachmentsOrderByInfo.js";import l from"../../rest/query/support/AttachmentInfo.js";import p from"../../rest/support/AttachmentQuery.js";import{getSourceLayer as m}from"../Feature/support/featureUtils.js";const f={editing:!1,operations:{add:!0,update:!0,delete:!0}},u=a.ofType(l);let y=class extends i{constructor(t){super(t),this._getAttachmentsPromise=null,this._attachmentLayer=null,this.capabilities={...f},this.activeAttachmentInfo=null,this.activeFileInfo=null,this.attachmentInfos=new u,this.fileInfos=new a,this.graphic=null,this.mode="view",this.orderByFields=null,this.filesEnabled=!1,this.addHandles(r(()=>this.graphic,()=>this._graphicChanged(),s))}destroy(){this._attachmentLayer=null,this.graphic=null}castCapabilities(t){return{...f,...t}}get state(){return this._getAttachmentsPromise?"loading":this.graphic?"ready":"disabled"}get supportsResizeAttachments(){const{graphic:t}=this;if(!t)return!1;const e=t.layer||t.sourceLayer;return e?.loaded&&"capabilities"in e&&e.capabilities&&"attachment"in e.capabilities&&e.capabilities.attachment&&"supportsResize"in e.capabilities.attachment&&e.capabilities.attachment.supportsResize||!1}async getAttachments(){const{_attachmentLayer:t,attachmentInfos:e,orderByFields:i}=this;if(!t||"function"!=typeof t.queryAttachments)throw new n("invalid-layer","getAttachments(): A valid layer is required.");const a=this._getObjectId();if("number"!=typeof a)throw new n("invalid-object-id","getAttachments(): Numeric object id is required");const r=i?.map(t=>`${t.field} ${"descending"===t.order?"DESC":"ASC"}`),s=new p({objectIds:[a],returnMetadata:!0,orderByFields:r}),o=[],c=t.queryAttachments(s).then(t=>t[a]||o).catch(()=>o);this._getAttachmentsPromise=c,this.notifyChange("state");const h=await c;return e.destroyAll(),h.length&&e.addMany(h),this._getAttachmentsPromise=null,this.notifyChange("state"),h}async addAttachment(t,e=this.graphic){const{_attachmentLayer:i,attachmentInfos:a,capabilities:r}=this;if(!e)throw new n("invalid-graphic","addAttachment(): A valid graphic is required.",{graphic:e});if(!t)throw new n("invalid-attachment","addAttachment(): An attachment is required.",{attachment:t});if(!r.operations?.add)throw new n("invalid-capabilities","addAttachment(): add capabilities are required.");if(!i||"function"!=typeof i.addAttachment)throw new n("invalid-layer","addAttachment(): A valid layer is required.");const s=i.addAttachment(e,t).then(t=>this._queryAttachment(t.objectId,e)),o=await s;return a.add(o),o}async deleteAttachment(t){const{_attachmentLayer:e,attachmentInfos:i,graphic:a,capabilities:r}=this;if(!t)throw new n("invalid-attachment-info","deleteAttachment(): An attachmentInfo is required.",{attachmentInfo:t});if(!r.operations?.delete)throw new n("invalid-capabilities","deleteAttachment(): delete capabilities are required.");if(!e||"function"!=typeof e.deleteAttachments)throw new n("invalid-layer","deleteAttachment(): A valid layer is required.");if(!a)throw new n("invalid-graphic","deleteAttachment(): A graphic is required.");const s=e.deleteAttachments(a,[t.id]).then(()=>t),o=await s;return i.remove(o),o.destroy(),o}async updateAttachment(t,e=this.activeAttachmentInfo){const{_attachmentLayer:i,attachmentInfos:a,graphic:r,capabilities:s}=this;if(!t)throw new n("invalid-attachment","updateAttachment(): An attachment is required.",{attachment:t});if(!e)throw new n("invalid-attachment-info","updateAttachment(): An attachmentInfo is required.",{attachmentInfo:e});if(!s.operations?.update)throw new n("invalid-capabilities","updateAttachment(): Update capabilities are required.");const o=a.indexOf(e);if(!i||"function"!=typeof i.updateAttachment)throw new n("invalid-layer","updateAttachment(): A valid layer is required.");if(!r)throw new n("invalid-graphic","updateAttachment(): A graphic is required.");const c=i.updateAttachment(r,e.id,t).then(t=>this._queryAttachment(t.objectId)),h=await c;return a.splice(o,1,h),h}async commitFiles(){return await Promise.all(this.fileInfos.items.map(t=>this.addAttachment(t.form))),this.fileInfos.removeAll(),this.getAttachments()}addFile(t,e){if(!t||!e)return null;const i={file:t,form:e};return this.fileInfos.add(i),i}updateFile(t,e,i=this.activeFileInfo){if(!t||!e||!i)return null;const a=this.fileInfos.indexOf(i);return a>-1&&this.fileInfos.splice(a,1,{file:t,form:e}),this.fileInfos.items[a]}deleteFile(t){const e=this.fileInfos.find(e=>e.file===t);return e?(this.fileInfos.remove(e),e):null}async _queryAttachment(t,e){const{_attachmentLayer:i}=this;if(!t||!i?.queryAttachments)throw new n("invalid-attachment-id","Could not query attachment.");const a=this._getObjectId(e);if("number"!=typeof a)throw new n("invalid-object-id","getAttachments(): Numeric object id is required");const r=new p({objectIds:[a],attachmentsWhere:`AttachmentId=${t}`,returnMetadata:!0});return i.queryAttachments(r).then(t=>t[a][0])}_getObjectId(t=this.graphic){return t?.getObjectId()??null}_graphicChanged(){this.graphic&&(this._setAttachmentLayer(),this.getAttachments().catch(()=>this.attachmentInfos.destroyAll()))}_setAttachmentLayer(){const{graphic:t}=this,e=m(t);this._attachmentLayer=e?"scene"===e.type&&null!=e.associatedLayer?e.associatedLayer:e:null}};t([o()],y.prototype,"capabilities",void 0),t([c("capabilities")],y.prototype,"castCapabilities",null),t([o()],y.prototype,"activeAttachmentInfo",void 0),t([o()],y.prototype,"activeFileInfo",void 0),t([o({readOnly:!0,type:u})],y.prototype,"attachmentInfos",void 0),t([o()],y.prototype,"fileInfos",void 0),t([o({type:e})],y.prototype,"graphic",void 0),t([o()],y.prototype,"mode",void 0),t([o({type:[d]})],y.prototype,"orderByFields",void 0),t([o({readOnly:!0})],y.prototype,"state",null),t([o()],y.prototype,"filesEnabled",void 0),t([o({readOnly:!0})],y.prototype,"supportsResizeAttachments",null),y=t([h("esri.widgets.Attachments.AttachmentsViewModel")],y);export{y as default};
5
+ import{__decorate as t}from"tslib";import e from"../../Graphic.js";import a from"../../core/Accessor.js";import i from"../../core/Collection.js";import n from"../../core/Error.js";import{watch as r,initial as s}from"../../core/reactiveUtils.js";import{property as o}from"../../core/accessorSupport/decorators/property.js";import{cast as c}from"../../core/accessorSupport/decorators/cast.js";import"../../core/has.js";import"../../core/RandomLCG.js";import{subclass as h}from"../../core/accessorSupport/decorators/subclass.js";import d from"../../popup/support/AttachmentsOrderByInfo.js";import l from"../../rest/query/support/AttachmentInfo.js";import p from"../../rest/support/AttachmentQuery.js";import{getSourceLayer as m}from"../Feature/support/featureUtils.js";const u={editing:!1,operations:{add:!0,update:!0,delete:!0}},f=i.ofType(l);let y=class extends a{constructor(t){super(t),this._getAttachmentsPromise=null,this._attachmentLayer=null,this.attachmentKeywords=null,this.attachmentTypes=null,this.capabilities={...u},this.activeAttachmentInfo=null,this.activeFileInfo=null,this.attachmentInfos=new f,this.fileInfos=new i,this.graphic=null,this.mode="view",this.orderByFields=null,this.filesEnabled=!1,this.addHandles(r(()=>this.graphic,()=>this._graphicChanged(),s))}destroy(){this._attachmentLayer=null,this.graphic=null}castCapabilities(t){return{...u,...t}}get state(){return this._getAttachmentsPromise?"loading":this.graphic?"ready":"disabled"}get supportsResizeAttachments(){const{graphic:t}=this;if(!t)return!1;const e=t.layer||t.sourceLayer;return e?.loaded&&"capabilities"in e&&e.capabilities&&"attachment"in e.capabilities&&e.capabilities.attachment&&"supportsResize"in e.capabilities.attachment&&e.capabilities.attachment.supportsResize||!1}get supportsTypeWildcard(){const{graphic:t}=this;if(!t)return!1;const e=t.layer||t.sourceLayer;return e?.loaded&&"capabilities"in e&&e.capabilities&&"attachment"in e.capabilities&&e.capabilities.attachment&&"supportsResize"in e.capabilities.attachment&&e.capabilities.attachment.supportsTypeWildcard||!1}async getAttachments(){const{_attachmentLayer:t,attachmentInfos:e,orderByFields:a,attachmentTypes:i,attachmentKeywords:r,supportsTypeWildcard:s}=this;if(!t||"function"!=typeof t.queryAttachments)throw new n("invalid-layer","getAttachments(): A valid layer is required.");const o=this._getObjectId();if("number"!=typeof o)throw new n("invalid-object-id","getAttachments(): Numeric object id is required");const c=a?.map(t=>`${t.field} ${"descending"===t.order?"DESC":"ASC"}`),h=new p({objectIds:[o],returnMetadata:!0,orderByFields:c,attachmentTypes:s?i?.map(t=>`${t}/*`):void 0,keywords:r}),d=[],l=t.queryAttachments(h).then(t=>t[o]||d).catch(()=>d);this._getAttachmentsPromise=l,this.notifyChange("state");const m=await l;return e.destroyAll(),m.length&&e.addMany(m),this._getAttachmentsPromise=null,this.notifyChange("state"),m}async addAttachment(t,e=this.graphic){const{_attachmentLayer:a,attachmentInfos:i,capabilities:r}=this;if(!e)throw new n("invalid-graphic","addAttachment(): A valid graphic is required.",{graphic:e});if(!t)throw new n("invalid-attachment","addAttachment(): An attachment is required.",{attachment:t});if(!r.operations?.add)throw new n("invalid-capabilities","addAttachment(): add capabilities are required.");if(!a||"function"!=typeof a.addAttachment)throw new n("invalid-layer","addAttachment(): A valid layer is required.");const s=a.addAttachment(e,t).then(t=>this._queryAttachment(t.objectId,e)),o=await s;return i.add(o),o}async deleteAttachment(t){const{_attachmentLayer:e,attachmentInfos:a,graphic:i,capabilities:r}=this;if(!t)throw new n("invalid-attachment-info","deleteAttachment(): An attachmentInfo is required.",{attachmentInfo:t});if(!r.operations?.delete)throw new n("invalid-capabilities","deleteAttachment(): delete capabilities are required.");if(!e||"function"!=typeof e.deleteAttachments)throw new n("invalid-layer","deleteAttachment(): A valid layer is required.");if(!i)throw new n("invalid-graphic","deleteAttachment(): A graphic is required.");const s=e.deleteAttachments(i,[t.id]).then(()=>t),o=await s;return a.remove(o),o.destroy(),o}async updateAttachment(t,e=this.activeAttachmentInfo){const{_attachmentLayer:a,attachmentInfos:i,graphic:r,capabilities:s}=this;if(!t)throw new n("invalid-attachment","updateAttachment(): An attachment is required.",{attachment:t});if(!e)throw new n("invalid-attachment-info","updateAttachment(): An attachmentInfo is required.",{attachmentInfo:e});if(!s.operations?.update)throw new n("invalid-capabilities","updateAttachment(): Update capabilities are required.");const o=i.indexOf(e);if(!a||"function"!=typeof a.updateAttachment)throw new n("invalid-layer","updateAttachment(): A valid layer is required.");if(!r)throw new n("invalid-graphic","updateAttachment(): A graphic is required.");const c=a.updateAttachment(r,e.id,t).then(t=>this._queryAttachment(t.objectId)),h=await c;return i.splice(o,1,h),h}async commitFiles(){return await Promise.all(this.fileInfos.items.map(t=>this.addAttachment(t.form))),this.fileInfos.removeAll(),this.getAttachments()}addFile(t,e){if(!t||!e)return null;const a={file:t,form:e};return this.fileInfos.add(a),a}updateFile(t,e,a=this.activeFileInfo){if(!t||!e||!a)return null;const i=this.fileInfos.indexOf(a);return i>-1&&this.fileInfos.splice(i,1,{file:t,form:e}),this.fileInfos.items[i]}deleteFile(t){const e=this.fileInfos.find(e=>e.file===t);return e?(this.fileInfos.remove(e),e):null}async _queryAttachment(t,e){const{_attachmentLayer:a}=this;if(!t||!a?.queryAttachments)throw new n("invalid-attachment-id","Could not query attachment.");const i=this._getObjectId(e);if("number"!=typeof i)throw new n("invalid-object-id","getAttachments(): Numeric object id is required");const r=new p({objectIds:[i],attachmentsWhere:`AttachmentId=${t}`,returnMetadata:!0});return a.queryAttachments(r).then(t=>t[i][0])}_getObjectId(t=this.graphic){return t?.getObjectId()??null}_graphicChanged(){this.graphic&&(this._setAttachmentLayer(),this.getAttachments().catch(()=>this.attachmentInfos.destroyAll()))}_setAttachmentLayer(){const{graphic:t}=this,e=m(t);this._attachmentLayer=e?"scene"===e.type&&null!=e.associatedLayer?e.associatedLayer:e:null}};t([o({type:[String]})],y.prototype,"attachmentKeywords",void 0),t([o({type:[["application","audio","image","model","text","video"]]})],y.prototype,"attachmentTypes",void 0),t([o()],y.prototype,"capabilities",void 0),t([c("capabilities")],y.prototype,"castCapabilities",null),t([o()],y.prototype,"activeAttachmentInfo",void 0),t([o()],y.prototype,"activeFileInfo",void 0),t([o({readOnly:!0,type:f})],y.prototype,"attachmentInfos",void 0),t([o()],y.prototype,"fileInfos",void 0),t([o({type:e})],y.prototype,"graphic",void 0),t([o()],y.prototype,"mode",void 0),t([o({type:[d]})],y.prototype,"orderByFields",void 0),t([o({readOnly:!0})],y.prototype,"state",null),t([o()],y.prototype,"filesEnabled",void 0),t([o({readOnly:!0})],y.prototype,"supportsResizeAttachments",null),t([o({readOnly:!0})],y.prototype,"supportsTypeWildcard",null),y=t([h("esri.widgets.Attachments.AttachmentsViewModel")],y);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.34/esri/copyright.txt for details.
4
4
  */
5
- import{__decorate as e}from"tslib";import t from"../core/Error.js";import{on as s,watch as i,initial as a}from"../core/reactiveUtils.js";import{formatFileSize as n}from"../core/unitFormatUtils.js";import{property as l}from"../core/accessorSupport/decorators/property.js";import{cast as r}from"../core/accessorSupport/decorators/cast.js";import"../core/has.js";import"../core/RandomLCG.js";import{subclass as o}from"../core/accessorSupport/decorators/subclass.js";import d from"./Widget.js";import c from"./Attachments/AttachmentsViewModel.js";import{getIconPath as m,isSupportedImage as h}from"./Attachments/support/attachmentUtils.js";import{loadCalciteComponents as u}from"./support/componentsUtils.js";import{globalCss as p}from"./support/globalCss.js";import{legacyIcon as b}from"./support/legacyIcon.js";import{discardNode as _,storeNode as g,isRTL as f}from"./support/widgetUtils.js";import{messageBundle as v}from"./support/decorators/messageBundle.js";import{tsx as y}from"./support/jsxFactory.js";import"@arcgis/toolkit/dom";const A={addButton:!0,addSubmitButton:!0,cancelAddButton:!0,cancelUpdateButton:!0,deleteButton:!0,errorMessage:!0,progressBar:!0,updateButton:!0},w="esri-attachments",F={base:w,loaderContainer:`${w}__loader-container`,loader:`${w}__loader`,container:`${w}__container`,containerList:`${w}__container--list`,containerPreview:`${w}__container--preview`,actions:`${w}__actions`,deleteButton:`${w}__delete-button`,addAttachmentButton:`${w}__add-attachment-button`,errorMessage:`${w}__error-message`,items:`${w}__items`,item:`${w}__item`,itemButton:`${w}__item-button`,itemMask:`${w}__item-mask`,itemMaskIcon:`${w}__item-mask--icon`,itemImage:`${w}__image`,itemImageResizable:`${w}__image--resizable`,itemLabel:`${w}__label`,itemFilename:`${w}__filename`,itemChevronIcon:`${w}__item-chevron-icon`,itemLink:`${w}__item-link`,itemLinkOverlay:`${w}__item-link-overlay`,itemLinkOverlayIcon:`${w}__item-link-overlay-icon`,itemAddIcon:`${w}__item-add-icon`,formNode:`${w}__form-node`,fileFieldset:`${w}__file-fieldset`,fileLabel:`${w}__file-label`,fileName:`${w}__file-name`,fileInput:`${w}__file-input`,metadata:`${w}__metadata`,metadataFieldset:`${w}__metadata-fieldset`,progressBar:`${w}__progress-bar`},k=window.CSS;let M=class extends d{constructor(e,t){super(e,t),this.displayType="auto",this.messages=null,this.messagesUnits=null,this.selectedFile=null,this.submitting=!1,this.viewModel=null,this.visibleElements={...A},this._supportsImageOrientation=k&&k.supports&&k.supports("image-orientation","from-image"),this._addAttachmentForm=null,this._updateAttachmentForm=null}normalizeCtorArgs(e){return e?.viewModel||(e={viewModel:new c,...e}),e}initialize(){this.addHandles([s(()=>this.viewModel?.attachmentInfos,"change",()=>this.scheduleRender()),s(()=>this.viewModel?.fileInfos,"change",()=>this.scheduleRender()),i(()=>this.viewModel?.mode,()=>this._modeChanged(),a)])}loadDependencies(){return u({icon:()=>import("@esri/calcite-components/dist/components/calcite-icon")})}get capabilities(){return this.viewModel.capabilities}set capabilities(e){this.viewModel.capabilities=e}get effectiveDisplayType(){const{displayType:e}=this;return e&&"auto"!==e?e:this.viewModel.supportsResizeAttachments?"preview":"list"}get graphic(){return this.viewModel.graphic}set graphic(e){this.viewModel.graphic=e}get icon(){return"attachment"}set icon(e){this._overrideIfSome("icon",e)}get label(){return this.messages?.widgetLabel??""}set label(e){this._overrideIfSome("label",e)}castVisibleElements(e){return{...A,...e}}addAttachment(){const{_addAttachmentForm:e,viewModel:s}=this;return this._set("submitting",!0),this._set("error",null),s.addAttachment(e).then(e=>(this._set("submitting",!1),this._set("error",null),s.mode="view",e)).catch(e=>{throw this._set("submitting",!1),this._set("error",new t("attachments:add-attachment",this.messages.addErrorMessage,e)),e})}deleteAttachment(e){const{viewModel:s}=this;return this._set("submitting",!0),this._set("error",null),s.deleteAttachment(e).then(e=>(this._set("submitting",!1),this._set("error",null),s.mode="view",e)).catch(e=>{throw this._set("submitting",!1),this._set("error",new t("attachments:delete-attachment",this.messages.deleteErrorMessage,e)),e})}updateAttachment(){const{viewModel:e}=this,{_updateAttachmentForm:s}=this;return this._set("submitting",!0),this._set("error",null),e.updateAttachment(s).then(t=>(this._set("submitting",!1),this._set("error",null),e.mode="view",t)).catch(e=>{throw this._set("submitting",!1),this._set("error",new t("attachments:update-attachment",this.messages.updateErrorMessage,e)),e})}addFile(){const e=this.viewModel.addFile(this.selectedFile,this._addAttachmentForm);return this.viewModel.mode="view",e}updateFile(){const{viewModel:e}=this,t=e.updateFile(this.selectedFile,this._updateAttachmentForm,e.activeFileInfo);return e.mode="view",t}deleteFile(e){const t=this.viewModel.deleteFile(e||this.viewModel.activeFileInfo?.file);return this.viewModel.mode="view",t}render(){const{submitting:e,viewModel:t}=this,{state:s}=t;return y("div",{class:this.classes(F.base,p.widget)},e?this._renderProgressBar():null,"loading"===s?this._renderLoading():this._renderAttachments(),this._renderErrorMessage())}_renderErrorMessage(){const{error:e,visibleElements:t}=this;return e&&t.errorMessage?y("div",{class:F.errorMessage,key:"error-message"},e.message):null}_renderAttachments(){const{activeFileInfo:e,mode:t,activeAttachmentInfo:s}=this.viewModel;return"add"===t?this._renderAddForm():"edit"===t?this._renderDetailsForm(s||e):this._renderAttachmentContainer()}_renderLoading(){return y("div",{class:F.loaderContainer,key:"loader"},y("div",{class:F.loader}))}_renderProgressBar(){return this.visibleElements.progressBar?y("div",{class:F.progressBar,key:"progress-bar"}):null}_renderAddForm(){const{submitting:e,selectedFile:t}=this,s=e||!t,i=this.visibleElements.cancelAddButton?y("button",{bind:this,class:this.classes(p.button,p.buttonTertiary,p.buttonSmall,p.buttonHalf,e&&p.buttonDisabled),disabled:e,onclick:this._cancelForm,type:"button"},this.messages.cancel):null,a=this.visibleElements.addSubmitButton?y("button",{class:this.classes(p.button,p.buttonSecondary,p.buttonSmall,p.buttonHalf,{[p.buttonDisabled]:s}),disabled:s,type:"submit"},this.messages.add):null,n=t?y("span",{class:F.fileName,key:"file-name"},t.name):null,l=y("form",{afterCreate:g,afterRemoved:_,bind:this,"data-node-ref":"_addAttachmentForm",onsubmit:this._submitAddAttachment},y("fieldset",{class:F.fileFieldset},n,y("label",{class:this.classes(F.fileLabel,p.button,p.buttonSecondary)},t?this.messages.changeFile:this.messages.selectFile,y("input",{bind:this,class:F.fileInput,name:"attachment",onchange:this._handleFileInputChange,type:"file"}))),a,i);return y("div",{class:F.formNode,key:"add-form-container"},l)}_renderDetailsForm(e){const{visibleElements:t,viewModel:s,selectedFile:i,submitting:a}=this,{capabilities:l}=s,r=a||!i;let o,d,c,m;i?(o=i.type,d=i.name,c=i.size):e&&"file"in e?(o=e.file.type,d=e.file.name,c=e.file.size):e&&"contentType"in e&&(o=e.contentType,d=e.name,c=e.size,m=e.url);const h=l.editing&&l.operations?.delete&&t.deleteButton?y("button",{bind:this,class:this.classes(p.button,p.buttonSmall,p.buttonTertiary,F.deleteButton,{[p.buttonDisabled]:a}),disabled:a,key:"delete-button",onclick:t=>this._submitDeleteAttachment(t,e),type:"button"},this.messages.delete):void 0,u=l.editing&&l.operations?.update&&t.updateButton?y("button",{class:this.classes(p.button,p.buttonSmall,p.buttonThird,{[p.buttonDisabled]:r}),disabled:r,key:"update-button",type:"submit"},this.messages.update):void 0,b=this.visibleElements.cancelUpdateButton?y("button",{bind:this,class:this.classes(p.button,p.buttonSmall,p.buttonTertiary,p.buttonThird,{[p.buttonDisabled]:a}),disabled:a,key:"cancel-button",onclick:this._cancelForm,type:"button"},this.messages.cancel):void 0,f=l.editing&&l.operations?.update?y("fieldset",{class:F.fileFieldset,key:"file"},y("span",{class:F.fileName,key:"file-name"},d),y("label",{class:this.classes(F.fileLabel,p.button,p.buttonSecondary)},this.messages.changeFile,y("input",{bind:this,class:F.fileInput,name:"attachment",onchange:this._handleFileInputChange,type:"file"}))):void 0,v=y("fieldset",{class:F.metadataFieldset,key:"size"},y("label",null,n(this.messagesUnits,c??0))),A=y("fieldset",{class:F.metadataFieldset,key:"content-type"},y("label",null,o)),w=null!=m?y("a",{class:F.itemLink,href:m,rel:"noreferrer",target:"_blank"},this._renderImageMask(e,400),y("div",{class:F.itemLinkOverlay},y("span",{class:F.itemLinkOverlayIcon},y("calcite-icon",{icon:"launch"})))):this._renderImageMask(e,400),k=y("form",{afterCreate:g,afterRemoved:_,bind:this,"data-node-ref":"_updateAttachmentForm",onsubmit:t=>this._submitUpdateAttachment(t,e)},y("div",{class:F.metadata},v,A),f,y("div",{class:F.actions},h,b,u));return y("div",{class:F.formNode,key:"edit-form-container"},w,k)}_renderImageMask(e,t){return e?"file"in e?this._renderGenericImageMask(e.file.name,e.file.type):this._renderImageMaskForAttachment(e,t):null}_renderGenericImageMask(e,t){const{supportsResizeAttachments:s}=this.viewModel,i=m(t),a={[F.itemImageResizable]:s};return y("div",{class:this.classes(F.itemMaskIcon,F.itemMask),key:i},y("img",{alt:e,class:this.classes(a,F.itemImage),src:i,title:e}))}_renderImageMaskForAttachment(e,t){const{supportsResizeAttachments:s}=this.viewModel;if(!e)return null;const{contentType:i,name:a,size:n,url:l}=e;if(!s||!h(i))return this._renderGenericImageMask(a,i);const r=this._getCSSTransform(e),o=r?{transform:r,"image-orientation":"none"}:{},d=`${l}${l?.includes("?")?"&":"?"}w=${t}&s=${n}`,c={[F.itemImageResizable]:s};return y("div",{class:this.classes(F.itemMask),key:d},y("img",{alt:a,class:this.classes(c,F.itemImage),src:d,styles:o,title:a}))}_renderFile(e){const{file:t}=e;return y("li",{class:F.item,key:t},y("button",{"aria-label":this.messages.attachmentDetails,bind:this,class:F.itemButton,key:"details-button",onclick:()=>this._startEditFile(e),title:this.messages.attachmentDetails,type:"button"},this._renderImageMask(e),y("label",{class:F.itemLabel},y("span",{class:F.itemFilename},t.name||this.messages.noTitle),y("span",{"aria-hidden":"true",class:this.classes(F.itemChevronIcon,f(this.container)?b.left:b.right)}))))}_renderAttachmentInfo({attachmentInfo:e,displayType:t}){const{viewModel:s,effectiveDisplayType:i}=this,{capabilities:a,supportsResizeAttachments:n}=s,{contentType:l,name:r,url:o}=e,d=this._renderImageMask(e,"list"===t?48:400),c=a.editing?y("span",{"aria-hidden":"true",class:this.classes(F.itemChevronIcon,f(this.container)?b.left:b.right)}):null,m=[d,"preview"===i&&n&&h(l)?null:y("label",{class:F.itemLabel},y("span",{class:F.itemFilename},r||this.messages.noTitle),c)],u=a.editing?y("button",{"aria-label":this.messages.attachmentDetails,bind:this,class:F.itemButton,"data-attachment-info-id":e.id,key:"details-button",onclick:()=>this._startEditAttachment(e),title:this.messages.attachmentDetails,type:"button"},m):y("a",{class:F.itemButton,href:o??void 0,key:"details-link",rel:"noreferrer",target:"_blank"},m);return y("li",{class:F.item,key:e},u)}_renderAttachmentContainer(){const{effectiveDisplayType:e,viewModel:t,visibleElements:s}=this,{attachmentInfos:i,capabilities:a,fileInfos:n}=t,l=!!i?.length,r=!!n?.length,o={[F.containerList]:"preview"!==e,[F.containerPreview]:"preview"===e},d=a.editing&&a.operations?.add&&s.addButton?y("button",{bind:this,class:this.classes(p.button,p.buttonTertiary,F.addAttachmentButton),onclick:()=>this._startAddAttachment(),type:"button"},y("span",{"aria-hidden":"true",class:this.classes(F.itemAddIcon,b.plus)}),this.messages.add):void 0,c=l?y("ul",{class:F.items,key:"attachments-list"},i.toArray().map(t=>this._renderAttachmentInfo({attachmentInfo:t,displayType:e}))):void 0,m=r?y("ul",{class:F.items,key:"file-list"},n.toArray().map(e=>this._renderFile(e))):void 0,h=r||l?void 0:y("div",{class:p.empty},this.messages.noAttachments);return y("div",{class:this.classes(F.container,o),key:"attachments-container"},c,m,h,d)}_modeChanged(){this._set("error",null),this._set("selectedFile",null)}_handleFileInputChange(e){const t=e.target,s=t.files?.item(0);this._set("selectedFile",s)}_submitDeleteAttachment(e,t){e.preventDefault(),t&&("file"in t?this.deleteFile(t.file):t&&this.deleteAttachment(t))}_submitAddAttachment(e){e.preventDefault(),this.viewModel.filesEnabled?this.addFile():this.addAttachment()}_submitUpdateAttachment(e,t){e.preventDefault(),t&&"file"in t?this.updateFile():this.updateAttachment()}_startEditAttachment(e){const{viewModel:t}=this;t.activeFileInfo=null,t.activeAttachmentInfo=e,t.mode="edit"}_startEditFile(e){const{viewModel:t}=this;t.activeAttachmentInfo=null,t.activeFileInfo=e,t.mode="edit"}_startAddAttachment(){this.viewModel.mode="add"}_cancelForm(e){e.preventDefault(),this.viewModel.mode="view"}_getCSSTransform(e){const{orientationInfo:t}=e;return!this._supportsImageOrientation&&t?[t.rotation?`rotate(${t.rotation}deg)`:"",t.mirrored?"scaleX(-1)":""].join(" "):""}};e([l()],M.prototype,"capabilities",null),e([l()],M.prototype,"displayType",void 0),e([l({readOnly:!0})],M.prototype,"effectiveDisplayType",null),e([l()],M.prototype,"graphic",null),e([l()],M.prototype,"icon",null),e([l()],M.prototype,"label",null),e([l(),v("esri/widgets/Attachments/t9n/Attachments")],M.prototype,"messages",void 0),e([l(),v("esri/core/t9n/Units")],M.prototype,"messagesUnits",void 0),e([l({readOnly:!0})],M.prototype,"selectedFile",void 0),e([l({readOnly:!0})],M.prototype,"submitting",void 0),e([l({readOnly:!0})],M.prototype,"error",void 0),e([l({type:c})],M.prototype,"viewModel",void 0),e([l()],M.prototype,"visibleElements",void 0),e([r("visibleElements")],M.prototype,"castVisibleElements",null),M=e([o("esri.widgets.Attachments")],M);export{M as default};
5
+ import{__decorate as e}from"tslib";import t from"../core/Error.js";import{on as s,watch as i,initial as a}from"../core/reactiveUtils.js";import{formatFileSize as n}from"../core/unitFormatUtils.js";import{property as r}from"../core/accessorSupport/decorators/property.js";import{cast as l}from"../core/accessorSupport/decorators/cast.js";import"../core/has.js";import"../core/RandomLCG.js";import{subclass as o}from"../core/accessorSupport/decorators/subclass.js";import d from"./Widget.js";import c from"./Attachments/AttachmentsViewModel.js";import{getIconPath as m,isSupportedImage as h}from"./Attachments/support/attachmentUtils.js";import{loadCalciteComponents as u}from"./support/componentsUtils.js";import{globalCss as p}from"./support/globalCss.js";import{legacyIcon as b}from"./support/legacyIcon.js";import{discardNode as _,storeNode as g,isRTL as v}from"./support/widgetUtils.js";import{messageBundle as f}from"./support/decorators/messageBundle.js";import{tsx as y}from"./support/jsxFactory.js";import"@arcgis/toolkit/dom";const w={addButton:!0,addSubmitButton:!0,cancelAddButton:!0,cancelUpdateButton:!0,deleteButton:!0,errorMessage:!0,progressBar:!0,updateButton:!0},A="esri-attachments",M={base:A,loaderContainer:`${A}__loader-container`,loader:`${A}__loader`,container:`${A}__container`,containerList:`${A}__container--list`,containerPreview:`${A}__container--preview`,actions:`${A}__actions`,deleteButton:`${A}__delete-button`,addAttachmentButton:`${A}__add-attachment-button`,errorMessage:`${A}__error-message`,items:`${A}__items`,item:`${A}__item`,itemButton:`${A}__item-button`,itemMask:`${A}__item-mask`,itemMaskIcon:`${A}__item-mask--icon`,itemImage:`${A}__image`,itemImageResizable:`${A}__image--resizable`,itemLabel:`${A}__label`,itemFilename:`${A}__filename`,itemChevronIcon:`${A}__item-chevron-icon`,itemLink:`${A}__item-link`,itemLinkOverlay:`${A}__item-link-overlay`,itemLinkOverlayIcon:`${A}__item-link-overlay-icon`,itemAddIcon:`${A}__item-add-icon`,formNode:`${A}__form-node`,fileFieldset:`${A}__file-fieldset`,fileLabel:`${A}__file-label`,fileName:`${A}__file-name`,fileInput:`${A}__file-input`,metadata:`${A}__metadata`,metadataFieldset:`${A}__metadata-fieldset`,progressBar:`${A}__progress-bar`},F=window.CSS;let k=class extends d{constructor(e,t){super(e,t),this.displayType="auto",this.messages=null,this.messagesUnits=null,this.selectedFile=null,this.submitting=!1,this.viewModel=null,this.visibleElements={...w},this._supportsImageOrientation=F&&F.supports&&F.supports("image-orientation","from-image"),this._addAttachmentForm=null,this._updateAttachmentForm=null}normalizeCtorArgs(e){return e?.viewModel||(e={viewModel:new c,...e}),e}initialize(){this.addHandles([s(()=>this.viewModel?.attachmentInfos,"change",()=>this.scheduleRender()),s(()=>this.viewModel?.fileInfos,"change",()=>this.scheduleRender()),i(()=>this.viewModel?.mode,()=>this._modeChanged(),a)])}loadDependencies(){return u({icon:()=>import("@esri/calcite-components/dist/components/calcite-icon")})}get capabilities(){return this.viewModel.capabilities}set capabilities(e){this.viewModel.capabilities=e}get effectiveDisplayType(){const{displayType:e}=this;return e&&"auto"!==e?e:this.viewModel.supportsResizeAttachments?"preview":"list"}get attachmentKeywords(){return this.viewModel.attachmentKeywords}set attachmentKeywords(e){this.viewModel.attachmentKeywords=e}get attachmentTypes(){return this.viewModel.attachmentTypes}set attachmentTypes(e){this.viewModel.attachmentTypes=e}get graphic(){return this.viewModel.graphic}set graphic(e){this.viewModel.graphic=e}get icon(){return"attachment"}set icon(e){this._overrideIfSome("icon",e)}get label(){return this.messages?.widgetLabel??""}set label(e){this._overrideIfSome("label",e)}castVisibleElements(e){return{...w,...e}}addAttachment(){const{_addAttachmentForm:e,viewModel:s}=this;return this._set("submitting",!0),this._set("error",null),s.addAttachment(e).then(e=>(this._set("submitting",!1),this._set("error",null),s.mode="view",e)).catch(e=>{throw this._set("submitting",!1),this._set("error",new t("attachments:add-attachment",this.messages.addErrorMessage,e)),e})}deleteAttachment(e){const{viewModel:s}=this;return this._set("submitting",!0),this._set("error",null),s.deleteAttachment(e).then(e=>(this._set("submitting",!1),this._set("error",null),s.mode="view",e)).catch(e=>{throw this._set("submitting",!1),this._set("error",new t("attachments:delete-attachment",this.messages.deleteErrorMessage,e)),e})}updateAttachment(){const{viewModel:e}=this,{_updateAttachmentForm:s}=this;return this._set("submitting",!0),this._set("error",null),e.updateAttachment(s).then(t=>(this._set("submitting",!1),this._set("error",null),e.mode="view",t)).catch(e=>{throw this._set("submitting",!1),this._set("error",new t("attachments:update-attachment",this.messages.updateErrorMessage,e)),e})}addFile(){const e=this.viewModel.addFile(this.selectedFile,this._addAttachmentForm);return this.viewModel.mode="view",e}updateFile(){const{viewModel:e}=this,t=e.updateFile(this.selectedFile,this._updateAttachmentForm,e.activeFileInfo);return e.mode="view",t}deleteFile(e){const t=this.viewModel.deleteFile(e||this.viewModel.activeFileInfo?.file);return this.viewModel.mode="view",t}render(){const{submitting:e,viewModel:t}=this,{state:s}=t;return y("div",{class:this.classes(M.base,p.widget)},e?this._renderProgressBar():null,"loading"===s?this._renderLoading():this._renderAttachments(),this._renderErrorMessage())}_renderErrorMessage(){const{error:e,visibleElements:t}=this;return e&&t.errorMessage?y("div",{class:M.errorMessage,key:"error-message"},e.message):null}_renderAttachments(){const{activeFileInfo:e,mode:t,activeAttachmentInfo:s}=this.viewModel;return"add"===t?this._renderAddForm():"edit"===t?this._renderDetailsForm(s||e):this._renderAttachmentContainer()}_renderLoading(){return y("div",{class:M.loaderContainer,key:"loader"},y("div",{class:M.loader}))}_renderProgressBar(){return this.visibleElements.progressBar?y("div",{class:M.progressBar,key:"progress-bar"}):null}_renderAddForm(){const{submitting:e,selectedFile:t}=this,s=e||!t,i=this.visibleElements.cancelAddButton?y("button",{bind:this,class:this.classes(p.button,p.buttonTertiary,p.buttonSmall,p.buttonHalf,e&&p.buttonDisabled),disabled:e,onclick:this._cancelForm,type:"button"},this.messages.cancel):null,a=this.visibleElements.addSubmitButton?y("button",{class:this.classes(p.button,p.buttonSecondary,p.buttonSmall,p.buttonHalf,{[p.buttonDisabled]:s}),disabled:s,type:"submit"},this.messages.add):null,n=t?y("span",{class:M.fileName,key:"file-name"},t.name):null,r=y("form",{afterCreate:g,afterRemoved:_,bind:this,"data-node-ref":"_addAttachmentForm",onsubmit:this._submitAddAttachment},y("fieldset",{class:M.fileFieldset},n,y("label",{class:this.classes(M.fileLabel,p.button,p.buttonSecondary)},t?this.messages.changeFile:this.messages.selectFile,y("input",{bind:this,class:M.fileInput,name:"attachment",onchange:this._handleFileInputChange,type:"file"}))),a,i);return y("div",{class:M.formNode,key:"add-form-container"},r)}_renderDetailsForm(e){const{visibleElements:t,viewModel:s,selectedFile:i,submitting:a}=this,{capabilities:r}=s,l=a||!i;let o,d,c,m;i?(o=i.type,d=i.name,c=i.size):e&&"file"in e?(o=e.file.type,d=e.file.name,c=e.file.size):e&&"contentType"in e&&(o=e.contentType,d=e.name,c=e.size,m=e.url);const h=r.editing&&r.operations?.delete&&t.deleteButton?y("button",{bind:this,class:this.classes(p.button,p.buttonSmall,p.buttonTertiary,M.deleteButton,{[p.buttonDisabled]:a}),disabled:a,key:"delete-button",onclick:t=>this._submitDeleteAttachment(t,e),type:"button"},this.messages.delete):void 0,u=r.editing&&r.operations?.update&&t.updateButton?y("button",{class:this.classes(p.button,p.buttonSmall,p.buttonThird,{[p.buttonDisabled]:l}),disabled:l,key:"update-button",type:"submit"},this.messages.update):void 0,b=this.visibleElements.cancelUpdateButton?y("button",{bind:this,class:this.classes(p.button,p.buttonSmall,p.buttonTertiary,p.buttonThird,{[p.buttonDisabled]:a}),disabled:a,key:"cancel-button",onclick:this._cancelForm,type:"button"},this.messages.cancel):void 0,v=r.editing&&r.operations?.update?y("fieldset",{class:M.fileFieldset,key:"file"},y("span",{class:M.fileName,key:"file-name"},d),y("label",{class:this.classes(M.fileLabel,p.button,p.buttonSecondary)},this.messages.changeFile,y("input",{bind:this,class:M.fileInput,name:"attachment",onchange:this._handleFileInputChange,type:"file"}))):void 0,f=y("fieldset",{class:M.metadataFieldset,key:"size"},y("label",null,n(this.messagesUnits,c??0))),w=y("fieldset",{class:M.metadataFieldset,key:"content-type"},y("label",null,o)),A=null!=m?y("a",{class:M.itemLink,href:m,rel:"noreferrer",target:"_blank"},this._renderImageMask(e,400),y("div",{class:M.itemLinkOverlay},y("span",{class:M.itemLinkOverlayIcon},y("calcite-icon",{icon:"launch"})))):this._renderImageMask(e,400),F=y("form",{afterCreate:g,afterRemoved:_,bind:this,"data-node-ref":"_updateAttachmentForm",onsubmit:t=>this._submitUpdateAttachment(t,e)},y("div",{class:M.metadata},f,w),v,y("div",{class:M.actions},h,b,u));return y("div",{class:M.formNode,key:"edit-form-container"},A,F)}_renderImageMask(e,t){return e?"file"in e?this._renderGenericImageMask(e.file.name,e.file.type):this._renderImageMaskForAttachment(e,t):null}_renderGenericImageMask(e,t){const{supportsResizeAttachments:s}=this.viewModel,i=m(t),a={[M.itemImageResizable]:s};return y("div",{class:this.classes(M.itemMaskIcon,M.itemMask),key:i},y("img",{alt:e,class:this.classes(a,M.itemImage),src:i,title:e}))}_renderImageMaskForAttachment(e,t){const{supportsResizeAttachments:s}=this.viewModel;if(!e)return null;const{contentType:i,name:a,size:n,url:r}=e;if(!s||!h(i))return this._renderGenericImageMask(a,i);const l=this._getCSSTransform(e),o=l?{transform:l,"image-orientation":"none"}:{},d=`${r}${r?.includes("?")?"&":"?"}w=${t}&s=${n}`,c={[M.itemImageResizable]:s};return y("div",{class:this.classes(M.itemMask),key:d},y("img",{alt:a,class:this.classes(c,M.itemImage),src:d,styles:o,title:a}))}_renderFile(e){const{file:t}=e;return y("li",{class:M.item,key:t},y("button",{"aria-label":this.messages.attachmentDetails,bind:this,class:M.itemButton,key:"details-button",onclick:()=>this._startEditFile(e),title:this.messages.attachmentDetails,type:"button"},this._renderImageMask(e),y("label",{class:M.itemLabel},y("span",{class:M.itemFilename},t.name||this.messages.noTitle),y("span",{"aria-hidden":"true",class:this.classes(M.itemChevronIcon,v(this.container)?b.left:b.right)}))))}_renderAttachmentInfo({attachmentInfo:e,displayType:t}){const{viewModel:s,effectiveDisplayType:i}=this,{capabilities:a,supportsResizeAttachments:n}=s,{contentType:r,name:l,url:o}=e,d=this._renderImageMask(e,"list"===t?48:400),c=a.editing?y("span",{"aria-hidden":"true",class:this.classes(M.itemChevronIcon,v(this.container)?b.left:b.right)}):null,m=[d,"preview"===i&&n&&h(r)?null:y("label",{class:M.itemLabel},y("span",{class:M.itemFilename},l||this.messages.noTitle),c)],u=a.editing?y("button",{"aria-label":this.messages.attachmentDetails,bind:this,class:M.itemButton,"data-attachment-info-id":e.id,key:"details-button",onclick:()=>this._startEditAttachment(e),title:this.messages.attachmentDetails,type:"button"},m):y("a",{class:M.itemButton,href:o??void 0,key:"details-link",rel:"noreferrer",target:"_blank"},m);return y("li",{class:M.item,key:e},u)}_renderAttachmentContainer(){const{effectiveDisplayType:e,viewModel:t,visibleElements:s}=this,{attachmentInfos:i,capabilities:a,fileInfos:n}=t,r=!!i?.length,l=!!n?.length,o={[M.containerList]:"preview"!==e,[M.containerPreview]:"preview"===e},d=a.editing&&a.operations?.add&&s.addButton?y("button",{bind:this,class:this.classes(p.button,p.buttonTertiary,M.addAttachmentButton),onclick:()=>this._startAddAttachment(),type:"button"},y("span",{"aria-hidden":"true",class:this.classes(M.itemAddIcon,b.plus)}),this.messages.add):void 0,c=r?y("ul",{class:M.items,key:"attachments-list"},i.toArray().map(t=>this._renderAttachmentInfo({attachmentInfo:t,displayType:e}))):void 0,m=l?y("ul",{class:M.items,key:"file-list"},n.toArray().map(e=>this._renderFile(e))):void 0,h=l||r?void 0:y("div",{class:p.empty},this.messages.noAttachments);return y("div",{class:this.classes(M.container,o),key:"attachments-container"},c,m,h,d)}_modeChanged(){this._set("error",null),this._set("selectedFile",null)}_handleFileInputChange(e){const t=e.target,s=t.files?.item(0);this._set("selectedFile",s)}_submitDeleteAttachment(e,t){e.preventDefault(),t&&("file"in t?this.deleteFile(t.file):t&&this.deleteAttachment(t))}_submitAddAttachment(e){e.preventDefault(),this.viewModel.filesEnabled?this.addFile():this.addAttachment()}_submitUpdateAttachment(e,t){e.preventDefault(),t&&"file"in t?this.updateFile():this.updateAttachment()}_startEditAttachment(e){const{viewModel:t}=this;t.activeFileInfo=null,t.activeAttachmentInfo=e,t.mode="edit"}_startEditFile(e){const{viewModel:t}=this;t.activeAttachmentInfo=null,t.activeFileInfo=e,t.mode="edit"}_startAddAttachment(){this.viewModel.mode="add"}_cancelForm(e){e.preventDefault(),this.viewModel.mode="view"}_getCSSTransform(e){const{orientationInfo:t}=e;return!this._supportsImageOrientation&&t?[t.rotation?`rotate(${t.rotation}deg)`:"",t.mirrored?"scaleX(-1)":""].join(" "):""}};e([r()],k.prototype,"capabilities",null),e([r()],k.prototype,"displayType",void 0),e([r({readOnly:!0})],k.prototype,"effectiveDisplayType",null),e([r()],k.prototype,"attachmentKeywords",null),e([r()],k.prototype,"attachmentTypes",null),e([r()],k.prototype,"graphic",null),e([r()],k.prototype,"icon",null),e([r()],k.prototype,"label",null),e([r(),f("esri/widgets/Attachments/t9n/Attachments")],k.prototype,"messages",void 0),e([r(),f("esri/core/t9n/Units")],k.prototype,"messagesUnits",void 0),e([r({readOnly:!0})],k.prototype,"selectedFile",void 0),e([r({readOnly:!0})],k.prototype,"submitting",void 0),e([r({readOnly:!0})],k.prototype,"error",void 0),e([r({type:c})],k.prototype,"viewModel",void 0),e([r()],k.prototype,"visibleElements",void 0),e([l("visibleElements")],k.prototype,"castVisibleElements",null),k=e([o("esri.widgets.Attachments")],k);export{k 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.34/esri/copyright.txt for details.
4
4
  */
5
- import{R as t,D as i}from"../../../chunks/ResponsiveTheme.js";import"../../../intl.js";import{handlesGroup as e,makeHandle as o}from"../../../core/handleUtils.js";import"../../../core/has.js";import{throwIfAborted as n}from"../../../core/promiseUtils.js";import{signal as s}from"../../../core/signal.js";import{unitName as a,formatDecimal as l}from"../../../core/unitFormatUtils.js";import{convertUnit as r}from"../../../core/unitUtils.js";import{getEpsilon as d}from"../../../core/libs/gl-matrix-2/math/common.js";import{getConfig as c,notAvailable as p}from"./constants.js";import{getTranslatedLineTitle as m}from"./intlUtils.js";import{niceScale as u}from"./niceScale.js";import{binaryFindClosest as f}from"./profileUtils.js";import{c as x,N as g}from"../../../chunks/chartUtilsAm5.js";import{isRTL as h}from"../../support/widgetUtils.js";import{isDarkMode as A}from"../../../support/modeUtils.js";import{X as v,V as b,A as y,b as T,a as L,L as M}from"../../../chunks/LineSeries.js";import{b as S,d as F,a as P,C as k}from"../../../chunks/Theme.js";import{T as X}from"../../../chunks/Tooltip.js";import{formatNumber as Y}from"../../../intl/number.js";import{substitute as z}from"../../../intl/substitute.js";const C="#f8f8f8",j="#a9a9a9",w="#323232",H="line",B="fill",U=15,D=12,R=.001,O=.1,W=.02,G={fontFamily:"Avenir Next",paddingBottom:D/2,paddingLeft:0,paddingRight:0,paddingTop:0,axisGridStroke:"#f4f4f4",axisLabelsFontSize:9,axisLabelsFontWeight:"400",axisLabelsColor:j,axisTooltipFontSize:12,axisTooltipBackgroundColor:w,axisTooltipLabelColor:C,axisTooltipPaddingTop:Math.round(D/4),axisTooltipPaddingBottom:Math.round(D/4),axisTooltipPaddingHorizontal:Math.round(U/4),xAxisMinGridDistance:50,xAxisLabelsSpacing:Math.round(D/2),xAxisMinLabelPosition:.05,xAxisMaxLabelPosition:.9,yAxisMinGridDistance:30,yAxisLabelSpacing:Math.round(U/4),yAxisMinLabelPosition:0,yAxisMaxLabelPosition:.8,seriesTooltipFontSize:12,seriesTooltipBackgroundColor:C,seriesTooltipLabelColor:w,seriesFillLighten:.9,seriesTooltipSpacing:D/2,seriesTooltipPaddingVertical:Math.round(U/4),seriesTooltipPaddingHorizontal:Math.round(U/4)},V={...G,axisGridStroke:w,axisLabelsColor:j,axisTooltipBackgroundColor:w,axisTooltipLabelColor:C,seriesTooltipBackgroundColor:w,seriesTooltipLabelColor:C,seriesFillLighten:-.75},E={minX:void 0,maxX:void 0,minY:void 0,maxY:void 0};async function I(o){const a=await x(o.container);n(o.abortOptions);const l=A(o.container),r=l?V:G;a.setThemes(l?[t.new(a),i.new(a)]:[t.new(a)]);const d=h(o.container),c=a.container.children.push(v.new(a,{panX:!0,panY:!0,paddingTop:r.paddingTop,paddingBottom:r.paddingBottom,paddingLeft:d?r.paddingRight:r.paddingLeft,paddingRight:d?r.paddingLeft:r.paddingRight,maxTooltipDistance:-1}));c.zoomOutButton.set("forceHidden",!0);const p=c.xAxes.push(b.new(a,{renderer:y.new(a,{})})),m=c.yAxes.push(b.new(a,{renderer:T.new(a,{})})),u=s(null),f=s("loading"),g={chart:c,xAxis:p,yAxis:m,seriesInfos:new Map,messages:null,theme:r,pointerIsOver:!1,rtl:d,get state(){return f.value},get data(){return u.value},set data(t){u.value=t}};Z(g),q(g),N(g);const L=e([lt(g,o.onRangeChange),dt(g,o.onCursorPositionChange),yt(a.events.once("frameended",()=>{f.value="ready"})),yt(a)]);let M;return{destroy:()=>{L.remove(),f.value="destroyed"},update:t=>{t.data===g.data&&t.messages===g.messages||$(g)||J(g,t)},zoomOut:()=>K(g),test:M}}function $(t){return"destroyed"===t.state}function N({chart:t,xAxis:i,yAxis:e}){const o=L.new(t.root,{behavior:"none",xAxis:i,yAxis:e,snapToSeriesBy:"y"});o.lineY.set("visible",!1),t.set("cursor",o)}function Z(t){const{chart:i,xAxis:e,theme:o}=t;e.setAll({extraMax:0,extraMin:0,maxDeviation:0,numberFormatter:gt(t,"distance"),strictMinMax:!0,strictMinMaxSelection:!0}),e.axisHeader.set("forceHidden",!0);const n=e.get("renderer");n.setAll({inside:!1,minGridDistance:o.xAxisMinGridDistance}),n.labels.template.setAll({centerX:F,centerY:F,fill:S(o.axisLabelsColor),fontFamily:o.fontFamily,fontSize:o.axisLabelsFontSize,fontWeight:o.axisLabelsFontWeight,maxPosition:o.xAxisMaxLabelPosition,minPosition:o.xAxisMinLabelPosition,paddingLeft:0,paddingRight:0,paddingTop:o.xAxisLabelsSpacing});const s=e.set("tooltip",X.new(i.root,{paddingBottom:0,paddingLeft:0,paddingRight:0,paddingTop:0}));s.get("background")?.setAll({fill:S(o.axisTooltipBackgroundColor),stroke:void 0}),s.label.setAll({fill:S(o.axisTooltipLabelColor),fontFamily:o.fontFamily,fontSize:o.axisTooltipFontSize,paddingBottom:o.axisTooltipPaddingBottom,paddingLeft:o.axisTooltipPaddingHorizontal,paddingRight:o.axisTooltipPaddingHorizontal,paddingTop:o.axisTooltipPaddingTop,direction:t.rtl?"rtl":"ltr"}),n.grid.template.setAll({strokeOpacity:1,stroke:S(o.axisGridStroke)})}function q(t){const{yAxis:i,theme:e,rtl:o}=t;i.setAll({baseValue:c().noDataValue,extraMax:0,extraMin:0,maxDeviation:0,numberFormatter:gt(t,"elevation"),strictMinMax:!0,strictMinMaxSelection:!0,tooltip:void 0}),i.axisHeader.set("visible",!1);const n=i.get("renderer");n.setAll({minGridDistance:e.yAxisMinGridDistance,opposite:o,inside:!0}),n.labels.template.setAll({centerX:F,centerY:P,fill:S(e.axisLabelsColor),fontFamily:e.fontFamily,fontSize:e.axisLabelsFontSize,fontWeight:e.axisLabelsFontWeight,maxPosition:e.yAxisMaxLabelPosition,minPosition:e.yAxisMinLabelPosition,paddingBottom:0,paddingLeft:o?0:e.yAxisLabelSpacing,paddingRight:o?e.yAxisLabelSpacing:0,paddingTop:0,textAlign:"start"}),n.grid.template.setAll({strokeOpacity:1,stroke:S(e.axisGridStroke)})}function J(t,i){if($(t))return;const e=t.data??void 0,o=i.data??void 0;t.chart.get("cursor")?.set("forceHidden",!o?.refined);const n=e!==o,s=e?.effectiveUnits!==o?.effectiveUnits,a=e?.uniformScaling!==o?.uniformScaling;t.data=o,t.messages=i.messages,(n||s)&&(Q(t),et(t)),a&&K(t),pt(t)}function K(t){$(t)||(t.xAxis.zoom(0,1),t.yAxis.zoom(0,1))}function Q(t){const{chart:i,data:e,xAxis:o,yAxis:n}=t,{minX:s,maxX:a,minY:l,maxY:r}=_({data:e,pixelWidth:o.width(),pixelHeight:n.height()}),d=!!e?.uniformScaling,c=!!e?.refined;i.setAll({panX:!0,panY:d,pinchZoomX:c,pinchZoomY:c&&d,wheelX:"panX",wheelY:c?d?"zoomXY":"zoomX":"none"}),o.setAll({max:a,min:s,panX:!0,panY:!1,zoomX:!0,zoomY:d}),n.setAll({max:r,min:l,panX:!1,panY:d,zoomX:d,zoomY:d})}function _({data:t,pixelWidth:i,pixelHeight:e}){if(null==t)return E;const o=t.statistics,n=0,s=o?.maxDistance;let a=o?.minElevation,l=o?.maxElevation;if(null==s||null==a||null==l)return E;const d=Math.max(s-n,R);let p=Math.max(l-a,R);const m=t.effectiveUnits;if(t.dynamicElevationRange){const t=r(d,m.distance,m.elevation);p=Math.max(p,t/c().maxChartRatio)}return a-=W*p,l=a+p+O*p,[a,l]=u(a,l,10),p=l-a,t.uniformScaling?tt({data:t,bounds:{minX:n,maxX:s,minY:a,maxY:l},pixelWidth:i,pixelHeight:e,centered:!0}):{minX:n,maxX:n+d,minY:a,maxY:a+p}}function tt({data:t,bounds:i,pixelWidth:e,pixelHeight:o,centered:n}){if(null==t)return i;let{minX:s,maxX:a,minY:l,maxY:d}=i;if(null==s||null==a||null==l||null==d)return E;const c=a-s,p=d-l,m=t.effectiveUnits,u=r(p,m.elevation,m.distance)/o/(c/e);return u>=1?[s,a]=it([s,a],u):[l,d]=it([l,d],1/u),{minX:s,maxX:a,minY:l,maxY:d}}function it([t,i],e,o){const n=(i-t)*e;{const e=(t+i)/2-n/2;return[e,e+n]}}function et(t){const{chart:i,data:e,seriesInfos:o,xAxis:n,yAxis:s}=t;if(null==e||0===e.lines.length)return void i.series.clear();const a=new Map,l=new Set(i.series.values),r=e.lines.length;for(let d=0;d<r;d++){const n=e.lines[d];let s=o.get(n.id);s?(s.fill&&l.delete(s.fill),l.delete(s.line)):(s=nt(t,n),s.fill&&i.series.push(s.fill),i.series.push(s.line)),a.set(s.id,s);const c=r-d-1;s.fill?.set("layer",c),s.line.set("layer",r+c),ot(t,s,n)}t.seriesInfos=a;for(const d of l)i.series.removeValue(d);n.set("layer",r+1),s.set("layer",r+2)}function ot({theme:t},i,e){const o=S(e.color.toCss()),n=e.samples??[],s=n.length>0,{line:a,fill:l}=i;a.set("visible",s),a.set("stroke",o),l?.set("visible",s),l?.set("fill",k.lighten(o,t.seriesFillLighten)),a.data.setAll(n),l?.data.setAll(n)}function nt(t,i){const{id:e}=i,o=st(t,`${H}-${e}`),n=at(t);o.setAll({dy:i.chartStrokeOffsetY,tooltip:n}),o.strokes.template.setAll({strokeWidth:i.chartStrokeWidth});let s=null;return i.chartFillEnabled&&(s=st(t,`${B}-${e}`),s.fills.template.setAll({fillOpacity:1,visible:!0})),{id:e,line:o,fill:s}}function st(t,i){return M.new(t.chart.root,{connect:!1,excludeFromTotal:!0,fill:void 0,id:i,stroke:void 0,valueXField:"distance",valueYField:"elevation",xAxis:t.xAxis,yAxis:t.yAxis})}function at({theme:t,chart:i,rtl:e}){const o=X.new(i.root,{autoTextColor:!1,forceHidden:!0,getFillFromSprite:!1,getLabelFillFromSprite:!1,pointerOrientation:"vertical",visible:!1}),n=t.seriesTooltipPaddingHorizontal,s=t.seriesTooltipPaddingVertical;return o.label.setAll({fill:S(t.seriesTooltipLabelColor),fontFamily:t.fontFamily,fontSize:t.seriesTooltipFontSize,paddingBottom:s,paddingLeft:n,paddingRight:n,paddingTop:s,textAlign:e?"end":"start",direction:"ltr"}),o.get("background")?.setAll({stroke:void 0,fill:S(t.seriesTooltipBackgroundColor)}),o.adapters.add("dy",i=>{const e=t.seriesTooltipSpacing,n=o.get("pointTo")?.y??0;return(i??0)+(o.y()>n?e:-e)}),o}function lt(t,i){const{xAxis:e,yAxis:o}=t,n=()=>{i(rt(e),rt(o))},s=t=>[t.on("start",n),t.on("end",n)];return bt([...s(e),...s(o)])}function rt(t){const i=Math.abs((t.get("end")??0)-(t.get("start")??0)),e=0!==i?1/i:1;return Math.abs(1-e)<d()?1:e}function dt(t,i){const{chart:e,xAxis:o,yAxis:n}=t,s=e.get("cursor"),a=e.plotContainer.events,l=i=>{t.pointerIsOver=i,pt(t)},r=()=>{l(!1),i(null,null)};return bt([s?.events.on("cursormoved",()=>{if(!t.pointerIsOver)return;pt(t);let e=s?.getPrivate("positionX")??0,a=s?.getPrivate("positionY")??0;const l=t.data;if(null!=l?.statistics){const{maxDistance:t,minElevation:i,maxElevation:s}=l.statistics;let r,d;if(null!=t){1===rt(o)?(r=0,d=t):(r=At(o),d=vt(o)),e=ct(e,r,d,0,t)}if(null!=i&&null!=s){1===rt(n)?(r=i,d=s):(r=At(n),d=vt(n)),a=ct(a,r,d,i,s)}}i(e,a)}),a.on("pointerover",()=>l(!0)),a.on("pointerout",r),a.on("blur",r)])}function ct(t,i,e,o,n){return(i+t*(e-i)-o)/(n-o)}function pt(t){const i=mt(t);if(!i)return void t.seriesInfos.forEach(t=>{t.line.get("tooltip")?.set("forceHidden",!0)});t.seriesInfos.forEach(t=>{const e=t.line.get("tooltip");e.set("forceHidden",!1),e.label.set("text",i)});t.xAxis.getTooltip().setAll({tooltipText:xt(t)})}function mt(t){const{data:i}=t,e=i?.lines.map(i=>({line:i,y:ht(t,i)?.elevation})).sort(ut);return e&&0!==e.length&&null!=e[0].y?e.map(({y:i,line:e})=>ft(t,e,i)).join("\n"):null}function ut({y:t},{y:i}){return null==t?1:null==i?-1:i-t}function ft(t,i,e){const{data:o,messages:n}=t;if(null==o||null==n)return"";const s=`[${i.color.toHex()}]●[/]`,a=" ",r=c().formatPrecision,d=z(n.chartTooltip,{name:m(i,n),elevation:null!=e?l(n,e,o.effectiveUnits.elevation,r):p});return t.rtl?d+a+s:s+a+d}function xt(t){const{data:i,messages:e}=t;if(null==i||null==e)return"";const o=i.lines[0],n=o?ht(t,o):null,s=c().formatPrecision;return null!=n?l(e,n.distance,i.effectiveUnits.distance,s):"-"}function gt(t,i){const e=g.new(t.chart.root,{});return e.format=(e,o,n)=>{const{data:s,messages:l}=t;if(null==l||null==s||"string"==typeof e)return"";return`${Y(e,{maximumFractionDigits:n})} ${a(l,s.effectiveUnits[i],"abbr")}`},e}function ht({chart:t,xAxis:i},e){const o=e.samples??[];if(0===o.length)return null;const n=t.get("cursor"),s=n?.getPrivate("positionX")??0,a=i.toAxisPosition(s),l=i.positionToValue(a);return f(o,l,t=>t.distance)}function At(t){return t.positionToValue(t.get("start")??0)}function vt(t){return t.positionToValue(t.get("end")??1)}function bt(t){return e(t.map(yt))}function yt(t){return o(()=>{t?.dispose()})}export{I as createChart,_ as getAdjustedBounds};
5
+ import*as t from"@amcharts/amcharts5/index.js";import{XYChart as i,ValueAxis as e,AxisRendererX as o,AxisRendererY as n,XYCursor as s,LineSeries as a}from"@amcharts/amcharts5/xy.js";import l from"@amcharts/amcharts5/themes/Dark.js";import r from"@amcharts/amcharts5/themes/Responsive.js";import"../../../intl.js";import{handlesGroup as d,makeHandle as c}from"../../../core/handleUtils.js";import"../../../core/has.js";import{throwIfAborted as p}from"../../../core/promiseUtils.js";import{signal as m}from"../../../core/signal.js";import{unitName as u,formatDecimal as x}from"../../../core/unitFormatUtils.js";import{convertUnit as f}from"../../../core/unitUtils.js";import{getEpsilon as g}from"../../../core/libs/gl-matrix-2/math/common.js";import{getConfig as h,notAvailable as A}from"./constants.js";import{getTranslatedLineTitle as v}from"./intlUtils.js";import{niceScale as b}from"./niceScale.js";import{binaryFindClosest as y}from"./profileUtils.js";import{createRoot as T}from"../../support/chartUtilsAm5.js";import{isRTL as L}from"../../support/widgetUtils.js";import{isDarkMode as M}from"../../../support/modeUtils.js";import{formatNumber as F}from"../../../intl/number.js";import{substitute as S}from"../../../intl/substitute.js";const P="#f8f8f8",X="#a9a9a9",Y="#323232",z="line",k="fill",C=15,j=12,w=.001,H=.1,B=.02,U={fontFamily:"Avenir Next",paddingBottom:j/2,paddingLeft:0,paddingRight:0,paddingTop:0,axisGridStroke:"#f4f4f4",axisLabelsFontSize:9,axisLabelsFontWeight:"400",axisLabelsColor:X,axisTooltipFontSize:12,axisTooltipBackgroundColor:Y,axisTooltipLabelColor:P,axisTooltipPaddingTop:Math.round(j/4),axisTooltipPaddingBottom:Math.round(j/4),axisTooltipPaddingHorizontal:Math.round(C/4),xAxisMinGridDistance:50,xAxisLabelsSpacing:Math.round(j/2),xAxisMinLabelPosition:.05,xAxisMaxLabelPosition:.9,yAxisMinGridDistance:30,yAxisLabelSpacing:Math.round(C/4),yAxisMinLabelPosition:0,yAxisMaxLabelPosition:.8,seriesTooltipFontSize:12,seriesTooltipBackgroundColor:P,seriesTooltipLabelColor:Y,seriesFillLighten:.9,seriesTooltipSpacing:j/2,seriesTooltipPaddingVertical:Math.round(C/4),seriesTooltipPaddingHorizontal:Math.round(C/4)},D={...U,axisGridStroke:Y,axisLabelsColor:X,axisTooltipBackgroundColor:Y,axisTooltipLabelColor:P,seriesTooltipBackgroundColor:Y,seriesTooltipLabelColor:P,seriesFillLighten:-.75},R={minX:void 0,maxX:void 0,minY:void 0,maxY:void 0};async function O(t){const s=await T(t.container);p(t.abortOptions);const a=M(t.container),c=a?D:U;s.setThemes(a?[r.new(s),l.new(s)]:[r.new(s)]);const u=L(t.container),x=s.container.children.push(i.new(s,{panX:!0,panY:!0,paddingTop:c.paddingTop,paddingBottom:c.paddingBottom,paddingLeft:u?c.paddingRight:c.paddingLeft,paddingRight:u?c.paddingLeft:c.paddingRight,maxTooltipDistance:-1}));x.zoomOutButton.set("forceHidden",!0);const f=x.xAxes.push(e.new(s,{renderer:o.new(s,{})})),g=x.yAxes.push(e.new(s,{renderer:n.new(s,{})})),h=m(null),A=m("loading"),v={chart:x,xAxis:f,yAxis:g,seriesInfos:new Map,messages:null,theme:c,pointerIsOver:!1,rtl:u,get state(){return A.value},get data(){return h.value},set data(t){h.value=t}};E(v),I(v),G(v);const b=d([et(v,t.onRangeChange),nt(v,t.onCursorPositionChange),gt(s.events.once("frameended",()=>{A.value="ready"})),gt(s)]);let y;return{destroy:()=>{b.remove(),A.value="destroyed"},update:t=>{t.data===v.data&&t.messages===v.messages||W(v)||V(v,t)},zoomOut:()=>$(v),test:y}}function W(t){return"destroyed"===t.state}function G({chart:t,xAxis:i,yAxis:e}){const o=s.new(t.root,{behavior:"none",xAxis:i,yAxis:e,snapToSeriesBy:"y"});o.lineY.set("visible",!1),t.set("cursor",o)}function E(i){const{chart:e,xAxis:o,theme:n}=i;o.setAll({extraMax:0,extraMin:0,maxDeviation:0,numberFormatter:pt(i,"distance"),strictMinMax:!0,strictMinMaxSelection:!0}),o.axisHeader.set("forceHidden",!0);const s=o.get("renderer");s.setAll({inside:!1,minGridDistance:n.xAxisMinGridDistance}),s.labels.template.setAll({centerX:t.p0,centerY:t.p0,fill:t.color(n.axisLabelsColor),fontFamily:n.fontFamily,fontSize:n.axisLabelsFontSize,fontWeight:n.axisLabelsFontWeight,maxPosition:n.xAxisMaxLabelPosition,minPosition:n.xAxisMinLabelPosition,paddingLeft:0,paddingRight:0,paddingTop:n.xAxisLabelsSpacing});const a=o.set("tooltip",t.Tooltip.new(e.root,{paddingBottom:0,paddingLeft:0,paddingRight:0,paddingTop:0}));a.get("background")?.setAll({fill:t.color(n.axisTooltipBackgroundColor),stroke:void 0}),a.label.setAll({fill:t.color(n.axisTooltipLabelColor),fontFamily:n.fontFamily,fontSize:n.axisTooltipFontSize,paddingBottom:n.axisTooltipPaddingBottom,paddingLeft:n.axisTooltipPaddingHorizontal,paddingRight:n.axisTooltipPaddingHorizontal,paddingTop:n.axisTooltipPaddingTop,direction:i.rtl?"rtl":"ltr"}),s.grid.template.setAll({strokeOpacity:1,stroke:t.color(n.axisGridStroke)})}function I(i){const{yAxis:e,theme:o,rtl:n}=i;e.setAll({baseValue:h().noDataValue,extraMax:0,extraMin:0,maxDeviation:0,numberFormatter:pt(i,"elevation"),strictMinMax:!0,strictMinMaxSelection:!0,tooltip:void 0}),e.axisHeader.set("visible",!1);const s=e.get("renderer");s.setAll({minGridDistance:o.yAxisMinGridDistance,opposite:n,inside:!0}),s.labels.template.setAll({centerX:t.p0,centerY:t.p100,fill:t.color(o.axisLabelsColor),fontFamily:o.fontFamily,fontSize:o.axisLabelsFontSize,fontWeight:o.axisLabelsFontWeight,maxPosition:o.yAxisMaxLabelPosition,minPosition:o.yAxisMinLabelPosition,paddingBottom:0,paddingLeft:n?0:o.yAxisLabelSpacing,paddingRight:n?o.yAxisLabelSpacing:0,paddingTop:0,textAlign:"start"}),s.grid.template.setAll({strokeOpacity:1,stroke:t.color(o.axisGridStroke)})}function V(t,i){if(W(t))return;const e=t.data??void 0,o=i.data??void 0;t.chart.get("cursor")?.set("forceHidden",!o?.refined);const n=e!==o,s=e?.effectiveUnits!==o?.effectiveUnits,a=e?.uniformScaling!==o?.uniformScaling;t.data=o,t.messages=i.messages,(n||s)&&(N(t),K(t)),a&&$(t),at(t)}function $(t){W(t)||(t.xAxis.zoom(0,1),t.yAxis.zoom(0,1))}function N(t){const{chart:i,data:e,xAxis:o,yAxis:n}=t,{minX:s,maxX:a,minY:l,maxY:r}=Z({data:e,pixelWidth:o.width(),pixelHeight:n.height()}),d=!!e?.uniformScaling,c=!!e?.refined;i.setAll({panX:!0,panY:d,pinchZoomX:c,pinchZoomY:c&&d,wheelX:"panX",wheelY:c?d?"zoomXY":"zoomX":"none"}),o.setAll({max:a,min:s,panX:!0,panY:!1,zoomX:!0,zoomY:d}),n.setAll({max:r,min:l,panX:!1,panY:d,zoomX:d,zoomY:d})}function Z({data:t,pixelWidth:i,pixelHeight:e}){if(null==t)return R;const o=t.statistics,n=0,s=o?.maxDistance;let a=o?.minElevation,l=o?.maxElevation;if(null==s||null==a||null==l)return R;const r=Math.max(s-n,w);let d=Math.max(l-a,w);const c=t.effectiveUnits;if(t.dynamicElevationRange){const t=f(r,c.distance,c.elevation);d=Math.max(d,t/h().maxChartRatio)}return a-=B*d,l=a+d+H*d,[a,l]=b(a,l,10),d=l-a,t.uniformScaling?q({data:t,bounds:{minX:n,maxX:s,minY:a,maxY:l},pixelWidth:i,pixelHeight:e,centered:!0}):{minX:n,maxX:n+r,minY:a,maxY:a+d}}function q({data:t,bounds:i,pixelWidth:e,pixelHeight:o,centered:n}){if(null==t)return i;let{minX:s,maxX:a,minY:l,maxY:r}=i;if(null==s||null==a||null==l||null==r)return R;const d=a-s,c=r-l,p=t.effectiveUnits,m=f(c,p.elevation,p.distance)/o/(d/e);return m>=1?[s,a]=J([s,a],m):[l,r]=J([l,r],1/m),{minX:s,maxX:a,minY:l,maxY:r}}function J([t,i],e,o){const n=(i-t)*e;{const e=(t+i)/2-n/2;return[e,e+n]}}function K(t){const{chart:i,data:e,seriesInfos:o,xAxis:n,yAxis:s}=t;if(null==e||0===e.lines.length)return void i.series.clear();const a=new Map,l=new Set(i.series.values),r=e.lines.length;for(let d=0;d<r;d++){const n=e.lines[d];let s=o.get(n.id);s?(s.fill&&l.delete(s.fill),l.delete(s.line)):(s=_(t,n),s.fill&&i.series.push(s.fill),i.series.push(s.line)),a.set(s.id,s);const c=r-d-1;s.fill?.set("layer",c),s.line.set("layer",r+c),Q(t,s,n)}t.seriesInfos=a;for(const d of l)i.series.removeValue(d);n.set("layer",r+1),s.set("layer",r+2)}function Q({theme:i},e,o){const n=t.color(o.color.toCss()),s=o.samples??[],a=s.length>0,{line:l,fill:r}=e;l.set("visible",a),l.set("stroke",n),r?.set("visible",a),r?.set("fill",t.Color.lighten(n,i.seriesFillLighten)),l.data.setAll(s),r?.data.setAll(s)}function _(t,i){const{id:e}=i,o=tt(t,`${z}-${e}`),n=it(t);o.setAll({dy:i.chartStrokeOffsetY,tooltip:n}),o.strokes.template.setAll({strokeWidth:i.chartStrokeWidth});let s=null;return i.chartFillEnabled&&(s=tt(t,`${k}-${e}`),s.fills.template.setAll({fillOpacity:1,visible:!0})),{id:e,line:o,fill:s}}function tt(t,i){return a.new(t.chart.root,{connect:!1,excludeFromTotal:!0,fill:void 0,id:i,stroke:void 0,valueXField:"distance",valueYField:"elevation",xAxis:t.xAxis,yAxis:t.yAxis})}function it({theme:i,chart:e,rtl:o}){const n=t.Tooltip.new(e.root,{autoTextColor:!1,forceHidden:!0,getFillFromSprite:!1,getLabelFillFromSprite:!1,pointerOrientation:"vertical",visible:!1}),s=i.seriesTooltipPaddingHorizontal,a=i.seriesTooltipPaddingVertical;return n.label.setAll({fill:t.color(i.seriesTooltipLabelColor),fontFamily:i.fontFamily,fontSize:i.seriesTooltipFontSize,paddingBottom:a,paddingLeft:s,paddingRight:s,paddingTop:a,textAlign:o?"end":"start",direction:"ltr"}),n.get("background")?.setAll({stroke:void 0,fill:t.color(i.seriesTooltipBackgroundColor)}),n.adapters.add("dy",t=>{const e=i.seriesTooltipSpacing,o=n.get("pointTo")?.y??0;return(t??0)+(n.y()>o?e:-e)}),n}function et(t,i){const{xAxis:e,yAxis:o}=t,n=()=>{i(ot(e),ot(o))},s=t=>[t.on("start",n),t.on("end",n)];return ft([...s(e),...s(o)])}function ot(t){const i=Math.abs((t.get("end")??0)-(t.get("start")??0)),e=0!==i?1/i:1;return Math.abs(1-e)<g()?1:e}function nt(t,i){const{chart:e,xAxis:o,yAxis:n}=t,s=e.get("cursor"),a=e.plotContainer.events,l=i=>{t.pointerIsOver=i,at(t)},r=()=>{l(!1),i(null,null)};return ft([s?.events.on("cursormoved",()=>{if(!t.pointerIsOver)return;at(t);let e=s?.getPrivate("positionX")??0,a=s?.getPrivate("positionY")??0;const l=t.data;if(null!=l?.statistics){const{maxDistance:t,minElevation:i,maxElevation:s}=l.statistics;let r,d;if(null!=t){1===ot(o)?(r=0,d=t):(r=ut(o),d=xt(o)),e=st(e,r,d,0,t)}if(null!=i&&null!=s){1===ot(n)?(r=i,d=s):(r=ut(n),d=xt(n)),a=st(a,r,d,i,s)}}i(e,a)}),a.on("pointerover",()=>l(!0)),a.on("pointerout",r),a.on("blur",r)])}function st(t,i,e,o,n){return(i+t*(e-i)-o)/(n-o)}function at(t){const i=lt(t);if(!i)return void t.seriesInfos.forEach(t=>{t.line.get("tooltip")?.set("forceHidden",!0)});t.seriesInfos.forEach(t=>{const e=t.line.get("tooltip");e.set("forceHidden",!1),e.label.set("text",i)});t.xAxis.getTooltip().setAll({tooltipText:ct(t)})}function lt(t){const{data:i}=t,e=i?.lines.map(i=>({line:i,y:mt(t,i)?.elevation})).sort(rt);return e&&0!==e.length&&null!=e[0].y?e.map(({y:i,line:e})=>dt(t,e,i)).join("\n"):null}function rt({y:t},{y:i}){return null==t?1:null==i?-1:i-t}function dt(t,i,e){const{data:o,messages:n}=t;if(null==o||null==n)return"";const s=`[${i.color.toHex()}]●[/]`,a=" ",l=h().formatPrecision,r=S(n.chartTooltip,{name:v(i,n),elevation:null!=e?x(n,e,o.effectiveUnits.elevation,l):A});return t.rtl?r+a+s:s+a+r}function ct(t){const{data:i,messages:e}=t;if(null==i||null==e)return"";const o=i.lines[0],n=o?mt(t,o):null,s=h().formatPrecision;return null!=n?x(e,n.distance,i.effectiveUnits.distance,s):"-"}function pt(i,e){const o=t.NumberFormatter.new(i.chart.root,{});return o.format=(t,o,n)=>{const{data:s,messages:a}=i;if(null==a||null==s||"string"==typeof t)return"";return`${F(t,{maximumFractionDigits:n})} ${u(a,s.effectiveUnits[e],"abbr")}`},o}function mt({chart:t,xAxis:i},e){const o=e.samples??[];if(0===o.length)return null;const n=t.get("cursor"),s=n?.getPrivate("positionX")??0,a=i.toAxisPosition(s),l=i.positionToValue(a);return y(o,l,t=>t.distance)}function ut(t){return t.positionToValue(t.get("start")??0)}function xt(t){return t.positionToValue(t.get("end")??1)}function ft(t){return d(t.map(gt))}function gt(t){return c(()=>{t?.dispose()})}export{O as createChart,Z as getAdjustedBounds};
@@ -2,4 +2,4 @@
2
2
  All material copyright ESRI, All Rights Reserved, unless otherwise specified.
3
3
  See https://js.arcgis.com/4.34/esri/copyright.txt for details.
4
4
  */
5
- import{g as t,m as s,e,n as i,k as a,T as h,b as r}from"../../../chunks/Theme.js";export{D as DarkThemeAm5,R as ResponsiveThemeAm5}from"../../../chunks/ResponsiveTheme.js";import{R as n,B as o}from"../../../chunks/Button.js";export{T as TooltipAm5}from"../../../chunks/Tooltip.js";export{C as ColorSetAm5}from"../../../chunks/ColorSet.js";class u extends t{constructor(){super(...arguments),Object.defineProperty(this,"thumb",{enumerable:!0,configurable:!0,writable:!0,value:this._makeThumb()}),Object.defineProperty(this,"startGrip",{enumerable:!0,configurable:!0,writable:!0,value:this._makeButton()}),Object.defineProperty(this,"endGrip",{enumerable:!0,configurable:!0,writable:!0,value:this._makeButton()}),Object.defineProperty(this,"_thumbBusy",{enumerable:!0,configurable:!0,writable:!0,value:!1}),Object.defineProperty(this,"_startDown",{enumerable:!0,configurable:!0,writable:!0,value:!1}),Object.defineProperty(this,"_endDown",{enumerable:!0,configurable:!0,writable:!0,value:!1}),Object.defineProperty(this,"_thumbDown",{enumerable:!0,configurable:!0,writable:!0,value:!1}),Object.defineProperty(this,"_gripDown",{enumerable:!0,configurable:!0,writable:!0,value:void 0})}_addOrientationClass(){this._settings.themeTags=s(this._settings.themeTags,["scrollbar",this._settings.orientation]),this._settings.background||(this._settings.background=n.new(this._root,{themeTags:s(this._settings.themeTags,["main","background"])}))}_makeButton(){return this.children.push(o.new(this._root,{themeTags:["resize","button",this.get("orientation")],icon:e.new(this._root,{themeTags:["icon"]})}))}_makeThumb(){return this.children.push(n.new(this._root,{themeTags:["thumb",this.get("orientation")]}))}_handleAnimation(t){t&&this._disposers.push(t.events.on("stopped",()=>{this.setPrivateRaw("isBusy",!1),this._thumbBusy=!1}))}_afterNew(){this._addOrientationClass(),super._afterNew();const t=this.startGrip,s=this.endGrip,e=this.thumb,a=this.get("background");a&&this._disposers.push(a.events.on("click",t=>{this.setPrivateRaw("isBusy",!0);const s=this._display.toLocal(t.point),i=this.width(),a=this.height(),h=this.get("orientation");let r,n,o;r="vertical"==h?(s.y-e.height()/2)/a:(s.x-e.width()/2)/i,"vertical"==h?(n=r*a,o="y"):(n=r*i,o="x");const u=this.get("animationDuration",0);u>0?(this._thumbBusy=!0,this._handleAnimation(this.thumb.animate({key:o,to:n,duration:u,easing:this.get("animationEasing")}))):(this.thumb.set(o,n),this._root.events.once("frameended",()=>{this.setPrivateRaw("isBusy",!1)}))})),this._disposers.push(e.events.on("dblclick",t=>{if(!i(t.originalEvent,this))return;const s=this.get("animationDuration",0),e=this.get("animationEasing");this.animate({key:"start",to:0,duration:s,easing:e}),this.animate({key:"end",to:1,duration:s,easing:e})})),this._disposers.push(t.events.on("pointerdown",()=>{this.setPrivateRaw("isBusy",!0),this._startDown=!0,this._gripDown="start"})),this._disposers.push(s.events.on("pointerdown",()=>{this.setPrivateRaw("isBusy",!0),this._endDown=!0,this._gripDown="end"})),this._disposers.push(e.events.on("pointerdown",()=>{this.setPrivateRaw("isBusy",!0),this._thumbDown=!0,this._gripDown=void 0})),this._disposers.push(t.events.on("globalpointerup",()=>{this._startDown&&(this.setPrivateRaw("isBusy",!1),this._released()),this._startDown=!1})),this._disposers.push(s.events.on("globalpointerup",()=>{this._endDown&&(this.setPrivateRaw("isBusy",!1),this._released()),this._endDown=!1})),this._disposers.push(e.events.on("globalpointerup",()=>{this._thumbDown&&(this.setPrivateRaw("isBusy",!1),this._released()),this._thumbDown=!1})),this._disposers.push(t.on("x",()=>{this._updateThumb()})),this._disposers.push(s.on("x",()=>{this._updateThumb()})),this._disposers.push(t.on("y",()=>{this._updateThumb()})),this._disposers.push(s.on("y",()=>{this._updateThumb()})),this._disposers.push(e.events.on("positionchanged",()=>{this._updateGripsByThumb()})),"vertical"==this.get("orientation")?(t.set("x",0),s.set("x",0),this._disposers.push(e.adapters.add("y",t=>Math.max(Math.min(Number(t),this.height()-e.height()),0))),this._disposers.push(e.adapters.add("x",t=>this.width()/2)),this._disposers.push(t.adapters.add("x",t=>this.width()/2)),this._disposers.push(s.adapters.add("x",t=>this.width()/2)),this._disposers.push(t.adapters.add("y",t=>Math.max(Math.min(Number(t),this.height()),0))),this._disposers.push(s.adapters.add("y",t=>Math.max(Math.min(Number(t),this.height()),0)))):(t.set("y",0),s.set("y",0),this._disposers.push(e.adapters.add("x",t=>Math.max(Math.min(Number(t),this.width()-e.width()),0))),this._disposers.push(e.adapters.add("y",t=>this.height()/2)),this._disposers.push(t.adapters.add("y",t=>this.height()/2)),this._disposers.push(s.adapters.add("y",t=>this.height()/2)),this._disposers.push(t.adapters.add("x",t=>Math.max(Math.min(Number(t),this.width()),0))),this._disposers.push(s.adapters.add("x",t=>Math.max(Math.min(Number(t),this.width()),0))))}_updateChildren(){super._updateChildren(),(this.isDirty("end")||this.isDirty("start")||this._sizeDirty)&&this.updateGrips()}_changed(){if(super._changed(),this.isDirty("start")||this.isDirty("end")){const t="rangechanged";this.events.isEnabled(t)&&this.events.dispatch(t,{type:t,target:this,start:this.get("start",0),end:this.get("end",1),grip:this._gripDown})}}_released(){const t="released";this.events.isEnabled(t)&&this.events.dispatch(t,{type:t,target:this})}updateGrips(){const t=this.startGrip,s=this.endGrip,e=this.get("orientation"),i=this.height(),a=this.width();"vertical"==e?(t.set("y",i*this.get("start",0)),s.set("y",i*this.get("end",1))):(t.set("x",a*this.get("start",0)),s.set("x",a*this.get("end",1)));const h=this.getPrivate("positionTextFunction"),r=Math.round(100*this.get("start",0)),n=Math.round(100*this.get("end",0));let o,u;h?(o=h.call(this,this.get("start",0)),u=h.call(this,this.get("end",0))):(o=r+"%",u=n+"%"),t.set("ariaLabel",this._t("From %1",void 0,o)),t.set("ariaValueNow",""+r),t.set("ariaValueText",r+"%"),t.set("ariaValueMin","0"),t.set("ariaValueMax","100"),s.set("ariaLabel",this._t("To %1",void 0,u)),s.set("ariaValueNow",""+n),s.set("ariaValueText",n+"%"),s.set("ariaValueMin","0"),s.set("ariaValueMax","100")}_updateThumb(){const t=this.thumb,s=this.startGrip,e=this.endGrip,i=this.height(),h=this.width();let r=s.x(),n=e.x(),o=s.y(),u=e.y(),d=0,p=1;"vertical"==this.get("orientation")?a(o)&&a(u)&&(this._thumbBusy||t.isDragging()||(t.set("height",u-o),t.set("y",o)),d=o/i,p=u/i):a(r)&&a(n)&&(this._thumbBusy||t.isDragging()||(t.set("width",n-r),t.set("x",r)),d=r/h,p=n/h),!this.getPrivate("isBusy")||this.get("start")==d&&this.get("end")==p||(this.set("start",d),this.set("end",p));const l=this.getPrivate("positionTextFunction"),m=Math.round(100*this.get("start",0)),g=Math.round(100*this.get("end",0));let b,c;l?(b=l.call(this,this.get("start",0)),c=l.call(this,this.get("end",0))):(b=m+"%",c=g+"%"),t.set("ariaLabel",this._t("From %1 to %2",void 0,b,c)),t.set("ariaValueNow",""+m),t.set("ariaValueText",m+"%")}_updateGripsByThumb(){const t=this.thumb,s=this.startGrip,e=this.endGrip;if("vertical"==this.get("orientation")){const i=t.height();s.set("y",t.y()),e.set("y",t.y()+i)}else{const i=t.width();s.set("x",t.x()),e.set("x",t.x()+i)}}}Object.defineProperty(u,"className",{enumerable:!0,configurable:!0,writable:!0,value:"Scrollbar"}),Object.defineProperty(u,"classNames",{enumerable:!0,configurable:!0,writable:!0,value:t.classNames.concat([u.className])});class d extends h{setupDefaultRules(){super.setupDefaultRules(),this.rule("Component").setAll({interpolationDuration:600}),this.rule("Hierarchy").set("animationDuration",600),this.rule("Scrollbar").set("animationDuration",600),this.rule("Tooltip").set("animationDuration",300),this.rule("MapChart").set("animationDuration",1e3),this.rule("MapChart").set("wheelDuration",300),this.rule("Entity").setAll({stateAnimationDuration:600}),this.rule("Sprite").states.create("default",{stateAnimationDuration:600}),this.rule("Tooltip",["axis"]).setAll({animationDuration:200}),this.rule("WordCloud").set("animationDuration",500),this.rule("Polygon").set("animationDuration",600),this.rule("ArcDiagram").set("animationDuration",600)}}const p=["#2888B8","#EB7028","#48A375","#9370B1","#e55035","#3d9ccc","#DC7B04","#b87bb0","#3fa681","#EE6386"].map(t=>r(t));export{d as AnimatedThemeAm5,u as ScrollbarAm5,h as ThemeAm5,r as colorAm5,p as esriChartColorSet};
5
+ import{color as a}from"@amcharts/amcharts5/index.js";export{ColorSet as ColorSetAm5,Scrollbar as ScrollbarAm5,Theme as ThemeAm5,Tooltip as TooltipAm5,color as colorAm5}from"@amcharts/amcharts5/index.js";export{default as AnimatedThemeAm5}from"@amcharts/amcharts5/themes/Animated.js";export{default as DarkThemeAm5}from"@amcharts/amcharts5/themes/Dark.js";export{default as ResponsiveThemeAm5}from"@amcharts/amcharts5/themes/Responsive.js";const e=["#2888B8","#EB7028","#48A375","#9370B1","#e55035","#3d9ccc","#DC7B04","#b87bb0","#3fa681","#EE6386"].map(e=>a(e));export{e as esriChartColorSet};
@@ -2,4 +2,4 @@
2
2
  All material copyright ESRI, All Rights Reserved, unless otherwise specified.
3
3
  See https://js.arcgis.com/4.34/esri/copyright.txt for details.
4
4
  */
5
- import{__awaiter as e}from"tslib";import{w as t,c as i,S as s,a,T as r}from"../../../chunks/Tick.js";import{w as l,x as n,L as o,l as h,y as c,p as u,P as d,z as g,A as p,e as y,k as b,T as f,a as m,j as _,g as x,i as v,v as w,B as k,D,t as R,u as A,m as P}from"../../../chunks/Theme.js";import{C as T}from"../../../chunks/ColorSet.js";import{s as L}from"../../../chunks/DefaultTheme.js";class N extends l{constructor(){super(...arguments),Object.defineProperty(this,"_display",{enumerable:!0,configurable:!0,writable:!0,value:this._root._renderer.makeRadialText("",this.textStyle)})}_afterNew(){super._afterNew()}_beforeChanged(){super._beforeChanged(),this._display.clear(),this.isDirty("textType")&&(this._display.textType=this.get("textType"),this.markDirtyBounds()),this.isDirty("radius")&&(this._display.radius=this.get("radius"),this.markDirtyBounds()),this.isDirty("startAngle")&&(this._display.startAngle=(this.get("startAngle",0)+90)*n,this.markDirtyBounds()),this.isDirty("inside")&&(this._display.inside=this.get("inside"),this.markDirtyBounds()),this.isDirty("orientation")&&(this._display.orientation=this.get("orientation"),this.markDirtyBounds()),this.isDirty("kerning")&&(this._display.kerning=this.get("kerning"),this.markDirtyBounds())}}Object.defineProperty(N,"className",{enumerable:!0,configurable:!0,writable:!0,value:"RadialText"}),Object.defineProperty(N,"classNames",{enumerable:!0,configurable:!0,writable:!0,value:l.classNames.concat([N.className])});class C extends o{constructor(){super(...arguments),Object.defineProperty(this,"_flipped",{enumerable:!0,configurable:!0,writable:!0,value:!1})}_afterNew(){this._textKeys.push("textType","kerning"),super._afterNew()}_makeText(){this._text=this.children.push(N.new(this._root,{}))}baseRadius(){const e=this.getPrivate("radius",0),t=this.getPrivate("innerRadius",0),i=this.get("baseRadius",0);return t+h(i,e-t)}radius(){const e=this.get("inside",!1);return this.baseRadius()+this.get("radius",0)*(e?-1:1)}_updateChildren(){if(super._updateChildren(),this.isDirty("baseRadius")||this.isPrivateDirty("radius")||this.isPrivateDirty("innerRadius")||this.isDirty("labelAngle")||this.isDirty("radius")||this.isDirty("inside")||this.isDirty("orientation")||this.isDirty("textType")){const e=this.get("textType","adjusted"),t=this.get("inside",!1),i=this.get("orientation");let s=c(this.get("labelAngle",0));this._text.set("startAngle",this.get("labelAngle",0)),this._text.set("inside",t);const a=p(s),r=g(s);let l=this.baseRadius(),n=this.radius();if(this._display.angle=0,"circular"==e)this.setAll({paddingTop:0,paddingBottom:0,paddingLeft:0,paddingRight:0}),this.setRaw("x",void 0),this.setRaw("y",void 0),this._text.set("orientation",i),this._text.set("radius",n);else{0==l&&(s=0,n=0);let t=n*r,o=n*a;"radial"==e?(this.setRaw("x",t),this.setRaw("y",o),s<90||s>270||"auto"!=i?(this._display.angle=s,this._flipped=!1):(this._display.angle=s+180,this._flipped=!0),this._dirty.rotation=!1):"adjusted"==e?(this.setRaw("centerX",u),this.setRaw("centerY",u),this.setRaw("x",t),this.setRaw("y",o)):"regular"==e&&(this.setRaw("x",t),this.setRaw("y",o))}this.markDirtyPosition(),this.markDirtyBounds()}}_updatePosition(){const e=this.get("textType","regular"),t=this.get("inside",!1);let i=0,s=0,a=this.get("labelAngle",0),r=this.localBounds(),l=r.right-r.left,n=r.bottom-r.top;if("radial"==e){if(this._flipped){let e=this.get("centerX");e instanceof d&&(l*=1-2*e.value),i=l*g(a),s=l*p(a)}}else t||"adjusted"!=e||(i=l/2*g(a),s=n/2*p(a));this.setRaw("dx",i),this.setRaw("dy",s),super._updatePosition()}get text(){return this._text}}Object.defineProperty(C,"className",{enumerable:!0,configurable:!0,writable:!0,value:"RadialLabel"}),Object.defineProperty(C,"classNames",{enumerable:!0,configurable:!0,writable:!0,value:o.classNames.concat([C.className])});const j=Math.abs,S=Math.atan2,O=Math.cos,I=Math.max,M=Math.min,B=Math.sin,F=Math.sqrt,H=1e-12,X=Math.PI,Y=X/2,z=2*X;function V(e){return e>1?0:e<-1?X:Math.acos(e)}function W(e){return e>=1?Y:e<=-1?-Y:Math.asin(e)}function U(e){return e.innerRadius}function K(e){return e.outerRadius}function q(e){return e.startAngle}function E(e){return e.endAngle}function G(e){return e&&e.padAngle}function J(e,t,i,s,a,r,l,n){var o=i-e,h=s-t,c=l-a,u=n-r,d=u*o-c*h;if(!(d*d<H))return[e+(d=(c*(t-r)-u*(e-a))/d)*o,t+d*h]}function Q(e,t,i,s,a,r,l){var n=e-i,o=t-s,h=(l?r:-r)/F(n*n+o*o),c=h*o,u=-h*n,d=e+c,g=t+u,p=i+c,y=s+u,b=(d+p)/2,f=(g+y)/2,m=p-d,_=y-g,x=m*m+_*_,v=a-r,w=d*y-p*g,k=(_<0?-1:1)*F(I(0,v*v*x-w*w)),D=(w*_-m*k)/x,R=(-w*m-_*k)/x,A=(w*_+m*k)/x,P=(-w*m+_*k)/x,T=D-b,L=R-f,N=A-b,C=P-f;return T*T+L*L>N*N+C*C&&(D=A,R=P),{cx:D,cy:R,x01:-c,y01:-u,x11:D*(a/v-1),y11:R*(a/v-1)}}function Z(){var e=U,s=K,a=i(0),r=null,l=q,n=E,o=G,h=null,c=t(u);function u(){var t,i,u=+e.apply(this,arguments),d=+s.apply(this,arguments),g=l.apply(this,arguments)-Y,p=n.apply(this,arguments)-Y,y=j(p-g),b=p>g;if(h||(h=t=c()),d<u&&(i=d,d=u,u=i),d>H)if(y>z-H)h.moveTo(d*O(g),d*B(g)),h.arc(0,0,d,g,p,!b),u>H&&(h.moveTo(u*O(p),u*B(p)),h.arc(0,0,u,p,g,b));else{var f,m,_=g,x=p,v=g,w=p,k=y,D=y,R=o.apply(this,arguments)/2,A=R>H&&(r?+r.apply(this,arguments):F(u*u+d*d)),P=M(j(d-u)/2,+a.apply(this,arguments)),T=P,L=P;if(A>H){var N=W(A/u*B(R)),C=W(A/d*B(R));(k-=2*N)>H?(v+=N*=b?1:-1,w-=N):(k=0,v=w=(g+p)/2),(D-=2*C)>H?(_+=C*=b?1:-1,x-=C):(D=0,_=x=(g+p)/2)}var I=d*O(_),U=d*B(_),K=u*O(w),q=u*B(w);if(P>H){var E,G=d*O(x),Z=d*B(x),$=u*O(v),ee=u*B(v);if(y<X)if(E=J(I,U,$,ee,G,Z,K,q)){var te=I-E[0],ie=U-E[1],se=G-E[0],ae=Z-E[1],re=1/B(V((te*se+ie*ae)/(F(te*te+ie*ie)*F(se*se+ae*ae)))/2),le=F(E[0]*E[0]+E[1]*E[1]);T=M(P,(u-le)/(re-1)),L=M(P,(d-le)/(re+1))}else T=L=0}D>H?L>H?(f=Q($,ee,I,U,d,L,b),m=Q(G,Z,K,q,d,L,b),h.moveTo(f.cx+f.x01,f.cy+f.y01),L<P?h.arc(f.cx,f.cy,L,S(f.y01,f.x01),S(m.y01,m.x01),!b):(h.arc(f.cx,f.cy,L,S(f.y01,f.x01),S(f.y11,f.x11),!b),h.arc(0,0,d,S(f.cy+f.y11,f.cx+f.x11),S(m.cy+m.y11,m.cx+m.x11),!b),h.arc(m.cx,m.cy,L,S(m.y11,m.x11),S(m.y01,m.x01),!b))):(h.moveTo(I,U),h.arc(0,0,d,_,x,!b)):h.moveTo(I,U),u>H&&k>H?T>H?(f=Q(K,q,G,Z,u,-T,b),m=Q(I,U,$,ee,u,-T,b),h.lineTo(f.cx+f.x01,f.cy+f.y01),T<P?h.arc(f.cx,f.cy,T,S(f.y01,f.x01),S(m.y01,m.x01),!b):(h.arc(f.cx,f.cy,T,S(f.y01,f.x01),S(f.y11,f.x11),!b),h.arc(0,0,u,S(f.cy+f.y11,f.cx+f.x11),S(m.cy+m.y11,m.cx+m.x11),b),h.arc(m.cx,m.cy,T,S(m.y11,m.x11),S(m.y01,m.x01),!b))):h.arc(0,0,u,w,v,b):h.lineTo(K,q)}else h.moveTo(0,0);if(h.closePath(),t)return h=null,t+""||null}return u.centroid=function(){var t=(+e.apply(this,arguments)+ +s.apply(this,arguments))/2,i=(+l.apply(this,arguments)+ +n.apply(this,arguments))/2-X/2;return[O(i)*t,B(i)*t]},u.innerRadius=function(t){return arguments.length?(e="function"==typeof t?t:i(+t),u):e},u.outerRadius=function(e){return arguments.length?(s="function"==typeof e?e:i(+e),u):s},u.cornerRadius=function(e){return arguments.length?(a="function"==typeof e?e:i(+e),u):a},u.padRadius=function(e){return arguments.length?(r=null==e?null:"function"==typeof e?e:i(+e),u):r},u.startAngle=function(e){return arguments.length?(l="function"==typeof e?e:i(+e),u):l},u.endAngle=function(e){return arguments.length?(n="function"==typeof e?e:i(+e),u):n},u.padAngle=function(e){return arguments.length?(o="function"==typeof e?e:i(+e),u):o},u.context=function(e){return arguments.length?(h=e??null,u):h},u}class $ extends y{constructor(){super(...arguments),Object.defineProperty(this,"ix",{enumerable:!0,configurable:!0,writable:!0,value:0}),Object.defineProperty(this,"iy",{enumerable:!0,configurable:!0,writable:!0,value:0}),Object.defineProperty(this,"_generator",{enumerable:!0,configurable:!0,writable:!0,value:Z()})}_getTooltipPoint(){let e=this.get("tooltipX"),t=this.get("tooltipY"),i=0,s=0;b(e)&&(i=e),b(t)&&(s=t);let a=this.get("radius",0),r=this.get("innerRadius",0);return a+=this.get("dRadius",0),r+=this.get("dInnerRadius",0),r<0&&(r=a+r),e instanceof d&&(i=this.ix*(r+(a-r)*e.value)),t instanceof d&&(s=this.iy*(r+(a-r)*t.value)),this.get("arc")>=360&&0==r&&(i=0,s=0),{x:i,y:s}}_beforeChanged(){super._beforeChanged(),(this.isDirty("radius")||this.isDirty("arc")||this.isDirty("innerRadius")||this.isDirty("startAngle")||this.isDirty("dRadius")||this.isDirty("dInnerRadius")||this.isDirty("cornerRadius")||this.isDirty("shiftRadius"))&&(this._clear=!0)}_changed(){if(super._changed(),this._clear){let e=this.get("startAngle",0),t=this.get("arc",0);const i=this._generator;t<0&&(e+=t,t*=-1),t>.1&&i.cornerRadius(this.get("cornerRadius",0)),i.context(this._display);let s=this.get("radius",0),a=this.get("innerRadius",0);s+=this.get("dRadius",0),a+=this.get("dInnerRadius",0),a<0&&(a=s+a),i({innerRadius:a,outerRadius:s,startAngle:(e+90)*n,endAngle:(e+t+90)*n});let r=e+t/2;this.ix=g(r),this.iy=p(r);const l=this.get("shiftRadius",0);this.setRaw("dx",this.ix*l),this.setRaw("dy",this.iy*l),this.markDirtyPosition()}}}Object.defineProperty($,"className",{enumerable:!0,configurable:!0,writable:!0,value:"Slice"}),Object.defineProperty($,"classNames",{enumerable:!0,configurable:!0,writable:!0,value:y.classNames.concat([$.className])});class ee extends f{setupDefaultRules(){super.setupDefaultRules();const e=this._root.interfaceColors,t=this.rule.bind(this);t("PercentSeries").setAll({legendLabelText:"{category}",legendValueText:"{valuePercentTotal.formatNumber('0.00p')}",colors:T.new(this._root,{}),width:m,height:m}),t("PieChart").setAll({radius:_(80),startAngle:-90,endAngle:270}),t("PieSeries").setAll({alignLabels:!0,startAngle:-90,endAngle:270}),t("PieSeries").states.create("hidden",{endAngle:-90,opacity:0}),t("Slice",["pie"]).setAll({position:"absolute",isMeasured:!1,x:0,y:0,toggleKey:"active",tooltipText:"{category}: {valuePercentTotal.formatNumber('0.00p')}",strokeWidth:1,strokeOpacity:1,role:"figure",lineJoin:"round"}),t("Slice",["pie"]).states.create("active",{shiftRadius:20,scale:1}),t("Slice",["pie"]).states.create("hoverActive",{scale:1.04}),t("Slice",["pie"]).states.create("hover",{scale:1.04}),t("RadialLabel",["pie"]).setAll({textType:"aligned",radius:10,text:"{category}: {valuePercentTotal.formatNumber('0.00p')}",paddingTop:5,paddingBottom:5,populateText:!0}),t("Tick",["pie"]).setAll({location:1}),t("SlicedChart").setAll({paddingLeft:10,paddingRight:10,paddingTop:10,paddingBottom:10}),t("FunnelSeries").setAll({startLocation:0,endLocation:1,orientation:"vertical",alignLabels:!0,sequencedInterpolation:!0}),t("FunnelSlice").setAll({interactive:!0,expandDistance:0}),t("FunnelSlice").states.create("hover",{expandDistance:.15}),t("Label",["funnel"]).setAll({populateText:!0,text:"{category}: {valuePercentTotal.formatNumber('0.00p')}",centerY:u}),t("Label",["funnel","horizontal"]).setAll({centerX:0,centerY:u,rotation:-90}),t("Label",["funnel","vertical"]).setAll({centerY:u,centerX:0}),t("Tick",["funnel"]).setAll({location:1}),t("FunnelSlice",["funnel","link"]).setAll({fillOpacity:.5,strokeOpacity:0,expandDistance:-.1}),t("FunnelSlice",["funnel","link","vertical"]).setAll({height:10}),t("FunnelSlice",["funnel","link","horizontal"]).setAll({width:10}),t("PyramidSeries").setAll({valueIs:"area"}),t("FunnelSlice",["pyramid","link"]).setAll({fillOpacity:.5}),t("FunnelSlice",["pyramid","link","vertical"]).setAll({height:0}),t("FunnelSlice",["pyramid","link","horizontal"]).setAll({width:0}),t("FunnelSlice",["pyramid"]).setAll({interactive:!0,expandDistance:0}),t("FunnelSlice",["pyramid"]).states.create("hover",{expandDistance:.15}),t("Label",["pyramid"]).setAll({populateText:!0,text:"{category}: {valuePercentTotal.formatNumber('0.00p')}",centerY:u}),t("Label",["pyramid","horizontal"]).setAll({centerX:0,centerY:u,rotation:-90}),t("Label",["pyramid","vertical"]).setAll({centerY:u,centerX:0}),t("Tick",["pyramid"]).setAll({location:1}),t("FunnelSlice",["pictorial"]).setAll({interactive:!0,tooltipText:"{category}: {valuePercentTotal.formatNumber('0.00p')}"}),t("Label",["pictorial"]).setAll({populateText:!0,text:"{category}: {valuePercentTotal.formatNumber('0.00p')}",centerY:u}),t("Label",["pictorial","horizontal"]).setAll({centerX:0,centerY:u,rotation:-90}),t("Label",["pictorial","vertical"]).setAll({centerY:u,centerX:0}),t("FunnelSlice",["pictorial","link"]).setAll({fillOpacity:.5,width:0,height:0}),t("Tick",["pictorial"]).setAll({location:.5});{const i=t("Graphics",["pictorial","background"]);i.setAll({fillOpacity:.2}),L(i,"fill",e,"alternativeBackground")}}}class te extends s{_afterNew(){this._defaultThemes.push(ee.new(this._root)),super._afterNew(),this.chartContainer.children.push(this.seriesContainer),this.seriesContainer.children.push(this.bulletsContainer)}_processSeries(e){super._processSeries(e),this.seriesContainer.children.moveValue(this.bulletsContainer,this.seriesContainer.children.length-1)}}Object.defineProperty(te,"className",{enumerable:!0,configurable:!0,writable:!0,value:"PercentChart"}),Object.defineProperty(te,"classNames",{enumerable:!0,configurable:!0,writable:!0,value:s.classNames.concat([te.className])});class ie extends a{constructor(){super(...arguments),Object.defineProperty(this,"slicesContainer",{enumerable:!0,configurable:!0,writable:!0,value:this.children.push(x.new(this._root,{position:"absolute",isMeasured:!1}))}),Object.defineProperty(this,"labelsContainer",{enumerable:!0,configurable:!0,writable:!0,value:this.children.push(x.new(this._root,{position:"absolute",isMeasured:!1}))}),Object.defineProperty(this,"ticksContainer",{enumerable:!0,configurable:!0,writable:!0,value:this.children.push(x.new(this._root,{position:"absolute",isMeasured:!1}))}),Object.defineProperty(this,"_lLabels",{enumerable:!0,configurable:!0,writable:!0,value:[]}),Object.defineProperty(this,"_rLabels",{enumerable:!0,configurable:!0,writable:!0,value:[]}),Object.defineProperty(this,"_hLabels",{enumerable:!0,configurable:!0,writable:!0,value:[]}),Object.defineProperty(this,"slices",{enumerable:!0,configurable:!0,writable:!0,value:this.addDisposer(this._makeSlices())}),Object.defineProperty(this,"labels",{enumerable:!0,configurable:!0,writable:!0,value:this.addDisposer(this._makeLabels())}),Object.defineProperty(this,"ticks",{enumerable:!0,configurable:!0,writable:!0,value:this.addDisposer(this._makeTicks())})}makeSlice(e){const t=this.slicesContainer.children.push(this.slices.make());return t.on("fill",()=>{this.updateLegendMarker(e)}),t.on("fillPattern",()=>{this.updateLegendMarker(e)}),t.on("stroke",()=>{this.updateLegendMarker(e)}),t._setDataItem(e),e.set("slice",t),this.slices.push(t),t}makeLabel(e){const t=this.labelsContainer.children.push(this.labels.make());return t._setDataItem(e),e.set("label",t),this.labels.push(t),t}_shouldMakeBullet(e){return null!=e.get("value")}makeTick(e){const t=this.ticksContainer.children.push(this.ticks.make());return t._setDataItem(e),e.set("tick",t),this.ticks.push(t),t}_afterNew(){this.fields.push("category","fill"),super._afterNew()}_onDataClear(){const e=this.get("colors");e&&e.reset();const t=this.get("patterns");t&&t.reset()}_prepareChildren(){if(super._prepareChildren(),this._lLabels=[],this._rLabels=[],this._hLabels=[],this._valuesDirty){let e=0,t=0,i=0,s=1/0,a=0;v(this._dataItems,i=>{let s=i.get("valueWorking",0);e+=s,t+=Math.abs(s)}),v(this._dataItems,e=>{let r=e.get("valueWorking",0);r>i&&(i=r),r<s&&(s=r),a++;let l=r/t;0==t&&(l=0),e.setRaw("valuePercentTotal",100*l)}),this.setPrivateRaw("valueLow",s),this.setPrivateRaw("valueHigh",i),this.setPrivateRaw("valueSum",e),this.setPrivateRaw("valueAverage",e/a),this.setPrivateRaw("valueAbsoluteSum",t)}}show(t){const i=Object.create(null,{show:{get:()=>super.show}});return e(this,void 0,void 0,function*(){let e=[];e.push(i.show.call(this,t)),e.push(this._sequencedShowHide(!0,t)),yield Promise.all(e)})}hide(t){const i=Object.create(null,{hide:{get:()=>super.hide}});return e(this,void 0,void 0,function*(){let e=[];e.push(i.hide.call(this,t)),e.push(this._sequencedShowHide(!1,t)),yield Promise.all(e)})}_updateChildren(){super._updateChildren(),this._valuesDirty&&v(this._dataItems,e=>{e.get("label").text.markDirtyText()}),(this.isDirty("legendLabelText")||this.isDirty("legendValueText"))&&v(this._dataItems,e=>{this.updateLegendValue(e)}),this._arrange()}_arrange(){this._arrangeDown(this._lLabels),this._arrangeUp(this._lLabels),this._arrangeDown(this._rLabels),this._arrangeUp(this._rLabels),this._arrangeLeft(this._hLabels),this._arrangeRight(this._hLabels),v(this.dataItems,e=>{this._updateTick(e)})}_afterChanged(){super._afterChanged(),this._arrange()}processDataItem(e){if(super.processDataItem(e),null==e.get("fill")){let t=this.get("colors");t&&e.setRaw("fill",t.next())}if(null==e.get("fillPattern")){let t=this.get("patterns");t&&e.setRaw("fillPattern",t.next())}}showDataItem(t,i){const s=Object.create(null,{showDataItem:{get:()=>super.showDataItem}});return e(this,void 0,void 0,function*(){const e=[s.showDataItem.call(this,t,i)];b(i)||(i=this.get("stateAnimationDuration",0));const a=this.get("stateAnimationEasing");let r=t.get("value");const l=t.animate({key:"valueWorking",to:r,duration:i,easing:a});l&&e.push(l.waitForStop());const n=t.get("tick");n&&e.push(n.show(i));const o=t.get("label");o&&e.push(o.show(i));const h=t.get("slice");h&&e.push(h.show(i)),h.get("active")&&h.states.applyAnimate("active"),yield Promise.all(e)})}hideDataItem(t,i){const s=Object.create(null,{hideDataItem:{get:()=>super.hideDataItem}});return e(this,void 0,void 0,function*(){const e=[s.hideDataItem.call(this,t,i)],a=this.states.create("hidden",{});b(i)||(i=a.get("stateAnimationDuration",this.get("stateAnimationDuration",0)));const r=a.get("stateAnimationEasing",this.get("stateAnimationEasing")),l=t.animate({key:"valueWorking",to:0,duration:i,easing:r});l&&e.push(l.waitForStop());const n=t.get("tick");n&&e.push(n.hide(i));const o=t.get("label");o&&e.push(o.hide(i));const h=t.get("slice");h.hideTooltip(),h&&e.push(h.hide(i)),yield Promise.all(e)})}disposeDataItem(e){super.disposeDataItem(e);let t=e.get("label");t&&(this.labels.removeValue(t),t.dispose());let i=e.get("tick");i&&(this.ticks.removeValue(i),i.dispose());let s=e.get("slice");s&&(this.slices.removeValue(s),s.dispose())}hoverDataItem(e){const t=e.get("slice");t&&!t.isHidden()&&t.hover()}unhoverDataItem(e){const t=e.get("slice");t&&t.unhover()}updateLegendMarker(e){if(e){const t=e.get("slice");if(t){const i=e.get("legendDataItem");if(i){const e=i.get("markerRectangle");v(w,i=>{null!=t.get(i)&&e.set(i,t.get(i))})}}}}_arrangeDown(e){if(e){let t=this._getNextDown();e.sort((e,t)=>e.y>t.y?1:e.y<t.y?-1:0),v(e,e=>{const i=e.label.adjustedLocalBounds();let s=i.top;e.y+s<t&&(e.y=t-s),e.label.set("y",e.y),t=e.y+i.bottom})}}_getNextUp(){return this.labelsContainer.maxHeight()}_getNextDown(){return 0}_arrangeUp(e){if(e){let t=this._getNextUp();e.sort((e,t)=>e.y<t.y?1:e.y>t.y?-1:0),v(e,e=>{const i=e.label.adjustedLocalBounds();let s=i.bottom;e.y+s>t&&(e.y=t-s),e.label.set("y",e.y),t=e.y+i.top})}}_arrangeRight(e){if(e){let t=0;e.sort((e,t)=>e.y>t.y?1:e.y<t.y?-1:0),v(e,e=>{const i=e.label.adjustedLocalBounds();let s=i.left;e.y+s<t&&(e.y=t-s),e.label.set("x",e.y),t=e.y+i.right})}}_arrangeLeft(e){if(e){let t=this.labelsContainer.maxWidth();e.sort((e,t)=>e.y<t.y?1:e.y>t.y?-1:0),v(e,e=>{const i=e.label.adjustedLocalBounds();let s=i.right;e.y+s>t&&(e.y=t-s),e.label.set("x",e.y),t=e.y+i.left})}}_updateSize(){super._updateSize(),this.markDirty()}_updateTick(e){}_dispose(){super._dispose();const e=this.chart;e&&e.series.removeValue(this)}}Object.defineProperty(ie,"className",{enumerable:!0,configurable:!0,writable:!0,value:"PercentSeries"}),Object.defineProperty(ie,"classNames",{enumerable:!0,configurable:!0,writable:!0,value:a.classNames.concat([ie.className])});class se extends te{constructor(){super(...arguments),Object.defineProperty(this,"_maxRadius",{enumerable:!0,configurable:!0,writable:!0,value:1})}_afterNew(){super._afterNew(),this.seriesContainer.setAll({x:u,y:u})}_prepareChildren(){super._prepareChildren();const e=this.chartContainer,t=e.innerWidth(),i=e.innerHeight(),s=this.get("startAngle",0),a=this.get("endAngle",0),r=this.get("innerRadius");let l=k(0,0,s,a,1);const n=t/(l.right-l.left),o=i/(l.bottom-l.top);let c={left:0,right:0,top:0,bottom:0};if(r instanceof d){let e=r.value,l=Math.min(n,o);e=Math.max(l*e,l-Math.min(i,t))/l,c=k(0,0,s,a,e),this.setPrivateRaw("irModifyer",e/r.value)}l=D([l,c]);const u=this._maxRadius;this._maxRadius=Math.min(n,o);const g=h(this.get("radius",0),this._maxRadius);this.seriesContainer.setAll({dy:-g*(l.bottom+l.top)/2,dx:-g*(l.right+l.left)/2}),(this.isDirty("startAngle")||this.isDirty("endAngle")||u!=this._maxRadius)&&this.series.each(e=>{e._markDirtyKey("startAngle")}),(this.isDirty("innerRadius")||this.isDirty("radius"))&&this.series.each(e=>{e._markDirtyKey("innerRadius")})}radius(e){let t=h(this.get("radius",0),this._maxRadius),i=h(this.get("innerRadius",0),t);if(e){let s=this.series.indexOf(e),a=this.series.length,r=e.get("radius");return null!=r?i+h(r,t-i):i+(t-i)/a*(s+1)}return t}innerRadius(e){const t=this.radius();let i=h(this.get("innerRadius",0),t);if(i<0&&(i=t+i),e){let s=this.series.indexOf(e),a=this.series.length,r=e.get("innerRadius");return null!=r?i+h(r,t-i):i+(t-i)/a*s}return i}_updateSize(){super._updateSize(),this.markDirtyKey("radius")}}Object.defineProperty(se,"className",{enumerable:!0,configurable:!0,writable:!0,value:"PieChart"}),Object.defineProperty(se,"classNames",{enumerable:!0,configurable:!0,writable:!0,value:te.classNames.concat([se.className])});class ae extends ie{_makeSlices(){return new R(A.new({}),()=>$._new(this._root,{themeTags:P(this.slices.template.get("themeTags",[]),["pie","series"])},[this.slices.template]))}_makeLabels(){return new R(A.new({}),()=>C._new(this._root,{themeTags:P(this.labels.template.get("themeTags",[]),["pie","series"])},[this.labels.template]))}_makeTicks(){return new R(A.new({}),()=>r._new(this._root,{themeTags:P(this.ticks.template.get("themeTags",[]),["pie","series"])},[this.ticks.template]))}processDataItem(e){super.processDataItem(e);const t=this.makeSlice(e);t.on("scale",()=>{this._updateTick(e)}),t.on("shiftRadius",()=>{this._updateTick(e)}),t.events.on("positionchanged",()=>{this._updateTick(e)});const i=this.makeLabel(e);i.events.on("positionchanged",()=>{this._updateTick(e)}),this.makeTick(e),t.events.on("positionchanged",()=>{i.markDirty()})}_getNextUp(){const e=this.chart;return e?e._maxRadius:this.labelsContainer.maxHeight()/2}_getNextDown(){const e=this.chart;return e?-e._maxRadius:-this.labelsContainer.maxHeight()/2}_prepareChildren(){super._prepareChildren();const e=this.chart;if(e){if(this.isDirty("alignLabels")){let e=this.labels.template;if(this.get("alignLabels"))e.set("textType","aligned");else{let t=e.get("textType");null!=t&&"aligned"!=t||e.set("textType","adjusted")}}if(this._valuesDirty||this.isDirty("radius")||this.isDirty("innerRadius")||this.isDirty("startAngle")||this.isDirty("endAngle")||this.isDirty("alignLabels")){this.markDirtyBounds();const t=this.get("startAngle",e.get("startAngle",-90)),i=this.get("endAngle",e.get("endAngle",270))-t;let s=t;const a=e.radius(this);this.setPrivateRaw("radius",a);let r=e.innerRadius(this)*e.getPrivate("irModifyer",1);r<0&&(r=a+r),v(this._dataItems,e=>{this.updateLegendValue(e);let t=i*e.get("valuePercentTotal")/100;const l=e.get("slice");if(l){l.set("radius",a),l.set("innerRadius",r),l.set("startAngle",s),l.set("arc",t);const i=e.get("fill");l._setDefault("fill",i),l._setDefault("stroke",i);const n=e.get("fillPattern");l._setDefault("fillPattern",n)}let n=c(s+t/2);const o=e.get("label");if(o&&(o.setPrivate("radius",a),o.setPrivate("innerRadius",r),o.set("labelAngle",n),"aligned"==o.get("textType"))){let e=a+o.get("radius",0),t=a*p(n);n>90&&n<=270?(o.isHidden()||o.isHiding()||this._lLabels.push({label:o,y:t}),e*=-1,e-=this.labelsContainer.get("paddingLeft",0),o.set("centerX",m),o.setPrivateRaw("left",!0)):(o.isHidden()||o.isHiding()||this._rLabels.push({label:o,y:t}),e+=this.labelsContainer.get("paddingRight",0),o.set("centerX",0),o.setPrivateRaw("left",!1)),o.set("x",e),o.set("y",a*p(n))}s+=t,this._updateTick(e)})}}}_updateTick(e){const t=e.get("tick"),i=e.get("label"),s=e.get("slice"),a=t.get("location",1);if(t&&i&&s){const e=(s.get("shiftRadius",0)+s.get("radius",0))*s.get("scale",1)*a,r=i.get("labelAngle",0),l=g(r),n=p(r),o=this.labelsContainer,h=o.get("paddingLeft",0),c=o.get("paddingRight",0);let u=0,d=0;u=i.x(),d=i.y();let y=[];if(0!=u||0!=d){if("circular"==i.get("textType")){const e=i.radius()-i.get("paddingBottom",0),t=i.get("labelAngle",0);u=e*g(t),d=e*p(t)}let t=-c;i.getPrivate("left")&&(t=h),y=[{x:s.x()+e*l,y:s.y()+e*n},{x:u+t,y:d},{x:u,y:d}]}t.set("points",y)}}_positionBullet(e){const t=e.get("sprite");if(t){const i=t.dataItem.get("slice");if(i){const s=i.get("innerRadius",0),a=i.get("radius",0),r=i.get("startAngle",0)+i.get("arc",0)*e.get("locationX",.5),l=s+(a-s)*e.get("locationY",.5);t.setAll({x:g(r)*l,y:p(r)*l})}}}}Object.defineProperty(ae,"className",{enumerable:!0,configurable:!0,writable:!0,value:"PieSeries"}),Object.defineProperty(ae,"classNames",{enumerable:!0,configurable:!0,writable:!0,value:ie.classNames.concat([ae.className])});export{se as PieChartAm5,ae as PieSeriesAm5};
5
+ export{PieChart as PieChartAm5,PieSeries as PieSeriesAm5}from"@amcharts/amcharts5/percent.js";
@@ -2,4 +2,4 @@
2
2
  All material copyright ESRI, All Rights Reserved, unless otherwise specified.
3
3
  See https://js.arcgis.com/4.34/esri/copyright.txt for details.
4
4
  */
5
- import{c as t,d as e,V as i}from"../../../chunks/LineSeries.js";export{A as AxisRendererXAm5,b as AxisRendererYAm5,L as LineSeriesAm5,X as XYChartAm5,a as XYCursorAm5}from"../../../chunks/LineSeries.js";import{i as s,v as o,P as n,q as r,k as l,m as h,f as g,s as d,t as c,u as m}from"../../../chunks/Theme.js";import{__awaiter as p}from"tslib";import{R as u}from"../../../chunks/Button.js";class x extends t{constructor(){super(...arguments),Object.defineProperty(this,"_ph",{enumerable:!0,configurable:!0,writable:!0,value:0}),Object.defineProperty(this,"_pw",{enumerable:!0,configurable:!0,writable:!0,value:0})}_makeGraphics(t,e){return this.makeColumn(e,t)}_makeFieldNames(){super._makeFieldNames();const t=this.get("xAxis"),e=this.get("yAxis"),i="CategoryAxis",s="ValueAxis";t.isType(i)&&(this.get("openCategoryXField")||(this._xOpenField=this._xField)),t.isType(s)&&(this.get("openValueXField")||(this._xOpenField=this._xField)),e.isType(i)&&(this.get("openCategoryYField")||(this._yOpenField=this._yField)),e.isType(s)&&(this.get("openValueYField")||(this._yOpenField=this._yField))}_prepareChildren(){super._prepareChildren();const t=this.get("xAxis"),e=this.get("yAxis"),i=this.dataItems.length,s=Math.max(0,this.startIndex()-2),a=Math.min(this.endIndex()+2,i-1);if(t.inited&&e.inited)for(let o=s;o<=a;o++){let t=this.dataItems[o];this._createGraphics(t)}}_updateChildren(){const t=this.chart;t&&(this._ph=t.plotContainer.height(),this._pw=t.plotContainer.width());const e=this.get("xAxis"),i=this.get("yAxis"),a=this.get("baseAxis"),o=this.columns.template;this.isDirty("fill")&&null==o.get("fill")&&o.set("fill",this.get("fill")),this.isDirty("fillPattern")&&null==o.get("fillPattern")&&o.set("fillPattern",this.get("fillPattern")),this.isDirty("stroke")&&null==o.get("stroke")&&o.set("stroke",this.get("stroke"));let n=0,r=0,l=0;s(a.series,t=>{if(t instanceof x){const e=t.get("stacked");e&&0==l&&r++,!e&&t.get("clustered")&&r++}t===this&&(n=r-1),l++}),this.get("clustered")||(n=0,r=1),0===r&&(r=1,n=0);const h=e.get("renderer"),g=i.get("renderer"),d="cellStartLocation",c="cellEndLocation",m=h.get(d,0),p=h.get(c,1),u=g.get(d,0),_=g.get(c,1);if(this._aLocationX0=m+n/r*(p-m),this._aLocationX1=m+(n+1)/r*(p-m),this._aLocationY0=u+n/r*(_-u),this._aLocationY1=u+(n+1)/r*(_-u),e.inited&&i.inited){if(this._axesDirty||this._valuesDirty||this._stackDirty||this.isDirty("vcx")||this.isDirty("vcy")||this._sizeDirty){const t=this.dataItems.length;let e=Math.max(0,this.startIndex()-2),i=Math.min(this.endIndex()+2,t-1);for(let a=0;a<e;a++)this._toggleColumn(this.dataItems[a],!1);let s=this.dataItems[e];for(let a=e;a<=i;a++){let t=this.dataItems[a];if(null!=t.get("valueX")&&null!=t.get("valueY")){if(s=t,a>0&&e>0)for(let t=a-1;t>=0;t--){let e=this.dataItems[t];if(null!=e.get("valueX")&&null!=e.get("valueY")){s=e;break}}break}this._toggleColumn(t,!1)}for(let a=e;a<=i;a++){let t=this.dataItems[a];this._updateGraphics(t,s),null!=t.get("valueX")&&null!=t.get("valueY")&&(s=t)}for(let a=i+1;a<t;a++)this._toggleColumn(this.dataItems[a],!1)}}else this._skipped=!0;this.getPrivate("doNotUpdateLegend")||this.updateLegendMarker(this.get("tooltipDataItem")),super._updateChildren()}_createGraphics(t){let e=t.get("graphics");if(!e){e=this._makeGraphics(this.columns,t),t.set("graphics",e),e._setDataItem(t);const i=t.get("legendDataItem");if(i){const t=i.get("markerRectangle");if(t){const i=t.states.lookup("default");s(o,s=>{const a=e.get(s,this.get(s));t.set(s,a),i.set(s,a)})}}let a=t.get("rangeGraphics");a&&s(a,t=>{t.dispose()}),a=[],t.setRaw("rangeGraphics",a),this.axisRanges.each(e=>{const i=e.container,s=this._makeGraphics(e.columns,t);a&&a.push(s),s.setPrivate("list",e.columns),i.children.push(s)})}}createAxisRange(t){return s(this.dataItems,t=>{const e=t.get("graphics");e&&(e.dispose(),t.set("graphics",void 0))}),super.createAxisRange(t)}_updateGraphics(t,e){let i=t.get("graphics");const a=this._xField,o=this._yField,l=t.get(a),h=t.get(o);if(null!=l&&null!=h){const l=this._xOpenField,h=this._yOpenField,g=this.get("locationX",t.get("locationX",.5)),d=this.get("locationY",t.get("locationY",.5)),c=this.get("openLocationX",t.get("openLocationX",g)),m=this.get("openLocationY",t.get("openLocationY",d)),p=i.get("width"),u=i.get("height"),x=this.get("stacked"),_=this.get("xAxis"),I=this.get("yAxis"),f=this.get("baseAxis"),y=_.get("start"),P=_.get("end"),b=I.get("start"),v=I.get("end");let D,T,C,w,A=this.get("vcy",1),k=this.get("vcx",1),F=!1,M=!1;if(I.isType("CategoryAxis")&&_.isType("CategoryAxis")){let e=this._aLocationX0+c-.5,i=this._aLocationX1+g-.5;if(p instanceof n){let t=(i-e)*(1-p.value)/2;e+=t,i-=t}if(D=_.getDataItemPositionX(t,l,e,k),T=_.getDataItemPositionX(t,a,i,k),e=this._aLocationY0+m-.5,i=this._aLocationY1+d-.5,u instanceof n){let t=(i-e)*(1-u.value)/2;e+=t,i-=t}C=I.getDataItemPositionY(t,h,e,A),w=I.getDataItemPositionY(t,o,i,A),t.setRaw("point",{x:D+(T-D)/2,y:C+(w-C)/2})}else if(_===f){let e=this._aLocationX0+c-.5,i=this._aLocationX1+g-.5;if(p instanceof n){let t=(i-e)*(1-p.value)/2;e+=t,i-=t}if(D=_.getDataItemPositionX(t,l,e,k),T=_.getDataItemPositionX(t,a,i,k),C=I.getDataItemPositionY(t,o,d,A),this._yOpenField!==this._yField)w=I.getDataItemPositionY(t,h,m,A);else if(x){let e=t.get("stackToItemY");w=e?I.getDataItemPositionY(e,o,m,e.component.get("vcy")):I.basePosition()}else w=I.basePosition();t.setRaw("point",{x:D+(T-D)/2,y:C}),M=!0}else if(I===f){let e=this._aLocationY0+m-.5,i=this._aLocationY1+d-.5;if(u instanceof n){let t=(i-e)*(1-u.value)/2;e+=t,i-=t}if(C=I.getDataItemPositionY(t,h,e,A),w=I.getDataItemPositionY(t,o,i,A),T=_.getDataItemPositionX(t,a,g,k),this._xOpenField!==this._xField)D=_.getDataItemPositionX(t,l,c,k);else if(x){let e=t.get("stackToItemX");D=e?_.getDataItemPositionX(e,a,c,e.component.get("vcx")):_.basePosition()}else D=_.basePosition();F=!0,t.setRaw("point",{x:T,y:C+(w-C)/2})}this._updateSeriesGraphics(t,i,D,T,C,w,F,M),D<y&&T<y||D>P&&T>P||C<b&&w<=b||C>=v&&w>v||r(D)||r(C)?this._toggleColumn(t,!1):this._toggleColumn(t,!0);let X=t.get("rangeGraphics");X&&s(X,e=>{this._updateSeriesGraphics(t,e,D,T,C,w,F,M)}),this._applyGraphicsStates(t,e)}else this._toggleColumn(t,!1)}_updateSeriesGraphics(t,e,i,s,a,o,n,r){const h=e.get("width"),g=e.get("height"),d=e.get("maxWidth"),c=e.get("maxHeight"),m=this.getPoint(i,a),p=this.getPoint(s,o),u=t.get("point");if(u){const t=this.getPoint(u.x,u.y);u.x=t.x+this._x,u.y=t.y+this._y}if(i=m.x,s=p.x,a=m.y,o=p.y,l(h)){const t=(s-i-h)/2;i+=t,s-=t}if(l(d)&&d<Math.abs(s-i)){const t=(s-i-d)/2;i+=t,s-=t}if(l(g)){const t=(o-a-g)/2;a+=t,o-=t}if(l(c)&&c<Math.abs(o-a)){const t=(o-a-c)/2;a+=t,o-=t}this.get("adjustBulletPosition")&&(n&&(s=Math.min(Math.max(0,s),this._pw),i=Math.min(Math.max(0,i),this._pw)),r&&(a=Math.min(Math.max(0,a),this._ph),o=Math.min(Math.max(0,o),this._ph))),t.setRaw("left",i),t.setRaw("right",s),t.setRaw("top",a),t.setRaw("bottom",o),e.setPrivate("width",s-i),e.setPrivate("height",o-a),e.set("x",i),e.set("y",o-(o-a))}_handleDataSetChange(){super._handleDataSetChange(),s(this._dataItems,t=>{this._toggleColumn(t,!1)})}_applyGraphicsStates(t,e){const i=t.get("graphics"),s=i.states.lookup("dropFromOpen"),a=i.states.lookup("riseFromOpen"),o=i.states.lookup("dropFromPrevious"),n=i.states.lookup("riseFromPrevious");if(s||o||a||n){const i=this.get("xAxis"),r=this.get("yAxis"),h=this.get("baseAxis");let g,d,c;h===i&&r.isType("ValueAxis")?(g=t.get(this._yOpenField),d=t.get(this._yField),c=e.get(this._yField)):h===r&&i.isType("ValueAxis")&&(g=t.get(this._xOpenField),d=t.get(this._xField),c=e.get(this._xField)),l(g)&&l(d)&&(d<g?s&&s.apply():a&&a.apply(),l(c)&&(d<c?o&&o.apply():n&&n.apply()))}}disposeDataItem(t){super.disposeDataItem(t);const e=t.get("graphics");e&&(this.columns.removeValue(e),e.dispose());const i=t.get("rangeGraphics");i&&s(i,t=>{const e=t.getPrivate("list");e&&e.removeValue(t),t.dispose()})}hideDataItem(t,e){const i=Object.create(null,{hideDataItem:{get:()=>super.hideDataItem}});return p(this,void 0,void 0,function*(){const a=[i.hideDataItem.call(this,t,e)],o=t.get("graphics");o&&a.push(o.hide(e));const n=t.get("rangeGraphics");n&&s(n,t=>{a.push(t.hide(e))}),yield Promise.all(a)})}_toggleColumn(t,e){const i=t.get("graphics");i&&i.setPrivate("visible",e);const a=t.get("rangeGraphics");a&&s(a,t=>{t.setPrivate("visible",e)});const o=t.bullets;o&&s(o,t=>{t.setPrivate("hidden",!e)})}showDataItem(t,e){const i=Object.create(null,{showDataItem:{get:()=>super.showDataItem}});return p(this,void 0,void 0,function*(){const a=[i.showDataItem.call(this,t,e)],o=t.get("graphics");o&&a.push(o.show(e));const n=t.get("rangeGraphics");n&&s(n,t=>{a.push(t.show(e))}),yield Promise.all(a)})}updateLegendMarker(t){let e=this.get("legendDataItem");if(this.get("useLastColorForLegendMarker")&&!t){const e=this.dataItems[this.endIndex()-1];e&&(t=e)}if(e){let i=this.columns.template;if(t){let e=t.get("graphics");e&&(i=e)}const a=e.get("markerRectangle");if(a&&!e.get("itemContainer").get("disabled")){const t=a.states.lookup("default");s(o,e=>{const s=i.get(e,this.get(e));a.set(e,s),t.set(e,s)})}}}_getTooltipTarget(t){if("bullet"==this.get("seriesTooltipTarget"))return super._getTooltipTarget(t);let e=t.get("graphics");return e||this}}Object.defineProperty(x,"className",{enumerable:!0,configurable:!0,writable:!0,value:"BaseColumnSeries"}),Object.defineProperty(x,"classNames",{enumerable:!0,configurable:!0,writable:!0,value:t.classNames.concat([x.className])});class _ extends e{constructor(){super(...arguments),Object.defineProperty(this,"_frequency",{enumerable:!0,configurable:!0,writable:!0,value:1}),Object.defineProperty(this,"_itemMap",{enumerable:!0,configurable:!0,writable:!0,value:{}})}_afterNew(){this._settings.themeTags=h(this._settings.themeTags,["axis"]),this.fields.push("category"),this.setPrivateRaw("name","category"),this.addTag("category"),super._afterNew()}_prepareChildren(){super._prepareChildren();const t=this.dataItems.length;let e=0;this._valuesDirty&&(this._itemMap={},s(this.dataItems,t=>{t.setRaw("index",e),this._itemMap[t.get("category")]=t,e++}),this.setPrivateRaw("maxZoomFactor",t)),this.setPrivateRaw("startIndex",Math.max(Math.round(this.get("start",0)*t),0)),this.setPrivateRaw("endIndex",Math.min(Math.round(this.get("end",1)*t),t)),(this._sizeDirty||this._valuesDirty||this.isDirty("start")||this.isDirty("end")||this.isPrivateDirty("endIndex")||this.isPrivateDirty("startIndex")||this.isPrivateDirty("width")||this.isPrivateDirty("height"))&&this.dataItems.length>0&&(this._handleRangeChange(),this._prepareAxisItems(),this._updateAxisRanges())}_handleRangeChange(){s(this.series,t=>{let e=this.dataItems[this.startIndex()].get("category"),a=this.dataItems[this.endIndex()-1].get("category"),o=t.get("baseAxis"),n=t.get("xAxis"),r=t.get("yAxis");if(n instanceof _&&r instanceof _)t._markDirtyAxes();else if(o===this){let l,h,g=r;if(n===o?(t.get("categoryXField")&&(l="categoryX"),t.get("openCategoryXField")&&(h="openCategoryX")):r===o&&(t.get("categoryYField")&&(l="categoryY"),t.get("openCategoryYField")&&(h="openCategoryY"),g=n),g instanceof i&&(l||h)){let i,o;for(let s=0,a=t.dataItems.length;s<a;s++){let a=t.dataItems[s];if(l&&a.get(l)===e){i=a;break}if(h&&a.get(h)===e){i=a;break}}for(let e=t.dataItems.length-1;e>=0;e--){let i=t.dataItems[e];if(l&&i.get(l)===a){o=i;break}if(h&&i.get(h)===a){o=i;break}}let n=0,r=t.dataItems.length;i&&(n=t.dataItems.indexOf(i)),o&&(r=t.dataItems.indexOf(o)+1),t.setPrivate("startIndex",n),t.setPrivate("endIndex",r);let g=!1;for(let e=n;e<r;e++){const i=t.dataItems[e];if(s(t.__valueXShowFields,t=>{null!=i.get(t)&&(g=!0)}),s(t.__valueYShowFields,t=>{null!=i.get(t)&&(g=!0)}),g)break}t.setPrivate("outOfSelection",!g)}t._markDirtyAxes()}})}_prepareAxisItems(){var t;const e=this.get("renderer"),i=this.dataItems.length;let s=this.startIndex();s>0&&s--;let a=this.endIndex();a<i&&a++;const o=e.get("minorLabelsEnabled"),n=e.get("minorGridEnabled",o);let r=e.axisLength()/Math.max(e.get("minGridDistance"),1),l=Math.max(1,Math.min(i,Math.ceil((a-s)/r)));s=Math.floor(s/l)*l,this._frequency=l;for(let g=0;g<i;g++)this._toggleDataItem(this.dataItems[g],!1);let h=this.dataItems[s].get("index",0);for(let g=s;g<a;g+=l){let t=this.dataItems[g];this._createAssets(t,[]),this._toggleDataItem(t,!0);let e=l;n&&(e=1),this._prepareDataItem(t,h,e),h++}if(e.get("minorGridEnabled"))for(let g=s;g<a;g++){let e=this.dataItems[g];g%l!=0&&(this._createAssets(e,["minor"],!0),this._toggleDataItem(e,!0),this._prepareDataItem(e,0,1),o||null===(t=e.get("label"))||void 0===t||t.setPrivate("visible",!1))}this._updateGhost()}_prepareDataItem(t,e,i){let s=this.get("renderer"),a=t.get("categoryLocation",0),o=t.get("endCategoryLocation",1),n=t.get("index");l(n)||(n=this.categoryToIndex(t.get("category")));let r,h=this.indexToPosition(n,a),g=t.get("endCategory");g?(r=this.categoryToIndex(g),l(r)||(r=n)):r=n;let d,c,m=this.indexToPosition(r,o);d=t.get("isRange")?r:n+this._frequency-1,c=this.indexToPosition(d,o),s.updateLabel(t.get("label"),h,m,i),s.updateGrid(t.get("grid"),h,m),s.updateTick(t.get("tick"),h,m,i),s.updateFill(t.get("axisFill"),h,c),this._processBullet(t),s.updateBullet(t.get("bullet"),h,m);const p=this.get("fillRule");p&&p(t,e)}startIndex(){let t=this.dataItems.length;return Math.min(Math.max(this.getPrivate("startIndex",0),0),t-1)}endIndex(){let t=this.dataItems.length;return Math.max(1,Math.min(this.getPrivate("endIndex",t),t))}baseValue(){}basePosition(){return 0}getX(t){let e=this._itemMap[t];return e?this._settings.renderer.positionToCoordinate(this.indexToPosition(e.get("index",0))):NaN}getY(t){let e=this._itemMap[t];return e?this._settings.renderer.positionToCoordinate(this.indexToPosition(e.get("index",0))):NaN}getDataItemPositionX(t,e,i,s){const a=t.get(e),o=this._itemMap[a];return o?this.indexToPosition(o.get("index",0),i):NaN}getDataItemCoordinateX(t,e,i,s){return this._settings.renderer.positionToCoordinate(this.getDataItemPositionX(t,e,i,s))}getDataItemPositionY(t,e,i,s){const a=t.get(e),o=this._itemMap[a];return o?this.indexToPosition(o.get("index",0),i):NaN}getDataItemCoordinateY(t,e,i,s){return this._settings.renderer.positionToCoordinate(this.getDataItemPositionY(t,e,i,s))}indexToPosition(t,e){l(e)||(e=.5);let i=this.dataItems.length,s=this.get("startLocation",0);i-=s,i-=1-this.get("endLocation",1);let a=(t+e-s)/i,o=this.dataItems[t];return o&&(a+=o.get("deltaPosition",0)),a}categoryToPosition(t){let e=this._itemMap[t];return e?this.indexToPosition(e.get("index")):NaN}categoryToIndex(t){let e=this._itemMap[t];return e?e.get("index"):NaN}dataItemToPosition(t){return this.indexToPosition(t.get("index"))}roundAxisPosition(t,e){return t+=(.5-e)/this.dataItems.length,this.indexToPosition(this.axisPositionToIndex(t),e)}axisPositionToIndex(t){let e=this.dataItems.length;return g(Math.floor(t*e),0,e-1)}getTooltipText(t,e){const i=this.dataItems[this.axisPositionToIndex(t)];if(i){const t=i.get("label");if(t)return d(t,this.get("tooltipText",""))}}_updateTooltipText(t,e){t._setDataItem(this.dataItems[this.axisPositionToIndex(e)]),t.label.text.markDirtyText()}getSeriesItem(t,e){if(this.dataItems.length>0){let i=this.getPrivate("name")+this.get("renderer").getPrivate("letter"),s=this.axisPositionToIndex(e),a=t.dataItems[s],o=this.dataItems[s],n=o.get("category");if(a&&o&&a.get(i)===n)return a;for(let e=0,r=t.dataItems.length;e<r;e++){let s=t.dataItems[e];if(s.get(i)===n)return s}}}zoomToIndexes(t,e,i){let s=this.dataItems.length;this.zoom(t/s,e/s,i)}zoomToCategories(t,e,i){this.zoomToIndexes(this.categoryToIndex(t),this.categoryToIndex(e)+1,i)}getCellWidthPosition(){return this._frequency/this.dataItems.length/(this.get("end",1)-this.get("start",0))}nextPosition(t){null==t&&(t=1),"Y"==this.get("renderer").getPrivate("letter")&&(t*=-1);const e=this.getPrivate("tooltipPosition",0),i=g(this.axisPositionToIndex(e)+t,0,this.dataItems.length-1);return this.toGlobalPosition(this.indexToPosition(i))}}Object.defineProperty(_,"className",{enumerable:!0,configurable:!0,writable:!0,value:"CategoryAxis"}),Object.defineProperty(_,"classNames",{enumerable:!0,configurable:!0,writable:!0,value:e.classNames.concat([_.className])});class I extends x{constructor(){super(...arguments),Object.defineProperty(this,"columns",{enumerable:!0,configurable:!0,writable:!0,value:this.addDisposer(new c(m.new({}),()=>u._new(this._root,{position:"absolute",themeTags:h(this.columns.template.get("themeTags",[]),["series","column"])},[this.columns.template])))})}makeColumn(t,e){const i=this.mainContainer.children.push(e.make());return i._setDataItem(t),e.push(i),i}_processAxisRange(t){super._processAxisRange(t),t.columns=new c(m.new({}),()=>u._new(this._root,{position:"absolute",themeTags:h(t.columns.template.get("themeTags",[]),["series","column"])},[this.columns.template,t.columns.template]))}}Object.defineProperty(I,"className",{enumerable:!0,configurable:!0,writable:!0,value:"ColumnSeries"}),Object.defineProperty(I,"classNames",{enumerable:!0,configurable:!0,writable:!0,value:x.classNames.concat([I.className])});export{_ as CategoryAxisAm5,I as ColumnSeriesAm5,i as ValueAxisAm5};
5
+ export{AxisRendererX as AxisRendererXAm5,AxisRendererY as AxisRendererYAm5,CategoryAxis as CategoryAxisAm5,ColumnSeries as ColumnSeriesAm5,LineSeries as LineSeriesAm5,ValueAxis as ValueAxisAm5,XYChart as XYChartAm5,XYCursor as XYCursorAm5}from"@amcharts/amcharts5/xy.js";
@@ -2,4 +2,4 @@
2
2
  All material copyright ESRI, All Rights Reserved, unless otherwise specified.
3
3
  See https://js.arcgis.com/4.34/esri/copyright.txt for details.
4
4
  */
5
- import{__decorate as e}from"tslib";import t from"../../Graphic.js";import{FeatureSetQueryInterceptor as i}from"../../arcade/featureset/support/FeatureSetQueryInterceptor.js";import s from"../../core/Accessor.js";import{isSome as o}from"../../core/arrayUtils.js";import{createTask as r}from"../../core/asyncUtils.js";import a from"../../core/Collection.js";import{IdentifiableMixin as n}from"../../core/Identifiable.js";import l from"../../core/Logger.js";import{abortMaybe as p}from"../../core/maybe.js";import{eachAlways as c,isAbortError as d,throwIfAborted as h}from"../../core/promiseUtils.js";import{watch as u,when as f,initial as m,on as _}from"../../core/reactiveUtils.js";import{throttle as y}from"../../core/throttle.js";import{property as g}from"../../core/accessorSupport/decorators/property.js";import{cast as b}from"../../core/accessorSupport/decorators/cast.js";import"../../core/has.js";import{subclass as v}from"../../core/accessorSupport/decorators/subclass.js";import w from"../../geometry/Point.js";import A from"../../geometry/SpatialReference.js";import I from"../../popup/content/TextContent.js";import{system as x}from"../../time/constants.js";import M from"./FeatureAttachments/FeatureAttachmentsViewModel.js";import T from"./FeatureContent/FeatureContentViewModel.js";import F from"./FeatureExpression/FeatureExpressionViewModel.js";import E from"./FeatureFields/FeatureFieldsViewModel.js";import C from"./FeatureMedia/FeatureMediaViewModel.js";import V from"./FeatureRelationship/FeatureRelationshipViewModel.js";import{compileExpressionInfos as j,formatArcadeValue as k}from"./support/arcadeFeatureUtils.js";import{preLayerQueryCallback as P,preRequestCallback as R,createFieldInfoMap as L,getAllFieldInfos as O,getSourceLayer as N,querySourceLayer as U,queryUpdatedFeature as Z,isRelatableFeatureSupportedLayer as S,isAssociatedFeatureSupportedLayer as B,substituteFieldsInLinksAndAttributes as H,isExpressionField as D,isRelatedField as G,formatEditInfo as q,graphicCallback as z,formatAttributes as Q}from"./support/featureUtils.js";import{queryLayerInfos as J,queryRelatedFeatures as K,setRelatedFeatures as W,getRelatedFieldInfo as X,createRelatedInfo as Y,updateRelatedInfo as $}from"./support/relatedFeatureUtils.js";import ee from"../support/UtilityNetworkAssociations/FeatureUtilityNetworkAssociationsViewModel.js";var te;const ie=1,se="content-view-models",oe="relationship-view-models",re="association-view-models",ae={attachmentsContent:!0,chartAnimation:!0,customContent:!0,expressionContent:!0,fieldsContent:!0,mediaContent:!0,textContent:!0,relationshipContent:!0,utilityNetworkAssociationsContent:!0};let ne=class extends(n(s)){static{te=this}constructor(e){super(e),this._error=null,this._graphicChangedTask=null,this._evaluateExpressionAttributesTask=null,this._associationVMAbortController=null,this._expressionAttributes=null,this._graphicExpressionAttributes=null,this.abilities={...ae},this.content=null,this.contentViewModels=[],this.description=null,this.defaultPopupTemplateEnabled=!1,this.formattedAttributes=null,this.graphic=null,this.lastEditInfo=null,this.location=null,this.relatedInfos=new Map,this.title="",this.view=null,this._graphicChangedThrottled=y(this._graphicChanged,()=>this.notifyChange("waitingForContent"),ie,this),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||"utility-network-associations"===e.type&&!!t.utilityNetworkAssociationsContent},this._evaluateExpressionAttributesThrottled=y(this._evaluateExpressionAttributes,()=>this.notifyChange("waitingForContent"),ie,this),this.addHandles([u(()=>[this.graphic,this._effectivePopupTemplate,this.abilities,this.timeZone],()=>this._graphicChangedThrottled(),m),f(()=>{if(!this._graphicChangedTask?.finished||null==this._graphicChangedTask.value)return null;const e=this._graphicChangedTask.value,t=e?.expressionInfos?.dependencies;return[e,t?.has("view-scale")?this.view?.scale:null,t?.has("view-time-extent")?this.view?.timeExtent?.start:null,t?.has("view-time-extent")?this.view?.timeExtent?.end:null]},([e])=>this._evaluateExpressionAttributesThrottled(e))])}initialize(){this.addHandles([this._graphicChangedThrottled,this._evaluateExpressionAttributesThrottled])}destroy(){this._clear(),this._graphicChangedTask=p(this._graphicChangedTask),this._evaluateExpressionAttributesTask=p(this._evaluateExpressionAttributesTask),this._error=null,this.graphic=null,this._destroyContentViewModels(),this.relatedInfos.clear()}static{this.interceptor=new i(P,R)}get _effectivePopupTemplate(){return null!=this.graphic?this.graphic.getEffectivePopupTemplate(this.defaultPopupTemplateEnabled):null}get _fieldInfoMap(){return L(O(this._effectivePopupTemplate),this._sourceLayer)}get _sourceLayer(){return N(this.graphic)}castAbilities(e){return{...ae,...e}}get isFeatureFromTable(){return this._sourceLayer?.isTable||!1}get state(){return this.graphic?this._error?"error":this.waitingForContent?"loading":"ready":"disabled"}get spatialReference(){return this.view?.spatialReference??null}set spatialReference(e){this._override("spatialReference",e)}get timeZone(){return this.view?.timeZone??x}set timeZone(e){this._overrideIfSome("timeZone",e)}get map(){return this.view?.map||null}set map(e){this._override("map",e)}get waitingForContent(){const{_graphicChangedThrottled:e,_evaluateExpressionAttributesThrottled:t,_graphicChangedTask:i,_evaluateExpressionAttributesTask:s,_associationVMAbortController:o}=this;return e.hasPendingUpdates()||t.hasPendingUpdates()||null!=i&&!i.finished||null!=s&&!s.finished||!!o}setActiveMedia(e,t){const i=this.contentViewModels[e];i instanceof C&&i.setActiveMedia(t)}nextMedia(e){const t=this.contentViewModels[e];t instanceof C&&t.next()}previousMedia(e){const t=this.contentViewModels[e];t instanceof C&&t.previous()}async updateGeometry(){const{graphic:e,spatialReference:t,_sourceLayer:i}=this;await(i?.load());const s=i?.objectIdField;if(!s||!e||!i)return;const o=e?.attributes?.[s];if(null==o)return;const r=[o];if(!e.geometry){const s=await U({layer:i,graphic:e,outFields:[],objectIds:r,returnGeometry:!0,spatialReference:t}),o=s?.geometry;o&&(e.geometry=o)}}_clear(){this._set("title",""),this._set("content",null),this._set("formattedAttributes",null)}_graphicChanged(){this._evaluateExpressionAttributesTask=p(this._evaluateExpressionAttributesTask),this._graphicChangedTask=p(this._graphicChangedTask),this._graphicChangedTask=r(async e=>{this._error=null,this._clear();const{graphic:t}=this;try{if(!t)return null;const{_sourceLayer:i,_effectivePopupTemplate:s}=this,o=this.spatialReference;await Z({graphic:t,popupTemplate:s,layer:i,spatialReference:o},{signal:e});const[{value:r},{value:a}]=await c([this._getContent(),this._getTitle()]),[,{value:n}]=await c([this._checkForRelatedFeatures({signal:e}),j(s?.expressionInfos,t)]);return{expressionInfos:n,content:r,title:a}}catch(i){throw d(i)||(this._error=i,l.getLogger(this).error("error","The popupTemplate could not be displayed for this feature.",{error:i,graphic:t,popupTemplate:this._effectivePopupTemplate})),i}})}_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):"utility-network-associations"===e.type?this._compileUtilityNetworkAssociation(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(o):"string"==typeof e?this._compileText(new I({text:e}),0).text:e}_destroyContentViewModels(){this.removeHandles(oe),this.removeHandles(se),this.contentViewModels.forEach(e=>e&&!e.destroyed&&e.destroy()),this._set("contentViewModels",[])}_matchesFeature(e,t){const i=e?.graphic?.getObjectId(),s=t?.getObjectId();return null!=i&&null!=s&&i===s}_setRelatedFeaturesViewModels({relatedFeatureViewModels:e,relatedFeatures:t,map:i}){const{view:s,spatialReference:o,timeZone:r}=this;t?.filter(Boolean).forEach(t=>{e.some(e=>this._matchesFeature(e,t))||e.add(new te({abilities:{relationshipContent:!1},map:i,view:s,spatialReference:o,timeZone:r,graphic:t}))}),e.forEach(i=>{const s=t?.find(e=>this._matchesFeature(i,e));s||e.remove(i)})}_setExpressionContentVM(e,t){const i=this.formattedAttributes,{contentElement:s,contentElementViewModel:o}=e,r=s?.type;o&&r&&("fields"===r&&(this._createFieldsFormattedAttributes({contentElement:s,contentElementIndex:t,formattedAttributes:i}),o.set(this._createFieldsVMParams(s,t))),"media"===r&&(this._createMediaFormattedAttributes({contentElement:s,contentElementIndex:t,formattedAttributes:i}),o.set(this._createMediaVMParams(s,t))),"text"===r&&o.set(this._createTextVMParams(s)))}_compileRelationship(e,t){const{displayCount:i,orderByFields:s,relationshipId:o,title:r,description:a}=e,{_sourceLayer:n,graphic:l,map:p}=this;if(!S(n))return;const c=new V({displayCount:i,graphic:l,orderByFields:s,relationshipId:o,layer:n,map:p,...this._compileTitleAndDesc({title:r,description:a})});return this.contentViewModels[t]=c,this.addHandles(_(()=>c.relatedFeatures,"change",()=>this._setRelatedFeaturesViewModels(c)),oe),e}_matchesGlobalFeature(e,t){return e.association.equals(t.association)}_setUpUtilityNetworkAssociationsViewModels(e,t,i){const{view:s,spatialReference:o,timeZone:r}=this;e.forEach((i,s)=>{const o=t.get(s);o?i.forEach(t=>{o.find(e=>this._matchesGlobalFeature(t,e))||(i.remove(t),0===i.length&&e.delete(s))}):(i.removeAll(),e.delete(s))}),t.forEach((t,n)=>{const l=e.get(n)||new a;t?.filter(Boolean).forEach((e,t)=>{if(!l.some(t=>this._matchesGlobalFeature(t,e))){const{association:a,feature:n,terminalName:p,title:c}=e;l.add({title:c,association:a,featureViewModel:new te({abilities:{utilityNetworkAssociationsContent:!1},map:i,view:s,spatialReference:o,timeZone:r,graphic:n}),terminalName:p},t)}}),e.set(n,l)})}_compileUtilityNetworkAssociation(e,t){const{displayCount:i,title:s,description:o,associationTypes:r}=e,{_sourceLayer:a,graphic:n,map:l}=this;if(!B(a))return;const p=new ee({graphic:n,displayCount:i,associationTypes:r,layer:a,map:l,...this._compileTitleAndDesc({title:s,description:o})});return this.contentViewModels[t]=p,this.addHandles([u(()=>p.associationFeatures.values(),()=>this._setUpUtilityNetworkAssociationsViewModels(p.associationViewModels,p.associationFeatures,p.map))],re),e}_compileExpression(e,t){const{expressionInfo:i}=e,{graphic:s,map:o,spatialReference:r,view:a,location:n}=this,l=new F({expressionInfo:i,graphic:s,interceptor:te.interceptor,map:o,spatialReference:r,view:a,location:n});return this.contentViewModels[t]=l,this.addHandles(u(()=>l.contentElementViewModel,()=>this._setExpressionContentVM(l,t),m),se),e}_compileAttachments(e,t){const{graphic:i}=this,{description:s,title:o,orderByFields:r}=e;return this.contentViewModels[t]=new M({graphic:i,orderByFields:r,...this._compileTitleAndDesc({title:o,description:s})}),e}_compileCustom(e,t){const{graphic:i}=this,{creator:s,destroyer:o}=e;return this.contentViewModels[t]=new T({graphic:i,creator:s,destroyer:o}),e}_compileTitleAndDesc({title:e,description:t}){const{_fieldInfoMap:i,_sourceLayer:s,graphic:o,formattedAttributes:r}=this,a=o?.attributes,n=this._expressionAttributes,l=r.global;return{title:H({attributes:a,fieldInfoMap:i,globalAttributes:l,expressionAttributes:n,layer:s,text:e}),description:H({attributes:a,fieldInfoMap:i,globalAttributes:l,expressionAttributes:n,layer:s,text:t})}}_createFieldsVMParams(e,t){const i=this._effectivePopupTemplate,s=this.formattedAttributes,o={...s?.global,...s?.content[t]},r=e?.fieldInfos||i?.fieldInfos,a=r?.filter(({fieldName:e})=>!!e&&(D(e)||G(e)||o.hasOwnProperty(e))),n=i?.expressionInfos,{description:l,title:p}=e;return{attributes:o,expressionInfos:n,fieldInfos:a,...this._compileTitleAndDesc({title:p,description:l})}}_compileFields(e,t){const i=e.clone(),s=new E(this._createFieldsVMParams(e,t));return this.contentViewModels[t]=s,i.fieldInfos=s.formattedFieldInfos.slice(),i}_createMediaVMParams(e,t){const{abilities:i,graphic:s,_fieldInfoMap:o,_effectivePopupTemplate:r,relatedInfos:a,_sourceLayer:n,_expressionAttributes:l}=this,p=this.formattedAttributes,c=s?.attributes??{},{description:d,mediaInfos:h,title:u}=e;return{abilities:{chartAnimation:i.chartAnimation},activeMediaInfoIndex:e.activeMediaInfoIndex||0,attributes:c,isAggregate:s?.isAggregate,layer:n,fieldInfoMap:o,formattedAttributes:{...p?.global,...p?.content[t]},expressionAttributes:l,mediaInfos:h,popupTemplate:r,relatedInfos:a,...this._compileTitleAndDesc({title:u,description:d})}}_compileMedia(e,t){const i=e.clone(),s=new C(this._createMediaVMParams(e,t));return i.mediaInfos=s.formattedMediaInfos.slice(),this.contentViewModels[t]=s,i}_createTextVMParams(e){const{graphic:t,_fieldInfoMap:i,_sourceLayer:s,_expressionAttributes:o}=this;if(e&&e.text){const r=t?.attributes??{},a=this.formattedAttributes?.global??{};e.text=H({attributes:r,fieldInfoMap:i,globalAttributes:a,expressionAttributes:o,layer:s,text:e.text})}return{graphic:t,creator:e.text}}_compileText(e,t){const i=e.clone();return this.contentViewModels[t]=new T(this._createTextVMParams(i)),i}_compileLastEditInfo(){const{_effectivePopupTemplate:e,_sourceLayer:t,graphic:i,timeZone:s}=this;if(!e)return;const{lastEditInfoEnabled:o}=e,r=t?.editFieldsInfo;return o&&r?q(r,i?.attributes,s,t):void 0}_compileTitle(e){const{_fieldInfoMap:t,_sourceLayer:i,graphic:s,_expressionAttributes:o}=this,r=s?.attributes??{},a=this.formattedAttributes?.global??{};return H({attributes:r,fieldInfoMap:t,globalAttributes:a,expressionAttributes:o,layer:i,text:e})}async _getTitle(){const{_effectivePopupTemplate:e,graphic:t}=this;return t?z({type:"title",value:e?.title,event:{graphic:t}}):null}async _getContent(){const{_effectivePopupTemplate:e,graphic:t}=this;return t?z({type:"content",value:e?.content,event:{graphic:t}}):null}_evaluateExpressionAttributes({title:e,content:t,expressionInfos:i}){this._evaluateExpressionAttributesTask=p(this._evaluateExpressionAttributesTask),this._evaluateExpressionAttributesTask=r(async s=>{const{graphic:o,map:r,view:a,spatialReference:n,location:p}=this;try{if(!o)return;let l;if(null!=i){const e=[];for(const[t,l]of i.expressions.entries())null!=l?e.push(l.evaluate({graphic:o,interceptor:te.interceptor,location:p,map:r,options:{signal:s},spatialReference:n,view:a}).then(e=>[t,"string"==typeof e?k(e):e]).catch(()=>[t,void 0])):e.push(Promise.resolve([t,void 0]));l=Object.fromEntries(await Promise.all(e)),h(s)}this._expressionAttributes=l,this._graphicExpressionAttributes={...o.attributes,...l},this._set("formattedAttributes",this._createFormattedAttributes(t)),this._set("title",this._compileTitle(e)),this._set("lastEditInfo",this._compileLastEditInfo()||null),this._set("content",this._compileContent(t)||null)}catch(c){d(c)||(this._error=c,l.getLogger(this).error("error","The popupTemplate could not be displayed for this feature.",{error:c,graphic:o,popupTemplate:this._effectivePopupTemplate}))}})}_createMediaFormattedAttributes({contentElement:e,contentElementIndex:t,formattedAttributes:i}){const{_effectivePopupTemplate:s,graphic:o,relatedInfos:r,_sourceLayer:a,_fieldInfoMap:n,_graphicExpressionAttributes:l,timeZone:p}=this;i.content[t]=Q({fieldInfos:s?.fieldInfos,graphic:o,attributes:{...l,...e.attributes},layer:a,fieldInfoMap:n,relatedInfos:r,timeZone:p})}_createFieldsFormattedAttributes({contentElement:e,contentElementIndex:t,formattedAttributes:i}){if(e.fieldInfos){const{graphic:s,relatedInfos:o,_sourceLayer:r,_fieldInfoMap:a,_graphicExpressionAttributes:n,timeZone:l}=this;i.content[t]=Q({fieldInfos:e.fieldInfos,graphic:s,attributes:{...n,...e.attributes},layer:r,fieldInfoMap:a,relatedInfos:o,timeZone:l})}}_createFormattedAttributes(e){const{_effectivePopupTemplate:t,graphic:i,relatedInfos:s,_sourceLayer:o,_fieldInfoMap:r,_graphicExpressionAttributes:a,timeZone:n}=this,l=t?.fieldInfos,p={global:Q({fieldInfos:l,graphic:i,attributes:a,layer:o,fieldInfoMap:r,relatedInfos:s,timeZone:n}),content:[]};return Array.isArray(e)&&e.forEach((e,t)=>{"fields"===e.type&&this._createFieldsFormattedAttributes({contentElement:e,contentElementIndex:t,formattedAttributes:p}),"media"===e.type&&this._createMediaFormattedAttributes({contentElement:e,contentElementIndex:t,formattedAttributes:p})}),p}_checkForRelatedFeatures(e){const{graphic:t,_effectivePopupTemplate:i}=this;return this._queryRelatedInfos(t,O(i),e)}async _queryRelatedInfos(e,t,i){const{relatedInfos:s,_sourceLayer:o}=this;s.clear();const r=null!=o?.associatedLayer?await(o?.associatedLayer.load(i)):o;if(!r||!e)return;const a=t.filter(e=>!!e.fieldName&&G(e.fieldName));if(!a?.length)return;t.forEach(e=>this._configureRelatedInfo(e,r));const n=await J({relatedInfos:s,layer:r},i);Object.keys(n).forEach(e=>{const t=s.get(e.toString()),i=n[e]?.value;t&&i&&(t.layerInfo=i.data)});const l=await K({graphic:e,relatedInfos:s,layer:r},i);Object.keys(l).forEach(e=>{W(l[e]?.value,s.get(e.toString()))})}_configureRelatedInfo(e,t){const{relatedInfos:i}=this,s=X(e.fieldName||"");if(!s)return;const{layerId:o,fieldName:r}=s;if(!o)return;const a=i.get(o.toString())||Y(o,t);a&&($({relatedInfo:a,fieldName:r,fieldInfo:e}),this.relatedInfos.set(o,a))}};e([g()],ne.prototype,"_error",void 0),e([g()],ne.prototype,"_graphicChangedTask",void 0),e([g()],ne.prototype,"_evaluateExpressionAttributesTask",void 0),e([g()],ne.prototype,"_associationVMAbortController",void 0),e([g({readOnly:!0})],ne.prototype,"_effectivePopupTemplate",null),e([g({readOnly:!0})],ne.prototype,"_fieldInfoMap",null),e([g({readOnly:!0})],ne.prototype,"_sourceLayer",null),e([g()],ne.prototype,"abilities",void 0),e([b("abilities")],ne.prototype,"castAbilities",null),e([g({readOnly:!0})],ne.prototype,"content",void 0),e([g({readOnly:!0})],ne.prototype,"contentViewModels",void 0),e([g()],ne.prototype,"description",void 0),e([g({type:Boolean})],ne.prototype,"defaultPopupTemplateEnabled",void 0),e([g({readOnly:!0})],ne.prototype,"isFeatureFromTable",null),e([g({readOnly:!0})],ne.prototype,"state",null),e([g({readOnly:!0})],ne.prototype,"formattedAttributes",void 0),e([g({type:t})],ne.prototype,"graphic",void 0),e([g({readOnly:!0})],ne.prototype,"lastEditInfo",void 0),e([g({type:w})],ne.prototype,"location",void 0),e([g({readOnly:!0})],ne.prototype,"relatedInfos",void 0),e([g({type:A})],ne.prototype,"spatialReference",null),e([g()],ne.prototype,"timeZone",null),e([g({readOnly:!0})],ne.prototype,"title",void 0),e([g()],ne.prototype,"map",null),e([g({readOnly:!0})],ne.prototype,"waitingForContent",null),e([g()],ne.prototype,"view",void 0),ne=te=e([v("esri.widgets.Feature.FeatureViewModel")],ne);export{ne as default};
5
+ import{__decorate as e}from"tslib";import t from"../../Graphic.js";import{FeatureSetQueryInterceptor as i}from"../../arcade/featureset/support/FeatureSetQueryInterceptor.js";import s from"../../core/Accessor.js";import{isSome as o}from"../../core/arrayUtils.js";import{createTask as r}from"../../core/asyncUtils.js";import a from"../../core/Collection.js";import{IdentifiableMixin as n}from"../../core/Identifiable.js";import l from"../../core/Logger.js";import{abortMaybe as p}from"../../core/maybe.js";import{eachAlways as c,isAbortError as d,throwIfAborted as h}from"../../core/promiseUtils.js";import{watch as u,when as m,initial as f,on as _}from"../../core/reactiveUtils.js";import{throttle as y}from"../../core/throttle.js";import{property as g}from"../../core/accessorSupport/decorators/property.js";import{cast as b}from"../../core/accessorSupport/decorators/cast.js";import"../../core/has.js";import{subclass as v}from"../../core/accessorSupport/decorators/subclass.js";import w from"../../geometry/Point.js";import A from"../../geometry/SpatialReference.js";import I from"../../popup/content/TextContent.js";import{system as x}from"../../time/constants.js";import M from"./FeatureAttachments/FeatureAttachmentsViewModel.js";import T from"./FeatureContent/FeatureContentViewModel.js";import F from"./FeatureExpression/FeatureExpressionViewModel.js";import E from"./FeatureFields/FeatureFieldsViewModel.js";import C from"./FeatureMedia/FeatureMediaViewModel.js";import V from"./FeatureRelationship/FeatureRelationshipViewModel.js";import{compileExpressionInfos as j,formatArcadeValue as k}from"./support/arcadeFeatureUtils.js";import{preLayerQueryCallback as P,preRequestCallback as R,createFieldInfoMap as L,getAllFieldInfos as O,getSourceLayer as N,querySourceLayer as U,queryUpdatedFeature as Z,isRelatableFeatureSupportedLayer as S,isAssociatedFeatureSupportedLayer as B,substituteFieldsInLinksAndAttributes as H,isExpressionField as D,isRelatedField as G,formatEditInfo as q,graphicCallback as K,formatAttributes as z}from"./support/featureUtils.js";import{queryLayerInfos as Q,queryRelatedFeatures as J,setRelatedFeatures as W,getRelatedFieldInfo as X,createRelatedInfo as Y,updateRelatedInfo as $}from"./support/relatedFeatureUtils.js";import ee from"../support/UtilityNetworkAssociations/FeatureUtilityNetworkAssociationsViewModel.js";var te;const ie=1,se="content-view-models",oe="relationship-view-models",re="association-view-models",ae={attachmentsContent:!0,chartAnimation:!0,customContent:!0,expressionContent:!0,fieldsContent:!0,mediaContent:!0,textContent:!0,relationshipContent:!0,utilityNetworkAssociationsContent:!0};let ne=class extends(n(s)){static{te=this}constructor(e){super(e),this._error=null,this._graphicChangedTask=null,this._evaluateExpressionAttributesTask=null,this._associationVMAbortController=null,this._expressionAttributes=null,this._graphicExpressionAttributes=null,this.abilities={...ae},this.content=null,this.contentViewModels=[],this.description=null,this.defaultPopupTemplateEnabled=!1,this.formattedAttributes=null,this.graphic=null,this.lastEditInfo=null,this.location=null,this.relatedInfos=new Map,this.title="",this.view=null,this._graphicChangedThrottled=y(this._graphicChanged,()=>this.notifyChange("waitingForContent"),ie,this),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||"utility-network-associations"===e.type&&!!t.utilityNetworkAssociationsContent},this._evaluateExpressionAttributesThrottled=y(this._evaluateExpressionAttributes,()=>this.notifyChange("waitingForContent"),ie,this),this.addHandles([u(()=>[this.graphic,this._effectivePopupTemplate,this.abilities,this.timeZone],()=>this._graphicChangedThrottled(),f),m(()=>{if(!this._graphicChangedTask?.finished||null==this._graphicChangedTask.value)return null;const e=this._graphicChangedTask.value,t=e?.expressionInfos?.dependencies;return[e,t?.has("view-scale")?this.view?.scale:null,t?.has("view-time-extent")?this.view?.timeExtent?.start:null,t?.has("view-time-extent")?this.view?.timeExtent?.end:null]},([e])=>this._evaluateExpressionAttributesThrottled(e))])}initialize(){this.addHandles([this._graphicChangedThrottled,this._evaluateExpressionAttributesThrottled])}destroy(){this._clear(),this._graphicChangedTask=p(this._graphicChangedTask),this._evaluateExpressionAttributesTask=p(this._evaluateExpressionAttributesTask),this._error=null,this.graphic=null,this._destroyContentViewModels(),this.relatedInfos.clear()}static{this.interceptor=new i(P,R)}get _effectivePopupTemplate(){return null!=this.graphic?this.graphic.getEffectivePopupTemplate(this.defaultPopupTemplateEnabled):null}get _fieldInfoMap(){return L(O(this._effectivePopupTemplate),this._sourceLayer)}get _sourceLayer(){return N(this.graphic)}castAbilities(e){return{...ae,...e}}get isFeatureFromTable(){return this._sourceLayer?.isTable||!1}get state(){return this.graphic?this._error?"error":this.waitingForContent?"loading":"ready":"disabled"}get spatialReference(){return this.view?.spatialReference??null}set spatialReference(e){this._override("spatialReference",e)}get timeZone(){return this.view?.timeZone??x}set timeZone(e){this._overrideIfSome("timeZone",e)}get map(){return this.view?.map||null}set map(e){this._override("map",e)}get waitingForContent(){const{_graphicChangedThrottled:e,_evaluateExpressionAttributesThrottled:t,_graphicChangedTask:i,_evaluateExpressionAttributesTask:s,_associationVMAbortController:o}=this;return e.hasPendingUpdates()||t.hasPendingUpdates()||null!=i&&!i.finished||null!=s&&!s.finished||!!o}setActiveMedia(e,t){const i=this.contentViewModels[e];i instanceof C&&i.setActiveMedia(t)}nextMedia(e){const t=this.contentViewModels[e];t instanceof C&&t.next()}previousMedia(e){const t=this.contentViewModels[e];t instanceof C&&t.previous()}async updateGeometry(){const{graphic:e,spatialReference:t,_sourceLayer:i}=this;await(i?.load());const s=i?.objectIdField;if(!s||!e||!i)return;const o=e?.attributes?.[s];if(null==o)return;const r=[o];if(!e.geometry){const s=await U({layer:i,graphic:e,outFields:[],objectIds:r,returnGeometry:!0,spatialReference:t}),o=s?.geometry;o&&(e.geometry=o)}}_clear(){this._set("title",""),this._set("content",null),this._set("formattedAttributes",null)}_graphicChanged(){this._evaluateExpressionAttributesTask=p(this._evaluateExpressionAttributesTask),this._graphicChangedTask=p(this._graphicChangedTask),this._graphicChangedTask=r(async e=>{this._error=null,this._clear();const{graphic:t}=this;try{if(!t)return null;const{_sourceLayer:i,_effectivePopupTemplate:s}=this,o=this.spatialReference;await Z({graphic:t,popupTemplate:s,layer:i,spatialReference:o},{signal:e});const[{value:r},{value:a}]=await c([this._getContent(),this._getTitle()]),[,{value:n}]=await c([this._checkForRelatedFeatures({signal:e}),j(s?.expressionInfos,t)]);return{expressionInfos:n,content:r,title:a}}catch(i){throw d(i)||(this._error=i,l.getLogger(this).error("error","The popupTemplate could not be displayed for this feature.",{error:i,graphic:t,popupTemplate:this._effectivePopupTemplate})),i}})}_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):"utility-network-associations"===e.type?this._compileUtilityNetworkAssociation(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(o):"string"==typeof e?this._compileText(new I({text:e}),0).text:e}_destroyContentViewModels(){this.removeHandles(oe),this.removeHandles(se),this.contentViewModels.forEach(e=>e&&!e.destroyed&&e.destroy()),this._set("contentViewModels",[])}_matchesFeature(e,t){const i=e?.graphic?.getObjectId(),s=t?.getObjectId();return null!=i&&null!=s&&i===s}_setRelatedFeaturesViewModels({relatedFeatureViewModels:e,relatedFeatures:t,map:i}){const{view:s,spatialReference:o,timeZone:r}=this;t?.filter(Boolean).forEach(t=>{e.some(e=>this._matchesFeature(e,t))||e.add(new te({abilities:{relationshipContent:!1},map:i,view:s,spatialReference:o,timeZone:r,graphic:t}))}),e.forEach(i=>{const s=t?.find(e=>this._matchesFeature(i,e));s||e.remove(i)})}_setExpressionContentVM(e,t){const i=this.formattedAttributes,{contentElement:s,contentElementViewModel:o}=e,r=s?.type;o&&r&&("fields"===r&&(this._createFieldsFormattedAttributes({contentElement:s,contentElementIndex:t,formattedAttributes:i}),o.set(this._createFieldsVMParams(s,t))),"media"===r&&(this._createMediaFormattedAttributes({contentElement:s,contentElementIndex:t,formattedAttributes:i}),o.set(this._createMediaVMParams(s,t))),"text"===r&&o.set(this._createTextVMParams(s)))}_compileRelationship(e,t){const{displayCount:i,orderByFields:s,relationshipId:o,title:r,description:a}=e,{_sourceLayer:n,graphic:l,map:p}=this;if(!S(n))return;const c=new V({displayCount:i,graphic:l,orderByFields:s,relationshipId:o,layer:n,map:p,...this._compileTitleAndDesc({title:r,description:a})});return this.contentViewModels[t]=c,this.addHandles(_(()=>c.relatedFeatures,"change",()=>this._setRelatedFeaturesViewModels(c)),oe),e}_matchesGlobalFeature(e,t){return e.association.equals(t.association)}_setUpUtilityNetworkAssociationsViewModels(e,t,i){const{view:s,spatialReference:o,timeZone:r}=this;e.forEach((i,s)=>{const o=t.get(s);o?i.forEach(t=>{o.find(e=>this._matchesGlobalFeature(t,e))||(i.remove(t),0===i.length&&e.delete(s))}):(i.removeAll(),e.delete(s))}),t.forEach((t,n)=>{const l=e.get(n)||new a;t?.filter(Boolean).forEach((e,t)=>{if(!l.some(t=>this._matchesGlobalFeature(t,e))){const{association:a,feature:n,terminalName:p,title:c}=e;l.add({title:c,association:a,featureViewModel:new te({abilities:{utilityNetworkAssociationsContent:!1},map:i,view:s,spatialReference:o,timeZone:r,graphic:n}),terminalName:p},t)}}),e.set(n,l)})}_compileUtilityNetworkAssociation(e,t){const{displayCount:i,title:s,description:o,associationTypes:r}=e,{_sourceLayer:a,graphic:n,map:l}=this;if(!B(a))return;const p=new ee({graphic:n,displayCount:i,associationTypes:r,layer:a,map:l,...this._compileTitleAndDesc({title:s,description:o})});return this.contentViewModels[t]=p,this.addHandles([u(()=>p.associationFeatures.values(),()=>this._setUpUtilityNetworkAssociationsViewModels(p.associationViewModels,p.associationFeatures,p.map))],re),e}_compileExpression(e,t){const{expressionInfo:i}=e,{graphic:s,map:o,spatialReference:r,view:a,location:n}=this,l=new F({expressionInfo:i,graphic:s,interceptor:te.interceptor,map:o,spatialReference:r,view:a,location:n});return this.contentViewModels[t]=l,this.addHandles(u(()=>l.contentElementViewModel,()=>this._setExpressionContentVM(l,t),f),se),e}_compileAttachments(e,t){const{graphic:i}=this,{description:s,title:o,orderByFields:r,attachmentKeywords:a,attachmentTypes:n}=e;return this.contentViewModels[t]=new M({attachmentKeywords:a,attachmentTypes:n,graphic:i,orderByFields:r,...this._compileTitleAndDesc({title:o,description:s})}),e}_compileCustom(e,t){const{graphic:i}=this,{creator:s,destroyer:o}=e;return this.contentViewModels[t]=new T({graphic:i,creator:s,destroyer:o}),e}_compileTitleAndDesc({title:e,description:t}){const{_fieldInfoMap:i,_sourceLayer:s,graphic:o,formattedAttributes:r}=this,a=o?.attributes,n=this._expressionAttributes,l=r.global;return{title:H({attributes:a,fieldInfoMap:i,globalAttributes:l,expressionAttributes:n,layer:s,text:e}),description:H({attributes:a,fieldInfoMap:i,globalAttributes:l,expressionAttributes:n,layer:s,text:t})}}_createFieldsVMParams(e,t){const i=this._effectivePopupTemplate,s=this.formattedAttributes,o={...s?.global,...s?.content[t]},r=e?.fieldInfos||i?.fieldInfos,a=r?.filter(({fieldName:e})=>!!e&&(D(e)||G(e)||o.hasOwnProperty(e))),n=i?.expressionInfos,{description:l,title:p}=e;return{attributes:o,expressionInfos:n,fieldInfos:a,...this._compileTitleAndDesc({title:p,description:l})}}_compileFields(e,t){const i=e.clone(),s=new E(this._createFieldsVMParams(e,t));return this.contentViewModels[t]=s,i.fieldInfos=s.formattedFieldInfos.slice(),i}_createMediaVMParams(e,t){const{abilities:i,graphic:s,_fieldInfoMap:o,_effectivePopupTemplate:r,relatedInfos:a,_sourceLayer:n,_expressionAttributes:l}=this,p=this.formattedAttributes,c=s?.attributes??{},{description:d,mediaInfos:h,title:u}=e;return{abilities:{chartAnimation:i.chartAnimation},activeMediaInfoIndex:e.activeMediaInfoIndex||0,attributes:c,isAggregate:s?.isAggregate,layer:n,fieldInfoMap:o,formattedAttributes:{...p?.global,...p?.content[t]},expressionAttributes:l,mediaInfos:h,popupTemplate:r,relatedInfos:a,...this._compileTitleAndDesc({title:u,description:d})}}_compileMedia(e,t){const i=e.clone(),s=new C(this._createMediaVMParams(e,t));return i.mediaInfos=s.formattedMediaInfos.slice(),this.contentViewModels[t]=s,i}_createTextVMParams(e){const{graphic:t,_fieldInfoMap:i,_sourceLayer:s,_expressionAttributes:o}=this;if(e&&e.text){const r=t?.attributes??{},a=this.formattedAttributes?.global??{};e.text=H({attributes:r,fieldInfoMap:i,globalAttributes:a,expressionAttributes:o,layer:s,text:e.text})}return{graphic:t,creator:e.text}}_compileText(e,t){const i=e.clone();return this.contentViewModels[t]=new T(this._createTextVMParams(i)),i}_compileLastEditInfo(){const{_effectivePopupTemplate:e,_sourceLayer:t,graphic:i,timeZone:s}=this;if(!e)return;const{lastEditInfoEnabled:o}=e,r=t?.editFieldsInfo;return o&&r?q(r,i?.attributes,s,t):void 0}_compileTitle(e){const{_fieldInfoMap:t,_sourceLayer:i,graphic:s,_expressionAttributes:o}=this,r=s?.attributes??{},a=this.formattedAttributes?.global??{};return H({attributes:r,fieldInfoMap:t,globalAttributes:a,expressionAttributes:o,layer:i,text:e})}async _getTitle(){const{_effectivePopupTemplate:e,graphic:t}=this;return t?K({type:"title",value:e?.title,event:{graphic:t}}):null}async _getContent(){const{_effectivePopupTemplate:e,graphic:t}=this;return t?K({type:"content",value:e?.content,event:{graphic:t}}):null}_evaluateExpressionAttributes({title:e,content:t,expressionInfos:i}){this._evaluateExpressionAttributesTask=p(this._evaluateExpressionAttributesTask),this._evaluateExpressionAttributesTask=r(async s=>{const{graphic:o,map:r,view:a,spatialReference:n,location:p}=this;try{if(!o)return;let l;if(null!=i){const e=[];for(const[t,l]of i.expressions.entries())null!=l?e.push(l.evaluate({graphic:o,interceptor:te.interceptor,location:p,map:r,options:{signal:s},spatialReference:n,view:a}).then(e=>[t,"string"==typeof e?k(e):e]).catch(()=>[t,void 0])):e.push(Promise.resolve([t,void 0]));l=Object.fromEntries(await Promise.all(e)),h(s)}this._expressionAttributes=l,this._graphicExpressionAttributes={...o.attributes,...l},this._set("formattedAttributes",this._createFormattedAttributes(t)),this._set("title",this._compileTitle(e)),this._set("lastEditInfo",this._compileLastEditInfo()||null),this._set("content",this._compileContent(t)||null)}catch(c){d(c)||(this._error=c,l.getLogger(this).error("error","The popupTemplate could not be displayed for this feature.",{error:c,graphic:o,popupTemplate:this._effectivePopupTemplate}))}})}_createMediaFormattedAttributes({contentElement:e,contentElementIndex:t,formattedAttributes:i}){const{_effectivePopupTemplate:s,graphic:o,relatedInfos:r,_sourceLayer:a,_fieldInfoMap:n,_graphicExpressionAttributes:l,timeZone:p}=this;i.content[t]=z({fieldInfos:s?.fieldInfos,graphic:o,attributes:{...l,...e.attributes},layer:a,fieldInfoMap:n,relatedInfos:r,timeZone:p})}_createFieldsFormattedAttributes({contentElement:e,contentElementIndex:t,formattedAttributes:i}){if(e.fieldInfos){const{graphic:s,relatedInfos:o,_sourceLayer:r,_fieldInfoMap:a,_graphicExpressionAttributes:n,timeZone:l}=this;i.content[t]=z({fieldInfos:e.fieldInfos,graphic:s,attributes:{...n,...e.attributes},layer:r,fieldInfoMap:a,relatedInfos:o,timeZone:l})}}_createFormattedAttributes(e){const{_effectivePopupTemplate:t,graphic:i,relatedInfos:s,_sourceLayer:o,_fieldInfoMap:r,_graphicExpressionAttributes:a,timeZone:n}=this,l=t?.fieldInfos,p={global:z({fieldInfos:l,graphic:i,attributes:a,layer:o,fieldInfoMap:r,relatedInfos:s,timeZone:n}),content:[]};return Array.isArray(e)&&e.forEach((e,t)=>{"fields"===e.type&&this._createFieldsFormattedAttributes({contentElement:e,contentElementIndex:t,formattedAttributes:p}),"media"===e.type&&this._createMediaFormattedAttributes({contentElement:e,contentElementIndex:t,formattedAttributes:p})}),p}_checkForRelatedFeatures(e){const{graphic:t,_effectivePopupTemplate:i}=this;return this._queryRelatedInfos(t,O(i),e)}async _queryRelatedInfos(e,t,i){const{relatedInfos:s,_sourceLayer:o}=this;s.clear();const r=null!=o?.associatedLayer?await(o?.associatedLayer.load(i)):o;if(!r||!e)return;const a=t.filter(e=>!!e.fieldName&&G(e.fieldName));if(!a?.length)return;t.forEach(e=>this._configureRelatedInfo(e,r));const n=await Q({relatedInfos:s,layer:r},i);Object.keys(n).forEach(e=>{const t=s.get(e.toString()),i=n[e]?.value;t&&i&&(t.layerInfo=i.data)});const l=await J({graphic:e,relatedInfos:s,layer:r},i);Object.keys(l).forEach(e=>{W(l[e]?.value,s.get(e.toString()))})}_configureRelatedInfo(e,t){const{relatedInfos:i}=this,s=X(e.fieldName||"");if(!s)return;const{layerId:o,fieldName:r}=s;if(!o)return;const a=i.get(o.toString())||Y(o,t);a&&($({relatedInfo:a,fieldName:r,fieldInfo:e}),this.relatedInfos.set(o,a))}};e([g()],ne.prototype,"_error",void 0),e([g()],ne.prototype,"_graphicChangedTask",void 0),e([g()],ne.prototype,"_evaluateExpressionAttributesTask",void 0),e([g()],ne.prototype,"_associationVMAbortController",void 0),e([g({readOnly:!0})],ne.prototype,"_effectivePopupTemplate",null),e([g({readOnly:!0})],ne.prototype,"_fieldInfoMap",null),e([g({readOnly:!0})],ne.prototype,"_sourceLayer",null),e([g()],ne.prototype,"abilities",void 0),e([b("abilities")],ne.prototype,"castAbilities",null),e([g({readOnly:!0})],ne.prototype,"content",void 0),e([g({readOnly:!0})],ne.prototype,"contentViewModels",void 0),e([g()],ne.prototype,"description",void 0),e([g({type:Boolean})],ne.prototype,"defaultPopupTemplateEnabled",void 0),e([g({readOnly:!0})],ne.prototype,"isFeatureFromTable",null),e([g({readOnly:!0})],ne.prototype,"state",null),e([g({readOnly:!0})],ne.prototype,"formattedAttributes",void 0),e([g({type:t})],ne.prototype,"graphic",void 0),e([g({readOnly:!0})],ne.prototype,"lastEditInfo",void 0),e([g({type:w})],ne.prototype,"location",void 0),e([g({readOnly:!0})],ne.prototype,"relatedInfos",void 0),e([g({type:A})],ne.prototype,"spatialReference",null),e([g()],ne.prototype,"timeZone",null),e([g({readOnly:!0})],ne.prototype,"title",void 0),e([g()],ne.prototype,"map",null),e([g({readOnly:!0})],ne.prototype,"waitingForContent",null),e([g()],ne.prototype,"view",void 0),ne=te=e([v("esri.widgets.Feature.FeatureViewModel")],ne);export{ne 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.34/esri/copyright.txt for details.
4
4
  */
5
- import{__decorate as o}from"tslib";import{JSONSupport as t}from"../../../core/JSONSupport.js";import{property as i}from"../../../core/accessorSupport/decorators/property.js";import"../../../core/has.js";import"../../../core/Logger.js";import"../../../core/RandomLCG.js";import{subclass as e}from"../../../core/accessorSupport/decorators/subclass.js";let r=class extends t{constructor(o){super(o),this.autoWidth=!1,this.description=null,this.direction=null,this.flexGrow=1,this.fieldName=null,this.formatFunction=null,this.frozen=!1,this.frozenToEnd=!1,this.icon=null,this.iconText=null,this.initialSortPriority=null,this.invalid=!1,this.label=null,this.labelTooltipText=null,this.menuConfig=null,this.resizable=!0,this.sortable=!1,this.textAlign="start",this.textWrap=!1,this.timeZone=null,this.type=null,this.visible=!0,this.width=200}};o([i()],r.prototype,"autoWidth",void 0),o([i()],r.prototype,"description",void 0),o([i()],r.prototype,"direction",void 0),o([i()],r.prototype,"flexGrow",void 0),o([i({type:String})],r.prototype,"fieldName",void 0),o([i()],r.prototype,"formatFunction",void 0),o([i()],r.prototype,"frozen",void 0),o([i()],r.prototype,"frozenToEnd",void 0),o([i()],r.prototype,"icon",void 0),o([i()],r.prototype,"iconText",void 0),o([i()],r.prototype,"initialSortPriority",void 0),o([i()],r.prototype,"invalid",void 0),o([i()],r.prototype,"label",void 0),o([i()],r.prototype,"labelTooltipText",void 0),o([i()],r.prototype,"menuConfig",void 0),o([i()],r.prototype,"resizable",void 0),o([i()],r.prototype,"sortable",void 0),o([i()],r.prototype,"textAlign",void 0),o([i()],r.prototype,"textWrap",void 0),o([i()],r.prototype,"timeZone",void 0),o([i({type:String,json:{read:!1,write:!0}})],r.prototype,"type",void 0),o([i()],r.prototype,"visible",void 0),o([i()],r.prototype,"width",void 0),r=o([e("esri.widgets.FeatureTable.support.ColumnTemplateBase")],r);const p=r;export{p as default};
5
+ import{__decorate as o}from"tslib";import{ClonableMixin as t}from"../../../core/Clonable.js";import{JSONSupport as i}from"../../../core/JSONSupport.js";import{property as e}from"../../../core/accessorSupport/decorators/property.js";import"../../../core/has.js";import"../../../core/Logger.js";import"../../../core/RandomLCG.js";import{subclass as r}from"../../../core/accessorSupport/decorators/subclass.js";let p=class extends(t(i)){constructor(o){super(o),this.autoWidth=!1,this.description=null,this.direction=null,this.flexGrow=1,this.fieldName=null,this.formatFunction=null,this.frozen=!1,this.frozenToEnd=!1,this.icon=null,this.iconText=null,this.initialSortPriority=null,this.invalid=!1,this.label=null,this.labelTooltipText=null,this.menuConfig=null,this.resizable=!0,this.sortable=!1,this.textAlign="start",this.textWrap=!1,this.timeZone=null,this.type=null,this.visible=!0,this.width=200}};o([e()],p.prototype,"autoWidth",void 0),o([e()],p.prototype,"description",void 0),o([e()],p.prototype,"direction",void 0),o([e()],p.prototype,"flexGrow",void 0),o([e({type:String})],p.prototype,"fieldName",void 0),o([e()],p.prototype,"formatFunction",void 0),o([e()],p.prototype,"frozen",void 0),o([e()],p.prototype,"frozenToEnd",void 0),o([e()],p.prototype,"icon",void 0),o([e()],p.prototype,"iconText",void 0),o([e()],p.prototype,"initialSortPriority",void 0),o([e()],p.prototype,"invalid",void 0),o([e()],p.prototype,"label",void 0),o([e()],p.prototype,"labelTooltipText",void 0),o([e()],p.prototype,"menuConfig",void 0),o([e()],p.prototype,"resizable",void 0),o([e()],p.prototype,"sortable",void 0),o([e()],p.prototype,"textAlign",void 0),o([e()],p.prototype,"textWrap",void 0),o([e()],p.prototype,"timeZone",void 0),o([e({type:String,json:{read:!1,write:!0}})],p.prototype,"type",void 0),o([e()],p.prototype,"visible",void 0),o([e()],p.prototype,"width",void 0),p=o([r("esri.widgets.FeatureTable.support.ColumnTemplateBase")],p);const s=p;export{s as default};
@@ -2,4 +2,4 @@
2
2
  All material copyright ESRI, All Rights Reserved, unless otherwise specified.
3
3
  See https://js.arcgis.com/4.34/esri/copyright.txt for details.
4
4
  */
5
- import{__decorate as e}from"tslib";import{JSONSupport as o}from"../../../core/JSONSupport.js";import{clone as t}from"../../../core/lang.js";import r from"../../../core/Logger.js";import{property as s}from"../../../core/accessorSupport/decorators/property.js";import{cast as m}from"../../../core/accessorSupport/decorators/cast.js";import{subclass as p}from"../../../core/accessorSupport/decorators/subclass.js";import l from"./AttachmentsColumnTemplate.js";import a from"./ColumnTemplate.js";import{isTemplateObjectWithType as n}from"./columnUtils.js";import c from"./FieldColumnTemplate.js";import i from"./GroupColumnTemplate.js";import u from"./RelationshipColumnTemplate.js";var f;let T=f=class extends o{constructor(e){super(e),this.columnTemplates=[]}castColumnTemplates(e){if(!e||!Array.isArray(e))return[];const o=[];return e.forEach(e=>{if(e instanceof c||e instanceof i||e instanceof a||e instanceof l||e instanceof u)o.push(e);else if(n(e)){const t=e.type;"field"===t?o.push(new c(e)):"group"===t?o.push(new i(e)):"column"===t?o.push(new a(e)):"attachment"===t?o.push(new l(e)):"relationship"===t&&o.push(new u(e))}else r.getLogger(this).warn("Property 'type' is missing from the provided template. Template removed from 'tableTemplate.columnTemplates'.")}),o}clone(){return new f({columnTemplates:t(this.columnTemplates)})}};e([s()],T.prototype,"columnTemplates",void 0),e([m("columnTemplates")],T.prototype,"castColumnTemplates",null),T=f=e([p("esri.widgets.FeatureTable.support.TableTemplate")],T);const h=T;export{h as default};
5
+ import{__decorate as o}from"tslib";import{ClonableMixin as e}from"../../../core/Clonable.js";import{JSONSupport as t}from"../../../core/JSONSupport.js";import r from"../../../core/Logger.js";import{property as s}from"../../../core/accessorSupport/decorators/property.js";import{cast as m}from"../../../core/accessorSupport/decorators/cast.js";import"../../../core/has.js";import"../../../core/RandomLCG.js";import{subclass as p}from"../../../core/accessorSupport/decorators/subclass.js";import a from"./AttachmentsColumnTemplate.js";import l from"./ColumnTemplate.js";import{isTemplateObjectWithType as n}from"./columnUtils.js";import c from"./FieldColumnTemplate.js";import i from"./GroupColumnTemplate.js";import u from"./RelationshipColumnTemplate.js";let f=class extends(e(t)){constructor(o){super(o),this.columnTemplates=[]}castColumnTemplates(o){if(!o||!Array.isArray(o))return[];const e=[];return o.forEach(o=>{if(o instanceof c||o instanceof i||o instanceof l||o instanceof a||o instanceof u)e.push(o);else if(n(o)){const t=o.type;"field"===t?e.push(new c(o)):"group"===t?e.push(new i(o)):"column"===t?e.push(new l(o)):"attachment"===t?e.push(new a(o)):"relationship"===t&&e.push(new u(o))}else r.getLogger(this).warn("Property 'type' is missing from the provided template. Template removed from 'tableTemplate.columnTemplates'.")}),e}};o([s()],f.prototype,"columnTemplates",void 0),o([m("columnTemplates")],f.prototype,"castColumnTemplates",null),f=o([p("esri.widgets.FeatureTable.support.TableTemplate")],f);const T=f;export{T as default};