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

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 (188) hide show
  1. package/dist/cdn/22BT2PBE.js +338 -0
  2. package/dist/cdn/{OZSFGLR6.js → 25HVM373.js} +1 -1
  3. package/dist/cdn/{44EC2SD3.js → 26LDC3OX.js} +1 -1
  4. package/dist/cdn/275IZ5I6.js +5 -0
  5. package/dist/cdn/{GUMEOBNQ.js → 2D6HFQD5.js} +1 -1
  6. package/dist/cdn/{QTFTJ4DQ.js → 2EXGHOIM.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/354D2K6F.js +2 -0
  12. package/dist/cdn/{D4TEADUS.js → 37P3IMFV.js} +1 -1
  13. package/dist/cdn/{C5BQAX2M.js → 3A3CPQX4.js} +1 -1
  14. package/dist/cdn/{2V64PFN2.js → 3J5ZSELO.js} +1 -1
  15. package/dist/cdn/{Q4X6GXRI.js → 3JCHYXHA.js} +1 -1
  16. package/dist/cdn/{IXLVTSCY.js → 3SMHMC4L.js} +1 -1
  17. package/dist/cdn/{S4ZMJ42A.js → 3UCDO65S.js} +1 -1
  18. package/dist/cdn/{CPOZIWVH.js → 463CZQF6.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/{H5KFQMYD.js → 4HRGPGDM.js} +1 -1
  22. package/dist/cdn/{U6DXEFHP.js → 4RCC4KA2.js} +1 -1
  23. package/dist/cdn/{WXM3KMEV.js → 4SORDX5Z.js} +1 -1
  24. package/dist/cdn/{EHSIODIO.js → 54A4C4RG.js} +1 -1
  25. package/dist/cdn/54TJQLYJ.js +69 -0
  26. package/dist/cdn/{D5JF7XQN.js → 56DNSWXG.js} +1 -1
  27. package/dist/cdn/{OMRM5EXN.js → 5FWKODDH.js} +1 -1
  28. package/dist/cdn/{G63OYQ7G.js → 5IDPOFIN.js} +1 -1
  29. package/dist/cdn/{TLRBE2TZ.js → 5LSNDSHW.js} +1 -1
  30. package/dist/cdn/{I4EEOB6Y.js → 5N4KGIIY.js} +1 -1
  31. package/dist/cdn/{QWGJAD3Z.js → 67CEWYTY.js} +1 -1
  32. package/dist/cdn/6FY64JKN.js +2 -0
  33. package/dist/cdn/{EYJQEBDF.js → 6HZBPFHA.js} +1 -1
  34. package/dist/cdn/{XEYYUNNX.js → 6PZSOVYB.js} +1 -1
  35. package/dist/cdn/{FZNRD2XJ.js → 6WNKGSHD.js} +1 -1
  36. package/dist/cdn/{NQBHAESW.js → 6WVYNWVR.js} +1 -1
  37. package/dist/cdn/{MBVY6OPY.js → 743J2ZUC.js} +1 -1
  38. package/dist/cdn/{7YJMTZFC.js → 77753TPX.js} +1 -1
  39. package/dist/cdn/{4G6CA64M.js → 7VY3RI7C.js} +1 -1
  40. package/dist/cdn/A2A3RFJ6.js +2 -0
  41. package/dist/cdn/{GABDTUB7.js → A6ZTIX3P.js} +1 -1
  42. package/dist/cdn/{R3PYC2H6.js → AAUM57XI.js} +1 -1
  43. package/dist/cdn/{Z226R5SF.js → ADURBGIK.js} +1 -1
  44. package/dist/cdn/{GVFCX2FF.js → APNDTPBA.js} +1 -1
  45. package/dist/cdn/{S47SVZPE.js → ARFBMFQW.js} +1 -1
  46. package/dist/cdn/ATEW4U4A.js +2 -0
  47. package/dist/cdn/{TSUSILGP.js → AYHTQTVS.js} +1 -1
  48. package/dist/cdn/{KU2LYW6K.js → BIX5DRQP.js} +1 -1
  49. package/dist/cdn/{G2RMWJ7R.js → BOFA5RH7.js} +1 -1
  50. package/dist/cdn/{P7LSYADG.js → BWWX52HV.js} +1 -1
  51. package/dist/cdn/{QPX33Y62.js → BXSBR2GT.js} +1 -1
  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/{CZ4A24AM.js → CU2JLCTZ.js} +1 -1
  56. package/dist/cdn/{KSAJFFJI.js → CV4B2O7J.js} +1 -1
  57. package/dist/cdn/{TTCTODAR.js → CVXDL2AT.js} +1 -1
  58. package/dist/cdn/{XHFFDKEQ.js → D22STVK5.js} +1 -1
  59. package/dist/cdn/{XF5N3NI5.js → DIBK4RSG.js} +1 -1
  60. package/dist/cdn/{JCQQIAIE.js → DQ47P6ES.js} +1 -1
  61. package/dist/cdn/{5NZT27OV.js → DVPYGOBV.js} +1 -1
  62. package/dist/cdn/E3F63VW4.js +2 -0
  63. package/dist/cdn/EL3OIP52.js +31 -0
  64. package/dist/cdn/{WQHJMFGP.js → ENXQ33P7.js} +1 -1
  65. package/dist/cdn/{Q6WCNWQE.js → ERLDQUNI.js} +1 -1
  66. package/dist/cdn/EUI6UDCN.js +43 -0
  67. package/dist/cdn/{RQIGAX6O.js → EWS72RFR.js} +1 -1
  68. package/dist/cdn/{4PNNKMNH.js → F4MS4NQL.js} +1 -1
  69. package/dist/cdn/{UA6XD7SQ.js → FFZ2XVRE.js} +1 -1
  70. package/dist/cdn/{YNCRTGYJ.js → FMPY32BG.js} +1 -1
  71. package/dist/cdn/{XKEKXTL2.js → FSF3T3OT.js} +1 -1
  72. package/dist/cdn/{JFLG3EKT.js → FYJMHXWV.js} +1 -1
  73. package/dist/cdn/{57SZHKM5.js → G4V4JPFI.js} +1 -1
  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/{LY3WRG7K.js → GVMTSUDH.js} +1 -1
  78. package/dist/cdn/{A62EWI7L.js → H4LZV33O.js} +1 -1
  79. package/dist/cdn/{OG4BNL2Z.js → HAMYUUYZ.js} +1 -1
  80. package/dist/cdn/{DVCYL5TO.js → HDMAFAEM.js} +1 -1
  81. package/dist/cdn/{X65HFYH4.js → HIB4BVGK.js} +1 -1
  82. package/dist/cdn/{2I5LGZNX.js → HIPZRG2Q.js} +1 -1
  83. package/dist/cdn/{LXGY2E55.js → HKFXHTYU.js} +1 -1
  84. package/dist/cdn/{EKK5FR2V.js → HM2QALUN.js} +1 -1
  85. package/dist/cdn/{MISU75DC.js → HQCHD3FH.js} +1 -1
  86. package/dist/cdn/HRQVJBRJ.js +2 -0
  87. package/dist/cdn/HXNARVYH.js +3 -0
  88. package/dist/cdn/{Q3MHT47G.js → I4PBOBUM.js} +1 -1
  89. package/dist/cdn/{V7WSQCQY.js → IAEFPE3L.js} +1 -1
  90. package/dist/cdn/INLWMPGE.js +2 -0
  91. package/dist/cdn/ITCC5G26.js +136 -0
  92. package/dist/cdn/IXPNZCW6.js +2 -0
  93. package/dist/cdn/{SMN3CVM5.js → IXRFWVBT.js} +1 -1
  94. package/dist/cdn/JFMNVOWH.js +2 -0
  95. package/dist/cdn/{AV2Q4PBA.js → JFPR5QIQ.js} +1 -1
  96. package/dist/cdn/{DF7TCZUS.js → KDDHPA54.js} +1 -1
  97. package/dist/cdn/{3IO2JXVB.js → KR2PPIBX.js} +1 -1
  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/{55QBAVPE.js → M6AOD7GG.js} +1 -1
  103. package/dist/cdn/{J6CXULUZ.js → MFFM74RG.js} +1 -1
  104. package/dist/cdn/{XM3SRZWV.js → MIV34H66.js} +1 -1
  105. package/dist/cdn/{EF2TTWG5.js → MKSUYITL.js} +1 -1
  106. package/dist/cdn/{IXBI3PV7.js → MOSQBUUZ.js} +1 -1
  107. package/dist/cdn/MV7GEGP5.js +98 -0
  108. package/dist/cdn/{26QXT6ZT.js → O4DB2EXV.js} +1 -1
  109. package/dist/cdn/OAUHQK3Y.js +54 -0
  110. package/dist/cdn/{WGRSVQHE.js → OBCXHY24.js} +1 -1
  111. package/dist/cdn/{V5WXJLJN.js → ON4EBR25.js} +1 -1
  112. package/dist/cdn/{7RIJ2EMD.js → OUMIC7G7.js} +1 -1
  113. package/dist/cdn/{F5SUVMAE.js → OZ4IYASP.js} +1 -1
  114. package/dist/cdn/{X7WLU5YB.js → P666D4WT.js} +1 -1
  115. package/dist/cdn/PGTLLFW6.js +3 -0
  116. package/dist/cdn/{WCXR46D4.js → PLQEDCUG.js} +1 -1
  117. package/dist/cdn/PLXHBQBF.js +146 -0
  118. package/dist/cdn/{22BJ76LD.js → PM4EFNB2.js} +1 -1
  119. package/dist/cdn/PPFEO3UH.js +2 -0
  120. package/dist/cdn/{UBPOT5V3.js → QMAV4UTN.js} +1 -1
  121. package/dist/cdn/{MICWKD3Q.js → QYCERRRZ.js} +1 -1
  122. package/dist/cdn/{7JC52SFZ.js → QZ2ZMWIH.js} +1 -1
  123. package/dist/cdn/{CAYWD56D.js → R27S3IDW.js} +1 -1
  124. package/dist/cdn/RDJIKSXN.js +439 -0
  125. package/dist/cdn/{I2NTSKBD.js → RLSY4VUQ.js} +1 -1
  126. package/dist/cdn/{HVT2WBVC.js → S4GBMN37.js} +1 -1
  127. package/dist/cdn/{KTRKTBPS.js → SGFSVWTY.js} +1 -1
  128. package/dist/cdn/{3LZFERNW.js → SHEDDVHQ.js} +1 -1
  129. package/dist/cdn/{5F6KCXYP.js → SJLSYFK3.js} +1 -1
  130. package/dist/cdn/T3EPRHTT.js +4 -0
  131. package/dist/cdn/TLIIJ2QC.js +122 -0
  132. package/dist/cdn/{BM4VSEDV.js → TWJ6DAY5.js} +1 -1
  133. package/dist/cdn/{KKEERGX7.js → TZHRYPII.js} +1 -1
  134. package/dist/cdn/{I7MO6UJB.js → U27263JW.js} +1 -1
  135. package/dist/cdn/{DKXVDY6L.js → U2FC3BET.js} +1 -1
  136. package/dist/cdn/{FBGCV6YJ.js → UCYR537P.js} +1 -1
  137. package/dist/cdn/{SS6AENH6.js → UDPMO6YN.js} +1 -1
  138. package/dist/cdn/{DJYT367X.js → V5BIPD5T.js} +1 -1
  139. package/dist/cdn/{XXQVYXGC.js → VBJJQPZT.js} +1 -1
  140. package/dist/cdn/VDI7SDRK.js +5 -0
  141. package/dist/cdn/VDZT4UXB.js +36 -0
  142. package/dist/cdn/{24DOFCUH.js → VKHBBAXO.js} +1 -1
  143. package/dist/cdn/{O7VRD3Z3.js → VL2NVCIB.js} +1 -1
  144. package/dist/cdn/{RBSOCHJT.js → VN3AKGAY.js} +1 -1
  145. package/dist/cdn/{VTAQ6NBB.js → VUXNHQGR.js} +1 -1
  146. package/dist/cdn/{EFYLYWPE.js → W5TNQMAJ.js} +1 -1
  147. package/dist/cdn/{BATEZR3T.js → WNVC3PSY.js} +1 -1
  148. package/dist/cdn/WXDMML76.js +2 -0
  149. package/dist/cdn/{JEIP7CJK.js → XKFX43FE.js} +1 -1
  150. package/dist/cdn/{GLC7JVKG.js → XQ7SXIHI.js} +1 -1
  151. package/dist/cdn/{ISFTCFSJ.js → Y2AUIXNK.js} +1 -1
  152. package/dist/cdn/{L4BYLII5.js → Y3GFBLXF.js} +1 -1
  153. package/dist/cdn/{VCLTCEIQ.js → YEDC2OLI.js} +1 -1
  154. package/dist/cdn/{3QONPAFM.js → YLIWN2J2.js} +1 -1
  155. package/dist/cdn/YPDXQEUA.js +77 -0
  156. package/dist/cdn/{SXECIQ6Q.js → YSQDSGSF.js} +1 -1
  157. package/dist/cdn/{BEKMMPB7.js → YUI2MSOK.js} +1 -1
  158. package/dist/cdn/{ONARC6AZ.js → YUWXPLTE.js} +1 -1
  159. package/dist/cdn/{CKURBJFW.js → YW2WMW6B.js} +1 -1
  160. package/dist/cdn/{IEXNY45H.js → ZWASNOIQ.js} +1 -1
  161. package/dist/cdn/index.js +1 -1
  162. package/dist/chunks/classifyIntent.js +31 -44
  163. package/dist/chunks/solution-builder-assistant.js +11 -11
  164. package/dist/chunks/validators.js +4 -3
  165. package/dist/components/arcgis-solutions-assistant/customElement.js +1031 -792
  166. package/dist/docs/api.json +1 -1
  167. package/dist/docs/docs.json +1 -1
  168. package/dist/docs/web-types.json +1 -1
  169. package/dist/solutions-components_commit.txt +3 -3
  170. package/package.json +1 -1
  171. package/dist/cdn/5M3PCZM5.js +0 -2
  172. package/dist/cdn/7VD3Y4IF.js +0 -2
  173. package/dist/cdn/B5JYLQYP.js +0 -2
  174. package/dist/cdn/FE7HMUSZ.js +0 -2
  175. package/dist/cdn/FFF5HUPM.js +0 -4
  176. package/dist/cdn/FZUI77EG.js +0 -2
  177. package/dist/cdn/J6OVONBB.js +0 -2
  178. package/dist/cdn/JDI57IEI.js +0 -98
  179. package/dist/cdn/LDSV7DEV.js +0 -2
  180. package/dist/cdn/LHTDVWX2.js +0 -90
  181. package/dist/cdn/LQXIFBIM.js +0 -3
  182. package/dist/cdn/O4VFFJLQ.js +0 -2
  183. package/dist/cdn/TGMVIKID.js +0 -2
  184. package/dist/cdn/UHJVBWUV.js +0 -434
  185. package/dist/cdn/V4O3KYPD.js +0 -2
  186. package/dist/cdn/V4ZJH2HP.js +0 -2
  187. package/dist/cdn/VHYS3SP3.js +0 -2
  188. 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(
27
- ([i]) => i.endsWith(`/${e}.md`)
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)}.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(
28
+ ([n]) => n.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((n) => n.solution.id), t = s.map((n) => n.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,137 +61,137 @@ 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, n) => `<img src="${n}" alt="${t}" style="width: 100%;">`);
85
86
  }
86
- function Xe(t, e) {
87
- const s = [];
88
- return (e?.configurable?.context?.configContext.allCards ?? []).forEach((n) => {
89
- const o = n.title;
87
+ function it(s, e) {
88
+ const t = [];
89
+ return (e?.configurable?.context?.configContext.allCards ?? []).forEach((i) => {
90
+ const o = i.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:${i.deployCommonId}">${o}</a>`);
98
+ }), r && t.push({
98
99
  solution: {
99
- title: n.title,
100
- id: n.deployCommonId,
101
- snippet: n.snippet,
102
- description: n.description
100
+ title: i.title,
101
+ id: i.deployCommonId,
102
+ snippet: i.snippet,
103
+ description: i.description
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
- const i = await fetch(e, {
115
+ async function Q(s, e, t) {
116
+ const n = 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
- if (!i.ok)
124
- throw new Error(`HTTP ${i.status} calling ${e}`);
125
- return i.json();
124
+ if (!n.ok)
125
+ throw new Error(`HTTP ${n.status} calling ${e}`);
126
+ return n.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 ?? [];
130
- if (!i || n.length <= 1 || i === "explorer")
131
- return s;
128
+ const ot = (s) => new Promise((e) => setTimeout(e, s));
129
+ async function at(s, e) {
130
+ const t = s.agentExecutionContext.userRequest, n = e?.configurable?.context?.lastTurnAgent, i = s.agentExecutionContext.messages ?? [];
131
+ if (!n || i.length <= 1 || n === "explorer")
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
136
  modelTier: "fast",
136
137
  temperature: 0,
137
- schema: We,
138
- messages: n.slice(-11),
139
- inputVariables: { query: s, lastTurnAgent: i }
138
+ schema: et,
139
+ messages: i.slice(-11),
140
+ inputVariables: { query: t, lastTurnAgent: n }
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);
171
- if (!n) return;
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, n) => {
170
+ if (!s) return;
171
+ const i = xe(s);
172
+ if (!i) return;
172
173
  const a = { context: {
173
174
  kind: "DocAIAssistantRequest",
174
175
  filters: {
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
+ n && (a.conversationId = n), Q(a, i, e ?? "");
184
+ }, ct = async (s, e) => {
185
+ if (ce(e))
185
186
  return {};
186
- const s = q(e), i = t.documentSkillUrl;
187
- let n = [];
188
- const o = await tt(t, e);
189
- await w(
190
- { text: s.agentProgress.explorerAgentSearching },
187
+ const t = U(e), n = s.documentSkillUrl;
188
+ let i = [];
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,
@@ -205,104 +206,124 @@ const st = y.Root({
205
206
  }
206
207
  }
207
208
  },
208
- i,
209
+ n,
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 = [
224
- ...n,
225
- ...T.allMatches.filter(
226
- (U) => !n.some((_) => _.solution.id === U.solution.id)
223
+ const S = tt(u), N = st(S), C = it(N, e);
224
+ c = C.source, i = [
225
+ ...i,
226
+ ...C.allMatches.filter(
227
+ (z) => !i.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
- i,
246
+ n,
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
+ ), i.length && (i.length === 1 ? ye(i[0].solution.id) : fe(i)), {
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((i) => i.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, n = !0) {
311
+ this.isValid = !0, this.issues = [], this.fieldNameRegistry = null, this.response = e, this.template = t, this.newDesign = n, 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,153 @@ 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((i) => i.key)), t = new Map(this.template.solution.strings.map((i) => [i.key, i]));
361
+ [...t.keys()].every((i) => e.has(i)) || (this.newDesign ? this._reconcileStringKeys() : this._logIssue("String keys in llm response do not match the template."));
362
+ for (const i of this.response.solution.strings) {
363
+ if (i.value)
364
+ continue;
365
+ const o = t.get(i.key)?.value;
366
+ this.newDesign && o ? (i.value = o, this._logAutoFix(`String key '${i.key}' had no value. Auto-fixed by restoring the template value.`)) : this._logIssue(`String key '${i.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((i) => i.id)), t = new Set(this.response.items.map((i) => i.id));
387
+ e.size === t.size && [...e].every((i) => t.has(i)) || (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
+ _reconcileItems() {
394
+ const e = new Set(this.template.items.map((i) => i.id)), t = new Set(this.response.items.map((i) => i.id)), n = [...t].filter((i) => !e.has(i));
395
+ n.length && (this.response.items = this.response.items.filter((i) => e.has(i.id)), this._logAutoFix(`Removed items not present in the template: ${n.join(", ")}.`));
396
+ for (const i of this.template.items)
397
+ t.has(i.id) || (this.response.items.push({ ...i }), this._logAutoFix(`Item '${i.id}' was missing from the design. Auto-fixed by adding it from the template.`));
340
398
  }
341
399
  /**
342
400
  * Compares feature layer configuration between response and template.
343
401
  */
344
402
  _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;
403
+ const e = this.template.featureLayer, t = this.response.featureLayer;
404
+ if (e.itemId !== t.itemId) {
405
+ const n = t.itemId;
406
+ t.itemId = e.itemId, this._logAutoFix(`Feature Layer itemId '${n}' did not match the template. Auto-fixed to '${e.itemId}'.`);
349
407
  }
350
408
  if (!e.addLayers) {
351
- const i = new Set(e.layers.map((o) => o.id)), n = new Set(s.layers.map((o) => o.id));
352
- if (!(i.size === n.size && [...i].every((o) => n.has(o))))
409
+ const n = new Set(e.layers.map((o) => o.id)), i = new Set(t.layers.map((o) => o.id));
410
+ if (!(n.size === i.size && [...n].every((o) => i.has(o))))
353
411
  this._logIssue(`Feature Layer '${e.itemId}' had its layer ids altered.`);
354
412
  else
355
- for (const o of e.layers)
413
+ for (const o of e.layers) {
356
414
  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.`);
415
+ const r = t.layers.find((c) => c.id === o.id);
416
+ if (r && r.type !== o.type)
417
+ if (this.newDesign) {
418
+ const c = r.type;
419
+ r.type = o.type, this._logAutoFix(`Layer '${o.id}' type '${c}' is immutable. Auto-fixed back to template type '${o.type}'.`);
420
+ } else
421
+ this._logIssue(`Layer '${o.id}' type '${r.type}' does not match template type '${o.type}'. This layer type is immutable.`);
359
422
  }
423
+ const a = t.layers.find((r) => r.id === o.id);
424
+ a && this._validateRequiredFields(a, o);
425
+ }
426
+ }
427
+ }
428
+ /**
429
+ * Validates required fields against the template. Required fields are matched by
430
+ * name. Users may change a required field's `alias` and `description`, but its
431
+ * `name`, `type`, `length`, and `choiceList` are immutable.
432
+ *
433
+ * On new designs, missing required fields are re-injected and tampered immutable
434
+ * properties are reverted to the template. Otherwise, issues are logged.
435
+ */
436
+ _validateRequiredFields(e, t) {
437
+ const n = new Map(
438
+ e.requiredFields.map((i) => [i.name.toLowerCase(), i])
439
+ );
440
+ for (const i of t.requiredFields) {
441
+ const o = n.get(i.name.toLowerCase());
442
+ if (!o) {
443
+ this.newDesign ? (e.requiredFields.push({ ...i }), this._logAutoFix(`Layer '${e.name}' was missing required field '${i.name}'. Auto-fixed by re-adding it from the template.`)) : this._logIssue(`Layer '${e.name}' is missing required field '${i.name}'.`);
444
+ continue;
445
+ }
446
+ this._enforceRequiredFieldImmutability(e, o, i);
360
447
  }
361
448
  }
449
+ /**
450
+ * Enforces immutability of a required field's `type`, `length`, and `choiceList`
451
+ * (its `name` is the match key, so it is equal by construction). On new designs the
452
+ * properties are reverted to the template; otherwise an issue is logged.
453
+ */
454
+ _enforceRequiredFieldImmutability(e, t, n) {
455
+ const i = [];
456
+ if (t.type !== n.type && i.push("type"), (t.length ?? null) !== (n.length ?? null) && i.push("length"), this._choiceListsEqual(t.choiceList, n.choiceList) || i.push("choiceList"), !i.length)
457
+ return;
458
+ const o = i.length === 1 ? "property" : "properties";
459
+ this.newDesign ? (t.type = n.type, t.length = n.length, t.choiceList = Array.isArray(n.choiceList) ? [...n.choiceList] : n.choiceList ?? null, this._logAutoFix(`Layer '${e.name}' required field '${n.name}' changed immutable ${o} (${i.join(", ")}). Auto-fixed by reverting to the template.`)) : this._logIssue(`Layer '${e.name}' required field '${n.name}' changed immutable ${o} (${i.join(", ")}). These cannot be modified.`);
460
+ }
461
+ /**
462
+ * Set-based equality check for two choiceList values (order-insensitive),
463
+ * treating null/undefined/non-array as "no domain".
464
+ */
465
+ _choiceListsEqual(e, t) {
466
+ const n = Array.isArray(e) ? e : null, i = Array.isArray(t) ? t : null;
467
+ if (n === null && i === null)
468
+ return !0;
469
+ if (n === null || i === null)
470
+ return !1;
471
+ const o = new Set(n), a = new Set(i);
472
+ return o.size === a.size && [...o].every((r) => a.has(r));
473
+ }
474
+ //--------------------------------------------------------------------------
475
+ //
476
+ // Validate
477
+ //
478
+ //--------------------------------------------------------------------------
362
479
  /**
363
480
  * Validates solution title and description.
364
481
  */
365
482
  _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}).`);
483
+ const e = this.response.solution.title ?? "", t = this.response.solution.description, n = /[/\\]/u.test(e), i = this.newDesign ? e.replace(/[/\\]/gu, "") : e;
484
+ this.newDesign && i !== e ? (this.response.solution.title = i, this._logAutoFix("Solution title contained forward or back slashes. Auto-fixed by removing them.")) : !this.newDesign && n && this._logIssue("Solution title contains forbidden forward or back slashes.");
485
+ const o = H(i);
486
+ if (o.isValid || this._tryFixName(o.errorType, i, (a) => {
487
+ this.response.solution.title = a;
488
+ }, "Solution title", "Solution Title") || this._logIssue(`Solution title is invalid (${o.errorType}).`), t) {
489
+ const a = J(t, b.DESCRIPTION_MAX_LENGTH, !0);
490
+ a.isValid || this._tryFixDescription(t, (r) => {
491
+ this.response.solution.description = r;
492
+ }, "Solution description") || this._logIssue(`Solution description is invalid (${a.errorType}).`);
370
493
  }
371
494
  }
372
495
  /**
@@ -377,12 +500,21 @@ class ve {
377
500
  "Feature Layer (hosted)",
378
501
  "Feature Layer (hosted, view)"
379
502
  ]);
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}).`);
503
+ for (const t of this.response.items) {
504
+ if (e.has(t.type) && t.title.length > b.SERVICE_NAME_MAX_LENGTH)
505
+ if (this.newDesign) {
506
+ const i = t.title;
507
+ t.title = t.title.slice(0, b.SERVICE_NAME_MAX_LENGTH).trim(), this._logAutoFix(`Service name '${i}' exceeded ${b.SERVICE_NAME_MAX_LENGTH} characters. Auto-fixed to '${t.title}'.`);
508
+ } else
509
+ this._logIssue(`Service name '${t.title}' exceeds 100 characters.`);
510
+ const n = H(t.title ?? "");
511
+ if (n.isValid || this._tryFixName(n.errorType, t.title ?? "", (i) => {
512
+ t.title = i;
513
+ }, `Item '${t.id}' title`, "Item Title") || this._logIssue(`Item '${t.id}' title is invalid (${n.errorType}).`), t.description) {
514
+ const i = J(t.description, b.DESCRIPTION_MAX_LENGTH, !0);
515
+ i.isValid || this._tryFixDescription(t.description, (o) => {
516
+ t.description = o;
517
+ }, `Item '${t.id}' description`) || this._logIssue(`Item '${t.id}' description is invalid (${i.errorType}).`);
386
518
  }
387
519
  }
388
520
  }
@@ -390,112 +522,134 @@ class ve {
390
522
  * Validates feature layer structure and layers.
391
523
  */
392
524
  _validateFeatureLayer() {
393
- const e = this.template.featureLayer.layers;
394
525
  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
- }
526
+ const e = this.response.featureLayer.layers.map((t) => t.name.toLowerCase());
527
+ 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}.`));
528
+ for (const t of this.response.featureLayer.layers)
529
+ this._validateLayer(t, this.response.featureLayer.addLayers);
402
530
  }
403
531
  /**
404
- * Validates that all required fields from template are present in layer.
532
+ * Renames duplicate (case-insensitive) layer names by appending a numeric suffix.
405
533
  */
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}'.`);
534
+ _dedupeLayerNames(e) {
535
+ const t = /* @__PURE__ */ new Set();
536
+ for (const n of e) {
537
+ const i = (n.name ?? "").toLowerCase();
538
+ if (t.has(i)) {
539
+ const o = n.name;
540
+ n.name = this._makeUniqueName(n.name ?? "Layer", t), this._logAutoFix(`Duplicate layer name '${o}'. Auto-fixed to '${n.name}'.`);
541
+ }
542
+ t.add(n.name.toLowerCase());
543
+ }
410
544
  }
411
545
  /**
412
546
  * Validates a single layer configuration including name, description, and fields.
413
547
  */
414
- _validateLayer(e, s) {
415
- !s && e.typeMutable === !0 && e.type === "Table" && this._logIssue(
548
+ _validateLayer(e, t) {
549
+ !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
550
  `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}).`);
551
+ ));
552
+ const n = H(e.name ?? "");
553
+ if (n.isValid || this._tryFixName(n.errorType, e.name ?? "", (i) => {
554
+ e.name = i;
555
+ }, `Layer '${e.name}' name`, "Layer Title") || this._logIssue(`Layer '${e.name}' name is invalid (${n.errorType}).`), e.description) {
556
+ const i = J(e.description, b.DESCRIPTION_MAX_LENGTH, !0);
557
+ i.isValid || this._tryFixDescription(e.description, (o) => {
558
+ e.description = o;
559
+ }, `Layer '${e.name}' description`) || this._logIssue(`Layer '${e.name}' description is invalid (${i.errorType}).`);
422
560
  }
423
561
  this._validateLayerFields(e);
424
562
  }
425
563
  /**
426
564
  * Validates all fields in a layer including custom, required, and system fields.
565
+ *
566
+ * Each field is validated individually first, which (among other checks)
567
+ * resolves collisions with reserved system field names. A final pass then
568
+ * ensures custom field names do not collide (case-insensitively) with required
569
+ * field names or one another — auto-fixed via {@link _makeUniqueName} on new
570
+ * designs, otherwise logged.
427
571
  */
428
572
  _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);
573
+ const t = e.systemFields ?? [];
574
+ this.fieldNameRegistry = new Set(
575
+ [...e.customFields, ...e.requiredFields, ...t].map((o) => o.name.toLowerCase())
576
+ );
577
+ for (const o of [...e.customFields, ...e.requiredFields])
578
+ this._validateField(o);
458
579
  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;
580
+ const n = new Set(e.requiredFields.map((o) => o.name.toLowerCase())), i = new Set(n);
581
+ for (const o of e.customFields) {
582
+ const a = o.name.toLowerCase();
583
+ if (i.has(a)) {
584
+ const r = n.has(a) ? "a required field name" : "another field with the same name";
585
+ if (this.newDesign) {
586
+ const c = o.name;
587
+ o.name = this._makeUniqueName(o.name, i), this._logAutoFix(`Layer '${e.name}' field '${c}' collided with ${r}. Auto-fixed to '${o.name}'.`);
588
+ } else
589
+ this._logIssue(`Layer '${e.name}' field '${o.name}' collides with ${r}.`);
590
+ }
591
+ i.add(o.name.toLowerCase());
474
592
  }
475
- return i.add(a.toLowerCase()), a;
476
593
  }
477
594
  /**
478
595
  * Validates a single field including name, type, length, and domain constraints.
479
596
  */
480
597
  _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)
598
+ const t = /^\p{L}/u, n = /^.[\p{L}\p{M}\p{N}_]*$/u;
599
+ 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).`));
600
+ const i = t.test(e.name), o = n.test(e.name);
601
+ if (!i || !o)
485
602
  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}'.`);
603
+ const a = e.name;
604
+ 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
605
  } else
489
- this._logIssue(`Field '${e.name}' exceeds 31 characters.`);
490
- if (Ve.has(e.name.toLowerCase()))
606
+ i || this._logIssue(`Field '${e.name}' does not start with a letter.`), o || this._logIssue(
607
+ `Field '${e.name}' contains invalid characters (only letters from any writing system, numbers, and underscores are allowed; emojis and punctuation are not allowed).`
608
+ );
609
+ if (e.name.length > b.FIELD_NAME_MAX_LENGTH)
610
+ if (this.newDesign) {
611
+ const a = e.name;
612
+ 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}'.`);
613
+ } else
614
+ this._logIssue(`Field '${e.name}' exceeds ${b.FIELD_NAME_MAX_LENGTH} characters.`);
615
+ if (Je.has(e.name.toLowerCase()))
491
616
  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}'.`);
617
+ const a = e.name;
618
+ 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
619
  } else
495
620
  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.`));
621
+ if (Ve.has(e.name.toLowerCase()))
622
+ if (this.newDesign) {
623
+ const a = e.name;
624
+ 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}'.`);
625
+ } else
626
+ this._logIssue(`Field '${e.name}' is a reserved system field name.`);
627
+ 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) {
628
+ const a = Math.max(...e.choiceList.map((r) => r.length));
629
+ 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.`));
630
+ }
631
+ }
632
+ /**
633
+ * New-design behavior: removes blank and duplicate domain values, and drops an
634
+ * empty domain entirely.
635
+ */
636
+ _autoFixChoiceList(e) {
637
+ let t = e.choiceList;
638
+ const n = t.filter((o) => o?.trim());
639
+ n.length !== t.length && (this._logAutoFix(`Field '${e.name}' had blank domain values. Auto-fixed by removing them.`), t = n, e.choiceList = t);
640
+ const i = [...new Set(t)];
641
+ i.length !== t.length && (this._logAutoFix(`Field '${e.name}' had duplicate domain values. Auto-fixed by removing duplicates.`), t = i, e.choiceList = t), t.length || (this._logAutoFix(`Field '${e.name}' had an empty domain. Auto-fixed by removing the domain.`), e.choiceList = null);
642
+ }
643
+ /**
644
+ * Legacy behavior: logs domain (choiceList) content issues as validation issues.
645
+ */
646
+ _logChoiceListIssues(e) {
647
+ if (Array.isArray(e.choiceList)) {
648
+ if (!e.choiceList.length) {
649
+ this._logIssue(`Field '${e.name}' has an empty domain. At least one value is required.`);
650
+ return;
651
+ }
652
+ 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
653
  }
500
654
  }
501
655
  /**
@@ -507,17 +661,100 @@ class ve {
507
661
  this._handleInvalidStringFieldLength(e, 256);
508
662
  return;
509
663
  }
510
- const s = e.length;
511
- if (!Je(s).isValid) {
512
- const n = s > 4e3 ? 4e3 : 256;
513
- this._handleInvalidStringFieldLength(e, n);
664
+ const t = e.length;
665
+ if (!Ke(t).isValid) {
666
+ const i = t > 4e3 ? 4e3 : 256;
667
+ this._handleInvalidStringFieldLength(e, i);
514
668
  }
515
669
  }
516
670
  /**
517
671
  * Applies an auto-fix to a string field's length on new designs, or logs an issue on update design.
518
672
  */
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).`);
673
+ _handleInvalidStringFieldLength(e, t) {
674
+ 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).`);
675
+ }
676
+ //--------------------------------------------------------------------------
677
+ //
678
+ // Helpers / Utilities
679
+ //
680
+ //--------------------------------------------------------------------------
681
+ /**
682
+ * Returns a name not present (case-insensitively) in the taken set by appending
683
+ * a numeric suffix when needed.
684
+ */
685
+ _makeUniqueName(e, t) {
686
+ let n = e, i = 1;
687
+ for (; t.has(n.toLowerCase()); )
688
+ n = `${e}_${i}`, i += 1;
689
+ return n;
690
+ }
691
+ /**
692
+ * Returns a field name truncated to the 31-character limit that does not collide
693
+ * (case-insensitively) with the supplied taken set, shortening the base and
694
+ * appending a numeric suffix as needed.
695
+ */
696
+ _getUniqueTruncatedFieldName(e, t) {
697
+ const n = b.FIELD_NAME_MAX_LENGTH, i = e.slice(0, n);
698
+ let o = i, a = 1;
699
+ for (; t.has(o.toLowerCase()); ) {
700
+ const r = `_${a}`, c = Math.max(1, n - r.length);
701
+ o = `${i.slice(0, c)}${r}`, a += 1;
702
+ }
703
+ return o;
704
+ }
705
+ /**
706
+ * Sanitizes an item-style name by stripping emojis and disallowed characters,
707
+ * collapsing whitespace, trimming, and truncating to the name length limit.
708
+ * May return an empty string when no valid characters remain.
709
+ */
710
+ _sanitizeItemName(e, t = b.NAME_MAX_LENGTH) {
711
+ let n = (e ?? "").replace(new RegExp(Qe.source, "gu"), "").replace(b.INVALID_NAME_CHARS, "").replace(/\s+/gu, " ").trim();
712
+ return n.length > t && (n = n.slice(0, t).trim()), n;
713
+ }
714
+ /**
715
+ * Sanitizes a description by stripping the disallowed `<` and `>` characters
716
+ * (forward slash is allowed) and truncating to the description length limit.
717
+ */
718
+ _sanitizeDescription(e, t = b.DESCRIPTION_MAX_LENGTH) {
719
+ let n = (e ?? "").replace(/[<>]/gu, "");
720
+ return n.length > t && (n = n.slice(0, t)), n;
721
+ }
722
+ /**
723
+ * Sanitizes a field name so it starts with a letter and contains only
724
+ * letters, combining marks, numbers, and underscores.
725
+ */
726
+ _sanitizeFieldName(e) {
727
+ let t = (e ?? "").replace(/[^\p{L}\p{M}\p{N}_]/gu, "");
728
+ return t.length === 0 ? t = "field" : /^\p{L}/u.test(t) || (t = `f_${t}`), t;
729
+ }
730
+ /**
731
+ * Attempts to auto-fix an invalid item-style name on new designs. Empty values
732
+ * (or values that sanitize to empty) fall back to the supplied placeholder.
733
+ * Returns true when fixed.
734
+ */
735
+ _tryFixName(e, t, n, i, o) {
736
+ if (!this.newDesign)
737
+ return !1;
738
+ if (e === "empty")
739
+ return n(o), this._logAutoFix(`${i} was empty. Auto-fixed to '${o}'.`), !0;
740
+ const r = this._sanitizeItemName(t) || o;
741
+ return n(r), this._logAutoFix(`${i} was invalid (${e}). Auto-fixed to '${r}'.`), !0;
742
+ }
743
+ /**
744
+ * Attempts to auto-fix an invalid description on new designs. Returns true when fixed.
745
+ */
746
+ _tryFixDescription(e, t, n) {
747
+ if (!this.newDesign)
748
+ return !1;
749
+ const i = this._sanitizeDescription(e);
750
+ return t(i), this._logAutoFix(`${n} was invalid. Auto-fixed to a sanitized value.`), !0;
751
+ }
752
+ /**
753
+ * Records an auto-fix that was applied (new-design only). Auto-fixes are
754
+ * informational: they are logged but do NOT mark validation invalid.
755
+ */
756
+ _logAutoFix(e) {
757
+ console.debug(e);
521
758
  }
522
759
  /**
523
760
  * Records an issue and marks the validation as invalid.
@@ -526,15 +763,15 @@ class ve {
526
763
  console.debug(e), this.issues.push(e), this.isValid = !1;
527
764
  }
528
765
  }
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([
766
+ const yt = l.object({
767
+ key: l.string().describe("Stable key identifier for the string."),
768
+ value: l.string().describe("Display value for the string."),
769
+ description: l.string().describe("Explanation of where/how the string is used.")
770
+ }), bt = l.object({
771
+ id: l.string().describe("ArcGIS item id (32 hex characters)."),
772
+ title: l.string().describe("Item title."),
773
+ description: l.string().describe("Item description."),
774
+ type: l.enum([
538
775
  "Feature Layer (hosted)",
539
776
  "Feature Layer (hosted, view)",
540
777
  "Web Map",
@@ -553,577 +790,577 @@ const pt = r.object({
553
790
  "Notebook",
554
791
  "QuickCapture Project"
555
792
  ]).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(
793
+ }), ue = l.object({
794
+ name: l.string().describe("Field name."),
795
+ type: l.enum(["string", "integer", "double", "date", "oid", "guid", "globalid"]).describe("Field data type."),
796
+ alias: l.string().describe("Field alias for display."),
797
+ description: l.string().describe("Field description."),
798
+ choiceList: l.array(l.string()).nullable().describe(
562
799
  "List of allowed values for string fields with a controlled vocabulary. Null if unrestricted or not applicable."
563
800
  ),
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.).")
801
+ length: l.number().int().nullable().describe("Maximum string length for string fields. Null for non-string fields.")
802
+ }), xt = l.object({
803
+ id: l.number().int().describe("Layer/table id within the feature service."),
804
+ type: l.enum(["Point", "Polyline", "Polygon", "Table"]).describe("Layer type."),
805
+ typeMutable: l.boolean().describe("Indicates whether the layer type can be changed."),
806
+ name: l.string().describe("Layer/table name."),
807
+ description: l.string().describe("Layer/table description."),
808
+ customFields: l.array(ue).describe("User/business fields specific to the solution."),
809
+ requiredFields: l.array(ue).describe("Fields required for solution functionality (e.g., relationship keys).")
810
+ }), vt = l.object({
811
+ itemId: l.string().describe("ArcGIS item id for the feature layer."),
812
+ addLayers: l.boolean().describe("Indicates whether new layers can be added during solution design."),
813
+ layers: l.array(xt)
814
+ }), Z = l.object({
815
+ response: l.string().describe("Conversational response to the user's query."),
816
+ solution: l.object({
817
+ 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."),
818
+ title: l.string().describe("Title of the solution."),
819
+ description: l.string().describe("Description of the solution."),
820
+ tags: l.array(l.string()).describe("Keywords/tags associated with the solution."),
821
+ strings: l.array(yt).describe("Localized strings/labels used by apps (dashboards, forms, etc.).")
585
822
  }),
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) => {
823
+ items: l.array(bt).describe("ArcGIS items that belong to the solution (apps, maps, layers, etc.)."),
824
+ featureLayer: vt.describe("Primary feature layer item and its schema/layers/tables details.")
825
+ }), wt = l.object({
826
+ op: l.enum(["add", "remove", "replace", "move", "copy"]).describe("RFC 6902 operation type."),
827
+ path: l.string().describe("RFC 6901 JSON Pointer to the target location."),
828
+ 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.`),
829
+ 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.")
830
+ }), _t = l.object({
831
+ response: l.string().describe("Conversational response describing the accepted design changes."),
832
+ patches: l.array(wt).describe("Minimal RFC 6902 patch operations needed to update the current design.")
833
+ }), St = l.object({
834
+ response: l.string().describe("Short, user-friendly explanation of why the requested update was not applied.")
835
+ }), It = l.object({
836
+ assistantResponse: l.string().describe("Natural-language response for the user."),
837
+ isValidUpdate: l.boolean().describe("True only when the request is in scope for supported design updates.")
838
+ }), At = l.object({
839
+ matchedTitles: l.array(l.string()).describe("Titles of solutions that match the user's request. Empty array if no strong match.")
840
+ }), Ct = l.object({
841
+ templateId: l.string().min(1).describe("Template id from the available template list."),
842
+ confidence: l.number().min(0).max(1).describe("Confidence score from 0 to 1 for this template match."),
843
+ templateDescription: l.string().min(1).describe("Short action‑oriented description of the template in the user's use case/workflow, starting with a verb.")
844
+ }), Tt = l.object({
845
+ assistantResponse: l.string().nullable().describe("Natural-language response for the user."),
846
+ isValidUseCase: l.boolean().describe("True only when the request is concrete, appropriate, and has at least one matching template."),
847
+ matchedTemplates: l.array(Ct).describe("Ordered list of matching templates, best match first. Empty when no valid match exists.")
848
+ }), Et = (s) => s.length ? s.map((e, t) => `${t + 1}. ${e}`).join(`
849
+ `) : "No validation errors were provided.", Lt = async (s) => {
613
850
  const {
614
851
  query: e,
615
- validationIssues: s,
616
- recentMessages: i,
617
- fallbackMessage: n,
852
+ validationIssues: t,
853
+ recentMessages: n,
854
+ fallbackMessage: i,
618
855
  promptModules: o
619
- } = t;
856
+ } = s;
620
857
  try {
621
- return (await C({
858
+ return (await We({
622
859
  promptText: await v(o, "explainValidationFailure"),
623
860
  modelTier: "fast",
624
861
  temperature: 0,
625
- schema: yt,
626
- messages: i,
862
+ schema: St,
863
+ messages: n,
627
864
  inputVariables: {
628
865
  query: e,
629
- validationIssueCount: String(s.length),
630
- validationIssues: _t(s)
866
+ validationIssueCount: String(t.length),
867
+ validationIssues: Et(t)
631
868
  }
632
- })).response?.trim() || n;
869
+ })).response?.trim() || i;
633
870
  } catch (a) {
634
871
  return console.warn(
635
872
  "Natural language response failed:",
636
873
  { error: a }
637
- ), n;
638
- }
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) => {
874
+ ), i;
875
+ }
876
+ }, ee = (s) => s in F, $t = 5, kt = 0.8, Nt = 0.5, Ft = "Web Mapping Application", Dt = "Embeddings";
877
+ let R = null, V = null, B = null, P = null;
878
+ const Mt = "Build", L = /* @__PURE__ */ Object.assign({
879
+ "./prompts/assessBuildRequest.md": () => import("../../chunks/assessBuildRequest.js").then((s) => s.default),
880
+ "./prompts/assessUpdateRequest.md": () => import("../../chunks/assessUpdateRequest.js").then((s) => s.default),
881
+ "./prompts/description.md": () => import("../../chunks/description2.js").then((s) => s.default),
882
+ "./prompts/designSolution.md": () => import("../../chunks/designSolution.js").then((s) => s.default),
883
+ "./prompts/explainValidationFailure.md": () => import("../../chunks/explainValidationFailure.js").then((s) => s.default),
884
+ "./prompts/findExistingSolution.md": () => import("../../chunks/findExistingSolution.js").then((s) => s.default),
885
+ "./prompts/updateDesign.md": () => import("../../chunks/updateDesign.js").then((s) => s.default)
886
+ }), Rt = ft.builderMessages, m = (s) => s?.signal?.aborted ?? !1, f = (s, e, t) => U(e)?.builderMessages?.[s] ?? Rt[s], _e = (s) => {
650
887
  typeof window < "u" && window.dispatchEvent(new CustomEvent("arcgis-solution-design-update", {
651
- detail: t
888
+ detail: s
652
889
  }));
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({
657
- q: i,
890
+ }, Bt = async (s, e, t) => {
891
+ if (!s) return null;
892
+ const n = `type:"${Ft}" AND typekeywords:${Dt} AND group:${s}`;
893
+ return (await Y.searchItems({
894
+ q: n,
658
895
  params: e ? { token: e } : void 0,
659
- portal: s,
896
+ portal: t,
660
897
  num: 1
661
898
  }))?.results?.[0] ?? null;
662
899
  };
663
- async function Rt(t, e, s, i) {
900
+ async function Pt(s, e, t, n) {
664
901
  try {
665
- const n = await Ft(t, e, s);
666
- if (!n || g(i))
902
+ const i = await Bt(s, e, t);
903
+ if (!i || m(n))
667
904
  return null;
668
- const o = new Qe({ id: n.id });
669
- return await o.load(), g(i) ? null : await o.fetchData("json");
905
+ const o = new Ye({ id: i.id });
906
+ return await o.load(), m(n) ? null : await o.fetchData("json");
670
907
  } catch {
671
908
  return null;
672
909
  }
673
910
  }
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({
678
- q: i,
911
+ const qt = async (s, e, t) => {
912
+ if (!s) return [];
913
+ const n = `type:Solution AND typekeywords:${Mt} AND group:${s}`;
914
+ return (await Y.searchItems({
915
+ q: n,
679
916
  params: e ? { token: e } : void 0,
680
- portal: s,
917
+ portal: t,
681
918
  num: 100
682
919
  }))?.results ?? [];
683
- }, Nt = async (t, e, s) => {
920
+ }, Ut = async (s, e, t) => {
684
921
  try {
685
- const i = await K.getItemData(t, {
922
+ const n = await Y.getItemData(s, {
686
923
  params: e ? { token: e } : void 0,
687
- portal: s
688
- }), n = i?.buildSolution;
689
- if (!n) return null;
690
- const o = i?.params, a = o && typeof o == "object" && !Array.isArray(o) ? o : null;
691
- return { buildSolution: n, params: a };
924
+ portal: t
925
+ }), i = n?.buildSolution;
926
+ if (!i) return null;
927
+ const o = n?.params, a = o && typeof o == "object" && !Array.isArray(o) ? o : null;
928
+ return { buildSolution: i, params: a };
692
929
  } catch {
693
930
  return null;
694
931
  }
695
- }, L = (t, e = {}) => {
696
- let s = t;
697
- return "itemId" in e && (s = {
698
- ...s,
932
+ }, $ = (s, e = {}) => {
933
+ let t = s;
934
+ return "itemId" in e && (t = {
935
+ ...t,
699
936
  solution: {
700
- ...s.solution,
937
+ ...t.solution,
701
938
  itemId: e.itemId ?? null
702
939
  }
703
- }), e.sourceBuildSolution != null && (s = {
704
- ...s,
940
+ }), e.sourceBuildSolution != null && (t = {
941
+ ...t,
705
942
  sourceBuildSolution: e.sourceBuildSolution
706
- }), "params" in e && (s = {
707
- ...s,
943
+ }), "params" in e && (t = {
944
+ ...t,
708
945
  params: e.params ?? null
709
- }), "templateId" in e && (s = {
710
- ...s,
946
+ }), "templateId" in e && (t = {
947
+ ...t,
711
948
  templateId: e.templateId ?? null
712
- }), s;
713
- }, we = (t, e) => {
714
- if (t == null || e == null)
949
+ }), t;
950
+ }, Se = (s, e) => {
951
+ if (s == null || e == null)
715
952
  return { ok: !1, error: "design or sourceBuildSolution is null/undefined" };
716
953
  try {
717
- const s = structuredClone(e);
718
- return new ce({ buildSolution: s }).applyLlmTemplate(t), { ok: !0 };
719
- } catch (s) {
954
+ const t = structuredClone(e);
955
+ return new pe({ buildSolution: t }).applyLlmTemplate(s), { ok: !0 };
956
+ } catch (t) {
720
957
  return {
721
958
  ok: !1,
722
- error: s instanceof Error ? s.stack ?? s.message : String(s)
959
+ error: t instanceof Error ? t.stack ?? t.message : String(t)
723
960
  };
724
961
  }
725
- }, Z = async (t) => {
726
- if (J) {
727
- Object.entries(J).forEach(([a, l]) => {
728
- F[a] && (F[a].initialTemplate = l);
962
+ }, te = async (s) => {
963
+ if (V) {
964
+ Object.entries(V).forEach(([a, r]) => {
965
+ F[a] && (F[a].initialTemplate = r);
729
966
  });
730
967
  return;
731
968
  }
732
- const e = t?.configurable?.context?.token, s = _e(t), i = Ie(t);
733
- if (!s) {
969
+ const e = s?.configurable?.context?.token, t = Ae(s), n = Ce(s);
970
+ if (!t) {
734
971
  console.warn("Solution Builder: missing primarySolutionsGroupId in appConfig; skipping live template hydration.");
735
972
  return;
736
973
  }
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))
974
+ const i = await qt(t, e, n), o = {};
975
+ m(s) || (await Promise.all(i.map(async (a) => {
976
+ const r = a.properties?.templateInfo;
977
+ if (!r || typeof r != "object") return;
978
+ const c = r.id;
979
+ if (typeof c != "string" || o[c]) return;
980
+ const d = await Ut(a.id, e, n);
981
+ if (!d || m(s))
745
982
  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;
983
+ const { buildSolution: h, params: y } = d;
984
+ if (typeof h == "object" && h !== null && "solution" in h) {
985
+ const g = h.solution;
986
+ g.thumbnailUrl = a.thumbnail ? `${n ?? "https://www.arcgis.com/sharing/rest"}/content/items/${a.id}/info/${a.thumbnail}` : void 0, g.item = a;
750
987
  }
751
988
  const u = {
752
- ...l,
753
- buildSolution: m
989
+ ...r,
990
+ buildSolution: h
754
991
  };
755
- o[d] = L(
756
- new ce(u).dumpToLlmTemplate(),
992
+ o[c] = $(
993
+ new pe(u).dumpToLlmTemplate(),
757
994
  {
758
995
  itemId: a.id,
759
- sourceBuildSolution: structuredClone(m),
760
- params: h ? structuredClone(h) : null
996
+ sourceBuildSolution: structuredClone(h),
997
+ params: y ? structuredClone(y) : null
761
998
  }
762
- ), F[d] = {
763
- ...l,
764
- initialTemplate: o[d]
999
+ ), F[c] = {
1000
+ ...r,
1001
+ initialTemplate: o[c]
765
1002
  };
766
- })), J = o);
767
- }, Se = (t) => {
768
- const e = t?.configurable?.context?.token;
1003
+ })), V = o);
1004
+ }, Ie = (s) => {
1005
+ const e = s?.configurable?.context?.token;
769
1006
  return typeof e != "string" || !e.trim() ? null : e;
770
- }, _e = (t) => {
771
- const e = t?.configurable?.context?.configContext?.primarySolutionsGroupId;
1007
+ }, Ae = (s) => {
1008
+ const e = s?.configurable?.context?.configContext?.primarySolutionsGroupId;
772
1009
  return typeof e != "string" || !e.trim() ? null : e;
773
- }, Ie = (t) => {
774
- const e = t?.configurable?.context?.configContext?.portalURL;
1010
+ }, Ce = (s) => {
1011
+ const e = s?.configurable?.context?.configContext?.portalURL;
775
1012
  if (!(typeof e != "string" || !e.trim()))
776
1013
  return `${e.replace(/\/+$/, "")}/sharing/rest`;
777
- }, Mt = async (t) => {
1014
+ }, Ot = async (s) => {
778
1015
  await Promise.all([
779
- Te(t),
780
- Z(t)
1016
+ Ee(s),
1017
+ te(s)
781
1018
  ]);
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;
1019
+ }, Te = async (s) => {
1020
+ const e = Ie(s);
1021
+ (!B || e && e !== P) && (P = e ?? P, B = Ot(s).catch((n) => {
1022
+ throw B = null, P = null, n;
1023
+ })), await B;
787
1024
  };
788
- async function Te(t) {
789
- if (N) return N;
790
- const e = _e(t);
1025
+ async function Ee(s) {
1026
+ if (R) return R;
1027
+ const e = Ae(s);
791
1028
  if (!e)
792
1029
  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))
1030
+ const t = Ce(s), n = s?.configurable?.context?.configContext?.portalURL;
1031
+ if (await new Xe(n ? { url: n } : void 0).load(), m(s))
795
1032
  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;
1033
+ const o = Ie(s) ?? void 0, a = await Pt(e, o, t, s);
1034
+ return m(s) ? null : a ? (R = a.items, R) : null;
798
1035
  }
799
- const Bt = () => Object.entries(F).map(([t, e]) => `ID: ${t}
1036
+ const zt = () => Object.entries(F).map(([s, e]) => `ID: ${s}
800
1037
  Label: ${e.label}
801
1038
  Description: ${e.description}`).join(`
802
1039
 
803
- `), Pt = (t) => {
804
- const e = t?.configurable?.context?.solutionDesignJson;
1040
+ `), jt = (s) => {
1041
+ const e = s?.configurable?.context?.solutionDesignJson;
805
1042
  if (typeof e != "string" || !e.trim())
806
1043
  return null;
807
1044
  try {
808
- const s = JSON.parse(e), i = L(
809
- { response: "", ...s },
810
- { itemId: s?.solution?.itemId ?? null }
811
- ), n = Y.safeParse(i);
812
- if (!n.success)
1045
+ const t = JSON.parse(e), n = $(
1046
+ { response: "", ...t },
1047
+ { itemId: t?.solution?.itemId ?? null }
1048
+ ), i = Z.safeParse(n);
1049
+ if (!i.success)
813
1050
  return null;
814
- const { response: o, ...a } = n.data, l = s.templateId, d = typeof l == "string" && X(l) ? l : null;
815
- return L(
1051
+ const { response: o, ...a } = i.data, r = t.templateId, c = typeof r == "string" && ee(r) ? r : null;
1052
+ return $(
816
1053
  a,
817
1054
  {
818
- sourceBuildSolution: s.sourceBuildSolution,
819
- templateId: d,
820
- params: s.params ?? null
1055
+ sourceBuildSolution: t.sourceBuildSolution,
1056
+ templateId: c,
1057
+ params: t.params ?? null
821
1058
  }
822
1059
  );
823
1060
  } catch {
824
1061
  return null;
825
1062
  }
826
- }, qt = y.Root({
827
- ...W(),
1063
+ }, Gt = x.Root({
1064
+ ...X(),
828
1065
  /** Optional human-readable template description retained for UI use. */
829
- templateDescription: y({
830
- reducer: (t, e) => typeof e == "string" || e === null ? e : t ?? null,
1066
+ templateDescription: x({
1067
+ reducer: (s, e) => typeof e == "string" || e === null ? e : s ?? null,
831
1068
  default: () => null
832
1069
  }),
833
1070
  /** Current editable design payload being refined across turns. */
834
- currentDesign: y({
835
- reducer: (t = null, e) => e === void 0 ? t : e ?? null,
1071
+ currentDesign: x({
1072
+ reducer: (s = null, e) => e === void 0 ? s : e ?? null,
836
1073
  default: () => null
837
1074
  }),
838
1075
  /** Initial request assessment produced by the intake prompt. */
839
- assessment: y({
840
- reducer: (t = null, e) => e === void 0 ? t : e ?? null,
1076
+ assessment: x({
1077
+ reducer: (s = null, e) => e === void 0 ? s : e ?? null,
841
1078
  default: () => null
842
1079
  }),
843
1080
  /** Template selected automatically or by human-in-the-loop choice. */
844
- selectedTemplate: y({
845
- reducer: (t = null, e) => e === void 0 ? t : e ?? null,
1081
+ selectedTemplate: x({
1082
+ reducer: (s = null, e) => e === void 0 ? s : e ?? null,
846
1083
  default: () => null
847
1084
  }),
848
1085
  /** Update request assessment produced when an active design exists. */
849
- updateAssessment: y({
850
- reducer: (t = null, e) => e === void 0 ? t : e ?? null,
1086
+ updateAssessment: x({
1087
+ reducer: (s = null, e) => e === void 0 ? s : e ?? null,
851
1088
  default: () => null
852
1089
  }),
853
1090
  /** Existing solution matches surfaced before building a new solution. */
854
- existingMatches: y({
855
- reducer: (t = [], e) => e === void 0 ? t : e ?? [],
1091
+ existingMatches: x({
1092
+ reducer: (s = [], e) => e === void 0 ? s : e ?? [],
856
1093
  default: () => []
857
1094
  }),
858
1095
  /** 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,
1096
+ continueBuilding: x({
1097
+ reducer: (s = null, e) => e === void 0 ? s : e ?? null,
861
1098
  default: () => null
862
1099
  })
863
- }), Ut = (t, e) => {
864
- if (g(e))
1100
+ }), Ht = (s, e) => {
1101
+ if (m(e))
865
1102
  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))
1103
+ const t = jt(e), n = t?.templateId ?? null, i = {};
1104
+ return JSON.stringify(s.currentDesign) !== JSON.stringify(t) && (i.currentDesign = t), n && s.selectedTemplate !== n && (i.selectedTemplate = n), i;
1105
+ }, Jt = async (s, e) => {
1106
+ if (m(e))
870
1107
  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"),
1108
+ await _({ text: f("understandingRequest", e) }, e), await Te(e);
1109
+ const t = s.agentExecutionContext.userRequest, n = zt(), i = s.agentExecutionContext.messages.slice(-11), o = await k({
1110
+ promptText: await v(L, "assessBuildRequest"),
874
1111
  modelTier: "advanced",
875
1112
  temperature: 0,
876
- schema: St,
877
- messages: n,
878
- inputVariables: { query: s, availableTemplates: i }
1113
+ schema: Tt,
1114
+ messages: i,
1115
+ inputVariables: { query: t, availableTemplates: n }
879
1116
  }), a = o.matchedTemplates.filter(
880
- (u) => X(u.templateId)
881
- ), l = {
1117
+ (u) => ee(u.templateId)
1118
+ ), r = {
882
1119
  ...o,
883
1120
  matchedTemplates: a
884
- }, [d, c] = a, h = !!d && d.confidence >= Tt && (c === void 0 || d.confidence - c.confidence >= kt) ? d.templateId : null;
1121
+ }, [c, d] = a, y = !!c && c.confidence >= kt && (d === void 0 || c.confidence - d.confidence >= Nt) ? c.templateId : null;
885
1122
  return {
886
- assessment: l,
887
- selectedTemplate: h,
1123
+ assessment: r,
1124
+ selectedTemplate: y,
888
1125
  existingMatches: [],
889
1126
  continueBuilding: null
890
1127
  };
891
- }, zt = (t) => {
892
- const e = t.assessment?.assistantResponse ?? "";
1128
+ }, Vt = (s) => {
1129
+ const e = s.assessment?.assistantResponse ?? "";
893
1130
  return {
894
1131
  outputMessage: e,
895
1132
  summary: e,
896
1133
  status: "success"
897
1134
  };
898
- }, jt = async (t, e) => {
899
- if (g(e))
1135
+ }, Qt = async (s, e) => {
1136
+ if (m(e))
900
1137
  return {};
901
- const { currentDesign: s } = t;
902
- if (!s)
1138
+ const { currentDesign: t } = s;
1139
+ if (!t)
903
1140
  return {
904
1141
  updateAssessment: {
905
1142
  assistantResponse: "",
906
1143
  isValidUpdate: !0
907
1144
  }
908
1145
  };
909
- await w({ text: b("understandingRequest", e) }, e);
910
- const i = t.agentExecutionContext.userRequest, n = t.agentExecutionContext.messages.slice(-11);
1146
+ await _({ text: f("understandingRequest", e) }, e);
1147
+ const n = s.agentExecutionContext.userRequest, i = s.agentExecutionContext.messages.slice(-11);
911
1148
  return {
912
- updateAssessment: await C({
913
- promptText: await v(E, "assessUpdateRequest"),
1149
+ updateAssessment: await k({
1150
+ promptText: await v(L, "assessUpdateRequest"),
914
1151
  modelTier: "advanced",
915
1152
  temperature: 0,
916
- schema: vt,
917
- messages: n,
1153
+ schema: It,
1154
+ messages: i,
918
1155
  inputVariables: {
919
- currentDesign: JSON.stringify(de(s)),
920
- query: i
1156
+ currentDesign: JSON.stringify(me(t)),
1157
+ query: n
921
1158
  }
922
1159
  })
923
1160
  };
924
- }, Vt = (t, e) => {
925
- const s = t.updateAssessment?.assistantResponse ?? b("applyChangeFailed", e);
1161
+ }, Kt = (s, e) => {
1162
+ const t = s.updateAssessment?.assistantResponse ?? f("applyChangeFailed", e);
926
1163
  return {
927
- outputMessage: s,
928
- summary: s,
1164
+ outputMessage: t,
1165
+ summary: t,
929
1166
  status: "success"
930
1167
  };
931
- }, Jt = (t, e) => {
932
- if (g(e))
1168
+ }, Wt = (s, e) => {
1169
+ if (m(e))
933
1170
  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 = {
1171
+ const { hitlResponse: t } = e.configurable, n = "selectTemplate", i = s.assessment?.matchedTemplates.filter(
1172
+ (d) => ee(d.templateId)
1173
+ ) ?? [], o = i.map((d) => `${d.templateDescription}`);
1174
+ if (t?.agentId !== "solutionBuilder" || t.id !== n) {
1175
+ const d = {
939
1176
  agentId: "solutionBuilder",
940
- id: i,
1177
+ id: n,
941
1178
  kind: "singleSelection",
942
- message: b("selectTemplatePrompt", e),
1179
+ message: f("selectTemplatePrompt", e),
943
1180
  metadata: [...o]
944
1181
  };
945
- throw new le(c);
1182
+ throw new de(d);
946
1183
  }
947
- const a = String(s.payload ?? ""), l = o.findIndex((c) => c === a);
1184
+ const a = String(t.payload ?? ""), r = o.findIndex((d) => d === a);
948
1185
  return {
949
- selectedTemplate: (l >= 0 ? n[l] : void 0)?.templateId ?? n[0]?.templateId ?? null
1186
+ selectedTemplate: (r >= 0 ? i[r] : void 0)?.templateId ?? i[0]?.templateId ?? null
950
1187
  };
951
- }, Gt = async (t, e) => {
952
- if (g(e))
1188
+ }, Xt = async (s, e) => {
1189
+ if (m(e))
953
1190
  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))
1191
+ await _({ text: f("searchingExistingSolutions", e) }, e);
1192
+ const t = s.agentExecutionContext.userRequest, n = ht(s.agentExecutionContext.messages) || t, i = await Ee(e);
1193
+ if (m(e))
957
1194
  return {};
958
- if (!n)
1195
+ if (!i)
959
1196
  return console.warn("Solutions Search: failed to load solution embeddings cache; skipping search."), { existingMatches: [] };
960
- if (!n.length)
1197
+ if (!i.length)
961
1198
  return { existingMatches: [] };
962
- const [o] = await Ue([i]);
963
- if (g(e))
1199
+ const [o] = await ze([n]);
1200
+ if (m(e))
964
1201
  return {};
965
- const a = n.map((u) => ({
1202
+ const a = i.map((u) => ({
966
1203
  solution: u,
967
- score: Oe(o, u.embedding)
1204
+ score: je(o, u.embedding)
968
1205
  }));
969
- a.sort((u, f) => f.score - u.score);
970
- const l = a.slice(0, Ct);
971
- if (!l.length)
1206
+ a.sort((u, g) => g.score - u.score);
1207
+ const r = a.slice(0, $t);
1208
+ if (!r.length)
972
1209
  return { existingMatches: [] };
973
- const d = l.map(({ solution: u }) => `${u.title}
1210
+ const c = r.map(({ solution: u }) => `${u.title}
974
1211
  Snippet: ${u.snippet}
975
1212
  Description: ${u.description}`).join(`
976
1213
 
977
- `), c = t.agentExecutionContext.messages.slice(-11);
978
- return { existingMatches: (await C({
979
- promptText: await v(E, "findExistingSolution"),
1214
+ `), d = s.agentExecutionContext.messages.slice(-11);
1215
+ return { existingMatches: (await k({
1216
+ promptText: await v(L, "findExistingSolution"),
980
1217
  modelTier: "fast",
981
1218
  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))
1219
+ schema: At,
1220
+ messages: d,
1221
+ inputVariables: { query: t, candidates: c }
1222
+ })).matchedTitles.map((u) => r.find(({ solution: g }) => g.title === u)).filter((u) => u !== void 0) };
1223
+ }, Yt = (s, e) => {
1224
+ if (m(e))
988
1225
  return {};
989
- const { existingMatches: s } = t, { hitlResponse: i } = e.configurable, n = `confirmExistingSolution:${s[0].solution.id}`;
990
- 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 = {
1226
+ const { existingMatches: t } = s, { hitlResponse: n } = e.configurable, i = `confirmExistingSolution:${t[0].solution.id}`;
1227
+ if (n?.agentId !== "solutionBuilder" || n.id !== i) {
1228
+ t.length === 1 ? ye(t[0].solution.id) : fe(t);
1229
+ const c = f("existingSolutionMatch", e), d = [
1230
+ f("continueBuildingYes", e),
1231
+ f("continueBuildingNo", e)
1232
+ ], h = {
996
1233
  agentId: "solutionBuilder",
997
- id: n,
1234
+ id: i,
998
1235
  kind: "singleSelection",
999
- message: d,
1000
- metadata: c
1236
+ message: c,
1237
+ metadata: d
1001
1238
  };
1002
- throw new le(m);
1239
+ throw new de(h);
1003
1240
  }
1004
- const o = String(i.payload ?? "").trim(), a = b("continueBuildingNo", e);
1241
+ const o = String(n.payload ?? "").trim(), a = f("continueBuildingNo", e);
1005
1242
  return { continueBuilding: o !== a };
1006
- }, Ht = (t, e) => {
1007
- const s = b("continueBuildingDeclined", e);
1243
+ }, Zt = (s, e) => {
1244
+ const t = f("continueBuildingDeclined", e);
1008
1245
  return {
1009
- outputMessage: s,
1010
- summary: s,
1246
+ outputMessage: t,
1247
+ summary: t,
1011
1248
  status: "success"
1012
1249
  };
1013
- }, ke = async (t, e) => {
1014
- if (g(e))
1250
+ }, Le = async (s, e) => {
1251
+ if (m(e))
1015
1252
  return {};
1016
- if (await Ce(e), g(e))
1253
+ if (await Te(e), m(e))
1017
1254
  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))
1255
+ const { currentDesign: t } = s, n = s.agentExecutionContext.userRequest;
1256
+ await _({ text: f("creatingDesign", e) }, e);
1257
+ let i = q(s.selectedTemplate);
1258
+ if (i?.initialTemplate || (await te(e), i = q(s.selectedTemplate)), m(e))
1022
1259
  return {};
1023
- if (!n?.initialTemplate)
1260
+ if (!i?.initialTemplate)
1024
1261
  throw new Error("No hydrated templates are available for solution design.");
1025
- const o = L(
1026
- s ?? n.initialTemplate,
1262
+ const o = $(
1263
+ t ?? i.initialTemplate,
1027
1264
  {
1028
- itemId: (s ?? n.initialTemplate)?.solution?.itemId ?? null,
1029
- sourceBuildSolution: s?.sourceBuildSolution ?? n.initialTemplate.sourceBuildSolution,
1030
- params: s?.params ?? n.initialTemplate.params ?? null
1265
+ itemId: (t ?? i.initialTemplate)?.solution?.itemId ?? null,
1266
+ sourceBuildSolution: t?.sourceBuildSolution ?? i.initialTemplate.sourceBuildSolution,
1267
+ params: t?.params ?? i.initialTemplate.params ?? null
1031
1268
  }
1032
- ), a = t.agentExecutionContext.messages.slice(-11), l = await C({
1033
- promptText: await v(E, "designSolution"),
1269
+ ), a = s.agentExecutionContext.messages.slice(-11), r = await k({
1270
+ promptText: await v(L, "designSolution"),
1034
1271
  modelTier: "advanced",
1035
1272
  temperature: 0,
1036
- schema: Y,
1273
+ schema: Z,
1037
1274
  messages: a,
1038
1275
  inputVariables: {
1039
- currentDesign: JSON.stringify(ue(o)),
1040
- templateInstructions: n.instructions,
1041
- query: i
1276
+ currentDesign: JSON.stringify(he(o)),
1277
+ templateInstructions: i.instructions,
1278
+ query: n
1042
1279
  }
1043
1280
  });
1044
- if (await w({ text: " of design solution 1" }, e), g(e))
1281
+ if (await _({ text: " of design solution 1" }, e), m(e))
1045
1282
  return {};
1046
- const { response: d, featureLayer: c, ...m } = l, h = pe(
1047
- c,
1283
+ const { response: c, featureLayer: d, ...h } = r, y = ge(
1284
+ d,
1048
1285
  o.featureLayer
1049
- ), u = L(
1050
- { ...m, featureLayer: h },
1286
+ ), u = $(
1287
+ { ...h, featureLayer: y },
1051
1288
  {
1052
1289
  itemId: o?.solution?.itemId,
1053
1290
  sourceBuildSolution: o.sourceBuildSolution,
1054
- templateId: t.selectedTemplate ?? null,
1291
+ templateId: s.selectedTemplate ?? null,
1055
1292
  params: o.params ?? null
1056
1293
  }
1057
- ), f = new ve(u, n.initialTemplate);
1058
- if (!f.isValid)
1294
+ ), g = new b(u, i.initialTemplate);
1295
+ if (!g.isValid)
1059
1296
  return console.warn(
1060
1297
  "[SolutionBuilder] designSolution validation failed:",
1061
- { issues: f.issues, llmResponse: l }
1298
+ { issues: g.issues, llmResponse: r }
1062
1299
  ), {
1063
- outputMessage: b("createDesignFailed", e)
1300
+ outputMessage: f("createDesignFailed", e)
1064
1301
  };
1065
- const S = u.sourceBuildSolution, $ = we(u, S);
1066
- if (!$.ok) {
1302
+ const S = u.sourceBuildSolution, N = Se(u, S);
1303
+ if (!N.ok) {
1067
1304
  console.warn(
1068
1305
  "[SolutionBuilder] designSolution Esri JSON conversion failed:",
1069
- { error: $.error, llmResponse: l, design: u }
1306
+ { error: N.error, llmResponse: r, design: u }
1070
1307
  );
1071
- const T = b("createDesignFailed", e);
1308
+ const C = f("createDesignFailed", e);
1072
1309
  return {
1073
- outputMessage: T,
1074
- summary: T,
1310
+ outputMessage: C,
1311
+ summary: C,
1075
1312
  status: "success"
1076
1313
  };
1077
1314
  }
1078
- return g(e) ? {} : (xe(u), {
1079
- outputMessage: d,
1080
- summary: d,
1315
+ return m(e) ? {} : (_e(u), {
1316
+ outputMessage: c,
1317
+ summary: c,
1081
1318
  status: "success",
1082
1319
  currentDesign: u
1083
1320
  });
1084
- }, Wt = async (t, e) => {
1085
- if (g(e))
1321
+ }, es = async (s, e) => {
1322
+ if (m(e))
1086
1323
  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);
1324
+ const { currentDesign: t } = s;
1325
+ if (!t)
1326
+ return Le(s, e);
1327
+ const n = s.agentExecutionContext.userRequest, i = s.agentExecutionContext.messages.slice(-11);
1328
+ await _({ text: f("updatingDesign", e) }, e);
1092
1329
  let o;
1093
1330
  try {
1094
- o = await C({
1095
- promptText: await v(E, "updateDesign"),
1331
+ o = await k({
1332
+ promptText: await v(L, "updateDesign"),
1096
1333
  modelTier: "advanced",
1097
1334
  temperature: 0,
1098
- schema: bt,
1099
- messages: n,
1335
+ schema: _t,
1336
+ messages: i,
1100
1337
  inputVariables: {
1101
- currentDesign: JSON.stringify(de(s)),
1102
- query: i
1338
+ currentDesign: JSON.stringify(me(t)),
1339
+ query: n
1103
1340
  }
1104
1341
  });
1105
1342
  } catch (p) {
1106
1343
  console.warn("[SolutionBuilder] updateDesign structured prompt failed:", p);
1107
- const x = b("applyChangeFailed", e);
1344
+ const w = f("applyChangeFailed", e);
1108
1345
  return {
1109
- outputMessage: x,
1110
- summary: x,
1346
+ outputMessage: w,
1347
+ summary: w,
1111
1348
  status: "success"
1112
1349
  };
1113
1350
  }
1114
- const { response: a, patches: l } = o;
1115
- if (!l || l.length === 0)
1351
+ const { response: a, patches: r } = o;
1352
+ if (!r || r.length === 0)
1116
1353
  return {
1117
1354
  outputMessage: a,
1118
1355
  summary: a,
1119
1356
  status: "success"
1120
1357
  };
1121
- const d = (p) => {
1358
+ const c = (p) => {
1122
1359
  try {
1123
1360
  return JSON.parse(p);
1124
1361
  } catch {
1125
- const x = p.replace(/[\u0000-\u001F]/g, (ie) => {
1126
- switch (ie) {
1362
+ const w = p.replace(/[\u0000-\u001F]/g, (oe) => {
1363
+ switch (oe) {
1127
1364
  case "\b":
1128
1365
  return "\\b";
1129
1366
  case "\f":
@@ -1136,82 +1373,82 @@ Description: ${u.description}`).join(`
1136
1373
  case " ":
1137
1374
  return "\\t";
1138
1375
  default:
1139
- return "\\u" + ie.charCodeAt(0).toString(16).padStart(4, "0");
1376
+ return "\\u" + oe.charCodeAt(0).toString(16).padStart(4, "0");
1140
1377
  }
1141
1378
  });
1142
1379
  try {
1143
- return JSON.parse(x);
1380
+ return JSON.parse(w);
1144
1381
  } catch {
1145
1382
  return p;
1146
1383
  }
1147
1384
  }
1148
- }, m = [...l.map((p) => ({
1385
+ }, h = [...r.map((p) => ({
1149
1386
  op: p.op,
1150
1387
  path: p.path.replace(/\/+$/, ""),
1151
- ...p.value != null && p.value !== "" ? { value: d(p.value) } : {},
1388
+ ...p.value != null && p.value !== "" ? { value: c(p.value) } : {},
1152
1389
  ...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)
1390
+ }))].sort((p, w) => p.op !== "remove" || w.op !== "remove" ? 0 : w.path.localeCompare(p.path, void 0, { numeric: !0 })), y = structuredClone(
1391
+ he(t)
1155
1392
  );
1156
1393
  try {
1157
- je(h, m, !0);
1394
+ He(y, h, !0);
1158
1395
  } catch (p) {
1159
1396
  console.warn(
1160
1397
  "[SolutionBuilder] updateDesign JSON patch failed:",
1161
- { error: p, llmResponse: o, patches: m, patchTarget: h }
1398
+ { error: p, llmResponse: o, patches: h, patchTarget: y }
1162
1399
  );
1163
- const x = b("applyChangeFailed", e);
1400
+ const w = f("applyChangeFailed", e);
1164
1401
  return {
1165
- outputMessage: x,
1166
- summary: x,
1402
+ outputMessage: w,
1403
+ summary: w,
1167
1404
  status: "success"
1168
1405
  };
1169
1406
  }
1170
- const u = L(
1171
- { response: "", ...h },
1172
- { itemId: s.solution?.itemId ?? null }
1173
- ), f = Y.safeParse(u);
1174
- if (!f.success) {
1407
+ const u = $(
1408
+ { response: "", ...y },
1409
+ { itemId: t.solution?.itemId ?? null }
1410
+ ), g = Z.safeParse(u);
1411
+ if (!g.success) {
1175
1412
  console.warn(
1176
1413
  "[SolutionBuilder] updateDesign schema validation failed:",
1177
- { errors: f.error.issues, llmResponse: o, patchedDesign: u }
1414
+ { errors: g.error.issues, llmResponse: o, patchedDesign: u }
1178
1415
  );
1179
- const p = b("applyChangeFailed", e);
1416
+ const p = f("applyChangeFailed", e);
1180
1417
  return {
1181
1418
  outputMessage: p,
1182
1419
  summary: p,
1183
1420
  status: "success"
1184
1421
  };
1185
1422
  }
1186
- const { response: S, featureLayer: $, ...T } = f.data, U = pe(
1187
- $,
1188
- s.featureLayer
1189
- ), _ = L(
1190
- { ...T, featureLayer: U },
1423
+ const { response: S, featureLayer: N, ...C } = g.data, z = ge(
1424
+ N,
1425
+ t.featureLayer
1426
+ ), I = $(
1427
+ { ...C, featureLayer: z },
1191
1428
  {
1192
- itemId: s.solution?.itemId,
1193
- sourceBuildSolution: s.sourceBuildSolution,
1194
- templateId: s.templateId ?? t.selectedTemplate ?? null,
1195
- params: s.params ?? null
1429
+ itemId: t.solution?.itemId,
1430
+ sourceBuildSolution: t.sourceBuildSolution,
1431
+ templateId: t.templateId ?? s.selectedTemplate ?? null,
1432
+ params: t.params ?? null
1196
1433
  }
1197
1434
  );
1198
- let R = P(t.selectedTemplate);
1199
- if (R?.initialTemplate || (await Z(e), R = P(t.selectedTemplate)), g(e))
1435
+ let D = q(s.selectedTemplate);
1436
+ if (D?.initialTemplate || (await te(e), D = q(s.selectedTemplate)), m(e))
1200
1437
  return {};
1201
- if (!R?.initialTemplate)
1438
+ if (!D?.initialTemplate)
1202
1439
  throw new Error("No hydrated templates are available for solution design.");
1203
- const O = new ve(_, R.initialTemplate, !1);
1204
- if (!O.isValid) {
1440
+ const j = new b(I, D.initialTemplate, !1);
1441
+ if (!j.isValid) {
1205
1442
  console.warn(
1206
1443
  "[SolutionBuilder] updateDesign validation failed:",
1207
- { issues: O.issues, llmResponse: o, patchedDesign: _ }
1444
+ { issues: j.issues, llmResponse: o, patchedDesign: I }
1208
1445
  );
1209
- const p = await It({
1210
- query: i,
1211
- validationIssues: O.issues,
1212
- recentMessages: n,
1213
- fallbackMessage: b("applyChangeFailed", e),
1214
- promptModules: E
1446
+ const p = await Lt({
1447
+ query: n,
1448
+ validationIssues: j.issues,
1449
+ recentMessages: i,
1450
+ fallbackMessage: f("applyChangeFailed", e),
1451
+ promptModules: L
1215
1452
  });
1216
1453
  return {
1217
1454
  outputMessage: p,
@@ -1219,151 +1456,153 @@ Description: ${u.description}`).join(`
1219
1456
  status: "success"
1220
1457
  };
1221
1458
  }
1222
- const Ee = _.sourceBuildSolution, se = we(_, Ee);
1223
- if (!se.ok) {
1459
+ const ke = I.sourceBuildSolution, ne = Se(I, ke);
1460
+ if (!ne.ok) {
1224
1461
  console.warn(
1225
1462
  "[SolutionBuilder] updateDesign Esri JSON conversion failed:",
1226
- { error: se.error, llmResponse: o, design: _ }
1463
+ { error: ne.error, llmResponse: o, design: I }
1227
1464
  );
1228
- const p = b("applyChangeFailed", e);
1465
+ const p = f("applyChangeFailed", e);
1229
1466
  return {
1230
1467
  outputMessage: p,
1231
1468
  summary: p,
1232
1469
  status: "success"
1233
1470
  };
1234
1471
  }
1235
- return g(e) ? {} : (xe(_), {
1472
+ return m(e) ? {} : (_e(I), {
1236
1473
  outputMessage: a,
1237
1474
  summary: a,
1238
1475
  status: "success",
1239
- currentDesign: _
1476
+ currentDesign: I
1240
1477
  });
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, {
1478
+ }, 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
1479
  assessUpdateRequest: "assessUpdateRequest",
1243
1480
  assessBuildRequest: "assessBuildRequest"
1244
- }).addConditionalEdges("assessUpdateRequest", Yt, {
1481
+ }).addConditionalEdges("assessUpdateRequest", ss, {
1245
1482
  invalidUpdateExit: "invalidUpdateExit",
1246
1483
  updateDesign: "updateDesign"
1247
- }).addConditionalEdges("assessBuildRequest", Xt, {
1484
+ }).addConditionalEdges("assessBuildRequest", is, {
1248
1485
  invalidBuildExit: "invalidBuildExit",
1249
1486
  selectTemplateHIL: "selectTemplateHIL",
1250
1487
  findExistingSolutions: "findExistingSolutions"
1251
- }).addEdge("invalidBuildExit", I).addEdge("invalidUpdateExit", I).addEdge("selectTemplateHIL", "findExistingSolutions").addConditionalEdges("findExistingSolutions", Zt, {
1488
+ }).addEdge("invalidBuildExit", A).addEdge("invalidUpdateExit", A).addEdge("selectTemplateHIL", "findExistingSolutions").addConditionalEdges("findExistingSolutions", ns, {
1252
1489
  confirmContinueBuildingHIL: "confirmContinueBuildingHIL",
1253
1490
  designSolution: "designSolution"
1254
- }).addConditionalEdges("confirmContinueBuildingHIL", es, {
1491
+ }).addConditionalEdges("confirmContinueBuildingHIL", os, {
1255
1492
  declineContinueBuildingExit: "declineContinueBuildingExit",
1256
1493
  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);
1270
- const i = new CustomEvent("assistantProcessing", {
1494
+ }).addEdge("declineContinueBuildingExit", A).addEdge("designSolution", A).addEdge("updateDesign", A);
1495
+ await v(L, "description");
1496
+ const rs = E.object({
1497
+ tool: E.enum(["explorer", "builder", "other"]).describe("The selected tool based on the users intent using the conversation context."),
1498
+ confidence: E.number().min(0).max(1).describe("A confidence score (0.00–1.00)."),
1499
+ rationale: E.string().min(1).describe("A brief rationale for the tool choice (≤140 characters)")
1500
+ }), O = (s) => s?.signal?.aborted ?? !1, se = /* @__PURE__ */ Object.assign({
1501
+ "./prompts/assistantResponse.md": () => import("../../chunks/assistantResponse.js").then((s) => s.default),
1502
+ "./prompts/classifyIntent.md": () => import("../../chunks/classifyIntent.js").then((s) => s.default),
1503
+ "./prompts/description.md": () => import("../../chunks/description.js").then((s) => s.default)
1504
+ }), ls = (s) => {
1505
+ const e = s?.configurable?.context?.solutionDesignJson, t = s?.configurable?.context?.lastTurnAgent, n = t === "assistant" ? "other" : t;
1506
+ let i = !1;
1507
+ if (typeof e == "string" && e.trim())
1508
+ try {
1509
+ i = JSON.parse(e).solution != null;
1510
+ } catch {
1511
+ i = !1;
1512
+ }
1513
+ return { activeSolutionDesign: i, lastTool: n };
1514
+ }, ie = (s, e) => {
1515
+ const t = s?.configurable?.context?.setLastTurnAgent;
1516
+ typeof t == "function" && t(e);
1517
+ const n = new CustomEvent("assistantProcessing", {
1271
1518
  detail: { finished: !0, agent: e }
1272
1519
  });
1273
- window.dispatchEvent(i);
1274
- }, Ae = y.Root({
1275
- ...W(),
1276
- selectedTool: y({
1277
- reducer: (t, e) => e ?? null,
1520
+ window.dispatchEvent(n);
1521
+ }, $e = x.Root({
1522
+ ...X(),
1523
+ selectedTool: x({
1524
+ reducer: (s, e) => e ?? null,
1278
1525
  default: () => null
1279
1526
  }),
1280
- intentRationale: y({
1281
- reducer: (t, e) => e ?? null,
1527
+ intentRationale: x({
1528
+ reducer: (s, e) => e ?? null,
1282
1529
  default: () => null
1283
1530
  })
1284
- }), is = async (t, e) => {
1285
- if (e?.configurable?.abortSignal?.aborted)
1531
+ }), cs = async (s, e) => {
1532
+ if (O(e))
1286
1533
  return {};
1287
- const s = q(e);
1288
- await w(
1289
- { text: s?.builderMessages.understandingRequest },
1534
+ const t = U(e);
1535
+ await _(
1536
+ { text: t?.builderMessages.understandingRequest },
1290
1537
  e
1291
1538
  );
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,
1539
+ const n = s.agentExecutionContext.userRequest, i = s.agentExecutionContext.messages.slice(-11), { activeSolutionDesign: o, lastTool: a } = ls(e), r = await v(se, "classifyIntent"), c = await k({
1540
+ promptText: r,
1302
1541
  modelTier: "advanced",
1303
1542
  temperature: 0,
1304
- schema: ss,
1305
- messages: n,
1306
- inputVariables: { query: i, activeSolutionDesign: a }
1543
+ schema: rs,
1544
+ messages: i,
1545
+ inputVariables: { query: n, activeSolutionDesign: o, lastTool: a }
1307
1546
  });
1308
1547
  return {
1309
- selectedTool: d.tool,
1310
- intentRationale: d.rationale
1548
+ selectedTool: c.tool,
1549
+ intentRationale: c.rationale
1311
1550
  };
1312
- }, ns = async (t, e) => {
1313
- if (e?.configurable?.abortSignal?.aborted)
1551
+ }, us = async (s, e) => {
1552
+ if (O(e))
1314
1553
  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)
1554
+ const n = await lt().compile().invoke(s, e);
1555
+ return ie(e, "explorer"), n;
1556
+ }, ds = async (s, e) => {
1557
+ if (O(e))
1319
1558
  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)
1559
+ const n = await as().compile().invoke(s, e);
1560
+ return ie(e, "builder"), n;
1561
+ }, ps = async (s, e) => {
1562
+ if (O(e))
1324
1563
  return {};
1325
- const s = q(e), i = t.agentExecutionContext.userRequest, n = t.intentRationale ?? "No rationale available.";
1326
- await w(
1327
- { text: s?.executingSolutionsAssistantAgent },
1564
+ const t = U(e), n = s.agentExecutionContext.userRequest, i = s.intentRationale ?? "No rationale available.";
1565
+ await _(
1566
+ { text: t?.executingSolutionsAssistantAgent },
1328
1567
  e
1329
1568
  );
1330
- const o = await v(ee, "assistantResponse"), a = t.agentExecutionContext.messages.slice(-11), l = await ze({
1569
+ const o = await v(se, "assistantResponse"), a = s.agentExecutionContext.messages.slice(-11), r = await Ge({
1331
1570
  promptText: o,
1332
1571
  modelTier: "advanced",
1333
1572
  temperature: 0,
1334
1573
  messages: a,
1335
- inputVariables: { query: i, rationale: n }
1574
+ inputVariables: { query: n, rationale: i }
1336
1575
  });
1337
- return te(e, "assistant"), {
1338
- outputMessage: l,
1339
- summary: l,
1576
+ return ie(e, "assistant"), {
1577
+ outputMessage: r,
1578
+ summary: r,
1340
1579
  status: "success"
1341
1580
  };
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, {
1581
+ }, 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
1582
  explorer: "routeToExplorer",
1344
1583
  builder: "routeToBuilder",
1345
1584
  other: "assistantResponse"
1346
- }).addEdge("routeToExplorer", I).addEdge("routeToBuilder", I).addEdge("assistantResponse", I), cs = await v(ee, "description"), ds = {
1585
+ }).addEdge("routeToExplorer", A).addEdge("routeToBuilder", A).addEdge("assistantResponse", A), gs = await v(se, "description"), fs = {
1347
1586
  id: "solutionsAssistant",
1348
1587
  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 {
1588
+ description: gs,
1589
+ createGraph: hs,
1590
+ workspace: $e
1591
+ }, ys = "https://links.esri.com/solutions/agol-organizational-account", bs = "https://links.esri.com/solutions/configure-assistants";
1592
+ class xs extends De {
1354
1593
  constructor() {
1355
1594
  super(), this.open = !1, this.userFirstName = "", this.builderVisible = !1, this.hasActiveBuilderDesign = !1, this._conversationId = void 0, this._lastTurnAgent = void 0, this._orgSettings = {
1356
1595
  aiAssistantsEnabled: !1,
1357
1596
  blockBetaApps: !0,
1358
1597
  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,
1598
+ }, 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({
1599
+ context: Be,
1361
1600
  subscribe: !0,
1362
1601
  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);
1602
+ e?.portalURL && (G.portalUrl = e.portalURL), e?.userSession && !this.userFirstName && this._loadUserFirstName(), e?.authentication?.PortalSubset?.orgSettings && (this._orgSettings = e?.authentication?.PortalSubset?.orgSettings);
1364
1603
  }
1365
- }), this._builderDesignContextConsumer = oe({
1366
- context: Me,
1604
+ }), this._builderDesignContextConsumer = le({
1605
+ context: Pe,
1367
1606
  subscribe: !0,
1368
1607
  callback: (e) => {
1369
1608
  e?.design && (this._solutionDesignJson = JSON.stringify(e.design, null, 2));
@@ -1371,34 +1610,34 @@ class ms extends Fe {
1371
1610
  }), this._handleResize = () => {
1372
1611
  this._isMobile = window.innerWidth <= 800;
1373
1612
  }, this._chatStartTime = null, this._handleAssistantProcessingFinished = (e) => {
1374
- const s = e;
1375
- if (s.detail?.finished && this._chatStartTime !== null) {
1376
- const i = Be(this._chatStartTime);
1613
+ const t = e;
1614
+ if (t.detail?.finished && this._chatStartTime !== null) {
1615
+ const n = qe(this._chatStartTime);
1377
1616
  this._telemetry?.logEvent({
1378
- category: D.ASSISTANT,
1617
+ category: M.ASSISTANT,
1379
1618
  action: "Chat",
1380
- dimensions: [s.detail.agent],
1381
- metrics: [i]
1619
+ dimensions: [t.detail.agent],
1620
+ metrics: [n]
1382
1621
  }), this._chatStartTime = null, this.assistantProcessing.emit(!1);
1383
1622
  }
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];
1389
- this._emitItemIdFromAI(i);
1623
+ }, this.closeAssistant = ae(), this.assistantProcessing = ae(), this._handleAssistantLinkClick = (e) => {
1624
+ const t = e.composedPath().find((n) => n instanceof HTMLAnchorElement);
1625
+ if (t?.href)
1626
+ if (e.preventDefault(), t.target.indexOf("solutionId:") > -1) {
1627
+ const n = t.target.split("solutionId:")[1];
1628
+ this._emitItemIdFromAI(n);
1390
1629
  } else
1391
- window.open(s.href, "_blank", "noopener,noreferrer");
1630
+ window.open(t.href, "_blank", "noopener,noreferrer");
1392
1631
  }, this._onSolutionDesignUpdate = (e) => {
1393
- const i = e.detail;
1394
- this._solutionDesignJson = i ? JSON.stringify(i, null, 2) : '{ "solution": null }';
1632
+ const n = e.detail;
1633
+ this._solutionDesignJson = n ? JSON.stringify(n, null, 2) : '{ "solution": null }';
1395
1634
  }, this._handleSignIn = () => {
1396
1635
  this._configContextConsumer.value?.authentication?.signIn("aiOpen");
1397
1636
  }, this._checkURLOpenParameter = () => {
1398
1637
  this.open = this._configContextConsumer.value?.authentication?.SignInParam === "aiOpen" || this.open;
1399
1638
  }, 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 ?? "");
1639
+ const t = e.detail, { agentPicked: n, taskAssigned: i, userMessage: o } = this._parseAgentPickedAndTask(t);
1640
+ this._sendFeedback(t.content, o ?? i ?? "", t.feedback?.positive ? "Good" : t.feedback?.positive == "Bad" ? "Bad" : "N/A", n ?? "");
1402
1641
  }), this.listenOn(window, "clearAssistantConversation", () => {
1403
1642
  this._clearConversation();
1404
1643
  });
@@ -1407,7 +1646,7 @@ class ms extends Fe {
1407
1646
  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
1647
  }
1409
1648
  static {
1410
- this.styles = He;
1649
+ this.styles = Ze;
1411
1650
  }
1412
1651
  get _telemetry() {
1413
1652
  return this._configContextConsumer.value?.telemetrySession;
@@ -1422,39 +1661,39 @@ class ms extends Fe {
1422
1661
  this._checkURLOpenParameter();
1423
1662
  }
1424
1663
  load() {
1425
- z.applicationName = "Solutions", this._configContextConsumer.value?.portalURL && (z.portalUrl = this._configContextConsumer.value.portalURL);
1664
+ G.applicationName = "Solutions", this._configContextConsumer.value?.portalURL && (G.portalUrl = this._configContextConsumer.value.portalURL);
1426
1665
  }
1427
1666
  firstUpdated(e) {
1428
1667
  this._loadUserFirstName();
1429
1668
  }
1430
1669
  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;
1670
+ 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
1671
  }
1433
1672
  _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>`;
1673
+ 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
1674
  }
1436
1675
  _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>`;
1676
+ 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
1677
  }
1439
1678
  render() {
1440
1679
  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=${() => {
1680
+ 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
1681
  this._telemetry?.logEvent({
1443
- category: D.ASSISTANT,
1682
+ category: M.ASSISTANT,
1444
1683
  action: "Toggle Builder Panel",
1445
1684
  dimensions: [this.builderVisible ? "Close" : "Open"]
1446
1685
  }), 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=${() => {
1686
+ }} 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) => {
1687
+ console.log("arcgis submit: ", t.detail), this._suggestedPrompts = [], e = [], this._hasInteracted = !0, this._chatStartTime = Date.now(), this.assistantProcessing.emit(!0);
1688
+ }} @arcgisFeedback=${(t) => {
1689
+ t.detail;
1690
+ }} ${Oe(this._assistantRef)}><calcite-button appearance=transparent id=newChatButton icon-start=speech-bubble-plus kind=neutral .label=${this._translations.tooltips.newChat} @click=${() => {
1452
1691
  this.hasActiveBuilderDesign ? this._showNewChatConfirm = !0 : (this._telemetry?.logEvent({
1453
- category: D.ASSISTANT,
1692
+ category: M.ASSISTANT,
1454
1693
  action: "New Chat",
1455
1694
  dimensions: ["No Active Design"]
1456
1695
  }), this._clearConversation());
1457
- }} round scale=m slot=entry-actions-start>${this._translations.tooltips.newChat}</calcite-button><arcgis-assistant-agent .agent=${ds} .context=${{
1696
+ }} round scale=m slot=entry-actions-start>${this._translations.tooltips.newChat}</calcite-button><arcgis-assistant-agent .agent=${fs} .context=${{
1458
1697
  token: this._configContextConsumer.value?.userSession?.token,
1459
1698
  configContext: this._configContextConsumer.value,
1460
1699
  convoId: this._conversationId,
@@ -1463,20 +1702,20 @@ class ms extends Fe {
1463
1702
  translations: this._translations,
1464
1703
  solutionDesignJson: this._solutionDesignJson,
1465
1704
  lastTurnAgent: this._lastTurnAgent,
1466
- setConversationId: (s) => {
1467
- this._conversationId = s;
1705
+ setConversationId: (t) => {
1706
+ this._conversationId = t;
1468
1707
  },
1469
- setLastTurnAgent: (s) => {
1470
- this._lastTurnAgent = s;
1708
+ setLastTurnAgent: (t) => {
1709
+ this._lastTurnAgent = t;
1471
1710
  },
1472
1711
  clearSuggestedPrompts: () => {
1473
1712
  this._suggestedPrompts = [];
1474
1713
  }
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=${() => {
1714
+ }}></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
1715
  this._showNewChatConfirm = !1;
1477
1716
  }} slot=footer-end>${this._translations.cancel}</calcite-button><calcite-button appearance=solid kind=danger @click=${() => {
1478
1717
  this._telemetry?.logEvent({
1479
- category: D.ASSISTANT,
1718
+ category: M.ASSISTANT,
1480
1719
  action: "New Chat",
1481
1720
  dimensions: ["With Design Discard"]
1482
1721
  }), this._showNewChatConfirm = !1, window.dispatchEvent(new CustomEvent("requestBuilderDiscard"));
@@ -1487,40 +1726,40 @@ class ms extends Fe {
1487
1726
  _clearConversation() {
1488
1727
  this._conversationId = void 0, this._lastTurnAgent = void 0, this._suggestedPrompts = [], this._hasInteracted = !1, this._assistantRef.value?.clearChatHistory();
1489
1728
  }
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")}`;
1729
+ _sendFeedback(e, t, n, i) {
1730
+ const o = `https://survey123.arcgis.com/share/6e349a50b4504ca6b6107216d568db5f?field:_source=${encodeURIComponent("Solutions Assistant")}&field:user_evaluation=${encodeURIComponent(n)}&field:question=${encodeURIComponent(t)}&field:answer=${encodeURIComponent(e)}&field:context=${encodeURIComponent(JSON.stringify({ agent: i }))}&field:version=${encodeURIComponent("v2")}`;
1492
1731
  window.open(o, "_blank");
1493
1732
  }
1494
1733
  async _loadUserFirstName() {
1495
1734
  try {
1496
1735
  const e = await this._configContextConsumer.value?.userSession?.getUser();
1497
1736
  if (e?.fullName) {
1498
- const s = e.fullName.split(" ")[0];
1499
- this.userFirstName = s;
1737
+ const t = e.fullName.split(" ")[0];
1738
+ this.userFirstName = t;
1500
1739
  }
1501
1740
  } catch {
1502
1741
  }
1503
1742
  }
1504
1743
  _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)
1744
+ const t = Array.from(this._assistantRef.value?.messages || []), n = e.log || [], a = [...t].sort((u, g) => g.id - u.id).find((u) => u.role === "user" && u.id <= e.id)?.content || null, r = n.find((u) => typeof u == "string" && u.includes("Agent picked:")) ?? null;
1745
+ if (!r)
1507
1746
  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)
1747
+ const c = /Agent picked:\s*(.*?)\s*(?:\\n|\r?\n)\s*Task Assigned:\s*([\s\S]*)$/i, d = r.match(c);
1748
+ if (!d)
1510
1749
  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 };
1750
+ const h = d[1].trim(), y = d[2].trim();
1751
+ return { agentPicked: h, taskAssigned: y, userMessage: a };
1513
1752
  }
1514
1753
  _emitItemIdFromAI(e) {
1515
- const s = new CustomEvent("solutionIDFromAssistant", {
1754
+ const t = new CustomEvent("solutionIDFromAssistant", {
1516
1755
  detail: e,
1517
1756
  bubbles: !0,
1518
1757
  composed: !0
1519
1758
  });
1520
- window.dispatchEvent(s);
1759
+ window.dispatchEvent(t);
1521
1760
  }
1522
1761
  }
1523
- Le("arcgis-solutions-assistant", ms);
1762
+ Ne("arcgis-solutions-assistant", xs);
1524
1763
  export {
1525
- ms as ArcgisSolutionsAssistant
1764
+ xs as ArcgisSolutionsAssistant
1526
1765
  };