@esri/solutions-components 5.1.0-next.153 → 5.1.0-next.155

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 (174) hide show
  1. package/dist/cdn/2C6OKRTL.js +2 -0
  2. package/dist/cdn/{4D4UXCEU.js → 2K4FSWCI.js} +1 -1
  3. package/dist/cdn/2L62YUIH.js +2 -0
  4. package/dist/cdn/2UIPY2ED.js +2 -0
  5. package/dist/cdn/{DN3PZCF4.js → 37SYO65U.js} +1 -1
  6. package/dist/cdn/{XK36P3C4.js → 3N4FGXFE.js} +1 -1
  7. package/dist/cdn/{2IGILR4T.js → 5KWJUQRY.js} +1 -1
  8. package/dist/cdn/66VSNZFA.js +2 -0
  9. package/dist/cdn/{GCEPKR7I.js → 6LDTUOZL.js} +1 -1
  10. package/dist/cdn/6OJALTOU.js +2 -0
  11. package/dist/cdn/6RNSFI2J.js +2 -0
  12. package/dist/cdn/{3JZVI5AM.js → 6RONZCGM.js} +1 -1
  13. package/dist/cdn/{DMM5WA5Q.js → 6Y47Z4QA.js} +1 -1
  14. package/dist/cdn/{UNBTFJYB.js → 7IXJB2CS.js} +1 -1
  15. package/dist/cdn/7JC52SFZ.js +2 -0
  16. package/dist/cdn/{IFONVCBL.js → 7LKPG6HJ.js} +1 -1
  17. package/dist/cdn/{VY5TD3VS.js → 7ZEDJMU7.js} +1 -1
  18. package/dist/cdn/{YXHO47AZ.js → 7ZJQQBSR.js} +1 -1
  19. package/dist/cdn/{PNESECPO.js → A6VVARNG.js} +1 -1
  20. package/dist/cdn/{JYUZPAPI.js → A7PEHKA2.js} +1 -1
  21. package/dist/cdn/{SYQ5E5TV.js → AKQEDHUS.js} +1 -1
  22. package/dist/cdn/{TOIBA2KF.js → ALQFRJNC.js} +1 -1
  23. package/dist/cdn/{FWRT4BPD.js → ARFCWGCB.js} +1 -1
  24. package/dist/cdn/{PPRV6EZZ.js → AVBZ2B75.js} +1 -1
  25. package/dist/cdn/{SZRVESYE.js → AXFB53AQ.js} +1 -1
  26. package/dist/cdn/{4ASIXXDP.js → AZDHGEBN.js} +1 -1
  27. package/dist/cdn/{JNE3LBQU.js → BFC6PQCO.js} +1 -1
  28. package/dist/cdn/BLR4MTOP.js +2 -0
  29. package/dist/cdn/{LHG6NOEP.js → BM4VSEDV.js} +1 -1
  30. package/dist/cdn/{DDJSF2M3.js → BWRBYYGI.js} +1 -1
  31. package/dist/cdn/C4F2OOUL.js +2 -0
  32. package/dist/cdn/C4T4HSG2.js +2 -0
  33. package/dist/cdn/C5KDPY7R.js +2 -0
  34. package/dist/cdn/{FZKGL66L.js → C76SZF3J.js} +1 -1
  35. package/dist/cdn/{TB33W36T.js → CEPWTLDN.js} +1 -1
  36. package/dist/cdn/{XO54BFTC.js → CFQKZMGC.js} +1 -1
  37. package/dist/cdn/CJ3EZE7U.js +2 -0
  38. package/dist/cdn/CPBEDBQJ.js +2 -0
  39. package/dist/cdn/{UWSHU7MG.js → CQQH3XK5.js} +1 -1
  40. package/dist/cdn/{WC37HMOI.js → CSAXBV46.js} +1 -1
  41. package/dist/cdn/{TLM7N22U.js → DF7TCZUS.js} +1 -1
  42. package/dist/cdn/{QFFHU77I.js → DMX66TUK.js} +1 -1
  43. package/dist/cdn/{NKX2EIDR.js → DOXKOGC2.js} +1 -1
  44. package/dist/cdn/{BJAEUZFB.js → EF4LWVLU.js} +1 -1
  45. package/dist/cdn/{IEC46RE7.js → EKFKOS5K.js} +1 -1
  46. package/dist/cdn/{ZCPVOS4Q.js → ENTBR5YC.js} +1 -1
  47. package/dist/cdn/EPKRNLRL.js +2 -0
  48. package/dist/cdn/{LGZDNUGT.js → FS5WR74E.js} +1 -1
  49. package/dist/cdn/{JOAEH3CI.js → G4ADX65Y.js} +1 -1
  50. package/dist/cdn/{NV2DLQDN.js → G5PL37M5.js} +1 -1
  51. package/dist/cdn/{RRD4QUQS.js → GBDBGOCT.js} +1 -1
  52. package/dist/cdn/{OAEWZFWV.js → GDX4FWG7.js} +1 -1
  53. package/dist/cdn/{GG4IIHQE.js → GFEDQ7WH.js} +1 -1
  54. package/dist/cdn/{G6EZOEPB.js → GJ7QMCFT.js} +1 -1
  55. package/dist/cdn/GXIGM56I.js +2 -0
  56. package/dist/cdn/{DD2Y5NOB.js → GYTMAAVH.js} +1 -1
  57. package/dist/cdn/HRH3YBW4.js +2 -0
  58. package/dist/cdn/{KV76ATT5.js → HS55CSUO.js} +1 -1
  59. package/dist/cdn/HVT2WBVC.js +2 -0
  60. package/dist/cdn/{QD22B6N2.js → I3A27HFS.js} +1 -1
  61. package/dist/cdn/IADXB53D.js +2 -0
  62. package/dist/cdn/{DXQQQNOF.js → IBAJ7OFO.js} +1 -1
  63. package/dist/cdn/{PX6AYCC4.js → IM3C52I6.js} +1 -1
  64. package/dist/cdn/{EVO7B63R.js → IR55PBAU.js} +1 -1
  65. package/dist/cdn/{JXTZNXTZ.js → IUNUJ6GU.js} +1 -1
  66. package/dist/cdn/{GMSG7ZRV.js → IZ7DJL5P.js} +1 -1
  67. package/dist/cdn/{FNTXI57U.js → IZDAQGZD.js} +1 -1
  68. package/dist/cdn/{UIGRRD7P.js → JET6MYZJ.js} +1 -1
  69. package/dist/cdn/{NYQQSL25.js → JM4BUUFY.js} +1 -1
  70. package/dist/cdn/JQANOMEB.js +2 -0
  71. package/dist/cdn/JTENM3PQ.js +2 -0
  72. package/dist/cdn/KGU32CDZ.js +2 -0
  73. package/dist/cdn/{EKUENEEW.js → L2XO4YLV.js} +1 -1
  74. package/dist/cdn/{LWT3JEQ6.js → LJIX7K76.js} +5 -5
  75. package/dist/cdn/{ZOF7AUSS.js → LOPXSWVG.js} +1 -1
  76. package/dist/cdn/M5ZEJF3J.js +2 -0
  77. package/dist/cdn/{WG5NM5XY.js → MDMFIEM7.js} +1 -1
  78. package/dist/cdn/MPSNK45A.js +2 -0
  79. package/dist/cdn/{XJAXXELZ.js → N2LDQKCJ.js} +1 -1
  80. package/dist/cdn/{L5YT5FRJ.js → O4YFJXGF.js} +1 -1
  81. package/dist/cdn/OOP3DI7Y.js +2 -0
  82. package/dist/cdn/ORMBTE2Z.js +2 -0
  83. package/dist/cdn/OUNL2UWX.js +7 -0
  84. package/dist/cdn/OVKPT3QA.js +2 -0
  85. package/dist/cdn/{RUVOSMTB.js → OZFVLORO.js} +1 -1
  86. package/dist/cdn/{SHEPQVUX.js → PCP5UFZR.js} +1 -1
  87. package/dist/cdn/{3CDO3ATJ.js → PJTHEJG4.js} +1 -1
  88. package/dist/cdn/PRM47E4O.js +2 -0
  89. package/dist/cdn/{ZCLYSOQM.js → Q7GMS6X2.js} +1 -1
  90. package/dist/cdn/{2HAYT46E.js → QA3SYWWX.js} +1 -1
  91. package/dist/cdn/{3S5PVZVU.js → QCCLUBLV.js} +1 -1
  92. package/dist/cdn/{3KYQE6O5.js → QCNGBMWJ.js} +1 -1
  93. package/dist/cdn/{X6JL6SAH.js → QLRGY4WQ.js} +1 -1
  94. package/dist/cdn/{D6VR7GCD.js → QSGVCMF2.js} +1 -1
  95. package/dist/cdn/{ZTRQVOAR.js → QX7YVGEN.js} +1 -1
  96. package/dist/cdn/{S4VDUHA7.js → RCOHFQC5.js} +1 -1
  97. package/dist/cdn/{U56TK45K.js → RFSPNC4B.js} +13 -13
  98. package/dist/cdn/RLV5JHIU.js +2 -0
  99. package/dist/cdn/RXOPHYUF.js +2 -0
  100. package/dist/cdn/{M73VTGBI.js → S2A7SDYB.js} +1 -1
  101. package/dist/cdn/{RYBSWXQQ.js → S2Y44VZV.js} +1 -1
  102. package/dist/cdn/{3ZYEIYTY.js → S6J35GRM.js} +1 -1
  103. package/dist/cdn/SIODWUWX.js +2 -0
  104. package/dist/cdn/{WZCJ2VDD.js → SNJPMQCE.js} +1 -1
  105. package/dist/cdn/{DUXRJBCP.js → SRLQU37I.js} +1 -1
  106. package/dist/cdn/TCUNTTNI.js +2 -0
  107. package/dist/cdn/{AOWNMC3W.js → TK235QG4.js} +1 -1
  108. package/dist/cdn/TM6TYAW2.js +90 -0
  109. package/dist/cdn/{ITSA4WXG.js → TRXDA7G2.js} +1 -1
  110. package/dist/cdn/U2ZKJCSY.js +27 -0
  111. package/dist/cdn/UBPOT5V3.js +2 -0
  112. package/dist/cdn/{QGDR24DC.js → UY66XIX3.js} +1 -1
  113. package/dist/cdn/{BAFYN4RD.js → V2DYKK6V.js} +1 -1
  114. package/dist/cdn/{QEPO225M.js → V6VJJHYJ.js} +1 -1
  115. package/dist/cdn/{YM2IDMZO.js → V73HMWMC.js} +1 -1
  116. package/dist/cdn/{7WIFBTQF.js → VCL4OTSQ.js} +6 -14
  117. package/dist/cdn/{Z23BVIGQ.js → VYCVNEK2.js} +1 -1
  118. package/dist/cdn/{2BM4W44V.js → WAJG744H.js} +1 -1
  119. package/dist/cdn/{CDJCXGBN.js → WFWEWVGR.js} +1 -1
  120. package/dist/cdn/WRLN7DLT.js +2 -0
  121. package/dist/cdn/X3CDW2ME.js +78 -0
  122. package/dist/cdn/{3TIQRBWC.js → XDONARND.js} +1 -1
  123. package/dist/cdn/{MGEDATQ7.js → XF5N3NI5.js} +1 -1
  124. package/dist/cdn/{63ZMLOEP.js → XKBOPER7.js} +1 -1
  125. package/dist/cdn/XOEFU24R.js +2 -0
  126. package/dist/cdn/{U6JZYJ4D.js → Y3Q6SFIV.js} +1 -1
  127. package/dist/cdn/Y6KZTCZD.js +2 -0
  128. package/dist/cdn/{WI67R264.js → YKSW755L.js} +1 -1
  129. package/dist/cdn/YM4U4HSN.js +2 -0
  130. package/dist/cdn/{OQOCOC5R.js → ZQAD6SUE.js} +1 -1
  131. package/dist/cdn/index.js +1 -1
  132. package/dist/chunks/assessBuildRequest.js +13 -13
  133. package/dist/chunks/assessUpdateRequest.js +29 -26
  134. package/dist/chunks/assistantResponse.js +6 -14
  135. package/dist/chunks/classifyIntent.js +5 -5
  136. package/dist/chunks/updateDesign.js +1 -1
  137. package/dist/components/arcgis-solutions-assistant/customElement.js +449 -446
  138. package/dist/docs/api.json +1 -1
  139. package/dist/docs/docs.json +1 -1
  140. package/dist/docs/web-types.json +1 -1
  141. package/dist/solutions-components_commit.txt +7 -7
  142. package/package.json +3 -3
  143. package/dist/cdn/4MAZNAHZ.js +0 -2
  144. package/dist/cdn/4RU3GWUU.js +0 -2
  145. package/dist/cdn/6IBUETLU.js +0 -2
  146. package/dist/cdn/6ZN2VAXG.js +0 -2
  147. package/dist/cdn/7CAFUU5D.js +0 -2
  148. package/dist/cdn/APL6U736.js +0 -2
  149. package/dist/cdn/BBECVTV3.js +0 -2
  150. package/dist/cdn/BG4LNU44.js +0 -2
  151. package/dist/cdn/BZLMMSFW.js +0 -2
  152. package/dist/cdn/CUOHPTI7.js +0 -2
  153. package/dist/cdn/CVHXDPJO.js +0 -2
  154. package/dist/cdn/DVWIWECZ.js +0 -27
  155. package/dist/cdn/F2V6IA23.js +0 -2
  156. package/dist/cdn/GWJRCE5C.js +0 -90
  157. package/dist/cdn/JGMNZLH4.js +0 -7
  158. package/dist/cdn/JMYENPUQ.js +0 -2
  159. package/dist/cdn/LBY3ZNJE.js +0 -2
  160. package/dist/cdn/LZDMYPQ2.js +0 -75
  161. package/dist/cdn/PYBOC3DB.js +0 -2
  162. package/dist/cdn/RMEDO4JC.js +0 -2
  163. package/dist/cdn/SO27FVOH.js +0 -2
  164. package/dist/cdn/SWM5KEF6.js +0 -2
  165. package/dist/cdn/TDH6R4JP.js +0 -2
  166. package/dist/cdn/TWJSFINX.js +0 -2
  167. package/dist/cdn/UQDRAXO2.js +0 -2
  168. package/dist/cdn/UQN2JCKP.js +0 -2
  169. package/dist/cdn/WDRZR4N3.js +0 -2
  170. package/dist/cdn/WW6SEFWM.js +0 -2
  171. package/dist/cdn/XDF5MAGN.js +0 -2
  172. package/dist/cdn/Y7F2QFO6.js +0 -2
  173. package/dist/cdn/YCJJWOTP.js +0 -2
  174. package/dist/cdn/ZWKTEPK3.js +0 -2
@@ -1,28 +1,28 @@
1
1
  /* COPYRIGHT Esri - https://js.arcgis.com/5.1/LICENSE.txt */
2
- import { c as ke } from "../../chunks/runtime.js";
3
- import { u as Ae } from "../../chunks/useT9n.js";
4
- import { LitElement as Le, createEvent as te, nothing as se } from "@arcgis/lumina";
5
- import { css as Re, html as I } from "lit";
6
- import { unsafeHTML as $e } from "lit/directives/unsafe-html.js";
7
- import { useContextConsumer as ie } from "@arcgis/lumina/context";
8
- import { c as De, b as Fe } from "../../chunks/deployAppContexts.js";
9
- import { T as $ } from "../../chunks/interfaces.js";
10
- import { m as Ne } from "../../chunks/helpers.js";
11
- import ne from "@arcgis/core/config.js";
12
- import { createRef as Me, ref as Be } from "lit-html/directives/ref.js";
13
- import { Annotation as b, StateGraph as V, START as J, END as x, NodeInterrupt as ae } from "@langchain/langgraph/web";
14
- import { createAgentRuntimeState as G, sendTraceMessage as w, invokeStructuredPrompt as T, getEmbeddings as Pe, cosineSimilarity as qe, invokeTextPrompt as Ue } from "@arcgis/ai-orchestrator";
2
+ import { c as Ae } from "../../chunks/runtime.js";
3
+ import { u as Le } from "../../chunks/useT9n.js";
4
+ import { LitElement as $e, createEvent as se, nothing as ie } from "@arcgis/lumina";
5
+ import { css as Fe, html as C } from "lit";
6
+ import { unsafeHTML as Re } from "lit/directives/unsafe-html.js";
7
+ import { useContextConsumer as ne } from "@arcgis/lumina/context";
8
+ import { c as De, b as Ne } from "../../chunks/deployAppContexts.js";
9
+ import { T as R } from "../../chunks/interfaces.js";
10
+ import { m as Me } from "../../chunks/helpers.js";
11
+ import ae from "@arcgis/core/config.js";
12
+ import { createRef as Be, ref as Pe } from "lit-html/directives/ref.js";
13
+ import { Annotation as y, StateGraph as J, START as G, END as S, NodeInterrupt as re } from "@langchain/langgraph/web";
14
+ import { createAgentRuntimeState as H, sendTraceMessage as w, invokeStructuredPrompt as k, getEmbeddings as qe, cosineSimilarity as Ue, invokeTextPrompt as Oe } from "@arcgis/ai-orchestrator";
15
15
  import r, { z as D } from "zod";
16
- import * as H from "@esri/arcgis-rest-portal";
17
- import { applyPatch as Oe } from "fast-json-patch";
16
+ import * as W from "@esri/arcgis-rest-portal";
17
+ import { applyPatch as ze } from "fast-json-patch";
18
18
  import "@langchain/core/messages";
19
- import { C as re } from "../../chunks/converter.js";
20
- import { v as U, b as O, S as ze, g as je } from "../../chunks/validators.js";
21
- import { t as le, g as B, c as ce, r as de, d as L } from "../../chunks/templates.js";
22
- import Ve from "@arcgis/core/portal/Portal.js";
23
- import Je from "@arcgis/core/portal/PortalItem.js";
24
- const Ge = 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 y(t, e) {
19
+ import { C as le } from "../../chunks/converter.js";
20
+ import { v as O, b as z, S as je, g as Ve } from "../../chunks/validators.js";
21
+ import { t as ce, g as P, c as de, r as ue, d as $ } from "../../chunks/templates.js";
22
+ import Je from "@arcgis/core/portal/Portal.js";
23
+ import Ge from "@arcgis/core/portal/PortalItem.js";
24
+ const He = Fe`: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
26
  const s = Object.entries(t).find(
27
27
  ([i]) => i.endsWith(`/${e}.md`)
28
28
  );
@@ -35,10 +35,10 @@ ${Object.keys(t).join(`
35
35
  );
36
36
  return await s[1]();
37
37
  }
38
- function P(t) {
38
+ function q(t) {
39
39
  return t?.configurable?.context?.translations;
40
40
  }
41
- function ue(t) {
41
+ function pe(t) {
42
42
  if (typeof window > "u" || t.length <= 1)
43
43
  return;
44
44
  const e = t.map((i) => i.solution.id), s = t.map((i) => i.solution.title);
@@ -60,7 +60,7 @@ function ue(t) {
60
60
  }
61
61
  }));
62
62
  }
63
- function pe(t) {
63
+ function me(t) {
64
64
  if (typeof window > "u" || !t)
65
65
  return;
66
66
  const e = new CustomEvent("solutionIDFromAssistant", {
@@ -70,21 +70,21 @@ function pe(t) {
70
70
  });
71
71
  window.dispatchEvent(e);
72
72
  }
73
- const He = /* @__PURE__ */ Object.assign({
73
+ const We = /* @__PURE__ */ Object.assign({
74
74
  "./prompts/solutions_explorer_description.md": () => import("../../chunks/solutions_explorer_description.js").then((t) => t.default)
75
75
  });
76
- function We(t) {
76
+ function Qe(t) {
77
77
  return t.replace(/<sup>\[\[(\d+)\]\]\(([^)]+)\)<\/sup>/g, '<sup><a href="$2">&#91;$1&#93;</a></sup>');
78
78
  }
79
- function Qe(t, e) {
79
+ function Ke(t, e) {
80
80
  const s = [];
81
81
  return (e?.configurable?.context?.configContext.allCards ?? []).forEach((n) => {
82
- const o = n.title;
83
- if (!o)
82
+ const a = n.title;
83
+ if (!a)
84
84
  return;
85
- const a = new RegExp(`(?<![\\p{L}\\p{N}])${o}(?![\\p{L}\\p{N}])`, "giu");
85
+ const o = new RegExp(`(?<![\\p{L}\\p{N}])${a}(?![\\p{L}\\p{N}])`, "giu");
86
86
  let l = !1;
87
- t = t.replace(a, () => (l = !0, `<a href="" target="solutionId:${n.deployCommonId}">${o}</a>`)), l && s.push({
87
+ t = t.replace(o, () => (l = !0, `<a href="" target="solutionId:${n.deployCommonId}">${a}</a>`)), l && s.push({
88
88
  solution: {
89
89
  title: n.title,
90
90
  id: n.deployCommonId,
@@ -95,13 +95,13 @@ function Qe(t, e) {
95
95
  });
96
96
  }), { source: t, allMatches: s };
97
97
  }
98
- function Ke(t) {
98
+ function Ye(t) {
99
99
  return t && t.helperServices.aiAssistantServices ? `${t.helperServices.aiAssistantServices.url}/skills/doc_ai_assistant/chat` : null;
100
100
  }
101
- function me(t) {
101
+ function ge(t) {
102
102
  return t && t.helperServices.aiAssistantServices ? `${t.helperServices.aiAssistantServices.url}/skills/doc_ai_assistant/api/pre-chat` : null;
103
103
  }
104
- async function j(t, e, s) {
104
+ async function V(t, e, s) {
105
105
  const i = await fetch(e, {
106
106
  method: "POST",
107
107
  headers: {
@@ -114,32 +114,32 @@ async function j(t, e, s) {
114
114
  throw new Error(`HTTP ${i.status} calling ${e}`);
115
115
  return i.json();
116
116
  }
117
- const Ye = (t) => new Promise((e) => setTimeout(e, t)), Xe = b.Root({
117
+ const Xe = (t) => new Promise((e) => setTimeout(e, t)), Ze = y.Root({
118
118
  // Provides agentExecutionContext, outputMessage, summary, and status
119
119
  // channels with the orchestrator's standard reducers/defaults so the
120
120
  // sub-agent reports back through the same shape the orchestrator
121
121
  // persists into priorSteps.
122
- ...G(),
123
- solutionResponse: b({
122
+ ...H(),
123
+ solutionResponse: y({
124
124
  reducer: (t, e) => e ?? null,
125
125
  default: () => null
126
126
  }),
127
- documentSkillUrl: b({
127
+ documentSkillUrl: y({
128
128
  reducer: (t, e) => e ?? null,
129
129
  default: () => null
130
130
  }),
131
131
  // Persisted across turns via the graph checkpointer so follow-up questions
132
132
  // continue the same service conversation. Null on the very first interaction
133
133
  // or after messages are cleared.
134
- conversationId: b({
134
+ conversationId: y({
135
135
  reducer: (t, e) => e ?? t,
136
136
  default: () => null
137
137
  })
138
- }), Ze = () => new V(Xe).addNode("initializeAgent", tt).addNode("askSolutionsQuestions", et).addEdge(J, "initializeAgent").addEdge("initializeAgent", "askSolutionsQuestions").addEdge("askSolutionsQuestions", x), ge = async (t, e, s, i) => {
138
+ }), et = () => new J(Ze).addNode("initializeAgent", st).addNode("askSolutionsQuestions", tt).addEdge(G, "initializeAgent").addEdge("initializeAgent", "askSolutionsQuestions").addEdge("askSolutionsQuestions", S), he = async (t, e, s, i) => {
139
139
  if (!t) return;
140
- const n = me(t);
140
+ const n = ge(t);
141
141
  if (!n) return;
142
- const a = { context: {
142
+ const o = { context: {
143
143
  kind: "DocAIAssistantRequest",
144
144
  filters: {
145
145
  products: "ArcGIS Solutions",
@@ -149,17 +149,17 @@ const Ye = (t) => new Promise((e) => setTimeout(e, t)), Xe = b.Root({
149
149
  }
150
150
  }
151
151
  } };
152
- i && (a.conversationId = i), j(a, n, e ?? "");
153
- }, et = async (t, e) => {
152
+ i && (o.conversationId = i), V(o, n, e ?? "");
153
+ }, tt = async (t, e) => {
154
154
  if (e?.configurable?.abortSignal?.aborted)
155
155
  return {};
156
- const s = P(e), i = t.documentSkillUrl;
156
+ const s = q(e), i = t.documentSkillUrl;
157
157
  let n = [];
158
158
  await w(
159
159
  { text: s.agentProgress.explorerAgentSearching },
160
160
  e
161
161
  );
162
- let o = await j(
162
+ let a = await V(
163
163
  {
164
164
  message: t.agentExecutionContext.userRequest,
165
165
  conversationId: e?.configurable?.context?.convoId ?? void 0,
@@ -177,22 +177,22 @@ const Ye = (t) => new Promise((e) => setTimeout(e, t)), Xe = b.Root({
177
177
  i,
178
178
  e?.configurable?.context?.token ?? ""
179
179
  );
180
- o.conversationId && e?.configurable?.context?.setConversationId && e.configurable.context.setConversationId(o.conversationId);
181
- let a = {
182
- message: o.message,
183
- conversationId: o.conversationId,
184
- hasMore: o.hasMore,
185
- ackSequenceNumber: o.sequenceNumber,
186
- inquiryId: o.inquiryId
180
+ a.conversationId && e?.configurable?.context?.setConversationId && e.configurable.context.setConversationId(a.conversationId);
181
+ let o = {
182
+ message: a.message,
183
+ conversationId: a.conversationId,
184
+ hasMore: a.hasMore,
185
+ ackSequenceNumber: a.sequenceNumber,
186
+ inquiryId: a.inquiryId
187
187
  }, l = "";
188
188
  const u = async (m) => {
189
- const f = m.context?.results?.[0]?.reply ?? "";
190
- if (f !== "") {
191
- const g = We(f), A = Qe(g, e);
192
- l = A.source, n = [
189
+ const b = m.context?.results?.[0]?.reply ?? "";
190
+ if (b !== "") {
191
+ const g = Qe(b), L = Ke(g, e);
192
+ l = L.source, n = [
193
193
  ...n,
194
- ...A.allMatches.filter(
195
- (E) => !n.some((k) => k.solution.id === E.solution.id)
194
+ ...L.allMatches.filter(
195
+ (E) => !n.some((A) => A.solution.id === E.solution.id)
196
196
  )
197
197
  ];
198
198
  }
@@ -202,45 +202,45 @@ const Ye = (t) => new Promise((e) => setTimeout(e, t)), Xe = b.Root({
202
202
  d === 1 ? g = s.agentProgress.explorerAgentReading : d === 2 ? g = s.agentProgress.explorerAgentReviewing : d === 3 && (g = s.agentProgress.explorerAgentPreparing), await w({ text: g }, e);
203
203
  }
204
204
  };
205
- for (await u(o); a.hasMore; ) {
205
+ for (await u(a); o.hasMore; ) {
206
206
  if (e?.configurable?.abortSignal?.aborted)
207
207
  return {};
208
- await Ye(500), o = await j(
208
+ await Xe(500), a = await V(
209
209
  {
210
- conversationId: a.conversationId,
211
- ackSequenceNumber: a.ackSequenceNumber,
212
- inquiryId: a.inquiryId
210
+ conversationId: o.conversationId,
211
+ ackSequenceNumber: o.ackSequenceNumber,
212
+ inquiryId: o.inquiryId
213
213
  },
214
214
  i,
215
215
  e?.configurable?.context?.token ?? ""
216
- ), a = {
217
- message: o.message,
218
- conversationId: o.conversationId,
219
- hasMore: o.hasMore,
220
- ackSequenceNumber: o.sequenceNumber,
221
- inquiryId: o.inquiryId
222
- }, await u(o);
216
+ ), o = {
217
+ message: a.message,
218
+ conversationId: a.conversationId,
219
+ hasMore: a.hasMore,
220
+ ackSequenceNumber: a.sequenceNumber,
221
+ inquiryId: a.inquiryId
222
+ }, await u(a);
223
223
  }
224
- return me(e?.configurable?.context.portal) && ge(
224
+ return ge(e?.configurable?.context.portal) && he(
225
225
  e?.configurable?.context.portal,
226
226
  e?.configurable?.context.token ?? "",
227
227
  e?.configurable?.context.configContext.locale ?? "en",
228
- a.conversationId
229
- ), n.length && (n.length === 1 ? pe(n[0].solution.id) : ue(n)), {
228
+ o.conversationId
229
+ ), n.length && (n.length === 1 ? me(n[0].solution.id) : pe(n)), {
230
230
  outputMessage: l,
231
231
  summary: l,
232
232
  status: "success",
233
- solutionResponse: a,
234
- conversationId: a.conversationId
233
+ solutionResponse: o,
234
+ conversationId: o.conversationId
235
235
  };
236
- }, tt = async (t, e) => {
236
+ }, st = async (t, e) => {
237
237
  let s = null;
238
- return t.documentSkillUrl === null && e?.configurable?.context?.portal && (s = Ke(e.configurable.context.portal)), {
238
+ return t.documentSkillUrl === null && e?.configurable?.context?.portal && (s = Ye(e.configurable.context.portal)), {
239
239
  documentSkillUrl: s
240
240
  };
241
241
  };
242
- await y(He, "solutions_explorer_description");
243
- const he = (t) => {
242
+ await v(We, "solutions_explorer_description");
243
+ const fe = (t) => {
244
244
  if (t && Array.isArray(t.id) && t.id.length > 0)
245
245
  return t.id[t.id.length - 1].replace("Message", "").toLowerCase();
246
246
  if (t && typeof t._getType == "function")
@@ -250,8 +250,8 @@ const he = (t) => {
250
250
  return "human";
251
251
  }
252
252
  return "human";
253
- }, st = (t) => {
254
- const e = he(t);
253
+ }, it = (t) => {
254
+ const e = fe(t);
255
255
  if (t && t.kwargs)
256
256
  return {
257
257
  role: e,
@@ -266,10 +266,10 @@ const he = (t) => {
266
266
  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;
267
267
  }
268
268
  return { role: "human", content: String(t) };
269
- }, it = (t) => he(t) === "human", nt = (t, e = 3) => t.filter((s) => it(s)).slice(-e).map(st), ot = (t, e = " ") => nt(t).map((n) => n.content).join(e).trim(), at = { 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?" }, rt = {
270
- builderMessages: at
269
+ }, nt = (t) => fe(t) === "human", at = (t, e = 3) => t.filter((s) => nt(s)).slice(-e).map(it), ot = (t, e = " ") => at(t).map((n) => n.content).join(e).trim(), rt = { 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?" }, lt = {
270
+ builderMessages: rt
271
271
  };
272
- class fe {
272
+ class be {
273
273
  constructor(e, s, i = !0) {
274
274
  this.isValid = !0, this.issues = [], this.fieldNameRegistry = null, this.response = e, this.template = s, this.newDesign = i, this.validate();
275
275
  }
@@ -299,21 +299,21 @@ class fe {
299
299
  return;
300
300
  }
301
301
  if (!e.addLayers) {
302
- const i = new Set(e.layers.map((o) => o.id)), n = new Set(s.layers.map((o) => o.id));
303
- if (!(i.size === n.size && [...i].every((o) => n.has(o))))
302
+ const i = new Set(e.layers.map((a) => a.id)), n = new Set(s.layers.map((a) => a.id));
303
+ if (!(i.size === n.size && [...i].every((a) => n.has(a))))
304
304
  this.logIssue(`Feature Layer '${e.itemId}' had its layer ids altered.`);
305
305
  else
306
- for (const o of e.layers)
307
- if (o.type) {
308
- const a = s.layers.find((l) => l.id === o.id);
309
- 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.`);
306
+ for (const a of e.layers)
307
+ if (a.type) {
308
+ const o = s.layers.find((l) => l.id === a.id);
309
+ o && o.type !== a.type && this.logIssue(`Layer '${a.id}' type '${o.type}' does not match template type '${a.type}'. This layer type is immutable.`);
310
310
  }
311
311
  }
312
312
  }
313
313
  validateSolutionProps() {
314
- const e = this.response.solution.title, s = this.response.solution.description, i = U(e ?? "");
314
+ const e = this.response.solution.title, s = this.response.solution.description, i = O(e ?? "");
315
315
  if (i.isValid || this.logIssue(`Solution title is invalid (${i.errorType}).`), s) {
316
- const n = O(s, 2048);
316
+ const n = z(s, 2048);
317
317
  n.isValid || this.logIssue(`Solution description is invalid (${n.errorType}).`);
318
318
  }
319
319
  }
@@ -324,9 +324,9 @@ class fe {
324
324
  ]);
325
325
  for (const s of this.response.items) {
326
326
  e.has(s.type) && s.title.length > 100 && this.logIssue(`Service name '${s.title}' exceeds 100 characters.`);
327
- const i = U(s.title ?? "");
327
+ const i = O(s.title ?? "");
328
328
  if (i.isValid || this.logIssue(`Item '${s.id}' title is invalid (${i.errorType}).`), s.description) {
329
- const n = O(s.description, 2048);
329
+ const n = z(s.description, 2048);
330
330
  n.isValid || this.logIssue(`Item '${s.id}' description is invalid (${n.errorType}).`);
331
331
  }
332
332
  }
@@ -338,7 +338,7 @@ class fe {
338
338
  s.length !== new Set(s).size && this.logIssue(`Layer names must be unique (case-insensitive). Layer names in design: ${s}.`);
339
339
  for (const i of this.response.featureLayer.layers) {
340
340
  this.validateLayer(i, this.response.featureLayer.addLayers);
341
- const n = e.find((o) => o.id === i.id);
341
+ const n = e.find((a) => a.id === i.id);
342
342
  n && this.validateRequiredFields(i, n);
343
343
  }
344
344
  }
@@ -351,9 +351,9 @@ class fe {
351
351
  !s && e.typeMutable === !0 && e.type === "Table" && this.logIssue(
352
352
  `Layer '${e.name}' cannot be a Table. It may be a Point, Line, or Polygon.`
353
353
  );
354
- const i = U(e.name ?? "");
354
+ const i = O(e.name ?? "");
355
355
  if (i.isValid || this.logIssue(`Layer '${e.name}' name is invalid (${i.errorType}).`), e.description) {
356
- const n = O(e.description, 2048);
356
+ const n = z(e.description, 2048);
357
357
  n.isValid || this.logIssue(`Layer '${e.name}' description is invalid (${n.errorType}).`);
358
358
  }
359
359
  this.validateLayerFields(e);
@@ -366,22 +366,22 @@ class fe {
366
366
  "created_user",
367
367
  "last_edited_date",
368
368
  "last_edited_user"
369
- ]), i = e.customFields.map((c) => c.name), n = new Set(e.requiredFields.map((c) => c.name)), o = [...new Set(
369
+ ]), i = e.customFields.map((c) => c.name), n = new Set(e.requiredFields.map((c) => c.name)), a = [...new Set(
370
370
  i.filter((c) => s.has(c))
371
371
  )];
372
- for (const c of o)
372
+ for (const c of a)
373
373
  this.logIssue(`Layer '${e.name}' field '${c}' collides with a reserved system field name.`);
374
- const a = [...new Set(
374
+ const o = [...new Set(
375
375
  i.filter((c) => n.has(c))
376
376
  )];
377
- for (const c of a)
377
+ for (const c of o)
378
378
  this.logIssue(`Layer '${e.name}' field '${c}' collides with a required field name.`);
379
- if (!o.length && !a.length) {
379
+ if (!a.length && !o.length) {
380
380
  const c = e.systemFields ?? [], m = [
381
381
  ...e.customFields,
382
382
  ...e.requiredFields,
383
383
  ...c
384
- ].map((f) => f.name);
384
+ ].map((b) => b.name);
385
385
  m.length !== new Set(m).size && this.logIssue(`Layer '${e.name}' has duplicate fields: ${JSON.stringify(m)}.`);
386
386
  }
387
387
  const l = e.systemFields ?? [], u = [...e.customFields, ...e.requiredFields, ...l].map((c) => c.name.toLowerCase());
@@ -396,13 +396,13 @@ class fe {
396
396
  return e.slice(0, 31);
397
397
  const n = e.toLowerCase();
398
398
  i.delete(n);
399
- const o = e.slice(0, 31);
400
- let a = o, l = 1;
401
- for (; i.has(a.toLowerCase()); ) {
399
+ const a = e.slice(0, 31);
400
+ let o = a, l = 1;
401
+ for (; i.has(o.toLowerCase()); ) {
402
402
  const u = `_${l}`, c = Math.max(1, 31 - u.length);
403
- a = `${o.slice(0, c)}${u}`, l += 1;
403
+ o = `${a.slice(0, c)}${u}`, l += 1;
404
404
  }
405
- return i.add(a.toLowerCase()), a;
405
+ return i.add(o.toLowerCase()), o;
406
406
  }
407
407
  validateField(e) {
408
408
  const s = /^\p{L}/u, i = /^.[\p{L}\p{M}\p{N}_]*$/u;
@@ -414,26 +414,26 @@ class fe {
414
414
  e.name = this.getUniqueTruncatedFieldName(e.name), console.debug(`Field '${n}' exceeds 31 characters. Auto-fixing to '${e.name}'.`);
415
415
  } else
416
416
  this.logIssue(`Field '${e.name}' exceeds 31 characters.`);
417
- if (ze.has(e.name.toLowerCase()))
417
+ if (je.has(e.name.toLowerCase()))
418
418
  if (this.newDesign) {
419
419
  const n = e.name;
420
420
  e.name = `${n}_`, console.debug(`Field '${n}' is a SQL reserved keyword. Auto-fixing to '${e.name}'.`);
421
421
  } else
422
422
  this.logIssue(`Field '${e.name}' is a SQL reserved keyword.`);
423
- if (e.type === "string" && (typeof e.length != "number" || Number.isNaN(e.length) ? this.logIssue(`Field '${e.name}' length is invalid (must be a number between 1 and 4000).`) : je(e.length).isValid || this.logIssue(`Field '${e.name}' length is invalid (must be a number between 1 and 4000).`)), 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)) {
424
- const n = Math.max(...e.choiceList.map((o) => o.length));
425
- n > e.length && (this.newDesign ? (console.debug(`Field '${e.name}' has a field length of ${e.length}, which is insufficient for the required length of ${n}. Auto-fixing to ${n}.`), e.length = n) : this.logIssue(`Field '${e.name}' has a field length of ${e.length}, which is insufficient for the choiceList options.`));
423
+ if (e.type === "string" && (typeof e.length != "number" || Number.isNaN(e.length) ? this.logIssue(`Field '${e.name}' length is invalid (must be a number between 1 and 4000).`) : Ve(e.length).isValid || this.logIssue(`Field '${e.name}' length is invalid (must be a number between 1 and 4000).`)), 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)) {
424
+ const n = Math.max(...e.choiceList.map((a) => a.length));
425
+ 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.`));
426
426
  }
427
427
  }
428
428
  logIssue(e) {
429
429
  console.debug(e), this.issues.push(e), this.isValid = !1;
430
430
  }
431
431
  }
432
- const lt = r.object({
432
+ const ct = r.object({
433
433
  key: r.string().describe("Stable key identifier for the string."),
434
434
  value: r.string().describe("Display value for the string."),
435
435
  description: r.string().describe("Explanation of where/how the string is used.")
436
- }), ct = r.object({
436
+ }), dt = r.object({
437
437
  id: r.string().describe("ArcGIS item id (32 hex characters)."),
438
438
  title: r.string().describe("Item title."),
439
439
  description: r.string().describe("Item description."),
@@ -465,7 +465,7 @@ const lt = r.object({
465
465
  "List of allowed values for string fields with a controlled vocabulary. Null if unrestricted or not applicable."
466
466
  ),
467
467
  length: r.number().int().nullable().describe("Maximum string length for string fields. Null for non-string fields.")
468
- }), dt = r.object({
468
+ }), ut = r.object({
469
469
  id: r.number().int().describe("Layer/table id within the feature service."),
470
470
  type: r.enum(["Point", "Polyline", "Polygon", "Table"]).describe("Layer type."),
471
471
  typeMutable: r.boolean().describe("Indicates whether the layer type can be changed."),
@@ -473,76 +473,75 @@ const lt = r.object({
473
473
  description: r.string().describe("Layer/table description."),
474
474
  customFields: r.array(oe).describe("User/business fields specific to the solution."),
475
475
  requiredFields: r.array(oe).describe("Fields required for solution functionality (e.g., relationship keys).")
476
- }), ut = r.object({
476
+ }), pt = r.object({
477
477
  itemId: r.string().describe("ArcGIS item id for the feature layer."),
478
478
  addLayers: r.boolean().describe("Indicates whether new layers can be added during solution design."),
479
- layers: r.array(dt)
480
- }), W = r.object({
479
+ layers: r.array(ut)
480
+ }), Q = r.object({
481
481
  response: r.string().describe("Conversational response to the user's query."),
482
482
  solution: r.object({
483
483
  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."),
484
484
  title: r.string().describe("Title of the solution."),
485
485
  description: r.string().describe("Description of the solution."),
486
486
  tags: r.array(r.string()).describe("Keywords/tags associated with the solution."),
487
- strings: r.array(lt).describe("Localized strings/labels used by apps (dashboards, forms, etc.).")
487
+ strings: r.array(ct).describe("Localized strings/labels used by apps (dashboards, forms, etc.).")
488
488
  }),
489
- items: r.array(ct).describe("ArcGIS items that belong to the solution (apps, maps, layers, etc.)."),
490
- featureLayer: ut.describe("Primary feature layer item and its schema/layers/tables details.")
491
- }), pt = r.object({
489
+ items: r.array(dt).describe("ArcGIS items that belong to the solution (apps, maps, layers, etc.)."),
490
+ featureLayer: pt.describe("Primary feature layer item and its schema/layers/tables details.")
491
+ }), mt = r.object({
492
492
  op: r.enum(["add", "remove", "replace", "move", "copy"]).describe("RFC 6902 operation type."),
493
493
  path: r.string().describe("RFC 6901 JSON Pointer to the target location."),
494
494
  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.`),
495
495
  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.")
496
- }), mt = r.object({
497
- response: r.string().describe("Conversational response describing the accepted design changes."),
498
- patches: r.array(pt).describe("Minimal RFC 6902 patch operations needed to update the current design.")
499
496
  }), gt = r.object({
500
- response: r.string().describe("Short, user-friendly explanation of why the requested update was not applied.")
497
+ response: r.string().describe("Conversational response describing the accepted design changes."),
498
+ patches: r.array(mt).describe("Minimal RFC 6902 patch operations needed to update the current design.")
501
499
  }), ht = r.object({
500
+ response: r.string().describe("Short, user-friendly explanation of why the requested update was not applied.")
501
+ }), ft = r.object({
502
502
  assistantResponse: r.string().describe("Natural-language response for the user."),
503
503
  isValidUpdate: r.boolean().describe("True only when the request is in scope for supported design updates.")
504
- }), ft = r.object({
505
- matchedTitles: r.array(r.string()).describe("Titles of solutions that match the user's request. Empty array if no strong match.")
506
504
  }), bt = r.object({
505
+ matchedTitles: r.array(r.string()).describe("Titles of solutions that match the user's request. Empty array if no strong match.")
506
+ }), yt = r.object({
507
507
  templateId: r.string().min(1).describe("Template id from the available template list."),
508
508
  confidence: r.number().min(0).max(1).describe("Confidence score from 0 to 1 for this template match."),
509
509
  templateDescription: r.string().min(1).describe("Short action‑oriented description of the template in the user's use case/workflow, starting with a verb.")
510
- }), yt = r.object({
510
+ }), vt = r.object({
511
511
  assistantResponse: r.string().nullable().describe("Natural-language response for the user."),
512
512
  isValidUseCase: r.boolean().describe("True only when the request is concrete, appropriate, and has at least one matching template."),
513
- matchedTemplates: r.array(bt).describe("Ordered list of matching templates, best match first. Empty when no valid match exists."),
514
- rationale: r.string().min(1).describe("A brief rationale for the choice for isValidUseCase and matchedTemplates (≤140 characters)")
515
- }), vt = (t) => t.length ? t.map((e, s) => `${s + 1}. ${e}`).join(`
516
- `) : "No validation errors were provided.", xt = async (t) => {
513
+ matchedTemplates: r.array(yt).describe("Ordered list of matching templates, best match first. Empty when no valid match exists.")
514
+ }), xt = (t) => t.length ? t.map((e, s) => `${s + 1}. ${e}`).join(`
515
+ `) : "No validation errors were provided.", wt = async (t) => {
517
516
  const {
518
517
  query: e,
519
518
  validationIssues: s,
520
519
  recentMessages: i,
521
520
  fallbackMessage: n,
522
- promptModules: o
521
+ promptModules: a
523
522
  } = t;
524
523
  try {
525
- return (await T({
526
- promptText: await y(o, "explainValidationFailure"),
524
+ return (await k({
525
+ promptText: await v(a, "explainValidationFailure"),
527
526
  modelTier: "fast",
528
527
  temperature: 0,
529
- schema: gt,
528
+ schema: ht,
530
529
  messages: i,
531
530
  inputVariables: {
532
531
  query: e,
533
532
  validationIssueCount: String(s.length),
534
- validationIssues: vt(s)
533
+ validationIssues: xt(s)
535
534
  }
536
535
  })).response?.trim() || n;
537
- } catch (a) {
536
+ } catch (o) {
538
537
  return console.warn(
539
538
  "Natural language response failed:",
540
- { error: a }
539
+ { error: o }
541
540
  ), n;
542
541
  }
543
- }, Q = (t) => t in L, wt = 5, St = 0.8, It = 0.15, Ct = "Web Mapping Application", _t = "Embeddings";
544
- let F = null, z = null, N = null, M = null;
545
- const Tt = "Build", C = /* @__PURE__ */ Object.assign({
542
+ }, K = (t) => t in $, St = 5, It = 0.8, Ct = 0.15, _t = "Web Mapping Application", Tt = "Embeddings";
543
+ let N = null, j = null, M = null, B = null;
544
+ const kt = "Build", _ = /* @__PURE__ */ Object.assign({
546
545
  "./prompts/assessBuildRequest.md": () => import("../../chunks/assessBuildRequest.js").then((t) => t.default),
547
546
  "./prompts/assessUpdateRequest.md": () => import("../../chunks/assessUpdateRequest.js").then((t) => t.default),
548
547
  "./prompts/description.md": () => import("../../chunks/description2.js").then((t) => t.default),
@@ -550,52 +549,53 @@ const Tt = "Build", C = /* @__PURE__ */ Object.assign({
550
549
  "./prompts/explainValidationFailure.md": () => import("../../chunks/explainValidationFailure.js").then((t) => t.default),
551
550
  "./prompts/findExistingSolution.md": () => import("../../chunks/findExistingSolution.js").then((t) => t.default),
552
551
  "./prompts/updateDesign.md": () => import("../../chunks/updateDesign.js").then((t) => t.default)
553
- }), Et = rt.builderMessages, h = (t, e, s) => P(e)?.builderMessages?.[t] ?? Et[t], be = (t) => {
552
+ }), Et = lt.builderMessages, h = (t) => t?.configurable?.abortSignal.aborted ?? !1, f = (t, e, s) => q(e)?.builderMessages?.[t] ?? Et[t], ye = (t) => {
554
553
  typeof window < "u" && window.dispatchEvent(new CustomEvent("arcgis-solution-design-update", {
555
554
  detail: t
556
555
  }));
557
- }, kt = async (t, e, s) => {
556
+ }, At = async (t, e, s) => {
558
557
  if (!t) return null;
559
- const i = `type:"${Ct}" AND typekeywords:${_t} AND group:${t}`;
560
- return (await H.searchItems({
558
+ const i = `type:"${_t}" AND typekeywords:${Tt} AND group:${t}`;
559
+ return (await W.searchItems({
561
560
  q: i,
562
561
  params: e ? { token: e } : void 0,
563
562
  portal: s,
564
563
  num: 1
565
564
  }))?.results?.[0] ?? null;
566
565
  };
567
- async function At(t, e, s) {
566
+ async function Lt(t, e, s, i) {
568
567
  try {
569
- const i = await kt(t, e, s);
570
- if (!i) return null;
571
- const n = new Je({ id: i.id });
572
- return await n.load(), await n.fetchData("json");
568
+ const n = await At(t, e, s);
569
+ if (!n || h(i))
570
+ return null;
571
+ const a = new Ge({ id: n.id });
572
+ return await a.load(), h(i) ? null : await a.fetchData("json");
573
573
  } catch {
574
574
  return null;
575
575
  }
576
576
  }
577
- const Lt = async (t, e, s) => {
577
+ const $t = async (t, e, s) => {
578
578
  if (!t) return [];
579
- const i = `type:Solution AND typekeywords:${Tt} AND group:${t}`;
580
- return (await H.searchItems({
579
+ const i = `type:Solution AND typekeywords:${kt} AND group:${t}`;
580
+ return (await W.searchItems({
581
581
  q: i,
582
582
  params: e ? { token: e } : void 0,
583
583
  portal: s,
584
584
  num: 100
585
585
  }))?.results ?? [];
586
- }, Rt = async (t, e, s) => {
586
+ }, Ft = async (t, e, s) => {
587
587
  try {
588
- const i = await H.getItemData(t, {
588
+ const i = await W.getItemData(t, {
589
589
  params: e ? { token: e } : void 0,
590
590
  portal: s
591
591
  }), n = i?.buildSolution;
592
592
  if (!n) return null;
593
- const o = i?.params, a = o && typeof o == "object" && !Array.isArray(o) ? o : null;
594
- return { buildSolution: n, params: a };
593
+ const a = i?.params, o = a && typeof a == "object" && !Array.isArray(a) ? a : null;
594
+ return { buildSolution: n, params: o };
595
595
  } catch {
596
596
  return null;
597
597
  }
598
- }, _ = (t, e = {}) => {
598
+ }, T = (t, e = {}) => {
599
599
  let s = t;
600
600
  return "itemId" in e && (s = {
601
601
  ...s,
@@ -613,108 +613,110 @@ const Lt = async (t, e, s) => {
613
613
  ...s,
614
614
  templateId: e.templateId ?? null
615
615
  }), s;
616
- }, ye = (t, e) => {
616
+ }, ve = (t, e) => {
617
617
  if (t == null || e == null)
618
618
  return { ok: !1, error: "design or sourceBuildSolution is null/undefined" };
619
619
  try {
620
620
  const s = structuredClone(e);
621
- return new re({ buildSolution: s }).applyLlmTemplate(t), { ok: !0 };
621
+ return new le({ buildSolution: s }).applyLlmTemplate(t), { ok: !0 };
622
622
  } catch (s) {
623
623
  return {
624
624
  ok: !1,
625
625
  error: s instanceof Error ? s.stack ?? s.message : String(s)
626
626
  };
627
627
  }
628
- }, K = async (t) => {
629
- if (z) {
630
- Object.entries(z).forEach(([a, l]) => {
631
- L[a] && (L[a].initialTemplate = l);
628
+ }, Y = async (t) => {
629
+ if (j) {
630
+ Object.entries(j).forEach(([o, l]) => {
631
+ $[o] && ($[o].initialTemplate = l);
632
632
  });
633
633
  return;
634
634
  }
635
- const e = t?.configurable?.context?.token, s = xe(t), i = we(t);
635
+ const e = t?.configurable?.context?.token, s = we(t), i = Se(t);
636
636
  if (!s) {
637
637
  console.warn("Solution Builder: missing primarySolutionsGroupId in appConfig; skipping live template hydration.");
638
638
  return;
639
639
  }
640
- const n = await Lt(s, e, i), o = {};
641
- await Promise.all(n.map(async (a) => {
642
- const l = a.properties?.templateInfo;
640
+ const n = await $t(s, e, i), a = {};
641
+ h(t) || (await Promise.all(n.map(async (o) => {
642
+ const l = o.properties?.templateInfo;
643
643
  if (!l || typeof l != "object") return;
644
644
  const u = l.id;
645
- if (typeof u != "string" || o[u]) return;
646
- const c = await Rt(a.id, e, i);
647
- if (!c) return;
648
- const { buildSolution: m, params: f } = c;
645
+ if (typeof u != "string" || a[u]) return;
646
+ const c = await Ft(o.id, e, i);
647
+ if (!c || h(t))
648
+ return;
649
+ const { buildSolution: m, params: b } = c;
649
650
  if (typeof m == "object" && m !== null && "solution" in m) {
650
651
  const g = m.solution;
651
- g.thumbnailUrl = a.thumbnail ? `${i ?? "https://www.arcgis.com/sharing/rest"}/content/items/${a.id}/info/${a.thumbnail}` : void 0, g.item = a;
652
+ g.thumbnailUrl = o.thumbnail ? `${i ?? "https://www.arcgis.com/sharing/rest"}/content/items/${o.id}/info/${o.thumbnail}` : void 0, g.item = o;
652
653
  }
653
654
  const d = {
654
655
  ...l,
655
656
  buildSolution: m
656
657
  };
657
- o[u] = _(
658
- new re(d).dumpToLlmTemplate(),
658
+ a[u] = T(
659
+ new le(d).dumpToLlmTemplate(),
659
660
  {
660
- itemId: a.id,
661
+ itemId: o.id,
661
662
  sourceBuildSolution: structuredClone(m),
662
- params: f ? structuredClone(f) : null
663
+ params: b ? structuredClone(b) : null
663
664
  }
664
- ), L[u] = {
665
+ ), $[u] = {
665
666
  ...l,
666
- initialTemplate: o[u]
667
+ initialTemplate: a[u]
667
668
  };
668
- })), z = o;
669
- }, ve = (t) => {
669
+ })), j = a);
670
+ }, xe = (t) => {
670
671
  const e = t?.configurable?.context?.token;
671
672
  return typeof e != "string" || !e.trim() ? null : e;
672
- }, xe = (t) => {
673
+ }, we = (t) => {
673
674
  const e = t?.configurable?.context?.configContext?.primarySolutionsGroupId;
674
675
  return typeof e != "string" || !e.trim() ? null : e;
675
- }, we = (t) => {
676
+ }, Se = (t) => {
676
677
  const e = t?.configurable?.context?.configContext?.portalURL;
677
678
  if (!(typeof e != "string" || !e.trim()))
678
679
  return `${e.replace(/\/+$/, "")}/sharing/rest`;
679
- }, $t = async (t) => {
680
+ }, Rt = async (t) => {
680
681
  await Promise.all([
681
- Ie(t),
682
- K(t)
682
+ Ce(t),
683
+ Y(t)
683
684
  ]);
684
- }, Se = async (t) => {
685
- const e = ve(t);
686
- (!N || e && e !== M) && (M = e ?? M, N = $t(t).catch((i) => {
687
- throw N = null, M = null, i;
688
- })), await N;
689
- };
690
- async function Ie(t) {
691
- if (F) return F;
685
+ }, Ie = async (t) => {
692
686
  const e = xe(t);
687
+ (!M || e && e !== B) && (B = e ?? B, M = Rt(t).catch((i) => {
688
+ throw M = null, B = null, i;
689
+ })), await M;
690
+ };
691
+ async function Ce(t) {
692
+ if (N) return N;
693
+ const e = we(t);
693
694
  if (!e)
694
695
  return console.warn("Solution Builder: missing primarySolutionsGroupId in appConfig; skipping embeddings load."), null;
695
- const s = we(t), i = t?.configurable?.context?.configContext?.portalURL;
696
- await new Ve(i ? { url: i } : void 0).load();
697
- const o = ve(t) ?? void 0, a = await At(e, o, s);
698
- return a ? (F = a.items, F) : null;
696
+ const s = Se(t), i = t?.configurable?.context?.configContext?.portalURL;
697
+ if (await new Je(i ? { url: i } : void 0).load(), h(t))
698
+ return null;
699
+ const a = xe(t) ?? void 0, o = await Lt(e, a, s, t);
700
+ return h(t) ? null : o ? (N = o.items, N) : null;
699
701
  }
700
- const Dt = () => Object.entries(L).map(([t, e]) => `ID: ${t}
702
+ const Dt = () => Object.entries($).map(([t, e]) => `ID: ${t}
701
703
  Label: ${e.label}
702
704
  Description: ${e.description}`).join(`
703
705
 
704
- `), Ft = (t) => {
706
+ `), Nt = (t) => {
705
707
  const e = t?.configurable?.context?.solutionDesignJson;
706
708
  if (typeof e != "string" || !e.trim())
707
709
  return null;
708
710
  try {
709
- const s = JSON.parse(e), i = _(
711
+ const s = JSON.parse(e), i = T(
710
712
  { response: "", ...s },
711
713
  { itemId: s?.solution?.itemId ?? null }
712
- ), n = W.safeParse(i);
714
+ ), n = Q.safeParse(i);
713
715
  if (!n.success)
714
716
  return null;
715
- const { response: o, ...a } = n.data, l = s.templateId, u = typeof l == "string" && Q(l) ? l : null;
716
- return _(
717
- a,
717
+ const { response: a, ...o } = n.data, l = s.templateId, u = typeof l == "string" && K(l) ? l : null;
718
+ return T(
719
+ o,
718
720
  {
719
721
  sourceBuildSolution: s.sourceBuildSolution,
720
722
  templateId: u,
@@ -724,75 +726,81 @@ Description: ${e.description}`).join(`
724
726
  } catch {
725
727
  return null;
726
728
  }
727
- }, Nt = b.Root({
728
- ...G(),
729
+ }, Mt = y.Root({
730
+ ...H(),
729
731
  /** Optional human-readable template description retained for UI use. */
730
- templateDescription: b({
732
+ templateDescription: y({
731
733
  reducer: (t, e) => typeof e == "string" || e === null ? e : t ?? null,
732
734
  default: () => null
733
735
  }),
734
736
  /** Current editable design payload being refined across turns. */
735
- currentDesign: b({
737
+ currentDesign: y({
736
738
  reducer: (t = null, e) => e === void 0 ? t : e ?? null,
737
739
  default: () => null
738
740
  }),
739
741
  /** Initial request assessment produced by the intake prompt. */
740
- assessment: b({
742
+ assessment: y({
741
743
  reducer: (t = null, e) => e === void 0 ? t : e ?? null,
742
744
  default: () => null
743
745
  }),
744
746
  /** Template selected automatically or by human-in-the-loop choice. */
745
- selectedTemplate: b({
747
+ selectedTemplate: y({
746
748
  reducer: (t = null, e) => e === void 0 ? t : e ?? null,
747
749
  default: () => null
748
750
  }),
749
751
  /** Update request assessment produced when an active design exists. */
750
- updateAssessment: b({
752
+ updateAssessment: y({
751
753
  reducer: (t = null, e) => e === void 0 ? t : e ?? null,
752
754
  default: () => null
753
755
  }),
754
756
  /** Existing solution matches surfaced before building a new solution. */
755
- existingMatches: b({
757
+ existingMatches: y({
756
758
  reducer: (t = [], e) => e === void 0 ? t : e ?? [],
757
759
  default: () => []
758
760
  }),
759
761
  /** User decision for whether to continue building after existing matches are shown. */
760
- continueBuilding: b({
762
+ continueBuilding: y({
761
763
  reducer: (t = null, e) => e === void 0 ? t : e ?? null,
762
764
  default: () => null
763
765
  })
764
- }), Mt = (t, e) => {
765
- const s = Ft(e), i = s?.templateId ?? null, n = {};
766
+ }), Bt = (t, e) => {
767
+ if (h(e))
768
+ return {};
769
+ const s = Nt(e), i = s?.templateId ?? null, n = {};
766
770
  return JSON.stringify(t.currentDesign) !== JSON.stringify(s) && (n.currentDesign = s), i && t.selectedTemplate !== i && (n.selectedTemplate = i), n;
767
- }, Bt = async (t, e) => {
768
- await w({ text: h("understandingRequest", e) }, e), await Se(e);
769
- const s = t.agentExecutionContext.userRequest, i = Dt(), n = t.agentExecutionContext.messages.slice(-11), o = await T({
770
- promptText: await y(C, "assessBuildRequest"),
771
+ }, Pt = async (t, e) => {
772
+ if (h(e))
773
+ return {};
774
+ await w({ text: f("understandingRequest", e) }, e), await Ie(e);
775
+ const s = t.agentExecutionContext.userRequest, i = Dt(), n = t.agentExecutionContext.messages.slice(-11), a = await k({
776
+ promptText: await v(_, "assessBuildRequest"),
771
777
  modelTier: "advanced",
772
778
  temperature: 0,
773
- schema: yt,
779
+ schema: vt,
774
780
  messages: n,
775
781
  inputVariables: { query: s, availableTemplates: i }
776
- }), a = o.matchedTemplates.filter(
777
- (d) => Q(d.templateId)
782
+ }), o = a.matchedTemplates.filter(
783
+ (d) => K(d.templateId)
778
784
  ), l = {
779
- ...o,
780
- matchedTemplates: a
781
- }, [u, c] = a, f = !!u && u.confidence >= St && (c === void 0 || u.confidence - c.confidence >= It) ? u.templateId : null;
785
+ ...a,
786
+ matchedTemplates: o
787
+ }, [u, c] = o, b = !!u && u.confidence >= It && (c === void 0 || u.confidence - c.confidence >= Ct) ? u.templateId : null;
782
788
  return {
783
789
  assessment: l,
784
- selectedTemplate: f,
790
+ selectedTemplate: b,
785
791
  existingMatches: [],
786
792
  continueBuilding: null
787
793
  };
788
- }, Pt = (t) => {
794
+ }, qt = (t) => {
789
795
  const e = t.assessment?.assistantResponse ?? "";
790
796
  return {
791
797
  outputMessage: e,
792
798
  summary: e,
793
799
  status: "success"
794
800
  };
795
- }, qt = async (t, e) => {
801
+ }, Ut = async (t, e) => {
802
+ if (h(e))
803
+ return {};
796
804
  const { currentDesign: s } = t;
797
805
  if (!s)
798
806
  return {
@@ -801,59 +809,68 @@ Description: ${e.description}`).join(`
801
809
  isValidUpdate: !0
802
810
  }
803
811
  };
804
- await w({ text: h("understandingRequest", e) }, e);
812
+ await w({ text: f("understandingRequest", e) }, e);
805
813
  const i = t.agentExecutionContext.userRequest, n = t.agentExecutionContext.messages.slice(-11);
806
814
  return {
807
- updateAssessment: await T({
808
- promptText: await y(C, "assessUpdateRequest"),
815
+ updateAssessment: await k({
816
+ promptText: await v(_, "assessUpdateRequest"),
809
817
  modelTier: "advanced",
810
818
  temperature: 0,
811
- schema: ht,
819
+ schema: ft,
812
820
  messages: n,
813
821
  inputVariables: {
814
- currentDesign: JSON.stringify(le(s)),
822
+ currentDesign: JSON.stringify(ce(s)),
815
823
  query: i
816
824
  }
817
825
  })
818
826
  };
819
- }, Ut = (t, e) => {
820
- const s = t.updateAssessment?.assistantResponse ?? h("applyChangeFailed", e);
827
+ }, Ot = (t, e) => {
828
+ const s = t.updateAssessment?.assistantResponse ?? f("applyChangeFailed", e);
821
829
  return {
822
830
  outputMessage: s,
823
831
  summary: s,
824
832
  status: "success"
825
833
  };
826
- }, Ot = (t, e) => {
834
+ }, zt = (t, e) => {
835
+ if (h(e))
836
+ return {};
827
837
  const { hitlResponse: s } = e.configurable, i = "selectTemplate", n = t.assessment?.matchedTemplates.filter(
828
- (c) => Q(c.templateId)
829
- ) ?? [], o = n.map((c) => `${c.templateDescription}`);
838
+ (c) => K(c.templateId)
839
+ ) ?? [], a = n.map((c) => `${c.templateDescription}`);
830
840
  if (s?.agentId !== "solutionBuilder" || s.id !== i) {
831
841
  const c = {
832
842
  agentId: "solutionBuilder",
833
843
  id: i,
834
844
  kind: "singleSelection",
835
- message: h("selectTemplatePrompt", e),
836
- metadata: [...o]
845
+ message: f("selectTemplatePrompt", e),
846
+ metadata: [...a]
837
847
  };
838
- throw new ae(c);
848
+ throw new re(c);
839
849
  }
840
- const a = String(s.payload ?? ""), l = o.findIndex((c) => c === a);
850
+ const o = String(s.payload ?? ""), l = a.findIndex((c) => c === o);
841
851
  return {
842
852
  selectedTemplate: (l >= 0 ? n[l] : void 0)?.templateId ?? n[0]?.templateId ?? null
843
853
  };
844
- }, zt = async (t, e) => {
845
- await w({ text: h("searchingExistingSolutions", e) }, e);
846
- const s = t.agentExecutionContext.userRequest, i = ot(t.agentExecutionContext.messages) || s, n = await Ie(e);
854
+ }, jt = async (t, e) => {
855
+ if (h(e))
856
+ return {};
857
+ await w({ text: f("searchingExistingSolutions", e) }, e);
858
+ const s = t.agentExecutionContext.userRequest, i = ot(t.agentExecutionContext.messages) || s, n = await Ce(e);
859
+ if (h(e))
860
+ return {};
847
861
  if (!n)
848
862
  return console.warn("Solutions Search: failed to load solution embeddings cache; skipping search."), { existingMatches: [] };
849
863
  if (!n.length)
850
864
  return { existingMatches: [] };
851
- const [o] = await Pe([i]), a = n.map((d) => ({
865
+ const [a] = await qe([i]);
866
+ if (h(e))
867
+ return {};
868
+ const o = n.map((d) => ({
852
869
  solution: d,
853
- score: qe(o, d.embedding)
870
+ score: Ue(a, d.embedding)
854
871
  }));
855
- a.sort((d, g) => g.score - d.score);
856
- const l = a.slice(0, wt);
872
+ o.sort((d, g) => g.score - d.score);
873
+ const l = o.slice(0, St);
857
874
  if (!l.length)
858
875
  return { existingMatches: [] };
859
876
  const u = l.map(({ solution: d }) => `${d.title}
@@ -861,21 +878,23 @@ Snippet: ${d.snippet}
861
878
  Description: ${d.description}`).join(`
862
879
 
863
880
  `), c = t.agentExecutionContext.messages.slice(-11);
864
- return { existingMatches: (await T({
865
- promptText: await y(C, "findExistingSolution"),
881
+ return { existingMatches: (await k({
882
+ promptText: await v(_, "findExistingSolution"),
866
883
  modelTier: "fast",
867
884
  temperature: 0,
868
- schema: ft,
885
+ schema: bt,
869
886
  messages: c,
870
887
  inputVariables: { query: s, candidates: u }
871
888
  })).matchedTitles.map((d) => l.find(({ solution: g }) => g.title === d)).filter((d) => d !== void 0) };
872
- }, jt = (t, e) => {
889
+ }, Vt = (t, e) => {
890
+ if (h(e))
891
+ return {};
873
892
  const { existingMatches: s } = t, { hitlResponse: i } = e.configurable, n = `confirmExistingSolution:${s[0].solution.id}`;
874
893
  if (i?.agentId !== "solutionBuilder" || i.id !== n) {
875
- s.length === 1 ? pe(s[0].solution.id) : ue(s);
876
- const u = h("existingSolutionMatch", e), c = [
877
- h("continueBuildingYes", e),
878
- h("continueBuildingNo", e)
894
+ s.length === 1 ? me(s[0].solution.id) : pe(s);
895
+ const u = f("existingSolutionMatch", e), c = [
896
+ f("continueBuildingYes", e),
897
+ f("continueBuildingNo", e)
879
898
  ], m = {
880
899
  agentId: "solutionBuilder",
881
900
  id: n,
@@ -883,121 +902,131 @@ Description: ${d.description}`).join(`
883
902
  message: u,
884
903
  metadata: c
885
904
  };
886
- throw new ae(m);
905
+ throw new re(m);
887
906
  }
888
- const o = String(i.payload ?? "").trim(), a = h("continueBuildingNo", e);
889
- return { continueBuilding: o !== a };
890
- }, Vt = (t, e) => {
891
- const s = h("continueBuildingDeclined", e);
907
+ const a = String(i.payload ?? "").trim(), o = f("continueBuildingNo", e);
908
+ return { continueBuilding: a !== o };
909
+ }, Jt = (t, e) => {
910
+ const s = f("continueBuildingDeclined", e);
892
911
  return {
893
912
  outputMessage: s,
894
913
  summary: s,
895
914
  status: "success"
896
915
  };
897
- }, Ce = async (t, e) => {
898
- await Se(e);
916
+ }, _e = async (t, e) => {
917
+ if (h(e))
918
+ return {};
919
+ if (await Ie(e), h(e))
920
+ return {};
899
921
  const { currentDesign: s } = t, i = t.agentExecutionContext.userRequest;
900
- await w({ text: h("creatingDesign", e) }, e);
901
- let n = B(t.selectedTemplate);
902
- if (n?.initialTemplate || (await K(e), n = B(t.selectedTemplate)), !n?.initialTemplate)
922
+ await w({ text: f("creatingDesign", e) }, e);
923
+ let n = P(t.selectedTemplate);
924
+ if (n?.initialTemplate || (await Y(e), n = P(t.selectedTemplate)), h(e))
925
+ return {};
926
+ if (!n?.initialTemplate)
903
927
  throw new Error("No hydrated templates are available for solution design.");
904
- const o = _(
928
+ const a = T(
905
929
  s ?? n.initialTemplate,
906
930
  {
907
931
  itemId: (s ?? n.initialTemplate)?.solution?.itemId ?? null,
908
932
  sourceBuildSolution: s?.sourceBuildSolution ?? n.initialTemplate.sourceBuildSolution,
909
933
  params: s?.params ?? n.initialTemplate.params ?? null
910
934
  }
911
- ), a = t.agentExecutionContext.messages.slice(-11), l = await T({
912
- promptText: await y(C, "designSolution"),
935
+ ), o = t.agentExecutionContext.messages.slice(-11), l = await k({
936
+ promptText: await v(_, "designSolution"),
913
937
  modelTier: "advanced",
914
938
  temperature: 0,
915
- schema: W,
916
- messages: a,
939
+ schema: Q,
940
+ messages: o,
917
941
  inputVariables: {
918
- currentDesign: JSON.stringify(ce(o)),
942
+ currentDesign: JSON.stringify(de(a)),
919
943
  templateInstructions: n.instructions,
920
944
  query: i
921
945
  }
922
- }), { response: u, featureLayer: c, ...m } = l, f = de(
946
+ });
947
+ if (await w({ text: " of design solution 1" }, e), h(e))
948
+ return {};
949
+ const { response: u, featureLayer: c, ...m } = l, b = ue(
923
950
  c,
924
- o.featureLayer
925
- ), d = _(
926
- { ...m, featureLayer: f },
951
+ a.featureLayer
952
+ ), d = T(
953
+ { ...m, featureLayer: b },
927
954
  {
928
- itemId: o?.solution?.itemId,
929
- sourceBuildSolution: o.sourceBuildSolution,
955
+ itemId: a?.solution?.itemId,
956
+ sourceBuildSolution: a.sourceBuildSolution,
930
957
  templateId: t.selectedTemplate ?? null,
931
- params: o.params ?? null
958
+ params: a.params ?? null
932
959
  }
933
- ), g = new fe(d, n.initialTemplate);
960
+ ), g = new be(d, n.initialTemplate);
934
961
  if (!g.isValid)
935
962
  return console.warn(
936
963
  "[SolutionBuilder] designSolution validation failed:",
937
964
  { issues: g.issues, llmResponse: l }
938
965
  ), {
939
- outputMessage: h("createDesignFailed", e)
966
+ outputMessage: f("createDesignFailed", e)
940
967
  };
941
- const A = d.sourceBuildSolution, E = ye(d, A);
968
+ const L = d.sourceBuildSolution, E = ve(d, L);
942
969
  if (!E.ok) {
943
970
  console.warn(
944
971
  "[SolutionBuilder] designSolution Esri JSON conversion failed:",
945
972
  { error: E.error, llmResponse: l, design: d }
946
973
  );
947
- const k = h("createDesignFailed", e);
974
+ const A = f("createDesignFailed", e);
948
975
  return {
949
- outputMessage: k,
950
- summary: k,
976
+ outputMessage: A,
977
+ summary: A,
951
978
  status: "success"
952
979
  };
953
980
  }
954
- return be(d), {
981
+ return h(e) ? {} : (ye(d), {
955
982
  outputMessage: u,
956
983
  summary: u,
957
984
  status: "success",
958
985
  currentDesign: d
959
- };
960
- }, Jt = async (t, e) => {
986
+ });
987
+ }, Gt = async (t, e) => {
988
+ if (h(e))
989
+ return {};
961
990
  const { currentDesign: s } = t;
962
991
  if (!s)
963
- return Ce(t, e);
992
+ return _e(t, e);
964
993
  const i = t.agentExecutionContext.userRequest, n = t.agentExecutionContext.messages.slice(-11);
965
- await w({ text: h("updatingDesign", e) }, e);
966
- let o;
994
+ await w({ text: f("updatingDesign", e) }, e);
995
+ let a;
967
996
  try {
968
- o = await T({
969
- promptText: await y(C, "updateDesign"),
997
+ a = await k({
998
+ promptText: await v(_, "updateDesign"),
970
999
  modelTier: "advanced",
971
1000
  temperature: 0,
972
- schema: mt,
1001
+ schema: gt,
973
1002
  messages: n,
974
1003
  inputVariables: {
975
- currentDesign: JSON.stringify(le(s)),
1004
+ currentDesign: JSON.stringify(ce(s)),
976
1005
  query: i
977
1006
  }
978
1007
  });
979
1008
  } catch (p) {
980
1009
  console.warn("[SolutionBuilder] updateDesign structured prompt failed:", p);
981
- const v = h("applyChangeFailed", e);
1010
+ const x = f("applyChangeFailed", e);
982
1011
  return {
983
- outputMessage: v,
984
- summary: v,
1012
+ outputMessage: x,
1013
+ summary: x,
985
1014
  status: "success"
986
1015
  };
987
1016
  }
988
- const { response: a, patches: l } = o;
1017
+ const { response: o, patches: l } = a;
989
1018
  if (!l || l.length === 0)
990
1019
  return {
991
- outputMessage: a,
992
- summary: a,
1020
+ outputMessage: o,
1021
+ summary: o,
993
1022
  status: "success"
994
1023
  };
995
1024
  const u = (p) => {
996
1025
  try {
997
1026
  return JSON.parse(p);
998
1027
  } catch {
999
- const v = p.replace(/[\u0000-\u001F]/g, (ee) => {
1000
- switch (ee) {
1028
+ const x = p.replace(/[\u0000-\u001F]/g, (te) => {
1029
+ switch (te) {
1001
1030
  case "\b":
1002
1031
  return "\\b";
1003
1032
  case "\f":
@@ -1010,11 +1039,11 @@ Description: ${d.description}`).join(`
1010
1039
  case " ":
1011
1040
  return "\\t";
1012
1041
  default:
1013
- return "\\u" + ee.charCodeAt(0).toString(16).padStart(4, "0");
1042
+ return "\\u" + te.charCodeAt(0).toString(16).padStart(4, "0");
1014
1043
  }
1015
1044
  });
1016
1045
  try {
1017
- return JSON.parse(v);
1046
+ return JSON.parse(x);
1018
1047
  } catch {
1019
1048
  return p;
1020
1049
  }
@@ -1024,44 +1053,44 @@ Description: ${d.description}`).join(`
1024
1053
  path: p.path.replace(/\/+$/, ""),
1025
1054
  ...p.value != null && p.value !== "" ? { value: u(p.value) } : {},
1026
1055
  ...p.from != null && p.from !== "" ? { from: p.from } : {}
1027
- }))].sort((p, v) => p.op !== "remove" || v.op !== "remove" ? 0 : v.path.localeCompare(p.path, void 0, { numeric: !0 })), f = structuredClone(
1028
- ce(s)
1056
+ }))].sort((p, x) => p.op !== "remove" || x.op !== "remove" ? 0 : x.path.localeCompare(p.path, void 0, { numeric: !0 })), b = structuredClone(
1057
+ de(s)
1029
1058
  );
1030
1059
  try {
1031
- Oe(f, m, !0);
1060
+ ze(b, m, !0);
1032
1061
  } catch (p) {
1033
1062
  console.warn(
1034
1063
  "[SolutionBuilder] updateDesign JSON patch failed:",
1035
- { error: p, llmResponse: o, patches: m, patchTarget: f }
1064
+ { error: p, llmResponse: a, patches: m, patchTarget: b }
1036
1065
  );
1037
- const v = h("applyChangeFailed", e);
1066
+ const x = f("applyChangeFailed", e);
1038
1067
  return {
1039
- outputMessage: v,
1040
- summary: v,
1068
+ outputMessage: x,
1069
+ summary: x,
1041
1070
  status: "success"
1042
1071
  };
1043
1072
  }
1044
- const d = _(
1045
- { response: "", ...f },
1073
+ const d = T(
1074
+ { response: "", ...b },
1046
1075
  { itemId: s.solution?.itemId ?? null }
1047
- ), g = W.safeParse(d);
1076
+ ), g = Q.safeParse(d);
1048
1077
  if (!g.success) {
1049
1078
  console.warn(
1050
1079
  "[SolutionBuilder] updateDesign schema validation failed:",
1051
- { errors: g.error.issues, llmResponse: o, patchedDesign: d }
1080
+ { errors: g.error.issues, llmResponse: a, patchedDesign: d }
1052
1081
  );
1053
- const p = h("applyChangeFailed", e);
1082
+ const p = f("applyChangeFailed", e);
1054
1083
  return {
1055
1084
  outputMessage: p,
1056
1085
  summary: p,
1057
1086
  status: "success"
1058
1087
  };
1059
1088
  }
1060
- const { response: A, featureLayer: E, ...k } = g.data, Te = de(
1089
+ const { response: L, featureLayer: E, ...A } = g.data, ke = ue(
1061
1090
  E,
1062
1091
  s.featureLayer
1063
- ), S = _(
1064
- { ...k, featureLayer: Te },
1092
+ ), I = T(
1093
+ { ...A, featureLayer: ke },
1065
1094
  {
1066
1095
  itemId: s.solution?.itemId,
1067
1096
  sourceBuildSolution: s.sourceBuildSolution,
@@ -1069,21 +1098,23 @@ Description: ${d.description}`).join(`
1069
1098
  params: s.params ?? null
1070
1099
  }
1071
1100
  );
1072
- let R = B(t.selectedTemplate);
1073
- if (R?.initialTemplate || (await K(e), R = B(t.selectedTemplate)), !R?.initialTemplate)
1101
+ let F = P(t.selectedTemplate);
1102
+ if (F?.initialTemplate || (await Y(e), F = P(t.selectedTemplate)), h(e))
1103
+ return {};
1104
+ if (!F?.initialTemplate)
1074
1105
  throw new Error("No hydrated templates are available for solution design.");
1075
- const q = new fe(S, R.initialTemplate, !1);
1076
- if (!q.isValid) {
1106
+ const U = new be(I, F.initialTemplate, !1);
1107
+ if (!U.isValid) {
1077
1108
  console.warn(
1078
1109
  "[SolutionBuilder] updateDesign validation failed:",
1079
- { issues: q.issues, llmResponse: o, patchedDesign: S }
1110
+ { issues: U.issues, llmResponse: a, patchedDesign: I }
1080
1111
  );
1081
- const p = await xt({
1112
+ const p = await wt({
1082
1113
  query: i,
1083
- validationIssues: q.issues,
1114
+ validationIssues: U.issues,
1084
1115
  recentMessages: n,
1085
- fallbackMessage: h("applyChangeFailed", e),
1086
- promptModules: C
1116
+ fallbackMessage: f("applyChangeFailed", e),
1117
+ promptModules: _
1087
1118
  });
1088
1119
  return {
1089
1120
  outputMessage: p,
@@ -1091,149 +1122,149 @@ Description: ${d.description}`).join(`
1091
1122
  status: "success"
1092
1123
  };
1093
1124
  }
1094
- const Ee = S.sourceBuildSolution, Z = ye(S, Ee);
1095
- if (!Z.ok) {
1125
+ const Ee = I.sourceBuildSolution, ee = ve(I, Ee);
1126
+ if (!ee.ok) {
1096
1127
  console.warn(
1097
1128
  "[SolutionBuilder] updateDesign Esri JSON conversion failed:",
1098
- { error: Z.error, llmResponse: o, design: S }
1129
+ { error: ee.error, llmResponse: a, design: I }
1099
1130
  );
1100
- const p = h("applyChangeFailed", e);
1131
+ const p = f("applyChangeFailed", e);
1101
1132
  return {
1102
1133
  outputMessage: p,
1103
1134
  summary: p,
1104
1135
  status: "success"
1105
1136
  };
1106
1137
  }
1107
- return be(S), {
1108
- outputMessage: a,
1109
- summary: a,
1138
+ return h(e) ? {} : (ye(I), {
1139
+ outputMessage: o,
1140
+ summary: o,
1110
1141
  status: "success",
1111
- currentDesign: S
1112
- };
1113
- }, Gt = (t) => t.currentDesign !== null ? "assessUpdateRequest" : "assessBuildRequest", Ht = (t) => !t.updateAssessment || !t.updateAssessment.isValidUpdate ? "invalidUpdateExit" : "updateDesign", Wt = (t) => !t.assessment || !t.assessment.isValidUseCase ? "invalidBuildExit" : !t.selectedTemplate && t.assessment.matchedTemplates.length > 1 ? "selectTemplateHIL" : "findExistingSolutions", Qt = (t) => t.existingMatches.length > 0 ? "confirmContinueBuildingHIL" : "designSolution", Kt = (t) => t.continueBuilding === !1 ? "declineContinueBuildingExit" : "designSolution", Yt = () => new V(Nt).addNode("syncCurrentDesignFromContext", Mt).addNode("assessBuildRequest", Bt).addNode("assessUpdateRequest", qt).addNode("invalidBuildExit", Pt).addNode("invalidUpdateExit", Ut).addNode("selectTemplateHIL", Ot).addNode("findExistingSolutions", zt).addNode("confirmContinueBuildingHIL", jt).addNode("declineContinueBuildingExit", Vt).addNode("designSolution", Ce).addNode("updateDesign", Jt).addEdge(J, "syncCurrentDesignFromContext").addConditionalEdges("syncCurrentDesignFromContext", Gt, {
1142
+ currentDesign: I
1143
+ });
1144
+ }, Ht = (t) => t.currentDesign !== null ? "assessUpdateRequest" : "assessBuildRequest", Wt = (t) => !t.updateAssessment || !t.updateAssessment.isValidUpdate ? "invalidUpdateExit" : "updateDesign", Qt = (t) => !t.assessment || !t.assessment.isValidUseCase ? "invalidBuildExit" : !t.selectedTemplate && t.assessment.matchedTemplates.length > 1 ? "selectTemplateHIL" : "findExistingSolutions", Kt = (t) => t.existingMatches.length > 0 ? "confirmContinueBuildingHIL" : "designSolution", Yt = (t) => t.continueBuilding === !1 ? "declineContinueBuildingExit" : "designSolution", Xt = () => new J(Mt).addNode("syncCurrentDesignFromContext", Bt).addNode("assessBuildRequest", Pt).addNode("assessUpdateRequest", Ut).addNode("invalidBuildExit", qt).addNode("invalidUpdateExit", Ot).addNode("selectTemplateHIL", zt).addNode("findExistingSolutions", jt).addNode("confirmContinueBuildingHIL", Vt).addNode("declineContinueBuildingExit", Jt).addNode("designSolution", _e).addNode("updateDesign", Gt).addEdge(G, "syncCurrentDesignFromContext").addConditionalEdges("syncCurrentDesignFromContext", Ht, {
1114
1145
  assessUpdateRequest: "assessUpdateRequest",
1115
1146
  assessBuildRequest: "assessBuildRequest"
1116
- }).addConditionalEdges("assessUpdateRequest", Ht, {
1147
+ }).addConditionalEdges("assessUpdateRequest", Wt, {
1117
1148
  invalidUpdateExit: "invalidUpdateExit",
1118
1149
  updateDesign: "updateDesign"
1119
- }).addConditionalEdges("assessBuildRequest", Wt, {
1150
+ }).addConditionalEdges("assessBuildRequest", Qt, {
1120
1151
  invalidBuildExit: "invalidBuildExit",
1121
1152
  selectTemplateHIL: "selectTemplateHIL",
1122
1153
  findExistingSolutions: "findExistingSolutions"
1123
- }).addEdge("invalidBuildExit", x).addEdge("invalidUpdateExit", x).addEdge("selectTemplateHIL", "findExistingSolutions").addConditionalEdges("findExistingSolutions", Qt, {
1154
+ }).addEdge("invalidBuildExit", S).addEdge("invalidUpdateExit", S).addEdge("selectTemplateHIL", "findExistingSolutions").addConditionalEdges("findExistingSolutions", Kt, {
1124
1155
  confirmContinueBuildingHIL: "confirmContinueBuildingHIL",
1125
1156
  designSolution: "designSolution"
1126
- }).addConditionalEdges("confirmContinueBuildingHIL", Kt, {
1157
+ }).addConditionalEdges("confirmContinueBuildingHIL", Yt, {
1127
1158
  declineContinueBuildingExit: "declineContinueBuildingExit",
1128
1159
  designSolution: "designSolution"
1129
- }).addEdge("declineContinueBuildingExit", x).addEdge("designSolution", x).addEdge("updateDesign", x);
1130
- await y(C, "description");
1131
- const Xt = D.object({
1160
+ }).addEdge("declineContinueBuildingExit", S).addEdge("designSolution", S).addEdge("updateDesign", S);
1161
+ await v(_, "description");
1162
+ const Zt = D.object({
1132
1163
  tool: D.enum(["explorer", "builder", "other"]).describe("The selected tool based on the user's query."),
1133
1164
  confidence: D.number().min(0).max(1).describe("A confidence score (0.00–1.00)."),
1134
1165
  rationale: D.string().min(1).describe("A brief rationale for the tool choice (≤140 characters)")
1135
- }), Y = /* @__PURE__ */ Object.assign({
1166
+ }), X = /* @__PURE__ */ Object.assign({
1136
1167
  "./prompts/assistantResponse.md": () => import("../../chunks/assistantResponse.js").then((t) => t.default),
1137
1168
  "./prompts/classifyIntent.md": () => import("../../chunks/classifyIntent.js").then((t) => t.default),
1138
1169
  "./prompts/description.md": () => import("../../chunks/description.js").then((t) => t.default)
1139
- }), X = (t) => {
1170
+ }), Z = (t) => {
1140
1171
  const e = new CustomEvent("assistantProcessing", {
1141
1172
  detail: { finished: !0, agent: t }
1142
1173
  });
1143
1174
  window.dispatchEvent(e);
1144
- }, _e = b.Root({
1145
- ...G(),
1146
- selectedTool: b({
1175
+ }, Te = y.Root({
1176
+ ...H(),
1177
+ selectedTool: y({
1147
1178
  reducer: (t, e) => e ?? null,
1148
1179
  default: () => null
1149
1180
  }),
1150
- intentRationale: b({
1181
+ intentRationale: y({
1151
1182
  reducer: (t, e) => e ?? null,
1152
1183
  default: () => null
1153
1184
  })
1154
- }), Zt = async (t, e) => {
1185
+ }), es = async (t, e) => {
1155
1186
  if (e?.configurable?.abortSignal?.aborted)
1156
1187
  return {};
1157
- const s = P(e);
1188
+ const s = q(e);
1158
1189
  await w(
1159
1190
  { text: s?.builderMessages.understandingRequest },
1160
1191
  e
1161
1192
  );
1162
- const i = t.agentExecutionContext.userRequest, n = t.agentExecutionContext.messages.slice(-11), o = e?.configurable?.context?.solutionDesignJson;
1163
- let a = !1;
1164
- if (typeof o == "string" && o.trim())
1193
+ const i = t.agentExecutionContext.userRequest, n = t.agentExecutionContext.messages.slice(-11), a = e?.configurable?.context?.solutionDesignJson;
1194
+ let o = !1;
1195
+ if (typeof a == "string" && a.trim())
1165
1196
  try {
1166
- a = JSON.parse(o).solution != null;
1197
+ o = JSON.parse(a).solution != null;
1167
1198
  } catch {
1168
- a = !1;
1199
+ o = !1;
1169
1200
  }
1170
- const l = await y(Y, "classifyIntent"), u = await T({
1201
+ const l = await v(X, "classifyIntent"), u = await k({
1171
1202
  promptText: l,
1172
1203
  modelTier: "advanced",
1173
1204
  temperature: 0,
1174
- schema: Xt,
1205
+ schema: Zt,
1175
1206
  messages: n,
1176
- inputVariables: { query: i, activeSolutionDesign: a }
1207
+ inputVariables: { query: i, activeSolutionDesign: o }
1177
1208
  });
1178
1209
  return {
1179
1210
  selectedTool: u.tool,
1180
1211
  intentRationale: u.rationale
1181
1212
  };
1182
- }, es = async (t, e) => {
1183
- if (e?.configurable?.abortSignal?.aborted)
1184
- return {};
1185
- const i = await Ze().compile().invoke(t, e);
1186
- return X("explorer"), i;
1187
1213
  }, ts = async (t, e) => {
1188
1214
  if (e?.configurable?.abortSignal?.aborted)
1189
1215
  return {};
1190
- const i = await Yt().compile().invoke(t, e);
1191
- return X("builder"), i;
1216
+ const i = await et().compile().invoke(t, e);
1217
+ return Z("explorer"), i;
1192
1218
  }, ss = async (t, e) => {
1193
1219
  if (e?.configurable?.abortSignal?.aborted)
1194
1220
  return {};
1195
- const s = P(e), i = t.agentExecutionContext.userRequest, n = t.intentRationale ?? "No rationale available.";
1221
+ const i = await Xt().compile().invoke(t, e);
1222
+ return Z("builder"), i;
1223
+ }, is = async (t, e) => {
1224
+ if (e?.configurable?.abortSignal?.aborted)
1225
+ return {};
1226
+ const s = q(e), i = t.agentExecutionContext.userRequest, n = t.intentRationale ?? "No rationale available.";
1196
1227
  await w(
1197
1228
  { text: s?.executingSolutionsAssistantAgent },
1198
1229
  e
1199
1230
  );
1200
- const o = await y(Y, "assistantResponse"), a = t.agentExecutionContext.messages.slice(-11), l = await Ue({
1201
- promptText: o,
1231
+ const a = await v(X, "assistantResponse"), o = t.agentExecutionContext.messages.slice(-11), l = await Oe({
1232
+ promptText: a,
1202
1233
  modelTier: "advanced",
1203
1234
  temperature: 0,
1204
- messages: a,
1235
+ messages: o,
1205
1236
  inputVariables: { query: i, rationale: n }
1206
1237
  });
1207
- return X("assistant"), {
1238
+ return Z("assistant"), {
1208
1239
  outputMessage: l,
1209
1240
  summary: l,
1210
1241
  status: "success"
1211
1242
  };
1212
- }, is = (t) => t.selectedTool ?? "other", ns = () => new V(_e).addNode("classifyIntent", Zt).addNode("routeToExplorer", es).addNode("routeToBuilder", ts).addNode("assistantResponse", ss).addEdge(J, "classifyIntent").addConditionalEdges("classifyIntent", is, {
1243
+ }, ns = (t) => t.selectedTool ?? "other", as = () => new J(Te).addNode("classifyIntent", es).addNode("routeToExplorer", ts).addNode("routeToBuilder", ss).addNode("assistantResponse", is).addEdge(G, "classifyIntent").addConditionalEdges("classifyIntent", ns, {
1213
1244
  explorer: "routeToExplorer",
1214
1245
  builder: "routeToBuilder",
1215
1246
  other: "assistantResponse"
1216
- }).addEdge("routeToExplorer", x).addEdge("routeToBuilder", x).addEdge("assistantResponse", x), os = await y(Y, "description"), as = {
1247
+ }).addEdge("routeToExplorer", S).addEdge("routeToBuilder", S).addEdge("assistantResponse", S), os = await v(X, "description"), rs = {
1217
1248
  id: "solutionsAssistant",
1218
1249
  name: "Solutions Assistant Agent",
1219
1250
  description: os,
1220
- createGraph: ns,
1221
- workspace: _e
1222
- }, rs = "https://links.esri.com/solutions/agol-organizational-account", ls = "https://links.esri.com/solutions/configure-assistants";
1223
- class cs extends Le {
1251
+ createGraph: as,
1252
+ workspace: Te
1253
+ }, ls = "https://links.esri.com/solutions/agol-organizational-account", cs = "https://links.esri.com/solutions/configure-assistants";
1254
+ class ds extends $e {
1224
1255
  constructor() {
1225
1256
  super(), this.open = !1, this.userFirstName = "", this.builderVisible = !1, this.hasActiveBuilderDesign = !1, this._conversationId = void 0, this._orgSettings = {
1226
1257
  aiAssistantsEnabled: !1,
1227
1258
  blockBetaApps: !0,
1228
1259
  colocateCompute: !1
1229
- }, this._suggestedPrompts = [], this._hasInteracted = !1, this._isMobile = window.innerWidth <= 800, this._translations = Ae({ 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 = Me(), this._configContextConsumer = ie({
1260
+ }, this._suggestedPrompts = [], this._hasInteracted = !1, this._isMobile = window.innerWidth <= 800, this._translations = Le({ 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 = Be(), this._configContextConsumer = ne({
1230
1261
  context: De,
1231
1262
  subscribe: !0,
1232
1263
  callback: (e) => {
1233
- e?.portalURL && (ne.portalUrl = e.portalURL), e?.userSession && !this.userFirstName && this._loadUserFirstName(), e?.authentication?.PortalSubset?.orgSettings && (this._orgSettings = e?.authentication?.PortalSubset?.orgSettings);
1264
+ e?.portalURL && (ae.portalUrl = e.portalURL), e?.userSession && !this.userFirstName && this._loadUserFirstName(), e?.authentication?.PortalSubset?.orgSettings && (this._orgSettings = e?.authentication?.PortalSubset?.orgSettings);
1234
1265
  }
1235
- }), this._builderDesignContextConsumer = ie({
1236
- context: Fe,
1266
+ }), this._builderDesignContextConsumer = ne({
1267
+ context: Ne,
1237
1268
  subscribe: !0,
1238
1269
  callback: (e) => {
1239
1270
  e?.design && (this._solutionDesignJson = JSON.stringify(e.design, null, 2));
@@ -1243,15 +1274,15 @@ class cs extends Le {
1243
1274
  }, this._chatStartTime = null, this._handleAssistantProcessingFinished = (e) => {
1244
1275
  const s = e;
1245
1276
  if (s.detail?.finished && this._chatStartTime !== null) {
1246
- const i = Ne(this._chatStartTime);
1277
+ const i = Me(this._chatStartTime);
1247
1278
  this._telemetry?.logEvent({
1248
- category: $.ASSISTANT,
1279
+ category: R.ASSISTANT,
1249
1280
  action: "Chat",
1250
1281
  dimensions: [s.detail.agent],
1251
1282
  metrics: [i]
1252
1283
  }), this._chatStartTime = null, this.assistantProcessing.emit(!1);
1253
1284
  }
1254
- }, this.closeAssistant = te(), this.assistantProcessing = te(), this._handleAssistantLinkClick = (e) => {
1285
+ }, this.closeAssistant = se(), this.assistantProcessing = se(), this._handleAssistantLinkClick = (e) => {
1255
1286
  const s = e.composedPath().find((i) => i instanceof HTMLAnchorElement);
1256
1287
  if (s?.href)
1257
1288
  if (e.preventDefault(), s.target.indexOf("solutionId:") > -1) {
@@ -1267,8 +1298,8 @@ class cs extends Le {
1267
1298
  }, this._checkURLOpenParameter = () => {
1268
1299
  this.open = this._configContextConsumer.value?.authentication?.SignInParam === "aiOpen" || this.open;
1269
1300
  }, this.listenOn(window, "arcgisFeedback", (e) => {
1270
- const s = e.detail, { agentPicked: i, taskAssigned: n, userMessage: o } = this._parseAgentPickedAndTask(s);
1271
- this._sendFeedback(s.content, o ?? n ?? "", s.feedback?.positive ? "Good" : s.feedback?.positive == "Bad" ? "Bad" : "N/A", i ?? "");
1301
+ const s = e.detail, { agentPicked: i, taskAssigned: n, userMessage: a } = this._parseAgentPickedAndTask(s);
1302
+ this._sendFeedback(s.content, a ?? n ?? "", s.feedback?.positive ? "Good" : s.feedback?.positive == "Bad" ? "Bad" : "N/A", i ?? "");
1272
1303
  }), this.listenOn(window, "clearAssistantConversation", () => {
1273
1304
  this._clearConversation();
1274
1305
  });
@@ -1277,7 +1308,7 @@ class cs extends Le {
1277
1308
  this.properties = { open: 5, userFirstName: 1, builderVisible: 5, hasActiveBuilderDesign: 5, _conversationId: 16, _orgSettings: 16, _suggestedPrompts: 16, _hasInteracted: 16, _isMobile: 16, _translations: 16, _builderWidth: 16, _solutionDesignJson: 16, _isAssistantBusy: 16, _isBuilderBusy: 16, _preChatCheck: 16, _showNewChatConfirm: 16 };
1278
1309
  }
1279
1310
  static {
1280
- this.styles = Ge;
1311
+ this.styles = He;
1281
1312
  }
1282
1313
  get _telemetry() {
1283
1314
  return this._configContextConsumer.value?.telemetrySession;
@@ -1292,45 +1323,39 @@ class cs extends Le {
1292
1323
  this._checkURLOpenParameter();
1293
1324
  }
1294
1325
  load() {
1295
- this._configContextConsumer.value?.portalURL && (ne.portalUrl = this._configContextConsumer.value.portalURL);
1326
+ this._configContextConsumer.value?.portalURL && (ae.portalUrl = this._configContextConsumer.value.portalURL);
1296
1327
  }
1297
1328
  firstUpdated(e) {
1298
1329
  this._loadUserFirstName();
1299
1330
  }
1300
1331
  willUpdate(e) {
1301
- e.has("open") && this.open && window.dispatchEvent(new CustomEvent("openAssistant")), this._configContextConsumer.value?.authentication && this._configContextConsumer.value?.userSession?.token && (this._preChatCheck || (ge(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;
1332
+ e.has("open") && this.open && window.dispatchEvent(new CustomEvent("openAssistant")), this._configContextConsumer.value?.authentication && this._configContextConsumer.value?.userSession?.token && (this._preChatCheck || (he(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;
1302
1333
  }
1303
1334
  _renderNoSign() {
1304
- return I`<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 ?? se} class="padding-top-10">${this._translations.signIn}</calcite-link></calcite-notice>`;
1335
+ return C`<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 ?? ie} class="padding-top-10">${this._translations.signIn}</calcite-link></calcite-notice>`;
1305
1336
  }
1306
1337
  _renderNoPermission() {
1307
- return I`<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">${$e(this._translations.noPermissionMessage.replace("{{orgUrl}}", rs).replace("{{configAI}}", ls))}</div></calcite-notice>`;
1338
+ return C`<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}}", ls).replace("{{configAI}}", cs))}</div></calcite-notice>`;
1308
1339
  }
1309
1340
  render() {
1310
1341
  let e = this._suggestedPrompts.length > 0 ? this._suggestedPrompts : this._hasInteracted ? [] : Object.values(this._translations.defaultFollowUpQuestions);
1311
- return this._suggestedPrompts.length > 0 ? e = this._suggestedPrompts : this._hasInteracted || (e = [...Object.values(this._translations.defaultFollowUpQuestions)]), I`<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 ? I`${!this._isMobile && I`<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=${() => {
1342
+ return this._suggestedPrompts.length > 0 ? e = this._suggestedPrompts : this._hasInteracted || (e = [...Object.values(this._translations.defaultFollowUpQuestions)]), C`<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 ? C`${!this._isMobile && C`<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=${() => {
1312
1343
  this._telemetry?.logEvent({
1313
- category: $.ASSISTANT,
1344
+ category: R.ASSISTANT,
1314
1345
  action: "Toggle Builder Panel",
1315
1346
  dimensions: [this.builderVisible ? "Close" : "Open"]
1316
1347
  }), window.dispatchEvent(new CustomEvent("toggleSolutionBuilder"));
1317
- }} scale=m slot=header-actions-end></calcite-action>` || ""}${!this._isMobile && I`<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 ?? se} .suggestedPrompts=${e} @arcgisSubmit=${(s) => {
1348
+ }} scale=m slot=header-actions-end></calcite-action>` || ""}${!this._isMobile && C`<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 ?? ie} .suggestedPrompts=${e} @arcgisSubmit=${(s) => {
1318
1349
  console.log("arcgis submit: ", s.detail), this._suggestedPrompts = [], e = [], this._hasInteracted = !0, this._chatStartTime = Date.now(), this.assistantProcessing.emit(!0);
1319
1350
  }} @arcgisFeedback=${(s) => {
1320
1351
  s.detail;
1321
- }} @arcgisInterrupt=${() => {
1322
- this._queryElementInShadowDom(this.el, ".footer-container", !0);
1323
- }} @arcgisInterruptCancel=${() => {
1324
- this._queryElementInShadowDom(this.el, ".footer-container", !1);
1325
- }} @arcgisInterruptSubmit=${() => {
1326
- this._queryElementInShadowDom(this.el, ".footer-container", !1);
1327
- }} ${Be(this._assistantRef)}><calcite-button appearance=transparent id=newChatButton icon-start=speech-bubble-plus kind=neutral .label=${this._translations.tooltips.newChat} @click=${() => {
1352
+ }} ${Pe(this._assistantRef)}><calcite-button appearance=transparent id=newChatButton icon-start=speech-bubble-plus kind=neutral .label=${this._translations.tooltips.newChat} @click=${() => {
1328
1353
  this.hasActiveBuilderDesign ? this._showNewChatConfirm = !0 : (this._telemetry?.logEvent({
1329
- category: $.ASSISTANT,
1354
+ category: R.ASSISTANT,
1330
1355
  action: "New Chat",
1331
1356
  dimensions: ["No Active Design"]
1332
1357
  }), this._clearConversation());
1333
- }} round scale=m slot=entry-actions-start>${this._translations.tooltips.newChat}</calcite-button><arcgis-assistant-agent .agent=${as} .context=${{
1358
+ }} round scale=m slot=entry-actions-start>${this._translations.tooltips.newChat}</calcite-button><arcgis-assistant-agent .agent=${rs} .context=${{
1334
1359
  token: this._configContextConsumer.value?.userSession?.token,
1335
1360
  configContext: this._configContextConsumer.value,
1336
1361
  convoId: this._conversationId,
@@ -1344,11 +1369,11 @@ class cs extends Le {
1344
1369
  clearSuggestedPrompts: () => {
1345
1370
  this._suggestedPrompts = [];
1346
1371
  }
1347
- }}></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 && I`<calcite-dialog close-disabled escape-disabled heading="Start new conversation" modal open>${this._translations.builderMessages.discardMessage}<calcite-button appearance=outline @click=${() => {
1372
+ }}></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 && C`<calcite-dialog close-disabled escape-disabled heading="Start new conversation" modal open>${this._translations.builderMessages.discardMessage}<calcite-button appearance=outline @click=${() => {
1348
1373
  this._showNewChatConfirm = !1;
1349
1374
  }} slot=footer-end>\r\n Cancel</calcite-button><calcite-button appearance=solid kind=danger @click=${() => {
1350
1375
  this._telemetry?.logEvent({
1351
- category: $.ASSISTANT,
1376
+ category: R.ASSISTANT,
1352
1377
  action: "New Chat",
1353
1378
  dimensions: ["With Design Discard"]
1354
1379
  }), this._showNewChatConfirm = !1, window.dispatchEvent(new CustomEvent("requestBuilderDiscard"));
@@ -1357,11 +1382,11 @@ class cs extends Le {
1357
1382
  }} slot=header-actions-end .text=${this._translations.tooltips.close}></calcite-action><calcite-tooltip placement=bottom reference-element=closeAssistantButton><span>${this._translations.tooltips.close}</span></calcite-tooltip></calcite-panel>`;
1358
1383
  }
1359
1384
  _clearConversation() {
1360
- this._conversationId = void 0, this._suggestedPrompts = [], this._hasInteracted = !1, this._assistantRef.value?.clearChatHistory(), this._queryElementInShadowDom(this.el, ".footer-container", !1);
1385
+ this._conversationId = void 0, this._suggestedPrompts = [], this._hasInteracted = !1, this._assistantRef.value?.clearChatHistory();
1361
1386
  }
1362
1387
  _sendFeedback(e, s, i, n) {
1363
- 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")}`;
1364
- window.open(o, "_blank");
1388
+ const a = `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")}`;
1389
+ window.open(a, "_blank");
1365
1390
  }
1366
1391
  async _loadUserFirstName() {
1367
1392
  try {
@@ -1374,14 +1399,14 @@ class cs extends Le {
1374
1399
  }
1375
1400
  }
1376
1401
  _parseAgentPickedAndTask(e) {
1377
- const s = Array.from(this._assistantRef.value?.messages || []), i = e.log || [], a = [...s].sort((d, g) => g.id - d.id).find((d) => d.role === "user" && d.id <= e.id)?.content || null, l = i.find((d) => typeof d == "string" && d.includes("Agent picked:")) ?? null;
1402
+ const s = Array.from(this._assistantRef.value?.messages || []), i = e.log || [], o = [...s].sort((d, g) => g.id - d.id).find((d) => d.role === "user" && d.id <= e.id)?.content || null, l = i.find((d) => typeof d == "string" && d.includes("Agent picked:")) ?? null;
1378
1403
  if (!l)
1379
- return { agentPicked: null, taskAssigned: null, userMessage: a };
1404
+ return { agentPicked: null, taskAssigned: null, userMessage: o };
1380
1405
  const u = /Agent picked:\s*(.*?)\s*(?:\\n|\r?\n)\s*Task Assigned:\s*([\s\S]*)$/i, c = l.match(u);
1381
1406
  if (!c)
1382
- return { agentPicked: null, taskAssigned: null, userMessage: a };
1383
- const m = c[1].trim(), f = c[2].trim();
1384
- return { agentPicked: m, taskAssigned: f, userMessage: a };
1407
+ return { agentPicked: null, taskAssigned: null, userMessage: o };
1408
+ const m = c[1].trim(), b = c[2].trim();
1409
+ return { agentPicked: m, taskAssigned: b, userMessage: o };
1385
1410
  }
1386
1411
  _emitItemIdFromAI(e) {
1387
1412
  const s = new CustomEvent("solutionIDFromAssistant", {
@@ -1391,30 +1416,8 @@ class cs extends Le {
1391
1416
  });
1392
1417
  window.dispatchEvent(s);
1393
1418
  }
1394
- _queryElementInShadowDom(e, s, i) {
1395
- const n = e.shadowRoot;
1396
- if (n) {
1397
- const o = n.querySelector("arcgis-assistant");
1398
- o && o.shadowRoot && this._findElementInShadowDom(o.shadowRoot, s, i);
1399
- } else
1400
- console.log("No shadowRoot found on this component.");
1401
- }
1402
- _findElementInShadowDom(e, s, i) {
1403
- const n = e.querySelector(s);
1404
- n && this._disableElementAndChildren(n, i);
1405
- const o = e.children;
1406
- for (const a of Array.from(o))
1407
- a.classList.contains(s) && this._disableElementAndChildren(a, i), this._findElementInShadowDom(a, s, i);
1408
- }
1409
- _disableElementAndChildren(e, s) {
1410
- "disabled" in e && (e.disabled = s), e.querySelectorAll("*").forEach((n) => {
1411
- n.nodeName.toLowerCase() === "arcgis-assistant-chat-entry" && n.shadowRoot && n.shadowRoot.querySelectorAll("*").forEach((l) => {
1412
- "disabled" in l && (l.disabled = s);
1413
- }), "disabled" in n && (n.disabled = s);
1414
- });
1415
- }
1416
1419
  }
1417
- ke("arcgis-solutions-assistant", cs);
1420
+ Ae("arcgis-solutions-assistant", ds);
1418
1421
  export {
1419
- cs as ArcgisSolutionsAssistant
1422
+ ds as ArcgisSolutionsAssistant
1420
1423
  };