@arcgis/core 5.1.0-next.113 → 5.1.0-next.114

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 (204) hide show
  1. package/Graphic.d.ts +1 -0
  2. package/assets/esri/core/workers/RemoteClient.js +1 -1
  3. package/assets/esri/core/workers/chunks/{31a8bc25aa1441c70caa.js → 009250a7bded12099dd1.js} +1 -1
  4. package/assets/esri/core/workers/chunks/019a4fe7e085b2fc6ae9.js +1 -0
  5. package/assets/esri/core/workers/chunks/023837e5d9d2b6af66d8.js +1 -0
  6. package/assets/esri/core/workers/chunks/{a001e7e8a39f27284d87.js → 03c46880b69ce75a010f.js} +1 -1
  7. package/assets/esri/core/workers/chunks/0a530fbbb4486c670ea2.js +1 -0
  8. package/assets/esri/core/workers/chunks/{14b7b55c42af65ffa024.js → 0bd2b035c6ee89c725f9.js} +1 -1
  9. package/assets/esri/core/workers/chunks/0ded5c114cbb7574f2f4.js +1 -0
  10. package/assets/esri/core/workers/chunks/{b432a5a829e309837db6.js → 0e549d942d6cba1608cf.js} +1 -1
  11. package/assets/esri/core/workers/chunks/{7dafe608c224b9d48ffa.js → 115664cb7d7b22a315bb.js} +1 -1
  12. package/assets/esri/core/workers/chunks/123a67e84ed68b96ac59.js +1 -0
  13. package/assets/esri/core/workers/chunks/14a241b07baa67743248.js +1 -0
  14. package/assets/esri/core/workers/chunks/{054ae729e7cefa2c7778.js → 170f8dc97614e9609443.js} +1 -1
  15. package/assets/esri/core/workers/chunks/179ffa2168c42615ccf2.js +1 -0
  16. package/assets/esri/core/workers/chunks/{4a65bc9091d7ea7e80df.js → 19f07c8d0f32ec889861.js} +1 -1
  17. package/assets/esri/core/workers/chunks/{ca92176d5348e2c533d7.js → 224a9f39876aa426a9bc.js} +1 -1
  18. package/assets/esri/core/workers/chunks/{0550dc63b6b1274242b8.js → 27d7c701306efeea6b82.js} +1 -1
  19. package/assets/esri/core/workers/chunks/{8aac1155b8ac071cd2ad.js → 2855357a2c1f2ab03fb7.js} +1 -1
  20. package/assets/esri/core/workers/chunks/{33329f5d88e60b4ec568.js → 2a8f198f6c272f92bad5.js} +1 -1
  21. package/assets/esri/core/workers/chunks/{cb3004998eff7c60930e.js → 2b2a09ce14d00b4b1187.js} +1 -1
  22. package/assets/esri/core/workers/chunks/{5d60253ea3d247cdb3d1.js → 2bdfae998371e3aa9f2d.js} +1 -1
  23. package/assets/esri/core/workers/chunks/2f99a95facddc44319a9.js +1 -0
  24. package/assets/esri/core/workers/chunks/{bd17ac2e6f1eb8cf7abf.js → 2fa080539d039c92ce08.js} +1 -1
  25. package/assets/esri/core/workers/chunks/{ee635172be7fdea69367.js → 3109b05fe4fc40d4f25b.js} +1 -1
  26. package/assets/esri/core/workers/chunks/{92db9a6d273ae2862883.js → 315bf08dff4757ffbed3.js} +1 -1
  27. package/assets/esri/core/workers/chunks/{593772bd8b19ac664b29.js → 35527a01d61cabbfd33e.js} +1 -1
  28. package/assets/esri/core/workers/chunks/{52a91c314afec70199bc.js → 39987c06636e757d1f00.js} +1 -1
  29. package/assets/esri/core/workers/chunks/41074d383af3662673ca.js +1 -0
  30. package/assets/esri/core/workers/chunks/49675e77a351abda2728.js +1 -0
  31. package/assets/esri/core/workers/chunks/4bfeac7338df9e0b7ce1.js +1 -0
  32. package/assets/esri/core/workers/chunks/4ffcca40e7aa24c8cc35.js +1 -0
  33. package/assets/esri/core/workers/chunks/534dd93c72ea448ee908.js +1 -0
  34. package/assets/esri/core/workers/chunks/{2dc2487d05381de07e3f.js → 548c34ea88f113d03c93.js} +1 -1
  35. package/assets/esri/core/workers/chunks/{77ac243d4dcd901c2eec.js → 621d71d26bd20e296138.js} +1 -1
  36. package/assets/esri/core/workers/chunks/{7e203e947846d40f897e.js → 67dffb896b6ef4b2038b.js} +1 -1
  37. package/assets/esri/core/workers/chunks/6920e7f700a9ba280dba.js +1 -0
  38. package/assets/esri/core/workers/chunks/696967c8c6f53b94f851.js +1 -0
  39. package/assets/esri/core/workers/chunks/6b1f2b36bdc6b2ff2ea5.js +1 -0
  40. package/assets/esri/core/workers/chunks/7014e73dfd3c8baa704c.js +1 -0
  41. package/assets/esri/core/workers/chunks/75dfdd85abbac26ac899.js +1 -0
  42. package/assets/esri/core/workers/chunks/76a9b64fd573775bf6cd.js +1 -0
  43. package/assets/esri/core/workers/chunks/798c4d3201fcc9f2a42b.js +1 -0
  44. package/assets/esri/core/workers/chunks/{6c79e8e840c1d027fbb2.js → 7e0daf0864005cdd63c5.js} +1 -1
  45. package/assets/esri/core/workers/chunks/{c0c693c2e0043ecba4a5.js → 817fd88fe9a48caf69fb.js} +1 -1
  46. package/assets/esri/core/workers/chunks/82f7d83a2073d1b0111c.js +1 -0
  47. package/assets/esri/core/workers/chunks/8795c4895df229cb471c.js +1 -0
  48. package/assets/esri/core/workers/chunks/{7bc746ea17f4e336e0b0.js → 8b5ee6be52e892fbd325.js} +1 -1
  49. package/assets/esri/core/workers/chunks/927c8ca7fd385b28a1b7.js +640 -0
  50. package/assets/esri/core/workers/chunks/942e527b9b92999886c7.js +1 -0
  51. package/assets/esri/core/workers/chunks/961995d8da45a9203255.js +1 -0
  52. package/assets/esri/core/workers/chunks/{eb1d6614eeac6d26bb9c.js → 9a3344f1dd22c425b8cc.js} +1 -1
  53. package/assets/esri/core/workers/chunks/9a6e62ef984e9c5babc4.js +1 -0
  54. package/assets/esri/core/workers/chunks/a0b6eef4890cc61609dc.js +1 -0
  55. package/assets/esri/core/workers/chunks/{f37be7e517f0892014e3.js → a320c69bc7528ff0d0cf.js} +1 -1
  56. package/assets/esri/core/workers/chunks/{660713adb5a845dfa2ef.js → a40003dfe3c081d1a1d2.js} +1 -1
  57. package/assets/esri/core/workers/chunks/b5937ce657c1fff3864f.js +1 -0
  58. package/assets/esri/core/workers/chunks/{63ea9035dcf9ce45560c.js → b684ff4bc93bd60d6a19.js} +1 -1
  59. package/assets/esri/core/workers/chunks/b7a0a5b895ddd2d3d038.js +1 -0
  60. package/assets/esri/core/workers/chunks/{f3161c47a572194f6017.js → c06ae3a6ecc4a4fc67b2.js} +1 -1
  61. package/assets/esri/core/workers/chunks/{970e91de5dfbbc247afb.js → c5b7ff8650235c464dbf.js} +1 -1
  62. package/assets/esri/core/workers/chunks/c8dedc010fcc2382af24.js +1 -0
  63. package/assets/esri/core/workers/chunks/cd2b2babcdc130b4c368.js +1 -0
  64. package/assets/esri/core/workers/chunks/{5a6523c903b11dea77d4.js → cdef9c3f80588ae45a04.js} +1 -1
  65. package/assets/esri/core/workers/chunks/{e973cab79ec2541cb81b.js → d19600336cb6023d3e34.js} +1 -1
  66. package/assets/esri/core/workers/chunks/{34c11e7c8762fe0c19fb.js → d39f5590022d910ee951.js} +1 -1
  67. package/assets/esri/core/workers/chunks/d412a43060441d347fb4.js +1 -0
  68. package/assets/esri/core/workers/chunks/{01c70c27aa3a955e2928.js → d41b847d08c42e5329d6.js} +2 -2
  69. package/assets/esri/core/workers/chunks/{10491b5b106bc5ad0b2b.js → d66f68a811c90739951a.js} +1 -1
  70. package/assets/esri/core/workers/chunks/d8c2bed12f937228c763.js +1 -0
  71. package/assets/esri/core/workers/chunks/de916dd0c11aefb6832e.js +1 -0
  72. package/assets/esri/core/workers/chunks/{63513e706fe55a1def15.js → e227ae2c1a63e30e62d9.js} +1 -1
  73. package/assets/esri/core/workers/chunks/{e4c350dc65aae121171d.js → e29d182460564c2a52ad.js} +1 -1
  74. package/assets/esri/core/workers/chunks/e87d02af6d6b05e19d93.js +1 -0
  75. package/assets/esri/core/workers/chunks/f0b5c140a5ba174572b6.js +1 -0
  76. package/assets/esri/core/workers/chunks/{ce3b5b83237cf37ff523.js → f286680e363eefdf27df.js} +1 -1
  77. package/assets/esri/core/workers/chunks/f7698c855800e0af3038.js +1 -0
  78. package/assets/esri/core/workers/chunks/f931d560f3f14598f454.js +1 -0
  79. package/assets/esri/core/workers/chunks/{9890c85a238879490926.js → f9f331c76c96743d8522.js} +1 -1
  80. package/assets/esri/core/workers/chunks/fcbacca99c5a3ee5b69a.js +1 -0
  81. package/assets/esri/rest/knowledgeGraph/wasmInterface/arcgis-knowledge-client-core-simd.wasm +0 -0
  82. package/assets/esri/rest/knowledgeGraph/wasmInterface/arcgis-knowledge-client-core.wasm +0 -0
  83. package/assets/esri/widgets/BasemapGallery/t9n/BasemapGallery.json +1 -1
  84. package/assets/esri/widgets/BasemapGallery/t9n/BasemapGallery_en.json +1 -1
  85. package/assets/esri/widgets/BatchAttributeForm/t9n/BatchAttributeForm.json +1 -1
  86. package/assets/esri/widgets/BatchAttributeForm/t9n/BatchAttributeForm_en.json +1 -1
  87. package/chunks/Path.glsl.js +22 -17
  88. package/config.js +1 -1
  89. package/geometry/support/DoubleArray.js +1 -1
  90. package/geometry/support/Indices.js +1 -1
  91. package/kernel.js +1 -1
  92. package/layers/DimensionLayer.d.ts +22 -0
  93. package/layers/FeatureLayer.d.ts +15 -12
  94. package/layers/FeatureLayer.js +1 -1
  95. package/layers/GaussianSplatLayer.d.ts +22 -0
  96. package/layers/LineOfSightLayer.d.ts +22 -0
  97. package/layers/Lyr3DWasmPerSceneView.js +1 -1
  98. package/layers/PointCloudLayer.d.ts +22 -0
  99. package/layers/ViewshedLayer.d.ts +22 -0
  100. package/layers/support/Field.d.ts +1 -0
  101. package/layers/support/Field.js +1 -1
  102. package/layers/support/SceneModification.js +1 -1
  103. package/layers/support/types.d.ts +1 -1
  104. package/layers/types.d.ts +1 -0
  105. package/package.json +1 -1
  106. package/rest/support/Query.d.ts +1 -0
  107. package/support/revision.js +1 -1
  108. package/symbols/cim/animationUtils.js +1 -1
  109. package/symbols/cim/defaultCIMValues.js +1 -1
  110. package/views/2d/engine/vectorTiles/VectorTileContainer.js +1 -1
  111. package/views/2d/engine/webgl/animations/instructions.js +1 -1
  112. package/views/2d/engine/webgl/shaders/sources/shaderRepository.js +1 -1
  113. package/views/2d/layers/FeatureLikeLayerView2D.js +1 -1
  114. package/views/2d/layers/features/layerAdapters/CatalogFootprintLayerAdapter.js +1 -1
  115. package/views/2d/layers/features/layerAdapters/DimensionLayerAdapter.js +1 -1
  116. package/views/2d/layers/features/layerAdapters/FeatureLayerAdapter.js +1 -1
  117. package/views/2d/layers/features/layerAdapters/InMemoryLayerAdapter.js +1 -1
  118. package/views/2d/layers/features/layerAdapters/KnowledgeGraphSublayerAdapter.js +1 -1
  119. package/views/2d/layers/features/layerAdapters/OGCFeatureLayerAdapter.js +1 -1
  120. package/views/2d/layers/features/layerAdapters/OrientedImageryLayerAdapter.js +1 -1
  121. package/views/2d/layers/features/layerAdapters/ParquetLayerAdapter.js +1 -1
  122. package/views/2d/layers/features/layerAdapters/StreamLayerAdapter.js +1 -1
  123. package/views/2d/layers/features/layerAdapters/SubtypeGroupLayerAdapter.js +1 -1
  124. package/views/2d/support/clippingUtils.js +1 -1
  125. package/views/2d/support/hitTestUtils.js +1 -1
  126. package/views/3d/analysis/ShadowCast/ShadowCastTooltip.js +1 -1
  127. package/views/3d/input/SceneInputManager.js +1 -1
  128. package/views/3d/layers/IntegratedMesh3DTilesLayerView3D.js +1 -1
  129. package/views/3d/layers/IntegratedMesh3DTilesLayerWorkerHandle.js +1 -1
  130. package/views/3d/layers/graphics/Graphics3DExtrudeSymbolLayer.js +1 -1
  131. package/views/3d/layers/graphics/Graphics3DPathSymbolLayer.js +1 -1
  132. package/views/3d/layers/graphics/Graphics3DPolygonFillSymbolLayer.js +1 -1
  133. package/views/3d/layers/graphics/Graphics3DSymbolLayer.js +1 -1
  134. package/views/3d/layers/graphics/extrudeUtils.js +1 -1
  135. package/views/3d/layers/graphics/tessellationUtils.js +1 -1
  136. package/views/3d/support/engineContent/line.js +1 -1
  137. package/views/3d/support/renderInfoUtils/polygon.js +1 -1
  138. package/views/3d/webgl-engine/core/shaderLibrary/TextureBackedBufferFields.glsl.js +3 -3
  139. package/views/3d/webgl-engine/core/shaderLibrary/attributes/PathEvaluate.glsl.js +233 -0
  140. package/views/3d/webgl-engine/core/shaderLibrary/attributes/PathVertexInfo.glsl.js +19 -0
  141. package/views/3d/webgl-engine/core/shaderLibrary/attributes/PathVertexPosition.glsl.js +64 -40
  142. package/views/3d/webgl-engine/core/shaderModules/Float2sPassUniform.js +2 -0
  143. package/views/3d/webgl-engine/core/shaderModules/IntegersPassUniform.js +2 -0
  144. package/views/3d/webgl-engine/lib/PathBuilder.js +1 -1
  145. package/views/3d/webgl-engine/lib/PathEvaluator.js +1 -1
  146. package/views/3d/webgl-engine/lib/PathExtruder.js +1 -1
  147. package/views/3d/webgl-engine/lib/PathGeometryData.js +1 -1
  148. package/views/3d/webgl-engine/lib/PathProfile.js +1 -1
  149. package/views/3d/webgl-engine/lib/TextureBackedBuffer/TextureBackedBufferFieldCreation.js +1 -1
  150. package/views/3d/webgl-engine/materials/PathLayouts.js +1 -1
  151. package/views/3d/webgl-engine/materials/PathMaterial.js +1 -1
  152. package/views/3d/webgl-engine/materials/PathTechniqueConfiguration.js +1 -1
  153. package/views/3d/webgl-engine/materials/internal/bufferWriterUtils.js +1 -1
  154. package/views/View2D.d.ts +1 -1
  155. package/views/draw/DrawTool.d.ts +34 -1
  156. package/views/input/EventMatch.js +1 -1
  157. package/widgets/BatchAttributeForm/templates/support/createBatchFormTemplate.js +1 -1
  158. package/widgets/BatchAttributeForm.js +1 -1
  159. package/widgets/Directions/DirectionsViewModel.js +1 -1
  160. package/widgets/Directions.js +1 -1
  161. package/widgets/FeatureTable/FeatureTableViewModel.d.ts +7 -1
  162. package/widgets/FeatureTable/FeatureTableViewModel.js +1 -1
  163. package/widgets/FeatureTable/support/FeatureStore.js +1 -1
  164. package/widgets/FeatureTable/support/types.d.ts +11 -1
  165. package/widgets/FeatureTable.d.ts +7 -1
  166. package/widgets/FeatureTable.js +1 -1
  167. package/assets/esri/core/workers/chunks/02c0640005b09007bb70.js +0 -1
  168. package/assets/esri/core/workers/chunks/0c8e6ccb5a8174718d62.js +0 -640
  169. package/assets/esri/core/workers/chunks/13f0e08de2dfab07d212.js +0 -1
  170. package/assets/esri/core/workers/chunks/1c0e8808d14d8e6dde2c.js +0 -1
  171. package/assets/esri/core/workers/chunks/1c8c8050d60205cf2156.js +0 -1
  172. package/assets/esri/core/workers/chunks/23119a1b1310b7dab2aa.js +0 -1
  173. package/assets/esri/core/workers/chunks/282f3d364411efac7b80.js +0 -1
  174. package/assets/esri/core/workers/chunks/2ffffc1931b2e27c6617.js +0 -1
  175. package/assets/esri/core/workers/chunks/313a89b334e3518d30a4.js +0 -1
  176. package/assets/esri/core/workers/chunks/389e57aab12d52d72695.js +0 -1
  177. package/assets/esri/core/workers/chunks/3fed503185ea1913fb84.js +0 -1
  178. package/assets/esri/core/workers/chunks/4020f95d8131493f799e.js +0 -1
  179. package/assets/esri/core/workers/chunks/4255ad7601c7a7621b71.js +0 -1
  180. package/assets/esri/core/workers/chunks/453c3b265481c80fc625.js +0 -1
  181. package/assets/esri/core/workers/chunks/4a41f98210f1da3b5041.js +0 -1
  182. package/assets/esri/core/workers/chunks/4afe76de6e82e86fe697.js +0 -1
  183. package/assets/esri/core/workers/chunks/5a85cbc04c64091d7f46.js +0 -1
  184. package/assets/esri/core/workers/chunks/5e5c7cc74ff1c9603aff.js +0 -1
  185. package/assets/esri/core/workers/chunks/601edefd8da4eb2eda28.js +0 -1
  186. package/assets/esri/core/workers/chunks/6f02681bcaa9bef501fc.js +0 -1
  187. package/assets/esri/core/workers/chunks/7b66691d133dabd87ce6.js +0 -1
  188. package/assets/esri/core/workers/chunks/7c077e1a63ab97bf3e87.js +0 -1
  189. package/assets/esri/core/workers/chunks/7dc9ff66e1eceadbae24.js +0 -1
  190. package/assets/esri/core/workers/chunks/85a200aecc7a844c9566.js +0 -1
  191. package/assets/esri/core/workers/chunks/958617c3a9854ea04e06.js +0 -1
  192. package/assets/esri/core/workers/chunks/a5b9ae4c93f9af7589f2.js +0 -1
  193. package/assets/esri/core/workers/chunks/a93a058678c8c8996d54.js +0 -1
  194. package/assets/esri/core/workers/chunks/acb8cff06142f828fb78.js +0 -1
  195. package/assets/esri/core/workers/chunks/b4badbcf1bdb7823d825.js +0 -1
  196. package/assets/esri/core/workers/chunks/b891d95b7858665cd6c1.js +0 -1
  197. package/assets/esri/core/workers/chunks/c91d4f1b42cfe474df52.js +0 -1
  198. package/assets/esri/core/workers/chunks/d33a08e5f589355c57a3.js +0 -1
  199. package/assets/esri/core/workers/chunks/dd29fd1b3da90d3ca6b1.js +0 -1
  200. package/assets/esri/core/workers/chunks/e393fd61deb2e7f22ee6.js +0 -1
  201. package/assets/esri/core/workers/chunks/e8518bd3596543b387f8.js +0 -1
  202. package/assets/esri/core/workers/chunks/ee56290e600cbeb25a00.js +0 -1
  203. package/assets/esri/core/workers/chunks/f91a2c69a93295cf4de6.js +0 -1
  204. package/assets/esri/core/workers/chunks/fec3fffcf854a6226df4.js +0 -1
@@ -1,2 +1,2 @@
1
1
  /* COPYRIGHT Esri - https://js.arcgis.com/5.1/LICENSE.txt */
2
- import{__decorate as e}from"tslib";import{parameter as o}from"../core/shaderTechnique/ShaderTechniqueConfiguration.js";import{TriangleTechniqueConfiguration as t}from"./TriangleTechniqueConfiguration.js";class i extends t{constructor(e){super(),this.spherical=e,this.pbrMode=0,this.doubleSidedMode=0,this.emissionSource=0,this.receiveShadows=!1,this.hasShadowHighlights=!1,this.receiveAmbientOcclusion=!1,this.hasVVSize=!1,this.hasVVColor=!1,this.hasVVOpacity=!1,this.hasOccludees=!1,this.snowCover=!1,this.receiveGlobalIllumination=!1,this.supportNaN=!0,this.textureCoordinateType=0,this.hasVVInstancing=!1,this.useCustomDTRExponentForWater=!1,this.useFillLights=!1,this.hasColorTexture=!1,this.hasMetallicRoughnessTexture=!1,this.hasOcclusionTexture=!1,this.hasNormalTexture=!1,this.draped=!1,this.overlayEnabled=!1}get discardInvisibleFragments(){return this.transparent}}e([o({count:7})],i.prototype,"pbrMode",void 0),e([o({count:3})],i.prototype,"doubleSidedMode",void 0),e([o({count:8})],i.prototype,"emissionSource",void 0),e([o()],i.prototype,"receiveShadows",void 0),e([o()],i.prototype,"hasShadowHighlights",void 0),e([o()],i.prototype,"receiveAmbientOcclusion",void 0),e([o()],i.prototype,"hasVVSize",void 0),e([o()],i.prototype,"hasVVColor",void 0),e([o()],i.prototype,"hasVVOpacity",void 0),e([o()],i.prototype,"hasOccludees",void 0),e([o()],i.prototype,"snowCover",void 0),e([o()],i.prototype,"receiveGlobalIllumination",void 0);export{i as PathTechniqueConfiguration};
2
+ import{__decorate as o}from"tslib";import{parameter as t}from"../core/shaderTechnique/ShaderTechniqueConfiguration.js";import{TriangleTechniqueConfiguration as e}from"./TriangleTechniqueConfiguration.js";class i extends e{constructor(o){super(),this.spherical=o,this.pbrMode=0,this.doubleSidedMode=0,this.emissionSource=0,this.upVectorAlignment=0,this.pathCapType=3,this.pathProfileType=0,this.receiveShadows=!1,this.hasShadowHighlights=!1,this.receiveAmbientOcclusion=!1,this.hasVVSize=!1,this.hasVVColor=!1,this.hasVVOpacity=!1,this.hasOccludees=!1,this.snowCover=!1,this.receiveGlobalIllumination=!1,this.supportNaN=!0,this.textureCoordinateType=0,this.hasVVInstancing=!1,this.useCustomDTRExponentForWater=!1,this.useFillLights=!1,this.hasColorTexture=!1,this.hasMetallicRoughnessTexture=!1,this.hasOcclusionTexture=!1,this.hasNormalTexture=!1,this.draped=!1,this.overlayEnabled=!1}get discardInvisibleFragments(){return this.transparent}}o([t({count:7})],i.prototype,"pbrMode",void 0),o([t({count:3})],i.prototype,"doubleSidedMode",void 0),o([t({count:8})],i.prototype,"emissionSource",void 0),o([t({count:2})],i.prototype,"upVectorAlignment",void 0),o([t({count:4})],i.prototype,"pathCapType",void 0),o([t({count:2})],i.prototype,"pathProfileType",void 0),o([t()],i.prototype,"receiveShadows",void 0),o([t()],i.prototype,"hasShadowHighlights",void 0),o([t()],i.prototype,"receiveAmbientOcclusion",void 0),o([t()],i.prototype,"hasVVSize",void 0),o([t()],i.prototype,"hasVVColor",void 0),o([t()],i.prototype,"hasVVOpacity",void 0),o([t()],i.prototype,"hasOccludees",void 0),o([t()],i.prototype,"snowCover",void 0),o([t()],i.prototype,"receiveGlobalIllumination",void 0);export{i as PathTechniqueConfiguration};
@@ -1,2 +1,2 @@
1
1
  /* COPYRIGHT Esri - https://js.arcgis.com/5.1/LICENSE.txt */
2
- import{subtract as e,length as t,scale as f}from"../../../../../core/libs/gl-matrix-2/math/vec3.js";import{create as o}from"../../../../../core/libs/gl-matrix-2/factories/vec3f64.js";import{isOrthoNormal as r,hasIdentityRotation as i}from"../../../../../core/libs/gl-matrix-2/math/mat4.js";import{BufferViewVec4u8 as s,BufferViewVec3f16 as n,BufferViewVec3f as c,BufferViewVec4f16 as l,BufferViewVec4f as d,BufferViewFloat as u,BufferViewVec2i16 as a,BufferViewVec2f16 as p,BufferViewVec2f as g}from"../../../../../geometry/support/buffer/BufferView.js";import{assert as b}from"../../lib/Util.js";function y(e,t,f,o=1){const{data:r,indices:i}=e,s=t.typedBuffer,n=t.typedBufferStride,c=i.length;if(f*=n,1===o)for(let l=0;l<c;++l)s[f]=r[i[l]],f+=n;else for(let l=0;l<c;++l){const e=r[i[l]];for(let t=0;t<o;t++)s[f]=e,f+=n}}function B(e,t,f){const{data:o,indices:r}=e,i=t.typedBuffer,s=t.typedBufferStride,n=r.length;f*=s;for(let c=0;c<n;++c){const e=2*r[c];i[f]=o[e],i[f+1]=o[e+1],f+=s}}function h(e,t,f,o=1){const{data:r,indices:i}=e,s=t.typedBuffer,n=t.typedBufferStride,c=i.length;if(f*=n,1===o)for(let l=0;l<c;++l){const e=3*i[l];s[f]=r[e],s[f+1]=r[e+1],s[f+2]=r[e+2],f+=n}else for(let l=0;l<c;++l){const e=3*i[l];for(let t=0;t<o;++t)s[f]=r[e],s[f+1]=r[e+1],s[f+2]=r[e+2],f+=n}}function m(e,t,f,o=1){const{data:r,indices:i}=e,s=t.typedBuffer,n=t.typedBufferStride,c=i.length;if(f*=n,1===o)for(let l=0;l<c;++l){const e=4*i[l];s[f]=r[e],s[f+1]=r[e+1],s[f+2]=r[e+2],s[f+3]=r[e+3],f+=n}else for(let l=0;l<c;++l){const e=4*i[l];for(let t=0;t<o;++t)s[f]=r[e],s[f+1]=r[e+1],s[f+2]=r[e+2],s[f+3]=r[e+3],f+=n}}function F(e,t,f){const o=e.typedBuffer,r=e.typedBufferStride,i=e.elementCount;t*=r;for(let s=0;s<f;++s){for(let e=0;e<i;++e)o[t+e]=0;t+=r}}function v(e,t,f){const{data:o,indices:r}=e,i=t.typedBuffer,s=t.typedBufferStride,n=r.length;f*=s;for(let c=0;c<n;++c){const e=9*r[c];for(let t=0;t<9;++t)i[f+t]=o[e+t];f+=s}}function z(e,t,f){const{data:o,indices:r}=e,i=t.typedBuffer,s=t.typedBufferStride,n=r.length;f*=s;for(let c=0;c<n;++c){const e=16*r[c];for(let t=0;t<16;++t)i[f+t]=o[e+t];f+=s}}function w(e,t,f,o,r=1){if(!t)return void h(e,f,o,r);const{data:s,indices:n}=e,c=f.typedBuffer,l=f.typedBufferStride,d=n.length,u=t[0],a=t[1],p=t[2],g=t[4],b=t[5],y=t[6],B=t[8],m=t[9],F=t[10],v=t[12],z=t[13],w=t[14];o*=l;let S=0,k=0,N=0;const $=i(t)?e=>{S=s[e]+v,k=s[e+1]+z,N=s[e+2]+w}:e=>{const t=s[e],f=s[e+1],o=s[e+2];S=u*t+g*f+B*o+v,k=a*t+b*f+m*o+z,N=p*t+y*f+F*o+w};if(1===r)for(let i=0;i<d;++i)$(3*n[i]),c[o]=S,c[o+1]=k,c[o+2]=N,o+=l;else for(let i=0;i<d;++i){$(3*n[i]);for(let e=0;e<r;++e)c[o]=S,c[o+1]=k,c[o+2]=N,o+=l}}function S(e,t,f,o,s=1){if(!t)return void h(e,f,o,s);const{data:n,indices:c}=e,l=t,d=f.typedBuffer,u=f.typedBufferStride,a=c.length,p=l[0],g=l[1],b=l[2],y=l[4],B=l[5],m=l[6],F=l[8],v=l[9],z=l[10],w=!r(l),S=1e-6,k=1-S;o*=u;let N=0,$=0,x=0;const A=i(l)?e=>{N=n[e],$=n[e+1],x=n[e+2]}:e=>{const t=n[e],f=n[e+1],o=n[e+2];N=p*t+y*f+F*o,$=g*t+B*f+v*o,x=b*t+m*f+z*o};if(1===s)if(w)for(let r=0;r<a;++r){A(3*c[r]);const e=N*N+$*$+x*x;if(e<k&&e>S){const t=1/Math.sqrt(e);d[o]=N*t,d[o+1]=$*t,d[o+2]=x*t}else d[o]=N,d[o+1]=$,d[o+2]=x;o+=u}else for(let r=0;r<a;++r)A(3*c[r]),d[o]=N,d[o+1]=$,d[o+2]=x,o+=u;else for(let r=0;r<a;++r){if(A(3*c[r]),w){const e=N*N+$*$+x*x;if(e<k&&e>S){const t=1/Math.sqrt(e);N*=t,$*=t,x*=t}}for(let e=0;e<s;++e)d[o]=N,d[o+1]=$,d[o+2]=x,o+=u}}function k(e,t,f,o,i=1){if(!t)return void m(e,f,o,i);const{data:s,indices:n}=e,c=t,l=f.typedBuffer,d=f.typedBufferStride,u=n.length,a=c[0],p=c[1],g=c[2],b=c[4],y=c[5],B=c[6],h=c[8],F=c[9],v=c[10],z=!r(c),w=1e-6,S=1-w;if(o*=d,1===i)for(let r=0;r<u;++r){const e=4*n[r],t=s[e],f=s[e+1],i=s[e+2],c=s[e+3];let u=a*t+b*f+h*i,m=p*t+y*f+F*i,k=g*t+B*f+v*i;if(z){const e=u*u+m*m+k*k;if(e<S&&e>w){const t=1/Math.sqrt(e);u*=t,m*=t,k*=t}}l[o]=u,l[o+1]=m,l[o+2]=k,l[o+3]=c,o+=d}else for(let r=0;r<u;++r){const e=4*n[r],t=s[e],f=s[e+1],c=s[e+2],u=s[e+3];let m=a*t+b*f+h*c,k=p*t+y*f+F*c,N=g*t+B*f+v*c;if(z){const e=m*m+k*k+N*N;if(e<S&&e>w){const t=1/Math.sqrt(e);m*=t,k*=t,N*=t}}for(let r=0;r<i;++r)l[o]=m,l[o+1]=k,l[o+2]=N,l[o+3]=u,o+=d}}function N(e,t,f,o,r=1){const{data:i,indices:s}=e,n=f.typedBuffer,c=f.typedBufferStride,l=s.length;if(o*=c,t===i.length&&4===t){n[o]=i[0],n[o+1]=i[1],n[o+2]=i[2],n[o+3]=i[3];const e=new Uint32Array(f.typedBuffer.buffer,f.start),t=c/4,s=e[o/=4];o+=t;const d=l*r;for(let f=1;f<d;++f)e[o]=s,o+=t;return}if(1!==r)if(4!==t)for(let d=0;d<l;++d){const e=3*s[d];for(let t=0;t<r;++t)n[o]=i[e],n[o+1]=i[e+1],n[o+2]=i[e+2],n[o+3]=255,o+=c}else for(let d=0;d<l;++d){const e=4*s[d];for(let t=0;t<r;++t)n[o]=i[e],n[o+1]=i[e+1],n[o+2]=i[e+2],n[o+3]=i[e+3],o+=c}else{if(4===t){for(let e=0;e<l;++e){const t=4*s[e];n[o]=i[t],n[o+1]=i[t+1],n[o+2]=i[t+2],n[o+3]=i[t+3],o+=c}return}for(let e=0;e<l;++e){const t=3*s[e];n[o]=i[t],n[o+1]=i[t+1],n[o+2]=i[t+2],n[o+3]=255,o+=c}}}function $(e,t,f){const{data:o,indices:r}=e,i=t.typedBuffer,s=t.typedBufferStride,n=r.length,c=o[0];f*=s;for(let l=0;l<n;++l)i[f]=c,f+=s}function x(o,r,i,s){e(A,o,r);const n=Math.max(Math.sqrt(t(A)),1e-4);f(A,A,1/n),i[s++]=A[0],i[s++]=A[1],i[s++]=A[2],i[s++]=n}const A=o();function M(e,t,f,o,r=1){const i=t.typedBuffer,s=t.typedBufferStride;if(o*=s,1===r)for(let n=0;n<f;++n)i[o]=e[0],i[o+1]=e[1],i[o+2]=e[2],i[o+3]=e[3],o+=s;else for(let n=0;n<f;++n)for(let t=0;t<r;++t)i[o]=e[0],i[o+1]=e[1],i[o+2]=e[2],i[o+3]=e[3],o+=s}function j(e,t,f,o,r,i){const{buffer:n,offset:c}=i;for(const l of f.fields.keys()){const f=e.get(l),i=f?.indices;if(f&&i)q(l,f,o,r,n,c);else if("olidColor"===l&&null!=t){const f=e.get("position")?.indices;if(f){const e=f.length;M(t,n.getField(l,s),e,c)}}}}function q(e,t,f,o,r,i){switch(e){case"position":{b(3===t.size);const o=r.getField(e,c);b(!!o,`No buffer view for ${e}`),w(t,f,o,i);break}case"normal":{b(3===t.size);const f=r.getField(e,c);b(!!f,`No buffer view for ${e}`),S(t,o,f,i);break}case"normalCompressed":case"profileRight":case"profileUp":{b(2===t.size);const f=r.getField(e,a);b(!!f,`No buffer view for ${e}`),B(t,f,i);break}case"uv0":{b(2===t.size);const f=r.getField(e,p)??r.getField(e,g);b(!!f,`No buffer view for ${e}`),B(t,f,i);break}case"uvi":{b(2===t.size);const f=r.getField(e,a);b(!!f,`No buffer view for ${e}`),B(t,f,i);break}case"color":case"symbolColor":{const f=r.getField(e,s);b(!!f,`No buffer view for ${e}`),b(3===t.size||4===t.size),N(t,t.size,f,i);break}case"colorFeatureAttribute":case"opacityFeatureAttribute":case"sizeFeatureAttribute":{const f=r.getField(e,u)??r.getField(e,u);b(!!f,`No buffer view for ${e}`),b(1===t.size),$(t,f,i);break}case"tangent":{b(4===t.size);const o=r.getField(e,d);b(!!o,`No buffer view for ${e}`),k(t,f,o,i);break}case"profileVertexAndNormal":{b(4===t.size);const f=r.getField(e,l)??r.getField(e,d);b(!!f,`No buffer view for ${e}`),m(t,f,i);break}case"profileAuxData":{b(3===t.size);const f=r.getField(e,n)??r.getField(e,c);b(!!f,`No buffer view for ${e}`),h(t,f,i);break}}}function C(e,t,f,o){const{data:r,stride:i,size:s,indices:n}=e;b(1===s,"Index should be 1D");const c=n.length;for(let l=0;l<c;++l){const e=r[i*n[l]];t.set(f+l,o+e)}}function U(e,t,f,o){for(let r=0;r<o;++r)e.set(t+r,f)}export{q as writeAttribute,j as writeAttributes,y as writeBufferFloat,v as writeBufferMat3f,z as writeBufferMat4f,B as writeBufferVec2,h as writeBufferVec3,m as writeBufferVec4,F as writeBufferZeros,N as writeColor,U as writeConstTextureElementIndex,x as writeDeltaF16Vector,S as writeNormal,M as writeOlidColor,w as writePosition,k as writeTangent,C as writeTextureElementIndex,$ as writeVVFeatureAttribute};
2
+ import{subtract as e,length as t,scale as f}from"../../../../../core/libs/gl-matrix-2/math/vec3.js";import{create as o}from"../../../../../core/libs/gl-matrix-2/factories/vec3f64.js";import{isOrthoNormal as r,hasIdentityRotation as i}from"../../../../../core/libs/gl-matrix-2/math/mat4.js";import{BufferViewVec4u8 as n,BufferViewVec4f as s,BufferViewFloat as c,BufferViewVec2i16 as l,BufferViewVec2f16 as d,BufferViewVec2f as u,BufferViewVec3f as a}from"../../../../../geometry/support/buffer/BufferView.js";import{assert as p}from"../../lib/Util.js";function g(e,t,f,o=1){const{data:r,indices:i}=e,n=t.typedBuffer,s=t.typedBufferStride,c=i.length;if(f*=s,1===o)for(let l=0;l<c;++l)n[f]=r[i[l]],f+=s;else for(let l=0;l<c;++l){const e=r[i[l]];for(let t=0;t<o;t++)n[f]=e,f+=s}}function y(e,t,f){const{data:o,stride:r,indices:i}=e,n=i.length;for(let s=0;s<n;++s)t.set(f+s,o[r*i[s]])}function b(e,t,f){const{data:o,indices:r}=e,i=t.typedBuffer,n=t.typedBufferStride,s=r.length;f*=n;for(let c=0;c<s;++c){const e=2*r[c];i[f]=o[e],i[f+1]=o[e+1],f+=n}}function B(e,t,f,o=1){const{data:r,indices:i}=e,n=t.typedBuffer,s=t.typedBufferStride,c=i.length;if(f*=s,1===o)for(let l=0;l<c;++l){const e=3*i[l];n[f]=r[e],n[f+1]=r[e+1],n[f+2]=r[e+2],f+=s}else for(let l=0;l<c;++l){const e=3*i[l];for(let t=0;t<o;++t)n[f]=r[e],n[f+1]=r[e+1],n[f+2]=r[e+2],f+=s}}function h(e,t,f,o=1){const{data:r,indices:i}=e,n=t.typedBuffer,s=t.typedBufferStride,c=i.length;if(f*=s,1===o)for(let l=0;l<c;++l){const e=4*i[l];n[f]=r[e],n[f+1]=r[e+1],n[f+2]=r[e+2],n[f+3]=r[e+3],f+=s}else for(let l=0;l<c;++l){const e=4*i[l];for(let t=0;t<o;++t)n[f]=r[e],n[f+1]=r[e+1],n[f+2]=r[e+2],n[f+3]=r[e+3],f+=s}}function m(e,t,f){const o=e.typedBuffer,r=e.typedBufferStride,i=e.elementCount;t*=r;for(let n=0;n<f;++n){for(let e=0;e<i;++e)o[t+e]=0;t+=r}}function v(e,t,f){const{data:o,indices:r}=e,i=t.typedBuffer,n=t.typedBufferStride,s=r.length;f*=n;for(let c=0;c<s;++c){const e=9*r[c];for(let t=0;t<9;++t)i[f+t]=o[e+t];f+=n}}function F(e,t,f){const{data:o,indices:r}=e,i=t.typedBuffer,n=t.typedBufferStride,s=r.length;f*=n;for(let c=0;c<s;++c){const e=16*r[c];for(let t=0;t<16;++t)i[f+t]=o[e+t];f+=n}}function S(e,t,f,o,r=1){if(!t)return void B(e,f,o,r);const{data:n,indices:s}=e,c=f.typedBuffer,l=f.typedBufferStride,d=s.length,u=t[0],a=t[1],p=t[2],g=t[4],y=t[5],b=t[6],h=t[8],m=t[9],v=t[10],F=t[12],S=t[13],z=t[14];o*=l;let w=0,k=0,N=0;const $=i(t)?e=>{w=n[e]+F,k=n[e+1]+S,N=n[e+2]+z}:e=>{const t=n[e],f=n[e+1],o=n[e+2];w=u*t+g*f+h*o+F,k=a*t+y*f+m*o+S,N=p*t+b*f+v*o+z};if(1===r)for(let i=0;i<d;++i)$(3*s[i]),c[o]=w,c[o+1]=k,c[o+2]=N,o+=l;else for(let i=0;i<d;++i){$(3*s[i]);for(let e=0;e<r;++e)c[o]=w,c[o+1]=k,c[o+2]=N,o+=l}}function z(e,t,f,o,n=1){if(!t)return void B(e,f,o,n);const{data:s,indices:c}=e,l=t,d=f.typedBuffer,u=f.typedBufferStride,a=c.length,p=l[0],g=l[1],y=l[2],b=l[4],h=l[5],m=l[6],v=l[8],F=l[9],S=l[10],z=!r(l),w=1e-6,k=1-w;o*=u;let N=0,$=0,x=0;const M=i(l)?e=>{N=s[e],$=s[e+1],x=s[e+2]}:e=>{const t=s[e],f=s[e+1],o=s[e+2];N=p*t+b*f+v*o,$=g*t+h*f+F*o,x=y*t+m*f+S*o};if(1===n)if(z)for(let r=0;r<a;++r){M(3*c[r]);const e=N*N+$*$+x*x;if(e<k&&e>w){const t=1/Math.sqrt(e);d[o]=N*t,d[o+1]=$*t,d[o+2]=x*t}else d[o]=N,d[o+1]=$,d[o+2]=x;o+=u}else for(let r=0;r<a;++r)M(3*c[r]),d[o]=N,d[o+1]=$,d[o+2]=x,o+=u;else for(let r=0;r<a;++r){if(M(3*c[r]),z){const e=N*N+$*$+x*x;if(e<k&&e>w){const t=1/Math.sqrt(e);N*=t,$*=t,x*=t}}for(let e=0;e<n;++e)d[o]=N,d[o+1]=$,d[o+2]=x,o+=u}}function w(e,t,f,o,i=1){if(!t)return void h(e,f,o,i);const{data:n,indices:s}=e,c=t,l=f.typedBuffer,d=f.typedBufferStride,u=s.length,a=c[0],p=c[1],g=c[2],y=c[4],b=c[5],B=c[6],m=c[8],v=c[9],F=c[10],S=!r(c),z=1e-6,w=1-z;if(o*=d,1===i)for(let r=0;r<u;++r){const e=4*s[r],t=n[e],f=n[e+1],i=n[e+2],c=n[e+3];let u=a*t+y*f+m*i,h=p*t+b*f+v*i,k=g*t+B*f+F*i;if(S){const e=u*u+h*h+k*k;if(e<w&&e>z){const t=1/Math.sqrt(e);u*=t,h*=t,k*=t}}l[o]=u,l[o+1]=h,l[o+2]=k,l[o+3]=c,o+=d}else for(let r=0;r<u;++r){const e=4*s[r],t=n[e],f=n[e+1],c=n[e+2],u=n[e+3];let h=a*t+y*f+m*c,k=p*t+b*f+v*c,N=g*t+B*f+F*c;if(S){const e=h*h+k*k+N*N;if(e<w&&e>z){const t=1/Math.sqrt(e);h*=t,k*=t,N*=t}}for(let r=0;r<i;++r)l[o]=h,l[o+1]=k,l[o+2]=N,l[o+3]=u,o+=d}}function k(e,t,f,o,r=1){const{data:i,indices:n}=e,s=f.typedBuffer,c=f.typedBufferStride,l=n.length;if(o*=c,t===i.length&&4===t){s[o]=i[0],s[o+1]=i[1],s[o+2]=i[2],s[o+3]=i[3];const e=new Uint32Array(f.typedBuffer.buffer,f.start),t=c/4,n=e[o/=4];o+=t;const d=l*r;for(let f=1;f<d;++f)e[o]=n,o+=t;return}if(1!==r)if(4!==t)for(let d=0;d<l;++d){const e=3*n[d];for(let t=0;t<r;++t)s[o]=i[e],s[o+1]=i[e+1],s[o+2]=i[e+2],s[o+3]=255,o+=c}else for(let d=0;d<l;++d){const e=4*n[d];for(let t=0;t<r;++t)s[o]=i[e],s[o+1]=i[e+1],s[o+2]=i[e+2],s[o+3]=i[e+3],o+=c}else{if(4===t){for(let e=0;e<l;++e){const t=4*n[e];s[o]=i[t],s[o+1]=i[t+1],s[o+2]=i[t+2],s[o+3]=i[t+3],o+=c}return}for(let e=0;e<l;++e){const t=3*n[e];s[o]=i[t],s[o+1]=i[t+1],s[o+2]=i[t+2],s[o+3]=255,o+=c}}}function N(e,t,f){const{data:o,indices:r}=e,i=t.typedBuffer,n=t.typedBufferStride,s=r.length,c=o[0];f*=n;for(let l=0;l<s;++l)i[f]=c,f+=n}function $(o,r,i,n){e(x,o,r);const s=Math.max(Math.sqrt(t(x)),1e-4);f(x,x,1/s),i[n++]=x[0],i[n++]=x[1],i[n++]=x[2],i[n++]=s}const x=o();function M(e,t,f,o,r=1){const i=t.typedBuffer,n=t.typedBufferStride;if(o*=n,1===r)for(let s=0;s<f;++s)i[o]=e[0],i[o+1]=e[1],i[o+2]=e[2],i[o+3]=e[3],o+=n;else for(let s=0;s<f;++s)for(let t=0;t<r;++t)i[o]=e[0],i[o+1]=e[1],i[o+2]=e[2],i[o+3]=e[3],o+=n}function j(e,t,f,o,r,i){const{buffer:s,offset:c}=i;for(const l of f.fields.keys()){const f=e.get(l),i=f?.indices;if(f&&i)q(l,f,o,r,s,c);else if("olidColor"===l&&null!=t){const f=e.get("position")?.indices;if(f){const e=f.length;M(t,s.getField(l,n),e,c)}}}}function q(e,t,f,o,r,i){switch(e){case"position":{p(3===t.size);const o=r.getField(e,a);p(!!o,`No buffer view for ${e}`),S(t,f,o,i);break}case"normal":{p(3===t.size);const f=r.getField(e,a);p(!!f,`No buffer view for ${e}`),z(t,o,f,i);break}case"normalCompressed":case"profileRight":case"profileUp":{p(2===t.size);const f=r.getField(e,l);p(!!f,`No buffer view for ${e}`),b(t,f,i);break}case"uv0":{p(2===t.size);const f=r.getField(e,d)??r.getField(e,u);p(!!f,`No buffer view for ${e}`),b(t,f,i);break}case"uvi":{p(2===t.size);const f=r.getField(e,l);p(!!f,`No buffer view for ${e}`),b(t,f,i);break}case"color":case"symbolColor":{const f=r.getField(e,n);p(!!f,`No buffer view for ${e}`),p(3===t.size||4===t.size),k(t,t.size,f,i);break}case"colorFeatureAttribute":case"opacityFeatureAttribute":case"sizeFeatureAttribute":{const f=r.getField(e,c)??r.getField(e,c);p(!!f,`No buffer view for ${e}`),p(1===t.size),N(t,f,i);break}case"tangent":{p(4===t.size);const o=r.getField(e,s);p(!!o,`No buffer view for ${e}`),w(t,f,o,i);break}}}function A(e,t,f,o){const{data:r,stride:i,size:n,indices:s}=e;p(1===n,"Index should be 1D");const c=s.length;for(let l=0;l<c;++l){const e=r[i*s[l]];t.set(f+l,o+e)}}function C(e,t,f,o){for(let r=0;r<o;++r)e.set(t+r,f)}export{q as writeAttribute,j as writeAttributes,g as writeBufferFloat,v as writeBufferMat3f,F as writeBufferMat4f,y as writeBufferUint32,b as writeBufferVec2,B as writeBufferVec3,h as writeBufferVec4,m as writeBufferZeros,k as writeColor,C as writeConstTextureElementIndex,$ as writeDeltaF16Vector,z as writeNormal,M as writeOlidColor,S as writePosition,w as writeTangent,A as writeTextureElementIndex,N as writeVVFeatureAttribute};
package/views/View2D.d.ts CHANGED
@@ -884,7 +884,7 @@ export default abstract class View2D extends View2DSuperclass {
884
884
  * | [FeatureLayer](https://developers.arcgis.com/javascript/latest/references/core/layers/FeatureLayer/), [CatalogFootprintLayer](https://developers.arcgis.com/javascript/latest/references/core/layers/catalog/CatalogFootprintLayer/), [CSVLayer](https://developers.arcgis.com/javascript/latest/references/core/layers/CSVLayer/), [GeoJSONLayer](https://developers.arcgis.com/javascript/latest/references/core/layers/GeoJSONLayer/), [OGCFeatureLayer](https://developers.arcgis.com/javascript/latest/references/core/layers/OGCFeatureLayer/), [OrientedImageryLayer](https://developers.arcgis.com/javascript/latest/references/core/layers/OrientedImageryLayer/), [StreamLayer](https://developers.arcgis.com/javascript/latest/references/core/layers/StreamLayer/), [SubtypeGroupLayer](https://developers.arcgis.com/javascript/latest/references/core/layers/SubtypeGroupLayer/), [WFSLayer](https://developers.arcgis.com/javascript/latest/references/core/layers/WFSLayer/) | Returns all intersecting [features](https://developers.arcgis.com/javascript/latest/references/core/views/types/#GraphicHit) at the hit location. |
885
885
  * | [ParquetLayer](https://developers.arcgis.com/javascript/latest/references/core/layers/ParquetLayer/) | Returns only the topmost [feature](https://developers.arcgis.com/javascript/latest/references/core/views/types/#GraphicHit) when the hit occurs on overlapping features. (as of version 4.34). |
886
886
  * | [GeoRSSLayer](https://developers.arcgis.com/javascript/latest/references/core/layers/GeoRSSLayer/), [GraphicsLayer](https://developers.arcgis.com/javascript/latest/references/core/layers/GraphicsLayer/), [KMLLayer](https://developers.arcgis.com/javascript/latest/references/core/layers/KMLLayer/), [MapNotesLayer](https://developers.arcgis.com/javascript/latest/references/core/layers/MapNotesLayer/) | Returns all intersecting [features](https://developers.arcgis.com/javascript/latest/references/core/views/types/#GraphicHit) at the hit location. |
887
- * | [ImageryLayer](https://developers.arcgis.com/javascript/latest/references/core/layers/ImageryLayer/), [ImageryTileLayer](https://developers.arcgis.com/javascript/latest/references/core/layers/ImageryTileLayer/)| Returns [result](https://developers.arcgis.com/javascript/latest/references/core/views/types/#RasterHit) containing raster pixel value used in rendering and bandId info on intersecting pixels. |
887
+ * | [ImageryLayer](https://developers.arcgis.com/javascript/latest/references/core/layers/ImageryLayer/), [ImageryTileLayer](https://developers.arcgis.com/javascript/latest/references/core/layers/ImageryTileLayer/)| Returns [result](https://developers.arcgis.com/javascript/latest/references/core/views/types/#RasterHit) containing raster pixel value used in rendering and bandId info on intersecting pixels. The `screenRect` hitTarget is not supported for these layers. |
888
888
  * | [VectorTileLayer](https://developers.arcgis.com/javascript/latest/references/core/layers/VectorTileLayer/) | Returns a result for all intersecting [features](https://developers.arcgis.com/javascript/latest/references/core/views/types/#GraphicHit) containing attributes of style layers (as of version 4.29; in prior releases, only the topmost style layer result was returned). In addition, the graphic's [origin](https://developers.arcgis.com/javascript/latest/references/core/Graphic/#origin) contains the style layer's [id](https://maplibre.org/maplibre-style-spec/layers/#id) and layer index within the [vector tile style](https://doc.arcgis.com/en/arcgis-online/reference/tile-layers.htm#ESRI_SECTION1_8F68399EB47B48FF9EF46719FCC96978). Spatial information about the actual feature represented in the style layer is returned only if the style layer is a [symbol layer](https://maplibre.org/maplibre-style-spec/layers/#symbol). Otherwise, the graphic's geometry is `null`. |
889
889
  * | [MediaLayer](https://developers.arcgis.com/javascript/latest/references/core/layers/MediaLayer/) | Returns [result](https://developers.arcgis.com/javascript/latest/references/core/views/types/#MediaHit) containing all media elements if the hit is made on intersecting elements. |
890
890
  * | [RouteLayer](https://developers.arcgis.com/javascript/latest/references/core/layers/RouteLayer/) | Returns [result](https://developers.arcgis.com/javascript/latest/references/core/views/types/#RouteHit) containing all intersecting route elements if the hit is made on intersecting elements. |
@@ -1,8 +1,13 @@
1
1
  import type Collection from "../../core/Collection.js";
2
+ import type Point from "../../geometry/Point.js";
3
+ import type { ScreenPoint } from "../../core/types.js";
2
4
  import type { Plugin, PluginConfiguration } from "./support/types.js";
3
5
  import type { InteractiveToolBase } from "../interactive/InteractiveToolBase.js";
4
6
  import type { SupportedEditGeometry } from "../interactive/editGeometry/interfaces.js";
5
7
 
8
+ /** @internal */
9
+ export interface DrawToolProperties extends Partial<Pick<DrawTool, "defaultZ" | "hasZ" | "lastScreenPosition">> {}
10
+
6
11
  /**
7
12
  * `DrawTool` implements geometry creation workflows by orchestrating one or more
8
13
  * plugins, which may be built-in or user provided. `DrawTool` provides common
@@ -44,7 +49,25 @@ import type { SupportedEditGeometry } from "../interactive/editGeometry/interfac
44
49
  *
45
50
  * @internal
46
51
  */
47
- export abstract class DrawTool extends InteractiveToolBase {
52
+ export class DrawTool extends InteractiveToolBase {
53
+ /** @internal */
54
+ constructor(properties: DrawToolProperties);
55
+ /** @internal */
56
+ get canRedo(): boolean;
57
+ /** @internal */
58
+ get canUndo(): boolean;
59
+ /**
60
+ * @default 0
61
+ * @internal
62
+ */
63
+ accessor defaultZ: number;
64
+ /**
65
+ * @default false
66
+ * @internal
67
+ */
68
+ accessor hasZ: boolean;
69
+ /** @internal */
70
+ accessor lastScreenPosition: ScreenPoint | null | undefined;
48
71
  /**
49
72
  * The last plugin in the stack, including hidden plugins. This is the one that is
50
73
  * accepting primary input.
@@ -52,9 +75,19 @@ export abstract class DrawTool extends InteractiveToolBase {
52
75
  * @internal
53
76
  */
54
77
  get mostDownstreamPlugin(): Plugin | null | undefined;
78
+ /**
79
+ * The "root" plugin. This plugin is the first in the plugin stack and the one
80
+ * that consumes the result of all downstream plugins and defines the final
81
+ * shape of the geometry.
82
+ *
83
+ * @internal
84
+ */
85
+ get mostUpstreamPlugin(): Plugin | null | undefined;
55
86
  /** @internal */
56
87
  get pluginStack(): Collection<Plugin>;
57
88
  /** @internal */
89
+ get positionOfLastUserInput(): Point | null | undefined;
90
+ /** @internal */
58
91
  get updating(): boolean;
59
92
  /**
60
93
  * Gets the geometry that would be produced if the drawing was
@@ -1,2 +1,2 @@
1
1
  /* COPYRIGHT Esri - https://js.arcgis.com/5.1/LICENSE.txt */
2
- class e{constructor(e,t=[]){this.eventType=e,this.keyModifiers=t}matches(e){if(e.type!==this.eventType)return!1;if(0===this.keyModifiers.length)return!0;const t=e.modifiers;for(const i of this.keyModifiers)if(!t.has(i))return!1;return!0}}export{e as EventMatch};
2
+ class e{constructor(e,t=[]){this.eventType=e,this.keyModifiers=t}matches(e){if(e.type!==this.eventType)return!1;if(0===this.keyModifiers.length)return!0;const t=e.modifiers;for(const s of this.keyModifiers)if(!t.has(s)&&!t.has(s.toLowerCase())&&!t.has(s.toUpperCase()))return!1;return!0}}export{e as EventMatch};
@@ -1,2 +1,2 @@
1
1
  /* COPYRIGHT Esri - https://js.arcgis.com/5.1/LICENSE.txt */
2
- import{createArcadeProfile as e,createArcadeExecutor as t}from"../../../../arcade.js";import r from"../../../../core/Error.js";import n from"../../../../core/Logger.js";import{getEffectiveFieldAlias as o}from"../../../../editing/fieldUtils.js";import i from"../../../../form/ExpressionInfo.js";import{isMultipleChoiceInput as s}from"../../../../form/elements/inputs/inputUtils.js";import{isAttachmentElement as a,isFieldElement as l,isGroupElement as m,isRelationshipElement as d,isTextElement as p,isUtilityNetworkAssociationsElement as c}from"../../../../form/support/formUtils.js";import{getLowerCaseEditTrackingFields as f,isFieldVisibleByDefault as u}from"../../../../layers/support/fieldUtils.js";import{isSubtypeSublayer as x,isSubtypeGroupLayer as y}from"../../../../layers/support/layerUtils.js";import{isNumber as w}from"../../../../support/guards.js";import{unknown as h}from"../../../../time/constants.js";import{makeExpressionInfosMap as E,makeExecutorSetForFormElement as b}from"../../expressions/expressionUtils.js";import{AttachmentElementTemplate as T}from"../AttachmentElementTemplate.js";import I from"../BatchFormTemplate.js";import{FieldElementTemplate as v}from"../FieldElementTemplate.js";import{GroupElementTemplate as g}from"../GroupElementTemplate.js";import{RelationshipElementTemplate as j}from"../RelationshipElementTemplate.js";import{TextElementTemplate as F}from"../TextElementTemplate.js";import{UtilityNetworkAssociationsElementTemplate as C}from"../UtilityNetworkAssociationsElementTemplate.js";import{compileTextElementMarkdownToHTML as P}from"./textElementTemplateUtils.js";const L="expression/dea57012-47ca4b55a000-8df62742ed0c",A=e("form-attachment-filename-calculation"),U=()=>n.getLogger("esri.widgets.BatchAttributeForm.templates.templateUtils");async function Z(e,t,r=e.formTemplate){return await e.load(),r?.elements&&r.elements.length>0?B(r,e,t):N(e,t)}async function N(e,{arcadeExecutorProvider:t,formTimeZone:r}){const n=new Set(f(e)),o={arcadeExecutorProvider:t,formTimeZone:r,layer:e},i=[];for(const a of e.fields)G(a,e,n)&&i.push(O(a,o));const s=await Promise.all(i);return new I({elements:s,preserveFieldValuesWhenHidden:!0})}function k(e,t){for(const r of e??[])if("group"!==r.type){if("field"===r.type){if(!1===r.editable&&!r.editableExpression)return!0;if(t.subtypeField&&(x(t)||y(t))&&r.fieldName?.toLowerCase()===t.subtypeField.toLowerCase())return!0}}else if(k(r.elements??[],t))return!0;return!1}async function B(e,t,r){let n=null;k(e.elements??[],t)&&(n=new i({title:"",name:L,expression:"false"}));const o=E(n?[...e.expressionInfos??[],n]:e.expressionInfos),s={description:e.description,elements:new Array,title:e.title,preserveFieldValuesWhenHidden:e.preserveFieldValuesWhenHidden,supportsAttachmentElements:e.supportsAttachmentElements},{elements:a}=e;if(!a)return new I(s);const{arcadeExecutorProvider:l,formTimeZone:m}=r;for(const i of a){const e=await R(i,{arcadeExecutorProvider:l,expressionInfos:o,layer:t,formTimeZone:m});e&&s.elements.push(e)}return e.supportsAttachmentElements,new I(s)}async function H(e,{arcadeExecutorProvider:r,expressionInfos:n,layer:o}){const i=n.get(e.filenameExpression),s=i?await t(i.expression,A):null,a=new T({allowUserRename:e.allowUserRename,attachmentKeyword:e.attachmentKeyword,description:e.description,displayFilename:e.displayFilename,filenameExpressionExecutor:s,input:e.input,label:e.label,maxAttachmentCount:e.maxAttachmentCount,minAttachmentCount:e.minAttachmentCount,useOriginalFilename:e.useOriginalFilename}),l=await b({element:e,expressionInfos:n,provider:r});return a.addLayer(o,l),a}async function R(e,t){return a(e)?H(e,{arcadeExecutorProvider:t.arcadeExecutorProvider,expressionInfos:t.expressionInfos,layer:t.layer}):l(e)?S(e,t):m(e)?V(e,t):d(e)?W(e,t):p(e)?z(e,t):c(e)?K(e,t):null}async function S(e,{arcadeExecutorProvider:t,expressionInfos:n,layer:o,formTimeZone:i}){const{fieldsIndex:a}=o,{description:l,domain:m,fieldName:d,hint:p,input:c,label:f}=e;if(null==d||!a.has(d))return U().warn(new r("batch-attribute-form:invalid-form-element-field",`Field element with label '${f}' does not refer to a valid field`)),null;if(!1!==e.editable||e.editableExpression||((e=e.clone()).editableExpression=L),o.subtypeField&&(x(o)||y(o))&&e.fieldName?.toLowerCase()===o.subtypeField.toLowerCase()&&((e=e.clone()).editableExpression=L),c&&s(c)&&c.otherChoice){const e=c.otherChoice.fieldName,t=a.get(e);t&&t.name!==e&&(c.otherChoice=c.otherChoice.clone(),c.otherChoice.fieldName=t.name)}const u=new v({description:l,domain:m,field:a.get(d),hint:p,input:c,formTimeZone:i,layerTimeZone:$(o),label:f}),w=await b({element:e,expressionInfos:n,provider:t});return u.addLayer(o,w),u}async function V(e,t){const{arcadeExecutorProvider:r,expressionInfos:n,layer:o}=t,{description:i,label:s,initialState:a}=e,l=[];for(const p of e.elements){const e=await R(p,t);e&&l.push(e)}const m=new g({description:i,elements:l,label:s,initialState:a??"expanded"}),d=await b({element:e,expressionInfos:n,provider:r});return m.addLayer(o,d),m}async function W(e,t){const{description:r,label:n,displayCount:o,displayType:i,orderByFields:s,relationshipId:a}=e,{arcadeExecutorProvider:l,expressionInfos:m,layer:d}=t,p=new j({description:r,...w(o)&&{displayCount:o},displayType:i,label:n,orderByFields:s,relationshipId:a}),c=await b({element:e,expressionInfos:m,provider:l});return p.addLayer(d,c),p}async function z(e,{arcadeExecutorProvider:t,expressionInfos:r,layer:n}){const{description:o,label:i,text:s,textFormat:a}=e,{fieldsIndex:l}=n,m=s&&"markdown"===a?await P(s):s,d=new F({compiledText:m,description:o,fieldsIndex:l,label:i}),p=await b({element:e,expressionInfos:r,provider:t}),{expressionParts:c}=d;if(c.length){const e=await Promise.all(c.map(e=>{const n=r.get(e)?.expression??e;return t.getArcadeExecutor(n)}));p.textExpressions=e}return d.addLayer(n,p),d}async function K(e,t){const{associationTypes:r,description:n,label:o}=e,{arcadeExecutorProvider:i,expressionInfos:s,layer:a}=t,l=new C({associationTypes:r,description:n,label:o}),m=await b({element:e,expressionInfos:s,provider:i});return l.addLayer(a,m),l}async function O(e,{arcadeExecutorProvider:t,layer:r,formTimeZone:n}){const i=o(e,r)||e.name,s=new v({field:e,label:i,formTimeZone:n,layerTimeZone:$(r)}),a={},l=(y(r)||x(r))&&r.subtypeField&&r.subtypeField.toLowerCase()===e.name.toLowerCase();return!l&&e.editable&&r.userHasUpdateItemPrivileges&&(a.editableExpression=await t.getArcadeExecutor("true")),l&&(a.editableExpression=await t.getArcadeExecutor("false")),s.addLayer(r,a),s}function G(e,t,r){return!r.has(e.name.toLowerCase())&&u(e,t)}function $(e){return x(e)&&e.parent&&(e=e.parent),e&&"datesInUnknownTimezone"in e&&e.datesInUnknownTimezone?h:e&&"preferredTimeZone"in e&&e.preferredTimeZone?e.preferredTimeZone:null}export{Z as createBatchFormTemplate,N as createBatchFormTemplateFromFields};
2
+ import{createArcadeProfile as e,createArcadeExecutor as r}from"../../../../arcade.js";import t from"../../../../core/Error.js";import o from"../../../../core/Logger.js";import{getEffectiveFieldAlias as n}from"../../../../editing/fieldUtils.js";import i from"../../../../form/ExpressionInfo.js";import s from"../../../../form/elements/AttachmentElement.js";import{isMultipleChoiceInput as a}from"../../../../form/elements/inputs/inputUtils.js";import{isAttachmentElement as l,isFieldElement as m,isGroupElement as d,isRelationshipElement as p,isTextElement as c,isUtilityNetworkAssociationsElement as f}from"../../../../form/support/formUtils.js";import{getLowerCaseEditTrackingFields as u,isFieldVisibleByDefault as x}from"../../../../layers/support/fieldUtils.js";import{isSubtypeSublayer as y,isSubtypeGroupLayer as w}from"../../../../layers/support/layerUtils.js";import{isNumber as h}from"../../../../support/guards.js";import{unknown as E}from"../../../../time/constants.js";import{layerSupportsQueryAttachments as b}from"../../batchAttributeFormUtils.js";import{makeExpressionInfosMap as v,makeExecutorSetForFormElement as I}from"../../expressions/expressionUtils.js";import{AttachmentElementTemplate as T}from"../AttachmentElementTemplate.js";import j from"../BatchFormTemplate.js";import{FieldElementTemplate as F}from"../FieldElementTemplate.js";import{GroupElementTemplate as g}from"../GroupElementTemplate.js";import{RelationshipElementTemplate as P}from"../RelationshipElementTemplate.js";import{TextElementTemplate as C}from"../TextElementTemplate.js";import{UtilityNetworkAssociationsElementTemplate as A}from"../UtilityNetworkAssociationsElementTemplate.js";import{compileTextElementMarkdownToHTML as L}from"./textElementTemplateUtils.js";const U="expression/dea57012-47ca4b55a000-8df62742ed0c",Z=e("form-attachment-filename-calculation"),N=()=>o.getLogger("esri.widgets.BatchAttributeForm.templates.templateUtils");async function k(e,r,t=e.formTemplate){return await e.load(),t?.elements&&t.elements.length>0?S(t,e,r):B(e,r)}async function B(e,{arcadeExecutorProvider:r,formTimeZone:t}){const o=new Set(u(e)),n={arcadeExecutorProvider:r,formTimeZone:t,layer:e},i=[];for(const a of e.fields)D(a,e,o)&&i.push(q(a,n));const s=await Promise.all(i);return await R(s,{arcadeExecutorProvider:r,expressionInfos:v(void 0),layer:e}),new j({elements:s,preserveFieldValuesWhenHidden:!0})}function H(e,r){for(const t of e??[])if("group"!==t.type){if("field"===t.type){if(!1===t.editable&&!t.editableExpression)return!0;if(r.subtypeField&&(y(r)||w(r))&&t.fieldName?.toLowerCase()===r.subtypeField.toLowerCase())return!0}}else if(H(t.elements??[],r))return!0;return!1}async function R(e,{arcadeExecutorProvider:r,expressionInfos:t,layer:o}){if(!b(o))return;const n=await V(new s({displayFilename:!0}),{arcadeExecutorProvider:r,expressionInfos:t,layer:o});e.push(n)}async function S(e,r,t){let o=null;H(e.elements??[],r)&&(o=new i({title:"",name:U,expression:"false"}));const n=v(o?[...e.expressionInfos??[],o]:e.expressionInfos),s={description:e.description,elements:new Array,title:e.title,preserveFieldValuesWhenHidden:e.preserveFieldValuesWhenHidden,supportsAttachmentElements:e.supportsAttachmentElements},{elements:a}=e;if(!a)return new j(s);const{arcadeExecutorProvider:l,formTimeZone:m}=t;for(const i of a){const e=await W(i,{arcadeExecutorProvider:l,expressionInfos:n,layer:r,formTimeZone:m});e&&s.elements.push(e)}return e.supportsAttachmentElements||await R(s.elements,{arcadeExecutorProvider:l,expressionInfos:n,layer:r}),new j(s)}async function V(e,{arcadeExecutorProvider:t,expressionInfos:o,layer:n}){const i=o.get(e.filenameExpression),s=i?await r(i.expression,Z):null,a=new T({allowUserRename:e.allowUserRename,attachmentKeyword:e.attachmentKeyword,description:e.description,displayFilename:e.displayFilename,filenameExpressionExecutor:s,input:e.input,label:e.label,maxAttachmentCount:e.maxAttachmentCount,minAttachmentCount:e.minAttachmentCount,useOriginalFilename:e.useOriginalFilename}),l=await I({element:e,expressionInfos:o,provider:t});return a.addLayer(n,l),a}async function W(e,r){return l(e)?V(e,{arcadeExecutorProvider:r.arcadeExecutorProvider,expressionInfos:r.expressionInfos,layer:r.layer}):m(e)?z(e,r):d(e)?K(e,r):p(e)?O(e,r):c(e)?G(e,r):f(e)?$(e,r):null}async function z(e,{arcadeExecutorProvider:r,expressionInfos:o,layer:n,formTimeZone:i}){const{fieldsIndex:s}=n,{description:l,domain:m,fieldName:d,hint:p,input:c,label:f}=e;if(null==d||!s.has(d))return N().warn(new t("batch-attribute-form:invalid-form-element-field",`Field element with label '${f}' does not refer to a valid field`)),null;if(!1!==e.editable||e.editableExpression||((e=e.clone()).editableExpression=U),n.subtypeField&&(y(n)||w(n))&&e.fieldName?.toLowerCase()===n.subtypeField.toLowerCase()&&((e=e.clone()).editableExpression=U),c&&a(c)&&c.otherChoice){const e=c.otherChoice.fieldName,r=s.get(e);r&&r.name!==e&&(c.otherChoice=c.otherChoice.clone(),c.otherChoice.fieldName=r.name)}const u=new F({description:l,domain:m,field:s.get(d),hint:p,input:c,formTimeZone:i,layerTimeZone:J(n),label:f}),x=await I({element:e,expressionInfos:o,provider:r});return u.addLayer(n,x),u}async function K(e,r){const{arcadeExecutorProvider:t,expressionInfos:o,layer:n}=r,{description:i,label:s,initialState:a}=e,l=[];for(const p of e.elements){const e=await W(p,r);e&&l.push(e)}const m=new g({description:i,elements:l,label:s,initialState:a??"expanded"}),d=await I({element:e,expressionInfos:o,provider:t});return m.addLayer(n,d),m}async function O(e,r){const{description:t,label:o,displayCount:n,displayType:i,orderByFields:s,relationshipId:a}=e,{arcadeExecutorProvider:l,expressionInfos:m,layer:d}=r,p=new P({description:t,...h(n)&&{displayCount:n},displayType:i,label:o,orderByFields:s,relationshipId:a}),c=await I({element:e,expressionInfos:m,provider:l});return p.addLayer(d,c),p}async function G(e,{arcadeExecutorProvider:r,expressionInfos:t,layer:o}){const{description:n,label:i,text:s,textFormat:a}=e,{fieldsIndex:l}=o,m=s&&"markdown"===a?await L(s):s,d=new C({compiledText:m,description:n,fieldsIndex:l,label:i}),p=await I({element:e,expressionInfos:t,provider:r}),{expressionParts:c}=d;if(c.length){const e=await Promise.all(c.map(e=>{const o=t.get(e)?.expression??e;return r.getArcadeExecutor(o)}));p.textExpressions=e}return d.addLayer(o,p),d}async function $(e,r){const{associationTypes:t,description:o,label:n}=e,{arcadeExecutorProvider:i,expressionInfos:s,layer:a}=r,l=new A({associationTypes:t,description:o,label:n}),m=await I({element:e,expressionInfos:s,provider:i});return l.addLayer(a,m),l}async function q(e,{arcadeExecutorProvider:r,layer:t,formTimeZone:o}){const i=n(e,t)||e.name,s=new F({field:e,label:i,formTimeZone:o,layerTimeZone:J(t)}),a={},l=(w(t)||y(t))&&t.subtypeField&&t.subtypeField.toLowerCase()===e.name.toLowerCase();return!l&&e.editable&&t.userHasUpdateItemPrivileges&&(a.editableExpression=await r.getArcadeExecutor("true")),l&&(a.editableExpression=await r.getArcadeExecutor("false")),s.addLayer(t,a),s}function D(e,r,t){return!t.has(e.name.toLowerCase())&&x(e,r)}function J(e){return y(e)&&e.parent&&(e=e.parent),e&&"datesInUnknownTimezone"in e&&e.datesInUnknownTimezone?E:e&&"preferredTimeZone"in e&&e.preferredTimeZone?e.preferredTimeZone:null}export{k as createBatchFormTemplate,B as createBatchFormTemplateFromFields};
@@ -1,2 +1,2 @@
1
1
  /* COPYRIGHT Esri - https://js.arcgis.com/5.1/LICENSE.txt */
2
- import{__decorate as e}from"tslib";import{substitute as t}from"../intl.js";import{deprecateWidget as a}from"../core/deprecate.js";import i from"../core/Logger.js";import{getOrCreateMapValue as n}from"../core/MapUtils.js";import{watch as l,when as s,on as o}from"../core/reactiveUtils.js";import{formatFileSize as r}from"../core/unitFormatUtils.js";import{property as c,subclass as d}from"../core/accessorSupport/decorators.js";import{isIntegerField as m}from"../layers/support/fieldUtils.js";import{isString as h}from"../support/guards.js";import u from"./Widget.js";import{getAttachmentTypeCategory as p,getCalciteIconForAttachment as g}from"./Attachments/support/attachmentUtils.js";import{getAttachmentKey as v,isImageAttachment as f}from"./BatchAttributeForm/attachmentUtils.js";import{getHiddenFieldsValidationErrorMessage as b,getVisibleFieldInputValidationErrorMessage as C,isElementTemplateWithInputType as _}from"./BatchAttributeForm/batchAttributeFormUtils.js";import A from"./BatchAttributeForm/BatchAttributeFormViewModel.js";import{css as y}from"./BatchAttributeForm/css.js";import{makeAddAttachmentFooterButtons as I,makeDiscardAttachmentFooterButtons as F,makeReplaceAttachmentFooterButtons as w,makeViewingAttachmentFooterButtons as k,makeDefaultFooterButtons as x}from"./BatchAttributeForm/interfaceUtils.js";import D from"./BatchAttributeForm/VisibleElements.js";import{isGroupInput as M,isFieldInput as S,isTextElementInput as E,isRelationshipElementInput as O,isAttachmentElementInput as V,isUtilityNetworkAssociationsElementInput as T,differentValuesString as L}from"./BatchAttributeForm/inputs/support/inputUtils.js";import{clearMultipleChoiceOtherChoiceStateForViewModel as R,getMultipleChoiceCheckboxState as P,otherChoiceCheckedPlaceholderValue as U,getUpdatedMultipleChoiceValueForFeature as N,getMultipleChoiceSelectAllState as $,splitMultipleChoiceValue as B,canRestoreMultipleChoiceOtherChoiceDraftValue as j}from"./BatchAttributeForm/inputs/support/multipleChoiceInputUtils.js";import{downloadAttachmentInfo as z}from"./FeatureTable/support/exportUtils.js";import{loadCalciteComponents as H}from"./support/componentsUtils.js";import{getLabelForDateFieldValue as Z,getIntlOptionsForField as q,prepareISOFieldValueForDateComponents as G,prepareUnixFieldValueForDateComponents as W,normalizeTimeOnlyString as K,getISOFieldValueFromDateComponents as J,getUnixFieldValueFromDateComponents as Q}from"./support/dateUtils.js";import{globalCss as X}from"./support/globalCss.js";import{calciteListFilterProps as Y}from"./support/listUtils.js";import{messageBundle as ee,vmEvent as te,tsx as ae}from"./support/widget.js";import{setFocus as ie}from"./support/widgetUtils.js";import{isEmptyValue as ne}from"./support/forms/formUtils.js";const le="data-element-id",se="esri_BatchAttributeForm_select_all",oe="esri_BatchAttributeForm_other_choice";let re=class extends u{constructor(e,t){super(e,t),this.headingLevel=2,this.messagesCommon=null,this.messages=null,this.messagesUnits=null,this.viewModel=new A,this.visibleElements=new D,this.groupDisplay="all",this._attemptFocusOnNextRender=!1,this._dateComponentMap=new Map,this._touchedInputs=new Set,this._focusedFieldInput=null,this._batchSwitchInputInitialValues=new Map,this._attachmentDialogInfo=null,this._attachmentListFilterText="",this._attachmentFileInputMap=new Map,this._selectedAttachmentReplaceFileInput=null,this._maximizeSelectedAttachment=()=>{this._attachmentDialogInfo=this.selectedAttachmentDetails},this._enterAttachmentReplaceView=()=>{this.readOnly||this.effectiveDisabled||!this.selectedAttachmentDetails||this.viewModel.setShowingSelectedAttachmentReplacePage(!0)},this._setSelectedAttachmentReplaceFileInput=e=>{this._selectedAttachmentReplaceFileInput=e},this._openSelectedAttachmentReplaceFilePicker=()=>{this.readOnly||this.effectiveDisabled||this._selectedAttachmentReplaceFileInput?.click()},this._resetSelectedAttachmentName=()=>{const e=this.selectedAttachmentDetails,t=e?.attachment.globalId,a=e?e.input.getAttachmentEditState(e.attachment).initialName:null;e&&t&&null!=a&&this.viewModel.stageRenameAttachment(e.input.template.elementId,t,a)},this._resetSelectedAttachmentChanges=()=>{const e=this.selectedAttachmentDetails,t=e?.attachment.globalId;e&&t&&this.viewModel.resetAttachmentChanges(e.input.template.elementId,t)},this._deleteSelectedAttachment=()=>{const e=this.selectedAttachmentDetails,t=e?.attachment.globalId;e&&t&&!this._isSelectedAttachmentDeleteDisabled()&&(this.viewModel.stageDeleteAttachment(e.input.template.elementId,t),this._setSelectedAttachment(null))},this._closeAttachmentDialog=()=>{this.hideAttachmentDialog()},this._saveInput=this._saveInput.bind(this),this._onFormSubmit=this._onFormSubmit.bind(this),this._onComponentFocus=this._onComponentFocus.bind(this),this._onComponentBlur=this._onComponentBlur.bind(this),this._afterComponentCreateOrUpdate=this._afterComponentCreateOrUpdate.bind(this),this._afterDateComponentCreate=this._afterDateComponentCreate.bind(this),this._afterRadioGroupCreateOrUpdate=this._afterRadioGroupCreateOrUpdate.bind(this),e?.suppressDeprecationWarning||(this.announceDeprecation=()=>{a(i.getLogger(this),"Editor","arcgis-editor",{version:"5.0"})})}normalizeCtorArgs(e={}){const{suppressDeprecationWarning:t,...a}=e;return a}initialize(){this.addHandles([l(()=>this.features,()=>{this._dateComponentMap.clear(),this._resetTransientFormState(),R(this.viewModel,{includeDraftValues:!0})}),l(()=>this.viewModel.activeForm,()=>{this._batchSwitchInputInitialValues.clear(),this._resetTransientFormState(),R(this.viewModel)}),l(()=>this.viewModel.selectedAttachmentAddElementId,()=>{this.hideAttachmentDialog()}),s(()=>!this.selectedAttachmentDetails,()=>this.hideAttachmentDialog()),l(()=>this.viewModel.selectedAttachmentListElementId,()=>{this._attachmentListFilterText=""}),o(()=>this.viewModel,"submit",()=>{this.valid||this.goToFirstError()})])}loadDependencies(){return H({action:()=>import("@esri/calcite-components/dist/components/calcite-action"),block:()=>import("@esri/calcite-components/dist/components/calcite-block"),button:()=>import("@esri/calcite-components/dist/components/calcite-button"),checkbox:()=>import("@esri/calcite-components/dist/components/calcite-checkbox"),combobox:()=>import("@esri/calcite-components/dist/components/calcite-combobox"),"combobox-item":()=>import("@esri/calcite-components/dist/components/calcite-combobox-item"),"combobox-item-group":()=>import("@esri/calcite-components/dist/components/calcite-combobox-item-group"),dialog:()=>import("@esri/calcite-components/dist/components/calcite-dialog"),dropdown:()=>import("@esri/calcite-components/dist/components/calcite-dropdown"),"dropdown-group":()=>import("@esri/calcite-components/dist/components/calcite-dropdown-group"),"dropdown-item":()=>import("@esri/calcite-components/dist/components/calcite-dropdown-item"),icon:()=>import("@esri/calcite-components/dist/components/calcite-icon"),input:()=>import("@esri/calcite-components/dist/components/calcite-input"),"input-date-picker":()=>import("@esri/calcite-components/dist/components/calcite-input-date-picker"),"input-number":()=>import("@esri/calcite-components/dist/components/calcite-input-number"),"input-time-picker":()=>import("@esri/calcite-components/dist/components/calcite-input-time-picker"),"input-time-zone":()=>import("@esri/calcite-components/dist/components/calcite-input-time-zone"),label:()=>import("@esri/calcite-components/dist/components/calcite-label"),"input-message":()=>import("@esri/calcite-components/dist/components/calcite-input-message"),loader:()=>import("@esri/calcite-components/dist/components/calcite-loader"),list:()=>import("@esri/calcite-components/dist/components/calcite-list"),"list-item":()=>import("@esri/calcite-components/dist/components/calcite-list-item"),notice:()=>import("@esri/calcite-components/dist/components/calcite-notice"),switch:()=>import("@esri/calcite-components/dist/components/calcite-switch"),"text-area":()=>import("@esri/calcite-components/dist/components/calcite-text-area"),"radio-button":()=>import("@esri/calcite-components/dist/components/calcite-radio-button"),"radio-button-group":()=>import("@esri/calcite-components/dist/components/calcite-radio-button-group")})}get activeFeatureIndex(){return this.viewModel.activeFeatureIndex}set activeFeatureIndex(e){this.viewModel.activeFeatureIndex=e}get callbacks(){return this.viewModel.callbacks}set callbacks(e){this.viewModel.callbacks=e}get disabled(){return this.viewModel.disabled}set disabled(e){this.viewModel.disabled=e}get effectiveTitle(){const{features:e,messages:t,page:a}=this;return"replacing-attachment"===a?t.titles.replaceAttachment:"viewing-attachment-details"===a?t.titles.editAttachment:"adding-attachments"===a?t.titles.addAttachments:"viewing-attachments"===a?t.titles.attachments:1===e.length||this.activeFeatureIndex>-1?t.titles.editFeature:e.length>1?t.titles.editFeatures:""}get effectiveDisabled(){return this.disabled||this.viewModel.updating}get features(){return this.viewModel.features}set features(e){this.viewModel.features=e}get footerButtonInfos(){if(!this.features.length)return[];const{page:e,messages:t}=this,a=this.viewModel.selectedAttachmentAddElementId,i=this.selectedAttachmentDetails,n=i?i.input.getAttachmentEditState(i.attachment):null;if("adding-attachments"===e&&a)return I({messages:t,onclick:()=>this._attachmentFileInputMap.get(a)?.click()});return!!i&&"replacing-attachment"!==e&&!!n?.isReplaced?F({message:this.messagesCommon.remove,onclick:this._resetSelectedAttachmentChanges}):"replacing-attachment"===e?w({disabled:this.readOnly||this.effectiveDisabled,messages:t,onclick:this._openSelectedAttachmentReplaceFilePicker}):"viewing-attachment-details"===e?k({deleteDisabled:this._isSelectedAttachmentDeleteDisabled(),deleteOnclick:this._deleteSelectedAttachment,doneOnclick:()=>this._setSelectedAttachment(null),messages:t.footerButtons}):"viewing-attachments"===e?[]:x({formId:this._formId,callback:this.submit,messages:t})}get footerNoticeInfos(){if(!this.features.length)return[];const{messages:{footerNotices:e}}=this;return this._isSelectedAttachmentDeleteDisabled()?[{icon:"information",message:e.deleteDisabledMinimumAttachments}]:[]}get map(){return this.viewModel.map}set map(e){this.viewModel.map=e}get maximumFeatureCount(){return this.viewModel.maximumFeatureCount}set maximumFeatureCount(e){this.viewModel.maximumFeatureCount=e}get maximumFeatureCountWithComplexForms(){return this.viewModel.maximumFeatureCountWithComplexForms}set maximumFeatureCountWithComplexForms(e){this.viewModel.maximumFeatureCountWithComplexForms=e}get spatialReference(){return this.viewModel.spatialReference}set spatialReference(e){this.viewModel.spatialReference=e}get layerInfos(){return this.viewModel.layerInfos}set layerInfos(e){this.viewModel.layerInfos=e}get timeZone(){return this.viewModel.timeZone}set timeZone(e){this.viewModel.timeZone=e}get icon(){return"edit-attributes"}set icon(e){this._overrideIfSome("icon",e)}get page(){return this.viewModel.page}get readOnly(){return this.viewModel.readOnly}set readOnly(e){this.viewModel.readOnly=e}get selectedAttachment(){return this.viewModel.selectedAttachment}get selectedAttachmentDetails(){return this.viewModel.selectedAttachmentDetails}get valid(){return this.viewModel.valid}get _associationsEnabled(){const{callbacks:e}=this;return!(!e?.addAssociation||!e.selectAssociatedFeature)}get _formId(){return`${this.id}-form`}async goBack(){return this.viewModel.goBack()}async goHome(){return this.viewModel.goHome()}goToFirstError(){const e=this.viewModel.getFirstVisibleInvalidFieldInput();if(!e)return;const{groupInput:t}=e;t&&(t.open||(t.open=!0)),this._focusedFieldInput=e.input,this._attemptFocusOnNextRender=!0,this.scheduleRender()}render(){return ae("div",{class:this.classes(y.base,X.widget,X.panel)},this._renderContent(),this._renderAttachmentDialog())}submit(){return this.viewModel.submit()}_setDateTimeTimeZoneMap(e){const{datePart:t,elementId:a}=e.dataset,i=n(this._dateComponentMap,`${a}`,()=>({}));switch(t){case"date":i.date=e;break;case"time":i.time=e;break;case"timeZone":i.timeZone=e}}_renderContent(){const{messages:e,viewModel:a}=this,{status:i}=a;return"failed"===i?a.hasTooManyComplexFeatures?this._renderErrorNotice(t(e.formFailedToLoadTooManyComplexFeatures,{num:a.maximumFeatureCountWithComplexForms})):a.hasTooManyFeatures?this._renderErrorNotice(t(e.formFailedToLoadTooManyFeatures,{num:a.maximumFeatureCount})):e.formFailedToLoad:a.expressionEvaluationFailed?this._renderErrorNotice(e.expressionEvaluationFailed):a.hasLayersWithContingentValues&&this.viewModel.features.length>1?this._renderErrorNotice(e.unsupportedContingentValues):"loading"===i&&this.visibleElements.loadingIndicator?ae("calcite-loader",{key:"loader",label:this.messagesCommon?.loading}):0!==this.features.length?this._renderForm():void 0}_renderErrorNotice(e,t="warning"){return ae("calcite-notice",{class:y.noticeError,icon:!0,kind:t,open:!0},ae("div",{slot:"message"},e))}_renderForm(){return ae("form",{class:y.form,id:this._formId,onsubmit:this._onFormSubmit},this._renderInvisibleFieldsError(),this._renderPage())}_renderPage(){switch(this.page){case"adding-attachments":return this._renderAttachmentAddPage();case"replacing-attachment":case"viewing-attachments":return this._renderAttachmentListPage();case"viewing-attachment-details":return this._renderAttachmentDetailPage();default:return this._renderFormContent()}}_renderInvisibleFieldsError(){const{viewModel:e}=this,{hasNonActiveInvalidFeatures:t,activeForm:a}=e;let i;if(!e.submitHasBeenAttempted)return null;if(a.invalidHiddenInputs.length>0)if(i=b(a,e.mode,this.messages),"batch"===this.viewModel.mode){const e=a.invalidHiddenInputs.filter(e=>"hidden:group-visibility-expression:all-features"===e.effectiveVisibilityCode||"hidden:visibility-expression:all-features"===e.visibilityCode);e.length>0?i+=` (${e.map(e=>e.label).join(", ")})`:i=null}else i+=` (${a.invalidHiddenInputs.map(e=>e.label).join(", ")})`;else if(t)return null;return i?this._renderErrorNotice(i,"danger"):null}_renderFormContent(){return this.viewModel.hasVisibleInputs?this.viewModel.activeForm.inputs.filter(e=>e.visible).map(e=>this._renderInput(e)):this._renderErrorNotice(this.messages.noVisibleFields[this.viewModel.noVisibleElementsReason])}_renderInput(e){return M(e)?this._renderGroupInput(e):S(e)?this._renderLabeledField(e):E(e)?this._renderTextComponent(e):O(e)?this._renderRelationshipElementInput(e):V(e)?this._renderAttachmentElementInput(e):T(e)?this._renderUtilityNetworkAssociationsElementInput(e):void 0}_renderGroupInput(e){const{inputs:t,template:a,open:i}=e,n=t.filter(e=>e.visible),l=a.label??"";return ae("calcite-block",{class:this.classes(y.group,"sequential"===this.groupDisplay?y.groupSequential:null,this.disabled?y.inputDisabled:null),collapsible:!0,description:a.description??void 0,disabled:this.effectiveDisabled,expanded:i,heading:l,headingLevel:this.headingLevel,key:`{${a.elementId}-key}`,label:l,onCalciteBlockClose:()=>{e.open=!1},onCalciteBlockOpen:()=>{e.open=!0}},n.map(e=>this._renderInput(e)))}_renderLabeledField(e){const{elementId:a}=e.template,{label:i,required:n,dataType:l}=e,s=n?t(this.messages.requiredFieldLabel,{name:i}):i;return ae("calcite-label",{"aria-label":s,class:y.label,key:`field--${a}`},ae("div",{class:y.labelTextContent,key:"labelTextContainer"},i,n?ae("span",{"aria-hidden":"true",title:this.messagesCommon.required},"*"):void 0),"unsupported"!==l?this._renderFieldInput(e):this._renderReadOnlyComponent(e),this._renderAuxiliaryText(e))}_renderFieldInput(e){const t=this.getCommonInputProps(e),{dataType:a}=e;return"date"===a?this._renderDateComponents(e,t):"coded-value"===e.domain?.type?this._renderCodedInputs({input:e,props:t}):null!==e.multipleChoiceChoices?this._renderMultipleChoiceComponent({input:e,props:t}):"number"===a?this._renderNumberComponent(e,t):this._renderStringComponent(e,t)}_renderAuxiliaryText(e){const{compositeError:t,description:a,submittable:i}=e,n=!i&&t&&(this.viewModel.submitHasBeenAttempted||this._touchedInputs.has(e.template.elementId))?C(e,t,this.messages):null;return n?ae("calcite-input-message",{icon:!0,status:"invalid"},n):a?ae("calcite-input-message",{class:y.description,icon:!1,status:"idle"},a):null}_renderCodedInputs({input:e,props:t}){const a=e.input?.type??null,i=e.codedValueOptions;switch(a){case"switch":return this._renderSwitchField({input:e,props:t});case"radio-buttons":return this._renderRadioButtonGroupComponent({input:e,options:i,props:t});default:return this._renderComboBoxComponent({options:i,props:t,input:e})}}_renderMultipleChoiceComponent({input:e,props:t}){const{messages:a}=this,{multipleChoiceChoices:i,multipleChoiceInput:n,multipleChoiceValues:l}=e;if(!n||!i||!l)return null;const s=!0===n.includeSelectAllChoices,o=new Map;let r=l.length>0,c=!1;for(const f of l){const t=P({input:e,choiceValue:f});o.set(f,t),(t.checked||t.indeterminate)&&(c=!0),t.checked||(r=!1)}const d={checked:r,indeterminate:!r&&c},m=d.checked?a.deselectAllLabel:a.selectAllLabel,h=e.getMultipleChoiceOtherChoiceRenderState(this.messages.otherOptionLabel),u=t=>{this._saveValueFromMultipleChoiceCheckbox({input:e,checkbox:t,isSelectAllCheckbox:!0})},p=t=>{this._saveValueFromMultipleChoiceCheckbox({input:e,checkbox:t})},g=t=>{const{fieldName:a}=h;a&&this._saveOtherChoiceCheckboxValue({input:e,isChecked:t.checked,otherChoiceFieldName:a})},v=t=>{this._saveValueFromMultipleChoiceTextInput({input:e,textInput:t,otherChoiceFieldName:h.fieldName})};return ae("div",{class:y.multipleChoiceInput,key:`${t.key}-multiple-choice-group`},s?this._renderMultipleChoiceSelectAllCheckbox({props:t,selectAllState:d,selectAllLabel:m,handleSelectAllCheckboxChange:u}):null,this._renderMultipleChoiceChoiceCheckboxes({input:e,props:t,checkboxStatesByValue:o,handleChoiceCheckboxChange:p}),h.shouldShow?this._renderMultipleChoiceOtherChoice({props:t,includeSelectAllChoices:s,otherChoiceRenderState:h,handleOtherChoiceCheckboxChange:g,handleOtherChoiceInputChange:v,differentValuesPlaceholder:a.differentValuesPlaceholder}):null)}_renderMultipleChoiceSelectAllCheckbox({props:e,selectAllState:t,selectAllLabel:a,handleSelectAllCheckboxChange:i}){return ae("calcite-checkbox",{afterCreate:e.afterCreate,afterUpdate:e.afterUpdate,"aria-invalid":e["aria-invalid"],checked:t.checked,class:y.multipleChoiceSelectAll,"data-element-id":e[le],disabled:e.readOnly,indeterminate:t.indeterminate,key:`${e.key}-select-all`,label:a,labelText:a,value:se,onblur:e.onblur,onCalciteCheckboxChange:({currentTarget:e})=>i(e),onfocus:e.onfocus})}_renderMultipleChoiceChoiceCheckboxes({input:e,props:t,checkboxStatesByValue:a,handleChoiceCheckboxChange:i}){const{multipleChoiceChoices:n}=e;return n?n.map(e=>{const n=a.get(e.value)??{checked:!1,indeterminate:!1};return ae("calcite-checkbox",{afterCreate:t.afterCreate,afterUpdate:t.afterUpdate,"aria-invalid":t["aria-invalid"],checked:n.checked,class:t.class,"data-element-id":t[le],disabled:t.readOnly,indeterminate:n.indeterminate,key:`${t.key}-${e.value}`,label:e.label,labelText:e.label,required:t.required,value:e.value,onblur:t.onblur,onCalciteCheckboxChange:({currentTarget:e})=>i(e),onfocus:t.onfocus})}):[]}_renderMultipleChoiceOtherChoice({props:e,includeSelectAllChoices:t,otherChoiceRenderState:a,handleOtherChoiceCheckboxChange:i,handleOtherChoiceInputChange:n,differentValuesPlaceholder:l}){return ae("div",{class:this.classes(y.multipleChoiceOtherChoice,t?y.multipleChoiceOtherChoiceWithSelectAll:null),key:`${e.key}-other-choice`},ae("calcite-checkbox",{afterCreate:e.afterCreate,afterUpdate:e.afterUpdate,"aria-invalid":e["aria-invalid"],checked:a.checkboxState.checked,class:e.class,"data-element-id":e[le],disabled:e.readOnly,indeterminate:a.checkboxState.indeterminate,key:`${e.key}-other-choice-checkbox`,label:a.label,labelText:a.label,value:oe,onblur:e.onblur,onCalciteCheckboxChange:({currentTarget:e})=>i(e),onfocus:e.onfocus}),a.checkboxState.checked?ae("calcite-input",{afterCreate:e.afterCreate,afterUpdate:e.afterUpdate,"aria-invalid":e["aria-invalid"],"aria-label":a.label,class:y.textElementInput,"data-element-id":e[le],disabled:e.readOnly,key:`${e.key}-other-choice-input`,maxLength:a.maxLength,placeholder:a.value===L?l:a.hint,required:e.required,type:"text",value:a.normalizedValue===L?"":a.normalizedValue?String(a.normalizedValue):"",onblur:e.onblur,onCalciteInputInput:({currentTarget:e})=>n(e),onfocus:e.onfocus}):null)}async _saveValueFromMultipleChoiceCheckbox({input:e,checkbox:t,isSelectAllCheckbox:a=!1}){if(e.multipleChoiceInput&&!a&&"batch"===this.viewModel.mode)return void await this._saveMultipleChoiceCheckboxValueByFeature({input:e,checkbox:t});const i=e.value,n=this._parseValue(t,e,a);n!==i&&await this.viewModel.setValue(e.template.elementId,n)}async _saveValueFromMultipleChoiceTextInput({input:e,textInput:t,otherChoiceFieldName:a}){if(!a)return;const i=t.value,n=null==i||""===i?null:i;e.initializeExplicitMultipleChoiceOtherChoiceCheckedState(),e.stashMultipleChoiceOtherChoiceDraftValueForFeatures(e.features,n);const l=e.features.toArray().filter(e=>e.getAttribute(a)!==n);if(0!==l.length){for(const e of l)e.setAttribute(a,n);this.viewModel.userHasChangedValues=!0,await e.expressionsManager.valueChanged(a,l),this.viewModel.emit("value-change",{features:l.map(e=>e.source),fieldName:a,name:"value-change",value:n})}}async _saveOtherChoiceCheckboxValue({input:e,isChecked:t,otherChoiceFieldName:a}){e.setExplicitMultipleChoiceOtherChoiceCheckedState(t),t||e.setMultipleChoiceOtherChoiceDraftValuesFromFeatures(e.features.toArray());const i=e.features.toArray().filter(i=>{const n=i.getAttribute(a);if(t){if(!ne(n))return!1;const t=e.getMultipleChoiceOtherChoiceDraftValue(i),l=j(t)?t:U;return i.setAttribute(a,l),!0}return null!=n&&(i.setAttribute(a,null),!0)});0!==i.length&&(this.viewModel.userHasChangedValues=!0,await e.expressionsManager.valueChanged(a,i),this.viewModel.emit("value-change",{features:i.map(e=>e.source),fieldName:a,name:"value-change",value:this._getFieldValueByFieldNameForInput(e,a)}))}async _saveMultipleChoiceCheckboxValueByFeature({input:e,checkbox:t}){if(!e.multipleChoiceInput||!e.multipleChoiceValues)return;const a=e.features.toArray().filter(a=>{const i=a.getAttribute(e.fieldName),n=N({input:e,choiceValue:t.value,currentValue:i,isChecked:t.checked});return i!==n&&(a.setAttribute(e.fieldName,n),!0)});0!==a.length&&(this.viewModel.userHasChangedValues=!0,await e.expressionsManager.valueChanged(e.fieldName,a),this.viewModel.emit("value-change",{features:a.map(e=>e.source),fieldName:e.fieldName,name:"value-change",value:this._getFieldValueByFieldNameForInput(e,e.fieldName)}))}_getFieldValueByFieldNameForInput(e,t){const a=e.features.toArray().map(e=>e.getAttribute(t));if(0===a.length)return null;const[i]=a;return a.every(e=>e===i)?i:L}_renderSwitchField({input:e,props:t}){if((this._batchSwitchInputInitialValues.get(e)===L||e.value===L)&&"batch"===this.viewModel.mode){const a={dropdown:{afterCreate:this._afterComponentCreateOrUpdate,afterUpdate:this._afterComponentCreateOrUpdate,disabled:t.readOnly,open:!1,[le]:t[le]},trigger:{appearance:"transparent",iconEnd:"chevron-down",kind:"neutral",slot:"trigger",label:t.label},group:{mode:"single"}};return this._renderDropdownComponent({buttonValue:e.value,dropdownProps:a,options:[{name:this.messages.differentValuesPlaceholder,value:L,disabled:!0},...e.codedValueDomainOptions]})}return this._renderSwitchComponent({input:e,props:t})}_renderSwitchComponent({input:e,props:t}){return ae("calcite-switch",{...t,checked:!!_(e.template,"switch")&&e.value===e.template.input.onValue,class:y.inputSwitch,disabled:t.readOnly,onblur:()=>{this._focusedFieldInput=null},onCalciteSwitchChange:({currentTarget:e})=>this._saveInput(e)})}_renderDropdownComponent({buttonValue:e,options:t,dropdownProps:a}){const{trigger:i,dropdown:n,group:l}=a;return ae("calcite-dropdown",{...n,topLayerDisabled:this.topLayerDisabled,onblur:()=>{this._focusedFieldInput=null},onCalciteDropdownSelect:({currentTarget:e})=>this._saveInput(e),onfocus:this._onComponentFocus},ae("calcite-button",{...i},e===L?this.messages.differentValuesPlaceholder:e),ae("calcite-dropdown-group",{selectionMode:l.mode},t.map(t=>ae("calcite-dropdown-item",{disabled:t.disabled,label:String(t.name),selected:e===t.value},t.name))))}_renderComboBoxComponent({input:e,options:t,props:a}){const i="INSERT"===this.viewModel.editType,n=this._touchedInputs.has(e?.template?.elementId),l=i&&e.showNoValueOptionEnabled&&!n?()=>{}:a.onblur,s={...a,onblur:l};return ae("calcite-combobox",{...s,selectionMode:"single",topLayerDisabled:this.topLayerDisabled,value:a.placeholder===this.messages.differentValuesPlaceholder?L:String(a.value),onCalciteComboboxChange:({currentTarget:e})=>{e.value!==L&&this._saveInput(e)}},this.renderComboboxOptionsList({input:e,options:t,props:a}))}renderComboboxOptionsList({input:e,options:t,props:a}){const i=e=>e.map(e=>{const{value:t}=e,i=ne(e.value)?this.messages.empty:e.name;return ae("calcite-combobox-item",{heading:i,key:`#${t}`,selected:a.value===t,value:`${t}`})});let n=[];const{messages:l}=this;t.other.length>0&&n.push(ae("calcite-combobox-item-group",{key:"other",label:l.other},i(t.other))),t.unsupported.length>0&&n.push(ae("calcite-combobox-item-group",{key:"unsupported",label:l.unsupported},i(t.unsupported)));const s=i(t.recommended);n.length>0?n.unshift(ae("calcite-combobox-item-group",{key:"recommended",label:l.recommended},s)):n=s;const o=a.placeholder===this.messages.differentValuesPlaceholder,r=!o&&ne(a.value);return e.showNoValueOptionEnabled&&!t.containsEmptyOption&&n.unshift(ae("calcite-combobox-item",{heading:e.showNoValueLabel||this.messages.empty,key:"empty-option",selected:r,value:""})),o&&n.unshift(ae("calcite-combobox-item",{heading:this.messages.differentValuesPlaceholder,key:L,selected:!0,value:L})),n}_renderRadioButtonGroupComponent({input:e,options:t,props:a}){const i=[...t.recommended,...t.other,...t.unsupported].map(({name:t,value:i})=>this._renderRadioButtons({label:t,value:i,selected:i===e.value,props:a}));if(e.showNoValueOptionEnabled&&!t.containsEmptyOption){const t="",n=e.showNoValueLabel||this.messages.empty,l=ne(e.value);i.unshift(this._renderRadioButtons({label:n,value:t,selected:l,props:a}))}return ae("calcite-radio-button-group",{afterCreate:this._afterRadioGroupCreateOrUpdate,afterUpdate:this._afterRadioGroupCreateOrUpdate,class:y.inputRadioGroup,disabled:a.readOnly,key:`${a.key}-radio-group`,layout:"vertical",name:a.name,required:a.required},i,a.placeholder===this.messages.differentValuesPlaceholder?ae("calcite-label",{class:y.placeholderRadio,key:a.label,layout:"inline"},ae("calcite-radio-button",{checked:!0,class:y.inputRadio,disabled:!0,name:a.placeholder,value:a.placeholder}),a.placeholder):null)}_renderRadioButtons({value:e,selected:t,label:a,props:i}){return ae("calcite-label",{class:y.inputRadioLabel,key:i.label,layout:"inline"},ae("calcite-radio-button",{...i,afterCreate:void 0,afterUpdate:void 0,checked:t,class:y.inputRadio,disabled:i.readOnly,name:i.label,value:e,onblur:()=>{this._focusedFieldInput=null},onCalciteRadioButtonChange:({currentTarget:e})=>{e.checked&&this._saveInput(e)}}),a)}_renderStringComponent(e,t){const{template:a}=e;return!a.field.editable||this.readOnly?this._renderReadOnlyComponent(e):"text-area"===a.input?.type?ae("calcite-text-area",{...t,class:this.classes(y.individualElement),resize:"vertical",value:t.value?String(t.value):"",onCalciteTextAreaInput:({currentTarget:e})=>this._saveInput(e)}):ae("calcite-input",{...t,class:this.classes(y.individualElement),type:"text",value:t.value?String(t.value):"",onCalciteInputInput:({currentTarget:e})=>this._saveInput(e)})}_renderNumberComponent(e,t){const a=m(e.field);return ae("calcite-input-number",{...t,integer:a,type:"number",value:a&&""!==t.value?Math.round(parseFloat(String(t.value))).toString():String(t.value),onCalciteInputNumberInput:({currentTarget:e})=>this._saveInput(e)})}_renderReadOnlyComponent(e,t){const a=this.getCommonInputProps(e);return ae("calcite-input",{...a,class:this.classes(y.fieldInput,y.inputDisabled,y.individualElement),readOnly:!0,type:"text",value:String(t??a.value??"")})}_renderDateComponents(e,t){const{field:a}=e;let i;switch(a.type){case"date":i=this._renderDateFieldComponents(e,t);break;case"date-only":i=this._renderDateOnlyFieldComponent(e,t);break;case"time-only":i=this._renderTimeOnlyFieldComponent(e,t);break;case"timestamp-offset":i=this._renderTimestampOffsetFieldComponents(e,t);break;default:i=this._renderReadOnlyComponent(e,Z(a,t.value,{timeZone:e.effectiveTimeZone,...q(e.template.field)}))}return e.value===L?[i,ae("calcite-input-message",{icon:"information",key:"diff-values-message",status:"idle"},this.messages.differentValues)]:i}_renderDateOnlyFieldComponent(e,t){const{class:a,key:i,readOnly:n}=t,{rawMax:l,rawMin:s}=e.range;return ae("calcite-input-date-picker",{afterCreate:this._afterDateComponentCreate,afterUpdate:this._afterComponentCreateOrUpdate,class:a,"data-date-part":"date","data-element-id":t[le],key:`${i}-date-input`,max:h(l)?l:void 0,min:h(s)?s:void 0,overlayPositioning:"fixed",readOnly:n,topLayerDisabled:this.topLayerDisabled,value:e.value===L?"":e.value?String(e.value):"",onblur:()=>{this._focusedFieldInput=null},onCalciteInputDatePickerChange:t=>this._saveValueFromDateComponent(e,t.currentTarget),onfocus:this._onComponentFocus})}_renderTimeOnlyFieldComponent(e,t){const{class:a,key:i,readOnly:n}=t;return ae("calcite-input-time-picker",{afterCreate:this._afterDateComponentCreate,afterUpdate:this._afterComponentCreateOrUpdate,class:a,"data-date-part":"time","data-element-id":t[le],key:`${i}-time-input`,overlayPositioning:"fixed",readOnly:n,value:e.value===L?"":e.value?String(e.value):"",onblur:()=>{this._focusedFieldInput=null},onCalciteInputTimePickerChange:t=>this._saveValueFromDateComponent(e,t.currentTarget),onfocus:this._onComponentFocus})}_renderTimestampOffsetFieldComponents(e,t){const{class:a,key:i,readOnly:n}=t,{rawMax:l,rawMin:s}=e.range,o=G(l),r=G(s),c=G(e.value===L?"":e.value),d=e.includeTimeOffset,m={afterCreate:this._afterDateComponentCreate,afterUpdate:this._afterComponentCreateOrUpdate,overlayPositioning:"fixed",readOnly:n,[le]:t[le],onfocus:this._onComponentFocus};return ae("div",{class:y.dateInputContainer,key:`${i}-date-time-container`},ae("calcite-input-date-picker",{...m,class:a,"data-date-part":"date",key:`${i}-date-input`,max:o?.date??void 0,min:r?.date??void 0,topLayerDisabled:this.topLayerDisabled,value:c.date??"",onblur:()=>{this._focusedFieldInput=null},onCalciteInputDatePickerChange:t=>this._saveValueFromDateComponent(e,t.target)}),ae("calcite-input-time-picker",{...m,class:a,"data-date-part":"time",key:`${i}-time-input`,value:c.time??"",onblur:()=>{this._focusedFieldInput=null},onCalciteInputTimePickerChange:t=>this._saveValueFromDateComponent(e,t.target)}),d?ae("calcite-input-time-zone",{...m,class:a,clearable:e.value===L||null==e.value,"data-date-part":"timeZone",key:`${i}-timezone-input`,value:c.timeZoneOffset||"",onblur:()=>{this._focusedFieldInput=null},onCalciteInputTimeZoneChange:t=>this._saveValueFromDateComponent(e,t.target)}):null)}_renderDateFieldComponents(e,t){const{class:a,key:i,readOnly:n,min:l,max:s}=t,o=e.effectiveTimeZone,r=W(e.value===L?"":e.value,o),c=W(s,o),d=W(l,o),m=e.includeTime,h={afterCreate:this._afterDateComponentCreate,afterUpdate:this._afterComponentCreateOrUpdate,overlayPositioning:"fixed",readOnly:n,[le]:t[le],onfocus:this._onComponentFocus};return ae("div",{class:y.dateInputContainer,key:`${i}-date-time-container`},ae("calcite-input-date-picker",{...h,class:a,"data-date-part":"date",key:`${i}-date-input`,max:c?.date??void 0,min:d?.date??void 0,topLayerDisabled:this.topLayerDisabled,value:r.date??"",onblur:()=>{this._focusedFieldInput=null},onCalciteInputDatePickerChange:t=>this._saveValueFromDateComponent(e,t.target)}),m?ae("calcite-input-time-picker",{...h,"data-date-part":"time",key:`${i}-time-input`,step:1,value:r.time??"",onblur:()=>{this._focusedFieldInput=null},onCalciteInputTimePickerChange:t=>{this._saveValueFromDateComponent(e,t.target)}}):null)}_renderRelationshipElementInput(e){const{elementId:t}=e.template;return ae("div",{class:y.relationshipElementInput,"data-testid":`relationship-element-${t}`,key:`relationship-element-${t}`})}_renderAttachmentElementInput(e){const{allAttachmentsVisibleOnDefaultPage:t,attachments:a,defaultPageAttachments:i,template:{description:n,elementId:l,label:s}}=e,o=t?a:i;return ae("div",{class:y.attachmentElementInput,"data-testid":`attachment-element-${l}`,key:`attachment-element-${l}`},s?ae("div",{class:y.attachmentElementLabel,key:`attachment-element-label-${l}`},s):null,n?ae("div",{class:y.description,key:`attachment-element-description-${l}`},n):null,a.length?this._renderAttachmentList(e,o,{label:s||this.messagesCommon.details,viewAllCount:t?null:a.length}):ae("div",{class:y.attachmentElementEmptyState,key:`attachment-element-empty-state-${l}`},this.messages.attachments.noAttachments),this._renderAttachmentAddAction(e))}_renderAttachmentListPage(){const e=this.viewModel.selectedAttachmentListInput;if(e)return ae("div",{class:y.attachmentElementAllPanel,key:`attachment-element-all-panel-${e.template.elementId}`},this._renderAttachmentList(e,e.attachments,{filterEnabled:!0,label:this.messages.titles.attachments}))}_renderAttachmentList(e,t,a){const{filterEnabled:i,label:n,viewAllCount:l}=a;return ae("calcite-list",{class:y.attachmentElementList,filterEnabled:i,filterPlaceholder:i?this.messages.attachments.searchAttachments:void 0,filterProps:i?Y:void 0,filterText:i?this._attachmentListFilterText:void 0,label:n,selectionAppearance:"border",selectionMode:"none",onCalciteListFilter:i?e=>{this._attachmentListFilterText=e.currentTarget.filterText??""}:void 0},this._renderAttachmentListItems(e,t),null!=l?this._renderViewAllAttachmentsItem(e,l):null)}_renderAttachmentListItems(e,t){const{elementId:a}=e.template;return t.map((t,i)=>{const n=this._formatAttachmentSize(t.size),l=this._getAttachmentLabel(t,i,n,e.displayFilename),s=l===n?void 0:n,o=v(t),r=e.isStagedAttachmentAddition(t),c=e.getAttachmentEditState(t),d=r||c.isRenamed||c.isReplaced;return ae("calcite-list-item",{class:y.attachmentElementListItem,description:s,key:`attachment-item-${o}`,label:l,onCalciteListItemSelect:r?void 0:()=>this._setSelectedAttachment({attachmentKey:o,elementId:a})},ae("div",{class:y.attachmentElementListItemStart,slot:"content-start"},this._renderAttachmentPreviewThumbnail(t,l,e)),d?ae("span",{class:y.attachmentElementListItemStagedIndicator,slot:"content-end"}):null,r?[ae("calcite-action",{disabled:this.effectiveDisabled,icon:"x",scale:"s",slot:"actions-end",text:this.messagesCommon.delete,title:this.messagesCommon.delete,onclick:()=>this.viewModel.stageDeleteAttachment(a,t.globalId)})]:ae("calcite-action",{icon:"chevron-right",scale:"s",slot:"actions-end",text:l,title:l}))})}_renderViewAllAttachmentsItem(e,a){const{elementId:i}=e.template,{viewAll:n}=this.messages.attachments;return ae("calcite-list-item",{class:y.attachmentElementListItem,description:t(this.messages.attachments.count,{count:a}),key:`attachment-item-view-all-${i}`,label:n,onCalciteListItemSelect:()=>this._setAttachmentListElementId(i)},ae("calcite-action",{icon:"chevron-right",scale:"s",slot:"actions-end",text:n,title:n}))}_renderAttachmentAddAction(e){const{elementId:t}=e.template,a=this.effectiveDisabled||e.addDisabled;return ae("div",{class:y.attachmentElementEmptyAction,key:`attachment-element-empty-action-${t}`},ae("calcite-button",{appearance:"outline",disabled:a,iconStart:"attachment",kind:"neutral",round:!0,scale:"s",onclick:()=>this._setAttachmentAddElementId(t)},this.messages.attachments.attach))}_renderAttachmentAddPage(){const e=this.viewModel.selectedAttachmentAddInput;return e?this._renderAttachmentAddPanel(e):null}_renderAttachmentAddPanel(e){const{maxAttachmentCount:t}=e,{elementId:a}=e.template,i=null==t||t-e.attachments.length>1,n=this.effectiveDisabled||e.addDisabled,l=this.messages.attachments,s=l.dragAndDropFile,o="upload",r=e=>{this._attachmentFileInputMap.set(a,e)};return ae("div",{class:y.attachmentElementAddPanel,key:`attachment-element-add-panel-${a}`},ae("input",{accept:e.accept,afterCreate:r,afterRemoved:()=>{this._attachmentFileInputMap.delete(a)},afterUpdate:r,class:y.attachmentElementFileInput,"data-element-id":a,disabled:n,multiple:i,type:"file",onchange:e=>{const t=e.currentTarget,i=t.files?Array.from(t.files):[];this._stageAttachmentFiles(a,i),t.value=""}}),ae("div",{class:y.attachmentElementAddDropzone,"data-disabled":n?"true":"false",ondragover:e=>{e.preventDefault()},ondrop:e=>{if(e.preventDefault(),n)return;const t=e.dataTransfer?.files?Array.from(e.dataTransfer.files):[];this._stageAttachmentFiles(a,t)}},ae("calcite-icon",{class:y.attachmentElementAddDropzoneIcon,icon:o,scale:"l"}),ae("div",{class:y.attachmentElementAddDropzoneHeading},l.addFile),ae("div",{class:y.attachmentElementAddDropzoneDetail,title:s},s),ae("calcite-button",{appearance:"outline-fill",disabled:n,iconStart:"folder-open",scale:"s",type:"button",onclick:e=>{e.stopPropagation(),this._openAttachmentFilePicker(a,n)}},l.selectFile)))}async _stageAttachmentFiles(e,t){if(0!==t.length)try{await this.viewModel.stageAddAttachments(e,t)}finally{this.viewModel.setSelectedAttachmentAddElementId(null)}}_openAttachmentFilePicker(e,t){t||this._attachmentFileInputMap.get(e)?.click()}_renderAttachmentDetailPage(){const e=this.selectedAttachmentDetails;if(!e)return;if("replacing-attachment"===this.page)return this._renderAttachmentReplacePanel(e);const{attachment:t,input:a}=e,i=v(t),n=!!a.getAttachmentPreviewUrl(t),l=a.getAttachmentEditState(t),s=!this.readOnly&&!this.effectiveDisabled;return ae("div",{class:y.attachmentElementDetail,key:`attachment-detail-panel-${a.template.elementId}-${i}`},ae("div",{class:y.attachmentElementDetailPreview},this._renderAttachmentPreviewImageForInput(t,a)),ae("div",{class:y.attachmentElementDetailActions},ae("calcite-button",{appearance:"outline",disabled:!n,iconStart:"download-to",kind:"neutral",scale:"s",onclick:()=>{this._downloadAttachment(t)}},this.messages.attachments.download),f(t)?ae("calcite-button",{appearance:"outline",disabled:!n,iconStart:"expand",kind:"neutral",label:this.messages.attachments.maximize,scale:"m",title:this.messages.attachments.maximize,onclick:this._maximizeSelectedAttachment}):null,ae("calcite-button",{appearance:"outline",disabled:!n,iconStart:"download",kind:"neutral",label:this.messages.attachments.download,scale:"m",title:this.messages.attachments.download,onclick:()=>{this._downloadAttachment(t)}}),ae("calcite-button",{appearance:"outline",disabled:!s,iconStart:"upload-to",kind:"neutral",label:this.messages.attachments.replace,scale:"m",title:this.messages.attachments.replace,onclick:this._enterAttachmentReplaceView})),ae("div",{class:y.attachmentElementDetailMetadata},ae("div",{class:y.attachmentElementDetailMetadataGroup},ae("span",{class:y.attachmentElementDetailMetadataLabel},this.messages.attachments.fileName),a.allowUserRename?ae("div",{class:y.attachmentElementDetailFileNameRow},ae("calcite-input",{class:y.attachmentElementDetailFileNameInput,disabled:!s,scale:"m",value:t.name||"",onCalciteInputInput:({currentTarget:e})=>this._renameSelectedAttachment(e.value)}),ae("calcite-button",{appearance:"transparent",disabled:!s||null==l.initialName||!l.isRenamed,iconStart:"reset",kind:"neutral",scale:"m",title:this.messages.footerButtons.reset,onclick:this._resetSelectedAttachmentName})):ae("span",{class:y.attachmentElementDetailMetadataValue},t.name)),ae("div",{class:y.attachmentElementDetailMetadataGroup},ae("span",{class:y.attachmentElementDetailMetadataLabel},this.messages.attachments.size),ae("span",{class:y.attachmentElementDetailMetadataValue},this._formatAttachmentSize(t.size))),ae("div",{class:y.attachmentElementDetailMetadataGroup},ae("span",{class:y.attachmentElementDetailMetadataLabel},this.messages.attachments.type),ae("span",{class:y.attachmentElementDetailMetadataValue},this._getLabelForAttachmentType(t)))))}_renderAttachmentReplacePanel(e){const{attachment:t,input:a}=e,i=this.readOnly||this.effectiveDisabled,n=a.template.elementId;return ae("div",{class:y.attachmentElementAddPanel,key:`attachment-replace-panel-${n}-${v(t)}`},ae("input",{accept:a.accept,afterCreate:this._setSelectedAttachmentReplaceFileInput,afterRemoved:()=>{this._selectedAttachmentReplaceFileInput=null},afterUpdate:this._setSelectedAttachmentReplaceFileInput,class:y.attachmentElementFileInput,disabled:i,type:"file",onchange:e=>{const t=e.currentTarget,a=t.files?.[0];a&&this._stageSelectedAttachmentReplacement(a),t.value=""}}),ae("div",{class:y.attachmentElementAddDropzone,"data-disabled":i?"true":"false",ondragover:e=>{e.preventDefault()},ondrop:e=>{if(e.preventDefault(),i)return;const t=e.dataTransfer?.files?.[0];t&&this._stageSelectedAttachmentReplacement(t)}},ae("calcite-icon",{class:y.attachmentElementAddDropzoneIcon,icon:"refresh",scale:"l"}),ae("div",{class:y.attachmentElementAddDropzoneHeading},this.messages.attachments.replace),ae("div",{class:y.attachmentElementAddDropzoneDetail,title:this.messages.attachments.dragAndDropFile},this.messages.attachments.dragAndDropFile),ae("calcite-button",{appearance:"outline-fill",disabled:i,iconStart:"folder-open",scale:"s",onclick:e=>{e.stopPropagation(),this._openSelectedAttachmentReplaceFilePicker()}},this.messages.attachments.selectFile)),ae("div",{class:y.attachmentElementDetailMetadata},ae("div",{class:y.attachmentElementDetailMetadataGroup},ae("span",{class:y.attachmentElementDetailMetadataLabel},this.messages.attachments.fileToBeReplaced),ae("span",{class:y.attachmentElementDetailMetadataValue},t.name))))}_renderAttachmentDialog(){const e=this._attachmentDialogInfo;if(!e)return null;const{attachment:t,input:a}=e;return ae("calcite-dialog",{heading:t.name||this.messagesCommon.details,key:"attachment-preview-dialog",modal:!0,open:!0,placement:"cover",width:"l",onCalciteDialogClose:this._closeAttachmentDialog},ae("div",{class:y.attachmentElementDetailPreview},this._renderAttachmentPreviewImageForInput(t,a)))}_setSelectedAttachment(e){this.viewModel.setSelectedAttachment(e),e||this.hideAttachmentDialog()}_setAttachmentAddElementId(e){this.viewModel.setSelectedAttachmentAddElementId(e),this.hideAttachmentDialog()}_setAttachmentListElementId(e){this.viewModel.setSelectedAttachmentListElementId(e),this.hideAttachmentDialog()}_getAttachmentLabel(e,a,i,n){return!1!==n&&h(e.name)&&e.name.length>0?e.name:i!==this.messagesCommon.notApplicable?i:t(this.messages.attachments.attachmentNumberedLabel,{index:a+1})}_formatAttachmentSize(e){return null==e||Number.isNaN(e)?this.messagesCommon.notApplicable:r(this.messagesUnits,e)}_getLabelForAttachmentType({contentType:e}){if(!e)return this.messagesCommon.notApplicable;const t=this.messages.attachments.attachmentTypes,a=p(e);return t?.[a]||e}_renderAttachmentPreviewThumbnail(e,t,a){const i=a.getAttachmentPreviewUrl(e,64);return i&&f(e)?ae("img",{alt:t,class:y.attachmentElementListItemThumb,src:i}):ae("calcite-icon",{class:y.attachmentElementListItemIcon,icon:g(e.contentType),scale:"s"})}_renderAttachmentPreviewImageForInput(e,t){const a=t.getAttachmentPreviewUrl(e),i=e.name||this.messagesCommon.details;return a&&f(e)?ae("img",{alt:i,class:y.attachmentElementDetailPreviewImage,src:a,title:i}):[ae("calcite-icon",{class:y.attachmentElementDetailPreviewIcon,icon:g(e.contentType),scale:"l",textLabel:i,title:i}),this.messages.attachments.noPreviewAvailable]}async _downloadAttachment(e){await z(e)}_exitAttachmentReplaceView(){this.viewModel.setShowingSelectedAttachmentReplacePage(!1),this._selectedAttachmentReplaceFileInput=null}async _stageSelectedAttachmentReplacement(e){const t=this.selectedAttachmentDetails,a=t?.attachment.globalId;if(t&&a)try{await this.viewModel.stageReplaceAttachment(t.input.template.elementId,a,e)}finally{this._exitAttachmentReplaceView()}}_renameSelectedAttachment(e){const t=this.selectedAttachmentDetails,a=t?.attachment.globalId;t&&a&&this.viewModel.stageRenameAttachment(t.input.template.elementId,a,e)}_isSelectedAttachmentDeleteDisabled(){const e=this.selectedAttachmentDetails;if(!e)return!1;if(this.readOnly||this.effectiveDisabled)return!0;const t=e.input.minAttachmentCount;return null!=t&&e.input.attachments.length<=t}hideAttachmentDialog(){this._attachmentDialogInfo=null}_renderTextComponent(e){const{elementId:t}=e.template;return ae("div",{class:y.textElementInput,"data-testid":`text-element-${t}`,innerHTML:e.text,key:`text-element-${t}`})}_renderUtilityNetworkAssociationsElementInput(e){if(!this._associationsEnabled)return;const{elementId:t}=e.template;return ae("div",{class:y.utilityNetworkAssociationsElementInput,"data-testid":t,key:t})}getCommonInputProps(e){const{template:t,valid:a,value:i,minLength:n,maxLength:l,required:s,fieldName:o,editable:r,userHasChangedValue:c,range:{max:d,min:m}}=e,h=!r||this.readOnly,u=!h&&this.effectiveDisabled;let p=t.hint??void 0,g=!1;return i===L&&(p=this.messages.differentValuesPlaceholder,g=!0),{afterCreate:this._afterComponentCreateOrUpdate,afterUpdate:this._afterComponentCreateOrUpdate,"aria-invalid":a?"false":"true",class:this.classes(y.fieldInput,h?y.inputDisabled:null),status:!c&&!this.viewModel.submitHasBeenAttempted||a?"idle":"invalid",maxLength:l&&l>-1?l:void 0,minLength:n&&n>-1?n:void 0,key:t.elementId,label:o,name:o,max:null!=d?d:void 0,min:null!=m?m:void 0,disabled:u,readOnly:h,onblur:this._onComponentBlur,required:s,placeholder:p,value:g?"":i??"",[le]:t.elementId,onfocus:this._onComponentFocus}}_onFormSubmit(e){e.preventDefault()}_getFieldInputFromHTMLElement(e){return this.viewModel.findFieldInput(e.getAttribute(le))}_afterRadioGroupCreateOrUpdate(e){const t=e.selectedItem,a=e.querySelector("calcite-radio-button"),i=t||a;i&&this._afterComponentCreateOrUpdate(i)}_onComponentFocus(e){const t=e.target,a=this._getFieldInputFromHTMLElement(t);this._touchedInputs.add(a.template.elementId),this._focusedFieldInput=a}_afterComponentCreateOrUpdate(e){const t=this._getFieldInputFromHTMLElement(e),a=this._focusedFieldInput;this._attemptFocusOnNextRender&&a===t&&(this._attemptFocusOnNextRender=!1,ie(e))}_onComponentBlur(){this._focusedFieldInput=null}_resetTransientFormState(){this._attemptFocusOnNextRender=!1,this._focusedFieldInput=null,this._attachmentDialogInfo=null,this._selectedAttachmentReplaceFileInput=null,this._attachmentListFilterText="",this._attachmentFileInputMap.clear()}_parseValue(e,t,a=!1){const i=t.multipleChoiceInput,n=t.multipleChoiceValues;if(i&&n){const l=i.choiceDelimiter,s=e;if(a){return $({input:t}).checked?null:n.length>0?n.join(l):null}const o=B(t.value,l).filter(e=>e!==L),r=new Set(o);s.checked?r.add(s.value):r.delete(s.value);const c=n.filter(e=>r.has(e));return c.length?c.join(l):null}if(_(t.template,"switch")){if("calcite-dropdown"===e.localName&&t.domain)for(const a of t.domain.codedValues)if(a.name===e.selectedItems[0].textContent)return a.code;return e.checked?t.template.input.onValue:t.template.input.offValue}const l=e.value;return null==l||""===l?null:"number"===t.dataType?"-0"===l||"-0."===l||"-0,"===l?l:parseFloat(l):"date"===t.field.type?parseFloat(l):l}_saveInput(e){const t=this._getFieldInputFromHTMLElement(e),{elementId:a}=t.template;if(!t)return;const i=t?.value;if(_(t.template,"switch")&&"single"!==this.viewModel.mode){const e=n(this._batchSwitchInputInitialValues,t,()=>t.value);this._batchSwitchInputInitialValues.set(t,null===e?i:e)}const l=this._parseValue(e,t);l!==i&&this.viewModel.setValue(a,l)}_afterDateComponentCreate(e){this._setDateTimeTimeZoneMap(e),this._afterComponentCreateOrUpdate(e)}_saveValueFromDateComponent(e,t){const{elementId:a}=e.template,i=e.field.type,n=this._dateComponentMap.get(`${a}`);if(!n)return;const l=e.effectiveTimeZone;let s=e.value===L?void 0:e.value,o=null;"date-only"===i?o=Array.isArray(t.value)?t.value[0]:t.value:"time-only"===i?(s=K(s),o=K(t.value)):o="timestamp-offset"===i?null!=t.value?J({dateComponent:n.date,timeComponent:n.time,oldValue:s,timeZoneComponent:n.timeZone,defaultTimeZone:l}):null:null!=t.value?Q({oldValue:s,dateComponent:n.date,timeZone:l,timeComponent:n.time?.value===L?void 0:n.time}):null,s!==o&&(null!==o&&t.value?this.viewModel.setValue(`${a}`,o):this.viewModel.setValue(`${a}`,null))}};e([c()],re.prototype,"activeFeatureIndex",null),e([c()],re.prototype,"callbacks",null),e([c()],re.prototype,"disabled",null),e([c()],re.prototype,"effectiveTitle",null),e([c()],re.prototype,"effectiveDisabled",null),e([c()],re.prototype,"features",null),e([c()],re.prototype,"footerButtonInfos",null),e([c()],re.prototype,"footerNoticeInfos",null),e([c()],re.prototype,"map",null),e([c()],re.prototype,"maximumFeatureCount",null),e([c()],re.prototype,"maximumFeatureCountWithComplexForms",null),e([c()],re.prototype,"spatialReference",null),e([c()],re.prototype,"layerInfos",null),e([c()],re.prototype,"timeZone",null),e([c()],re.prototype,"headingLevel",void 0),e([c()],re.prototype,"icon",null),e([c(),ee("esri/t9n/common")],re.prototype,"messagesCommon",void 0),e([c(),ee("esri/widgets/BatchAttributeForm/t9n/BatchAttributeForm")],re.prototype,"messages",void 0),e([c(),ee("esri/core/t9n/Units")],re.prototype,"messagesUnits",void 0),e([c()],re.prototype,"page",null),e([c()],re.prototype,"readOnly",null),e([c()],re.prototype,"selectedAttachment",null),e([c()],re.prototype,"selectedAttachmentDetails",null),e([c()],re.prototype,"valid",null),e([c({type:A}),te(["value-change","submit"])],re.prototype,"viewModel",void 0),e([c({type:D,nonNullable:!0})],re.prototype,"visibleElements",void 0),e([c()],re.prototype,"groupDisplay",void 0),e([c()],re.prototype,"_associationsEnabled",null),e([c()],re.prototype,"_attemptFocusOnNextRender",void 0),e([c()],re.prototype,"_formId",null),e([c()],re.prototype,"_focusedFieldInput",void 0),e([c()],re.prototype,"_attachmentDialogInfo",void 0),e([c()],re.prototype,"_attachmentListFilterText",void 0),re=e([d("esri.widgets.BatchAttributeForm")],re);const ce=re;export{ce as default};
2
+ import{__decorate as e}from"tslib";import{substitute as t}from"../intl.js";import{deprecateWidget as a}from"../core/deprecate.js";import i from"../core/Logger.js";import{getOrCreateMapValue as n}from"../core/MapUtils.js";import{watch as l,when as s,on as o}from"../core/reactiveUtils.js";import{formatFileSize as r}from"../core/unitFormatUtils.js";import{property as c,subclass as d}from"../core/accessorSupport/decorators.js";import{isIntegerField as m}from"../layers/support/fieldUtils.js";import{isString as h}from"../support/guards.js";import u from"./Widget.js";import{getAttachmentTypeCategory as p,getCalciteIconForAttachment as g}from"./Attachments/support/attachmentUtils.js";import{getAttachmentKey as v,isImageAttachment as f}from"./BatchAttributeForm/attachmentUtils.js";import{getHiddenFieldsValidationErrorMessage as b,getVisibleFieldInputValidationErrorMessage as C,isElementTemplateWithInputType as _}from"./BatchAttributeForm/batchAttributeFormUtils.js";import A from"./BatchAttributeForm/BatchAttributeFormViewModel.js";import{css as y}from"./BatchAttributeForm/css.js";import{makeAddAttachmentFooterButtons as I,makeDiscardAttachmentFooterButtons as F,makeReplaceAttachmentFooterButtons as w,makeViewingAttachmentFooterButtons as k,makeDefaultFooterButtons as x}from"./BatchAttributeForm/interfaceUtils.js";import D from"./BatchAttributeForm/VisibleElements.js";import{isGroupInput as M,isFieldInput as S,isTextElementInput as E,isRelationshipElementInput as O,isAttachmentElementInput as T,isUtilityNetworkAssociationsElementInput as V,differentValuesString as L}from"./BatchAttributeForm/inputs/support/inputUtils.js";import{clearMultipleChoiceOtherChoiceStateForViewModel as R,getMultipleChoiceCheckboxState as P,otherChoiceCheckedPlaceholderValue as U,getUpdatedMultipleChoiceValueForFeature as N,getMultipleChoiceSelectAllState as B,splitMultipleChoiceValue as $,canRestoreMultipleChoiceOtherChoiceDraftValue as j}from"./BatchAttributeForm/inputs/support/multipleChoiceInputUtils.js";import{downloadAttachmentInfo as z}from"./FeatureTable/support/exportUtils.js";import{loadCalciteComponents as H}from"./support/componentsUtils.js";import{getLabelForDateFieldValue as Z,getIntlOptionsForField as q,prepareISOFieldValueForDateComponents as G,prepareUnixFieldValueForDateComponents as W,normalizeTimeOnlyString as K,getISOFieldValueFromDateComponents as X,getUnixFieldValueFromDateComponents as J}from"./support/dateUtils.js";import{globalCss as Q}from"./support/globalCss.js";import{calciteListFilterProps as Y}from"./support/listUtils.js";import{messageBundle as ee,vmEvent as te,tsx as ae}from"./support/widget.js";import{setFocus as ie}from"./support/widgetUtils.js";import{isEmptyValue as ne}from"./support/forms/formUtils.js";const le="data-element-id",se="esri_BatchAttributeForm_select_all",oe="esri_BatchAttributeForm_other_choice";let re=class extends u{constructor(e,t){super(e,t),this.headingLevel=2,this.messagesCommon=null,this.messages=null,this.messagesUnits=null,this.viewModel=new A,this.visibleElements=new D,this.groupDisplay="all",this._attemptFocusOnNextRender=!1,this._dateComponentMap=new Map,this._touchedInputs=new Set,this._focusedFieldInput=null,this._batchSwitchInputInitialValues=new Map,this._attachmentDialogInfo=null,this._attachmentListFilterText="",this._attachmentFileInputMap=new Map,this._selectedAttachmentReplaceFileInput=null,this._maximizeSelectedAttachment=()=>{this._attachmentDialogInfo=this.selectedAttachmentDetails},this._enterAttachmentReplaceView=()=>{this.readOnly||this.effectiveDisabled||!this.selectedAttachmentDetails||this.viewModel.setShowingSelectedAttachmentReplacePage(!0)},this._setSelectedAttachmentReplaceFileInput=e=>{this._selectedAttachmentReplaceFileInput=e},this._openSelectedAttachmentReplaceFilePicker=()=>{this.readOnly||this.effectiveDisabled||this._selectedAttachmentReplaceFileInput?.click()},this._resetSelectedAttachmentName=()=>{const e=this.selectedAttachmentDetails,t=e?.attachment.globalId,a=e?e.input.getAttachmentEditState(e.attachment).initialName:null;e&&t&&null!=a&&this.viewModel.stageRenameAttachment(e.input.template.elementId,t,a)},this._resetSelectedAttachmentChanges=()=>{const e=this.selectedAttachmentDetails,t=e?.attachment.globalId;e&&t&&this.viewModel.resetAttachmentChanges(e.input.template.elementId,t)},this._deleteSelectedAttachment=()=>{const e=this.selectedAttachmentDetails,t=e?.attachment.globalId;e&&t&&!this._isSelectedAttachmentDeleteDisabled()&&(this.viewModel.stageDeleteAttachment(e.input.template.elementId,t),this._setSelectedAttachment(null))},this._closeAttachmentDialog=()=>{this.hideAttachmentDialog()},this._saveInput=this._saveInput.bind(this),this._onFormSubmit=this._onFormSubmit.bind(this),this._onComponentFocus=this._onComponentFocus.bind(this),this._onComponentBlur=this._onComponentBlur.bind(this),this._afterComponentCreateOrUpdate=this._afterComponentCreateOrUpdate.bind(this),this._afterDateComponentCreate=this._afterDateComponentCreate.bind(this),this._afterRadioGroupCreateOrUpdate=this._afterRadioGroupCreateOrUpdate.bind(this),e?.suppressDeprecationWarning||(this.announceDeprecation=()=>{a(i.getLogger(this),"Editor","arcgis-editor",{version:"5.0"})})}normalizeCtorArgs(e={}){const{suppressDeprecationWarning:t,...a}=e;return a}initialize(){this.addHandles([l(()=>this.features,()=>{this._dateComponentMap.clear(),this._resetTransientFormState(),R(this.viewModel,{includeDraftValues:!0})}),l(()=>this.viewModel.activeForm,()=>{this._batchSwitchInputInitialValues.clear(),this._resetTransientFormState(),R(this.viewModel)}),l(()=>this.viewModel.selectedAttachmentAddElementId,()=>{this.hideAttachmentDialog()}),s(()=>!this.selectedAttachmentDetails,()=>this.hideAttachmentDialog()),l(()=>this.viewModel.selectedAttachmentListElementId,()=>{this._attachmentListFilterText=""}),o(()=>this.viewModel,"submit",()=>{this.valid||this.goToFirstError()})])}loadDependencies(){return H({action:()=>import("@esri/calcite-components/dist/components/calcite-action"),block:()=>import("@esri/calcite-components/dist/components/calcite-block"),button:()=>import("@esri/calcite-components/dist/components/calcite-button"),checkbox:()=>import("@esri/calcite-components/dist/components/calcite-checkbox"),combobox:()=>import("@esri/calcite-components/dist/components/calcite-combobox"),"combobox-item":()=>import("@esri/calcite-components/dist/components/calcite-combobox-item"),"combobox-item-group":()=>import("@esri/calcite-components/dist/components/calcite-combobox-item-group"),dialog:()=>import("@esri/calcite-components/dist/components/calcite-dialog"),dropdown:()=>import("@esri/calcite-components/dist/components/calcite-dropdown"),"dropdown-group":()=>import("@esri/calcite-components/dist/components/calcite-dropdown-group"),"dropdown-item":()=>import("@esri/calcite-components/dist/components/calcite-dropdown-item"),icon:()=>import("@esri/calcite-components/dist/components/calcite-icon"),input:()=>import("@esri/calcite-components/dist/components/calcite-input"),"input-date-picker":()=>import("@esri/calcite-components/dist/components/calcite-input-date-picker"),"input-number":()=>import("@esri/calcite-components/dist/components/calcite-input-number"),"input-time-picker":()=>import("@esri/calcite-components/dist/components/calcite-input-time-picker"),"input-time-zone":()=>import("@esri/calcite-components/dist/components/calcite-input-time-zone"),label:()=>import("@esri/calcite-components/dist/components/calcite-label"),"input-message":()=>import("@esri/calcite-components/dist/components/calcite-input-message"),loader:()=>import("@esri/calcite-components/dist/components/calcite-loader"),list:()=>import("@esri/calcite-components/dist/components/calcite-list"),"list-item":()=>import("@esri/calcite-components/dist/components/calcite-list-item"),notice:()=>import("@esri/calcite-components/dist/components/calcite-notice"),switch:()=>import("@esri/calcite-components/dist/components/calcite-switch"),"text-area":()=>import("@esri/calcite-components/dist/components/calcite-text-area"),"radio-button":()=>import("@esri/calcite-components/dist/components/calcite-radio-button"),"radio-button-group":()=>import("@esri/calcite-components/dist/components/calcite-radio-button-group")})}get activeFeatureIndex(){return this.viewModel.activeFeatureIndex}set activeFeatureIndex(e){this.viewModel.activeFeatureIndex=e}get callbacks(){return this.viewModel.callbacks}set callbacks(e){this.viewModel.callbacks=e}get disabled(){return this.viewModel.disabled}set disabled(e){this.viewModel.disabled=e}get effectiveTitle(){const{features:e,messages:t,page:a}=this;return"replacing-attachment"===a?t.titles.replaceAttachment:"viewing-attachment-details"===a?t.titles.editAttachment:"adding-attachments"===a?t.titles.addAttachments:"viewing-attachments"===a?t.titles.attachments:1===e.length||this.activeFeatureIndex>-1?t.titles.editFeature:e.length>1?t.titles.editFeatures:""}get effectiveDisabled(){return this.disabled||this.viewModel.updating}get features(){return this.viewModel.features}set features(e){this.viewModel.features=e}get footerButtonInfos(){if(!this.features.length)return[];const{page:e,messages:t}=this,a=this.viewModel.selectedAttachmentAddElementId,i=this.selectedAttachmentDetails,n=i?i.input.getAttachmentEditState(i.attachment):null;if("adding-attachments"===e&&a)return I({messages:t,onclick:()=>this._attachmentFileInputMap.get(a)?.click()});return!!i&&"replacing-attachment"!==e&&!!n?.isReplaced?F({message:this.messagesCommon.remove,onclick:this._resetSelectedAttachmentChanges}):"replacing-attachment"===e?w({disabled:this.readOnly||this.effectiveDisabled,messages:t,onclick:this._openSelectedAttachmentReplaceFilePicker}):"viewing-attachment-details"===e?k({deleteDisabled:this._isSelectedAttachmentDeleteDisabled(),deleteOnclick:this._deleteSelectedAttachment,doneOnclick:()=>this._setSelectedAttachment(null),messages:t.footerButtons}):"viewing-attachments"===e?[]:x({formId:this._formId,callback:this.submit,messages:t})}get footerNoticeInfos(){if(!this.features.length)return[];const{messages:{footerNotices:e}}=this;return this._isSelectedAttachmentDeleteDisabled()?[{icon:"information",message:e.deleteDisabledMinimumAttachments}]:[]}get map(){return this.viewModel.map}set map(e){this.viewModel.map=e}get maximumFeatureCount(){return this.viewModel.maximumFeatureCount}set maximumFeatureCount(e){this.viewModel.maximumFeatureCount=e}get maximumFeatureCountWithComplexForms(){return this.viewModel.maximumFeatureCountWithComplexForms}set maximumFeatureCountWithComplexForms(e){this.viewModel.maximumFeatureCountWithComplexForms=e}get spatialReference(){return this.viewModel.spatialReference}set spatialReference(e){this.viewModel.spatialReference=e}get layerInfos(){return this.viewModel.layerInfos}set layerInfos(e){this.viewModel.layerInfos=e}get timeZone(){return this.viewModel.timeZone}set timeZone(e){this.viewModel.timeZone=e}get icon(){return"edit-attributes"}set icon(e){this._overrideIfSome("icon",e)}get page(){return this.viewModel.page}get readOnly(){return this.viewModel.readOnly}set readOnly(e){this.viewModel.readOnly=e}get selectedAttachment(){return this.viewModel.selectedAttachment}get selectedAttachmentDetails(){return this.viewModel.selectedAttachmentDetails}get valid(){return this.viewModel.valid}get _associationsEnabled(){const{callbacks:e}=this;return!(!e?.addAssociation||!e.selectAssociatedFeature)}get _formId(){return`${this.id}-form`}async goBack(){return this.viewModel.goBack()}async goHome(){return this.viewModel.goHome()}goToFirstError(){const e=this.viewModel.getFirstVisibleInvalidFieldInput();if(!e)return;const{groupInput:t}=e;t&&(t.open||(t.open=!0)),this._focusedFieldInput=e.input,this._attemptFocusOnNextRender=!0,this.scheduleRender()}render(){return ae("div",{class:this.classes(y.base,Q.widget,Q.panel)},this._renderContent(),this._renderAttachmentDialog())}submit(){return this.viewModel.submit()}_setDateTimeTimeZoneMap(e){const{datePart:t,elementId:a}=e.dataset,i=n(this._dateComponentMap,`${a}`,()=>({}));switch(t){case"date":i.date=e;break;case"time":i.time=e;break;case"timeZone":i.timeZone=e}}_renderContent(){const{messages:e,viewModel:a}=this,{status:i}=a;return"failed"===i?a.hasTooManyComplexFeatures?this._renderErrorNotice(t(e.formFailedToLoadTooManyComplexFeatures,{num:a.maximumFeatureCountWithComplexForms})):a.hasTooManyFeatures?this._renderErrorNotice(t(e.formFailedToLoadTooManyFeatures,{num:a.maximumFeatureCount})):e.formFailedToLoad:a.expressionEvaluationFailed?this._renderErrorNotice(e.expressionEvaluationFailed):a.hasLayersWithContingentValues&&this.viewModel.features.length>1?this._renderErrorNotice(e.unsupportedContingentValues):"loading"===i&&this.visibleElements.loadingIndicator?ae("calcite-loader",{key:"loader",label:this.messagesCommon?.loading}):0!==this.features.length?this._renderForm():void 0}_renderErrorNotice(e,t="warning"){return ae("calcite-notice",{class:y.noticeError,icon:!0,kind:t,open:!0},ae("div",{slot:"message"},e))}_renderForm(){return ae("form",{class:y.form,id:this._formId,onsubmit:this._onFormSubmit},this._renderInvisibleFieldsError(),this._renderPage())}_renderPage(){switch(this.page){case"adding-attachments":return this._renderAttachmentAddPage();case"replacing-attachment":case"viewing-attachments":return this._renderAttachmentListPage();case"viewing-attachment-details":return this._renderAttachmentDetailPage();default:return this._renderFormContent()}}_renderInvisibleFieldsError(){const{viewModel:e}=this,{hasNonActiveInvalidFeatures:t,activeForm:a}=e;let i;if(!e.submitHasBeenAttempted)return null;if(a.invalidHiddenInputs.length>0)if(i=b(a,e.mode,this.messages),"batch"===this.viewModel.mode){const e=a.invalidHiddenInputs.filter(e=>"hidden:group-visibility-expression:all-features"===e.effectiveVisibilityCode||"hidden:visibility-expression:all-features"===e.visibilityCode);e.length>0?i+=` (${e.map(e=>e.label).join(", ")})`:i=null}else i+=` (${a.invalidHiddenInputs.map(e=>e.label).join(", ")})`;else if(t)return null;return i?this._renderErrorNotice(i,"danger"):null}_renderFormContent(){return this.viewModel.hasVisibleInputs?this.viewModel.activeForm.inputs.filter(e=>e.visible).map(e=>this._renderInput(e)):this._renderErrorNotice(this.messages.noVisibleFields[this.viewModel.noVisibleElementsReason])}_renderInput(e){return M(e)?this._renderGroupInput(e):S(e)?this._renderLabeledField(e):E(e)?this._renderTextComponent(e):O(e)?this._renderRelationshipElementInput(e):T(e)?this._renderAttachmentElementInput(e):V(e)?this._renderUtilityNetworkAssociationsElementInput(e):void 0}_renderGroupInput(e){const{inputs:t,template:a,open:i}=e,n=t.filter(e=>e.visible),l=a.label??"";return ae("calcite-block",{class:this.classes(y.group,"sequential"===this.groupDisplay?y.groupSequential:null,this.disabled?y.inputDisabled:null),collapsible:!0,description:a.description??void 0,disabled:this.effectiveDisabled,expanded:i,heading:l,headingLevel:this.headingLevel,key:`{${a.elementId}-key}`,label:l,onCalciteBlockClose:()=>{e.open=!1},onCalciteBlockOpen:()=>{e.open=!0}},n.map(e=>this._renderInput(e)))}_renderLabeledField(e){const{elementId:a}=e.template,{label:i,required:n,dataType:l}=e,s=n?t(this.messages.requiredFieldLabel,{name:i}):i;return ae("calcite-label",{"aria-label":s,class:y.label,key:`field--${a}`},ae("div",{class:y.labelTextContent,key:"labelTextContainer"},i,n?ae("span",{"aria-hidden":"true",title:this.messagesCommon.required},"*"):void 0),"unsupported"!==l?this._renderFieldInput(e):this._renderReadOnlyComponent(e),this._renderAuxiliaryText(e))}_renderFieldInput(e){const t=this.getCommonInputProps(e),{dataType:a}=e;return"date"===a?this._renderDateComponents(e,t):"coded-value"===e.domain?.type?this._renderCodedInputs({input:e,props:t}):null!==e.multipleChoiceChoices?this._renderMultipleChoiceComponent({input:e,props:t}):"number"===a?this._renderNumberComponent(e,t):this._renderStringComponent(e,t)}_renderAuxiliaryText(e){const{compositeError:t,description:a,submittable:i}=e,n=!i&&t&&(this.viewModel.submitHasBeenAttempted||this._touchedInputs.has(e.template.elementId))?C(e,t,this.messages):null;return n?ae("calcite-input-message",{icon:!0,status:"invalid"},n):a?ae("calcite-input-message",{class:y.description,icon:!1,status:"idle"},a):null}_renderCodedInputs({input:e,props:t}){const a=e.input?.type??null,i=e.codedValueOptions;switch(a){case"switch":return this._renderSwitchField({input:e,props:t});case"radio-buttons":return this._renderRadioButtonGroupComponent({input:e,options:i,props:t});default:return this._renderComboBoxComponent({options:i,props:t,input:e})}}_renderMultipleChoiceComponent({input:e,props:t}){const{messages:a}=this,{multipleChoiceChoices:i,multipleChoiceInput:n,multipleChoiceValues:l}=e;if(!n||!i||!l)return null;const s=!0===n.includeSelectAllChoices,o=new Map;let r=l.length>0,c=!1;for(const f of l){const t=P({input:e,choiceValue:f});o.set(f,t),(t.checked||t.indeterminate)&&(c=!0),t.checked||(r=!1)}const d={checked:r,indeterminate:!r&&c},m=d.checked?a.deselectAllLabel:a.selectAllLabel,h=e.getMultipleChoiceOtherChoiceRenderState(this.messages.otherOptionLabel),u=t=>{this._saveValueFromMultipleChoiceCheckbox({input:e,checkbox:t,isSelectAllCheckbox:!0})},p=t=>{this._saveValueFromMultipleChoiceCheckbox({input:e,checkbox:t})},g=t=>{const{fieldName:a}=h;a&&this._saveOtherChoiceCheckboxValue({input:e,isChecked:t.checked,otherChoiceFieldName:a})},v=t=>{this._saveValueFromMultipleChoiceTextInput({input:e,textInput:t,otherChoiceFieldName:h.fieldName})};return ae("div",{class:y.multipleChoiceInput,key:`${t.key}-multiple-choice-group`},s?this._renderMultipleChoiceSelectAllCheckbox({props:t,selectAllState:d,selectAllLabel:m,handleSelectAllCheckboxChange:u}):null,this._renderMultipleChoiceChoiceCheckboxes({input:e,props:t,checkboxStatesByValue:o,handleChoiceCheckboxChange:p}),h.shouldShow?this._renderMultipleChoiceOtherChoice({props:t,includeSelectAllChoices:s,otherChoiceRenderState:h,handleOtherChoiceCheckboxChange:g,handleOtherChoiceInputChange:v,differentValuesPlaceholder:a.differentValuesPlaceholder}):null)}_renderMultipleChoiceSelectAllCheckbox({props:e,selectAllState:t,selectAllLabel:a,handleSelectAllCheckboxChange:i}){return ae("calcite-checkbox",{afterCreate:e.afterCreate,afterUpdate:e.afterUpdate,"aria-invalid":e["aria-invalid"],checked:t.checked,class:y.multipleChoiceSelectAll,"data-element-id":e[le],disabled:e.readOnly,indeterminate:t.indeterminate,key:`${e.key}-select-all`,label:a,labelText:a,value:se,onblur:e.onblur,onCalciteCheckboxChange:({currentTarget:e})=>i(e),onfocus:e.onfocus})}_renderMultipleChoiceChoiceCheckboxes({input:e,props:t,checkboxStatesByValue:a,handleChoiceCheckboxChange:i}){const{multipleChoiceChoices:n}=e;return n?n.map(e=>{const n=a.get(e.value)??{checked:!1,indeterminate:!1};return ae("calcite-checkbox",{afterCreate:t.afterCreate,afterUpdate:t.afterUpdate,"aria-invalid":t["aria-invalid"],checked:n.checked,class:t.class,"data-element-id":t[le],disabled:t.readOnly,indeterminate:n.indeterminate,key:`${t.key}-${e.value}`,label:e.label,labelText:e.label,required:t.required,value:e.value,onblur:t.onblur,onCalciteCheckboxChange:({currentTarget:e})=>i(e),onfocus:t.onfocus})}):[]}_renderMultipleChoiceOtherChoice({props:e,includeSelectAllChoices:t,otherChoiceRenderState:a,handleOtherChoiceCheckboxChange:i,handleOtherChoiceInputChange:n,differentValuesPlaceholder:l}){return ae("div",{class:this.classes(y.multipleChoiceOtherChoice,t?y.multipleChoiceOtherChoiceWithSelectAll:null),key:`${e.key}-other-choice`},ae("calcite-checkbox",{afterCreate:e.afterCreate,afterUpdate:e.afterUpdate,"aria-invalid":e["aria-invalid"],checked:a.checkboxState.checked,class:e.class,"data-element-id":e[le],disabled:e.readOnly,indeterminate:a.checkboxState.indeterminate,key:`${e.key}-other-choice-checkbox`,label:a.label,labelText:a.label,value:oe,onblur:e.onblur,onCalciteCheckboxChange:({currentTarget:e})=>i(e),onfocus:e.onfocus}),a.checkboxState.checked?ae("calcite-input",{afterCreate:e.afterCreate,afterUpdate:e.afterUpdate,"aria-invalid":e["aria-invalid"],"aria-label":a.label,class:y.textElementInput,"data-element-id":e[le],disabled:e.readOnly,key:`${e.key}-other-choice-input`,maxLength:a.maxLength,placeholder:a.value===L?l:a.hint,required:e.required,type:"text",value:a.normalizedValue===L?"":a.normalizedValue?String(a.normalizedValue):"",onblur:e.onblur,onCalciteInputInput:({currentTarget:e})=>n(e),onfocus:e.onfocus}):null)}async _saveValueFromMultipleChoiceCheckbox({input:e,checkbox:t,isSelectAllCheckbox:a=!1}){if(this._markFieldInputTouched(e),e.multipleChoiceInput&&!a&&"batch"===this.viewModel.mode)return void await this._saveMultipleChoiceCheckboxValueByFeature({input:e,checkbox:t});const i=e.value,n=this._parseValue(t,e,a);n!==i&&await this.viewModel.setValue(e.template.elementId,n)}async _saveValueFromMultipleChoiceTextInput({input:e,textInput:t,otherChoiceFieldName:a}){if(!a)return;const i=t.value,n=null==i||""===i?null:i;e.initializeExplicitMultipleChoiceOtherChoiceCheckedState(),e.stashMultipleChoiceOtherChoiceDraftValueForFeatures(e.features,n);const l=e.features.toArray().filter(e=>e.getAttribute(a)!==n);if(0!==l.length){for(const e of l)e.setAttribute(a,n);this.viewModel.userHasChangedValues=!0,await e.expressionsManager.valueChanged(a,l),this.viewModel.emit("value-change",{features:l.map(e=>e.source),fieldName:a,name:"value-change",value:n})}}async _saveOtherChoiceCheckboxValue({input:e,isChecked:t,otherChoiceFieldName:a}){e.setExplicitMultipleChoiceOtherChoiceCheckedState(t),this._markFieldInputTouched(e),t||e.setMultipleChoiceOtherChoiceDraftValuesFromFeatures(e.features.toArray());const i=e.features.toArray().filter(i=>{const n=i.getAttribute(a);if(t){if(!ne(n))return!1;const t=e.getMultipleChoiceOtherChoiceDraftValue(i),l=j(t)?t:U;return i.setAttribute(a,l),!0}return null!=n&&(i.setAttribute(a,null),!0)});0!==i.length&&(this.viewModel.userHasChangedValues=!0,await e.expressionsManager.valueChanged(a,i),this.viewModel.emit("value-change",{features:i.map(e=>e.source),fieldName:a,name:"value-change",value:this._getFieldValueByFieldNameForInput(e,a)}))}async _saveMultipleChoiceCheckboxValueByFeature({input:e,checkbox:t}){if(!e.multipleChoiceInput||!e.multipleChoiceValues)return;const a=e.features.toArray().filter(a=>{const i=a.getAttribute(e.fieldName),n=N({input:e,choiceValue:t.value,currentValue:i,isChecked:t.checked});return i!==n&&(a.setAttribute(e.fieldName,n),!0)});0!==a.length&&(this.viewModel.userHasChangedValues=!0,await e.expressionsManager.valueChanged(e.fieldName,a),this.viewModel.emit("value-change",{features:a.map(e=>e.source),fieldName:e.fieldName,name:"value-change",value:this._getFieldValueByFieldNameForInput(e,e.fieldName)}))}_getFieldValueByFieldNameForInput(e,t){const a=e.features.toArray().map(e=>e.getAttribute(t));if(0===a.length)return null;const[i]=a;return a.every(e=>e===i)?i:L}_renderSwitchField({input:e,props:t}){if((this._batchSwitchInputInitialValues.get(e)===L||e.value===L)&&"batch"===this.viewModel.mode){const a={dropdown:{afterCreate:this._afterComponentCreateOrUpdate,afterUpdate:this._afterComponentCreateOrUpdate,disabled:t.readOnly,open:!1,[le]:t[le]},trigger:{appearance:"transparent",iconEnd:"chevron-down",kind:"neutral",slot:"trigger",label:t.label},group:{mode:"single"}};return this._renderDropdownComponent({buttonValue:e.value,dropdownProps:a,options:[{name:this.messages.differentValuesPlaceholder,value:L,disabled:!0},...e.codedValueDomainOptions]})}return this._renderSwitchComponent({input:e,props:t})}_renderSwitchComponent({input:e,props:t}){return ae("calcite-switch",{...t,checked:!!_(e.template,"switch")&&e.value===e.template.input.onValue,class:y.inputSwitch,disabled:t.readOnly,onblur:()=>{this._focusedFieldInput=null},onCalciteSwitchChange:({currentTarget:e})=>this._saveInput(e)})}_renderDropdownComponent({buttonValue:e,options:t,dropdownProps:a}){const{trigger:i,dropdown:n,group:l}=a;return ae("calcite-dropdown",{...n,topLayerDisabled:this.topLayerDisabled,onblur:()=>{this._focusedFieldInput=null},onCalciteDropdownSelect:({currentTarget:e})=>this._saveInput(e),onfocus:this._onComponentFocus},ae("calcite-button",{...i},e===L?this.messages.differentValuesPlaceholder:e),ae("calcite-dropdown-group",{selectionMode:l.mode},t.map(t=>ae("calcite-dropdown-item",{disabled:t.disabled,label:String(t.name),selected:e===t.value},t.name))))}_renderComboBoxComponent({input:e,options:t,props:a}){const i="INSERT"===this.viewModel.editType,n=this._touchedInputs.has(e?.template?.elementId),l=i&&e.showNoValueOptionEnabled&&!n?()=>{}:a.onblur,s={...a,onblur:l};return ae("calcite-combobox",{...s,selectionMode:"single",topLayerDisabled:this.topLayerDisabled,value:a.placeholder===this.messages.differentValuesPlaceholder?L:String(a.value),onCalciteComboboxChange:({currentTarget:e})=>{e.value!==L&&this._saveInput(e)}},this.renderComboboxOptionsList({input:e,options:t,props:a}))}renderComboboxOptionsList({input:e,options:t,props:a}){const i=e=>e.map(e=>{const{value:t}=e,i=ne(e.value)?this.messages.empty:e.name;return ae("calcite-combobox-item",{heading:i,key:`#${t}`,selected:a.value===t,value:`${t}`})});let n=[];const{messages:l}=this;t.other.length>0&&n.push(ae("calcite-combobox-item-group",{key:"other",label:l.other},i(t.other))),t.unsupported.length>0&&n.push(ae("calcite-combobox-item-group",{key:"unsupported",label:l.unsupported},i(t.unsupported)));const s=i(t.recommended);n.length>0?n.unshift(ae("calcite-combobox-item-group",{key:"recommended",label:l.recommended},s)):n=s;const o=a.placeholder===this.messages.differentValuesPlaceholder,r=!o&&ne(a.value);return e.showNoValueOptionEnabled&&!t.containsEmptyOption&&n.unshift(ae("calcite-combobox-item",{heading:e.showNoValueLabel||this.messages.empty,key:"empty-option",selected:r,value:""})),o&&n.unshift(ae("calcite-combobox-item",{heading:this.messages.differentValuesPlaceholder,key:L,selected:!0,value:L})),n}_renderRadioButtonGroupComponent({input:e,options:t,props:a}){const i=[...t.recommended,...t.other,...t.unsupported].map(({name:t,value:i})=>this._renderRadioButtons({label:t,value:i,selected:i===e.value,props:a}));if(e.showNoValueOptionEnabled&&!t.containsEmptyOption){const t="",n=e.showNoValueLabel||this.messages.empty,l=ne(e.value);i.unshift(this._renderRadioButtons({label:n,value:t,selected:l,props:a}))}return ae("calcite-radio-button-group",{afterCreate:this._afterRadioGroupCreateOrUpdate,afterUpdate:this._afterRadioGroupCreateOrUpdate,class:y.inputRadioGroup,disabled:a.readOnly,key:`${a.key}-radio-group`,layout:"vertical",name:a.name,required:a.required},i,a.placeholder===this.messages.differentValuesPlaceholder?ae("calcite-label",{class:y.placeholderRadio,key:a.label,layout:"inline"},ae("calcite-radio-button",{checked:!0,class:y.inputRadio,disabled:!0,name:a.placeholder,value:a.placeholder}),a.placeholder):null)}_renderRadioButtons({value:e,selected:t,label:a,props:i}){return ae("calcite-label",{class:y.inputRadioLabel,key:i.label,layout:"inline"},ae("calcite-radio-button",{...i,afterCreate:void 0,afterUpdate:void 0,checked:t,class:y.inputRadio,disabled:i.readOnly,name:i.label,value:e,onblur:()=>{this._focusedFieldInput=null},onCalciteRadioButtonChange:({currentTarget:e})=>{e.checked&&this._saveInput(e)}}),a)}_renderStringComponent(e,t){const{template:a}=e;return!a.field.editable||this.readOnly?this._renderReadOnlyComponent(e):"text-area"===a.input?.type?ae("calcite-text-area",{...t,class:this.classes(y.individualElement),resize:"vertical",value:t.value?String(t.value):"",onCalciteTextAreaInput:({currentTarget:e})=>this._saveInput(e)}):ae("calcite-input",{...t,class:this.classes(y.individualElement),type:"text",value:t.value?String(t.value):"",onCalciteInputInput:({currentTarget:e})=>this._saveInput(e)})}_renderNumberComponent(e,t){const a=m(e.field);return ae("calcite-input-number",{...t,integer:a,type:"number",value:a&&""!==t.value?Math.round(parseFloat(String(t.value))).toString():String(t.value),onCalciteInputNumberInput:({currentTarget:e})=>this._saveInput(e)})}_renderReadOnlyComponent(e,t){const a=this.getCommonInputProps(e);return ae("calcite-input",{...a,class:this.classes(y.fieldInput,y.inputDisabled,y.individualElement),readOnly:!0,type:"text",value:String(t??a.value??"")})}_renderDateComponents(e,t){const{field:a}=e;let i;switch(a.type){case"date":i=this._renderDateFieldComponents(e,t);break;case"date-only":i=this._renderDateOnlyFieldComponent(e,t);break;case"time-only":i=this._renderTimeOnlyFieldComponent(e,t);break;case"timestamp-offset":i=this._renderTimestampOffsetFieldComponents(e,t);break;default:i=this._renderReadOnlyComponent(e,Z(a,t.value,{timeZone:e.effectiveTimeZone,...q(e.template.field)}))}return e.value===L?[i,ae("calcite-input-message",{icon:"information",key:"diff-values-message",status:"idle"},this.messages.differentValues)]:i}_renderDateOnlyFieldComponent(e,t){const{class:a,key:i,readOnly:n}=t,{rawMax:l,rawMin:s}=e.range;return ae("calcite-input-date-picker",{afterCreate:this._afterDateComponentCreate,afterUpdate:this._afterComponentCreateOrUpdate,class:a,"data-date-part":"date","data-element-id":t[le],key:`${i}-date-input`,max:h(l)?l:void 0,min:h(s)?s:void 0,overlayPositioning:"fixed",readOnly:n,topLayerDisabled:this.topLayerDisabled,value:e.value===L?"":e.value?String(e.value):"",onblur:()=>{this._focusedFieldInput=null},onCalciteInputDatePickerChange:t=>this._saveValueFromDateComponent(e,t.currentTarget),onfocus:this._onComponentFocus})}_renderTimeOnlyFieldComponent(e,t){const{class:a,key:i,readOnly:n}=t;return ae("calcite-input-time-picker",{afterCreate:this._afterDateComponentCreate,afterUpdate:this._afterComponentCreateOrUpdate,class:a,"data-date-part":"time","data-element-id":t[le],key:`${i}-time-input`,overlayPositioning:"fixed",readOnly:n,value:e.value===L?"":e.value?String(e.value):"",onblur:()=>{this._focusedFieldInput=null},onCalciteInputTimePickerChange:t=>this._saveValueFromDateComponent(e,t.currentTarget),onfocus:this._onComponentFocus})}_renderTimestampOffsetFieldComponents(e,t){const{class:a,key:i,readOnly:n}=t,{rawMax:l,rawMin:s}=e.range,o=G(l),r=G(s),c=G(e.value===L?"":e.value),d=e.includeTimeOffset,m={afterCreate:this._afterDateComponentCreate,afterUpdate:this._afterComponentCreateOrUpdate,overlayPositioning:"fixed",readOnly:n,[le]:t[le],onfocus:this._onComponentFocus};return ae("div",{class:y.dateInputContainer,key:`${i}-date-time-container`},ae("calcite-input-date-picker",{...m,class:a,"data-date-part":"date",key:`${i}-date-input`,max:o?.date??void 0,min:r?.date??void 0,topLayerDisabled:this.topLayerDisabled,value:c.date??"",onblur:()=>{this._focusedFieldInput=null},onCalciteInputDatePickerChange:t=>this._saveValueFromDateComponent(e,t.target)}),ae("calcite-input-time-picker",{...m,class:a,"data-date-part":"time",key:`${i}-time-input`,value:c.time??"",onblur:()=>{this._focusedFieldInput=null},onCalciteInputTimePickerChange:t=>this._saveValueFromDateComponent(e,t.target)}),d?ae("calcite-input-time-zone",{...m,class:a,clearable:e.value===L||null==e.value,"data-date-part":"timeZone",key:`${i}-timezone-input`,value:c.timeZoneOffset||"",onblur:()=>{this._focusedFieldInput=null},onCalciteInputTimeZoneChange:t=>this._saveValueFromDateComponent(e,t.target)}):null)}_renderDateFieldComponents(e,t){const{class:a,key:i,readOnly:n,min:l,max:s}=t,o=e.effectiveTimeZone,r=W(e.value===L?"":e.value,o),c=W(s,o),d=W(l,o),m=e.includeTime,h={afterCreate:this._afterDateComponentCreate,afterUpdate:this._afterComponentCreateOrUpdate,overlayPositioning:"fixed",readOnly:n,[le]:t[le],onfocus:this._onComponentFocus};return ae("div",{class:y.dateInputContainer,key:`${i}-date-time-container`},ae("calcite-input-date-picker",{...h,class:a,"data-date-part":"date",key:`${i}-date-input`,max:c?.date??void 0,min:d?.date??void 0,topLayerDisabled:this.topLayerDisabled,value:r.date??"",onblur:()=>{this._focusedFieldInput=null},onCalciteInputDatePickerChange:t=>this._saveValueFromDateComponent(e,t.target)}),m?ae("calcite-input-time-picker",{...h,"data-date-part":"time",key:`${i}-time-input`,step:1,value:r.time??"",onblur:()=>{this._focusedFieldInput=null},onCalciteInputTimePickerChange:t=>{this._saveValueFromDateComponent(e,t.target)}}):null)}_renderRelationshipElementInput(e){const{elementId:t}=e.template;return ae("div",{class:y.relationshipElementInput,"data-testid":`relationship-element-${t}`,key:`relationship-element-${t}`})}_renderAttachmentElementInput(e){const{allAttachmentsVisibleOnDefaultPage:t,attachments:a,defaultPageAttachments:i,template:{description:n,elementId:l,label:s}}=e,o=t?a:i;return ae("div",{class:y.attachmentElementInput,"data-testid":`attachment-element-${l}`,key:`attachment-element-${l}`},s?ae("div",{class:y.attachmentElementLabel,key:`attachment-element-label-${l}`},s):null,n?ae("div",{class:y.description,key:`attachment-element-description-${l}`},n):null,a.length?this._renderAttachmentList(e,o,{label:s||this.messagesCommon.details,viewAllCount:t?null:a.length}):ae("div",{class:y.attachmentElementEmptyState,key:`attachment-element-empty-state-${l}`},this.messages.attachments.noAttachments),this._renderAttachmentAddAction(e))}_renderAttachmentListPage(){const e=this.viewModel.selectedAttachmentListInput;if(e)return ae("div",{class:y.attachmentElementAllPanel,key:`attachment-element-all-panel-${e.template.elementId}`},this._renderAttachmentList(e,e.attachments,{filterEnabled:!0,label:this.messages.titles.attachments}))}_renderAttachmentList(e,t,a){const{filterEnabled:i,label:n,viewAllCount:l}=a;return ae("calcite-list",{class:y.attachmentElementList,filterEnabled:i,filterPlaceholder:i?this.messages.attachments.searchAttachments:void 0,filterProps:i?Y:void 0,filterText:i?this._attachmentListFilterText:void 0,label:n,selectionAppearance:"border",selectionMode:"none",onCalciteListFilter:i?e=>{this._attachmentListFilterText=e.currentTarget.filterText??""}:void 0},this._renderAttachmentListItems(e,t),null!=l?this._renderViewAllAttachmentsItem(e,l):null)}_renderAttachmentListItems(e,t){const{elementId:a}=e.template;return t.map((t,i)=>{const n=this._formatAttachmentSize(t.size),l=this._getAttachmentLabel(t,i,n,e.displayFilename),s=l===n?void 0:n,o=v(t),r=e.isStagedAttachmentAddition(t),c=e.getAttachmentEditState(t),d=r||c.isRenamed||c.isReplaced;return ae("calcite-list-item",{class:y.attachmentElementListItem,description:s,key:`attachment-item-${o}`,label:l,onCalciteListItemSelect:r?void 0:()=>this._setSelectedAttachment({attachmentKey:o,elementId:a})},ae("div",{class:y.attachmentElementListItemStart,slot:"content-start"},this._renderAttachmentPreviewThumbnail(t,l,e)),d?ae("span",{class:y.attachmentElementListItemStagedIndicator,slot:"content-end"}):null,r?[ae("calcite-action",{disabled:this.effectiveDisabled,icon:"x",scale:"s",slot:"actions-end",text:this.messagesCommon.delete,title:this.messagesCommon.delete,onclick:()=>this.viewModel.stageDeleteAttachment(a,t.globalId)})]:ae("calcite-action",{icon:"chevron-right",scale:"s",slot:"actions-end",text:l,title:l}))})}_renderViewAllAttachmentsItem(e,a){const{elementId:i}=e.template,{viewAll:n}=this.messages.attachments;return ae("calcite-list-item",{class:y.attachmentElementListItem,description:t(this.messages.attachments.count,{count:a}),key:`attachment-item-view-all-${i}`,label:n,onCalciteListItemSelect:()=>this._setAttachmentListElementId(i)},ae("calcite-action",{icon:"chevron-right",scale:"s",slot:"actions-end",text:n,title:n}))}_renderAttachmentAddAction(e){const{elementId:t}=e.template,a=this.effectiveDisabled||e.addDisabled;return ae("div",{class:y.attachmentElementEmptyAction,key:`attachment-element-empty-action-${t}`},ae("calcite-button",{appearance:"outline",disabled:a,iconStart:"attachment",kind:"neutral",round:!0,scale:"s",onclick:()=>this._setAttachmentAddElementId(t)},this.messages.attachments.attach))}_renderAttachmentAddPage(){const e=this.viewModel.selectedAttachmentAddInput;return e?this._renderAttachmentAddPanel(e):null}_renderAttachmentAddPanel(e){const{maxAttachmentCount:t}=e,{elementId:a}=e.template,i=null==t||t-e.attachments.length>1,n=this.effectiveDisabled||e.addDisabled,l=this.messages.attachments,s=l.dragAndDropFile,o="upload",r=e=>{this._attachmentFileInputMap.set(a,e)};return ae("div",{class:y.attachmentElementAddPanel,key:`attachment-element-add-panel-${a}`},ae("input",{accept:e.accept,afterCreate:r,afterRemoved:()=>{this._attachmentFileInputMap.delete(a)},afterUpdate:r,class:y.attachmentElementFileInput,"data-element-id":a,disabled:n,multiple:i,type:"file",onchange:e=>{const t=e.currentTarget,i=t.files?Array.from(t.files):[];this._stageAttachmentFiles(a,i),t.value=""}}),ae("div",{class:y.attachmentElementAddDropzone,"data-disabled":n?"true":"false",ondragover:e=>{e.preventDefault()},ondrop:e=>{if(e.preventDefault(),n)return;const t=e.dataTransfer?.files?Array.from(e.dataTransfer.files):[];this._stageAttachmentFiles(a,t)}},ae("calcite-icon",{class:y.attachmentElementAddDropzoneIcon,icon:o,scale:"l"}),ae("div",{class:y.attachmentElementAddDropzoneHeading},l.addFile),ae("div",{class:y.attachmentElementAddDropzoneDetail,title:s},s),ae("calcite-button",{appearance:"outline-fill",disabled:n,iconStart:"folder-open",scale:"s",type:"button",onclick:e=>{e.stopPropagation(),this._openAttachmentFilePicker(a,n)}},l.selectFile)))}async _stageAttachmentFiles(e,t){if(0!==t.length)try{await this.viewModel.stageAddAttachments(e,t)}finally{this.viewModel.setSelectedAttachmentAddElementId(null)}}_openAttachmentFilePicker(e,t){t||this._attachmentFileInputMap.get(e)?.click()}_renderAttachmentDetailPage(){const e=this.selectedAttachmentDetails;if(!e)return;if("replacing-attachment"===this.page)return this._renderAttachmentReplacePanel(e);const{attachment:t,input:a}=e,i=v(t),n=!!a.getAttachmentPreviewUrl(t),l=a.getAttachmentEditState(t),s=!this.readOnly&&!this.effectiveDisabled;return ae("div",{class:y.attachmentElementDetail,key:`attachment-detail-panel-${a.template.elementId}-${i}`},ae("div",{class:y.attachmentElementDetailPreview},this._renderAttachmentPreviewImageForInput(t,a)),ae("div",{class:y.attachmentElementDetailActions},ae("calcite-button",{appearance:"outline",disabled:!n,iconStart:"download-to",kind:"neutral",scale:"s",onclick:()=>{this._downloadAttachment(t)}},this.messages.attachments.download),f(t)?ae("calcite-button",{appearance:"outline",disabled:!n,iconStart:"expand",kind:"neutral",label:this.messages.attachments.maximize,scale:"m",title:this.messages.attachments.maximize,onclick:this._maximizeSelectedAttachment}):null,ae("calcite-button",{appearance:"outline",disabled:!n,iconStart:"download",kind:"neutral",label:this.messages.attachments.download,scale:"m",title:this.messages.attachments.download,onclick:()=>{this._downloadAttachment(t)}}),ae("calcite-button",{appearance:"outline",disabled:!s,iconStart:"upload-to",kind:"neutral",label:this.messages.attachments.replace,scale:"m",title:this.messages.attachments.replace,onclick:this._enterAttachmentReplaceView})),ae("div",{class:y.attachmentElementDetailMetadata},ae("div",{class:y.attachmentElementDetailMetadataGroup},ae("span",{class:y.attachmentElementDetailMetadataLabel},this.messages.attachments.fileName),a.allowUserRename?ae("div",{class:y.attachmentElementDetailFileNameRow},ae("calcite-input",{class:y.attachmentElementDetailFileNameInput,disabled:!s,scale:"m",value:t.name||"",onCalciteInputInput:({currentTarget:e})=>this._renameSelectedAttachment(e.value)}),ae("calcite-button",{appearance:"transparent",disabled:!s||null==l.initialName||!l.isRenamed,iconStart:"reset",kind:"neutral",scale:"m",title:this.messages.footerButtons.reset,onclick:this._resetSelectedAttachmentName})):ae("span",{class:y.attachmentElementDetailMetadataValue},t.name)),ae("div",{class:y.attachmentElementDetailMetadataGroup},ae("span",{class:y.attachmentElementDetailMetadataLabel},this.messages.attachments.size),ae("span",{class:y.attachmentElementDetailMetadataValue},this._formatAttachmentSize(t.size))),ae("div",{class:y.attachmentElementDetailMetadataGroup},ae("span",{class:y.attachmentElementDetailMetadataLabel},this.messages.attachments.type),ae("span",{class:y.attachmentElementDetailMetadataValue},this._getLabelForAttachmentType(t)))))}_renderAttachmentReplacePanel(e){const{attachment:t,input:a}=e,i=this.readOnly||this.effectiveDisabled,n=a.template.elementId;return ae("div",{class:y.attachmentElementAddPanel,key:`attachment-replace-panel-${n}-${v(t)}`},ae("input",{accept:a.accept,afterCreate:this._setSelectedAttachmentReplaceFileInput,afterRemoved:()=>{this._selectedAttachmentReplaceFileInput=null},afterUpdate:this._setSelectedAttachmentReplaceFileInput,class:y.attachmentElementFileInput,disabled:i,type:"file",onchange:e=>{const t=e.currentTarget,a=t.files?.[0];a&&this._stageSelectedAttachmentReplacement(a),t.value=""}}),ae("div",{class:y.attachmentElementAddDropzone,"data-disabled":i?"true":"false",ondragover:e=>{e.preventDefault()},ondrop:e=>{if(e.preventDefault(),i)return;const t=e.dataTransfer?.files?.[0];t&&this._stageSelectedAttachmentReplacement(t)}},ae("calcite-icon",{class:y.attachmentElementAddDropzoneIcon,icon:"refresh",scale:"l"}),ae("div",{class:y.attachmentElementAddDropzoneHeading},this.messages.attachments.replace),ae("div",{class:y.attachmentElementAddDropzoneDetail,title:this.messages.attachments.dragAndDropFile},this.messages.attachments.dragAndDropFile),ae("calcite-button",{appearance:"outline-fill",disabled:i,iconStart:"folder-open",scale:"s",onclick:e=>{e.stopPropagation(),this._openSelectedAttachmentReplaceFilePicker()}},this.messages.attachments.selectFile)),ae("div",{class:y.attachmentElementDetailMetadata},ae("div",{class:y.attachmentElementDetailMetadataGroup},ae("span",{class:y.attachmentElementDetailMetadataLabel},this.messages.attachments.fileToBeReplaced),ae("span",{class:y.attachmentElementDetailMetadataValue},t.name))))}_renderAttachmentDialog(){const e=this._attachmentDialogInfo;if(!e)return null;const{attachment:t,input:a}=e;return ae("calcite-dialog",{heading:t.name||this.messagesCommon.details,key:"attachment-preview-dialog",modal:!0,open:!0,placement:"cover",width:"l",onCalciteDialogClose:this._closeAttachmentDialog},ae("div",{class:y.attachmentElementDetailPreview},this._renderAttachmentPreviewImageForInput(t,a)))}_setSelectedAttachment(e){this.viewModel.setSelectedAttachment(e),e||this.hideAttachmentDialog()}_setAttachmentAddElementId(e){this.viewModel.setSelectedAttachmentAddElementId(e),this.hideAttachmentDialog()}_setAttachmentListElementId(e){this.viewModel.setSelectedAttachmentListElementId(e),this.hideAttachmentDialog()}_getAttachmentLabel(e,a,i,n){return!1!==n&&h(e.name)&&e.name.length>0?e.name:i!==this.messagesCommon.notApplicable?i:t(this.messages.attachments.attachmentNumberedLabel,{index:a+1})}_formatAttachmentSize(e){return null==e||Number.isNaN(e)?this.messagesCommon.notApplicable:r(this.messagesUnits,e)}_getLabelForAttachmentType({contentType:e}){if(!e)return this.messagesCommon.notApplicable;const t=this.messages.attachments.attachmentTypes,a=p(e);return t?.[a]||e}_renderAttachmentPreviewThumbnail(e,t,a){const i=a.getAttachmentPreviewUrl(e,64);return i&&f(e)?ae("img",{alt:t,class:y.attachmentElementListItemThumb,src:i}):ae("calcite-icon",{class:y.attachmentElementListItemIcon,icon:g(e.contentType),scale:"s"})}_renderAttachmentPreviewImageForInput(e,t){const a=t.getAttachmentPreviewUrl(e),i=e.name||this.messagesCommon.details;return a&&f(e)?ae("img",{alt:i,class:y.attachmentElementDetailPreviewImage,src:a,title:i}):[ae("calcite-icon",{class:y.attachmentElementDetailPreviewIcon,icon:g(e.contentType),scale:"l",textLabel:i,title:i}),this.messages.attachments.noPreviewAvailable]}async _downloadAttachment(e){await z(e)}_exitAttachmentReplaceView(){this.viewModel.setShowingSelectedAttachmentReplacePage(!1),this._selectedAttachmentReplaceFileInput=null}async _stageSelectedAttachmentReplacement(e){const t=this.selectedAttachmentDetails,a=t?.attachment.globalId;if(t&&a)try{await this.viewModel.stageReplaceAttachment(t.input.template.elementId,a,e)}finally{this._exitAttachmentReplaceView()}}_renameSelectedAttachment(e){const t=this.selectedAttachmentDetails,a=t?.attachment.globalId;t&&a&&this.viewModel.stageRenameAttachment(t.input.template.elementId,a,e)}_isSelectedAttachmentDeleteDisabled(){const e=this.selectedAttachmentDetails;if(!e)return!1;if(this.readOnly||this.effectiveDisabled)return!0;const t=e.input.minAttachmentCount;return null!=t&&e.input.attachments.length<=t}hideAttachmentDialog(){this._attachmentDialogInfo=null}_renderTextComponent(e){const{elementId:t}=e.template;return ae("div",{class:y.textElementInput,"data-testid":`text-element-${t}`,innerHTML:e.text,key:`text-element-${t}`})}_renderUtilityNetworkAssociationsElementInput(e){if(!this._associationsEnabled)return;const{elementId:t}=e.template;return ae("div",{class:y.utilityNetworkAssociationsElementInput,"data-testid":t,key:t})}getCommonInputProps(e){const{template:t,valid:a,value:i,minLength:n,maxLength:l,required:s,fieldName:o,editable:r,userHasChangedValue:c,range:{max:d,min:m}}=e,h=!r||this.readOnly,u=!h&&this.effectiveDisabled;let p=t.hint??void 0,g=!1;return i===L&&(p=this.messages.differentValuesPlaceholder,g=!0),{afterCreate:this._afterComponentCreateOrUpdate,afterUpdate:this._afterComponentCreateOrUpdate,"aria-invalid":a?"false":"true",class:this.classes(y.fieldInput,h?y.inputDisabled:null),status:!c&&!this.viewModel.submitHasBeenAttempted||a?"idle":"invalid",maxLength:l&&l>-1?l:void 0,minLength:n&&n>-1?n:void 0,key:t.elementId,label:o,name:o,max:null!=d?d:void 0,min:null!=m?m:void 0,disabled:u,readOnly:h,onblur:this._onComponentBlur,required:s,placeholder:p,value:g?"":i??"",[le]:t.elementId,onfocus:this._onComponentFocus}}_onFormSubmit(e){e.preventDefault()}_getFieldInputFromHTMLElement(e){return this.viewModel.findFieldInput(e.getAttribute(le))}_afterRadioGroupCreateOrUpdate(e){const t=e.selectedItem,a=e.querySelector("calcite-radio-button"),i=t||a;i&&this._afterComponentCreateOrUpdate(i)}_onComponentFocus(e){const t=e.target,a=this._getFieldInputFromHTMLElement(t);this._isMultipleChoiceCheckbox(t,a)||this._markFieldInputTouched(a),this._focusedFieldInput=a}_markFieldInputTouched(e){this._touchedInputs.add(e.template.elementId)}_isMultipleChoiceCheckbox(e,t){return"CALCITE-CHECKBOX"===e.tagName&&null!=t.multipleChoiceInput}_afterComponentCreateOrUpdate(e){const t=this._getFieldInputFromHTMLElement(e),a=this._focusedFieldInput;this._attemptFocusOnNextRender&&a===t&&(this._attemptFocusOnNextRender=!1,ie(e))}_onComponentBlur(){this._focusedFieldInput=null}_resetTransientFormState(){this._attemptFocusOnNextRender=!1,this._focusedFieldInput=null,this._attachmentDialogInfo=null,this._selectedAttachmentReplaceFileInput=null,this._attachmentListFilterText="",this._attachmentFileInputMap.clear()}_parseValue(e,t,a=!1){const i=t.multipleChoiceInput,n=t.multipleChoiceValues;if(i&&n){const l=i.choiceDelimiter,s=e;if(a){return B({input:t}).checked?null:n.length>0?n.join(l):null}const o=$(t.value,l).filter(e=>e!==L),r=new Set(o);s.checked?r.add(s.value):r.delete(s.value);const c=n.filter(e=>r.has(e));return c.length?c.join(l):null}if(_(t.template,"switch")){if("calcite-dropdown"===e.localName&&t.domain)for(const a of t.domain.codedValues)if(a.name===e.selectedItems[0].textContent)return a.code;return e.checked?t.template.input.onValue:t.template.input.offValue}const l=e.value;return null==l||""===l?null:"number"===t.dataType?"-0"===l||"-0."===l||"-0,"===l?l:parseFloat(l):"date"===t.field.type?parseFloat(l):l}_saveInput(e){const t=this._getFieldInputFromHTMLElement(e),{elementId:a}=t.template;if(!t)return;const i=t?.value;if(_(t.template,"switch")&&"single"!==this.viewModel.mode){const e=n(this._batchSwitchInputInitialValues,t,()=>t.value);this._batchSwitchInputInitialValues.set(t,null===e?i:e)}const l=this._parseValue(e,t);l!==i&&this.viewModel.setValue(a,l)}_afterDateComponentCreate(e){this._setDateTimeTimeZoneMap(e),this._afterComponentCreateOrUpdate(e)}_saveValueFromDateComponent(e,t){const{elementId:a}=e.template,i=e.field.type,n=this._dateComponentMap.get(`${a}`);if(!n)return;const l=e.effectiveTimeZone;let s=e.value===L?void 0:e.value,o=null;"date-only"===i?o=Array.isArray(t.value)?t.value[0]:t.value:"time-only"===i?(s=K(s),o=K(t.value)):o="timestamp-offset"===i?null!=t.value?X({dateComponent:n.date,timeComponent:n.time,oldValue:s,timeZoneComponent:n.timeZone,defaultTimeZone:l}):null:null!=t.value?J({oldValue:s,dateComponent:n.date,timeZone:l,timeComponent:n.time?.value===L?void 0:n.time}):null,s!==o&&(null!==o&&t.value?this.viewModel.setValue(`${a}`,o):this.viewModel.setValue(`${a}`,null))}};e([c()],re.prototype,"activeFeatureIndex",null),e([c()],re.prototype,"callbacks",null),e([c()],re.prototype,"disabled",null),e([c()],re.prototype,"effectiveTitle",null),e([c()],re.prototype,"effectiveDisabled",null),e([c()],re.prototype,"features",null),e([c()],re.prototype,"footerButtonInfos",null),e([c()],re.prototype,"footerNoticeInfos",null),e([c()],re.prototype,"map",null),e([c()],re.prototype,"maximumFeatureCount",null),e([c()],re.prototype,"maximumFeatureCountWithComplexForms",null),e([c()],re.prototype,"spatialReference",null),e([c()],re.prototype,"layerInfos",null),e([c()],re.prototype,"timeZone",null),e([c()],re.prototype,"headingLevel",void 0),e([c()],re.prototype,"icon",null),e([c(),ee("esri/t9n/common")],re.prototype,"messagesCommon",void 0),e([c(),ee("esri/widgets/BatchAttributeForm/t9n/BatchAttributeForm")],re.prototype,"messages",void 0),e([c(),ee("esri/core/t9n/Units")],re.prototype,"messagesUnits",void 0),e([c()],re.prototype,"page",null),e([c()],re.prototype,"readOnly",null),e([c()],re.prototype,"selectedAttachment",null),e([c()],re.prototype,"selectedAttachmentDetails",null),e([c()],re.prototype,"valid",null),e([c({type:A}),te(["value-change","submit"])],re.prototype,"viewModel",void 0),e([c({type:D,nonNullable:!0})],re.prototype,"visibleElements",void 0),e([c()],re.prototype,"groupDisplay",void 0),e([c()],re.prototype,"_associationsEnabled",null),e([c()],re.prototype,"_attemptFocusOnNextRender",void 0),e([c()],re.prototype,"_formId",null),e([c()],re.prototype,"_focusedFieldInput",void 0),e([c()],re.prototype,"_attachmentDialogInfo",void 0),e([c()],re.prototype,"_attachmentListFilterText",void 0),re=e([d("esri.widgets.BatchAttributeForm")],re);const ce=re;export{ce as default};
@@ -1,2 +1,2 @@
1
1
  /* COPYRIGHT Esri - https://js.arcgis.com/5.1/LICENSE.txt */
2
- import{__decorate as e}from"tslib";import t from"../../core/Collection.js";import r from"../../core/Error.js";import{EventedAccessor as i}from"../../core/Evented.js";import o from"../../core/Logger.js";import{clamp as s}from"../../core/mathUtils.js";import{debounce as a,throwIfNotAbortError as l,isAbortError as n}from"../../core/promiseUtils.js";import{watch as u,syncAndInitial as d,when as c,on as h}from"../../core/reactiveUtils.js";import{property as p,subclass as m}from"../../core/accessorSupport/decorators.js";import{resolveTimeZone as v,formatTimestamp as y,convertDateFormatToIntlOptions as g}from"../../intl/date.js";import{getLocale as f,getLocaleParts as w}from"../../intl/locale.js";import{fetchServiceDescription as _}from"../../rest/networkService.js";import T from"../../rest/support/RouteParameters.js";import S from"../../rest/support/Stop.js";import D from"../../rest/support/TravelMode.js";import{defaultDatePattern as b,defaultTimePattern as C}from"../../support/dateUtils.js";import{system as M}from"../../time/constants.js";import{shortTimeZoneName as I}from"../../time/timeZoneUtils.js";import{DepartureTimeOption as j}from"./support/directionsUtils.js";import{getDefaultLocaleOptions as A}from"../support/dateUtils.js";import{GoTo as P}from"../support/GoTo.js";import{DateTime as L,FixedOffsetZone as O,IANAZone as R}from"luxon";function E(e){return e.map(e=>({locale:e,parts:w(e)})).filter(({parts:e})=>!!e)}function U(e,t){return e.find(({parts:e})=>V(e.language,t.language)&&e.region===t.region)?.locale??e.find(({parts:e})=>V(e.language,t.language))?.locale}function N(e){return"esri.Graphic"===e?.declaredClass}function k(e){return"no"===e||"nb"===e}function V(e,t){return e===t||k(e)&&k(t)}function z(e){return"esri.rest.support.Stop"===e?.declaredClass}let F=class extends(P(i)){constructor(e){super(e),this._debouncedSolveHandler=a(async e=>{switch(e.type){case"create":switch(e.state){case"start":case"active":return}break;case"delete":break;case"update":switch(e.state){case"start":return void(this._networkFeatureUpdated=!1);case"active":if(this._networkFeatureUpdated=!0,this.autoSolveOn.includes("active"))break;return;case"complete":if(!this._networkFeatureUpdated)return;if(this.autoSolveOn.includes("complete"))break;return}}if((this.layer?.stops.filter(({geometry:e})=>!!e).length??0)<2||!this.autoSolve)return;const t="update"===e.type&&"active"===e.state;try{await this.getDirections({zoomToSolvedRoute:!1,ignoreSolvedStopGeometry:t,generalizeGeometry:t})}catch(r){o.getLogger(this).error(r)}}),this._highlight=null,this._loadController=null,this._loadPromise=null,this._networkFeatureUpdated=!1,this._layerView=null,this._routeController=null,this._serviceDescriptionStatus=3,this.apiKey=void 0,this.autoSolve=!0,this.autoSolveOn=["complete"],this.defaultTravelMode=null,this.departureIsoDate=void 0,this.departureIsoTime=void 0,this.departureOption=j.NOW,this.departureTime="now",this.lastError=null,this.lastRoute=null,this.layer=null,this.maxStops=50,this.routeParameters=new T({directionsLengthUnits:"kilometers",findBestSequence:!1,preserveFirstStop:!0,preserveLastStop:!0,returnZ:!0,useTimeWindows:!1}),this.serviceDescription=null,this.view=null}initialize(){this.addHandles([u(()=>this.layer,e=>{if(e){for(;e.stops.length<2;)e.stops.add(new S);this._set("defaultTravelMode",null),this.addHandles(c(()=>this.serviceDescription?e.routeInfo?.analysisSettings?.travelMode:null,e=>{this.defaultTravelMode=this._resolveDefaultTravelMode(e)},{once:!0}))}},d),u(()=>[this.layer,this.view],async()=>{this._layerView=await this._getRouteLayerView()},d),h(()=>this._layerView,["create","delete","update"],e=>{this._debouncedSolveHandler(e).catch(l)})]);const e=v(this.view?.timeZone??M),t=L.fromMillis(Date.now());this.departureIsoDate=t.toFormat(b,A(e)),this.departureIsoTime=t.toFormat(C,A(e))}get _directionsLanguage(){const e=this.serviceDescription?.directionsSupportedLanguages;if(!e)return;const t=this.routeParameters.directionsLanguage??f(),r=w(t),i=r?.language,o=r?.region;if(!i)return;return U(E(e),{language:i,region:o})}get formattedEta(){const e=this.layer?.routeInfo?.endTime,t=this.layer?.routeInfo?.endTimeOffset;if(this.departureOption===j.UNSPECIFIED||!e||!t)return null;const r=L.fromJSDate(e,{zone:O.instance(t)}),i=L.fromJSDate(e,{zone:R.create(v(this.view?.timeZone??M))}),o=L.fromJSDate(new Date,{zone:R.create(v(this.view?.timeZone??M))}),s=o.year===i.year&&o.month===i.month&&o.day===i.day,a=i.offset===t?void 0:I,l=s?void 0:g("short-date"),n=g("short-time");return y(r.toISO(),{...l,...n,timeZoneName:a})}get impedanceAttribute(){const e=this.routeParameters.travelMode?.impedanceAttributeName??this.routeParameters.impedanceAttribute??this.serviceDescription?.impedance??null;return this.getCostAttribute(e)}get selectedNetworkFeatures(){return this._layerView?.selectedNetworkFeatures??null}get selectedTravelMode(){return this.serviceDescription?this.defaultTravelMode??this.serviceDescription.defaultTravelMode??this.serviceDescription.supportedTravelModes?.[0]??null:null}set selectedTravelMode(e){this._override("selectedTravelMode",e)}get state(){if(this._routeController)return"routing";if(this.lastError)return"error";switch(this._serviceDescriptionStatus){case 4:return"unauthenticated";case 3:return"disabled";case 0:return"initializing";case 2:return"error";default:return"ready"}}get timeAttribute(){const e=this.routeParameters.travelMode?.timeAttributeName??this.routeParameters.directionsTimeAttribute??this.serviceDescription?.directionsTimeAttribute??null;return this.getCostAttribute(e)}get travelModes(){const e=this.serviceDescription?.supportedTravelModes?.slice()??[];return null==this.defaultTravelMode||e.includes(this.defaultTravelMode)||e.unshift(this.defaultTravelMode),e}async load(){if(this._loadPromise)return this._loadPromise;this._loadPromise=this._load(),await this._loadPromise,this._loadPromise=null}async highlight(e){this.clearHighlights();const t=await this._getRouteLayerView();this._highlight=t?.highlight(e)??null}clearHighlights(){this._highlight?.remove(),this._highlight=null}centerAt(e){if(!this.view)return;const t=z(e)||N(e)?e.geometry:e;t&&this.callGoTo({target:t})}clearResults(){this._set("lastRoute",null),this.layer?.removeResult()}async create(e){await(this._layerView?.create(e))}async getDirections(e={zoomToSolvedRoute:!0,ignoreSolvedStopGeometry:!1,generalizeGeometry:!1}){const{apiKey:t,layer:i,state:o}=this;if(!i)throw new r("directions-view-model:missing-route-layer","A route layer must be associated with the view model.");if("disabled"===o||"initializing"===o||"unauthenticated"===o||2===this._serviceDescriptionStatus)throw new r("directions-view-model:not-loaded","Cannot get directions until view model loads.");this._routeController?.abort(),this._routeController=null;const{startTime:s,startTimeIsUTC:a}=this._getStartTimeParameters(),l=this.view?.spatialReference??null,u=this.routeParameters.clone(),d=e.generalizeGeometry?this._getGeometryPrecision():null;u.set({apiKey:t,directionsLanguage:this._directionsLanguage,geometryPrecision:d,outSpatialReference:l,startTime:s,startTimeIsUTC:a}),this.selectedTravelMode&&(u.travelMode=this.selectedTravelMode);if(i.stops.filter(({geometry:e})=>!!e).length<2){const e=new r("directions-view-model:not-enough-stops","Not enough stops for routing");throw this._set("lastError",e),e}i.stops.forEach(e=>e.sequence=null),this._routeController=new AbortController;const{signal:c}=this._routeController;let h=null;try{h=await i.solve(u,{signal:c})}catch(p){if(!n(p)){const e=new r("directions-view-model:unable-to-route","Unable to route to these addresses",{error:p});throw this._set("lastError",e),this.clearResults(),e}}finally{this._routeController=null}this._set("lastError",null);for(const r of h.stops)r.geometry||(r.name=null);if(e.ignoreSolvedStopGeometry&&i.stops.every(({objectId:e})=>!!e)&&h.stops.every(({objectId:e})=>!!e))for(const r of h.stops){const e=i.stops.find(({objectId:e})=>e===r.objectId)?.geometry;e&&(r.geometry=e.clone())}return i.update(h),this._set("lastRoute",h),e.zoomToSolvedRoute&&this.zoomToRoute(),h}getCostAttribute(e){return(this.serviceDescription?.networkDataset?.networkAttributes??[]).find(({name:t,usageType:r})=>t===e&&"cost"===r)??null}remove(e){this._layerView?.remove(e)}reset(){this.clearHighlights(),this.clearResults(),null!=this.layer&&(this.layer.removeAll(),this.layer.stops=new t([new S,new S]))}save(){if(!this.layer)throw new r("directions-view-model:missing-layer","save() requires a layer");return this.layer.save()}saveAs(e,t={}){if(!this.layer)throw new r("directions-view-model:missing-layer","saveAs() requires a layer");return this.layer.saveAs(e,t)}startEditing(){this._layerView&&(this._layerView.interactive=!0,this._layerView.interactiveOptions.waypointAdditionEnabled=!this.routeParameters.findBestSequence)}stopEditing(){this._layerView&&(this._layerView.interactive=!1)}updateDepartureTime(){if(this.departureIsoDate&&this.departureIsoTime)switch(this.departureOption){case j.NOW:this.departureTime="now";break;case j.DEPART_AT:{const e=L.fromISO(`${this.departureIsoDate}T${this.departureIsoTime}`,{zone:O.instance(0)});this.departureTime=e.toJSDate();break}case j.UNSPECIFIED:this.departureTime=null}}zoomToRoute(){const{view:e,layer:t}=this,r=t?.routeInfo?.geometry?.extent;if(!e||!r)return;const i=r.width>r.height,o=r.clone().expand(i?2:1);this.callGoTo({target:o})}_getGeometryPrecision(){const e=this.view?.resolution;return e?s(Math.ceil(-Math.log10(e)),0,4):null}async _getRouteLayerView(){return this.view&&this.layer?this.view.whenLayerView(this.layer):null}_getStartTimeParameters(){if("now"===this.departureTime){return{startTime:this.serviceDescription?.capabilities.supportsNow??!1?"now":new Date,startTimeIsUTC:!0}}return null==this.departureTime?{startTime:void 0,startTimeIsUTC:void 0}:{startTime:this.departureTime,startTimeIsUTC:!1}}async _load(){if(null==this.layer)return;null!=this._loadController&&(this._loadController.abort(),this._loadController=null),this._loadController=new AbortController;const{signal:e}=this._loadController;try{this._serviceDescriptionStatus=0;const t=await _(this.layer.url,this.apiKey,{signal:e});this._set("serviceDescription",t),this._serviceDescriptionStatus=1}catch(t){if(n(t))return void(this._serviceDescriptionStatus=3);if("identity-manager:user-aborted"===t.name)return void(this._serviceDescriptionStatus=4);const e=new r("directions-view-model:service-metadata-unavailable","Cannot load route service metadata",{error:t});throw this._serviceDescriptionStatus=2,this._set("lastError",e),e}finally{this._loadController=null}}_resolveDefaultTravelMode(e){if(null==this.serviceDescription)return null;const{defaultTravelMode:t,supportedTravelModes:r}=this.serviceDescription,i=/^<(?<name>.*)>$/i.exec(e.name)?.groups?.name;if(i){const o=r?.find(({name:e})=>e.toLocaleLowerCase()===i.trim().toLocaleLowerCase()),s=o??t;return D.fromJSON({...s?.toJSON(),...e.toJSON()})}const o=r?.find(({name:t})=>t.toLocaleLowerCase()===e.name.toLocaleLowerCase());return o??t}};e([p()],F.prototype,"_directionsLanguage",null),e([p()],F.prototype,"_layerView",void 0),e([p()],F.prototype,"_routeController",void 0),e([p()],F.prototype,"_serviceDescriptionStatus",void 0),e([p()],F.prototype,"apiKey",void 0),e([p()],F.prototype,"autoSolve",void 0),e([p({nonNullable:!0})],F.prototype,"autoSolveOn",void 0),e([p()],F.prototype,"defaultTravelMode",void 0),e([p()],F.prototype,"departureTime",void 0),e([p()],F.prototype,"formattedEta",null),e([p({readOnly:!0})],F.prototype,"impedanceAttribute",null),e([p()],F.prototype,"lastError",void 0),e([p({readOnly:!0})],F.prototype,"lastRoute",void 0),e([p()],F.prototype,"layer",void 0),e([p({type:Number,range:{min:2,max:50},nonNullable:!0})],F.prototype,"maxStops",void 0),e([p({type:T,nonNullable:!0})],F.prototype,"routeParameters",void 0),e([p({readOnly:!0})],F.prototype,"selectedNetworkFeatures",null),e([p({type:D})],F.prototype,"selectedTravelMode",null),e([p({readOnly:!0})],F.prototype,"serviceDescription",void 0),e([p({readOnly:!0})],F.prototype,"state",null),e([p({readOnly:!0})],F.prototype,"timeAttribute",null),e([p()],F.prototype,"travelModes",null),e([p()],F.prototype,"view",void 0),e([p()],F.prototype,"zoomToRoute",null),F=e([m("esri.widgets.Directions.DirectionsViewModel")],F);const G=F;export{G as default};
2
+ import{__decorate as e}from"tslib";import t from"../../core/Collection.js";import r from"../../core/Error.js";import{EventedAccessor as i}from"../../core/Evented.js";import o from"../../core/Logger.js";import{clamp as s}from"../../core/mathUtils.js";import{debounce as a,throwIfNotAbortError as l,isAbortError as n}from"../../core/promiseUtils.js";import{watch as u,syncAndInitial as d,when as c,on as h}from"../../core/reactiveUtils.js";import{property as p,subclass as m}from"../../core/accessorSupport/decorators.js";import{resolveTimeZone as v,formatTimestamp as y,convertDateFormatToIntlOptions as g}from"../../intl/date.js";import{getLocale as f,getLocaleParts as w}from"../../intl/locale.js";import{fetchServiceDescription as _}from"../../rest/networkService.js";import T from"../../rest/support/RouteParameters.js";import S from"../../rest/support/Stop.js";import D from"../../rest/support/TravelMode.js";import{defaultDatePattern as b,defaultTimePattern as C}from"../../support/dateUtils.js";import{system as M}from"../../time/constants.js";import{shortTimeZoneName as I}from"../../time/timeZoneUtils.js";import{DepartureTimeOption as j}from"./support/directionsUtils.js";import{getDefaultLocaleOptions as A}from"../support/dateUtils.js";import{GoTo as P}from"../support/GoTo.js";import{DateTime as L,FixedOffsetZone as O,IANAZone as R}from"luxon";function E(e){return e.map(e=>({locale:e,parts:w(e)})).filter(({parts:e})=>!!e)}function U(e,t){return e.find(({parts:e})=>V(e.language,t.language)&&e.region===t.region)?.locale??e.find(({parts:e})=>V(e.language,t.language))?.locale}function N(e){return"esri.Graphic"===e?.declaredClass}function k(e){return"no"===e||"nb"===e}function V(e,t){return e===t||k(e)&&k(t)}function z(e){return"esri.rest.support.Stop"===e?.declaredClass}let F=class extends(P(i)){constructor(e){super(e),this._debouncedSolveHandler=a(async e=>{switch(e.type){case"create":switch(e.state){case"start":case"active":return}break;case"delete":break;case"update":switch(e.state){case"start":return void(this._networkFeatureUpdated=!1);case"active":if(this._networkFeatureUpdated=!0,this.autoSolveOn.includes("active"))break;return;case"complete":if(!this._networkFeatureUpdated)return;if(this.autoSolveOn.includes("complete"))break;return}}if((this.layer?.stops.filter(({geometry:e})=>!!e).length??0)<2||!this.autoSolve)return;const t="update"===e.type&&"active"===e.state,r=t?e.networkFeatures.filter(e=>"stop"===e.type):void 0;try{await this.getDirections({zoomToSolvedRoute:!1,draggedStops:r,generalizeGeometry:t})}catch(i){o.getLogger(this).error(i)}}),this._highlight=null,this._loadController=null,this._loadPromise=null,this._networkFeatureUpdated=!1,this._layerView=null,this._routeController=null,this._serviceDescriptionStatus=3,this.apiKey=void 0,this.autoSolve=!0,this.autoSolveOn=["complete"],this.defaultTravelMode=null,this.departureIsoDate=void 0,this.departureIsoTime=void 0,this.departureOption=j.NOW,this.departureTime="now",this.lastError=null,this.lastRoute=null,this.layer=null,this.maxStops=50,this.routeParameters=new T({directionsLengthUnits:"kilometers",findBestSequence:!1,preserveFirstStop:!0,preserveLastStop:!0,returnZ:!0,useTimeWindows:!1}),this.serviceDescription=null,this.view=null}initialize(){this.addHandles([u(()=>this.layer,e=>{if(e){for(;e.stops.length<2;)e.stops.add(new S);this._set("defaultTravelMode",null),this.addHandles(c(()=>this.serviceDescription?e.routeInfo?.analysisSettings?.travelMode:null,e=>{this.defaultTravelMode=this._resolveDefaultTravelMode(e)},{once:!0}))}},d),u(()=>[this.layer,this.view],async()=>{this._layerView=await this._getRouteLayerView()},d),h(()=>this._layerView,["create","delete","update"],e=>{this._debouncedSolveHandler(e).catch(l)})]);const e=v(this.view?.timeZone??M),t=L.fromMillis(Date.now());this.departureIsoDate=t.toFormat(b,A(e)),this.departureIsoTime=t.toFormat(C,A(e))}get _directionsLanguage(){const e=this.serviceDescription?.directionsSupportedLanguages;if(!e)return;const t=this.routeParameters.directionsLanguage??f(),r=w(t),i=r?.language,o=r?.region;if(!i)return;return U(E(e),{language:i,region:o})}get formattedEta(){const e=this.layer?.routeInfo?.endTime,t=this.layer?.routeInfo?.endTimeOffset;if(this.departureOption===j.UNSPECIFIED||!e||!t)return null;const r=L.fromJSDate(e,{zone:O.instance(t)}),i=L.fromJSDate(e,{zone:R.create(v(this.view?.timeZone??M))}),o=L.fromJSDate(new Date,{zone:R.create(v(this.view?.timeZone??M))}),s=o.year===i.year&&o.month===i.month&&o.day===i.day,a=i.offset===t?void 0:I,l=s?void 0:g("short-date"),n=g("short-time");return y(r.toISO(),{...l,...n,timeZoneName:a})}get impedanceAttribute(){const e=this.routeParameters.travelMode?.impedanceAttributeName??this.routeParameters.impedanceAttribute??this.serviceDescription?.impedance??null;return this.getCostAttribute(e)}get selectedNetworkFeatures(){return this._layerView?.selectedNetworkFeatures??null}get selectedTravelMode(){return this.serviceDescription?this.defaultTravelMode??this.serviceDescription.defaultTravelMode??this.serviceDescription.supportedTravelModes?.[0]??null:null}set selectedTravelMode(e){this._override("selectedTravelMode",e)}get state(){if(this._routeController)return"routing";if(this.lastError)return"error";switch(this._serviceDescriptionStatus){case 4:return"unauthenticated";case 3:return"disabled";case 0:return"initializing";case 2:return"error";default:return"ready"}}get timeAttribute(){const e=this.routeParameters.travelMode?.timeAttributeName??this.routeParameters.directionsTimeAttribute??this.serviceDescription?.directionsTimeAttribute??null;return this.getCostAttribute(e)}get travelModes(){const e=this.serviceDescription?.supportedTravelModes?.slice()??[];return null==this.defaultTravelMode||e.includes(this.defaultTravelMode)||e.unshift(this.defaultTravelMode),e}async load(){if(this._loadPromise)return this._loadPromise;this._loadPromise=this._load(),await this._loadPromise,this._loadPromise=null}async highlight(e){this.clearHighlights();const t=await this._getRouteLayerView();this._highlight=t?.highlight(e)??null}clearHighlights(){this._highlight?.remove(),this._highlight=null}centerAt(e){if(!this.view)return;const t=z(e)||N(e)?e.geometry:e;t&&this.callGoTo({target:t})}clearResults(){this._set("lastRoute",null),this.layer?.removeResult()}async create(e){await(this._layerView?.create(e))}async getDirections(e={zoomToSolvedRoute:!0,generalizeGeometry:!1}){const{apiKey:t,layer:i,state:o}=this;if(!i)throw new r("directions-view-model:missing-route-layer","A route layer must be associated with the view model.");if("disabled"===o||"initializing"===o||"unauthenticated"===o||2===this._serviceDescriptionStatus)throw new r("directions-view-model:not-loaded","Cannot get directions until view model loads.");this._routeController?.abort(),this._routeController=null;const{startTime:s,startTimeIsUTC:a}=this._getStartTimeParameters(),l=this.view?.spatialReference??null,u=this.routeParameters.clone(),d=e.generalizeGeometry?this._getGeometryPrecision():null;u.set({apiKey:t,directionsLanguage:this._directionsLanguage,geometryPrecision:d,outSpatialReference:l,startTime:s,startTimeIsUTC:a}),this.selectedTravelMode&&(u.travelMode=this.selectedTravelMode);if(i.stops.filter(({geometry:e})=>!!e).length<2){const e=new r("directions-view-model:not-enough-stops","Not enough stops for routing");throw this._set("lastError",e),e}i.stops.forEach(e=>e.sequence=null),this._routeController=new AbortController;const{signal:c}=this._routeController;let h=null;try{h=await i.solve(u,{signal:c})}catch(p){if(!n(p)){const e=new r("directions-view-model:unable-to-route","Unable to route to these addresses",{error:p});throw this._set("lastError",e),this.clearResults(),e}}finally{this._routeController=null}this._set("lastError",null);for(const r of h.stops)r.geometry||(r.name=null);if(e.draggedStops&&i.stops.every(({objectId:e})=>!!e)&&h.stops.every(({objectId:e})=>!!e))for(const{objectId:r,geometry:n}of e.draggedStops){if(!r||!n)continue;const e=h.stops.find(e=>e.objectId===r);e&&(e.geometry=n.clone())}return i.update(h),this._set("lastRoute",h),e.zoomToSolvedRoute&&this.zoomToRoute(),h}getCostAttribute(e){return(this.serviceDescription?.networkDataset?.networkAttributes??[]).find(({name:t,usageType:r})=>t===e&&"cost"===r)??null}remove(e){this._layerView?.remove(e)}reset(){this.clearHighlights(),this.clearResults(),null!=this.layer&&(this.layer.removeAll(),this.layer.stops=new t([new S,new S]))}save(){if(!this.layer)throw new r("directions-view-model:missing-layer","save() requires a layer");return this.layer.save()}saveAs(e,t={}){if(!this.layer)throw new r("directions-view-model:missing-layer","saveAs() requires a layer");return this.layer.saveAs(e,t)}startEditing(){this._layerView&&(this._layerView.interactive=!0,this._layerView.interactiveOptions.waypointAdditionEnabled=!this.routeParameters.findBestSequence)}stopEditing(){this._layerView&&(this._layerView.interactive=!1)}updateDepartureTime(){if(this.departureIsoDate&&this.departureIsoTime)switch(this.departureOption){case j.NOW:this.departureTime="now";break;case j.DEPART_AT:{const e=L.fromISO(`${this.departureIsoDate}T${this.departureIsoTime}`,{zone:O.instance(0)});this.departureTime=e.toJSDate();break}case j.UNSPECIFIED:this.departureTime=null}}zoomToRoute(){const{view:e,layer:t}=this,r=t?.routeInfo?.geometry?.extent;if(!e||!r)return;const i=r.width>r.height,o=r.clone().expand(i?2:1);this.callGoTo({target:o})}_getGeometryPrecision(){const e=this.view?.resolution;return e?s(Math.ceil(-Math.log10(e)),0,4):null}async _getRouteLayerView(){return this.view&&this.layer?this.view.whenLayerView(this.layer):null}_getStartTimeParameters(){if("now"===this.departureTime){return{startTime:this.serviceDescription?.capabilities.supportsNow??!1?"now":new Date,startTimeIsUTC:!0}}return null==this.departureTime?{startTime:void 0,startTimeIsUTC:void 0}:{startTime:this.departureTime,startTimeIsUTC:!1}}async _load(){if(null==this.layer)return;null!=this._loadController&&(this._loadController.abort(),this._loadController=null),this._loadController=new AbortController;const{signal:e}=this._loadController;try{this._serviceDescriptionStatus=0;const t=await _(this.layer.url,this.apiKey,{signal:e});this._set("serviceDescription",t),this._serviceDescriptionStatus=1}catch(t){if(n(t))return void(this._serviceDescriptionStatus=3);if("identity-manager:user-aborted"===t.name)return void(this._serviceDescriptionStatus=4);const e=new r("directions-view-model:service-metadata-unavailable","Cannot load route service metadata",{error:t});throw this._serviceDescriptionStatus=2,this._set("lastError",e),e}finally{this._loadController=null}}_resolveDefaultTravelMode(e){if(null==this.serviceDescription)return null;const{defaultTravelMode:t,supportedTravelModes:r}=this.serviceDescription,i=/^<(?<name>.*)>$/i.exec(e.name)?.groups?.name;if(i){const o=r?.find(({name:e})=>e.toLocaleLowerCase()===i.trim().toLocaleLowerCase()),s=o??t;return D.fromJSON({...s?.toJSON(),...e.toJSON()})}const o=r?.find(({name:t})=>t.toLocaleLowerCase()===e.name.toLocaleLowerCase());return o??t}};e([p()],F.prototype,"_directionsLanguage",null),e([p()],F.prototype,"_layerView",void 0),e([p()],F.prototype,"_routeController",void 0),e([p()],F.prototype,"_serviceDescriptionStatus",void 0),e([p()],F.prototype,"apiKey",void 0),e([p()],F.prototype,"autoSolve",void 0),e([p({nonNullable:!0})],F.prototype,"autoSolveOn",void 0),e([p()],F.prototype,"defaultTravelMode",void 0),e([p()],F.prototype,"departureTime",void 0),e([p()],F.prototype,"formattedEta",null),e([p({readOnly:!0})],F.prototype,"impedanceAttribute",null),e([p()],F.prototype,"lastError",void 0),e([p({readOnly:!0})],F.prototype,"lastRoute",void 0),e([p()],F.prototype,"layer",void 0),e([p({type:Number,range:{min:2,max:50},nonNullable:!0})],F.prototype,"maxStops",void 0),e([p({type:T,nonNullable:!0})],F.prototype,"routeParameters",void 0),e([p({readOnly:!0})],F.prototype,"selectedNetworkFeatures",null),e([p({type:D})],F.prototype,"selectedTravelMode",null),e([p({readOnly:!0})],F.prototype,"serviceDescription",void 0),e([p({readOnly:!0})],F.prototype,"state",null),e([p({readOnly:!0})],F.prototype,"timeAttribute",null),e([p()],F.prototype,"travelModes",null),e([p()],F.prototype,"view",void 0),e([p()],F.prototype,"zoomToRoute",null),F=e([m("esri.widgets.Directions.DirectionsViewModel")],F);const x=F;export{x as default};