@arcgis/ai-components 5.2.0-next.91 → 5.2.0-next.94

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 (50) hide show
  1. package/dist/cdn/{W5JPJWMM.js → 2FYVIMRW.js} +1 -1
  2. package/dist/cdn/{C5ZL5Z52.js → 2OB6I4ZG.js} +1 -1
  3. package/dist/cdn/{LPR72QZF.js → 6KN5LUAV.js} +1 -1
  4. package/dist/cdn/{OWTGH34K.js → 7VUSIGEM.js} +1 -1
  5. package/dist/cdn/{VNJMTA6O.js → ANRQWYU2.js} +1 -1
  6. package/dist/cdn/{HKSFWTWK.js → ASR3I43T.js} +1 -1
  7. package/dist/cdn/{ZVGUAOXE.js → B2JDVLA6.js} +1 -1
  8. package/dist/cdn/{DP6O6PMH.js → B2O2LAEL.js} +1 -1
  9. package/dist/cdn/{JJJZ7FOM.js → CPYR4ZQP.js} +1 -1
  10. package/dist/cdn/{AT4XVTJR.js → D5UFYQHN.js} +1 -1
  11. package/dist/cdn/{HMUWQCXU.js → FG647IP6.js} +1 -1
  12. package/dist/cdn/{6KFMRBAA.js → FUF3NAU7.js} +1 -1
  13. package/dist/cdn/G2EGT3CF.js +6 -0
  14. package/dist/cdn/{PEYYWXFE.js → G7OMHU2B.js} +1 -1
  15. package/dist/cdn/{OL5656NI.js → HAEFC2SJ.js} +1 -1
  16. package/dist/cdn/{ZQMBJ6MI.js → HDACNIZF.js} +1 -1
  17. package/dist/cdn/JCOA24UH.js +3 -0
  18. package/dist/cdn/{SUYWKYWI.js → LNCT4S4I.js} +1 -1
  19. package/dist/cdn/{OYSPNIJI.js → MX7OEO5Z.js} +1 -1
  20. package/dist/cdn/{PSYRZMX2.js → NZSOJ726.js} +1 -1
  21. package/dist/cdn/{4HDDRBIY.js → OE3GW5LE.js} +1 -1
  22. package/dist/cdn/{ZLWWWTH4.js → R2PQVY4O.js} +1 -1
  23. package/dist/cdn/{COL6QYGQ.js → RJMPDAE6.js} +1 -1
  24. package/dist/cdn/{4EBLRHYE.js → RWQOM6TX.js} +1 -1
  25. package/dist/cdn/{FQH3HOFH.js → TFIJZWY3.js} +1 -1
  26. package/dist/cdn/{FUZ77UGP.js → UAANWCMU.js} +1 -1
  27. package/dist/cdn/UK3MKESF.js +3 -0
  28. package/dist/cdn/{KCU4FWF7.js → VOV5D2HS.js} +1 -1
  29. package/dist/cdn/{WP7ORLSB.js → WGO5SER7.js} +1 -1
  30. package/dist/cdn/{4NJ2FF7H.js → ZDV4K4WG.js} +1 -1
  31. package/dist/cdn/agent-utils/index.js +1 -1
  32. package/dist/cdn/index.js +1 -1
  33. package/dist/chunks/baseAgentState.js +32 -30
  34. package/dist/chunks/orchestrator.js +301 -249
  35. package/dist/components/arcgis-assistant/customElement.d.ts +24 -0
  36. package/dist/components/arcgis-assistant/customElement.js +275 -270
  37. package/dist/docs/api.json +1 -1
  38. package/dist/docs/docs.json +1 -1
  39. package/dist/docs/vscode.html-custom-data.json +1 -1
  40. package/dist/docs/web-types.json +1 -1
  41. package/dist/loader.js +1 -1
  42. package/dist/types/lumina.d.ts +1 -1
  43. package/dist/types/preact.d.ts +1 -1
  44. package/dist/types/react.d.ts +1 -1
  45. package/dist/types/stencil.d.ts +1 -1
  46. package/dist/utils/index.d.ts +45 -11
  47. package/package.json +5 -5
  48. package/dist/cdn/6VJXUIXY.js +0 -3
  49. package/dist/cdn/7M6VKBTK.js +0 -6
  50. package/dist/cdn/PKUDO2RC.js +0 -3
@@ -1,2 +1,2 @@
1
1
  /* COPYRIGHT Esri - https://js.arcgis.com/5.2/LICENSE.txt */
2
- import s from"./C5ZL5Z52.js";import q from"./SZ2QSSB3.js";import p from"./OYSPNIJI.js";import{a as o,c as a}from"./V6HOUZPZ.js";import n from"./KITIP6J2.js";import"./Z5W4V7RC.js";import m from"./RHYNE5OE.js";import l from"./KWD2ECTM.js";import k from"./U2D53TAX.js";import j from"./OAKRPM7D.js";import h from"./V52XWEGV.js";import g from"./CCC6LBMY.js";import"./34O57OGV.js";import"./7SRLZQVC.js";import"./FDOMMK2M.js";import f from"./6HF36IKA.js";import"./Y7XD7ZRD.js";import"./VLLZ2FFU.js";import e from"./5ZFUGNRN.js";import"./LLUGJKAQ.js";import"./WKTQVBFJ.js";import"./K2R6XVK3.js";import"./3UEKINYC.js";import"./RLEHNAIA.js";import d from"./AT4XVTJR.js";import"./7M6VKBTK.js";import"./5WYRJMBW.js";import"./YEZ3AMNX.js";import c from"./JKIESH74.js";import b from"./QNNGPA3Q.js";import"./ONQ6JSBJ.js";import{v as i,z as r}from"./X3COUAXY.js";import"./R74ZHFA6.js";import"./7VAQUCBU.js";import"./VOKXKU7M.js";import"./EWLXNGKH.js";import"./AI6DYOKR.js";import"./VXFQANGJ.js";import"./MWYBF3F3.js";import"./UZLQALHY.js";export default $arcgis.t(([,,,,,,,,,,,,,,,,,,,,,s])=>{var t=class extends i{constructor(){super(...arguments),this.agent=s}static{this.properties={referenceElement:1}}#t;#i;getContext(){if(!this.#t)throw new Error("arcgis-assistant-data-exploration-agent requires a mapView");return{mapView:this.#t}}load(){this.#t=o(this,"arcgis-assistant-data-exploration-agent"),this.#i=a(this)}disconnectedCallback(){this.#i?.unregister(this.agent.id),super.disconnectedCallback()}};r("arcgis-assistant-data-exploration-agent",t);return t},"identity/IdentityManager","portal/Portal","request","config","core/reactiveUtils","layers/FeatureLayer","rest/knowledgeGraphService",b,c,d,e,f,g,h,j,k,l,m,n,p,q,s)
2
+ import s from"./2OB6I4ZG.js";import q from"./SZ2QSSB3.js";import p from"./MX7OEO5Z.js";import{a as o,c as a}from"./V6HOUZPZ.js";import n from"./KITIP6J2.js";import"./Z5W4V7RC.js";import m from"./RHYNE5OE.js";import l from"./KWD2ECTM.js";import k from"./U2D53TAX.js";import j from"./OAKRPM7D.js";import h from"./V52XWEGV.js";import g from"./CCC6LBMY.js";import"./34O57OGV.js";import"./7SRLZQVC.js";import"./FDOMMK2M.js";import f from"./6HF36IKA.js";import"./Y7XD7ZRD.js";import"./VLLZ2FFU.js";import e from"./5ZFUGNRN.js";import"./LLUGJKAQ.js";import"./WKTQVBFJ.js";import"./K2R6XVK3.js";import"./3UEKINYC.js";import"./RLEHNAIA.js";import d from"./D5UFYQHN.js";import"./G2EGT3CF.js";import"./5WYRJMBW.js";import"./YEZ3AMNX.js";import c from"./JKIESH74.js";import b from"./QNNGPA3Q.js";import"./ONQ6JSBJ.js";import{v as i,z as r}from"./X3COUAXY.js";import"./R74ZHFA6.js";import"./7VAQUCBU.js";import"./VOKXKU7M.js";import"./EWLXNGKH.js";import"./AI6DYOKR.js";import"./VXFQANGJ.js";import"./MWYBF3F3.js";import"./UZLQALHY.js";export default $arcgis.t(([,,,,,,,,,,,,,,,,,,,,,s])=>{var t=class extends i{constructor(){super(...arguments),this.agent=s}static{this.properties={referenceElement:1}}#t;#i;getContext(){if(!this.#t)throw new Error("arcgis-assistant-data-exploration-agent requires a mapView");return{mapView:this.#t}}load(){this.#t=o(this,"arcgis-assistant-data-exploration-agent"),this.#i=a(this)}disconnectedCallback(){this.#i?.unregister(this.agent.id),super.disconnectedCallback()}};r("arcgis-assistant-data-exploration-agent",t);return t},"identity/IdentityManager","portal/Portal","request","config","core/reactiveUtils","layers/FeatureLayer","rest/knowledgeGraphService",b,c,d,e,f,g,h,j,k,l,m,n,p,q,s)
@@ -1,5 +1,5 @@
1
1
  /* COPYRIGHT Esri - https://js.arcgis.com/5.2/LICENSE.txt */
2
- import f from"./SZ2QSSB3.js";import e from"./OYSPNIJI.js";import d from"./RHYNE5OE.js";import c from"./CCC6LBMY.js";import{a as g}from"./FDOMMK2M.js";import a from"./AT4XVTJR.js";import{a as b}from"./ONQ6JSBJ.js";import{a as r}from"./7VAQUCBU.js";import{Ya as R,a as q,b as p}from"./EWLXNGKH.js";import{ea as M}from"./AI6DYOKR.js";export default $arcgis.t(([,,,,,,{n:L,p:y},{a:x},F,{a:_,c:f,d:E,e:C,f:w,g:k,h:S,i:N},v])=>{var I=async(e,t)=>(await r({text:"Exiting Data Exploration agent"},t),e),z=async(e,t)=>{await r({text:"Requesting LLM for layer filter results"},t);let a=await f("data_explore_filter_prompt");if(!t?.configurable)throw new Error("config.configurable is required for layer filter tools");let{userTimezone:l,userTimezoneOffset:o}=x(),i={layerFieldInfo:e.layerFieldInfo,userTimezone:l,userTimezoneOffset:o,queryResponse:e.queryResponse,assignedTask:e.agentExecutionContext.assignedTask,userRequest:e.agentExecutionContext.userRequest,priorSteps:e.agentExecutionContext.priorSteps},n=await y({promptText:a,modelTier:"advanced",config:t,messages:e.dataExplorationMessages,inputVariables:i,tools:S}),s=[...e.dataExplorationMessages,n];if(!((n.tool_calls?.length??0)>0))return await r({text:"LLM determined no filter changes needed"},t),{...e,dataExplorationMessages:s};let d=s,c=n.content.toString();return await v(n,t),{...e,dataExplorationMessages:d,outputMessage:c}},D=async(e,t)=>{await r({text:"Requesting LLM for layer query results"},t);let a=await f("data_explore_query_prompt");if(!t?.configurable)throw new Error("config.configurable is required for layer query tools");let{userTimezone:l,userTimezoneOffset:o}=x(),i=e.agentExecutionContext.sharedState,n=i.lastNavigatedFeatures?.value,s=i.lastResolvedLocation?.value,d="none";if(n!=null)try{d=JSON.stringify(n)}catch{d="none"}let c="none";if(s!=null)try{c=JSON.stringify({address:s.address,location:s.location})}catch{c="none"}let u={layerFieldInfo:e.layerFieldInfo,userTimezone:l,userTimezoneOffset:o,assignedTask:e.agentExecutionContext.assignedTask,userRequest:e.agentExecutionContext.userRequest,priorSteps:e.agentExecutionContext.priorSteps,lastNavigatedFeatures:d,lastResolvedLocation:c},m=await y({promptText:a,modelTier:"advanced",config:t,messages:e.dataExplorationMessages,inputVariables:u,tools:k}),T=(m.tool_calls?.length??0)>0,h=m.content.toString();return await v(m,t),{...e,dataExplorationMessages:[...e.dataExplorationMessages,m],...T?{}:{outputMessage:h},status:"success",summary:h&&!T?E(h):"Query planning completed."}},V=async(e,t)=>{try{await r({text:"Requesting LLM for summary on query results"},t);let a=await f("summarize_query_response_prompt"),l={queryResponse:e.queryResponse,assignedTask:e.agentExecutionContext.assignedTask,userRequest:e.agentExecutionContext.userRequest,priorSteps:e.agentExecutionContext.priorSteps},o=await L({promptText:a,modelTier:"fast",config:t,messages:e.dataExplorationMessages,inputVariables:l}),i=typeof o=="string"?o:o.content,n=new M(i);await r({text:`Received response from LLM: ${i}`},t);let s=i;return{...e,outputMessage:s,status:"success",summary:s?E(s):"Summary generated.",dataExplorationMessages:[...e.dataExplorationMessages,n]}}catch(a){throw await r({text:"Error during filter LLM request"},t),new Error(`Error during filter LLM request: ${a instanceof Error?a.message:String(a)}`)}};async function O(e,t){if((e.queryResponse??[]).some(l=>{let o=l.details;return typeof o=="object"&&o!==null&&"error"in o}))return await r({text:"Skipping layer filter tool because query response contains an error."},t),{...e};let a=await new _(S,{handleToolErrors:!1}).invoke({messages:e.dataExplorationMessages},t);return await r({text:`Finished executing layer filter tool: ${a.messages.map(l=>l.content).join(", ")}`},t),{...e}}var $=/\b(average|avg|mean|median|max(?:imum)?|min(?:imum)?|sum|total|count|std(?:dev|\s*deviation)|variance|null\s*count|missing\s*values?|range)\b/iu;function j(e,t){return $.test(e)||$.test(t)}var Q=async(e,t)=>{try{await r({text:"Preparing field information for vector search results"},t);let a=g(t,"layersAndFieldsRegistry"),{mapView:l}=b(t,["mapView"]),{assignedTask:o,userRequest:i}=e.agentExecutionContext,n=j(o,i),{layerFieldInfo:s,didFetchStatistics:d,fieldStatisticsFetchStatus:c}=await F(e.vectorSearchFieldResults,a,l,n);d?await r({text:"Statistics fetched"},t):await r({text:"Statistics skipped"},t);for(let u of c)await r({text:` - ${u.fieldName} - stats ${u.didFetchStatistics?"fetched":"skipped"}`},t);return await r({text:"Field information prepared"},t),{...e,layerFieldInfo:s}}catch(a){throw await r({text:"Error during fetching statistics"},t),new Error(`Error during fetching statistics: ${a instanceof Error?a.message:String(a)}`)}},A=.7,G=10,W=async(e,t)=>{try{await r({text:"Similarity search to find fields"},t);let a=g(t,"fieldSearch"),l=g(t,"layersAndFieldsRegistry"),o=g(t,"embeddingCache"),i=await a.searchFields({text:e.agentExecutionContext.assignedTask,layerIds:e.vectorSearchLayerIds,minScore:A,topResults:G,embeddingCache:o}),n=i.map(({layerId:d,results:c})=>{let u=c.map(m=>` - ${m.name} (${m.score.toFixed(2)})`).join(`
2
+ import f from"./SZ2QSSB3.js";import e from"./MX7OEO5Z.js";import d from"./RHYNE5OE.js";import c from"./CCC6LBMY.js";import{a as g}from"./FDOMMK2M.js";import a from"./D5UFYQHN.js";import{a as b}from"./ONQ6JSBJ.js";import{a as r}from"./7VAQUCBU.js";import{Ya as R,a as q,b as p}from"./EWLXNGKH.js";import{ea as M}from"./AI6DYOKR.js";export default $arcgis.t(([,,,,,,{n:L,p:y},{a:x},F,{a:_,c:f,d:E,e:C,f:w,g:k,h:S,i:N},v])=>{var I=async(e,t)=>(await r({text:"Exiting Data Exploration agent"},t),e),z=async(e,t)=>{await r({text:"Requesting LLM for layer filter results"},t);let a=await f("data_explore_filter_prompt");if(!t?.configurable)throw new Error("config.configurable is required for layer filter tools");let{userTimezone:l,userTimezoneOffset:o}=x(),i={layerFieldInfo:e.layerFieldInfo,userTimezone:l,userTimezoneOffset:o,queryResponse:e.queryResponse,assignedTask:e.agentExecutionContext.assignedTask,userRequest:e.agentExecutionContext.userRequest,priorSteps:e.agentExecutionContext.priorSteps},n=await y({promptText:a,modelTier:"advanced",config:t,messages:e.dataExplorationMessages,inputVariables:i,tools:S}),s=[...e.dataExplorationMessages,n];if(!((n.tool_calls?.length??0)>0))return await r({text:"LLM determined no filter changes needed"},t),{...e,dataExplorationMessages:s};let d=s,c=n.content.toString();return await v(n,t),{...e,dataExplorationMessages:d,outputMessage:c}},D=async(e,t)=>{await r({text:"Requesting LLM for layer query results"},t);let a=await f("data_explore_query_prompt");if(!t?.configurable)throw new Error("config.configurable is required for layer query tools");let{userTimezone:l,userTimezoneOffset:o}=x(),i=e.agentExecutionContext.sharedState,n=i.lastNavigatedFeatures?.value,s=i.lastResolvedLocation?.value,d="none";if(n!=null)try{d=JSON.stringify(n)}catch{d="none"}let c="none";if(s!=null)try{c=JSON.stringify({address:s.address,location:s.location})}catch{c="none"}let u={layerFieldInfo:e.layerFieldInfo,userTimezone:l,userTimezoneOffset:o,assignedTask:e.agentExecutionContext.assignedTask,userRequest:e.agentExecutionContext.userRequest,priorSteps:e.agentExecutionContext.priorSteps,lastNavigatedFeatures:d,lastResolvedLocation:c},m=await y({promptText:a,modelTier:"advanced",config:t,messages:e.dataExplorationMessages,inputVariables:u,tools:k}),T=(m.tool_calls?.length??0)>0,h=m.content.toString();return await v(m,t),{...e,dataExplorationMessages:[...e.dataExplorationMessages,m],...T?{}:{outputMessage:h},status:"success",summary:h&&!T?E(h):"Query planning completed."}},V=async(e,t)=>{try{await r({text:"Requesting LLM for summary on query results"},t);let a=await f("summarize_query_response_prompt"),l={queryResponse:e.queryResponse,assignedTask:e.agentExecutionContext.assignedTask,userRequest:e.agentExecutionContext.userRequest,priorSteps:e.agentExecutionContext.priorSteps},o=await L({promptText:a,modelTier:"fast",config:t,messages:e.dataExplorationMessages,inputVariables:l}),i=typeof o=="string"?o:o.content,n=new M(i);await r({text:`Received response from LLM: ${i}`},t);let s=i;return{...e,outputMessage:s,status:"success",summary:s?E(s):"Summary generated.",dataExplorationMessages:[...e.dataExplorationMessages,n]}}catch(a){throw await r({text:"Error during filter LLM request"},t),new Error(`Error during filter LLM request: ${a instanceof Error?a.message:String(a)}`)}};async function O(e,t){if((e.queryResponse??[]).some(l=>{let o=l.details;return typeof o=="object"&&o!==null&&"error"in o}))return await r({text:"Skipping layer filter tool because query response contains an error."},t),{...e};let a=await new _(S,{handleToolErrors:!1}).invoke({messages:e.dataExplorationMessages},t);return await r({text:`Finished executing layer filter tool: ${a.messages.map(l=>l.content).join(", ")}`},t),{...e}}var $=/\b(average|avg|mean|median|max(?:imum)?|min(?:imum)?|sum|total|count|std(?:dev|\s*deviation)|variance|null\s*count|missing\s*values?|range)\b/iu;function j(e,t){return $.test(e)||$.test(t)}var Q=async(e,t)=>{try{await r({text:"Preparing field information for vector search results"},t);let a=g(t,"layersAndFieldsRegistry"),{mapView:l}=b(t,["mapView"]),{assignedTask:o,userRequest:i}=e.agentExecutionContext,n=j(o,i),{layerFieldInfo:s,didFetchStatistics:d,fieldStatisticsFetchStatus:c}=await F(e.vectorSearchFieldResults,a,l,n);d?await r({text:"Statistics fetched"},t):await r({text:"Statistics skipped"},t);for(let u of c)await r({text:` - ${u.fieldName} - stats ${u.didFetchStatistics?"fetched":"skipped"}`},t);return await r({text:"Field information prepared"},t),{...e,layerFieldInfo:s}}catch(a){throw await r({text:"Error during fetching statistics"},t),new Error(`Error during fetching statistics: ${a instanceof Error?a.message:String(a)}`)}},A=.7,G=10,W=async(e,t)=>{try{await r({text:"Similarity search to find fields"},t);let a=g(t,"fieldSearch"),l=g(t,"layersAndFieldsRegistry"),o=g(t,"embeddingCache"),i=await a.searchFields({text:e.agentExecutionContext.assignedTask,layerIds:e.vectorSearchLayerIds,minScore:A,topResults:G,embeddingCache:o}),n=i.map(({layerId:d,results:c})=>{let u=c.map(m=>` - ${m.name} (${m.score.toFixed(2)})`).join(`
3
3
  `);return`${l.get(d)?.layerItem.name??d}:
4
4
  ${u}`}).join(`
5
5
  `),s;return i.length>0?s=`Vector search completed. Matching layers and fields with scores:
@@ -1,5 +1,5 @@
1
1
  /* COPYRIGHT Esri - https://js.arcgis.com/5.2/LICENSE.txt */
2
- import f from"./SZ2QSSB3.js";import e from"./OYSPNIJI.js";import d from"./KITIP6J2.js";import{a as Z}from"./Z5W4V7RC.js";import{a as h}from"./FDOMMK2M.js";import c from"./6HF36IKA.js";import{a as F}from"./Y7XD7ZRD.js";import{a as C}from"./VLLZ2FFU.js";import b from"./5ZFUGNRN.js";import{a as R}from"./LLUGJKAQ.js";import{a as _}from"./WKTQVBFJ.js";import{a as I}from"./K2R6XVK3.js";import a from"./AT4XVTJR.js";import{a as x}from"./ONQ6JSBJ.js";import{a as g}from"./7VAQUCBU.js";import{Ya as E,a as w,b as k}from"./EWLXNGKH.js";import{a as y}from"./VXFQANGJ.js";export default $arcgis.t(([,,,,,,{o:$,p:N},L,b,M,{a:A,b:v,c:S,d:q,e:V},j])=>{var T=[b,F,C,L,R,_,I,M,Z];async function B(e,t){let a=await S("navigation_tool_prompt"),{mapView:s}=x(t,["mapView"]),c=s.map.bookmarks?.map(p=>p.name).filter(Boolean)??[],i=e.vectorSearchLayerResults?.length>0?e.vectorSearchLayerResults.map((p,G)=>`${G+1}. layerId=${p.id} | title=${p.title??""} | name=${p.name??""} | score=${p.score.toFixed(2)}`).join(`
2
+ import f from"./SZ2QSSB3.js";import e from"./MX7OEO5Z.js";import d from"./KITIP6J2.js";import{a as Z}from"./Z5W4V7RC.js";import{a as h}from"./FDOMMK2M.js";import c from"./6HF36IKA.js";import{a as F}from"./Y7XD7ZRD.js";import{a as C}from"./VLLZ2FFU.js";import b from"./5ZFUGNRN.js";import{a as R}from"./LLUGJKAQ.js";import{a as _}from"./WKTQVBFJ.js";import{a as I}from"./K2R6XVK3.js";import a from"./D5UFYQHN.js";import{a as x}from"./ONQ6JSBJ.js";import{a as g}from"./7VAQUCBU.js";import{Ya as E,a as w,b as k}from"./EWLXNGKH.js";import{a as y}from"./VXFQANGJ.js";export default $arcgis.t(([,,,,,,{o:$,p:N},L,b,M,{a:A,b:v,c:S,d:q,e:V},j])=>{var T=[b,F,C,L,R,_,I,M,Z];async function B(e,t){let a=await S("navigation_tool_prompt"),{mapView:s}=x(t,["mapView"]),c=s.map.bookmarks?.map(p=>p.name).filter(Boolean)??[],i=e.vectorSearchLayerResults?.length>0?e.vectorSearchLayerResults.map((p,G)=>`${G+1}. layerId=${p.id} | title=${p.title??""} | name=${p.name??""} | score=${p.score.toFixed(2)}`).join(`
3
3
  `):"",l=e.vectorSearchFieldResults?.length>0?JSON.stringify(e.vectorSearchFieldResults,null,2):"",n=e.intent==="goToBookmark"&&c.length?`Available bookmarks:
4
4
  ${c.map(p=>`- ${p}`).join(`
5
5
  `)}`:"",o=(e.intent==="goToLayer"||e.intent==="goToFeatures")&&e.vectorSearchLayerResults?.length?`Candidate layers:
@@ -1,2 +1,2 @@
1
1
  /* COPYRIGHT Esri - https://js.arcgis.com/5.2/LICENSE.txt */
2
- import{c}from"./ZLWWWTH4.js";export default $arcgis.t(([l,{property:i,subclass:y},{watch:d}])=>{var w=Object.defineProperty,g=Object.getOwnPropertyDescriptor,t=(s,a,p,o)=>{for(var r=o>1?void 0:o?g(a,p):a,h=s.length-1,n;h>=0;h--)(n=s[h])&&(r=(o?n(a,p,r):n(r))||r);return o&&r&&w(a,p,r),r},m=()=>{throw new Error("createGraph method not implemented.")},e=class extends l{constructor(){super(...arguments),this.description="",this.middlewares=[],this.createGraph=m,this.workspace=c()}initialize(){this.addHandles([d(()=>[this.name,this.description],()=>this.generate(),{initial:!0,sync:!0}),d(()=>this.createGraph,()=>this._compiledGraph=void 0)])}get id(){return this.name.replace(/\s+/gu,"-").toLowerCase()}get registration(){return{id:this.id,name:this.name,description:this.description,createGraph:this.createGraph,workspace:this.workspace}}async run(s={},a){return this.createGraph===m&&this.generate(),this._compiledGraph=this._compiledGraph??this.createGraph().compile(),await this._compiledGraph.invoke(s,a)}};t([i({readOnly:!0})],e.prototype,"id",1);t([i()],e.prototype,"name",2);t([i()],e.prototype,"description",2);t([i()],e.prototype,"middlewares",2);t([i({readOnly:!0})],e.prototype,"createGraph",2);t([i({readOnly:!0})],e.prototype,"workspace",2);t([i({readOnly:!0})],e.prototype,"registration",1);e=t([y("BaseAgent")],e);return e},"core/Accessor","core/accessorSupport/decorators","core/reactiveUtils")
2
+ import{c}from"./R2PQVY4O.js";export default $arcgis.t(([l,{property:i,subclass:y},{watch:d}])=>{var w=Object.defineProperty,g=Object.getOwnPropertyDescriptor,t=(s,a,p,o)=>{for(var r=o>1?void 0:o?g(a,p):a,h=s.length-1,n;h>=0;h--)(n=s[h])&&(r=(o?n(a,p,r):n(r))||r);return o&&r&&w(a,p,r),r},m=()=>{throw new Error("createGraph method not implemented.")},e=class extends l{constructor(){super(...arguments),this.description="",this.middlewares=[],this.createGraph=m,this.workspace=c()}initialize(){this.addHandles([d(()=>[this.name,this.description],()=>this.generate(),{initial:!0,sync:!0}),d(()=>this.createGraph,()=>this._compiledGraph=void 0)])}get id(){return this.name.replace(/\s+/gu,"-").toLowerCase()}get registration(){return{id:this.id,name:this.name,description:this.description,createGraph:this.createGraph,workspace:this.workspace}}async run(s={},a){return this.createGraph===m&&this.generate(),this._compiledGraph=this._compiledGraph??this.createGraph().compile(),await this._compiledGraph.invoke(s,a)}};t([i({readOnly:!0})],e.prototype,"id",1);t([i()],e.prototype,"name",2);t([i()],e.prototype,"description",2);t([i()],e.prototype,"middlewares",2);t([i({readOnly:!0})],e.prototype,"createGraph",2);t([i({readOnly:!0})],e.prototype,"workspace",2);t([i({readOnly:!0})],e.prototype,"registration",1);e=t([y("BaseAgent")],e);return e},"core/Accessor","core/accessorSupport/decorators","core/reactiveUtils")
@@ -1,2 +1,2 @@
1
1
  /* COPYRIGHT Esri - https://js.arcgis.com/5.2/LICENSE.txt */
2
- import{c as i,e as c}from"./ZLWWWTH4.js";export default $arcgis.t(([m,{subclass:p}])=>{function a(t){return t?Object.keys(t.shape??{}):[]}function d(t){let e={};for(let n of t)for(let s of a(n))e[s]=void 0;return e}function g(t,e){return Object.fromEntries(e.filter(n=>Object.hasOwn(t,n)).map(n=>[n,t[n]]))}function l(t,e){return`${t.id}_${e}`}function h(t,e){let n=e.inputSchema;return n?{...g(t,a(n)),agentExecutionContext:t.agentExecutionContext,outputMessage:t.outputMessage,status:void 0,summary:""}:{...t,status:void 0,summary:""}}function x(t,e){return t.outputSchema?g(e,a(t.outputSchema)):{}}function y(t){let e={outputMessage:t.outputMessage,status:t.status,summary:t.summary};return t.agentExecutionContext&&(e.agentExecutionContext=t.agentExecutionContext),e}function v(t,e){return async(n,s)=>{let o=await t.run(h(n,t),s),r=x(t,o);return e||o.status==="failed"?{...r,...y(o)}:{...r,outputMessage:o.outputMessage}}}var w=Object.getOwnPropertyDescriptor,E=(t,e,n,s)=>{for(var o=s>1?void 0:s?w(e,n):e,r=t.length-1,u;r>=0;r--)(u=t[r])&&(o=u(o)||o);return o},f=class extends m{generate(){let t=this.getAgents();this.validateAgents(t);for(let r of t)r.generate();let e=d(t.flatMap(r=>r.getSchemas())),n=i(e),s=this.buildNodes(t),o=this.buildEdges(t);return{workspace:n,createGraph:()=>c(s,o,n,{entryNode:this.getEntryNode(t)})}}buildNodes(t){let e={};for(let[n,s]of t.entries())e[l(s,n)]=v(s,this.isTerminalAgent(t,n));return e}validateAgents(t){if(!t.length)throw new Error("Workflow requires at least one agent.")}};f=E([p("BaseWorkflow")],f);return{a:a,b:d,c:l,d:f}},"core/Accessor","core/accessorSupport/decorators")
2
+ import{c as i,e as c}from"./R2PQVY4O.js";export default $arcgis.t(([m,{subclass:p}])=>{function a(t){return t?Object.keys(t.shape??{}):[]}function d(t){let e={};for(let n of t)for(let s of a(n))e[s]=void 0;return e}function g(t,e){return Object.fromEntries(e.filter(n=>Object.hasOwn(t,n)).map(n=>[n,t[n]]))}function l(t,e){return`${t.id}_${e}`}function h(t,e){let n=e.inputSchema;return n?{...g(t,a(n)),agentExecutionContext:t.agentExecutionContext,outputMessage:t.outputMessage,status:void 0,summary:""}:{...t,status:void 0,summary:""}}function x(t,e){return t.outputSchema?g(e,a(t.outputSchema)):{}}function y(t){let e={outputMessage:t.outputMessage,status:t.status,summary:t.summary};return t.agentExecutionContext&&(e.agentExecutionContext=t.agentExecutionContext),e}function v(t,e){return async(n,s)=>{let o=await t.run(h(n,t),s),r=x(t,o);return e||o.status==="failed"?{...r,...y(o)}:{...r,outputMessage:o.outputMessage}}}var w=Object.getOwnPropertyDescriptor,E=(t,e,n,s)=>{for(var o=s>1?void 0:s?w(e,n):e,r=t.length-1,u;r>=0;r--)(u=t[r])&&(o=u(o)||o);return o},f=class extends m{generate(){let t=this.getAgents();this.validateAgents(t);for(let r of t)r.generate();let e=d(t.flatMap(r=>r.getSchemas())),n=i(e),s=this.buildNodes(t),o=this.buildEdges(t);return{workspace:n,createGraph:()=>c(s,o,n,{entryNode:this.getEntryNode(t)})}}buildNodes(t){let e={};for(let[n,s]of t.entries())e[l(s,n)]=v(s,this.isTerminalAgent(t,n));return e}validateAgents(t){if(!t.length)throw new Error("Workflow requires at least one agent.")}};f=E([p("BaseWorkflow")],f);return{a:a,b:d,c:l,d:f}},"core/Accessor","core/accessorSupport/decorators")
@@ -1,5 +1,5 @@
1
1
  /* COPYRIGHT Esri - https://js.arcgis.com/5.2/LICENSE.txt */
2
- import c from"./SZ2QSSB3.js";import b from"./OYSPNIJI.js";import{a as g}from"./FDOMMK2M.js";import a from"./AT4XVTJR.js";import{a as s}from"./7VAQUCBU.js";import{Ya as S,a as u,b as p,s as f}from"./EWLXNGKH.js";export default $arcgis.t(([,,,,,,{p:x},{a:w,c:E,e:I,j:v,k:L,l:F,m:$,n:C,o:N,p:R,q:T,r:b,s:A,t:_,u:h},q])=>{var V=.7,z=10,D=async(a,t)=>{try{await s({text:"Similarity search to find fields"},t);let e=g(t,"fieldSearch"),n=g(t,"layersAndFieldsRegistry"),o=g(t,"embeddingCache"),r=await e.searchFields({text:a.agentExecutionContext.assignedTask,layerIds:a.vectorSearchLayerIds,minScore:V,topResults:z,embeddingCache:o}),m=r.map(({layerId:d,results:c})=>{let y=c.map(i=>` - ${i.name} (${i.score.toFixed(2)})`).join(`
2
+ import c from"./SZ2QSSB3.js";import b from"./MX7OEO5Z.js";import{a as g}from"./FDOMMK2M.js";import a from"./D5UFYQHN.js";import{a as s}from"./7VAQUCBU.js";import{Ya as S,a as u,b as p,s as f}from"./EWLXNGKH.js";export default $arcgis.t(([,,,,,,{p:x},{a:w,c:E,e:I,j:v,k:L,l:F,m:$,n:C,o:N,p:R,q:T,r:b,s:A,t:_,u:h},q])=>{var V=.7,z=10,D=async(a,t)=>{try{await s({text:"Similarity search to find fields"},t);let e=g(t,"fieldSearch"),n=g(t,"layersAndFieldsRegistry"),o=g(t,"embeddingCache"),r=await e.searchFields({text:a.agentExecutionContext.assignedTask,layerIds:a.vectorSearchLayerIds,minScore:V,topResults:z,embeddingCache:o}),m=r.map(({layerId:d,results:c})=>{let y=c.map(i=>` - ${i.name} (${i.score.toFixed(2)})`).join(`
3
3
  `);return`${n.get(d)?.layerItem.name??d}:
4
4
  ${y}`}).join(`
5
5
  `),l;return r.length>0?l=`Vector search completed. Matching layers and fields with scores:
@@ -1,2 +1,2 @@
1
1
  /* COPYRIGHT Esri - https://js.arcgis.com/5.2/LICENSE.txt */
2
- import c from"./PEYYWXFE.js";import"./CP5BVGJU.js";import b from"./OWTGH34K.js";import"./ZLWWWTH4.js";import a from"./AT4XVTJR.js";import"./7M6VKBTK.js";import"./R74ZHFA6.js";import"./7VAQUCBU.js";import"./HHFNQR6Z.js";import"./VOKXKU7M.js";import"./EWLXNGKH.js";import"./AI6DYOKR.js";import"./VXFQANGJ.js";import"./MWYBF3F3.js";import"./UZLQALHY.js";export default $arcgis.t(([,,a])=>{return a},a,b,c)
2
+ import c from"./G7OMHU2B.js";import"./CP5BVGJU.js";import b from"./7VUSIGEM.js";import"./R2PQVY4O.js";import a from"./D5UFYQHN.js";import"./G2EGT3CF.js";import"./R74ZHFA6.js";import"./7VAQUCBU.js";import"./HHFNQR6Z.js";import"./VOKXKU7M.js";import"./EWLXNGKH.js";import"./AI6DYOKR.js";import"./VXFQANGJ.js";import"./MWYBF3F3.js";import"./UZLQALHY.js";export default $arcgis.t(([,,a])=>{return a},a,b,c)
@@ -1,2 +1,2 @@
1
1
  /* COPYRIGHT Esri - https://js.arcgis.com/5.2/LICENSE.txt */
2
- import q from"./HKSFWTWK.js";import p from"./SZ2QSSB3.js";import n from"./OYSPNIJI.js";import{a as o,c as m}from"./V6HOUZPZ.js";import l from"./KITIP6J2.js";import"./Z5W4V7RC.js";import k from"./KWD2ECTM.js";import j from"./U2D53TAX.js";import h from"./OAKRPM7D.js";import g from"./V52XWEGV.js";import f from"./CCC6LBMY.js";import"./34O57OGV.js";import"./7SRLZQVC.js";import"./FDOMMK2M.js";import e from"./6HF36IKA.js";import"./Y7XD7ZRD.js";import"./VLLZ2FFU.js";import d from"./5ZFUGNRN.js";import"./LLUGJKAQ.js";import"./WKTQVBFJ.js";import"./K2R6XVK3.js";import"./3UEKINYC.js";import"./RLEHNAIA.js";import c from"./AT4XVTJR.js";import"./7M6VKBTK.js";import"./5WYRJMBW.js";import"./YEZ3AMNX.js";import b from"./JKIESH74.js";import a from"./QNNGPA3Q.js";import"./ONQ6JSBJ.js";import{v as i,z as r}from"./X3COUAXY.js";import"./R74ZHFA6.js";import"./7VAQUCBU.js";import"./VOKXKU7M.js";import"./EWLXNGKH.js";import"./AI6DYOKR.js";import"./VXFQANGJ.js";import"./MWYBF3F3.js";import"./UZLQALHY.js";export default $arcgis.t(([,,,,,,,,,,,,,,,,,,,,,,,p])=>{var t=class extends i{constructor(){super(...arguments),this.agent=p}static{this.properties={referenceElement:1}}#t;#i;getContext(){if(!this.#t)throw new Error("arcgis-assistant-layer-styling-agent requires a mapView");return{mapView:this.#t}}load(){this.#t=o(this,"arcgis-assistant-layer-styling-agent"),this.#i=m(this)}disconnectedCallback(){this.#i?.unregister(this.agent.id),super.disconnectedCallback()}};r("arcgis-assistant-layer-styling-agent",t);return t},"identity/IdentityManager","portal/Portal","request","config","core/reactiveUtils","layers/FeatureLayer","intl","smartMapping/statistics/summaryStatistics","smartMapping/statistics/uniqueValues","rest/knowledgeGraphService",a,b,c,d,e,f,g,h,j,k,l,n,p,q)
2
+ import q from"./ASR3I43T.js";import p from"./SZ2QSSB3.js";import n from"./MX7OEO5Z.js";import{a as o,c as m}from"./V6HOUZPZ.js";import l from"./KITIP6J2.js";import"./Z5W4V7RC.js";import k from"./KWD2ECTM.js";import j from"./U2D53TAX.js";import h from"./OAKRPM7D.js";import g from"./V52XWEGV.js";import f from"./CCC6LBMY.js";import"./34O57OGV.js";import"./7SRLZQVC.js";import"./FDOMMK2M.js";import e from"./6HF36IKA.js";import"./Y7XD7ZRD.js";import"./VLLZ2FFU.js";import d from"./5ZFUGNRN.js";import"./LLUGJKAQ.js";import"./WKTQVBFJ.js";import"./K2R6XVK3.js";import"./3UEKINYC.js";import"./RLEHNAIA.js";import c from"./D5UFYQHN.js";import"./G2EGT3CF.js";import"./5WYRJMBW.js";import"./YEZ3AMNX.js";import b from"./JKIESH74.js";import a from"./QNNGPA3Q.js";import"./ONQ6JSBJ.js";import{v as i,z as r}from"./X3COUAXY.js";import"./R74ZHFA6.js";import"./7VAQUCBU.js";import"./VOKXKU7M.js";import"./EWLXNGKH.js";import"./AI6DYOKR.js";import"./VXFQANGJ.js";import"./MWYBF3F3.js";import"./UZLQALHY.js";export default $arcgis.t(([,,,,,,,,,,,,,,,,,,,,,,,p])=>{var t=class extends i{constructor(){super(...arguments),this.agent=p}static{this.properties={referenceElement:1}}#t;#i;getContext(){if(!this.#t)throw new Error("arcgis-assistant-layer-styling-agent requires a mapView");return{mapView:this.#t}}load(){this.#t=o(this,"arcgis-assistant-layer-styling-agent"),this.#i=m(this)}disconnectedCallback(){this.#i?.unregister(this.agent.id),super.disconnectedCallback()}};r("arcgis-assistant-layer-styling-agent",t);return t},"identity/IdentityManager","portal/Portal","request","config","core/reactiveUtils","layers/FeatureLayer","intl","smartMapping/statistics/summaryStatistics","smartMapping/statistics/uniqueValues","rest/knowledgeGraphService",a,b,c,d,e,f,g,h,j,k,l,n,p,q)
@@ -1,2 +1,2 @@
1
1
  /* COPYRIGHT Esri - https://js.arcgis.com/5.2/LICENSE.txt */
2
- import p from"./LPR72QZF.js";import n from"./SZ2QSSB3.js";import m from"./OYSPNIJI.js";import{a as o,c as s}from"./V6HOUZPZ.js";import l from"./KITIP6J2.js";import"./Z5W4V7RC.js";import k from"./KWD2ECTM.js";import j from"./U2D53TAX.js";import h from"./OAKRPM7D.js";import g from"./V52XWEGV.js";import f from"./CCC6LBMY.js";import"./34O57OGV.js";import"./7SRLZQVC.js";import"./FDOMMK2M.js";import e from"./6HF36IKA.js";import"./Y7XD7ZRD.js";import"./VLLZ2FFU.js";import d from"./5ZFUGNRN.js";import"./LLUGJKAQ.js";import"./WKTQVBFJ.js";import"./K2R6XVK3.js";import"./3UEKINYC.js";import"./RLEHNAIA.js";import c from"./AT4XVTJR.js";import"./7M6VKBTK.js";import"./5WYRJMBW.js";import"./YEZ3AMNX.js";import b from"./JKIESH74.js";import a from"./QNNGPA3Q.js";import"./ONQ6JSBJ.js";import{v as i,z as r}from"./X3COUAXY.js";import"./R74ZHFA6.js";import"./7VAQUCBU.js";import"./VOKXKU7M.js";import"./EWLXNGKH.js";import"./AI6DYOKR.js";import"./VXFQANGJ.js";import"./MWYBF3F3.js";import"./UZLQALHY.js";export default $arcgis.t(([,,,,,,,,,,,,,,,,,,,,,,,m])=>{var t=class extends i{constructor(){super(...arguments),this.agent=m}static{this.properties={referenceElement:1}}#t;#i;getContext(){if(!this.#t)throw new Error("arcgis-assistant-navigation-agent requires a mapView");return{mapView:this.#t}}load(){this.#t=o(this,"arcgis-assistant-navigation-agent"),this.#i=s(this)}disconnectedCallback(){this.#i?.unregister(this.agent.id),super.disconnectedCallback()}};r("arcgis-assistant-navigation-agent",t);return t},"identity/IdentityManager","portal/Portal","request","config","core/reactiveUtils","layers/FeatureLayer","intl","smartMapping/statistics/summaryStatistics","smartMapping/statistics/uniqueValues","rest/knowledgeGraphService",a,b,c,d,e,f,g,h,j,k,l,m,n,p)
2
+ import p from"./6KN5LUAV.js";import n from"./SZ2QSSB3.js";import m from"./MX7OEO5Z.js";import{a as o,c as s}from"./V6HOUZPZ.js";import l from"./KITIP6J2.js";import"./Z5W4V7RC.js";import k from"./KWD2ECTM.js";import j from"./U2D53TAX.js";import h from"./OAKRPM7D.js";import g from"./V52XWEGV.js";import f from"./CCC6LBMY.js";import"./34O57OGV.js";import"./7SRLZQVC.js";import"./FDOMMK2M.js";import e from"./6HF36IKA.js";import"./Y7XD7ZRD.js";import"./VLLZ2FFU.js";import d from"./5ZFUGNRN.js";import"./LLUGJKAQ.js";import"./WKTQVBFJ.js";import"./K2R6XVK3.js";import"./3UEKINYC.js";import"./RLEHNAIA.js";import c from"./D5UFYQHN.js";import"./G2EGT3CF.js";import"./5WYRJMBW.js";import"./YEZ3AMNX.js";import b from"./JKIESH74.js";import a from"./QNNGPA3Q.js";import"./ONQ6JSBJ.js";import{v as i,z as r}from"./X3COUAXY.js";import"./R74ZHFA6.js";import"./7VAQUCBU.js";import"./VOKXKU7M.js";import"./EWLXNGKH.js";import"./AI6DYOKR.js";import"./VXFQANGJ.js";import"./MWYBF3F3.js";import"./UZLQALHY.js";export default $arcgis.t(([,,,,,,,,,,,,,,,,,,,,,,,m])=>{var t=class extends i{constructor(){super(...arguments),this.agent=m}static{this.properties={referenceElement:1}}#t;#i;getContext(){if(!this.#t)throw new Error("arcgis-assistant-navigation-agent requires a mapView");return{mapView:this.#t}}load(){this.#t=o(this,"arcgis-assistant-navigation-agent"),this.#i=s(this)}disconnectedCallback(){this.#i?.unregister(this.agent.id),super.disconnectedCallback()}};r("arcgis-assistant-navigation-agent",t);return t},"identity/IdentityManager","portal/Portal","request","config","core/reactiveUtils","layers/FeatureLayer","intl","smartMapping/statistics/summaryStatistics","smartMapping/statistics/uniqueValues","rest/knowledgeGraphService",a,b,c,d,e,f,g,h,j,k,l,m,n,p)
@@ -1,5 +1,5 @@
1
1
  /* COPYRIGHT Esri - https://js.arcgis.com/5.2/LICENSE.txt */
2
- import{a as us,b as ki,c as vi,d as Ti}from"./7M6VKBTK.js";import{b as ri}from"./R74ZHFA6.js";import{a as st}from"./7VAQUCBU.js";import{b as Ci,c as Ri,d as Ei}from"./VOKXKU7M.js";import{K as gi,L as yi,M as Hs,N as Zn,O as Kt,P as Vn,Q as Ai,R as Ii,T as bi,U as xi,V as Zs,X as wi,Y as Jn,Z as Gn,_ as Pi,aa as Oi,ka as ke}from"./EWLXNGKH.js";import{Ac as Vs,Cb as hi,E as Bn,F as qn,G as Ks,Ub as E,W as Fs,X as oi,Z as ii,Zb as Lt,ea as ae,fa as Bs,ha as Dt,hc as _i,ia as qs,ja as ai,mb as is,na as ui,o as si,p as re,qb as Hn,ra as li,rb as di,sb as fi,u as rt,ub as as,vc as Ws,wa as Wn,x as ni,y as Ls,za as ci}from"./AI6DYOKR.js";import{a as ue}from"./VXFQANGJ.js";import{$ as mi,Dd as b,j as pi}from"./MWYBF3F3.js";export default $arcgis.t(([nl,ol,Yp,Qp])=>{function ls(t,e){return t.lc_error_code=e,t.message=`${t.message}
2
+ import{a as us,b as ki,c as vi,d as Ti}from"./G2EGT3CF.js";import{b as ri}from"./R74ZHFA6.js";import{a as st}from"./7VAQUCBU.js";import{b as Ci,c as Ri,d as Ei}from"./VOKXKU7M.js";import{K as gi,L as yi,M as Hs,N as Zn,O as Kt,P as Vn,Q as Ai,R as Ii,T as bi,U as xi,V as Zs,X as wi,Y as Jn,Z as Gn,_ as Pi,aa as Oi,ka as ke}from"./EWLXNGKH.js";import{Ac as Vs,Cb as hi,E as Bn,F as qn,G as Ks,Ub as E,W as Fs,X as oi,Z as ii,Zb as Lt,ea as ae,fa as Bs,ha as Dt,hc as _i,ia as qs,ja as ai,mb as is,na as ui,o as si,p as re,qb as Hn,ra as li,rb as di,sb as fi,u as rt,ub as as,vc as Ws,wa as Wn,x as ni,y as Ls,za as ci}from"./AI6DYOKR.js";import{a as ue}from"./VXFQANGJ.js";import{$ as mi,Dd as b,j as pi}from"./MWYBF3F3.js";export default $arcgis.t(([nl,ol,Yp,Qp])=>{function ls(t,e){return t.lc_error_code=e,t.message=`${t.message}
3
3
 
4
4
  Troubleshooting URL: https://docs.langchain.com/oss/javascript/langchain/errors/${e}/
5
5
  `,t}function k(t,e,r,s,n){if(s==="m")throw new TypeError("Private method is not writable");if(s==="a"&&!n)throw new TypeError("Private accessor was defined without a setter");if(typeof e=="function"?t!==e||!n:!e.has(t))throw new TypeError("Cannot write private member to an object whose class did not declare it");return s==="a"?n.call(t,r):n?n.value=r:e.set(t,r),r}function d(t,e,r,s){if(r==="a"&&!s)throw new TypeError("Private accessor was defined without a getter");if(typeof e=="function"?t!==e||!s:!e.has(t))throw new TypeError("Cannot read private member from an object whose class did not declare it");return r==="m"?s:r==="a"?s.call(t):s?s.value:e.get(t)}var Xn=function(){let{crypto:t}=globalThis;if(t?.randomUUID)return Xn=t.randomUUID.bind(t),t.randomUUID();let e=new Uint8Array(1),r=t?()=>t.getRandomValues(e)[0]:()=>Math.random()*255&255;return"10000000-1000-4000-8000-100000000000".replace(/[018]/g,s=>(+s^r()&15>>+s/4).toString(16))};function cs(t){return typeof t=="object"&&t!==null&&("name"in t&&t.name==="AbortError"||"message"in t&&String(t.message).includes("FetchRequestCanceledException"))}var ps=t=>{if(t instanceof Error)return t;if(typeof t=="object"&&t!==null){try{if(Object.prototype.toString.call(t)==="[object Error]"){let e=new Error(t.message,t.cause?{cause:t.cause}:{});return t.stack&&(e.stack=t.stack),t.cause&&!e.cause&&(e.cause=t.cause),t.name&&(e.name=t.name),e}}catch{}try{return new Error(JSON.stringify(t))}catch{}}return new Error(t)};var P=class extends Error{},j=class t extends P{constructor(e,r,s,n){super(`${t.makeMessage(e,r,s)}`),this.status=e,this.headers=n,this.requestID=n?.get("x-request-id"),this.error=r;let o=r;this.code=o?.code,this.param=o?.param,this.type=o?.type}static makeMessage(e,r,s){let n=r?.message?typeof r.message=="string"?r.message:JSON.stringify(r.message):r?JSON.stringify(r):s;return e&&n?`${e} ${n}`:e?`${e} status code (no body)`:n||"(no status code or body)"}static generate(e,r,s,n){if(!e||!n)return new Le({message:s,cause:ps(r)});let o=r?.error;return e===400?new Ft(e,o,s,n):e===401?new Bt(e,o,s,n):e===403?new qt(e,o,s,n):e===404?new Wt(e,o,s,n):e===409?new Ht(e,o,s,n):e===422?new Zt(e,o,s,n):e===429?new Vt(e,o,s,n):e>=500?new Jt(e,o,s,n):new t(e,o,s,n)}},D=class extends j{constructor({message:e}={}){super(void 0,void 0,e||"Request was aborted.",void 0)}},Le=class extends j{constructor({message:e,cause:r}){super(void 0,void 0,e||"Connection error.",void 0),r&&(this.cause=r)}},ye=class extends Le{constructor({message:e}={}){super({message:e??"Request timed out."})}},Ft=class extends j{},Bt=class extends j{},qt=class extends j{},Wt=class extends j{},Ht=class extends j{},Zt=class extends j{},Vt=class extends j{},Jt=class extends j{},Gt=class extends P{constructor(){super("Could not parse response content as the length limit was reached")}},Xt=class extends P{constructor(){super("Could not parse response content as the request was rejected by the content filter")}},Ae=class extends Error{constructor(e){super(e)}},nt=class extends j{constructor(e,r,s){let n="OAuth2 authentication error",o;if(r&&typeof r=="object"){let i=r;o=i.error;let a=i.error_description;a&&typeof a=="string"?n=a:o&&(n=o)}super(e,r,n,s),this.error_code=o}},ms=class extends P{constructor(e,r,s){super(e),this.provider=r,this.cause=s}};var dl=/^[a-z][a-z0-9+.-]*:/i,Si=t=>dl.test(t),Y=t=>(Y=Array.isArray,Y(t)),Yn=Y;function Js(t){return typeof t!="object"?{}:t??{}}function Qn(t){if(!t)return!0;for(let e in t)return!1;return!0}function $i(t,e){return Object.prototype.hasOwnProperty.call(t,e)}function ds(t){return t!=null&&typeof t=="object"&&!Array.isArray(t)}var Mi=(t,e)=>{if(typeof e!="number"||!Number.isInteger(e))throw new P(`${t} must be an integer`);if(e<0)throw new P(`${t} must be a positive integer`);return e};var Ni=t=>{try{return JSON.parse(t)}catch{return}};var Ie=t=>new Promise(e=>setTimeout(e,t));var Ke="6.45.0";var Di=()=>typeof window<"u"&&typeof window.document<"u"&&typeof navigator<"u";function fl(){return typeof Deno<"u"&&Deno.build!=null?"deno":typeof EdgeRuntime<"u"?"edge":Object.prototype.toString.call(typeof globalThis.process<"u"?globalThis.process:0)==="[object process]"?"node":"unknown"}var hl=()=>{let t=fl();if(t==="deno")return{"X-Stainless-Lang":"js","X-Stainless-Package-Version":Ke,"X-Stainless-OS":Ui(Deno.build.os),"X-Stainless-Arch":zi(Deno.build.arch),"X-Stainless-Runtime":"deno","X-Stainless-Runtime-Version":typeof Deno.version=="string"?Deno.version:Deno.version?.deno??"unknown"};if(typeof EdgeRuntime<"u")return{"X-Stainless-Lang":"js","X-Stainless-Package-Version":Ke,"X-Stainless-OS":"Unknown","X-Stainless-Arch":`other:${EdgeRuntime}`,"X-Stainless-Runtime":"edge","X-Stainless-Runtime-Version":globalThis.process.version};if(t==="node")return{"X-Stainless-Lang":"js","X-Stainless-Package-Version":Ke,"X-Stainless-OS":Ui(globalThis.process.platform??"unknown"),"X-Stainless-Arch":zi(globalThis.process.arch??"unknown"),"X-Stainless-Runtime":"node","X-Stainless-Runtime-Version":globalThis.process.version??"unknown"};let e=_l();return e?{"X-Stainless-Lang":"js","X-Stainless-Package-Version":Ke,"X-Stainless-OS":"Unknown","X-Stainless-Arch":"unknown","X-Stainless-Runtime":`browser:${e.browser}`,"X-Stainless-Runtime-Version":e.version}:{"X-Stainless-Lang":"js","X-Stainless-Package-Version":Ke,"X-Stainless-OS":"Unknown","X-Stainless-Arch":"unknown","X-Stainless-Runtime":"unknown","X-Stainless-Runtime-Version":"unknown"}};function _l(){if(typeof navigator>"u"||!navigator)return null;let t=[{key:"edge",pattern:/Edge(?:\W+(\d+)\.(\d+)(?:\.(\d+))?)?/},{key:"ie",pattern:/MSIE(?:\W+(\d+)\.(\d+)(?:\.(\d+))?)?/},{key:"ie",pattern:/Trident(?:.*rv\:(\d+)\.(\d+)(?:\.(\d+))?)?/},{key:"chrome",pattern:/Chrome(?:\W+(\d+)\.(\d+)(?:\.(\d+))?)?/},{key:"firefox",pattern:/Firefox(?:\W+(\d+)\.(\d+)(?:\.(\d+))?)?/},{key:"safari",pattern:/(?:Version\W+(\d+)\.(\d+)(?:\.(\d+))?)?(?:\W+Mobile\S*)?\W+Safari/}];for(let{key:e,pattern:r}of t){let s=r.exec(navigator.userAgent);if(s){let n=s[1]||0,o=s[2]||0,i=s[3]||0;return{browser:e,version:`${n}.${o}.${i}`}}}return null}var zi=t=>t==="x32"?"x32":t==="x86_64"||t==="x64"?"x64":t==="arm"?"arm":t==="aarch64"||t==="arm64"?"arm64":t?`other:${t}`:"unknown",Ui=t=>(t=t.toLowerCase(),t.includes("ios")?"iOS":t==="android"?"Android":t==="darwin"?"MacOS":t==="win32"?"Windows":t==="freebsd"?"FreeBSD":t==="openbsd"?"OpenBSD":t==="linux"?"Linux":t?`Other:${t}`:"Unknown"),ji,Li=()=>ji??(ji=hl());function Gs(){if(typeof fetch<"u")return fetch;throw new Error("`fetch` is not defined as a global; Either pass `fetch` to the client, `new OpenAI({ fetch })` or polyfill the global, `globalThis.fetch = fetch`")}function eo(...t){let e=globalThis.ReadableStream;if(typeof e>"u")throw new Error("`ReadableStream` is not defined as a global; You will need to polyfill it, `globalThis.ReadableStream = ReadableStream`");return new e(...t)}function Xs(t){let e=Symbol.asyncIterator in t?t[Symbol.asyncIterator]():t[Symbol.iterator]();return eo({start(){},async pull(r){let{done:s,value:n}=await e.next();s?r.close():r.enqueue(n)},async cancel(){await e.return?.()}})}function to(t){if(t[Symbol.asyncIterator])return t;let e=t.getReader();return{async next(){try{let r=await e.read();return r?.done&&e.releaseLock(),r}catch(r){throw e.releaseLock(),r}},async return(){let r=e.cancel();return e.releaseLock(),await r,{done:!0,value:void 0}},[Symbol.asyncIterator](){return this}}}async function ro(t){if(t===null||typeof t!="object")return;if(t[Symbol.asyncIterator]){await t[Symbol.asyncIterator]().return?.();return}let e=t.getReader(),r=e.cancel();e.releaseLock(),await r}var Fi=({headers:t,body:e})=>({bodyHeaders:{"content-type":"application/json"},body:JSON.stringify(e)});var so="RFC3986",no=t=>String(t),oo={RFC1738:t=>String(t).replace(/%20/g,"+"),RFC3986:no},Bi="RFC1738";var Ys=(t,e)=>(Ys=Object.hasOwn??Function.prototype.call.bind(Object.prototype.hasOwnProperty),Ys(t,e)),be=(()=>{let t=[];for(let e=0;e<256;++e)t.push("%"+((e<16?"0":"")+e.toString(16)).toUpperCase());return t})();var io=1024,qi=(t,e,r,s,n)=>{if(t.length===0)return t;let o=t;if(typeof t=="symbol"?o=Symbol.prototype.toString.call(t):typeof t!="string"&&(o=String(t)),r==="iso-8859-1")return escape(o).replace(/%u[0-9a-f]{4}/gi,function(a){return"%26%23"+parseInt(a.slice(2),16)+"%3B"});let i="";for(let a=0;a<o.length;a+=io){let c=o.length>=io?o.slice(a,a+io):o,u=[];for(let h=0;h<c.length;++h){let f=c.charCodeAt(h);if(f===45||f===46||f===95||f===126||f>=48&&f<=57||f>=65&&f<=90||f>=97&&f<=122||n===Bi&&(f===40||f===41)){u[u.length]=c.charAt(h);continue}if(f<128){u[u.length]=be[f];continue}if(f<2048){u[u.length]=be[192|f>>6]+be[128|f&63];continue}if(f<55296||f>=57344){u[u.length]=be[224|f>>12]+be[128|f>>6&63]+be[128|f&63];continue}h+=1,f=65536+((f&1023)<<10|c.charCodeAt(h)&1023),u[u.length]=be[240|f>>18]+be[128|f>>12&63]+be[128|f>>6&63]+be[128|f&63]}i+=u.join("")}return i};function Wi(t){return!t||typeof t!="object"?!1:!!(t.constructor&&t.constructor.isBuffer&&t.constructor.isBuffer(t))}function ao(t,e){if(Y(t)){let r=[];for(let s=0;s<t.length;s+=1)r.push(e(t[s]));return r}return e(t)}var Zi={brackets(t){return String(t)+"[]"},comma:"comma",indices(t,e){return String(t)+"["+e+"]"},repeat(t){return String(t)}},Vi=function(t,e){Array.prototype.push.apply(t,Y(e)?e:[e])},Hi,W={addQueryPrefix:!1,allowDots:!1,allowEmptyArrays:!1,arrayFormat:"indices",charset:"utf-8",charsetSentinel:!1,delimiter:"&",encode:!0,encodeDotInKeys:!1,encoder:qi,encodeValuesOnly:!1,format:so,formatter:no,indices:!1,serializeDate(t){return(Hi??(Hi=Function.prototype.call.bind(Date.prototype.toISOString)))(t)},skipNulls:!1,strictNullHandling:!1};function yl(t){return typeof t=="string"||typeof t=="number"||typeof t=="boolean"||typeof t=="symbol"||typeof t=="bigint"}var uo={};function Ji(t,e,r,s,n,o,i,a,c,u,h,f,g,y,I,x,_,v){let p=t,A=v,O=0,z=!1;for(;(A=A.get(uo))!==void 0&&!z;){let F=A.get(t);if(O+=1,typeof F<"u"){if(F===O)throw new RangeError("Cyclic object value");z=!0}typeof A.get(uo)>"u"&&(O=0)}if(typeof u=="function"?p=u(e,p):p instanceof Date?p=g?.(p):r==="comma"&&Y(p)&&(p=ao(p,function(F){return F instanceof Date?g?.(F):F})),p===null){if(o)return c&&!x?c(e,W.encoder,_,"key",y):e;p=""}if(yl(p)||Wi(p)){if(c){let F=x?e:c(e,W.encoder,_,"key",y);return[I?.(F)+"="+I?.(c(p,W.encoder,_,"value",y))]}return[I?.(e)+"="+I?.(String(p))]}let N=[];if(typeof p>"u")return N;let U;if(r==="comma"&&Y(p))x&&c&&(p=ao(p,c)),U=[{value:p.length>0?p.join(",")||null:void 0}];else if(Y(u))U=u;else{let F=Object.keys(p);U=h?F.sort(h):F}let L=a?String(e).replace(/\./g,"%2E"):String(e),X=s&&Y(p)&&p.length===1?L+"[]":L;if(n&&Y(p)&&p.length===0)return X+"[]";for(let F=0;F<U.length;++F){let q=U[F],ei=typeof q=="object"&&typeof q.value<"u"?q.value:p[q];if(i&&ei===null)continue;let Fn=f&&a?q.replace(/\./g,"%2E"):q,pl=Y(p)?typeof r=="function"?r(X,Fn):X:X+(f?"."+Fn:"["+Fn+"]");v.set(t,O);let ti=new WeakMap;ti.set(uo,v),Vi(N,Ji(ei,pl,r,s,n,o,i,a,r==="comma"&&x&&Y(p)?null:c,u,h,f,g,y,I,x,_,ti))}return N}function Al(t=W){if(typeof t.allowEmptyArrays<"u"&&typeof t.allowEmptyArrays!="boolean")throw new TypeError("`allowEmptyArrays` option can only be `true` or `false`, when provided");if(typeof t.encodeDotInKeys<"u"&&typeof t.encodeDotInKeys!="boolean")throw new TypeError("`encodeDotInKeys` option can only be `true` or `false`, when provided");if(t.encoder!==null&&typeof t.encoder<"u"&&typeof t.encoder!="function")throw new TypeError("Encoder has to be a function.");let e=t.charset||W.charset;if(typeof t.charset<"u"&&t.charset!=="utf-8"&&t.charset!=="iso-8859-1")throw new TypeError("The charset option must be either utf-8, iso-8859-1, or undefined");let r=so;if(typeof t.format<"u"){if(!Ys(oo,t.format))throw new TypeError("Unknown format option provided.");r=t.format}let s=oo[r],n=W.filter;(typeof t.filter=="function"||Y(t.filter))&&(n=t.filter);let o;if(t.arrayFormat&&t.arrayFormat in Zi?o=t.arrayFormat:"indices"in t?o=t.indices?"indices":"repeat":o=W.arrayFormat,"commaRoundTrip"in t&&typeof t.commaRoundTrip!="boolean")throw new TypeError("`commaRoundTrip` must be a boolean, or absent");let i=typeof t.allowDots>"u"?t.encodeDotInKeys?!0:W.allowDots:!!t.allowDots;return{addQueryPrefix:typeof t.addQueryPrefix=="boolean"?t.addQueryPrefix:W.addQueryPrefix,allowDots:i,allowEmptyArrays:typeof t.allowEmptyArrays=="boolean"?!!t.allowEmptyArrays:W.allowEmptyArrays,arrayFormat:o,charset:e,charsetSentinel:typeof t.charsetSentinel=="boolean"?t.charsetSentinel:W.charsetSentinel,commaRoundTrip:!!t.commaRoundTrip,delimiter:typeof t.delimiter>"u"?W.delimiter:t.delimiter,encode:typeof t.encode=="boolean"?t.encode:W.encode,encodeDotInKeys:typeof t.encodeDotInKeys=="boolean"?t.encodeDotInKeys:W.encodeDotInKeys,encoder:typeof t.encoder=="function"?t.encoder:W.encoder,encodeValuesOnly:typeof t.encodeValuesOnly=="boolean"?t.encodeValuesOnly:W.encodeValuesOnly,filter:n,format:r,formatter:s,serializeDate:typeof t.serializeDate=="function"?t.serializeDate:W.serializeDate,skipNulls:typeof t.skipNulls=="boolean"?t.skipNulls:W.skipNulls,sort:typeof t.sort=="function"?t.sort:null,strictNullHandling:typeof t.strictNullHandling=="boolean"?t.strictNullHandling:W.strictNullHandling}}function Gi(t,e={}){let r=t,s=Al(e),n,o;typeof s.filter=="function"?(o=s.filter,r=o("",r)):Y(s.filter)&&(o=s.filter,n=o);let i=[];if(typeof r!="object"||r===null)return"";let a=Zi[s.arrayFormat],c=a==="comma"&&s.commaRoundTrip;n||(n=Object.keys(r)),s.sort&&n.sort(s.sort);let u=new WeakMap;for(let g=0;g<n.length;++g){let y=n[g];s.skipNulls&&r[y]===null||Vi(i,Ji(r[y],y,a,c,s.allowEmptyArrays,s.strictNullHandling,s.skipNulls,s.encodeDotInKeys,s.encode?s.encoder:null,s.filter,s.sort,s.allowDots,s.serializeDate,s.format,s.formatter,s.encodeValuesOnly,s.charset,u))}let h=i.join(s.delimiter),f=s.addQueryPrefix===!0?"?":"";return s.charsetSentinel&&(s.charset==="iso-8859-1"?f+="utf8=%26%2310003%3B&":f+="utf8=%E2%9C%93&"),h.length>0?f+h:""}function Xi(t){return Gi(t,{arrayFormat:"brackets"})}function ea(t){let e=0;for(let n of t)e+=n.length;let r=new Uint8Array(e),s=0;for(let n of t)r.set(n,s),s+=n.length;return r}var Yi;function Yt(t){let e;return(Yi??(e=new globalThis.TextEncoder,Yi=e.encode.bind(e)))(t)}var Qi;function lo(t){let e;return(Qi??(e=new globalThis.TextDecoder,Qi=e.decode.bind(e)))(t)}var se,ne,ot=class{constructor(){se.set(this,void 0),ne.set(this,void 0),k(this,se,new Uint8Array,"f"),k(this,ne,null,"f")}decode(e){if(e==null)return[];let r=e instanceof ArrayBuffer?new Uint8Array(e):typeof e=="string"?Yt(e):e;k(this,se,ea([d(this,se,"f"),r]),"f");let s=[],n;for(;(n=bl(d(this,se,"f"),d(this,ne,"f")))!=null;){if(n.carriage&&d(this,ne,"f")==null){k(this,ne,n.index,"f");continue}if(d(this,ne,"f")!=null&&(n.index!==d(this,ne,"f")+1||n.carriage)){s.push(lo(d(this,se,"f").subarray(0,d(this,ne,"f")-1))),k(this,se,d(this,se,"f").subarray(d(this,ne,"f")),"f"),k(this,ne,null,"f");continue}let o=d(this,ne,"f")!==null?n.preceding-1:n.preceding,i=lo(d(this,se,"f").subarray(0,o));s.push(i),k(this,se,d(this,se,"f").subarray(n.index),"f"),k(this,ne,null,"f")}return s}flush(){return d(this,se,"f").length?this.decode(`
@@ -1,2 +1,2 @@
1
1
  /* COPYRIGHT Esri - https://js.arcgis.com/5.2/LICENSE.txt */
2
- import a from"./VNJMTA6O.js";import"./ZLWWWTH4.js";import"./7M6VKBTK.js";import"./EWLXNGKH.js";import"./AI6DYOKR.js";import"./MWYBF3F3.js";import"./UZLQALHY.js";export default $arcgis.t(([{property:l,subclass:w},{c:p,d:d}])=>{var y=Object.defineProperty,m=Object.getOwnPropertyDescriptor,f=e=>{throw TypeError(e)},h=(e,t,o,n)=>{for(var r=n>1?void 0:n?m(t,o):t,s=e.length-1,g;s>=0;s--)(g=e[s])&&(r=(n?g(t,o,r):g(r))||r);return n&&r&&y(t,o,r),r},k=(e,t,o)=>t.has(e)||f("Cannot "+o),b=(e,t,o)=>t.has(e)?f("Cannot add the same private member more than once"):t instanceof WeakSet?t.add(e):t.set(e,o),c=(e,t,o)=>(k(e,t,"access private method"),o),a,i,u=class extends d{constructor(e){super(e),b(this,a)}getAgents(){return c(this,a,i).call(this),[this.routerAgent,...Object.values(this.agentsMap)]}buildEdges(e){c(this,a,i).call(this);let t=p(this.routerAgent,0),o=new Map;for(let[n,[r]]of Object.entries(this.agentsMap).entries())o.set(r,p(e[n+1],n+1));return[{from:t,decide:n=>{let r=n[this.routerOutputKey];if(typeof r!="string"||!r)throw new Error("RouterWorkflow decideRoute could not determine next agent from state.");let s=o.get(r);if(!s)throw new Error(`RouterWorkflow decideRoute returned unknown agent: ${r}. Expected one of: ${Object.keys(this.agentsMap).join(", ")||"(none)"}.`);return s}}]}getEntryNode(){return c(this,a,i).call(this),p(this.routerAgent,0)}isTerminalAgent(e,t){return t>0}validateAgents(e){c(this,a,i).call(this),super.validateAgents(e)}};a=new WeakSet;i=function(){if(!Object.keys(this.agentsMap).length)throw new Error("RouterWorkflow requires a non-empty agentsMap.")};h([l()],u.prototype,"agentsMap",2);h([l()],u.prototype,"routerAgent",2);h([l()],u.prototype,"routerOutputKey",2);u=h([w("RouterWorkflow")],u);return u},"core/accessorSupport/decorators",a)
2
+ import a from"./ANRQWYU2.js";import"./R2PQVY4O.js";import"./G2EGT3CF.js";import"./EWLXNGKH.js";import"./AI6DYOKR.js";import"./MWYBF3F3.js";import"./UZLQALHY.js";export default $arcgis.t(([{property:l,subclass:w},{c:p,d:d}])=>{var y=Object.defineProperty,m=Object.getOwnPropertyDescriptor,f=e=>{throw TypeError(e)},h=(e,t,o,n)=>{for(var r=n>1?void 0:n?m(t,o):t,s=e.length-1,g;s>=0;s--)(g=e[s])&&(r=(n?g(t,o,r):g(r))||r);return n&&r&&y(t,o,r),r},k=(e,t,o)=>t.has(e)||f("Cannot "+o),b=(e,t,o)=>t.has(e)?f("Cannot add the same private member more than once"):t instanceof WeakSet?t.add(e):t.set(e,o),c=(e,t,o)=>(k(e,t,"access private method"),o),a,i,u=class extends d{constructor(e){super(e),b(this,a)}getAgents(){return c(this,a,i).call(this),[this.routerAgent,...Object.values(this.agentsMap)]}buildEdges(e){c(this,a,i).call(this);let t=p(this.routerAgent,0),o=new Map;for(let[n,[r]]of Object.entries(this.agentsMap).entries())o.set(r,p(e[n+1],n+1));return[{from:t,decide:n=>{let r=n[this.routerOutputKey];if(typeof r!="string"||!r)throw new Error("RouterWorkflow decideRoute could not determine next agent from state.");let s=o.get(r);if(!s)throw new Error(`RouterWorkflow decideRoute returned unknown agent: ${r}. Expected one of: ${Object.keys(this.agentsMap).join(", ")||"(none)"}.`);return s}}]}getEntryNode(){return c(this,a,i).call(this),p(this.routerAgent,0)}isTerminalAgent(e,t){return t>0}validateAgents(e){c(this,a,i).call(this),super.validateAgents(e)}};a=new WeakSet;i=function(){if(!Object.keys(this.agentsMap).length)throw new Error("RouterWorkflow requires a non-empty agentsMap.")};h([l()],u.prototype,"agentsMap",2);h([l()],u.prototype,"routerAgent",2);h([l()],u.prototype,"routerOutputKey",2);u=h([w("RouterWorkflow")],u);return u},"core/accessorSupport/decorators",a)
@@ -1,2 +1,2 @@
1
1
  /* COPYRIGHT Esri - https://js.arcgis.com/5.2/LICENSE.txt */
2
- import{a as u,b as g,c as S}from"./CP5BVGJU.js";import a from"./OWTGH34K.js";import{d as m,e as f}from"./ZLWWWTH4.js";import"./7M6VKBTK.js";import{y as p}from"./EWLXNGKH.js";import"./AI6DYOKR.js";import"./MWYBF3F3.js";import"./UZLQALHY.js";export default $arcgis.t(([{property:h,subclass:l},{watch:w},d])=>{var v=Object.defineProperty,y=Object.getOwnPropertyDescriptor,o=(t,e,s,r)=>{for(var i=r>1?void 0:r?y(e,s):e,a=t.length-1,c;a>=0;a--)(c=t[a])&&(i=(r?c(e,s,i):c(i))||i);return r&&i&&v(e,s,i),i},n=class extends d{constructor(t){super(t)}initialize(){this.addHandles(w(()=>[this.name,this.description,this.inputSchema,this.outputSchema,this.execute],()=>{this.generate()},{initial:!0,sync:!0}))}getSchemas(){return[this.inputSchema,this.outputSchema].filter(Boolean)}generate(){let t=m(this.getSchemas());this._set("workspace",t);let e=`${this.id}-execute`,s={[e]:this._invokeExecuteNode.bind(this)},r=[{from:e,decide:()=>{}}];this._set("createGraph",()=>f(s,r,t,{agent:this,entryNode:e,middlewares:this.middlewares}))}async _invokeExecuteNode(t,e){try{return this.outputSchema?await this._invokeStructured(t,e):await this._invokeUnstructured(t,e)}catch(s){if(p(s))throw s;let r=s instanceof Error?s.message:String(s);return u({outputMessage:r},"failed",r)}}async _invokeStructured(t,e){if(!this.outputSchema)throw new Error("Output schema is required for structured invocation.");let s=this._validateInputState(t),r=await this.execute(s,e);if(typeof r=="string")throw new Error("Expected execute function to return an object matching the output schema, but received a string.");return g(r,this.outputSchema,t.agentExecutionContext.messages)}async _invokeUnstructured(t,e){let s=this._validateInputState(t),r=await this.execute(s,e),i=typeof r=="string"?r:JSON.stringify(r),a=i.trim()||"FunctionAgent completed.";return u({outputMessage:i},"success",a)}_validateInputState(t){if(!this.inputSchema)return t;let e=this.inputSchema.safeParse(S(t,this.inputSchema));if(!e.success)throw new Error(`FunctionAgent input schema validation failed: ${e.error.message}`);return{...t,...e.data}}};o([h()],n.prototype,"inputSchema",2);o([h()],n.prototype,"outputSchema",2);o([h()],n.prototype,"execute",2);n=o([l("FunctionAgent")],n);return n},"core/accessorSupport/decorators","core/reactiveUtils",a)
2
+ import{a as u,b as g,c as S}from"./CP5BVGJU.js";import a from"./7VUSIGEM.js";import{d as m,e as f}from"./R2PQVY4O.js";import"./G2EGT3CF.js";import{y as p}from"./EWLXNGKH.js";import"./AI6DYOKR.js";import"./MWYBF3F3.js";import"./UZLQALHY.js";export default $arcgis.t(([{property:h,subclass:l},{watch:w},d])=>{var v=Object.defineProperty,y=Object.getOwnPropertyDescriptor,o=(t,e,s,r)=>{for(var i=r>1?void 0:r?y(e,s):e,a=t.length-1,c;a>=0;a--)(c=t[a])&&(i=(r?c(e,s,i):c(i))||i);return r&&i&&v(e,s,i),i},n=class extends d{constructor(t){super(t)}initialize(){this.addHandles(w(()=>[this.name,this.description,this.inputSchema,this.outputSchema,this.execute],()=>{this.generate()},{initial:!0,sync:!0}))}getSchemas(){return[this.inputSchema,this.outputSchema].filter(Boolean)}generate(){let t=m(this.getSchemas());this._set("workspace",t);let e=`${this.id}-execute`,s={[e]:this._invokeExecuteNode.bind(this)},r=[{from:e,decide:()=>{}}];this._set("createGraph",()=>f(s,r,t,{agent:this,entryNode:e,middlewares:this.middlewares}))}async _invokeExecuteNode(t,e){try{return this.outputSchema?await this._invokeStructured(t,e):await this._invokeUnstructured(t,e)}catch(s){if(p(s))throw s;let r=s instanceof Error?s.message:String(s);return u({outputMessage:r},"failed",r)}}async _invokeStructured(t,e){if(!this.outputSchema)throw new Error("Output schema is required for structured invocation.");let s=this._validateInputState(t),r=await this.execute(s,e);if(typeof r=="string")throw new Error("Expected execute function to return an object matching the output schema, but received a string.");return g(r,this.outputSchema,t.agentExecutionContext.messages)}async _invokeUnstructured(t,e){let s=this._validateInputState(t),r=await this.execute(s,e),i=typeof r=="string"?r:JSON.stringify(r),a=i.trim()||"FunctionAgent completed.";return u({outputMessage:i},"success",a)}_validateInputState(t){if(!this.inputSchema)return t;let e=this.inputSchema.safeParse(S(t,this.inputSchema));if(!e.success)throw new Error(`FunctionAgent input schema validation failed: ${e.error.message}`);return{...t,...e.data}}};o([h()],n.prototype,"inputSchema",2);o([h()],n.prototype,"outputSchema",2);o([h()],n.prototype,"execute",2);n=o([l("FunctionAgent")],n);return n},"core/accessorSupport/decorators","core/reactiveUtils",a)
@@ -0,0 +1,6 @@
1
+ /* COPYRIGHT Esri - https://js.arcgis.com/5.2/LICENSE.txt */
2
+ import{ka as r}from"./EWLXNGKH.js";var a=(e,t)=>t,d=(e,t)=>({...e,...t}),o=(e="",t)=>{let s=typeof t=="string"?t.trim():"";if(!s)return e;let u=e.trim();if(!u)return s;if(u===s)return e;let n=u.split(`
3
+
4
+ `);return n[n.length-1]?.trim()===s?e:`${e}
5
+
6
+ ${s}`},c=()=>({userRequest:"",assignedTask:"",messages:[],priorSteps:[],sharedState:{},sharedResources:[]}),i=()=>({agentExecutionContext:r({reducer:d,default:c}),outputMessage:r({reducer:o,default:()=>""}),summary:r({reducer:a,default:()=>""}),status:r({reducer:a}),sharedStatePatch:r({reducer:a}),sharedResourceAdditions:r({reducer:a})}),f=()=>i();export{a,d as b,o as c,c as d,i as e,f};
@@ -1,2 +1,2 @@
1
1
  /* COPYRIGHT Esri - https://js.arcgis.com/5.2/LICENSE.txt */
2
- import{a as d,b as S,c as v}from"./CP5BVGJU.js";import b from"./OWTGH34K.js";import{d as f,e as y}from"./ZLWWWTH4.js";import a from"./AT4XVTJR.js";import{c as u}from"./HHFNQR6Z.js";import{b as c}from"./VOKXKU7M.js";import{Y as g,y as l}from"./EWLXNGKH.js";export default $arcgis.t(([,,,{watch:T},,{property:m,subclass:_},{d:h},w])=>{var k=Object.defineProperty,x=Object.getOwnPropertyDescriptor,a=(t,r,e,s)=>{for(var o=s>1?void 0:s?x(r,e):r,n=t.length-1,p;n>=0;n--)(p=t[n])&&(o=(s?p(r,e,o):p(o))||o);return s&&o&&k(r,e,o),o},i=class extends w{constructor(t){super(t),this.modelTier="default"}initialize(){this.addHandles(T(()=>[this.description,this.inputSchema,this.modelTier,this.name,this.outputSchema,this.prompt,this.tools],()=>{this.generate()},{initial:!0,sync:!0}))}getSchemas(){return[this.inputSchema,this.outputSchema].filter(Boolean)}generate(){let t=f(this.getSchemas());this._set("workspace",t);let r=this.id,e={[r]:this._invoke.bind(this)},s=[{from:r,decide:()=>{}}];this._set("createGraph",()=>y(e,s,t,{agent:this,entryNode:r,middlewares:this.middlewares}))}async _invoke(t,r){try{return this.outputSchema?await this._invokeStructured(t,r):await this._invokeUnstructured(t,r)}catch(e){if(l(e))throw e;let s=e instanceof Error?e.message:String(e);return d({outputMessage:s},"failed",s)}}async _invokeStructured(t,r){if(!this.outputSchema)throw new Error("Output schema is required for structured invocation.");let e=await c({model:await h({modelTier:this.modelTier}),systemPrompt:await this._getPromptWithInputVariables(t),tools:this._getTools(),checkpointer:!0,middleware:u(this.middlewares),responseFormat:this.outputSchema}).invoke({messages:t.agentExecutionContext.messages},r);if(!("structuredResponse"in e)||e.structuredResponse===void 0)throw new Error("LLMAgent did not receive structured output from createAgent.");return S(e.structuredResponse,this.outputSchema,e.messages)}async _invokeUnstructured(t,r){let e=(await c({model:await h({modelTier:this.modelTier}),systemPrompt:await this._getPromptWithInputVariables(t),tools:this._getTools(),checkpointer:!0,middleware:u(this.middlewares)}).invoke({messages:t.agentExecutionContext.messages},r)).messages,s=e.at(-1)?.content??"",o=typeof s=="string"?s:JSON.stringify(s),n=o.trim()||"LLMAgent completed.";return d({agentExecutionContext:{...t.agentExecutionContext,messages:e},outputMessage:o},"success",n)}async _getPromptWithInputVariables(t){let r=v(t,this.inputSchema);for(let{outputKey:e}of this.middlewares)e&&(r[String(e)]=t[e]);return await g.fromTemplate(this.prompt).format(r)}_getTools(){return this.tools?.map(t=>"getTool"in t?t.getTool():t)??[]}};a([m()],i.prototype,"prompt",2);a([m()],i.prototype,"tools",2);a([m()],i.prototype,"inputSchema",2);a([m()],i.prototype,"outputSchema",2);a([m()],i.prototype,"modelTier",2);i=a([_("LLMAgent")],i);return i},"identity/IdentityManager","portal/Portal","request","core/reactiveUtils","layers/FeatureLayer","core/accessorSupport/decorators",a,b)
2
+ import{a as d,b as S,c as v}from"./CP5BVGJU.js";import b from"./7VUSIGEM.js";import{d as f,e as y}from"./R2PQVY4O.js";import a from"./D5UFYQHN.js";import{c as u}from"./HHFNQR6Z.js";import{b as c}from"./VOKXKU7M.js";import{Y as g,y as l}from"./EWLXNGKH.js";export default $arcgis.t(([,,,{watch:T},,{property:m,subclass:_},{d:h},w])=>{var k=Object.defineProperty,x=Object.getOwnPropertyDescriptor,a=(t,r,e,s)=>{for(var o=s>1?void 0:s?x(r,e):r,n=t.length-1,p;n>=0;n--)(p=t[n])&&(o=(s?p(r,e,o):p(o))||o);return s&&o&&k(r,e,o),o},i=class extends w{constructor(t){super(t),this.modelTier="default"}initialize(){this.addHandles(T(()=>[this.description,this.inputSchema,this.modelTier,this.name,this.outputSchema,this.prompt,this.tools],()=>{this.generate()},{initial:!0,sync:!0}))}getSchemas(){return[this.inputSchema,this.outputSchema].filter(Boolean)}generate(){let t=f(this.getSchemas());this._set("workspace",t);let r=this.id,e={[r]:this._invoke.bind(this)},s=[{from:r,decide:()=>{}}];this._set("createGraph",()=>y(e,s,t,{agent:this,entryNode:r,middlewares:this.middlewares}))}async _invoke(t,r){try{return this.outputSchema?await this._invokeStructured(t,r):await this._invokeUnstructured(t,r)}catch(e){if(l(e))throw e;let s=e instanceof Error?e.message:String(e);return d({outputMessage:s},"failed",s)}}async _invokeStructured(t,r){if(!this.outputSchema)throw new Error("Output schema is required for structured invocation.");let e=await c({model:await h({modelTier:this.modelTier}),systemPrompt:await this._getPromptWithInputVariables(t),tools:this._getTools(),checkpointer:!0,middleware:u(this.middlewares),responseFormat:this.outputSchema}).invoke({messages:t.agentExecutionContext.messages},r);if(!("structuredResponse"in e)||e.structuredResponse===void 0)throw new Error("LLMAgent did not receive structured output from createAgent.");return S(e.structuredResponse,this.outputSchema,e.messages)}async _invokeUnstructured(t,r){let e=(await c({model:await h({modelTier:this.modelTier}),systemPrompt:await this._getPromptWithInputVariables(t),tools:this._getTools(),checkpointer:!0,middleware:u(this.middlewares)}).invoke({messages:t.agentExecutionContext.messages},r)).messages,s=e.at(-1)?.content??"",o=typeof s=="string"?s:JSON.stringify(s),n=o.trim()||"LLMAgent completed.";return d({agentExecutionContext:{...t.agentExecutionContext,messages:e},outputMessage:o},"success",n)}async _getPromptWithInputVariables(t){let r=v(t,this.inputSchema);for(let{outputKey:e}of this.middlewares)e&&(r[String(e)]=t[e]);return await g.fromTemplate(this.prompt).format(r)}_getTools(){return this.tools?.map(t=>"getTool"in t?t.getTool():t)??[]}};a([m()],i.prototype,"prompt",2);a([m()],i.prototype,"tools",2);a([m()],i.prototype,"inputSchema",2);a([m()],i.prototype,"outputSchema",2);a([m()],i.prototype,"modelTier",2);i=a([_("LLMAgent")],i);return i},"identity/IdentityManager","portal/Portal","request","core/reactiveUtils","layers/FeatureLayer","core/accessorSupport/decorators",a,b)
@@ -1,2 +1,2 @@
1
1
  /* COPYRIGHT Esri - https://js.arcgis.com/5.2/LICENSE.txt */
2
- import a from"./OWTGH34K.js";import{e as l}from"./ZLWWWTH4.js";import"./7M6VKBTK.js";import"./EWLXNGKH.js";import"./AI6DYOKR.js";import"./MWYBF3F3.js";import"./UZLQALHY.js";export default $arcgis.t(([{property:p,subclass:m},{watch:w},c])=>{var d=Object.defineProperty,f=Object.getOwnPropertyDescriptor,n=(e,r,s,o)=>{for(var t=o>1?void 0:o?f(r,s):r,i=e.length-1,a;i>=0;i--)(a=e[i])&&(t=(o?a(r,s,t):a(t))||t);return o&&t&&d(r,s,t),t},h=class extends c{constructor(e){super(e)}initialize(){this.addHandles(w(()=>[this.name,this.description,this.inputSchema,this.outputSchema,this.workflow],()=>this.generate(),{initial:!0,sync:!0}))}getSchemas(){return[this.inputSchema,...this.workflow.getAgents().flatMap(e=>e.getSchemas()),this.outputSchema].filter(Boolean)}generate(){let{workspace:e,createGraph:r}=this.workflow.generate();if(this._set("workspace",e),!this.middlewares?.length)this._set("createGraph",r);else{let s=this.id,o={[s]:async(i,a)=>await r().compile().invoke(i,a)},t=[{from:s,decide:()=>{}}];this._set("createGraph",()=>l(o,t,e,{agent:this,entryNode:s,middlewares:this.middlewares}))}}};n([p()],h.prototype,"workflow",2);n([p()],h.prototype,"inputSchema",2);n([p()],h.prototype,"outputSchema",2);h=n([m("WorkflowAgent")],h);return h},"core/accessorSupport/decorators","core/reactiveUtils",a)
2
+ import a from"./7VUSIGEM.js";import{e as l}from"./R2PQVY4O.js";import"./G2EGT3CF.js";import"./EWLXNGKH.js";import"./AI6DYOKR.js";import"./MWYBF3F3.js";import"./UZLQALHY.js";export default $arcgis.t(([{property:p,subclass:m},{watch:w},c])=>{var d=Object.defineProperty,f=Object.getOwnPropertyDescriptor,n=(e,r,s,o)=>{for(var t=o>1?void 0:o?f(r,s):r,i=e.length-1,a;i>=0;i--)(a=e[i])&&(t=(o?a(r,s,t):a(t))||t);return o&&t&&d(r,s,t),t},h=class extends c{constructor(e){super(e)}initialize(){this.addHandles(w(()=>[this.name,this.description,this.inputSchema,this.outputSchema,this.workflow],()=>this.generate(),{initial:!0,sync:!0}))}getSchemas(){return[this.inputSchema,...this.workflow.getAgents().flatMap(e=>e.getSchemas()),this.outputSchema].filter(Boolean)}generate(){let{workspace:e,createGraph:r}=this.workflow.generate();if(this._set("workspace",e),!this.middlewares?.length)this._set("createGraph",r);else{let s=this.id,o={[s]:async(i,a)=>await r().compile().invoke(i,a)},t=[{from:s,decide:()=>{}}];this._set("createGraph",()=>l(o,t,e,{agent:this,entryNode:s,middlewares:this.middlewares}))}}};n([p()],h.prototype,"workflow",2);n([p()],h.prototype,"inputSchema",2);n([p()],h.prototype,"outputSchema",2);h=n([m("WorkflowAgent")],h);return h},"core/accessorSupport/decorators","core/reactiveUtils",a)
@@ -1,2 +1,2 @@
1
1
  /* COPYRIGHT Esri - https://js.arcgis.com/5.2/LICENSE.txt */
2
- import a from"./VNJMTA6O.js";import"./ZLWWWTH4.js";import"./7M6VKBTK.js";import"./EWLXNGKH.js";import"./AI6DYOKR.js";import"./MWYBF3F3.js";import"./UZLQALHY.js";export default $arcgis.t(([{property:g,subclass:y},{c:p,d:w}])=>{var b=Object.defineProperty,k=Object.getOwnPropertyDescriptor,v=e=>{throw TypeError(e)},h=(e,t,r,s)=>{for(var n=s>1?void 0:s?k(t,r):t,o=e.length-1,a;o>=0;o--)(a=e[o])&&(n=(s?a(t,r,n):a(n))||n);return s&&n&&b(t,r,n),n},A=(e,t,r)=>t.has(e)||v("Cannot "+r),M=(e,t,r)=>t.has(e)?v("Cannot add the same private member more than once"):t instanceof WeakSet?t.add(e):t.set(e,r),m=(e,t,r)=>(A(e,t,"access private method"),r),c,u,i=class extends w{constructor(e){super(e),M(this,c)}getAgents(){let e=Object.values(this.agentsMap);return this.defaultAgent?e.concat(this.defaultAgent):e}buildNodes(e){let t=super.buildNodes(e);return t[d]=()=>({}),t}buildEdges(e){m(this,c,u).call(this);let t=this.resolver,r=new Map;for(let[o,[a]]of Object.entries(this.agentsMap).entries())r.set(a,p(e[o],o));let{defaultAgent:s}=this,n=s?p(s,e.length-1):void 0;return[{from:d,decide:async(o,a)=>{let l=await Promise.resolve(t(o,a));if(!l)return;let f=r.get(l);if(f)return f;if(s)return n;throw new Error(`SwitchWorkflow resolver returned unknown case: ${l}. Expected one of: ${Object.keys(this.agentsMap).join(", ")||"(none)"}.`)}}]}getEntryNode(){return d}isTerminalAgent(){return!0}validateAgents(e){m(this,c,u).call(this),super.validateAgents(e)}};c=new WeakSet;u=function(){if(!Object.keys(this.agentsMap).length)throw new Error("SwitchWorkflow requires a non-empty agentsMap.")};h([g()],i.prototype,"agentsMap",2);h([g()],i.prototype,"resolver",2);h([g()],i.prototype,"defaultAgent",2);i=h([y("SwitchWorkflow")],i);var d="__switch_decide";return i},"core/accessorSupport/decorators",a)
2
+ import a from"./ANRQWYU2.js";import"./R2PQVY4O.js";import"./G2EGT3CF.js";import"./EWLXNGKH.js";import"./AI6DYOKR.js";import"./MWYBF3F3.js";import"./UZLQALHY.js";export default $arcgis.t(([{property:g,subclass:y},{c:p,d:w}])=>{var b=Object.defineProperty,k=Object.getOwnPropertyDescriptor,v=e=>{throw TypeError(e)},h=(e,t,r,s)=>{for(var n=s>1?void 0:s?k(t,r):t,o=e.length-1,a;o>=0;o--)(a=e[o])&&(n=(s?a(t,r,n):a(n))||n);return s&&n&&b(t,r,n),n},A=(e,t,r)=>t.has(e)||v("Cannot "+r),M=(e,t,r)=>t.has(e)?v("Cannot add the same private member more than once"):t instanceof WeakSet?t.add(e):t.set(e,r),m=(e,t,r)=>(A(e,t,"access private method"),r),c,u,i=class extends w{constructor(e){super(e),M(this,c)}getAgents(){let e=Object.values(this.agentsMap);return this.defaultAgent?e.concat(this.defaultAgent):e}buildNodes(e){let t=super.buildNodes(e);return t[d]=()=>({}),t}buildEdges(e){m(this,c,u).call(this);let t=this.resolver,r=new Map;for(let[o,[a]]of Object.entries(this.agentsMap).entries())r.set(a,p(e[o],o));let{defaultAgent:s}=this,n=s?p(s,e.length-1):void 0;return[{from:d,decide:async(o,a)=>{let l=await Promise.resolve(t(o,a));if(!l)return;let f=r.get(l);if(f)return f;if(s)return n;throw new Error(`SwitchWorkflow resolver returned unknown case: ${l}. Expected one of: ${Object.keys(this.agentsMap).join(", ")||"(none)"}.`)}}]}getEntryNode(){return d}isTerminalAgent(){return!0}validateAgents(e){m(this,c,u).call(this),super.validateAgents(e)}};c=new WeakSet;u=function(){if(!Object.keys(this.agentsMap).length)throw new Error("SwitchWorkflow requires a non-empty agentsMap.")};h([g()],i.prototype,"agentsMap",2);h([g()],i.prototype,"resolver",2);h([g()],i.prototype,"defaultAgent",2);i=h([y("SwitchWorkflow")],i);var d="__switch_decide";return i},"core/accessorSupport/decorators",a)
@@ -0,0 +1,3 @@
1
+ /* COPYRIGHT Esri - https://js.arcgis.com/5.2/LICENSE.txt */
2
+ import a from"./D5UFYQHN.js";import{b as E}from"./R74ZHFA6.js";import{a as p}from"./7VAQUCBU.js";import{Ya as M,a as I,b,ea as $,y as S}from"./EWLXNGKH.js";import{La as k,ea as C,qa as A}from"./AI6DYOKR.js";export default $arcgis.t(([N,P,T,G,z,{a:_,b:D,c:R,e:L,f:W,m:q}])=>{var B=async e=>{let t=await Q(),n=await _("default"),s=P.getDefault(),r=(await N.getCredential(`${s.url}/sharing`)).token,a={type:"generateEmbeddings",webmapEmbeddings:e,auth:{apiUrl:n,token:r}};return t.postMessage(a),await new Promise((i,o)=>{let d=u=>{u.data==="completed"&&(t.removeEventListener("message",d),i())},c=u=>{t.removeEventListener("message",d),o(u instanceof Error?u:new Error("Embeddings worker error"))};t.addEventListener("message",d),t.addEventListener("error",c,{once:!0})}),t},Q=async()=>{{let e=(await import("./OKVLGJAG.js")).default;return new e}},J=e=>{e.currentIntent="none"},K=async(e,t)=>{let n=R(t);if(e.agentExecutionContext.userRequest){let r=new A(e.agentExecutionContext.userRequest.trim());e.agentExecutionContext.messages=[...e.agentExecutionContext.messages,r],J(e)}let s=n?.services.agentRegistry.list().map(r=>r.agent.id)??[];return await p({text:`Available agents: ${[...s].join(", ")}`},t),await p({text:"Analyzing user input"},t),e},V=async(e,t)=>(await p({text:"Exiting..."},t),e),F=e=>typeof e=="object"&&e!==null&&!Array.isArray(e),X=(e,t)=>{if(!F(e)){e!==void 0&&console.warn(`Agent "${t}" returned invalid sharedStatePatch. Ignoring it.`);return}let n={};for(let[s,r]of Object.entries(e)){if(!F(r)||!("value"in r)){console.warn(`Agent "${t}" returned invalid sharedStatePatch entry for key "${s}". Ignoring that entry.`);continue}n[s]={value:r.value}}return n},Y=e=>{let{previousSharedState:t,patch:n,agentId:s}=e;if(!n)return t;let r=Date.now(),a={...t};for(let[i,o]of Object.entries(n))o?.value!==void 0&&(a[i]={value:o.value,meta:{updatedByAgentId:s,updatedAt:r}});return a},Z=256,ee=new Set(["point","polyline","polygon","extent","custom"]),te=e=>typeof e=="object"&&e!==null&&!Array.isArray(e),re=(e,t)=>{if(e===void 0)return;if(!Array.isArray(e)){console.warn(`Agent "${t}" returned invalid sharedResourceAdditions. Ignoring it.`);return}let n=[];for(let[s,r]of e.entries()){if(!te(r)||typeof r.kind!="string"||!ee.has(r.kind)||typeof r.description!="string"||!r.description.trim()||!("payload"in r)||r.payload===void 0){console.warn(`Agent "${t}" returned invalid sharedResourceAdditions entry at index ${s}. Ignoring that entry.`);continue}let a;try{a=structuredClone(r.payload)}catch{console.warn(`Agent "${t}" returned invalid sharedResourceAdditions entry at index ${s}. Ignoring that entry.`);continue}n.push({kind:r.kind,description:r.description.trim().slice(0,Z),payload:a})}return n.length?n:void 0},ne=e=>{let{previousSharedResources:t,additions:n,agentId:s}=e;if(!n?.length)return t;let r=Date.now(),a=n.map(i=>({...i,id:E(),meta:{createdByAgentId:s,createdAt:r}}));return[...t,...a].slice(-50)},j=e=>typeof e!="string"?void 0:e.trim()||void 0,se=e=>{switch(e){case"failed":return"Agent failed without a summary.";case"unknown":return"Agent returned with unknown status.";case"success":return"Agent completed without a summary.";default:return"Agent completed without a summary."}},ae=(e,t)=>{let n=j(t?.outputMessage),s=j(t?.summary),r=t?.status,a=r==="success"||r==="failed"?r:"unknown";a==="unknown"&&console.warn(`Agent "${e}" returned missing/invalid status. Defaulting to "unknown".`);let i=X(t?.sharedStatePatch,e),o=re(t?.sharedResourceAdditions,e);return{outputMessage:n,summary:s??n??se(a),status:a,sharedStatePatch:i,sharedResourceAdditions:o}},H=4e3,ie=async(e,t)=>{let n=R(t);if(t?.signal?.aborted)return await p({text:"Run cancelled; skipping agent execution"},t),{...e,currentIntent:"none",requiresFollowUp:!1};let{agentRegistry:s}=n?.services??{},r=s?.get(e.currentIntent);if(!r)return console.warn(`No agent found for intent: ${e.currentIntent}`),e;await p({text:`Executing registered agent: ${r.agent.name}`},t);let a={...t??{},metadata:{...t?.metadata,agentId:r.agent.id},configurable:{...n??{},agentId:r.agent.id,context:r.getContext?await r.getContext():void 0}},i;try{let c=await r.agent.createGraph().compile().invoke({agentExecutionContext:{...e.agentExecutionContext,messages:[...e.agentExecutionContext.messages],priorSteps:structuredClone(e.agentExecutionContext.priorSteps??[]),sharedState:structuredClone(e.agentExecutionContext.sharedState??{}),sharedResources:structuredClone(e.agentExecutionContext.sharedResources??[])}},a);i=ae(r.agent.name,c),await p({text:`Finished executing registered agent: ${r.agent.name}`},t)}catch(c){if(S(c)||t?.signal?.aborted||c instanceof Error&&c.name==="AbortError")throw c;let u=c instanceof Error?c.message:String(c);console.error(`Agent "${r.agent.name}" failed:`,c),await p({text:`Registered agent failed: ${r.agent.name}. ${u}`},t),i={status:"failed",outputMessage:`Agent execution failed: ${u}`,summary:`Agent execution failed: ${u}`}}let o=i.outputMessage,d=[...e.agentExecutionContext.messages];if(o){let c=o.length>H?`${o.slice(0,H-14)}
3
+ [truncated]`:o;d.push(new C(c))}return{...e,stepCount:e.stepCount+1,lastExecutedAgent:r.agent.id,requiresFollowUp:i.status==="failed"?!0:e.requiresFollowUp,finalOutputMessage:o??"",agentExecutionContext:{...e.agentExecutionContext,messages:d,priorSteps:[...e.agentExecutionContext.priorSteps??[],{agentId:r.agent.id,assignedTask:e.agentExecutionContext.assignedTask,summary:i?.summary||"No summary provided.",status:i?.status||"unknown"}],sharedState:Y({previousSharedState:e.agentExecutionContext.sharedState,patch:i.sharedStatePatch,agentId:r.agent.id}),sharedResources:ne({previousSharedResources:e.agentExecutionContext.sharedResources,additions:i.sharedResourceAdditions,agentId:r.agent.id})}}},oe=async(e,t)=>{if(e.routing.mode!=="direct")throw new Error("Direct agent assignment requires direct routing.");return await p({text:`Doing a direct route to agent: ${e.routing.agentId}`},t),{...e,currentIntent:e.routing.agentId,requiresFollowUp:!1,agentExecutionContext:{...e.agentExecutionContext,assignedTask:e.agentExecutionContext.userRequest}}},de=3,ce=e=>e.routing.mode==="direct"?"assignDirectAgent":"intentLLM",ue=e=>e.routing.mode==="direct"||e.stepCount>=de||!e.requiresFollowUp?"exit":"intentLLM",ge=()=>new M(D).addNode("ingestInput",K).addNode("assignDirectAgent",oe).addNode("intentLLM",W).addNode("executeRegisteredAgent",ie).addNode("exit",V).addEdge(I,"ingestInput").addConditionalEdges("ingestInput",ce).addEdge("assignDirectAgent","executeRegisteredAgent").addConditionalEdges("intentLLM",e=>e.currentIntent==="none"||e.currentIntent===e.lastExecutedAgent?"exit":"executeRegisteredAgent").addConditionalEdges("executeRegisteredAgent",ue).addEdge("exit",b),le=(e,t)=>{let n=e.output?.usage_metadata??t.usage_metadata,s=e.output?.llmOutput?.tokenUsage,r=n?.input_tokens??s?.promptTokens,a=n?.output_tokens??s?.completionTokens,i=n?.total_tokens??s?.totalTokens;if(r===void 0||a===void 0||i===void 0)return;let o=n?.input_token_details?.cache_read,d=n?.output_token_details?.reasoning;return{input:r,output:a,total:i,...o!==void 0&&{cacheRead:o},...d!==void 0&&{reasoning:d}}},he=(e,t,n,s)=>{switch(e){case"chat_model":case"llm":return"model";case"tool":case"retriever":return e;case"chain":return!s||t==="LangGraph"?"workflow":n===t?"node":"chain";default:return}},pe=e=>{if(e instanceof Error)return{message:e.message,name:e.name};let t=e,n=typeof t?.message=="string"?t.message:String(e??"Unknown runtime error"),s=typeof t?.name=="string"?t.name:void 0;return{message:n,...s&&{name:s}}},me=({event:e,runId:t,parentSpanId:n,timestamp:s})=>{let r=/^on_(.+)_(start|end|error)$/u.exec(e.event);if(!r)return;let[,a,i]=r,o=e.metadata??{},d=o.langgraph_node,c=he(a,e.name,d,n);if(!c)return;let u=o.agentId,m=o.model??o.ls_model_name,l=e.data,g=i==="end"&&c==="model"?le(l,o):void 0,y=e.tags?.includes("langsmith:hidden")||d==="__start__",h={...m&&{model:m},...g&&{tokenUsage:g},...y&&{internal:!0}},w={id:e.run_id,...n&&{parentId:n},label:e.name,type:c,...Object.keys(h).length&&{metadata:h}},v={runId:t,timestamp:s,type:"runtime",...u&&{agentId:u}};switch(i){case"start":return{...v,phase:"started",span:{...w,...l?.input!==void 0&&{input:l.input}}};case"end":return{...v,phase:"completed",span:{...w,...l?.output!==void 0&&{output:l.output}}};case"error":return{...v,phase:"failed",span:{...w,error:pe(l?.error)}};default:return}},f=class{constructor(){this.agentRegistry=new Map}register(t){let{agent:n}=t;if(this.agentRegistry.has(n.id))throw new Error(`Duplicate agent id: ${n.id}`);this.agentRegistry.set(n.id,t)}get(t){return this.agentRegistry.get(t)}list(){return[...this.agentRegistry.values()]}},x=class{constructor(t,n){this.graph=t,this.config={...n}}async waitForUser(){return await new Promise((t,n)=>{this.resolveWait=t,this.rejectWait=n})}handle(t,n){try{let s={agentId:t.agentId,id:t.id,payload:n},r=this.graph.streamEvents(null,{...this.config,configurable:{...this.config.configurable,hitlResponse:s},subgraphs:!0,version:"v2"});this.resolveWait?.(r)}catch(s){this.rejectWait?.(s)}finally{this.resolveWait=void 0,this.rejectWait=void 0}}cancel(){this.rejectWait&&(this.rejectWait(new Error("Request cancelled by user.")),this.resolveWait=void 0,this.rejectWait=void 0)}},ye=async e=>{try{return await(await L()).embedDocuments(e)}catch(t){throw console.error("Failed to generate embeddings:",t),t}},U=async(e,t)=>{let n=t.get(e);if(n)return n;let s=await ye([e]);return t.set(e,s[0]),s[0]};async function we(e,t,n,s){let r=`req-${Date.now()}`,a={type:"layerSearch",precomputedEmbedding:s?await U(e,s):void 0,requestId:r,minScore:n};return await new Promise(i=>{let o=d=>{d.data.requestId===r&&i(d.data.results)};t.addEventListener("message",o,{once:!0}),t.postMessage(a)})}function fe(e){let{worker:t}=e;return{async searchLayers({text:n,minScore:s,embeddingCache:r}){return await we(n,t,s,r)}}}var ve=async({combinedQuery:e,layerIds:t,embeddingsWorker:n,minScore:s,topResults:r,embeddingCache:a})=>{let i=`req-${Date.now()}`,o=a?await U(e,a):void 0,d={type:"fieldSearch",layerIdForFieldsSearch:t,precomputedEmbedding:o,requestId:i,minScore:s,topResults:r};return await new Promise(c=>{let u=m=>{if(m.data.requestId!==i)return;let l=m.data.results.map(({layerId:g,results:y})=>({layerId:g,results:y}));c(l)};n.addEventListener("message",u,{once:!0}),n.postMessage(d)})};function Ee(e){let{worker:t}=e;return{async searchFields({text:n,layerIds:s,minScore:r,topResults:a,embeddingCache:i}){return await ve({combinedQuery:n,layerIds:s,embeddingsWorker:t,minScore:r,topResults:a,embeddingCache:i})}}}var Re=e=>{let t=q.safeParse(e);if(!t.success)throw new Error("Embeddings response validation failed. Regenerate embeddings.");return t.data},xe=(e,t)=>{let n=new Map,s=new Map;if(t.allLayers.forEach(r=>{r instanceof G&&s.set(r.id,r)}),e.length!==s.size)throw new Error("Layer count mismatch during registry restoration. Regenerate embeddings.");for(let r of e){let a=s.get(r.id);if(!a)throw new Error(`Layer with ID ${r.id} not found in the original map during registry restoration. Regenerate embeddings.`);if(r.fields.length!==a.fields.length)throw new Error(`Field count mismatch for layer ID ${r.id} during registry restoration. Regenerate embeddings.`);let i={name:r.name,title:r.title,description:r.description},o=new Map;for(let d of r.fields){let c=a.fieldsIndex.get(d.name);if(!c)throw new Error(`Field with name ${d.name} not found in the original layer ${r.id} during registry restoration. Regenerate embeddings.`);o.set(d.name,{name:d.name,alias:a.getFieldAlias(d.name)??d.alias,description:d.description,type:c.type||"unknown",valueType:c.valueType||"unknown",domain:a.getFieldDomain(d.name)??void 0})}n.set(r.id,{layerItem:i,fieldRegistry:o})}return n},Ie=async e=>{try{return(await z(e,{responseType:"json"})).data}catch(t){throw new Error(`Failed to fetch data from ${e}: ${String(t)}`)}},be=async e=>{let t=e.map;if(!t?.portalItem)throw new Error("WebMap portal item is missing.");let{resources:n}=await t.portalItem.fetchResources(),s=n.find(a=>a.resource.path==="embeddings-v01.json");if(!s?.resource.url)throw new Error("Embeddings resource 'embeddings-v01.json' not found in the webmap portal item.");let r=await Ie(s.resource.url);return Re(r)},O=class e{constructor(){this.orchestratorReady=!1,this.chatHistory=[],this.priorSteps=[],this.sharedState={},this.sharedResources=[],this.agentRegistry=new f,this.activeRunId="",this.cancelledRunIds=new Set,this.parentRunIds=new Map,this.activeRuntimeSpans=new Map,this.runtimeEventsEnabled=!1,this.streamEpoch=0}static async init(t){let n=new e;n.runtimeEventsEnabled=t.runtimeEventsEnabled??!1;try{if(t.view?.map){await T.whenOnce(()=>t.view.ready);let s=await be(t.view),r=xe(s.layers,t.view.map);n.layersAndFieldsRegistry=r,n.embeddingsWorker=await B(s)}return t.agents?.forEach(s=>{n.agentRegistry.register(s)}),n.orchestratorReady=!0,n}catch(s){throw console.error("Orchestrator initialization failed:",s),s}}async*ask(t,n={}){if(!this.orchestratorReady)throw new Error("Orchestrator is not ready yet.");if(!this.agentRegistry.list().length)throw new Error("Orchestrator has no registered agents.");let s=this.createRequestAgentRegistry(n);if(!s.list().length)throw new Error("Orchestrator has no agents selected for this request.");if(++this.streamEpoch,!t.trim())return;let r=E();this.parentRunIds.clear(),this.activeRuntimeSpans.clear(),this.activeRunId=r,this.activeAbortController=new AbortController,this.graph||(this.graph=ge().compile({checkpointer:new $}));let a=this.embeddingsWorker?fe({worker:this.embeddingsWorker}):void 0,i=this.embeddingsWorker?Ee({worker:this.embeddingsWorker}):void 0,o=new Map,d=n.routing==="direct"?{mode:"direct",agentId:n.agentId}:{mode:"auto"},c={thread_id:r,hitlResponse:null,services:{layerSearch:a,fieldSearch:i,layersAndFieldsRegistry:this.layersAndFieldsRegistry,agentRegistry:s,embeddingCache:o}},u={version:"v2",streamMode:"custom",signal:this.activeAbortController.signal,...this.runtimeEventsEnabled&&{callbacks:[this.createHierarchyCallback()]},configurable:c,subgraphs:!0},m=this.graph?.streamEvents({routing:d,agentExecutionContext:{userRequest:t,messages:this.chatHistory,priorSteps:this.priorSteps,sharedState:this.sharedState,sharedResources:this.sharedResources}},u),l=++this.streamEpoch;if(yield*this.pipeStream(m,l,r),this.isRunCancelled(r)){yield*this.createCancellationEvents(r);return}for(;;){if(this.isRunCancelled(r)){yield*this.createCancellationEvents(r);return}let y=(await this.graph.getState(u,{subgraphs:!0})).tasks.find(h=>h.interrupts.length>0)?.interrupts[0]?.value;if(!y)break;this.currentInterrupt=y,this.interruptHandler=new x(this.graph,u),yield*this.closeActiveRuntimeSpans(r,"interrupted"),yield{runId:r,timestamp:Date.now(),type:"interrupt",interrupt:y};try{let h=await this.interruptHandler.waitForUser(),w=++this.streamEpoch;yield*this.pipeStream(h,w,r)}catch(h){if(this.isRunCancelled(r)){yield*this.createCancellationEvents(r);return}if(h){yield{runId:r,timestamp:Date.now(),type:"error",error:{message:h?.message}};return}}}if(this.isRunCancelled(r)){yield*this.createCancellationEvents(r);return}let g=(await this.graph.getState(u,{subgraphs:!0})).values;if(this.isRunCancelled(r)){yield*this.createCancellationEvents(r);return}this.chatHistory=g.agentExecutionContext.messages.length?g.agentExecutionContext.messages:this.chatHistory,this.priorSteps=g.agentExecutionContext.priorSteps?.slice(-5)??[],this.sharedState=g.agentExecutionContext.sharedState??{},this.sharedResources=g.agentExecutionContext.sharedResources??[],yield{runId:r,timestamp:Date.now(),type:"completed",result:{content:g.finalOutputMessage}}}newConversation(){this.chatHistory=[],this.priorSteps=[],this.sharedState={},this.sharedResources=[]}resumeInterrupt(t){if(!this.currentInterrupt||!this.interruptHandler)throw new Error("No pending interrupt to resume.");this.interruptHandler.handle(this.currentInterrupt,t)}cancelInterrupt(){this.interruptHandler&&this.interruptHandler.cancel()}cancel(){this.activeRunId&&(this.cancelledRunIds.add(this.activeRunId),this.activeAbortController?.abort(),++this.streamEpoch,this.interruptHandler?.cancel())}async*pipeStream(t,n,s){try{for await(let r of t){if(this.isRunCancelled(s)||n!==this.streamEpoch)break;if(this.runtimeEventsEnabled){let a=me({event:r,runId:s,parentSpanId:this.parentRunIds.get(r.run_id),timestamp:Date.now()});a&&(a.phase==="started"?this.activeRuntimeSpans.set(a.span.id,a):this.activeRuntimeSpans.delete(a.span.id),yield a)}r.event==="on_custom_event"&&r.name==="trace_message"?yield{runId:s,timestamp:Date.now(),type:"trace",data:r.data}:r.name==="graph_ux_suggestion"&&(yield{runId:s,timestamp:Date.now(),type:"ux-suggestion",suggestion:r.data})}}catch(r){if(!this.isRunCancelled(s))throw r}}*createCancellationEvents(t){yield*this.closeActiveRuntimeSpans(t,"cancelled"),yield{runId:t,timestamp:Date.now(),type:"cancelled",reason:"user"}}*closeActiveRuntimeSpans(t,n){let s=Date.now(),r=[...this.activeRuntimeSpans.values()].reverse();this.activeRuntimeSpans.clear();for(let a of r){let{input:i,...o}=a.span;yield{type:"runtime",phase:n,runId:t,timestamp:s,...a.agentId&&{agentId:a.agentId},span:o}}}createHierarchyCallback(){let t=(n,s)=>{s&&this.parentRunIds.set(n,s)};return k.fromMethods({handleLLMStart:(n,s,r,a)=>t(r,a),handleChatModelStart:(n,s,r,a)=>t(r,a),handleChainStart:(n,s,r,a)=>t(r,a),handleToolStart:(n,s,r,a)=>t(r,a),handleRetrieverStart:(n,s,r,a)=>t(r,a)})}isRunCancelled(t){return this.cancelledRunIds.has(t)}createRequestAgentRegistry(t){let n=t.routing==="direct"?[t.agentId]:t.agentIds,s=n?n.map(a=>{let i=this.agentRegistry.get(a);if(!i)throw new Error(`Agent is not registered: ${a}`);return i}):this.agentRegistry.list(),r=new f;return s.forEach(a=>r.register(a)),r}dispose(){this.sharedResources=[],this.embeddingsWorker&&(this.embeddingsWorker.terminate(),this.embeddingsWorker=void 0),this.orchestratorReady=!1}};return{a:ye,b:O}},"identity/IdentityManager","portal/Portal","core/reactiveUtils","layers/FeatureLayer","request",a)
@@ -1,5 +1,5 @@
1
1
  /* COPYRIGHT Esri - https://js.arcgis.com/5.2/LICENSE.txt */
2
- import d from"./SZ2QSSB3.js";import b from"./OYSPNIJI.js";import{a as h}from"./7SRLZQVC.js";import{a as m}from"./FDOMMK2M.js";import a from"./AT4XVTJR.js";import{a as p}from"./7VAQUCBU.js";import{Ya as c,a as u,b as n}from"./EWLXNGKH.js";export default $arcgis.t(([,,,,,,{p:g},{a:f,c:y,d:x,e:E,v:d},S])=>{var _=[h],v=e=>{if(!e||e.size===0)return"No layers available in this map.";let t=Array.from(e.values()).map(({layerItem:r,fieldRegistry:s},o)=>{let a=Array.from(s.values()).map(i=>i.name).slice(0,10).join(", "),l=s.size>10?` (and ${s.size-10} more)`:"";return`${o+1}. "${r.title}". Description: ${r.description}
2
+ import d from"./SZ2QSSB3.js";import b from"./MX7OEO5Z.js";import{a as h}from"./7SRLZQVC.js";import{a as m}from"./FDOMMK2M.js";import a from"./D5UFYQHN.js";import{a as p}from"./7VAQUCBU.js";import{Ya as c,a as u,b as n}from"./EWLXNGKH.js";export default $arcgis.t(([,,,,,,{p:g},{a:f,c:y,d:x,e:E,v:d},S])=>{var _=[h],v=e=>{if(!e||e.size===0)return"No layers available in this map.";let t=Array.from(e.values()).map(({layerItem:r,fieldRegistry:s},o)=>{let a=Array.from(s.values()).map(i=>i.name).slice(0,10).join(", "),l=s.size>10?` (and ${s.size-10} more)`:"";return`${o+1}. "${r.title}". Description: ${r.description}
3
3
  Fields: ${a}${l}`}).join(`
4
4
 
5
5
  `);return`This map contains ${e.size} layer(s):
@@ -1,5 +1,5 @@
1
1
  /* COPYRIGHT Esri - https://js.arcgis.com/5.2/LICENSE.txt */
2
- import i from"./KWD2ECTM.js";import h from"./U2D53TAX.js";import f from"./OAKRPM7D.js";import e from"./V52XWEGV.js";import c from"./AT4XVTJR.js";import{e as R,f as le}from"./7M6VKBTK.js";import{a as de}from"./5WYRJMBW.js";import{a as ue}from"./YEZ3AMNX.js";import a from"./JKIESH74.js";import{a as b,b as T}from"./7VAQUCBU.js";import{Fa as se,Sa as N,g as ne,j as D,k as P,ka as y,y as ie}from"./EWLXNGKH.js";import{Dc as g,S as $,W as B,fa as A}from"./AI6DYOKR.js";import{a as d}from"./VXFQANGJ.js";export default $arcgis.t(([ve,_,Se,,_e,,{createRenderer:Le},{getSchemesByTag:Fe,getSchemes:Qe},{getBackgroundColorTheme:xe},{createAgeRenderer:Ge,createContinuousRenderer:Ve},{getSchemesByTag:re},{createContinuousRenderer:Be},{createRenderer:Ke},{getSchemesByTag:Ue},{createRenderer:He},{getSchemesByTag:Je},{createRenderer:We},{getSchemesByTag:Ze},{createRenderer:Xe},{getSchemesByTag:Ye},{createAgeRenderer:et,createContinuousRenderer:tt},{createRenderer:rt},{getSchemesByTag:ot},at,ke,{fetchKnowledgeGraph:Ee,executeQueryStreaming:nt,executeSearchStreaming:it},st,{getBindParametersFromCypherQuery:lt},pe,{o:ce},fe,ye,me,he])=>{var Te=e=>Array.isArray(e)&&e.every($),De=e=>typeof e=="object"&&e!=null&&"messages"in e&&Te(e.messages),Pe=e=>typeof e=="object"&&e!=null&&"lg_tool_call"in e,O=class extends se{tools;handleToolErrors=!0;trace=!1;constructor(e,t){let{name:r,tags:o,handleToolErrors:a}=t??{};super({name:r,tags:o,func:(i,s)=>this.run(i,s)}),this.tools=e,this.handleToolErrors=a??this.handleToolErrors}async runTool(e,t,r){let o=this.tools.find(a=>a.name===e.name);try{if(o===void 0)throw new Error(`Tool "${e.name}" not found.`);let a={...e,type:"tool_call"},i={...t,state:r,toolCallId:e.id??"",config:t,context:t.context,store:t.store??null,writer:t.writer??t.configurable?.writer??null},s=await o.invoke(a,i);return $(s)&&s.getType()==="tool"||P(s)?s:new B({status:"success",name:o.name,content:typeof s=="string"?s:JSON.stringify(s),tool_call_id:e.id})}catch(a){if(!this.handleToolErrors||ie(a))throw a;return new B({status:"error",content:`Error: ${a.message}
2
+ import i from"./KWD2ECTM.js";import h from"./U2D53TAX.js";import f from"./OAKRPM7D.js";import e from"./V52XWEGV.js";import c from"./D5UFYQHN.js";import{e as R,f as le}from"./G2EGT3CF.js";import{a as de}from"./5WYRJMBW.js";import{a as ue}from"./YEZ3AMNX.js";import a from"./JKIESH74.js";import{a as b,b as T}from"./7VAQUCBU.js";import{Fa as se,Sa as N,g as ne,j as D,k as P,ka as y,y as ie}from"./EWLXNGKH.js";import{Dc as g,S as $,W as B,fa as A}from"./AI6DYOKR.js";import{a as d}from"./VXFQANGJ.js";export default $arcgis.t(([ve,_,Se,,_e,,{createRenderer:Le},{getSchemesByTag:Fe,getSchemes:Qe},{getBackgroundColorTheme:xe},{createAgeRenderer:Ge,createContinuousRenderer:Ve},{getSchemesByTag:re},{createContinuousRenderer:Be},{createRenderer:Ke},{getSchemesByTag:Ue},{createRenderer:He},{getSchemesByTag:Je},{createRenderer:We},{getSchemesByTag:Ze},{createRenderer:Xe},{getSchemesByTag:Ye},{createAgeRenderer:et,createContinuousRenderer:tt},{createRenderer:rt},{getSchemesByTag:ot},at,ke,{fetchKnowledgeGraph:Ee,executeQueryStreaming:nt,executeSearchStreaming:it},st,{getBindParametersFromCypherQuery:lt},pe,{o:ce},fe,ye,me,he])=>{var Te=e=>Array.isArray(e)&&e.every($),De=e=>typeof e=="object"&&e!=null&&"messages"in e&&Te(e.messages),Pe=e=>typeof e=="object"&&e!=null&&"lg_tool_call"in e,O=class extends se{tools;handleToolErrors=!0;trace=!1;constructor(e,t){let{name:r,tags:o,handleToolErrors:a}=t??{};super({name:r,tags:o,func:(i,s)=>this.run(i,s)}),this.tools=e,this.handleToolErrors=a??this.handleToolErrors}async runTool(e,t,r){let o=this.tools.find(a=>a.name===e.name);try{if(o===void 0)throw new Error(`Tool "${e.name}" not found.`);let a={...e,type:"tool_call"},i={...t,state:r,toolCallId:e.id??"",config:t,context:t.context,store:t.store??null,writer:t.writer??t.configurable?.writer??null},s=await o.invoke(a,i);return $(s)&&s.getType()==="tool"||P(s)?s:new B({status:"success",name:o.name,content:typeof s=="string"?s:JSON.stringify(s),tool_call_id:e.id})}catch(a){if(!this.handleToolErrors||ie(a))throw a;return new B({status:"error",content:`Error: ${a.message}
3
3
  Please fix your mistakes.`,name:e.name,tool_call_id:e.id??""})}}async run(e,t){let r;if(Pe(e)){let{lg_tool_call:i,...s}=e;r=[await this.runTool(i,t,s)]}else{let i;if(Te(e))i=e;else if(De(e))i=e.messages;else throw new Error("ToolNode only accepts BaseMessage[] or { messages: BaseMessage[] } as input.");let s=new Set(i.filter(c=>c.getType()==="tool").map(c=>c.tool_call_id)),n;for(let c=i.length-1;c>=0;c-=1){let l=i[c];if(A(l)){n=l;break}}if(n==null||!A(n))throw new Error("ToolNode only accepts AIMessages as input.");r=await Promise.all(n.tool_calls?.filter(c=>c.id==null||!s.has(c.id)).map(c=>this.runTool(c,t,e))??[])}if(!r.some(P))return Array.isArray(e)?r:{messages:r};let o=[],a=null;for(let i of r)P(i)?i.graph===D.PARENT&&Array.isArray(i.goto)&&i.goto.every(s=>ne(s))?a?a.goto.push(...i.goto):a=new D({graph:D.PARENT,goto:i.goto}):o.push(i):o.push(Array.isArray(e)?[i]:{messages:[i]});return a&&o.push(a),o}};var zo=y.Root({llmInputMessages:y({reducer:(e,t)=>N([],t),default:()=>[]})});var I=(e,t)=>t??e,Fa=y.Root({...le(),intent:y({reducer:I}),vectorSearchLayerResults:y({reducer:I,default:()=>[]}),vectorSearchFieldResults:y({reducer:I}),navigationInternalState:y({reducer:I,default:()=>({toolCallMessage:void 0})})}),Me=Object.assign({"../agents/arcgisKnowledge/prompts/arcgis_knowledge_current_lc_context.md":()=>import("./J6A4AS7E.js").then(e=>e.default),"../agents/arcgisKnowledge/prompts/arcgis_knowledge_current_map_context.md":()=>import("./TPULIO6I.js").then(e=>e.default),"../agents/arcgisKnowledge/prompts/arcgis_knowledge_cypher_query_prompt.md":()=>import("./IHP25JWI.js").then(e=>e.default),"../agents/arcgisKnowledge/prompts/arcgis_knowledge_lucene_generation_prompt.md":()=>import("./CEKOEHB3.js").then(e=>e.default),"../agents/arcgisKnowledge/prompts/arcgis_knowledge_summarize_result_prompt.md":()=>import("./VAXH6RUQ.js").then(e=>e.default),"../agents/arcgisKnowledge/prompts/arcgis_knowledge_tool_prompt.md":()=>import("./AOVJ34QE.js").then(e=>e.default),"../agents/dataExploration/prompts/data_explore_filter_prompt.md":()=>import("./PQ2DPOFM.js").then(e=>e.default),"../agents/dataExploration/prompts/data_explore_query_prompt.md":()=>import("./SDWWUWAF.js").then(e=>e.default),"../agents/dataExploration/prompts/summarize_query_response_prompt.md":()=>import("./FYZATVB3.js").then(e=>e.default),"../agents/help/prompts/help_prompt.md":()=>import("./NEV6OZN3.js").then(e=>e.default),"../agents/layerStyling/prompts/layer_styling_prompt.md":()=>import("./ICBIUFK7.js").then(e=>e.default),"../agents/navigation/prompts/navigation_intent_prompt.md":()=>import("./JEBRN3EU.js").then(e=>e.default),"../agents/navigation/prompts/navigation_tool_prompt.md":()=>import("./UHEYPSOR.js").then(e=>e.default)});async function F(e){let t=Object.entries(Me).find(([r])=>r.endsWith(`/${e}.md`));if(!t)throw new Error(`Prompt not found: ${e}
4
4
  Available prompts:
5
5
  ${Object.keys(Me).join(`
@@ -1,2 +1,2 @@
1
1
  /* COPYRIGHT Esri - https://js.arcgis.com/5.2/LICENSE.txt */
2
- import a from"./VNJMTA6O.js";import"./ZLWWWTH4.js";import"./7M6VKBTK.js";import"./EWLXNGKH.js";import"./AI6DYOKR.js";import"./MWYBF3F3.js";import"./UZLQALHY.js";export default $arcgis.t(([{property:g,subclass:p},{c:d,d:u}])=>{var f=Object.defineProperty,w=Object.getOwnPropertyDescriptor,c=(e,r,n,o)=>{for(var t=o>1?void 0:o?w(r,n):r,i=e.length-1,a;i>=0;i--)(a=e[i])&&(t=(o?a(r,n,t):a(t))||t);return o&&t&&f(r,n,t),t},s=class extends u{constructor(e){super(e)}getAgents(){return this.agents}buildNodes(e){let r=super.buildNodes(e);return r[l]=()=>({}),r}buildEdges(e){let r=this.condition;if(!r)throw new Error("ConditionalWorkflow requires a condition.");let n=d(e[0],0),o=d(e[1],1);return[{from:l,decide:async(t,i)=>await Promise.resolve(r(t,i))?n:o}]}getEntryNode(){return l}isTerminalAgent(){return!0}validateAgents(e){if(super.validateAgents(e),e.length!==2)throw new Error(`ConditionalWorkflow requires exactly 2 agents; received ${e.length}.`)}};c([g()],s.prototype,"condition",2);c([g()],s.prototype,"agents",2);s=c([p("ConditionalWorkflow")],s);var l="__conditional_decide";return s},"core/accessorSupport/decorators",a)
2
+ import a from"./ANRQWYU2.js";import"./R2PQVY4O.js";import"./G2EGT3CF.js";import"./EWLXNGKH.js";import"./AI6DYOKR.js";import"./MWYBF3F3.js";import"./UZLQALHY.js";export default $arcgis.t(([{property:g,subclass:p},{c:d,d:u}])=>{var f=Object.defineProperty,w=Object.getOwnPropertyDescriptor,c=(e,r,n,o)=>{for(var t=o>1?void 0:o?w(r,n):r,i=e.length-1,a;i>=0;i--)(a=e[i])&&(t=(o?a(r,n,t):a(t))||t);return o&&t&&f(r,n,t),t},s=class extends u{constructor(e){super(e)}getAgents(){return this.agents}buildNodes(e){let r=super.buildNodes(e);return r[l]=()=>({}),r}buildEdges(e){let r=this.condition;if(!r)throw new Error("ConditionalWorkflow requires a condition.");let n=d(e[0],0),o=d(e[1],1);return[{from:l,decide:async(t,i)=>await Promise.resolve(r(t,i))?n:o}]}getEntryNode(){return l}isTerminalAgent(){return!0}validateAgents(e){if(super.validateAgents(e),e.length!==2)throw new Error(`ConditionalWorkflow requires exactly 2 agents; received ${e.length}.`)}};c([g()],s.prototype,"condition",2);c([g()],s.prototype,"agents",2);s=c([p("ConditionalWorkflow")],s);var l="__conditional_decide";return s},"core/accessorSupport/decorators",a)
@@ -1,2 +1,2 @@
1
1
  /* COPYRIGHT Esri - https://js.arcgis.com/5.2/LICENSE.txt */
2
- import a from"./VNJMTA6O.js";import{e as l}from"./ZLWWWTH4.js";import"./7M6VKBTK.js";import"./EWLXNGKH.js";import"./AI6DYOKR.js";import"./MWYBF3F3.js";import"./UZLQALHY.js";export default $arcgis.t(([{property:g,subclass:u},{d:w}])=>{var f=Object.defineProperty,m=Object.getOwnPropertyDescriptor,c=(o,r,n,s)=>{for(var e=s>1?void 0:s?m(r,n):r,a=o.length-1,t;a>=0;a--)(t=o[a])&&(e=(s?t(r,n,e):t(e))||e);return s&&e&&f(r,n,e),e},p=class extends w{constructor(o){super(o)}getAgents(){return this.workflow.getAgents()}generate(){let o=this.workflow.generate(),r=o.workspace,n=o.createGraph().compile(),{decideContinue:s}=this,e={[i]:async(t,d)=>await n.invoke(t,d)},a=[{from:i,decide:async(t,d)=>await Promise.resolve(s(t,d))?i:void 0}];return{workspace:r,createGraph:()=>l(e,a,r,{entryNode:i})}}buildEdges(){throw new Error("LoopWorkflow overrides generate(); buildEdges should not be called.")}getEntryNode(){return i}isTerminalAgent(){return!0}};c([g()],p.prototype,"workflow",2);c([g()],p.prototype,"decideContinue",2);p=c([u("LoopWorkflow")],p);var i="__loop_body";return p},"core/accessorSupport/decorators",a)
2
+ import a from"./ANRQWYU2.js";import{e as l}from"./R2PQVY4O.js";import"./G2EGT3CF.js";import"./EWLXNGKH.js";import"./AI6DYOKR.js";import"./MWYBF3F3.js";import"./UZLQALHY.js";export default $arcgis.t(([{property:g,subclass:u},{d:w}])=>{var f=Object.defineProperty,m=Object.getOwnPropertyDescriptor,c=(o,r,n,s)=>{for(var e=s>1?void 0:s?m(r,n):r,a=o.length-1,t;a>=0;a--)(t=o[a])&&(e=(s?t(r,n,e):t(e))||e);return s&&e&&f(r,n,e),e},p=class extends w{constructor(o){super(o)}getAgents(){return this.workflow.getAgents()}generate(){let o=this.workflow.generate(),r=o.workspace,n=o.createGraph().compile(),{decideContinue:s}=this,e={[i]:async(t,d)=>await n.invoke(t,d)},a=[{from:i,decide:async(t,d)=>await Promise.resolve(s(t,d))?i:void 0}];return{workspace:r,createGraph:()=>l(e,a,r,{entryNode:i})}}buildEdges(){throw new Error("LoopWorkflow overrides generate(); buildEdges should not be called.")}getEntryNode(){return i}isTerminalAgent(){return!0}};c([g()],p.prototype,"workflow",2);c([g()],p.prototype,"decideContinue",2);p=c([u("LoopWorkflow")],p);var i="__loop_body";return p},"core/accessorSupport/decorators",a)
@@ -1,2 +1,2 @@
1
1
  /* COPYRIGHT Esri - https://js.arcgis.com/5.2/LICENSE.txt */
2
- import{d as b}from"./7M6VKBTK.js";import{Ya as G,a as E,b as y,ka as h}from"./EWLXNGKH.js";var x=new Set(["agentExecutionContext","outputMessage","summary","status"]);function O(r){let o=[...new Set([...r].filter(n=>x.has(n)))];if(o.length!==0)throw new Error(`custom state cannot define reserved runtime fields: ${o.join(", ")}.`)}function $(r){let o=Object.entries(r);return Object.fromEntries(o.map(([n,t])=>[n,h({reducer:(i,g)=>g,default:()=>t})]))}function S(r={}){O(Object.keys(r));let o=$(r);return h.Root({...o,agentExecutionContext:h({reducer:(n,t)=>({...n,...t}),default:b}),outputMessage:h({reducer:(n="",t)=>typeof t=="string"&&t.trim()?t:n,default:()=>""}),summary:h({reducer:(n="",t)=>typeof t=="string"?t:n,default:()=>""}),status:h({reducer:(n,t)=>t??n,default:()=>{}})})}function C(r){let o=new Set;for(let t of r)for(let i of Object.keys(t.shape??{}))o.add(i);let n=Object.fromEntries([...o].map(t=>[t,void 0]));return S(n)}function P(r,o,n,t={}){let{agent:i,entryNode:g,middlewares:c=[]}=t,s=new G(n);if(Object.keys(r).length===0)throw new Error("Graph requires at least one node.");if(o.length===0)throw new Error("Graph requires at least one edge.");if(c.length>0&&!i)throw new Error("Graph middleware requires agent metadata.");let a=new Set(Object.keys(r)),m=new Map,w=new Map;for(let e of a)m.set(e,0),w.set(e,0);for(let e of o)"to"in e?(a.has(e.from)&&w.set(e.from,(w.get(e.from)??0)+1),a.has(e.to)&&m.set(e.to,(m.get(e.to)??0)+1)):a.has(e.from)&&w.set(e.from,(w.get(e.from)??0)+1);for(let[e,f]of Object.entries(r)){let u=N(i,e,c,async(d,p)=>await Promise.resolve(f(d,p))),l=async(d,p)=>await u(d,p);s=s.addNode(e,l)}for(let e of o)if("to"in e){let f=e.from,u=e.to;if(!a.has(f))throw new Error(`Graph edge references unknown from-node: ${f}`);if(!a.has(u))throw new Error(`Graph edge references unknown to-node: ${u}`);s.addEdge(f,u)}else{let f=e.from;if(!a.has(f))throw new Error(`Graph conditional edge references unknown from-node: ${f}`);s.addConditionalEdges(f,async(u,l)=>{let d=await e.decide(u,l);if(!d)return y;if(!a.has(d))throw new Error(`Graph conditional edge returned unknown node: ${d}`);return d})}let k=v(a,m,g);s.addEdge(E,k);let j=[...a].filter(e=>(w.get(e)??0)===0);for(let e of j)s.addEdge(e,y);return s}function N(r,o,n,t){return!n.length||!r?t:async(i,g)=>await n.reduceRight((c,s)=>async a=>await s.handler(a,c),async c=>{let s=await t(c.state,c.config);return{...c.state,...s}})({agent:r,config:g,nodeName:o,state:i})}function v(r,o,n){if(n){if(!r.has(n))throw new Error(`Graph entry node references unknown node: ${n}`);return n}let t=[...r].filter(i=>(o.get(i)??0)===0);if(t.length!==1)throw new Error(`Graph could not infer a single entry node (found ${t.length}). Provide an explicit entryNode or ensure exactly one node has no incoming edges.`);return t[0]}export{O as a,$ as b,S as c,C as d,P as e};
2
+ import{d as b}from"./G2EGT3CF.js";import{Ya as G,a as E,b as y,ka as h}from"./EWLXNGKH.js";var x=new Set(["agentExecutionContext","outputMessage","summary","status"]);function O(r){let o=[...new Set([...r].filter(n=>x.has(n)))];if(o.length!==0)throw new Error(`custom state cannot define reserved runtime fields: ${o.join(", ")}.`)}function $(r){let o=Object.entries(r);return Object.fromEntries(o.map(([n,t])=>[n,h({reducer:(i,g)=>g,default:()=>t})]))}function S(r={}){O(Object.keys(r));let o=$(r);return h.Root({...o,agentExecutionContext:h({reducer:(n,t)=>({...n,...t}),default:b}),outputMessage:h({reducer:(n="",t)=>typeof t=="string"&&t.trim()?t:n,default:()=>""}),summary:h({reducer:(n="",t)=>typeof t=="string"?t:n,default:()=>""}),status:h({reducer:(n,t)=>t??n,default:()=>{}})})}function C(r){let o=new Set;for(let t of r)for(let i of Object.keys(t.shape??{}))o.add(i);let n=Object.fromEntries([...o].map(t=>[t,void 0]));return S(n)}function P(r,o,n,t={}){let{agent:i,entryNode:g,middlewares:c=[]}=t,s=new G(n);if(Object.keys(r).length===0)throw new Error("Graph requires at least one node.");if(o.length===0)throw new Error("Graph requires at least one edge.");if(c.length>0&&!i)throw new Error("Graph middleware requires agent metadata.");let a=new Set(Object.keys(r)),m=new Map,w=new Map;for(let e of a)m.set(e,0),w.set(e,0);for(let e of o)"to"in e?(a.has(e.from)&&w.set(e.from,(w.get(e.from)??0)+1),a.has(e.to)&&m.set(e.to,(m.get(e.to)??0)+1)):a.has(e.from)&&w.set(e.from,(w.get(e.from)??0)+1);for(let[e,f]of Object.entries(r)){let u=N(i,e,c,async(d,p)=>await Promise.resolve(f(d,p))),l=async(d,p)=>await u(d,p);s=s.addNode(e,l)}for(let e of o)if("to"in e){let f=e.from,u=e.to;if(!a.has(f))throw new Error(`Graph edge references unknown from-node: ${f}`);if(!a.has(u))throw new Error(`Graph edge references unknown to-node: ${u}`);s.addEdge(f,u)}else{let f=e.from;if(!a.has(f))throw new Error(`Graph conditional edge references unknown from-node: ${f}`);s.addConditionalEdges(f,async(u,l)=>{let d=await e.decide(u,l);if(!d)return y;if(!a.has(d))throw new Error(`Graph conditional edge returned unknown node: ${d}`);return d})}let k=v(a,m,g);s.addEdge(E,k);let j=[...a].filter(e=>(w.get(e)??0)===0);for(let e of j)s.addEdge(e,y);return s}function N(r,o,n,t){return!n.length||!r?t:async(i,g)=>await n.reduceRight((c,s)=>async a=>await s.handler(a,c),async c=>{let s=await t(c.state,c.config);return{...c.state,...s}})({agent:r,config:g,nodeName:o,state:i})}function v(r,o,n){if(n){if(!r.has(n))throw new Error(`Graph entry node references unknown node: ${n}`);return n}let t=[...r].filter(i=>(o.get(i)??0)===0);if(t.length!==1)throw new Error(`Graph could not infer a single entry node (found ${t.length}). Provide an explicit entryNode or ensure exactly one node has no incoming edges.`);return t[0]}export{O as a,$ as b,S as c,C as d,P as e};
@@ -1,2 +1,2 @@
1
1
  /* COPYRIGHT Esri - https://js.arcgis.com/5.2/LICENSE.txt */
2
- import w from"./FUZ77UGP.js";import v from"./HKSFWTWK.js";import t from"./LPR72QZF.js";import s from"./C5ZL5Z52.js";import r from"./SUYWKYWI.js";import q from"./SZ2QSSB3.js";import p from"./OYSPNIJI.js";import o from"./KITIP6J2.js";import"./Z5W4V7RC.js";import n from"./RHYNE5OE.js";import m from"./KWD2ECTM.js";import l from"./U2D53TAX.js";import k from"./OAKRPM7D.js";import j from"./V52XWEGV.js";import i from"./CCC6LBMY.js";import"./34O57OGV.js";import"./7SRLZQVC.js";import"./FDOMMK2M.js";import f from"./6HF36IKA.js";import"./Y7XD7ZRD.js";import"./VLLZ2FFU.js";import e from"./5ZFUGNRN.js";import"./LLUGJKAQ.js";import"./WKTQVBFJ.js";import"./K2R6XVK3.js";import d from"./6VJXUIXY.js";import c from"./AT4XVTJR.js";import{e as g,f as h}from"./7M6VKBTK.js";import"./5WYRJMBW.js";import"./YEZ3AMNX.js";import b from"./JKIESH74.js";import a from"./QNNGPA3Q.js";import"./ONQ6JSBJ.js";import"./R74ZHFA6.js";import{a as y,b as u}from"./7VAQUCBU.js";import"./VOKXKU7M.js";import"./EWLXNGKH.js";import"./AI6DYOKR.js";import"./VXFQANGJ.js";import"./MWYBF3F3.js";import"./UZLQALHY.js";export default $arcgis.t(([C,I,,,{d:w,g:v,h:A,i:b,j:S,k:d,l:f,m:M,n:E,o:P,p:T,q:x,r:D},{a:p,b:V},,,,,,,,,,,,W,R,O,L,k])=>{var U=async e=>{let a=e.allLayers.toArray(),o=[],r=new Map;for(let t of a)if(t instanceof C){let i=(async()=>{let n=await x(t),s=await D(t,n);r.set(t.id,{layerItem:s,fieldRegistry:n})})();o.push(i)}return await Promise.all(o),r},q=async e=>{await I.whenOnce(()=>e.ready);let a=await U(e.map),{layers:o}=await z(a),r={schemaVersion:v,modified:Date.now(),embeddings:{modelProvider:b,model:S,dimensions:A,templates:{layer:d,field:f}},layers:o},t=M.safeParse(r);if(!t.success)throw console.error("Schema Mismatch:",t.error.format()),new Error("Webmap embedding generation failed validation.");return t.data},z=async e=>{let a=[],o=[];for(let[i,{fieldRegistry:n,layerItem:s}]of e.entries()){let l=H(d,{name:s.name,title:s.title,description:s.description});a.push(l);let m={id:i,name:s.name??"",title:s.title,description:s.description,vector:[],fields:[]};for(let[,c]of n.entries()){let N=H(f,{name:c.name,alias:c.alias,description:c.description});a.push(N),m.fields.push({name:c.name,alias:c.alias,description:c.description,vector:[]})}o.push(m)}let r=await p(a),t=0;return{layers:o.map(i=>(i.vector=r[t++],i.fields.forEach(n=>{n.vector=r[t++]}),i))}},H=(e,a)=>e.replace(/\{(\w+)\}/gu,(o,r)=>a[r]??""),F=(e,a)=>{if(e.length!==a.length)throw new Error("Vectors must be the same length");let o=0,r=0,t=0;for(let s=0;s<e.length;++s){let l=e[s],m=a[s];o+=l*m,r+=l*l,t+=m*m}let i=Math.sqrt(r*t);if(i===0)return 0;let n=o/i;return Math.max(-1,Math.min(1,n))},ee=E,ae=P,te=T,se=y,re=p,oe=F,ie=O,ne=L,me=R,ce=W,le=k,de=q,fe=()=>g(),pe=()=>h(),ge=async(e,a)=>await u(e,a),he=async({modelTier:e="default",config:a}={})=>await w({modelTier:e,config:a});return{ArcgisKnowledgeAgent:le,DataExplorationAgent:me,HelpAgent:ce,LayerStylingAgent:ne,NavigationAgent:ie,Orchestrator:V,cosineSimilarity:oe,createAgentRuntimeState:fe,createAgentRuntimeStateWithSharedState:pe,createChatModel:he,createWebmapEmbeddings:de,getEmbeddings:re,invokeStructuredPrompt:ae,invokeTextPrompt:ee,invokeToolPrompt:te,sendTraceMessage:se,sendUXSuggestion:ge}},"layers/FeatureLayer","core/reactiveUtils",a,b,c,d,e,f,i,j,k,l,m,n,o,p,q,r,s,t,v,w)
2
+ import w from"./UAANWCMU.js";import v from"./ASR3I43T.js";import t from"./6KN5LUAV.js";import s from"./2OB6I4ZG.js";import r from"./LNCT4S4I.js";import q from"./SZ2QSSB3.js";import p from"./MX7OEO5Z.js";import o from"./KITIP6J2.js";import"./Z5W4V7RC.js";import n from"./RHYNE5OE.js";import m from"./KWD2ECTM.js";import l from"./U2D53TAX.js";import k from"./OAKRPM7D.js";import j from"./V52XWEGV.js";import i from"./CCC6LBMY.js";import"./34O57OGV.js";import"./7SRLZQVC.js";import"./FDOMMK2M.js";import f from"./6HF36IKA.js";import"./Y7XD7ZRD.js";import"./VLLZ2FFU.js";import e from"./5ZFUGNRN.js";import"./LLUGJKAQ.js";import"./WKTQVBFJ.js";import"./K2R6XVK3.js";import d from"./JCOA24UH.js";import c from"./D5UFYQHN.js";import{e as g,f as h}from"./G2EGT3CF.js";import"./5WYRJMBW.js";import"./YEZ3AMNX.js";import b from"./JKIESH74.js";import a from"./QNNGPA3Q.js";import"./ONQ6JSBJ.js";import"./R74ZHFA6.js";import{a as y,b as u}from"./7VAQUCBU.js";import"./VOKXKU7M.js";import"./EWLXNGKH.js";import"./AI6DYOKR.js";import"./VXFQANGJ.js";import"./MWYBF3F3.js";import"./UZLQALHY.js";export default $arcgis.t(([C,I,,,{d:w,g:v,h:A,i:b,j:S,k:d,l:f,m:M,n:E,o:P,p:T,q:x,r:D},{a:p,b:V},,,,,,,,,,,,W,R,O,L,k])=>{var U=async e=>{let a=e.allLayers.toArray(),o=[],r=new Map;for(let t of a)if(t instanceof C){let i=(async()=>{let n=await x(t),s=await D(t,n);r.set(t.id,{layerItem:s,fieldRegistry:n})})();o.push(i)}return await Promise.all(o),r},q=async e=>{await I.whenOnce(()=>e.ready);let a=await U(e.map),{layers:o}=await z(a),r={schemaVersion:v,modified:Date.now(),embeddings:{modelProvider:b,model:S,dimensions:A,templates:{layer:d,field:f}},layers:o},t=M.safeParse(r);if(!t.success)throw console.error("Schema Mismatch:",t.error.format()),new Error("Webmap embedding generation failed validation.");return t.data},z=async e=>{let a=[],o=[];for(let[i,{fieldRegistry:n,layerItem:s}]of e.entries()){let l=H(d,{name:s.name,title:s.title,description:s.description});a.push(l);let m={id:i,name:s.name??"",title:s.title,description:s.description,vector:[],fields:[]};for(let[,c]of n.entries()){let N=H(f,{name:c.name,alias:c.alias,description:c.description});a.push(N),m.fields.push({name:c.name,alias:c.alias,description:c.description,vector:[]})}o.push(m)}let r=await p(a),t=0;return{layers:o.map(i=>(i.vector=r[t++],i.fields.forEach(n=>{n.vector=r[t++]}),i))}},H=(e,a)=>e.replace(/\{(\w+)\}/gu,(o,r)=>a[r]??""),F=(e,a)=>{if(e.length!==a.length)throw new Error("Vectors must be the same length");let o=0,r=0,t=0;for(let s=0;s<e.length;++s){let l=e[s],m=a[s];o+=l*m,r+=l*l,t+=m*m}let i=Math.sqrt(r*t);if(i===0)return 0;let n=o/i;return Math.max(-1,Math.min(1,n))},ee=E,ae=P,te=T,se=y,re=p,oe=F,ie=O,ne=L,me=R,ce=W,le=k,de=q,fe=()=>g(),pe=()=>h(),ge=async(e,a)=>await u(e,a),he=async({modelTier:e="default",config:a}={})=>await w({modelTier:e,config:a});return{ArcgisKnowledgeAgent:le,DataExplorationAgent:me,HelpAgent:ce,LayerStylingAgent:ne,NavigationAgent:ie,Orchestrator:V,cosineSimilarity:oe,createAgentRuntimeState:fe,createAgentRuntimeStateWithSharedState:pe,createChatModel:he,createWebmapEmbeddings:de,getEmbeddings:re,invokeStructuredPrompt:ae,invokeTextPrompt:ee,invokeToolPrompt:te,sendTraceMessage:se,sendUXSuggestion:ge}},"layers/FeatureLayer","core/reactiveUtils",a,b,c,d,e,f,i,j,k,l,m,n,o,p,q,r,s,t,v,w)
@@ -1,2 +1,2 @@
1
1
  /* COPYRIGHT Esri - https://js.arcgis.com/5.2/LICENSE.txt */
2
- import n from"./FUZ77UGP.js";import m from"./OYSPNIJI.js";import{c as s,d as p}from"./V6HOUZPZ.js";import l from"./KITIP6J2.js";import"./Z5W4V7RC.js";import k from"./KWD2ECTM.js";import j from"./U2D53TAX.js";import i from"./OAKRPM7D.js";import h from"./V52XWEGV.js";import g from"./CCC6LBMY.js";import"./34O57OGV.js";import"./7SRLZQVC.js";import"./FDOMMK2M.js";import f from"./6HF36IKA.js";import"./Y7XD7ZRD.js";import"./VLLZ2FFU.js";import d from"./5ZFUGNRN.js";import"./LLUGJKAQ.js";import"./WKTQVBFJ.js";import"./K2R6XVK3.js";import"./3UEKINYC.js";import"./RLEHNAIA.js";import c from"./AT4XVTJR.js";import"./7M6VKBTK.js";import"./5WYRJMBW.js";import"./YEZ3AMNX.js";import b from"./JKIESH74.js";import a from"./QNNGPA3Q.js";import"./ONQ6JSBJ.js";import{v as e,z as o}from"./X3COUAXY.js";import"./R74ZHFA6.js";import"./7VAQUCBU.js";import"./VOKXKU7M.js";import"./EWLXNGKH.js";import"./AI6DYOKR.js";import"./VXFQANGJ.js";import"./MWYBF3F3.js";import"./UZLQALHY.js";export default $arcgis.t(([,,,,,,,,,{fetchKnowledgeGraph:n},,,,,,,,,,,,,m])=>{var r=class extends e{constructor(){super(...arguments),this.agent=m}static{this.properties={referenceElement:1,serviceUrl:3,context:0}}#i;#r;#t;#e;get serviceUrl(){return this.#r}set serviceUrl(t){this.#r=t}async getContext(){let t=this.context?{...this.context,knowledgeGraph:void 0,view:void 0}:{};if(this.#i)return{...t,view:this.#i};if(this.#t)try{let i=await this.#t;return{...t,knowledgeGraph:i}}catch(i){console.error("Failed to load knowledge graph via service URL:",i)}if(!this.context?.knowledgeGraph&&!this.context?.view)throw new Error("arcgis-assistant-knowledge-agent requires either a knowledgeGraph or view in context, and neither were provided");return this.context}willUpdate(t){t.has("serviceUrl")&&this.serviceUrl?this.#t=n(this.serviceUrl):this.#t=void 0}load(){this.#i=p(this)??void 0,this.#e=s(this)}disconnectedCallback(){this.#e?.unregister(this.agent.id),super.disconnectedCallback()}};o("arcgis-assistant-knowledge-agent",r);return r},"identity/IdentityManager","portal/Portal","request","config","core/reactiveUtils","layers/FeatureLayer","intl","smartMapping/statistics/summaryStatistics","smartMapping/statistics/uniqueValues","rest/knowledgeGraphService",a,b,c,d,f,g,h,i,j,k,l,m,n)
2
+ import n from"./UAANWCMU.js";import m from"./MX7OEO5Z.js";import{c as s,d as p}from"./V6HOUZPZ.js";import l from"./KITIP6J2.js";import"./Z5W4V7RC.js";import k from"./KWD2ECTM.js";import j from"./U2D53TAX.js";import i from"./OAKRPM7D.js";import h from"./V52XWEGV.js";import g from"./CCC6LBMY.js";import"./34O57OGV.js";import"./7SRLZQVC.js";import"./FDOMMK2M.js";import f from"./6HF36IKA.js";import"./Y7XD7ZRD.js";import"./VLLZ2FFU.js";import d from"./5ZFUGNRN.js";import"./LLUGJKAQ.js";import"./WKTQVBFJ.js";import"./K2R6XVK3.js";import"./3UEKINYC.js";import"./RLEHNAIA.js";import c from"./D5UFYQHN.js";import"./G2EGT3CF.js";import"./5WYRJMBW.js";import"./YEZ3AMNX.js";import b from"./JKIESH74.js";import a from"./QNNGPA3Q.js";import"./ONQ6JSBJ.js";import{v as e,z as o}from"./X3COUAXY.js";import"./R74ZHFA6.js";import"./7VAQUCBU.js";import"./VOKXKU7M.js";import"./EWLXNGKH.js";import"./AI6DYOKR.js";import"./VXFQANGJ.js";import"./MWYBF3F3.js";import"./UZLQALHY.js";export default $arcgis.t(([,,,,,,,,,{fetchKnowledgeGraph:n},,,,,,,,,,,,,m])=>{var r=class extends e{constructor(){super(...arguments),this.agent=m}static{this.properties={referenceElement:1,serviceUrl:3,context:0}}#i;#r;#t;#e;get serviceUrl(){return this.#r}set serviceUrl(t){this.#r=t}async getContext(){let t=this.context?{...this.context,knowledgeGraph:void 0,view:void 0}:{};if(this.#i)return{...t,view:this.#i};if(this.#t)try{let i=await this.#t;return{...t,knowledgeGraph:i}}catch(i){console.error("Failed to load knowledge graph via service URL:",i)}if(!this.context?.knowledgeGraph&&!this.context?.view)throw new Error("arcgis-assistant-knowledge-agent requires either a knowledgeGraph or view in context, and neither were provided");return this.context}willUpdate(t){t.has("serviceUrl")&&this.serviceUrl?this.#t=n(this.serviceUrl):this.#t=void 0}load(){this.#i=p(this)??void 0,this.#e=s(this)}disconnectedCallback(){this.#e?.unregister(this.agent.id),super.disconnectedCallback()}};o("arcgis-assistant-knowledge-agent",r);return r},"identity/IdentityManager","portal/Portal","request","config","core/reactiveUtils","layers/FeatureLayer","intl","smartMapping/statistics/summaryStatistics","smartMapping/statistics/uniqueValues","rest/knowledgeGraphService",a,b,c,d,f,g,h,i,j,k,l,m,n)
@@ -1,2 +1,2 @@
1
1
  /* COPYRIGHT Esri - https://js.arcgis.com/5.2/LICENSE.txt */
2
- import q from"./SUYWKYWI.js";import n from"./SZ2QSSB3.js";import m from"./OYSPNIJI.js";import{a as o,c as p}from"./V6HOUZPZ.js";import l from"./KITIP6J2.js";import"./Z5W4V7RC.js";import k from"./KWD2ECTM.js";import j from"./U2D53TAX.js";import h from"./OAKRPM7D.js";import g from"./V52XWEGV.js";import f from"./CCC6LBMY.js";import"./34O57OGV.js";import"./7SRLZQVC.js";import"./FDOMMK2M.js";import e from"./6HF36IKA.js";import"./Y7XD7ZRD.js";import"./VLLZ2FFU.js";import d from"./5ZFUGNRN.js";import"./LLUGJKAQ.js";import"./WKTQVBFJ.js";import"./K2R6XVK3.js";import"./3UEKINYC.js";import"./RLEHNAIA.js";import c from"./AT4XVTJR.js";import"./7M6VKBTK.js";import"./5WYRJMBW.js";import"./YEZ3AMNX.js";import b from"./JKIESH74.js";import a from"./QNNGPA3Q.js";import"./ONQ6JSBJ.js";import{v as i,z as r}from"./X3COUAXY.js";import"./R74ZHFA6.js";import"./7VAQUCBU.js";import"./VOKXKU7M.js";import"./EWLXNGKH.js";import"./AI6DYOKR.js";import"./VXFQANGJ.js";import"./MWYBF3F3.js";import"./UZLQALHY.js";export default $arcgis.t(([,,,,,,,,,,,,,,,,,,,,,,,m])=>{var t=class extends i{constructor(){super(...arguments),this.agent=m}static{this.properties={referenceElement:1}}#t;#i;getContext(){if(!this.#t)throw new Error("arcgis-assistant-help-agent requires a mapView");return{mapView:this.#t}}load(){this.#t=o(this,"arcgis-assistant-help-agent"),this.#i=p(this)}disconnectedCallback(){this.#i?.unregister(this.agent.id),super.disconnectedCallback()}};r("arcgis-assistant-help-agent",t);return t},"identity/IdentityManager","portal/Portal","request","config","core/reactiveUtils","layers/FeatureLayer","intl","smartMapping/statistics/summaryStatistics","smartMapping/statistics/uniqueValues","rest/knowledgeGraphService",a,b,c,d,e,f,g,h,j,k,l,m,n,q)
2
+ import q from"./LNCT4S4I.js";import n from"./SZ2QSSB3.js";import m from"./MX7OEO5Z.js";import{a as o,c as p}from"./V6HOUZPZ.js";import l from"./KITIP6J2.js";import"./Z5W4V7RC.js";import k from"./KWD2ECTM.js";import j from"./U2D53TAX.js";import h from"./OAKRPM7D.js";import g from"./V52XWEGV.js";import f from"./CCC6LBMY.js";import"./34O57OGV.js";import"./7SRLZQVC.js";import"./FDOMMK2M.js";import e from"./6HF36IKA.js";import"./Y7XD7ZRD.js";import"./VLLZ2FFU.js";import d from"./5ZFUGNRN.js";import"./LLUGJKAQ.js";import"./WKTQVBFJ.js";import"./K2R6XVK3.js";import"./3UEKINYC.js";import"./RLEHNAIA.js";import c from"./D5UFYQHN.js";import"./G2EGT3CF.js";import"./5WYRJMBW.js";import"./YEZ3AMNX.js";import b from"./JKIESH74.js";import a from"./QNNGPA3Q.js";import"./ONQ6JSBJ.js";import{v as i,z as r}from"./X3COUAXY.js";import"./R74ZHFA6.js";import"./7VAQUCBU.js";import"./VOKXKU7M.js";import"./EWLXNGKH.js";import"./AI6DYOKR.js";import"./VXFQANGJ.js";import"./MWYBF3F3.js";import"./UZLQALHY.js";export default $arcgis.t(([,,,,,,,,,,,,,,,,,,,,,,,m])=>{var t=class extends i{constructor(){super(...arguments),this.agent=m}static{this.properties={referenceElement:1}}#t;#i;getContext(){if(!this.#t)throw new Error("arcgis-assistant-help-agent requires a mapView");return{mapView:this.#t}}load(){this.#t=o(this,"arcgis-assistant-help-agent"),this.#i=p(this)}disconnectedCallback(){this.#i?.unregister(this.agent.id),super.disconnectedCallback()}};r("arcgis-assistant-help-agent",t);return t},"identity/IdentityManager","portal/Portal","request","config","core/reactiveUtils","layers/FeatureLayer","intl","smartMapping/statistics/summaryStatistics","smartMapping/statistics/uniqueValues","rest/knowledgeGraphService",a,b,c,d,e,f,g,h,j,k,l,m,n,q)
@@ -1,5 +1,5 @@
1
1
  /* COPYRIGHT Esri - https://js.arcgis.com/5.2/LICENSE.txt */
2
- import b from"./OYSPNIJI.js";import a from"./AT4XVTJR.js";import{a as c,b as k}from"./7VAQUCBU.js";import{Ya as x,a as w,b as d,j as f}from"./EWLXNGKH.js";import{ea as u}from"./AI6DYOKR.js";export default $arcgis.t(([,,,,,,{n:_,p:b},{A:M,B:T,C:E,D:C,E:G,F:N,G:R,a:v,c:m,d:h,e:A,w:y,x:K,y:q,z:S}])=>{var z=[T,E,N,C,M,R,G];async function $(e,a){let s=await m("arcgis_knowledge_tool_prompt"),o=K(a),n={assignedTask:e.agentExecutionContext.assignedTask,userRequest:e.agentExecutionContext.userRequest,priorSteps:e.agentExecutionContext.priorSteps,contextType:o},r=await b({promptText:s,messages:e.arcgisKnowledgeMessages,inputVariables:n,tools:z,config:a}),i=(r.tool_calls?.length??0)>0,t=typeof r.text=="string"?r.text.trim():"",l=t.length>0,p=r.content.toString();return!i&&(o==="map"||o==="knowledgeGraph")?{...e,arcgisKnowledgeMessages:[...e.arcgisKnowledgeMessages,r],outputMessage:o==="map"?"No tools were found for the current view and prompt. Maps do not support changing nonspatial visibility, layout changes, or generation from queries.":"No tools were found for the current prompt and knowledge graph service. A knowledge graph service only supports search and query.",status:"success"}:{...e,arcgisKnowledgeMessages:[...e.arcgisKnowledgeMessages,r],outputMessage:i?p:t,status:i?e.status:l?"success":"failed",summary:p?h(p):"ArcGIS Knowledge Agent tool executed."}}var L={generateCypher:"generated-cypher-query",queryGraphData:"graph-query-result",searchGraphData:"graph-search-result",addRecords:"added-records",applyLayout:"applied-layout",changeNonspatialVisibility:"changed-nonspatial-visibility",createLinkChart:"created-link-chart"};function I(e){return!!e&&e.status==="success"&&!!L[e.toolName]}function D(e){return{type:L[e.toolName],data:e.details}}async function F(e,a){let s=new v(z,{handleToolErrors:!1});try{let o=await s.invoke({messages:e.arcgisKnowledgeMessages},a),n=[];for(let t of o.messages){let l;if(typeof t.content!="string")throw new Error(`Unexpected tool message content type: ${typeof t.content}. Expected string.`);try{l=JSON.parse(t.content)}catch{throw new Error(`Failed to parse tool message content as JSON. Tool: ${t.name??"unknown"}.
2
+ import b from"./MX7OEO5Z.js";import a from"./D5UFYQHN.js";import{a as c,b as k}from"./7VAQUCBU.js";import{Ya as x,a as w,b as d,j as f}from"./EWLXNGKH.js";import{ea as u}from"./AI6DYOKR.js";export default $arcgis.t(([,,,,,,{n:_,p:b},{A:M,B:T,C:E,D:C,E:G,F:N,G:R,a:v,c:m,d:h,e:A,w:y,x:K,y:q,z:S}])=>{var z=[T,E,N,C,M,R,G];async function $(e,a){let s=await m("arcgis_knowledge_tool_prompt"),o=K(a),n={assignedTask:e.agentExecutionContext.assignedTask,userRequest:e.agentExecutionContext.userRequest,priorSteps:e.agentExecutionContext.priorSteps,contextType:o},r=await b({promptText:s,messages:e.arcgisKnowledgeMessages,inputVariables:n,tools:z,config:a}),i=(r.tool_calls?.length??0)>0,t=typeof r.text=="string"?r.text.trim():"",l=t.length>0,p=r.content.toString();return!i&&(o==="map"||o==="knowledgeGraph")?{...e,arcgisKnowledgeMessages:[...e.arcgisKnowledgeMessages,r],outputMessage:o==="map"?"No tools were found for the current view and prompt. Maps do not support changing nonspatial visibility, layout changes, or generation from queries.":"No tools were found for the current prompt and knowledge graph service. A knowledge graph service only supports search and query.",status:"success"}:{...e,arcgisKnowledgeMessages:[...e.arcgisKnowledgeMessages,r],outputMessage:i?p:t,status:i?e.status:l?"success":"failed",summary:p?h(p):"ArcGIS Knowledge Agent tool executed."}}var L={generateCypher:"generated-cypher-query",queryGraphData:"graph-query-result",searchGraphData:"graph-search-result",addRecords:"added-records",applyLayout:"applied-layout",changeNonspatialVisibility:"changed-nonspatial-visibility",createLinkChart:"created-link-chart"};function I(e){return!!e&&e.status==="success"&&!!L[e.toolName]}function D(e){return{type:L[e.toolName],data:e.details}}async function F(e,a){let s=new v(z,{handleToolErrors:!1});try{let o=await s.invoke({messages:e.arcgisKnowledgeMessages},a),n=[];for(let t of o.messages){let l;if(typeof t.content!="string")throw new Error(`Unexpected tool message content type: ${typeof t.content}. Expected string.`);try{l=JSON.parse(t.content)}catch{throw new Error(`Failed to parse tool message content as JSON. Tool: ${t.name??"unknown"}.
3
3
 
4
4
  Original Content: ${t.content}`)}if(!l||typeof l!="object"||!("toolName"in l))throw new Error(`Parsed tool message content does not have expected structure. Parsed content: ${JSON.stringify(l)}`);n.push(l)}await c({text:`Finished executing ArcGIS Knowledge Agent tools: ${o.messages.filter(t=>t.name).map(t=>t.name).join(", ")}`},a);let r=n.filter(t=>typeof t!="string").map(t=>`- Called Tool: ${t.toolName}, Status: ${t.status}`),i=n[0];return i&&I(i)&&await k(D(i),a),{...e,outputMessage:r.join(`
5
5
  `),summary:r.length?h(r.join(`
@@ -0,0 +1,3 @@
1
+ /* COPYRIGHT Esri - https://js.arcgis.com/5.2/LICENSE.txt */
2
+ import b from"./JCOA24UH.js";import{a as I}from"./5FL5BTTX.js";import{a as $}from"./434TAA3J.js";import{b as D}from"./V6F3HEK7.js";import{a as M}from"./3UEKINYC.js";import"./RLEHNAIA.js";import a from"./D5UFYQHN.js";import"./G2EGT3CF.js";import{g as C,h,k as A,l as P,n as g,t as v,u as f,v as T,x as y,z as L}from"./X3COUAXY.js";import"./R74ZHFA6.js";import"./7VAQUCBU.js";import"./VOKXKU7M.js";import"./EWLXNGKH.js";import"./AI6DYOKR.js";import"./VXFQANGJ.js";import"./MWYBF3F3.js";import"./UZLQALHY.js";export default $arcgis.t(([B,{whenOnce:q,watch:V,when:j},F,,N,,,H,{property:b,subclass:W},,{b:R}])=>{var G=C`:host{display:block;width:var(--arcgis-internal-panel-width, 100%);height:var(--arcgis-internal-expand-max-height, 100%);--calcite-panel-content-bottom-space: 0}.footer-container{display:flex;flex-direction:column;flex:1 1 0;gap:var(--calcite-spacing-md)}.content-container{display:flex;flex-direction:column;flex:1 1 0;min-height:0;position:relative;overflow:auto}.suggested-prompts-container{display:flex;justify-content:center;width:100%;background:var(--calcite-panel-background-color, var(--calcite-color-background))}.suggested-prompts{display:block;padding:var(--calcite-spacing-md);max-width:100%;box-sizing:border-box}.error-notice{padding:var(--calcite-spacing-sm)}.interrupt-waiting-message{font-style:italic;color:var(--calcite-color-text-2)}`;function x(o){return o.trim()?I.lexer(o).filter(t=>t.type!=="space").map(t=>I.parser([t])):[]}var w=class{constructor(){this._stableParts=[],this._stableText="",this._rawText=""}push(t){return this._rawText+=t,this._advanceStableBoundary(),this.getParts()}finalize(){let t=this._rawText.slice(this._stableText.length);return t.trim()&&(this._stableParts.push(...x(t)),this._stableText=this._rawText),this._stableParts}getParts(){let t=this._trimIncompleteTail(this._rawText.slice(this._stableText.length)),e=t.trim()?x(t):[];return[...this._stableParts,...e]}reset(){this._stableParts=[],this._stableText="",this._rawText=""}_advanceStableBoundary(){let t=this._rawText.slice(this._stableText.length),e=this._lastSafeBoundary(t);if(e<=0)return;let i=t.slice(0,e);this._stableParts.push(...x(i)),this._stableText+=i}_lastSafeBoundary(t){let e=t.split(`
3
+ `),i=!1,r=0,s=0;for(let l of e)/^\s*(```|~~~)/u.test(l)&&(i=!i),s+=l.length+1,l.trim()===""&&!i&&(r=s);return r<t.length?r:0}_trimIncompleteTail(t){let e=t.lastIndexOf("<");if(e!==-1&&!t.includes(">",e))return t.slice(0,e);let i=this._earliestUnclosedTag(t);if(i!==-1)return t.slice(0,i);let r=t.lastIndexOf("[");if(r!==-1){let s=t.slice(r);if(!/\[[^\]]*\]\([^)]*\)/u.test(s))return t.slice(0,r)}return t}_earliestUnclosedTag(t){let e=new Set(["br","img","hr","input","meta","link","area","base","col","embed","source","track","wbr"]),i=/<(\/?)([a-zA-Z][\w-]*)\b[^>]*?(\/?)>/gu,r=[];for(let s=i.exec(t);s;s=i.exec(t)){let[,l,a,n]=s,c=a.toLowerCase();if(!(e.has(c)||n==="/"))if(l==="/"){for(let d=r.length-1;d>=0;d--)if(r[d].name===c){r.splice(d);break}}else r.push({name:c,index:s.index})}return r.length?r[0].index:-1}};function Z(o){let t=new w;return t.push(o),t.finalize()}var J=async o=>await new Promise(t=>setTimeout(t,o));async function*K(o,{chunkSize:t=15,delay:e=50}={}){let i=new w;for(let r=0;r<o.length;r+=t)yield i.push(o.slice(r,r+t)),await J(e);yield i.finalize()}var Q=Object.defineProperty,X=Object.getOwnPropertyDescriptor,m=(o,t,e,i)=>{for(var r=i>1?void 0:i?X(t,e):t,s=o.length-1,l;s>=0;s--)(l=o[s])&&(r=(i?l(t,e,r):l(r))||r);return i&&r&&Q(t,e,r),r},U=o=>!o||typeof o!="object"?!1:o.name==="AbortError";async function*O(o,t,e,i,r=!1){if(r){if(i?.aborted){yield{type:"cancelled",log:e,runId:t};return}yield{type:"block-data",blockType:"text",data:{parts:Z(o)},runId:t};return}for await(let s of K(o)){if(i?.aborted){yield{type:"cancelled",log:e,runId:t};return}yield{type:"block-data",blockType:"text",data:{parts:s},runId:t}}}var p=class extends H{constructor(o){super(o),this.view=null,this.streamingDisabled=!1,this.runtimeEventsEnabled=!1,this.loading=!1,this.processing=!1,this.processingStep=""}async load(){this._set("loading",!0);try{await this._initialize()}finally{this._set("loading",!1)}}destroy(){this.orchestrator?.dispose(),super.destroy()}async _initialize(){this.removeHandles(),await Promise.all([this.portal.load(),this.view?.when()]),this.view&&await q(()=>!this.view.updating),this._set("orchestrator",await R.init({agents:[...this.agents],runtimeEventsEnabled:this.runtimeEventsEnabled,view:this.view??void 0})),this.addHandles([V(()=>[this.view,this.agents],()=>{this._initialize()})])}clearChatHistory(){this.orchestrator?.newConversation()}async*ask(o,t,e){if(!this.orchestrator)throw new Error("Orchestrator not initialized yet.");this._set("processing",!0),this._set("processingStep","");let i=[],r,s="pending";try{let l=this.orchestrator.ask(o,t);for await(let a of l)switch(s=a.runId,a.type){case"runtime":{yield{type:"runtime",event:a,runId:s};break}case"trace":{this._set("processingStep",a.data.text),i.push(a.data.text);break}case"completed":{this._set("processing",!1),this._set("processingStep","");let n=a.result,c=!!n.content.length,d=!!r?.length;if(!c&&!d){yield{type:"completed",error:"No response received.",log:i,runId:s};return}let u=n.content;if(yield{type:"block-start",blockType:"text",runId:s},yield*O(u,s,i,e,this.streamingDisabled),yield{type:"block-end",blockType:"text",runId:s},d)for(let k of r){if(e?.aborted){yield{type:"cancelled",log:i,runId:s};return}let{type:_,data:E}=k;if(yield{type:"block-start",blockType:_,runId:s},_==="text"){let z=typeof E?.content=="string"?E.content:"";yield*O(z,s,i,e,this.streamingDisabled)}else yield{type:"block-data",blockType:_,data:E,runId:s};yield{type:"block-end",blockType:_,runId:s}}yield{type:"completed",response:u,blocks:r,log:i,runId:s};return}case"ux-suggestion":{let n=a.suggestion;r=r?[...r,n]:[n];break}case"interrupt":{let{kind:n,message:c,metadata:d}=a.interrupt,u=Array.isArray(d)?d.filter(_=>typeof _=="string"):[],k=(()=>{switch(n){case"booleanChoice":return{type:"boolean-choice",message:c,options:u};case"singleSelection":return{type:"single-select",message:c,options:u};case"multipleSelection":return{type:"multi-select",message:c,options:u};case"textInput":return{type:"text-input",message:c};default:return{type:n,message:c,options:u}}})();this._set("processingStep","Waiting for user input..."),yield{type:"interrupt",payload:k,runId:s};break}case"cancelled":{yield{type:"cancelled",log:i,runId:s};return}case"error":{if(e?.aborted||U(a.error)){yield{type:"cancelled",log:i,runId:s};return}yield{type:"completed",error:a.error.message,log:i,runId:s};return}default:{console.warn("Unknown event type:",a);break}}}catch(l){if(e?.aborted||U(l)){yield{type:"cancelled",log:i,runId:s};return}console.warn("Error during message processing:",l),yield{type:"completed",error:"An error occurred during message processing.",log:i,runId:"error"};return}finally{this._set("processing",!1)}}cancel(){this.orchestrator?.cancel()}};m([b({readOnly:!0})],p.prototype,"orchestrator",2);m([b()],p.prototype,"agents",2);m([b()],p.prototype,"portal",2);m([b()],p.prototype,"view",2);m([b()],p.prototype,"streamingDisabled",2);m([b()],p.prototype,"runtimeEventsEnabled",2);m([b({readOnly:!0})],p.prototype,"loading",2);m([b({readOnly:!0})],p.prototype,"processing",2);m([b({readOnly:!0})],p.prototype,"processingStep",2);p=m([W("OrchestratorController")],p);var Y="Embeddings resource 'embeddings-v01.json' not found in the webmap portal item.",tt="Embeddings not found for this web map.",et="https://developers.arcgis.com/javascript/latest/agentic-apps/ai-webmap-setup/#embeddings",S=class extends T{constructor(){super(...arguments),this._messages=D({blocking:!0}),this.#t=v(),this.#o=v(),this.#s=v(),this.#e=null,this.#r=new Map,this.#i=F.getDefault(),this.#a=t=>{t.stopPropagation(),this.cancelInterrupt()},this.#n=t=>{t.stopPropagation();let e=t.detail;this.submitInterrupt(e)},this.#l=t=>{t.stopPropagation(),this.keepSuggestedPrompts||(this.suggestedPrompts=[]);let e=t.detail;this._inputValue="",this.arcgisSubmit.emit(e),this.submitMessage(e)},this.#c=t=>{if(this._canceling=!0,t.stopPropagation(),this.arcgisCancel.emit(),this._interrupt){this.orchestrator?.cancelInterrupt(),this._interrupt=null;return}this._orchestratorController?.cancel(),this.#e?.abort(),this.#e=null},this.#h=t=>{t.stopPropagation();let e=t.detail;this.arcgisFeedback.emit(e)},this.#d=t=>{t.stopPropagation();let e=t.detail;this._inputValue=e.prompt,this.arcgisPromptSelect.emit(e)},this.#u=t=>{this.arcgisSlottableRequest.emit(t.detail)},this._orchestratorController=null,this._interrupt=null,this._interruptDetails=[],this._error=null,this._inputValue="",this._isAnswering=!1,this._canceling=!1,this.messages=new B([]),this.referenceElement=null,this.suggestedPrompts=[],this.feedbackEnabled=!1,this.keepSuggestedPrompts=!1,this.streamingDisabled=!1,this.runtimeEventsEnabled=!1,this.logEnabled=!1,this.copyEnabled=!1,this.voiceInputEnabled=!1,this.readAloudEnabled=!1,this.assistantAvatarEnabled=!1,this.userAvatarEnabled=!1,this.arcgisCancel=g(),this.arcgisError=g(),this.arcgisFeedback=g(),this.arcgisInterrupt=g(),this.arcgisInterruptCancel=g(),this.arcgisInterruptSubmit=g(),this.arcgisPromptSelect=g(),this.arcgisReady=g(),this.arcgisResponse=g(),this.arcgisRuntime=g({bubbles:!1,composed:!1}),this.arcgisSlottableRequest=g({bubbles:!1,composed:!1}),this.arcgisSubmit=g()}static{this.properties={_orchestratorController:16,_interrupt:16,_interruptDetails:16,_error:16,_inputValue:16,_isAnswering:16,_signedInUserId:16,_canceling:16,_isSignedIn:16,_user:16,awaitingResponse:32,awaitingResponseStep:32,interrupt:32,messages:0,orchestrator:32,entryMessage:1,heading:1,description:1,referenceElement:1,alwaysUseAgentId:1,allowedAgentIds:0,suggestedPrompts:0,feedbackEnabled:5,keepSuggestedPrompts:5,streamingDisabled:5,runtimeEventsEnabled:5,logEnabled:5,copyEnabled:5,voiceInputEnabled:5,readAloudEnabled:5,assistantAvatarEnabled:5,userAvatarEnabled:5}}static{this.styles=G}#t;#o;#s;#e;#r;#i;#a;#n;#l;#c;#h;#d;#u;get _isSignedIn(){return!!this.#i?.user||!!this._signedInUserId}get _user(){return this.#i?.user?.fullName||this.#i?.user?.username}get awaitingResponse(){return this._orchestratorController?.processing??!1}get awaitingResponseStep(){return this._orchestratorController?.processingStep??""}get interrupt(){return this._interrupt}get orchestrator(){return this._orchestratorController?.orchestrator}cancelInterrupt(){this.arcgisInterruptCancel.emit(),this.orchestrator?.cancelInterrupt(),this._interrupt=null}async clearChatHistory(){this._reset(),this._orchestratorController?.clearChatHistory()}register(t){this.#r.set(t.agent.id,t),this._orchestratorController&&this.#g()}submitInterrupt(t){this.arcgisInterruptSubmit.emit(t),this._interrupt&&(this._interruptDetails=[...this._interruptDetails,{interrupt:this._interrupt,response:t}]),this.orchestrator?.resumeInterrupt(t),this._interrupt=null}async submitMessage(t){let e=t.trim();if(!e||(this.messages.push({id:Date.now().toString(),role:"user",content:e}),!this._orchestratorController))return;this.#e=new AbortController,this._orchestratorController.streamingDisabled=this.streamingDisabled;let i=this.alwaysUseAgentId?{routing:"direct",agentId:this.alwaysUseAgentId}:{routing:"auto",agentIds:this.allowedAgentIds},r=this._orchestratorController.ask(e,i,this.#e?.signal);for await(let s of r){let l=s.runId,a=this.messages.at(-1);switch(s.type){case"runtime":this.arcgisRuntime.emit(s.event);break;case"block-start":{this._isAnswering=!0;let n={type:s.blockType,isPending:!0};if(a?.role==="assistant"&&a.id===l){let c=[...a.blocks??[],n];this.messages.splice(-1,1,{...a,blocks:c})}else this.messages.push({role:"assistant",blocks:[n],id:l,isStreaming:!0,interrupts:this._interruptDetails}),this._interruptDetails=[];break}case"block-data":{if(a?.role!=="assistant"||a?.id!==l)break;let n=[...a.blocks??[]],c=n[n.length-1],{blockType:d,data:u}=s;if(c?.type!==d||!c.isPending)break;d==="text"?n[n.length-1]={...c,data:{...c.data,parts:u?.parts}}:n[n.length-1]={...c,data:{...c.data,...u??{}}},this.messages.splice(-1,1,{...a,blocks:n});break}case"block-end":{if(a?.role!=="assistant"||a?.id!==l)break;let n=[...a.blocks??[]],c=n[n.length-1];if(c?.type!==s.blockType||!c.isPending)break;let d=c;n[n.length-1]={...d,data:{...d.data},isPending:!1},this.messages.splice(-1,1,{...a,blocks:n});break}case"completed":s.error?(this.messages.push({role:"assistant",log:s.log,error:s.error,id:l,interrupts:this._interruptDetails}),this._interruptDetails=[]):a?.role==="assistant"&&a.id===l&&this.messages.splice(-1,1,{...a,content:s.response,blocks:a.blocks?.map(n=>({...n,data:{...n.data},isPending:!1}))??[],isStreaming:!1,log:s.log}),this._isAnswering=!1,this.#e=null,this._canceling=!1;break;case"interrupt":this._interrupt={...s.payload,id:l},this.arcgisInterrupt.emit(this._interrupt);break;case"cancelled":a?.role==="assistant"&&a.id===l?this.messages.splice(-1,1,{...a,blocks:a.blocks?.filter(n=>n.type==="text"||!n.isPending)??[],isStreaming:!1,log:s.log,error:`(${this._messages.stoppedByUserLabel})`}):(this.messages.push({role:"assistant",log:s.log,error:`(${this._messages.stoppedByUserLabel})`,id:l,interrupts:this._interruptDetails}),this._interruptDetails=[]),this._isAnswering=!1,this.#e=null,this._canceling=!1;break}}}unregister(t){this.#r.delete(t),this._orchestratorController&&this.#g()}load(){this.manager.onLifecycle(this._reset.bind(this))}loaded(){this.manager.onLifecycle(()=>{this.#t.value?.addEventListener("arcgisPromptSelect",this.#d),this.#t.value?.addEventListener("arcgisSubmit",this.#l),this.#t.value?.addEventListener("arcgisCancel",this.#c),this.#t.value?.addEventListener("arcgisFeedback",this.#h);let t=j(()=>!!this._interrupt&&!!this.#s.value,()=>{let i=this.#s.value;i.removeEventListener("arcgisSubmit",this.#n),i.removeEventListener("arcgisCancel",this.#a),i.addEventListener("arcgisSubmit",this.#n,{once:!0}),i.addEventListener("arcgisCancel",this.#a,{once:!0})}),e=this.messages.on("after-add",i=>{let r=i.item;r.role==="assistant"&&(r.error||r.content)&&this.arcgisResponse.emit(r)});return queueMicrotask(()=>{this.#p()}),()=>{t.remove(),e.remove(),this.#t.value?.removeEventListener("arcgisPromptSelect",this.#d),this.#s.value?.removeEventListener("arcgisSubmit",this.#n),this.#s.value?.removeEventListener("arcgisCancel",this.#a),this.#t.value?.removeEventListener("arcgisSubmit",this.#l),this.#t.value?.removeEventListener("arcgisCancel",this.#c),this.#t.value?.removeEventListener("arcgisFeedback",this.#h),this._orchestratorController?.destroy(),this._orchestratorController=null}})}willUpdate(t){this.hasUpdated&&t.has("runtimeEventsEnabled")&&this._orchestratorController&&(this._orchestratorController.destroy(),this._orchestratorController=null,this.#p())}async#g(){try{this._error=null;let t=M(this.el,this.referenceElement);await t?.componentOnReady();let e=[...this.#r.values()];return e.length?(this._orchestratorController?.destroy(),this._orchestratorController=new p({agents:e,portal:this.#i,runtimeEventsEnabled:this.runtimeEventsEnabled,streamingDisabled:this.streamingDisabled,view:t?.view}),await this._orchestratorController.load(),this.requestUpdate(),!0):(this._error=this._messages.noAgentsFoundMessage,!1)}catch(t){return this._error=t?.message??this._messages.orchestratorInitializationErrorMessage,P(this)(t),!1}}async#p(){await this.#g()?this.arcgisReady.emit():this._error&&this.arcgisError.emit(new Error(this._error))}_reset(){this._orchestratorController?.cancel(),this.#e?.abort(),this._interrupt=null,this.messages.removeAll(),this._error=null,this._inputValue="",this._signedInUserId=void 0}_renderEntryMessage(){return this._isSignedIn?this._error?this._renderErrorNotice():this.entryMessage?this.messages.length>0?null:h`<calcite-notice open kind=brand closable icon width=full><div slot=message>${this.entryMessage}</div></calcite-notice>`:h`<slot name=entry-message></slot>`:this._renderSignInNotice()}_renderSignInNotice(){let t=this.#i;return h`<calcite-notice slot=entry-message open kind=brand icon width=full><div slot=message>${this._messages.signInRequiredMessage}</div>${t?h`<calcite-link slot=link @click=${async()=>{try{let e=await N.getCredential(`${t.url}/sharing`);this._signedInUserId=e.userId,this._error=null,this.requestUpdate(),await this.#p()}catch(e){this._error=e?.message??this._messages.signInErrorMessage,this.arcgisError.emit(new Error(this._error)),A("error",this,"Error signing in:",{detail:{error:e}})}}} target=_blank title=${this._messages.signInToArcGISOnlineLabel??y}>${this._messages.signInLabel}</calcite-link>`:h`<div slot=link>${this._messages.noPortalInformationMessage}</div>`}</calcite-notice>`}_renderErrorNotice(){return this._error?h`<calcite-notice slot=entry-message open kind=brand icon width=full>${this._error===Y?h`<div slot=message>${tt}</div><calcite-link slot=link .href=${et} target=_blank title=${this._messages.learnAboutWebMapEmbeddingsLabel??y}>${this._messages.readMoreLabel}</calcite-link>`:h`<div slot=message>${this._error}</div>`}</calcite-notice>`:null}render(){return h`<calcite-panel .loading=${!this._orchestratorController&&!this._error||this._orchestratorController?.loading} .heading=${this.heading??this._messages.assistantLabel} .description=${this.description} ${f(this.#t)}><slot name=header-actions-start slot=header-actions-start></slot><slot name=header-actions-end slot=header-actions-end></slot><div class="content-container"><arcgis-assistant-chat .loading=${this.awaitingResponse} .messages=${this.messages} .interrupt=${this._interrupt}><slot name=message-starter slot=message-starter></slot><slot name=messages slot=messages>${this.messages.map(t=>t.role==="assistant"?h`<arcgis-assistant-message .message=${t} .feedbackEnabled=${this.feedbackEnabled} .logEnabled=${this.logEnabled} .copyEnabled=${this.copyEnabled} .readAloudEnabled=${this.readAloudEnabled} @arcgisSlottableRequest=${this.#u} .assistantAvatarEnabled=${this.assistantAvatarEnabled}>${t.blocks?.map((e,i)=>h`<slot name=${$(t.id,i)??y} slot=${$(t.id,i)??y}><arcgis-assistant-message-block .block=${e}></arcgis-assistant-message-block></slot>`)}</arcgis-assistant-message>`:h`<arcgis-assistant-user-message .message=${t} .user=${this._user} .userAvatarEnabled=${this.userAvatarEnabled}></arcgis-assistant-user-message>`)}</slot>${this._interrupt?h`<div slot=message-loading><div class="interrupt-waiting-message">${this._messages.waitingForUserInputMessage}</div></div>`:h`<slot name=message-loading slot=message-loading><arcgis-assistant-message-loading .loading=${this.awaitingResponse} .loadingMessage=${this.awaitingResponseStep} .assistantAvatarEnabled=${this.assistantAvatarEnabled} .interrupts=${this._interruptDetails}></arcgis-assistant-message-loading></slot>`}</arcgis-assistant-chat></div>${this._interrupt?h`<slot name=interrupt><arcgis-assistant-interrupt slot=content-bottom .type=${this._interrupt.type} .message=${this._interrupt.message} .options=${this._interrupt.options} ${f(this.#s)}></arcgis-assistant-interrupt></slot>`:this.suggestedPrompts?.length?h`<div class="suggested-prompts-container" slot=content-bottom><arcgis-assistant-suggested-prompts class="suggested-prompts" .prompts=${this.suggestedPrompts}></arcgis-assistant-suggested-prompts></div>`:null}<div class="footer-container" slot=footer>${this._renderEntryMessage()}<slot name=chat-entry><arcgis-assistant-chat-entry .awaitingResponse=${this.awaitingResponse||this._isAnswering} .inputValue=${this._inputValue} .messages=${this.messages} .voiceInputEnabled=${this.voiceInputEnabled} .disabled=${this._canceling||!this._isSignedIn||!!this._interrupt||!!this._error} ${f(this.#o)}><slot name=entry-actions-start slot=entry-actions-start></slot><slot name=entry-actions-end slot=entry-actions-end><calcite-button .iconStart=${this.awaitingResponse||this._isAnswering?"circle-stop":"send"} @click=${()=>{this.#o.value?.submitMessage()}} round>${this.awaitingResponse||this._isAnswering?this._messages.stopButtonLabel:this._messages.askButtonLabel}</calcite-button></slot></arcgis-assistant-chat-entry></slot><slot name=footer-content></slot></div></calcite-panel>`}};L("arcgis-assistant",S);return S},"core/Collection","core/reactiveUtils","portal/Portal","request","identity/IdentityManager","config","layers/FeatureLayer","core/Accessor","core/accessorSupport/decorators",a,b)