@arcgis/core 4.34.0-next.2 → 4.34.0-next.3

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 (231) hide show
  1. package/Map.js +1 -1
  2. package/assets/esri/core/workers/RemoteClient.js +1 -1
  3. package/assets/esri/core/workers/chunks/{bf3555f91492a1a3b613.js → 09f76ca9b47b465c934f.js} +1 -1
  4. package/assets/esri/core/workers/chunks/{397b15d46f22718c9f38.js → 0d78fc2c2bc1152f84db.js} +1 -1
  5. package/assets/esri/core/workers/chunks/{ead5d4e271effc04def3.js → 1415d4e2f5f3193be004.js} +1 -1
  6. package/assets/esri/core/workers/chunks/17e43a050fbf8dc87588.js +1 -0
  7. package/assets/esri/core/workers/chunks/1ee6e9a88f0676032e91.js +1 -0
  8. package/assets/esri/core/workers/chunks/{ece68a25651ef03fc95d.js → 342f61e784c9364a493b.js} +1 -1
  9. package/assets/esri/core/workers/chunks/3adcf78ed1e7cd82666d.js +1 -0
  10. package/assets/esri/core/workers/chunks/{07e58dff44fcbb3b3539.js → 562800b0af52a38a311b.js} +1 -1
  11. package/assets/esri/core/workers/chunks/{32ee2708edd307954125.js → 7174150bf7595c22f976.js} +1 -1
  12. package/assets/esri/core/workers/chunks/{e77371ddbaf4b2d9be8d.js → 74c0db9e3a62e9839b23.js} +1 -1
  13. package/assets/esri/core/workers/chunks/{aba19485b6cdcb70dac6.js → 8008f5479f4d16964088.js} +1 -1
  14. package/assets/esri/core/workers/chunks/{40f54c4f8ae63c6f3df9.js → a32dcd5bc4680374d30c.js} +1 -1
  15. package/assets/esri/core/workers/chunks/ad4f65d764654c70a117.js +1 -0
  16. package/assets/esri/core/workers/chunks/{ac2607f1e8cd2e99907c.js → b70f65ccee01d48a610e.js} +2 -2
  17. package/assets/esri/core/workers/chunks/{d7b640f7a181bd26c7c7.js → bac5e1d50b69f0d94694.js} +1 -1
  18. package/assets/esri/core/workers/chunks/{9ca480eb8b2312381ccf.js → bcadcb709e622f2aaaf9.js} +1 -1
  19. package/assets/esri/core/workers/chunks/{677af0281e4fc9f3bd98.js → c6cd8784a3e222eb2d4a.js} +1 -1
  20. package/assets/esri/core/workers/chunks/{54f4a1131f99468db076.js → d33a5d79f2163ad62b1d.js} +1 -1
  21. package/assets/esri/core/workers/chunks/{e3c1aea34ece8336dae1.js → e9aa1d9ded8a52a40c57.js} +1 -1
  22. package/assets/esri/core/workers/chunks/f2aa8090827086c62dde.js +1 -0
  23. package/assets/esri/core/workers/chunks/fd4c020297badcb81947.js +1 -0
  24. package/assets/esri/core/workers/chunks/{b160dcbea6256e0cf689.js → feaf79b69d2e2a1f2aa2.js} +1 -1
  25. package/assets/esri/widgets/Editor/t9n/Editor.json +1 -1
  26. package/assets/esri/widgets/Editor/t9n/Editor_ar.json +1 -1
  27. package/assets/esri/widgets/Editor/t9n/Editor_bg.json +1 -1
  28. package/assets/esri/widgets/Editor/t9n/Editor_bs.json +1 -1
  29. package/assets/esri/widgets/Editor/t9n/Editor_ca.json +1 -1
  30. package/assets/esri/widgets/Editor/t9n/Editor_cs.json +1 -1
  31. package/assets/esri/widgets/Editor/t9n/Editor_da.json +1 -1
  32. package/assets/esri/widgets/Editor/t9n/Editor_de.json +1 -1
  33. package/assets/esri/widgets/Editor/t9n/Editor_el.json +1 -1
  34. package/assets/esri/widgets/Editor/t9n/Editor_en.json +1 -1
  35. package/assets/esri/widgets/Editor/t9n/Editor_es.json +1 -1
  36. package/assets/esri/widgets/Editor/t9n/Editor_et.json +1 -1
  37. package/assets/esri/widgets/Editor/t9n/Editor_fi.json +1 -1
  38. package/assets/esri/widgets/Editor/t9n/Editor_fr.json +1 -1
  39. package/assets/esri/widgets/Editor/t9n/Editor_he.json +1 -1
  40. package/assets/esri/widgets/Editor/t9n/Editor_hr.json +1 -1
  41. package/assets/esri/widgets/Editor/t9n/Editor_hu.json +1 -1
  42. package/assets/esri/widgets/Editor/t9n/Editor_id.json +1 -1
  43. package/assets/esri/widgets/Editor/t9n/Editor_it.json +1 -1
  44. package/assets/esri/widgets/Editor/t9n/Editor_ja.json +1 -1
  45. package/assets/esri/widgets/Editor/t9n/Editor_ko.json +1 -1
  46. package/assets/esri/widgets/Editor/t9n/Editor_lt.json +1 -1
  47. package/assets/esri/widgets/Editor/t9n/Editor_lv.json +1 -1
  48. package/assets/esri/widgets/Editor/t9n/Editor_nl.json +1 -1
  49. package/assets/esri/widgets/Editor/t9n/Editor_no.json +1 -1
  50. package/assets/esri/widgets/Editor/t9n/Editor_pl.json +1 -1
  51. package/assets/esri/widgets/Editor/t9n/Editor_pt-BR.json +1 -1
  52. package/assets/esri/widgets/Editor/t9n/Editor_pt-PT.json +1 -1
  53. package/assets/esri/widgets/Editor/t9n/Editor_ro.json +1 -1
  54. package/assets/esri/widgets/Editor/t9n/Editor_ru.json +1 -1
  55. package/assets/esri/widgets/Editor/t9n/Editor_sk.json +1 -1
  56. package/assets/esri/widgets/Editor/t9n/Editor_sl.json +1 -1
  57. package/assets/esri/widgets/Editor/t9n/Editor_sr.json +1 -1
  58. package/assets/esri/widgets/Editor/t9n/Editor_sv.json +1 -1
  59. package/assets/esri/widgets/Editor/t9n/Editor_th.json +1 -1
  60. package/assets/esri/widgets/Editor/t9n/Editor_tr.json +1 -1
  61. package/assets/esri/widgets/Editor/t9n/Editor_uk.json +1 -1
  62. package/assets/esri/widgets/Editor/t9n/Editor_vi.json +1 -1
  63. package/assets/esri/widgets/Editor/t9n/Editor_zh-CN.json +1 -1
  64. package/assets/esri/widgets/Editor/t9n/Editor_zh-HK.json +1 -1
  65. package/assets/esri/widgets/Editor/t9n/Editor_zh-TW.json +1 -1
  66. package/assets/esri/widgets/FeatureTable/t9n/FeatureTable_ar.json +1 -1
  67. package/assets/esri/widgets/FeatureTable/t9n/FeatureTable_bg.json +1 -1
  68. package/assets/esri/widgets/FeatureTable/t9n/FeatureTable_bs.json +1 -1
  69. package/assets/esri/widgets/FeatureTable/t9n/FeatureTable_ca.json +1 -1
  70. package/assets/esri/widgets/FeatureTable/t9n/FeatureTable_cs.json +1 -1
  71. package/assets/esri/widgets/FeatureTable/t9n/FeatureTable_da.json +1 -1
  72. package/assets/esri/widgets/FeatureTable/t9n/FeatureTable_de.json +1 -1
  73. package/assets/esri/widgets/FeatureTable/t9n/FeatureTable_el.json +1 -1
  74. package/assets/esri/widgets/FeatureTable/t9n/FeatureTable_es.json +1 -1
  75. package/assets/esri/widgets/FeatureTable/t9n/FeatureTable_et.json +1 -1
  76. package/assets/esri/widgets/FeatureTable/t9n/FeatureTable_fi.json +1 -1
  77. package/assets/esri/widgets/FeatureTable/t9n/FeatureTable_fr.json +1 -1
  78. package/assets/esri/widgets/FeatureTable/t9n/FeatureTable_he.json +1 -1
  79. package/assets/esri/widgets/FeatureTable/t9n/FeatureTable_hr.json +1 -1
  80. package/assets/esri/widgets/FeatureTable/t9n/FeatureTable_hu.json +1 -1
  81. package/assets/esri/widgets/FeatureTable/t9n/FeatureTable_id.json +1 -1
  82. package/assets/esri/widgets/FeatureTable/t9n/FeatureTable_it.json +1 -1
  83. package/assets/esri/widgets/FeatureTable/t9n/FeatureTable_ja.json +1 -1
  84. package/assets/esri/widgets/FeatureTable/t9n/FeatureTable_ko.json +1 -1
  85. package/assets/esri/widgets/FeatureTable/t9n/FeatureTable_lt.json +1 -1
  86. package/assets/esri/widgets/FeatureTable/t9n/FeatureTable_lv.json +1 -1
  87. package/assets/esri/widgets/FeatureTable/t9n/FeatureTable_nl.json +1 -1
  88. package/assets/esri/widgets/FeatureTable/t9n/FeatureTable_no.json +1 -1
  89. package/assets/esri/widgets/FeatureTable/t9n/FeatureTable_pl.json +1 -1
  90. package/assets/esri/widgets/FeatureTable/t9n/FeatureTable_pt-BR.json +1 -1
  91. package/assets/esri/widgets/FeatureTable/t9n/FeatureTable_pt-PT.json +1 -1
  92. package/assets/esri/widgets/FeatureTable/t9n/FeatureTable_ro.json +1 -1
  93. package/assets/esri/widgets/FeatureTable/t9n/FeatureTable_ru.json +1 -1
  94. package/assets/esri/widgets/FeatureTable/t9n/FeatureTable_sk.json +1 -1
  95. package/assets/esri/widgets/FeatureTable/t9n/FeatureTable_sl.json +1 -1
  96. package/assets/esri/widgets/FeatureTable/t9n/FeatureTable_sr.json +1 -1
  97. package/assets/esri/widgets/FeatureTable/t9n/FeatureTable_sv.json +1 -1
  98. package/assets/esri/widgets/FeatureTable/t9n/FeatureTable_th.json +1 -1
  99. package/assets/esri/widgets/FeatureTable/t9n/FeatureTable_tr.json +1 -1
  100. package/assets/esri/widgets/FeatureTable/t9n/FeatureTable_uk.json +1 -1
  101. package/assets/esri/widgets/FeatureTable/t9n/FeatureTable_vi.json +1 -1
  102. package/assets/esri/widgets/FeatureTable/t9n/FeatureTable_zh-CN.json +1 -1
  103. package/assets/esri/widgets/FeatureTable/t9n/FeatureTable_zh-HK.json +1 -1
  104. package/assets/esri/widgets/FeatureTable/t9n/FeatureTable_zh-TW.json +1 -1
  105. package/assets/esri/widgets/OrientedImageryViewer/t9n/OrientedImageryViewer_ar.json +1 -1
  106. package/assets/esri/widgets/OrientedImageryViewer/t9n/OrientedImageryViewer_bg.json +1 -1
  107. package/assets/esri/widgets/OrientedImageryViewer/t9n/OrientedImageryViewer_bs.json +1 -1
  108. package/assets/esri/widgets/OrientedImageryViewer/t9n/OrientedImageryViewer_ca.json +1 -1
  109. package/assets/esri/widgets/OrientedImageryViewer/t9n/OrientedImageryViewer_cs.json +1 -1
  110. package/assets/esri/widgets/OrientedImageryViewer/t9n/OrientedImageryViewer_da.json +1 -1
  111. package/assets/esri/widgets/OrientedImageryViewer/t9n/OrientedImageryViewer_de.json +1 -1
  112. package/assets/esri/widgets/OrientedImageryViewer/t9n/OrientedImageryViewer_el.json +1 -1
  113. package/assets/esri/widgets/OrientedImageryViewer/t9n/OrientedImageryViewer_es.json +1 -1
  114. package/assets/esri/widgets/OrientedImageryViewer/t9n/OrientedImageryViewer_et.json +1 -1
  115. package/assets/esri/widgets/OrientedImageryViewer/t9n/OrientedImageryViewer_fi.json +1 -1
  116. package/assets/esri/widgets/OrientedImageryViewer/t9n/OrientedImageryViewer_fr.json +1 -1
  117. package/assets/esri/widgets/OrientedImageryViewer/t9n/OrientedImageryViewer_he.json +1 -1
  118. package/assets/esri/widgets/OrientedImageryViewer/t9n/OrientedImageryViewer_hr.json +1 -1
  119. package/assets/esri/widgets/OrientedImageryViewer/t9n/OrientedImageryViewer_hu.json +1 -1
  120. package/assets/esri/widgets/OrientedImageryViewer/t9n/OrientedImageryViewer_id.json +1 -1
  121. package/assets/esri/widgets/OrientedImageryViewer/t9n/OrientedImageryViewer_it.json +1 -1
  122. package/assets/esri/widgets/OrientedImageryViewer/t9n/OrientedImageryViewer_ja.json +1 -1
  123. package/assets/esri/widgets/OrientedImageryViewer/t9n/OrientedImageryViewer_ko.json +1 -1
  124. package/assets/esri/widgets/OrientedImageryViewer/t9n/OrientedImageryViewer_lt.json +1 -1
  125. package/assets/esri/widgets/OrientedImageryViewer/t9n/OrientedImageryViewer_lv.json +1 -1
  126. package/assets/esri/widgets/OrientedImageryViewer/t9n/OrientedImageryViewer_nl.json +1 -1
  127. package/assets/esri/widgets/OrientedImageryViewer/t9n/OrientedImageryViewer_no.json +1 -1
  128. package/assets/esri/widgets/OrientedImageryViewer/t9n/OrientedImageryViewer_pl.json +1 -1
  129. package/assets/esri/widgets/OrientedImageryViewer/t9n/OrientedImageryViewer_pt-BR.json +1 -1
  130. package/assets/esri/widgets/OrientedImageryViewer/t9n/OrientedImageryViewer_pt-PT.json +1 -1
  131. package/assets/esri/widgets/OrientedImageryViewer/t9n/OrientedImageryViewer_ro.json +1 -1
  132. package/assets/esri/widgets/OrientedImageryViewer/t9n/OrientedImageryViewer_ru.json +1 -1
  133. package/assets/esri/widgets/OrientedImageryViewer/t9n/OrientedImageryViewer_sk.json +1 -1
  134. package/assets/esri/widgets/OrientedImageryViewer/t9n/OrientedImageryViewer_sl.json +1 -1
  135. package/assets/esri/widgets/OrientedImageryViewer/t9n/OrientedImageryViewer_sr.json +1 -1
  136. package/assets/esri/widgets/OrientedImageryViewer/t9n/OrientedImageryViewer_sv.json +1 -1
  137. package/assets/esri/widgets/OrientedImageryViewer/t9n/OrientedImageryViewer_th.json +1 -1
  138. package/assets/esri/widgets/OrientedImageryViewer/t9n/OrientedImageryViewer_tr.json +1 -1
  139. package/assets/esri/widgets/OrientedImageryViewer/t9n/OrientedImageryViewer_uk.json +1 -1
  140. package/assets/esri/widgets/OrientedImageryViewer/t9n/OrientedImageryViewer_vi.json +1 -1
  141. package/assets/esri/widgets/OrientedImageryViewer/t9n/OrientedImageryViewer_zh-CN.json +1 -1
  142. package/assets/esri/widgets/OrientedImageryViewer/t9n/OrientedImageryViewer_zh-HK.json +1 -1
  143. package/assets/esri/widgets/OrientedImageryViewer/t9n/OrientedImageryViewer_zh-TW.json +1 -1
  144. package/chunks/Laserlines.glsl.js +2 -2
  145. package/chunks/cameraUtilsSpherical.js +1 -1
  146. package/chunks/sphere.js +1 -1
  147. package/chunks/vec42.js +1 -1
  148. package/config.js +1 -1
  149. package/core/accessorSupport/ensureType.js +1 -1
  150. package/core/libs/gl-matrix-2/math/quat.js +1 -1
  151. package/core/libs/gl-matrix-2/math/vec4.js +1 -1
  152. package/effects/FocusArea.js +5 -0
  153. package/{views → effects}/FocusAreaOutline.js +1 -1
  154. package/{views → effects}/FocusAreas.js +1 -1
  155. package/geometry/support/frustum.js +1 -1
  156. package/geometry/support/sphere.js +1 -1
  157. package/interfaces.d.ts +137 -66
  158. package/kernel.js +1 -1
  159. package/layers/VideoLayer.js +1 -1
  160. package/layers/orientedImagery/transformations/imageToWorld.js +1 -1
  161. package/layers/video/VideoController.js +1 -1
  162. package/networks/support/UNTraceConfiguration.js +1 -1
  163. package/networks/support/typeUtils.js +1 -1
  164. package/package.json +1 -1
  165. package/rest/knowledgeGraph/GraphAddFieldIndexResult.js +5 -0
  166. package/rest/knowledgeGraph/GraphAddNamedTypesResult.js +1 -1
  167. package/rest/knowledgeGraph/GraphAddPropertyResult.js +1 -1
  168. package/rest/knowledgeGraph/GraphDataModelOperationResult.js +5 -0
  169. package/rest/knowledgeGraph/GraphDeleteFieldIndexResult.js +5 -0
  170. package/rest/knowledgeGraph/GraphDeleteNamedTypeResult.js +1 -1
  171. package/rest/knowledgeGraph/GraphDeletePropertyResult.js +1 -1
  172. package/rest/knowledgeGraph/GraphUpdateNamedTypesResult.js +1 -1
  173. package/rest/knowledgeGraph/GraphUpdatePropertyResult.js +1 -1
  174. package/rest/knowledgeGraph/GraphUpdateSearchIndexResult.js +1 -1
  175. package/rest/knowledgeGraph/wasmInterface/updateToWasmEncodedFactories.js +1 -1
  176. package/rest/knowledgeGraph/wasmInterface/wasmToDataModelChangeResponseFactories.js +1 -1
  177. package/rest/knowledgeGraphService.js +1 -1
  178. package/rest/networks/support/CircuitPath.js +5 -0
  179. package/rest/networks/support/CircuitPathConnectivityElement.js +5 -0
  180. package/rest/networks/support/TraceLocation.js +1 -1
  181. package/rest/networks/support/TraceResult.js +1 -1
  182. package/smartMapping/renderers/pieChart.js +1 -1
  183. package/smartMapping/renderers/predominance.js +1 -1
  184. package/smartMapping/renderers/support/rendererUtils.js +1 -1
  185. package/smartMapping/renderers/support/spikeUtils.d.ts +4 -0
  186. package/support/revision.js +1 -1
  187. package/views/2d/layers/VideoLayerView2D.js +1 -1
  188. package/views/3d/FocusAreasView.js +1 -1
  189. package/views/3d/camera/constraintUtils/distance.js +1 -1
  190. package/views/3d/camera/constraintUtils/tilt.js +1 -1
  191. package/views/3d/interactive/visualElements/DrapedVisualElementResources.js +1 -1
  192. package/views/3d/layers/graphics/Deconflictor.js +1 -1
  193. package/views/3d/layers/graphics/Graphics3DWaterSymbolLayer.js +1 -1
  194. package/views/3d/state/NearFarHeuristic.js +1 -1
  195. package/views/3d/state/controllers/GamepadKeyboardController.js +1 -1
  196. package/views/3d/state/utils/navigationUtils.js +1 -1
  197. package/views/3d/support/geometryUtils/sphere.js +1 -1
  198. package/views/3d/support/sunUtils.js +1 -1
  199. package/views/3d/terrain/OverlayManager.js +1 -1
  200. package/views/3d/terrain/OverlayRenderer.js +1 -1
  201. package/views/3d/webgl/RenderCamera.js +1 -1
  202. package/views/3d/webgl/RenderNode.js +1 -1
  203. package/views/3d/webgl-engine/core/FBOCache.js +1 -1
  204. package/views/3d/webgl-engine/effects/focusArea/FocusAreaOutlineItem.js +5 -0
  205. package/views/3d/webgl-engine/effects/laserlines/LaserLineRenderer.js +1 -1
  206. package/views/3d/webgl-engine/effects/laserlines/LaserlinePathTechniqueConfiguration.js +1 -1
  207. package/views/3d/webgl-engine/lib/Octree.js +1 -1
  208. package/views/3d/webgl-engine/materials/RibbonLineMaterial.js +1 -1
  209. package/views/3d/webgl-engine/shaders/CompositingTechniqueConfiguration.js +1 -1
  210. package/views/VideoView.js +1 -1
  211. package/views/webgl/RenderingContext.js +1 -1
  212. package/views/webgl/Texture.js +1 -1
  213. package/widgets/Daylight/DaylightViewModel.js +1 -1
  214. package/widgets/Editor/EditorViewModel.js +1 -1
  215. package/widgets/Editor/UpdateFeaturesWorkflow.js +1 -1
  216. package/widgets/Editor/UpdateFeaturesWorkflowData.js +1 -1
  217. package/widgets/Editor/UpdateWorkflow.js +1 -1
  218. package/widgets/Editor/components/Notices.js +1 -1
  219. package/widgets/Editor/components/UpdateFeaturePanelContent.js +1 -1
  220. package/widgets/Editor/workflowUtils.js +1 -1
  221. package/widgets/Editor.js +1 -1
  222. package/widgets/FeatureTable/FieldColumn.js +1 -1
  223. package/widgets/FeatureTable/Grid/EditorColumn.js +1 -1
  224. package/assets/esri/core/workers/chunks/094e8aae6dada24c8115.js +0 -1
  225. package/assets/esri/core/workers/chunks/24327d01cb2c5c55a4b7.js +0 -1
  226. package/assets/esri/core/workers/chunks/62b2d3720693c93a60f2.js +0 -1
  227. package/assets/esri/core/workers/chunks/a0f2df8ca7cd14bfa013.js +0 -1
  228. package/assets/esri/core/workers/chunks/b06cb23048c32940f5de.js +0 -1
  229. package/assets/esri/core/workers/chunks/d3d98ea5b5e56fc60a31.js +0 -1
  230. package/views/FocusArea.js +0 -5
  231. package/views/FocusAreaOutlineItem.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{substitute as e}from"../../../intl/substitute.js";import{isUpdateFeaturesWorkflow as t,isBatchAttributeFormViewModel as o}from"../workflowUtils.js";import{loadFooterActionsComponents as i,FooterActions as a}from"./FooterActions.js";import{loadNoticesComponents as n,Notices as s}from"./Notices.js";import{loadPanelContentComponents as l,PanelContentSection as r,PanelContentSectionGroup as d,PanelContent as u}from"./PanelContent.js";import c from"./PendingFeatureList.js";import{Heading as p,incrementHeadingLevel as m}from"../../support/Heading.js";import"../../support/widgetUtils.js";import{tsx as f,tsxFragment as g}from"../../support/jsxFactory.js";const h=()=>Promise.all([i(),n(),l()]);function w({editorViewModel:i,headingLevel:n,messages:l,messagesCommon:h,onDelete:w,onDeleteAssociation:b,onSave:y,renderAttachments:v,renderFeatureForm:k,renderBatchAttributeForm:F,renderSketchToolbar:A}){const{activeLeafWorkflow:j,activeWorkflow:C,formViewModel:S,syncing:L}=i;if(!j||!C||!S)return null;const P=j.type.includes("update"),D=o(S),H=P&&!j.hasPendingEdits||L||S.updating||S.disabled,I=P?h.update:h.create,T="create-features"===j?.type?j.numPendingFeaturesExcludingHidden:0,x="create-features"!==j?.type||!!j.data.selectedPendingFeature,B=T>1?e(l.createFeaturesTemplate,{numFeatures:T}):I,M="shouldShowAttachments"in j&&j.shouldShowAttachments&&!D&&!S.activeRelationshipInput&&!S.activeAssociationInput,V=(D?S.activeForm.inputs:S.inputs).every((e=>!e.visible))&&!M,E=t(j)?F:k,U=V?f(r,null,"create-features"===j.type?f(c,{headingLevel:n,key:"pending-feature-list",workflow:j}):void 0):f(r,{key:"panel-content-section"},f(s,{messages:l,workflow:C}),f(d,null,x||"create-features"!==j.type?E():f(c,{headingLevel:n,key:"pending-feature-list",workflow:j}),M?f("div",{key:"attachments"},f(p,{level:m(n)},l.attachments),v()):null)),W=()=>{const{featureFormViewModel:e}=i;null!=e?.associationId&&(e.associationId=null)},N={appearance:"solid",onClick:y,disabled:H,label:B,type:"button"},R={appearance:"outline",onClick:w,disabled:L,kind:"danger",label:h.delete,type:"button"},q={...R,onClick:b,label:l.deleteAssociationTitle,type:"button"},z={...R,primaryLabel:h.delete,primaryText:h.delete,dropdownItems:[{onClick:b,label:l.deleteAssociationTitle}],type:"split-button"},G={appearance:"outline",onClick:W,disabled:L,label:h.cancel,type:"button"},J="viewing-associated-features"===i.page||"viewing-associated-layers"===i.page?[G]:[N,i.shouldShowDeleteButton&&!i.featureFormHasAssociation?R:void 0,i.shouldShowDeleteButton&&i.featureFormHasAssociation?z:void 0,!i.shouldShowDeleteButton&&i.featureFormHasAssociation?q:void 0];return f(g,null,V?A?.():void 0,f(u,{key:"attribute-panel-content"},U),f(a,{buttons:J}))}export{w as UpdateFeaturePanelContent,h as loadUpdateFeaturePanelContentComponents};
5
+ import{substitute as e}from"../../../intl/substitute.js";import{isUpdateFeaturesWorkflow as t,isBatchAttributeFormViewModel as o}from"../workflowUtils.js";import{loadFooterActionsComponents as i,FooterActions as a}from"./FooterActions.js";import{loadNoticesComponents as n,Notices as s}from"./Notices.js";import{loadPanelContentComponents as l,PanelContentSection as r,PanelContentSectionGroup as u,PanelContent as d}from"./PanelContent.js";import c from"./PendingFeatureList.js";import{Heading as p,incrementHeadingLevel as m}from"../../support/Heading.js";import"../../support/widgetUtils.js";import{tsx as f,tsxFragment as h}from"../../support/jsxFactory.js";const v=()=>Promise.all([i(),n(),l()]);function w({editorViewModel:i,headingLevel:n,messages:l,messagesCommon:v,onDelete:w,onDeleteAssociation:b,onSave:g,renderAttachments:y,renderFeatureForm:k,renderBatchAttributeForm:F,renderSketchToolbar:A}){const{activeFeatureCount:j,activeLeafWorkflow:C,activeWorkflow:S,formViewModel:L,syncing:D}=i;if(!C||!S||!L)return null;const I=C.type.includes("update"),P=o(L),B=j>1?l.multiFeature:l.singleFeature,H=I&&!C.hasPendingEdits||D||L.updating||L.disabled,T=e(I?B.update:B.create,{count:j}),x="create-features"!==C?.type||!!C.data.selectedPendingFeature,M="shouldShowAttachments"in C&&C.shouldShowAttachments&&!P&&!L.activeRelationshipInput&&!L.activeAssociationInput,V=(P?L.activeForm.inputs:L.inputs).every((e=>!e.visible))&&!M,U=t(C)?F:k,W=V?f(r,null,"create-features"===C.type?f(c,{headingLevel:n,key:"pending-feature-list",workflow:C}):void 0):f(r,{key:"panel-content-section"},f(s,{activeFeatureCount:j,messages:l,workflow:S}),f(u,null,x||"create-features"!==C.type?U():f(c,{headingLevel:n,key:"pending-feature-list",workflow:C}),M?f("div",{key:"attachments"},f(p,{level:m(n)},l.attachments),y()):null)),E=()=>{const{featureFormViewModel:e}=i;null!=e?.associationId&&(e.associationId=null)},N={appearance:"solid",onClick:g,disabled:H,label:T,type:"button"},R={appearance:"outline",onClick:w,disabled:D,kind:"danger",label:e(B.delete,{count:j}),type:"button"},q={...R,onClick:b,label:l.deleteAssociationTitle,type:"button"},z={...R,primaryLabel:v.delete,primaryText:v.delete,dropdownItems:[{onClick:b,label:l.deleteAssociationTitle}],type:"split-button"},G={appearance:"outline",onClick:E,disabled:D,label:v.cancel,type:"button"},J="viewing-associated-features"===i.page||"viewing-associated-layers"===i.page?[G]:[N,i.shouldShowDeleteButton&&!i.featureFormHasAssociation?R:void 0,i.shouldShowDeleteButton&&i.featureFormHasAssociation?z:void 0,!i.shouldShowDeleteButton&&i.featureFormHasAssociation?q:void 0];return f(h,null,V?A?.():void 0,f(d,{key:"attribute-panel-content"},W),f(a,{buttons:J}))}export{w as UpdateFeaturePanelContent,v as loadUpdateFeaturePanelContentComponents};
@@ -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 e from"../../Color.js";import t from"../../Graphic.js";import{isSome as r,equals as n,addMany as a}from"../../core/arrayUtils.js";import{createTask as o}from"../../core/asyncUtils.js";import"../../core/has.js";import i from"../../core/Error.js";import{handlesGroup as s,makeHandle as l,abortHandle as c}from"../../core/handleUtils.js";import{clone as u}from"../../core/lang.js";import p from"../../core/Logger.js";import{getOrCreateMapValue as d}from"../../core/MapUtils.js";import{debounce as f,isPromiseLike as y,throwIfAborted as m,whenOrAbort as h}from"../../core/promiseUtils.js";import{watch as g,on as b,whenOnce as w}from"../../core/reactiveUtils.js";import{px2pt as v}from"../../core/screenUtils.js";import{diff as I}from"../../core/accessorSupport/diffUtils.js";import{isSharedTemplateOrMetadata as T,isSharedGroupTemplate as S,isSharedTemplate as j,isSharedPresetTemplate as F,isStandardFeatureTemplate as k,isSharedFeatureTemplate as A}from"../../editing/templateUtils.js";import{getSharedTemplateProvider as U}from"../../editing/sharedTemplates/SharedTemplateProvider.js";import V from"../../layers/GraphicsLayer.js";import{featureHasFields as L,fixFields as M,getDisplayFieldName as O}from"../../layers/support/fieldUtils.js";import{isSubtypeSublayer as x}from"../../layers/support/layerUtils.js";import{calculateTolerance as z}from"../../renderers/support/clickToleranceUtils.js";import{meterIn as q}from"../../renderers/support/lengthUtils.js";import{isRenderer as P}from"../../renderers/support/typeUtils.js";import{getTransformationType as E,TransformationType as C}from"../../renderers/visualVariables/support/sizeVariableUtils.js";import R from"../../symbols/SimpleFillSymbol.js";import D from"../../symbols/SimpleLineSymbol.js";import G from"../../symbols/SimpleMarkerSymbol.js";import{to3D as B}from"../../symbols/support/symbolConversion.js";import{getDisplayedSymbol as N}from"../../symbols/support/symbolUtils.js";import{getServices as Z}from"../../undoredo/support/Services.js";import{GraphicState as W}from"../../views/3d/layers/graphics/GraphicState.js";import{defaultDrawingMode as Q}from"../../views/draw/DrawingMode.js";import{createQueryGeometry as $}from"../../views/support/drapedUtils.js";import{filterGraphicHits as J,hitTestSelectSimilarDistance as H}from"../../views/support/hitTestSelectUtils.js";import{dependencySort as K}from"./support/dependencySort.js";import{isDrawGraphicTool as X}from"../Sketch/support/sketchUtils.js";const Y=()=>p.getLogger("esri.widgets.Editor.workflowUtils");function _(e){return!!e&&"features"in e}function ee(e){return"update"===e.type}function te(e){return"update-features"===e.type}function re(e){if(!(e&&"renderer"in e&&ce(e.renderer)))return{rotation:null,size:null};const t=e.renderer.getVisualVariablesForType("rotation").filter((e=>(!e.axis||"heading"===e.axis)&&e.field&&!e.valueExpression)),r=e.renderer.getVisualVariablesForType("size").filter((e=>e.field&&!e.useSymbolValue&&!e.valueExpression&&E(e)===C.RealWorldSize));return{rotation:1===t.length?t[0]:null,size:1===r.length?r[0]:null}}function ne(e){const t=e.sourceLayer;if(!(t&&"renderer"in t&&ce(t.renderer)))return{rotation:null,size:null};const{rotation:r,size:n}=re(t);let a=null,o=null;if(r){const e=t.fields?.filter((e=>e.name===r.field)),n=1===e?.length?e[0]:null;a=ae(r,n)}if(n){const e=t.fields?.filter((e=>e.name===n.field)),r=1===e?.length?e[0]:null;o=se(n,r)}return{rotation:a,size:o}}function ae(e,t){const r="heading"===(e.axis||"heading")&&"arithmetic"===e.rotationType?-1:1,n=t?.type??"double",a={initial:0,current:0};return{field:e.field,fieldType:n,getDefaultValue:()=>Promise.resolve(0),getValue:e=>(a.current=a.initial-r*e,le((a.current+360)%360,n)),setInitialValue:e=>{a.initial=e,a.current=0},isUpdatingInteractively:!1,rotationType:e.rotationType??"geographic"}}function oe(e,t){switch(t){case"width":return e[0];case"depth":return e[1];case"height":return e[2];default:return e[2]||e[1]||e[0]}}async function ie(e,t,r){if(null==t)return 0;const{symbol:n}=B(t);if(null==n||"web-style"===n.type||"cim"===n.type)return 0;const a=n.symbolLayers.at(0);if(!a)return 0;switch(a.type){case"icon":{const{computeIconLayerResourceSize:e}=await import("../../symbols/support/symbolLayerUtils.js");return Math.min(He.icon,(await e(a,He.icon))[0])||He.icon}case"text":return He.text;case"line":return He.line;case"object":{const{computeObjectLayerResourceSize:t}=await import("../../symbols/support/symbolLayerUtils.js");return oe(await t(a,e.scale/He.viewScaleSizeFactor),r)}case"path":case"extrude":return e.scale/He.viewScaleSizeFactor;default:return 0}}function se(e,t){const r=e.axis,n=t?.type??"double",a={initial:0,current:0},o=q[e.valueUnit]??1;let i;return i="area"===e.valueRepresentation?e=>(e*o/2)**2*Math.PI:"radius"===e.valueRepresentation||"distance"===e.valueRepresentation?e=>e*o/2:e=>e*o,{field:e.field,fieldType:n,getDefaultValue:async(e,t)=>le(i(await ie(t,e,r)),n),getValue:(e,t)=>(a.initial||(a.initial=t.pixelSizeAt(t.center)),a.current=a.initial*e,le(a.current,n)),setInitialValue:e=>{a.initial=e,a.current=0},isUpdatingInteractively:!1,displayUnit:Ye(e.valueUnit),axis:e.axis}}function le(e,t){switch(t){case"small-integer":case"integer":case"long":return Math.round(e);case"double":case"single":return e;default:return 0}}function ce(e){if(!P(e))return!1;switch(e?.type){case"class-breaks":case"simple":case"unique-value":case"dot-density":case"dictionary":case"pie-chart":return!0;default:return!1}}async function ue(e,t,r){const n=await N(e,{useSourceLayer:!0,ignoreGraphicSymbol:!0,webStyleCache:t,scale:r});null!=I(e.symbol,n)&&(e.symbol=n)}function pe(e,t){if(!e||!t)throw new Error("no geometry type");if("multipatch"===e)return{tool:"mesh",createOptions:{mode:"hybrid"}};const r=new Map;r.set("circle",{mode:"freehand"}),r.set("rectangle",{mode:"freehand"});const n={mode:Q,optionsPerTool:r};if(T(t)){const a=t.defaultTool,o=S(t)?t.definition?.inputGeometryType??e:e;switch(a){case"freehand":case"stream-line":return{tool:"polyline"===o?"freehandPolyline":"freehandPolygon",createOptions:n};case"autocomplete-freehand-polygons":case"stream-polygon":return{tool:"freehandPolygon",createOptions:n};case"autocomplete-polygons":case"difference-polygon":case"create-structures":case"polygon":case"trace":return{tool:"polygon"===o?"polygon":"polyline",createOptions:n};case"circle":return r.get("circle").preserveAspectRatio=!0,{tool:"circle",createOptions:n};case"ellipse":return r.get("circle").preserveAspectRatio=!1,{tool:"circle",createOptions:n};case"create-points-along-line":case"multipoint":return{tool:"multipoint",createOptions:n};case"line":case"radial-line":case"right-angle-line":case"split":case"two-point-line":return{tool:"polyline",createOptions:n};case"rectangle":case"regular-polygon":case"right-angle-polygon":return{tool:"rectangle",createOptions:n};case"elevation-point-from-contour":case"elevation-point-from-dem":case"parcel-seed":case"point":case"point-and-rotation":case"point-at-end-of-line":return{tool:"point",createOptions:n}}}else{const a=t.drawingTool;if("circle"===a||"ellipse"===a)return r.get("circle").preserveAspectRatio="circle"===a,{tool:"circle",createOptions:n};if("rectangle"===a)return{tool:"rectangle",createOptions:n};if("freehand"===a)return{tool:"polygon"===e?"freehandPolygon":"freehandPolyline",createOptions:n}}return{tool:e,createOptions:n}}async function de(e,t,r){const{creationInfo:n,fullTemplate:a}=t;if(!n)throw new i("featureworkflow","No creation info provided.");const o=n.layer,s=Le(a,n.attributeOverrides),{view:l}=e,c="2d"===l?.type;S(a)||F(a)||await Me(e,o,s,r,c?l.scale:null);const{capabilities:u}=o;e.layer.elevationInfo=o.elevationInfo;const p=pe(o.geometryType,a);e.defaultCreateOptions={graphicProperties:{attributes:s,sourceLayer:o},mode:p.createOptions.mode,optionsPerTool:p.createOptions.optionsPerTool,preserveAspectRatio:p.createOptions.preserveAspectRatio,hasZ:u.data.supportsZ,defaultZ:(c?u.editing.zDefault:null)??e.defaultCreateOptions.defaultZ},null==n.geometryToPlace?await e.create(p.tool):await e.place(n.geometryToPlace,{graphicProperties:{attributes:s,sourceLayer:o}})}async function fe(e){return s([await ye(e),await me(e)])}async function ye({creationAttributes:e,data:t,sketchViewModel:r,view:n,webStyleCache:a}){const{creationInfo:o}=t,{fullTemplate:i}=t;if(!o||"2d"!==n?.type||S(i)||F(i))return null;const s=f((t=>Me(r,o.layer,e,a,t)));return g((()=>n.scale),(e=>s(e)))}async function me({data:t,sketchViewModel:r,view:n}){const{templateExecutorInfo:a}=t;if(!a)return null;const o=r.activeComponent;if(!n||!X(o))return Y().error(new i("featureworkflow","Failed to set up template feedback.")),null;const c=new V({effect:"saturate(0.6) opacity(0.8)",listMode:"hide",title:"Shared Template Feedback Graphics"});n.map?.add(c);const{executor:u,serviceLayersById:p}=a,d=n.theme?.accentColor??new e([255,165,0,1]);return s([b((()=>o),["cursor-update","vertex-add"],(()=>{c.removeAll();const e=o.graphic?.geometry;if(!e||!he(e))return;const t=u(e,"digitizing");if(!y(t))for(const r of t.edits){const e=p.get(r.id);if(e&&r.addFeatures&&0!==r.addFeatures.length)for(const t of e)if(!t.isTable)for(const e of r.addFeatures){const t=ge(e,d);t&&c.add(t)}}})),l((()=>{n.map.remove(c),c.destroy()}))])}function he(e){switch(e.type){case"point":case"multipoint":return!0;case"polyline":return e.paths[0].length>1;case"polygon":{const t=e.rings[0];return n(t.at(0),t.at(-1))?t.length>2:t.length>1}default:return!1}}function ge(e,r){let n=null;switch(e.geometry?.type){case"point":case"multipoint":n=new G({angle:0,color:r,outline:new D({cap:"round",color:r,join:"round",miterLimit:1,style:"solid",width:1}),path:"undefined",size:8,style:"circle",xoffset:0,yoffset:0});break;case"polygon":n=new R({color:r,outline:new D({cap:"round",color:r,join:"round",miterLimit:1,style:"solid",width:3}),style:"none"});break;case"polyline":n=new D({cap:"round",color:r,join:"round",miterLimit:1,style:"solid",width:2});break;default:return null}return new t({geometry:e.geometry,symbol:n,attributes:{...e.attributes}})}async function be(e,t){const r=await Z(t).load(),n=x(e)?e.parent:e;return r.tablesAndLayersLookup.get(n)}async function we(e,t){const r=await be(e,t);if(!r)return new Map;const n=new Map;for(const a of r.layersAndTables)d(n,a.layerId,(()=>[])).push(a);return n}function ve(e){const t=e.objectIdField,r=e.globalIdField??"";return{id:e.layerId,identifierFields:{objectIdField:t,globalIdField:r},addFeatures:[],deleteAttachments:[],addAttachments:[],deleteFeatures:[],updateFeatures:[]}}function Ie(e){const{edits:t,serviceInfo:n,view:a,findOriginalFeature:o}=e,i=Te(n.layersAndTables),s=n.layersAndTables.toArray(),{allEditData:l,editDataByLayerIdMap:c,editDataByIdMap:u}=je(t,i,o),p=Fe(l,Se(s,c),c);if(a&&Ue(l,p,a),0===p.length)return t;const d=K(p,{continueOnCircularDependency:!0}).map((e=>u.get(e))).filter(r),f=new Map;for(const r of d)f.set(r.uniqueId,r);const y=[];for(const r of l)f.has(r.uniqueId)||y.push(r);const m=[];let h=null;for(const r of d){const{layer:e}=r;switch(null==h?h=ve(e):h.id!==e.layerId&&(m.push(h),h=ve(e)),r.operationType){case"add":case"modify":h.addFeatures.push(r.after);break;case"delete":h.deleteFeatures.push(r.before)}}null!==h&&m.push(h);for(const r of y){const e=r.layer.layerId,t=m.find((t=>t.id===e))??ve(r.layer);switch(m.includes(t)||m.push(t),r.operationType){case"add":t.addFeatures.push(r.after);break;case"modify":t.updateFeatures.push(r.after);break;case"delete":t.deleteFeatures.push(r.before);break;case"deleteAttachment":t.deleteAttachments.push(r.attachmentId);break;case"addAttachment":t.addAttachments.push(r.attachment)}}for(const r of m)void 0!==r.deleteAttachments&&0===r.deleteAttachments.length&&delete r.deleteAttachments,void 0!==r.addAttachments&&0===r.addAttachments.length&&delete r.addAttachments;return m}function Te(e){const t=new Map;for(const r of e)t.set(r.layerId,r);return t}function Se(e,t){const r=new Map;for(const n of e)for(const e of n.relationships??[])if(r.set(ke(n,e),""),t.has(e.relatedTableId)){const a=t.get(e.relatedTableId);if(a.length>0)for(const t of a[0].layer.relationships??[])if(t.id===e.id){r.set(ke(n,e),t.keyField);break}}return r}function je(e,t,r){const n=new Map,a=[],o=new Map;let s=1;for(const l of e){const e=[],c=t.get(l.id);if(!c)throw new i("featureworkflow",`Failed to prepare applyEdits payload. Layer with id ${l.id} not found.`);for(const t of l.addFeatures??[])e.push({uniqueId:"T"+s++,operationType:"add",layer:c,after:t});for(const t of l.deleteFeatures??[])e.push({uniqueId:"T"+s++,operationType:"delete",before:t,layer:c});for(const t of l.deleteAttachments??[])e.push({uniqueId:"T"+s++,operationType:"deleteAttachment",attachmentId:t,layer:c});for(const t of l.addAttachments??[])e.push({uniqueId:"T"+s++,operationType:"addAttachment",attachment:t,layer:c});for(const t of l.updateFeatures??[])e.push({uniqueId:"T"+s++,operationType:"modify",before:r(t),after:t,layer:c});n.set(c.layerId,e);for(const t of e)a.push(t),o.set(t.uniqueId,t)}return{allEditData:a,editDataByIdMap:o,editDataByLayerIdMap:n}}function Fe(e,t,r){const n=[];for(const a of e){const e=a.layer.relationships??[],{uniqueId:o}=a;for(const i of e){const e=i.keyField;if("origin"===i.role){const s=r.get(i.relatedTableId);if(!s||0===s.length)continue;const l=ke(a.layer,i),c=t.get(l);if(void 0===c||""===c)continue;switch(a.operationType){case"add":for(const t of s)t!==a&&("add"!==t.operationType&&"modify"!==t.operationType||t.after.attributes[c]===a.after.attributes[e]&&n.push([o,t.uniqueId]));break;case"modify":if(a.before.attributes[e]!==a.after.attributes[e])for(const t of s){const r=t.uniqueId;t!==a&&("delete"===t.operationType?t.before.attributes[c]===a.before.attributes[e]?n.push([r,o]):t.before.attributes[c]===a.after.attributes[e]&&n.push([o,r]):"add"===t.operationType?t.after.attributes[c]===a.after.attributes[e]?n.push([o,r]):t.after.attributes[c]===a.before.attributes[e]&&n.push([r,o]):"modify"===t.operationType&&(t.before.attributes[c]!==t.after.attributes[c]?t.after.attributes[c]===a.after.attributes[e]?n.push([o,r]):n.push([r,o]):n.push([o,r])))}break;case"delete":for(const t of s)t!==a&&("delete"!==t.operationType&&"modify"!==t.operationType||t.before.attributes[c]===a.before.attributes[e]&&n.push([t.uniqueId,o]))}}}}return n}function ke(e,t){return`${e.layerId}:${t.id}`}function Ae(e,t){return!!(t?.map&&"utilityNetworks"in t.map&&t.map.utilityNetworks?.length&&t.map.utilityNetworks.some((t=>!(!t.loaded||!e.url?.startsWith(t.featureServiceUrl)||e.layerId!==t.networkSystemLayers.associationsTableId))))}function Ue(e,t,r){const n=[];for(const o of e)Ae(o.layer,r)&&n.push(o);if(0===n.length)return;let a=[];for(const o of n){const r=o.layer;switch(o.operationType){case"delete":a=[...Ve(o.before.attributes[r.fieldsIndex.get("fromglobalid").name],e),...Ve(o.before.attributes[r.fieldsIndex.get("toglobalid").name],e)];for(const e of a)t.push([o.uniqueId,e.uniqueId]);break;case"add":a=[...Ve(o.after.attributes[r.fieldsIndex.get("fromglobalid").name],e),...Ve(o.after.attributes[r.fieldsIndex.get("toglobalid").name],e)];for(const e of a)t.push([e.uniqueId,o.uniqueId])}}}function Ve(e,t){const r=[],n=t.filter((({layer:e})=>""!==e.globalIdField&&null!=e.globalIdField));for(const a of n){const t=a.layer.globalIdField;("before"in a&&a.before?.attributes[t]===e||"after"in a&&a.after?.attributes[t]===e)&&r.push(a)}return r}function Le(e,t={}){return S(e)||F(e)?{}:k(e)?{...e.prototype.attributes,...t}:A(e)?{...e.definition?.defaultValues,...t}:{...t}}async function Me(e,r,n,a,o){const i=new t({sourceLayer:r,attributes:n}),{rotation:s,size:l}=ne(i);let c=await N(i,{useSourceLayer:!0,webStyleCache:a,scale:o}),u=!1;for(const t of[l,s]){if(null==t)continue;null==n[t.field]&&(n[t.field]=await t.getDefaultValue(c,e.view),u=!0)}switch(u&&(c=await N(i,{useSourceLayer:!0,webStyleCache:a,scale:o})),c?.type){case"simple-fill":case"polygon-3d":e.polygonSymbol=c;break;case"simple-line":case"line-3d":e.polylineSymbol=c;break;case"simple-marker":case"picture-marker":case"point-3d":case"cim":e.pointSymbol=c;break;case"mesh-3d":e.meshSymbol=c}Oe(e.tooltipOptions,l,s)}function Oe(e,t,r){e.visualVariables=null!=t||null!=r?{size:null!=t?{unit:t.displayUnit,axis:t.axis,valueType:t.fieldType}:null,rotation:null!=r?{valueType:r.fieldType,rotationType:r.rotationType??"geographic"}:null}:null}function xe(e,t){return e?.find((e=>e.layer===t))}async function ze(e,t,r,n){switch(t.type){case"3d":return qe(e,t,r,n);case"2d":return Pe(e,t,r,n)}}async function qe(e,t,r,n){if(0===e.length)return[];const{updatable:o,graphicsByLayer:i}=await r.defer((async()=>{const{results:a}=await h(H(t,r),n),o=new Map,i=e=>{const t=e.layer,r=o.get(t);if(!r){const e=new Array;return o.set(t,e),e}return r};J(a).forEach((({graphic:e})=>i(e).push(e)));const s=e.filter((({capabilities:e,layer:t})=>e.update.enabled&&o.has(t)));return 0!==s.length&&r.stopPropagation(),{updatable:s,graphicsByLayer:o}}));return h(Promise.allSettled(o.map((async({layer:e})=>{const t=i.get(e),r=Ee(e);if(t.every((e=>L(r,e))))return t;const o=[];for(const n of t){o.push(n.getObjectId());const e=Object.keys(n.attributes);a(r,e)}const s=e.createQuery();return s.returnGeometry=!1,s.objectIds=o,s.outFields=M(e.fieldsIndex,r),e.queryFeatures(s,{signal:n}).then((({features:e})=>e))}))),n)}async function Pe(e,t,r,n){if(0===e.length)return[];const{mapPoint:a}=r;if(null==a)return[];let o=null;const i=await r.defer((async()=>{const{results:a}=await h(t.hitTest(r),n);if(0===a.length)return[];const i=new Set;o=J(a),o.forEach((({graphic:e})=>e&&i.add(e.layer)));const s=e.filter((e=>i.has(e.layer)&&e.supportsUpdateWorkflow));return s.length>0&&r.stopPropagation(),s}));return h(Promise.allSettled(i.map((async({layer:e})=>{const i=e.createQuery();i.returnGeometry=!0,i.outFields=Ee(e);const s="renderer"in e?z({renderer:e.renderer,pointerType:r.pointerType}):0;i.geometry=$(a,s,t),i.outSpatialReference=t.spatialReference;const{features:l}=await e.queryFeatures(i,{signal:n});return o?.forEach((({graphic:t})=>{t.layer!==e||l.some((e=>e.getObjectId()===t.getObjectId()))||l.push(t)})),l}))),n)}function Ee(e){return M(e.fieldsIndex,[e.objectIdField,O({displayField:"displayField"in e?e.displayField:null,fields:e.fields})])}async function Ce(e,t,n,a){const o=t.createQuery();o.objectIds=e.map((e=>e.getObjectId())).filter(r),o.outFields=["*"],o.returnM=t.capabilities.data.supportsM,o.returnZ=t.capabilities.data.supportsZ,"scene"===t.type&&null!=t.infoFor3D||(o.outSpatialReference=n);const i=await t.queryFeatures(o,{signal:a});return m(a),i.features}function Re(e){const t=new Map;for(const r of e){const e=r.sourceLayer,n=x(e)?e.parent:e;d(t,n,(()=>[])).push(r)}return t}async function De(e){const{graphic:t,sketchViewModel:r,sourceLayer:n,visualVariables:a}=e;await Ge(e);const o={multipleSelectionEnabled:!1};return"point"===n.geometryType&&(o.enableRotation=null!=a.rotation,o.enableScaling=null!=a.size),r.update(t,o)}async function Ge(e){const{graphic:t,sketchViewModel:r,sourceLayer:n,visualVariables:a,webStyleCache:o}=e;let i=!1;const{rotation:s,size:l}=a;for(const c of[s,l]){if(null==c)continue;const e=t.getAttribute(c.field);if(null!=e)c.setInitialValue(e);else{const e=await c.getDefaultValue(t.symbol,r.view);c.setInitialValue(e),t.setAttribute(c.field,e),i=!0}}if(i){const e="2d"===r.view?.type?r.view.scale:null;await ue(t,o,e)}Oe(r.tooltipOptions,l,s),r.layer.elevationInfo=n.elevationInfo}function Be(e){return null==e||"rotate-start"!==e.type&&"rotate"!==e.type&&"rotate-stop"!==e.type?null:e}function Ne(e){return null==e||"scale-start"!==e.type&&"scale"!==e.type&&"scale-stop"!==e.type?null:e}function Ze(e,t,r,n){if(null==t.geometry||"point"!==t.geometry?.type)return!1;const a=t.attributes;let o=!1;const i=n.rotation,s=Be(r.toolEventInfo);if(null!=i&&null!=s){const{field:r,getValue:n}=i;if("rotate-stop"===s.type)i.isUpdatingInteractively=!1,i.setInitialValue(t.getAttribute(r));else{i.isUpdatingInteractively=!0;const l=n(s.angle,e);l!==a[r]&&(t.setAttribute(r,l),o=!0)}}const l=n.size,c=Ne(r.toolEventInfo);if(null!=l&&null!=c){const{field:r,getValue:n}=l;if("scale-stop"===c.type)l.isUpdatingInteractively=!1,l.setInitialValue(t.getAttribute(r));else{l.isUpdatingInteractively=!0;const i=n(c.xScale,e);i!==a[r]&&(t.setAttribute(r,i),o=!0)}}return o}async function We({feature:e,featureClone:t,visualVariableAttributes:r,sketchViewModel:n,view:a,onUpdate:o,webStyleCache:i,addUpdatingPromise:u,addHandle:p}){await ue(t,i,"2d"===a.type?a.scale:null);let d=null;if("2d"===n?.view?.type){const e=f((e=>ue(t,i,e)));d=g((()=>n?.view?.scale),(t=>e(t)))}const y=t.sourceLayer,m=tt(a,y);await De({graphic:t,sketchViewModel:n,sourceLayer:y,visualVariables:r,webStyleCache:i});let h=null;m.then((e=>h=e)).catch((()=>{}));const b=r.size,v=r.rotation,I=g((()=>e.attributes),(async e=>{let r=!1;for(const n in e){const a=e[n];a!==t.getAttribute(n)&&(t.setAttribute(n,a),null==b||b.isUpdatingInteractively||b.field!==n||b.setInitialValue(a),null==v||v.isUpdatingInteractively||v.field!==n||v.setInitialValue(a),(null==h||h.requiredFields.includes(n))&&(r=!0))}r&&await ue(t,i,"2d"===a.type?a.scale:null)})),T=n.on("update",(async e=>{const t=e.graphics[0],s={graphic:t,sketchViewModel:n,sourceLayer:y,visualVariables:r,webStyleCache:i};if("complete"===e.state){if(null===a.activeTool)return De(s);const e=new AbortController,t=c(e);return p(t),u(w((()=>null===a.activeTool),e.signal).then((async()=>{if(!e.signal.aborted)return e.abort(),De(s)})))}Ze(a,t,e,r)&&await ue(t,i,"2d"===a.type?a.scale:null),o(nt(t),e)})),S=n.on(["undo","redo"],(async e=>{o(nt(e.graphics[0]),e)}));return s([S,T,l((()=>n.cancel())),I,d])}async function Qe(e,t,r){const n=e.view;e.layer.add(r);const a=t.sourceLayer,i=t.layer,c=t.getAttribute(i.objectIdField);let u=null;function p(e){u?.abort(),u=o((async t=>{const r=await tt(n,a);m(t),r.setVisibility?.(c,e)}))}return await Je(n,r),p(!1),s([$e(n,r,(e=>p(!e))),l((async()=>{p(!0);try{const e=await tt(n,a);await w((()=>!e.updating))}finally{e.layer.remove(r)}}))])}function $e(e,t,r){if("3d"===e.type){const n=new W({graphic:t});return s([e.trackGraphicState(n),g((()=>n.displaying),r)])}return g((()=>t.visible),r)}async function Je(e,t){if("3d"===e.type){const r=new W({graphic:t}),n=e.trackGraphicState(r);await w((()=>r.displaying||r.error)),n.remove()}else await w((()=>t.visible))}const He={icon:v(24),text:v(12),line:v(1),viewScaleSizeFactor:100};function Ke(e,t,r){let n=!1;return e.filter((e=>!!n||(n=e===t,n))).map((e=>r[e]()))}function Xe(e,t){e.viewModel.syncFeatureTemplates();const r=e.creationInfo;if("awaiting-feature-creation-info"===t[0].id&&r){const n=r.layer,a=e.viewModel.getTemplatesForLayer(n);1===a.length&&"scene"!==n.type&&(r.template=a[0],t.shift())}return t}function Ye(e){return"unknown"===e?null:e}function _e(e){e.filesEnabled=!0,e.mode="view",e.capabilities={editing:!0,operations:{add:!0,update:!0,delete:!0}}}const et=e=>/-stop/.test(e)||/vertex-/.test(e),tt=(e,t)=>{const r="subtype-sublayer"===t.type?t.parent:t;return e.whenLayerView(r)};function rt(e){return"createInteractiveEditSession"in e}function nt(e){const t=e.geometry;if("mesh"===t?.type){const r=e.cloneShallow();return r.attributes=u(e.attributes),r.geometry=t.cloneShallow(),r.geometry.transform=t.transform?.clone()??null,r}return e.clone()}function at(e){const t=e.cursor;return e.cursor="progress",l((()=>e.cursor=t))}async function ot(e,t){const{template:r}=e;if(null==r)return null;if(j(r))return r.load();if(T(r)){const e=(await import("../../editing/sharedTemplates/SharedTemplate.js")).default,n=U(t,{makeSharedTemplateFromJSON:t=>e.fromJSON(t)}),a=await n.getTemplates({templateIds:[r.templateId],featureService:r.featureService});if(0===a.length)throw new i("editor:failed-to-load-template","Unable to load the provided template");return a[0].load()}return r}function it(e){for(const t of e){const{destinationGraphic:e,destinationField:r,sourceGraphic:n,sourceField:a}=t;e.setAttribute(r,n.getAttribute(a))}}function st(e){const t=e.templateExecutorInfo?.completionResults;return t?.length?(t.forEach((e=>it(e.relationships))),t.flatMap((e=>e.edits))):null}function lt(e){if(null==e)return[];if(te(e))return e.data.layers;const t=ee(e)?e.activeWorkflow:e,r=t?.layer;return r?[r]:[]}export{Ue as appendAllUtilityNetworkAssociationRelationships,Xe as avoidFeatureTemplateSelectionWithOnlyOneItem,rt as canCreateInteractiveEditSession,nt as cloneGraphicExceptMesh,Te as createLayerIdMap,Se as createRelationshipKeyMap,pe as createToolFromGeometryType,Ke as createWorkflowSteps,ze as fetchCandidates,Ce as fetchFullFeatures,Fe as findAllDependencies,Ve as findChangesByGlobalId,xe as findLayerInfo,ke as generateHashForRelationship,Le as getCreationAttributes,ot as getFullTemplateForCreationInfo,lt as getLayersFromWorkflow,ae as getRotationVariableAttribute,st as getServiceEditsFromWorkflowData,be as getServiceInfoForLayer,we as getServiceLayersById,se as getSizeVariableAttribute,ne as getVisualVariableAttributes,re as getVisualVariablesForLayer,Re as groupFeaturesByLayer,_ as isBatchAttributeFormViewModel,et as isTerminalUpdateEventType,te as isUpdateFeaturesWorkflow,ee as isUpdateWorkflow,Ae as isUtilityNetworkAssociationsTable,Ie as orderEditsByRelationshipDependencies,_e as prepareAttachmentsForCreateFeaturesWorkflow,it as setRelationshipFields,We as setUpGeometryUpdate,fe as setUpSketchCreateWatchers,Ge as setVisualVariablesAndElevationInfoForUpdate,at as showProgressCursor,He as sizeDefaults,Ye as sizeVariableUnitToLengthUnit,de as startCreatingNewFeature,De as startUpdatingFeatureGeometry,Qe as swapForEditingSession,ue as updateGraphicSymbolWhenRequired,Ze as visualVariableInteractiveUpdate,tt as whenEditorLayerView,Je as whenGraphicDisplayed};
5
+ import e from"../../Color.js";import t from"../../Graphic.js";import{isSome as r,equals as n,addMany as a}from"../../core/arrayUtils.js";import{createTask as o}from"../../core/asyncUtils.js";import"../../core/has.js";import i from"../../core/Error.js";import{handlesGroup as s,makeHandle as l,abortHandle as c}from"../../core/handleUtils.js";import{clone as u}from"../../core/lang.js";import p from"../../core/Logger.js";import{getOrCreateMapValue as d}from"../../core/MapUtils.js";import{debounce as f,isPromiseLike as y,throwIfAborted as m,whenOrAbort as h}from"../../core/promiseUtils.js";import{watch as g,on as b,whenOnce as w}from"../../core/reactiveUtils.js";import{px2pt as v}from"../../core/screenUtils.js";import{diff as I}from"../../core/accessorSupport/diffUtils.js";import{isSharedTemplateOrMetadata as T,isSharedGroupTemplate as S,isSharedTemplate as j,isSharedPresetTemplate as F,isStandardFeatureTemplate as k,isSharedFeatureTemplate as A}from"../../editing/templateUtils.js";import{getSharedTemplateProvider as U}from"../../editing/sharedTemplates/SharedTemplateProvider.js";import V from"../../layers/GraphicsLayer.js";import{featureHasFields as L,fixFields as M,getDisplayFieldName as O}from"../../layers/support/fieldUtils.js";import{isSubtypeSublayer as x}from"../../layers/support/layerUtils.js";import{calculateTolerance as z}from"../../renderers/support/clickToleranceUtils.js";import{meterIn as q}from"../../renderers/support/lengthUtils.js";import{isRenderer as P}from"../../renderers/support/typeUtils.js";import{getTransformationType as E,TransformationType as C}from"../../renderers/visualVariables/support/sizeVariableUtils.js";import R from"../../symbols/SimpleFillSymbol.js";import D from"../../symbols/SimpleLineSymbol.js";import G from"../../symbols/SimpleMarkerSymbol.js";import{to3D as B}from"../../symbols/support/symbolConversion.js";import{getDisplayedSymbol as N}from"../../symbols/support/symbolUtils.js";import{getServices as Z}from"../../undoredo/support/Services.js";import{GraphicState as W}from"../../views/3d/layers/graphics/GraphicState.js";import{defaultDrawingMode as Q}from"../../views/draw/DrawingMode.js";import{createQueryGeometry as $}from"../../views/support/drapedUtils.js";import{filterGraphicHits as J,hitTestSelectSimilarDistance as H}from"../../views/support/hitTestSelectUtils.js";import{dependencySort as K}from"./support/dependencySort.js";import{isDrawGraphicTool as X}from"../Sketch/support/sketchUtils.js";const Y=()=>p.getLogger("esri.widgets.Editor.workflowUtils");function _(e){return!!e&&"features"in e}function ee(e){return null!=e&&"create-features"===e.type}function te(e){return null!=e&&"update-features"===e.type}function re(e){return null!=e&&/update-/.test(e.type)&&"fullFeature"in e}function ne(e){return null!=e&&"update"===e.type}function ae(e){if(!(e&&"renderer"in e&&pe(e.renderer)))return{rotation:null,size:null};const t=e.renderer.getVisualVariablesForType("rotation").filter((e=>(!e.axis||"heading"===e.axis)&&e.field&&!e.valueExpression)),r=e.renderer.getVisualVariablesForType("size").filter((e=>e.field&&!e.useSymbolValue&&!e.valueExpression&&E(e)===C.RealWorldSize));return{rotation:1===t.length?t[0]:null,size:1===r.length?r[0]:null}}function oe(e){const t=e.sourceLayer;if(!(t&&"renderer"in t&&pe(t.renderer)))return{rotation:null,size:null};const{rotation:r,size:n}=ae(t);let a=null,o=null;if(r){const e=t.fields?.filter((e=>e.name===r.field)),n=1===e?.length?e[0]:null;a=ie(r,n)}if(n){const e=t.fields?.filter((e=>e.name===n.field)),r=1===e?.length?e[0]:null;o=ce(n,r)}return{rotation:a,size:o}}function ie(e,t){const r="heading"===(e.axis||"heading")&&"arithmetic"===e.rotationType?-1:1,n=t?.type??"double",a={initial:0,current:0};return{field:e.field,fieldType:n,getDefaultValue:()=>Promise.resolve(0),getValue:e=>(a.current=a.initial-r*e,ue((a.current+360)%360,n)),setInitialValue:e=>{a.initial=e,a.current=0},isUpdatingInteractively:!1,rotationType:e.rotationType??"geographic"}}function se(e,t){switch(t){case"width":return e[0];case"depth":return e[1];case"height":return e[2];default:return e[2]||e[1]||e[0]}}async function le(e,t,r){if(null==t)return 0;const{symbol:n}=B(t);if(null==n||"web-style"===n.type||"cim"===n.type)return 0;const a=n.symbolLayers.at(0);if(!a)return 0;switch(a.type){case"icon":{const{computeIconLayerResourceSize:e}=await import("../../symbols/support/symbolLayerUtils.js");return Math.min(Xe.icon,(await e(a,Xe.icon))[0])||Xe.icon}case"text":return Xe.text;case"line":return Xe.line;case"object":{const{computeObjectLayerResourceSize:t}=await import("../../symbols/support/symbolLayerUtils.js");return se(await t(a,e.scale/Xe.viewScaleSizeFactor),r)}case"path":case"extrude":return e.scale/Xe.viewScaleSizeFactor;default:return 0}}function ce(e,t){const r=e.axis,n=t?.type??"double",a={initial:0,current:0},o=q[e.valueUnit]??1;let i;return i="area"===e.valueRepresentation?e=>(e*o/2)**2*Math.PI:"radius"===e.valueRepresentation||"distance"===e.valueRepresentation?e=>e*o/2:e=>e*o,{field:e.field,fieldType:n,getDefaultValue:async(e,t)=>ue(i(await le(t,e,r)),n),getValue:(e,t)=>(a.initial||(a.initial=t.pixelSizeAt(t.center)),a.current=a.initial*e,ue(a.current,n)),setInitialValue:e=>{a.initial=e,a.current=0},isUpdatingInteractively:!1,displayUnit:et(e.valueUnit),axis:e.axis}}function ue(e,t){switch(t){case"small-integer":case"integer":case"long":return Math.round(e);case"double":case"single":return e;default:return 0}}function pe(e){if(!P(e))return!1;switch(e?.type){case"class-breaks":case"simple":case"unique-value":case"dot-density":case"dictionary":case"pie-chart":return!0;default:return!1}}async function de(e,t,r){const n=await N(e,{useSourceLayer:!0,ignoreGraphicSymbol:!0,webStyleCache:t,scale:r});null!=I(e.symbol,n)&&(e.symbol=n)}function fe(e,t){if(!e||!t)throw new Error("no geometry type");if("multipatch"===e)return{tool:"mesh",createOptions:{mode:"hybrid"}};const r=new Map;r.set("circle",{mode:"freehand"}),r.set("rectangle",{mode:"freehand"});const n={mode:Q,optionsPerTool:r};if(T(t)){const a=t.defaultTool,o=S(t)?t.definition?.inputGeometryType??e:e;switch(a){case"freehand":case"stream-line":return{tool:"polyline"===o?"freehandPolyline":"freehandPolygon",createOptions:n};case"autocomplete-freehand-polygons":case"stream-polygon":return{tool:"freehandPolygon",createOptions:n};case"autocomplete-polygons":case"difference-polygon":case"create-structures":case"polygon":case"trace":return{tool:"polygon"===o?"polygon":"polyline",createOptions:n};case"circle":return r.get("circle").preserveAspectRatio=!0,{tool:"circle",createOptions:n};case"ellipse":return r.get("circle").preserveAspectRatio=!1,{tool:"circle",createOptions:n};case"create-points-along-line":case"multipoint":return{tool:"multipoint",createOptions:n};case"line":case"radial-line":case"right-angle-line":case"split":case"two-point-line":return{tool:"polyline",createOptions:n};case"rectangle":case"regular-polygon":case"right-angle-polygon":return{tool:"rectangle",createOptions:n};case"elevation-point-from-contour":case"elevation-point-from-dem":case"parcel-seed":case"point":case"point-and-rotation":case"point-at-end-of-line":return{tool:"point",createOptions:n}}}else{const a=t.drawingTool;if("circle"===a||"ellipse"===a)return r.get("circle").preserveAspectRatio="circle"===a,{tool:"circle",createOptions:n};if("rectangle"===a)return{tool:"rectangle",createOptions:n};if("freehand"===a)return{tool:"polygon"===e?"freehandPolygon":"freehandPolyline",createOptions:n}}return{tool:e,createOptions:n}}async function ye(e,t,r){const{creationInfo:n,fullTemplate:a}=t;if(!n)throw new i("featureworkflow","No creation info provided.");const o=n.layer,s=Oe(a,n.attributeOverrides),{view:l}=e,c="2d"===l?.type;S(a)||F(a)||await xe(e,o,s,r,c?l.scale:null);const{capabilities:u}=o;e.layer.elevationInfo=o.elevationInfo;const p=fe(o.geometryType,a);e.defaultCreateOptions={graphicProperties:{attributes:s,sourceLayer:o},mode:p.createOptions.mode,optionsPerTool:p.createOptions.optionsPerTool,preserveAspectRatio:p.createOptions.preserveAspectRatio,hasZ:u.data.supportsZ,defaultZ:(c?u.editing.zDefault:null)??e.defaultCreateOptions.defaultZ},null==n.geometryToPlace?await e.create(p.tool):await e.place(n.geometryToPlace,{graphicProperties:{attributes:s,sourceLayer:o}})}async function me(e){return s([await he(e),await ge(e)])}async function he({creationAttributes:e,data:t,sketchViewModel:r,view:n,webStyleCache:a}){const{creationInfo:o}=t,{fullTemplate:i}=t;if(!o||"2d"!==n?.type||S(i)||F(i))return null;const s=f((t=>xe(r,o.layer,e,a,t)));return g((()=>n.scale),(e=>s(e)))}async function ge({data:t,sketchViewModel:r,view:n}){const{templateExecutorInfo:a}=t;if(!a)return null;const o=r.activeComponent;if(!n||!X(o))return Y().error(new i("featureworkflow","Failed to set up template feedback.")),null;const c=new V({effect:"saturate(0.6) opacity(0.8)",listMode:"hide",title:"Shared Template Feedback Graphics"});n.map?.add(c);const{executor:u,serviceLayersById:p}=a,d=n.theme?.accentColor??new e([255,165,0,1]);return s([b((()=>o),["cursor-update","vertex-add"],(()=>{c.removeAll();const e=o.graphic?.geometry;if(!e||!be(e))return;const t=u(e,"digitizing");if(!y(t))for(const r of t.edits){const e=p.get(r.id);if(e&&r.addFeatures&&0!==r.addFeatures.length)for(const t of e)if(!t.isTable)for(const e of r.addFeatures){const t=we(e,d);t&&c.add(t)}}})),l((()=>{n.map.remove(c),c.destroy()}))])}function be(e){switch(e.type){case"point":case"multipoint":return!0;case"polyline":return e.paths[0].length>1;case"polygon":{const t=e.rings[0];return n(t.at(0),t.at(-1))?t.length>2:t.length>1}default:return!1}}function we(e,r){let n=null;switch(e.geometry?.type){case"point":case"multipoint":n=new G({angle:0,color:r,outline:new D({cap:"round",color:r,join:"round",miterLimit:1,style:"solid",width:1}),path:"undefined",size:8,style:"circle",xoffset:0,yoffset:0});break;case"polygon":n=new R({color:r,outline:new D({cap:"round",color:r,join:"round",miterLimit:1,style:"solid",width:3}),style:"none"});break;case"polyline":n=new D({cap:"round",color:r,join:"round",miterLimit:1,style:"solid",width:2});break;default:return null}return new t({geometry:e.geometry,symbol:n,attributes:{...e.attributes}})}async function ve(e,t){const r=await Z(t).load(),n=x(e)?e.parent:e;return r.tablesAndLayersLookup.get(n)}async function Ie(e,t){const r=await ve(e,t);if(!r)return new Map;const n=new Map;for(const a of r.layersAndTables)d(n,a.layerId,(()=>[])).push(a);return n}function Te(e){const t=e.objectIdField,r=e.globalIdField??"";return{id:e.layerId,identifierFields:{objectIdField:t,globalIdField:r},addFeatures:[],deleteAttachments:[],addAttachments:[],deleteFeatures:[],updateFeatures:[]}}function Se(e){const{edits:t,serviceInfo:n,view:a,findOriginalFeature:o}=e,i=je(n.layersAndTables),s=n.layersAndTables.toArray(),{allEditData:l,editDataByLayerIdMap:c,editDataByIdMap:u}=ke(t,i,o),p=Ae(l,Fe(s,c),c);if(a&&Le(l,p,a),0===p.length)return t;const d=K(p,{continueOnCircularDependency:!0}).map((e=>u.get(e))).filter(r),f=new Map;for(const r of d)f.set(r.uniqueId,r);const y=[];for(const r of l)f.has(r.uniqueId)||y.push(r);const m=[];let h=null;for(const r of d){const{layer:e}=r;switch(null==h?h=Te(e):h.id!==e.layerId&&(m.push(h),h=Te(e)),r.operationType){case"add":case"modify":h.addFeatures.push(r.after);break;case"delete":h.deleteFeatures.push(r.before)}}null!==h&&m.push(h);for(const r of y){const e=r.layer.layerId,t=m.find((t=>t.id===e))??Te(r.layer);switch(m.includes(t)||m.push(t),r.operationType){case"add":t.addFeatures.push(r.after);break;case"modify":t.updateFeatures.push(r.after);break;case"delete":t.deleteFeatures.push(r.before);break;case"deleteAttachment":t.deleteAttachments.push(r.attachmentId);break;case"addAttachment":t.addAttachments.push(r.attachment)}}for(const r of m)void 0!==r.deleteAttachments&&0===r.deleteAttachments.length&&delete r.deleteAttachments,void 0!==r.addAttachments&&0===r.addAttachments.length&&delete r.addAttachments;return m}function je(e){const t=new Map;for(const r of e)t.set(r.layerId,r);return t}function Fe(e,t){const r=new Map;for(const n of e)for(const e of n.relationships??[])if(r.set(Ue(n,e),""),t.has(e.relatedTableId)){const a=t.get(e.relatedTableId);if(a.length>0)for(const t of a[0].layer.relationships??[])if(t.id===e.id){r.set(Ue(n,e),t.keyField);break}}return r}function ke(e,t,r){const n=new Map,a=[],o=new Map;let s=1;for(const l of e){const e=[],c=t.get(l.id);if(!c)throw new i("featureworkflow",`Failed to prepare applyEdits payload. Layer with id ${l.id} not found.`);for(const t of l.addFeatures??[])e.push({uniqueId:"T"+s++,operationType:"add",layer:c,after:t});for(const t of l.deleteFeatures??[])e.push({uniqueId:"T"+s++,operationType:"delete",before:t,layer:c});for(const t of l.deleteAttachments??[])e.push({uniqueId:"T"+s++,operationType:"deleteAttachment",attachmentId:t,layer:c});for(const t of l.addAttachments??[])e.push({uniqueId:"T"+s++,operationType:"addAttachment",attachment:t,layer:c});for(const t of l.updateFeatures??[])e.push({uniqueId:"T"+s++,operationType:"modify",before:r(t),after:t,layer:c});n.set(c.layerId,e);for(const t of e)a.push(t),o.set(t.uniqueId,t)}return{allEditData:a,editDataByIdMap:o,editDataByLayerIdMap:n}}function Ae(e,t,r){const n=[];for(const a of e){const e=a.layer.relationships??[],{uniqueId:o}=a;for(const i of e){const e=i.keyField;if("origin"===i.role){const s=r.get(i.relatedTableId);if(!s||0===s.length)continue;const l=Ue(a.layer,i),c=t.get(l);if(void 0===c||""===c)continue;switch(a.operationType){case"add":for(const t of s)t!==a&&("add"!==t.operationType&&"modify"!==t.operationType||t.after.attributes[c]===a.after.attributes[e]&&n.push([o,t.uniqueId]));break;case"modify":if(a.before.attributes[e]!==a.after.attributes[e])for(const t of s){const r=t.uniqueId;t!==a&&("delete"===t.operationType?t.before.attributes[c]===a.before.attributes[e]?n.push([r,o]):t.before.attributes[c]===a.after.attributes[e]&&n.push([o,r]):"add"===t.operationType?t.after.attributes[c]===a.after.attributes[e]?n.push([o,r]):t.after.attributes[c]===a.before.attributes[e]&&n.push([r,o]):"modify"===t.operationType&&(t.before.attributes[c]!==t.after.attributes[c]?t.after.attributes[c]===a.after.attributes[e]?n.push([o,r]):n.push([r,o]):n.push([o,r])))}break;case"delete":for(const t of s)t!==a&&("delete"!==t.operationType&&"modify"!==t.operationType||t.before.attributes[c]===a.before.attributes[e]&&n.push([t.uniqueId,o]))}}}}return n}function Ue(e,t){return`${e.layerId}:${t.id}`}function Ve(e,t){return!!(t?.map&&"utilityNetworks"in t.map&&t.map.utilityNetworks?.length&&t.map.utilityNetworks.some((t=>!(!t.loaded||!e.url?.startsWith(t.featureServiceUrl)||e.layerId!==t.networkSystemLayers.associationsTableId))))}function Le(e,t,r){const n=[];for(const o of e)Ve(o.layer,r)&&n.push(o);if(0===n.length)return;let a=[];for(const o of n){const r=o.layer;switch(o.operationType){case"delete":a=[...Me(o.before.attributes[r.fieldsIndex.get("fromglobalid").name],e),...Me(o.before.attributes[r.fieldsIndex.get("toglobalid").name],e)];for(const e of a)t.push([o.uniqueId,e.uniqueId]);break;case"add":a=[...Me(o.after.attributes[r.fieldsIndex.get("fromglobalid").name],e),...Me(o.after.attributes[r.fieldsIndex.get("toglobalid").name],e)];for(const e of a)t.push([e.uniqueId,o.uniqueId])}}}function Me(e,t){const r=[],n=t.filter((({layer:e})=>""!==e.globalIdField&&null!=e.globalIdField));for(const a of n){const t=a.layer.globalIdField;("before"in a&&a.before?.attributes[t]===e||"after"in a&&a.after?.attributes[t]===e)&&r.push(a)}return r}function Oe(e,t={}){return S(e)||F(e)?{}:k(e)?{...e.prototype.attributes,...t}:A(e)?{...e.definition?.defaultValues,...t}:{...t}}async function xe(e,r,n,a,o){const i=new t({sourceLayer:r,attributes:n}),{rotation:s,size:l}=oe(i);let c=await N(i,{useSourceLayer:!0,webStyleCache:a,scale:o}),u=!1;for(const t of[l,s]){if(null==t)continue;null==n[t.field]&&(n[t.field]=await t.getDefaultValue(c,e.view),u=!0)}switch(u&&(c=await N(i,{useSourceLayer:!0,webStyleCache:a,scale:o})),c?.type){case"simple-fill":case"polygon-3d":e.polygonSymbol=c;break;case"simple-line":case"line-3d":e.polylineSymbol=c;break;case"simple-marker":case"picture-marker":case"point-3d":case"cim":e.pointSymbol=c;break;case"mesh-3d":e.meshSymbol=c}ze(e.tooltipOptions,l,s)}function ze(e,t,r){e.visualVariables=null!=t||null!=r?{size:null!=t?{unit:t.displayUnit,axis:t.axis,valueType:t.fieldType}:null,rotation:null!=r?{valueType:r.fieldType,rotationType:r.rotationType??"geographic"}:null}:null}function qe(e,t){return e?.find((e=>e.layer===t))}async function Pe(e,t,r,n){switch(t.type){case"3d":return Ee(e,t,r,n);case"2d":return Ce(e,t,r,n)}}async function Ee(e,t,r,n){if(0===e.length)return[];const{updatable:o,graphicsByLayer:i}=await r.defer((async()=>{const{results:a}=await h(H(t,r),n),o=new Map,i=e=>{const t=e.layer,r=o.get(t);if(!r){const e=new Array;return o.set(t,e),e}return r};J(a).forEach((({graphic:e})=>i(e).push(e)));const s=e.filter((({capabilities:e,layer:t})=>e.update.enabled&&o.has(t)));return 0!==s.length&&r.stopPropagation(),{updatable:s,graphicsByLayer:o}}));return h(Promise.allSettled(o.map((async({layer:e})=>{const t=i.get(e),r=Re(e);if(t.every((e=>L(r,e))))return t;const o=[];for(const n of t){o.push(n.getObjectId());const e=Object.keys(n.attributes);a(r,e)}const s=e.createQuery();return s.returnGeometry=!1,s.objectIds=o,s.outFields=M(e.fieldsIndex,r),e.queryFeatures(s,{signal:n}).then((({features:e})=>e))}))),n)}async function Ce(e,t,r,n){if(0===e.length)return[];const{mapPoint:a}=r;if(null==a)return[];let o=null;const i=await r.defer((async()=>{const{results:a}=await h(t.hitTest(r),n);if(0===a.length)return[];const i=new Set;o=J(a),o.forEach((({graphic:e})=>e&&i.add(e.layer)));const s=e.filter((e=>i.has(e.layer)&&e.supportsUpdateWorkflow));return s.length>0&&r.stopPropagation(),s}));return h(Promise.allSettled(i.map((async({layer:e})=>{const i=e.createQuery();i.returnGeometry=!0,i.outFields=Re(e);const s="renderer"in e?z({renderer:e.renderer,pointerType:r.pointerType}):0;i.geometry=$(a,s,t),i.outSpatialReference=t.spatialReference;const{features:l}=await e.queryFeatures(i,{signal:n});return o?.forEach((({graphic:t})=>{t.layer!==e||l.some((e=>e.getObjectId()===t.getObjectId()))||l.push(t)})),l}))),n)}function Re(e){return M(e.fieldsIndex,[e.objectIdField,O({displayField:"displayField"in e?e.displayField:null,fields:e.fields})])}async function De(e,t,n,a){const o=t.createQuery();o.objectIds=e.map((e=>e.getObjectId())).filter(r),o.outFields=["*"],o.returnM=t.capabilities.data.supportsM,o.returnZ=t.capabilities.data.supportsZ,"scene"===t.type&&null!=t.infoFor3D||(o.outSpatialReference=n);const i=await t.queryFeatures(o,{signal:a});return m(a),i.features}function Ge(e){const t=new Map;for(const r of e){const e=r.sourceLayer,n=x(e)?e.parent:e;d(t,n,(()=>[])).push(r)}return t}async function Be(e){const{graphic:t,sketchViewModel:r,sourceLayer:n,visualVariables:a}=e;await Ne(e);const o={multipleSelectionEnabled:!1};return"point"===n.geometryType&&(o.enableRotation=null!=a.rotation,o.enableScaling=null!=a.size),r.update(t,o)}async function Ne(e){const{graphic:t,sketchViewModel:r,sourceLayer:n,visualVariables:a,webStyleCache:o}=e;let i=!1;const{rotation:s,size:l}=a;for(const c of[s,l]){if(null==c)continue;const e=t.getAttribute(c.field);if(null!=e)c.setInitialValue(e);else{const e=await c.getDefaultValue(t.symbol,r.view);c.setInitialValue(e),t.setAttribute(c.field,e),i=!0}}if(i){const e="2d"===r.view?.type?r.view.scale:null;await de(t,o,e)}ze(r.tooltipOptions,l,s),r.layer.elevationInfo=n.elevationInfo}function Ze(e){return null==e||"rotate-start"!==e.type&&"rotate"!==e.type&&"rotate-stop"!==e.type?null:e}function We(e){return null==e||"scale-start"!==e.type&&"scale"!==e.type&&"scale-stop"!==e.type?null:e}function Qe(e,t,r,n){if(null==t.geometry||"point"!==t.geometry?.type)return!1;const a=t.attributes;let o=!1;const i=n.rotation,s=Ze(r.toolEventInfo);if(null!=i&&null!=s){const{field:r,getValue:n}=i;if("rotate-stop"===s.type)i.isUpdatingInteractively=!1,i.setInitialValue(t.getAttribute(r));else{i.isUpdatingInteractively=!0;const l=n(s.angle,e);l!==a[r]&&(t.setAttribute(r,l),o=!0)}}const l=n.size,c=We(r.toolEventInfo);if(null!=l&&null!=c){const{field:r,getValue:n}=l;if("scale-stop"===c.type)l.isUpdatingInteractively=!1,l.setInitialValue(t.getAttribute(r));else{l.isUpdatingInteractively=!0;const i=n(c.xScale,e);i!==a[r]&&(t.setAttribute(r,i),o=!0)}}return o}async function $e({feature:e,featureClone:t,visualVariableAttributes:r,sketchViewModel:n,view:a,onUpdate:o,webStyleCache:i,addUpdatingPromise:u,addHandle:p}){await de(t,i,"2d"===a.type?a.scale:null);let d=null;if("2d"===n?.view?.type){const e=f((e=>de(t,i,e)));d=g((()=>n?.view?.scale),(t=>e(t)))}const y=t.sourceLayer,m=nt(a,y);await Be({graphic:t,sketchViewModel:n,sourceLayer:y,visualVariables:r,webStyleCache:i});let h=null;m.then((e=>h=e)).catch((()=>{}));const b=r.size,v=r.rotation,I=g((()=>e.attributes),(async e=>{let r=!1;for(const n in e){const a=e[n];a!==t.getAttribute(n)&&(t.setAttribute(n,a),null==b||b.isUpdatingInteractively||b.field!==n||b.setInitialValue(a),null==v||v.isUpdatingInteractively||v.field!==n||v.setInitialValue(a),(null==h||h.requiredFields.includes(n))&&(r=!0))}r&&await de(t,i,"2d"===a.type?a.scale:null)})),T=n.on("update",(async e=>{const t=e.graphics[0],s={graphic:t,sketchViewModel:n,sourceLayer:y,visualVariables:r,webStyleCache:i};if("complete"===e.state){if(null===a.activeTool)return Be(s);const e=new AbortController,t=c(e);return p(t),u(w((()=>null===a.activeTool),e.signal).then((async()=>{if(!e.signal.aborted)return e.abort(),Be(s)})))}Qe(a,t,e,r)&&await de(t,i,"2d"===a.type?a.scale:null),o(ot(t),e)})),S=n.on(["undo","redo"],(async e=>{o(ot(e.graphics[0]),e)}));return s([S,T,l((()=>n.cancel())),I,d])}async function Je(e,t,r){const n=e.view;e.layer.add(r);const a=t.sourceLayer,i=t.layer,c=t.getAttribute(i.objectIdField);let u=null;function p(e){u?.abort(),u=o((async t=>{const r=await nt(n,a);m(t),r.setVisibility?.(c,e)}))}return await Ke(n,r),p(!1),s([He(n,r,(e=>p(!e))),l((async()=>{p(!0);try{const e=await nt(n,a);await w((()=>!e.updating))}finally{e.layer.remove(r)}}))])}function He(e,t,r){if("3d"===e.type){const n=new W({graphic:t});return s([e.trackGraphicState(n),g((()=>n.displaying),r)])}return g((()=>t.visible),r)}async function Ke(e,t){if("3d"===e.type){const r=new W({graphic:t}),n=e.trackGraphicState(r);await w((()=>r.displaying||r.error)),n.remove()}else await w((()=>t.visible))}const Xe={icon:v(24),text:v(12),line:v(1),viewScaleSizeFactor:100};function Ye(e,t,r){let n=!1;return e.filter((e=>!!n||(n=e===t,n))).map((e=>r[e]()))}function _e(e,t){e.viewModel.syncFeatureTemplates();const r=e.creationInfo;if("awaiting-feature-creation-info"===t[0].id&&r){const n=r.layer,a=e.viewModel.getTemplatesForLayer(n);1===a.length&&"scene"!==n.type&&(r.template=a[0],t.shift())}return t}function et(e){return"unknown"===e?null:e}function tt(e){e.filesEnabled=!0,e.mode="view",e.capabilities={editing:!0,operations:{add:!0,update:!0,delete:!0}}}const rt=e=>/-stop/.test(e)||/vertex-/.test(e),nt=(e,t)=>{const r="subtype-sublayer"===t.type?t.parent:t;return e.whenLayerView(r)};function at(e){return"createInteractiveEditSession"in e}function ot(e){const t=e.geometry;if("mesh"===t?.type){const r=e.cloneShallow();return r.attributes=u(e.attributes),r.geometry=t.cloneShallow(),r.geometry.transform=t.transform?.clone()??null,r}return e.clone()}function it(e){const t=e.cursor;return e.cursor="progress",l((()=>e.cursor=t))}async function st(e,t){const{template:r}=e;if(null==r)return null;if(j(r))return r.load();if(T(r)){const e=(await import("../../editing/sharedTemplates/SharedTemplate.js")).default,n=U(t,{makeSharedTemplateFromJSON:t=>e.fromJSON(t)}),a=await n.getTemplates({templateIds:[r.templateId],featureService:r.featureService});if(0===a.length)throw new i("editor:failed-to-load-template","Unable to load the provided template");return a[0].load()}return r}function lt(e){for(const t of e){const{destinationGraphic:e,destinationField:r,sourceGraphic:n,sourceField:a}=t;e.setAttribute(r,n.getAttribute(a))}}function ct(e){const t=e.templateExecutorInfo?.completionResults;return t?.length?(t.forEach((e=>lt(e.relationships))),t.flatMap((e=>e.edits))):null}function ut(e){if(null==e)return[];if(te(e))return e.data.layers;const t=ne(e)?e.activeWorkflow:e,r=t?.layer;return r?[r]:[]}export{Le as appendAllUtilityNetworkAssociationRelationships,_e as avoidFeatureTemplateSelectionWithOnlyOneItem,at as canCreateInteractiveEditSession,ot as cloneGraphicExceptMesh,je as createLayerIdMap,Fe as createRelationshipKeyMap,fe as createToolFromGeometryType,Ye as createWorkflowSteps,Pe as fetchCandidates,De as fetchFullFeatures,Ae as findAllDependencies,Me as findChangesByGlobalId,qe as findLayerInfo,Ue as generateHashForRelationship,Oe as getCreationAttributes,st as getFullTemplateForCreationInfo,ut as getLayersFromWorkflow,ie as getRotationVariableAttribute,ct as getServiceEditsFromWorkflowData,ve as getServiceInfoForLayer,Ie as getServiceLayersById,ce as getSizeVariableAttribute,oe as getVisualVariableAttributes,ae as getVisualVariablesForLayer,Ge as groupFeaturesByLayer,_ as isBatchAttributeFormViewModel,ee as isCreateFeaturesWorkflow,rt as isTerminalUpdateEventType,te as isUpdateFeaturesWorkflow,re as isUpdateRecordWorkflow,ne as isUpdateWorkflow,Ve as isUtilityNetworkAssociationsTable,Se as orderEditsByRelationshipDependencies,tt as prepareAttachmentsForCreateFeaturesWorkflow,lt as setRelationshipFields,$e as setUpGeometryUpdate,me as setUpSketchCreateWatchers,Ne as setVisualVariablesAndElevationInfoForUpdate,it as showProgressCursor,Xe as sizeDefaults,et as sizeVariableUnitToLengthUnit,ye as startCreatingNewFeature,Be as startUpdatingFeatureGeometry,Je as swapForEditingSession,de as updateGraphicSymbolWhenRequired,Qe as visualVariableInteractiveUpdate,nt as whenEditorLayerView,Ke as whenGraphicDisplayed};
package/widgets/Editor.js CHANGED
@@ -2,4 +2,4 @@
2
2
  All material copyright ESRI, All Rights Reserved, unless otherwise specified.
3
3
  See https://js.arcgis.com/4.34/esri/copyright.txt for details.
4
4
  */
5
- import{_ as e}from"../chunks/tslib.es6.js";import"../intl.js";import{destroyMaybe as t,abortMaybe as s,mappedFind as i}from"../core/maybe.js";import{createResolver as o}from"../core/promiseUtils.js";import{watch as a,on as r,when as n,initial as l}from"../core/reactiveUtils.js";import{property as c}from"../core/accessorSupport/decorators/property.js";import"../core/has.js";import"../core/Logger.js";import"../core/RandomLCG.js";import{subclass as d}from"../core/accessorSupport/decorators/subclass.js";import{UpdatingHandles as h}from"../core/support/UpdatingHandles.js";import m from"../views/interactive/sketch/SketchValueOptions.js";import p from"./Attachments.js";import u from"./BatchAttributeForm.js";import g from"./FeatureForm.js";import w from"./FeatureTemplates.js";import _ from"./Spinner.js";import v from"./Widget.js";import{VisibleElements as f}from"./BatchAttributeForm/VisibleElements.js";import{css as y}from"./Editor/css.js";import b from"./Editor/EditorViewModel.js";import{isModelUpload as k}from"./Editor/modelUploadUtils.js";import A from"./Editor/VisibleElements.js";import{isBatchAttributeFormViewModel as F}from"./Editor/workflowUtils.js";import{loadCreateFeaturesPanelContentComponents as M,CreateFeaturesPanelContent as T}from"./Editor/components/CreateFeaturesPanelContent.js";import{loadFeatureListComponents as C,FeatureList as L}from"./Editor/components/FeatureList.js";import{loadFooterActionsComponents as S,FooterActions as E}from"./Editor/components/FooterActions.js";import{loadNoticesComponents as W,Notice as P}from"./Editor/components/Notices.js";import{loadPanelContentComponents as I,PanelContent as j,PanelContentSection as U,PanelContentMessage as V}from"./Editor/components/PanelContent.js";import{PanelToolbar as D,loadPanelToolbarComponents as B}from"./Editor/components/PanelToolbar.js";import{loadPromptComponents as O,Prompt as x}from"./Editor/components/Prompt.js";import{loadUpdateFeaturePanelContentComponents as N,UpdateFeaturePanelContent as z}from"./Editor/components/UpdateFeaturePanelContent.js";import{loadUploadDetailsComponents as H,UploadDetails as G}from"./Editor/components/UploadDetails.js";import{VisibleElements as R,SelectionToolVisibilityMap as q,CreateToolVisibilityMap as Z}from"./Sketch/VisibleElements.js";import{loadCalciteComponents as K}from"./support/componentsUtils.js";import{globalCss as $}from"./support/globalCss.js";import{incrementHeadingLevel as J,Heading as Q}from"./support/Heading.js";import{renderItem as X}from"./support/ItemList.js";import{connectDelayedLoading as Y}from"./support/loaderUtils.js";import ee from"./support/SelectionList.js";import te from"./support/SelectionToolbar.js";import"./support/widgetUtils.js";import{messageBundle as se}from"./support/decorators/messageBundle.js";import{vmEvent as ie}from"./support/decorators/vmEvent.js";import{tsx as oe}from"./support/jsxFactory.js";import ae from"./support/SelectionList/VisibleElements.js";import re from"./support/SelectionToolbar/VisibleElements.js";import{substitute as ne}from"../intl/substitute.js";const le=Symbol("sketch-setup-handles");let ce=class extends v{constructor(e,t){super(e,t),this._batchAttributeForm=new u({visibleElements:new f({loadingIndicator:!1})}),this._featureForm=new g,this._sketchToolbar=null,this._attachments=new p({visibleElements:{addSubmitButton:!1,cancelAddButton:!1,cancelUpdateButton:!1,deleteButton:!1,errorMessage:!1,progressBar:!1,updateButton:!1}}),this._associationItemList=null,this._associationSettings=null,this._featureTemplates=new w({enableListScroll:!1,renderItemContentEnd:e=>e.supportsUpload?oe("calcite-icon",{class:y.templateItemContentEnd,icon:"upload-to",key:"upload-icon"}):null,renderItemLabel:e=>e.label,renderCustomGroupContent:e=>this._renderCustomTemplateGroupContent(e)}),this._filterText="",this._prompt=null,this._spinner=new _,this._loading=!1,this._selectionList=new ee({displayMode:"layer",itemActionConfigs:this._selectionListItemActionConfigs,onListItemSelect:({item:e})=>this._onSelectionListItemSelect(e),visibleElements:new ae({header:!1})}),this._selectionToolbar=new te({persistSelection:!1,returnGeometry:!1,visibleElements:new re({chip:!1})}),this._updatingHandles=new h,this.headingLevel=4,this.messages=null,this.messagesCommon=null,this.messagesTemplates=null,this.messagesFeature=null,this.supportingWidgetDefaults=null,this.viewModel=new b,this.visibleElements=new A,this._renderAttachments=()=>this._attachments.render(),this._renderFeatureForm=()=>this._featureForm.render(),this._renderBatchAttributeForm=()=>this._batchAttributeForm.render(),this._renderFeatureTemplates=()=>this._featureTemplates.render(),this._renderSelectionList=()=>this._selectionList.render(),this._renderSelectionToolbar=()=>this._selectionToolbar.render(),this._renderSketch=()=>this._sketchToolbar?oe("div",{class:y.sketchContainer,key:"editor-sketch-container"},this._sketchToolbar?.render()):void 0,this._renderSelectIcon=()=>oe("calcite-icon",{icon:"cursor",slot:"content-start"}),this.EditorPanel=({heading:e,key:t,selected:s},...i)=>{const{visibleElements:o}=this;return oe("calcite-flow-item",{closable:!1,heading:e,headingLevel:this.headingLevel,key:t,loading:this._loading,selected:s,onCalciteFlowItemBack:this._onBack},o.zoomToButton&&this.viewModel.canZoomTo?oe("calcite-action",{alignment:"center",appearance:"transparent",icon:"zoom-to-object",key:"zoom-to-button",onclick:()=>this.viewModel.zoomTo(),slot:"header-actions-end",text:this.messages.zoomTo,title:this.messages.zoomTo}):null,o.settingsMenu?oe(D,{editorViewModel:this.viewModel,messagesCommon:this.messagesCommon,visibleElements:o}):null,...i)},this._showDiscardEditsPrompt=()=>{const{messages:e,activeWorkflow:t}=this,s={title:e.cancelEditTitle,message:e.cancelEditWarningMessage,yesLabel:e.discardEdits,noLabel:e.continueEditing};return"create-features"===t?.type&&k(t.data.creationInfo)?this._showPromptAndWait("success"===t.data.upload?.state?e.modelUploads.cancelPlacementPrompt:e.modelUploads.cancelUploadPrompt):"update"===t?.type&&t.activeFeatureFormViewModel?.activeAssociation?this._showPromptAndWait({...s,message:e.cancelAssociationEditWarning}):this._showPromptAndWait(s)},this._showGenericCancelPrompt=()=>{const{messages:e,messagesCommon:t}=this;return this._showPromptAndWait({title:e.cancelRequestTitle,message:e.cancelRequestWarningMessage,yesLabel:t.form.yes,noLabel:t.form.no})},this._showPrompt=e=>{this._prompt?.cancel?.(),this._prompt=e},this._clearPrompt=()=>{this._prompt=null},this._onSave=()=>{this.viewModel.saveWorkflow()},this._onDelete=()=>{const{messages:e,messagesCommon:t}=this;this._showPrompt({title:e.deleteWarningTitle,message:e.deleteWarningMessage,context:"danger",actions:{primary:{label:t.delete,action:()=>{this.deleteFeatureFromWorkflow(),this._clearPrompt()}},secondary:{label:e.keepFeature,action:this._clearPrompt}}})},this._onDeleteAssociation=()=>{const{messages:e,messagesCommon:t}=this;this._showPrompt({title:e.deleteAssociationTitle,message:e.deleteAssociationMessage,context:"danger",actions:{primary:{label:t.delete,action:()=>{this.deleteAssociationFromWorkflow(),this._clearPrompt()}},secondary:{label:e.keepAssociation,action:this._clearPrompt}}})},this._onToggleUpdateWorkflow=()=>this.viewModel.toggleUpdateWorkflow(),this._onBack=e=>(e?.stopPropagation(),this.viewModel.back()),this._onAttachmentAdd=()=>{const{activeWorkflow:e}=this.viewModel;e&&("create-features"===e.type||"update"===e.type&&"create-features"===e.activeWorkflow?.type?(this._attachments.addFile(),e.back()):this._attachments.addAttachment().then((()=>e.back())))},this._onAttachmentUpdate=()=>{const{activeWorkflow:e}=this.viewModel;e&&("create-features"===e.type?(this._attachments.updateFile(),e.back()):this._attachments.updateAttachment().then((()=>e.back())))},this._onAttachmentDelete=()=>{const{messages:e,messagesCommon:t}=this;this._showPrompt({title:e.deleteAttachmentWarningTitle,message:e.deleteAttachmentWarningMessage,context:"danger",actions:{primary:{label:t.delete,action:this._onAttachmentDeleteConfirm},secondary:{label:e.keepAttachment,action:this._clearPrompt}}})},this._onAttachmentDeleteConfirm=async()=>{const e=this._attachments,{activeWorkflow:t}=this.viewModel;t&&("create-features"===t.type?e.deleteFile():(await e.deleteAttachment(e.viewModel.activeAttachmentInfo),this._clearPrompt()),await t.back(),this._clearPrompt())},this._onAttachmentsError=e=>{this._showPrompt({title:this.messages.errorWarningTitle,message:e.message,context:"warning",actions:{primary:{label:this.messagesCommon.form.ok,action:this._clearPrompt}}})}}initialize(){this._featureForm.showPrompt=this._showPrompt,this._featureForm.clearPrompt=this._clearPrompt,this.addHandles([a((()=>J(this.headingLevel)),(e=>{this._featureForm.headingLevel=e,this._featureTemplates.headingLevel=e}),l),r((()=>this.viewModel.activeWorkflow),"cancel-request",(({controller:e})=>{(this.viewModel.hasPendingEdits?this._showDiscardEditsPrompt():this._showGenericCancelPrompt()).then((t=>t?e.allow():e.deny()))})),n((()=>this.viewModel.formViewModel),(e=>{F(e)?this._batchAttributeForm.viewModel=e:this._featureForm.viewModel=e}),l),n((()=>this.viewModel.utilityNetworkAssociationAddAssociationViewModel),(e=>{this._associationItemList?this._associationItemList.viewModel=e:this._updatingHandles.addPromise(this._initializeAssociationItemList(e))}),l),n((()=>this.viewModel.utilityNetworkAssociationAddAssociationViewModel?.association),(()=>{this._setUpAssociationSettings()})),a((()=>[this.viewModel,this.viewModel?.attachmentsViewModel,this.viewModel?.featureTemplatesViewModel,this.viewModel?.spinnerViewModel,this.viewModel?.selectionListViewModel,this.viewModel?.selectionToolbarViewModel]),(([e,t,s,i,o,a])=>{this._attachments.viewModel=t,this._featureTemplates.viewModel=s,this._spinner.viewModel=i,this._selectionList.viewModel=o,this._selectionToolbar.viewModel=a,e.showDiscardEditsPrompt=this._showDiscardEditsPrompt}),l),a((()=>this.view),((e,t)=>{const s=`editor-${this.id}-spinner`;t?.ui.remove(this._spinner,s),e?.ui.add(this._spinner,{key:s,position:"manual"}),this._associationItemList&&(this._associationItemList.view=e)}),l),a((()=>[this.supportingWidgetDefaults,this.viewModel.sketchViewModel]),(([e])=>{e&&(this._featureForm.set(e.featureForm),this._attachments.set(e.attachments),this._featureTemplates.set(e.featureTemplates),this.viewModel.sketchViewModel?.set(e.sketch))}),l),n((()=>this._attachments?.error),(e=>this._onAttachmentsError(e))),n((()=>this._selectionListItemActionConfigs),(()=>{this._selectionList.itemActionConfigs=this._selectionListItemActionConfigs})),n((()=>this.viewModel?.failures),(e=>{const{messages:t}=this,[{error:s,retry:i,cancel:o}]=e;this._showPrompt({title:t.errorWarningTitle,message:ne(t.errorWarningMessageTemplate,{errorMessage:s.message}),context:"warning",actions:{primary:{label:t.retry,action:()=>{i(),this._clearPrompt()}},secondary:{label:t.ignore,action:()=>{o(),this._clearPrompt()}}}})})),a((()=>this.viewModel?.state),(e=>{switch(e){case"awaiting-feature-to-update":case"ready":case"disabled":this._filterText="",this._featureTemplates.filterText=""}})),a((()=>this.viewModel.featureFormDisabled),(e=>this._featureForm.disabled=e)),a((()=>this.visibleElements.sketch),(()=>this._setupSketch()),l),Y({getLoading:()=>{const{viewModel:e}=this;return e.syncing||e.updating||this._attachments.submitting||this._updatingHandles.updating},setEffectiveLoading:e=>{this._loading=e}})])}destroy(){this._associationItemList?.destroy(),this._associationSettings?.destroy(),this._selectionList.destroy(),this._selectionToolbar.destroy(),this._attachments.destroy(),this._batchAttributeForm.destroy(),this._featureForm.destroy(),this._featureTemplates.destroy(),this._spinner.destroy(),this._sketchToolbar=t(this._sketchToolbar),this._sketchImportAbortController=s(this._sketchImportAbortController)}loadDependencies(){return Promise.all([K({action:()=>import("@esri/calcite-components/dist/components/calcite-action"),flow:()=>import("@esri/calcite-components/dist/components/calcite-flow"),"flow-item":()=>import("@esri/calcite-components/dist/components/calcite-flow-item"),icon:()=>import("@esri/calcite-components/dist/components/calcite-icon"),list:()=>import("@esri/calcite-components/dist/components/calcite-list")}),M(),C(),S(),W(),I(),B(),O(),N(),H()])}get _deleteButtonCommonInfo(){return{appearance:"outline",kind:"danger"}}get _selectionListItemActionConfigs(){const{messages:e}=this;return[{label:e?.batchEditing?.editThisFeature,icon:"edit-attributes",type:"feature",callback:({item:e})=>this._onSelectionListMenuItemSelect(e)},{label:e?.batchEditing?.editTheseFeatures,icon:"edit-attributes",type:"layer",callback:({item:e})=>this._onSelectionListMenuItemSelect(e)}]}get activeWorkflow(){return this.viewModel.activeWorkflow}get effectiveSelectionManager(){return this.viewModel.effectiveSelectionManager}get hideTemplatesForInactiveLayers(){return this.viewModel.hideTemplatesForInactiveLayers}set hideTemplatesForInactiveLayers(e){this.viewModel.hideTemplatesForInactiveLayers=e}get icon(){return"pencil"}set icon(e){this._overrideIfSome("icon",e)}get label(){return this.messages?.widgetLabel??""}set label(e){this._overrideIfSome("label",e)}get labelOptions(){return this.viewModel.labelOptions}set labelOptions(e){this.viewModel.labelOptions=e}get layerInfos(){return this.viewModel.layerInfos}set layerInfos(e){this.viewModel.layerInfos=e}get snappingOptions(){return this.viewModel.snappingOptions}set snappingOptions(e){this.viewModel.snappingOptions=e}get tooltipOptions(){return this.viewModel.tooltipOptions}set tooltipOptions(e){this.viewModel.tooltipOptions=e}get valueOptions(){return this.viewModel.valueOptions}set valueOptions(e){this.viewModel.valueOptions=e}get view(){return this.viewModel.view}set view(e){this.viewModel.view=e}startCreateFeaturesWorkflowAtFeatureTypeSelection(){return this.viewModel.startCreateFeaturesWorkflowAtFeatureTypeSelection()}startCreateFeaturesWorkflowAtFeatureCreation(e){return this.viewModel.startCreateFeaturesWorkflowAtFeatureCreation(e)}startCreateFeaturesWorkflowAtFeatureEdit(e){return this.viewModel.startCreateFeaturesWorkflowAtFeatureEdit(e)}startUpdateFeaturesWorkflow(e){return this.viewModel.startUpdateFeaturesWorkflow(e)}startUpdateWorkflowAtFeatureSelection(){return this.viewModel.startUpdateWorkflowAtFeatureSelection()}startUpdateWorkflowAtMultipleFeatureSelection(e){return this.viewModel.startUpdateWorkflowAtMultipleFeatureSelection(e)}startUpdateWorkflowAtFeatureEdit(e){return this.viewModel.startUpdateWorkflowAtFeatureEdit(e)}startUpdateWorkflowWithActiveSelection(){return this.viewModel.startUpdateWorkflowWithActiveSelection()}deleteFeatureFromWorkflow(){return this.viewModel.deleteFeatureFromWorkflow()}deleteAssociationFromWorkflow(){return this.viewModel.deleteAssociationFromWorkflow()}cancelWorkflow(e){return this.viewModel.cancelWorkflow(e)}render(){const{visibleElements:e,viewModel:t}=this,s=this.classes(y.base,$.widget,$.panel);if(!t)return oe("div",{class:s,key:"empty"});const{pageStack:i}=t,o=i.length-1,a=i.map(((e,t)=>this._renderPage(e,t===o)));return oe("div",{class:s,key:"base"},e.flow?oe("calcite-flow",{inert:!!this._prompt,key:"flow"},a):a,this._prompt?oe(x,{...this._prompt,headingLevel:this.headingLevel}):void 0)}_renderPage(e,t){const s={selected:t};switch(e){case"disabled":break;case"ready":return this._renderReady(s);case"viewing-selection-list":return this._renderSelectionListPage(s);case"awaiting-feature-creation-info":return this._renderAwaitingFeatureCreationInfo(s);case"creating-features-upload-details":return this._renderUploadDetails(s);case"creating-features":return this._renderCreatingFeatures(s);case"editing-existing-feature":case"editing-features":case"editing-attributes":return this._renderUpdateFeature(s);case"awaiting-update-feature-candidate":return this._renderFeatureList(s);case"adding-attachment":return this._renderAttachmentAdding(s);case"editing-attachment":return this._renderAttachmentEditing(s);case"viewing-associated-layers":case"viewing-associated-features":return this._renderViewAssociatedLayers(s);case"add-association-select-layer":case"add-association-select-feature":return this._renderSelectFeature(s);case"add-association-create-association":return this._renderAddAssociation(s)}return oe("div",{key:"empty-page"})}_renderAwaitingFeatureCreationInfo(e){const{EditorPanel:t,messages:s}=this;return oe(t,{heading:s.selectTemplate,key:"templates-panel",...e},oe(j,{key:"feature-templates"},oe(U,null,this._renderFeatureTemplates())))}_renderUploadDetails(e){const{EditorPanel:t,activeWorkflow:s,messages:i}=this;if("create-features"!==s?.type)return null;const o=s.data.upload;return o?oe(t,{heading:i.createFeatures,key:"upload-details-panel",...e},oe(G,{helpMessage:this._helpMessage,messages:i,upload:o})):null}_renderCreatingFeatures(e){const{EditorPanel:t,activeWorkflow:s,messages:i,messagesCommon:o,headingLevel:a,viewModel:r}=this;if(!s)return null;const n="create-features"===s.type&&s.numPendingFeatures>0||"update"===s.type&&"create-features"===s?.activeWorkflow?.type&&s.activeWorkflow?.numPendingFeatures>0;return oe(t,{heading:i.createFeatures,key:"create-features-panel",...e},n?oe(z,{editorViewModel:r,headingLevel:a,messages:i,messagesCommon:o,renderAttachments:this._renderAttachments,renderBatchAttributeForm:this._renderBatchAttributeForm,renderFeatureForm:this._renderFeatureForm,renderSketchToolbar:this._renderSketch,onDelete:this._onDelete,onDeleteAssociation:this._onDeleteAssociation,onSave:this._onSave}):oe(T,{helpMessage:this._helpMessage,renderSketchToolbar:this._renderSketch}))}_renderUpdateFeature(e){const{EditorPanel:t,messages:s,messagesCommon:i,headingLevel:o,viewModel:a}=this;return oe(t,{heading:s.editFeature,key:"update-feature-panel",...e},oe(z,{editorViewModel:a,headingLevel:o,messages:s,messagesCommon:i,renderAttachments:this._renderAttachments,renderBatchAttributeForm:this._renderBatchAttributeForm,renderFeatureForm:this._renderFeatureForm,onDelete:this._onDelete,onDeleteAssociation:this._onDeleteAssociation,onSave:this._onSave}))}_getAssociationTypeTitle(e){const{messages:t}=this;if(!e)return t.editFeature;if(e.title)return e.title;const{messagesFeature:s}=this;switch(e.type){case"attachment":return s.associationsAttachments;case"connectivity":return s.associationsConnectivity;case"structure":return s.associationsStructure;case"content":return s.associationsContents;case"container":return s.associationsContainer}}_getAddAssociationTypeTitle(e){const{messages:t}=this;if(!e)return t.editFeature;const s=t.associations;switch(e.type){case"attachment":return s.addAttachment;case"connectivity":return s.addConnectivity;case"structure":return s.addStructure;case"content":return s.addContent;case"container":return s.addContainer}}async _initializeAssociationItemList(e){const t=(await import("./FeatureForm/FeatureFormUtilityNetworkAssociations/UtilityNetworkAssociationItemList.js")).default;this._associationItemList=new t({view:this.view,viewModel:e})}async _initializeAssociationSettings(){const e=new(0,(await import("./FeatureForm/FeatureFormUtilityNetworkAssociations/UtilityNetworkAssociationSettings.js")).default);return this._associationSettings=e,e}_renderViewAssociatedLayers(e){const{EditorPanel:t,messages:s,messagesCommon:i,headingLevel:o,viewModel:a}=this,r=a.featureFormViewModel?.activeAssociationInput?.activeAssociationType,n=this._getAssociationTypeTitle(r);return oe(t,{heading:n,key:"viewing-associated-layers-panel",...e},oe(z,{editorViewModel:a,headingLevel:o,messages:s,messagesCommon:i,renderAttachments:this._renderAttachments,renderBatchAttributeForm:this._renderBatchAttributeForm,renderFeatureForm:this._renderFeatureForm,renderSketchToolbar:this._renderSketch,onDelete:this._onDelete,onDeleteAssociation:this._onDeleteAssociation,onSave:this._onSave}))}_renderSelectFeature(e){const{_associationItemList:t,EditorPanel:s,viewModel:i,messagesCommon:o}=this,a=i.utilityNetworkAssociationAddAssociationViewModel,r=this._getAddAssociationTypeTitle(a?.associationType),n="ready"!==a?.state||this.viewModel.featureFormDisabled;return t?oe(s,{heading:r,key:"add-association-select-feature",...e},oe(j,{key:"select-feature"},oe(U,null,t.render())),oe(E,{buttons:[t.filterOptionsVisible?{appearance:"solid",label:o.apply,disabled:n,onClick:()=>t.applyFilterOptions(),type:"button"}:void 0,{appearance:"outline",label:o.cancel,disabled:n,onClick:()=>{"update"===i.activeWorkflow?.type&&(a?.reset(),i.activeWorkflow.cancelActiveWorkflow())},type:"button"}]})):oe(s,{heading:r,key:"add-association-select-feature",...e})}async _setUpAssociationSettings(){const{viewModel:e}=this,t=this._associationSettings??await this._updatingHandles.addPromise(this._initializeAssociationSettings()),s=e.utilityNetworkAssociationAddAssociationViewModel,i="update"===e.activeWorkflow?.type?e.activeWorkflow:null,o=i?i.activeWorkflow:null,a="add-association"===o?.type?o.sourceFeatureItem:null,r=s?.selectedFeature,n=s?.association,l=s?.utilityNetwork;a&&r&&n&&l&&(t.sourceFeature=a,t.targetFeature=r,t.association=n,t.utilityNetwork=l)}_renderAddAssociation(e){const{_associationSettings:t,EditorPanel:s,viewModel:i,messagesCommon:o}=this;if(!t)return null;const a=i.utilityNetworkAssociationAddAssociationViewModel,r=this._getAddAssociationTypeTitle(a?.associationType),n="ready"!==a?.state;return oe(s,{heading:r,key:"add-association",...e},oe(j,{key:"add-association-content"},oe(U,null,t.render())),oe(E,{buttons:[{label:o.add,disabled:n||!a.canAddAssociation,onClick:()=>this._onSave(),type:"button"},{appearance:"outline",label:o.cancel,disabled:n,onClick:()=>{"update"===i.activeWorkflow?.type&&i.activeWorkflow.cancelActiveWorkflow()},type:"button"}]}))}_renderCustomTemplateGroupContent(e){const{messages:t,viewModel:s}=this,o=i(e.group.items,(e=>s.itemHasInvalidFormTemplate(e)?t.formFieldCreateError:void 0));return o?oe(P,{kind:"warning",message:o}):null}_renderAttachmentAdding(e){const{EditorPanel:t,_attachments:s,messages:i,messagesCommon:o}=this;return oe(t,{heading:i.addAttachment,key:"attachment-adding-panel",...e},oe(j,{key:"attachments"},this._renderAttachments()),oe(E,{buttons:[{label:s.submitting?o.cancel:o.add,disabled:s.submitting||!s.selectedFile,onClick:this._onAttachmentAdd,type:"button"}]}))}_renderSelectionListPage(e){const{_selectionList:t,messages:s,EditorPanel:i}=this,{batchUpdateActions:o}=this.visibleElements;return oe(i,{heading:s.widgetLabel,key:"selection-list-panel",...e},this.visibleElements.selectionToolbar&&"3d"!==this.view?.type?oe("div",{class:y.selectionToolbarContainer},this._renderSelectionToolbar()):void 0,oe(j,{key:"selection-list"},oe(U,null,this._renderSelectionList())),oe(E,{buttons:[o?{label:ne(s.batchEditing.editCount,{count:t.visibleFeatureCount}),disabled:t.visibleLayerCount>1,onClick:()=>this.startUpdateWorkflowWithActiveSelection(),type:"button"}:void 0],notice:o&&t.visibleLayerCount>1?{text:s.batchEditing.selectOneLayer,icon:"information"}:void 0}))}_renderAttachmentEditing(e){const{EditorPanel:t,_attachments:s,activeWorkflow:i,messages:o,messagesCommon:a}=this;return i?oe(t,{heading:o.editAttachment,key:"attachment-editing-panel",...e},oe(j,{key:"attachments"},this._renderAttachments()),i.shouldAllowAttachmentEditing?oe(E,{buttons:[{label:a.update,disabled:s.submitting||!s.selectedFile,onClick:this._onAttachmentUpdate,type:"button"},{...this._deleteButtonCommonInfo,onClick:this._onAttachmentDelete,disabled:s.submitting,label:a.delete,type:"button"}]}):void 0):null}_renderReady(e){const{EditorPanel:t,messages:s,viewModel:i,visibleElements:o}=this,a=this._helpMessage;return oe(t,{heading:s.widgetLabel,key:"landing-panel",...e},oe(j,{key:"landing-content"},i.editorItems.length?[o.editFeaturesSection?oe(U,{key:"edit-actions"},this._renderUpdateActions()):null,o.createFeaturesSection&&i.canCreateVisible?oe(U,{key:"create-actions"},this._renderCreateActions()):null]:oe(V,{key:"no-content"},s.noEditableLayers)),a?oe("div",{class:y.helpMessage,key:"footer-actions",slot:"footer"},a):void 0)}get _helpMessage(){const{activeWorkflow:e,messages:t,view:s}=this,i=e?.helpMessage;return i?t["3d"===s?.type?"helpMessages3d":"helpMessages2d"]?.[i]:void 0}_renderUpdateActions(){const{messages:e,messagesCommon:t,viewModel:s}=this,i={id:"select",label:t.select};return oe("div",{class:y.updateActions,key:"update-actions"},oe(Q,{level:J(this.headingLevel)},e.editFeatures),this.visibleElements.selectionToolbar&&"3d"!==this.view?.type?oe("div",{class:y.selectionToolbarContainer},this._renderSelectionToolbar()):oe("calcite-list",{class:y.updateActionsList,label:e.editFeaturesList,selectionAppearance:"border",selectionMode:"single"},X({disabled:!s.canUpdateVisible,grouped:!1,item:i,selectedItem:"awaiting-feature-to-update"===s.activeWorkflow?.stepId?i:void 0,renderIcon:this._renderSelectIcon,onItemSelect:this._onToggleUpdateWorkflow})))}_renderCreateActions(){return oe("div",{key:"create-actions"},oe(Q,{level:J(this.headingLevel)},this.messages.createFeatures),oe("div",{class:y.featureTemplatesContainer,key:"templates"},this._renderFeatureTemplates()))}_renderFeatureList(e){const{EditorPanel:t,viewModel:s}=this,{activeWorkflow:i}=s;if("update"!==i?.type)return null;const o=i.data.candidates,a=ne(this.messages.multipleFeaturesTemplate,{total:o.length});return oe(t,{heading:a,key:"feature-list",...e},oe(L,{editorItems:s.editorItems,editorMessages:this.messages,filterText:this._filterText,id:this.id,messagesTemplates:this.messagesTemplates,workflow:i,onFilterTextChange:e=>this._filterText=e,onSelectFeature:(e,t)=>s.selectFeature(e,t),onZoomTo:e=>s.zoomTo(e)}))}_showPromptAndWait({title:e,message:t,yesLabel:s,noLabel:i}){const a=o(),{view:r}=this,n=r?.focused;return this._showPrompt({title:e,message:t,context:"danger",actions:{primary:{label:s,action:()=>a.resolve(!0)},secondary:{label:i,action:()=>a.resolve(!1)}}}),a.promise.finally((()=>{this._clearPrompt(),n&&r?.focus()}))}async _onSelectionListItemSelect(e){await this.viewModel.onSelectionListItemSelect(e)}async _onSelectionListMenuItemSelect(e){await this.viewModel.onSelectionListMenuItemSelect(e)}async _setupSketch(){if(!!!this.visibleElements.sketch)return this._sketchImportAbortController=s(this._sketchImportAbortController),this._sketchToolbar=t(this._sketchToolbar),void this.removeHandles(le);if(this._sketchImportAbortController)return;const e=new AbortController;this._sketchImportAbortController=e;const i=await import("./Sketch.js");if(!e.signal.aborted)try{this._sketchToolbar=new i.default({toolbarKind:"docked",contextualToolLocation:"inline-end",scale:"s",visibleElements:new R({deleteButton:!1,settingsMenu:!1,directionModePicker:!1,selectionCountLabel:!1,duplicateButton:!1,createTools:new Z({freehandPolygon:!0,freehandPolyline:!0}),selectionTools:new q({"lasso-selection":!1,"rectangle-selection":!1})})}),this.addHandles([a((()=>this.viewModel.activeLeafWorkflow?.availableCreateTools),(e=>{this._sketchToolbar&&(this._sketchToolbar.availableCreateTools=e)}),l),a((()=>this.visibleElements.undoRedoButtons),(e=>{this._sketchToolbar&&(this._sketchToolbar.visibleElements.undoRedoMenu=e)}),l),n((()=>this.viewModel?.sketchViewModel),(e=>{this._sketchToolbar&&(this._sketchToolbar.viewModel=e)}),l)],le)}finally{this._sketchImportAbortController=null}}get test(){return{sketch:this._sketchToolbar,showPrompt:this._showPromptAndWait.bind(this)}}};e([c()],ce.prototype,"_batchAttributeForm",void 0),e([c()],ce.prototype,"_featureForm",void 0),e([c()],ce.prototype,"_sketchToolbar",void 0),e([c()],ce.prototype,"_attachments",void 0),e([c()],ce.prototype,"_associationItemList",void 0),e([c()],ce.prototype,"_associationSettings",void 0),e([c()],ce.prototype,"_featureTemplates",void 0),e([c()],ce.prototype,"_filterText",void 0),e([c()],ce.prototype,"_prompt",void 0),e([c()],ce.prototype,"_spinner",void 0),e([c()],ce.prototype,"_deleteButtonCommonInfo",null),e([c()],ce.prototype,"_loading",void 0),e([c()],ce.prototype,"_selectionList",void 0),e([c()],ce.prototype,"_selectionListItemActionConfigs",null),e([c()],ce.prototype,"_selectionToolbar",void 0),e([c({readOnly:!0})],ce.prototype,"activeWorkflow",null),e([c()],ce.prototype,"effectiveSelectionManager",null),e([c()],ce.prototype,"headingLevel",void 0),e([c()],ce.prototype,"hideTemplatesForInactiveLayers",null),e([c()],ce.prototype,"icon",null),e([c()],ce.prototype,"label",null),e([c()],ce.prototype,"labelOptions",null),e([c()],ce.prototype,"layerInfos",null),e([c(),se("esri/widgets/Editor/t9n/Editor")],ce.prototype,"messages",void 0),e([c(),se("esri/t9n/common")],ce.prototype,"messagesCommon",void 0),e([c(),se("esri/widgets/FeatureTemplates/t9n/FeatureTemplates")],ce.prototype,"messagesTemplates",void 0),e([c(),se("esri/widgets/Feature/t9n/Feature")],ce.prototype,"messagesFeature",void 0),e([c()],ce.prototype,"snappingOptions",null),e([c()],ce.prototype,"tooltipOptions",null),e([c()],ce.prototype,"supportingWidgetDefaults",void 0),e([c({type:m,nonNullable:!0})],ce.prototype,"valueOptions",null),e([c()],ce.prototype,"view",null),e([c(),ie(["sketch-create","sketch-delete","sketch-update","workflow-cancel","workflow-commit"])],ce.prototype,"viewModel",void 0),e([c({type:A,nonNullable:!0})],ce.prototype,"visibleElements",void 0),e([c()],ce.prototype,"_helpMessage",null),ce=e([d("esri.widgets.Editor")],ce);const de=ce;export{de as default};
5
+ import{_ as e}from"../chunks/tslib.es6.js";import"../intl.js";import{deprecatedFunction as t}from"../core/deprecate.js";import s from"../core/Logger.js";import{destroyMaybe as i,abortMaybe as o,mappedFind as a}from"../core/maybe.js";import{createResolver as r}from"../core/promiseUtils.js";import{watch as n,on as l,when as c,initial as d}from"../core/reactiveUtils.js";import{property as h}from"../core/accessorSupport/decorators/property.js";import"../core/has.js";import"../core/RandomLCG.js";import{subclass as m}from"../core/accessorSupport/decorators/subclass.js";import{UpdatingHandles as p}from"../core/support/UpdatingHandles.js";import u from"../views/interactive/sketch/SketchValueOptions.js";import g from"./Attachments.js";import w from"./BatchAttributeForm.js";import _ from"./FeatureForm.js";import v from"./FeatureTemplates.js";import f from"./Spinner.js";import y from"./Widget.js";import{VisibleElements as b}from"./BatchAttributeForm/VisibleElements.js";import{css as k}from"./Editor/css.js";import A from"./Editor/EditorViewModel.js";import{isModelUpload as F}from"./Editor/modelUploadUtils.js";import M from"./Editor/VisibleElements.js";import{isBatchAttributeFormViewModel as T}from"./Editor/workflowUtils.js";import{loadCreateFeaturesPanelContentComponents as C,CreateFeaturesPanelContent as L}from"./Editor/components/CreateFeaturesPanelContent.js";import{loadFeatureListComponents as S,FeatureList as E}from"./Editor/components/FeatureList.js";import{loadFooterActionsComponents as W,FooterActions as P}from"./Editor/components/FooterActions.js";import{loadNoticesComponents as I,Notice as j}from"./Editor/components/Notices.js";import{loadPanelContentComponents as U,PanelContent as V,PanelContentSection as D,PanelContentMessage as B}from"./Editor/components/PanelContent.js";import{PanelToolbar as O,loadPanelToolbarComponents as x}from"./Editor/components/PanelToolbar.js";import{loadPromptComponents as N,Prompt as z}from"./Editor/components/Prompt.js";import{loadUpdateFeaturePanelContentComponents as H,UpdateFeaturePanelContent as G}from"./Editor/components/UpdateFeaturePanelContent.js";import{loadUploadDetailsComponents as R,UploadDetails as q}from"./Editor/components/UploadDetails.js";import{VisibleElements as Z,SelectionToolVisibilityMap as K,CreateToolVisibilityMap as $}from"./Sketch/VisibleElements.js";import{loadCalciteComponents as J}from"./support/componentsUtils.js";import{globalCss as Q}from"./support/globalCss.js";import{incrementHeadingLevel as X,Heading as Y}from"./support/Heading.js";import{renderItem as ee}from"./support/ItemList.js";import{connectDelayedLoading as te}from"./support/loaderUtils.js";import se from"./support/SelectionList.js";import ie from"./support/SelectionToolbar.js";import"./support/widgetUtils.js";import{messageBundle as oe}from"./support/decorators/messageBundle.js";import{vmEvent as ae}from"./support/decorators/vmEvent.js";import{tsx as re}from"./support/jsxFactory.js";import ne from"./support/SelectionList/VisibleElements.js";import le from"./support/SelectionToolbar/VisibleElements.js";import{substitute as ce}from"../intl/substitute.js";const de=Symbol("sketch-setup-handles");let he=class extends y{constructor(e,t){super(e,t),this._batchAttributeForm=new w({visibleElements:new b({loadingIndicator:!1})}),this._featureForm=new _,this._sketchToolbar=null,this._attachments=new g({visibleElements:{addSubmitButton:!1,cancelAddButton:!1,cancelUpdateButton:!1,deleteButton:!1,errorMessage:!1,progressBar:!1,updateButton:!1}}),this._associationItemList=null,this._associationSettings=null,this._featureTemplates=new v({enableListScroll:!1,renderItemContentEnd:e=>e.supportsUpload?re("calcite-icon",{class:k.templateItemContentEnd,icon:"upload-to",key:"upload-icon"}):null,renderItemLabel:e=>e.label,renderCustomGroupContent:e=>this._renderCustomTemplateGroupContent(e)}),this._filterText="",this._prompt=null,this._spinner=new f,this._loading=!1,this._selectionList=new se({displayMode:"layer",itemActionConfigs:this._selectionListItemActionConfigs,onListItemSelect:({item:e})=>this._onSelectionListItemSelect(e),visibleElements:new ne({header:!1})}),this._selectionToolbar=new ie({persistSelection:!1,returnGeometry:!1,visibleElements:new le({chip:!1})}),this._updatingHandles=new p,this.headingLevel=4,this.messages=null,this.messagesCommon=null,this.messagesTemplates=null,this.messagesFeature=null,this.supportingWidgetDefaults=null,this.viewModel=new A,this.visibleElements=new M,this._renderAttachments=()=>this._attachments.render(),this._renderFeatureForm=()=>this._featureForm.render(),this._renderBatchAttributeForm=()=>this._batchAttributeForm.render(),this._renderFeatureTemplates=()=>this._featureTemplates.render(),this._renderSelectionList=()=>this._selectionList.render(),this._renderSelectionToolbar=()=>this._selectionToolbar.render(),this._renderSketch=()=>this._sketchToolbar?re("div",{class:k.sketchContainer,key:"editor-sketch-container"},this._sketchToolbar?.render()):void 0,this._renderSelectIcon=()=>re("calcite-icon",{icon:"cursor",slot:"content-start"}),this.EditorPanel=({heading:e,key:t,selected:s},...i)=>{const{visibleElements:o}=this;return re("calcite-flow-item",{closable:!1,heading:e,headingLevel:this.headingLevel,key:t,loading:this._loading,selected:s,onCalciteFlowItemBack:this._onBack},o.zoomToButton&&this.viewModel.canZoomTo?re("calcite-action",{alignment:"center",appearance:"transparent",icon:"zoom-to-object",key:"zoom-to-button",onclick:()=>this.viewModel.zoomTo(),slot:"header-actions-end",text:this.messages.zoomTo,title:this.messages.zoomTo}):null,o.settingsMenu?re(O,{editorViewModel:this.viewModel,messagesCommon:this.messagesCommon,visibleElements:o}):null,...i)},this._showDiscardEditsPrompt=()=>{const{messages:e,activeWorkflow:t}=this,s={title:e.cancelEditTitle,message:e.cancelEditWarningMessage,yesLabel:e.discardEdits,noLabel:e.continueEditing};return"create-features"===t?.type&&F(t.data.creationInfo)?this._showPromptAndWait("success"===t.data.upload?.state?e.modelUploads.cancelPlacementPrompt:e.modelUploads.cancelUploadPrompt):"update"===t?.type&&t.activeFeatureFormViewModel?.activeAssociation?this._showPromptAndWait({...s,message:e.cancelAssociationEditWarning}):this._showPromptAndWait(s)},this._showGenericCancelPrompt=()=>{const{messages:e,messagesCommon:t}=this;return this._showPromptAndWait({title:e.cancelRequestTitle,message:e.cancelRequestWarningMessage,yesLabel:t.form.yes,noLabel:t.form.no})},this._showPrompt=e=>{this._prompt?.cancel?.(),this._prompt=e},this._clearPrompt=()=>{this._prompt=null},this._onSave=()=>{this.viewModel.saveWorkflow()},this._onDelete=()=>{const e=this.viewModel.activeFeatureCount,t=e>1?this.messages.multiFeature:this.messages.singleFeature;this._showPrompt({title:t.deleteWarningTitle,message:t.deleteWarningMessage,context:"danger",actions:{primary:{label:ce(t.delete,{count:e}),action:()=>{this.deleteFeatures(),this._clearPrompt()}},secondary:{label:t.keep,action:this._clearPrompt}}})},this._onDeleteAssociation=()=>{const{messages:e,messagesCommon:t}=this;this._showPrompt({title:e.deleteAssociationTitle,message:e.deleteAssociationMessage,context:"danger",actions:{primary:{label:t.delete,action:()=>{this.deleteAssociationFromWorkflow(),this._clearPrompt()}},secondary:{label:e.keepAssociation,action:this._clearPrompt}}})},this._onToggleUpdateWorkflow=()=>this.viewModel.toggleUpdateWorkflow(),this._onBack=e=>(e?.stopPropagation(),this.viewModel.back()),this._onAttachmentAdd=()=>{const{activeWorkflow:e}=this.viewModel;e&&("create-features"===e.type||"update"===e.type&&"create-features"===e.activeWorkflow?.type?(this._attachments.addFile(),e.back()):this._attachments.addAttachment().then((()=>e.back())))},this._onAttachmentUpdate=()=>{const{activeWorkflow:e}=this.viewModel;e&&("create-features"===e.type?(this._attachments.updateFile(),e.back()):this._attachments.updateAttachment().then((()=>e.back())))},this._onAttachmentDelete=()=>{const{messages:e,messagesCommon:t}=this;this._showPrompt({title:e.deleteAttachmentWarningTitle,message:e.deleteAttachmentWarningMessage,context:"danger",actions:{primary:{label:t.delete,action:this._onAttachmentDeleteConfirm},secondary:{label:e.keepAttachment,action:this._clearPrompt}}})},this._onAttachmentDeleteConfirm=async()=>{const e=this._attachments,{activeWorkflow:t}=this.viewModel;t&&("create-features"===t.type?e.deleteFile():(await e.deleteAttachment(e.viewModel.activeAttachmentInfo),this._clearPrompt()),await t.back(),this._clearPrompt())},this._onAttachmentsError=e=>{this._showPrompt({title:this.messages.errorWarningTitle,message:e.message,context:"warning",actions:{primary:{label:this.messagesCommon.form.ok,action:this._clearPrompt}}})}}initialize(){this._featureForm.showPrompt=this._showPrompt,this._featureForm.clearPrompt=this._clearPrompt,this.addHandles([n((()=>X(this.headingLevel)),(e=>{this._featureForm.headingLevel=e,this._featureTemplates.headingLevel=e}),d),l((()=>this.viewModel.activeWorkflow),"cancel-request",(({controller:e})=>{(this.viewModel.hasPendingEdits?this._showDiscardEditsPrompt():this._showGenericCancelPrompt()).then((t=>t?e.allow():e.deny()))})),c((()=>this.viewModel.formViewModel),(e=>{T(e)?this._batchAttributeForm.viewModel=e:this._featureForm.viewModel=e}),d),c((()=>this.viewModel.utilityNetworkAssociationAddAssociationViewModel),(e=>{this._associationItemList?this._associationItemList.viewModel=e:this._updatingHandles.addPromise(this._initializeAssociationItemList(e))}),d),c((()=>this.viewModel.utilityNetworkAssociationAddAssociationViewModel?.association),(()=>{this._setUpAssociationSettings()})),n((()=>[this.viewModel,this.viewModel?.attachmentsViewModel,this.viewModel?.featureTemplatesViewModel,this.viewModel?.spinnerViewModel,this.viewModel?.selectionListViewModel,this.viewModel?.selectionToolbarViewModel]),(([e,t,s,i,o,a])=>{this._attachments.viewModel=t,this._featureTemplates.viewModel=s,this._spinner.viewModel=i,this._selectionList.viewModel=o,this._selectionToolbar.viewModel=a,e.showDiscardEditsPrompt=this._showDiscardEditsPrompt}),d),n((()=>this.view),((e,t)=>{const s=`editor-${this.id}-spinner`;t?.ui.remove(this._spinner,s),e?.ui.add(this._spinner,{key:s,position:"manual"}),this._associationItemList&&(this._associationItemList.view=e)}),d),n((()=>[this.supportingWidgetDefaults,this.viewModel.sketchViewModel]),(([e])=>{e&&(this._featureForm.set(e.featureForm),this._attachments.set(e.attachments),this._featureTemplates.set(e.featureTemplates),this.viewModel.sketchViewModel?.set(e.sketch))}),d),c((()=>this._attachments?.error),(e=>this._onAttachmentsError(e))),c((()=>this._selectionListItemActionConfigs),(()=>{this._selectionList.itemActionConfigs=this._selectionListItemActionConfigs})),c((()=>this.viewModel?.failures),(e=>{const{messages:t}=this,[{error:s,retry:i,cancel:o}]=e;this._showPrompt({title:t.errorWarningTitle,message:ce(t.errorWarningMessageTemplate,{errorMessage:s.message}),context:"warning",actions:{primary:{label:t.retry,action:()=>{i(),this._clearPrompt()}},secondary:{label:t.ignore,action:()=>{o(),this._clearPrompt()}}}})})),n((()=>this.viewModel?.state),(e=>{switch(e){case"awaiting-feature-to-update":case"ready":case"disabled":this._filterText="",this._featureTemplates.filterText=""}})),n((()=>this.viewModel.featureFormDisabled),(e=>this._featureForm.disabled=e)),n((()=>this.visibleElements.sketch),(()=>this._setupSketch()),d),te({getLoading:()=>{const{viewModel:e}=this;return e.syncing||e.updating||this._attachments.submitting||this._updatingHandles.updating},setEffectiveLoading:e=>{this._loading=e}})])}destroy(){this._associationItemList?.destroy(),this._associationSettings?.destroy(),this._selectionList.destroy(),this._selectionToolbar.destroy(),this._attachments.destroy(),this._batchAttributeForm.destroy(),this._featureForm.destroy(),this._featureTemplates.destroy(),this._spinner.destroy(),this._sketchToolbar=i(this._sketchToolbar),this._sketchImportAbortController=o(this._sketchImportAbortController)}loadDependencies(){return Promise.all([J({action:()=>import("@esri/calcite-components/dist/components/calcite-action"),flow:()=>import("@esri/calcite-components/dist/components/calcite-flow"),"flow-item":()=>import("@esri/calcite-components/dist/components/calcite-flow-item"),icon:()=>import("@esri/calcite-components/dist/components/calcite-icon"),list:()=>import("@esri/calcite-components/dist/components/calcite-list")}),C(),S(),W(),I(),U(),x(),N(),H(),R()])}get _deleteButtonCommonInfo(){return{appearance:"outline",kind:"danger"}}get _selectionListItemActionConfigs(){const{messages:e}=this;return[{label:e?.batchEditing?.editThisFeature,icon:"edit-attributes",type:"feature",callback:({item:e})=>this._onSelectionListMenuItemSelect(e)},{label:e?.batchEditing?.editTheseFeatures,icon:"edit-attributes",type:"layer",callback:({item:e})=>this._onSelectionListMenuItemSelect(e)}]}get activeWorkflow(){return this.viewModel.activeWorkflow}get effectiveSelectionManager(){return this.viewModel.effectiveSelectionManager}get hideTemplatesForInactiveLayers(){return this.viewModel.hideTemplatesForInactiveLayers}set hideTemplatesForInactiveLayers(e){this.viewModel.hideTemplatesForInactiveLayers=e}get icon(){return"pencil"}set icon(e){this._overrideIfSome("icon",e)}get label(){return this.messages?.widgetLabel??""}set label(e){this._overrideIfSome("label",e)}get labelOptions(){return this.viewModel.labelOptions}set labelOptions(e){this.viewModel.labelOptions=e}get layerInfos(){return this.viewModel.layerInfos}set layerInfos(e){this.viewModel.layerInfos=e}get snappingOptions(){return this.viewModel.snappingOptions}set snappingOptions(e){this.viewModel.snappingOptions=e}get tooltipOptions(){return this.viewModel.tooltipOptions}set tooltipOptions(e){this.viewModel.tooltipOptions=e}get valueOptions(){return this.viewModel.valueOptions}set valueOptions(e){this.viewModel.valueOptions=e}get view(){return this.viewModel.view}set view(e){this.viewModel.view=e}startCreateFeaturesWorkflowAtFeatureTypeSelection(){return this.viewModel.startCreateFeaturesWorkflowAtFeatureTypeSelection()}startCreateFeaturesWorkflowAtFeatureCreation(e){return this.viewModel.startCreateFeaturesWorkflowAtFeatureCreation(e)}startCreateFeaturesWorkflowAtFeatureEdit(e){return this.viewModel.startCreateFeaturesWorkflowAtFeatureEdit(e)}startUpdateFeaturesWorkflow(e){return this.viewModel.startUpdateFeaturesWorkflow(e)}startUpdateWorkflowAtFeatureSelection(){return this.viewModel.startUpdateWorkflowAtFeatureSelection()}startUpdateWorkflowAtMultipleFeatureSelection(e){return this.viewModel.startUpdateWorkflowAtMultipleFeatureSelection(e)}startUpdateWorkflowAtFeatureEdit(e){return this.viewModel.startUpdateWorkflowAtFeatureEdit(e)}startUpdateWorkflowWithActiveSelection(){return this.viewModel.startUpdateWorkflowWithActiveSelection()}deleteFeatureFromWorkflow(){return t(s.getLogger(this),"Editor.deleteFeatureFromWorkflow is deprecated. Use Editor.deleteFeatures instead.",{version:"4.33",replacement:"Editor.deleteFeatures",warnOnce:!0}),this.deleteFeatures()}async deleteFeatures(){await this.viewModel.deleteFeatures()}deleteAssociationFromWorkflow(){return this.viewModel.deleteAssociationFromWorkflow()}cancelWorkflow(e){return this.viewModel.cancelWorkflow(e)}render(){const{visibleElements:e,viewModel:t}=this,s=this.classes(k.base,Q.widget,Q.panel);if(!t)return re("div",{class:s,key:"empty"});const{pageStack:i}=t,o=i.length-1,a=i.map(((e,t)=>this._renderPage(e,t===o)));return re("div",{class:s,key:"base"},e.flow?re("calcite-flow",{inert:!!this._prompt,key:"flow"},a):a,this._prompt?re(z,{...this._prompt,headingLevel:this.headingLevel}):void 0)}_renderPage(e,t){const s={selected:t};switch(e){case"disabled":break;case"ready":return this._renderReady(s);case"viewing-selection-list":return this._renderSelectionListPage(s);case"awaiting-feature-creation-info":return this._renderAwaitingFeatureCreationInfo(s);case"creating-features-upload-details":return this._renderUploadDetails(s);case"creating-features":return this._renderCreatingFeatures(s);case"editing-existing-feature":case"editing-features":case"editing-attributes":return this._renderUpdateFeature(s);case"awaiting-update-feature-candidate":return this._renderFeatureList(s);case"adding-attachment":return this._renderAttachmentAdding(s);case"editing-attachment":return this._renderAttachmentEditing(s);case"viewing-associated-layers":case"viewing-associated-features":return this._renderViewAssociatedLayers(s);case"add-association-select-layer":case"add-association-select-feature":return this._renderSelectFeature(s);case"add-association-create-association":return this._renderAddAssociation(s)}return re("div",{key:"empty-page"})}_renderAwaitingFeatureCreationInfo(e){const{EditorPanel:t,messages:s}=this;return re(t,{heading:s.selectTemplate,key:"templates-panel",...e},re(V,{key:"feature-templates"},re(D,null,this._renderFeatureTemplates())))}_renderUploadDetails(e){const{EditorPanel:t,activeWorkflow:s,messages:i}=this;if("create-features"!==s?.type)return null;const o=s.data.upload;return o?re(t,{heading:i.createFeatures,key:"upload-details-panel",...e},re(q,{helpMessage:this._helpMessage,messages:i,upload:o})):null}_renderCreatingFeatures(e){const{EditorPanel:t,activeWorkflow:s,messages:i,messagesCommon:o,headingLevel:a,viewModel:r}=this;if(!s)return null;const n="create-features"===s.type&&s.numPendingFeatures>0||"update"===s.type&&"create-features"===s?.activeWorkflow?.type&&s.activeWorkflow?.numPendingFeatures>0;return re(t,{heading:i.createFeatures,key:"create-features-panel",...e},n?re(G,{editorViewModel:r,headingLevel:a,messages:i,messagesCommon:o,renderAttachments:this._renderAttachments,renderBatchAttributeForm:this._renderBatchAttributeForm,renderFeatureForm:this._renderFeatureForm,renderSketchToolbar:this._renderSketch,onDelete:this._onDelete,onDeleteAssociation:this._onDeleteAssociation,onSave:this._onSave}):re(L,{helpMessage:this._helpMessage,renderSketchToolbar:this._renderSketch}))}_renderUpdateFeature(e){const{EditorPanel:t,messages:s,messagesCommon:i,headingLevel:o,viewModel:a}=this,r=a.activeFeatureCount>1?s.multiFeature.editPanelTitle:s.singleFeature.editPanelTitle;return re(t,{heading:r,key:"update-feature-panel",...e},re(G,{editorViewModel:a,headingLevel:o,messages:s,messagesCommon:i,renderAttachments:this._renderAttachments,renderBatchAttributeForm:this._renderBatchAttributeForm,renderFeatureForm:this._renderFeatureForm,onDelete:this._onDelete,onDeleteAssociation:this._onDeleteAssociation,onSave:this._onSave}))}_getAssociationTypeTitle(e){const{messages:t}=this;if(!e)return t.singleFeature.editPanelTitle;if(e.title)return e.title;const{messagesFeature:s}=this;switch(e.type){case"attachment":return s.associationsAttachments;case"connectivity":return s.associationsConnectivity;case"structure":return s.associationsStructure;case"content":return s.associationsContents;case"container":return s.associationsContainer}}_getAddAssociationTypeTitle(e){const{messages:t}=this;if(!e)return t.singleFeature.editPanelTitle;const s=t.associations;switch(e.type){case"attachment":return s.addAttachment;case"connectivity":return s.addConnectivity;case"structure":return s.addStructure;case"content":return s.addContent;case"container":return s.addContainer}}async _initializeAssociationItemList(e){const t=(await import("./FeatureForm/FeatureFormUtilityNetworkAssociations/UtilityNetworkAssociationItemList.js")).default;this._associationItemList=new t({view:this.view,viewModel:e})}async _initializeAssociationSettings(){const e=new(0,(await import("./FeatureForm/FeatureFormUtilityNetworkAssociations/UtilityNetworkAssociationSettings.js")).default);return this._associationSettings=e,e}_renderViewAssociatedLayers(e){const{EditorPanel:t,messages:s,messagesCommon:i,headingLevel:o,viewModel:a}=this,r=a.featureFormViewModel?.activeAssociationInput?.activeAssociationType,n=this._getAssociationTypeTitle(r);return re(t,{heading:n,key:"viewing-associated-layers-panel",...e},re(G,{editorViewModel:a,headingLevel:o,messages:s,messagesCommon:i,renderAttachments:this._renderAttachments,renderBatchAttributeForm:this._renderBatchAttributeForm,renderFeatureForm:this._renderFeatureForm,renderSketchToolbar:this._renderSketch,onDelete:this._onDelete,onDeleteAssociation:this._onDeleteAssociation,onSave:this._onSave}))}_renderSelectFeature(e){const{_associationItemList:t,EditorPanel:s,viewModel:i,messagesCommon:o}=this,a=i.utilityNetworkAssociationAddAssociationViewModel,r=this._getAddAssociationTypeTitle(a?.associationType),n="ready"!==a?.state||this.viewModel.featureFormDisabled;return t?re(s,{heading:r,key:"add-association-select-feature",...e},re(V,{key:"select-feature"},re(D,null,t.render())),re(P,{buttons:[t.filterOptionsVisible?{appearance:"solid",label:o.apply,disabled:n,onClick:()=>t.applyFilterOptions(),type:"button"}:void 0,{appearance:"outline",label:o.cancel,disabled:n,onClick:()=>{"update"===i.activeWorkflow?.type&&(a?.reset(),i.activeWorkflow.cancelActiveWorkflow())},type:"button"}]})):re(s,{heading:r,key:"add-association-select-feature",...e})}async _setUpAssociationSettings(){const{viewModel:e}=this,t=this._associationSettings??await this._updatingHandles.addPromise(this._initializeAssociationSettings()),s=e.utilityNetworkAssociationAddAssociationViewModel,i="update"===e.activeWorkflow?.type?e.activeWorkflow:null,o=i?i.activeWorkflow:null,a="add-association"===o?.type?o.sourceFeatureItem:null,r=s?.selectedFeature,n=s?.association,l=s?.utilityNetwork;a&&r&&n&&l&&(t.sourceFeature=a,t.targetFeature=r,t.association=n,t.utilityNetwork=l)}_renderAddAssociation(e){const{_associationSettings:t,EditorPanel:s,viewModel:i,messagesCommon:o}=this;if(!t)return null;const a=i.utilityNetworkAssociationAddAssociationViewModel,r=this._getAddAssociationTypeTitle(a?.associationType),n="ready"!==a?.state;return re(s,{heading:r,key:"add-association",...e},re(V,{key:"add-association-content"},re(D,null,t.render())),re(P,{buttons:[{label:o.add,disabled:n||!a.canAddAssociation,onClick:()=>this._onSave(),type:"button"},{appearance:"outline",label:o.cancel,disabled:n,onClick:()=>{"update"===i.activeWorkflow?.type&&i.activeWorkflow.cancelActiveWorkflow()},type:"button"}]}))}_renderCustomTemplateGroupContent(e){const{messages:t,viewModel:s}=this,i=a(e.group.items,(e=>s.itemHasInvalidFormTemplate(e)?t.formFieldCreateError:void 0));return i?re(j,{kind:"warning",message:i}):null}_renderAttachmentAdding(e){const{EditorPanel:t,_attachments:s,messages:i,messagesCommon:o}=this;return re(t,{heading:i.addAttachment,key:"attachment-adding-panel",...e},re(V,{key:"attachments"},this._renderAttachments()),re(P,{buttons:[{label:s.submitting?o.cancel:o.add,disabled:s.submitting||!s.selectedFile,onClick:this._onAttachmentAdd,type:"button"}]}))}_renderSelectionListPage(e){const{_selectionList:t,messages:s,EditorPanel:i}=this,{batchUpdateActions:o}=this.visibleElements;return re(i,{heading:s.widgetLabel,key:"selection-list-panel",...e},this.visibleElements.selectionToolbar&&"3d"!==this.view?.type?re("div",{class:k.selectionToolbarContainer},this._renderSelectionToolbar()):void 0,re(V,{key:"selection-list"},re(D,null,this._renderSelectionList())),re(P,{buttons:[o?{label:ce(s.batchEditing.editCount,{count:t.visibleFeatureCount}),disabled:t.visibleLayerCount>1,onClick:()=>this.startUpdateWorkflowWithActiveSelection(),type:"button"}:void 0],notice:o&&t.visibleLayerCount>1?{text:s.batchEditing.selectOneLayer,icon:"information"}:void 0}))}_renderAttachmentEditing(e){const{EditorPanel:t,_attachments:s,activeWorkflow:i,messages:o,messagesCommon:a}=this;return i?re(t,{heading:o.editAttachment,key:"attachment-editing-panel",...e},re(V,{key:"attachments"},this._renderAttachments()),i.shouldAllowAttachmentEditing?re(P,{buttons:[{label:a.update,disabled:s.submitting||!s.selectedFile,onClick:this._onAttachmentUpdate,type:"button"},{...this._deleteButtonCommonInfo,onClick:this._onAttachmentDelete,disabled:s.submitting,label:a.delete,type:"button"}]}):void 0):null}_renderReady(e){const{EditorPanel:t,messages:s,viewModel:i,visibleElements:o}=this,a=this._helpMessage;return re(t,{heading:s.widgetLabel,key:"landing-panel",...e},re(V,{key:"landing-content"},i.editorItems.length?[o.editFeaturesSection?re(D,{key:"edit-actions"},this._renderUpdateActions()):null,o.createFeaturesSection&&i.canCreateVisible?re(D,{key:"create-actions"},this._renderCreateActions()):null]:re(B,{key:"no-content"},s.noEditableLayers)),a?re("div",{class:k.helpMessage,key:"footer-actions",slot:"footer"},a):void 0)}get _helpMessage(){const{activeWorkflow:e,messages:t,view:s}=this,i=e?.helpMessage;return i?t["3d"===s?.type?"helpMessages3d":"helpMessages2d"]?.[i]:void 0}_renderUpdateActions(){const{messages:e,messagesCommon:t,viewModel:s}=this,i={id:"select",label:t.select};return re("div",{class:k.updateActions,key:"update-actions"},re(Y,{level:X(this.headingLevel)},e.editFeatures),this.visibleElements.selectionToolbar&&"3d"!==this.view?.type?re("div",{class:k.selectionToolbarContainer},this._renderSelectionToolbar()):re("calcite-list",{class:k.updateActionsList,label:e.editFeaturesList,selectionAppearance:"border",selectionMode:"single"},ee({disabled:!s.canUpdateVisible,grouped:!1,item:i,selectedItem:"awaiting-feature-to-update"===s.activeWorkflow?.stepId?i:void 0,renderIcon:this._renderSelectIcon,onItemSelect:this._onToggleUpdateWorkflow})))}_renderCreateActions(){return re("div",{key:"create-actions"},re(Y,{level:X(this.headingLevel)},this.messages.createFeatures),re("div",{class:k.featureTemplatesContainer,key:"templates"},this._renderFeatureTemplates()))}_renderFeatureList(e){const{EditorPanel:t,viewModel:s}=this,{activeWorkflow:i}=s;if("update"!==i?.type)return null;const o=i.data.candidates,a=ce(this.messages.multipleFeaturesTemplate,{total:o.length});return re(t,{heading:a,key:"feature-list",...e},re(E,{editorItems:s.editorItems,editorMessages:this.messages,filterText:this._filterText,id:this.id,messagesTemplates:this.messagesTemplates,workflow:i,onFilterTextChange:e=>this._filterText=e,onSelectFeature:(e,t)=>s.selectFeature(e,t),onZoomTo:e=>s.zoomTo(e)}))}_showPromptAndWait({title:e,message:t,yesLabel:s,noLabel:i}){const o=r(),{view:a}=this,n=a?.focused;return this._showPrompt({title:e,message:t,context:"danger",actions:{primary:{label:s,action:()=>o.resolve(!0)},secondary:{label:i,action:()=>o.resolve(!1)}}}),o.promise.finally((()=>{this._clearPrompt(),n&&a?.focus()}))}async _onSelectionListItemSelect(e){await this.viewModel.onSelectionListItemSelect(e)}async _onSelectionListMenuItemSelect(e){await this.viewModel.onSelectionListMenuItemSelect(e)}async _setupSketch(){if(!!!this.visibleElements.sketch)return this._sketchImportAbortController=o(this._sketchImportAbortController),this._sketchToolbar=i(this._sketchToolbar),void this.removeHandles(de);if(this._sketchImportAbortController)return;const e=new AbortController;this._sketchImportAbortController=e;const t=await import("./Sketch.js");if(!e.signal.aborted)try{this._sketchToolbar=new t.default({toolbarKind:"docked",contextualToolLocation:"inline-end",scale:"s",visibleElements:new Z({deleteButton:!1,settingsMenu:!1,directionModePicker:!1,selectionCountLabel:!1,duplicateButton:!1,createTools:new $({freehandPolygon:!0,freehandPolyline:!0}),selectionTools:new K({"lasso-selection":!1,"rectangle-selection":!1})})}),this.addHandles([n((()=>this.viewModel.activeLeafWorkflow?.availableCreateTools),(e=>{this._sketchToolbar&&(this._sketchToolbar.availableCreateTools=e)}),d),n((()=>this.visibleElements.undoRedoButtons),(e=>{this._sketchToolbar&&(this._sketchToolbar.visibleElements.undoRedoMenu=e)}),d),c((()=>this.viewModel?.sketchViewModel),(e=>{this._sketchToolbar&&(this._sketchToolbar.viewModel=e)}),d)],de)}finally{this._sketchImportAbortController=null}}get test(){return{sketch:this._sketchToolbar,showPrompt:this._showPromptAndWait.bind(this)}}};e([h()],he.prototype,"_batchAttributeForm",void 0),e([h()],he.prototype,"_featureForm",void 0),e([h()],he.prototype,"_sketchToolbar",void 0),e([h()],he.prototype,"_attachments",void 0),e([h()],he.prototype,"_associationItemList",void 0),e([h()],he.prototype,"_associationSettings",void 0),e([h()],he.prototype,"_featureTemplates",void 0),e([h()],he.prototype,"_filterText",void 0),e([h()],he.prototype,"_prompt",void 0),e([h()],he.prototype,"_spinner",void 0),e([h()],he.prototype,"_deleteButtonCommonInfo",null),e([h()],he.prototype,"_loading",void 0),e([h()],he.prototype,"_selectionList",void 0),e([h()],he.prototype,"_selectionListItemActionConfigs",null),e([h()],he.prototype,"_selectionToolbar",void 0),e([h({readOnly:!0})],he.prototype,"activeWorkflow",null),e([h()],he.prototype,"effectiveSelectionManager",null),e([h()],he.prototype,"headingLevel",void 0),e([h()],he.prototype,"hideTemplatesForInactiveLayers",null),e([h()],he.prototype,"icon",null),e([h()],he.prototype,"label",null),e([h()],he.prototype,"labelOptions",null),e([h()],he.prototype,"layerInfos",null),e([h(),oe("esri/widgets/Editor/t9n/Editor")],he.prototype,"messages",void 0),e([h(),oe("esri/t9n/common")],he.prototype,"messagesCommon",void 0),e([h(),oe("esri/widgets/FeatureTemplates/t9n/FeatureTemplates")],he.prototype,"messagesTemplates",void 0),e([h(),oe("esri/widgets/Feature/t9n/Feature")],he.prototype,"messagesFeature",void 0),e([h()],he.prototype,"snappingOptions",null),e([h()],he.prototype,"tooltipOptions",null),e([h()],he.prototype,"supportingWidgetDefaults",void 0),e([h({type:u,nonNullable:!0})],he.prototype,"valueOptions",null),e([h()],he.prototype,"view",null),e([h(),ae(["sketch-create","sketch-delete","sketch-update","workflow-cancel","workflow-commit"])],he.prototype,"viewModel",void 0),e([h({type:M,nonNullable:!0})],he.prototype,"visibleElements",void 0),e([h()],he.prototype,"_helpMessage",null),he=e([m("esri.widgets.Editor")],he);const me=he;export{me 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{_ as e}from"../../chunks/tslib.es6.js";import t from"../../core/Logger.js";import{renderingSanitizer as i}from"../../core/sanitizerUtils.js";import{property as n}from"../../core/accessorSupport/decorators/property.js";import"../../core/has.js";import"../../core/RandomLCG.js";import{subclass as o}from"../../core/accessorSupport/decorators/subclass.js";import{convertDateFormatToIntlOptions as l}from"../../intl/date.js";import{convertNumberFormatToIntlOptions as r,formatNumber as a}from"../../intl/number.js";import{isEditableLayer as s}from"../../layers/support/editableLayers.js";import{computeDomainFromTypes as u}from"../../layers/support/featureLayerUtils.js";import p from"../../layers/support/Field.js";import{validateFieldValue as d,isDateField as c,isTimeOnlyField as m,isIntegerField as f,isNumericField as h,isStringField as g,isDateOnlyField as y,isTimestampOffsetField as v}from"../../layers/support/fieldUtils.js";import{isAnyDateField as F}from"../../smartMapping/support/utils.js";import{system as _}from"../../time/constants.js";import{getTimeZoneFormattingOptions as C}from"../../time/timeZoneUtils.js";import b from"../FeatureForm/FieldInput.js";import D from"./Grid/EditorColumn.js";import{isEmptyStringOrWhitespace as x}from"./support/tableUtils.js";import{dateFieldsWithStringFieldValue as I,getLabelForDateFieldValue as E,valueIsInRange as w,dateTimeIsInRange as T,getUnixFieldValueFromDateComponents as V,getISOFieldValueFromDateComponents as L,normalizeTimeOnlyString as O,prepareISOFieldValueForDateComponents as Z,prepareUnixFieldValueForDateComponents as j}from"../support/dateUtils.js";import{setFocus as R}from"../support/widgetUtils.js";const S={cancelEdit:"Escape"},N="esri-column",A={input:`${N}__cell-input`,inputContainer:`${N}__cell__input-container`},U=l("short-date-short-time"),q=l("short-date"),k={useGrouping:!0,maximumFractionDigits:20};let z=class extends D{constructor(e){super(e),this._activeFieldInput=null,this.cellValueFormatFunction=({root:e,rowData:t,value:n})=>{const{formatFunction:o}=this;if(o&&t){const{index:l,item:{attachments:r,feature:a,relatedRecords:s}}=t;return o({attachments:r,column:this,feature:a,field:this.field,index:l,relatedRecords:s,value:i.sanitize(n),virtualIndex:this.getVirtualRowIndex(e)})}if(null===n)return"&nbsp;";const{field:l}=this,s=this._getDomainForFeature(t?.item?.feature);if(s){const e=this._getComputedDomain(n,s);if("date"===l.type&&"range"===s.type)return this._formatDateValueForDisplay(l,e);if(this._isNumericField&&"range"===s.type){const e=this.template?.format,t=e?r(e):k;return a(parseFloat(n),t)}return I.has(l.type)?"range"===s.type?i.sanitize(E(l,e)):i.sanitize(e):e}if("date"===l.type||I.has(l.type))return this._formatDateValueForDisplay(l,n);if(this._isNumericField){const e=this.template?.format,t=e?r(e):k;return a(parseFloat(n),t)}return i.sanitize(n)},this.cellValueValidatorFunction=({oldValue:e,value:i})=>{const{_effectiveRange:n,field:o}=this,{max:l,min:r}=n;if(this.effectiveRequired&&(null==i||""===i))return!1;if(this._isNumericField&&(d(o,i)||!w({max:l,min:r,value:i})))return t.getLogger(this).warn("value-exceeds-valid-range","Field value exceeds valid range. Attempted edit was rejected."),!1;if(this._isAnyDateOrTimeField){const e=o.type;if(!T({type:e,range:n,value:i}))return!1}return e!==i},this.field=null,this.formatFunction=null,this.inputRenderFunction=async({root:e,column:i,rowData:n})=>{if(this.editInfo||!this.effectiveEditable)return;const o=this.getCellValue(n),{field:l}=this;if("big-integer"===l.type&&d(l,o))return void t.getLogger(this).warn("value-exceeds-valid-range","Field value is beyond supported limit. Editing is disabled for this field value.");const r=n?.item.feature;if(!r)return;this._activeFieldInput=this._setUpFieldInput(r,o);const a=document.createElement("div");a.classList.add(A.inputContainer);const s=[],u="coded-value"===this._effectiveDomain?.type;if(this._isAnyDateOrTimeField&&!u){const e=document.createElement("div"),t=this._setUpDateComponents(o),i=this._setUpDateActionBar();t.forEach((t=>e.appendChild(t))),a.appendChild(e),a.appendChild(i),s.push(...t)}else{const e=this.createInputElement({value:o});a.appendChild(e),s.push(e)}this._set("editInfo",{column:i,inputs:s,root:e,rowData:n,oldValue:o}),this.removeCellContent(e),e.appendChild(a),this._syncRowEditingState(e,!0),this.grid?.generateCellPartNames();const p=s[0];await R(p),"selectText"in p&&await p.selectText()},this.layer=null,this.parseInputValueFunction=({inputs:e})=>{const{editInfo:t,field:i,includeTime:n}=this;if(!t||!e.length)return null;const o=e[0];if(this._isAnyDateOrTimeField){if("coded-value"===this._effectiveDomain?.type){if(null==o.value)return null;const e=String(o.value);return c(i)?parseFloat(e):e}const{timeZone:l}=this.effectiveTimeZoneOptions,r=t.oldValue??void 0;switch(i.type){case"date-only":{const e=o.value;return""!==e?e:null}case"time-only":{const e=O(o.value);return""!==e?e:null}case"timestamp-offset":{const t=n?e[1]:void 0,i=e.at(-1);return L({oldValue:r,dateComponent:o,timeComponent:t,timeZoneComponent:i,defaultTimeZone:l})}case"date":{const{max:t,min:i}=this._effectiveRange;return V({oldValue:r,dateComponent:o,timeComponent:e[1],timeZone:l,max:t,min:i})}}return null}const l=o.value,{effectiveRequired:r}=this;return r||null!=l&&""!==l?this._isNumericField?parseFloat(l):this._isStringField?l.trim():l:null},this.sortable=!0,this.store=null,this.template=null,this.view=null}get _effectiveDomain(){const e=this._activeFieldInput?.feature;return e?this._getDomainForFeature(e):null}get _effectiveRange(){return this._activeFieldInput?.range??{max:null,min:null}}get _isAnyDateOrTimeField(){const{field:e}=this;return F(e)||m(e)}get _isIntegerField(){return f(this.field)}get _isNumericField(){return h(this.field)}get _isStringField(){return g(this.field)}get _isSubtypeField(){const{layer:e}=this;if(e?.subtypeField){const{subtypeField:t,fieldsIndex:i}=e;return(i.get(t)?.name??t)===this.fieldName}return!1}get alias(){return this.field?.alias}get defaultValue(){return this.field?.defaultValue}get effectiveDescription(){const{description:e,field:t}=this,n=t.description,o=x(e)?x(n)?null:n:e;return null==o?null:i.sanitize(o)}get effectiveEditable(){const{editable:e,field:t,layer:i,tableEditingEnabled:n}=this;if(!t||!i)return!1;const o=s(i),l=i.effectiveCapabilities??i.capabilities,r=l?.operations?.supportsUpdate;return!!(t.editable&&o&&r&&"oid"!==t.type&&n)&&e}get effectiveLabel(){return i.sanitize(this.label||this.alias||this.fieldName)}get effectiveRequired(){return!this.nullable||this._isSubtypeField||this._activeFieldInput?.required||this.required}get effectiveTimeZoneOptions(){const{layer:e,field:t}=this;if(!e||"date"!==t?.type&&"timestamp-offset"!==t?.type)return{timeZone:void 0,timeZoneName:void 0};const{tableTimeZone:i,timeZone:n,view:o}=this;return C(e.preferredTimeZone||null,!!e.datesInUnknownTimezone,n??i??o?.timeZone??_,l("short-time"),t.type)}get includeTime(){const{field:e,template:t}=this;return"time-only"===e.type||"date-only"!==e.type&&(!t?.input||"includeTime"in t.input&&!1!==t.input.includeTime)}get loadingMessage(){return this.messages?.loading||"..."}get maxLength(){const{field:e,template:t}=this,i=e?.length??-1,n=t?.input&&"maxLength"in t.input?t.input.maxLength:null;return null!=n&&!isNaN(n)&&n>=-1&&(-1===i||n<=i)?n:i}get minLength(){const{template:e,maxLength:t}=this,i=e?.input&&"minLength"in e.input?e.input.minLength:null;return t&&i<=t?i:null}get name(){return this.field?.name}get nullable(){return!1!==this.field.nullable}get shouldShowPrompt(){return this._isSubtypeField}createInputElement({value:e}){const{_effectiveDomain:t,maxLength:i,minLength:n,effectiveRequired:o}=this;let l;if("coded-value"===t?.type)l=this.createCalciteSelect(e,t.codedValues.map((({code:e,name:t})=>({value:e,name:t})))),l.addEventListener("calciteSelectChange",(()=>this.onInputBlur(l)));else if(this._isNumericField){const{_effectiveRange:{max:t,min:i}}=this;l=document.createElement("calcite-input"),l.type="number",this._isIntegerField&&(l.step=1),null!=t&&(l.max=t),null!=i&&(l.min=i),l.status=w({max:t,min:i,value:e})?"idle":"invalid"}else l=document.createElement("calcite-input"),l.addEventListener("calciteInputChange",(()=>this.onInputBlur(l))),i>-1&&(l.maxLength=i),n>0&&(l.minLength=n);return l.classList.add(A.input),l.required=o,l.value=null!=e?e.toString():"",l.onkeydown=e=>{e.key===S.cancelEdit&&this.onInputBlur(l,!0)},l.onblur=()=>this.onInputBlur(l),l}onEditComplete(){const e=this.editInfo?.root;e&&this._syncRowEditingState(e,!1),this._activeFieldInput=null,super.onEditComplete()}_clearActiveEditValues(){this.editInfo?.inputs?.forEach((e=>e.value=""))}_setUpDateActionBar(){const{messagesCommon:e}=this,t=e?.cancel??"",i=e?.clear??"",n=e?.save??"",o=document.createElement("calcite-action-bar");return o.expandDisabled=!0,o.layout="horizontal",o.appendChild(this.createCalciteAction({text:n,icon:"save",onclick:()=>this.submit()})),this.effectiveRequired||o.appendChild(this.createCalciteAction({text:i,icon:"trash",onclick:()=>{this._clearActiveEditValues(),this.submit()}})),o.appendChild(this.createCalciteAction({text:t,icon:"x",onclick:()=>this.cancel()})),o}_formatDateValueForDisplay(e,t){const{timeZone:i,timeZoneName:n}=this.effectiveTimeZoneOptions;return null!=t?E(e,t,{...this._getDateFormatOptions(),timeZone:i,timeZoneName:n}):null}_setUpDateComponents(e){const{_effectiveRange:{max:t,min:i,rawMax:n,rawMin:o},field:l,effectiveRequired:r}=this,a=this._getDateFieldValuesForComponents(l,e),s=[];if(F(l)){const e=this.createDateComponent(),u=y(l)||v(l)?n:t,p=y(l)||v(l)?o:i,d=this._getDateFieldValuesForComponents(l,u??null),c=this._getDateFieldValuesForComponents(l,p??null);e.value=a.date??"",e.max=d.date??"",e.min=c.date??"",e.required=r,e.addEventListener("calciteInputDatePickerOpen",(()=>this._onDateComponentOpen(e))),s.push(e)}if(this.includeTime){const e=this.createTimeComponent();e.value=a.time??"",e.required=r,e.addEventListener("calciteInputTimePickerOpen",(()=>this._onDateComponentOpen(e))),s.push(e)}if("timestamp-offset"===l.type){const e=this.createTimeZoneComponent();e.value=a.timeZoneOffset??"0",e.addEventListener("calciteInputTimeZoneOpen",(()=>this._onDateComponentOpen(e))),s.push(e)}return s}_onDateComponentOpen(e){this.editInfo?.inputs.forEach((t=>{t!==e&&"open"in t&&(t.open=!1)}))}_syncRowEditingState(e,t=!1){const i=this.grid?.getRowContainingNode(e);i&&(t?i.setAttribute("editing","true"):i.removeAttribute("editing"))}_getDateFieldValuesForComponents(e,t){switch(e.type){case"date":return j(t,this.effectiveTimeZoneOptions.timeZone);case"date-only":return{date:t};case"time-only":return{time:t};case"timestamp-offset":return Z(t);default:return{}}}_setUpFieldInput(e,t){const{field:i,layer:n,effectiveTimeZoneOptions:{timeZone:o}}=this,l=new b({feature:e,field:i,initialFeature:e.clone(),layer:n,timeZone:o});return l.set("value",t),l}_isDomainCompatible(e){if(!e)return!1;const{_isNumericField:t,_isStringField:i}=this,{type:n}=e;if("coded-value"===n){const n=typeof e.codedValues[0].code;if("string"===n&&i||"number"===n&&t)return!0}return!("range"!==n||!t)}_getDomainForFeature(e){const{fieldName:t,layer:i,template:n}=this;if(!e||!i?.getFieldDomain)return null;if("wfs"===i.type||"geojson"===i.type||"csv"===i.type||"knowledge-graph-sublayer"===i.type)return null;if(n?.domain&&this._isDomainCompatible(n.domain))return n.domain;if("feature"!==i.type&&"subtype-group"!==i.type&&null==i.getField(t)?.domain){const e=u(i,t);if(e)return e}return i.getFieldDomain(t,{feature:e})}_getComputedDomain(e,t){if(!t)return null;if("range"===t.type)return e;if("coded-value"===t.type){const i=t.codedValues.filter((t=>t.hasOwnProperty("code")&&t.code===e));return i&&i.length?i[0].name:e}return null}_getDateFormatOptions(){const{template:e}=this,t=e?.format?.dateFormat;return t?l(t):e?.input&&"includeTime"in e.input&&!1===e.input.includeTime?q:U}};e([n()],z.prototype,"_effectiveDomain",null),e([n()],z.prototype,"_activeFieldInput",void 0),e([n()],z.prototype,"_effectiveRange",null),e([n()],z.prototype,"_isAnyDateOrTimeField",null),e([n()],z.prototype,"_isIntegerField",null),e([n()],z.prototype,"_isNumericField",null),e([n()],z.prototype,"_isStringField",null),e([n()],z.prototype,"_isSubtypeField",null),e([n({readOnly:!0})],z.prototype,"alias",null),e([n()],z.prototype,"cellValueFormatFunction",void 0),e([n()],z.prototype,"cellValueValidatorFunction",void 0),e([n({readOnly:!0})],z.prototype,"defaultValue",null),e([n()],z.prototype,"effectiveDescription",null),e([n()],z.prototype,"effectiveEditable",null),e([n()],z.prototype,"effectiveLabel",null),e([n()],z.prototype,"effectiveRequired",null),e([n()],z.prototype,"effectiveTimeZoneOptions",null),e([n({type:p})],z.prototype,"field",void 0),e([n()],z.prototype,"formatFunction",void 0),e([n()],z.prototype,"includeTime",null),e([n()],z.prototype,"inputRenderFunction",void 0),e([n()],z.prototype,"layer",void 0),e([n({readOnly:!0})],z.prototype,"loadingMessage",null),e([n()],z.prototype,"maxLength",null),e([n()],z.prototype,"minLength",null),e([n({readOnly:!0})],z.prototype,"name",null),e([n({readOnly:!0})],z.prototype,"nullable",null),e([n()],z.prototype,"parseInputValueFunction",void 0),e([n()],z.prototype,"shouldShowPrompt",null),e([n()],z.prototype,"sortable",void 0),e([n()],z.prototype,"store",void 0),e([n()],z.prototype,"template",void 0),e([n()],z.prototype,"view",void 0),z=e([o("esri.widgets.FeatureTable.FieldColumn")],z);const B=z;export{B as default};
5
+ import{_ as e}from"../../chunks/tslib.es6.js";import t from"../../core/Logger.js";import{on as i,sync as n}from"../../core/reactiveUtils.js";import{renderingSanitizer as o}from"../../core/sanitizerUtils.js";import{property as l}from"../../core/accessorSupport/decorators/property.js";import"../../core/has.js";import"../../core/RandomLCG.js";import{subclass as r}from"../../core/accessorSupport/decorators/subclass.js";import{convertDateFormatToIntlOptions as s}from"../../intl/date.js";import{convertNumberFormatToIntlOptions as a,formatNumber as u}from"../../intl/number.js";import{isEditableLayer as p}from"../../layers/support/editableLayers.js";import{computeDomainFromTypes as d}from"../../layers/support/featureLayerUtils.js";import c from"../../layers/support/Field.js";import{validateFieldValue as m,isDateField as f,isTimeOnlyField as h,isIntegerField as g,isNumericField as y,isStringField as v,isDateOnlyField as F,isTimestampOffsetField as _}from"../../layers/support/fieldUtils.js";import{isAnyDateField as C}from"../../smartMapping/support/utils.js";import{system as b}from"../../time/constants.js";import{getTimeZoneFormattingOptions as D}from"../../time/timeZoneUtils.js";import I from"../FeatureForm/FieldInput.js";import x from"./Grid/EditorColumn.js";import{isEmptyStringOrWhitespace as w}from"./support/tableUtils.js";import{dateFieldsWithStringFieldValue as T,getLabelForDateFieldValue as V,valueIsInRange as E,dateTimeIsInRange as O,getUnixFieldValueFromDateComponents as Z,getISOFieldValueFromDateComponents as j,normalizeTimeOnlyString as L,prepareISOFieldValueForDateComponents as R,prepareUnixFieldValueForDateComponents as S}from"../support/dateUtils.js";import{setFocus as N}from"../support/widgetUtils.js";const U={cancelEdit:"Escape"},A=Symbol(),q="esri-column",k={input:`${q}__cell-input`,inputContainer:`${q}__cell__input-container`},z=s("short-date-short-time"),B=s("short-date"),H={useGrouping:!0,maximumFractionDigits:20};let P=class extends x{constructor(e){super(e),this._activeFieldInput=null,this.cellValueFormatFunction=({root:e,rowData:t,value:i})=>{const{formatFunction:n}=this;if(n&&t){const{index:l,item:{attachments:r,feature:s,relatedRecords:a}}=t;return n({attachments:r,column:this,feature:s,field:this.field,index:l,relatedRecords:a,value:o.sanitize(i),virtualIndex:this.getVirtualRowIndex(e)})}if(null===i)return"&nbsp;";const{field:l}=this,r=this._getDomainForFeature(t?.item?.feature);if(r){const e=this._getComputedDomain(i,r);if("date"===l.type&&"range"===r.type)return this._formatDateValueForDisplay(l,e);if(this._isNumericField&&"range"===r.type){const e=this.template?.format,t=e?a(e):H;return u(parseFloat(i),t)}return T.has(l.type)?"range"===r.type?o.sanitize(V(l,e)):o.sanitize(e):e}if("date"===l.type||T.has(l.type))return this._formatDateValueForDisplay(l,i);if(this._isNumericField){const e=this.template?.format,t=e?a(e):H;return u(parseFloat(i),t)}return o.sanitize(i)},this.cellValueValidatorFunction=({oldValue:e,value:i})=>{const{_effectiveRange:n,field:o}=this,{max:l,min:r}=n;if(this.effectiveRequired&&(null==i||""===i))return!1;if(this._isNumericField&&(m(o,i)||!E({max:l,min:r,value:i})))return t.getLogger(this).warn("value-exceeds-valid-range","Field value exceeds valid range. Attempted edit was rejected."),!1;if(this._isAnyDateOrTimeField){const e=o.type;if(!O({type:e,range:n,value:i}))return!1}return e!==i},this.field=null,this.formatFunction=null,this.inputRenderFunction=async({root:e,column:i,rowData:n})=>{if(this.editInfo||!this.effectiveEditable)return;const o=this.getCellValue(n),{field:l}=this;if("big-integer"===l.type&&m(l,o))return void t.getLogger(this).warn("value-exceeds-valid-range","Field value is beyond supported limit. Editing is disabled for this field value.");const r=n?.item.feature;if(!r)return;this._activeFieldInput=this._setUpFieldInput(r,o);const s=document.createElement("div");s.classList.add(k.inputContainer);const a=[],u="coded-value"===this._effectiveDomain?.type;if(this._isAnyDateOrTimeField&&!u){const e=document.createElement("div"),t=this._setUpDateComponents(o),i=this._setUpDateActionBar();t.forEach((t=>e.appendChild(t))),s.appendChild(e),s.appendChild(i),a.push(...t)}else{const e=this.createInputElement({value:o});s.appendChild(e),a.push(e)}this._set("editInfo",{column:i,inputs:a,root:e,rowData:n,oldValue:o}),this.removeCellContent(e),e.appendChild(s),this._syncRowEditingState(e,!0),this.grid?.generateCellPartNames();const p=a[0];await N(p),"selectText"in p&&await p.selectText()},this.layer=null,this.parseInputValueFunction=({inputs:e})=>{const{editInfo:t,field:i,includeTime:n}=this;if(!t||!e.length)return null;const o=e[0];if(this._isAnyDateOrTimeField){if("coded-value"===this._effectiveDomain?.type){if(null==o.value||""===o.value)return null;const e=String(o.value);return f(i)?parseFloat(e):e}const{timeZone:l}=this.effectiveTimeZoneOptions,r=t.oldValue??void 0;switch(i.type){case"date-only":{const e=o.value;return""!==e?e:null}case"time-only":{const e=L(o.value);return""!==e?e:null}case"timestamp-offset":{const t=n?e[1]:void 0,i=e.at(-1);return j({oldValue:r,dateComponent:o,timeComponent:t,timeZoneComponent:i,defaultTimeZone:l})}case"date":{const{max:t,min:i}=this._effectiveRange;return Z({oldValue:r,dateComponent:o,timeComponent:e[1],timeZone:l,max:t,min:i})}}return null}const l=o.value,{effectiveRequired:r}=this;return r||null!=l&&""!==l?this._isNumericField?parseFloat(l):this._isStringField?l.trim():l:null},this.sortable=!0,this.store=null,this.template=null,this.view=null}get _effectiveDomain(){const e=this._activeFieldInput?.feature;return e?this._getDomainForFeature(e):null}get _effectiveRange(){return this._activeFieldInput?.range??{max:null,min:null}}get _isAnyDateOrTimeField(){const{field:e}=this;return C(e)||h(e)}get _isIntegerField(){return g(this.field)}get _isNumericField(){return y(this.field)}get _isStringField(){return v(this.field)}get _isSubtypeField(){const{layer:e}=this;if(e?.subtypeField){const{subtypeField:t,fieldsIndex:i}=e;return(i.get(t)?.name??t)===this.fieldName}return!1}get alias(){return this.field?.alias}get defaultValue(){return this.field?.defaultValue}get effectiveDescription(){const{description:e,field:t}=this,i=t.description,n=w(e)?w(i)?null:i:e;return null==n?null:o.sanitize(n)}get effectiveEditable(){const{editable:e,field:t,layer:i,tableEditingEnabled:n}=this;if(!t||!i)return!1;const o=p(i),l=i.effectiveCapabilities??i.capabilities,r=l?.operations?.supportsUpdate;return!!(t.editable&&o&&r&&"oid"!==t.type&&n)&&e}get effectiveLabel(){return o.sanitize(this.label||this.alias||this.fieldName)}get effectiveRequired(){return!this.nullable||this._isSubtypeField||this._activeFieldInput?.required||this.required}get effectiveTimeZoneOptions(){const{layer:e,field:t}=this;if(!e||"date"!==t?.type&&"timestamp-offset"!==t?.type)return{timeZone:void 0,timeZoneName:void 0};const{tableTimeZone:i,timeZone:n,view:o}=this;return D(e.preferredTimeZone||null,!!e.datesInUnknownTimezone,n??i??o?.timeZone??b,s("short-time"),t.type)}get includeTime(){const{field:e,template:t}=this;return"time-only"===e.type||"date-only"!==e.type&&(!t?.input||"includeTime"in t.input&&!1!==t.input.includeTime)}get loadingMessage(){return this.messages?.loading||"..."}get maxLength(){const{field:e,template:t}=this,i=e?.length??-1,n=t?.input&&"maxLength"in t.input?t.input.maxLength:null;return null!=n&&!isNaN(n)&&n>=-1&&(-1===i||n<=i)?n:i}get minLength(){const{template:e,maxLength:t}=this,i=e?.input&&"minLength"in e.input?e.input.minLength:null;return t&&i<=t?i:null}get name(){return this.field?.name}get nullable(){return!1!==this.field.nullable}get shouldShowPrompt(){return this._isSubtypeField}createInputElement({value:e}){const{_effectiveDomain:t,maxLength:o,minLength:l,effectiveRequired:r}=this;let s;if("coded-value"===t?.type)s=this.createCalciteSelect(e,t.codedValues.map((({code:e,name:t})=>({value:e,name:t})))),this.addHandles([i((()=>s),"calciteSelectChange",(()=>this.onInputBlur()),n)],A);else if(this._isNumericField){const{_effectiveRange:{max:t,min:i}}=this;s=document.createElement("calcite-input"),s.type="number",this._isIntegerField&&(s.step=1),null!=t&&(s.max=t),null!=i&&(s.min=i),s.status=E({max:t,min:i,value:e})?"idle":"invalid"}else s=document.createElement("calcite-input"),this.addHandles([i((()=>s),"calciteInputChange",(()=>this.onInputBlur()),n)],A),o>-1&&(s.maxLength=o),l>0&&(s.minLength=l);return s.classList.add(k.input),s.required=r,s.value=null!=e?e.toString():"",this.addHandles([i((()=>s),"keydown",(e=>{e.key===U.cancelEdit&&this.onInputBlur(!0)}),n),i((()=>s),"blur",(()=>this.onInputBlur()),n)],A),s}onInputBlur(e=!1){this.removeHandles(A),super.onInputBlur(e)}onEditComplete(){const e=this.editInfo?.root;e&&this._syncRowEditingState(e,!1),this._activeFieldInput=null,super.onEditComplete()}_clearActiveEditValues(){this.editInfo?.inputs?.forEach((e=>e.value=""))}_setUpDateActionBar(){const{messagesCommon:e}=this,t=e?.cancel??"",i=e?.clear??"",n=e?.save??"",o=document.createElement("calcite-action-bar");return o.expandDisabled=!0,o.layout="horizontal",o.appendChild(this.createCalciteAction({text:n,icon:"save",onclick:()=>this.submit()})),this.effectiveRequired||o.appendChild(this.createCalciteAction({text:i,icon:"trash",onclick:()=>{this._clearActiveEditValues(),this.submit()}})),o.appendChild(this.createCalciteAction({text:t,icon:"x",onclick:()=>this.cancel()})),o}_formatDateValueForDisplay(e,t){const{timeZone:i,timeZoneName:n}=this.effectiveTimeZoneOptions;return null!=t?V(e,t,{...this._getDateFormatOptions(),timeZone:i,timeZoneName:n}):null}_setUpDateComponents(e){const{_effectiveRange:{max:t,min:n,rawMax:o,rawMin:l},field:r,effectiveRequired:s}=this,a=this._getDateFieldValuesForComponents(r,e),u=[];if(C(r)){const e=this.createDateComponent(),p=F(r)||_(r)?o:t,d=F(r)||_(r)?l:n,c=this._getDateFieldValuesForComponents(r,p??null),m=this._getDateFieldValuesForComponents(r,d??null);e.value=a.date??"",e.max=c.date??"",e.min=m.date??"",e.required=s,this.addHandles([i((()=>e),"calciteInputDatePickerOpen",(()=>this._onDateComponentOpen(e)))],A),u.push(e)}if(this.includeTime){const e=this.createTimeComponent();e.value=a.time??"",e.required=s,this.addHandles([i((()=>e),"calciteInputTimePickerOpen",(()=>this._onDateComponentOpen(e)))],A),u.push(e)}if("timestamp-offset"===r.type){const e=this.createTimeZoneComponent();e.value=a.timeZoneOffset??"0",this.addHandles([i((()=>e),"calciteInputTimeZoneOpen",(()=>this._onDateComponentOpen(e)))],A),u.push(e)}return u}_onDateComponentOpen(e){this.editInfo?.inputs.forEach((t=>{t!==e&&"open"in t&&(t.open=!1)}))}_syncRowEditingState(e,t=!1){const i=this.grid?.getRowContainingNode(e);i&&(t?i.setAttribute("editing","true"):i.removeAttribute("editing"))}_getDateFieldValuesForComponents(e,t){switch(e.type){case"date":return S(t,this.effectiveTimeZoneOptions.timeZone);case"date-only":return{date:t};case"time-only":return{time:t};case"timestamp-offset":return R(t);default:return{}}}_setUpFieldInput(e,t){const{field:i,layer:n,effectiveTimeZoneOptions:{timeZone:o}}=this,l=new I({feature:e,field:i,initialFeature:e.clone(),layer:n,timeZone:o});return l.set("value",t),l}_isDomainCompatible(e){if(!e)return!1;const{_isNumericField:t,_isStringField:i}=this,{type:n}=e;if("coded-value"===n){const n=typeof e.codedValues[0].code;if("string"===n&&i||"number"===n&&t)return!0}return!("range"!==n||!t)}_getDomainForFeature(e){const{fieldName:t,layer:i,template:n}=this;if(!e||!i?.getFieldDomain)return null;if("wfs"===i.type||"geojson"===i.type||"csv"===i.type||"knowledge-graph-sublayer"===i.type)return null;if(n?.domain&&this._isDomainCompatible(n.domain))return n.domain;if("feature"!==i.type&&"subtype-group"!==i.type&&null==i.getField(t)?.domain){const e=d(i,t);if(e)return e}return i.getFieldDomain(t,{feature:e})}_getComputedDomain(e,t){if(!t)return null;if("range"===t.type)return e;if("coded-value"===t.type){const i=t.codedValues.filter((t=>t.hasOwnProperty("code")&&t.code===e));return i&&i.length?i[0].name:e}return null}_getDateFormatOptions(){const{template:e}=this,t=e?.format?.dateFormat;return t?s(t):e?.input&&"includeTime"in e.input&&!1===e.input.includeTime?B:z}};e([l()],P.prototype,"_effectiveDomain",null),e([l()],P.prototype,"_activeFieldInput",void 0),e([l()],P.prototype,"_effectiveRange",null),e([l()],P.prototype,"_isAnyDateOrTimeField",null),e([l()],P.prototype,"_isIntegerField",null),e([l()],P.prototype,"_isNumericField",null),e([l()],P.prototype,"_isStringField",null),e([l()],P.prototype,"_isSubtypeField",null),e([l({readOnly:!0})],P.prototype,"alias",null),e([l()],P.prototype,"cellValueFormatFunction",void 0),e([l()],P.prototype,"cellValueValidatorFunction",void 0),e([l({readOnly:!0})],P.prototype,"defaultValue",null),e([l()],P.prototype,"effectiveDescription",null),e([l()],P.prototype,"effectiveEditable",null),e([l()],P.prototype,"effectiveLabel",null),e([l()],P.prototype,"effectiveRequired",null),e([l()],P.prototype,"effectiveTimeZoneOptions",null),e([l({type:c})],P.prototype,"field",void 0),e([l()],P.prototype,"formatFunction",void 0),e([l()],P.prototype,"includeTime",null),e([l()],P.prototype,"inputRenderFunction",void 0),e([l()],P.prototype,"layer",void 0),e([l({readOnly:!0})],P.prototype,"loadingMessage",null),e([l()],P.prototype,"maxLength",null),e([l()],P.prototype,"minLength",null),e([l({readOnly:!0})],P.prototype,"name",null),e([l({readOnly:!0})],P.prototype,"nullable",null),e([l()],P.prototype,"parseInputValueFunction",void 0),e([l()],P.prototype,"shouldShowPrompt",null),e([l()],P.prototype,"sortable",void 0),e([l()],P.prototype,"store",void 0),e([l()],P.prototype,"template",void 0),e([l()],P.prototype,"view",void 0),P=e([r("esri.widgets.FeatureTable.FieldColumn")],P);const M=P;export{M 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{_ as t}from"../../../chunks/tslib.es6.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 n}from"../../../core/accessorSupport/decorators/subclass.js";import o from"./Column.js";import{autoLink as i}from"../../support/uriUtils.js";const l={showInput:"Enter",hideInput:"Escape"};let r=class extends o{constructor(t){super(t),this.editInfo=null,this.cellValueValidatorFunction=({oldValue:t,value:e})=>t!==e,this.editable=!0,this.headerRenderFunction=t=>{const{root:e}=t,n=this.createHeaderContent();this.tableEditingEnabled&&!this.effectiveEditable&&n.prepend(this._lockIconNode),this.removeCellContent(e),e.appendChild(n)},this.inputRenderFunction=({root:t,column:e,rowData:n})=>{if(this.editInfo||!this.effectiveEditable||!n)return;const o=this.getCellValue(n),i=this.createInputElement({value:o});this._set("editInfo",{column:e,inputs:[i],root:t,rowData:n,oldValue:o});const l=document.createElement("div");l.appendChild(i),this.removeCellContent(t),t.appendChild(l),i.focus(),i instanceof HTMLInputElement&&i.select()},this.loadingMessage="",this.inputType="text",this.maxLength=null,this.onShowPromptCallback=()=>{},this.parseInputValueFunction=({inputs:t})=>t?.length||1!==t.length||Array.isArray(t[0].value)?null:t[0].value,this.renderFunction=t=>{const{root:e,rowData:n}=t,{editInfo:o}=this;if(o)return;const r=this.getCellValue(n),s=this.cellValueFormatFunction({root:e,rowData:n,value:r});let a=null;e.onclick=()=>e.focus(),e.ondblclick=()=>this.inputRenderFunction(t),e.ontouchend=()=>this.inputRenderFunction(t);const c=this.grid?.getSlotElementByName(e.slot),u=c?.parentElement;u&&!u.onkeydown&&(u.onkeydown=e=>{e.key!==l.showInput||this.editInfo||this.inputRenderFunction(t),e.key===l.hideInput&&this.editInfo&&this.cancel()}),null!=r&&null!=s?e.title=s.toString():e.title&&e.removeAttribute("title"),a=s instanceof HTMLElement?s:i(this.messagesURIUtils,s),this.removeCellContent(e),a instanceof HTMLElement?e.appendChild(a):null!=a&&(e.innerHTML=a.toString())},this.required=!1,this.tableEditingEnabled=!1}get _lockIconNode(){return this.createCalciteIcon({icon:"lock",textLabel:this.messages?.editingPreventedColumn})}get effectiveEditable(){return this.tableEditingEnabled&&this.editable}get effectiveRequired(){return this.required}get editing(){return!!this.editInfo}get shouldShowPrompt(){return!1}cancel(){const{editInfo:t}=this;if(!t)return;const{column:e,root:n,rowData:o}=t;this.onEditComplete(),this.renderFunction({column:e,root:n,rowData:o})}createCalciteOption(t,e,n=!1){const o=document.createElement("calcite-option");return o.label=t,o.value=`${e}`,o.selected=n,o}createCalciteSelect(t,e){const{effectiveRequired:n,messages:o}=this;let i=!1;const l=e.map((({name:e,value:n})=>{const o=n===t;return o&&(i=!0),this.createCalciteOption(e,n,o)}));if(null!=t&&""!==t&&!i){const e=t.toString(),n=this.createCalciteOption(e,e);l.unshift(n)}n||l.unshift(this.createCalciteOption(`<${o?.noValue}>`,""));const r=document.createElement("calcite-select");return l.forEach((t=>r.appendChild(t))),r}createInputElement({value:t}){const{effectiveRequired:e,maxLength:n}=this,o=document.createElement("calcite-input");return null!=n&&(o.maxLength=n),o.required=e,o.value=t,o.addEventListener("calciteInputChange",(()=>this.onInputBlur(o))),o.onkeydown=t=>{t.key===l.hideInput&&this.onInputBlur(o,!0)},o.onblur=()=>this.onInputBlur(o),o}createDateComponent(){const t=document.createElement("calcite-input-date-picker");return t.focusTrapDisabled=!0,t.overlayPositioning="fixed",t}createTimeComponent(){const t=document.createElement("calcite-input-time-picker");return t.overlayPositioning="fixed",t.placement="auto-start",t.step=1,t}createTimeZoneComponent(){const t=document.createElement("calcite-input-time-zone");return t.maxItems=4,t.overlayPositioning="fixed",t}onEditComplete(){this._set("editInfo",null),this.grid?.generateCellPartNames()}onInputBlur(t,e=!1){t.onblur=null,e?this.cancel():this.submit()}async submit(){const{editInfo:t}=this;if(!t)return void this.cancel();const{inputs:e,rowData:n,oldValue:o}=t,i=this.parseInputValueFunction({inputs:e});if(!this.cellValueValidatorFunction({value:i,oldValue:o}))return void this.cancel();const{root:l}=t,r=n.item.objectId,{fieldName:s}=this;l.textContent=this.loadingMessage,this.shouldShowPrompt?this.onShowPromptCallback({column:this,objectId:r,oldValue:o,value:i}):await this.updateItems({objectId:r,updates:[{fieldName:s,value:i}]})}async updateItems(t){const{store:e}=this;if(e)try{await e.updateItem(t),this.onEditComplete()}catch{this.cancel()}else this.cancel()}};t([e()],r.prototype,"_lockIconNode",null),t([e({readOnly:!0})],r.prototype,"editInfo",void 0),t([e()],r.prototype,"cellValueValidatorFunction",void 0),t([e()],r.prototype,"editable",void 0),t([e()],r.prototype,"effectiveEditable",null),t([e()],r.prototype,"effectiveRequired",null),t([e()],r.prototype,"editing",null),t([e()],r.prototype,"headerRenderFunction",void 0),t([e()],r.prototype,"inputRenderFunction",void 0),t([e({constructOnly:!0})],r.prototype,"loadingMessage",void 0),t([e()],r.prototype,"inputType",void 0),t([e()],r.prototype,"maxLength",void 0),t([e()],r.prototype,"onShowPromptCallback",void 0),t([e()],r.prototype,"parseInputValueFunction",void 0),t([e()],r.prototype,"renderFunction",void 0),t([e()],r.prototype,"required",void 0),t([e()],r.prototype,"shouldShowPrompt",null),t([e()],r.prototype,"tableEditingEnabled",void 0),r=t([n("esri.widgets.FeatureTable.Grid.EditorColumn")],r);const s=r;export{s as default};
5
+ import{_ as t}from"../../../chunks/tslib.es6.js";import{on as e,sync as n}from"../../../core/reactiveUtils.js";import{property as o}from"../../../core/accessorSupport/decorators/property.js";import"../../../core/has.js";import"../../../core/Logger.js";import"../../../core/RandomLCG.js";import{subclass as i}from"../../../core/accessorSupport/decorators/subclass.js";import l from"./Column.js";import{autoLink as r}from"../../support/uriUtils.js";const s={showInput:"Enter",cancelEdit:"Escape"},a=Symbol();let c=class extends l{constructor(t){super(t),this.editInfo=null,this.cellValueValidatorFunction=({oldValue:t,value:e})=>t!==e,this.editable=!0,this.headerRenderFunction=t=>{const{root:e}=t,n=this.createHeaderContent();this.tableEditingEnabled&&!this.effectiveEditable&&n.prepend(this._lockIconNode),this.removeCellContent(e),e.appendChild(n)},this.inputRenderFunction=({root:t,column:e,rowData:n})=>{if(this.editInfo||!this.effectiveEditable||!n)return;const o=this.getCellValue(n),i=this.createInputElement({value:o});this._set("editInfo",{column:e,inputs:[i],root:t,rowData:n,oldValue:o});const l=document.createElement("div");l.appendChild(i),this.removeCellContent(t),t.appendChild(l),i.focus(),i instanceof HTMLInputElement&&i.select()},this.loadingMessage="",this.inputType="text",this.maxLength=null,this.onShowPromptCallback=()=>{},this.parseInputValueFunction=({inputs:t})=>t?.length||1!==t.length||Array.isArray(t[0].value)?null:t[0].value,this.renderFunction=t=>{const{root:e,rowData:n}=t,{editInfo:o}=this;if(o)return;const i=this.getCellValue(n),l=this.cellValueFormatFunction({root:e,rowData:n,value:i});let a=null;e.onclick=()=>e.focus(),e.ondblclick=()=>this.inputRenderFunction(t),e.ontouchend=()=>this.inputRenderFunction(t);const c=this.grid?.getSlotElementByName(e.slot),u=c?.parentElement;u&&!u.onkeydown&&(u.onkeydown=e=>{e.key!==s.showInput||this.editInfo||this.inputRenderFunction(t),e.key===s.cancelEdit&&this.editInfo&&this.cancel()}),null!=i&&null!=l?e.title=l.toString():e.title&&e.removeAttribute("title"),a=l instanceof HTMLElement?l:r(this.messagesURIUtils,l),this.removeCellContent(e),a instanceof HTMLElement?e.appendChild(a):null!=a&&(e.innerHTML=a.toString())},this.required=!1,this.tableEditingEnabled=!1}get _lockIconNode(){return this.createCalciteIcon({icon:"lock",textLabel:this.messages?.editingPreventedColumn})}get effectiveEditable(){return this.tableEditingEnabled&&this.editable}get effectiveRequired(){return this.required}get editing(){return!!this.editInfo}get shouldShowPrompt(){return!1}cancel(){this.onEditComplete()}createCalciteOption(t,e,n=!1){const o=document.createElement("calcite-option");return o.label=t,o.value=`${e}`,o.selected=n,o}createCalciteSelect(t,e){const{effectiveRequired:n,messages:o}=this;let i=!1;const l=e.map((({name:e,value:n})=>{const o=n===t;return o&&(i=!0),this.createCalciteOption(e,n,o)}));if(null!=t&&""!==t&&!i){const e=t.toString(),n=this.createCalciteOption(e,e);l.unshift(n)}n||l.unshift(this.createCalciteOption(`<${o?.noValue}>`,""));const r=document.createElement("calcite-select");return l.forEach((t=>r.appendChild(t))),r}createInputElement({value:t}){const{effectiveRequired:o,maxLength:i}=this,l=document.createElement("calcite-input");return null!=i&&(l.maxLength=i),l.required=o,l.value=null!=t?t.toString():"",this.addHandles([e((()=>l),"calciteInputChange",(()=>this.onInputBlur()),n),e((()=>l),"keydown",(t=>{t.key===s.cancelEdit&&this.onInputBlur(!0)}),n),e((()=>l),"blur",(()=>this.onInputBlur()),n)],a),l}createDateComponent(){const t=document.createElement("calcite-input-date-picker");return t.focusTrapDisabled=!0,t.overlayPositioning="fixed",t}createTimeComponent(){const t=document.createElement("calcite-input-time-picker");return t.overlayPositioning="fixed",t.placement="auto-start",t.step=1,t}createTimeZoneComponent(){const t=document.createElement("calcite-input-time-zone");return t.maxItems=4,t.overlayPositioning="fixed",t}onEditComplete(){this._set("editInfo",null),this.grid?.generateCellPartNames(),this.grid?.requestContentUpdate()}onInputBlur(t=!1){this.removeHandles(a),t?this.cancel():this.submit()}async submit(){const{editInfo:t}=this;if(!t)return void this.cancel();const{inputs:e,rowData:n,oldValue:o}=t,i=this.parseInputValueFunction({inputs:e});if(!this.cellValueValidatorFunction({value:i,oldValue:o}))return void this.cancel();const{root:l}=t,r=n.item.objectId,{fieldName:s}=this;l.textContent=this.loadingMessage,this.shouldShowPrompt?this.onShowPromptCallback({column:this,objectId:r,oldValue:o,value:i}):await this.updateItems({objectId:r,updates:[{fieldName:s,value:i}]})}async updateItems(t){const{store:e}=this;if(e)try{await e.updateItem(t),this.onEditComplete()}catch{this.cancel()}else this.cancel()}};t([o()],c.prototype,"_lockIconNode",null),t([o({readOnly:!0})],c.prototype,"editInfo",void 0),t([o()],c.prototype,"cellValueValidatorFunction",void 0),t([o()],c.prototype,"editable",void 0),t([o()],c.prototype,"effectiveEditable",null),t([o()],c.prototype,"effectiveRequired",null),t([o()],c.prototype,"editing",null),t([o()],c.prototype,"headerRenderFunction",void 0),t([o()],c.prototype,"inputRenderFunction",void 0),t([o({constructOnly:!0})],c.prototype,"loadingMessage",void 0),t([o()],c.prototype,"inputType",void 0),t([o()],c.prototype,"maxLength",void 0),t([o()],c.prototype,"onShowPromptCallback",void 0),t([o()],c.prototype,"parseInputValueFunction",void 0),t([o()],c.prototype,"renderFunction",void 0),t([o()],c.prototype,"required",void 0),t([o()],c.prototype,"shouldShowPrompt",null),t([o()],c.prototype,"tableEditingEnabled",void 0),c=t([i("esri.widgets.FeatureTable.Grid.EditorColumn")],c);const u=c;export{u as default};
@@ -1 +0,0 @@
1
- "use strict";(self.webpackChunkRemoteClient=self.webpackChunkRemoteClient||[]).push([[8692],{8303:(e,t,i)=>{i.d(t,{A:()=>T});var a=i(90237),s=i(92602),r=i(70333),n=i(78888),o=i(60999),l=i(49186),d=i(53966),h=i(97768),p=i(74887),u=i(84952),y=i(10107),c=(i(44208),i(87811),i(36005)),f=i(40608),g=i(43937),m=i(77548),w=i(20655),M=i(80812),b=i(41318),_=i(10407);const T=e=>{let t=class extends e{constructor(){super(...arguments),this.resourceReferences={portalItem:null,paths:[]},this.userHasEditingPrivileges=!0,this.userHasFullEditingPrivileges=!1,this.userHasUpdateItemPrivileges=!1}destroy(){this.portalItem=(0,h.pR)(this.portalItem),this.resourceReferences.portalItem=null,this.resourceReferences.paths.length=0}set portalItem(e){e!==this._get("portalItem")&&(this.removeOrigin("portal-item"),this._set("portalItem",e))}readPortalItem(e,t,i){if(t.itemId)return new M.default({id:t.itemId,portal:i?.portal})}writePortalItem(e,t){e?.id&&(t.itemId=e.id)}async loadFromPortal(e,t){if(this.portalItem?.id)try{const{load:a}=await i.e(1204).then(i.bind(i,41204));return(0,p.Te)(t),await a({instance:this,supportedTypes:e.supportedTypes,validateItem:e.validateItem,supportsData:e.supportsData,layerModuleTypeMap:e.layerModuleTypeMap,populateGroupLayer:e.populateGroupLayer},t)}catch(e){throw(0,p.zf)(e)||d.A.getLogger(this).warn(`Failed to load layer (${this.title}, ${this.id}) portal item (${this.portalItem.id})\n ${e}`),e}}async finishLoadEditablePortalLayer(e){this._set("userHasEditingPrivileges",await this._fetchUserHasEditingPrivileges(e).catch((e=>((0,p.QP)(e),!0))))}async setUserPrivileges(e,t){if(!s.A.userPrivilegesApplied)return this.finishLoadEditablePortalLayer(t);if(this.url)try{const{features:{edit:i,fullEdit:a},content:{updateItem:s}}=await this._fetchUserPrivileges(e,t);this._set("userHasEditingPrivileges",i),this._set("userHasFullEditingPrivileges",a),this._set("userHasUpdateItemPrivileges",s)}catch(e){(0,p.QP)(e)}}async _fetchUserPrivileges(e,t){let i=this.portalItem;if(!e||!i||!i.loaded||i.sourceUrl)return this._fetchFallbackUserPrivileges(t);const a=!r.id?.findCredential(this.url),s=e===i.id;if(s&&i.portal.user)return this._getUserPrivileges(i,a);let n,o;if(s)n=i.portal.url;else try{n=await(0,m.wI)(this.url,t)}catch(e){(0,p.QP)(e)}if(!n||!(0,u.b8)(n,i.portal.url))return this._fetchFallbackUserPrivileges(t);try{const e=null!=t?t.signal:null;o=await(r.id?.getCredential(`${n}/sharing`,{prompt:!1,signal:e}))}catch(e){(0,p.QP)(e)}const l=!0,d=!1,h=!1;if(!o)return{features:{edit:l,fullEdit:d},content:{updateItem:h}};try{if(s?await i.reload():(i=new M.default({id:e,portal:{url:n}}),await i.load(t)),i.portal.user)return this._getUserPrivileges(i,a)}catch(e){(0,p.QP)(e)}return{features:{edit:l,fullEdit:d},content:{updateItem:h}}}_getUserPrivileges(e,t){const i=(0,_.It)(e);return t&&(i.features.edit=!0),i}async _fetchFallbackUserPrivileges(e){let t=!0;try{t=await this._fetchUserHasEditingPrivileges(e)}catch(e){(0,p.QP)(e)}return{features:{edit:t,fullEdit:!1},content:{updateItem:!1}}}async _fetchUserHasEditingPrivileges(e){const t=this.url?r.id?.findCredential(this.url):null;if(!t)return!0;const i=v.credential===t?v.user:await this._fetchEditingUser(e);return v.credential=t,v.user=i,null==i?.privileges||i.privileges.includes("features:user:edit")}async _fetchEditingUser(e){const t=this.portalItem?.portal?.user;if(t)return t;const i=r.id?.findServerInfo(this.url??"");if(!i?.owningSystemUrl)return null;const a=`${i.owningSystemUrl}/sharing/rest`,s=w.A.getDefault();if(s&&s.loaded&&(0,u.S8)(s.restUrl)===(0,u.S8)(a))return s.user;const l=`${a}/community/self`,d=null!=e?e.signal:null,h=await(0,o.Ke)((0,n.A)(l,{authMode:"no-prompt",query:{f:"json"},signal:d}));return h.ok?b.A.fromJSON(h.value.data):null}read(e,t){t&&(t.layer=this),super.read(e,t)}write(e,t){const i=t?.portal,a=this.portalItem?.id&&(this.portalItem.portal||w.A.getDefault());return i&&a&&!(0,u.ut)(a.restUrl,i.restUrl)?(t.messages&&t.messages.push(new l.A("layer:cross-portal",`The layer '${this.title} (${this.id})' cannot be persisted because it refers to an item on a different portal than the one being saved to. To save, set layer.portalItem to null or save to the same portal as the item associated with the layer`,{layer:this})),null):super.write(e,{...t,layer:this})}};return(0,a._)([(0,y.MZ)({type:M.default})],t.prototype,"portalItem",null),(0,a._)([(0,c.w)("web-document","portalItem",["itemId"])],t.prototype,"readPortalItem",null),(0,a._)([(0,g.K)("web-document","portalItem",{itemId:{type:String}})],t.prototype,"writePortalItem",null),(0,a._)([(0,y.MZ)({clonable:!1})],t.prototype,"resourceReferences",void 0),(0,a._)([(0,y.MZ)({type:Boolean,readOnly:!0})],t.prototype,"userHasEditingPrivileges",void 0),(0,a._)([(0,y.MZ)({type:Boolean,readOnly:!0})],t.prototype,"userHasFullEditingPrivileges",void 0),(0,a._)([(0,y.MZ)({type:Boolean,readOnly:!0})],t.prototype,"userHasUpdateItemPrivileges",void 0),t=(0,a._)([(0,f.$)("esri.layers.mixins.PortalLayer")],t),t},v={credential:null,user:null}},18768:(e,t,i)=>{i.d(t,{b:()=>l});var a=i(90237),s=i(53966),r=i(10107),n=(i(44208),i(87811),i(40608)),o=i(60694);const l=e=>{let t=class extends e{get title(){if(this._get("title")&&"defaults"!==this.originOf("title"))return this._get("title");if(this.url){const e=(0,o.qg)(this.url);if(e?.title)return e.title}return this._get("title")||""}set title(e){this._set("title",e)}set url(e){this._set("url",(0,o.Jf)(e,s.A.getLogger(this)))}};return(0,a._)([(0,r.MZ)()],t.prototype,"title",null),(0,a._)([(0,r.MZ)({type:String})],t.prototype,"url",null),t=(0,a._)([(0,n.$)("esri.layers.mixins.ArcGISService")],t),t}},28692:(e,t,i)=>{i.r(t),i.d(t,{default:()=>N});var a=i(90237),s=i(67996),r=i(5503),n=i(49186),o=i(53966),l=i(91869),d=i(92071),h=i(74887),p=i(36708),u=i(84952),y=i(13069),c=i(10107),f=(i(44208),i(87811),i(36005)),g=i(40608),m=i(43937),w=i(35666),M=i(4146),b=i(80340),_=i(70643),T=i(85342),v=i(18768),D=i(63074),A=i(69208),I=i(16131),S=i(8303),L=i(54310),P=i(25036),E=i(10873),k=i(34246),C=i(97159);let G=class extends((0,D.dM)((0,P.j)((0,L.J)((0,v.b)((0,I.q)((0,S.A)((0,d.P)((0,A.d)(M.A))))))))){constructor(e){super(e),this._graphTypeLookup=new Map,this._namedTypesModified=!1,this.dataManager=null,this.definitionSetMap=null,this.knowledgeGraph=null,this.layers=new(r.A.ofType(_.A)),this.memberEntityTypes=null,this.memberRelationshipTypes=null,this.operationalLayerType="KnowledgeGraphLayer",this.sublayerIdsCache=new Map,this.tables=new(r.A.ofType(_.A)),this.type="knowledge-graph",this.url=null,this.addHandles((0,p.wB)((()=>this.layers.concat(this.tables)),((e,t)=>this._handleSublayersChange(e,t)),p.OH))}load(e){return this.addResolvingPromise(this._doLoad(e)),Promise.resolve(this)}async _doLoad(e){try{await this.loadFromPortal({supportedTypes:["Knowledge Graph Layer"]},e)}catch(e){(0,h.QP)(e)}await this._fetchMetadata(),await this._initializeLayerProperties(),this.loadLayerAssumingLocalCache(),this._layersLoadedFromAuthoritativeItem()||await(0,T.qN)(this)}async _fetchMetadata(){if(!this.url)throw new n.A("knowledge-graph:missing-url","KnowledgeGraphLayer must be created with a url");const e=await(0,k.fetchKnowledgeGraph)(this.url);this.knowledgeGraph=e,this._forEachGraphType((e=>{e.name&&this._graphTypeLookup.set(e.name,e)}))}async _initializeLayerProperties(){this.originIdOf("inclusionModeDefinition")===w.Gr.USER?this._validateInclusionModeDefinition():await this._initializeInclusionModeDefinition(),this._setMemberTypes(),this.dataManager=new b.P({knowledgeGraph:this.knowledgeGraph,inclusionModeDefinition:this.inclusionModeDefinition})}async _initializeInclusionModeDefinition(){const e=this.definitionSetMap?await(0,s.cZ)(this.definitionSetMap,!0):{generateAllSublayers:!0,namedTypeDefinitions:new Map};[...this.layers.toArray(),...this.tables.toArray()].forEach((t=>{const i=this._graphTypeLookup.get(t.graphTypeName);i&&!e.namedTypeDefinitions.has(i.name)&&e.namedTypeDefinitions.set(i.name,{useAllData:!0})})),this.setAtOrigin("inclusionModeDefinition",e,(0,w.OL)(this.originIdOf("definitionSetMap")))}_validateInclusionModeDefinition(){const{inclusionModeDefinition:e}=this;if(!e)return;const{namedTypeDefinitions:t}=e;if(t?.size>0)t.forEach(((e,i)=>{const a=this._graphTypeLookup.get(i);if(!a)return o.A.getLogger(this).warn(`A named type, ${i}, was in the inclusion list that wasn't in the data model and will be removed`),void t.delete(i);"relationship"!==a.type&&"entity"!==a.type&&(o.A.getLogger(this).warn(`A named type, ${i}, was in the inclusion list that wasn't properly modeled and will be removed`),t.delete(i))}));else if(!e.generateAllSublayers)throw new n.A("knowledge-graph:composite-layer-constructor","If an explicit inclusion definition is defined, at least one namedTypeDefinition must also be defined")}_setMemberTypes(){let e=[],t=[];const{inclusionModeDefinition:i}=this,a=i?.namedTypeDefinitions;!i||i.generateAllSublayers?(e=this.knowledgeGraph.dataModel?.entityTypes??[],t=this.knowledgeGraph.dataModel?.relationshipTypes??[]):a&&a.size>0&&a.forEach(((i,a)=>{const s=this._graphTypeLookup.get(a);switch(s?.type){case"relationship":t.push(s);break;case"entity":e.push(s)}})),this.memberEntityTypes=e,this.memberRelationshipTypes=t}_forEachGraphType(e){[...this.knowledgeGraph.dataModel?.entityTypes??[],...this.knowledgeGraph.dataModel?.relationshipTypes??[]].forEach((t=>{e(t)}))}_refreshNamedTypes(){this._namedTypesModified=!0;for(const e of this.layers)e.emit("refresh",{dataChanged:!0});for(const e of this.tables)e.emit("refresh",{dataChanged:!0})}async _handleNewRecords(e){const t=new Set,i=[];for(const a of e)this._graphTypeLookup.has(a.typeName)&&(!1===this.layers.concat(this.tables).some((e=>e.objectType.name===a.typeName))&&(this.dataManager.sublayerCaches.set(a.typeName,new Map),t.add(a.typeName)),(0,l.tE)(this.sublayerIdsCache,a.typeName,(()=>new Set)).add(a.id),i.push(a));this.dataManager.addToLayer(i);for(const e of t){const t=this._graphTypeLookup.get(e);t&&(this._addSublayer(t),"entity"===t.type?this.dataManager.entityTypeNames.add(e):this.dataManager.relationshipTypeNames.add(e))}await(0,T.qN)(this,Array.from(t)),this._refreshNamedTypes()}_createSublayers(e,t,i){e.forEach((e=>{const a=this._createSublayer(e);i(a)&&t.push(a),this._updateSublayerCaches(e)}))}_addSublayer(e){const t=this._createSublayer(e);return t.geometryType?this.layers.push(t):this.tables.push(t),t}_createSublayer(e){return new _.A({objectType:e,parentCompositeLayer:this,graphType:e.type})}_updateSublayers(e,t){t.forEach((t=>{t.parentCompositeLayer=this;const i=e.find((e=>e.type===t.graphType&&e.name===t.graphTypeName));i&&(t.objectType=i,this._updateSublayerCaches(i))}))}_updateSublayerCaches({name:e}){if(!e)return;const t=this.dataManager.sublayerCaches;t.has(e)||t.set(e,new Map)}_saveUrlAsNewResource(e,t,i,a){e[t]="<pending>",i.pendingOperations.push(async function(e){const t=await(0,s.fe)(e);return new Blob([t],{type:"application/x-protobuf"})}(this.inclusionModeDefinition).then((s=>{const r=function(e){const t=`definitionSetMap-${(0,y.lk)()}.dat`,i=(0,u.fj)("knowledgeGraphLayer",t);return e.resourceFromPath(i)}(a);e[t]=r.itemRelativeUrl,i.toAdd.push({resource:r,content:{type:"blob",blob:s},compress:!1,finish:e=>{this.definitionSetMap=e.url}})})))}_displaysAllRecords(e){for(const[,{useAllData:t}]of e.namedTypeDefinitions)if(!t)return!1;return!0}_handleSublayersChange(e,t){t&&(t.forEach((e=>{e.parent=null})),this.removeHandles("sublayers-owner")),e&&(e.forEach((e=>{e.parent=this})),this.addHandles([e.on("after-add",(({item:e})=>{e.parent=this})),e.on("after-remove",(({item:e})=>{e.parent=null}))],"sublayers-owner"))}_layersLoadedFromAuthoritativeItem(){const e=this.originIdOf("layers");return e>=w.Gr.PORTAL_ITEM&&e<w.Gr.USER}readDefinitionSetMap(e,t,i){return(0,C.f)(e,i)}writeDefinitionSetMap(e,t,i,a){const s=a?.portalItem,r=a?.resources,n=(0,w.aB)(a?.origin);if(!s||!r||null==n)return void(e&&(t[i]=(0,C.t)(e,a)));const{inclusionModeDefinition:o}=this;if(!o||this._displaysAllRecords(o))return void(this.definitionSetMap=null);const l=this.originIdOf("inclusionModeDefinition");if(l===w.Gr.USER||this._namedTypesModified||n<l)this._saveUrlAsNewResource(t,i,r,s);else if(n===l&&e){const n=(0,C.t)(e,a);(0,u.oP)(n)?this._saveUrlAsNewResource(t,i,r,s):t[i]=n}}set inclusionModeDefinition(e){"loaded"!==this.loadStatus&&"failed"!==this.loadStatus?this._set("inclusionModeDefinition",e):o.A.getLogger(this).error("#inclusionModeDefinition","inclusionModeDefinition cannot be changed after the layer is loaded.")}loadLayerAssumingLocalCache(){const e=[...this.memberEntityTypes,...this.memberRelationshipTypes];this.layers.length||this.originIdOf("tables")===w.Gr.DEFAULTS?this.originIdOf("layers")===w.Gr.DEFAULTS?this._createSublayers(e,this.layers,(e=>!!e.geometryType)):this._updateSublayers(e,this.layers):this.layers=new r.A,this.tables.length||this.originIdOf("layers")===w.Gr.DEFAULTS?this.originIdOf("tables")===w.Gr.DEFAULTS?this._createSublayers(e,this.tables,(e=>!e.geometryType)):this._updateSublayers(e,this.tables):this.tables=new r.A,this.dataManager.inclusionModeDefinition?.namedTypeDefinitions?.forEach(((e,t)=>{const i=(0,l.tE)(this.sublayerIdsCache,t,(()=>new Set));e.members?.forEach((e=>{i.add(e.id)}))}))}async addRecords(e){await this.load(),await this._handleNewRecords(e)}async createSublayerForNamedType(e){await this.load();const t=this._graphTypeLookup.get(e);if(!t)throw new n.A("knowledge-graph:missing-type","The specified type does not exist in the layer's graph data model.");if(this.dataManager.sublayerCaches.has(e))throw new n.A("knowledge-graph:duplicate-type","The specified type already exists as a sublayer.");this.dataManager.sublayerCaches.set(e,new Map),(0,l.tE)(this.sublayerIdsCache,e,(()=>new Set));const i=this._addSublayer(t);return"entity"===t.type?this.dataManager.entityTypeNames.add(e):this.dataManager.relationshipTypeNames.add(e),this.dataManager.inclusionModeDefinition&&this.dataManager.inclusionModeDefinition.namedTypeDefinitions.set(e,{useAllData:!0}),await(0,T.qN)(this,[e]),this._refreshNamedTypes(),i}convertSublayerToDynamicData(e){if(!this.dataManager.inclusionModeDefinition)throw new n.A("knowledge-graph:fully-dynamic-membership","This Knowledge Graph Layer already uses fully dynamic membership, individual sublayers cannot be converted");if(!this._graphTypeLookup.get(e))throw new n.A("knowledge-graph:missing-type","The specified type does not exist in the layer's graph data model.");if(!this.dataManager.sublayerCaches.has(e))throw new n.A("knowledge-graph:duplicate-type","The specified type does not exist as a sublayer.");const t=this.dataManager.inclusionModeDefinition.namedTypeDefinitions.get(e);t?.useAllData?o.A.getLogger(this).warn("This Knowledge Graph Layer already uses dynamic membership for the sublayer - no conversion was made"):(this.dataManager.inclusionModeDefinition.namedTypeDefinitions.set(e,{useAllData:!0}),this.sublayerIdsCache.delete(e),this._refreshNamedTypes())}convertSublayerToExplicitMembership(e){if(!this.dataManager.inclusionModeDefinition)throw new n.A("knowledge-graph:fully-dynamic-membership","This Knowledge Graph Layer already uses fully dynamic membership, individual sublayers cannot be converted");if(!this._graphTypeLookup.get(e))throw new n.A("knowledge-graph:missing-type","The specified type does not exist in the layer's graph data model.");const t=this.dataManager.inclusionModeDefinition.namedTypeDefinitions.get(e);if(!t||t.useAllData){if(!this.dataManager.sublayerCaches.has(e))throw new n.A("knowledge-graph:duplicate-type","The specified type does not exist as a sublayer.");this.sublayerIdsCache.set(e,new Set),this.dataManager.inclusionModeDefinition.namedTypeDefinitions.set(e,{useAllData:!1,members:new Map}),this._refreshNamedTypes()}else o.A.getLogger(this).warn("This Knowledge Graph Layer already uses explicit membership for the sublayer - no conversion was made")}convertToFullyDynamicData(){this.dataManager.inclusionModeDefinition||o.A.getLogger(this).warn("This Knowledge Graph Layer already uses fully dynamic membership - no conversion was made"),this.sublayerIdsCache.clear(),this.dataManager.inclusionModeDefinition=null,this._refreshNamedTypes()}convertToExplicitMembership(){this.dataManager.inclusionModeDefinition&&this.dataManager.inclusionModeDefinition.namedTypeDefinitions.size>0&&o.A.getLogger(this).warn("This Knowledge Graph Layer already uses explicit membership - no conversion was made"),this.dataManager.inclusionModeDefinition={generateAllSublayers:!1,namedTypeDefinitions:new Map};for(const e of this.dataManager.sublayerCaches.keys())(0,l.tE)(this.sublayerIdsCache,e,(()=>new Set)),this.dataManager.inclusionModeDefinition.namedTypeDefinitions.set(e,{useAllData:!1,members:new Map});this._refreshNamedTypes()}async removeRecords(e){await this.load();const t=[];for(const i of e)!1===this.dataManager.inclusionModeDefinition?.namedTypeDefinitions?.get(i.typeName)?.useAllData&&this.dataManager.inclusionModeDefinition?.namedTypeDefinitions?.get(i.typeName)?.members?.has(i.id)&&t.push(i);this.dataManager.removeFromLayer(t);for(const e of t)this.sublayerIdsCache.get(e.typeName)?.delete(e.id);return this._refreshNamedTypes(),t}};(0,a._)([(0,c.MZ)()],G.prototype,"dataManager",void 0),(0,a._)([(0,c.MZ)({json:{write:{ignoreOrigin:!0,writerEnsuresNonNull:!0}}})],G.prototype,"definitionSetMap",void 0),(0,a._)([(0,f.w)("definitionSetMap")],G.prototype,"readDefinitionSetMap",null),(0,a._)([(0,m.K)("definitionSetMap")],G.prototype,"writeDefinitionSetMap",null),(0,a._)([(0,c.MZ)()],G.prototype,"inclusionModeDefinition",null),(0,a._)([(0,c.MZ)()],G.prototype,"knowledgeGraph",void 0),(0,a._)([(0,c.MZ)({type:r.A.ofType(_.A),json:{write:{ignoreOrigin:!0}}})],G.prototype,"layers",void 0),(0,a._)([(0,c.MZ)()],G.prototype,"memberEntityTypes",void 0),(0,a._)([(0,c.MZ)()],G.prototype,"memberRelationshipTypes",void 0),(0,a._)([(0,c.MZ)({type:["KnowledgeGraphLayer"]})],G.prototype,"operationalLayerType",void 0),(0,a._)([(0,c.MZ)()],G.prototype,"sublayerIdsCache",void 0),(0,a._)([(0,c.MZ)({type:r.A.ofType(_.A),json:{write:{ignoreOrigin:!0}}})],G.prototype,"tables",void 0),(0,a._)([(0,c.MZ)({json:{read:!1}})],G.prototype,"type",void 0),(0,a._)([(0,c.MZ)(E.OZ)],G.prototype,"url",void 0),G=(0,a._)([(0,g.$)("esri.layers.KnowledgeGraphLayer")],G);const N=G},69208:(e,t,i)=>{i.d(t,{d:()=>n});var a=i(90237),s=i(10107),r=(i(44208),i(53966),i(87811),i(40608));const n=e=>{let t=class extends e{constructor(){super(...arguments),this.customParameters=null}};return(0,a._)([(0,s.MZ)({type:Object,json:{write:{overridePolicy:e=>({enabled:!!(e&&Object.keys(e).length>0)})}}})],t.prototype,"customParameters",void 0),t=(0,a._)([(0,r.$)("esri.layers.mixins.CustomParametersMixin")],t),t}}}]);
@@ -1 +0,0 @@
1
- "use strict";(self.webpackChunkRemoteClient=self.webpackChunkRemoteClient||[]).push([[1728],{71728:(e,t,a)=>{a.r(t),a.d(t,{default:()=>z});var i,n,o=a(90237),s=a(67996),r=a(5503),l=a(49186),h=a(53966),d=a(91869),c=a(92071),p=a(74887),u=a(36708),y=a(10107),g=(a(44208),a(87811),a(40608)),m=a(35666),f=a(5443),M=a(86738),L=a(82799),w=a(4146),b=a(90708),T=a(15375);(n=i||(i={})).MULTIPLIER="multiplier",n.ABSOLUTE="absolute-value";var k=a(80340),C=a(70643),N=a(85342),x=a(69860),D=a(30504),v=a(63074),A=a(16131),E=a(25036),_=a(10873),I=a(8460),S=a(34246);let R=class extends((0,A.q)((0,v.dM)((0,E.j)((0,c.P)(w.A))))){constructor(e){if(super(e),this.url=null,this.dataPreloadedInLocalCache=!1,this.initializationLinkChartConfig=null,this.membershipModified=!0,this._currentLinkChartConfig={layoutMode:"organic-standard"},this._graphTypeLookup=new Map,this.dataManager=null,this.knowledgeGraph=null,this.layers=new(r.A.ofType(C.A)),this.entityLinkChartDiagramLookup=new Map,this.relationshipLinkChartDiagramLookup=new Map,this.linkChartExtent=new f.A({xmin:-1e-7,ymin:-1e-7,xmax:1e-7,ymax:1e-7}),this.memberEntityTypes=null,this.memberRelationshipTypes=null,this.operationalLayerType="LinkChartLayer",this.sublayerIdsCache=new Map,this.tables=new(r.A.ofType(C.A)),this.type="link-chart",this.chronologicalAuxiliaryGraphics=null,this._originalInclusionList=e?.initializationInclusionModeDefinition,e?.dataPreloadedInLocalCache&&!e?.initializationInclusionModeDefinition)throw new l.A("knowledge-graph:linkchart-layer-constructor","If creating a link chart composite layer and configured that data is already loaded in the cache, you must specify an inclusion list so the Composite Layer knows what records belong to it");this.addHandles((0,u.wB)((()=>this.layers.concat(this.tables)),((e,t)=>this._handleSublayersChange(e,t)),u.OH))}normalizeCtorArgs(e){if(!e)return{};const{url:t,title:a,dataPreloadedInLocalCache:i,initializationLinkChartConfig:n}=e;return{url:t,title:a,dataPreloadedInLocalCache:i,initializationLinkChartConfig:n}}_initializeLayerProperties(e){if(!this.title&&this.url){const e=this.url.split("/");this.title=e[e.length-2]}const t=new Set;let a=[],i=[];if(e.inclusionModeDefinition&&(!e.inclusionModeDefinition.namedTypeDefinitions||e.inclusionModeDefinition.namedTypeDefinitions.size<1))throw new l.A("knowledge-graph:composite-layer-constructor","If an explicit inclusion definition is defined, at least one namedTypeDefinition must also be defined");e.inclusionModeDefinition?.generateAllSublayers?(a=e.knowledgeGraph.dataModel.entityTypes??[],i=e.knowledgeGraph.dataModel.relationshipTypes??[]):e.inclusionModeDefinition?.namedTypeDefinitions&&e.inclusionModeDefinition?.namedTypeDefinitions.size>0?e.inclusionModeDefinition?.namedTypeDefinitions.forEach(((n,o)=>{const s=this._graphTypeLookup.get(o);if(!s)return h.A.getLogger(this).warn(`A named type, ${o}, was in the inclusion list that wasn't in the data model and will be removed`),void e.inclusionModeDefinition?.namedTypeDefinitions.delete(o);"relationship"===s.type?t.has(o)||(t.add(o),i.push(s)):"entity"===s.type?t.has(o)||(t.add(o),a.push(s)):(h.A.getLogger(this).warn(`A named type, ${o}, was in the inclusion list that wasn't properly modeled and will be removed`),e.inclusionModeDefinition?.namedTypeDefinitions.delete(o))})):(a=e.knowledgeGraph.dataModel.entityTypes??[],i=e.knowledgeGraph.dataModel.relationshipTypes??[]);const n=new k.P({knowledgeGraph:e.knowledgeGraph,inclusionModeDefinition:e.inclusionModeDefinition});this.knowledgeGraph=e.knowledgeGraph,this.memberEntityTypes=a,this.memberRelationshipTypes=i,this.dataManager=n}load(e){const t=async()=>{const e=[],t=[];this.loadLayerAssumingLocalCache(),this._layersLoadedFromAuthoritativeItem()||await(0,N.qN)(this),this.dataManager.inclusionModeDefinition&&(this.dataManager.inclusionModeDefinition.generateAllSublayers=!1),this.dataManager.inclusionModeDefinition?.namedTypeDefinitions.forEach((e=>{e.useAllData=!1})),await this._initializeDiagram(),this.layers.forEach((a=>{t.push(a.refreshCachedQueryEngine()),e.push(new Promise((e=>{a.on("layerview-create",(()=>{e(null)}))})))})),this.tables.forEach((e=>{t.push(e.refreshCachedQueryEngine())})),await Promise.all(t)};return this.addResolvingPromise(new Promise((a=>{(0,S.fetchKnowledgeGraph)(this.url).then((async i=>{i.dataModel.entityTypes?.forEach((e=>{e.name&&this._graphTypeLookup.set(e.name,e)})),i.dataModel.relationshipTypes?.forEach((e=>{e.name&&this._graphTypeLookup.set(e.name,e)}));const n=this.linkChart?.linkChartProperties;if(n?.originIdOf("entitiesUrl")===m.Gr.LINK_CHART&&(this.membershipModified=!1,this._originalInclusionList=await s.XW.fetchAndConvertSerializedLinkChart({entitiesUrl:n?.entitiesUrl,relationshipsUrl:n?.relationshipsUrl}),this._alignLayersDataModelAndInclusionDefinition(i.dataModel),this.initializationLinkChartConfig={layoutSettings:n?.layoutSettings??void 0,layoutMode:(0,D.k5)(n.layoutType)}),this._initializeLayerProperties({knowledgeGraph:i,inclusionModeDefinition:this._originalInclusionList}),this.dataManager.inclusionModeDefinition?.namedTypeDefinitions?.size||(this.dataManager.inclusionModeDefinition={generateAllSublayers:!1,namedTypeDefinitions:new Map},this.dataManager.knowledgeGraph.dataModel.entityTypes?.forEach((e=>{e.name&&this.dataManager.inclusionModeDefinition?.namedTypeDefinitions.set(e.name,{useAllData:!0})})),this.dataManager.knowledgeGraph.dataModel.relationshipTypes?.forEach((e=>{e.name&&this.dataManager.inclusionModeDefinition?.namedTypeDefinitions.set(e.name,{useAllData:!0})}))),this.dataPreloadedInLocalCache){const e=x.A.getInstance();for(const[t,a]of this.dataManager.inclusionModeDefinition?.namedTypeDefinitions??[])for(const i of a.members?.values()??[]){const a=e.readFromStoreById(`${t}__${i.id}`);a&&(0,d.tE)(this.dataManager.sublayerCaches,t,(()=>new Map)).set(i.id,a)}await t()}else{const a="geographic-organic-standard"===this.initializationLinkChartConfig?.layoutMode;this.addResolvingPromise(this.dataManager.refreshCacheContent(void 0,!1,a,!0).then((async()=>{(0,p.Te)(e),await t()})))}a(null)}))}))),Promise.resolve(this)}set initializationInclusionModeDefinition(e){"loaded"!==this.loadStatus&&"failed"!==this.loadStatus?this._set("initializationInclusionModeDefinition",e):h.A.getLogger(this).error("#initializationInclusionModeDefinition","initializationInclusionModeDefinition cannot be changed after the layer is loaded.")}get linkChart(){return this.parent}async addRecords(e,t){let a=[];t?.cascadeAddRelationshipEndNodes&&this.dataManager.knowledgeGraph.dataModel&&(a=await(0,D.aq)(e,this.dataManager.knowledgeGraph));const i=e.concat(a).filter((e=>!this.sublayerIdsCache.get(e.typeName)?.has(e.id)));i.length>0&&(this.membershipModified=!0),await this._handleNewRecords(i,t)}async createSublayerForNamedType(e){await this.load();const t=this._graphTypeLookup.get(e);if(!t)throw new l.A("knowledge-graph:missing-type","The specified type does not exist in the knowledge graph.");if(this.dataManager.sublayerCaches.has(e))throw new l.A("knowledge-graph:duplicate-type","The specified type already exists as a sublayer.");this.dataManager.sublayerCaches.set(e,new Map),(0,d.tE)(this.sublayerIdsCache,e,(()=>new Set));const a=this._createSublayer(t);return"entity"===t.type?this.dataManager.entityTypeNames.add(e):this.dataManager.relationshipTypeNames.add(e),this.dataManager.inclusionModeDefinition?.namedTypeDefinitions?.set(e,{useAllData:!1,members:new Map}),a.geometryType?this.layers.push(a):this.tables.push(a),await(0,N.qN)(this,[e]),this._refreshNamedTypes(),a}async removeRecords(e,{cascadeRemoveRelationships:t=!0,recalculateLayout:a=!1,overrideMembershipCheck:i=!1}={cascadeRemoveRelationships:!0,recalculateLayout:!1,overrideMembershipCheck:!1}){let n=[];for(const t of e)(i||!1===this.dataManager.inclusionModeDefinition?.namedTypeDefinitions?.get(t.typeName)?.useAllData&&this.dataManager.inclusionModeDefinition?.namedTypeDefinitions?.get(t.typeName)?.members?.has(t.id))&&n.push(t);if(t){const e=new Set,t=[];for(const t of n)if(this.dataManager.nodeConnectionsLookup.has(t.id))for(const a of this.dataManager.nodeConnectionsLookup.get(t.id))e.add(a);for(const a of e)if(this.dataManager.memberIdTypeLookup.has(a))for(const e of this.dataManager.memberIdTypeLookup.get(a))this.dataManager.relationshipTypeNames.has(e)&&t.push({id:a,typeName:e});n=n.concat(t)}this.dataManager.removeFromLayer(n);for(const e of n)this.sublayerIdsCache.get(e.typeName)?.delete(e.id),this.dataManager.relationshipTypeNames.has(e.typeName)?this.relationshipLinkChartDiagramLookup.delete(e.id):this.entityLinkChartDiagramLookup.delete(e.id);const o=a?void 0:this.getCurrentNodeLocations();await this._calculateLayoutWithSublayerTimeInfo(this._currentLinkChartConfig.layoutMode,{layoutSettings:this._currentLinkChartConfig.layoutSettings,lockedNodeLocations:o}),n.length>0&&(this.membershipModified=!0);const s=[];return this.layers.forEach((e=>{s.push(e.refreshCachedQueryEngine())})),await Promise.all(s),this._refreshNamedTypes(),n}async expand(e,t){let a=[];try{const i=await this.dataManager.getConnectedRecordIds(e,t?.relationshipTypeNames,t);a=i.filter((e=>!this.sublayerIdsCache.get(e.typeName)?.has(e.id))),await this._handleNewRecords(a,t),i.length>0&&(this.membershipModified=!0),(0,p.Te)(t?.signal)}catch(e){throw(0,p.zf)(e)&&a.length>0&&await this.removeRecords(a,{overrideMembershipCheck:!0}),e}return{records:a}}loadLayerAssumingLocalCache(){const e=[...this.memberRelationshipTypes,...this.memberEntityTypes];this.layers.length||this.originIdOf("tables")===m.Gr.DEFAULTS?this.originIdOf("layers")===m.Gr.DEFAULTS?this._createSublayers(e,this.layers,(e=>!!e.geometryType)):this._updateSublayers(e,this.layers):this.layers=new r.A,this.tables.length||this.originIdOf("layers")===m.Gr.DEFAULTS?this.originIdOf("tables")===m.Gr.DEFAULTS?this._createSublayers(e,this.tables,(e=>!e.geometryType)):this._updateSublayers(e,this.tables):this.tables=new r.A,this.dataManager.inclusionModeDefinition?.namedTypeDefinitions?.forEach(((e,t)=>{const a=(0,d.tE)(this.sublayerIdsCache,t,(()=>new Set));e.members?.forEach((({id:e,linkChartLocation:i})=>{if(a.add(e),i){const a="coords"in i&&"lengths"in i?i:(0,b.Ux)(i);this.dataManager.relationshipTypeNames.has(t)?this.relationshipLinkChartDiagramLookup.set(e,a):this.entityLinkChartDiagramLookup.set(e,a)}}))}))}async calculateLinkChartLayout(e="organic-standard",t){const a=[],i=[],n=[];this.dataManager.sublayerCaches.forEach(((e,t)=>{this.dataManager.entityTypeNames.has(t)?e.forEach((e=>{a.push({typeName:t,feature:e})})):this.dataManager.relationshipTypeNames.has(t)&&e.forEach((e=>{i.push({typeName:t,feature:e})}))})),this.entityLinkChartDiagramLookup=new Map,this.relationshipLinkChartDiagramLookup=new Map;const o=new Map,s=new Map,r=new Map,c=new Map,u=new Uint8Array(a.length),y=new Float64Array(a.length),g=new Float64Array(a.length),m=new Float64Array(a.length),w=new Float64Array(a.length),k=new Uint32Array(i.length),C=new Uint32Array(i.length),N=new Float64Array(i.length),x=new Float64Array(i.length),D=[];let v=!1;const A=new f.A({xmin:-1e-7,ymin:-1e-7,xmax:1e-7,ymax:1e-7});let E,_="organic-standard",S=0,R=0;const z=I.i6.apply;switch(_="geographic-organic-standard"===e?"organic-standard":e,_){case"organic-standard":E=I.pM.apply;break;case"organic-community":E=I.Tu.apply;break;case"hierarchical-bottom-to-top":E=I.$C.apply;break;case"radial-root-centric":E=I.vJ.apply;break;case"tree-left-to-right":E=I.Xq.apply;break;default:E=I.Wg.apply}let G=!1;a.forEach((({typeName:a,feature:i})=>{if("chronological-mono-timeline"!==e&&"chronological-multi-timeline"!==e&&t?.lockedNodeLocations?.has(i.attributes[T.dr])){"geographic-organic-standard"===e&&this.dataManager.geographicLookup.has(a)?u[S]=I.tx.IsGeographic:u[S]=I.tx.None;const n=t.lockedNodeLocations.get(i.attributes[T.dr]);y[S]=n.x,g[S]=n.y}else if("geographic-organic-standard"===e&&this.dataManager.geographicLookup.has(a)){u[S]=I.tx.IsGeographic;let e=null;const t=i.attributes[this.dataManager.geographicLookup.get(a).name],n=this.dataManager.geographicLookup.get(a)?.geometryType;switch(n){case"esriGeometryPoint":y[S]=t?.x,g[S]=t?.y;break;case"esriGeometryPolygon":e=t?.centroid,null!=e?.x&&null!=e?.y?(y[S]=e.x,g[S]=e.y):u[S]=I.tx.IsMovable;break;case"esriGeometryPolyline":case"esriGeometryMultipoint":e=t?.extent?.center,null!=e?.x&&null!=e?.y?(y[S]=e.x,g[S]=e.y):u[S]=I.tx.IsMovable;break;default:u[S]=I.tx.IsMovable}(null==y[S]||null==g[S]||Number.isNaN(y[S])||Number.isNaN(g[S]))&&(u[S]=I.tx.IsMovable,y[S]=0,g[S]=0)}else if("chronological-mono-timeline"===e||"chronological-multi-timeline"===e){!G&&t?.lockedNodeLocations?.has(i.attributes[T.dr])&&(G=!0);const e=t?.timeInfoByTypeName?.get(a),n=e?.startField,o=n&&e?.startField?i.attributes[n]:null;m[S]=o?new Date(o).getTime():NaN;const s=e?.endField,r=s&&e?.endField?i.attributes[s]:null;w[S]=r?new Date(r).getTime():NaN,y[S]=0,g[S]=0,u[S]=I.tx.IsMovable}else u[S]=I.tx.IsMovable,y[S]=0,g[S]=0;c.set(i.attributes[T.dr],S),D[S]={feature:i,typeName:a},S++})),G&&h.A.getLogger(this).warn("Locked node locations are not supported for chronological layout at this time. Requested node locations were ignored");let F=!1;const P=new Map;i.forEach((a=>{const i=a.feature.attributes[T.Cz],o=a.feature.attributes[T.KQ],s=c.get(i),r=c.get(o),l=t?.timeInfoByTypeName?.get(a.typeName),h=t?.timeInfoByTypeName?l?.startField:null,d=h?a.feature.attributes[h]:null,p=l?.endField,u=p?a.feature.attributes[p]:null;if(void 0!==s&&void 0!==r){let t=i+"-"+o;"chronological-mono-timeline"!==e&&"chronological-multi-timeline"!==e||(t=t+"-"+d+"-"+u);const l=P.get(t),h=l?.has(a.typeName);h||(k[R]=s,C[R]=r,"chronological-mono-timeline"!==e&&"chronological-multi-timeline"!==e||(N[R]=d?new Date(d).getTime():NaN,x[R]=u?new Date(u).getTime():NaN),void 0===l?P.set(t,new Map([[a.typeName,R]])):l.set(a.typeName,R),R++),n.push(a)}else F=!0,this.relationshipLinkChartDiagramLookup.set(i,null)})),F&&h.A.getLogger(this).warn("A relationship is a member of this layer that has either origin or destination entity nodes that are not members. The diagram geometry will be set to null");const O=this._validateOrganicLayoutSettings(e,t?.layoutSettings?.organicLayoutSettings),U=this._convertValidatedOrganicSettingsToCalculationSettings(O);await(0,I.Hh)();let Z=I.JT.Error,B=null;if("chronological-mono-timeline"===e||"chronological-multi-timeline"===e){let a;({status:Z,links:B,graphics:a}=z((()=>t?.signal?.aborted??!1),u,y,g,m,w,k.subarray(0,R),C.subarray(0,R),N.subarray(0,R),x.subarray(0,R),"chronological-multi-timeline"===e,t?.layoutSettings?.chronologicalLayoutSettings)),Z===I.JT.Success&&(this.chronologicalAuxiliaryGraphics=a)}else({status:Z,links:B}=E((()=>t?.signal?.aborted??!1),u,y,g,k.subarray(0,R),C.subarray(0,R),U.computationBudgetTime,U.idealEdgeLengthMultiplier,U.repulsionRadiusMultiplier));if((0,p.Te)(t?.signal),Z===I.JT.Error)throw new l.A("knowledge-graph:layout-failed","Attempting to arrange the records in the specified layout failed");if(Z===I.JT.Canceled)throw(0,p.NK)();for(let e=0;e<D.length;e++){if(g[e]>84.9999?g[e]=84.9999:g[e]<-84.9999&&(g[e]=-84.9999),y[e]>179.9999?y[e]=179.9999:y[e]<-179.9999&&(y[e]=-179.9999),D[e].feature.attributes[T.T1]=new M.A(y[e],g[e]),o.has(D[e].typeName)){const t=o.get(D[e].typeName);t?.set(D[e].feature.attributes[T.dr],D[e].feature)}else{const t=new Map;t.set(D[e].feature.attributes[T.dr],D[e].feature),o.set(D[e].typeName,t)}r.set(D[e].feature.attributes[T.dr],D[e].feature);const t=(0,b.Ux)(D[e].feature.attributes[T.T1]);this.entityLinkChartDiagramLookup.set(D[e].feature.attributes[T.dr],D[e].feature.attributes[T.T1]?t:null);const a=(0,d.tE)(this.dataManager.inclusionModeDefinition.namedTypeDefinitions,D[e].typeName,(()=>({useAllData:!1,members:new Map})));(0,d.tE)(a.members,D[e].feature.attributes[T.dr],(()=>({id:D[e].feature.attributes[T.dr],linkChartLocation:void 0}))).linkChartLocation=D[e].feature.attributes[T.T1];const{x:i,y:n}=D[e].feature.attributes[T.T1];if(v)A.xmin=Math.min(A.xmin,i),A.xmax=Math.max(A.xmax,i),A.ymin=Math.min(A.ymin,n),A.ymax=Math.max(A.ymax,n);else{const e=1e-7;A.xmin=i-e,A.xmax=i+e,A.ymin=n-e,A.ymax=n+e,v=!0}}if(this.linkChartExtent.xmin=A.xmin,this.linkChartExtent.xmax=A.xmax,this.linkChartExtent.ymin=A.ymin,this.linkChartExtent.ymax=A.ymax,!B)throw new l.A("knowledge-graph:layout-failed","Attempting to retrieve link geometry from diagram engine failed");const j=new Map,Q=new Map,q=new Map,J=new Set;for(let a=0;a<n.length;a++){const i=[],o=n[a],l=o.feature.attributes[T.Cz],p=o.feature.attributes[T.KQ];let u=l+"-"+p;if("chronological-mono-timeline"===e||"chronological-multi-timeline"===e){const e=t?.timeInfoByTypeName?.get(o.typeName),a=t?.timeInfoByTypeName?e?.startField:null,i=a?o.feature.attributes[a]:null,n=e?.endField;u+="-"+i+"-"+(n?o.feature.attributes[n]:null)}const y=P.get(u).get(o.typeName),g=0===y?0:B?.vertexEndIndex[y-1];if(!J.has(y)){if(J.add(y),B.types[y]===I.J.Recursive){const e=[B.vertices[2*g],B.vertices[2*g+1]],t=[B.vertices[2*(g+1)],B.vertices[2*(g+1)+1]],a=[.5*(e[0]+t[0]),.5*(e[1]+t[1])],n=[a[0]-e[0],a[1]-e[1]],o=[a[0]+n[1],a[1]-n[0]],s=[a[0]-n[1],a[1]+n[0]];i.push(e),i.push(o),i.push(t),i.push(s),i.push(e)}else{if(B.types[y]!==I.J.Regular){h.A.getLogger(this).warn("A relationship generated an unsupported link geometry type. It will not be rendered");continue}for(let e=g;e<B.vertexEndIndex[y];e++)i.push([B.vertices[2*e],B.vertices[2*e+1]])}if("chronological-mono-timeline"!==e&&"chronological-multi-timeline"!==e){const e=D[c.get(l)]?.feature.attributes[T.T1],t=D[c.get(p)]?.feature.attributes[T.T1];i[0][0]===e.x&&i[0][1]===e.y||(i[0]=[e.x,e.y]),i[i.length-1][0]===t.x&&i[i.length-1][1]===t.y||(i[i.length-1]=[t.x,t.y])}for(let e=1;e<i.length-1;e++)i[e][1]>85.5?i[e][1]=85.5:i[e][1]<-85.5&&(i[e][1]=-85.5),i[e][0]>179.9999?i[e][0]=179.9999:i[e][0]<-179.9999&&(i[e][0]=-179.9999);j.has(u)?j.get(u).push(i):j.set(u,[i])}const m=j.get(u);Q.has(u)||(Q.set(u,new Map),q.set(u,new Map));const f=Q.get(u),M=q.get(u);f.has(o.typeName)||(f.set(o.typeName,m.shift()),M.set(o.typeName,0));const w=f.get(o.typeName);M.set(o.typeName,M.get(o.typeName)+1);const k=new L.A({paths:[w]});if(o.feature.attributes[T.T1]=k,s.has(o.typeName)){const e=s.get(o.typeName);e?.set(o.feature.attributes[T.dr],o.feature)}else{const e=new Map;e.set(o.feature.attributes[T.dr],o.feature),s.set(o.typeName,e)}r.set(o.feature.attributes[T.dr],o.feature);const C=(0,b.Ux)(o.feature.attributes[T.T1]);this.relationshipLinkChartDiagramLookup.set(o.feature.attributes[T.dr],o.feature.attributes[T.T1]?C:null);const N=(0,d.tE)(this.dataManager.inclusionModeDefinition.namedTypeDefinitions,o.typeName,(()=>({useAllData:!1,members:new Map})));(0,d.tE)(N.members,o.feature.attributes[T.dr],(()=>({id:o.feature.attributes[T.dr],linkChartLocation:void 0}))).linkChartLocation=C}for(const e of n)e.feature.attributes[T.M1]=q.get(e.feature.attributes[T.Cz]+"-"+e.feature.attributes[T.KQ])?.get(e.typeName)??null;return this._currentLinkChartConfig={layoutMode:e,layoutSettings:t?.layoutSettings?.clone()},{nodes:o,links:s,idMap:r}}async applyNewLinkChartLayout(e="organic-standard",t){const a=[];await this._calculateLayoutWithSublayerTimeInfo(e,t),this.layers.forEach((e=>{a.push(e.refreshCachedQueryEngine())})),this.membershipModified=!0,await Promise.all(a),this._refreshNamedTypes()}getCurrentNodeLocations(){const e=new Map;for(const[t,a]of this.dataManager.inclusionModeDefinition?.namedTypeDefinitions.entries()??[])this.dataManager.relationshipTypeNames.has(t)||a?.members?.forEach((t=>{const a=t.linkChartLocation;let i;const n=t.id;a&&(i="x"in a?{x:a.x,y:a.y}:{x:a.coords[0],y:a.coords[1]},e.set(n,new M.A({x:i.x,y:i.y})))}));return e}async refreshLinkChartCache(e){await this.dataManager.refreshCacheContent(e);const t=[];this.layers.forEach((e=>{t.push(e.refreshCachedQueryEngine())})),await Promise.all(t),this._refreshNamedTypes()}async connectBetweenEntities(e,t){if(!e.length)return{records:[]};let a=[];try{let i=[];for(const e of this.dataManager.relationshipTypeNames){const t=this.sublayerIdsCache.get(e);t&&(i=i.concat(Array.from(t.keys())))}a=await this.dataManager.getRelationshipsBetweenNodes(e,i,t),await this._handleNewRecords(a,t),(0,p.Te)(t)}catch(e){throw(0,p.zf)(e)&&this.removeRecords(a),e}return{records:a}}async connectFromEntities(e,t){if(!e.length)return{records:[]};let a=[];try{let i=[];for(const e of this.dataManager.relationshipTypeNames){const t=this.sublayerIdsCache.get(e);t&&(i=i.concat(Array.from(t.keys())))}let n=[];for(const e of this.dataManager.entityTypeNames){const t=this.sublayerIdsCache.get(e);t&&(n=n.concat(Array.from(t)))}a=await this.dataManager.getRelationshipsFromNodes(e,n,i,t),await this._handleNewRecords(a,t),a.length>0&&(this.membershipModified=!0),(0,p.Te)(t)}catch(e){throw(0,p.zf)(e)&&this.removeRecords(a),e}return{records:a}}getCurrentLayout(){return this._currentLinkChartConfig.layoutMode}async _calculateLayoutWithSublayerTimeInfo(e="organic-standard",t){const a=new Map;this.layers.forEach((e=>{a.set(e.objectType.name,e.timeInfo)})),await this.calculateLinkChartLayout(e,{timeInfoByTypeName:a,...t}),this.linkChart?.handleChronologicalOverlay()}async _handleNewRecords(e,t){const a=new Set,i=[],n=this.layers.concat(this.tables);for(const t of e)this._graphTypeLookup.has(t.typeName)&&(!1===n.some((e=>e.objectType.name===t.typeName))&&(this.dataManager.sublayerCaches.set(t.typeName,new Map),a.add(t.typeName)),(0,d.tE)(this.sublayerIdsCache,t.typeName,(()=>new Set)).add(t.id),i.push(t));this.dataManager.addToLayer(i);for(const e of a){const t=this._graphTypeLookup.get(e);if(t){const a=this._createSublayer(t);"entity"===t.type?this.dataManager.entityTypeNames.add(e):this.dataManager.relationshipTypeNames.add(e),a.geometryType?this.layers.push(a):this.tables.push(a)}}await(0,N.qN)(this,Array.from(a),t),await this.dataManager.refreshCacheContent(e.map((e=>e.id)),void 0,void 0,void 0,t);const o={layoutSettings:this._currentLinkChartConfig.layoutSettings,lockedNodeLocations:new Map};for(const[e,t]of this.entityLinkChartDiagramLookup.entries())t&&o.lockedNodeLocations.set(e,new M.A(t.coords[0],t.coords[1]));await this.applyNewLinkChartLayout(this._currentLinkChartConfig.layoutMode,o)}_createSublayers(e,t,a){e.forEach((e=>{const i=this._createSublayer(e);a(i)&&t.push(i),this._updateSublayerCaches(e)}))}_updateSublayers(e,t){t.forEach((t=>{t.parentCompositeLayer=this;const a=e.find((e=>e.type===t.graphType&&e.name===t.graphTypeName));a&&(t.objectType=a,t.read({title:a.name},{origin:"service"}),this._updateSublayerCaches(a))}))}_updateSublayerCaches({name:e}){if(!e)return;const t=this.dataManager.sublayerCaches;t.has(e)||t.set(e,new Map)}_layersLoadedFromAuthoritativeItem(){const e=this.originIdOf("layers");return e>=m.Gr.PORTAL_ITEM&&e<m.Gr.USER}async _initializeDiagram(){this.initializationLinkChartConfig?this.initializationLinkChartConfig.doNotRecalculateLayout?(this.dataManager.inclusionModeDefinition?.namedTypeDefinitions?.forEach(((e,t)=>{e?.members?.forEach((e=>{const a=e.linkChartLocation;let i;const n=e.id;if(!a)return;i="x"in a?{x:a.x,y:a.y}:{x:a.coords[0],y:a.coords[1]};const o=(0,b.Ux)(i);this.dataManager.relationshipTypeNames.has(t)?this.relationshipLinkChartDiagramLookup.set(n,o):this.entityLinkChartDiagramLookup.set(n,o),this.linkChartExtent.xmin>i.x&&(this.linkChartExtent.xmin=i.x),this.linkChartExtent.xmax<i.x&&(this.linkChartExtent.xmax=i.x),this.linkChartExtent.ymin>i.y&&(this.linkChartExtent.ymin=i.y),this.linkChartExtent.ymax<i.y&&(this.linkChartExtent.ymax=i.y)}))})),this.memberRelationshipTypes.forEach((e=>{e.name&&this.dataManager.sublayerCaches.get(e.name)?.forEach((e=>{const t=this.relationshipLinkChartDiagramLookup.get(e.attributes[T.Cz]),a=this.relationshipLinkChartDiagramLookup.get(e.attributes[T.KQ]);if(t&&a){const i=(0,b.Ux)(new L.A({paths:[[[t.coords[0],t.coords[1]],[a.coords[0],a.coords[1]]]]}));this.relationshipLinkChartDiagramLookup.set(e.attributes[T.dr],i)}else this.relationshipLinkChartDiagramLookup.set(e.attributes[T.dr],null)}))}))):await this._calculateLayoutWithSublayerTimeInfo(this.initializationLinkChartConfig.layoutMode,{lockedNodeLocations:this.getCurrentNodeLocations(),...this.initializationLinkChartConfig||{}}):await this._calculateLayoutWithSublayerTimeInfo("organic-standard",{lockedNodeLocations:this.getCurrentNodeLocations()})}_refreshNamedTypes(){for(const e of this.layers)e.emit("refresh",{dataChanged:!0});for(const e of this.tables)e.emit("refresh",{dataChanged:!0})}_validateOrganicLayoutSettings(e,t){const a=e=>"number"==typeof e&&!isNaN(e),n=e=>a(e)&&e>=0,o={};if(!new Set(["organic-standard","organic-community","geographic-organic-standard","chronological-multi-timeline","chronological-mono-timeline"]).has(e)||!t)return o;const{computationBudgetTime:s,autoRepulsionRadius:r,repulsionRadiusMultiplier:l,absoluteIdealEdgeLength:d,multiplicativeIdealEdgeLength:c,idealEdgeLengthType:p}=t;return(e=>a(e)&&e>=1)(s)?o.computationBudgetTime=s:s&&h.A.getLogger(this).warn("Invalid layout computationBudgetTime setting, will revert to default setting"),o.autoRepulsionRadius=r,!r&&(e=>a(e)&&e>=1)(l)?o.repulsionRadiusMultiplier=l:r||(o.autoRepulsionRadius=!0,h.A.getLogger(this).warn("Invalid layout repulsionRadiusMultiplier setting, will revert to default setting")),"geographic-organic-standard"===e&&((e=>Object.values(i).includes(e))(p)?o.idealEdgeLengthType=p:void 0!==p&&h.A.getLogger(this).warn('Invalid layout idealEdgeLengthType setting, will revert to "multiplier" setting'),"absolute-value"===p&&n(d)?o.absoluteIdealEdgeLength=d:"absolute-value"===p&&void 0!==d?h.A.getLogger(this).warn("Invalid layout idealEdgeLength setting, will revert to default setting"):"multiplier"===p&&n(c)?o.multiplicativeIdealEdgeLength=c:"multiplier"===p&&void 0!==c&&h.A.getLogger(this).warn("Invalid layout idealEdgeLength setting, will revert to default setting")),o}_convertValidatedOrganicSettingsToCalculationSettings(e){let t=e.idealEdgeLengthType===i.ABSOLUTE?e.absoluteIdealEdgeLength:e.multiplicativeIdealEdgeLength;return e.idealEdgeLengthType===i.ABSOLUTE&&(void 0===t?t=-1:t*=-1),{computationBudgetTime:e.computationBudgetTime??void 0,repulsionRadiusMultiplier:e.repulsionRadiusMultiplier&&!e.autoRepulsionRadius?e.repulsionRadiusMultiplier:void 0,idealEdgeLengthMultiplier:t}}_createSublayer(e){return new C.A({objectType:e,parentCompositeLayer:this,graphType:e.type})}_handleSublayersChange(e,t){t&&(t.forEach((e=>{e.parent=null})),this.removeHandles("sublayers-owner")),e&&(e.forEach((e=>{e.parent=this})),this.addHandles([e.on("after-add",(({item:e})=>{e.parent=this})),e.on("after-remove",(({item:e})=>{e.parent=null}))],"sublayers-owner"))}_alignLayersDataModelAndInclusionDefinition(e){const t=new Set((e.entityTypes??[]).map((e=>e.name)).concat((e.relationshipTypes??[]).map((e=>e.name)))),a=new Set((e.entityTypes??[]).map((e=>e.name))),i=new Set((e.relationshipTypes??[]).map((e=>e.name)));if(this.layers){for(const e of this.layers)!e.graphType&&t.has(e.graphTypeName)&&(e.graphType=a.has(e.graphTypeName)?"entity":"relationship");const e=this.layers.filter((e=>t.has(e.graphTypeName)&&("entity"===e.graphType?a.has(e.graphTypeName):i.has(e.graphTypeName))));this.setAtOrigin("layers",e,(0,m.OL)(this.originIdOf("layers")))}else this.layers=new r.A;if(this.layers&&this._originalInclusionList){const e=new Set(this._originalInclusionList.namedTypeDefinitions.keys()),t=this.tables?.map((e=>e.graphTypeName))??[],a=this.layers.map((e=>e.graphTypeName)).concat(t);for(const t of a)e.has(t)||this._originalInclusionList.namedTypeDefinitions.set(t,{useAllData:!1,members:new Map});const i=[];for(const e of this._originalInclusionList.namedTypeDefinitions.keys())a.includes(e)||(h.A.getLogger(this).warn(`A named type, ${e}, was in the serialized feature collection but did not have a sublayer config in the item, so will be removed`),i.push(e));for(const e of i)this._originalInclusionList.namedTypeDefinitions.delete(e)}}};(0,o._)([(0,y.MZ)(_.OZ)],R.prototype,"url",void 0),(0,o._)([(0,y.MZ)()],R.prototype,"dataPreloadedInLocalCache",void 0),(0,o._)([(0,y.MZ)()],R.prototype,"initializationLinkChartConfig",void 0),(0,o._)([(0,y.MZ)()],R.prototype,"membershipModified",void 0),(0,o._)([(0,y.MZ)()],R.prototype,"dataManager",void 0),(0,o._)([(0,y.MZ)()],R.prototype,"initializationInclusionModeDefinition",null),(0,o._)([(0,y.MZ)()],R.prototype,"knowledgeGraph",void 0),(0,o._)([(0,y.MZ)({type:r.A.ofType(C.A),json:{write:{ignoreOrigin:!0}}})],R.prototype,"layers",void 0),(0,o._)([(0,y.MZ)({readOnly:!0})],R.prototype,"linkChart",null),(0,o._)([(0,y.MZ)()],R.prototype,"entityLinkChartDiagramLookup",void 0),(0,o._)([(0,y.MZ)()],R.prototype,"relationshipLinkChartDiagramLookup",void 0),(0,o._)([(0,y.MZ)()],R.prototype,"linkChartExtent",void 0),(0,o._)([(0,y.MZ)()],R.prototype,"memberEntityTypes",void 0),(0,o._)([(0,y.MZ)()],R.prototype,"memberRelationshipTypes",void 0),(0,o._)([(0,y.MZ)({type:["LinkChartLayer"]})],R.prototype,"operationalLayerType",void 0),(0,o._)([(0,y.MZ)()],R.prototype,"sublayerIdsCache",void 0),(0,o._)([(0,y.MZ)({type:r.A.ofType(C.A),json:{write:{ignoreOrigin:!0}}})],R.prototype,"tables",void 0),(0,o._)([(0,y.MZ)({json:{read:!1}})],R.prototype,"type",void 0),(0,o._)([(0,y.MZ)({json:{read:!1}})],R.prototype,"chronologicalAuxiliaryGraphics",void 0),R=(0,o._)([(0,g.$)("esri.layers.LinkChartLayer")],R);const z=R}}]);