@esri/solutions-components 5.1.0-next.164 → 5.1.0-next.166

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 (210) hide show
  1. package/dist/cdn/{XXQVYXGC.js → 25QYS4LE.js} +1 -1
  2. package/dist/cdn/275IZ5I6.js +5 -0
  3. package/dist/cdn/{KSAJFFJI.js → 2BI4S6V2.js} +1 -1
  4. package/dist/cdn/{SS6AENH6.js → 2BRPSISV.js} +1 -1
  5. package/dist/cdn/{QTFTJ4DQ.js → 2EXGHOIM.js} +1 -1
  6. package/dist/cdn/{S37TPZAO.js → 2LCG2XWX.js} +1 -1
  7. package/dist/cdn/{F3A22NPP.js → 2NSMAAXL.js} +1 -1
  8. package/dist/cdn/{A2VP46QZ.js → 2R7Y2ZVX.js} +1 -1
  9. package/dist/cdn/{3KRXI2TQ.js → 2RL6H5TB.js} +1 -1
  10. package/dist/cdn/{A6VVARNG.js → 2TEBTKD4.js} +1 -1
  11. package/dist/cdn/2VG5GRFH.js +2 -0
  12. package/dist/cdn/{44EC2SD3.js → 2YC25V3L.js} +1 -1
  13. package/dist/cdn/{D4TEADUS.js → 37P3IMFV.js} +1 -1
  14. package/dist/cdn/{C5BQAX2M.js → 3A3CPQX4.js} +1 -1
  15. package/dist/cdn/{7RIJ2EMD.js → 3FKVBTJC.js} +1 -1
  16. package/dist/cdn/{Q4X6GXRI.js → 3JCHYXHA.js} +1 -1
  17. package/dist/cdn/{CPOZIWVH.js → 463CZQF6.js} +1 -1
  18. package/dist/cdn/{2V64PFN2.js → 46I7FRQJ.js} +1 -1
  19. package/dist/cdn/{BQ7O62CG.js → 47FRMYZ4.js} +1 -1
  20. package/dist/cdn/4A77MNRM.js +2 -0
  21. package/dist/cdn/{U6DXEFHP.js → 4RCC4KA2.js} +1 -1
  22. package/dist/cdn/{WXM3KMEV.js → 4SORDX5Z.js} +1 -1
  23. package/dist/cdn/{EHSIODIO.js → 54A4C4RG.js} +1 -1
  24. package/dist/cdn/54TJQLYJ.js +69 -0
  25. package/dist/cdn/{D5JF7XQN.js → 56DNSWXG.js} +1 -1
  26. package/dist/cdn/{OMRM5EXN.js → 5FWKODDH.js} +1 -1
  27. package/dist/cdn/{G63OYQ7G.js → 5IDPOFIN.js} +1 -1
  28. package/dist/cdn/{TLRBE2TZ.js → 5LSNDSHW.js} +1 -1
  29. package/dist/cdn/{I4EEOB6Y.js → 5N4KGIIY.js} +1 -1
  30. package/dist/cdn/66N4ZZKC.js +2 -0
  31. package/dist/cdn/6FY64JKN.js +2 -0
  32. package/dist/cdn/{EYJQEBDF.js → 6HZBPFHA.js} +1 -1
  33. package/dist/cdn/{FZNRD2XJ.js → 6WNKGSHD.js} +1 -1
  34. package/dist/cdn/6WPQPRJ5.js +49 -0
  35. package/dist/cdn/{MBVY6OPY.js → 743J2ZUC.js} +1 -1
  36. package/dist/cdn/{7YJMTZFC.js → 77753TPX.js} +1 -1
  37. package/dist/cdn/{LY3WRG7K.js → 7P57UVVG.js} +1 -1
  38. package/dist/cdn/{5W7G3TSG.js → 7X2SPNNK.js} +21 -19
  39. package/dist/cdn/{GABDTUB7.js → A6ZTIX3P.js} +1 -1
  40. package/dist/cdn/{Z226R5SF.js → ADURBGIK.js} +1 -1
  41. package/dist/cdn/{GUMEOBNQ.js → AFLXI5U2.js} +1 -1
  42. package/dist/cdn/{GVFCX2FF.js → APNDTPBA.js} +1 -1
  43. package/dist/cdn/{S47SVZPE.js → ARFBMFQW.js} +1 -1
  44. package/dist/cdn/{KU2LYW6K.js → BIX5DRQP.js} +1 -1
  45. package/dist/cdn/{G2RMWJ7R.js → BOFA5RH7.js} +1 -1
  46. package/dist/cdn/{H5KFQMYD.js → BT3FYIEX.js} +1 -1
  47. package/dist/cdn/{P7LSYADG.js → BWWX52HV.js} +1 -1
  48. package/dist/cdn/{QPX33Y62.js → BXSBR2GT.js} +1 -1
  49. package/dist/cdn/C47WRU5U.js +2 -0
  50. package/dist/cdn/{OG4BNL2Z.js → CDT6E3VG.js} +1 -1
  51. package/dist/cdn/CKWEF3KW.js +2 -0
  52. package/dist/cdn/{PN2P5EVA.js → CMCEF65U.js} +1 -1
  53. package/dist/cdn/CRDFUDM4.js +45 -0
  54. package/dist/cdn/{4AFANEZZ.js → CS5N3DOL.js} +1 -1
  55. package/dist/cdn/{J6CXULUZ.js → CVHZAZLS.js} +1 -1
  56. package/dist/cdn/{TTCTODAR.js → CVXDL2AT.js} +1 -1
  57. package/dist/cdn/{XHFFDKEQ.js → D22STVK5.js} +1 -1
  58. package/dist/cdn/{XF5N3NI5.js → DIBK4RSG.js} +1 -1
  59. package/dist/cdn/{Q3MHT47G.js → DKZ4FZKK.js} +1 -1
  60. package/dist/cdn/{JCQQIAIE.js → DQ47P6ES.js} +1 -1
  61. package/dist/cdn/E3F63VW4.js +2 -0
  62. package/dist/cdn/EL3OIP52.js +31 -0
  63. package/dist/cdn/{Q6WCNWQE.js → ERLDQUNI.js} +1 -1
  64. package/dist/cdn/{RQIGAX6O.js → EWS72RFR.js} +1 -1
  65. package/dist/cdn/{4PNNKMNH.js → F4MS4NQL.js} +1 -1
  66. package/dist/cdn/{UA6XD7SQ.js → FFZ2XVRE.js} +1 -1
  67. package/dist/cdn/{XKEKXTL2.js → FSF3T3OT.js} +1 -1
  68. package/dist/cdn/{JFLG3EKT.js → FYJMHXWV.js} +1 -1
  69. package/dist/cdn/{C4F2OOUL.js → G2H3X6NS.js} +1 -1
  70. package/dist/cdn/{57SZHKM5.js → G4V4JPFI.js} +1 -1
  71. package/dist/cdn/{S4ZMJ42A.js → GDUCH242.js} +1 -1
  72. package/dist/cdn/{AV2Q4PBA.js → GI33DSVT.js} +1 -1
  73. package/dist/cdn/GJWHFH2F.js +2 -0
  74. package/dist/cdn/GSCHQNQD.js +56 -0
  75. package/dist/cdn/{SHI2ULEO.js → GSR2GEY7.js} +1 -1
  76. package/dist/cdn/{2OCRSUSE.js → GUSPFJUQ.js} +1 -1
  77. package/dist/cdn/{A62EWI7L.js → H4LZV33O.js} +1 -1
  78. package/dist/cdn/{X65HFYH4.js → HIB4BVGK.js} +1 -1
  79. package/dist/cdn/{2I5LGZNX.js → HIPZRG2Q.js} +1 -1
  80. package/dist/cdn/{LXGY2E55.js → HKFXHTYU.js} +1 -1
  81. package/dist/cdn/{EKK5FR2V.js → HM2QALUN.js} +1 -1
  82. package/dist/cdn/{F5SUVMAE.js → HOCCKT72.js} +1 -1
  83. package/dist/cdn/{MISU75DC.js → HQCHD3FH.js} +1 -1
  84. package/dist/cdn/HXNARVYH.js +3 -0
  85. package/dist/cdn/{V7WSQCQY.js → IAEFPE3L.js} +1 -1
  86. package/dist/cdn/INLWMPGE.js +2 -0
  87. package/dist/cdn/{DVCYL5TO.js → IVKRYKER.js} +1 -1
  88. package/dist/cdn/IXPNZCW6.js +2 -0
  89. package/dist/cdn/{SMN3CVM5.js → IXRFWVBT.js} +1 -1
  90. package/dist/cdn/{XEYYUNNX.js → JGL4WYTO.js} +1 -1
  91. package/dist/cdn/{4G6CA64M.js → JS2MTHHP.js} +1 -1
  92. package/dist/cdn/{3LZFERNW.js → K4LZRLGL.js} +1 -1
  93. package/dist/cdn/{YNCRTGYJ.js → K5ZYDQR7.js} +1 -1
  94. package/dist/cdn/{QH6PUU3Q.js → KD4IHPH6.js} +1 -6
  95. package/dist/cdn/{DF7TCZUS.js → KDDHPA54.js} +1 -1
  96. package/dist/cdn/{3IO2JXVB.js → KR2PPIBX.js} +1 -1
  97. package/dist/cdn/KWAQEZ3T.js +136 -0
  98. package/dist/cdn/LGBRHJBY.js +109 -0
  99. package/dist/cdn/{5K5GHKON.js → LV5KMTCD.js} +1 -1
  100. package/dist/cdn/LVYAW6XF.js +2 -0
  101. package/dist/cdn/LWJF6EXD.js +85 -0
  102. package/dist/cdn/{MICWKD3Q.js → LXNQ32NZ.js} +1 -1
  103. package/dist/cdn/{55QBAVPE.js → M6AOD7GG.js} +1 -1
  104. package/dist/cdn/{SNZRQPXI.js → MFVXFKKM.js} +1 -1
  105. package/dist/cdn/{XM3SRZWV.js → MIV34H66.js} +1 -1
  106. package/dist/cdn/{EF2TTWG5.js → MKSUYITL.js} +1 -1
  107. package/dist/cdn/MV7GEGP5.js +98 -0
  108. package/dist/cdn/{OZSFGLR6.js → MVDJOENC.js} +2 -2
  109. package/dist/cdn/{26QXT6ZT.js → O4DB2EXV.js} +1 -1
  110. package/dist/cdn/P5RZHVDH.js +2 -0
  111. package/dist/cdn/{WCXR46D4.js → PLQEDCUG.js} +1 -1
  112. package/dist/cdn/PLXHBQBF.js +146 -0
  113. package/dist/cdn/{22BJ76LD.js → PM4EFNB2.js} +1 -1
  114. package/dist/cdn/PPFEO3UH.js +2 -0
  115. package/dist/cdn/PVPKXQBE.js +340 -0
  116. package/dist/cdn/{UBPOT5V3.js → QMAV4UTN.js} +1 -1
  117. package/dist/cdn/{WGRSVQHE.js → QVUBUYP6.js} +1 -1
  118. package/dist/cdn/{7JC52SFZ.js → QZ2ZMWIH.js} +1 -1
  119. package/dist/cdn/{CAYWD56D.js → R27S3IDW.js} +1 -1
  120. package/dist/cdn/RDJIKSXN.js +439 -0
  121. package/dist/cdn/{R3PYC2H6.js → RHAHQ4DB.js} +1 -1
  122. package/dist/cdn/{I2NTSKBD.js → RLSY4VUQ.js} +1 -1
  123. package/dist/cdn/{TSUSILGP.js → RSCCUNJ4.js} +1 -1
  124. package/dist/cdn/{EFYLYWPE.js → RYJ556XB.js} +1 -1
  125. package/dist/cdn/{HVT2WBVC.js → S4GBMN37.js} +1 -1
  126. package/dist/cdn/{L4BYLII5.js → S5RB3GMN.js} +1 -1
  127. package/dist/cdn/{KTRKTBPS.js → SGFSVWTY.js} +1 -1
  128. package/dist/cdn/SHQFXQEI.js +2 -0
  129. package/dist/cdn/{IXBI3PV7.js → SJ2IGQMX.js} +1 -1
  130. package/dist/cdn/{5F6KCXYP.js → SJLSYFK3.js} +1 -1
  131. package/dist/cdn/T26SIBKB.js +3 -0
  132. package/dist/cdn/T3EPRHTT.js +4 -0
  133. package/dist/cdn/{IXLVTSCY.js → TCRMAQDF.js} +1 -1
  134. package/dist/cdn/TFO2AK45.js +2 -0
  135. package/dist/cdn/TLIIJ2QC.js +122 -0
  136. package/dist/cdn/{BM4VSEDV.js → TWJ6DAY5.js} +1 -1
  137. package/dist/cdn/{KKEERGX7.js → TZHRYPII.js} +1 -1
  138. package/dist/cdn/U76GHEKJ.js +71 -0
  139. package/dist/cdn/{FBGCV6YJ.js → UCYR537P.js} +1 -1
  140. package/dist/cdn/{NQBHAESW.js → UEYON3AE.js} +1 -1
  141. package/dist/cdn/UIZL3C3H.js +2 -0
  142. package/dist/cdn/{WQHJMFGP.js → UTUOUV3E.js} +1 -1
  143. package/dist/cdn/{DJYT367X.js → V5BIPD5T.js} +1 -1
  144. package/dist/cdn/VDI7SDRK.js +5 -0
  145. package/dist/cdn/VDZT4UXB.js +36 -0
  146. package/dist/cdn/{24DOFCUH.js → VKHBBAXO.js} +1 -1
  147. package/dist/cdn/{O7VRD3Z3.js → VL2NVCIB.js} +1 -1
  148. package/dist/cdn/{RBSOCHJT.js → VTFLDHVU.js} +1 -1
  149. package/dist/cdn/{VTAQ6NBB.js → VUXNHQGR.js} +1 -1
  150. package/dist/cdn/{BATEZR3T.js → WNVC3PSY.js} +1 -1
  151. package/dist/cdn/{JEIP7CJK.js → XKFX43FE.js} +1 -1
  152. package/dist/cdn/XLGAHCS7.js +2 -0
  153. package/dist/cdn/{GLC7JVKG.js → XQ7SXIHI.js} +1 -1
  154. package/dist/cdn/{CKURBJFW.js → XXCHYJ3I.js} +1 -1
  155. package/dist/cdn/{ISFTCFSJ.js → Y2AUIXNK.js} +1 -1
  156. package/dist/cdn/{CZ4A24AM.js → Y32IJPXS.js} +1 -1
  157. package/dist/cdn/{QWGJAD3Z.js → YPBSKBT2.js} +1 -1
  158. package/dist/cdn/YPDXQEUA.js +77 -0
  159. package/dist/cdn/{SXECIQ6Q.js → YSQDSGSF.js} +1 -1
  160. package/dist/cdn/{BEKMMPB7.js → YUI2MSOK.js} +1 -1
  161. package/dist/cdn/{ONARC6AZ.js → YUWXPLTE.js} +1 -1
  162. package/dist/cdn/YVWFYZTI.js +4 -0
  163. package/dist/cdn/{3QONPAFM.js → YWX2U5OD.js} +1 -1
  164. package/dist/cdn/{V5WXJLJN.js → Z7VXHUQA.js} +1 -1
  165. package/dist/cdn/{X7WLU5YB.js → ZOFZVFBV.js} +1 -1
  166. package/dist/cdn/ZSTC2DJY.js +2 -0
  167. package/dist/cdn/{IEXNY45H.js → ZWASNOIQ.js} +1 -1
  168. package/dist/cdn/{5NZT27OV.js → ZZOMKTFL.js} +1 -1
  169. package/dist/cdn/index.js +1 -1
  170. package/dist/chunks/assessBuildRequest.js +1 -6
  171. package/dist/chunks/assessUpdateRequest.js +21 -19
  172. package/dist/chunks/classifyIntent.js +31 -44
  173. package/dist/chunks/converter.js +75 -44
  174. package/dist/chunks/interfaces.js +26 -26
  175. package/dist/chunks/solution-builder-assistant.js +21 -23
  176. package/dist/chunks/transformQuery.js +1 -1
  177. package/dist/chunks/updateDesign.js +1 -1
  178. package/dist/chunks/validators.js +4 -3
  179. package/dist/components/arcgis-solutions-assistant/customElement.js +996 -737
  180. package/dist/components/solutions-deploy-app/customElement.js +1 -1
  181. package/dist/components/solutions-searchsort-toolbar/customElement.js +1 -1
  182. package/dist/docs/api.json +1 -1
  183. package/dist/docs/docs.json +1 -1
  184. package/dist/docs/web-types.json +1 -1
  185. package/dist/solutions-components_commit.txt +8 -5
  186. package/package.json +1 -1
  187. package/dist/cdn/5M3PCZM5.js +0 -2
  188. package/dist/cdn/62GTPPV5.js +0 -2
  189. package/dist/cdn/7VD3Y4IF.js +0 -2
  190. package/dist/cdn/B5JYLQYP.js +0 -2
  191. package/dist/cdn/DKXVDY6L.js +0 -2
  192. package/dist/cdn/FE7HMUSZ.js +0 -2
  193. package/dist/cdn/FFF5HUPM.js +0 -4
  194. package/dist/cdn/FZUI77EG.js +0 -2
  195. package/dist/cdn/I7MO6UJB.js +0 -2
  196. package/dist/cdn/J6OVONBB.js +0 -2
  197. package/dist/cdn/JDI57IEI.js +0 -98
  198. package/dist/cdn/LDSV7DEV.js +0 -2
  199. package/dist/cdn/LHTDVWX2.js +0 -90
  200. package/dist/cdn/LQXIFBIM.js +0 -3
  201. package/dist/cdn/O4VFFJLQ.js +0 -2
  202. package/dist/cdn/SIODWUWX.js +0 -2
  203. package/dist/cdn/SYISCXZY.js +0 -4
  204. package/dist/cdn/TGMVIKID.js +0 -2
  205. package/dist/cdn/UHJVBWUV.js +0 -434
  206. package/dist/cdn/V4O3KYPD.js +0 -2
  207. package/dist/cdn/V4ZJH2HP.js +0 -2
  208. package/dist/cdn/VCLTCEIQ.js +0 -2
  209. package/dist/cdn/VHYS3SP3.js +0 -2
  210. package/dist/cdn/WRQXYCRH.js +0 -2
@@ -1,47 +1,48 @@
1
1
  /* COPYRIGHT Esri - https://js.arcgis.com/5.1/LICENSE.txt */
2
- import { c as Le } from "../../chunks/runtime.js";
3
- import { u as $e } from "../../chunks/useT9n.js";
4
- import { LitElement as Fe, createEvent as ne, nothing as ae } from "@arcgis/lumina";
5
- import { css as Re, html as k } from "lit";
6
- import { unsafeHTML as De } from "lit/directives/unsafe-html.js";
7
- import { useContextConsumer as oe } from "@arcgis/lumina/context";
8
- import { c as Ne, b as Me } from "../../chunks/deployAppContexts.js";
9
- import { T as D } from "../../chunks/interfaces.js";
10
- import { m as Be } from "../../chunks/helpers.js";
11
- import z from "@arcgis/core/config.js";
12
- import { createRef as Pe, ref as qe } from "lit-html/directives/ref.js";
13
- import { Annotation as y, StateGraph as Q, START as H, END as I, NodeInterrupt as le } from "@langchain/langgraph/web";
14
- import { createAgentRuntimeState as W, sendTraceMessage as w, invokeStructuredPrompt as C, getEmbeddings as Ue, cosineSimilarity as Oe, invokeTextPrompt as ze } from "@arcgis/ai-orchestrator";
15
- import r, { z as A } from "zod";
16
- import * as K from "@esri/arcgis-rest-portal";
17
- import { applyPatch as je } from "fast-json-patch";
2
+ import { c as Ne } from "../../chunks/runtime.js";
3
+ import { u as Fe } from "../../chunks/useT9n.js";
4
+ import { LitElement as De, createEvent as ae, nothing as re } from "@arcgis/lumina";
5
+ import { css as Me, html as T } from "lit";
6
+ import { unsafeHTML as Re } from "lit/directives/unsafe-html.js";
7
+ import { useContextConsumer as le } from "@arcgis/lumina/context";
8
+ import { c as Be, b as Pe } from "../../chunks/deployAppContexts.js";
9
+ import { T as M } from "../../chunks/interfaces.js";
10
+ import { m as qe } from "../../chunks/helpers.js";
11
+ import G from "@arcgis/core/config.js";
12
+ import { createRef as Ue, ref as Oe } from "lit-html/directives/ref.js";
13
+ import { Annotation as x, StateGraph as K, START as W, END as A, NodeInterrupt as de } from "@langchain/langgraph/web";
14
+ import { createAgentRuntimeState as X, sendTraceMessage as _, invokeStructuredPrompt as k, getEmbeddings as ze, cosineSimilarity as je, invokeTextPrompt as Ge } from "@arcgis/ai-components/utils/index.js";
15
+ import l, { z as E } from "zod";
16
+ import * as Y from "@esri/arcgis-rest-portal";
17
+ import { applyPatch as He } from "fast-json-patch";
18
18
  import "@langchain/core/messages";
19
- import { C as ce } from "../../chunks/converter.js";
20
- import { v as j, b as V, S as Ve, g as Je } from "../../chunks/validators.js";
21
- import { t as de, g as P, c as ue, r as pe, d as F } from "../../chunks/templates.js";
22
- import Ge from "@arcgis/core/portal/Portal.js";
23
- import Qe from "@arcgis/core/portal/PortalItem.js";
24
- const He = Re`:host{display:block;height:100%}.margin-lg{margin:var(--calcite-spacing-lg)}.display-flex-row{display:flex;flex-direction:row}.assistant-split-container{display:flex;width:100%;height:calc(100vh - 78px);overflow:hidden;border-radius:10px}.assistant-panel{display:flex;flex-direction:column;height:100%;border:1px solid var(--calcite-color-surface-3);background-color:var(--calcite-color-surface-2);overflow:hidden}.chat-panel{min-width:320px}.builder-panel{min-width:320px;max-width:100%;border-left:1px solid var(--calcite-color-surface-3)}.panel-actions{display:flex;gap:8px;padding:6px;align-items:center}.builder-header,.builder-footer{padding:10px;background:var(--calcite-color-surface-1);border-bottom:1px solid var(--calcite-color-surface-3)}.builder-content{flex:1;overflow:auto;padding:12px}.builder-content pre{white-space:pre-wrap;word-wrap:break-word;max-height:100%;overflow:auto}.builder-actions{display:flex;gap:6px;align-items:center}.padding-left-10{padding-left:10px}.chat-container{display:flex;flex-direction:column;gap:0px;max-width:600px;height:75%;background-color:var(--calcite-color-surface-4);padding:1px}.chat-container_expanded{display:flex;flex-direction:column;gap:0px;max-width:100%;height:95%;background-color:var(--calcite-color-surface-1);border-radius:10px;padding:10px}.chat-panel{--calcite-color-focus: var(--calcite-color-brand);--calcite-panel-border-color: var(--calcite-color-border-2);--calcite-internal-panel-header-vertical-padding: 0px;--calcite-panel-header-content-space: 0px;border:var(--calcite-border-width-sm) solid var(--calcite-color-border-2);height:100%}.header-content{display:flex;align-items:center;gap:var(--calcite-spacing-sm);height:65px;box-sizing:border-box;padding-inline-start:var(--calcite-space-2xl)}.header-title{font-size:var(--calcite-font-size-md);font-weight:var(--calcite-font-weight-medium);color:var(--calcite-color-text-1)}.beta-chip{--calcite-chip-corner-radius: var(--calcite-corner-radius-half)}.chat-panel calcite-card,.chat-panel calcite-text-area,.chat-panel calcite-button,.chat-panel .chat-messages,.chat-panel .chat-input{--calcite-color-focus: var(--calcite-color-brand)}.assistant-followup-chip:focus{outline:2px solid var(--calcite-color-brand)}.chat-panel-heading{font-size:var(--calcite-font-size-0);font-weight:var(--calcite-font-weight-medium);color:var(--calcite-color-surface-1, var(--calcite-color-text-1))}.chat-messages{display:flex;flex-direction:column;gap:20px;padding:4px;height:100%;overflow-y:auto}.user-message{align-self:flex-end;background:var(--calcite-color-brand);border-radius:8px;max-width:90%;--calcite-card-corner-radius: 8px;--calcite-card-background-color: var(--calcite-color-brand);--calcite-card-border-color: var(--calcite-color-brand);color:var(--calcite-color-text-inverse);text-align:left}.system-message{align-self:flex-start;background:var(--calcite-color-surface-3);border-radius:8px;max-width:90%;--calcite-card-corner-radius: 8px;--calcite-card-background-color: var(--calcite-color-surface-4);--calcite-card-border-color: var(--calcite-color-surface-4);color:var(--calcite-color-inverse);text-align:left}.loader-message{align-self:flex-start;background:var(--calcite-color-surface-4);border-radius:8px;--calcite-card-corner-radius: 8px;--calcite-card-background-color: var(--calcite-color-surface-4);--calcite-card-border-color: var(--calcite-color-surface-4)}.message-content{padding:0;font-size:14px}.response-message.message-content>p:first-of-type{margin-top:0}.message-content img{max-width:100%;height:auto;display:block;object-fit:contain}.message-content-pad{padding-bottom:10px;font-size:14px}.message-content-summary{padding-bottom:14px}.message-content-alignment{display:flex;align-items:center;gap:var(--calcite-spacing-md);font-size:var(--calcite-font-size--1);color:var(--calcite-color-text-1)}.padding-top-10{padding-top:10px}.padding-right-8{padding-right:8px}.padding-left-right-5{padding-right:5px;padding-left:5px}.chip-content{padding:5px 5px 5px 0}.chat-input{display:flex;flex-direction:row;flex-grow:1}.table-cell{--calcite-table-cell-background: var(--calcite-color-surface-4)}.cursor-pointer{cursor:pointer}.notice-border-color{--temp-initial-brand: var(--calcite-color-brand)}.notice-border-color calcite-notice{--calcite-color-brand: #ddd;--calcite-icon-color: var(--temp-initial-brand)}.notice-border-color calcite-notice *{--calcite-color-brand: var(--temp-initial-brand)}.solution-card{padding:5px 0;text-decoration:none;display:block;width:100%;cursor:pointer}.solution-card calcite-card{display:flex;flex-direction:column;max-width:520px;overflow:hidden;--calcite-card-corner-radius: var(--calcite-corner-radius-round) !important;--calcite-card-shadow: var(--calcite-shadow-sm);--calcite-card-background-color: var(--calcite-card-background-color) }.solution-card div[slot=thumbnail]{max-height:100%;width:100%;position:relative;&:after{content:"";position:absolute;top:0;left:0;width:100%;height:100%;transition:all .15s ease-in-out}}.solution-card div[slot=thumbnail] img{max-height:100%;width:100%;object-fit:cover}.solution-card span[slot=description]{padding-top:10px}.solution-card calcite-chip{position:absolute;top:50%;left:50%;transform:translate(-50%,-50%);visibility:hidden;pointer-events:none;opacity:0;transition:all .15s ease-in-out;z-index:9999}.solution-card:hover calcite-chip{visibility:visible;opacity:1}.solution-card:hover div[slot=thumbnail]:after{background-color:#00000080}.solution-card:hover h3{text-decoration:underline}.solution-card:focus{outline:2px solid var(--calcite-color-brand)}.references-container{padding-top:10px;display:block}.references-container.collapsed{display:none}.width-100{width:100%}.disclaimer-div{display:flex;align-items:center;gap:var(--calcite-spacing-sm);font-size:var(--calcite-font-size--0);color:var(--calcite-color-text-1)}.display-none{display:none}.chat-messages calcite-fab{position:absolute;bottom:16px;left:50%;transform:translate(-50%);z-index:999}.icon-color-background{--calcite-button-icon-color: var(--calcite-color-surface-1)}#closeAssistantButton{--calcite-action-text-color: var(--calcite-color-text-1)}.icon-color-background:focus{--calcite-color-focus: var(--calcite-color-surface-1)}@media(max-width:430px){.solution-card .solution-snippet{display:none}}.height-32-flex-auto{height:32px;flex:0 0 auto}.margin-top-0.message-content>p:first-of-type{margin-top:0}a:not(.solution-card){color:var(--calcite-link-text-color, var(--calcite-color-text-link));cursor:pointer;text-decoration:none;line-height:inherit;background-image:linear-gradient(currentColor,currentColor),linear-gradient(var(--calcite-color-brand-underline),var(--calcite-color-brand-underline));background-position-x:0%,100%;background-position-y:min(1.5em,100%);background-repeat:no-repeat,no-repeat;background-size:0% 1px,100% 1px;transition-property:background-size,color;transition-duration:var(--calcite-animation-timing, .15s);transition-timing-function:ease-in-out;outline-color:transparent;position:relative}a:not(.solution-card):hover{background-size:100% 1px,100% 1px}a:not(.solution-card):focus{outline:2px solid var(--calcite-color-brand);outline-offset:2px;outline-color:var(--calcite-color-brand)}a:not(.solution-card):active{color:var(--calcite-color-brand-press)}`;
25
- async function v(t, e) {
26
- const s = Object.entries(t).find(
19
+ import { C as pe } from "../../chunks/converter.js";
20
+ import { v as H, b as J, S as Je, h as Ve, E as Qe, g as Ke } from "../../chunks/validators.js";
21
+ import { invokeStructuredPrompt as We } from "@arcgis/ai-orchestrator";
22
+ import { t as me, g as q, c as he, r as ge, d as F } from "../../chunks/templates.js";
23
+ import Xe from "@arcgis/core/portal/Portal.js";
24
+ import Ye from "@arcgis/core/portal/PortalItem.js";
25
+ const Ze = Me`:host{display:block;height:100%}.margin-lg{margin:var(--calcite-spacing-lg)}.display-flex-row{display:flex;flex-direction:row}.assistant-split-container{display:flex;width:100%;height:calc(100vh - 78px);overflow:hidden;border-radius:10px}.assistant-panel{display:flex;flex-direction:column;height:100%;border:1px solid var(--calcite-color-surface-3);background-color:var(--calcite-color-surface-2);overflow:hidden}.chat-panel{min-width:320px}.builder-panel{min-width:320px;max-width:100%;border-left:1px solid var(--calcite-color-surface-3)}.panel-actions{display:flex;gap:8px;padding:6px;align-items:center}.builder-header,.builder-footer{padding:10px;background:var(--calcite-color-surface-1);border-bottom:1px solid var(--calcite-color-surface-3)}.builder-content{flex:1;overflow:auto;padding:12px}.builder-content pre{white-space:pre-wrap;word-wrap:break-word;max-height:100%;overflow:auto}.builder-actions{display:flex;gap:6px;align-items:center}.padding-left-10{padding-left:10px}.chat-container{display:flex;flex-direction:column;gap:0px;max-width:600px;height:75%;background-color:var(--calcite-color-surface-4);padding:1px}.chat-container_expanded{display:flex;flex-direction:column;gap:0px;max-width:100%;height:95%;background-color:var(--calcite-color-surface-1);border-radius:10px;padding:10px}.chat-panel{--calcite-color-focus: var(--calcite-color-brand);--calcite-panel-border-color: var(--calcite-color-border-2);--calcite-internal-panel-header-vertical-padding: 0px;--calcite-panel-header-content-space: 0px;border:var(--calcite-border-width-sm) solid var(--calcite-color-border-2);height:100%}.header-content{display:flex;align-items:center;gap:var(--calcite-spacing-sm);height:65px;box-sizing:border-box;padding-inline-start:var(--calcite-space-2xl)}@media(resolution:1.25dppx),(resolution:1.75dppx){.chat-panel{margin-top:.5px}}.header-title{font-size:var(--calcite-font-size-md);font-weight:var(--calcite-font-weight-medium);color:var(--calcite-color-text-1)}.beta-chip{--calcite-chip-corner-radius: var(--calcite-corner-radius-half)}.chat-panel calcite-card,.chat-panel calcite-text-area,.chat-panel calcite-button,.chat-panel .chat-messages,.chat-panel .chat-input{--calcite-color-focus: var(--calcite-color-brand)}.assistant-followup-chip:focus{outline:2px solid var(--calcite-color-brand)}.chat-panel-heading{font-size:var(--calcite-font-size-0);font-weight:var(--calcite-font-weight-medium);color:var(--calcite-color-surface-1, var(--calcite-color-text-1))}.chat-messages{display:flex;flex-direction:column;gap:20px;padding:4px;height:100%;overflow-y:auto}.user-message{align-self:flex-end;background:var(--calcite-color-brand);border-radius:8px;max-width:90%;--calcite-card-corner-radius: 8px;--calcite-card-background-color: var(--calcite-color-brand);--calcite-card-border-color: var(--calcite-color-brand);color:var(--calcite-color-text-inverse);text-align:left}.system-message{align-self:flex-start;background:var(--calcite-color-surface-3);border-radius:8px;max-width:90%;--calcite-card-corner-radius: 8px;--calcite-card-background-color: var(--calcite-color-surface-4);--calcite-card-border-color: var(--calcite-color-surface-4);color:var(--calcite-color-inverse);text-align:left}.loader-message{align-self:flex-start;background:var(--calcite-color-surface-4);border-radius:8px;--calcite-card-corner-radius: 8px;--calcite-card-background-color: var(--calcite-color-surface-4);--calcite-card-border-color: var(--calcite-color-surface-4)}.message-content{padding:0;font-size:14px}.response-message.message-content>p:first-of-type{margin-top:0}.message-content img{max-width:100%;height:auto;display:block;object-fit:contain}.message-content-pad{padding-bottom:10px;font-size:14px}.message-content-summary{padding-bottom:14px}.message-content-alignment{display:flex;align-items:center;gap:var(--calcite-spacing-md);font-size:var(--calcite-font-size--1);color:var(--calcite-color-text-1)}.padding-top-10{padding-top:10px}.padding-right-8{padding-right:8px}.padding-left-right-5{padding-right:5px;padding-left:5px}.chip-content{padding:5px 5px 5px 0}.chat-input{display:flex;flex-direction:row;flex-grow:1}.table-cell{--calcite-table-cell-background: var(--calcite-color-surface-4)}.cursor-pointer{cursor:pointer}.notice-border-color{--temp-initial-brand: var(--calcite-color-brand)}.notice-border-color calcite-notice{--calcite-color-brand: #ddd;--calcite-icon-color: var(--temp-initial-brand)}.notice-border-color calcite-notice *{--calcite-color-brand: var(--temp-initial-brand)}.solution-card{padding:5px 0;text-decoration:none;display:block;width:100%;cursor:pointer}.solution-card calcite-card{display:flex;flex-direction:column;max-width:520px;overflow:hidden;--calcite-card-corner-radius: var(--calcite-corner-radius-round) !important;--calcite-card-shadow: var(--calcite-shadow-sm);--calcite-card-background-color: var(--calcite-card-background-color) }.solution-card div[slot=thumbnail]{max-height:100%;width:100%;position:relative;&:after{content:"";position:absolute;top:0;left:0;width:100%;height:100%;transition:all .15s ease-in-out}}.solution-card div[slot=thumbnail] img{max-height:100%;width:100%;object-fit:cover}.solution-card span[slot=description]{padding-top:10px}.solution-card calcite-chip{position:absolute;top:50%;left:50%;transform:translate(-50%,-50%);visibility:hidden;pointer-events:none;opacity:0;transition:all .15s ease-in-out;z-index:9999}.solution-card:hover calcite-chip{visibility:visible;opacity:1}.solution-card:hover div[slot=thumbnail]:after{background-color:#00000080}.solution-card:hover h3{text-decoration:underline}.solution-card:focus{outline:2px solid var(--calcite-color-brand)}.references-container{padding-top:10px;display:block}.references-container.collapsed{display:none}.width-100{width:100%}.disclaimer-div{display:flex;align-items:center;gap:var(--calcite-spacing-sm);font-size:var(--calcite-font-size--0);color:var(--calcite-color-text-1)}.display-none{display:none}.chat-messages calcite-fab{position:absolute;bottom:16px;left:50%;transform:translate(-50%);z-index:999}.icon-color-background{--calcite-button-icon-color: var(--calcite-color-surface-1)}#closeAssistantButton{--calcite-action-text-color: var(--calcite-color-text-1)}.icon-color-background:focus{--calcite-color-focus: var(--calcite-color-surface-1)}@media(max-width:430px){.solution-card .solution-snippet{display:none}}.height-32-flex-auto{height:32px;flex:0 0 auto}.margin-top-0.message-content>p:first-of-type{margin-top:0}a:not(.solution-card){color:var(--calcite-link-text-color, var(--calcite-color-text-link));cursor:pointer;text-decoration:none;line-height:inherit;background-image:linear-gradient(currentColor,currentColor),linear-gradient(var(--calcite-color-brand-underline),var(--calcite-color-brand-underline));background-position-x:0%,100%;background-position-y:min(1.5em,100%);background-repeat:no-repeat,no-repeat;background-size:0% 1px,100% 1px;transition-property:background-size,color;transition-duration:var(--calcite-animation-timing, .15s);transition-timing-function:ease-in-out;outline-color:transparent;position:relative}a:not(.solution-card):hover{background-size:100% 1px,100% 1px}a:not(.solution-card):focus{outline:2px solid var(--calcite-color-brand);outline-offset:2px;outline-color:var(--calcite-color-brand)}a:not(.solution-card):active{color:var(--calcite-color-brand-press)}`;
26
+ async function v(s, e) {
27
+ const t = Object.entries(s).find(
27
28
  ([i]) => i.endsWith(`/${e}.md`)
28
29
  );
29
- if (!s)
30
+ if (!t)
30
31
  throw new Error(
31
32
  `Prompt not found: ${e}
32
33
  Available prompts:
33
- ${Object.keys(t).join(`
34
+ ${Object.keys(s).join(`
34
35
  `)}`
35
36
  );
36
- return await s[1]();
37
+ return await t[1]();
37
38
  }
38
- function q(t) {
39
- return t?.configurable?.context?.translations;
39
+ function U(s) {
40
+ return s?.configurable?.context?.translations;
40
41
  }
41
- function me(t) {
42
- if (typeof window > "u" || t.length <= 1)
42
+ function fe(s) {
43
+ if (typeof window > "u" || s.length <= 1)
43
44
  return;
44
- const e = t.map((i) => i.solution.id), s = t.map((i) => i.solution.title);
45
+ const e = s.map((i) => i.solution.id), t = s.map((i) => i.solution.title);
45
46
  window.dispatchEvent(new CustomEvent("searchTermSet", {
46
47
  detail: {
47
48
  scope: "all-solutions",
@@ -50,7 +51,7 @@ function me(t) {
50
51
  })), window.dispatchEvent(new CustomEvent("solutionMatchesFromAssistant", {
51
52
  detail: {
52
53
  solutionIds: e,
53
- solutionTitles: s
54
+ solutionTitles: t
54
55
  },
55
56
  bubbles: !0,
56
57
  composed: !0
@@ -60,41 +61,41 @@ function me(t) {
60
61
  }
61
62
  }));
62
63
  }
63
- function ge(t) {
64
- if (typeof window > "u" || !t)
64
+ function ye(s) {
65
+ if (typeof window > "u" || !s)
65
66
  return;
66
67
  const e = new CustomEvent("solutionIDFromAssistant", {
67
- detail: t,
68
+ detail: s,
68
69
  bubbles: !0,
69
70
  composed: !0
70
71
  });
71
72
  window.dispatchEvent(e);
72
73
  }
73
- const We = A.object({
74
- needsContext: A.boolean().describe("True when the explorer query requires added context from prior turns."),
75
- rewrittenQuery: A.string().min(1).describe("The final query to send to doc AI. Keep original query if no context is needed.")
76
- }), he = /* @__PURE__ */ Object.assign({
77
- "./prompts/solutions_explorer_description.md": () => import("../../chunks/solutions_explorer_description.js").then((t) => t.default),
78
- "./prompts/transformQuery.md": () => import("../../chunks/transformQuery.js").then((t) => t.default)
74
+ const et = E.object({
75
+ needsContext: E.boolean().describe("True when the explorer query requires added context from prior turns."),
76
+ rewrittenQuery: E.string().min(1).describe("The final query to send to doc AI. Keep original query if no context is needed.")
77
+ }), ce = (s) => s?.signal?.aborted ?? !1, be = /* @__PURE__ */ Object.assign({
78
+ "./prompts/solutions_explorer_description.md": () => import("../../chunks/solutions_explorer_description.js").then((s) => s.default),
79
+ "./prompts/transformQuery.md": () => import("../../chunks/transformQuery.js").then((s) => s.default)
79
80
  });
80
- function Ke(t) {
81
- return t.replace(/<sup>\[\[(\d+)\]\]\(([^)]+)\)<\/sup>/g, '<sup><a href="$2">&#91;$1&#93;</a></sup>');
81
+ function tt(s) {
82
+ return s.replace(/<sup>\[\[(\d+)\]\]\(([^)]+)\)<\/sup>/g, '<sup><a href="$2">&#91;$1&#93;</a></sup>');
82
83
  }
83
- function Ye(t) {
84
- return t.replace(/!\[([^\]]*)\]\(([^)]+)\)/g, (e, s, i) => `<img src="${i}" alt="${s}" style="width: 100%;">`);
84
+ function st(s) {
85
+ return s.replace(/!\[([^\]]*)\]\(([^)]+)\)/g, (e, t, i) => `<img src="${i}" alt="${t}" style="width: 100%;">`);
85
86
  }
86
- function Xe(t, e) {
87
- const s = [];
87
+ function it(s, e) {
88
+ const t = [];
88
89
  return (e?.configurable?.context?.configContext.allCards ?? []).forEach((n) => {
89
90
  const o = n.title;
90
91
  if (!o)
91
92
  return;
92
93
  const a = new RegExp(`(?<![\\p{L}\\p{N}])${o}(?![\\p{L}\\p{N}])`, "giu");
93
- let l = !1;
94
- t = t.replace(a, (d, c, m) => {
95
- const h = m.slice(0, c);
96
- return /<img[^>]*alt\s*=\s*["'][^"']*$/i.test(h) ? d : (l = !0, `<a href="" target="solutionId:${n.deployCommonId}">${o}</a>`);
97
- }), l && s.push({
94
+ let r = !1;
95
+ s = s.replace(a, (c, d, h) => {
96
+ const y = h.slice(0, d);
97
+ return /<img[^>]*alt\s*=\s*["'][^"']*$/i.test(y) ? c : (r = !0, `<a href="" target="solutionId:${n.deployCommonId}">${o}</a>`);
98
+ }), r && t.push({
98
99
  solution: {
99
100
  title: n.title,
100
101
  id: n.deployCommonId,
@@ -103,71 +104,71 @@ function Xe(t, e) {
103
104
  },
104
105
  score: 100
105
106
  });
106
- }), { source: t, allMatches: s };
107
+ }), { source: s, allMatches: t };
107
108
  }
108
- function Ze(t) {
109
- return t && t.helperServices.aiAssistantServices ? `${t.helperServices.aiAssistantServices.url}/skills/doc_ai_assistant/chat` : null;
109
+ function nt(s) {
110
+ return s && s.helperServices.aiAssistantServices ? `${s.helperServices.aiAssistantServices.url}/skills/doc_ai_assistant/chat` : null;
110
111
  }
111
- function fe(t) {
112
- return t && t.helperServices.aiAssistantServices ? `${t.helperServices.aiAssistantServices.url}/skills/doc_ai_assistant/api/pre-chat` : null;
112
+ function xe(s) {
113
+ return s && s.helperServices.aiAssistantServices ? `${s.helperServices.aiAssistantServices.url}/skills/doc_ai_assistant/api/pre-chat` : null;
113
114
  }
114
- async function G(t, e, s) {
115
+ async function Q(s, e, t) {
115
116
  const i = await fetch(e, {
116
117
  method: "POST",
117
118
  headers: {
118
119
  "Content-Type": "application/json",
119
- token: s
120
+ token: t
120
121
  },
121
- body: JSON.stringify(t)
122
+ body: JSON.stringify(s)
122
123
  });
123
124
  if (!i.ok)
124
125
  throw new Error(`HTTP ${i.status} calling ${e}`);
125
126
  return i.json();
126
127
  }
127
- const et = (t) => new Promise((e) => setTimeout(e, t));
128
- async function tt(t, e) {
129
- const s = t.agentExecutionContext.userRequest, i = e?.configurable?.context?.lastTurnAgent, n = t.agentExecutionContext.messages ?? [];
128
+ const ot = (s) => new Promise((e) => setTimeout(e, s));
129
+ async function at(s, e) {
130
+ const t = s.agentExecutionContext.userRequest, i = e?.configurable?.context?.lastTurnAgent, n = s.agentExecutionContext.messages ?? [];
130
131
  if (!i || n.length <= 1 || i === "explorer")
131
- return s;
132
+ return t;
132
133
  try {
133
- const o = await v(he, "transformQuery"), a = await C({
134
+ const o = await v(be, "transformQuery"), a = await k({
134
135
  promptText: o,
135
- modelTier: "fast",
136
+ modelTier: "advanced",
136
137
  temperature: 0,
137
- schema: We,
138
+ schema: et,
138
139
  messages: n.slice(-11),
139
- inputVariables: { query: s, lastTurnAgent: i }
140
+ inputVariables: { query: t, lastTurnAgent: i }
140
141
  });
141
142
  if (a.needsContext && a.rewrittenQuery.trim())
142
- return console.debug(`Rephrased query from "${s}" to "${a.rewrittenQuery.trim()}"`), a.rewrittenQuery.trim();
143
+ return console.debug(`Rephrased query from "${t}" to "${a.rewrittenQuery.trim()}"`), a.rewrittenQuery.trim();
143
144
  } catch {
144
145
  }
145
- return s;
146
+ return t;
146
147
  }
147
- const st = y.Root({
148
+ const rt = x.Root({
148
149
  // Provides agentExecutionContext, outputMessage, summary, and status
149
150
  // channels with the orchestrator's standard reducers/defaults so the
150
151
  // sub-agent reports back through the same shape the orchestrator
151
152
  // persists into priorSteps.
152
- ...W(),
153
- solutionResponse: y({
154
- reducer: (t, e) => e ?? null,
153
+ ...X(),
154
+ solutionResponse: x({
155
+ reducer: (s, e) => e ?? null,
155
156
  default: () => null
156
157
  }),
157
- documentSkillUrl: y({
158
- reducer: (t, e) => e ?? null,
158
+ documentSkillUrl: x({
159
+ reducer: (s, e) => e ?? null,
159
160
  default: () => null
160
161
  }),
161
162
  // Persisted across turns via the graph checkpointer so follow-up questions
162
163
  // continue the same service conversation. Null on the very first interaction
163
164
  // or after messages are cleared.
164
- conversationId: y({
165
- reducer: (t, e) => e ?? t,
165
+ conversationId: x({
166
+ reducer: (s, e) => e ?? s,
166
167
  default: () => null
167
168
  })
168
- }), it = () => new Q(st).addNode("initializeAgent", at).addNode("askSolutionsQuestions", nt).addEdge(H, "initializeAgent").addEdge("initializeAgent", "askSolutionsQuestions").addEdge("askSolutionsQuestions", I), be = async (t, e, s, i) => {
169
- if (!t) return;
170
- const n = fe(t);
169
+ }), lt = () => new K(rt).addNode("initializeAgent", ut).addNode("askSolutionsQuestions", ct).addEdge(W, "initializeAgent").addEdge("initializeAgent", "askSolutionsQuestions").addEdge("askSolutionsQuestions", A), ve = async (s, e, t, i) => {
170
+ if (!s) return;
171
+ const n = xe(s);
171
172
  if (!n) return;
172
173
  const a = { context: {
173
174
  kind: "DocAIAssistantRequest",
@@ -175,22 +176,22 @@ const st = y.Root({
175
176
  products: "ArcGIS Solutions",
176
177
  persona: { persona: "apps-solutions" },
177
178
  pipeline: {
178
- translation: { allow: !0, language: s, use_llm: !1 }
179
+ translation: { allow: !0, language: t, use_llm: !1 }
179
180
  }
180
181
  }
181
182
  } };
182
- i && (a.conversationId = i), G(a, n, e ?? "");
183
- }, nt = async (t, e) => {
184
- if (e?.configurable?.abortSignal?.aborted)
183
+ i && (a.conversationId = i), Q(a, n, e ?? "");
184
+ }, ct = async (s, e) => {
185
+ if (ce(e))
185
186
  return {};
186
- const s = q(e), i = t.documentSkillUrl;
187
+ const t = U(e), i = s.documentSkillUrl;
187
188
  let n = [];
188
- const o = await tt(t, e);
189
- await w(
190
- { text: s.agentProgress.explorerAgentSearching },
189
+ const o = await at(s, e);
190
+ await _(
191
+ { text: t.agentProgress.explorerAgentSearching },
191
192
  e
192
193
  );
193
- let a = await G(
194
+ let a = await Q(
194
195
  {
195
196
  message: o,
196
197
  conversationId: e?.configurable?.context?.convoId ?? void 0,
@@ -209,100 +210,120 @@ const st = y.Root({
209
210
  e?.configurable?.context?.token ?? ""
210
211
  );
211
212
  a.conversationId && e?.configurable?.context?.setConversationId && e.configurable.context.setConversationId(a.conversationId);
212
- let l = {
213
+ let r = {
213
214
  message: a.message,
214
215
  conversationId: a.conversationId,
215
216
  hasMore: a.hasMore,
216
217
  ackSequenceNumber: a.sequenceNumber,
217
218
  inquiryId: a.inquiryId
218
- }, d = "";
219
- const c = async (h) => {
220
- const u = h.context?.results?.[0]?.reply ?? "";
219
+ }, c = "";
220
+ const d = async (y) => {
221
+ const u = y.context?.results?.[0]?.reply ?? "";
221
222
  if (u !== "") {
222
- const S = Ke(u), $ = Ye(S), T = Xe($, e);
223
- d = T.source, n = [
223
+ const S = tt(u), N = st(S), C = it(N, e);
224
+ c = C.source, n = [
224
225
  ...n,
225
- ...T.allMatches.filter(
226
- (U) => !n.some((_) => _.solution.id === U.solution.id)
226
+ ...C.allMatches.filter(
227
+ (z) => !n.some((I) => I.solution.id === z.solution.id)
227
228
  )
228
229
  ];
229
230
  }
230
- const f = h.context?.results?.[0]?.status?.currentStatusStep;
231
- if (f) {
231
+ const g = y.context?.results?.[0]?.status?.currentStatusStep;
232
+ if (g) {
232
233
  let S = "";
233
- f === 1 ? S = s.agentProgress.explorerAgentReading : f === 2 ? S = s.agentProgress.explorerAgentReviewing : f === 3 && (S = s.agentProgress.explorerAgentPreparing), await w({ text: S }, e);
234
+ g === 1 ? S = t.agentProgress.explorerAgentReading : g === 2 ? S = t.agentProgress.explorerAgentReviewing : g === 3 && (S = t.agentProgress.explorerAgentPreparing), await _({ text: S }, e);
234
235
  }
235
236
  };
236
- for (await c(a); l.hasMore; ) {
237
- if (e?.configurable?.abortSignal?.aborted)
237
+ for (await d(a); r.hasMore; ) {
238
+ if (ce(e))
238
239
  return {};
239
- await et(500), a = await G(
240
+ await ot(500), a = await Q(
240
241
  {
241
- conversationId: l.conversationId,
242
- ackSequenceNumber: l.ackSequenceNumber,
243
- inquiryId: l.inquiryId
242
+ conversationId: r.conversationId,
243
+ ackSequenceNumber: r.ackSequenceNumber,
244
+ inquiryId: r.inquiryId
244
245
  },
245
246
  i,
246
247
  e?.configurable?.context?.token ?? ""
247
- ), l = {
248
+ ), r = {
248
249
  message: a.message,
249
250
  conversationId: a.conversationId,
250
251
  hasMore: a.hasMore,
251
252
  ackSequenceNumber: a.sequenceNumber,
252
253
  inquiryId: a.inquiryId
253
- }, await c(a);
254
+ }, await d(a);
254
255
  }
255
- return fe(e?.configurable?.context.portal) && be(
256
+ return xe(e?.configurable?.context.portal) && ve(
256
257
  e?.configurable?.context.portal,
257
258
  e?.configurable?.context.token ?? "",
258
259
  e?.configurable?.context.configContext.locale ?? "en",
259
- l.conversationId
260
- ), n.length && (n.length === 1 ? ge(n[0].solution.id) : me(n)), {
261
- outputMessage: d,
262
- summary: d,
260
+ r.conversationId
261
+ ), n.length && (n.length === 1 ? ye(n[0].solution.id) : fe(n)), {
262
+ outputMessage: c,
263
+ summary: c,
263
264
  status: "success",
264
- solutionResponse: l,
265
- conversationId: l.conversationId
265
+ solutionResponse: r,
266
+ conversationId: r.conversationId
266
267
  };
267
- }, at = async (t, e) => {
268
- let s = null;
269
- return t.documentSkillUrl === null && e?.configurable?.context?.portal && (s = Ze(e.configurable.context.portal)), {
270
- documentSkillUrl: s
268
+ }, ut = async (s, e) => {
269
+ let t = null;
270
+ return s.documentSkillUrl === null && e?.configurable?.context?.portal && (t = nt(e.configurable.context.portal)), {
271
+ documentSkillUrl: t
271
272
  };
272
273
  };
273
- await v(he, "solutions_explorer_description");
274
- const ye = (t) => {
275
- if (t && Array.isArray(t.id) && t.id.length > 0)
276
- return t.id[t.id.length - 1].replace("Message", "").toLowerCase();
277
- if (t && typeof t._getType == "function")
274
+ await v(be, "solutions_explorer_description");
275
+ const we = (s) => {
276
+ if (s && Array.isArray(s.id) && s.id.length > 0)
277
+ return s.id[s.id.length - 1].replace("Message", "").toLowerCase();
278
+ if (s && typeof s._getType == "function")
278
279
  try {
279
- return t._getType();
280
+ return s._getType();
280
281
  } catch {
281
282
  return "human";
282
283
  }
283
284
  return "human";
284
- }, ot = (t) => {
285
- const e = ye(t);
286
- if (t && t.kwargs)
285
+ }, dt = (s) => {
286
+ const e = we(s);
287
+ if (s && s.kwargs)
287
288
  return {
288
289
  role: e,
289
- ...t.kwargs
290
+ ...s.kwargs
290
291
  // Includes content, id, additional_kwargs, response_metadata, etc.
291
292
  };
292
- if (t && typeof t == "object") {
293
- const s = {
293
+ if (s && typeof s == "object") {
294
+ const t = {
294
295
  role: e,
295
- content: typeof t.content == "string" ? t.content : String(t.content || "")
296
+ content: typeof s.content == "string" ? s.content : String(s.content || "")
296
297
  };
297
- return t.id && (s.id = t.id), t.name && (s.name = t.name), t.additional_kwargs && (s.additional_kwargs = t.additional_kwargs), t.response_metadata && (s.response_metadata = t.response_metadata), s;
298
+ return s.id && (t.id = s.id), s.name && (t.name = s.name), s.additional_kwargs && (t.additional_kwargs = s.additional_kwargs), s.response_metadata && (t.response_metadata = s.response_metadata), t;
298
299
  }
299
- return { role: "human", content: String(t) };
300
- }, rt = (t) => ye(t) === "human", lt = (t, e = 3) => t.filter((s) => rt(s)).slice(-e).map(ot), ct = (t, e = " ") => lt(t).map((n) => n.content).join(e).trim(), dt = { understandingRequest: "Understanding your request...", selectTemplatePrompt: "This use case could be supported in a few different ways. Choose the option that best matches what you want to accomplish.", searchingExistingSolutions: "Searching for existing solutions...", existingSolutionMatch: "I found one or more existing solutions that match your use case. These are ready-to-use solutions that may already meet your needs and can be deployed now. Do you want to continue building your own solution?", continueBuildingYes: "Yes, I want to build a new solution", continueBuildingNo: "No, I’ll review existing solutions", continueBuildingDeclined: "Sounds good. We can focus on existing solutions. Let me know if I can help answer any questions or provide more details.", creatingDesign: "Generating solution design...", updatingDesign: "Updating solution design...", applyChangeFailed: "I wasn't able to apply that change. The design was not modified. Please try rephrasing your request.", createDesignFailed: "I wasn't able to create a solution design from that request. Please try rephrasing and try again.", discardMessage: "Are you sure you want to discard your solution?", discardForNewSolution: "I can help you build a new solution, but I will need to discard your current solution design. Do you want to continue?" }, ut = {
301
- builderMessages: dt
300
+ return { role: "human", content: String(s) };
301
+ }, pt = (s) => we(s) === "human", mt = (s, e = 3) => s.filter((t) => pt(t)).slice(-e).map(dt), ht = (s, e = " ") => mt(s).map((n) => n.content).join(e).trim(), gt = { understandingRequest: "Understanding your request...", selectTemplatePrompt: "This use case could be supported in a few different ways. Choose the option that best matches what you want to accomplish.", searchingExistingSolutions: "Searching for existing solutions...", existingSolutionMatch: "I found one or more existing solutions that match your use case. These are ready-to-use solutions that may already meet your needs and can be deployed now. Do you want to continue building your own solution?", continueBuildingYes: "Yes, I want to build a new solution", continueBuildingNo: "No, I’ll review existing solutions", continueBuildingDeclined: "Sounds good. We can focus on existing solutions. Let me know if I can help answer any questions or provide more details.", creatingDesign: "Generating solution design...", updatingDesign: "Updating solution design...", applyChangeFailed: "I wasn't able to apply that change. The design was not modified. Please try rephrasing your request.", createDesignFailed: "I wasn't able to create a solution design from that request. Please try rephrasing and try again.", discardMessage: "Are you sure you want to discard your solution?", discardForNewSolution: "I can help you build a new solution, but I will need to discard your current solution design. Do you want to continue?" }, ft = {
302
+ builderMessages: gt
302
303
  };
303
- class ve {
304
- constructor(e, s, i = !0) {
305
- this.isValid = !0, this.issues = [], this.fieldNameRegistry = null, this.response = e, this.template = s, this.newDesign = i, this.validate();
304
+ class b {
305
+ //--------------------------------------------------------------------------
306
+ //
307
+ // Public API
308
+ //
309
+ //--------------------------------------------------------------------------
310
+ constructor(e, t, i = !0) {
311
+ this.isValid = !0, this.issues = [], this.fieldNameRegistry = null, this.response = e, this.template = t, this.newDesign = i, this.validate();
312
+ }
313
+ static {
314
+ this.INVALID_NAME_CHARS = /[><~`$^+=|]/gu;
315
+ }
316
+ static {
317
+ this.NAME_MAX_LENGTH = 250;
318
+ }
319
+ static {
320
+ this.DESCRIPTION_MAX_LENGTH = 2048;
321
+ }
322
+ static {
323
+ this.SERVICE_NAME_MAX_LENGTH = 100;
324
+ }
325
+ static {
326
+ this.FIELD_NAME_MAX_LENGTH = 31;
306
327
  }
307
328
  /**
308
329
  * Runs all validation checks on the response.
@@ -322,51 +343,171 @@ class ve {
322
343
  validateResponse() {
323
344
  this._validateSolutionProps(), this._validateItems(), this._validateFeatureLayer();
324
345
  }
346
+ //--------------------------------------------------------------------------
347
+ //
348
+ // Compare
349
+ //
350
+ //--------------------------------------------------------------------------
325
351
  /**
326
352
  * Compares string keys and values between response and template.
353
+ *
354
+ * On new designs the response is reconciled against the template: missing
355
+ * keys are re-injected and empty values are restored from the template.
356
+ * Otherwise, issues are logged. Extra response keys are ignored — the
357
+ * downstream app discards them.
327
358
  */
328
359
  _compareStrings() {
329
- const e = new Set(this.template.solution.strings.map((i) => i.key)), s = new Set(this.response.solution.strings.map((i) => i.key));
330
- e.size === s.size && [...e].every((i) => s.has(i)) || this._logIssue("String keys in llm response do not match the template.");
331
- for (const i of this.response.solution.strings)
332
- i.value || this._logIssue(`String key '${i.key}' has no value in the design. It must be populated.`);
360
+ const e = new Set(this.response.solution.strings.map((n) => n.key)), t = new Map(this.template.solution.strings.map((n) => [n.key, n]));
361
+ [...t.keys()].every((n) => e.has(n)) || (this.newDesign ? this._reconcileStringKeys() : this._logIssue("String keys in llm response do not match the template."));
362
+ for (const n of this.response.solution.strings) {
363
+ if (n.value)
364
+ continue;
365
+ const o = t.get(n.key)?.value;
366
+ this.newDesign && o ? (n.value = o, this._logAutoFix(`String key '${n.key}' had no value. Auto-fixed by restoring the template value.`)) : this._logIssue(`String key '${n.key}' has no value in the design. It must be populated.`);
367
+ }
368
+ }
369
+ /**
370
+ * Re-adds template string keys missing from the response (new-design only),
371
+ * carrying over the template value and description.
372
+ */
373
+ _reconcileStringKeys() {
374
+ const e = new Set(this.response.solution.strings.map((t) => t.key));
375
+ for (const t of this.template.solution.strings)
376
+ e.has(t.key) || (this.response.solution.strings.push({ ...t }), this._logAutoFix(`String key '${t.key}' was missing from the design. Auto-fixed by re-adding it from the template.`));
333
377
  }
334
378
  /**
335
379
  * Compares item IDs between response and template.
380
+ *
381
+ * On new designs the response items are reconciled against the template:
382
+ * missing items are added and items not present in the template are removed.
383
+ * Otherwise, an issue is logged.
336
384
  */
337
385
  _compareItems() {
338
- const e = new Set(this.template.items.map((i) => i.id)), s = new Set(this.response.items.map((i) => i.id));
339
- e.size === s.size && [...e].every((i) => s.has(i)) || this._logIssue("Item IDs in design do not match the template.");
386
+ const e = new Set(this.template.items.map((n) => n.id)), t = new Set(this.response.items.map((n) => n.id));
387
+ e.size === t.size && [...e].every((n) => t.has(n)) || (this.newDesign ? this._reconcileItems() : this._logIssue("Item IDs in design do not match the template."));
388
+ }
389
+ /**
390
+ * Reconciles response items against the template (new-design only): removes
391
+ * response items not present in the template and adds missing template items.
392
+ *
393
+ * Special case: when both sides have the same number of unique item ids and
394
+ * exactly one id differs, update that response item id in place to preserve
395
+ * any other user-edited properties on the item.
396
+ */
397
+ _reconcileItems() {
398
+ const e = new Set(this.template.items.map((a) => a.id)), t = new Set(this.response.items.map((a) => a.id)), i = [...t].filter((a) => !e.has(a)), n = [...e].filter((a) => !t.has(a));
399
+ if (e.size === t.size && i.length === 1 && n.length === 1) {
400
+ const a = i[0], r = n[0], c = this.response.items.find((d) => d.id === a);
401
+ if (c) {
402
+ c.id = r, this._logAutoFix(`Item id '${a}' did not match the template id '${r}'. Auto-fixed in place.`);
403
+ return;
404
+ }
405
+ }
406
+ i.length && (this.response.items = this.response.items.filter((a) => e.has(a.id)), this._logAutoFix(`Removed items not present in the template: ${i.join(", ")}.`));
407
+ const o = this.template.items.filter((a) => !t.has(a.id));
408
+ if (o.length) {
409
+ this.response.items = [
410
+ ...o.map((a) => ({ ...a })),
411
+ ...this.response.items
412
+ ];
413
+ for (const a of o)
414
+ this._logAutoFix(`Item '${a.id}' was missing from the design. Auto-fixed by adding it from the template.`);
415
+ }
340
416
  }
341
417
  /**
342
418
  * Compares feature layer configuration between response and template.
343
419
  */
344
420
  _compareFeatureLayers() {
345
- const e = this.template.featureLayer, s = this.response.featureLayer;
346
- if (e.itemId !== s.itemId) {
347
- this._logIssue(`Feature Layer itemId '${s.itemId}' does not match template '${e.itemId}'.`);
348
- return;
421
+ const e = this.template.featureLayer, t = this.response.featureLayer;
422
+ if (e.itemId !== t.itemId) {
423
+ const i = t.itemId;
424
+ t.itemId = e.itemId, this._logAutoFix(`Feature Layer itemId '${i}' did not match the template. Auto-fixed to '${e.itemId}'.`);
349
425
  }
350
426
  if (!e.addLayers) {
351
- const i = new Set(e.layers.map((o) => o.id)), n = new Set(s.layers.map((o) => o.id));
427
+ const i = new Set(e.layers.map((o) => o.id)), n = new Set(t.layers.map((o) => o.id));
352
428
  if (!(i.size === n.size && [...i].every((o) => n.has(o))))
353
429
  this._logIssue(`Feature Layer '${e.itemId}' had its layer ids altered.`);
354
430
  else
355
- for (const o of e.layers)
431
+ for (const o of e.layers) {
356
432
  if (o.type) {
357
- const a = s.layers.find((l) => l.id === o.id);
358
- a && a.type !== o.type && this._logIssue(`Layer '${o.id}' type '${a.type}' does not match template type '${o.type}'. This layer type is immutable.`);
433
+ const r = t.layers.find((c) => c.id === o.id);
434
+ if (r && r.type !== o.type)
435
+ if (this.newDesign) {
436
+ const c = r.type;
437
+ r.type = o.type, this._logAutoFix(`Layer '${o.id}' type '${c}' is immutable. Auto-fixed back to template type '${o.type}'.`);
438
+ } else
439
+ this._logIssue(`Layer '${o.id}' type '${r.type}' does not match template type '${o.type}'. This layer type is immutable.`);
359
440
  }
441
+ const a = t.layers.find((r) => r.id === o.id);
442
+ a && this._validateRequiredFields(a, o);
443
+ }
444
+ }
445
+ }
446
+ /**
447
+ * Validates required fields against the template. Required fields are matched by
448
+ * name. Users may change a required field's `alias` and `description`, but its
449
+ * `name`, `type`, `length`, and `choiceList` are immutable.
450
+ *
451
+ * On new designs, missing required fields are re-injected and tampered immutable
452
+ * properties are reverted to the template. Otherwise, issues are logged.
453
+ */
454
+ _validateRequiredFields(e, t) {
455
+ const i = new Map(
456
+ e.requiredFields.map((n) => [n.name.toLowerCase(), n])
457
+ );
458
+ for (const n of t.requiredFields) {
459
+ const o = i.get(n.name.toLowerCase());
460
+ if (!o) {
461
+ this.newDesign ? (e.requiredFields.push({ ...n }), this._logAutoFix(`Layer '${e.name}' was missing required field '${n.name}'. Auto-fixed by re-adding it from the template.`)) : this._logIssue(`Layer '${e.name}' is missing required field '${n.name}'.`);
462
+ continue;
463
+ }
464
+ this._enforceRequiredFieldImmutability(e, o, n);
360
465
  }
361
466
  }
467
+ /**
468
+ * Enforces immutability of a required field's `type`, `length`, and `choiceList`
469
+ * (its `name` is the match key, so it is equal by construction). On new designs the
470
+ * properties are reverted to the template; otherwise an issue is logged.
471
+ */
472
+ _enforceRequiredFieldImmutability(e, t, i) {
473
+ const n = [];
474
+ if (t.type !== i.type && n.push("type"), (t.length ?? null) !== (i.length ?? null) && n.push("length"), this._choiceListsEqual(t.choiceList, i.choiceList) || n.push("choiceList"), !n.length)
475
+ return;
476
+ const o = n.length === 1 ? "property" : "properties";
477
+ this.newDesign ? (t.type = i.type, t.length = i.length, t.choiceList = Array.isArray(i.choiceList) ? [...i.choiceList] : i.choiceList ?? null, this._logAutoFix(`Layer '${e.name}' required field '${i.name}' changed immutable ${o} (${n.join(", ")}). Auto-fixed by reverting to the template.`)) : this._logIssue(`Layer '${e.name}' required field '${i.name}' changed immutable ${o} (${n.join(", ")}). These cannot be modified.`);
478
+ }
479
+ /**
480
+ * Set-based equality check for two choiceList values (order-insensitive),
481
+ * treating null/undefined/non-array as "no domain".
482
+ */
483
+ _choiceListsEqual(e, t) {
484
+ const i = Array.isArray(e) ? e : null, n = Array.isArray(t) ? t : null;
485
+ if (i === null && n === null)
486
+ return !0;
487
+ if (i === null || n === null)
488
+ return !1;
489
+ const o = new Set(i), a = new Set(n);
490
+ return o.size === a.size && [...o].every((r) => a.has(r));
491
+ }
492
+ //--------------------------------------------------------------------------
493
+ //
494
+ // Validate
495
+ //
496
+ //--------------------------------------------------------------------------
362
497
  /**
363
498
  * Validates solution title and description.
364
499
  */
365
500
  _validateSolutionProps() {
366
- const e = this.response.solution.title, s = this.response.solution.description, i = j(e ?? "");
367
- if (i.isValid || this._logIssue(`Solution title is invalid (${i.errorType}).`), s) {
368
- const n = V(s, 2048, !0);
369
- n.isValid || this._logIssue(`Solution description is invalid (${n.errorType}).`);
501
+ const e = this.response.solution.title ?? "", t = this.response.solution.description, i = /[/\\]/u.test(e), n = this.newDesign ? e.replace(/[/\\]/gu, "") : e;
502
+ this.newDesign && n !== e ? (this.response.solution.title = n, this._logAutoFix("Solution title contained forward or back slashes. Auto-fixed by removing them.")) : !this.newDesign && i && this._logIssue("Solution title contains forbidden forward or back slashes.");
503
+ const o = H(n);
504
+ if (o.isValid || this._tryFixName(o.errorType, n, (a) => {
505
+ this.response.solution.title = a;
506
+ }, "Solution title", "Solution Title") || this._logIssue(`Solution title is invalid (${o.errorType}).`), t) {
507
+ const a = J(t, b.DESCRIPTION_MAX_LENGTH, !0);
508
+ a.isValid || this._tryFixDescription(t, (r) => {
509
+ this.response.solution.description = r;
510
+ }, "Solution description") || this._logIssue(`Solution description is invalid (${a.errorType}).`);
370
511
  }
371
512
  }
372
513
  /**
@@ -377,12 +518,21 @@ class ve {
377
518
  "Feature Layer (hosted)",
378
519
  "Feature Layer (hosted, view)"
379
520
  ]);
380
- for (const s of this.response.items) {
381
- e.has(s.type) && s.title.length > 100 && this._logIssue(`Service name '${s.title}' exceeds 100 characters.`);
382
- const i = j(s.title ?? "");
383
- if (i.isValid || this._logIssue(`Item '${s.id}' title is invalid (${i.errorType}).`), s.description) {
384
- const n = V(s.description, 2048, !0);
385
- n.isValid || this._logIssue(`Item '${s.id}' description is invalid (${n.errorType}).`);
521
+ for (const t of this.response.items) {
522
+ if (e.has(t.type) && t.title.length > b.SERVICE_NAME_MAX_LENGTH)
523
+ if (this.newDesign) {
524
+ const n = t.title;
525
+ t.title = t.title.slice(0, b.SERVICE_NAME_MAX_LENGTH).trim(), this._logAutoFix(`Service name '${n}' exceeded ${b.SERVICE_NAME_MAX_LENGTH} characters. Auto-fixed to '${t.title}'.`);
526
+ } else
527
+ this._logIssue(`Service name '${t.title}' exceeds 100 characters.`);
528
+ const i = H(t.title ?? "");
529
+ if (i.isValid || this._tryFixName(i.errorType, t.title ?? "", (n) => {
530
+ t.title = n;
531
+ }, `Item '${t.id}' title`, "Item Title") || this._logIssue(`Item '${t.id}' title is invalid (${i.errorType}).`), t.description) {
532
+ const n = J(t.description, b.DESCRIPTION_MAX_LENGTH, !0);
533
+ n.isValid || this._tryFixDescription(t.description, (o) => {
534
+ t.description = o;
535
+ }, `Item '${t.id}' description`) || this._logIssue(`Item '${t.id}' description is invalid (${n.errorType}).`);
386
536
  }
387
537
  }
388
538
  }
@@ -390,112 +540,134 @@ class ve {
390
540
  * Validates feature layer structure and layers.
391
541
  */
392
542
  _validateFeatureLayer() {
393
- const e = this.template.featureLayer.layers;
394
543
  this.response.featureLayer.layers.length || this._logIssue("Feature layer item must contain at least one layer.");
395
- const s = this.response.featureLayer.layers.map((i) => i.name.toLowerCase());
396
- s.length !== new Set(s).size && this._logIssue(`Layer names must be unique (case-insensitive). Layer names in design: ${s}.`);
397
- for (const i of this.response.featureLayer.layers) {
398
- this._validateLayer(i, this.response.featureLayer.addLayers);
399
- const n = e.find((o) => o.id === i.id);
400
- n && this._validateRequiredFields(i, n);
401
- }
544
+ const e = this.response.featureLayer.layers.map((t) => t.name.toLowerCase());
545
+ e.length !== new Set(e).size && (this.newDesign ? this._dedupeLayerNames(this.response.featureLayer.layers) : this._logIssue(`Layer names must be unique (case-insensitive). Layer names in design: ${e}.`));
546
+ for (const t of this.response.featureLayer.layers)
547
+ this._validateLayer(t, this.response.featureLayer.addLayers);
402
548
  }
403
549
  /**
404
- * Validates that all required fields from template are present in layer.
550
+ * Renames duplicate (case-insensitive) layer names by appending a numeric suffix.
405
551
  */
406
- _validateRequiredFields(e, s) {
407
- const i = new Set(e.requiredFields.map((n) => n.name));
408
- for (const n of s.requiredFields)
409
- i.has(n.name) || this._logIssue(`Layer '${e.name}' is missing required field '${n.name}'.`);
552
+ _dedupeLayerNames(e) {
553
+ const t = /* @__PURE__ */ new Set();
554
+ for (const i of e) {
555
+ const n = (i.name ?? "").toLowerCase();
556
+ if (t.has(n)) {
557
+ const o = i.name;
558
+ i.name = this._makeUniqueName(i.name ?? "Layer", t), this._logAutoFix(`Duplicate layer name '${o}'. Auto-fixed to '${i.name}'.`);
559
+ }
560
+ t.add(i.name.toLowerCase());
561
+ }
410
562
  }
411
563
  /**
412
564
  * Validates a single layer configuration including name, description, and fields.
413
565
  */
414
- _validateLayer(e, s) {
415
- !s && e.typeMutable === !0 && e.type === "Table" && this._logIssue(
566
+ _validateLayer(e, t) {
567
+ !t && e.typeMutable === !0 && e.type === "Table" && (this.newDesign ? (e.type = "Point", this._logAutoFix(`Layer '${e.name}' cannot be a Table. Auto-fixed to 'Point'.`)) : this._logIssue(
416
568
  `Layer '${e.name}' cannot be a Table. It may be a Point, Line, or Polygon.`
417
- );
418
- const i = j(e.name ?? "");
419
- if (i.isValid || this._logIssue(`Layer '${e.name}' name is invalid (${i.errorType}).`), e.description) {
420
- const n = V(e.description, 2048, !0);
421
- n.isValid || this._logIssue(`Layer '${e.name}' description is invalid (${n.errorType}).`);
569
+ ));
570
+ const i = H(e.name ?? "");
571
+ if (i.isValid || this._tryFixName(i.errorType, e.name ?? "", (n) => {
572
+ e.name = n;
573
+ }, `Layer '${e.name}' name`, "Layer Title") || this._logIssue(`Layer '${e.name}' name is invalid (${i.errorType}).`), e.description) {
574
+ const n = J(e.description, b.DESCRIPTION_MAX_LENGTH, !0);
575
+ n.isValid || this._tryFixDescription(e.description, (o) => {
576
+ e.description = o;
577
+ }, `Layer '${e.name}' description`) || this._logIssue(`Layer '${e.name}' description is invalid (${n.errorType}).`);
422
578
  }
423
579
  this._validateLayerFields(e);
424
580
  }
425
581
  /**
426
582
  * Validates all fields in a layer including custom, required, and system fields.
583
+ *
584
+ * Each field is validated individually first, which (among other checks)
585
+ * resolves collisions with reserved system field names. A final pass then
586
+ * ensures custom field names do not collide (case-insensitively) with required
587
+ * field names or one another — auto-fixed via {@link _makeUniqueName} on new
588
+ * designs, otherwise logged.
427
589
  */
428
590
  _validateLayerFields(e) {
429
- const s = /* @__PURE__ */ new Set([
430
- "objectid",
431
- "globalid",
432
- "created_date",
433
- "created_user",
434
- "last_edited_date",
435
- "last_edited_user"
436
- ]), i = e.customFields.map((c) => c.name), n = new Set(e.requiredFields.map((c) => c.name)), o = [...new Set(
437
- i.filter((c) => s.has(c))
438
- )];
439
- for (const c of o)
440
- this._logIssue(`Layer '${e.name}' field '${c}' collides with a reserved system field name.`);
441
- const a = [...new Set(
442
- i.filter((c) => n.has(c))
443
- )];
444
- for (const c of a)
445
- this._logIssue(`Layer '${e.name}' field '${c}' collides with a required field name.`);
446
- if (!o.length && !a.length) {
447
- const c = e.systemFields ?? [], m = [
448
- ...e.customFields,
449
- ...e.requiredFields,
450
- ...c
451
- ].map((h) => h.name);
452
- m.length !== new Set(m).size && this._logIssue(`Layer '${e.name}' has duplicate fields: ${JSON.stringify(m)}.`);
453
- }
454
- const l = e.systemFields ?? [], d = [...e.customFields, ...e.requiredFields, ...l].map((c) => c.name.toLowerCase());
455
- this.fieldNameRegistry = new Set(d);
456
- for (const c of [...e.customFields, ...e.requiredFields])
457
- this._validateField(c);
591
+ const t = e.systemFields ?? [];
592
+ this.fieldNameRegistry = new Set(
593
+ [...e.customFields, ...e.requiredFields, ...t].map((o) => o.name.toLowerCase())
594
+ );
595
+ for (const o of [...e.customFields, ...e.requiredFields])
596
+ this._validateField(o);
458
597
  this.fieldNameRegistry = null;
459
- }
460
- /**
461
- * Generates a unique truncated field name within the 31-character limit.
462
- */
463
- _getUniqueTruncatedFieldName(e) {
464
- const i = this.fieldNameRegistry;
465
- if (!i)
466
- return e.slice(0, 31);
467
- const n = e.toLowerCase();
468
- i.delete(n);
469
- const o = e.slice(0, 31);
470
- let a = o, l = 1;
471
- for (; i.has(a.toLowerCase()); ) {
472
- const d = `_${l}`, c = Math.max(1, 31 - d.length);
473
- a = `${o.slice(0, c)}${d}`, l += 1;
598
+ const i = new Set(e.requiredFields.map((o) => o.name.toLowerCase())), n = new Set(i);
599
+ for (const o of e.customFields) {
600
+ const a = o.name.toLowerCase();
601
+ if (n.has(a)) {
602
+ const r = i.has(a) ? "a required field name" : "another field with the same name";
603
+ if (this.newDesign) {
604
+ const c = o.name;
605
+ o.name = this._makeUniqueName(o.name, n), this._logAutoFix(`Layer '${e.name}' field '${c}' collided with ${r}. Auto-fixed to '${o.name}'.`);
606
+ } else
607
+ this._logIssue(`Layer '${e.name}' field '${o.name}' collides with ${r}.`);
608
+ }
609
+ n.add(o.name.toLowerCase());
474
610
  }
475
- return i.add(a.toLowerCase()), a;
476
611
  }
477
612
  /**
478
613
  * Validates a single field including name, type, length, and domain constraints.
479
614
  */
480
615
  _validateField(e) {
481
- const s = /^\p{L}/u, i = /^.[\p{L}\p{M}\p{N}_]*$/u;
482
- if (e.alias || this._logIssue(`Field '${e.name}' has no display name (alias).`), s.test(e.name) || this._logIssue(`Field '${e.name}' does not start with a letter.`), i.test(e.name) || this._logIssue(
483
- `Field '${e.name}' contains invalid characters (only letters from any writing system, numbers, and underscores are allowed; emojis and punctuation are not allowed).`
484
- ), e.name.length > 31)
616
+ const t = /^\p{L}/u, i = /^.[\p{L}\p{M}\p{N}_]*$/u;
617
+ e.alias || (this.newDesign ? (e.alias = e.name, this._logAutoFix(`Field '${e.name}' had no display name (alias). Auto-fixed to '${e.alias}'.`)) : this._logIssue(`Field '${e.name}' has no display name (alias).`));
618
+ const n = t.test(e.name), o = i.test(e.name);
619
+ if (!n || !o)
485
620
  if (this.newDesign) {
486
- const n = e.name;
487
- e.name = this._getUniqueTruncatedFieldName(e.name), console.debug(`Field '${n}' exceeds 31 characters. Auto-fixing to '${e.name}'.`);
621
+ const a = e.name;
622
+ e.name = this._makeUniqueName(this._sanitizeFieldName(e.name), this.fieldNameRegistry), this.fieldNameRegistry.add(e.name.toLowerCase()), this._logAutoFix(`Field '${a}' had an invalid name. Auto-fixed to '${e.name}'.`);
488
623
  } else
489
- this._logIssue(`Field '${e.name}' exceeds 31 characters.`);
490
- if (Ve.has(e.name.toLowerCase()))
624
+ n || this._logIssue(`Field '${e.name}' does not start with a letter.`), o || this._logIssue(
625
+ `Field '${e.name}' contains invalid characters (only letters from any writing system, numbers, and underscores are allowed; emojis and punctuation are not allowed).`
626
+ );
627
+ if (e.name.length > b.FIELD_NAME_MAX_LENGTH)
491
628
  if (this.newDesign) {
492
- const n = e.name;
493
- e.name = `${n}_`, console.debug(`Field '${n}' is a SQL reserved keyword. Auto-fixing to '${e.name}'.`);
629
+ const a = e.name;
630
+ e.name = this._getUniqueTruncatedFieldName(e.name, this.fieldNameRegistry), this.fieldNameRegistry.add(e.name.toLowerCase()), this._logAutoFix(`Field '${a}' exceeds ${b.FIELD_NAME_MAX_LENGTH} characters. Auto-fixing to '${e.name}'.`);
631
+ } else
632
+ this._logIssue(`Field '${e.name}' exceeds ${b.FIELD_NAME_MAX_LENGTH} characters.`);
633
+ if (Je.has(e.name.toLowerCase()))
634
+ if (this.newDesign) {
635
+ const a = e.name;
636
+ e.name = this._getUniqueTruncatedFieldName(a, this.fieldNameRegistry), this.fieldNameRegistry.add(e.name.toLowerCase()), this._logAutoFix(`Field '${a}' is a SQL reserved keyword. Auto-fixing to '${e.name}'.`);
494
637
  } else
495
638
  this._logIssue(`Field '${e.name}' is a SQL reserved keyword.`);
496
- if (e.type === "string" && this._validateStringFieldLength(e), Array.isArray(e.choiceList) && (e.type !== "string" && this._logIssue(`Field '${e.name}' must be of type 'string' to have a domain.`), e.choiceList.length || this._logIssue(`Field '${e.name}' has an empty domain. At least one value is required.`), e.choiceList.some((n) => !n?.trim()) && this._logIssue(`A blank domain value was added to Field '${e.name}'.`), e.choiceList.length !== new Set(e.choiceList).size && this._logIssue(`Field '${e.name}' has duplicate domain values.`), e.length != null)) {
497
- const n = Math.max(...e.choiceList.map((o) => o.length));
498
- n > e.length && (this.newDesign ? (console.debug(`The choice provided for field '${e.name}' is too long. It must fit within ${e.length} characters, but the choice requires ${n} characters. Auto-fixing to ${n}.`), e.length = n) : this._logIssue(`The choice provided for field '${e.name}' is too long. It must fit within ${e.length} characters, but the choice requires ${n} characters.`));
639
+ if (Ve.has(e.name.toLowerCase()))
640
+ if (this.newDesign) {
641
+ const a = e.name;
642
+ e.name = this._getUniqueTruncatedFieldName(a, this.fieldNameRegistry), this.fieldNameRegistry.add(e.name.toLowerCase()), this._logAutoFix(`Field '${a}' is a reserved system field name. Auto-fixing to '${e.name}'.`);
643
+ } else
644
+ this._logIssue(`Field '${e.name}' is a reserved system field name.`);
645
+ if (Array.isArray(e.choiceList) && e.type !== "string" && (this.newDesign ? e.choiceList.length ? (e.type = "string", this._logAutoFix(`Field '${e.name}' had a domain but was not of type 'string'. Auto-fixed by setting the type to 'string'.`)) : (e.choiceList = null, this._logAutoFix(`Field '${e.name}' had an empty domain but is not of type 'string'. Auto-fixed by removing the domain.`)) : this._logIssue(`Field '${e.name}' must be of type 'string' to have a domain.`)), e.type === "string" && this._validateStringFieldLength(e), Array.isArray(e.choiceList) && (this.newDesign ? this._autoFixChoiceList(e) : this._logChoiceListIssues(e)), Array.isArray(e.choiceList) && e.length != null) {
646
+ const a = Math.max(...e.choiceList.map((r) => r.length));
647
+ a > e.length && (this.newDesign ? (this._logAutoFix(`The choice provided for field '${e.name}' is too long. It must fit within ${e.length} characters, but the choice requires ${a} characters. Auto-fixing to ${a}.`), e.length = a) : this._logIssue(`The choice provided for field '${e.name}' is too long. It must fit within ${e.length} characters, but the choice requires ${a} characters.`));
648
+ }
649
+ }
650
+ /**
651
+ * New-design behavior: removes blank and duplicate domain values, and drops an
652
+ * empty domain entirely.
653
+ */
654
+ _autoFixChoiceList(e) {
655
+ let t = e.choiceList;
656
+ const i = t.filter((o) => o?.trim());
657
+ i.length !== t.length && (this._logAutoFix(`Field '${e.name}' had blank domain values. Auto-fixed by removing them.`), t = i, e.choiceList = t);
658
+ const n = [...new Set(t)];
659
+ n.length !== t.length && (this._logAutoFix(`Field '${e.name}' had duplicate domain values. Auto-fixed by removing duplicates.`), t = n, e.choiceList = t), t.length || (this._logAutoFix(`Field '${e.name}' had an empty domain. Auto-fixed by removing the domain.`), e.choiceList = null);
660
+ }
661
+ /**
662
+ * Legacy behavior: logs domain (choiceList) content issues as validation issues.
663
+ */
664
+ _logChoiceListIssues(e) {
665
+ if (Array.isArray(e.choiceList)) {
666
+ if (!e.choiceList.length) {
667
+ this._logIssue(`Field '${e.name}' has an empty domain. At least one value is required.`);
668
+ return;
669
+ }
670
+ e.choiceList.some((t) => !t?.trim()) && this._logIssue(`A blank domain value was added to Field '${e.name}'.`), e.choiceList.length !== new Set(e.choiceList).size && this._logIssue(`Field '${e.name}' has duplicate domain values.`);
499
671
  }
500
672
  }
501
673
  /**
@@ -507,17 +679,100 @@ class ve {
507
679
  this._handleInvalidStringFieldLength(e, 256);
508
680
  return;
509
681
  }
510
- const s = e.length;
511
- if (!Je(s).isValid) {
512
- const n = s > 4e3 ? 4e3 : 256;
682
+ const t = e.length;
683
+ if (!Ke(t).isValid) {
684
+ const n = t > 4e3 ? 4e3 : 256;
513
685
  this._handleInvalidStringFieldLength(e, n);
514
686
  }
515
687
  }
516
688
  /**
517
689
  * Applies an auto-fix to a string field's length on new designs, or logs an issue on update design.
518
690
  */
519
- _handleInvalidStringFieldLength(e, s) {
520
- this.newDesign ? (console.debug(`Field '${e.name}' has an invalid length. Auto-fixing to ${s}.`), e.length = s) : this._logIssue(`Field '${e.name}' length is invalid (must be a number between 1 and 4000).`);
691
+ _handleInvalidStringFieldLength(e, t) {
692
+ this.newDesign ? (this._logAutoFix(`Field '${e.name}' has an invalid length. Auto-fixing to ${t}.`), e.length = t) : this._logIssue(`Field '${e.name}' length is invalid (must be a number between 1 and 4000).`);
693
+ }
694
+ //--------------------------------------------------------------------------
695
+ //
696
+ // Helpers / Utilities
697
+ //
698
+ //--------------------------------------------------------------------------
699
+ /**
700
+ * Returns a name not present (case-insensitively) in the taken set by appending
701
+ * a numeric suffix when needed.
702
+ */
703
+ _makeUniqueName(e, t) {
704
+ let i = e, n = 1;
705
+ for (; t.has(i.toLowerCase()); )
706
+ i = `${e}_${n}`, n += 1;
707
+ return i;
708
+ }
709
+ /**
710
+ * Returns a field name truncated to the 31-character limit that does not collide
711
+ * (case-insensitively) with the supplied taken set, shortening the base and
712
+ * appending a numeric suffix as needed.
713
+ */
714
+ _getUniqueTruncatedFieldName(e, t) {
715
+ const i = b.FIELD_NAME_MAX_LENGTH, n = e.slice(0, i);
716
+ let o = n, a = 1;
717
+ for (; t.has(o.toLowerCase()); ) {
718
+ const r = `_${a}`, c = Math.max(1, i - r.length);
719
+ o = `${n.slice(0, c)}${r}`, a += 1;
720
+ }
721
+ return o;
722
+ }
723
+ /**
724
+ * Sanitizes an item-style name by stripping emojis and disallowed characters,
725
+ * collapsing whitespace, trimming, and truncating to the name length limit.
726
+ * May return an empty string when no valid characters remain.
727
+ */
728
+ _sanitizeItemName(e, t = b.NAME_MAX_LENGTH) {
729
+ let i = (e ?? "").replace(new RegExp(Qe.source, "gu"), "").replace(b.INVALID_NAME_CHARS, "").replace(/\s+/gu, " ").trim();
730
+ return i.length > t && (i = i.slice(0, t).trim()), i;
731
+ }
732
+ /**
733
+ * Sanitizes a description by stripping the disallowed `<` and `>` characters
734
+ * (forward slash is allowed) and truncating to the description length limit.
735
+ */
736
+ _sanitizeDescription(e, t = b.DESCRIPTION_MAX_LENGTH) {
737
+ let i = (e ?? "").replace(/[<>]/gu, "");
738
+ return i.length > t && (i = i.slice(0, t)), i;
739
+ }
740
+ /**
741
+ * Sanitizes a field name so it starts with a letter and contains only
742
+ * letters, combining marks, numbers, and underscores.
743
+ */
744
+ _sanitizeFieldName(e) {
745
+ let t = (e ?? "").replace(/[^\p{L}\p{M}\p{N}_]/gu, "");
746
+ return t.length === 0 ? t = "field" : /^\p{L}/u.test(t) || (t = `f_${t}`), t;
747
+ }
748
+ /**
749
+ * Attempts to auto-fix an invalid item-style name on new designs. Empty values
750
+ * (or values that sanitize to empty) fall back to the supplied placeholder.
751
+ * Returns true when fixed.
752
+ */
753
+ _tryFixName(e, t, i, n, o) {
754
+ if (!this.newDesign)
755
+ return !1;
756
+ if (e === "empty")
757
+ return i(o), this._logAutoFix(`${n} was empty. Auto-fixed to '${o}'.`), !0;
758
+ const r = this._sanitizeItemName(t) || o;
759
+ return i(r), this._logAutoFix(`${n} was invalid (${e}). Auto-fixed to '${r}'.`), !0;
760
+ }
761
+ /**
762
+ * Attempts to auto-fix an invalid description on new designs. Returns true when fixed.
763
+ */
764
+ _tryFixDescription(e, t, i) {
765
+ if (!this.newDesign)
766
+ return !1;
767
+ const n = this._sanitizeDescription(e);
768
+ return t(n), this._logAutoFix(`${i} was invalid. Auto-fixed to a sanitized value.`), !0;
769
+ }
770
+ /**
771
+ * Records an auto-fix that was applied (new-design only). Auto-fixes are
772
+ * informational: they are logged but do NOT mark validation invalid.
773
+ */
774
+ _logAutoFix(e) {
775
+ console.debug(e);
521
776
  }
522
777
  /**
523
778
  * Records an issue and marks the validation as invalid.
@@ -526,15 +781,15 @@ class ve {
526
781
  console.debug(e), this.issues.push(e), this.isValid = !1;
527
782
  }
528
783
  }
529
- const pt = r.object({
530
- key: r.string().describe("Stable key identifier for the string."),
531
- value: r.string().describe("Display value for the string."),
532
- description: r.string().describe("Explanation of where/how the string is used.")
533
- }), mt = r.object({
534
- id: r.string().describe("ArcGIS item id (32 hex characters)."),
535
- title: r.string().describe("Item title."),
536
- description: r.string().describe("Item description."),
537
- type: r.enum([
784
+ const yt = l.object({
785
+ key: l.string().describe("Stable key identifier for the string."),
786
+ value: l.string().describe("Display value for the string."),
787
+ description: l.string().describe("Explanation of where/how the string is used.")
788
+ }), bt = l.object({
789
+ id: l.string().describe("ArcGIS item id (32 hex characters)."),
790
+ title: l.string().describe("Item title."),
791
+ description: l.string().describe("Item description."),
792
+ type: l.enum([
538
793
  "Feature Layer (hosted)",
539
794
  "Feature Layer (hosted, view)",
540
795
  "Web Map",
@@ -553,81 +808,81 @@ const pt = r.object({
553
808
  "Notebook",
554
809
  "QuickCapture Project"
555
810
  ]).describe("ArcGIS item type.")
556
- }), re = r.object({
557
- name: r.string().describe("Field name."),
558
- type: r.enum(["string", "integer", "double", "date", "oid", "guid", "globalid"]).describe("Field data type."),
559
- alias: r.string().describe("Field alias for display."),
560
- description: r.string().describe("Field description."),
561
- choiceList: r.array(r.string()).nullable().describe(
811
+ }), ue = l.object({
812
+ name: l.string().describe("Field name."),
813
+ type: l.enum(["string", "integer", "double", "date", "oid", "guid", "globalid"]).describe("Field data type."),
814
+ alias: l.string().describe("Field alias for display."),
815
+ description: l.string().describe("Field description."),
816
+ choiceList: l.array(l.string()).nullable().describe(
562
817
  "List of allowed values for string fields with a controlled vocabulary. Null if unrestricted or not applicable."
563
818
  ),
564
- length: r.number().int().nullable().describe("Maximum string length for string fields. Null for non-string fields.")
565
- }), gt = r.object({
566
- id: r.number().int().describe("Layer/table id within the feature service."),
567
- type: r.enum(["Point", "Polyline", "Polygon", "Table"]).describe("Layer type."),
568
- typeMutable: r.boolean().describe("Indicates whether the layer type can be changed."),
569
- name: r.string().describe("Layer/table name."),
570
- description: r.string().describe("Layer/table description."),
571
- customFields: r.array(re).describe("User/business fields specific to the solution."),
572
- requiredFields: r.array(re).describe("Fields required for solution functionality (e.g., relationship keys).")
573
- }), ht = r.object({
574
- itemId: r.string().describe("ArcGIS item id for the feature layer."),
575
- addLayers: r.boolean().describe("Indicates whether new layers can be added during solution design."),
576
- layers: r.array(gt)
577
- }), Y = r.object({
578
- response: r.string().describe("Conversational response to the user's query."),
579
- solution: r.object({
580
- itemId: r.string().nullable().describe("ArcGIS item id of the source Solution template used for deployment. Preserve the existing value exactly when known; otherwise use null."),
581
- title: r.string().describe("Title of the solution."),
582
- description: r.string().describe("Description of the solution."),
583
- tags: r.array(r.string()).describe("Keywords/tags associated with the solution."),
584
- strings: r.array(pt).describe("Localized strings/labels used by apps (dashboards, forms, etc.).")
819
+ length: l.number().int().nullable().describe("Maximum string length for string fields. Null for non-string fields.")
820
+ }), xt = l.object({
821
+ id: l.number().int().describe("Layer/table id within the feature service."),
822
+ type: l.enum(["Point", "Polyline", "Polygon", "Table"]).describe("Layer type."),
823
+ typeMutable: l.boolean().describe("Indicates whether the layer type can be changed."),
824
+ name: l.string().describe("Layer/table name."),
825
+ description: l.string().describe("Layer/table description."),
826
+ customFields: l.array(ue).describe("User/business fields specific to the solution."),
827
+ requiredFields: l.array(ue).describe("Fields required for solution functionality (e.g., relationship keys).")
828
+ }), vt = l.object({
829
+ itemId: l.string().describe("ArcGIS item id for the feature layer."),
830
+ addLayers: l.boolean().describe("Indicates whether new layers can be added during solution design."),
831
+ layers: l.array(xt)
832
+ }), Z = l.object({
833
+ response: l.string().describe("Conversational response to the user's query."),
834
+ solution: l.object({
835
+ itemId: l.string().nullable().describe("ArcGIS item id of the source Solution template used for deployment. Preserve the existing value exactly when known; otherwise use null."),
836
+ title: l.string().describe("Title of the solution."),
837
+ description: l.string().describe("Description of the solution."),
838
+ tags: l.array(l.string()).describe("Keywords/tags associated with the solution."),
839
+ strings: l.array(yt).describe("Localized strings/labels used by apps (dashboards, forms, etc.).")
585
840
  }),
586
- items: r.array(mt).describe("ArcGIS items that belong to the solution (apps, maps, layers, etc.)."),
587
- featureLayer: ht.describe("Primary feature layer item and its schema/layers/tables details.")
588
- }), ft = r.object({
589
- op: r.enum(["add", "remove", "replace", "move", "copy"]).describe("RFC 6902 operation type."),
590
- path: r.string().describe("RFC 6901 JSON Pointer to the target location."),
591
- value: r.string().nullable().describe(`JSON-encoded value to apply (required for add and replace). Must be null — not an empty string — for remove, move, and copy operations. Serialize as a JSON string, e.g. '\\"text\\"' for a string, '[\\"a\\",\\"b\\"]' for an array, or '{\\"name\\":\\"x\\"}' for an object.`),
592
- from: r.string().nullable().describe("RFC 6901 JSON Pointer to the source location (required for move and copy). Must be null — not an empty string — for all other operations.")
593
- }), bt = r.object({
594
- response: r.string().describe("Conversational response describing the accepted design changes."),
595
- patches: r.array(ft).describe("Minimal RFC 6902 patch operations needed to update the current design.")
596
- }), yt = r.object({
597
- response: r.string().describe("Short, user-friendly explanation of why the requested update was not applied.")
598
- }), vt = r.object({
599
- assistantResponse: r.string().describe("Natural-language response for the user."),
600
- isValidUpdate: r.boolean().describe("True only when the request is in scope for supported design updates.")
601
- }), xt = r.object({
602
- matchedTitles: r.array(r.string()).describe("Titles of solutions that match the user's request. Empty array if no strong match.")
603
- }), wt = r.object({
604
- templateId: r.string().min(1).describe("Template id from the available template list."),
605
- confidence: r.number().min(0).max(1).describe("Confidence score from 0 to 1 for this template match."),
606
- templateDescription: r.string().min(1).describe("Short action‑oriented description of the template in the user's use case/workflow, starting with a verb.")
607
- }), St = r.object({
608
- assistantResponse: r.string().nullable().describe("Natural-language response for the user."),
609
- isValidUseCase: r.boolean().describe("True only when the request is concrete, appropriate, and has at least one matching template."),
610
- matchedTemplates: r.array(wt).describe("Ordered list of matching templates, best match first. Empty when no valid match exists.")
611
- }), _t = (t) => t.length ? t.map((e, s) => `${s + 1}. ${e}`).join(`
612
- `) : "No validation errors were provided.", It = async (t) => {
841
+ items: l.array(bt).describe("ArcGIS items that belong to the solution (apps, maps, layers, etc.)."),
842
+ featureLayer: vt.describe("Primary feature layer item and its schema/layers/tables details.")
843
+ }), wt = l.object({
844
+ op: l.enum(["add", "remove", "replace", "move", "copy"]).describe("RFC 6902 operation type."),
845
+ path: l.string().describe("RFC 6901 JSON Pointer to the target location."),
846
+ value: l.string().nullable().describe(`JSON-encoded value to apply (required for add and replace). Must be null — not an empty string — for remove, move, and copy operations. Serialize as a JSON string, e.g. '\\"text\\"' for a string, '[\\"a\\",\\"b\\"]' for an array, or '{\\"name\\":\\"x\\"}' for an object.`),
847
+ from: l.string().nullable().describe("RFC 6901 JSON Pointer to the source location (required for move and copy). Must be null — not an empty string — for all other operations.")
848
+ }), _t = l.object({
849
+ response: l.string().describe("Conversational response describing the accepted design changes."),
850
+ patches: l.array(wt).describe("Minimal RFC 6902 patch operations needed to update the current design.")
851
+ }), St = l.object({
852
+ response: l.string().describe("Short, user-friendly explanation of why the requested update was not applied.")
853
+ }), It = l.object({
854
+ assistantResponse: l.string().describe("Natural-language response for the user."),
855
+ isValidUpdate: l.boolean().describe("True only when the request is in scope for supported design updates.")
856
+ }), At = l.object({
857
+ matchedTitles: l.array(l.string()).describe("Titles of solutions that match the user's request. Empty array if no strong match.")
858
+ }), Ct = l.object({
859
+ templateId: l.string().min(1).describe("Template id from the available template list."),
860
+ confidence: l.number().min(0).max(1).describe("Confidence score from 0 to 1 for this template match."),
861
+ templateDescription: l.string().min(1).describe("Short action‑oriented description of the template in the user's use case/workflow, starting with a verb.")
862
+ }), Tt = l.object({
863
+ assistantResponse: l.string().nullable().describe("Natural-language response for the user."),
864
+ isValidUseCase: l.boolean().describe("True only when the request is concrete, appropriate, and has at least one matching template."),
865
+ matchedTemplates: l.array(Ct).describe("Ordered list of matching templates, best match first. Empty when no valid match exists.")
866
+ }), Et = (s) => s.length ? s.map((e, t) => `${t + 1}. ${e}`).join(`
867
+ `) : "No validation errors were provided.", Lt = async (s) => {
613
868
  const {
614
869
  query: e,
615
- validationIssues: s,
870
+ validationIssues: t,
616
871
  recentMessages: i,
617
872
  fallbackMessage: n,
618
873
  promptModules: o
619
- } = t;
874
+ } = s;
620
875
  try {
621
- return (await C({
876
+ return (await We({
622
877
  promptText: await v(o, "explainValidationFailure"),
623
878
  modelTier: "fast",
624
879
  temperature: 0,
625
- schema: yt,
880
+ schema: St,
626
881
  messages: i,
627
882
  inputVariables: {
628
883
  query: e,
629
- validationIssueCount: String(s.length),
630
- validationIssues: _t(s)
884
+ validationIssueCount: String(t.length),
885
+ validationIssues: Et(t)
631
886
  }
632
887
  })).response?.trim() || n;
633
888
  } catch (a) {
@@ -636,55 +891,55 @@ const pt = r.object({
636
891
  { error: a }
637
892
  ), n;
638
893
  }
639
- }, X = (t) => t in F, Ct = 5, Tt = 0.8, kt = 0.5, At = "Web Mapping Application", Et = "Embeddings";
640
- let N = null, J = null, M = null, B = null;
641
- const Lt = "Build", E = /* @__PURE__ */ Object.assign({
642
- "./prompts/assessBuildRequest.md": () => import("../../chunks/assessBuildRequest.js").then((t) => t.default),
643
- "./prompts/assessUpdateRequest.md": () => import("../../chunks/assessUpdateRequest.js").then((t) => t.default),
644
- "./prompts/description.md": () => import("../../chunks/description2.js").then((t) => t.default),
645
- "./prompts/designSolution.md": () => import("../../chunks/designSolution.js").then((t) => t.default),
646
- "./prompts/explainValidationFailure.md": () => import("../../chunks/explainValidationFailure.js").then((t) => t.default),
647
- "./prompts/findExistingSolution.md": () => import("../../chunks/findExistingSolution.js").then((t) => t.default),
648
- "./prompts/updateDesign.md": () => import("../../chunks/updateDesign.js").then((t) => t.default)
649
- }), $t = ut.builderMessages, g = (t) => t?.configurable?.abortSignal?.aborted ?? !1, b = (t, e, s) => q(e)?.builderMessages?.[t] ?? $t[t], xe = (t) => {
894
+ }, ee = (s) => s in F, $t = 5, kt = 0.8, Nt = 0.5, Ft = "Web Mapping Application", Dt = "Embeddings";
895
+ let R = null, V = null, B = null, P = null;
896
+ const Mt = "Build", L = /* @__PURE__ */ Object.assign({
897
+ "./prompts/assessBuildRequest.md": () => import("../../chunks/assessBuildRequest.js").then((s) => s.default),
898
+ "./prompts/assessUpdateRequest.md": () => import("../../chunks/assessUpdateRequest.js").then((s) => s.default),
899
+ "./prompts/description.md": () => import("../../chunks/description2.js").then((s) => s.default),
900
+ "./prompts/designSolution.md": () => import("../../chunks/designSolution.js").then((s) => s.default),
901
+ "./prompts/explainValidationFailure.md": () => import("../../chunks/explainValidationFailure.js").then((s) => s.default),
902
+ "./prompts/findExistingSolution.md": () => import("../../chunks/findExistingSolution.js").then((s) => s.default),
903
+ "./prompts/updateDesign.md": () => import("../../chunks/updateDesign.js").then((s) => s.default)
904
+ }), Rt = ft.builderMessages, m = (s) => s?.signal?.aborted ?? !1, f = (s, e, t) => U(e)?.builderMessages?.[s] ?? Rt[s], _e = (s) => {
650
905
  typeof window < "u" && window.dispatchEvent(new CustomEvent("arcgis-solution-design-update", {
651
- detail: t
906
+ detail: s
652
907
  }));
653
- }, Ft = async (t, e, s) => {
654
- if (!t) return null;
655
- const i = `type:"${At}" AND typekeywords:${Et} AND group:${t}`;
656
- return (await K.searchItems({
908
+ }, Bt = async (s, e, t) => {
909
+ if (!s) return null;
910
+ const i = `type:"${Ft}" AND typekeywords:${Dt} AND group:${s}`;
911
+ return (await Y.searchItems({
657
912
  q: i,
658
913
  params: e ? { token: e } : void 0,
659
- portal: s,
914
+ portal: t,
660
915
  num: 1
661
916
  }))?.results?.[0] ?? null;
662
917
  };
663
- async function Rt(t, e, s, i) {
918
+ async function Pt(s, e, t, i) {
664
919
  try {
665
- const n = await Ft(t, e, s);
666
- if (!n || g(i))
920
+ const n = await Bt(s, e, t);
921
+ if (!n || m(i))
667
922
  return null;
668
- const o = new Qe({ id: n.id });
669
- return await o.load(), g(i) ? null : await o.fetchData("json");
923
+ const o = new Ye({ id: n.id });
924
+ return await o.load(), m(i) ? null : await o.fetchData("json");
670
925
  } catch {
671
926
  return null;
672
927
  }
673
928
  }
674
- const Dt = async (t, e, s) => {
675
- if (!t) return [];
676
- const i = `type:Solution AND typekeywords:${Lt} AND group:${t}`;
677
- return (await K.searchItems({
929
+ const qt = async (s, e, t) => {
930
+ if (!s) return [];
931
+ const i = `type:Solution AND typekeywords:${Mt} AND group:${s}`;
932
+ return (await Y.searchItems({
678
933
  q: i,
679
934
  params: e ? { token: e } : void 0,
680
- portal: s,
935
+ portal: t,
681
936
  num: 100
682
937
  }))?.results ?? [];
683
- }, Nt = async (t, e, s) => {
938
+ }, Ut = async (s, e, t) => {
684
939
  try {
685
- const i = await K.getItemData(t, {
940
+ const i = await Y.getItemData(s, {
686
941
  params: e ? { token: e } : void 0,
687
- portal: s
942
+ portal: t
688
943
  }), n = i?.buildSolution;
689
944
  if (!n) return null;
690
945
  const o = i?.params, a = o && typeof o == "object" && !Array.isArray(o) ? o : null;
@@ -692,438 +947,438 @@ const Dt = async (t, e, s) => {
692
947
  } catch {
693
948
  return null;
694
949
  }
695
- }, L = (t, e = {}) => {
696
- let s = t;
697
- return "itemId" in e && (s = {
698
- ...s,
950
+ }, $ = (s, e = {}) => {
951
+ let t = s;
952
+ return "itemId" in e && (t = {
953
+ ...t,
699
954
  solution: {
700
- ...s.solution,
955
+ ...t.solution,
701
956
  itemId: e.itemId ?? null
702
957
  }
703
- }), e.sourceBuildSolution != null && (s = {
704
- ...s,
958
+ }), e.sourceBuildSolution != null && (t = {
959
+ ...t,
705
960
  sourceBuildSolution: e.sourceBuildSolution
706
- }), "params" in e && (s = {
707
- ...s,
961
+ }), "params" in e && (t = {
962
+ ...t,
708
963
  params: e.params ?? null
709
- }), "templateId" in e && (s = {
710
- ...s,
964
+ }), "templateId" in e && (t = {
965
+ ...t,
711
966
  templateId: e.templateId ?? null
712
- }), s;
713
- }, we = (t, e) => {
714
- if (t == null || e == null)
967
+ }), t;
968
+ }, Se = (s, e) => {
969
+ if (s == null || e == null)
715
970
  return { ok: !1, error: "design or sourceBuildSolution is null/undefined" };
716
971
  try {
717
- const s = structuredClone(e);
718
- return new ce({ buildSolution: s }).applyLlmTemplate(t), { ok: !0 };
719
- } catch (s) {
972
+ const t = structuredClone(e);
973
+ return new pe({ buildSolution: t }).applyLlmTemplate(s), { ok: !0 };
974
+ } catch (t) {
720
975
  return {
721
976
  ok: !1,
722
- error: s instanceof Error ? s.stack ?? s.message : String(s)
977
+ error: t instanceof Error ? t.stack ?? t.message : String(t)
723
978
  };
724
979
  }
725
- }, Z = async (t) => {
726
- if (J) {
727
- Object.entries(J).forEach(([a, l]) => {
728
- F[a] && (F[a].initialTemplate = l);
980
+ }, te = async (s) => {
981
+ if (V) {
982
+ Object.entries(V).forEach(([a, r]) => {
983
+ F[a] && (F[a].initialTemplate = r);
729
984
  });
730
985
  return;
731
986
  }
732
- const e = t?.configurable?.context?.token, s = _e(t), i = Ie(t);
733
- if (!s) {
987
+ const e = s?.configurable?.context?.token, t = Ae(s), i = Ce(s);
988
+ if (!t) {
734
989
  console.warn("Solution Builder: missing primarySolutionsGroupId in appConfig; skipping live template hydration.");
735
990
  return;
736
991
  }
737
- const n = await Dt(s, e, i), o = {};
738
- g(t) || (await Promise.all(n.map(async (a) => {
739
- const l = a.properties?.templateInfo;
740
- if (!l || typeof l != "object") return;
741
- const d = l.id;
742
- if (typeof d != "string" || o[d]) return;
743
- const c = await Nt(a.id, e, i);
744
- if (!c || g(t))
992
+ const n = await qt(t, e, i), o = {};
993
+ m(s) || (await Promise.all(n.map(async (a) => {
994
+ const r = a.properties?.templateInfo;
995
+ if (!r || typeof r != "object") return;
996
+ const c = r.id;
997
+ if (typeof c != "string" || o[c]) return;
998
+ const d = await Ut(a.id, e, i);
999
+ if (!d || m(s))
745
1000
  return;
746
- const { buildSolution: m, params: h } = c;
747
- if (typeof m == "object" && m !== null && "solution" in m) {
748
- const f = m.solution;
749
- f.thumbnailUrl = a.thumbnail ? `${i ?? "https://www.arcgis.com/sharing/rest"}/content/items/${a.id}/info/${a.thumbnail}` : void 0, f.item = a;
1001
+ const { buildSolution: h, params: y } = d;
1002
+ if (typeof h == "object" && h !== null && "solution" in h) {
1003
+ const g = h.solution;
1004
+ g.thumbnailUrl = a.thumbnail ? `${i ?? "https://www.arcgis.com/sharing/rest"}/content/items/${a.id}/info/${a.thumbnail}` : void 0, g.item = a;
750
1005
  }
751
1006
  const u = {
752
- ...l,
753
- buildSolution: m
1007
+ ...r,
1008
+ buildSolution: h
754
1009
  };
755
- o[d] = L(
756
- new ce(u).dumpToLlmTemplate(),
1010
+ o[c] = $(
1011
+ new pe(u).dumpToLlmTemplate(),
757
1012
  {
758
1013
  itemId: a.id,
759
- sourceBuildSolution: structuredClone(m),
760
- params: h ? structuredClone(h) : null
1014
+ sourceBuildSolution: structuredClone(h),
1015
+ params: y ? structuredClone(y) : null
761
1016
  }
762
- ), F[d] = {
763
- ...l,
764
- initialTemplate: o[d]
1017
+ ), F[c] = {
1018
+ ...r,
1019
+ initialTemplate: o[c]
765
1020
  };
766
- })), J = o);
767
- }, Se = (t) => {
768
- const e = t?.configurable?.context?.token;
1021
+ })), V = o);
1022
+ }, Ie = (s) => {
1023
+ const e = s?.configurable?.context?.token;
769
1024
  return typeof e != "string" || !e.trim() ? null : e;
770
- }, _e = (t) => {
771
- const e = t?.configurable?.context?.configContext?.primarySolutionsGroupId;
1025
+ }, Ae = (s) => {
1026
+ const e = s?.configurable?.context?.configContext?.primarySolutionsGroupId;
772
1027
  return typeof e != "string" || !e.trim() ? null : e;
773
- }, Ie = (t) => {
774
- const e = t?.configurable?.context?.configContext?.portalURL;
1028
+ }, Ce = (s) => {
1029
+ const e = s?.configurable?.context?.configContext?.portalURL;
775
1030
  if (!(typeof e != "string" || !e.trim()))
776
1031
  return `${e.replace(/\/+$/, "")}/sharing/rest`;
777
- }, Mt = async (t) => {
1032
+ }, Ot = async (s) => {
778
1033
  await Promise.all([
779
- Te(t),
780
- Z(t)
1034
+ Ee(s),
1035
+ te(s)
781
1036
  ]);
782
- }, Ce = async (t) => {
783
- const e = Se(t);
784
- (!M || e && e !== B) && (B = e ?? B, M = Mt(t).catch((i) => {
785
- throw M = null, B = null, i;
786
- })), await M;
1037
+ }, Te = async (s) => {
1038
+ const e = Ie(s);
1039
+ (!B || e && e !== P) && (P = e ?? P, B = Ot(s).catch((i) => {
1040
+ throw B = null, P = null, i;
1041
+ })), await B;
787
1042
  };
788
- async function Te(t) {
789
- if (N) return N;
790
- const e = _e(t);
1043
+ async function Ee(s) {
1044
+ if (R) return R;
1045
+ const e = Ae(s);
791
1046
  if (!e)
792
1047
  return console.warn("Solution Builder: missing primarySolutionsGroupId in appConfig; skipping embeddings load."), null;
793
- const s = Ie(t), i = t?.configurable?.context?.configContext?.portalURL;
794
- if (await new Ge(i ? { url: i } : void 0).load(), g(t))
1048
+ const t = Ce(s), i = s?.configurable?.context?.configContext?.portalURL;
1049
+ if (await new Xe(i ? { url: i } : void 0).load(), m(s))
795
1050
  return null;
796
- const o = Se(t) ?? void 0, a = await Rt(e, o, s, t);
797
- return g(t) ? null : a ? (N = a.items, N) : null;
1051
+ const o = Ie(s) ?? void 0, a = await Pt(e, o, t, s);
1052
+ return m(s) ? null : a ? (R = a.items, R) : null;
798
1053
  }
799
- const Bt = () => Object.entries(F).map(([t, e]) => `ID: ${t}
1054
+ const zt = () => Object.entries(F).map(([s, e]) => `ID: ${s}
800
1055
  Label: ${e.label}
801
1056
  Description: ${e.description}`).join(`
802
1057
 
803
- `), Pt = (t) => {
804
- const e = t?.configurable?.context?.solutionDesignJson;
1058
+ `), jt = (s) => {
1059
+ const e = s?.configurable?.context?.solutionDesignJson;
805
1060
  if (typeof e != "string" || !e.trim())
806
1061
  return null;
807
1062
  try {
808
- const s = JSON.parse(e), i = L(
809
- { response: "", ...s },
810
- { itemId: s?.solution?.itemId ?? null }
811
- ), n = Y.safeParse(i);
1063
+ const t = JSON.parse(e), i = $(
1064
+ { response: "", ...t },
1065
+ { itemId: t?.solution?.itemId ?? null }
1066
+ ), n = Z.safeParse(i);
812
1067
  if (!n.success)
813
1068
  return null;
814
- const { response: o, ...a } = n.data, l = s.templateId, d = typeof l == "string" && X(l) ? l : null;
815
- return L(
1069
+ const { response: o, ...a } = n.data, r = t.templateId, c = typeof r == "string" && ee(r) ? r : null;
1070
+ return $(
816
1071
  a,
817
1072
  {
818
- sourceBuildSolution: s.sourceBuildSolution,
819
- templateId: d,
820
- params: s.params ?? null
1073
+ sourceBuildSolution: t.sourceBuildSolution,
1074
+ templateId: c,
1075
+ params: t.params ?? null
821
1076
  }
822
1077
  );
823
1078
  } catch {
824
1079
  return null;
825
1080
  }
826
- }, qt = y.Root({
827
- ...W(),
1081
+ }, Gt = x.Root({
1082
+ ...X(),
828
1083
  /** Optional human-readable template description retained for UI use. */
829
- templateDescription: y({
830
- reducer: (t, e) => typeof e == "string" || e === null ? e : t ?? null,
1084
+ templateDescription: x({
1085
+ reducer: (s, e) => typeof e == "string" || e === null ? e : s ?? null,
831
1086
  default: () => null
832
1087
  }),
833
1088
  /** Current editable design payload being refined across turns. */
834
- currentDesign: y({
835
- reducer: (t = null, e) => e === void 0 ? t : e ?? null,
1089
+ currentDesign: x({
1090
+ reducer: (s = null, e) => e === void 0 ? s : e ?? null,
836
1091
  default: () => null
837
1092
  }),
838
1093
  /** Initial request assessment produced by the intake prompt. */
839
- assessment: y({
840
- reducer: (t = null, e) => e === void 0 ? t : e ?? null,
1094
+ assessment: x({
1095
+ reducer: (s = null, e) => e === void 0 ? s : e ?? null,
841
1096
  default: () => null
842
1097
  }),
843
1098
  /** Template selected automatically or by human-in-the-loop choice. */
844
- selectedTemplate: y({
845
- reducer: (t = null, e) => e === void 0 ? t : e ?? null,
1099
+ selectedTemplate: x({
1100
+ reducer: (s = null, e) => e === void 0 ? s : e ?? null,
846
1101
  default: () => null
847
1102
  }),
848
1103
  /** Update request assessment produced when an active design exists. */
849
- updateAssessment: y({
850
- reducer: (t = null, e) => e === void 0 ? t : e ?? null,
1104
+ updateAssessment: x({
1105
+ reducer: (s = null, e) => e === void 0 ? s : e ?? null,
851
1106
  default: () => null
852
1107
  }),
853
1108
  /** Existing solution matches surfaced before building a new solution. */
854
- existingMatches: y({
855
- reducer: (t = [], e) => e === void 0 ? t : e ?? [],
1109
+ existingMatches: x({
1110
+ reducer: (s = [], e) => e === void 0 ? s : e ?? [],
856
1111
  default: () => []
857
1112
  }),
858
1113
  /** User decision for whether to continue building after existing matches are shown. */
859
- continueBuilding: y({
860
- reducer: (t = null, e) => e === void 0 ? t : e ?? null,
1114
+ continueBuilding: x({
1115
+ reducer: (s = null, e) => e === void 0 ? s : e ?? null,
861
1116
  default: () => null
862
1117
  })
863
- }), Ut = (t, e) => {
864
- if (g(e))
1118
+ }), Ht = (s, e) => {
1119
+ if (m(e))
865
1120
  return {};
866
- const s = Pt(e), i = s?.templateId ?? null, n = {};
867
- return JSON.stringify(t.currentDesign) !== JSON.stringify(s) && (n.currentDesign = s), i && t.selectedTemplate !== i && (n.selectedTemplate = i), n;
868
- }, Ot = async (t, e) => {
869
- if (g(e))
1121
+ const t = jt(e), i = t?.templateId ?? null, n = {};
1122
+ return JSON.stringify(s.currentDesign) !== JSON.stringify(t) && (n.currentDesign = t), i && s.selectedTemplate !== i && (n.selectedTemplate = i), n;
1123
+ }, Jt = async (s, e) => {
1124
+ if (m(e))
870
1125
  return {};
871
- await w({ text: b("understandingRequest", e) }, e), await Ce(e);
872
- const s = t.agentExecutionContext.userRequest, i = Bt(), n = t.agentExecutionContext.messages.slice(-11), o = await C({
873
- promptText: await v(E, "assessBuildRequest"),
1126
+ await _({ text: f("understandingRequest", e) }, e), await Te(e);
1127
+ const t = s.agentExecutionContext.userRequest, i = zt(), n = s.agentExecutionContext.messages.slice(-11), o = await k({
1128
+ promptText: await v(L, "assessBuildRequest"),
874
1129
  modelTier: "advanced",
875
1130
  temperature: 0,
876
- schema: St,
1131
+ schema: Tt,
877
1132
  messages: n,
878
- inputVariables: { query: s, availableTemplates: i }
1133
+ inputVariables: { query: t, availableTemplates: i }
879
1134
  }), a = o.matchedTemplates.filter(
880
- (u) => X(u.templateId)
881
- ), l = {
1135
+ (u) => ee(u.templateId)
1136
+ ), r = {
882
1137
  ...o,
883
1138
  matchedTemplates: a
884
- }, [d, c] = a, h = !!d && d.confidence >= Tt && (c === void 0 || d.confidence - c.confidence >= kt) ? d.templateId : null;
1139
+ }, [c, d] = a, y = !!c && c.confidence >= kt && (d === void 0 || c.confidence - d.confidence >= Nt) ? c.templateId : null;
885
1140
  return {
886
- assessment: l,
887
- selectedTemplate: h,
1141
+ assessment: r,
1142
+ selectedTemplate: y,
888
1143
  existingMatches: [],
889
1144
  continueBuilding: null
890
1145
  };
891
- }, zt = (t) => {
892
- const e = t.assessment?.assistantResponse ?? "";
1146
+ }, Vt = (s) => {
1147
+ const e = s.assessment?.assistantResponse ?? "";
893
1148
  return {
894
1149
  outputMessage: e,
895
1150
  summary: e,
896
1151
  status: "success"
897
1152
  };
898
- }, jt = async (t, e) => {
899
- if (g(e))
1153
+ }, Qt = async (s, e) => {
1154
+ if (m(e))
900
1155
  return {};
901
- const { currentDesign: s } = t;
902
- if (!s)
1156
+ const { currentDesign: t } = s;
1157
+ if (!t)
903
1158
  return {
904
1159
  updateAssessment: {
905
1160
  assistantResponse: "",
906
1161
  isValidUpdate: !0
907
1162
  }
908
1163
  };
909
- await w({ text: b("understandingRequest", e) }, e);
910
- const i = t.agentExecutionContext.userRequest, n = t.agentExecutionContext.messages.slice(-11);
1164
+ await _({ text: f("understandingRequest", e) }, e);
1165
+ const i = s.agentExecutionContext.userRequest, n = s.agentExecutionContext.messages.slice(-11);
911
1166
  return {
912
- updateAssessment: await C({
913
- promptText: await v(E, "assessUpdateRequest"),
1167
+ updateAssessment: await k({
1168
+ promptText: await v(L, "assessUpdateRequest"),
914
1169
  modelTier: "advanced",
915
1170
  temperature: 0,
916
- schema: vt,
1171
+ schema: It,
917
1172
  messages: n,
918
1173
  inputVariables: {
919
- currentDesign: JSON.stringify(de(s)),
1174
+ currentDesign: JSON.stringify(me(t)),
920
1175
  query: i
921
1176
  }
922
1177
  })
923
1178
  };
924
- }, Vt = (t, e) => {
925
- const s = t.updateAssessment?.assistantResponse ?? b("applyChangeFailed", e);
1179
+ }, Kt = (s, e) => {
1180
+ const t = s.updateAssessment?.assistantResponse ?? f("applyChangeFailed", e);
926
1181
  return {
927
- outputMessage: s,
928
- summary: s,
1182
+ outputMessage: t,
1183
+ summary: t,
929
1184
  status: "success"
930
1185
  };
931
- }, Jt = (t, e) => {
932
- if (g(e))
1186
+ }, Wt = (s, e) => {
1187
+ if (m(e))
933
1188
  return {};
934
- const { hitlResponse: s } = e.configurable, i = "selectTemplate", n = t.assessment?.matchedTemplates.filter(
935
- (c) => X(c.templateId)
936
- ) ?? [], o = n.map((c) => `${c.templateDescription}`);
937
- if (s?.agentId !== "solutionBuilder" || s.id !== i) {
938
- const c = {
1189
+ const { hitlResponse: t } = e.configurable, i = "selectTemplate", n = s.assessment?.matchedTemplates.filter(
1190
+ (d) => ee(d.templateId)
1191
+ ) ?? [], o = n.map((d) => `${d.templateDescription}`);
1192
+ if (t?.agentId !== "solutionBuilder" || t.id !== i) {
1193
+ const d = {
939
1194
  agentId: "solutionBuilder",
940
1195
  id: i,
941
1196
  kind: "singleSelection",
942
- message: b("selectTemplatePrompt", e),
1197
+ message: f("selectTemplatePrompt", e),
943
1198
  metadata: [...o]
944
1199
  };
945
- throw new le(c);
1200
+ throw new de(d);
946
1201
  }
947
- const a = String(s.payload ?? ""), l = o.findIndex((c) => c === a);
1202
+ const a = String(t.payload ?? ""), r = o.findIndex((d) => d === a);
948
1203
  return {
949
- selectedTemplate: (l >= 0 ? n[l] : void 0)?.templateId ?? n[0]?.templateId ?? null
1204
+ selectedTemplate: (r >= 0 ? n[r] : void 0)?.templateId ?? n[0]?.templateId ?? null
950
1205
  };
951
- }, Gt = async (t, e) => {
952
- if (g(e))
1206
+ }, Xt = async (s, e) => {
1207
+ if (m(e))
953
1208
  return {};
954
- await w({ text: b("searchingExistingSolutions", e) }, e);
955
- const s = t.agentExecutionContext.userRequest, i = ct(t.agentExecutionContext.messages) || s, n = await Te(e);
956
- if (g(e))
1209
+ await _({ text: f("searchingExistingSolutions", e) }, e);
1210
+ const t = s.agentExecutionContext.userRequest, i = ht(s.agentExecutionContext.messages) || t, n = await Ee(e);
1211
+ if (m(e))
957
1212
  return {};
958
1213
  if (!n)
959
1214
  return console.warn("Solutions Search: failed to load solution embeddings cache; skipping search."), { existingMatches: [] };
960
1215
  if (!n.length)
961
1216
  return { existingMatches: [] };
962
- const [o] = await Ue([i]);
963
- if (g(e))
1217
+ const [o] = await ze([i]);
1218
+ if (m(e))
964
1219
  return {};
965
1220
  const a = n.map((u) => ({
966
1221
  solution: u,
967
- score: Oe(o, u.embedding)
1222
+ score: je(o, u.embedding)
968
1223
  }));
969
- a.sort((u, f) => f.score - u.score);
970
- const l = a.slice(0, Ct);
971
- if (!l.length)
1224
+ a.sort((u, g) => g.score - u.score);
1225
+ const r = a.slice(0, $t);
1226
+ if (!r.length)
972
1227
  return { existingMatches: [] };
973
- const d = l.map(({ solution: u }) => `${u.title}
1228
+ const c = r.map(({ solution: u }) => `${u.title}
974
1229
  Snippet: ${u.snippet}
975
1230
  Description: ${u.description}`).join(`
976
1231
 
977
- `), c = t.agentExecutionContext.messages.slice(-11);
978
- return { existingMatches: (await C({
979
- promptText: await v(E, "findExistingSolution"),
1232
+ `), d = s.agentExecutionContext.messages.slice(-11);
1233
+ return { existingMatches: (await k({
1234
+ promptText: await v(L, "findExistingSolution"),
980
1235
  modelTier: "fast",
981
1236
  temperature: 0,
982
- schema: xt,
983
- messages: c,
984
- inputVariables: { query: s, candidates: d }
985
- })).matchedTitles.map((u) => l.find(({ solution: f }) => f.title === u)).filter((u) => u !== void 0) };
986
- }, Qt = (t, e) => {
987
- if (g(e))
1237
+ schema: At,
1238
+ messages: d,
1239
+ inputVariables: { query: t, candidates: c }
1240
+ })).matchedTitles.map((u) => r.find(({ solution: g }) => g.title === u)).filter((u) => u !== void 0) };
1241
+ }, Yt = (s, e) => {
1242
+ if (m(e))
988
1243
  return {};
989
- const { existingMatches: s } = t, { hitlResponse: i } = e.configurable, n = `confirmExistingSolution:${s[0].solution.id}`;
1244
+ const { existingMatches: t } = s, { hitlResponse: i } = e.configurable, n = `confirmExistingSolution:${t[0].solution.id}`;
990
1245
  if (i?.agentId !== "solutionBuilder" || i.id !== n) {
991
- s.length === 1 ? ge(s[0].solution.id) : me(s);
992
- const d = b("existingSolutionMatch", e), c = [
993
- b("continueBuildingYes", e),
994
- b("continueBuildingNo", e)
995
- ], m = {
1246
+ t.length === 1 ? ye(t[0].solution.id) : fe(t);
1247
+ const c = f("existingSolutionMatch", e), d = [
1248
+ f("continueBuildingYes", e),
1249
+ f("continueBuildingNo", e)
1250
+ ], h = {
996
1251
  agentId: "solutionBuilder",
997
1252
  id: n,
998
1253
  kind: "singleSelection",
999
- message: d,
1000
- metadata: c
1254
+ message: c,
1255
+ metadata: d
1001
1256
  };
1002
- throw new le(m);
1257
+ throw new de(h);
1003
1258
  }
1004
- const o = String(i.payload ?? "").trim(), a = b("continueBuildingNo", e);
1259
+ const o = String(i.payload ?? "").trim(), a = f("continueBuildingNo", e);
1005
1260
  return { continueBuilding: o !== a };
1006
- }, Ht = (t, e) => {
1007
- const s = b("continueBuildingDeclined", e);
1261
+ }, Zt = (s, e) => {
1262
+ const t = f("continueBuildingDeclined", e);
1008
1263
  return {
1009
- outputMessage: s,
1010
- summary: s,
1264
+ outputMessage: t,
1265
+ summary: t,
1011
1266
  status: "success"
1012
1267
  };
1013
- }, ke = async (t, e) => {
1014
- if (g(e))
1268
+ }, Le = async (s, e) => {
1269
+ if (m(e))
1015
1270
  return {};
1016
- if (await Ce(e), g(e))
1271
+ if (await Te(e), m(e))
1017
1272
  return {};
1018
- const { currentDesign: s } = t, i = t.agentExecutionContext.userRequest;
1019
- await w({ text: b("creatingDesign", e) }, e);
1020
- let n = P(t.selectedTemplate);
1021
- if (n?.initialTemplate || (await Z(e), n = P(t.selectedTemplate)), g(e))
1273
+ const { currentDesign: t } = s, i = s.agentExecutionContext.userRequest;
1274
+ await _({ text: f("creatingDesign", e) }, e);
1275
+ let n = q(s.selectedTemplate);
1276
+ if (n?.initialTemplate || (await te(e), n = q(s.selectedTemplate)), m(e))
1022
1277
  return {};
1023
1278
  if (!n?.initialTemplate)
1024
1279
  throw new Error("No hydrated templates are available for solution design.");
1025
- const o = L(
1026
- s ?? n.initialTemplate,
1280
+ const o = $(
1281
+ t ?? n.initialTemplate,
1027
1282
  {
1028
- itemId: (s ?? n.initialTemplate)?.solution?.itemId ?? null,
1029
- sourceBuildSolution: s?.sourceBuildSolution ?? n.initialTemplate.sourceBuildSolution,
1030
- params: s?.params ?? n.initialTemplate.params ?? null
1283
+ itemId: (t ?? n.initialTemplate)?.solution?.itemId ?? null,
1284
+ sourceBuildSolution: t?.sourceBuildSolution ?? n.initialTemplate.sourceBuildSolution,
1285
+ params: t?.params ?? n.initialTemplate.params ?? null
1031
1286
  }
1032
- ), a = t.agentExecutionContext.messages.slice(-11), l = await C({
1033
- promptText: await v(E, "designSolution"),
1287
+ ), a = s.agentExecutionContext.messages.slice(-11), r = await k({
1288
+ promptText: await v(L, "designSolution"),
1034
1289
  modelTier: "advanced",
1035
1290
  temperature: 0,
1036
- schema: Y,
1291
+ schema: Z,
1037
1292
  messages: a,
1038
1293
  inputVariables: {
1039
- currentDesign: JSON.stringify(ue(o)),
1294
+ currentDesign: JSON.stringify(he(o)),
1040
1295
  templateInstructions: n.instructions,
1041
1296
  query: i
1042
1297
  }
1043
1298
  });
1044
- if (await w({ text: " of design solution 1" }, e), g(e))
1299
+ if (await _({ text: " of design solution 1" }, e), m(e))
1045
1300
  return {};
1046
- const { response: d, featureLayer: c, ...m } = l, h = pe(
1047
- c,
1301
+ const { response: c, featureLayer: d, ...h } = r, y = ge(
1302
+ d,
1048
1303
  o.featureLayer
1049
- ), u = L(
1050
- { ...m, featureLayer: h },
1304
+ ), u = $(
1305
+ { ...h, featureLayer: y },
1051
1306
  {
1052
1307
  itemId: o?.solution?.itemId,
1053
1308
  sourceBuildSolution: o.sourceBuildSolution,
1054
- templateId: t.selectedTemplate ?? null,
1309
+ templateId: s.selectedTemplate ?? null,
1055
1310
  params: o.params ?? null
1056
1311
  }
1057
- ), f = new ve(u, n.initialTemplate);
1058
- if (!f.isValid)
1312
+ ), g = new b(u, n.initialTemplate);
1313
+ if (!g.isValid)
1059
1314
  return console.warn(
1060
1315
  "[SolutionBuilder] designSolution validation failed:",
1061
- { issues: f.issues, llmResponse: l }
1316
+ { issues: g.issues, llmResponse: r }
1062
1317
  ), {
1063
- outputMessage: b("createDesignFailed", e)
1318
+ outputMessage: f("createDesignFailed", e)
1064
1319
  };
1065
- const S = u.sourceBuildSolution, $ = we(u, S);
1066
- if (!$.ok) {
1320
+ const S = u.sourceBuildSolution, N = Se(u, S);
1321
+ if (!N.ok) {
1067
1322
  console.warn(
1068
1323
  "[SolutionBuilder] designSolution Esri JSON conversion failed:",
1069
- { error: $.error, llmResponse: l, design: u }
1324
+ { error: N.error, llmResponse: r, design: u }
1070
1325
  );
1071
- const T = b("createDesignFailed", e);
1326
+ const C = f("createDesignFailed", e);
1072
1327
  return {
1073
- outputMessage: T,
1074
- summary: T,
1328
+ outputMessage: C,
1329
+ summary: C,
1075
1330
  status: "success"
1076
1331
  };
1077
1332
  }
1078
- return g(e) ? {} : (xe(u), {
1079
- outputMessage: d,
1080
- summary: d,
1333
+ return m(e) ? {} : (_e(u), {
1334
+ outputMessage: c,
1335
+ summary: c,
1081
1336
  status: "success",
1082
1337
  currentDesign: u
1083
1338
  });
1084
- }, Wt = async (t, e) => {
1085
- if (g(e))
1339
+ }, es = async (s, e) => {
1340
+ if (m(e))
1086
1341
  return {};
1087
- const { currentDesign: s } = t;
1088
- if (!s)
1089
- return ke(t, e);
1090
- const i = t.agentExecutionContext.userRequest, n = t.agentExecutionContext.messages.slice(-11);
1091
- await w({ text: b("updatingDesign", e) }, e);
1342
+ const { currentDesign: t } = s;
1343
+ if (!t)
1344
+ return Le(s, e);
1345
+ const i = s.agentExecutionContext.userRequest, n = s.agentExecutionContext.messages.slice(-11);
1346
+ await _({ text: f("updatingDesign", e) }, e);
1092
1347
  let o;
1093
1348
  try {
1094
- o = await C({
1095
- promptText: await v(E, "updateDesign"),
1349
+ o = await k({
1350
+ promptText: await v(L, "updateDesign"),
1096
1351
  modelTier: "advanced",
1097
1352
  temperature: 0,
1098
- schema: bt,
1353
+ schema: _t,
1099
1354
  messages: n,
1100
1355
  inputVariables: {
1101
- currentDesign: JSON.stringify(de(s)),
1356
+ currentDesign: JSON.stringify(me(t)),
1102
1357
  query: i
1103
1358
  }
1104
1359
  });
1105
1360
  } catch (p) {
1106
1361
  console.warn("[SolutionBuilder] updateDesign structured prompt failed:", p);
1107
- const x = b("applyChangeFailed", e);
1362
+ const w = f("applyChangeFailed", e);
1108
1363
  return {
1109
- outputMessage: x,
1110
- summary: x,
1364
+ outputMessage: w,
1365
+ summary: w,
1111
1366
  status: "success"
1112
1367
  };
1113
1368
  }
1114
- const { response: a, patches: l } = o;
1115
- if (!l || l.length === 0)
1369
+ const { response: a, patches: r } = o;
1370
+ if (!r || r.length === 0)
1116
1371
  return {
1117
1372
  outputMessage: a,
1118
1373
  summary: a,
1119
1374
  status: "success"
1120
1375
  };
1121
- const d = (p) => {
1376
+ const c = (p) => {
1122
1377
  try {
1123
1378
  return JSON.parse(p);
1124
1379
  } catch {
1125
- const x = p.replace(/[\u0000-\u001F]/g, (ie) => {
1126
- switch (ie) {
1380
+ const w = p.replace(/[\u0000-\u001F]/g, (oe) => {
1381
+ switch (oe) {
1127
1382
  case "\b":
1128
1383
  return "\\b";
1129
1384
  case "\f":
@@ -1136,82 +1391,82 @@ Description: ${u.description}`).join(`
1136
1391
  case " ":
1137
1392
  return "\\t";
1138
1393
  default:
1139
- return "\\u" + ie.charCodeAt(0).toString(16).padStart(4, "0");
1394
+ return "\\u" + oe.charCodeAt(0).toString(16).padStart(4, "0");
1140
1395
  }
1141
1396
  });
1142
1397
  try {
1143
- return JSON.parse(x);
1398
+ return JSON.parse(w);
1144
1399
  } catch {
1145
1400
  return p;
1146
1401
  }
1147
1402
  }
1148
- }, m = [...l.map((p) => ({
1403
+ }, h = [...r.map((p) => ({
1149
1404
  op: p.op,
1150
1405
  path: p.path.replace(/\/+$/, ""),
1151
- ...p.value != null && p.value !== "" ? { value: d(p.value) } : {},
1406
+ ...p.value != null && p.value !== "" ? { value: c(p.value) } : {},
1152
1407
  ...p.from != null && p.from !== "" ? { from: p.from } : {}
1153
- }))].sort((p, x) => p.op !== "remove" || x.op !== "remove" ? 0 : x.path.localeCompare(p.path, void 0, { numeric: !0 })), h = structuredClone(
1154
- ue(s)
1408
+ }))].sort((p, w) => p.op !== "remove" || w.op !== "remove" ? 0 : w.path.localeCompare(p.path, void 0, { numeric: !0 })), y = structuredClone(
1409
+ he(t)
1155
1410
  );
1156
1411
  try {
1157
- je(h, m, !0);
1412
+ He(y, h, !0);
1158
1413
  } catch (p) {
1159
1414
  console.warn(
1160
1415
  "[SolutionBuilder] updateDesign JSON patch failed:",
1161
- { error: p, llmResponse: o, patches: m, patchTarget: h }
1416
+ { error: p, llmResponse: o, patches: h, patchTarget: y }
1162
1417
  );
1163
- const x = b("applyChangeFailed", e);
1418
+ const w = f("applyChangeFailed", e);
1164
1419
  return {
1165
- outputMessage: x,
1166
- summary: x,
1420
+ outputMessage: w,
1421
+ summary: w,
1167
1422
  status: "success"
1168
1423
  };
1169
1424
  }
1170
- const u = L(
1171
- { response: "", ...h },
1172
- { itemId: s.solution?.itemId ?? null }
1173
- ), f = Y.safeParse(u);
1174
- if (!f.success) {
1425
+ const u = $(
1426
+ { response: "", ...y },
1427
+ { itemId: t.solution?.itemId ?? null }
1428
+ ), g = Z.safeParse(u);
1429
+ if (!g.success) {
1175
1430
  console.warn(
1176
1431
  "[SolutionBuilder] updateDesign schema validation failed:",
1177
- { errors: f.error.issues, llmResponse: o, patchedDesign: u }
1432
+ { errors: g.error.issues, llmResponse: o, patchedDesign: u }
1178
1433
  );
1179
- const p = b("applyChangeFailed", e);
1434
+ const p = f("applyChangeFailed", e);
1180
1435
  return {
1181
1436
  outputMessage: p,
1182
1437
  summary: p,
1183
1438
  status: "success"
1184
1439
  };
1185
1440
  }
1186
- const { response: S, featureLayer: $, ...T } = f.data, U = pe(
1187
- $,
1188
- s.featureLayer
1189
- ), _ = L(
1190
- { ...T, featureLayer: U },
1441
+ const { response: S, featureLayer: N, ...C } = g.data, z = ge(
1442
+ N,
1443
+ t.featureLayer
1444
+ ), I = $(
1445
+ { ...C, featureLayer: z },
1191
1446
  {
1192
- itemId: s.solution?.itemId,
1193
- sourceBuildSolution: s.sourceBuildSolution,
1194
- templateId: s.templateId ?? t.selectedTemplate ?? null,
1195
- params: s.params ?? null
1447
+ itemId: t.solution?.itemId,
1448
+ sourceBuildSolution: t.sourceBuildSolution,
1449
+ templateId: t.templateId ?? s.selectedTemplate ?? null,
1450
+ params: t.params ?? null
1196
1451
  }
1197
1452
  );
1198
- let R = P(t.selectedTemplate);
1199
- if (R?.initialTemplate || (await Z(e), R = P(t.selectedTemplate)), g(e))
1453
+ let D = q(s.selectedTemplate);
1454
+ if (D?.initialTemplate || (await te(e), D = q(s.selectedTemplate)), m(e))
1200
1455
  return {};
1201
- if (!R?.initialTemplate)
1456
+ if (!D?.initialTemplate)
1202
1457
  throw new Error("No hydrated templates are available for solution design.");
1203
- const O = new ve(_, R.initialTemplate, !1);
1204
- if (!O.isValid) {
1458
+ const j = new b(I, D.initialTemplate, !1);
1459
+ if (!j.isValid) {
1205
1460
  console.warn(
1206
1461
  "[SolutionBuilder] updateDesign validation failed:",
1207
- { issues: O.issues, llmResponse: o, patchedDesign: _ }
1462
+ { issues: j.issues, llmResponse: o, patchedDesign: I }
1208
1463
  );
1209
- const p = await It({
1464
+ const p = await Lt({
1210
1465
  query: i,
1211
- validationIssues: O.issues,
1466
+ validationIssues: j.issues,
1212
1467
  recentMessages: n,
1213
- fallbackMessage: b("applyChangeFailed", e),
1214
- promptModules: E
1468
+ fallbackMessage: f("applyChangeFailed", e),
1469
+ promptModules: L
1215
1470
  });
1216
1471
  return {
1217
1472
  outputMessage: p,
@@ -1219,151 +1474,153 @@ Description: ${u.description}`).join(`
1219
1474
  status: "success"
1220
1475
  };
1221
1476
  }
1222
- const Ee = _.sourceBuildSolution, se = we(_, Ee);
1223
- if (!se.ok) {
1477
+ const ke = I.sourceBuildSolution, ne = Se(I, ke);
1478
+ if (!ne.ok) {
1224
1479
  console.warn(
1225
1480
  "[SolutionBuilder] updateDesign Esri JSON conversion failed:",
1226
- { error: se.error, llmResponse: o, design: _ }
1481
+ { error: ne.error, llmResponse: o, design: I }
1227
1482
  );
1228
- const p = b("applyChangeFailed", e);
1483
+ const p = f("applyChangeFailed", e);
1229
1484
  return {
1230
1485
  outputMessage: p,
1231
1486
  summary: p,
1232
1487
  status: "success"
1233
1488
  };
1234
1489
  }
1235
- return g(e) ? {} : (xe(_), {
1490
+ return m(e) ? {} : (_e(I), {
1236
1491
  outputMessage: a,
1237
1492
  summary: a,
1238
1493
  status: "success",
1239
- currentDesign: _
1494
+ currentDesign: I
1240
1495
  });
1241
- }, Kt = (t) => t.currentDesign !== null ? "assessUpdateRequest" : "assessBuildRequest", Yt = (t) => !t.updateAssessment || !t.updateAssessment.isValidUpdate ? "invalidUpdateExit" : "updateDesign", Xt = (t) => !t.assessment || !t.assessment.isValidUseCase ? "invalidBuildExit" : !t.selectedTemplate && t.assessment.matchedTemplates.length > 1 ? "selectTemplateHIL" : "findExistingSolutions", Zt = (t) => t.existingMatches.length > 0 ? "confirmContinueBuildingHIL" : "designSolution", es = (t) => t.continueBuilding === !1 ? "declineContinueBuildingExit" : "designSolution", ts = () => new Q(qt).addNode("syncCurrentDesignFromContext", Ut).addNode("assessBuildRequest", Ot).addNode("assessUpdateRequest", jt).addNode("invalidBuildExit", zt).addNode("invalidUpdateExit", Vt).addNode("selectTemplateHIL", Jt).addNode("findExistingSolutions", Gt).addNode("confirmContinueBuildingHIL", Qt).addNode("declineContinueBuildingExit", Ht).addNode("designSolution", ke).addNode("updateDesign", Wt).addEdge(H, "syncCurrentDesignFromContext").addConditionalEdges("syncCurrentDesignFromContext", Kt, {
1496
+ }, ts = (s) => s.currentDesign !== null ? "assessUpdateRequest" : "assessBuildRequest", ss = (s) => !s.updateAssessment || !s.updateAssessment.isValidUpdate ? "invalidUpdateExit" : "updateDesign", is = (s) => !s.assessment || !s.assessment.isValidUseCase ? "invalidBuildExit" : !s.selectedTemplate && s.assessment.matchedTemplates.length > 1 ? "selectTemplateHIL" : "findExistingSolutions", ns = (s) => s.existingMatches.length > 0 ? "confirmContinueBuildingHIL" : "designSolution", os = (s) => s.continueBuilding === !1 ? "declineContinueBuildingExit" : "designSolution", as = () => new K(Gt).addNode("syncCurrentDesignFromContext", Ht).addNode("assessBuildRequest", Jt).addNode("assessUpdateRequest", Qt).addNode("invalidBuildExit", Vt).addNode("invalidUpdateExit", Kt).addNode("selectTemplateHIL", Wt).addNode("findExistingSolutions", Xt).addNode("confirmContinueBuildingHIL", Yt).addNode("declineContinueBuildingExit", Zt).addNode("designSolution", Le).addNode("updateDesign", es).addEdge(W, "syncCurrentDesignFromContext").addConditionalEdges("syncCurrentDesignFromContext", ts, {
1242
1497
  assessUpdateRequest: "assessUpdateRequest",
1243
1498
  assessBuildRequest: "assessBuildRequest"
1244
- }).addConditionalEdges("assessUpdateRequest", Yt, {
1499
+ }).addConditionalEdges("assessUpdateRequest", ss, {
1245
1500
  invalidUpdateExit: "invalidUpdateExit",
1246
1501
  updateDesign: "updateDesign"
1247
- }).addConditionalEdges("assessBuildRequest", Xt, {
1502
+ }).addConditionalEdges("assessBuildRequest", is, {
1248
1503
  invalidBuildExit: "invalidBuildExit",
1249
1504
  selectTemplateHIL: "selectTemplateHIL",
1250
1505
  findExistingSolutions: "findExistingSolutions"
1251
- }).addEdge("invalidBuildExit", I).addEdge("invalidUpdateExit", I).addEdge("selectTemplateHIL", "findExistingSolutions").addConditionalEdges("findExistingSolutions", Zt, {
1506
+ }).addEdge("invalidBuildExit", A).addEdge("invalidUpdateExit", A).addEdge("selectTemplateHIL", "findExistingSolutions").addConditionalEdges("findExistingSolutions", ns, {
1252
1507
  confirmContinueBuildingHIL: "confirmContinueBuildingHIL",
1253
1508
  designSolution: "designSolution"
1254
- }).addConditionalEdges("confirmContinueBuildingHIL", es, {
1509
+ }).addConditionalEdges("confirmContinueBuildingHIL", os, {
1255
1510
  declineContinueBuildingExit: "declineContinueBuildingExit",
1256
1511
  designSolution: "designSolution"
1257
- }).addEdge("declineContinueBuildingExit", I).addEdge("designSolution", I).addEdge("updateDesign", I);
1258
- await v(E, "description");
1259
- const ss = A.object({
1260
- tool: A.enum(["explorer", "builder", "other"]).describe("The selected tool based on the user's query."),
1261
- confidence: A.number().min(0).max(1).describe("A confidence score (0.00–1.00)."),
1262
- rationale: A.string().min(1).describe("A brief rationale for the tool choice (≤140 characters)")
1263
- }), ee = /* @__PURE__ */ Object.assign({
1264
- "./prompts/assistantResponse.md": () => import("../../chunks/assistantResponse.js").then((t) => t.default),
1265
- "./prompts/classifyIntent.md": () => import("../../chunks/classifyIntent.js").then((t) => t.default),
1266
- "./prompts/description.md": () => import("../../chunks/description.js").then((t) => t.default)
1267
- }), te = (t, e) => {
1268
- const s = t?.configurable?.context?.setLastTurnAgent;
1269
- typeof s == "function" && s(e);
1512
+ }).addEdge("declineContinueBuildingExit", A).addEdge("designSolution", A).addEdge("updateDesign", A);
1513
+ await v(L, "description");
1514
+ const rs = E.object({
1515
+ tool: E.enum(["explorer", "builder", "other"]).describe("The selected tool based on the users intent using the conversation context."),
1516
+ confidence: E.number().min(0).max(1).describe("A confidence score (0.00–1.00)."),
1517
+ rationale: E.string().min(1).describe("A brief rationale for the tool choice (≤140 characters)")
1518
+ }), O = (s) => s?.signal?.aborted ?? !1, se = /* @__PURE__ */ Object.assign({
1519
+ "./prompts/assistantResponse.md": () => import("../../chunks/assistantResponse.js").then((s) => s.default),
1520
+ "./prompts/classifyIntent.md": () => import("../../chunks/classifyIntent.js").then((s) => s.default),
1521
+ "./prompts/description.md": () => import("../../chunks/description.js").then((s) => s.default)
1522
+ }), ls = (s) => {
1523
+ const e = s?.configurable?.context?.solutionDesignJson, t = s?.configurable?.context?.lastTurnAgent, i = t === "assistant" ? "other" : t;
1524
+ let n = !1;
1525
+ if (typeof e == "string" && e.trim())
1526
+ try {
1527
+ n = JSON.parse(e).solution != null;
1528
+ } catch {
1529
+ n = !1;
1530
+ }
1531
+ return { activeSolutionDesign: n, lastTool: i };
1532
+ }, ie = (s, e) => {
1533
+ const t = s?.configurable?.context?.setLastTurnAgent;
1534
+ typeof t == "function" && t(e);
1270
1535
  const i = new CustomEvent("assistantProcessing", {
1271
1536
  detail: { finished: !0, agent: e }
1272
1537
  });
1273
1538
  window.dispatchEvent(i);
1274
- }, Ae = y.Root({
1275
- ...W(),
1276
- selectedTool: y({
1277
- reducer: (t, e) => e ?? null,
1539
+ }, $e = x.Root({
1540
+ ...X(),
1541
+ selectedTool: x({
1542
+ reducer: (s, e) => e ?? null,
1278
1543
  default: () => null
1279
1544
  }),
1280
- intentRationale: y({
1281
- reducer: (t, e) => e ?? null,
1545
+ intentRationale: x({
1546
+ reducer: (s, e) => e ?? null,
1282
1547
  default: () => null
1283
1548
  })
1284
- }), is = async (t, e) => {
1285
- if (e?.configurable?.abortSignal?.aborted)
1549
+ }), cs = async (s, e) => {
1550
+ if (O(e))
1286
1551
  return {};
1287
- const s = q(e);
1288
- await w(
1289
- { text: s?.builderMessages.understandingRequest },
1552
+ const t = U(e);
1553
+ await _(
1554
+ { text: t?.builderMessages.understandingRequest },
1290
1555
  e
1291
1556
  );
1292
- const i = t.agentExecutionContext.userRequest, n = t.agentExecutionContext.messages.slice(-11), o = e?.configurable?.context?.solutionDesignJson;
1293
- let a = !1;
1294
- if (typeof o == "string" && o.trim())
1295
- try {
1296
- a = JSON.parse(o).solution != null;
1297
- } catch {
1298
- a = !1;
1299
- }
1300
- const l = await v(ee, "classifyIntent"), d = await C({
1301
- promptText: l,
1557
+ const i = s.agentExecutionContext.userRequest, n = s.agentExecutionContext.messages.slice(-11), { activeSolutionDesign: o, lastTool: a } = ls(e), r = await v(se, "classifyIntent"), c = await k({
1558
+ promptText: r,
1302
1559
  modelTier: "advanced",
1303
1560
  temperature: 0,
1304
- schema: ss,
1561
+ schema: rs,
1305
1562
  messages: n,
1306
- inputVariables: { query: i, activeSolutionDesign: a }
1563
+ inputVariables: { query: i, activeSolutionDesign: o, lastTool: a }
1307
1564
  });
1308
1565
  return {
1309
- selectedTool: d.tool,
1310
- intentRationale: d.rationale
1566
+ selectedTool: c.tool,
1567
+ intentRationale: c.rationale
1311
1568
  };
1312
- }, ns = async (t, e) => {
1313
- if (e?.configurable?.abortSignal?.aborted)
1569
+ }, us = async (s, e) => {
1570
+ if (O(e))
1314
1571
  return {};
1315
- const i = await it().compile().invoke(t, e);
1316
- return te(e, "explorer"), i;
1317
- }, as = async (t, e) => {
1318
- if (e?.configurable?.abortSignal?.aborted)
1572
+ const i = await lt().compile().invoke(s, e);
1573
+ return ie(e, "explorer"), i;
1574
+ }, ds = async (s, e) => {
1575
+ if (O(e))
1319
1576
  return {};
1320
- const i = await ts().compile().invoke(t, e);
1321
- return te(e, "builder"), i;
1322
- }, os = async (t, e) => {
1323
- if (e?.configurable?.abortSignal?.aborted)
1577
+ const i = await as().compile().invoke(s, e);
1578
+ return ie(e, "builder"), i;
1579
+ }, ps = async (s, e) => {
1580
+ if (O(e))
1324
1581
  return {};
1325
- const s = q(e), i = t.agentExecutionContext.userRequest, n = t.intentRationale ?? "No rationale available.";
1326
- await w(
1327
- { text: s?.executingSolutionsAssistantAgent },
1582
+ const t = U(e), i = s.agentExecutionContext.userRequest, n = s.intentRationale ?? "No rationale available.";
1583
+ await _(
1584
+ { text: t?.executingSolutionsAssistantAgent },
1328
1585
  e
1329
1586
  );
1330
- const o = await v(ee, "assistantResponse"), a = t.agentExecutionContext.messages.slice(-11), l = await ze({
1587
+ const o = await v(se, "assistantResponse"), a = s.agentExecutionContext.messages.slice(-11), r = await Ge({
1331
1588
  promptText: o,
1332
1589
  modelTier: "advanced",
1333
1590
  temperature: 0,
1334
1591
  messages: a,
1335
1592
  inputVariables: { query: i, rationale: n }
1336
1593
  });
1337
- return te(e, "assistant"), {
1338
- outputMessage: l,
1339
- summary: l,
1594
+ return ie(e, "assistant"), {
1595
+ outputMessage: r,
1596
+ summary: r,
1340
1597
  status: "success"
1341
1598
  };
1342
- }, rs = (t) => t.selectedTool ?? "other", ls = () => new Q(Ae).addNode("classifyIntent", is).addNode("routeToExplorer", ns).addNode("routeToBuilder", as).addNode("assistantResponse", os).addEdge(H, "classifyIntent").addConditionalEdges("classifyIntent", rs, {
1599
+ }, ms = (s) => s.selectedTool ?? "other", hs = () => new K($e).addNode("classifyIntent", cs).addNode("routeToExplorer", us).addNode("routeToBuilder", ds).addNode("assistantResponse", ps).addEdge(W, "classifyIntent").addConditionalEdges("classifyIntent", ms, {
1343
1600
  explorer: "routeToExplorer",
1344
1601
  builder: "routeToBuilder",
1345
1602
  other: "assistantResponse"
1346
- }).addEdge("routeToExplorer", I).addEdge("routeToBuilder", I).addEdge("assistantResponse", I), cs = await v(ee, "description"), ds = {
1603
+ }).addEdge("routeToExplorer", A).addEdge("routeToBuilder", A).addEdge("assistantResponse", A), gs = await v(se, "description"), fs = {
1347
1604
  id: "solutionsAssistant",
1348
1605
  name: "Solutions Assistant Agent",
1349
- description: cs,
1350
- createGraph: ls,
1351
- workspace: Ae
1352
- }, us = "https://links.esri.com/solutions/agol-organizational-account", ps = "https://links.esri.com/solutions/configure-assistants";
1353
- class ms extends Fe {
1606
+ description: gs,
1607
+ createGraph: hs,
1608
+ workspace: $e
1609
+ }, ys = "https://links.esri.com/solutions/agol-organizational-account", bs = "https://links.esri.com/solutions/configure-assistants";
1610
+ class xs extends De {
1354
1611
  constructor() {
1355
1612
  super(), this.open = !1, this.userFirstName = "", this.builderVisible = !1, this.hasActiveBuilderDesign = !1, this._conversationId = void 0, this._lastTurnAgent = void 0, this._orgSettings = {
1356
1613
  aiAssistantsEnabled: !1,
1357
1614
  blockBetaApps: !0,
1358
1615
  colocateCompute: !1
1359
- }, this._suggestedPrompts = [], this._hasInteracted = !1, this._isMobile = window.innerWidth <= 800, this._translations = $e({ name: "arcgis-solutions-assistant", blocking: !0 }), this._builderWidth = 48, this._solutionDesignJson = '{ "solution": null }', this._isAssistantBusy = !1, this._isBuilderBusy = !1, this._preChatCheck = !1, this._showNewChatConfirm = !1, this._assistantRef = Pe(), this._configContextConsumer = oe({
1360
- context: Ne,
1616
+ }, this._suggestedPrompts = [], this._hasInteracted = !1, this._isMobile = window.innerWidth <= 800, this._translations = Fe({ name: "arcgis-solutions-assistant", blocking: !0 }), this._builderWidth = 48, this._solutionDesignJson = '{ "solution": null }', this._isAssistantBusy = !1, this._isBuilderBusy = !1, this._preChatCheck = !1, this._showNewChatConfirm = !1, this._assistantRef = Ue(), this._configContextConsumer = le({
1617
+ context: Be,
1361
1618
  subscribe: !0,
1362
1619
  callback: (e) => {
1363
- e?.portalURL && (z.portalUrl = e.portalURL), e?.userSession && !this.userFirstName && this._loadUserFirstName(), e?.authentication?.PortalSubset?.orgSettings && (this._orgSettings = e?.authentication?.PortalSubset?.orgSettings);
1620
+ e?.portalURL && (G.portalUrl = e.portalURL), e?.userSession && !this.userFirstName && this._loadUserFirstName(), e?.authentication?.PortalSubset?.orgSettings && (this._orgSettings = e?.authentication?.PortalSubset?.orgSettings);
1364
1621
  }
1365
- }), this._builderDesignContextConsumer = oe({
1366
- context: Me,
1622
+ }), this._builderDesignContextConsumer = le({
1623
+ context: Pe,
1367
1624
  subscribe: !0,
1368
1625
  callback: (e) => {
1369
1626
  e?.design && (this._solutionDesignJson = JSON.stringify(e.design, null, 2));
@@ -1371,24 +1628,24 @@ class ms extends Fe {
1371
1628
  }), this._handleResize = () => {
1372
1629
  this._isMobile = window.innerWidth <= 800;
1373
1630
  }, this._chatStartTime = null, this._handleAssistantProcessingFinished = (e) => {
1374
- const s = e;
1375
- if (s.detail?.finished && this._chatStartTime !== null) {
1376
- const i = Be(this._chatStartTime);
1631
+ const t = e;
1632
+ if (t.detail?.finished && this._chatStartTime !== null) {
1633
+ const i = qe(this._chatStartTime);
1377
1634
  this._telemetry?.logEvent({
1378
- category: D.ASSISTANT,
1635
+ category: M.ASSISTANT,
1379
1636
  action: "Chat",
1380
- dimensions: [s.detail.agent],
1637
+ dimensions: [t.detail.agent],
1381
1638
  metrics: [i]
1382
- }), this._chatStartTime = null, this.assistantProcessing.emit(!1);
1639
+ }), this._chatStartTime = null;
1383
1640
  }
1384
- }, this.closeAssistant = ne(), this.assistantProcessing = ne(), this._handleAssistantLinkClick = (e) => {
1385
- const s = e.composedPath().find((i) => i instanceof HTMLAnchorElement);
1386
- if (s?.href)
1387
- if (e.preventDefault(), s.target.indexOf("solutionId:") > -1) {
1388
- const i = s.target.split("solutionId:")[1];
1641
+ }, this.closeAssistant = ae(), this.assistantProcessing = ae(), this._handleAssistantLinkClick = (e) => {
1642
+ const t = e.composedPath().find((i) => i instanceof HTMLAnchorElement);
1643
+ if (t?.href)
1644
+ if (e.preventDefault(), t.target.indexOf("solutionId:") > -1) {
1645
+ const i = t.target.split("solutionId:")[1];
1389
1646
  this._emitItemIdFromAI(i);
1390
1647
  } else
1391
- window.open(s.href, "_blank", "noopener,noreferrer");
1648
+ window.open(t.href, "_blank", "noopener,noreferrer");
1392
1649
  }, this._onSolutionDesignUpdate = (e) => {
1393
1650
  const i = e.detail;
1394
1651
  this._solutionDesignJson = i ? JSON.stringify(i, null, 2) : '{ "solution": null }';
@@ -1397,8 +1654,8 @@ class ms extends Fe {
1397
1654
  }, this._checkURLOpenParameter = () => {
1398
1655
  this.open = this._configContextConsumer.value?.authentication?.SignInParam === "aiOpen" || this.open;
1399
1656
  }, this.listenOn(window, "arcgisFeedback", (e) => {
1400
- const s = e.detail, { agentPicked: i, taskAssigned: n, userMessage: o } = this._parseAgentPickedAndTask(s);
1401
- this._sendFeedback(s.content, o ?? n ?? "", s.feedback?.positive ? "Good" : s.feedback?.positive == "Bad" ? "Bad" : "N/A", i ?? "");
1657
+ const t = e.detail, { agentPicked: i, taskAssigned: n, userMessage: o } = this._parseAgentPickedAndTask(t);
1658
+ this._sendFeedback(t.content, o ?? n ?? "", t.feedback?.positive ? "Good" : t.feedback?.positive == "Bad" ? "Bad" : "N/A", i ?? "");
1402
1659
  }), this.listenOn(window, "clearAssistantConversation", () => {
1403
1660
  this._clearConversation();
1404
1661
  });
@@ -1407,7 +1664,7 @@ class ms extends Fe {
1407
1664
  this.properties = { open: 5, userFirstName: 1, builderVisible: 5, hasActiveBuilderDesign: 5, _conversationId: 16, _lastTurnAgent: 16, _orgSettings: 16, _suggestedPrompts: 16, _hasInteracted: 16, _isMobile: 16, _translations: 16, _builderWidth: 16, _solutionDesignJson: 16, _isAssistantBusy: 16, _isBuilderBusy: 16, _preChatCheck: 16, _showNewChatConfirm: 16 };
1408
1665
  }
1409
1666
  static {
1410
- this.styles = He;
1667
+ this.styles = Ze;
1411
1668
  }
1412
1669
  get _telemetry() {
1413
1670
  return this._configContextConsumer.value?.telemetrySession;
@@ -1422,39 +1679,41 @@ class ms extends Fe {
1422
1679
  this._checkURLOpenParameter();
1423
1680
  }
1424
1681
  load() {
1425
- z.applicationName = "Solutions", this._configContextConsumer.value?.portalURL && (z.portalUrl = this._configContextConsumer.value.portalURL);
1682
+ G.applicationName = "Solutions", this._configContextConsumer.value?.portalURL && (G.portalUrl = this._configContextConsumer.value.portalURL);
1426
1683
  }
1427
1684
  firstUpdated(e) {
1428
1685
  this._loadUserFirstName();
1429
1686
  }
1430
1687
  willUpdate(e) {
1431
- e.has("open") && this.open && window.dispatchEvent(new CustomEvent("openAssistant")), this._configContextConsumer.value?.authentication && this._configContextConsumer.value?.userSession?.token && (this._preChatCheck || (be(this._configContextConsumer.value?.authentication.Portal, this._configContextConsumer.value?.userSession?.token, this._configContextConsumer.value?.locale ?? "en"), this._preChatCheck = !0)), this._configContextConsumer.value?.userSession?.token && this._configContextConsumer.value?.authentication?.CanUseAI;
1688
+ e.has("open") && this.open && window.dispatchEvent(new CustomEvent("openAssistant")), this._configContextConsumer.value?.authentication && this._configContextConsumer.value?.userSession?.token && (this._preChatCheck || (ve(this._configContextConsumer.value?.authentication.Portal, this._configContextConsumer.value?.userSession?.token, this._configContextConsumer.value?.locale ?? "en"), this._preChatCheck = !0)), this._configContextConsumer.value?.userSession?.token && this._configContextConsumer.value?.authentication?.CanUseAI;
1432
1689
  }
1433
1690
  _renderNoSign() {
1434
- return k`<calcite-notice class="margin-lg" open scale=m icon=effects kind=info><div slot=message>${this._translations.signInMessage}</div><calcite-link @click=${this._handleSignIn} slot=link title=${this._translations.signInMessage ?? ae} class="padding-top-10">${this._translations.signIn}</calcite-link></calcite-notice>`;
1691
+ return T`<calcite-notice class="margin-lg" open scale=m icon=effects kind=info><div slot=message>${this._translations.signInMessage}</div><calcite-link @click=${this._handleSignIn} slot=link title=${this._translations.signInMessage ?? re} class="padding-top-10">${this._translations.signIn}</calcite-link></calcite-notice>`;
1435
1692
  }
1436
1693
  _renderNoPermission() {
1437
- return k`<calcite-notice class="margin-lg" open scale=m icon=effects kind=info><div slot=title>${this._translations.noPermissionTitle}</div><div slot=message class="padding-top-10">${De(this._translations.noPermissionMessage.replace("{{orgUrl}}", us).replace("{{configAI}}", ps))}</div></calcite-notice>`;
1694
+ return T`<calcite-notice class="margin-lg" open scale=m icon=effects kind=info><div slot=title>${this._translations.noPermissionTitle}</div><div slot=message class="padding-top-10">${Re(this._translations.noPermissionMessage.replace("{{orgUrl}}", ys).replace("{{configAI}}", bs))}</div></calcite-notice>`;
1438
1695
  }
1439
1696
  render() {
1440
1697
  let e = this._suggestedPrompts.length > 0 ? this._suggestedPrompts : this._hasInteracted ? [] : Object.values(this._translations.defaultFollowUpQuestions);
1441
- return this._suggestedPrompts.length > 0 ? e = this._suggestedPrompts : this._hasInteracted || (e = [...Object.values(this._translations.defaultFollowUpQuestions)]), k`<calcite-panel class="chat-panel"><div class="header-content" slot=header-content><span class="header-title">${this._translations.solutionAssistantTitle}</span></div>${this._configContextConsumer.value?.userSession?.token ? this._configContextConsumer.value?.authentication?.CanUseAI ? k`${!this._isMobile && k`<calcite-action id=solutionBuilderAction icon=pencil-square .text=${this._translations.tooltips.builder} text-enabled .indicator=${this.hasActiveBuilderDesign} .disabled=${!this.hasActiveBuilderDesign} .active=${this.builderVisible} selection-appearance=highlight @click=${() => {
1698
+ return this._suggestedPrompts.length > 0 ? e = this._suggestedPrompts : this._hasInteracted || (e = [...Object.values(this._translations.defaultFollowUpQuestions)]), T`<calcite-panel class="chat-panel"><div class="header-content" slot=header-content><span class="header-title">${this._translations.solutionAssistantTitle}</span></div>${this._configContextConsumer.value?.userSession?.token ? this._configContextConsumer.value?.authentication?.CanUseAI ? T`${!this._isMobile && T`<calcite-action id=solutionBuilderAction icon=pencil-square .text=${this._translations.tooltips.builder} text-enabled .indicator=${this.hasActiveBuilderDesign} .disabled=${!this.hasActiveBuilderDesign} .active=${this.builderVisible} selection-appearance=highlight @click=${() => {
1442
1699
  this._telemetry?.logEvent({
1443
- category: D.ASSISTANT,
1700
+ category: M.ASSISTANT,
1444
1701
  action: "Toggle Builder Panel",
1445
1702
  dimensions: [this.builderVisible ? "Close" : "Open"]
1446
1703
  }), window.dispatchEvent(new CustomEvent("toggleSolutionBuilder"));
1447
- }} scale=m slot=header-actions-end></calcite-action>` || ""}${!this._isMobile && k`<calcite-tooltip placement=bottom reference-element=solutionBuilderAction><span>${this._translations.tooltips.solutionBuilder}</span></calcite-tooltip>` || ""}<arcgis-assistant reference-element copy-enabled feedback-enabled heading description entry-message=${this._translations.defaultStartUpMessage ?? ae} .suggestedPrompts=${e} @arcgisSubmit=${(s) => {
1448
- console.log("arcgis submit: ", s.detail), this._suggestedPrompts = [], e = [], this._hasInteracted = !0, this._chatStartTime = Date.now(), this.assistantProcessing.emit(!0);
1449
- }} @arcgisFeedback=${(s) => {
1450
- s.detail;
1451
- }} ${qe(this._assistantRef)}><calcite-button appearance=transparent id=newChatButton icon-start=speech-bubble-plus kind=neutral .label=${this._translations.tooltips.newChat} @click=${() => {
1704
+ }} scale=m slot=header-actions-end></calcite-action>` || ""}${!this._isMobile && T`<calcite-tooltip placement=bottom reference-element=solutionBuilderAction><span>${this._translations.tooltips.solutionBuilder}</span></calcite-tooltip>` || ""}<arcgis-assistant reference-element copy-enabled feedback-enabled heading description entry-message=${this._translations.defaultStartUpMessage ?? re} .suggestedPrompts=${e} @arcgisSubmit=${(t) => {
1705
+ console.log("arcgis submit: ", t.detail), this._suggestedPrompts = [], e = [], this._hasInteracted = !0, this._chatStartTime = Date.now(), this.assistantProcessing.emit(!0);
1706
+ }} @arcgisFeedback=${(t) => {
1707
+ t.detail;
1708
+ }} @arcgisResponse=${() => {
1709
+ this.assistantProcessing.emit(!1);
1710
+ }} ${Oe(this._assistantRef)}><calcite-button appearance=transparent id=newChatButton icon-start=speech-bubble-plus kind=neutral .label=${this._translations.tooltips.newChat} @click=${() => {
1452
1711
  this.hasActiveBuilderDesign ? this._showNewChatConfirm = !0 : (this._telemetry?.logEvent({
1453
- category: D.ASSISTANT,
1712
+ category: M.ASSISTANT,
1454
1713
  action: "New Chat",
1455
1714
  dimensions: ["No Active Design"]
1456
1715
  }), this._clearConversation());
1457
- }} round scale=m slot=entry-actions-start>${this._translations.tooltips.newChat}</calcite-button><arcgis-assistant-agent .agent=${ds} .context=${{
1716
+ }} round scale=m slot=entry-actions-start>${this._translations.tooltips.newChat}</calcite-button><arcgis-assistant-agent .agent=${fs} .context=${{
1458
1717
  token: this._configContextConsumer.value?.userSession?.token,
1459
1718
  configContext: this._configContextConsumer.value,
1460
1719
  convoId: this._conversationId,
@@ -1463,20 +1722,20 @@ class ms extends Fe {
1463
1722
  translations: this._translations,
1464
1723
  solutionDesignJson: this._solutionDesignJson,
1465
1724
  lastTurnAgent: this._lastTurnAgent,
1466
- setConversationId: (s) => {
1467
- this._conversationId = s;
1725
+ setConversationId: (t) => {
1726
+ this._conversationId = t;
1468
1727
  },
1469
- setLastTurnAgent: (s) => {
1470
- this._lastTurnAgent = s;
1728
+ setLastTurnAgent: (t) => {
1729
+ this._lastTurnAgent = t;
1471
1730
  },
1472
1731
  clearSuggestedPrompts: () => {
1473
1732
  this._suggestedPrompts = [];
1474
1733
  }
1475
- }}></arcgis-assistant-agent></arcgis-assistant><div slot=footer class="disclaimer-div width-100"><calcite-chip class="beta-chip" appearance=solid kind=neutral .label=${this._translations.betaTag} scale=s>${this._translations.betaTag}</calcite-chip><span>${this._translations.disclaimerMessage} <a href=https://links.esri.com/solutions/security-concern rel="noopener noreferrer" target=_blank>${this._translations.reportConcern}</a></span></div>` : this._renderNoPermission() : this._renderNoSign()}${this._showNewChatConfirm && k`<calcite-dialog close-disabled escape-disabled .heading=${this._translations.newConversationConfirmTitle} modal open outside-close-disabled>${this._translations.builderMessages.discardMessage}<calcite-button appearance=outline @click=${() => {
1734
+ }}></arcgis-assistant-agent></arcgis-assistant><div slot=footer class="disclaimer-div width-100"><calcite-chip class="beta-chip" appearance=solid kind=neutral .label=${this._translations.betaTag} scale=s>${this._translations.betaTag}</calcite-chip><span>${this._translations.disclaimerMessage} <a href=https://links.esri.com/solutions/security-concern rel="noopener noreferrer" target=_blank>${this._translations.reportConcern}</a></span></div>` : this._renderNoPermission() : this._renderNoSign()}${this._showNewChatConfirm && T`<calcite-dialog close-disabled escape-disabled .heading=${this._translations.newConversationConfirmTitle} modal open outside-close-disabled>${this._translations.builderMessages.discardMessage}<calcite-button appearance=outline @click=${() => {
1476
1735
  this._showNewChatConfirm = !1;
1477
1736
  }} slot=footer-end>${this._translations.cancel}</calcite-button><calcite-button appearance=solid kind=danger @click=${() => {
1478
1737
  this._telemetry?.logEvent({
1479
- category: D.ASSISTANT,
1738
+ category: M.ASSISTANT,
1480
1739
  action: "New Chat",
1481
1740
  dimensions: ["With Design Discard"]
1482
1741
  }), this._showNewChatConfirm = !1, window.dispatchEvent(new CustomEvent("requestBuilderDiscard"));
@@ -1487,40 +1746,40 @@ class ms extends Fe {
1487
1746
  _clearConversation() {
1488
1747
  this._conversationId = void 0, this._lastTurnAgent = void 0, this._suggestedPrompts = [], this._hasInteracted = !1, this._assistantRef.value?.clearChatHistory();
1489
1748
  }
1490
- _sendFeedback(e, s, i, n) {
1491
- const o = `https://survey123.arcgis.com/share/6e349a50b4504ca6b6107216d568db5f?field:_source=${encodeURIComponent("Solutions Assistant")}&field:user_evaluation=${encodeURIComponent(i)}&field:question=${encodeURIComponent(s)}&field:answer=${encodeURIComponent(e)}&field:context=${encodeURIComponent(JSON.stringify({ agent: n }))}&field:version=${encodeURIComponent("v2")}`;
1749
+ _sendFeedback(e, t, i, n) {
1750
+ const o = `https://survey123.arcgis.com/share/6e349a50b4504ca6b6107216d568db5f?field:_source=${encodeURIComponent("Solutions Assistant")}&field:user_evaluation=${encodeURIComponent(i)}&field:question=${encodeURIComponent(t)}&field:answer=${encodeURIComponent(e)}&field:context=${encodeURIComponent(JSON.stringify({ agent: n }))}&field:version=${encodeURIComponent("v2")}`;
1492
1751
  window.open(o, "_blank");
1493
1752
  }
1494
1753
  async _loadUserFirstName() {
1495
1754
  try {
1496
1755
  const e = await this._configContextConsumer.value?.userSession?.getUser();
1497
1756
  if (e?.fullName) {
1498
- const s = e.fullName.split(" ")[0];
1499
- this.userFirstName = s;
1757
+ const t = e.fullName.split(" ")[0];
1758
+ this.userFirstName = t;
1500
1759
  }
1501
1760
  } catch {
1502
1761
  }
1503
1762
  }
1504
1763
  _parseAgentPickedAndTask(e) {
1505
- const s = Array.from(this._assistantRef.value?.messages || []), i = e.log || [], a = [...s].sort((u, f) => f.id - u.id).find((u) => u.role === "user" && u.id <= e.id)?.content || null, l = i.find((u) => typeof u == "string" && u.includes("Agent picked:")) ?? null;
1506
- if (!l)
1764
+ const t = Array.from(this._assistantRef.value?.messages || []), i = e.log || [], a = [...t].sort((u, g) => g.id - u.id).find((u) => u.role === "user" && u.id <= e.id)?.content || null, r = i.find((u) => typeof u == "string" && u.includes("Agent picked:")) ?? null;
1765
+ if (!r)
1507
1766
  return { agentPicked: null, taskAssigned: null, userMessage: a };
1508
- const d = /Agent picked:\s*(.*?)\s*(?:\\n|\r?\n)\s*Task Assigned:\s*([\s\S]*)$/i, c = l.match(d);
1509
- if (!c)
1767
+ const c = /Agent picked:\s*(.*?)\s*(?:\\n|\r?\n)\s*Task Assigned:\s*([\s\S]*)$/i, d = r.match(c);
1768
+ if (!d)
1510
1769
  return { agentPicked: null, taskAssigned: null, userMessage: a };
1511
- const m = c[1].trim(), h = c[2].trim();
1512
- return { agentPicked: m, taskAssigned: h, userMessage: a };
1770
+ const h = d[1].trim(), y = d[2].trim();
1771
+ return { agentPicked: h, taskAssigned: y, userMessage: a };
1513
1772
  }
1514
1773
  _emitItemIdFromAI(e) {
1515
- const s = new CustomEvent("solutionIDFromAssistant", {
1774
+ const t = new CustomEvent("solutionIDFromAssistant", {
1516
1775
  detail: e,
1517
1776
  bubbles: !0,
1518
1777
  composed: !0
1519
1778
  });
1520
- window.dispatchEvent(s);
1779
+ window.dispatchEvent(t);
1521
1780
  }
1522
1781
  }
1523
- Le("arcgis-solutions-assistant", ms);
1782
+ Ne("arcgis-solutions-assistant", xs);
1524
1783
  export {
1525
- ms as ArcgisSolutionsAssistant
1784
+ xs as ArcgisSolutionsAssistant
1526
1785
  };