@arcgis/core 5.2.0-next.62 → 5.2.0-next.64

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 (530) hide show
  1. package/WebDocument2D.d.ts +17 -1
  2. package/WebDocument2D.js +1 -1
  3. package/WebLinkChart.js +1 -1
  4. package/WebMap.js +1 -1
  5. package/WebScene.js +1 -1
  6. package/arcade/Feature.js +1 -1
  7. package/arcade/ImmutableArray.js +1 -1
  8. package/arcade/ImmutablePathArray.js +1 -1
  9. package/arcade/ImmutablePointArray.js +1 -1
  10. package/arcade/Pixel.js +1 -1
  11. package/arcade/Voxel.js +1 -1
  12. package/arcade/arcadeAsyncRuntime.js +1 -1
  13. package/arcade/arcadeCompiler.js +1 -1
  14. package/arcade/arcadeRuntime.js +1 -1
  15. package/arcade/containerUtils.js +1 -1
  16. package/arcade/debug.js +1 -1
  17. package/arcade/deepClone.js +1 -1
  18. package/arcade/featureset/sources/FeatureLayerDynamic.js +1 -1
  19. package/arcade/functions/convertdirection.js +1 -1
  20. package/arcade/functions/date.js +1 -1
  21. package/arcade/functions/feature.js +1 -1
  22. package/arcade/functions/featuresetbase.js +1 -1
  23. package/arcade/functions/featuresetgeom.js +1 -1
  24. package/arcade/functions/featuresetstats.js +1 -1
  25. package/arcade/functions/featuresetstring.js +1 -1
  26. package/arcade/functions/fieldStats.js +1 -1
  27. package/arcade/functions/geomasync.js +1 -1
  28. package/arcade/functions/geometry.js +1 -1
  29. package/arcade/functions/geomsync.js +1 -1
  30. package/arcade/functions/knowledgegraph.js +1 -1
  31. package/arcade/functions/maths.js +1 -1
  32. package/arcade/functions/stats.js +1 -1
  33. package/arcade/functions/string.js +1 -1
  34. package/arcade/functions/track.js +1 -1
  35. package/arcade/geometry/functions.js +1 -1
  36. package/arcade/languageUtils.js +1 -1
  37. package/arcade.js +1 -1
  38. package/arcgisGlobal.d.ts +14 -0
  39. package/assets/esri/core/workers/RemoteClient.js +1 -1
  40. package/assets/esri/core/workers/chunks/{44e64186318728d1be51.js → 067b00498ae85f635f60.js} +1 -1
  41. package/assets/esri/core/workers/chunks/0977f4d77c36175c2895.js +1 -0
  42. package/assets/esri/core/workers/chunks/09c43bcb09aad02e83a9.js +1 -0
  43. package/assets/esri/core/workers/chunks/0b20f92bae2b4c40d299.js +1 -0
  44. package/assets/esri/core/workers/chunks/0c3c311400ee352187ea.js +1 -0
  45. package/assets/esri/core/workers/chunks/0c582abc8d25249eb530.js +1 -0
  46. package/assets/esri/core/workers/chunks/0d6776055e9b34c14151.js +1 -0
  47. package/assets/esri/core/workers/chunks/0d7d54e74b5639a0be6e.js +1 -0
  48. package/assets/esri/core/workers/chunks/0da5b27b070ab780f8b3.js +1 -0
  49. package/assets/esri/core/workers/chunks/0e6b6fcc55cc43ede1fc.js +1 -0
  50. package/assets/esri/core/workers/chunks/{bcb5017500d144b73908.js → 126f1f6b355723db6c4f.js} +1 -1
  51. package/assets/esri/core/workers/chunks/12a64eca4c571926d9d4.js +1 -0
  52. package/assets/esri/core/workers/chunks/{b2c0262c4a76b8a86200.js → 149284464115981694ff.js} +1 -1
  53. package/assets/esri/core/workers/chunks/1642fa1263d8f4a45101.js +1 -0
  54. package/assets/esri/core/workers/chunks/1840d74ebae777a0200b.js +1 -0
  55. package/assets/esri/core/workers/chunks/19bf6826e7d9a4d52035.js +1 -0
  56. package/assets/esri/core/workers/chunks/1bfbdec791e19f5a2534.js +1 -0
  57. package/assets/esri/core/workers/chunks/1d8280f63a6698e74f20.js +1 -0
  58. package/assets/esri/core/workers/chunks/{1b68b1b724ad30396723.js → 2426601b8cae7f06af4d.js} +1 -1
  59. package/assets/esri/core/workers/chunks/{a12803108c3b12808698.js → 242cad472fbc38b24dbc.js} +2 -2
  60. package/assets/esri/core/workers/chunks/25197ecb324d6f08e03e.js +1 -0
  61. package/assets/esri/core/workers/chunks/253c231b5a52f1d2d3a5.js +1 -0
  62. package/assets/esri/core/workers/chunks/25999b6f96ec305a7679.js +1 -0
  63. package/assets/esri/core/workers/chunks/259bdacfb7b0f866a8d0.js +1 -0
  64. package/assets/esri/core/workers/chunks/28565756f884d0851003.js +1 -0
  65. package/assets/esri/core/workers/chunks/2a5a165848413764381b.js +1 -0
  66. package/assets/esri/core/workers/chunks/2e7a5bb740281ef59199.js +1 -0
  67. package/assets/esri/core/workers/chunks/{285a5bd708f0fe1c620c.js → 2ea3ca68cfa4d34e8f3b.js} +1 -1
  68. package/assets/esri/core/workers/chunks/2f87a49bdd00f899d81d.js +1 -0
  69. package/assets/esri/core/workers/chunks/{37a95f097533bad1b338.js → 302d91b7c480c6c9304b.js} +1 -1
  70. package/assets/esri/core/workers/chunks/{3d6d2b42ba2ad7086d5d.js → 3b493e8043ec1a2a5d96.js} +1 -1
  71. package/assets/esri/core/workers/chunks/40e48b720d89cd067892.js +1 -0
  72. package/assets/esri/core/workers/chunks/{a833fc9250635eb4152f.js → 41f7f3615d3ecb87c59a.js} +1 -1
  73. package/assets/esri/core/workers/chunks/{17acbf40e7c1cb42d9bd.js → 44b1cdf28269b4fa8a39.js} +1 -1
  74. package/assets/esri/core/workers/chunks/44e8cd4b3dad777ab0c9.js +1 -0
  75. package/assets/esri/core/workers/chunks/{95b3b8fe45ef4ac6b277.js → 450bc48a7389607bce1e.js} +1 -1
  76. package/assets/esri/core/workers/chunks/465a050fd838ee8eddf3.js +1 -0
  77. package/assets/esri/core/workers/chunks/46d8a1d6f7341ad20749.js +1 -0
  78. package/assets/esri/core/workers/chunks/4710f21b138a2c9a0345.js +1 -0
  79. package/assets/esri/core/workers/chunks/48a0dfaabb9b4bce4191.js +1 -0
  80. package/assets/esri/core/workers/chunks/49a3888bf9e2481642ac.js +1 -0
  81. package/assets/esri/core/workers/chunks/{4ee900e5dbb130fa0c7b.js → 4a40b894ec89b0a4f9bf.js} +1 -1
  82. package/assets/esri/core/workers/chunks/{d847c3cb2043a983145b.js → 4addea2e35b0c845743e.js} +1 -1
  83. package/assets/esri/core/workers/chunks/{e0a4d0288abd334b0673.js → 4ae626868e14bedd7fc5.js} +1 -1
  84. package/assets/esri/core/workers/chunks/529ee4670940720e888b.js +1 -0
  85. package/assets/esri/core/workers/chunks/{a3c882fe7599dc0f4f27.js → 59d1708ae13c6e7e6e55.js} +1 -1
  86. package/assets/esri/core/workers/chunks/59dd83e5aee2908c7eca.js +1 -0
  87. package/assets/esri/core/workers/chunks/5dbd8ca7e7b8eb9a0bf7.js +1 -0
  88. package/assets/esri/core/workers/chunks/{b8bdacebd4d24ba90f3f.js → 5fde1234c5cccaee6763.js} +1 -1
  89. package/assets/esri/core/workers/chunks/60f9b37dd738d884c48d.js +1 -0
  90. package/assets/esri/core/workers/chunks/6123894e2ae9233cdf89.js +1 -0
  91. package/assets/esri/core/workers/chunks/62c8413f3bbc1378273d.js +1 -0
  92. package/assets/esri/core/workers/chunks/6501ee40bf25f9f75d02.js +1 -0
  93. package/assets/esri/core/workers/chunks/663cf8bff17c894cd5f8.js +1 -0
  94. package/assets/esri/core/workers/chunks/6b536d03b4bef408035b.js +1 -0
  95. package/assets/esri/core/workers/chunks/6c98a64d92c9bca78203.js +1 -0
  96. package/assets/esri/core/workers/chunks/6d1371b521c7f94fd77e.js +1 -0
  97. package/assets/esri/core/workers/chunks/6d5038d4351fe29e2718.js +1 -0
  98. package/assets/esri/core/workers/chunks/6f102c90908c9900cdaa.js +1 -0
  99. package/assets/esri/core/workers/chunks/6f39545710d1b35d922c.js +1 -0
  100. package/assets/esri/core/workers/chunks/7278fdf6bfcdffa10a7f.js +1 -0
  101. package/assets/esri/core/workers/chunks/72eb0ac55026a4f5d6a7.js +1 -0
  102. package/assets/esri/core/workers/chunks/73cb499d7d68c59ba34e.js +1 -0
  103. package/assets/esri/core/workers/chunks/{b8d788e110c212a879ab.js → 73f228d966b89c73c9e9.js} +1 -1
  104. package/assets/esri/core/workers/chunks/{e7402dfd683f82878360.js → 752343d92ed48e674351.js} +1 -1
  105. package/assets/esri/core/workers/chunks/7538a0fe0cec3156769e.js +1 -0
  106. package/assets/esri/core/workers/chunks/76bccc318d7cc33829a7.js +1 -0
  107. package/assets/esri/core/workers/chunks/771ead806efbe9c91fdc.js +1 -0
  108. package/assets/esri/core/workers/chunks/777eafdb86b26b35c803.js +1 -0
  109. package/assets/esri/core/workers/chunks/7821aeba3e414b318a75.js +1 -0
  110. package/assets/esri/core/workers/chunks/78b80da3bbc1b608fe83.js +1 -0
  111. package/assets/esri/core/workers/chunks/7b531feba4fd662575f9.js +1 -0
  112. package/assets/esri/core/workers/chunks/7c57354d026e27e056d4.js +1 -0
  113. package/assets/esri/core/workers/chunks/7d163d9d90393e491ee5.js +1 -0
  114. package/assets/esri/core/workers/chunks/7d4c65311064a5c2e0b1.js +1 -0
  115. package/assets/esri/core/workers/chunks/{0474af7687466d8befd2.js → 7e2794705b4e679fcb3f.js} +1 -1
  116. package/assets/esri/core/workers/chunks/7ebbb90d80600d9ba889.js +1 -0
  117. package/assets/esri/core/workers/chunks/7f125963555dc1ce63ad.js +1 -0
  118. package/assets/esri/core/workers/chunks/{763cbb6716e398436a6d.js → 7f6eee102871769fdf8f.js} +1 -1
  119. package/assets/esri/core/workers/chunks/805c97b875d3066fb8df.js +1 -0
  120. package/assets/esri/core/workers/chunks/8566449c39eba55147f5.js +1 -0
  121. package/assets/esri/core/workers/chunks/86ed75b7169b8ee43025.js +1 -0
  122. package/assets/esri/core/workers/chunks/{9482a6d7baa24bbf5693.js → 89132395eca329b9ab92.js} +1 -1
  123. package/assets/esri/core/workers/chunks/{28bc5e8e82f188b30eb9.js → 894343e415639df88243.js} +1 -1
  124. package/assets/esri/core/workers/chunks/8b4759cef5ae5e43253b.js +1 -0
  125. package/assets/esri/core/workers/chunks/8ba4175f5e9a24ffecf7.js +1 -0
  126. package/assets/esri/core/workers/chunks/8be707044d992ef5f1d8.js +1 -0
  127. package/assets/esri/core/workers/chunks/{bd862382f72ebd446b46.js → 8d2cac1952e817daaf1f.js} +1 -1
  128. package/assets/esri/core/workers/chunks/8e1d4867406753c5483c.js +1 -0
  129. package/assets/esri/core/workers/chunks/8e38c5e63aae42bdf5a4.js +29 -0
  130. package/assets/esri/core/workers/chunks/{02ab09285a5c4ca98066.js → 8f785b722b1a131bf370.js} +1 -1
  131. package/assets/esri/core/workers/chunks/8f9874f42f21a4cb3acd.js +1 -0
  132. package/assets/esri/core/workers/chunks/90f4b81c6034253b70d7.js +1 -0
  133. package/assets/esri/core/workers/chunks/917c11cb40a7742d7f98.js +1 -0
  134. package/assets/esri/core/workers/chunks/93ab247ff34694ac60eb.js +1 -0
  135. package/assets/esri/core/workers/chunks/{6e45d0db97ffa4509177.js → 94bf7f0da6ad3f7ea277.js} +1 -1
  136. package/assets/esri/core/workers/chunks/{580451761cadfe308919.js → 9954149def644c371894.js} +1 -1
  137. package/assets/esri/core/workers/chunks/9c57161ad48d8d546dc7.js +1 -0
  138. package/assets/esri/core/workers/chunks/{33bd9785bd0b6ccef21b.js → 9c5dff4f13102871786e.js} +1 -1
  139. package/assets/esri/core/workers/chunks/9d0bda096cdbd7e22f4b.js +1 -0
  140. package/assets/esri/core/workers/chunks/9dfb7d120195991e9672.js +1 -0
  141. package/assets/esri/core/workers/chunks/9ed5e6b06afea6c85330.js +1 -0
  142. package/assets/esri/core/workers/chunks/9f65cc6d9f7390bb1d5b.js +1 -0
  143. package/assets/esri/core/workers/chunks/{79b857bb301f9c4169d6.js → 9fee8441fbac9f723f77.js} +1 -1
  144. package/assets/esri/core/workers/chunks/a108f276659d5f25352c.js +1 -0
  145. package/assets/esri/core/workers/chunks/a2d8bc0efddd2e13b1ad.js +1 -0
  146. package/assets/esri/core/workers/chunks/{b32ede7805c7c6644e4c.js → a3bf8aa81ee398da5b52.js} +1 -1
  147. package/assets/esri/core/workers/chunks/{5b30231ae0a8f4b8435f.js → a504fa17d83facf1c01f.js} +1 -1
  148. package/assets/esri/core/workers/chunks/{538fe46dfd685a490e23.js → a7f42ada0aa69873a938.js} +1 -1
  149. package/assets/esri/core/workers/chunks/a97e0b9b057664911c14.js +1 -0
  150. package/assets/esri/core/workers/chunks/{cb58aff1ff186fa18345.js → a9f616f22042b0dce8b9.js} +1 -1
  151. package/assets/esri/core/workers/chunks/{128799741dd3c6fc69b9.js → ac4131121230cfc14f21.js} +1 -1
  152. package/assets/esri/core/workers/chunks/afd63c18ce4656271c8e.js +1 -0
  153. package/assets/esri/core/workers/chunks/{f04cb48fc73635d0572f.js → b059dabb1c732829487c.js} +1 -1
  154. package/assets/esri/core/workers/chunks/b13d2da33ec07e9d41ff.js +1 -0
  155. package/assets/esri/core/workers/chunks/b313464b987db8a3987a.js +1 -0
  156. package/assets/esri/core/workers/chunks/b318823aefcefad6fad5.js +1 -0
  157. package/assets/esri/core/workers/chunks/b378e504a5b1afc8d0ce.js +1 -0
  158. package/assets/esri/core/workers/chunks/{9fb87a7dba62b527c0ba.js → b3a1a93c6dc9247cb048.js} +1 -1
  159. package/assets/esri/core/workers/chunks/b5397dc03fa0bd654ba6.js +1 -0
  160. package/assets/esri/core/workers/chunks/b5b698008b8f3f4d5d61.js +1 -0
  161. package/assets/esri/core/workers/chunks/b7bcb31737b01d7736d0.js +1 -0
  162. package/assets/esri/core/workers/chunks/b9a1046ca2cd0cca5da5.js +1 -0
  163. package/assets/esri/core/workers/chunks/{cda04571d7623c17ada2.js → b9c7aa04861f545a559c.js} +1 -1
  164. package/assets/esri/core/workers/chunks/{7df795bc4fa1d433463b.js → ba030767cf935f967454.js} +1 -1
  165. package/assets/esri/core/workers/chunks/{53d165b4f30fd64e5d8a.js → bd311c85437743cf7d2f.js} +1 -1
  166. package/assets/esri/core/workers/chunks/bd88228f781a0399d8bd.js +1 -0
  167. package/assets/esri/core/workers/chunks/bfb626805405646a0419.js +1 -0
  168. package/assets/esri/core/workers/chunks/{61d3fcb419d6bf7e355e.js → c1e45e24f5ef719a714c.js} +18 -18
  169. package/assets/esri/core/workers/chunks/c203df41f9d2e4b80889.js +1 -0
  170. package/assets/esri/core/workers/chunks/{278409028bc5af45b507.js → c4c83b5129c279c3615b.js} +1 -1
  171. package/assets/esri/core/workers/chunks/c53b2be005721591e29b.js +1 -0
  172. package/assets/esri/core/workers/chunks/c6ef0636073e28350c91.js +1 -0
  173. package/assets/esri/core/workers/chunks/c7e391df714839484cd1.js +1 -0
  174. package/assets/esri/core/workers/chunks/{e287113777a94ded8de6.js → c82ab4f0908290e70ee9.js} +1 -1
  175. package/assets/esri/core/workers/chunks/cded485ad893a7dd2948.js +1 -0
  176. package/assets/esri/core/workers/chunks/{1cf8fb704c48ac3d3b15.js → cf360767310fb45660a8.js} +1 -1
  177. package/assets/esri/core/workers/chunks/{8f2fecd8a0a972d68590.js → cf8ce63711488f2e677c.js} +1 -1
  178. package/assets/esri/core/workers/chunks/d214ac457ac970479536.js +1 -0
  179. package/assets/esri/core/workers/chunks/d4058352db1e8255b52e.js +1 -0
  180. package/assets/esri/core/workers/chunks/d456520e4b119a2816b6.js +1 -0
  181. package/assets/esri/core/workers/chunks/d4d385d19e62ef1c286f.js +1 -0
  182. package/assets/esri/core/workers/chunks/d4f005dadba75422b401.js +1 -0
  183. package/assets/esri/core/workers/chunks/{52c4b4dabcb0d162be72.js → d5e15021928e95c11463.js} +1 -1
  184. package/assets/esri/core/workers/chunks/{fc639c730115e07a4a1a.js → d6500f6b2ff115d9eb09.js} +1 -1
  185. package/assets/esri/core/workers/chunks/e02f02040b63d9c2e654.js +1 -0
  186. package/assets/esri/core/workers/chunks/e08c64e4ae5a68eae2be.js +1 -0
  187. package/assets/esri/core/workers/chunks/e1492d2404c3ed82931e.js +1 -0
  188. package/assets/esri/core/workers/chunks/e2ddfc96ddba92302e0c.js +1 -0
  189. package/assets/esri/core/workers/chunks/e34ed3b818b2eb4116c5.js +1 -0
  190. package/assets/esri/core/workers/chunks/e7149d23615fee31ab7e.js +1 -0
  191. package/assets/esri/core/workers/chunks/ec774f5d6ea5c29536e5.js +1 -0
  192. package/assets/esri/core/workers/chunks/{35cbf00f0c37a86517af.js → ed1de8b7406269e217b9.js} +1 -1
  193. package/assets/esri/core/workers/chunks/ed4ac5568dc2815b066d.js +1 -0
  194. package/assets/esri/core/workers/chunks/ed71a4e353715db0a6e9.js +1 -0
  195. package/assets/esri/core/workers/chunks/{f4891345507df63cff3c.js → ef27bf1d7941ae265ca4.js} +3 -3
  196. package/assets/esri/core/workers/chunks/f029c12f1afee0e9b2a1.js +1 -0
  197. package/assets/esri/core/workers/chunks/{1e342d532925569daadb.js → f475672ff4c2ec9367c2.js} +1 -1
  198. package/assets/esri/core/workers/chunks/{cc414fd2e313d89d524d.js → f54eba484f40d5eeb590.js} +1 -1
  199. package/assets/esri/core/workers/chunks/f5c9659fc5d571d501c9.js +1 -0
  200. package/assets/esri/core/workers/chunks/f622b27ebdf1c918fd6d.js +1 -0
  201. package/assets/esri/core/workers/chunks/{dd95f50dac3f33cdb6d2.js → f6a13f07a5f7b781a9a8.js} +1 -1
  202. package/assets/esri/core/workers/chunks/{d849bdaf5bdfdc37531a.js → f6f7d885b4d6080e3f58.js} +1 -1
  203. package/assets/esri/core/workers/chunks/f8b8d3d2710c83acccf3.js +1 -0
  204. package/assets/esri/core/workers/chunks/f95870bb4d8e4e13e69e.js +1 -0
  205. package/assets/esri/core/workers/chunks/fa377112ef3b78f6ed18.js +1 -0
  206. package/assets/esri/core/workers/chunks/fa59f10ed0f182a2a7f3.js +1 -0
  207. package/assets/esri/core/workers/chunks/faa55265020591fd2224.js +1 -0
  208. package/assets/esri/core/workers/chunks/fc827f58db3194922056.js +1 -0
  209. package/chunks/VolumeMask.glsl.js +3 -0
  210. package/chunks/_commonjsHelpers.js +1 -1
  211. package/chunks/aiServices.js +1 -1
  212. package/chunks/array.js +1 -1
  213. package/chunks/languageUtils.js +1 -1
  214. package/chunks/persistableUrlUtils.js +1 -1
  215. package/config.js +1 -1
  216. package/core/Collection.d.ts +42 -6
  217. package/core/Collection.js +1 -1
  218. package/form/ExpressionInfo.d.ts +1 -1
  219. package/form/ExpressionInfo.js +1 -1
  220. package/form/elements/FieldElement.d.ts +3 -2
  221. package/form/elements/inputs/ComboBoxInput.d.ts +4 -15
  222. package/form/elements/inputs/ComboBoxInput.js +1 -1
  223. package/form/elements/inputs/DynamicChoiceInput.d.ts +31 -0
  224. package/form/elements/inputs/DynamicChoiceInput.js +2 -0
  225. package/form/elements/inputs/Input.d.ts +1 -1
  226. package/form/elements/inputs/RadioButtonsInput.d.ts +4 -15
  227. package/form/elements/inputs/RadioButtonsInput.js +1 -1
  228. package/form/elements/inputs/SingleChoiceInput.d.ts +18 -0
  229. package/form/elements/inputs/SingleChoiceInput.js +2 -0
  230. package/form/elements/inputs.d.ts +11 -2
  231. package/form/elements/inputs.js +1 -1
  232. package/geometry/SpatialReference.d.ts +1 -4
  233. package/geometry/support/normalizeUtils.d.ts +1 -1
  234. package/kernel.js +1 -1
  235. package/layers/BaseElevationLayer.js +1 -1
  236. package/layers/ElevationLayer.js +1 -1
  237. package/layers/ImageryTileLayer.d.ts +1 -1
  238. package/layers/IntegratedMesh3DTilesLayer.js +1 -1
  239. package/layers/KnowledgeGraphLayer.js +1 -1
  240. package/layers/Lyr3DWasmPerSceneView.js +1 -1
  241. package/layers/RouteLayer.d.ts +1 -1
  242. package/layers/StreamLayer.js +1 -1
  243. package/layers/VoxelWasmPerSceneView.js +1 -1
  244. package/layers/graphics/sources/connections/createConnection.js +1 -1
  245. package/layers/graphics/sources/parquet/ParquetFileStatistics.js +1 -1
  246. package/layers/graphics/sources/support/ParquetSourceWorker.js +1 -1
  247. package/layers/graphics/sources/support/QueryTask.js +1 -1
  248. package/layers/mixins/ArcGISImageService.d.ts +24 -24
  249. package/layers/mixins/SceneService.js +1 -1
  250. package/layers/mixins/TiledImagery.d.ts +1 -1
  251. package/layers/orientedImagery/transformations/rectifyMapPoint.js +1 -1
  252. package/layers/raster/datasets/BaseRaster.js +1 -1
  253. package/layers/save/groupLayerUtils.js +1 -1
  254. package/layers/save/mediaLayerUtils.js +1 -1
  255. package/layers/support/ElevationQueryTileCache.js +1 -1
  256. package/layers/video/VideoController.js +1 -1
  257. package/layers/video/types.d.ts +17 -1
  258. package/linkChart/LinkChartProperties.js +1 -1
  259. package/networks/support/CircuitExportJobInfo.d.ts +1 -1
  260. package/networks/support/CircuitVerifyJobInfo.d.ts +1 -1
  261. package/networks/support/TopologyValidationJobInfo.d.ts +1 -1
  262. package/networks/support/TraceJobInfo.d.ts +1 -1
  263. package/package.json +2 -2
  264. package/portal/jsonTypes.d.ts +1 -1
  265. package/portal/support/jsonContext.js +1 -1
  266. package/rest/closestFacility.d.ts +1 -1
  267. package/rest/find.d.ts +1 -1
  268. package/rest/geometryService.d.ts +21 -21
  269. package/rest/geoprocessor.d.ts +2 -2
  270. package/rest/identify.d.ts +1 -1
  271. package/rest/imageService.d.ts +19 -19
  272. package/rest/lastMileDelivery.d.ts +8 -8
  273. package/rest/locator.d.ts +4 -4
  274. package/rest/networkService.d.ts +1 -1
  275. package/rest/networks/queryAssociations.d.ts +1 -1
  276. package/rest/networks/synthesizeAssociationGeometries.d.ts +1 -1
  277. package/rest/networks/trace.d.ts +1 -1
  278. package/rest/networks/traverseAssociations.d.ts +1 -1
  279. package/rest/places.d.ts +3 -3
  280. package/rest/print.d.ts +1 -1
  281. package/rest/query.d.ts +11 -11
  282. package/rest/route.d.ts +1 -1
  283. package/rest/serviceArea.d.ts +1 -1
  284. package/rest/support/JobInfo.d.ts +5 -5
  285. package/rest/symbolService.d.ts +1 -1
  286. package/support/persistableUrlUtils.js +1 -1
  287. package/support/revision.js +1 -1
  288. package/views/2d/layers/features/sources/strategies/AFeatureLoadStrategy.js +1 -1
  289. package/views/2d/layers/features/sources/strategies/FeatureHybridTileLoadStrategy.js +1 -1
  290. package/views/3d/GroundView3D.js +1 -1
  291. package/views/3d/analysis/LineOfSight/LineOfSightReshapeTool3D.js +1 -1
  292. package/views/3d/analysis/LineOfSight/LineOfSightTool.js +1 -1
  293. package/views/3d/analysis/VolumeMeasurement/VolumeMeasurementCutFillController.js +1 -1
  294. package/views/3d/analysis/VolumeMeasurement/VolumeMeasurementShiftTool.js +1 -1
  295. package/views/3d/layers/IntegratedMesh3DTilesLayerView3D.js +1 -1
  296. package/views/3d/layers/graphics/Graphics3DPathSymbolLayer.js +1 -1
  297. package/views/3d/layers/graphics/Graphics3DPathSymbolLayerConstants.js +1 -1
  298. package/views/3d/layers/graphics/defaultSymbolComplexity.js +1 -1
  299. package/views/3d/layers/i3s/I3SIntersectionHandler.js +1 -1
  300. package/views/3d/layers/i3s/PointCloudRenderer.js +1 -1
  301. package/views/3d/layers/support/Tiles3DMeshIntersectionHandler.js +1 -1
  302. package/views/3d/state/helpers/SceneIntersectionHelper.js +1 -1
  303. package/views/3d/support/gaussianSplatting/GaussianSplatHeaderTexture.js +1 -1
  304. package/views/3d/support/gaussianSplatting/GaussianSplatIntersectionHandler.js +1 -1
  305. package/views/3d/support/hitTest.js +1 -1
  306. package/views/3d/support/pointsOfInterest/CameraOnSurface.js +1 -1
  307. package/views/3d/support/pointsOfInterest/PointsOfInterest.js +1 -1
  308. package/views/3d/support/pointsOfInterest/StableSurfaceCenter.js +1 -1
  309. package/views/3d/terrain/TerrainRenderer.js +1 -1
  310. package/views/3d/terrain/TerrainSurface.js +1 -1
  311. package/views/3d/webgl-engine/collections/Component/ComponentObjectElevationAgnosticBVH.js +1 -1
  312. package/views/3d/webgl-engine/collections/Component/ComponentObjectFixedBVH.js +1 -1
  313. package/views/3d/webgl-engine/collections/Component/IntersectionGeometry.js +1 -1
  314. package/views/3d/webgl-engine/core/shaderLibrary/TextureBackedBufferFields.glsl.js +1 -1
  315. package/views/3d/webgl-engine/core/shaderLibrary/attributes/PathEvaluate.glsl.js +49 -32
  316. package/views/3d/webgl-engine/core/shaderLibrary/attributes/PathVertexInfo.glsl.js +5 -5
  317. package/views/3d/webgl-engine/core/shaderLibrary/attributes/PathVertexPosition.glsl.js +23 -23
  318. package/views/3d/webgl-engine/effects/focusArea/FocusAreaMask.js +1 -1
  319. package/views/3d/webgl-engine/lib/CutFillVisualization.js +1 -1
  320. package/views/3d/webgl-engine/lib/GaussianSplatRenderer.js +1 -1
  321. package/views/3d/webgl-engine/lib/Intersector.js +1 -1
  322. package/views/3d/webgl-engine/lib/IntersectorResult.js +1 -1
  323. package/views/3d/webgl-engine/lib/PathBuilder.js +1 -1
  324. package/views/3d/webgl-engine/lib/PathEvaluator.js +1 -1
  325. package/views/3d/webgl-engine/lib/PathExtruder.js +1 -1
  326. package/views/3d/webgl-engine/lib/RayIntersections.js +1 -1
  327. package/views/3d/webgl-engine/lib/ShadowAccumulator.js +1 -1
  328. package/views/3d/webgl-engine/lib/SortedRenderGeometryRenderer.js +1 -1
  329. package/views/3d/webgl-engine/lib/TextureBackedBuffer/TextureBackedBufferFieldCreation.js +1 -1
  330. package/views/3d/webgl-engine/lib/lodRendering/LodResources.js +1 -1
  331. package/views/3d/webgl-engine/materials/HUDMaterial.js +1 -1
  332. package/views/3d/webgl-engine/materials/HeatmapDensityMaterial.js +1 -1
  333. package/views/3d/webgl-engine/materials/NativeLineMaterial.js +1 -1
  334. package/views/3d/webgl-engine/materials/PathMaterial.js +1 -1
  335. package/views/3d/webgl-engine/materials/PathTechniqueConfiguration.js +1 -1
  336. package/views/3d/webgl-engine/materials/RibbonLineMaterial.js +1 -1
  337. package/views/3d/webgl-engine/materials/intersectWithPolygonOffset.js +1 -1
  338. package/views/3d/webgl-engine/shaders/ShadowCastMaskTechnique.js +1 -1
  339. package/views/3d/webgl-engine/shaders/{CutFillMask.glsl.js → VolumeMask.glsl.js} +1 -1
  340. package/views/3d/webgl-engine/shaders/VolumeMaskTechnique.js +2 -0
  341. package/views/draw/support/InteractiveHandle.js +1 -1
  342. package/views/draw/support/managers/SurfaceManager.js +1 -1
  343. package/views/interactive/Tooltip.d.ts +3 -3
  344. package/views/interactive/Tooltip.js +1 -1
  345. package/views/interactive/options/ElevationOptions.d.ts +20 -0
  346. package/views/interactive/options/ElevationOptions.js +2 -0
  347. package/views/interactive/options/LabelOptions.d.ts +74 -0
  348. package/views/interactive/options/LabelOptions.js +2 -0
  349. package/views/interactive/options/SnappingOptions.d.ts +157 -0
  350. package/views/interactive/options/SnappingOptions.js +2 -0
  351. package/views/interactive/options/TooltipOptions.d.ts +152 -0
  352. package/views/interactive/options/TooltipOptions.js +2 -0
  353. package/views/interactive/options/TooltipVisibleElements.d.ts +105 -0
  354. package/views/interactive/options/TooltipVisibleElements.js +2 -0
  355. package/views/interactive/options/ValueOptions.d.ts +63 -0
  356. package/views/interactive/options/ValueOptions.js +2 -0
  357. package/views/interactive/sketch/SketchLabelOptions.d.ts +7 -9
  358. package/views/interactive/sketch/SketchLabelOptions.js +1 -1
  359. package/views/interactive/sketch/SketchTooltipElevationOptions.js +1 -1
  360. package/views/interactive/sketch/SketchTooltipOptions.d.ts +8 -50
  361. package/views/interactive/sketch/SketchTooltipOptions.js +1 -1
  362. package/views/interactive/sketch/SketchTooltipVisibleElements.d.ts +10 -95
  363. package/views/interactive/sketch/SketchTooltipVisibleElements.js +1 -1
  364. package/views/interactive/sketch/SketchValueOptions.d.ts +7 -45
  365. package/views/interactive/sketch/SketchValueOptions.js +1 -1
  366. package/views/interactive/sketch/Units.d.ts +10 -29
  367. package/views/interactive/sketch/Units.js +1 -1
  368. package/views/interactive/snapping/SnappingOptions.d.ts +7 -78
  369. package/views/interactive/snapping/SnappingOptions.js +1 -1
  370. package/views/interactive/support/Units.d.ts +33 -0
  371. package/views/interactive/support/Units.js +2 -0
  372. package/views/interactive/support/types.d.ts +33 -0
  373. package/views/interactive/tooltip/types.d.ts +6 -2
  374. package/webdoc/support/resourceUtils.js +1 -1
  375. package/webdoc/support/types.d.ts +2 -0
  376. package/webdoc/support/utils.js +2 -0
  377. package/webdoc/support/webdocLoadUtils.js +1 -1
  378. package/webdoc/support/webdocSaveUtils.js +1 -1
  379. package/widgets/BatchAttributeForm/BatchAttributeFormViewModel.js +1 -1
  380. package/widgets/BatchAttributeForm/batchAttributeFormUtils.js +1 -1
  381. package/widgets/BatchAttributeForm/expressions/ArcadeExecutorProvider.js +1 -1
  382. package/widgets/BatchAttributeForm/expressions/ExpressionsManager.js +1 -1
  383. package/widgets/BatchAttributeForm/expressions/ExpressionsModel.js +1 -1
  384. package/widgets/BatchAttributeForm/inputs/AttachmentElementInput.js +1 -1
  385. package/widgets/BatchAttributeForm/inputs/BatchFormInputs.js +1 -1
  386. package/widgets/BatchAttributeForm/inputs/FieldInput.js +1 -1
  387. package/widgets/BatchAttributeForm/inputs/RelationshipElementInput.js +1 -1
  388. package/widgets/BatchAttributeForm/inputs/support/inputUtils.js +1 -1
  389. package/widgets/BatchAttributeForm/rendered-content/RelationshipDetails.js +1 -1
  390. package/widgets/BatchAttributeForm/templates/support/createBatchFormTemplate.js +1 -1
  391. package/widgets/BatchAttributeForm.js +1 -1
  392. package/widgets/Editor/UpdateWorkflow.js +1 -1
  393. package/widgets/Editor.js +1 -1
  394. package/widgets/FeatureForm.js +1 -1
  395. package/widgets/FeatureTable/Grid/Column.d.ts +6 -0
  396. package/widgets/Legend/support/ActiveLayerInfo.js +1 -1
  397. package/widgets/Sketch/SketchViewModel.js +1 -1
  398. package/widgets/support/SelectionList/FeatureItem.d.ts +116 -0
  399. package/widgets/support/SelectionList/GroupLayerItem.d.ts +94 -0
  400. package/widgets/support/SelectionList/ItemBase.d.ts +70 -0
  401. package/widgets/support/SelectionList/LayerItem.d.ts +140 -0
  402. package/widgets/support/SelectionList/LayerItem.js +1 -1
  403. package/widgets/support/SelectionList/SelectionListViewModel.d.ts +265 -0
  404. package/widgets/support/SelectionList/SelectionListViewModel.js +1 -1
  405. package/widgets/support/SelectionList/types.d.ts +42 -0
  406. package/widgets/support/forms/formUtils.js +1 -1
  407. package/assets/esri/core/workers/chunks/003a87b16f8a4b476e14.js +0 -1
  408. package/assets/esri/core/workers/chunks/069b6d8bdb34ee88d437.js +0 -1
  409. package/assets/esri/core/workers/chunks/0790bf0eb276cd9166f6.js +0 -1
  410. package/assets/esri/core/workers/chunks/0a50efb07eee36237e21.js +0 -1
  411. package/assets/esri/core/workers/chunks/0ae0483b72f5e8d00d55.js +0 -1
  412. package/assets/esri/core/workers/chunks/0d1224693a62a26a0e72.js +0 -1
  413. package/assets/esri/core/workers/chunks/10b367563f894ceb9864.js +0 -1
  414. package/assets/esri/core/workers/chunks/11e00ca5ac1b004f4ecc.js +0 -1
  415. package/assets/esri/core/workers/chunks/129fdd1636e67997337c.js +0 -1
  416. package/assets/esri/core/workers/chunks/12e0c5b7cc5c3f9e6f0f.js +0 -1
  417. package/assets/esri/core/workers/chunks/13033178de9f637a2356.js +0 -1
  418. package/assets/esri/core/workers/chunks/13c893e448bedc5c1cef.js +0 -1
  419. package/assets/esri/core/workers/chunks/147a89553188cc6aabf4.js +0 -1
  420. package/assets/esri/core/workers/chunks/15c2d9bec0455fc363a9.js +0 -1
  421. package/assets/esri/core/workers/chunks/246cd372d4184233f48e.js +0 -1
  422. package/assets/esri/core/workers/chunks/268ab65afc3fce775ad2.js +0 -1
  423. package/assets/esri/core/workers/chunks/26a2d4b95cda0a41d980.js +0 -1
  424. package/assets/esri/core/workers/chunks/26f1fd3f2be5102aae1d.js +0 -1
  425. package/assets/esri/core/workers/chunks/279a9a38b04a21cdfd11.js +0 -1
  426. package/assets/esri/core/workers/chunks/3406a01dad6338e3c548.js +0 -1
  427. package/assets/esri/core/workers/chunks/34fbeeeeef4bd01672c6.js +0 -1
  428. package/assets/esri/core/workers/chunks/36781219ca9ba5d7fe52.js +0 -1
  429. package/assets/esri/core/workers/chunks/36999a2e383c8eb3c398.js +0 -1
  430. package/assets/esri/core/workers/chunks/36f8a912842181e1f0aa.js +0 -1
  431. package/assets/esri/core/workers/chunks/36fe6adf6517d8f80125.js +0 -1
  432. package/assets/esri/core/workers/chunks/3f1a7f8a9ead64bf0b7b.js +0 -1
  433. package/assets/esri/core/workers/chunks/403f08e0c1a9203f7fba.js +0 -1
  434. package/assets/esri/core/workers/chunks/461c2de938bf4c9b1442.js +0 -1
  435. package/assets/esri/core/workers/chunks/478540265c86436da05e.js +0 -1
  436. package/assets/esri/core/workers/chunks/479f486ec1797629ec70.js +0 -1
  437. package/assets/esri/core/workers/chunks/484b3e2a220c440ccbb4.js +0 -1
  438. package/assets/esri/core/workers/chunks/4a340836ddbc856993f2.js +0 -1
  439. package/assets/esri/core/workers/chunks/4f2170609742b51bd7b8.js +0 -1
  440. package/assets/esri/core/workers/chunks/4f59357f535f30a6b5cc.js +0 -1
  441. package/assets/esri/core/workers/chunks/5133083222588799493f.js +0 -1
  442. package/assets/esri/core/workers/chunks/52993a9dc0c56e9bda19.js +0 -1
  443. package/assets/esri/core/workers/chunks/57b07448da06d0302a46.js +0 -1
  444. package/assets/esri/core/workers/chunks/5a9ff50fdcc99ae28cce.js +0 -1
  445. package/assets/esri/core/workers/chunks/5dc17b76c6ecc24e7b9a.js +0 -1
  446. package/assets/esri/core/workers/chunks/5e35828216020f33e26b.js +0 -1
  447. package/assets/esri/core/workers/chunks/5eb6f37c74a217772eca.js +0 -1
  448. package/assets/esri/core/workers/chunks/5f0d6c853873a7f32527.js +0 -1
  449. package/assets/esri/core/workers/chunks/6121cd0264b6841a5bac.js +0 -1
  450. package/assets/esri/core/workers/chunks/6210fb6cd31844f23964.js +0 -1
  451. package/assets/esri/core/workers/chunks/638ed1297efdb24f4711.js +0 -1
  452. package/assets/esri/core/workers/chunks/64247e439ef3e1f712e9.js +0 -1
  453. package/assets/esri/core/workers/chunks/661a59133ae34f172174.js +0 -1
  454. package/assets/esri/core/workers/chunks/6823ba1688dfedba0107.js +0 -1
  455. package/assets/esri/core/workers/chunks/6c2b5087a9df65267f4e.js +0 -1
  456. package/assets/esri/core/workers/chunks/6d247ff53421d27628ce.js +0 -1
  457. package/assets/esri/core/workers/chunks/700c08dd2e734c15e621.js +0 -1
  458. package/assets/esri/core/workers/chunks/70452f6d63e9be8d03dd.js +0 -1
  459. package/assets/esri/core/workers/chunks/705d6b108fd121cea887.js +0 -1
  460. package/assets/esri/core/workers/chunks/733b2e181683d5fc7c95.js +0 -1
  461. package/assets/esri/core/workers/chunks/73aa1bfa6e1dc271c9d7.js +0 -1
  462. package/assets/esri/core/workers/chunks/7659391f952d134164cf.js +0 -1
  463. package/assets/esri/core/workers/chunks/7889f4a17cf249f2acc5.js +0 -1
  464. package/assets/esri/core/workers/chunks/7a2dcd57849048c6e00d.js +0 -1
  465. package/assets/esri/core/workers/chunks/7a2dfa42610fe8414ed7.js +0 -1
  466. package/assets/esri/core/workers/chunks/7ce52b850dd785bfa33f.js +0 -1
  467. package/assets/esri/core/workers/chunks/81accb1820e2735fa376.js +0 -1
  468. package/assets/esri/core/workers/chunks/8210fc9e072209e26fa9.js +0 -1
  469. package/assets/esri/core/workers/chunks/825eb845216762a1ed2f.js +0 -1
  470. package/assets/esri/core/workers/chunks/83991475aa54fd5aa008.js +0 -1
  471. package/assets/esri/core/workers/chunks/84fa102a93b2144c28fb.js +0 -1
  472. package/assets/esri/core/workers/chunks/85ce7673d42526a79fd2.js +0 -1
  473. package/assets/esri/core/workers/chunks/8722e2790272e90a1897.js +0 -1
  474. package/assets/esri/core/workers/chunks/88df19742edb0cdc3e67.js +0 -1
  475. package/assets/esri/core/workers/chunks/8977c85aecc7e08ab13c.js +0 -1
  476. package/assets/esri/core/workers/chunks/8a1970e68bc1e833cb7f.js +0 -1
  477. package/assets/esri/core/workers/chunks/8bb20ef549ec1c86b38e.js +0 -1
  478. package/assets/esri/core/workers/chunks/8bdca809dd88eab9e5d8.js +0 -29
  479. package/assets/esri/core/workers/chunks/8c5726c7ce40a92901e6.js +0 -1
  480. package/assets/esri/core/workers/chunks/8c5e65982c3f9295e844.js +0 -1
  481. package/assets/esri/core/workers/chunks/8ce649e55fefc8eca55c.js +0 -1
  482. package/assets/esri/core/workers/chunks/90ae80b797642bff0efa.js +0 -1
  483. package/assets/esri/core/workers/chunks/94e9cf8e729ec36de5be.js +0 -1
  484. package/assets/esri/core/workers/chunks/97c758f736f28c5dab84.js +0 -1
  485. package/assets/esri/core/workers/chunks/98b27cf8acbfa4259758.js +0 -1
  486. package/assets/esri/core/workers/chunks/9a6208ab670ad74e6f7d.js +0 -1
  487. package/assets/esri/core/workers/chunks/a10f63a08d976be058be.js +0 -1
  488. package/assets/esri/core/workers/chunks/a494abeb026d536d9fae.js +0 -1
  489. package/assets/esri/core/workers/chunks/a5f058567419ea70dff6.js +0 -1
  490. package/assets/esri/core/workers/chunks/a8ade34612e73862de6f.js +0 -1
  491. package/assets/esri/core/workers/chunks/a9d391071803b1e9e8a0.js +0 -1
  492. package/assets/esri/core/workers/chunks/aa3abc07de2921ef6ca1.js +0 -1
  493. package/assets/esri/core/workers/chunks/b03f09ee2224f0cc526a.js +0 -1
  494. package/assets/esri/core/workers/chunks/b3f1a442d6b7826e917f.js +0 -1
  495. package/assets/esri/core/workers/chunks/b5c7813495657f844171.js +0 -1
  496. package/assets/esri/core/workers/chunks/b7170816736769d3b7b0.js +0 -1
  497. package/assets/esri/core/workers/chunks/b819a9187426d0c146df.js +0 -1
  498. package/assets/esri/core/workers/chunks/b8e5d7aefddddbd0a10c.js +0 -1
  499. package/assets/esri/core/workers/chunks/b958f87f23f984131d09.js +0 -1
  500. package/assets/esri/core/workers/chunks/b9f40681af1fa00b5bbe.js +0 -1
  501. package/assets/esri/core/workers/chunks/c4c25db769a78e677e33.js +0 -1
  502. package/assets/esri/core/workers/chunks/c85ba0700eafdc8d6f9e.js +0 -1
  503. package/assets/esri/core/workers/chunks/ca118c42c0f609ca7912.js +0 -1
  504. package/assets/esri/core/workers/chunks/cb17cd8aaf77238c0236.js +0 -1
  505. package/assets/esri/core/workers/chunks/d03f427442bb0c287d05.js +0 -1
  506. package/assets/esri/core/workers/chunks/d08d3c6f21e6ba8268ca.js +0 -1
  507. package/assets/esri/core/workers/chunks/d37a72111dffc4c4db70.js +0 -1
  508. package/assets/esri/core/workers/chunks/d41ab2abcfacc87809b5.js +0 -1
  509. package/assets/esri/core/workers/chunks/d4ed094962a41d756c95.js +0 -1
  510. package/assets/esri/core/workers/chunks/d51c41c1944df0cbab3e.js +0 -1
  511. package/assets/esri/core/workers/chunks/dc24e80d061f7b063608.js +0 -1
  512. package/assets/esri/core/workers/chunks/df30053a10d4930924d5.js +0 -1
  513. package/assets/esri/core/workers/chunks/e3623e557ab463580fd2.js +0 -1
  514. package/assets/esri/core/workers/chunks/e5bb7ee670a3ba5ba3fe.js +0 -1
  515. package/assets/esri/core/workers/chunks/e5c75459de85a6dd2f14.js +0 -1
  516. package/assets/esri/core/workers/chunks/e798ca23f02a2dd65bd4.js +0 -1
  517. package/assets/esri/core/workers/chunks/f0225829f7d941914815.js +0 -1
  518. package/assets/esri/core/workers/chunks/f1299b4fc760ccca1518.js +0 -1
  519. package/assets/esri/core/workers/chunks/f65adaaa33d9f3b131f6.js +0 -1
  520. package/assets/esri/core/workers/chunks/f7fa932ade85cb2847b6.js +0 -1
  521. package/assets/esri/core/workers/chunks/f9b654f801cb416e9e17.js +0 -1
  522. package/assets/esri/core/workers/chunks/fb34d6d96c8c0d53fcf6.js +0 -1
  523. package/assets/esri/core/workers/chunks/fdec3a2e100688c42e41.js +0 -1
  524. package/assets/esri/core/workers/chunks/fefbde2c2e527bb716ee.js +0 -1
  525. package/chunks/CutFillMask.glsl.js +0 -3
  526. package/chunks/FocusAreaMask.glsl.js +0 -3
  527. package/views/3d/webgl-engine/effects/focusArea/FocusAreaMask.glsl.js +0 -2
  528. package/views/3d/webgl-engine/effects/focusArea/FocusAreaMaskTechnique.js +0 -2
  529. package/views/3d/webgl-engine/shaders/CutFillMaskTechnique.js +0 -2
  530. /package/assets/esri/core/workers/chunks/{a12803108c3b12808698.js.LICENSE.txt → 242cad472fbc38b24dbc.js.LICENSE.txt} +0 -0
@@ -1,2 +1,2 @@
1
1
  /* COPYRIGHT Esri - https://js.arcgis.com/5.2/LICENSE.txt */
2
- import{isSome as e,addMany as t,pushIfSome as n}from"../../../core/arrayUtils.js";import{getOrCreateMapValue as s}from"../../../core/MapUtils.js";import o from"../../../core/Queue.js";import{addMany as r,last as i}from"../../../core/SetUtils.js";import{isFieldElementTemplate as a}from"../templates/support/templateUtils.js";let c=0;class l{constructor(e){this.arcadeExecutorUses=new Map,this.components=[],this.preserveFieldValuesWhenHidden=!1,this.executorMap=e.executorMap,this.preserveFieldValuesWhenHidden=!0===e.preserveFieldValuesWhenHidden,this.elementTemplateMap=new Map;for(const t of this.executorMap.keys())this.elementTemplateMap.set(t.elementId,t);this._buildDependencyGraph()}_buildDependencyGraph(){const e=f(this.executorMap),t={components:[],arcadeExecutorUses:this.arcadeExecutorUses,elementTemplatesById:new Map([...this.executorMap.keys()].map(e=>[e.elementId,e])),executorMap:this.executorMap,fieldElementTemplateMap:x(this.executorMap),fieldReferencesMap:new Map,geometryReferences:new Set,originalFeatureReferences:new Set,nextIndex:0,nodeInfoMap:e,nodeStack:new o(i),shouldConsiderVisibility:!this.preserveFieldValuesWhenHidden};for(const n of this.executorMap.keys()){const e=this.executorMap.get(n);null!=e&&(e.editableExpression&&s(this.arcadeExecutorUses,e.editableExpression,()=>[]).push({elementId:n.elementId,executorPurpose:"editable"}),e.valueExpression&&s(this.arcadeExecutorUses,e.valueExpression,()=>[]).push({elementId:n.elementId,executorPurpose:"value"}),e.visibilityExpression&&s(this.arcadeExecutorUses,e.visibilityExpression,()=>[]).push({elementId:n.elementId,executorPurpose:"visibility"}),e.requiredExpression&&s(this.arcadeExecutorUses,e.requiredExpression,()=>[]).push({elementId:n.elementId,executorPurpose:"required"}),e.textExpressions&&e.textExpressions.forEach((e,t)=>{s(this.arcadeExecutorUses,e,()=>[]).push({elementId:n.elementId,executorPurpose:"text",textExpressionIndex:t})}))}for(const n of this.arcadeExecutorUses.values())n.sort(e=>"editable"===e.executorPurpose?-1:1);for(const n of e.values())-1===n.index&&p(n,t);this.dependencyGraphComponents=m(e),this.fieldReferencesMap=h(t),this.geometryReferences=M(t.geometryReferences,e),this.originalFeatureReferences=M(t.originalFeatureReferences,e),this.components=t.components}}function p(e,t){e.index=e.lowlink=t.nextIndex++,t.nodeStack.push(e);for(const n of d(e,t))-1===n.index?(p(n,t),e.lowlink=Math.min(e.lowlink,n.lowlink)):n.index<e.index&&t.nodeStack.contains(n)&&(e.lowlink=Math.min(e.lowlink,n.index)),t.nodeStack.contains(n)||e.crossLinkNeighbors.add(n);if(e.lowlink===e.index){const n=E();for(t.components.push(n);y(t.nodeStack)>=e.index;){const e=t.nodeStack.pop();if(null!=e){e.component=n,n.executors.add(e.executor);for(const t of e.crossLinkNeighbors)null!=t.component&&n.adjacencyList.add(t.component)}}}}function d({executor:t},n){const o=new Set;for(const e of t.fieldsUsed){const i=e.toLowerCase();s(n.fieldReferencesMap,i,()=>new Set).add(t),r(o,u(i,n))}t.geometryUsed&&n.geometryReferences.add(t),t.variablesUsed.includes("$originalfeature")&&n.originalFeatureReferences.add(t);const i=n.arcadeExecutorUses.get(t)??[];for(const e of i)switch(e.executorPurpose){case"value":{const s=n.executorMap.get(n.elementTemplatesById.get(e.elementId));s?.editableExpression&&s.editableExpression!==t&&o.add(s.editableExpression);break}case"visibility":{const t=n.elementTemplatesById.get(e.elementId);if(n.shouldConsiderVisibility&&t&&a(t)){const e=t.group,s=e?n.executorMap.get(e):null;s?.visibilityExpression&&o.add(s.visibilityExpression)}break}}return Array.from(o).map(e=>n.nodeInfoMap.get(e)).filter(e)}function u(e,{executorMap:t,fieldElementTemplateMap:s,shouldConsiderVisibility:o}){const r=[],i=s.get(e);if(null==i)return r;const a=t.get(i);if(null==a)return r;if(n(r,a.editableExpression),n(r,a.valueExpression),o){n(r,a.visibilityExpression);const{group:e}=i;if(null!=e){const s=t.get(e)?.visibilityExpression;n(r,s)}}return r}function x(e){const t=new Map;for(const n of e.keys())a(n)&&t.set(n.fieldName.toLowerCase(),n);return t}function f(n){const s=Array.from(n.values()).filter(e),o=new Set(s.flatMap(e=>{const{textExpressions:n,...s}=e,o=[];return n?.length&&t(o,n),t(o,Object.values(s)),o})),r=Array.from(o).map(e=>({component:null,crossLinkNeighbors:new Set,executor:e,index:-1,lowlink:-1,onStack:!1}));return new Map(r.map(e=>[e.executor,e]))}function m(e){return new Map([...e.values()].map(({component:e,executor:t})=>[t,e]))}function h({fieldReferencesMap:e,nodeInfoMap:t}){const n=new Map;for(const[s,o]of e.entries())n.set(s,M(o,t));return n}function M(e,t){const n=new Set;for(const s of e){const e=t.get(s);e?.component&&n.add(e.component)}return n}function E(){c++;const e=c.toString();return{executors:new Set,adjacencyList:new Set,componentId:e}}function y(e){return e.peek()?.index??-1}export{l as ExpressionsModel,d as getDirectDependencies};
2
+ import{isSome as e,addMany as t,pushIfSome as n}from"../../../core/arrayUtils.js";import{getOrCreateMapValue as s}from"../../../core/MapUtils.js";import o from"../../../core/Queue.js";import{addMany as r,last as i}from"../../../core/SetUtils.js";import{isFieldElementTemplate as a}from"../templates/support/templateUtils.js";let c=0;class l{constructor(e){this.arcadeExecutorUses=new Map,this.components=[],this.preserveFieldValuesWhenHidden=!1,this.executorMap=e.executorMap,this.preserveFieldValuesWhenHidden=!0===e.preserveFieldValuesWhenHidden,this.elementTemplateMap=new Map;for(const t of this.executorMap.keys())this.elementTemplateMap.set(t.elementId,t);this._buildDependencyGraph()}_buildDependencyGraph(){const e=f(this.executorMap),t={components:[],arcadeExecutorUses:this.arcadeExecutorUses,elementTemplatesById:new Map([...this.executorMap.keys()].map(e=>[e.elementId,e])),executorMap:this.executorMap,fieldElementTemplateMap:x(this.executorMap),fieldReferencesMap:new Map,geometryReferences:new Set,originalFeatureReferences:new Set,nextIndex:0,nodeInfoMap:e,nodeStack:new o(i),shouldConsiderVisibility:!this.preserveFieldValuesWhenHidden};for(const n of this.executorMap.keys()){const e=this.executorMap.get(n);null!=e&&(e.editableExpression&&s(this.arcadeExecutorUses,e.editableExpression,()=>[]).push({elementId:n.elementId,executorPurpose:"editable"}),e.valueExpression&&s(this.arcadeExecutorUses,e.valueExpression,()=>[]).push({elementId:n.elementId,executorPurpose:"value"}),e.visibilityExpression&&s(this.arcadeExecutorUses,e.visibilityExpression,()=>[]).push({elementId:n.elementId,executorPurpose:"visibility"}),e.requiredExpression&&s(this.arcadeExecutorUses,e.requiredExpression,()=>[]).push({elementId:n.elementId,executorPurpose:"required"}),e.textExpressions&&e.textExpressions.forEach((e,t)=>{s(this.arcadeExecutorUses,e,()=>[]).push({elementId:n.elementId,executorPurpose:"text",textExpressionIndex:t})}))}for(const n of this.arcadeExecutorUses.values())n.sort(e=>"editable"===e.executorPurpose?-1:1);for(const n of e.values())-1===n.index&&p(n,t);this.dependencyGraphComponents=m(e),this.fieldReferencesMap=h(t),this.geometryReferences=M(t.geometryReferences,e),this.originalFeatureReferences=M(t.originalFeatureReferences,e),this.components=t.components}}function p(e,t){e.index=e.lowlink=t.nextIndex++,t.nodeStack.push(e);for(const n of d(e,t))-1===n.index?(p(n,t),e.lowlink=Math.min(e.lowlink,n.lowlink)):n.index<e.index&&t.nodeStack.contains(n)&&(e.lowlink=Math.min(e.lowlink,n.index)),t.nodeStack.contains(n)||e.crossLinkNeighbors.add(n);if(e.lowlink===e.index){const n=E();for(t.components.push(n);y(t.nodeStack)>=e.index;){const e=t.nodeStack.pop();if(null!=e){e.component=n,n.executors.add(e.executor);for(const t of e.crossLinkNeighbors)null!=t.component&&n.adjacencyList.add(t.component)}}}}function d({executor:t},n){const o=new Set;for(const e of t.fieldsUsed){const i=e.toLowerCase();s(n.fieldReferencesMap,i,()=>new Set).add(t),r(o,u(i,n))}t.geometryUsed&&n.geometryReferences.add(t),t.variablesUsed.includes("$originalfeature")&&n.originalFeatureReferences.add(t);const i=n.arcadeExecutorUses.get(t)??[];for(const e of i)switch(e.executorPurpose){case"value":{const s=n.executorMap.get(n.elementTemplatesById.get(e.elementId));s?.editableExpression&&s.editableExpression!==t&&o.add(s.editableExpression);break}case"visibility":{const t=n.elementTemplatesById.get(e.elementId);if(n.shouldConsiderVisibility&&t&&a(t)){const e=t.group,s=e?n.executorMap.get(e):null;s?.visibilityExpression&&o.add(s.visibilityExpression)}break}}return Array.from(o).map(e=>n.nodeInfoMap.get(e)).filter(e)}function u(e,{executorMap:t,fieldElementTemplateMap:s,shouldConsiderVisibility:o}){const r=[],i=s.get(e);if(null==i)return r;const a=t.get(i);if(null==a)return r;if(n(r,a.editableExpression),n(r,a.valueExpression),o){n(r,a.visibilityExpression);const{group:e}=i;if(null!=e){const s=t.get(e)?.visibilityExpression;n(r,s)}}return r}function x(e){const t=new Map;for(const n of e.keys())a(n)&&t.set(n.fieldName.toLowerCase(),n);return t}function f(n){const s=Array.from(n.values()).filter(e),o=new Set(s.flatMap(e=>{const{textExpressions:n,...s}=e,o=[];return n?.length&&t(o,n),t(o,Object.values(s)),o})),r=Array.from(o).filter(e).map(e=>({component:null,crossLinkNeighbors:new Set,executor:e,index:-1,lowlink:-1,onStack:!1}));return new Map(r.map(e=>[e.executor,e]))}function m(e){return new Map([...e.values()].map(({component:e,executor:t})=>[t,e]))}function h({fieldReferencesMap:e,nodeInfoMap:t}){const n=new Map;for(const[s,o]of e.entries())n.set(s,M(o,t));return n}function M(e,t){const n=new Set;for(const s of e){const e=t.get(s);e?.component&&n.add(e.component)}return n}function E(){c++;const e=c.toString();return{executors:new Set,adjacencyList:new Set,componentId:e}}function y(e){return e.peek()?.index??-1}export{l as ExpressionsModel,d as getDirectDependencies};
@@ -1,2 +1,2 @@
1
1
  /* COPYRIGHT Esri - https://js.arcgis.com/5.2/LICENSE.txt */
2
- import{__decorate as t}from"tslib";import e from"../../../request.js";import a from"../../../core/Collection.js";import n from"../../../core/Error.js";import i from"../../../core/Logger.js";import{isAbortError as s}from"../../../core/promiseUtils.js";import r from"../../../core/ReactiveMap.js";import o from"../../../core/ReactiveSet.js";import{generateBracedUUID as d}from"../../../core/uuid.js";import{property as l,subclass as h}from"../../../core/accessorSupport/decorators.js";import{getEffectiveLayerCapabilities as c}from"../../../layers/support/layerUtils.js";import m from"../../../rest/query/support/AttachmentInfo.js";import{getAttachmentCategoryForFile as p}from"../../Attachments/support/attachmentUtils.js";import{getAttachmentKey as u,getAttachmentUrl as g,preserveAttachmentFilenameExtension as y,attachmentValidationUtils as f}from"../attachmentUtils.js";import _ from"./EditableInput.js";import A from"./SingleFeatureInputAdapter.js";let U=-1;const v=["maximum-audio-length","maximum-file-size","maximum-image-size","minimum-number-of-files","maximum-number-of-files","maximum-video-length"];let S=class extends _{constructor(t){super(t),this.attachments=[],this.displayCount=3,this.group=null,this.single=new A({input:this}),this.type="attachment",this._initialAttachments=[],this._stagedAdds=new a,this._stagedDeletes=new o,this._stagedUpdates=new r,this._failedStagedUpdateHydrations=new o,this._pendingStagedUpdateHydrations=new r,this._temporaryAttachmentUrls=new r,this._validationCriterionStates=new r,this._hasUnsupportedFileTypeValidationError=!1}get allowUserRename(){return this.template.allowUserRename}get addDisabled(){const t=this.maxAttachmentCount,e=this.effectiveAttachmentCount;return!this.editable||null!=t&&e>=t}get effectiveAttachmentCount(){return this._initialAttachments.length-this._stagedDeletes.size+this._stagedAdds.length}get accept(){const{categories:t}=this;if(!t.size)return;const e=[];return t.has("image")&&e.push("image/*"),t.has("audio")&&e.push("audio/*"),t.has("video")&&e.push("video/*"),t.has("document")&&e.push("text/*","application/*","model/*"),e.length>0?e.join(","):void 0}get categories(){const t=new Set;for(const e of this._nestableInputs)b(t,e.type);return t}get _nestableInputs(){const{input:t}=this;return null==t?[]:"attachment"===t.type?t.inputTypes??[]:[t]}get attachmentKeyword(){return this.template.attachmentKeyword?.trim()}get displayFilename(){return this.template.displayFilename}get allAttachmentsVisibleOnDefaultPage(){return this.defaultPageAttachments.length===this.attachments.length}get canUploadFiles(){const t=this._nestableInputs;return!t.length||t.some(x)}get hasCaptureInputs(){return this._nestableInputs.some(w)}get captureMediaType(){const t=new Set;for(const e of this._nestableInputs)if(w(e))switch(e.type){case"audio":t.add("audio");break;case"video":t.add("video");break;case"image":case"signature":t.add("image")}return 1===t.size?Array.from(t)[0]:null}get isCaptureOnly(){const t=this._nestableInputs;return!!t.length&&t.every(T)}get defaultPageAttachments(){return this.attachments.slice(0,this.displayCount)}get feature(){return this.single.feature}get hasAttachmentChanges(){return this._stagedAdds.length>0||this._stagedUpdates.size>0||this._stagedDeletes.size>0}get hasInvalidAttachmentName(){return!!this.allowUserRename&&this.attachments.some(t=>0===t.name.trim().length)}get attachmentCount(){return this.attachments.length}get hasMinimumAttachmentCountNotMet(){const t=this.minAttachmentCount;return null!=t&&(this.effectiveAttachmentCount<t&&!this.isCaptureOnly)}get hasReachedAttachmentLimit(){const t=this.maxAttachmentCount,e=this.effectiveAttachmentCount;return null!=t&&e===t}get hasExceededAttachmentLimit(){const t=this.maxAttachmentCount,e=this.effectiveAttachmentCount;return null!=t&&e>t}get hasPendingAttachmentUpdateData(){return this._pendingStagedUpdateHydrations.size>0}get input(){return this.template.input}get layer(){return this.single.layer}get maxAttachmentCount(){return this.template.maxAttachmentCount}get minAttachmentCount(){return this.template.minAttachmentCount}get supportsResize(){const{layer:t}=this;if(!t)return!1;const e=c(t);return!!e&&("attachment"in e&&!!e.attachment?.supportsResize)}get useOriginalFilename(){return this.template.useOriginalFilename}get valid(){return!(this._failedStagedUpdateHydrations.size>0||this.hasInvalidAttachmentName||this.hasExceededAttachmentLimit||this.hasMinimumAttachmentCountNotMet)}get _expressionLayer(){const t=this.layer;if(t)return"scene"===t.type&&"associatedLayer"in t&&null!=t.associatedLayer?t.associatedLayer:"feature"===t.type?t:void 0}destroy(){this._clearTemporaryAttachmentUrls()}applyFetchedAttachments(t){for(const e of t)this._normalizeAttachmentName(e);this._initialAttachments=t,this._failedStagedUpdateHydrations.clear(),this._recomputeAttachments()}applyStashedEdits(t){const{adds:e,deletes:a,updates:n}=t;for(const i of e){const t=this._getAttachmentKey(i.info);this._stagedAdds.add({data:i.data,globalId:i.globalId??d(),info:i.info,key:t}),this._setTemporaryAttachmentUrl(t,i.data)}for(const i of n){const t=this._getAttachmentKey(i.info);this._stagedUpdates.set(t,{contentType:i.contentType,data:i.data,info:i.info,key:t,name:i.name,size:F(i)}),this._setTemporaryAttachmentUrl(t,i.data)}for(const i of a){const t=this._getAttachmentKey(i.info);this._stagedDeletes.add(t)}this._recomputeAttachments()}clearAttachmentChanges(){this.clearValidationCriteriaState(),this._clearTemporaryAttachmentUrls(),this._stagedAdds.removeAll(),this._stagedUpdates.clear(),this._stagedDeletes.clear(),this._failedStagedUpdateHydrations.clear(),this._pendingStagedUpdateHydrations.clear(),this._recomputeAttachments()}clearValidationCriteriaState(){this._validationCriterionStates.clear(),this._hasUnsupportedFileTypeValidationError=!1}get hasInvalidValidationCriteria(){for(const t of this._validationCriterionStates.values())if("danger"===t)return!0;return!1}get hasUnsupportedFileTypeValidationError(){return this._hasUnsupportedFileTypeValidationError}get validationCriterionStates(){return this._validationCriterionStates}getValidationCriterionState(t){return this._validationCriterionStates.get(t)??null}stageAddAttachment(t){if(!this._assertEditable())throw new n("batch-attribute-form:not-editable","Cannot modify attachments when editableExpression is false.");const{contentType:e,data:a,name:i}=t,s=t.globalId??d(),r=a instanceof Blob?a.size:void 0,o=i.trim(),l=new m({contentType:e??void 0,globalId:s,id:U--,keywords:this.attachmentKeyword??void 0,name:o,size:r});return this._setTemporaryAttachmentUrl(s,a),this._stagedAdds.add({key:s,globalId:s,info:l,data:a}),this._recomputeAttachments(),l}async stageAddAttachments(t,e){if(this.clearValidationCriteriaState(),!this._assertEditable())return[];const a=t.filter(t=>this.isFileAllowed(t));if(this._setUnsupportedFileTypeValidationError(a.length!==t.length),0===a.length)return[];const n=[],i=new Map,s=Date.now(),r={},o=this.effectiveAttachmentCount,d=o+a.length;if(null!=this.minAttachmentCount&&this.minAttachmentCount>0&&this._setValidationCriterionState(r,"minimum-number-of-files",d>=this.minAttachmentCount?"success":"danger"),null!=this.maxAttachmentCount){const t=d<=this.maxAttachmentCount;if(this._setValidationCriterionState(r,"maximum-number-of-files",t?"success":"danger"),!t)return this._setValidationCriteriaState(r),[]}let l=!0;for(let h=0;h<a.length;h++){const t=a[h];await this._validateAttachmentFile(t,o+h+1,r)||(l=!1)}if(!l)return this._setValidationCriteriaState(r),[];for(let h=0;h<a.length;h++){const t=a[h],r=t instanceof File?t.name:`attachment-${s}_${h+1}`,o=await this._resolveAttachmentFilename(r,e),d=this._makeUniqueFilenameForOperation(i,o);n.push(this.stageAddAttachment({contentType:t.type,data:t,name:d}))}return this._setValidationCriteriaState(r),n}findAttachment(t){if(t)return this.attachments.find(e=>u(e)===t)}getAttachmentEditState(t){const e=this._getAttachmentKey(t),a=e?this._initialAttachments.find(t=>this._getAttachmentKey(t)===e):void 0,n=a?.name??null,i=e?this._stagedUpdates.get(e):void 0,s=i?.name??t.name??null;return{initialName:n,isDeleted:!!e&&this._stagedDeletes.has(e),isRenamed:null!=s&&null!=n&&s!==n,isReplaced:!0===i?.isReplacement}}getAttachmentPreviewUrl(t,e){const a=this._getAttachmentKey(t);return(a?this._temporaryAttachmentUrls.get(a):void 0)??g({attachment:t,supportsResizeAttachments:this.supportsResize,layer:this.layer,thumbnailSize:e})}async ensureStagedUpdateData(t){const e=this._getAttachmentKey(t);if(!e)return!1;const a=this._stagedUpdates.get(e);if(!a||a.data||this._stagedDeletes.has(e))return this._failedStagedUpdateHydrations.delete(e),!1;const n=this._pendingStagedUpdateHydrations.get(e);if(n)return await n;const i=this._hydrateStagedUpdateData(t);this._pendingStagedUpdateHydrations.set(e,i);try{return await i}finally{this._pendingStagedUpdateHydrations.get(e)===i&&this._pendingStagedUpdateHydrations.delete(e)}}async waitForPendingAttachmentUpdateData(){await Promise.allSettled(Array.from(this._pendingStagedUpdateHydrations.values()))}discardStagedEdits(t){if(!this._assertEditable())return;const e=this._getAttachmentKey(t);if(!e)return;const a=this._stagedAdds.findIndex(t=>t.key===e);if(a>-1)return this._clearTemporaryAttachmentUrl(e),this._stagedAdds.removeAt(a),this._failedStagedUpdateHydrations.delete(e),this._pendingStagedUpdateHydrations.delete(e),void this._recomputeAttachments();this._clearTemporaryAttachmentUrl(e),this._stagedDeletes.delete(e),this._clearStagedUpdateTracking(e),this._recomputeAttachments()}isFileAllowed(t){const{categories:e}=this;if(!e.size)return!0;const a=p(t);return null!=a&&e.has(a)}isStagedAttachmentAddition(t){return"number"==typeof t.id&&t.id<0}stageDeleteAttachment(t){if(!this._assertEditable())return;const e=this._getAttachmentKey(t);if(!e)return;const a=this._stagedAdds.findIndex(t=>t.key===e);if(a>-1)return this._clearTemporaryAttachmentUrl(e),this._stagedAdds.removeAt(a),this._failedStagedUpdateHydrations.delete(e),this._pendingStagedUpdateHydrations.delete(e),void this._recomputeAttachments();this._clearTemporaryAttachmentUrl(e),this._stagedDeletes.add(e),this._clearStagedUpdateTracking(e),this._recomputeAttachments()}stageRenameAttachment(t,e){if(!this._assertEditable())return;const a=this._getAttachmentKey(t);if(!a)return;const n=this._stagedAdds.find(t=>t.key===a);if(n){const a=y(t.name,e);return n.info.name=a,void this._recomputeAttachments()}const i=this._stagedUpdates.get(a),s=this._getInitialAttachment(a)?.name??null,r=0===t.name.trim().length?s??t.name:t.name,o=y(r,!0===i?.isReplacement&&null!=s&&e===s?I(s).base:e),d=null!=s&&o===s;if(d&&!0!==i?.isReplacement)return this._stagedUpdates.delete(a),this._failedStagedUpdateHydrations.delete(a),this._pendingStagedUpdateHydrations.delete(a),void this._recomputeAttachments();const l={key:a,...i,info:t};d?delete l.name:l.name=o,this._stagedUpdates.set(a,l),this._recomputeAttachments(),this.ensureStagedUpdateData(t)}async stageReplaceAttachment(t,e,a){if(this.clearValidationCriteriaState(),!this._assertEditable())return!1;if(!this.isFileAllowed(e))return this._setUnsupportedFileTypeValidationError(!0),!1;const n={},i=await this._validateAttachmentFile(e,void 0,n);if(this._setValidationCriteriaState(n),!i)return!1;const s=e instanceof File?e.name:t.name,r=await this._resolveAttachmentFilename(s,a);return this._stageReplaceAttachment(t,e,r),!0}toSubmitEdits(){const t=[],e=[],a=[],n=this.feature?.plainGraphic;if(!n||0===this._stagedAdds.length&&0===this._stagedUpdates.size&&0===this._stagedDeletes.size)return null;const i=this.attachmentKeyword;for(const s of this._stagedAdds)null!=s.data&&t.push({feature:n,contentType:s.info.contentType,data:s.data,info:s.info,globalId:s.info.globalId,keywords:i,name:s.info.name});for(const s of this._stagedUpdates.values()){const t=null==s.name||s.name.trim().length>0;if(null==s.data||!t)continue;const a=s.name??this._getInitialAttachment(s.key)?.name??s.info.name;e.push({feature:n,contentType:s.contentType,data:s.data,globalId:s.info.globalId,id:s.info.id,info:s.info,keywords:i,name:a})}for(const s of this._stagedDeletes.values()){const t=this._getInitialAttachment(s);t&&a.push({feature:n,contentType:t.contentType,globalId:t.globalId,id:t.id,info:t,keywords:i,name:t.name})}return 0===t.length&&0===e.length&&0===a.length?null:{label:this.template.label,keywords:i,adds:t,deletes:a,updates:e}}_assertEditable(){return!!this.editable||(i.getLogger(this).error("batch-attribute-form:not-editable","Cannot modify attachments when editableExpression is false."),!1)}_recomputeAttachments(){const t=[];for(const e of this._stagedAdds)t.push(e.info);for(const e of this._initialAttachments){const a=this._getAttachmentKey(e);if(a&&this._stagedUpdates.has(a)){const n=this._stagedUpdates.get(a),i=e.clone();null!=n.name&&(i.name=n.name),null!=n.contentType&&(i.contentType=n.contentType),null!=n.size&&(i.size=n.size),t.push(i);continue}t.push(e)}this.attachments=t}async _computeAttachmentFilename(t,e){const a=this.template.filenameExpressionExecutor;if(!a)return t;const n=this.single.feature,r=n?.plainGraphic,o=this._expressionLayer,{attachmentKeyword:d,description:l,label:h}=this.template,c={$originalfeature:n?.original,$editcontext:{editType:e.editType},$layer:o,$featureset:o,$datastore:o?.url,$feature:r,$map:e.map,$formElement:{attachmentKeyword:d,description:l,label:h}},m={rawOutput:!0,spatialReference:e.spatialReference,timeZone:e.timeZone};try{const e=a.isAsync?await a.executeAsync(c,m):a.execute(c,m);if("string"==typeof e&&e.trim().length>0){const{extension:a}=I(t);return z(e.trim(),a)}}catch(p){s(p)||i.getLogger(this).error("Failed evaluating attachment filename expression",p)}return t}async _resolveAttachmentFilename(t,e){return!1===this.useOriginalFilename?await this._computeAttachmentFilename(t,e):t}_makeUniqueFilenameForOperation(t,e){const a=e.toLowerCase(),n=t.get(a)??0;if(t.set(a,n+1),0===n)return e;const{base:i,extension:s}=I(e);return z(`${i}_${n}`,s)}_setValidationCriteriaState(t){this._validationCriterionStates.clear();for(const e of v){const a=t[e];a&&this._validationCriterionStates.set(e,a)}}_setUnsupportedFileTypeValidationError(t){this._hasUnsupportedFileTypeValidationError!==t&&(this._hasUnsupportedFileTypeValidationError=t)}_setValidationCriterionState(t,e,a){"danger"!==t[e]&&(t[e]=a)}async _validateAttachmentFile(t,e,a){let n=!0;const i=p(t);for(const s of this._nestableInputs){const e=f.getAttachmentCategoryForInputType(s.type);if(null==i||e===i){if("document"===s.type&&null!=s.maxFileSize){const e=t.size<=1048576*s.maxFileSize;this._setValidationCriterionState(a,"maximum-file-size",e?"success":"danger"),n=n&&e}if(("audio"===s.type||"video"===s.type)&&null!=s.maxDuration){const e=await f.getMediaDurationInSeconds(t,s.type),i=null!=e&&e<=s.maxDuration;this._setValidationCriterionState(a,"audio"===s.type?"maximum-audio-length":"maximum-video-length",i?"success":"danger"),n=n&&i}if("image"===s.type&&null!=s.maxImageSize){const e=await f.getImageDimensionsInPixels(t),i=e?Math.max(e.width,e.height):null,r=null==i||i<=s.maxImageSize;this._setValidationCriterionState(a,"maximum-image-size",r?"success":"danger"),n=n&&r}}}if(null!=e&&null!=this.maxAttachmentCount){const t=e<=this.maxAttachmentCount;this._setValidationCriterionState(a,"maximum-number-of-files",t?"success":"danger"),n=n&&t}return n}_stageReplaceAttachment(t,e,a){const n=this._getAttachmentKey(t);if(!n)return;const i=this._stagedAdds.find(t=>t.key===n);if(i)return i.data=e,i.info.name=a,i.info.contentType=e.type,i.info.size=e.size,this._setTemporaryAttachmentUrl(n,e),void this._recomputeAttachments();const s=this._stagedUpdates.get(n);this._setTemporaryAttachmentUrl(n,e),this._failedStagedUpdateHydrations.delete(n),this._pendingStagedUpdateHydrations.delete(n),this._stagedUpdates.set(n,{...s,key:n,info:t,isReplacement:!0,contentType:e.type||s?.contentType||t.contentType,data:e,name:a,size:e.size}),this._recomputeAttachments()}_getInitialAttachment(t){return this._initialAttachments.find(e=>this._getAttachmentKey(e)===t)}_normalizeAttachmentName(t){const{name:e}=t;"string"==typeof e&&(t.name=e.trim())}_getAttachmentKey(t){return u(t)}_clearStagedUpdateTracking(t){this._stagedUpdates.delete(t),this._failedStagedUpdateHydrations.delete(t),this._pendingStagedUpdateHydrations.delete(t)}async _hydrateStagedUpdateData(t){const a=this._getAttachmentKey(t),n=t.url;if(!a||!n)return!1;try{const{data:i}=await e(n,{responseType:"blob"});this._failedStagedUpdateHydrations.delete(a);const s=this._stagedUpdates.get(a);return!(!s||s.data||this._stagedDeletes.has(a))&&(this._stagedUpdates.set(a,{...s,info:t,isReplacement:s.isReplacement??!1,contentType:s.contentType??t.contentType??i.type,data:i}),!0)}catch(r){const t=this._stagedUpdates.get(a);return!t||t.data||this._stagedDeletes.has(a)||this._failedStagedUpdateHydrations.add(a),s(r)||i.getLogger(this).error("Failed to fetch attachment data for staged update",r),!1}}_setTemporaryAttachmentUrl(t,e){if(this._clearTemporaryAttachmentUrl(t),!(e instanceof Blob))return;const a=URL.createObjectURL(e);return this._temporaryAttachmentUrls.set(t,a),a}_clearTemporaryAttachmentUrl(t){const e=this._temporaryAttachmentUrls.get(t);e&&(URL.revokeObjectURL(e),this._temporaryAttachmentUrls.delete(t))}_clearTemporaryAttachmentUrls(){for(const t of this._temporaryAttachmentUrls.values())URL.revokeObjectURL(t);this._temporaryAttachmentUrls.clear()}};t([l()],S.prototype,"allowUserRename",null),t([l()],S.prototype,"addDisabled",null),t([l()],S.prototype,"effectiveAttachmentCount",null),t([l()],S.prototype,"accept",null),t([l()],S.prototype,"categories",null),t([l()],S.prototype,"attachmentKeyword",null),t([l()],S.prototype,"attachments",void 0),t([l()],S.prototype,"displayFilename",null),t([l({readOnly:!0})],S.prototype,"allAttachmentsVisibleOnDefaultPage",null),t([l()],S.prototype,"canUploadFiles",null),t([l()],S.prototype,"hasCaptureInputs",null),t([l()],S.prototype,"captureMediaType",null),t([l()],S.prototype,"isCaptureOnly",null),t([l({readOnly:!0})],S.prototype,"defaultPageAttachments",null),t([l()],S.prototype,"displayCount",void 0),t([l()],S.prototype,"feature",null),t([l()],S.prototype,"group",void 0),t([l()],S.prototype,"hasAttachmentChanges",null),t([l()],S.prototype,"hasInvalidAttachmentName",null),t([l()],S.prototype,"attachmentCount",null),t([l()],S.prototype,"hasMinimumAttachmentCountNotMet",null),t([l()],S.prototype,"hasReachedAttachmentLimit",null),t([l()],S.prototype,"hasExceededAttachmentLimit",null),t([l({readOnly:!0})],S.prototype,"hasPendingAttachmentUpdateData",null),t([l()],S.prototype,"input",null),t([l()],S.prototype,"layer",null),t([l()],S.prototype,"maxAttachmentCount",null),t([l()],S.prototype,"minAttachmentCount",null),t([l({readOnly:!0})],S.prototype,"single",void 0),t([l({readOnly:!0})],S.prototype,"type",void 0),t([l({readOnly:!0})],S.prototype,"supportsResize",null),t([l()],S.prototype,"useOriginalFilename",null),t([l({readOnly:!0})],S.prototype,"valid",null),t([l()],S.prototype,"_initialAttachments",void 0),t([l()],S.prototype,"_expressionLayer",null),t([l()],S.prototype,"_stagedAdds",void 0),t([l()],S.prototype,"_stagedDeletes",void 0),t([l()],S.prototype,"_stagedUpdates",void 0),t([l()],S.prototype,"_failedStagedUpdateHydrations",void 0),t([l()],S.prototype,"_pendingStagedUpdateHydrations",void 0),t([l()],S.prototype,"_temporaryAttachmentUrls",void 0),t([l()],S.prototype,"_hasUnsupportedFileTypeValidationError",void 0),t([l()],S.prototype,"hasInvalidValidationCriteria",null),t([l()],S.prototype,"hasUnsupportedFileTypeValidationError",null),t([l()],S.prototype,"validationCriterionStates",null),S=t([h("esri.widgets.BatchAttributeForm.inputs.AttachmentElementInput")],S);const C=S;function b(t,e){switch(e){case"audio":t.add("audio");break;case"document":t.add("document");break;case"image":case"signature":t.add("image");break;case"video":t.add("video")}}function T(t){return"document"!==t.type&&"capture"===t.inputMethod}function w(t){return T(t)}function x(t){return"document"===t.type||"capture"!==t.inputMethod}function F(t){return t.data&&"string"!=typeof t.data?t.data.size:t.info.size}function I(t){const e=t.lastIndexOf(".");return-1===e?{base:t,extension:null}:{base:t.slice(0,e),extension:t.slice(e+1)}}function z(t,e){return e?`${t}.${e}`:t}export{C as default};
2
+ import{__decorate as t}from"tslib";import e from"../../../request.js";import a from"../../../core/Collection.js";import i from"../../../core/Error.js";import n from"../../../core/Logger.js";import{isAbortError as s}from"../../../core/promiseUtils.js";import r from"../../../core/ReactiveMap.js";import o from"../../../core/ReactiveSet.js";import{generateBracedUUID as l}from"../../../core/uuid.js";import{property as d,subclass as h}from"../../../core/accessorSupport/decorators.js";import{getEffectiveLayerCapabilities as c}from"../../../layers/support/layerUtils.js";import m from"../../../rest/query/support/AttachmentInfo.js";import{getAttachmentCategoryForFile as p}from"../../Attachments/support/attachmentUtils.js";import{getAttachmentKey as u,getAttachmentUrl as g,preserveAttachmentFilenameExtension as y,attachmentValidationUtils as f}from"../attachmentUtils.js";import _ from"./EditableInput.js";import A from"./SingleFeatureInputAdapter.js";import{visibilityCodeToBoolean as U}from"./support/inputUtils.js";let v=-1;const b=["maximum-audio-length","maximum-file-size","maximum-image-size","minimum-number-of-files","maximum-number-of-files","maximum-video-length"];let C=class extends _{constructor(t){super(t),this.attachments=[],this.displayCount=3,this.group=null,this.single=new A({input:this}),this.type="attachment",this._initialAttachments=[],this._stagedAdds=new a,this._stagedDeletes=new o,this._stagedUpdates=new r,this._failedStagedUpdateHydrations=new o,this._pendingStagedUpdateHydrations=new r,this._temporaryAttachmentUrls=new r,this._validationCriterionStates=new r,this._hasUnsupportedFileTypeValidationError=!1}get allowUserRename(){return this.template.allowUserRename}get addDisabled(){const t=this.maxAttachmentCount,e=this.effectiveAttachmentCount;return!this.editable||null!=t&&e>=t}get effectiveAttachmentCount(){return this._initialAttachments.length-this._stagedDeletes.size+this._stagedAdds.length}get effectiveVisible(){return U(this.effectiveVisibilityCode)}get effectiveVisibilityCode(){const{visibilityCode:t}=this;if("visible"!==t)return t;const{group:e}=this;if(null==e)return t;const a=e.visibilityCode;return"hidden:visibility-expression:all-features"===a?"hidden:group-visibility-expression:all-features":"hidden:visibility-expression:some-features"===a?"hidden:group-visibility-expression:some-features":t}get accept(){const{categories:t}=this;if(!t.size)return;const e=[];return t.has("image")&&e.push("image/*"),t.has("audio")&&e.push("audio/*"),t.has("video")&&e.push("video/*"),t.has("document")&&e.push("text/*","application/*","model/*"),e.length>0?e.join(","):void 0}get categories(){const t=new Set;for(const e of this._nestableInputs)x(t,e.type);return t}get _nestableInputs(){const{input:t}=this;return null==t?[]:"attachment"===t.type?t.inputTypes??[]:[t]}get attachmentKeyword(){return this.template.attachmentKeyword?.trim()}get displayFilename(){return this.template.displayFilename}get allAttachmentsVisibleOnDefaultPage(){return this.defaultPageAttachments.length===this.attachments.length}get canUploadFiles(){const t=this._nestableInputs;return!t.length||t.some(F)}get hasCaptureInputs(){return this._nestableInputs.some(w)}get captureMediaType(){const t=new Set;for(const e of this._nestableInputs)if(w(e))switch(e.type){case"audio":t.add("audio");break;case"video":t.add("video");break;case"image":case"signature":t.add("image")}return 1===t.size?Array.from(t)[0]:null}get isCaptureOnly(){const t=this._nestableInputs;return!!t.length&&t.every(T)}get defaultPageAttachments(){return this.attachments.slice(0,this.displayCount)}get feature(){return this.single.feature}get hasAttachmentChanges(){return this._stagedAdds.length>0||this._stagedUpdates.size>0||this._stagedDeletes.size>0}get hasInvalidAttachmentName(){return!!this.allowUserRename&&this.attachments.some(t=>0===t.name.trim().length)}get attachmentCount(){return this.attachments.length}get hasMinimumAttachmentCountNotMet(){const t=this.minAttachmentCount;return!(null==t||!this.effectiveVisible)&&(this.effectiveAttachmentCount<t&&!this.isCaptureOnly)}get hasReachedAttachmentLimit(){const t=this.maxAttachmentCount,e=this.effectiveAttachmentCount;return null!=t&&e===t}get hasExceededAttachmentLimit(){const t=this.maxAttachmentCount;return!(null==t||!this.effectiveVisible)&&this.effectiveAttachmentCount>t}get hasPendingAttachmentUpdateData(){return this._pendingStagedUpdateHydrations.size>0}get input(){return this.template.input}get layer(){return this.single.layer}get maxAttachmentCount(){return this.template.maxAttachmentCount}get minAttachmentCount(){return this.template.minAttachmentCount}get supportsResize(){const{layer:t}=this;if(!t)return!1;const e=c(t);return!!e&&("attachment"in e&&!!e.attachment?.supportsResize)}get useOriginalFilename(){return this.template.useOriginalFilename}get valid(){return!(this._failedStagedUpdateHydrations.size>0||this.hasInvalidAttachmentName||this.hasExceededAttachmentLimit||this.hasMinimumAttachmentCountNotMet)}get _expressionLayer(){const t=this.layer;if(t)return"scene"===t.type&&"associatedLayer"in t&&null!=t.associatedLayer?t.associatedLayer:"feature"===t.type?t:void 0}destroy(){this._clearTemporaryAttachmentUrls()}applyFetchedAttachments(t){for(const e of t)this._normalizeAttachmentName(e);this._initialAttachments=t,this._failedStagedUpdateHydrations.clear(),this._recomputeAttachments()}applyStashedEdits(t){const{adds:e,deletes:a,updates:i}=t;for(const n of e){const t=this._getAttachmentKey(n.info);this._stagedAdds.add({data:n.data,globalId:n.globalId??l(),info:n.info,key:t}),this._setTemporaryAttachmentUrl(t,n.data)}for(const n of i){const t=this._getAttachmentKey(n.info);this._stagedUpdates.set(t,{contentType:n.contentType,data:n.data,info:n.info,key:t,name:n.name,size:I(n)}),this._setTemporaryAttachmentUrl(t,n.data)}for(const n of a){const t=this._getAttachmentKey(n.info);this._stagedDeletes.add(t)}this._recomputeAttachments()}clearAttachmentChanges(){this.clearValidationCriteriaState(),this._clearTemporaryAttachmentUrls(),this._stagedAdds.removeAll(),this._stagedUpdates.clear(),this._stagedDeletes.clear(),this._failedStagedUpdateHydrations.clear(),this._pendingStagedUpdateHydrations.clear(),this._recomputeAttachments()}clearValidationCriteriaState(){this._validationCriterionStates.clear(),this._hasUnsupportedFileTypeValidationError=!1}get hasInvalidValidationCriteria(){for(const t of this._validationCriterionStates.values())if("danger"===t)return!0;return!1}get hasUnsupportedFileTypeValidationError(){return this._hasUnsupportedFileTypeValidationError}get validationCriterionStates(){return this._validationCriterionStates}getValidationCriterionState(t){return this._validationCriterionStates.get(t)??null}stageAddAttachment(t){if(!this._assertEditable())throw new i("batch-attribute-form:not-editable","Cannot modify attachments when editableExpression is false.");const{contentType:e,data:a,name:n}=t,s=t.globalId??l(),r=a instanceof Blob?a.size:void 0,o=n.trim(),d=new m({contentType:e??void 0,globalId:s,id:v--,keywords:this.attachmentKeyword??void 0,name:o,size:r});return this._setTemporaryAttachmentUrl(s,a),this._stagedAdds.add({key:s,globalId:s,info:d,data:a}),this._recomputeAttachments(),d}async stageAddAttachments(t,e){if(this.clearValidationCriteriaState(),!this._assertEditable())return[];const a=t.filter(t=>this.isFileAllowed(t));if(this._setUnsupportedFileTypeValidationError(a.length!==t.length),0===a.length)return[];const i=[],n=new Map,s=Date.now(),r={},o=this.effectiveAttachmentCount,l=o+a.length;if(null!=this.minAttachmentCount&&this.minAttachmentCount>0&&this._setValidationCriterionState(r,"minimum-number-of-files",l>=this.minAttachmentCount?"success":"danger"),null!=this.maxAttachmentCount){const t=l<=this.maxAttachmentCount;if(this._setValidationCriterionState(r,"maximum-number-of-files",t?"success":"danger"),!t)return this._setValidationCriteriaState(r),[]}let d=!0;for(let h=0;h<a.length;h++){const t=a[h];await this._validateAttachmentFile(t,o+h+1,r)||(d=!1)}if(!d)return this._setValidationCriteriaState(r),[];for(let h=0;h<a.length;h++){const t=a[h],r=t instanceof File?t.name:`attachment-${s}_${h+1}`,o=await this._resolveAttachmentFilename(r,e),l=this._makeUniqueFilenameForOperation(n,o);i.push(this.stageAddAttachment({contentType:t.type,data:t,name:l}))}return this._setValidationCriteriaState(r),i}findAttachment(t){if(t)return this.attachments.find(e=>u(e)===t)}getAttachmentEditState(t){const e=this._getAttachmentKey(t),a=e?this._initialAttachments.find(t=>this._getAttachmentKey(t)===e):void 0,i=a?.name??null,n=e?this._stagedUpdates.get(e):void 0,s=n?.name??t.name??null;return{initialName:i,isDeleted:!!e&&this._stagedDeletes.has(e),isRenamed:null!=s&&null!=i&&s!==i,isReplaced:!0===n?.isReplacement}}getAttachmentPreviewUrl(t,e){const a=this._getAttachmentKey(t);return(a?this._temporaryAttachmentUrls.get(a):void 0)??g({attachment:t,supportsResizeAttachments:this.supportsResize,layer:this.layer,thumbnailSize:e})}async ensureStagedUpdateData(t){const e=this._getAttachmentKey(t);if(!e)return!1;const a=this._stagedUpdates.get(e);if(!a||a.data||this._stagedDeletes.has(e))return this._failedStagedUpdateHydrations.delete(e),!1;const i=this._pendingStagedUpdateHydrations.get(e);if(i)return await i;const n=this._hydrateStagedUpdateData(t);this._pendingStagedUpdateHydrations.set(e,n);try{return await n}finally{this._pendingStagedUpdateHydrations.get(e)===n&&this._pendingStagedUpdateHydrations.delete(e)}}async waitForPendingAttachmentUpdateData(){await Promise.allSettled(Array.from(this._pendingStagedUpdateHydrations.values()))}discardStagedEdits(t){if(!this._assertEditable())return;const e=this._getAttachmentKey(t);if(!e)return;const a=this._stagedAdds.findIndex(t=>t.key===e);if(a>-1)return this._clearTemporaryAttachmentUrl(e),this._stagedAdds.removeAt(a),this._failedStagedUpdateHydrations.delete(e),this._pendingStagedUpdateHydrations.delete(e),void this._recomputeAttachments();this._clearTemporaryAttachmentUrl(e),this._stagedDeletes.delete(e),this._clearStagedUpdateTracking(e),this._recomputeAttachments()}isFileAllowed(t){const{categories:e}=this;if(!e.size)return!0;const a=p(t);return null!=a&&e.has(a)}isStagedAttachmentAddition(t){return"number"==typeof t.id&&t.id<0}stageDeleteAttachment(t){if(!this._assertEditable())return;const e=this._getAttachmentKey(t);if(!e)return;const a=this._stagedAdds.findIndex(t=>t.key===e);if(a>-1)return this._clearTemporaryAttachmentUrl(e),this._stagedAdds.removeAt(a),this._failedStagedUpdateHydrations.delete(e),this._pendingStagedUpdateHydrations.delete(e),void this._recomputeAttachments();this._clearTemporaryAttachmentUrl(e),this._stagedDeletes.add(e),this._clearStagedUpdateTracking(e),this._recomputeAttachments()}stageRenameAttachment(t,e){if(!this._assertEditable())return;const a=this._getAttachmentKey(t);if(!a)return;const i=this._stagedAdds.find(t=>t.key===a);if(i){const a=y(t.name,e);return i.info.name=a,void this._recomputeAttachments()}const n=this._stagedUpdates.get(a),s=this._getInitialAttachment(a)?.name??null,r=0===t.name.trim().length?s??t.name:t.name,o=y(r,!0===n?.isReplacement&&null!=s&&e===s?z(s).base:e),l=null!=s&&o===s;if(l&&!0!==n?.isReplacement)return this._stagedUpdates.delete(a),this._failedStagedUpdateHydrations.delete(a),this._pendingStagedUpdateHydrations.delete(a),void this._recomputeAttachments();const d={key:a,...n,info:t};l?delete d.name:d.name=o,this._stagedUpdates.set(a,d),this._recomputeAttachments(),this.ensureStagedUpdateData(t)}async stageReplaceAttachment(t,e,a){if(this.clearValidationCriteriaState(),!this._assertEditable())return!1;if(!this.isFileAllowed(e))return this._setUnsupportedFileTypeValidationError(!0),!1;const i={},n=await this._validateAttachmentFile(e,void 0,i);if(this._setValidationCriteriaState(i),!n)return!1;const s=e instanceof File?e.name:t.name,r=await this._resolveAttachmentFilename(s,a);return this._stageReplaceAttachment(t,e,r),!0}toSubmitEdits(){const t=[],e=[],a=[],i=this.feature?.plainGraphic;if(!i||0===this._stagedAdds.length&&0===this._stagedUpdates.size&&0===this._stagedDeletes.size)return null;const n=this.attachmentKeyword;for(const s of this._stagedAdds)null!=s.data&&t.push({feature:i,contentType:s.info.contentType,data:s.data,info:s.info,globalId:s.info.globalId,keywords:n,name:s.info.name});for(const s of this._stagedUpdates.values()){const t=null==s.name||s.name.trim().length>0;if(null==s.data||!t)continue;const a=s.name??this._getInitialAttachment(s.key)?.name??s.info.name;e.push({feature:i,contentType:s.contentType,data:s.data,globalId:s.info.globalId,id:s.info.id,info:s.info,keywords:n,name:a})}for(const s of this._stagedDeletes.values()){const t=this._getInitialAttachment(s);t&&a.push({feature:i,contentType:t.contentType,globalId:t.globalId,id:t.id,info:t,keywords:n,name:t.name})}return 0===t.length&&0===e.length&&0===a.length?null:{label:this.template.label,keywords:n,adds:t,deletes:a,updates:e}}_assertEditable(){return!!this.editable||(n.getLogger(this).error("batch-attribute-form:not-editable","Cannot modify attachments when editableExpression is false."),!1)}_recomputeAttachments(){const t=[];for(const e of this._stagedAdds)t.push(e.info);for(const e of this._initialAttachments){const a=this._getAttachmentKey(e);if(a&&this._stagedUpdates.has(a)){const i=this._stagedUpdates.get(a),n=e.clone();null!=i.name&&(n.name=i.name),null!=i.contentType&&(n.contentType=i.contentType),null!=i.size&&(n.size=i.size),t.push(n);continue}t.push(e)}this.attachments=t}async _computeAttachmentFilename(t,e){const a=this.template.filenameExpressionExecutor;if(!a)return t;const i=this.single.feature,r=i?.plainGraphic,o=this._expressionLayer,{attachmentKeyword:l,description:d,label:h}=this.template,c={$originalfeature:i?.original,$editcontext:{editType:e.editType},$layer:o,$featureset:o,$datastore:o?.url,$feature:r,$map:e.map,$formElement:{attachmentKeyword:l,description:d,label:h}},m={rawOutput:!0,spatialReference:e.spatialReference,timeZone:e.timeZone};try{const e=a.isAsync?await a.executeAsync(c,m):a.execute(c,m);if("string"==typeof e&&e.trim().length>0){const{extension:a}=z(t);return V(e.trim(),a)}}catch(p){s(p)||n.getLogger(this).error("Failed evaluating attachment filename expression",p)}return t}async _resolveAttachmentFilename(t,e){return!1===this.useOriginalFilename?await this._computeAttachmentFilename(t,e):t}_makeUniqueFilenameForOperation(t,e){const a=e.toLowerCase(),i=t.get(a)??0;if(t.set(a,i+1),0===i)return e;const{base:n,extension:s}=z(e);return V(`${n}_${i}`,s)}_setValidationCriteriaState(t){this._validationCriterionStates.clear();for(const e of b){const a=t[e];a&&this._validationCriterionStates.set(e,a)}}_setUnsupportedFileTypeValidationError(t){this._hasUnsupportedFileTypeValidationError!==t&&(this._hasUnsupportedFileTypeValidationError=t)}_setValidationCriterionState(t,e,a){"danger"!==t[e]&&(t[e]=a)}async _validateAttachmentFile(t,e,a){let i=!0;const n=p(t);for(const s of this._nestableInputs){const e=f.getAttachmentCategoryForInputType(s.type);if(null==n||e===n){if("document"===s.type&&null!=s.maxFileSize){const e=t.size<=1048576*s.maxFileSize;this._setValidationCriterionState(a,"maximum-file-size",e?"success":"danger"),i=i&&e}if(("audio"===s.type||"video"===s.type)&&null!=s.maxDuration){const e=await f.getMediaDurationInSeconds(t,s.type),n=null!=e&&e<=s.maxDuration;this._setValidationCriterionState(a,"audio"===s.type?"maximum-audio-length":"maximum-video-length",n?"success":"danger"),i=i&&n}if("image"===s.type&&null!=s.maxImageSize){const e=await f.getImageDimensionsInPixels(t),n=e?Math.max(e.width,e.height):null,r=null==n||n<=s.maxImageSize;this._setValidationCriterionState(a,"maximum-image-size",r?"success":"danger"),i=i&&r}}}if(null!=e&&null!=this.maxAttachmentCount){const t=e<=this.maxAttachmentCount;this._setValidationCriterionState(a,"maximum-number-of-files",t?"success":"danger"),i=i&&t}return i}_stageReplaceAttachment(t,e,a){const i=this._getAttachmentKey(t);if(!i)return;const n=this._stagedAdds.find(t=>t.key===i);if(n)return n.data=e,n.info.name=a,n.info.contentType=e.type,n.info.size=e.size,this._setTemporaryAttachmentUrl(i,e),void this._recomputeAttachments();const s=this._stagedUpdates.get(i);this._setTemporaryAttachmentUrl(i,e),this._failedStagedUpdateHydrations.delete(i),this._pendingStagedUpdateHydrations.delete(i),this._stagedUpdates.set(i,{...s,key:i,info:t,isReplacement:!0,contentType:e.type||s?.contentType||t.contentType,data:e,name:a,size:e.size}),this._recomputeAttachments()}_getInitialAttachment(t){return this._initialAttachments.find(e=>this._getAttachmentKey(e)===t)}_normalizeAttachmentName(t){const{name:e}=t;"string"==typeof e&&(t.name=e.trim())}_getAttachmentKey(t){return u(t)}_clearStagedUpdateTracking(t){this._stagedUpdates.delete(t),this._failedStagedUpdateHydrations.delete(t),this._pendingStagedUpdateHydrations.delete(t)}async _hydrateStagedUpdateData(t){const a=this._getAttachmentKey(t),i=t.url;if(!a||!i)return!1;try{const{data:n}=await e(i,{responseType:"blob"});this._failedStagedUpdateHydrations.delete(a);const s=this._stagedUpdates.get(a);return!(!s||s.data||this._stagedDeletes.has(a))&&(this._stagedUpdates.set(a,{...s,info:t,isReplacement:s.isReplacement??!1,contentType:s.contentType??t.contentType??n.type,data:n}),!0)}catch(r){const t=this._stagedUpdates.get(a);return!t||t.data||this._stagedDeletes.has(a)||this._failedStagedUpdateHydrations.add(a),s(r)||n.getLogger(this).error("Failed to fetch attachment data for staged update",r),!1}}_setTemporaryAttachmentUrl(t,e){if(this._clearTemporaryAttachmentUrl(t),!(e instanceof Blob))return;const a=URL.createObjectURL(e);return this._temporaryAttachmentUrls.set(t,a),a}_clearTemporaryAttachmentUrl(t){const e=this._temporaryAttachmentUrls.get(t);e&&(URL.revokeObjectURL(e),this._temporaryAttachmentUrls.delete(t))}_clearTemporaryAttachmentUrls(){for(const t of this._temporaryAttachmentUrls.values())URL.revokeObjectURL(t);this._temporaryAttachmentUrls.clear()}};t([d()],C.prototype,"allowUserRename",null),t([d()],C.prototype,"addDisabled",null),t([d()],C.prototype,"effectiveAttachmentCount",null),t([d()],C.prototype,"effectiveVisible",null),t([d()],C.prototype,"effectiveVisibilityCode",null),t([d()],C.prototype,"accept",null),t([d()],C.prototype,"categories",null),t([d()],C.prototype,"attachmentKeyword",null),t([d()],C.prototype,"attachments",void 0),t([d()],C.prototype,"displayFilename",null),t([d({readOnly:!0})],C.prototype,"allAttachmentsVisibleOnDefaultPage",null),t([d()],C.prototype,"canUploadFiles",null),t([d()],C.prototype,"hasCaptureInputs",null),t([d()],C.prototype,"captureMediaType",null),t([d()],C.prototype,"isCaptureOnly",null),t([d({readOnly:!0})],C.prototype,"defaultPageAttachments",null),t([d()],C.prototype,"displayCount",void 0),t([d()],C.prototype,"feature",null),t([d()],C.prototype,"group",void 0),t([d()],C.prototype,"hasAttachmentChanges",null),t([d()],C.prototype,"hasInvalidAttachmentName",null),t([d()],C.prototype,"attachmentCount",null),t([d()],C.prototype,"hasMinimumAttachmentCountNotMet",null),t([d()],C.prototype,"hasReachedAttachmentLimit",null),t([d()],C.prototype,"hasExceededAttachmentLimit",null),t([d({readOnly:!0})],C.prototype,"hasPendingAttachmentUpdateData",null),t([d()],C.prototype,"input",null),t([d()],C.prototype,"layer",null),t([d()],C.prototype,"maxAttachmentCount",null),t([d()],C.prototype,"minAttachmentCount",null),t([d({readOnly:!0})],C.prototype,"single",void 0),t([d({readOnly:!0})],C.prototype,"type",void 0),t([d({readOnly:!0})],C.prototype,"supportsResize",null),t([d()],C.prototype,"useOriginalFilename",null),t([d({readOnly:!0})],C.prototype,"valid",null),t([d()],C.prototype,"_initialAttachments",void 0),t([d()],C.prototype,"_expressionLayer",null),t([d()],C.prototype,"_stagedAdds",void 0),t([d()],C.prototype,"_stagedDeletes",void 0),t([d()],C.prototype,"_stagedUpdates",void 0),t([d()],C.prototype,"_failedStagedUpdateHydrations",void 0),t([d()],C.prototype,"_pendingStagedUpdateHydrations",void 0),t([d()],C.prototype,"_temporaryAttachmentUrls",void 0),t([d()],C.prototype,"_hasUnsupportedFileTypeValidationError",void 0),t([d()],C.prototype,"hasInvalidValidationCriteria",null),t([d()],C.prototype,"hasUnsupportedFileTypeValidationError",null),t([d()],C.prototype,"validationCriterionStates",null),C=t([h("esri.widgets.BatchAttributeForm.inputs.AttachmentElementInput")],C);const S=C;function x(t,e){switch(e){case"audio":t.add("audio");break;case"document":t.add("document");break;case"image":case"signature":t.add("image");break;case"video":t.add("video")}}function T(t){return"document"!==t.type&&"capture"===t.inputMethod}function w(t){return T(t)}function F(t){return"document"===t.type||"capture"!==t.inputMethod}function I(t){return t.data&&"string"!=typeof t.data?t.data.size:t.info.size}function z(t){const e=t.lastIndexOf(".");return-1===e?{base:t,extension:null}:{base:t.slice(0,e),extension:t.slice(e+1)}}function V(t,e){return e?`${t}.${e}`:t}export{S as default};
@@ -1,2 +1,2 @@
1
1
  /* COPYRIGHT Esri - https://js.arcgis.com/5.2/LICENSE.txt */
2
- import{__decorate as t}from"tslib";import e from"../../../core/Accessor.js";import{destroyMaybe as l}from"../../../core/maybe.js";import{property as i,subclass as n}from"../../../core/accessorSupport/decorators.js";import{deepFilterInputs as s,isGroupInput as r,isFieldInput as p,isAttachmentElementInput as o,isEditableInput as u,isUtilityNetworkAssociationsElementInput as a}from"./support/inputUtils.js";let d=class extends e{constructor(t){super(t),this.inputs=[],this.staleInputs=new Map,this.template=null}destroy(){this.inputs.forEach(t=>l(t))}get allFieldInputs(){return s(this.inputs,p)}get allAttachmentElementInputs(){return s(this.inputs,o)}get allEditableInputs(){return s(this.inputs,u)}get allGroupInputs(){return this.inputs.filter(r)}get allUtilityNetworkAssociationsElementInputs(){return s(this.inputs,a)}get description(){return this.template?.description??null}get hasInvalidHiddenInputs(){return this.invalidHiddenInputs.length>0}get invalidFeatures(){return Array.from(new Set(this.allFieldInputs.flatMap(t=>t.invalidFeatures)))}get invalidHiddenInputs(){return this.allFieldInputs.filter(t=>!t.valid&&!t.effectiveVisible)}get title(){return this.template?.title??null}get valid(){return this.allEditableInputs.every(t=>t.valid)}};t([i()],d.prototype,"allFieldInputs",null),t([i()],d.prototype,"allAttachmentElementInputs",null),t([i()],d.prototype,"allEditableInputs",null),t([i()],d.prototype,"allGroupInputs",null),t([i()],d.prototype,"allUtilityNetworkAssociationsElementInputs",null),t([i()],d.prototype,"description",null),t([i()],d.prototype,"inputs",void 0),t([i()],d.prototype,"hasInvalidHiddenInputs",null),t([i()],d.prototype,"invalidFeatures",null),t([i()],d.prototype,"invalidHiddenInputs",null),t([i()],d.prototype,"template",void 0),t([i()],d.prototype,"title",null),t([i()],d.prototype,"valid",null),d=t([n("esri.widgets.BatchAttributeForm.inputs.BatchFormInputs")],d);const m=d;export{m as default};
2
+ import{__decorate as t}from"tslib";import e from"../../../core/Accessor.js";import{destroyMaybe as l}from"../../../core/maybe.js";import{property as i,subclass as n}from"../../../core/accessorSupport/decorators.js";import{deepFilterInputs as s,isGroupInput as r,isFieldInput as p,isAttachmentElementInput as o,isEditableInput as u,isUtilityNetworkAssociationsElementInput as a}from"./support/inputUtils.js";let d=class extends e{constructor(t){super(t),this.inputs=[],this.staleInputs=new Map,this.template=null}destroy(){this.inputs.forEach(t=>l(t))}get allFieldInputs(){return s(this.inputs,p)}get allAttachmentElementInputs(){return s(this.inputs,o)}get allEditableInputs(){return s(this.inputs,u)}get allGroupInputs(){return this.inputs.filter(r)}get allUtilityNetworkAssociationsElementInputs(){return s(this.inputs,a)}get description(){return this.template?.description??null}get hasInvalidHiddenInputs(){return this.invalidHiddenInputs.length>0}get invalidFeatures(){return Array.from(new Set(this.allFieldInputs.flatMap(t=>t.invalidFeatures)))}get invalidHiddenInputs(){return this.allFieldInputs.filter(t=>!t.valid&&!t.effectiveVisible)}get title(){return this.template?.title??null}get valid(){return this.allEditableInputs.filter(t=>t.visible).every(t=>t.valid)}};t([i()],d.prototype,"allFieldInputs",null),t([i()],d.prototype,"allAttachmentElementInputs",null),t([i()],d.prototype,"allEditableInputs",null),t([i()],d.prototype,"allGroupInputs",null),t([i()],d.prototype,"allUtilityNetworkAssociationsElementInputs",null),t([i()],d.prototype,"description",null),t([i()],d.prototype,"inputs",void 0),t([i()],d.prototype,"hasInvalidHiddenInputs",null),t([i()],d.prototype,"invalidFeatures",null),t([i()],d.prototype,"invalidHiddenInputs",null),t([i()],d.prototype,"template",void 0),t([i()],d.prototype,"title",null),t([i()],d.prototype,"valid",null),d=t([n("esri.widgets.BatchAttributeForm.inputs.BatchFormInputs")],d);const m=d;export{m as default};
@@ -1,2 +1,2 @@
1
1
  /* COPYRIGHT Esri - https://js.arcgis.com/5.2/LICENSE.txt */
2
- import{__decorate as e}from"tslib";import{isSome as t}from"../../../core/arrayUtils.js";import{getOrCreateMapValue as i}from"../../../core/MapUtils.js";import{property as l,subclass as r}from"../../../core/accessorSupport/decorators.js";import{isMultipleChoiceInput as o}from"../../../form/elements/inputs/inputUtils.js";import n from"../../../layers/support/CodedValue.js";import s from"../../../layers/support/CodedValueDomain.js";import{getDomainRange as a,dateTimeFieldValuesToNumericRange as u,isDomainValidForField as h}from"../../../layers/support/domainUtils.js";import{isNumericField as p,isStringField as c,isTimeOnlyField as m,getFieldRange as d,isDateOnlyField as f,isTimestampOffsetField as C}from"../../../layers/support/fieldUtils.js";import{supportsFieldConfiguration as g}from"../../../layers/support/layerUtils.js";import y from"../../../layers/support/RangeDomain.js";import{isAnyDateField as x}from"../../../smartMapping/support/utils.js";import{isNumber as b}from"../../../support/guards.js";import v from"./EditableInput.js";import{visibilityCodeToBoolean as F,differentValuesString as O,isFieldInputWithShowNoValueOptionInput as V}from"./support/inputUtils.js";import{otherChoiceCheckedPlaceholderValue as M,multipleChoiceOtherChoiceCheckedStateByExpressionsManager as _}from"./support/multipleChoiceInputUtils.js";import{timeResolutionToStepMap as S}from"../../support/dateUtils.js";import{isEmptyValue as E,getMaxLength as w,getMinLength as k,dateIsValid as D,validateFormValue as N}from"../../support/forms/formUtils.js";let R=class extends v{constructor(e){super(e),this.getExternalErrorForFeature=null,this.getFieldValueOptionsForFeature=null,this.group=null,this.type="field",this.userHasChangedValue=!1,this._hasIntersectionWithElementFieldDomain=!1}get compositeError(){if(this.valid)return null;const{errors:e}=this;if(e.length<this.features.length)return"batch-attribute-form-validation::features-have-different-errors";const t=e[0];for(const i of e)if(i.error!==t.error)return"batch-attribute-form-validation::features-have-different-errors";return t.error}get dataType(){const{field:e}=this;return p(e)?"number":c(e)?"text":x(e)||m(e)?"date":"unsupported"}get domain(){const e=this._allDomains.toArray();return this.calculateDomain(e)}get distinctValues(){if(this.featuresHaveSameValue)return[this.value];const e=new Set;for(const t of this.features)e.add(t.getAttribute(this.fieldName));return Array.from(e)}get editable(){return!!this.field.editable&&(this._evaluatedEditableExpression??!0)}get label(){const{label:e}=this.template,t=this._computeStringLiteralText(e);if(t)return t;const{field:i,layers:l}=this;if(1===l.length){const e=l[0];if(g(e)){const t=e.getFieldAlias(i.name);if(null!=t&&""!==t)return t}}return i.alias||i.name}get effectiveVisible(){return F(this.effectiveVisibilityCode)}get effectiveVisibilityCode(){const{visibilityCode:e}=this;if("visible"!==e)return e;const{group:t}=this;if(null==t)return e;const i=t.visibilityCode;return"hidden:visibility-expression:all-features"===i?"hidden:group-visibility-expression:all-features":"hidden:visibility-expression:some-features"===i?"hidden:group-visibility-expression:some-features":e}get errors(){return this._validate()}get featuresHaveSameValue(){const{fieldName:e}=this,t=this.features.at(0)?.getAttribute(e);return this.features.every(i=>i.getAttribute(e)===t)}get field(){return this.template.field}get fieldName(){return this.field.name}get input(){return this.template.input}get multipleChoiceInput(){const{input:e}=this;return e&&o(e)?e:null}get multipleChoiceChoices(){const{multipleChoiceInput:e}=this;if(!e)return null;const t=new Map;for(const i of e.choices)t.has(i.value)||t.set(i.value,i);return Array.from(t.values())}get multipleChoiceValues(){return this.multipleChoiceChoices?.map(e=>e.value)??null}get multipleChoiceOtherChoiceFieldName(){return this.multipleChoiceInput?.otherChoice?.fieldName??null}get multipleChoiceOtherChoiceHint(){return this.multipleChoiceInput?.otherChoice?.hint??""}get multipleChoiceOtherChoiceLabel(){return this.multipleChoiceInput?.otherChoice?.label??null}get hasMultipleChoiceOtherChoiceField(){const{multipleChoiceOtherChoiceFieldName:e}=this;return!!e&&this.layers.every(t=>null!=t.getField(e))}get shouldShowMultipleChoiceOtherChoice(){return null!=this.multipleChoiceInput?.otherChoice&&this.hasMultipleChoiceOtherChoiceField}set shouldShowMultipleChoiceOtherChoice(e){this._overrideIfSome("shouldShowMultipleChoiceOtherChoice",e)}get multipleChoiceOtherChoiceValue(){const{multipleChoiceOtherChoiceFieldName:e}=this;if(!e||!this.shouldShowMultipleChoiceOtherChoice)return null;const t=this.features.map(t=>t.getAttribute(e));if(0===t.length)return null;const[i]=t;return t.every(e=>e===i)?i:O}get multipleChoiceOtherChoiceMaxLength(){const{multipleChoiceOtherChoiceFieldName:e}=this;if(!e||!this.shouldShowMultipleChoiceOtherChoice)return;let t;for(const i of this.layers){const l=i.getField(e)?.length;null==l||l<0||(t=null==t?l:Math.min(t,l))}return t}getMultipleChoiceOtherChoiceRenderState(e){const t=this.multipleChoiceOtherChoiceFieldName??void 0,i=this.shouldShowMultipleChoiceOtherChoice,l=this.multipleChoiceOtherChoiceValue,r=i?this.multipleChoiceOtherChoiceCheckboxState:{checked:!1,indeterminate:!1},o=i?this.getExplicitMultipleChoiceOtherChoiceCheckedState():void 0,n=void 0===o?r:{checked:o,indeterminate:!1};return{fieldName:t,hint:this.multipleChoiceOtherChoiceHint,label:this.multipleChoiceOtherChoiceLabel??e,shouldShow:i,checkboxState:n,value:l,normalizedValue:l===M?"":l,maxLength:this.multipleChoiceOtherChoiceMaxLength}}get multipleChoiceOtherChoiceCheckboxState(){const e=this.multipleChoiceOtherChoiceFieldName;if(!e)return{checked:!1,indeterminate:!1};const t=this.features.map(t=>t.getAttribute(e));return{checked:t.length>0&&t.every(e=>!E(e)),indeterminate:t.some(e=>!E(e))&&t.some(e=>E(e))}}initializeExplicitMultipleChoiceOtherChoiceCheckedState(){this.hasExplicitMultipleChoiceOtherChoiceCheckedState()||this.setExplicitMultipleChoiceOtherChoiceCheckedState(this.multipleChoiceOtherChoiceCheckboxState.checked)}hasExplicitMultipleChoiceOtherChoiceCheckedState(){return void 0!==this.getExplicitMultipleChoiceOtherChoiceCheckedState()}getExplicitMultipleChoiceOtherChoiceCheckedState(){const e=this._multipleChoiceOtherChoiceCheckedStateKey;if(e)return this._multipleChoiceOtherChoiceCheckedStateStore.get(e)}setExplicitMultipleChoiceOtherChoiceCheckedState(e){const t=this._multipleChoiceOtherChoiceCheckedStateKey;t&&this._multipleChoiceOtherChoiceCheckedStateStore.set(t,e)}stashMultipleChoiceOtherChoiceDraftValueForFeatures(e,t){const i=this.multipleChoiceOtherChoiceFieldName;if(i)for(const l of e)l.stashAttribute(i,t)}setMultipleChoiceOtherChoiceDraftValuesFromFeatures(e){const t=this.multipleChoiceOtherChoiceFieldName;if(t)for(const i of e)i.stashAttribute(t,i.getAttribute(t))}getMultipleChoiceOtherChoiceDraftValue(e){const t=this.multipleChoiceOtherChoiceFieldName;if(t)return e.getStashedAttribute(t)}get invalidFeatures(){return this.errors.map(e=>e.feature)}get _multipleChoiceOtherChoiceCheckedStateKey(){return null!=this.multipleChoiceOtherChoiceFieldName?this.template.elementId:null}get _multipleChoiceOtherChoiceCheckedStateStore(){const e=this.expressionsManager;return e?i(_,e,()=>new Map):new Map}get isSubtypeField(){return this.layers.some(e=>{if(e&&"subtypeField"in e){const{subtypeField:t,fieldsIndex:i}=e;return(i.get(t)?.name??t)===this.fieldName}return!1})}get showNoValueOptionEnabled(){const{input:e}=this;return!this.required&&(!V(e)||!0===e?.showNoValueOption)}get showNoValueLabel(){const{input:e}=this;return V(e)?e?.noValueOptionLabel:null}get includeTime(){const{template:e,field:t}=this;return"date"===this.dataType&&("time-only"===t.type||"date-only"!==t.type&&("datetime-picker"!==e.input?.type||e.input.includeTime))}get includeTimeOffset(){if("timestamp-offset"!==this.field.type)return!1;const{input:e}=this;return!e||"timestampoffset-picker"===e.type&&e.includeTimeOffset}get inputType(){return this.input?.type}get maxLength(){return w({dataType:this.dataType,field:this.field,input:this.input})}get minLength(){return k({dataType:this.dataType,field:this.field,input:this.input})}get range(){if("date"===this.dataType)return this._dateRange;const{domain:e,field:t}=this;if(e){const i=a(t,e);return{max:i?.max,min:i?.min}}const i=this._allDomains.toArray().every(e=>!e)?d(t):null;return{max:i?.max===Number.MAX_VALUE?null:i?.max??null,min:i?.min===-Number.MAX_VALUE?null:i?.min??null}}get required(){if(!this.editable)return!1;if(!this.field.nullable||this.isSubtypeField)return!0;const e=this.visible&&!1!==this.group?.visible,t=this._evaluatedRequiredExpression;return!(!e||null==t)&&t}get timeResolution(){const e=this.input;if(e&&("timestampoffset-picker"===e.type||"time-picker"===e.type))return e.timeResolution??"minutes"}get timeStep(){return null!=this.timeResolution?S.get(this.timeResolution):void 0}get valid(){return 0===this.errors.length}get value(){return this.featuresHaveSameValue?this.features.at(0)?.getAttribute(this.fieldName)??null:O}get visibilityCode(){return this.field.visible?this._fieldShouldHaveDomain&&null==this.domain?"hidden:no-domain-in-common":this._baseVisibilityCode:"hidden:field-definition"}get codedValueDomainOptions(){return"coded-value"===this.domain?.type?this.domain.codedValues.map(({name:e,code:t})=>({name:e,value:t})):[]}get codedValueOptions(){const{getFieldValueOptionsForFeature:e}=this;if(1===this.features.length&&e){const t=this.features.at(0);return e({domain:this.domain??void 0,feature:t,fieldName:this.fieldName,layer:t.layer})}const t=this.codedValueDomainOptions,{value:i}=this,l=null==i||i===O||t.some(e=>e.value===i)?[]:[{name:`${i}`,value:i}];return{recommended:t,other:[],unsupported:l,containsEmptyOption:!1}}get _evaluatedRequiredExpression(){let e=!1,t=!0;const i=this.template;for(const l of this.features){if(null==i.getExpressionExecutorsForLayer(l.layer)?.requiredExpression)continue;t=!1;const r=this._lookupEvaluatedExpression(l,"required");"success"===r?.status?e=e||!0===r.result:e=!0}return t?null:e}get _allDomains(){const e=this.template.domain;return this.features.map(t=>{const i=t.layer.getFieldDomain(this.fieldName,{feature:t.plainGraphic});return"range"===i?.type||"range"===e?.type?i??this.template.domain:i})}get _fieldShouldHaveDomain(){return!!this._hasIntersectionWithElementFieldDomain||this._allDomains.some(t)}get _dateFormRange(){if("date"!==this.dataType)return{};const{input:e}=this;if(!e)return{};const{type:t}=e;let i={};if("date-picker"!==t&&"time-picker"!==t&&"timestampoffset-picker"!==t||(i=u(this.field,e.max,e.min)),"datetime-picker"===t){const{max:t,min:l}=e;i={max:null!=t&&D(t)?t.getTime():null,min:null!=l&&D(l)?l.getTime():null}}return{min:i.min,max:i.max,rawMax:i?.rawMax??null,rawMin:i?.rawMin??null}}get _dateRange(){const{_dateFormRange:e,template:t,field:i,domain:l}=this;if("date"!==this.dataType)return{};if(!l)return this._fieldShouldHaveDomain?{}:e;const r=a(i,l);if(!r)return e;const{max:o,min:n,rawMax:s,rawMin:u}=e,{type:h}=t.field;if("date"===h){const{max:e,min:t}=r;return{max:b(o)&&(null===e||null!=e&&o<=e)?o:e??null,min:b(n)&&(null===t||null!=t&&n>=t)?n:t??null}}if("date-only"===h||"time-only"===h||"timestamp-offset"===h){const{max:e,min:t,rawMax:i,rawMin:l}=r,a=b(o)&&s&&(null==e||o<e),h=b(n)&&u&&(null==t||n>t);return{max:a?o:e,min:h?n:t,rawMax:a?s:i,rawMin:h?u:l}}return{}}_validate(){const{dataType:e,fieldName:t,maxLength:i,minLength:l,range:r}=this,o=[],{multipleChoiceInput:n}=this;for(const s of this.features){const{layer:a}=s,u=a.getField(t)??this.field,h=a.getFieldDomain(t,{feature:s.plainGraphic}),p=this.calculateDomain([h]),c=this._requiredForFeature(s),m=s.getAttribute(t),d=N(m,{dataType:e,domain:p,field:u,maxLength:i,minLength:l,multipleChoice:n,range:r,required:c})??this.getExternalErrorForFeature?.(s,t);d&&o.push({error:d,feature:s.source})}return o}_editableForFeature(e){if(!this.field.editable)return!1;if(null==this.template.getExpressionExecutorsForLayer(e.layer)?.editableExpression)return!0;const t=this._lookupEvaluatedExpression(e,"editable");return"success"===t?.status&&!0===t.result}_effectiveVisibleFeature(e){if(this.group&&!this.group.visibleForFeature(e))return!1;if(null==this.template.getExpressionExecutorsForLayer(e.layer)?.visibilityExpression)return!0;const t=this._lookupEvaluatedExpression(e,"visibility");return"success"===t?.status&&!0===t.result}_requiredForFeature(e){if(!this._editableForFeature(e))return!1;if(!this.field.nullable||this.isSubtypeField)return!0;const t=this._effectiveVisibleFeature(e);if(null==this.template.getExpressionExecutorsForLayer(e.layer)?.requiredExpression)return!1;const i=this._lookupEvaluatedExpression(e,"required");return"success"!==i?.status?t:t&&!0===i.result}calculateDomain(e){const t=e.find(e=>null!=e),i=this.template.domain;if(!t)return i&&h(this.field,i)?i:null;switch(t.type){case"coded-value":if(e.some(e=>!e)){if(!i)return null;e=e.filter(e=>null!==e)}break;case"range":e=e.filter(e=>null!==e)}if(!e.every(e=>e?.type===t?.type))return null;let l=null;switch(t?.type){case"range":l=this._intersectRangeDomains(e);break;case"coded-value":l=this._intersectCodedValueDomains(e)}return l}_intersectCodedValueDomains(e){if(!e.length)return null;const t=new Map(e[0].codedValues.map(({code:e,name:t})=>[e,t])),i=this.template.domain?new Map(this.template.domain.codedValues.map(({code:e,name:t})=>[e,t])):null;for(const o of e)for(const[e,i]of t){o.codedValues.some(t=>t.code===e&&t.name===i)||t.delete(e)}let l=t;if(i){l=new Map;for(const[e,r]of i)t.has(e)&&l.set(e,r)}const r=Array.from(l.entries()).map(([e,t])=>new n({code:e,name:t}));return r.length?new s({codedValues:r}):null}_intersectRangeDomains(e){if(!e.length)return null;let t=e[0];for(let l=1;l<e.length;l++){if(!t)return null;t=this._findMinMaxValuesBetweenTwoDomains(t,e[l])}if(t&&!h(this.field,t))return null;const{domain:i}=this.template;if(t&&i&&i instanceof y){const e=this._findMinMaxValuesBetweenTwoDomains(t,i);return this._hasIntersectionWithElementFieldDomain=!!e,e}return t}_getMinMaxFromRangeDomain(e){const t=e.minValue,i=e.maxValue,{field:l}=this;return f(l)||m(l)||C(l)?u(l,i,t):{min:null!=t&&"number"==typeof t?t:null,max:null!=i&&"number"==typeof i?i:null}}_findMinMaxValuesBetweenTwoDomains(e,t){const i=new y,l=this._getMinMaxFromRangeDomain(e),r=this._getMinMaxFromRangeDomain(t),{field:o}=this,n=this._getValidRangeValue(l.min,-1/0),s=this._getValidRangeValue(l.max,1/0),a=this._getValidRangeValue(r.min,-1/0),u=this._getValidRangeValue(r.max,1/0);return i.minValue=Math.max(n,a),i.maxValue=Math.min(s,u),i.minValue===-1/0||i.maxValue===1/0||i.minValue>i.maxValue?null:((f(o)||m(o)||C(o))&&(i.minValue=Number(l.min)>Number(r.min)?l.rawMin:r.rawMin,i.maxValue=Number(l.max)<Number(r.max)?l.rawMax:r.rawMax),i.name="intersection",i)}_getValidRangeValue(e,t){return b(e)?e:t}};e([l()],R.prototype,"dataType",null),e([l()],R.prototype,"domain",null),e([l()],R.prototype,"distinctValues",null),e([l()],R.prototype,"editable",null),e([l()],R.prototype,"label",null),e([l()],R.prototype,"effectiveVisible",null),e([l()],R.prototype,"effectiveVisibilityCode",null),e([l()],R.prototype,"errors",null),e([l()],R.prototype,"featuresHaveSameValue",null),e([l()],R.prototype,"field",null),e([l()],R.prototype,"fieldName",null),e([l()],R.prototype,"getExternalErrorForFeature",void 0),e([l()],R.prototype,"getFieldValueOptionsForFeature",void 0),e([l()],R.prototype,"group",void 0),e([l()],R.prototype,"input",null),e([l()],R.prototype,"multipleChoiceInput",null),e([l()],R.prototype,"multipleChoiceChoices",null),e([l()],R.prototype,"multipleChoiceValues",null),e([l()],R.prototype,"multipleChoiceOtherChoiceFieldName",null),e([l()],R.prototype,"multipleChoiceOtherChoiceHint",null),e([l()],R.prototype,"multipleChoiceOtherChoiceLabel",null),e([l()],R.prototype,"hasMultipleChoiceOtherChoiceField",null),e([l()],R.prototype,"shouldShowMultipleChoiceOtherChoice",null),e([l()],R.prototype,"multipleChoiceOtherChoiceValue",null),e([l()],R.prototype,"multipleChoiceOtherChoiceMaxLength",null),e([l()],R.prototype,"multipleChoiceOtherChoiceCheckboxState",null),e([l()],R.prototype,"invalidFeatures",null),e([l()],R.prototype,"_multipleChoiceOtherChoiceCheckedStateStore",null),e([l()],R.prototype,"isSubtypeField",null),e([l()],R.prototype,"showNoValueOptionEnabled",null),e([l()],R.prototype,"showNoValueLabel",null),e([l()],R.prototype,"includeTime",null),e([l()],R.prototype,"includeTimeOffset",null),e([l({readOnly:!0})],R.prototype,"inputType",null),e([l()],R.prototype,"maxLength",null),e([l()],R.prototype,"minLength",null),e([l()],R.prototype,"range",null),e([l()],R.prototype,"required",null),e([l()],R.prototype,"timeResolution",null),e([l()],R.prototype,"timeStep",null),e([l({readOnly:!0})],R.prototype,"type",void 0),e([l()],R.prototype,"userHasChangedValue",void 0),e([l()],R.prototype,"valid",null),e([l()],R.prototype,"value",null),e([l()],R.prototype,"visibilityCode",null),e([l()],R.prototype,"codedValueDomainOptions",null),e([l()],R.prototype,"codedValueOptions",null),e([l()],R.prototype,"_evaluatedRequiredExpression",null),e([l()],R.prototype,"_hasIntersectionWithElementFieldDomain",void 0),e([l()],R.prototype,"_allDomains",null),e([l()],R.prototype,"_fieldShouldHaveDomain",null),e([l()],R.prototype,"_dateFormRange",null),e([l()],R.prototype,"_dateRange",null),R=e([r("esri.widgets.BatchAttributeForm.inputs.FieldInput")],R);const T=R;export{T as default};
2
+ import{__decorate as e}from"tslib";import{isSome as t}from"../../../core/arrayUtils.js";import{getOrCreateMapValue as i}from"../../../core/MapUtils.js";import l from"../../../core/ReactiveMap.js";import{property as r,subclass as o}from"../../../core/accessorSupport/decorators.js";import{isMultipleChoiceInput as n}from"../../../form/elements/inputs/inputUtils.js";import a from"../../../layers/support/CodedValue.js";import s from"../../../layers/support/CodedValueDomain.js";import{getDomainRange as u,validateDomainValue as h,dateTimeFieldValuesToNumericRange as p,isDomainValidForField as c}from"../../../layers/support/domainUtils.js";import{getFieldRange as m,isDateOnlyField as d,isTimeOnlyField as f,isTimestampOffsetField as C}from"../../../layers/support/fieldUtils.js";import{supportsFieldConfiguration as g}from"../../../layers/support/layerUtils.js";import y from"../../../layers/support/RangeDomain.js";import{isNumber as x}from"../../../support/guards.js";import b from"./EditableInput.js";import{getFieldInputDataType as v,visibilityCodeToBoolean as O,differentValuesString as F,isFieldInputWithShowNoValueOptionInput as V}from"./support/inputUtils.js";import{otherChoiceCheckedPlaceholderValue as M,multipleChoiceOtherChoiceCheckedStateByExpressionsManager as _}from"./support/multipleChoiceInputUtils.js";import{timeResolutionToStepMap as S}from"../../support/dateUtils.js";import{valuesAreEquivalent as E,isEmptyValue as w,getMaxLength as k,getMinLength as D,dateIsValid as N,validateFormValue as T}from"../../support/forms/formUtils.js";let L=class extends b{constructor(e){super(e),this.getExternalErrorForFeature=null,this.getFieldValueOptionsForFeature=null,this.group=null,this.type="field",this.userHasChangedValue=!1,this._hasIntersectionWithElementFieldDomain=!1}get compositeError(){if(this.valid)return null;const{errors:e}=this;if(e.length<this.features.length)return"batch-attribute-form-validation::features-have-different-errors";const t=e[0];for(const i of e)if(i.error!==t.error)return"batch-attribute-form-validation::features-have-different-errors";return t.error}get dataType(){return v(this.field)}get domain(){const e=this._allDomains.toArray();return this.calculateDomain(e)}get distinctValues(){if(this.featuresHaveSameValue)return[this.value];const e=new Set;for(const t of this.features)e.add(t.getAttribute(this.fieldName));return Array.from(e)}get editable(){return!!this.field.editable&&(this._evaluatedEditableExpression??!0)}get label(){const{label:e}=this.template,t=this._computeStringLiteralText(e);if(t)return t;const{field:i,layers:l}=this;if(1===l.length){const e=l[0];if(g(e)){const t=e.getFieldAlias(i.name);if(null!=t&&""!==t)return t}}return i.alias||i.name}get effectiveVisible(){return O(this.effectiveVisibilityCode)}get effectiveVisibilityCode(){const{visibilityCode:e}=this;if("visible"!==e)return e;const{group:t}=this;if(null==t)return e;const i=t.visibilityCode;return"hidden:visibility-expression:all-features"===i?"hidden:group-visibility-expression:all-features":"hidden:visibility-expression:some-features"===i?"hidden:group-visibility-expression:some-features":e}get errors(){return this._validate()}get featuresHaveSameValue(){const{fieldName:e}=this,t=this.features.at(0)?.getAttribute(e);return this.features.every(i=>E(i.getAttribute(e),t))}get field(){return this.template.field}get fieldName(){return this.field.name}get input(){return this.template.input}get multipleChoiceInput(){const{input:e}=this;return e&&n(e)?e:null}get multipleChoiceChoices(){const{multipleChoiceInput:e}=this;if(!e)return null;const t=new Map;for(const i of e.choices)t.has(i.value)||t.set(i.value,i);return Array.from(t.values())}get multipleChoiceValues(){return this.multipleChoiceChoices?.map(e=>e.value)??null}get multipleChoiceOtherChoiceFieldName(){return this.multipleChoiceInput?.otherChoice?.fieldName??null}get multipleChoiceOtherChoiceHint(){return this.multipleChoiceInput?.otherChoice?.hint??""}get multipleChoiceOtherChoiceLabel(){return this.multipleChoiceInput?.otherChoice?.label??null}get hasMultipleChoiceOtherChoiceField(){const{multipleChoiceOtherChoiceFieldName:e}=this;return!!e&&this.layers.every(t=>null!=t.getField(e))}get shouldShowMultipleChoiceOtherChoice(){return null!=this.multipleChoiceInput?.otherChoice&&this.hasMultipleChoiceOtherChoiceField}set shouldShowMultipleChoiceOtherChoice(e){this._overrideIfSome("shouldShowMultipleChoiceOtherChoice",e)}get multipleChoiceOtherChoiceValue(){const{multipleChoiceOtherChoiceFieldName:e}=this;if(!e||!this.shouldShowMultipleChoiceOtherChoice)return null;const t=this.features.map(t=>t.getAttribute(e));if(0===t.length)return null;const[i]=t;return t.every(e=>e===i)?i:F}get multipleChoiceOtherChoiceMaxLength(){const{multipleChoiceOtherChoiceFieldName:e}=this;if(!e||!this.shouldShowMultipleChoiceOtherChoice)return;let t;for(const i of this.layers){const l=i.getField(e)?.length;null==l||l<0||(t=null==t?l:Math.min(t,l))}return t}getMultipleChoiceOtherChoiceRenderState(e){const t=this.errors?.some(e=>"input-validation-error::cannot-be-empty"===e.error),{multipleChoiceOtherChoiceFieldName:i,shouldShowMultipleChoiceOtherChoice:l,multipleChoiceOtherChoiceValue:r}=this,o=this._getMultipleChoiceOtherChoiceCheckboxState(),n=o.checked&&t?"invalid":"idle";return{fieldName:i,hint:this.multipleChoiceOtherChoiceHint,label:this.multipleChoiceOtherChoiceLabel??e,shouldShow:l,checkboxState:o,value:r,normalizedValue:r===M?"":r,maxLength:this.multipleChoiceOtherChoiceMaxLength,status:n}}get multipleChoiceOtherChoiceCheckboxState(){const e=this.multipleChoiceOtherChoiceFieldName;if(!e)return{checked:!1,indeterminate:!1};const t=this.features.map(t=>t.getAttribute(e));return{checked:t.length>0&&t.every(e=>!w(e)),indeterminate:t.some(e=>!w(e))&&t.some(e=>w(e))}}initializeExplicitMultipleChoiceOtherChoiceCheckedState(){this.hasExplicitMultipleChoiceOtherChoiceCheckedState()||this.setExplicitMultipleChoiceOtherChoiceCheckedState(this.multipleChoiceOtherChoiceCheckboxState.checked)}hasExplicitMultipleChoiceOtherChoiceCheckedState(){return void 0!==this.getExplicitMultipleChoiceOtherChoiceCheckedState()}getExplicitMultipleChoiceOtherChoiceCheckedState(){const e=this._multipleChoiceOtherChoiceCheckedStateKey;if(e)return this._multipleChoiceOtherChoiceCheckedStateStore.get(e)}setExplicitMultipleChoiceOtherChoiceCheckedState(e){const t=this._multipleChoiceOtherChoiceCheckedStateKey;t&&this._multipleChoiceOtherChoiceCheckedStateStore.set(t,e)}stashMultipleChoiceOtherChoiceDraftValueForFeatures(e,t){const i=this.multipleChoiceOtherChoiceFieldName;if(i)for(const l of e)l.stashAttribute(i,t)}setMultipleChoiceOtherChoiceDraftValuesFromFeatures(e){const t=this.multipleChoiceOtherChoiceFieldName;if(t)for(const i of e)i.stashAttribute(t,i.getAttribute(t))}getMultipleChoiceOtherChoiceDraftValue(e){const t=this.multipleChoiceOtherChoiceFieldName;if(t)return e.getStashedAttribute(t)}get invalidFeatures(){return this.errors.map(e=>e.feature)}get _multipleChoiceOtherChoiceCheckedStateKey(){return null!=this.multipleChoiceOtherChoiceFieldName?this.template.elementId:null}get _multipleChoiceOtherChoiceCheckedStateStore(){const e=this.expressionsManager;return e?i(_,e,()=>new l):new l}get isSubtypeField(){return this.layers.some(e=>{if(e&&"subtypeField"in e){const{subtypeField:t,fieldsIndex:i}=e;return(i.get(t)?.name??t)===this.fieldName}return!1})}get showNoValueOptionEnabled(){const{input:e}=this;return!this.required&&(!V(e)||!0===e?.showNoValueOption)}get showNoValueLabel(){const{input:e}=this;return V(e)?e?.noValueOptionLabel:null}get includeTime(){const{template:e,field:t}=this;return"date"===this.dataType&&("time-only"===t.type||"date-only"!==t.type&&("datetime-picker"!==e.input?.type||e.input.includeTime))}get includeTimeOffset(){if("timestamp-offset"!==this.field.type)return!1;const{input:e}=this;return!e||"timestampoffset-picker"===e.type&&e.includeTimeOffset}get inputType(){return this.input?.type}get maxLength(){return k({dataType:this.dataType,field:this.field,input:this.input})}get minLength(){return D({dataType:this.dataType,field:this.field,input:this.input})}get range(){if("date"===this.dataType)return this._dateRange;const{domain:e,field:t}=this;if(e){const i=u(t,e);return{max:i?.max,min:i?.min}}const i=this._allDomains.toArray().every(e=>!e)?m(t):null;return{max:i?.max===Number.MAX_VALUE?null:i?.max??null,min:i?.min===-Number.MAX_VALUE?null:i?.min??null}}get required(){if(!this.editable)return!1;if(!this.field.nullable||this.isSubtypeField)return!0;const e=this.visible&&!1!==this.group?.visible,t=this._evaluatedRequiredExpression;return!(!e||null==t)&&t}get timeResolution(){const e=this.input;if(e&&("timestampoffset-picker"===e.type||"time-picker"===e.type))return e.timeResolution??"minutes"}get timeStep(){return null!=this.timeResolution?S.get(this.timeResolution):void 0}get valid(){return 0===this.errors.length||!this.editable}get value(){return this.featuresHaveSameValue?this.features.at(0)?.getAttribute(this.fieldName)??null:F}get valueIsOutOfDomain(){const{domain:e,value:t,field:i}=this;return!(!e||null==t)&&null!==h(i,t,e)}get visibilityCode(){return this.field.visible?this._fieldShouldHaveDomain&&null==this.domain?"hidden:no-domain-in-common":this._baseVisibilityCode:"hidden:field-definition"}get codedValueDomainOptions(){return"coded-value"===this.domain?.type?this.domain.codedValues.map(({name:e,code:t})=>({name:e,value:t})):[]}get codedValueOptions(){const{getFieldValueOptionsForFeature:e}=this;if(1===this.features.length&&e){const t=this.features.at(0);return e({domain:this.domain??void 0,feature:t,fieldName:this.fieldName,layer:t.layer})}const t=this.codedValueDomainOptions,{value:i}=this,l=null==i||i===F||t.some(e=>e.value===i)?[]:[{name:`${i}`,value:i}];return{recommended:t,other:[],unsupported:l,containsEmptyOption:!1}}get _evaluatedRequiredExpression(){let e=!1,t=!0;const i=this.template;for(const l of this.features){if(null==i.getExpressionExecutorsForLayer(l.layer)?.requiredExpression)continue;t=!1;const r=this._lookupEvaluatedExpression(l,"required");"success"===r?.status?e=e||!0===r.result:e=!0}return t?null:e}get _allDomains(){const e=this.template.domain;return this.features.map(t=>{const i=t.layer.getFieldDomain(this.fieldName,{feature:t.plainGraphic});return"range"===i?.type||"range"===e?.type?i??this.template.domain:i})}get _fieldShouldHaveDomain(){return!!this._hasIntersectionWithElementFieldDomain||this._allDomains.some(t)}get _dateFormRange(){if("date"!==this.dataType)return{};const{input:e}=this;if(!e)return{};const{type:t}=e;let i={};if("date-picker"!==t&&"time-picker"!==t&&"timestampoffset-picker"!==t||(i=p(this.field,e.max,e.min)),"datetime-picker"===t){const{max:t,min:l}=e;i={max:null!=t&&N(t)?t.getTime():null,min:null!=l&&N(l)?l.getTime():null}}return{min:i.min,max:i.max,rawMax:i?.rawMax??null,rawMin:i?.rawMin??null}}get _dateRange(){const{_dateFormRange:e,template:t,field:i,domain:l}=this;if("date"!==this.dataType)return{};if(!l)return this._fieldShouldHaveDomain?{}:e;const r=u(i,l);if(!r)return e;const{max:o,min:n,rawMax:a,rawMin:s}=e,{type:h}=t.field;if("date"===h){const{max:e,min:t}=r;return{max:x(o)&&(null===e||null!=e&&o<=e)?o:e??null,min:x(n)&&(null===t||null!=t&&n>=t)?n:t??null}}if("date-only"===h||"time-only"===h||"timestamp-offset"===h){const{max:e,min:t,rawMax:i,rawMin:l}=r,u=x(o)&&a&&(null==e||o<e),h=x(n)&&s&&(null==t||n>t);return{max:u?o:e,min:h?n:t,rawMax:u?a:i,rawMin:h?s:l}}return{}}_validate(){const{dataType:e,fieldName:t,maxLength:i,minLength:l,range:r}=this,o=[],{multipleChoiceInput:n}=this;for(const a of this.features){const{layer:s}=a,u=s.getField(t)??this.field,h=s.getFieldDomain(t,{feature:a.plainGraphic}),p=this.calculateDomain([h]),c=p&&"coded-value"!==p.type?p:null,m=this._requiredForFeature(a),d=a.getAttribute(t);let f=T(d,{dataType:e,domain:c,field:u,maxLength:i,minLength:l,multipleChoice:n,range:r,required:m})??this.getExternalErrorForFeature?.(a,t);if(!f&&n){const{otherChoice:e}=n,{multipleChoiceOtherChoiceFieldName:t,multipleChoiceOtherChoiceValue:i,shouldShowMultipleChoiceOtherChoice:l}=this,r=this._getMultipleChoiceOtherChoiceCheckboxState();if(l&&e&&t&&r.checked){const e=s.getField(t),l=i===M?null:i;if(e){const t=v(e);f=T(l,{dataType:t,domain:e.domain,field:e,maxLength:k({dataType:t,field:e,input:null}),minLength:D({dataType:t,field:e,input:null}),multipleChoice:null,range:{max:void 0,min:void 0},required:!0})}}}f&&o.push({error:f,feature:a.source})}return o}_editableForFeature(e){if(!this.field.editable)return!1;if(null==this.template.getExpressionExecutorsForLayer(e.layer)?.editableExpression)return!0;const t=this._lookupEvaluatedExpression(e,"editable");return"success"===t?.status&&!0===t.result}_effectiveVisibleFeature(e){if(this.group&&!this.group.visibleForFeature(e))return!1;if(null==this.template.getExpressionExecutorsForLayer(e.layer)?.visibilityExpression)return!0;const t=this._lookupEvaluatedExpression(e,"visibility");return"success"===t?.status&&!0===t.result}_getMultipleChoiceOtherChoiceCheckboxState(){const{shouldShowMultipleChoiceOtherChoice:e,multipleChoiceOtherChoiceCheckboxState:t}=this,i=e?t:{checked:!1,indeterminate:!1},l=e?this.getExplicitMultipleChoiceOtherChoiceCheckedState():void 0;return void 0===l?i:{checked:l,indeterminate:!1}}_requiredForFeature(e){if(!this._editableForFeature(e))return!1;if(!this.field.nullable||this.isSubtypeField)return!0;const t=this._effectiveVisibleFeature(e);if(null==this.template.getExpressionExecutorsForLayer(e.layer)?.requiredExpression)return!1;const i=this._lookupEvaluatedExpression(e,"required");return"success"!==i?.status?t:t&&!0===i.result}calculateDomain(e){const t=e.find(e=>null!=e),i=this.template.domain;if(!t)return i&&c(this.field,i)?i:null;switch(t.type){case"coded-value":if(e.some(e=>!e)){if(!i)return null;e=e.filter(e=>null!==e)}break;case"range":e=e.filter(e=>null!==e)}if(!e.every(e=>e?.type===t?.type))return null;let l=null;switch(t?.type){case"range":l=this._intersectRangeDomains(e);break;case"coded-value":l=this._intersectCodedValueDomains(e)}return l}_intersectCodedValueDomains(e){if(!e.length)return null;const t=new Map(e[0].codedValues.map(({code:e,name:t})=>[e,t])),i=this.template.domain?new Map(this.template.domain.codedValues.map(({code:e,name:t})=>[e,t])):null;for(const o of e)for(const[e,i]of t){o.codedValues.some(t=>t.code===e&&t.name===i)||t.delete(e)}let l=t;if(i){l=new Map;for(const[e,r]of i)t.has(e)&&l.set(e,r)}const r=Array.from(l.entries()).map(([e,t])=>new a({code:e,name:t}));return r.length?new s({codedValues:r}):null}_intersectRangeDomains(e){if(!e.length)return null;let t=e[0];for(let l=1;l<e.length;l++){if(!t)return null;t=this._findMinMaxValuesBetweenTwoDomains(t,e[l])}if(t&&!c(this.field,t))return null;const{domain:i}=this.template;if(t&&i&&i instanceof y){const e=this._findMinMaxValuesBetweenTwoDomains(t,i);return this._hasIntersectionWithElementFieldDomain=!!e,e}return t}_getMinMaxFromRangeDomain(e){const t=e.minValue,i=e.maxValue,{field:l}=this;return d(l)||f(l)||C(l)?p(l,i,t):{min:null!=t&&"number"==typeof t?t:null,max:null!=i&&"number"==typeof i?i:null}}_findMinMaxValuesBetweenTwoDomains(e,t){const i=new y,l=this._getMinMaxFromRangeDomain(e),r=this._getMinMaxFromRangeDomain(t),{field:o}=this,n=this._getValidRangeValue(l.min,-1/0),a=this._getValidRangeValue(l.max,1/0),s=this._getValidRangeValue(r.min,-1/0),u=this._getValidRangeValue(r.max,1/0);return i.minValue=Math.max(n,s),i.maxValue=Math.min(a,u),i.minValue===-1/0||i.maxValue===1/0||i.minValue>i.maxValue?null:((d(o)||f(o)||C(o))&&(i.minValue=Number(l.min)>Number(r.min)?l.rawMin:r.rawMin,i.maxValue=Number(l.max)<Number(r.max)?l.rawMax:r.rawMax),i.name="intersection",i)}_getValidRangeValue(e,t){return x(e)?e:t}};e([r()],L.prototype,"dataType",null),e([r()],L.prototype,"domain",null),e([r()],L.prototype,"distinctValues",null),e([r()],L.prototype,"editable",null),e([r()],L.prototype,"label",null),e([r()],L.prototype,"effectiveVisible",null),e([r()],L.prototype,"effectiveVisibilityCode",null),e([r()],L.prototype,"errors",null),e([r()],L.prototype,"featuresHaveSameValue",null),e([r()],L.prototype,"field",null),e([r()],L.prototype,"fieldName",null),e([r()],L.prototype,"getExternalErrorForFeature",void 0),e([r()],L.prototype,"getFieldValueOptionsForFeature",void 0),e([r()],L.prototype,"group",void 0),e([r()],L.prototype,"input",null),e([r()],L.prototype,"multipleChoiceInput",null),e([r()],L.prototype,"multipleChoiceChoices",null),e([r()],L.prototype,"multipleChoiceValues",null),e([r()],L.prototype,"multipleChoiceOtherChoiceFieldName",null),e([r()],L.prototype,"multipleChoiceOtherChoiceHint",null),e([r()],L.prototype,"multipleChoiceOtherChoiceLabel",null),e([r()],L.prototype,"hasMultipleChoiceOtherChoiceField",null),e([r()],L.prototype,"shouldShowMultipleChoiceOtherChoice",null),e([r()],L.prototype,"multipleChoiceOtherChoiceValue",null),e([r()],L.prototype,"multipleChoiceOtherChoiceMaxLength",null),e([r()],L.prototype,"multipleChoiceOtherChoiceCheckboxState",null),e([r()],L.prototype,"invalidFeatures",null),e([r()],L.prototype,"_multipleChoiceOtherChoiceCheckedStateStore",null),e([r()],L.prototype,"isSubtypeField",null),e([r()],L.prototype,"showNoValueOptionEnabled",null),e([r()],L.prototype,"showNoValueLabel",null),e([r()],L.prototype,"includeTime",null),e([r()],L.prototype,"includeTimeOffset",null),e([r({readOnly:!0})],L.prototype,"inputType",null),e([r()],L.prototype,"maxLength",null),e([r()],L.prototype,"minLength",null),e([r()],L.prototype,"range",null),e([r()],L.prototype,"required",null),e([r()],L.prototype,"timeResolution",null),e([r()],L.prototype,"timeStep",null),e([r({readOnly:!0})],L.prototype,"type",void 0),e([r()],L.prototype,"userHasChangedValue",void 0),e([r()],L.prototype,"valid",null),e([r()],L.prototype,"value",null),e([r()],L.prototype,"valueIsOutOfDomain",null),e([r()],L.prototype,"visibilityCode",null),e([r()],L.prototype,"codedValueDomainOptions",null),e([r()],L.prototype,"codedValueOptions",null),e([r()],L.prototype,"_evaluatedRequiredExpression",null),e([r()],L.prototype,"_hasIntersectionWithElementFieldDomain",void 0),e([r()],L.prototype,"_allDomains",null),e([r()],L.prototype,"_fieldShouldHaveDomain",null),e([r()],L.prototype,"_dateFormRange",null),e([r()],L.prototype,"_dateRange",null),L=e([o("esri.widgets.BatchAttributeForm.inputs.FieldInput")],L);const R=L;export{R as default};
@@ -1,2 +1,2 @@
1
1
  /* COPYRIGHT Esri - https://js.arcgis.com/5.2/LICENSE.txt */
2
- import{__decorate as e}from"tslib";import{destroyMaybe as t}from"../../../core/maybe.js";import{on as l}from"../../../core/reactiveUtils.js";import{property as r,subclass as i}from"../../../core/accessorSupport/decorators.js";import{isSubtypeGroupLayer as o,getEffectiveLayerCapabilities as s}from"../../../layers/support/layerUtils.js";import{isRelatableFeatureSupportedLayer as a}from"../../../popup/support/featureUtils.js";import{getComputedAttributes as n,parseFormTemplateString as p}from"../stringUtils.js";import d from"./EditableInput.js";import h from"./SingleFeatureInputAdapter.js";import u from"../../Feature/FeatureRelationship/FeatureRelationshipViewModel.js";let y=class extends d{constructor(e){super(e),this._relationshipVM=new u,this._showAllCategories=!1,this._showAllRelatedRecords=!1,this.group=null,this.map=null,this.single=new h({input:this}),this.type="relationship"}initialize(){this._setRelationshipVMProps(),this.addHandles([l(()=>this.relatedLayer,"edits",()=>this._relationshipVM?.refresh())])}destroy(){t(this._relationshipVM)}get activeCategory(){return this._relationshipVM.activeCategory}get allCategories(){const{relatedLayer:e,_relationshipVM:t}=this;if(!o(e))return;const l=t?.categories,r=(e.subtypes??[]).map(({code:e,name:t})=>{const r=l?.find(e=>e.name===t);return{name:t,count:r?.count??0,value:r?.value??e}});return r.length?r:null}get categories(){return this.showAllEnabled?this.allCategories:this.allCategories?.slice(0,this.displayCount)}get canAddRelatedFeature(){const{editable:e,relatedFeatureCount:t,relationship:l}=this;if(!l||!this.loaded||!this._relatedLayerAllowsAdds)return!1;if(this.allCategories?.length&&!this.activeCategory)return!1;const{cardinality:r,role:i}=l;return!("one-to-one"===r&&t>0)&&("many-to-many"!==r&&(!("one-to-many"===r&&"destination"===i&&t>0)&&e))}get displayCount(){return this.template.displayCount}get displayType(){return this.template.displayType}get editable(){return!!this._relatedLayerAllowsAdds&&(this._evaluatedEditableExpression??!0)}get feature(){return this.single.feature}get relatedFeatureCount(){return this._relationshipVM?.featureCount??0}get label(){return this.activeCategory?.name?this.activeCategory.name:this._computeStringLiteralText(this.template.label)}get layer(){return this.single.layer}get loaded(){return"loading"!==this._relationshipVM?.state}get orderByFields(){return this.template.orderByFields}get originHasValidKey(){return!!this.relationship&&null!=this.feature?.getAttribute(this.relationship.keyField)}get relationship(){return this._relationshipVM?.relationship}get relationshipId(){return this.template.relationshipId}get relatedFeatureInfos(){const{_relationshipVM:e,effectiveTimeZone:t}=this;if(!e?.relatedFeatures?.length||!e?.relatedLayer)return[];const{itemDescriptionFieldName:l,relatedFeatures:r,relatedLayer:i}=e,o=i?.formTemplate?.title||void 0;return r.map(e=>{let r;if(l){const o=e.getAttribute(l),s=i.fieldsIndex.get(l);if(s){const e=n({fields:[s],layer:i,values:[o],timeZone:t})[l];null!=e&&(r=e.toString())}}return{feature:e,description:r,title:o?p({attributes:e.attributes,label:o,layer:i,timeZone:t}):void 0}}).toArray()}get relatedLayer(){return this._relationshipVM?.relatedLayer}get relatedLayerIsTable(){return!!this.relatedLayer?.isTable}get showAllEnabled(){return this._relationshipVM.showAllEnabled}get showAllActionVisible(){return!this.showAllEnabled&&this.relatedFeatureCount>0&&this.relatedFeatureCount>this.displayCount}get showAllCategories(){return this._showAllCategories}get showAllCategoriesVisible(){const e=this.allCategories?.length??0;return!this.showAllEnabled&&e>0&&e>this.displayCount}get showAllRelatedRecords(){return this._showAllRelatedRecords}get updating(){return"loading"===this._relationshipVM?.state||"querying"===this._relationshipVM?.state}incrementPage(){this._relationshipVM&&this._relationshipVM.featurePage++}setActiveCategory(e){this._relationshipVM.activeCategory=e,this.setShowAllRelatedRecords(!!e)}setShowAllCategories(e){this._showAllCategories=e,this._showAllRelatedRecords||this._setShowAllEnabled(e)}setShowAllRelatedRecords(e){this._showAllRelatedRecords=e,this._showAllCategories||this._setShowAllEnabled(e)}get _relatedLayerAllowsAdds(){const{relatedLayer:e}=this;if(!e||!this._relatedLayerAllowsEdits)return!1;const t=s(e);return!!t?.operations?.supportsAdd}get _relatedLayerAllowsEdits(){const{relatedLayer:e}=this;if(!e)return!1;const t=s(e);return!!t?.operations?.supportsEditing}_setRelationshipVMProps(){const{displayCount:e,feature:t,layer:l,orderByFields:r,map:i,relationshipId:o,showAllEnabled:s}=this;t&&l&&a(l)&&this._relationshipVM.set({displayCount:e,graphic:t.plainGraphic,layer:l,map:i,orderByFields:r,relationshipId:o,showAllEnabled:s})}_setShowAllEnabled(e){this._relationshipVM.showAllEnabled=e}};e([r()],y.prototype,"_relationshipVM",void 0),e([r()],y.prototype,"_showAllCategories",void 0),e([r()],y.prototype,"_showAllRelatedRecords",void 0),e([r()],y.prototype,"activeCategory",null),e([r()],y.prototype,"allCategories",null),e([r()],y.prototype,"categories",null),e([r()],y.prototype,"canAddRelatedFeature",null),e([r()],y.prototype,"displayCount",null),e([r()],y.prototype,"displayType",null),e([r()],y.prototype,"editable",null),e([r()],y.prototype,"feature",null),e([r()],y.prototype,"group",void 0),e([r()],y.prototype,"label",null),e([r()],y.prototype,"layer",null),e([r()],y.prototype,"loaded",null),e([r()],y.prototype,"map",void 0),e([r()],y.prototype,"orderByFields",null),e([r()],y.prototype,"originHasValidKey",null),e([r()],y.prototype,"relationship",null),e([r()],y.prototype,"relationshipId",null),e([r()],y.prototype,"relatedFeatureInfos",null),e([r()],y.prototype,"relatedLayer",null),e([r()],y.prototype,"relatedLayerIsTable",null),e([r({readOnly:!0})],y.prototype,"single",void 0),e([r()],y.prototype,"showAllEnabled",null),e([r()],y.prototype,"showAllActionVisible",null),e([r()],y.prototype,"showAllCategories",null),e([r()],y.prototype,"showAllCategoriesVisible",null),e([r()],y.prototype,"showAllRelatedRecords",null),e([r({readOnly:!0})],y.prototype,"type",void 0),e([r()],y.prototype,"updating",null),e([r()],y.prototype,"_relatedLayerAllowsAdds",null),e([r()],y.prototype,"_relatedLayerAllowsEdits",null),y=e([i("esri.widgets.BatchAttributeForm.inputs.RelationshipElementInput")],y);const g=y;export{g as default};
2
+ import{__decorate as e}from"tslib";import{destroyMaybe as t}from"../../../core/maybe.js";import{on as l}from"../../../core/reactiveUtils.js";import{property as r,subclass as i}from"../../../core/accessorSupport/decorators.js";import{isSubtypeGroupLayer as o,getEffectiveLayerCapabilities as s}from"../../../layers/support/layerUtils.js";import{isRelatableFeatureSupportedLayer as a}from"../../../popup/support/featureUtils.js";import{getComputedAttributes as n,parseFormTemplateString as p}from"../stringUtils.js";import d from"./EditableInput.js";import h from"./SingleFeatureInputAdapter.js";import u from"../../Feature/FeatureRelationship/FeatureRelationshipViewModel.js";let y=class extends d{constructor(e){super(e),this._relationshipVM=new u,this._showAllCategories=!1,this._showAllRelatedRecords=!1,this.group=null,this.map=null,this.single=new h({input:this}),this.type="relationship"}initialize(){this._setRelationshipVMProps(),this.addHandles([l(()=>this.relatedLayer,"edits",()=>this._relationshipVM?.refresh())])}destroy(){t(this._relationshipVM)}get activeCategory(){return this._relationshipVM.activeCategory}get allCategories(){const{relatedLayer:e,_relationshipVM:t}=this;if(!o(e))return;const l=t?.categories,r=(e.subtypes??[]).map(({code:e,name:t})=>{const r=l?.find(e=>e.name===t);return{name:t,count:r?.count??0,value:r?.value??e}});return r.length?r:null}get categories(){return this.showAllEnabled?this.allCategories:this.allCategories?.slice(0,this.displayCount)}get canAddRelatedFeature(){const{editable:e,relatedFeatureCount:t,relationship:l}=this;if(!l||!this.loaded||!this._relatedLayerAllowsAdds)return!1;if(this.allCategories?.length&&!this.activeCategory)return!1;const{cardinality:r,role:i}=l;return!("one-to-one"===r&&t>0)&&("many-to-many"!==r&&(!("one-to-many"===r&&"destination"===i&&t>0)&&e))}get displayCount(){return this.template.displayCount}get displayType(){return this.template.displayType}get editable(){return!!this._relatedLayerAllowsEdits&&(this._evaluatedEditableExpression??!0)}get feature(){return this.single.feature}get relatedFeatureCount(){return this._relationshipVM?.featureCount??0}get label(){return this.activeCategory?.name?this.activeCategory.name:this._computeStringLiteralText(this.template.label)}get layer(){return this.single.layer}get loaded(){return"loading"!==this._relationshipVM?.state}get orderByFields(){return this.template.orderByFields}get originHasValidKey(){return!!this.relationship&&null!=this.feature?.getAttribute(this.relationship.keyField)}get relationship(){return this._relationshipVM?.relationship}get relationshipId(){return this.template.relationshipId}get relatedFeatureInfos(){const{_relationshipVM:e,effectiveTimeZone:t}=this;if(!e?.relatedFeatures?.length||!e?.relatedLayer)return[];const{itemDescriptionFieldName:l,relatedFeatures:r,relatedLayer:i}=e,o=i?.formTemplate?.title||void 0;return r.map(e=>{let r;if(l){const o=e.getAttribute(l),s=i.fieldsIndex.get(l);if(s){const e=n({fields:[s],layer:i,values:[o],timeZone:t})[l];null!=e&&(r=e.toString())}}return{feature:e,description:r,title:o?p({attributes:e.attributes,label:o,layer:i,timeZone:t}):void 0}}).toArray()}get relatedLayer(){return this._relationshipVM?.relatedLayer}get relatedLayerIsTable(){return!!this.relatedLayer?.isTable}get showAllEnabled(){return this._relationshipVM.showAllEnabled}get showAllActionVisible(){return!this.showAllEnabled&&this.relatedFeatureCount>0&&this.relatedFeatureCount>this.displayCount}get showAllCategories(){return this._showAllCategories}get showAllCategoriesVisible(){const e=this.allCategories?.length??0;return!this.showAllEnabled&&e>0&&e>this.displayCount}get showAllRelatedRecords(){return this._showAllRelatedRecords}get updating(){return"loading"===this._relationshipVM?.state||"querying"===this._relationshipVM?.state}incrementPage(){this._relationshipVM&&this._relationshipVM.featurePage++}setActiveCategory(e){this._relationshipVM.activeCategory=e,this.setShowAllRelatedRecords(!!e)}setShowAllCategories(e){this._showAllCategories=e,this._showAllRelatedRecords||this._setShowAllEnabled(e)}setShowAllRelatedRecords(e){this._showAllRelatedRecords=e,this._showAllCategories||this._setShowAllEnabled(e)}get _relatedLayerAllowsAdds(){const{relatedLayer:e}=this;if(!e||!this._relatedLayerAllowsEdits)return!1;const t=s(e);return!!t?.operations?.supportsAdd}get _relatedLayerAllowsEdits(){const{relatedLayer:e}=this;if(!e)return!1;const t=s(e);return!!t?.operations?.supportsEditing}_setRelationshipVMProps(){const{displayCount:e,feature:t,layer:l,orderByFields:r,map:i,relationshipId:o,showAllEnabled:s}=this;t&&l&&a(l)&&this._relationshipVM.set({displayCount:e,graphic:t.plainGraphic,layer:l,map:i,orderByFields:r,relationshipId:o,showAllEnabled:s})}_setShowAllEnabled(e){this._relationshipVM.showAllEnabled=e}};e([r()],y.prototype,"_relationshipVM",void 0),e([r()],y.prototype,"_showAllCategories",void 0),e([r()],y.prototype,"_showAllRelatedRecords",void 0),e([r()],y.prototype,"activeCategory",null),e([r()],y.prototype,"allCategories",null),e([r()],y.prototype,"categories",null),e([r()],y.prototype,"canAddRelatedFeature",null),e([r()],y.prototype,"displayCount",null),e([r()],y.prototype,"displayType",null),e([r()],y.prototype,"editable",null),e([r()],y.prototype,"feature",null),e([r()],y.prototype,"group",void 0),e([r()],y.prototype,"label",null),e([r()],y.prototype,"layer",null),e([r()],y.prototype,"loaded",null),e([r()],y.prototype,"map",void 0),e([r()],y.prototype,"orderByFields",null),e([r()],y.prototype,"originHasValidKey",null),e([r()],y.prototype,"relationship",null),e([r()],y.prototype,"relationshipId",null),e([r()],y.prototype,"relatedFeatureInfos",null),e([r()],y.prototype,"relatedLayer",null),e([r()],y.prototype,"relatedLayerIsTable",null),e([r({readOnly:!0})],y.prototype,"single",void 0),e([r()],y.prototype,"showAllEnabled",null),e([r()],y.prototype,"showAllActionVisible",null),e([r()],y.prototype,"showAllCategories",null),e([r()],y.prototype,"showAllCategoriesVisible",null),e([r()],y.prototype,"showAllRelatedRecords",null),e([r({readOnly:!0})],y.prototype,"type",void 0),e([r()],y.prototype,"updating",null),e([r()],y.prototype,"_relatedLayerAllowsAdds",null),e([r()],y.prototype,"_relatedLayerAllowsEdits",null),y=e([i("esri.widgets.BatchAttributeForm.inputs.RelationshipElementInput")],y);const g=y;export{g as default};
@@ -1,2 +1,2 @@
1
1
  /* COPYRIGHT Esri - https://js.arcgis.com/5.2/LICENSE.txt */
2
- const t="esri_BatchAttributeForm_different_values";function n(t){return"visible"===t}function e(t){return"field"===t.type}function r(t){return e(t)&&"multiple-choice"===t.input?.type}function u(t){return"group"===t.type}function o(t){return"relationship"===t.type}function i(t){return"text"===t.type}function c(t){return"attachment"===t.type}function f(t){return e(t)||c(t)||o(t)||l(t)}function s(t){return e(t)||c(t)||o(t)||l(t)||i(t)}function p(t){return s(t)&&null!=t.group}function l(t){return"utilityNetworkAssociations"===t.type}function x(t){const n=`${t.elementId}:${t.executorPurpose}`;return null!=t.textExpressionIndex?`${n}:${t.textExpressionIndex}`:n}const y=t=>null!=t&&(a(t,"combo-box")||a(t,"radio-buttons"));function a(t,n){return t?.type===n}function d(t,n,e=[]){for(const r of t)n(r)?e.push(r):u(r)&&d(r.inputs,n,e);return e}function m(t,n){return t.layers[0]?.getField(n)?.name??n}export{d as deepFilterInputs,t as differentValuesString,m as getNormalizedFieldName,c as isAttachmentElementInput,f as isEditableInput,e as isFieldInput,y as isFieldInputWithShowNoValueOptionInput,u as isGroupInput,s as isGroupableInput,p as isGroupedInput,a as isInputWithInputType,r as isMultipleChoiceFieldInput,o as isRelationshipElementInput,i as isTextElementInput,l as isUtilityNetworkAssociationsElementInput,x as makeUseId,n as visibilityCodeToBoolean};
2
+ import{isNumericField as t,isStringField as n,isTimeOnlyField as e}from"../../../../layers/support/fieldUtils.js";import{isAnyDateField as r}from"../../../../smartMapping/support/utils.js";const u="esri_BatchAttributeForm_different_values";function o(t){return"visible"===t}function i(t){return"field"===t.type}function p(t){return i(t)&&"multiple-choice"===t.input?.type}function s(t){return"group"===t.type}function c(t){return"relationship"===t.type}function f(t){return"text"===t.type}function l(t){return"attachment"===t.type}function a(t){return i(t)||l(t)||c(t)||y(t)}function m(t){return i(t)||l(t)||c(t)||y(t)||f(t)}function x(t){return m(t)&&null!=t.group}function y(t){return"utilityNetworkAssociations"===t.type}function d(t){const n=`${t.elementId}:${t.executorPurpose}`;return null!=t.textExpressionIndex?`${n}:${t.textExpressionIndex}`:n}const b=t=>null!=t&&(h(t,"combo-box")||h(t,"radio-buttons"));function h(t,n){return t?.type===n}function g(t,n,e=[]){for(const r of t)n(r)?e.push(r):s(r)&&g(r.inputs,n,e);return e}function $(t,n){return t.layers[0]?.getField(n)?.name??n}function I(u){return t(u)?"number":n(u)?"text":r(u)||e(u)?"date":"unsupported"}export{g as deepFilterInputs,u as differentValuesString,I as getFieldInputDataType,$ as getNormalizedFieldName,l as isAttachmentElementInput,a as isEditableInput,i as isFieldInput,b as isFieldInputWithShowNoValueOptionInput,s as isGroupInput,m as isGroupableInput,x as isGroupedInput,h as isInputWithInputType,p as isMultipleChoiceFieldInput,c as isRelationshipElementInput,f as isTextElementInput,y as isUtilityNetworkAssociationsElementInput,d as makeUseId,o as visibilityCodeToBoolean};
@@ -1,2 +1,2 @@
1
1
  /* COPYRIGHT Esri - https://js.arcgis.com/5.2/LICENSE.txt */
2
- import{formatNumber as e}from"../../../intl/number.js";import{substitute as t}from"../../../intl/substitute.js";import{isSubtypeGroupLayer as i}from"../../../layers/support/layerUtils.js";import{isRelatableFeatureSupportedLayer as n}from"../../../popup/support/featureUtils.js";import{css as l}from"../css.js";import{loadCalciteComponents as o}from"../../support/componentsUtils.js";import{getIconForFeature as a}from"../../support/iconUtils.js";import{tsx as s,classes as r}from"../../support/widget.js";const c=()=>o({button:()=>import("@esri/calcite-components/dist/components/calcite-button"),chip:()=>import("@esri/calcite-components/dist/components/calcite-chip"),icon:()=>import("@esri/calcite-components/dist/components/calcite-icon"),"input-message":()=>import("@esri/calcite-components/dist/components/calcite-input-message"),list:()=>import("@esri/calcite-components/dist/components/calcite-list"),"list-item":()=>import("@esri/calcite-components/dist/components/calcite-list-item"),loader:()=>import("@esri/calcite-components/dist/components/calcite-loader"),notice:()=>import("@esri/calcite-components/dist/components/calcite-notice")});function d(e){const{input:t}=e,{template:i}=t;return s("div",{class:r({[l.relationshipElementInput]:!0,[l.relationshipElementInputShowingAll]:t.showAllEnabled}),"data-testid":`relationship-element-${i.elementId}`,key:`relationship-${t.relationshipId}-container`},p(t,e.messagesCommon),u(t),t.showAllEnabled&&R(e),m(e),!t.showAllEnabled&&R(e))}function p(e,t){const i=e.updating||!e.loaded;return s("div",{class:l.relatedRecordsHeader,key:`relationship-${e.relationshipId}-header`},s("span",null,e.label),i?s("calcite-loader",{inline:!0,key:"loader",label:t?.loading,scale:"s",type:"indeterminate"}):void 0)}function u(e){const{activeCategory:t,description:i}=e;if(!t&&i)return s("calcite-input-message",{class:r(l.description,l.relatedRecordsDescription)},i)}function m(e){const{input:t,messages:i}=e,{activeCategory:n,relatedFeatureCount:l}=t;return l>0?f(e):n&&!l?L(e.messages):t.allCategories?.length?I(e):t.loaded?t.originHasValidKey?L(i):F(e):void 0}function f(e){const{viewModel:t,input:i,messages:n}=e,o=!i.editable||t.readOnly;return s("calcite-list",{class:l.relatedRecordsList,label:n.relatedRecords.relatedRecordsTitle},i.relatedFeatureInfos.map(t=>h(t,o,e)),g(e),y(e))}function h(e,t,i){const{feature:n,description:l,title:o}=e,{viewModel:r,input:c}=i,{relationshipId:d,single:p}=c,{feature:u}=p,m=r.callbacks?.editRelatedRecord,{highlightHelper:f}=r;if(!u||!m)return;const h=()=>{f?.removeAll(),m({parentFeature:u.plainGraphic,readOnly:t,relatedFeature:n,relationshipId:d})},g=f?()=>f.add(n):void 0,v=f?()=>f.remove(n):void 0;return s("calcite-list-item",{description:l,key:`${d}-${n.uid}`,label:o,value:o,onCalciteListItemSelect:h,onmouseenter:g,onmouseleave:v},s("calcite-icon",{icon:a(n),slot:"content-start"}),s("calcite-icon",{flipRtl:!0,icon:"chevron-right",scale:"s",slot:"content-end"}))}function g(e){const{input:i,messages:n}=e;if(i.showAllActionVisible)return s("calcite-list-item",{description:t(n.totalCount,{count:i.relatedFeatureCount}),key:"show-all-related-features",label:n.showAll,value:!0,onCalciteListItemSelect:()=>b(e)},s("calcite-icon",{icon:"list",scale:"s",slot:"content-end"}))}function v(e){e.input.setShowAllCategories(!0),e.viewModel.setActiveRelationshipInput(e.input)}function b(e){e.input.setShowAllRelatedRecords(!0),e.viewModel.setActiveRelationshipInput(e.input)}function y(e){const{afterObserverCreated:t,afterObserverRemoved:i,viewModel:n}=e;if(n.activeRelationshipInput?.showAllEnabled)return s("div",{afterCreate:t,afterRemoved:i,class:l.relatedRecordsListObserver,key:"feature-observer"})}function R(e){const{input:t,viewModel:i,messages:n}=e,{canAddRelatedFeature:o,relationshipId:a,relatedLayer:c,editable:d}=t,{callbacks:p}=i;if(!(o&&p?.addRelatedRecord&&c&&d))return;const u=i.disabled||i.readOnly||t.updating||!t.originHasValidKey;return s("calcite-button",{alignment:"center",appearance:"outline-fill",class:r(l.centeredButton,l.relatedRecordsAddButton),disabled:u,iconStart:"plus",key:`${a}-add-button`,round:!0,scale:"s",width:"full",onclick:()=>w(e)},t.relatedLayerIsTable?n.addRecord:n.addFeature)}function w(e){const{input:t,viewModel:l}=e,{relationshipId:o,relatedLayer:a,single:s}=t,{feature:r}=s,{callbacks:c}=l;if(!r||!c?.addRelatedRecord)return;let d=a;if(i(a)&&t.activeCategory){const e=t.activeCategory.value,i=a.findSublayerForSubtypeCode(e);i&&n(i)&&(d=i)}d&&c.addRelatedRecord({parentFeature:r.plainGraphic,relatedLayer:d,relationshipId:o})}function I(e){const{input:t,messages:i}=e;return s("calcite-list",{displayMode:"flat",label:i.relatedRecords.relatedRecordsTitle,loading:t.updating},t.categories?.map(t=>C(t,e)),k(e))}function C(t,i){const{count:n,name:l,value:o}=t,a=e(n);return s("calcite-list-item",{key:`${l}-${o}`,label:l,onCalciteListItemSelect:()=>A(t,i)},s("calcite-chip",{label:a,scale:"s",slot:"content-end"},a),s("calcite-icon",{flipRtl:!0,icon:"chevron-right",scale:"s",slot:"content-end"}))}function A(e,t){t.viewModel.setActiveRelationshipCategory(e,t.input)}function k(e){const{input:i,messages:n}=e;if(i.showAllCategoriesVisible)return s("calcite-list-item",{description:t(n.totalCount,{count:i.allCategories?.length??0}),key:"show-all-categories",label:n.showAll,value:!0,onCalciteListItemSelect:()=>v(e)},s("calcite-icon",{icon:"list",scale:"s",slot:"content-end"}))}function F(e){const{viewModel:i,input:n,messages:l}=e,o=n.relatedLayerIsTable?l.relatedRecords.noOriginKeyRecord:l.relatedRecords.noOriginKeyFeature,a=n.relationship?.keyField,s=i.findFieldInput(a),r=n.layer?.fieldsIndex.get(a),c=s?.label||r?.alias||a;return M(t(o,{relatedLayerName:n.relatedLayer?.title??l.relatedRecords.untitledLayer,originKeyField:c}))}function L(e){return M(e.relatedRecords.noRecordsFound)}function M(e){return s("calcite-notice",{icon:"information",kind:"brand",open:!0,scale:"s",width:"full"},s("div",{slot:"message"},e))}export{d as RelationshipDetails,c as loadRelationshipDetailsComponents};
2
+ import{formatNumber as e}from"../../../intl/number.js";import{substitute as t}from"../../../intl/substitute.js";import{isSubtypeGroupLayer as i}from"../../../layers/support/layerUtils.js";import{isRelatableFeatureSupportedLayer as n}from"../../../popup/support/featureUtils.js";import{css as o}from"../css.js";import{loadCalciteComponents as l}from"../../support/componentsUtils.js";import{getIconForFeature as a}from"../../support/iconUtils.js";import{tsx as s,classes as r}from"../../support/widget.js";const c=()=>l({button:()=>import("@esri/calcite-components/dist/components/calcite-button"),chip:()=>import("@esri/calcite-components/dist/components/calcite-chip"),icon:()=>import("@esri/calcite-components/dist/components/calcite-icon"),"input-message":()=>import("@esri/calcite-components/dist/components/calcite-input-message"),list:()=>import("@esri/calcite-components/dist/components/calcite-list"),"list-item":()=>import("@esri/calcite-components/dist/components/calcite-list-item"),loader:()=>import("@esri/calcite-components/dist/components/calcite-loader"),notice:()=>import("@esri/calcite-components/dist/components/calcite-notice")});function d(e){const{input:t}=e,{template:i}=t;return s("div",{class:r({[o.relationshipElementInput]:!0,[o.relationshipElementInputShowingAll]:t.showAllEnabled}),"data-testid":`relationship-element-${i.elementId}`,key:`relationship-${t.relationshipId}-container`},p(t,e.messagesCommon),u(t),t.showAllEnabled&&R(e),m(e),!t.showAllEnabled&&R(e))}function p(e,t){const i=e.updating||!e.loaded;return s("div",{class:o.relatedRecordsHeader,key:`relationship-${e.relationshipId}-header`},s("span",null,e.label),i?s("calcite-loader",{inline:!0,key:"loader",label:t?.loading,scale:"s",type:"indeterminate"}):void 0)}function u(e){const{activeCategory:t,description:i}=e;if(!t&&i)return s("calcite-input-message",{class:r(o.description,o.relatedRecordsDescription)},i)}function m(e){const{input:t,messages:i}=e,{activeCategory:n,relatedFeatureCount:o}=t;return o>0?f(e):n&&!o?L(e.messages):t.allCategories?.length?I(e):t.loaded?t.originHasValidKey?L(i):F(e):void 0}function f(e){const{viewModel:t,input:i,messages:n}=e,l=!i.editable||t.readOnly;return s("calcite-list",{class:o.relatedRecordsList,label:n.relatedRecords.relatedRecordsTitle},i.relatedFeatureInfos.map(t=>h(t,l,e)),g(e),y(e))}function h(e,t,i){const{feature:n,description:o,title:l}=e,{viewModel:r,input:c}=i,{relationshipId:d,single:p}=c,{feature:u}=p,m=r.callbacks?.editRelatedRecord,{highlightHelper:f}=r;if(!u||!m)return;const h=()=>{f?.removeAll(),m({parentFeature:u.plainGraphic,readOnly:t,relatedFeature:n,relationshipId:d})},g=f?()=>f.add(n):void 0,v=f?()=>f.remove(n):void 0;return s("calcite-list-item",{description:o,key:`${d}-${n.uid}`,label:l,value:l,onCalciteListItemSelect:h,onmouseenter:g,onmouseleave:v},s("calcite-icon",{icon:a(n),slot:"content-start"}),s("calcite-icon",{flipRtl:!0,icon:"chevron-right",scale:"s",slot:"content-end"}))}function g(e){const{input:i,messages:n}=e;if(i.showAllActionVisible)return s("calcite-list-item",{description:t(n.totalCount,{count:i.relatedFeatureCount}),key:"show-all-related-features",label:n.showAll,value:!0,onCalciteListItemSelect:()=>b(e)},s("calcite-icon",{icon:"list",scale:"s",slot:"content-end"}))}function v(e){e.input.setShowAllCategories(!0),e.viewModel.setActiveRelationshipInput(e.input)}function b(e){e.input.setShowAllRelatedRecords(!0),e.viewModel.setActiveRelationshipInput(e.input)}function y(e){const{afterObserverCreated:t,afterObserverRemoved:i,viewModel:n}=e;if(n.activeRelationshipInput?.showAllEnabled)return s("div",{afterCreate:t,afterRemoved:i,class:o.relatedRecordsListObserver,key:"feature-observer"})}function R(e){const{input:t,viewModel:i,messages:n}=e,{canAddRelatedFeature:l,relationshipId:a,relatedLayer:c,editable:d}=t,{callbacks:p}=i;if(!(l&&p?.addRelatedRecord&&c&&d))return;const u=i.disabled||t.updating||!t.originHasValidKey;return s("calcite-button",{alignment:"center",appearance:"outline-fill",class:r(o.centeredButton,o.relatedRecordsAddButton),disabled:u,iconStart:"plus",key:`${a}-add-button`,round:!0,scale:"s",width:"full",onclick:()=>w(e)},t.relatedLayerIsTable?n.addRecord:n.addFeature)}function w(e){const{input:t,viewModel:o}=e,{relationshipId:l,relatedLayer:a,single:s}=t,{feature:r}=s,{callbacks:c}=o;if(!r||!c?.addRelatedRecord)return;let d=a;if(i(a)&&t.activeCategory){const e=t.activeCategory.value,i=a.findSublayerForSubtypeCode(e);i&&n(i)&&(d=i)}d&&c.addRelatedRecord({parentFeature:r.plainGraphic,relatedLayer:d,relationshipId:l})}function I(e){const{input:t,messages:i}=e;return s("calcite-list",{displayMode:"flat",label:i.relatedRecords.relatedRecordsTitle,loading:t.updating},t.categories?.map(t=>C(t,e)),k(e))}function C(t,i){const{count:n,name:o,value:l}=t,a=e(n);return s("calcite-list-item",{key:`${o}-${l}`,label:o,onCalciteListItemSelect:()=>A(t,i)},s("calcite-chip",{label:a,scale:"s",slot:"content-end"},a),s("calcite-icon",{flipRtl:!0,icon:"chevron-right",scale:"s",slot:"content-end"}))}function A(e,t){t.viewModel.setActiveRelationshipCategory(e,t.input)}function k(e){const{input:i,messages:n}=e;if(i.showAllCategoriesVisible)return s("calcite-list-item",{description:t(n.totalCount,{count:i.allCategories?.length??0}),key:"show-all-categories",label:n.showAll,value:!0,onCalciteListItemSelect:()=>v(e)},s("calcite-icon",{icon:"list",scale:"s",slot:"content-end"}))}function F(e){const{viewModel:i,input:n,messages:o}=e,l=n.relatedLayerIsTable?o.relatedRecords.noOriginKeyRecord:o.relatedRecords.noOriginKeyFeature,a=n.relationship?.keyField,s=i.findFieldInput(a),r=n.layer?.fieldsIndex.get(a),c=s?.label||r?.alias||a;return M(t(l,{relatedLayerName:n.relatedLayer?.title??o.relatedRecords.untitledLayer,originKeyField:c}))}function L(e){return M(e.relatedRecords.noRecordsFound)}function M(e){return s("calcite-notice",{icon:"information",kind:"brand",open:!0,scale:"s",width:"full"},s("div",{slot:"message"},e))}export{d as RelationshipDetails,c as loadRelationshipDetailsComponents};
@@ -1,2 +1,2 @@
1
1
  /* COPYRIGHT Esri - https://js.arcgis.com/5.2/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 s from"../../../../form/elements/AttachmentElement.js";import{isMultipleChoiceInput as a}from"../../../../form/elements/inputs/inputUtils.js";import m from"../../../../form/elements/inputs/attachments/AttachmentInput.js";import l from"../../../../form/elements/inputs/attachments/AudioInput.js";import p from"../../../../form/elements/inputs/attachments/DocumentInput.js";import c from"../../../../form/elements/inputs/attachments/ImageInput.js";import d from"../../../../form/elements/inputs/attachments/VideoInput.js";import{isAttachmentElement as f,isFieldElement as u,isGroupElement as x,isRelationshipElement as y,isTextElement as h,isUtilityNetworkAssociationsElement as w}from"../../../../form/support/formUtils.js";import{getLowerCaseEditTrackingFields as E,isFieldVisibleByDefault as T}from"../../../../layers/support/fieldUtils.js";import{isNumber as I}from"../../../../support/guards.js";import{layerSupportsAttachments as v,getLayerTimeZone as b}from"../../batchAttributeFormUtils.js";import{makeExpressionInfosMap as j,makeExecutorSetForFormElement as P}from"../../expressions/expressionUtils.js";import{AttachmentElementTemplate as g}from"../AttachmentElementTemplate.js";import Z from"../BatchFormTemplate.js";import{FieldElementTemplate as A}from"../FieldElementTemplate.js";import{GroupElementTemplate as F}from"../GroupElementTemplate.js";import{RelationshipElementTemplate as U}from"../RelationshipElementTemplate.js";import{TextElementTemplate as C}from"../TextElementTemplate.js";import{UtilityNetworkAssociationsElementTemplate as L}from"../UtilityNetworkAssociationsElementTemplate.js";import{isGroupElementTemplate as B}from"./templateUtils.js";import{compileTextElementMarkdownToHTML as H}from"./textElementTemplateUtils.js";const N="expression/dea57012-47ca4b55a000-8df62742ed0c",V=e("form-attachment-filename-calculation"),R=()=>n.getLogger("esri.widgets.BatchAttributeForm.templates.templateUtils");async function S(e,t,r=e.formTemplate){return await e.load(),r?.elements&&r.elements.length>0?O(r,e,t):W(e,t)}async function W(e,{arcadeExecutorProvider:t,attachmentsEnabled:r,formTimeZone:n}){const o=new Set(E(e)),i={arcadeExecutorProvider:t,formTimeZone:n,layer:e},s=[];for(const m of e.fields)X(m,e,o)&&s.push(Q(m,i));const a=await Promise.all(s);return r&&await K(a,{arcadeExecutorProvider:t,expressionInfos:j(void 0),layer:e}),new Z({elements:a,title:e.formTemplate?.title,preserveFieldValuesWhenHidden:!0})}function k(e,t){for(const r of e??[])if("group"!==r.type){if("field"===r.type&&!1===r.editable&&!r.editableExpression)return!0}else if(k(r.elements??[]))return!0;return!1}async function K(e,{arcadeExecutorProvider:t,expressionInfos:r,layer:n}){if(!v(n))return;const o=await D(new s({displayFilename:!0,input:new m({attachmentAssociationType:"any",inputTypes:[new c,new p,new d,new l]})}),{arcadeExecutorProvider:t,expressionInfos:r,layer:n});e.push(o)}async function O(e,t,r){let n=null;k(e.elements??[])&&(n=new i({title:"",name:N,expression:"false"}));const o=j(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 Z(s);let m=!1;const{arcadeExecutorProvider:l,formTimeZone:p}=r;for(const i of a){const e=await G(i,{arcadeExecutorProvider:l,expressionInfos:o,layer:t,formTimeZone:p});if(e){if(s.elements.push(e),m)continue;"attachment"===e.type&&(m=!0),B(e)&&e.elements.some(e=>("attachment"===e.type&&(m=!0),m))}}return e.supportsAttachmentElements||!r.attachmentsEnabled||m||await K(s.elements,{arcadeExecutorProvider:l,expressionInfos:o,layer:t}),new Z(s)}async function D(e,{arcadeExecutorProvider:r,expressionInfos:n,layer:o}){let i=null;if(e.filenameExpression)try{i=await t(e.filenameExpression,V)}catch(m){R().error("Failed to compile attachment filename expression",m)}const s=new g({allowUserRename:e.allowUserRename,attachmentKeyword:e.attachmentKeyword,description:e.description,displayFilename:e.displayFilename,filenameExpressionExecutor:i,input:e.input,label:e.label,maxAttachmentCount:e.maxAttachmentCount,minAttachmentCount:e.minAttachmentCount,useOriginalFilename:e.useOriginalFilename}),a=await P({element:e,expressionInfos:n,provider:r});return s.addLayer(o,a),s}async function G(e,t){return f(e)?D(e,{arcadeExecutorProvider:t.arcadeExecutorProvider,expressionInfos:t.expressionInfos,layer:t.layer}):u(e)?$(e,t):x(e)?q(e,t):y(e)?z(e,t):h(e)?J(e,t):w(e)?M(e,t):null}async function $(e,{arcadeExecutorProvider:t,expressionInfos:n,layer:o,formTimeZone:i}){const{fieldsIndex:s}=o,{description:m,domain:l,fieldName:p,hint:c,input:d,label:f}=e;if(null==p||!s.has(p))return R().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=N),d&&a(d)&&d.otherChoice){const e=d.otherChoice.fieldName,t=s.get(e);t&&t.name!==e&&(d.otherChoice=d.otherChoice.clone(),d.otherChoice.fieldName=t.name)}const u=new A({description:m,domain:l,field:s.get(p),hint:c,input:d,formTimeZone:i,layerTimeZone:b(o),label:f}),x=await P({element:e,expressionInfos:n,provider:t});return u.addLayer(o,x),u}async function q(e,t){const{arcadeExecutorProvider:r,expressionInfos:n,layer:o}=t,{description:i,label:s,initialState:a}=e,m=[];for(const c of e.elements){const e=await G(c,t);e&&m.push(e)}const l=new F({description:i,elements:m,label:s,initialState:a??"expanded"}),p=await P({element:e,expressionInfos:n,provider:r});return l.addLayer(o,p),l}async function z(e,t){const{description:r,label:n,displayCount:o,displayType:i,orderByFields:s,relationshipId:a}=e,{arcadeExecutorProvider:m,expressionInfos:l,layer:p,formTimeZone:c}=t,d=new U({description:r,...I(o)&&{displayCount:o},displayType:i,formTimeZone:c,label:n,layerTimeZone:b(p),orderByFields:s,relationshipId:a}),f=await P({element:e,expressionInfos:l,provider:m});return d.addLayer(p,f),d}async function J(e,{arcadeExecutorProvider:t,expressionInfos:r,layer:n,formTimeZone:o}){const{description:i,label:s,text:a,textFormat:m}=e,{fieldsIndex:l}=n,p=a&&"markdown"===m?await H(a):a,c=new C({compiledText:p,description:i,fieldsIndex:l,formTimeZone:o,label:s,layerTimeZone:b(n)}),d=await P({element:e,expressionInfos:r,provider:t}),{expressionParts:f}=c;if(f.length){const e=await Promise.all(f.map(e=>{const n=r.get(e)?.expression??e;return t.getArcadeExecutor(n)}));d.textExpressions=e}return c.addLayer(n,d),c}async function M(e,t){const{associationTypes:r,description:n,label:o}=e,{arcadeExecutorProvider:i,expressionInfos:s,formTimeZone:a,layer:m}=t,l=new L({associationTypes:r,description:n,formTimeZone:a,label:o,layerTimeZone:b(m)}),p=await P({element:e,expressionInfos:s,provider:i});return l.addLayer(m,p),l}async function Q(e,{arcadeExecutorProvider:t,layer:r,formTimeZone:n}){const i=o(e,r)||e.name,s=new A({field:e,formTimeZone:n,label:i,layerTimeZone:b(r)}),a={};return e.editable&&r.userHasUpdateItemPrivileges&&(a.editableExpression=await t.getArcadeExecutor("true")),s.addLayer(r,a),s}function X(e,t,r){return!r.has(e.name.toLowerCase())&&T(e,t)}export{S as createBatchFormTemplate,W as createBatchFormTemplateFromFields};
2
+ import{createArcadeProfile as e,createArcadeExecutor as t}from"../../../../arcade.js";import{isSome as r}from"../../../../core/arrayUtils.js";import n from"../../../../core/Error.js";import o from"../../../../core/Logger.js";import{getEffectiveFieldAlias as i}from"../../../../editing/fieldUtils.js";import s from"../../../../form/ExpressionInfo.js";import a from"../../../../form/elements/AttachmentElement.js";import{isMultipleChoiceInput as m}from"../../../../form/elements/inputs/inputUtils.js";import l from"../../../../form/elements/inputs/attachments/AttachmentInput.js";import p from"../../../../form/elements/inputs/attachments/AudioInput.js";import c from"../../../../form/elements/inputs/attachments/DocumentInput.js";import d from"../../../../form/elements/inputs/attachments/ImageInput.js";import f from"../../../../form/elements/inputs/attachments/VideoInput.js";import{isAttachmentElement as u,isFieldElement as x,isGroupElement as y,isRelationshipElement as h,isTextElement as w,isUtilityNetworkAssociationsElement as E}from"../../../../form/support/formUtils.js";import{getLowerCaseEditTrackingFields as T,isFieldVisibleByDefault as I}from"../../../../layers/support/fieldUtils.js";import{isNumber as v}from"../../../../support/guards.js";import{layerSupportsAttachments as b,getLayerTimeZone as j}from"../../batchAttributeFormUtils.js";import{makeExpressionInfosMap as P,makeExecutorSetForFormElement as g}from"../../expressions/expressionUtils.js";import{AttachmentElementTemplate as Z}from"../AttachmentElementTemplate.js";import A from"../BatchFormTemplate.js";import{FieldElementTemplate as F}from"../FieldElementTemplate.js";import{GroupElementTemplate as U}from"../GroupElementTemplate.js";import{RelationshipElementTemplate as C}from"../RelationshipElementTemplate.js";import{TextElementTemplate as L}from"../TextElementTemplate.js";import{UtilityNetworkAssociationsElementTemplate as B}from"../UtilityNetworkAssociationsElementTemplate.js";import{isGroupElementTemplate as H}from"./templateUtils.js";import{compileTextElementMarkdownToHTML as N}from"./textElementTemplateUtils.js";const V="expression/dea57012-47ca4b55a000-8df62742ed0c",R=e("form-attachment-filename-calculation"),S=()=>o.getLogger("esri.widgets.BatchAttributeForm.templates.templateUtils");async function W(e,t,r=e.formTemplate){return await e.load(),r?.elements&&r.elements.length>0?D(r,e,t):k(e,t)}async function k(e,{arcadeExecutorProvider:t,attachmentsEnabled:r,formTimeZone:n}){const o=new Set(T(e)),i={arcadeExecutorProvider:t,formTimeZone:n,layer:e},s=[];for(const m of e.fields)Y(m,e,o)&&s.push(X(m,i));const a=await Promise.all(s);return r&&await O(a,{arcadeExecutorProvider:t,expressionInfos:P(void 0),layer:e}),new A({elements:a,title:e.formTemplate?.title,preserveFieldValuesWhenHidden:!0})}function K(e,t){for(const r of e??[])if("group"!==r.type){if("field"===r.type&&!1===r.editable&&!r.editableExpression)return!0}else if(K(r.elements??[]))return!0;return!1}async function O(e,{arcadeExecutorProvider:t,expressionInfos:r,layer:n}){if(!b(n))return;const o=await G(new a({displayFilename:!0,input:new l({attachmentAssociationType:"any",inputTypes:[new d,new c,new f,new p]})}),{arcadeExecutorProvider:t,expressionInfos:r,layer:n});e.push(o)}async function D(e,t,r){let n=null;K(e.elements??[])&&(n=new s({title:"",name:V,expression:"false"}));const o=P(n?[...e.expressionInfos??[],n]:e.expressionInfos),i={description:e.description,elements:new Array,title:e.title,preserveFieldValuesWhenHidden:e.preserveFieldValuesWhenHidden,supportsAttachmentElements:e.supportsAttachmentElements},{elements:a}=e;if(!a)return new A(i);let m=!1;const{arcadeExecutorProvider:l,formTimeZone:p}=r;for(const s of a){const e=await $(s,{arcadeExecutorProvider:l,expressionInfos:o,layer:t,formTimeZone:p});if(e){if(i.elements.push(e),m)continue;"attachment"===e.type&&(m=!0),H(e)&&e.elements.some(e=>("attachment"===e.type&&(m=!0),m))}}return e.supportsAttachmentElements||!r.attachmentsEnabled||m||await O(i.elements,{arcadeExecutorProvider:l,expressionInfos:o,layer:t}),new A(i)}async function G(e,{arcadeExecutorProvider:r,expressionInfos:n,layer:o}){let i=null;if(e.filenameExpression)try{i=await t(e.filenameExpression,R)}catch(m){S().error("Failed to compile attachment filename expression",m)}const s=new Z({allowUserRename:e.allowUserRename,attachmentKeyword:e.attachmentKeyword,description:e.description,displayFilename:e.displayFilename,filenameExpressionExecutor:i,input:e.input,label:e.label,maxAttachmentCount:e.maxAttachmentCount,minAttachmentCount:e.minAttachmentCount,useOriginalFilename:e.useOriginalFilename}),a=await g({element:e,expressionInfos:n,provider:r});return s.addLayer(o,a),s}async function $(e,t){return u(e)?G(e,{arcadeExecutorProvider:t.arcadeExecutorProvider,expressionInfos:t.expressionInfos,layer:t.layer}):x(e)?q(e,t):y(e)?z(e,t):h(e)?J(e,t):w(e)?M(e,t):E(e)?Q(e,t):null}async function q(e,{arcadeExecutorProvider:t,expressionInfos:r,layer:o,formTimeZone:i}){const{fieldsIndex:s}=o,{description:a,domain:l,fieldName:p,hint:c,input:d,label:f}=e;if(null==p||!s.has(p))return S().warn(new n("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=V),d&&m(d)&&d.otherChoice){const e=d.otherChoice.fieldName,t=s.get(e);t&&t.name!==e&&(d.otherChoice=d.otherChoice.clone(),d.otherChoice.fieldName=t.name)}const u=new F({description:a,domain:l,field:s.get(p),hint:c,input:d,formTimeZone:i,layerTimeZone:j(o),label:f}),x=await g({element:e,expressionInfos:r,provider:t});return u.addLayer(o,x),u}async function z(e,t){const{arcadeExecutorProvider:r,expressionInfos:n,layer:o}=t,{description:i,label:s,initialState:a}=e,m=[];for(const c of e.elements){const e=await $(c,t);e&&m.push(e)}const l=new U({description:i,elements:m,label:s,initialState:a??"expanded"}),p=await g({element:e,expressionInfos:n,provider:r});return l.addLayer(o,p),l}async function J(e,t){const{description:r,label:n,displayCount:o,displayType:i,orderByFields:s,relationshipId:a}=e,{arcadeExecutorProvider:m,expressionInfos:l,layer:p,formTimeZone:c}=t,d=new C({description:r,...v(o)&&{displayCount:o},displayType:i,formTimeZone:c,label:n,layerTimeZone:j(p),orderByFields:s,relationshipId:a}),f=await g({element:e,expressionInfos:l,provider:m});return d.addLayer(p,f),d}async function M(e,{arcadeExecutorProvider:t,expressionInfos:n,layer:o,formTimeZone:i}){const{description:s,label:a,text:m,textFormat:l}=e,{fieldsIndex:p}=o,c=m&&"markdown"===l?await N(m):m,d=new L({compiledText:c,description:s,fieldsIndex:p,formTimeZone:i,label:a,layerTimeZone:j(o)}),f=await g({element:e,expressionInfos:n,provider:t}),{expressionParts:u}=d;if(u.length){const e=await Promise.all(u.map(e=>{const r=n.get(e)?.expression??e;return t.getArcadeExecutor(r)}));f.textExpressions=e.filter(r)}return d.addLayer(o,f),d}async function Q(e,t){const{associationTypes:r,description:n,label:o}=e,{arcadeExecutorProvider:i,expressionInfos:s,formTimeZone:a,layer:m}=t,l=new B({associationTypes:r,description:n,formTimeZone:a,label:o,layerTimeZone:j(m)}),p=await g({element:e,expressionInfos:s,provider:i});return l.addLayer(m,p),l}async function X(e,{arcadeExecutorProvider:t,layer:r,formTimeZone:n}){const o=i(e,r)||e.name,s=new F({field:e,formTimeZone:n,label:o,layerTimeZone:j(r)}),a={};return e.editable&&r.userHasUpdateItemPrivileges&&(a.editableExpression=await t.getArcadeExecutor("true")),s.addLayer(r,a),s}function Y(e,t,r){return!r.has(e.name.toLowerCase())&&I(e,t)}export{W as createBatchFormTemplate,k as createBatchFormTemplateFromFields};