@arcgis/ai-components 5.2.0-next.13 → 5.2.0-next.14
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.
- package/dist/cdn/{LREQ3XAW.js → 22IT5TDB.js} +2 -2
- package/dist/cdn/7PANDHIL.js +16 -0
- package/dist/cdn/{KWTJAVWV.js → GBYLKQIL.js} +1 -1
- package/dist/cdn/{55R6J3FL.js → I2Y67HBL.js} +1 -1
- package/dist/cdn/JG2BIENI.js +3 -0
- package/dist/cdn/{ET453NAD.js → L4XF4H6V.js} +1 -1
- package/dist/cdn/{SRSFESAD.js → QYR3NSF2.js} +3 -3
- package/dist/cdn/{CFVVQXPJ.js → S75VFYR4.js} +5 -5
- package/dist/cdn/{X2ZDYHCG.js → TNMXWUXU.js} +9 -4
- package/dist/cdn/{DSVMXDPZ.js → XU6NCSE2.js} +1 -1
- package/dist/cdn/agent-utils/index.js +1 -1
- package/dist/cdn/index.js +1 -1
- package/dist/chunks/adapter.js +1 -1
- package/dist/chunks/arcgisKnowledgeGraph.js +5 -5
- package/dist/chunks/dataExplorationGraph.js +85 -74
- package/dist/chunks/data_explore_query_prompt.js +9 -4
- package/dist/chunks/generateLayerDescriptions.js +106 -106
- package/dist/chunks/orchestrator.js +63 -63
- package/dist/components/arcgis-assistant/customElement.js +123 -117
- package/dist/docs/api.json +1 -1
- package/dist/docs/docs.json +1 -1
- package/dist/docs/web-types.json +1 -1
- package/package.json +5 -5
- package/dist/cdn/MRLTR3UO.js +0 -16
- package/dist/cdn/SWBER53G.js +0 -3
|
@@ -1,9 +1,9 @@
|
|
|
1
1
|
/* COPYRIGHT Esri - https://js.arcgis.com/5.2/LICENSE.txt */
|
|
2
|
-
import e from"./
|
|
2
|
+
import e from"./QYR3NSF2.js";import a from"./S75VFYR4.js";import{c as K,d as E}from"./RUURNLTP.js";import"./5W7S2RS4.js";import"./NXKKG5TK.js";import{v as y,z as f}from"./MAV3DW27.js";import"./ADYIXCSG.js";import{a as c,b}from"./P7DG5T3Z.js";import"./BX7FSMUU.js";import{a as x,b as d,j as k,ta as _}from"./DHKUXLU3.js";import{Z as v}from"./CHPQM77M.js";import"./WNS5ZUF5.js";import"./ZEYIBYSF.js";import"./YIMNOUTF.js";export default $arcgis.t(([,,,,,,,,,,,,,,,{fetchKnowledgeGraph:B},{j:A,l:q},{K:u,L:C,M:G,N:T,O:N,P:R,Q:L,R:$,S:z,T:F,U:D,a:S,m:g,n:h,p:M}])=>{var I=[R,L,F,$,N,D,z];async function O(e,a){let r=await g("arcgis_knowledge_tool_prompt"),o=C(a),s={assignedTask:e.agentExecutionContext.assignedTask,userRequest:e.agentExecutionContext.userRequest,priorSteps:e.agentExecutionContext.priorSteps,contextType:o},n=await q({promptText:r,messages:e.arcgisKnowledgeMessages,inputVariables:s,tools:I}),i=(n.tool_calls?.length??0)>0,t=typeof n.text=="string"?n.text.trim():"",l=t.length>0,p=n.content.toString();return!i&&(o==="map"||o==="knowledgeGraph")?{...e,arcgisKnowledgeMessages:[...e.arcgisKnowledgeMessages,n],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,n],outputMessage:i?p:t,status:i?e.status:l?"success":"failed",summary:p?h(p):"ArcGIS Knowledge Agent tool executed."}}var U={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 V(e){return!!e&&e.status==="success"&&!!U[e.toolName]}function J(e){return{type:U[e.toolName],data:e.details}}async function P(e,a){let r=new S(I,{handleToolErrors:!1});try{let o=await r.invoke({messages:e.arcgisKnowledgeMessages},a),s=[];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)}`);s.push(l)}await c({text:`Finished executing ArcGIS Knowledge Agent tools: ${o.messages.filter(t=>t.name).map(t=>t.name).join(", ")}`},a);let n=s.filter(t=>typeof t!="string").map(t=>`- Called Tool: ${t.toolName}, Status: ${t.status}`),i=s[0];return i&&V(i)&&await b(J(i),a),{...e,outputMessage:n.join(`
|
|
5
5
|
`),summary:n.length?h(n.join(`
|
|
6
|
-
`)):"ArcGIS Knowledge Agent did not execute any tools or return any results.",arcgisKnowledgeMessages:[...e.arcgisKnowledgeMessages,...o.messages],arcgisKnowledgeToolResult:s}}catch(o){let s=o instanceof Error?o.message:String(o);return await c({text:`ArcGIS Knowledge Agent tool execution failed unexpectedly: ${s}`},a),{...e,outputMessage:`ArcGIS Knowledge Agent tool execution failed unexpectedly: ${s}`,status:"failed",summary:h(`ArcGIS Knowledge Agent tool execution failed unexpectedly: ${s}`),arcgisKnowledgeMessages:[...e.arcgisKnowledgeMessages]}}}var H=(e,a)=>M([],"ArcgisKnowledge Agent")(e,a);async function Q(e,a){let r=(e.arcgisKnowledgeToolResult??[]).map(l=>({...l,details:void 0})),{knowledgeGraph:o}=await G(a),s=T.getDataModelTypesSummary(o.dataModel),n={assignedTask:e.agentExecutionContext.assignedTask,userRequest:e.agentExecutionContext.userRequest,toolResult:r,dataModelSummary:s},i=await A({promptText:await g("arcgis_knowledge_summarize_result_prompt"),modelTier:"default",inputVariables:n}),t=typeof i=="string"?i:i.content;return{...e,outputMessage:t,status:"success",summary:h(t),arcgisKnowledgeMessages:[...e.arcgisKnowledgeMessages,new v(t)]}}function m(e){return async(a,r)=>r?.
|
|
6
|
+
`)):"ArcGIS Knowledge Agent did not execute any tools or return any results.",arcgisKnowledgeMessages:[...e.arcgisKnowledgeMessages,...o.messages],arcgisKnowledgeToolResult:s}}catch(o){let s=o instanceof Error?o.message:String(o);return await c({text:`ArcGIS Knowledge Agent tool execution failed unexpectedly: ${s}`},a),{...e,outputMessage:`ArcGIS Knowledge Agent tool execution failed unexpectedly: ${s}`,status:"failed",summary:h(`ArcGIS Knowledge Agent tool execution failed unexpectedly: ${s}`),arcgisKnowledgeMessages:[...e.arcgisKnowledgeMessages]}}}var H=(e,a)=>M([],"ArcgisKnowledge Agent")(e,a);async function Q(e,a){let r=(e.arcgisKnowledgeToolResult??[]).map(l=>({...l,details:void 0})),{knowledgeGraph:o}=await G(a),s=T.getDataModelTypesSummary(o.dataModel),n={assignedTask:e.agentExecutionContext.assignedTask,userRequest:e.agentExecutionContext.userRequest,toolResult:r,dataModelSummary:s},i=await A({promptText:await g("arcgis_knowledge_summarize_result_prompt"),modelTier:"default",inputVariables:n}),t=typeof i=="string"?i:i.content;return{...e,outputMessage:t,status:"success",summary:h(t),arcgisKnowledgeMessages:[...e.arcgisKnowledgeMessages,new v(t)]}}function m(e){return async(a,r)=>r?.signal?.aborted?(await c({text:"Knowledge Agent execution cancelled"},r),new k({goto:d,update:{outputMessage:"Knowledge Agent execution cancelled",summary:"Knowledge Agent execution cancelled",status:"failed"}})):await e(a,r)}var X=()=>new _(u).addNode("requireArcgisKnowledgeServices",H).addNode("agent",m(O)).addNode("tools",m(P)).addNode("summarizationLLM",m(Q)).addEdge(x,"requireArcgisKnowledgeServices").addEdge("requireArcgisKnowledgeServices","agent").addConditionalEdges("agent",e=>(e.arcgisKnowledgeMessages[e.arcgisKnowledgeMessages.length-1]?.tool_calls?.length??0)>0?"tools":d).addConditionalEdges("tools",e=>e.status==="failed"?d:"summarizationLLM").addEdge("summarizationLLM",d),Y=String.raw`The purpose of this agent is to work with Knowledge Graph data, a graph database technology that represents and stores data as interconnected entities (nodes) and relationships (edges).
|
|
7
7
|
This agent has two categories of skills: those that work with an active link chart visualization of a subset of the data in the knowledge graph, and those that work with the knowledge graph data more generally against the entire dataset in the service and database.
|
|
8
8
|
For link charts, the agent enables users to interact with a link chart by adding new entities (also called nodes) or relationships (also called edges), removing existing entities or relationships,
|
|
9
9
|
expanding the graph from particular entities, finding relationships between specified entities on the link chart and adding them to the link chart, finding all relationships
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
/* COPYRIGHT Esri - https://js.arcgis.com/5.2/LICENSE.txt */
|
|
2
|
+
import d from"./4UDYY3HL.js";import c from"./QYR3NSF2.js";import a from"./S75VFYR4.js";import{a as D,c as O}from"./RUURNLTP.js";import"./5W7S2RS4.js";import"./NXKKG5TK.js";import{v as b,z as N}from"./MAV3DW27.js";import"./ADYIXCSG.js";import{a as n}from"./P7DG5T3Z.js";import"./BX7FSMUU.js";import{a as A,b as S,ta as k}from"./DHKUXLU3.js";import{Z as V}from"./CHPQM77M.js";import"./WNS5ZUF5.js";import"./ZEYIBYSF.js";import"./YIMNOUTF.js";export default $arcgis.t(([,,,,,,,,,,,,K,X,,,{j:z,l:T},{C:M,D:G,E:L,F:P,G:F,H:U,a:j,m:w,n:R,o:h,p:Q},C])=>{var Y=async(e,t)=>(await n({text:"Exiting Data Exploration agent"},t),e),Z=async(e,t)=>{await n({text:"Requesting LLM for layer filter results"},t);let a=await w("data_explore_filter_prompt");if(!t?.configurable)throw new Error("config.configurable is required for layer filter tools");let{userTimezone:d,userTimezoneOffset:o}=L(),s={layerFieldInfo:e.layerFieldInfo,userTimezone:d,userTimezoneOffset:o,queryResponse:e.queryResponse,assignedTask:e.agentExecutionContext.assignedTask,userRequest:e.agentExecutionContext.userRequest,priorSteps:e.agentExecutionContext.priorSteps},i=await T({promptText:a,modelTier:"advanced",config:t,messages:e.dataExplorationMessages,inputVariables:s,tools:F}),r=[...e.dataExplorationMessages,i];if(!((i.tool_calls?.length??0)>0))return await n({text:"LLM determined no filter changes needed"},t),{...e,dataExplorationMessages:r};let c=r,l=i.content.toString();return await C(i,t),{...e,dataExplorationMessages:c,outputMessage:l}},ee=async(e,t)=>{await n({text:"Requesting LLM for layer query results"},t);let a=await w("data_explore_query_prompt");if(!t?.configurable)throw new Error("config.configurable is required for layer query tools");let{userTimezone:d,userTimezoneOffset:o}=L(),s=e.agentExecutionContext.sharedState,i=s.lastNavigatedFeatures?.value,r=s.lastResolvedLocation?.value,c="none";if(i!=null)try{c=JSON.stringify(i)}catch{c="none"}let l="none";if(r!=null)try{l=JSON.stringify({address:r.address,location:r.location})}catch{l="none"}let m={layerFieldInfo:e.layerFieldInfo,userTimezone:d,userTimezoneOffset:o,assignedTask:e.agentExecutionContext.assignedTask,userRequest:e.agentExecutionContext.userRequest,priorSteps:e.agentExecutionContext.priorSteps,lastNavigatedFeatures:c,lastResolvedLocation:l},g=await T({promptText:a,modelTier:"advanced",config:t,messages:e.dataExplorationMessages,inputVariables:m,tools:P}),y=(g.tool_calls?.length??0)>0,p=g.content.toString();return await C(g,t),{...e,dataExplorationMessages:[...e.dataExplorationMessages,g],...y?{}:{outputMessage:p},status:"success",summary:p&&!y?R(p):"Query planning completed."}},te=async(e,t)=>{try{await n({text:"Requesting LLM for summary on query results"},t);let a=await w("summarize_query_response_prompt"),d={queryResponse:e.queryResponse,assignedTask:e.agentExecutionContext.assignedTask,userRequest:e.agentExecutionContext.userRequest,priorSteps:e.agentExecutionContext.priorSteps},o=await z({promptText:a,modelTier:"fast",config:t,messages:e.dataExplorationMessages,inputVariables:d}),s=typeof o=="string"?o:o.content,i=new V(s);await n({text:`Received response from LLM: ${s}`},t);let r=s;return{...e,outputMessage:r,status:"success",summary:r?R(r):"Summary generated.",dataExplorationMessages:[...e.dataExplorationMessages,i]}}catch(a){throw await n({text:"Error during filter LLM request"},t),new Error(`Error during filter LLM request: ${a instanceof Error?a.message:String(a)}`)}};async function ae(e,t){if((e.queryResponse??[]).some(d=>{let o=d.details;return typeof o=="object"&&o!==null&&"error"in o}))return await n({text:"Skipping layer filter tool because query response contains an error."},t),{...e};let a=await new j(F,{handleToolErrors:!1}).invoke({messages:e.dataExplorationMessages},t);return await n({text:`Finished executing layer filter tool: ${a.messages.map(d=>d.content).join(", ")}`},t),{...e}}var se=10,re=["string","small-integer","integer"],ie=async(e,t,{includeSummaryStatistics:a=!0,includeUniqueValues:d=!0}={})=>{let o=null,s=null;try{if(t.type!=="geometry"&&t.type!=="oid"&&t.type!=="global-id"){a&&(o=await K({layer:e,field:t.name}));let i=t.domain?.type==="coded-value"?t.domain:null;d&&(re.includes(t.type)||i)&&(s=(await X({layer:e,field:t.name})).uniqueValueInfos.sort((r,c)=>c.count-r.count).slice(0,se),i&&(s=s.map(r=>({...r,value:i.getName(r.value)??r.value}))))}}catch(i){console.error(`Error fetching statistics for field ${t.name}:`,i)}return{summaryStatistics:o,uniqueValues:s}};function oe(e,t){return["string","small-integer","integer"].includes(e)||t==="coded-value"}async function ne(e,t,a,d=!0){let o=[],s=[],i=[];for(let r of e){let c=function(f){let u=t.get(f)?.layerItem;return u?[u.name&&`Name: ${u.name}`,u.title&&`Title: ${u.title}`,u.description&&`Description: ${u.description}`].filter(Boolean).join(" | "):f},{layerId:l,results:m}=r,g=a.map?.allLayers.find(f=>f.id===l),y=t.get(l)?.fieldRegistry;if(!y)continue;let p=o.find(f=>f.layerId===l);p||(p={layerId:l,layerSummary:c(l),fieldInfos:[]},o.push(p));for(let f of m){let u=y.get(f.name);if(!u)continue;let x=u.statistics,v=d&&!x?.summaryStatistics,q=oe(u.type,u.domain?.type)&&!x?.uniqueValues,I=v||q;if(i.push({layerId:l,fieldName:u.name,didFetchStatistics:I}),I){let J=ie(g,u,{includeSummaryStatistics:v,includeUniqueValues:q}).then($=>{let E={summaryStatistics:x?.summaryStatistics??null,uniqueValues:x?.uniqueValues??null};v&&(E.summaryStatistics=$.summaryStatistics),q&&(E.uniqueValues=$.uniqueValues),y.set(u.name,{...u,statistics:E}),u.statistics=E});s.push(J)}p.fieldInfos.push(u)}}return await Promise.all(s),{layerFieldInfo:o,didFetchStatistics:s.length>0,fieldStatisticsFetchStatus:i}}var W=/\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 le(e,t){return W.test(e)||W.test(t)}var de=async(e,t)=>{try{await n({text:"Preparing field information for vector search results"},t);let a=h(t,"layersAndFieldsRegistry"),{mapView:d}=G(t),{assignedTask:o,userRequest:s}=e.agentExecutionContext,i=le(o,s),{layerFieldInfo:r,didFetchStatistics:c,fieldStatisticsFetchStatus:l}=await ne(e.vectorSearchFieldResults,a,d,i);c?await n({text:"Statistics fetched"},t):await n({text:"Statistics skipped"},t);for(let m of l)await n({text:` - ${m.fieldName} - stats ${m.didFetchStatistics?"fetched":"skipped"}`},t);return await n({text:"Field information prepared"},t),{...e,layerFieldInfo:r}}catch(a){throw await n({text:"Error during fetching statistics"},t),new Error(`Error during fetching statistics: ${a instanceof Error?a.message:String(a)}`)}},B=.7,ce=10,ue=async(e,t)=>{try{await n({text:"Similarity search to find fields"},t);let a=h(t,"fieldSearch"),d=h(t,"layersAndFieldsRegistry"),o=h(t,"embeddingCache"),s=await a.searchFields({text:e.agentExecutionContext.assignedTask,layerIds:e.vectorSearchLayerIds,minScore:B,topResults:ce,embeddingCache:o}),i=s.map(({layerId:c,results:l})=>{let m=l.map(g=>` - ${g.name} (${g.score.toFixed(2)})`).join(`
|
|
3
|
+
`);return`${d.get(c)?.layerItem.name??c}:
|
|
4
|
+
${m}`}).join(`
|
|
5
|
+
`),r;return s.length>0?r=`Vector search completed. Matching layers and fields with scores:
|
|
6
|
+
${i}`:r=`No vector search results found for score over ${B}.`,await n({text:r},t),{...e,vectorSearchFieldResults:s}}catch(a){throw await n({text:`Error during vector search: ${a instanceof Error?a.message:String(a)}`},t),new Error(`Vector search failed: ${a instanceof Error?a.message:String(a)}`)}},me=.7,ge=async(e,t)=>{try{await n({text:`Similarity search to find layers: ${e.agentExecutionContext.assignedTask}`},t);let a=h(t,"layerSearch"),d=h(t,"layersAndFieldsRegistry"),o=h(t,"embeddingCache"),s=await a.searchLayers({text:e.agentExecutionContext.assignedTask,minScore:me,embeddingCache:o}),i=s.map(l=>l.id),r=s.map(({id:l,score:m})=>`${d.get(l)?.layerItem.name??l} (${m.toFixed(2)})`).join(`
|
|
7
|
+
`),c;return i.length>0?c=`Vector search completed. Matching layers with scores:
|
|
8
|
+
${r}`:c="Vector search completed. No matching layers found.",await n({text:c},t),{...e,vectorSearchLayerIds:i}}catch(a){throw await n({text:`Error during vector search: ${a instanceof Error?a.message:String(a)}`},t),new Error(`Vector search failed: ${a instanceof Error?a.message:String(a)}`)}},pe=(e,t)=>Q(["layerSearch","fieldSearch","layersAndFieldsRegistry"],"Data Exploration Agent")(e,t),fe=()=>new k(M).addNode("requireDataExplorationServices",pe).addNode("vectorSearchLayers",ge).addNode("vectorSearchFields",ue).addNode("fieldStatistics",de).addNode("queryAgent",ee).addNode("queryTools",U).addNode("summarizeQueryResponseLLM",te).addNode("filterAgent",Z).addNode("filterTools",ae).addNode("earlyExit",Y).addEdge(A,"requireDataExplorationServices").addEdge("requireDataExplorationServices","vectorSearchLayers").addConditionalEdges("vectorSearchLayers",e=>e.vectorSearchLayerIds.length?"vectorSearchFields":"earlyExit").addConditionalEdges("vectorSearchFields",e=>e.vectorSearchFieldResults.length?"fieldStatistics":"earlyExit").addEdge("fieldStatistics","queryAgent").addConditionalEdges("queryAgent",e=>(e.dataExplorationMessages[e.dataExplorationMessages.length-1]?.tool_calls?.length??0)>0?"queryTools":"filterAgent").addConditionalEdges("queryTools",e=>e.queryResponse.length?"summarizeQueryResponseLLM":"filterAgent").addEdge("summarizeQueryResponseLLM","filterAgent").addConditionalEdges("filterAgent",e=>(e.dataExplorationMessages[e.dataExplorationMessages.length-1]?.tool_calls?.length??0)>0?"filterTools":S).addEdge("filterTools",S).addEdge("earlyExit",S),he=String.raw`- **data exploration** — User is asking about the feature layer’s data (e.g. counts, summaries, statistics, field values), either for all features, a subset based on a condition, or for a subset based on the current view. And/Or user wants to include or exclude features based on field values, or visually style features differently (e.g., highlight or deemphasize them).
|
|
9
|
+
The Data Exploration Agent will automatically zoom to the affected features for action taken by this agent. In this case, no need to call navigation tool separately.
|
|
10
|
+
_Example: “Only show stations where Brand is Shell”_
|
|
11
|
+
_Example: “Make Shell stations stand out on the map”_
|
|
12
|
+
_Example: “Gray out all stations that aren’t Shell”_
|
|
13
|
+
This also includes questions that ask which feature meets a given condition or where a particular feature in the data is located (e.g., “Where is the spring with the highest elevation?”). However, this agent does not handle addresses.
|
|
14
|
+
_Example: “How many features are there?”_
|
|
15
|
+
_Example: “What’s the average population?”_
|
|
16
|
+
_Example: “Which values are in the status field?”_`,H={id:"dataExploration",name:"Data Exploration Agent",description:he,createGraph:fe,workspace:M};var _=class extends b{constructor(){super(...arguments),this.agent=H}static{this.properties={referenceElement:1}}#e;getContext(){if(!this.#e)throw new Error("arcgis-assistant-data-exploration-agent requires a mapView");return{mapView:this.#e}}load(){this.#e=D(this,"arcgis-assistant-data-exploration-agent"),O(this)}};N("arcgis-assistant-data-exploration-agent",_);return _},"identity/IdentityManager","portal/Portal","config","core/reactiveUtils","layers/FeatureLayer","request","identity/IdentityManager","portal/Portal","config","core/reactiveUtils","layers/FeatureLayer","request","smartMapping/statistics/summaryStatistics","smartMapping/statistics/uniqueValues","views/LinkChartView","rest/knowledgeGraphService",a,c,d)
|
|
@@ -1,2 +1,2 @@
|
|
|
1
1
|
/* COPYRIGHT Esri - https://js.arcgis.com/5.2/LICENSE.txt */
|
|
2
|
-
import{a as u,b as S,c as v}from"./XOH56EQ2.js";import b from"./TR4GFL7X.js";import{b as f,c as y}from"./FUIGPHBH.js";import a from"./
|
|
2
|
+
import{a as u,b as S,c as v}from"./XOH56EQ2.js";import b from"./TR4GFL7X.js";import{b as f,c as y}from"./FUIGPHBH.js";import a from"./S75VFYR4.js";import"./ADYIXCSG.js";import"./P7DG5T3Z.js";import{c as d}from"./DXVU45KM.js";import{b as c}from"./BX7FSMUU.js";import{O as g,u as l}from"./DHKUXLU3.js";import"./CHPQM77M.js";import"./WNS5ZUF5.js";import"./ZEYIBYSF.js";import"./YIMNOUTF.js";export default $arcgis.t(([,,{watch:T},,,{property:m,subclass:_},{f:h},w])=>{var k=Object.defineProperty,x=Object.getOwnPropertyDescriptor,a=(e,s,t,r)=>{for(var o=r>1?void 0:r?x(s,t):s,n=e.length-1,p;n>=0;n--)(p=e[n])&&(o=(r?p(s,t,o):p(o))||o);return r&&o&&k(s,t,o),o},i=class extends w{constructor(e){super(e),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 e=f(this.getSchemas());this._set("workspace",e);let s=this.id,t={[s]:this._invoke.bind(this)},r=[{from:s,decide:()=>{}}];this._set("createGraph",()=>y(t,r,e,{agent:this,entryNode:s,middlewares:this.middlewares}))}async _invoke(e,s){try{return this.outputSchema?await this._invokeStructured(e,s):await this._invokeUnstructured(e,s)}catch(t){if(l(t))throw t;let r=t instanceof Error?t.message:String(t);return u({outputMessage:r},"failed",r)}}async _invokeStructured(e,s){if(!this.outputSchema)throw new Error("Output schema is required for structured invocation.");let t=await c({model:await h({modelTier:this.modelTier}),systemPrompt:await this._getPromptWithInputVariables(e),tools:this._getTools(),checkpointer:!0,middleware:d(this.middlewares),responseFormat:this.outputSchema}).invoke({messages:e.agentExecutionContext.messages},s);if(!("structuredResponse"in t)||t.structuredResponse===void 0)throw new Error("LLMAgent did not receive structured output from createAgent.");return S(t.structuredResponse,this.outputSchema,t.messages)}async _invokeUnstructured(e,s){let t=(await c({model:await h({modelTier:this.modelTier}),systemPrompt:await this._getPromptWithInputVariables(e),tools:this._getTools(),checkpointer:!0,middleware:d(this.middlewares)}).invoke({messages:e.agentExecutionContext.messages},s)).messages,r=t.at(-1)?.content??"",o=typeof r=="string"?r:JSON.stringify(r),n=o.trim()||"LLMAgent completed.";return u({agentExecutionContext:{...e.agentExecutionContext,messages:t},outputMessage:o},"success",n)}async _getPromptWithInputVariables(e){let s=v(e,this.inputSchema);for(let{outputKey:t}of this.middlewares)t&&(s[String(t)]=e[t]);return await g.fromTemplate(this.prompt).format(s)}_getTools(){return this.tools?.map(e=>e.getTool())??[]}};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","core/reactiveUtils","layers/FeatureLayer","request","core/accessorSupport/decorators",a,b)
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
/* COPYRIGHT Esri - https://js.arcgis.com/5.2/LICENSE.txt */
|
|
2
|
-
import c from"./4UDYY3HL.js";import b from"./
|
|
2
|
+
import c from"./4UDYY3HL.js";import b from"./QYR3NSF2.js";import a from"./S75VFYR4.js";import{a as v,c as F}from"./RUURNLTP.js";import"./5W7S2RS4.js";import"./NXKKG5TK.js";import{v as x,z as S}from"./MAV3DW27.js";import"./ADYIXCSG.js";import{a as n}from"./P7DG5T3Z.js";import"./BX7FSMUU.js";import{a as w,b as h,q as E,ta as I}from"./DHKUXLU3.js";import"./CHPQM77M.js";import"./WNS5ZUF5.js";import"./ZEYIBYSF.js";import"./YIMNOUTF.js";export default $arcgis.t(([,,,,,,,,,,,,,,,,,{l:L},{A:z,B:u,a:$,m:C,o:m,p:N,q:A,r:R,s:T,t:b,u:_,v:V,w:q,x:j,y:k,z:M},D])=>{var B=.7,P=10,J=async(t,r)=>{try{await n({text:"Similarity search to find fields"},r);let e=m(r,"fieldSearch"),i=m(r,"layersAndFieldsRegistry"),o=m(r,"embeddingCache"),a=await e.searchFields({text:t.agentExecutionContext.assignedTask,layerIds:t.vectorSearchLayerIds,minScore:B,topResults:P,embeddingCache:o}),p=a.map(({layerId:c,results:d})=>{let g=d.map(s=>` - ${s.name} (${s.score.toFixed(2)})`).join(`
|
|
3
3
|
`);return`${i.get(c)?.layerItem.name??c}:
|
|
4
4
|
${g}`}).join(`
|
|
5
5
|
`),l;return a.length>0?l=`Vector search completed. Matching layers and fields with scores:
|
|
@@ -0,0 +1,3 @@
|
|
|
1
|
+
/* COPYRIGHT Esri - https://js.arcgis.com/5.2/LICENSE.txt */
|
|
2
|
+
import{a as x}from"./434TAA3J.js";import a from"./S75VFYR4.js";import{a as F}from"./E2HENO3T.js";import"./QSA4T3BU.js";import{a as Y}from"./5W7S2RS4.js";import"./NXKKG5TK.js";import{g as A,h,k as L,l as P,n as p,t as v,u as E,v as M,x as I,z as O}from"./MAV3DW27.js";import{b as D}from"./ADYIXCSG.js";import{a as y}from"./P7DG5T3Z.js";import"./BX7FSMUU.js";import{U as N,a as W,b as q,ta as U,u as j}from"./DHKUXLU3.js";import{Z as H,ja as T}from"./CHPQM77M.js";import"./WNS5ZUF5.js";import"./ZEYIBYSF.js";import"./YIMNOUTF.js";export default $arcgis.t(([Re,{whenOnce:$e,watch:Ae,when:Le},Pe,re,ie,K,ne,ae,De,,,Me,{property:f,subclass:Oe},{a:z,d:V,e:S,g:G,h:B,i:Q}])=>{var oe=async r=>{let e=await ce(),t=await z("default"),i=ie.getDefault(),s=(await re.getCredential(`${i.url}/sharing`)).token,o={type:"generateEmbeddings",webmapEmbeddings:r,auth:{apiUrl:t,token:s}};return e.postMessage(o),await new Promise((n,a)=>{let c=d=>{d.data==="completed"&&(e.removeEventListener("message",c),n())},l=d=>{e.removeEventListener("message",c),a(d instanceof Error?d:new Error("Embeddings worker error"))};e.addEventListener("message",c),e.addEventListener("error",l,{once:!0})}),e},ce=async()=>{{let r=(await import("./23EQTPO3.js")).default;return new r}},le=r=>{r.currentIntent="none"},de=async(r,e)=>{let t=S(e);if(r.agentExecutionContext.userRequest){let s=new T(r.agentExecutionContext.userRequest.trim());r.agentExecutionContext.messages=[...r.agentExecutionContext.messages,s],le(r)}let i=t?.services.agentRegistry.list().map(s=>s.agent.id)??[];return await y({text:`Available agents: ${[...i].join(", ")}`},e),await y({text:"Analyzing user input"},e),r},ge=async(r,e)=>(await y({text:"Exiting..."},e),r),J=r=>typeof r=="object"&&r!==null&&!Array.isArray(r),he=(r,e)=>{if(!J(r)){r!==void 0&&console.warn(`Agent "${e}" returned invalid sharedStatePatch. Ignoring it.`);return}let t={};for(let[i,s]of Object.entries(r)){if(!J(s)||!("value"in s)){console.warn(`Agent "${e}" returned invalid sharedStatePatch entry for key "${i}". Ignoring that entry.`);continue}t[i]={value:s.value}}return t},ue=r=>{let{previousSharedState:e,patch:t,agentId:i}=r;if(!t)return e;let s=Date.now(),o={...e};for(let[n,a]of Object.entries(t))a?.value!==void 0&&(o[n]={value:a.value,meta:{updatedByAgentId:i,updatedAt:s}});return o},X=r=>typeof r!="string"?void 0:r.trim()||void 0,pe=r=>{switch(r){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."}},me=(r,e)=>{let t=X(e?.outputMessage),i=X(e?.summary),s=e?.status,o=s==="success"||s==="failed"?s:"unknown";o==="unknown"&&console.warn(`Agent "${r}" returned missing/invalid status. Defaulting to "unknown".`);let n=he(e?.sharedStatePatch,r);return{outputMessage:t,summary:i??t??pe(o),status:o,sharedStatePatch:n}},Z=4e3,ye=async(r,e)=>{let t=S(e);if(e?.signal?.aborted)return await y({text:"Run cancelled; skipping agent execution"},e),{...r,currentIntent:"none",requiresFollowUp:!1};let{agentRegistry:i}=t?.services??{},s=i?.get(r.currentIntent);if(!s)return console.warn(`No agent found for intent: ${r.currentIntent}`),r;await y({text:`Executing registered agent: ${s.agent.name}`},e);let o={...e??{},configurable:{...t??{},agentId:s.agent.id,context:s.getContext?await s.getContext():void 0}},n;try{let l=await s.agent.createGraph().compile().invoke({agentExecutionContext:{...r.agentExecutionContext,messages:[...r.agentExecutionContext.messages],priorSteps:structuredClone(r.agentExecutionContext.priorSteps??[]),sharedState:structuredClone(r.agentExecutionContext.sharedState??{})}},o);n=me(s.agent.name,l),await y({text:`Finished executing registered agent: ${s.agent.name}`},e)}catch(l){if(j(l)||e?.signal?.aborted||l instanceof Error&&l.name==="AbortError")throw l;let d=l instanceof Error?l.message:String(l);console.error(`Agent "${s.agent.name}" failed:`,l),await y({text:`Registered agent failed: ${s.agent.name}. ${d}`},e),n={status:"failed",outputMessage:`Agent execution failed: ${d}`,summary:`Agent execution failed: ${d}`}}let a=n.outputMessage,c=[...r.agentExecutionContext.messages];if(a){let l=a.length>Z?`${a.slice(0,Z-14)}
|
|
3
|
+
[truncated]`:a;c.push(new H(l))}return{...r,stepCount:r.stepCount+1,lastExecutedAgent:s.agent.id,requiresFollowUp:n.status==="failed"?!0:r.requiresFollowUp,finalOutputMessage:a??"",agentExecutionContext:{...r.agentExecutionContext,messages:c,priorSteps:[...r.agentExecutionContext.priorSteps??[],{agentId:s.agent.id,assignedTask:r.agentExecutionContext.assignedTask,summary:n?.summary||"No summary provided.",status:n?.status||"unknown"}],sharedState:ue({previousSharedState:r.agentExecutionContext.sharedState,patch:n.sharedStatePatch,agentId:s.agent.id})}}},we=3,be=()=>new U(V).addNode("ingestInput",de).addNode("intentLLM",B).addNode("executeRegisteredAgent",ye).addNode("exit",ge).addEdge(W,"ingestInput").addEdge("ingestInput","intentLLM").addConditionalEdges("intentLLM",r=>r.currentIntent==="none"||r.currentIntent===r.lastExecutedAgent?"exit":"executeRegisteredAgent").addConditionalEdges("executeRegisteredAgent",r=>r.stepCount>=we||!r.requiresFollowUp?"exit":"intentLLM").addEdge("exit",q),C=class{constructor(){this.agentRegistry=new Map}register(e){let{agent:t}=e;if(this.agentRegistry.has(t.id))throw new Error(`Duplicate agent id: ${t.id}`);this.agentRegistry.set(t.id,e)}get(e){return this.agentRegistry.get(e)}list(){return[...this.agentRegistry.values()]}},R=class{constructor(e,t){this.graph=e,this.config={...t}}async waitForUser(){return await new Promise((e,t)=>{this.resolveWait=e,this.rejectWait=t})}handle(e,t){try{let i={agentId:e.agentId,id:e.id,payload:t},s=this.graph.streamEvents(null,{...this.config,configurable:{...this.config.configurable,hitlResponse:i},subgraphs:!0,version:"v2"});this.resolveWait?.(s)}catch(i){this.rejectWait?.(i)}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)}},fe=async r=>{try{return await(await G()).embedDocuments(r)}catch(e){throw console.error("Failed to generate embeddings:",e),e}},ee=async(r,e)=>{let t=e.get(r);if(t)return t;let i=await fe([r]);return e.set(r,i[0]),i[0]};async function ve(r,e,t,i){let s=`req-${Date.now()}`,o={type:"layerSearch",precomputedEmbedding:i?await ee(r,i):void 0,requestId:s,minScore:t};return await new Promise(n=>{let a=c=>{c.data.requestId===s&&n(c.data.results)};e.addEventListener("message",a,{once:!0}),e.postMessage(o)})}function Ee(r){let{worker:e}=r;return{async searchLayers({text:t,minScore:i,embeddingCache:s}){return await ve(t,e,i,s)}}}var _e=async({combinedQuery:r,layerIds:e,embeddingsWorker:t,minScore:i,topResults:s,embeddingCache:o})=>{let n=`req-${Date.now()}`,a=o?await ee(r,o):void 0,c={type:"fieldSearch",layerIdForFieldsSearch:e,precomputedEmbedding:a,requestId:n,minScore:i,topResults:s};return await new Promise(l=>{let d=u=>{if(u.data.requestId!==n)return;let g=u.data.results.map(({layerId:b,results:k})=>({layerId:b,results:k}));l(g)};t.addEventListener("message",d,{once:!0}),t.postMessage(c)})};function ke(r){let{worker:e}=r;return{async searchFields({text:t,layerIds:i,minScore:s,topResults:o,embeddingCache:n}){return await _e({combinedQuery:t,layerIds:i,embeddingsWorker:e,minScore:s,topResults:o,embeddingCache:n})}}}var Ie=r=>{let e=Q.safeParse(r);if(!e.success)throw new Error("Embeddings response validation failed. Regenerate embeddings.");return e.data},Se=(r,e)=>{let t=new Map,i=new Map;if(e.allLayers.forEach(s=>{s instanceof ne&&i.set(s.id,s)}),r.length!==i.size)throw new Error("Layer count mismatch during registry restoration. Regenerate embeddings.");for(let s of r){let o=i.get(s.id);if(!o)throw new Error(`Layer with ID ${s.id} not found in the original map during registry restoration. Regenerate embeddings.`);if(s.fields.length!==o.fields.length)throw new Error(`Field count mismatch for layer ID ${s.id} during registry restoration. Regenerate embeddings.`);let n={name:s.name,title:s.title,description:s.description},a=new Map;for(let c of s.fields){let l=o.fieldsIndex.get(c.name);if(!l)throw new Error(`Field with name ${c.name} not found in the original layer ${s.id} during registry restoration. Regenerate embeddings.`);a.set(c.name,{name:c.name,alias:o.getFieldAlias(c.name)??c.alias,description:c.description,type:l.type||"unknown",valueType:l.valueType||"unknown",domain:o.getFieldDomain(c.name)??void 0})}t.set(s.id,{layerItem:n,fieldRegistry:a})}return t},xe=async r=>{try{return(await ae(r,{responseType:"json"})).data}catch(e){throw new Error(`Failed to fetch data from ${r}: ${String(e)}`)}},Ce=async r=>{let e=r.map;if(!e?.portalItem)throw new Error("WebMap portal item is missing.");let{resources:t}=await e.portalItem.fetchResources(),i=t.find(o=>o.resource.path==="embeddings-v01.json");if(!i?.resource.url)throw new Error("Embeddings resource 'embeddings-v01.json' not found in the webmap portal item.");let s=await xe(i.resource.url);return Ie(s)},_=class r{constructor(){this.orchestratorReady=!1,this.chatHistory=[],this.priorSteps=[],this.sharedState={},this.agentRegistry=new C,this.activeRunId="",this.cancelledRunIds=new Set,this.streamEpoch=0}static async init(e){let t=new r;try{if(e.view?.map){await K.whenOnce(()=>e.view.ready);let i=await Ce(e.view),s=Se(i.layers,e.view.map);t.layersAndFieldsRegistry=s,t.embeddingsWorker=await oe(i)}return e.agents?.forEach(i=>{t.agentRegistry.register(i)}),t.orchestratorReady=!0,t}catch(i){throw console.error("Orchestrator initialization failed:",i),i}}async*ask(e){if(!this.orchestratorReady)throw new Error("Orchestrator is not ready yet.");if(!this.agentRegistry.list().length)throw new Error("Orchestrator has no registered agents.");if(++this.streamEpoch,!e.trim())return;let t=D();this.activeRunId=t,this.activeAbortController=new AbortController,this.graph||(this.graph=be().compile({checkpointer:new N}));let i=this.embeddingsWorker?Ee({worker:this.embeddingsWorker}):void 0,s=this.embeddingsWorker?ke({worker:this.embeddingsWorker}):void 0,o=new Map,n={thread_id:t,hitlResponse:null,services:{layerSearch:i,fieldSearch:s,layersAndFieldsRegistry:this.layersAndFieldsRegistry,agentRegistry:this.agentRegistry,embeddingCache:o}},a={version:"v2",streamMode:"custom",signal:this.activeAbortController.signal,configurable:n,subgraphs:!0},c=this.graph?.streamEvents({agentExecutionContext:{userRequest:e,messages:this.chatHistory,priorSteps:this.priorSteps,sharedState:this.sharedState}},a),l=++this.streamEpoch;if(yield*this.pipeStream(c,l,t),this.isRunCancelled(t)){yield{runId:t,timestamp:Date.now(),type:"cancelled",reason:"user"};return}for(;;){if(this.isRunCancelled(t)){yield{runId:t,timestamp:Date.now(),type:"cancelled",reason:"user"};return}let u=(await this.graph.getState(a,{subgraphs:!0})).tasks.find(g=>g.interrupts.length>0)?.interrupts[0]?.value;if(!u)break;this.currentInterrupt=u,this.interruptHandler=new R(this.graph,a),yield{runId:t,timestamp:Date.now(),type:"interrupt",interrupt:u};try{let g=await this.interruptHandler.waitForUser(),b=++this.streamEpoch;yield*this.pipeStream(g,b,t)}catch(g){if(this.isRunCancelled(t)){yield{runId:t,timestamp:Date.now(),type:"cancelled",reason:"user"};return}if(g){yield{runId:t,timestamp:Date.now(),type:"error",error:{message:g?.message}};return}}}if(this.isRunCancelled(t)){yield{runId:t,timestamp:Date.now(),type:"cancelled",reason:"user"};return}let d=(await this.graph.getState(a,{subgraphs:!0})).values;if(this.isRunCancelled(t)){yield{runId:t,timestamp:Date.now(),type:"cancelled",reason:"user"};return}this.chatHistory=d.agentExecutionContext.messages.length?d.agentExecutionContext.messages:this.chatHistory,this.priorSteps=d.agentExecutionContext.priorSteps?.slice(-5)??[],this.sharedState=d.agentExecutionContext.sharedState??{},yield{runId:t,timestamp:Date.now(),type:"completed",result:{content:d.finalOutputMessage}}}newConversation(){this.chatHistory=[],this.priorSteps=[],this.sharedState={}}resumeInterrupt(e){if(!this.currentInterrupt||!this.interruptHandler)throw new Error("No pending interrupt to resume.");this.interruptHandler.handle(this.currentInterrupt,e)}cancelInterrupt(){this.interruptHandler&&this.interruptHandler.cancel()}cancel(){this.activeRunId&&(this.cancelledRunIds.add(this.activeRunId),this.activeAbortController?.abort(),++this.streamEpoch,this.interruptHandler?.cancel())}async*pipeStream(e,t,i){for await(let s of e){if(this.isRunCancelled(i)||t!==this.streamEpoch)break;s.event==="on_custom_event"&&s.name==="trace_message"?yield{runId:i,timestamp:Date.now(),type:"trace",data:s.data}:s.name==="graph_ux_suggestion"&&(yield{runId:i,timestamp:Date.now(),type:"ux-suggestion",suggestion:s.data})}}isRunCancelled(e){return this.cancelledRunIds.has(e)}dispose(){this.embeddingsWorker&&(this.embeddingsWorker.terminate(),this.embeddingsWorker=void 0),this.orchestratorReady=!1}};var Fe=A`: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)}`,We=Object.defineProperty,qe=Object.getOwnPropertyDescriptor,w=(r,e,t,i)=>{for(var s=i>1?void 0:i?qe(e,t):e,o=r.length-1,n;o>=0;o--)(n=r[o])&&(s=(i?n(e,t,s):n(s))||s);return i&&s&&We(e,t,s),s},je=async r=>await new Promise(e=>setTimeout(e,r)),te=r=>!r||typeof r!="object"?!1:r.name==="AbortError";async function*He(r,{chunkSize:e=5,delay:t=20}={}){let i=0;for(;i<r.length;)yield r.slice(i,i+e),i+=e,await je(t)}async function*se(r,e,t,i){for await(let s of He(r)){if(i?.aborted){yield{type:"cancelled",log:t,runId:e};return}yield{type:"block-data",blockType:"text",data:{content:s},runId:e}}}var m=class extends Me{constructor(r){super(r),this.view=null,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 $e(()=>!this.view.updating),this._set("orchestrator",await _.init({agents:[...this.agents],view:this.view??void 0})),this.addHandles([Ae(()=>[this.view,this.agents],()=>{this._initialize()})])}clearChatHistory(){this.orchestrator?.newConversation()}async*ask(r,e){if(!this.orchestrator)throw new Error("Orchestrator not initialized yet.");this._set("processing",!0),this._set("processingStep","");let t=[],i,s="pending";try{let o=this.orchestrator.ask(r);for await(let n of o)switch(s=n.runId,n.type){case"trace":{this._set("processingStep",n.data.text),t.push(n.data.text);break}case"completed":{this._set("processing",!1),this._set("processingStep","");let a=n.result,c=!!a.content.length,l=!!i?.length;if(!c&&!l){yield{type:"completed",error:"No response received.",log:t,runId:s};return}let d=a.content;if(yield{type:"block-start",blockType:"text",runId:s},yield*se(d,s,t,e),yield{type:"block-end",blockType:"text",runId:s},l)for(let u of i){if(e?.aborted){yield{type:"cancelled",log:t,runId:s};return}let{type:g,data:b}=u;if(yield{type:"block-start",blockType:g,runId:s},g==="text"){let k=typeof b?.content=="string"?b.content:"";yield*se(k,s,t,e)}else yield{type:"block-data",blockType:g,data:b,runId:s};yield{type:"block-end",blockType:g,runId:s}}yield{type:"completed",response:d,blocks:i,log:t,runId:s};return}case"ux-suggestion":{let a=n.suggestion;i=i?[...i,a]:[a];break}case"interrupt":{let{kind:a,message:c,metadata:l}=n.interrupt,d=Array.isArray(l)?l.filter(g=>typeof g=="string"):[],u=(()=>{switch(a){case"booleanChoice":return{type:"boolean-choice",message:c,options:d};case"singleSelection":return{type:"single-select",message:c,options:d};case"multipleSelection":return{type:"multi-select",message:c,options:d};case"textInput":return{type:"text-input",message:c};default:return{type:a,message:c,options:d}}})();this._set("processingStep","Waiting for user input..."),yield{type:"interrupt",payload:u,runId:s};break}case"cancelled":{yield{type:"cancelled",log:t,runId:s};return}case"error":{if(e?.aborted||te(n.error)){yield{type:"cancelled",log:t,runId:s};return}yield{type:"completed",error:n.error.message,log:t,runId:s};return}default:{console.warn("Unknown event type:",n);break}}}catch(o){if(e?.aborted||te(o)){yield{type:"cancelled",log:t,runId:s};return}console.warn("Error during message processing:",o),yield{type:"completed",error:"An error occurred during message processing.",log:t,runId:"error"};return}finally{this._set("processing",!1)}}cancel(){this.orchestrator?.cancel()}};w([f({readOnly:!0})],m.prototype,"orchestrator",2);w([f()],m.prototype,"agents",2);w([f()],m.prototype,"portal",2);w([f()],m.prototype,"view",2);w([f({readOnly:!0})],m.prototype,"loading",2);w([f({readOnly:!0})],m.prototype,"processing",2);w([f({readOnly:!0})],m.prototype,"processingStep",2);m=w([Oe("OrchestratorController")],m);var Te="Embeddings resource 'embeddings-v01.json' not found in the webmap portal item.",Ne="Embeddings not found for this web map.",Ue="https://developers.arcgis.com/javascript/latest/agentic-apps/ai-webmap-setup/#embeddings",$=class extends M{constructor(){super(...arguments),this._messages=F({blocking:!0}),this.#e=v(),this.#a=v(),this.#s=v(),this.#t=null,this.#o=new Map,this.#r=Pe.getDefault(),this.#i=e=>{e.stopPropagation(),this.cancelInterrupt()},this.#n=e=>{e.stopPropagation();let t=e.detail;this.submitInterrupt(t)},this.#c=e=>{e.stopPropagation(),this.keepSuggestedPrompts||(this.suggestedPrompts=[]);let t=e.detail;this._inputValue="",this.arcgisSubmit.emit(t),this.submitMessage(t)},this.#l=e=>{if(this._canceling=!0,e.stopPropagation(),this.arcgisCancel.emit(),this._interrupt){this.orchestrator?.cancelInterrupt(),this._interrupt=null;return}this._orchestratorController?.cancel(),this.#t?.abort(),this.#t=null},this.#d=e=>{e.stopPropagation();let t=e.detail;this.arcgisFeedback.emit(t)},this.#g=e=>{e.stopPropagation();let t=e.detail;this._inputValue=t.prompt,this.arcgisPromptSelect.emit(t)},this.#h=e=>{this.arcgisSlottableRequest.emit(e.detail)},this._orchestratorController=null,this._interrupt=null,this._interruptDetails=[],this._error=null,this._inputValue="",this._isAnswering=!1,this._canceling=!1,this.messages=new Re([]),this.referenceElement=null,this.suggestedPrompts=[],this.feedbackEnabled=!1,this.keepSuggestedPrompts=!1,this.logEnabled=!1,this.copyEnabled=!1,this.voiceInputEnabled=!1,this.readAloudEnabled=!1,this.assistantAvatarEnabled=!1,this.arcgisCancel=p(),this.arcgisError=p(),this.arcgisFeedback=p(),this.arcgisInterrupt=p(),this.arcgisInterruptCancel=p(),this.arcgisInterruptSubmit=p(),this.arcgisPromptSelect=p(),this.arcgisReady=p(),this.arcgisSubmit=p(),this.arcgisSlottableRequest=p({bubbles:!1,composed:!1}),this.arcgisResponse=p()}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,suggestedPrompts:0,feedbackEnabled:5,keepSuggestedPrompts:5,logEnabled:5,copyEnabled:5,voiceInputEnabled:5,readAloudEnabled:5,assistantAvatarEnabled:5}}static{this.styles=Fe}#e;#a;#s;#t;#o;#r;#i;#n;#c;#l;#d;#g;#h;async#u(){try{let e=Y(this.el,this.referenceElement);await e?.componentOnReady();let t=[...this.#o.values()];return t.length?(this._orchestratorController?.destroy(),this._orchestratorController=new m({agents:t,portal:this.#r,view:e?.view}),await this._orchestratorController.load(),!0):(this._error="No agents found.",!1)}catch(e){return this._error=e?.message??"Error initializing orchestrator.",P(this)(e),!1}}get _isSignedIn(){return!!this.#r?.user||!!this._signedInUserId}get _user(){return this.#r?.user?.fullName||this.#r?.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}async clearChatHistory(){this._reset(),this._orchestratorController?.clearChatHistory()}cancelInterrupt(){this.arcgisInterruptCancel.emit(),this.orchestrator?.cancelInterrupt(),this._interrupt=null}register(e){this.#o.set(e.agent.id,e)}async submitMessage(e){let t=e.trim();if(!t||(this.messages.push({id:Date.now().toString(),role:"user",content:t}),!this._orchestratorController))return;this.#t=new AbortController;let i=this._orchestratorController.ask(t,this.#t?.signal);for await(let s of i){let o=s.runId,n=this.messages.at(-1);switch(s.type){case"block-start":{this._isAnswering=!0;let a={type:s.blockType,isPending:!0};if(n?.role==="assistant"&&n.id===o){let c=[...n.blocks??[],a];this.messages.splice(-1,1,{...n,blocks:c})}else this.messages.push({role:"assistant",blocks:[a],id:o,isStreaming:!0,interrupts:this._interruptDetails}),this._interruptDetails=[];break}case"block-data":{if(n?.role!=="assistant"||n?.id!==o)break;let a=[...n.blocks??[]],c=a[a.length-1],{blockType:l,data:d}=s;if(c?.type!==l||!c.isPending)break;if(l==="text"){let u=typeof c.data?.content=="string"?c.data.content:"",g=typeof d?.content=="string"?d.content:"";a[a.length-1]={...c,data:{...c.data,content:u+g}}}else a[a.length-1]={...c,data:{...c.data,...d??{}}};this.messages.splice(-1,1,{...n,blocks:a});break}case"block-end":{if(n?.role!=="assistant"||n?.id!==o)break;let a=[...n.blocks??[]],c=a[a.length-1];if(c?.type!==s.blockType||!c.isPending)break;let l=c;a[a.length-1]={...l,data:{...l.data},isPending:!1},this.messages.splice(-1,1,{...n,blocks:a});break}case"completed":s.error?(this.messages.push({role:"assistant",log:s.log,error:s.error,id:o,interrupts:this._interruptDetails}),this._interruptDetails=[]):n?.role==="assistant"&&n.id===o&&this.messages.splice(-1,1,{...n,content:s.response,blocks:n.blocks?.map(a=>({...a,isPending:!1}))??[],isStreaming:!1,log:s.log}),this._isAnswering=!1,this.#t=null,this._canceling=!1;break;case"interrupt":this._interrupt={...s.payload,id:o},this.arcgisInterrupt.emit(this._interrupt);break;case"cancelled":n?.role==="assistant"&&n.id===o?this.messages.splice(-1,1,{...n,blocks:n.blocks?.filter(a=>a.type==="text"||!a.isPending)??[],isStreaming:!1,log:s.log,error:"(Stopped by user)"}):(this.messages.push({role:"assistant",log:s.log,error:"(Stopped by user)",id:o,interrupts:this._interruptDetails}),this._interruptDetails=[]),this._isAnswering=!1,this.#t=null,this._canceling=!1;break}}}submitInterrupt(e){this.arcgisInterruptSubmit.emit(e),this._interrupt&&(this._interruptDetails=[...this._interruptDetails,{interrupt:this._interrupt,response:e}]),this.orchestrator?.resumeInterrupt(e),this._interrupt=null}load(){this.manager.onLifecycle(this._reset.bind(this))}loaded(){this.manager.onLifecycle(()=>{this.#e.value?.addEventListener("arcgisPromptSelect",this.#g),this.#e.value?.addEventListener("arcgisSubmit",this.#c),this.#e.value?.addEventListener("arcgisCancel",this.#l),this.#e.value?.addEventListener("arcgisFeedback",this.#d);let e=Le(()=>!!this._interrupt&&!!this.#s.value,()=>{let i=this.#s.value;i.removeEventListener("arcgisSubmit",this.#n),i.removeEventListener("arcgisCancel",this.#i),i.addEventListener("arcgisSubmit",this.#n,{once:!0}),i.addEventListener("arcgisCancel",this.#i,{once:!0})}),t=this.messages.on("after-add",i=>{let s=i.item;s.role==="assistant"&&(s.error||s.content)&&this.arcgisResponse.emit(s)});return queueMicrotask(()=>{this.#u().then(i=>{i?this.arcgisReady.emit():this._error&&this.arcgisError.emit(new Error(this._error))})}),()=>{e.remove(),t.remove(),this.#e.value?.removeEventListener("arcgisPromptSelect",this.#g),this.#s.value?.removeEventListener("arcgisSubmit",this.#n),this.#s.value?.removeEventListener("arcgisCancel",this.#i),this.#e.value?.removeEventListener("arcgisSubmit",this.#c),this.#e.value?.removeEventListener("arcgisCancel",this.#l),this.#e.value?.removeEventListener("arcgisFeedback",this.#d),this._orchestratorController?.destroy(),this._orchestratorController=null}})}_reset(){this._orchestratorController?.cancel(),this.#t?.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 e=this.#r;return h`<calcite-notice slot=entry-message open kind=brand icon width=full><div slot=message>You need to sign in to use the assistant chat.</div>${e?h`<calcite-link slot=link @click=${async()=>{try{let t=await De.getCredential(`${e.url}/sharing`);this._signedInUserId=t.userId,this._error=null,this.requestUpdate(),await this.#u()?this.arcgisReady.emit():this._error&&this.arcgisError.emit(new Error(this._error))}catch(t){this._error=t?.message??"Error signing in.",this.arcgisError.emit(new Error(this._error)),L("error",this,"Error signing in:",{detail:{error:t}})}}} target=_blank title="Sign in to ArcGIS Online">Sign in</calcite-link>`:h`<div slot=link>No portal information available</div>`}</calcite-notice>`}_renderErrorNotice(){return this._error?h`<calcite-notice slot=entry-message open kind=brand icon width=full>${this._error===Te?h`<div slot=message>${Ne}</div><calcite-link slot=link .href=${Ue} target=_blank title="Learn about web map embeddings">Read more</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} ${E(this.#e)}><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(e=>e.role==="assistant"?h`<arcgis-assistant-message .message=${e} .feedbackEnabled=${this.feedbackEnabled} .logEnabled=${this.logEnabled} .copyEnabled=${this.copyEnabled} .readAloudEnabled=${this.readAloudEnabled} @arcgisSlottableRequest=${this.#h} .assistantAvatarEnabled=${this.assistantAvatarEnabled}>${e.blocks?.map((t,i)=>h`<slot name=${x(e.id,i)??I} slot=${x(e.id,i)??I}><arcgis-assistant-message-block .block=${t}></arcgis-assistant-message-block></slot>`)}</arcgis-assistant-message>`:h`<arcgis-assistant-user-message .message=${e} .user=${this._user}></arcgis-assistant-user-message>`)}</slot>${this._interrupt?h`<div slot=message-loading><div class="interrupt-waiting-message">waiting for user input...</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} ${E(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} ${E(this.#a)}><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.#a.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>`}};O("arcgis-assistant",$);return $},"core/Collection","core/reactiveUtils","portal/Portal","identity/IdentityManager","portal/Portal","core/reactiveUtils","layers/FeatureLayer","request","identity/IdentityManager","config","layers/FeatureLayer","core/Accessor","core/accessorSupport/decorators",a)
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
/* COPYRIGHT Esri - https://js.arcgis.com/5.2/LICENSE.txt */
|
|
2
|
-
import c from"./
|
|
2
|
+
import c from"./QYR3NSF2.js";import a from"./S75VFYR4.js";import{a as L,c as R}from"./RUURNLTP.js";import"./5W7S2RS4.js";import"./NXKKG5TK.js";import{v as E,z as $}from"./MAV3DW27.js";import"./ADYIXCSG.js";import{a as d}from"./P7DG5T3Z.js";import"./BX7FSMUU.js";import{a as N,b as T,ta as b}from"./DHKUXLU3.js";import"./CHPQM77M.js";import{a as f}from"./WNS5ZUF5.js";import"./ZEYIBYSF.js";import"./YIMNOUTF.js";export default $arcgis.t(([,,,,,,,,,,,,,,,,,{k:C,l:F},{a:_,b:v,c:x,d:I,e:A,f:M,g:Z,h:q,i:j,j:V,k:O,l:z,m:S,n:G,o:h,p:B}])=>{var w=[I,A,M,Z,q,j,V,O,z];async function H(e,t){let a=await S("navigation_tool_prompt"),{mapView:n}=x(t),l=n.map.bookmarks?.map(p=>p.name).filter(Boolean)??[],s=e.vectorSearchLayerResults?.length>0?e.vectorSearchLayerResults.map((p,W)=>`${W+1}. layerId=${p.id} | title=${p.title??""} | name=${p.name??""} | score=${p.score.toFixed(2)}`).join(`
|
|
3
3
|
`):"",c=e.vectorSearchFieldResults?.length>0?JSON.stringify(e.vectorSearchFieldResults,null,2):"",r=e.intent==="goToBookmark"&&l.length?`Available bookmarks:
|
|
4
4
|
${l.map(p=>`- ${p}`).join(`
|
|
5
5
|
`)}`:"",o=(e.intent==="goToLayer"||e.intent==="goToFeatures")&&e.vectorSearchLayerResults?.length?`Candidate layers:
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
/* COPYRIGHT Esri - https://js.arcgis.com/5.2/LICENSE.txt */
|
|
2
|
-
import a from"./
|
|
3
|
-
Please fix your mistakes.`,name:e.name,tool_call_id:e.id??""})}}async run(e,t){let r;if(et(e))r=[await this.runTool(e.lg_tool_call,t)];else{let n;if(Me(e))n=e;else if(Xe(e))n=e.messages;else throw new Error("ToolNode only accepts BaseMessage[] or { messages: BaseMessage[] } as input.");let l=new Set(n.filter(c=>c.getType()==="tool").map(c=>c.tool_call_id)),i;for(let c=n.length-1;c>=0;c-=1){let u=n[c];if(j(u)){i=u;break}}if(i==null||!j(i))throw new Error("ToolNode only accepts AIMessages as input.");r=await Promise.all(i.tool_calls?.filter(c=>c.id==null||!l.has(c.id)).map(c=>this.runTool(c,t))??[])}if(!r.some(B))return Array.isArray(e)?r:{messages:r};let o=[],a=null;for(let n of r)B(n)?n.graph===Q.PARENT&&Array.isArray(n.goto)&&n.goto.every(l=>Se(l))?a?a.goto.push(...n.goto):a=new Q({graph:Q.PARENT,goto:n.goto}):o.push(n):o.push(Array.isArray(e)?[n]:{messages:[n]});return a&&o.push(a),o}};var An=w.Root({llmInputMessages:w({reducer:(e,t)=>L([],t),default:()=>[]})});var O=(e,t)=>t??e,Oi=w.Root({...Ie(),intent:w({reducer:O}),vectorSearchLayerResults:w({reducer:O,default:()=>[]}),vectorSearchFieldResults:w({reducer:O}),navigationInternalState:w({reducer:O,default:()=>({toolCallMessage:void 0})})});async function zt(e,t){let r=M.getDefault().helperServices,o=r.geocode.find(d=>d.name==="ArcGIS World Geocoding Service")??r.geocode[0];if(!o)throw new Error("No geocoding service found in helperServices.");let a=o.url,n=`${ie.assetsPath?.endsWith("/")?ie.assetsPath:`${ie.assetsPath}/`}esri/images/search/search-symbol-32.png`,l=(await at(a,{address:{SingleLine:e},outFields:["Match_addr"]}))?.[0];if(!l?.extent||!l.location)throw new Error(`Could not find location for: ${e}`);let i=new nt({url:n,width:24,height:24}),c=new ot({geometry:l.location,symbol:i});t.graphics.removeAll(),t.graphics.add(c),await t.goTo(l.extent);let u={address:l.address??"",location:l.location?l.location.toJSON():null,extent:l.extent?l.extent.toJSON():null};return{text:`Successfully zoomed to ${e}.`,sharedStatePatch:{lastResolvedLocation:{value:u}}}}var jt=["mapView"];function N(e){let t=e?.configurable?.context;if(!t||typeof t!="object")throw new Error("NavigationAgent context missing");let r=jt.filter(o=>!(o in t));if(r.length)throw new Error(`NavigationAgent context missing: ${r.join(", ")}`);return t}async function Lt({address:e},t){let{mapView:r}=N(t);return await zt(e,r)}var Dt=s.object({address:s.string().describe("The full address or place name to locate.")}),Pi=f(Lt,{name:"goToAddress",description:"Geocodes an address using Esri's World Geocoding Service and zooms the map to that location.",schema:Dt});async function Ot(e,t){let r=t.map.bookmarks;if(!r||r.length===0)throw new Error("No bookmarks found in the map.");let o=r.find(n=>n.name===e);if(!o)throw new Error(`Bookmark with name "${e}" not found.`);let a=o.viewpoint;if(!a)throw new Error(`Bookmark with name "${e}" does not have a valid viewpoint.`);return await t.goTo(a),{text:`Navigated to bookmark: ${e}`}}async function Pt({bookmarkName:e},t){let{mapView:r}=N(t);return await Promise.resolve(Ot(e,r))}var Gt=I.object({bookmarkName:I.string().describe("The name of the bookmark to navigate to.")}),Gi=f(Pt,{name:"goToBookmark",description:"Go to the extent of the bookmark with the given name.",schema:Gt});async function Vt(e,t,r){let o=r.map?.allLayers.find(l=>l.id===e);if(!o)return{text:`Error: Layer with id ${e} not found`};let a=t?.trim()?t:"1=1",n=o.createQuery();n.where=a;try{let{extent:l,count:i}=await o.queryExtent(n);if(i===0)return{text:`No features found in ${o.title} matching: ${a}`,where:a};if(l)await r.goTo(l);else return{text:`Error: Unable to determine extent for ${o.title}`,where:a};let c={layerId:e,layerTitle:o.title??e,where:a,count:i};return{text:`Successfully zoomed to ${i} feature(s) in ${o.title} matching: ${a}`,where:a,sharedStatePatch:{lastNavigatedFeatures:{value:c}}}}catch(l){return console.error("Error in goToFeatures:",l),{text:`Error: ${l instanceof Error?l.message:"Unknown error"}`,where:a}}}async function Qt({layerId:e,where:t},r){let{mapView:o}=N(r);return await Vt(e,t,o)}var Bt=I.object({layerId:I.string().describe("The layerId of the layer to zoom to."),where:I.string().describe("The sql-92 where clause used to query features to zoom to")}),Vi=f(Qt,{name:"goToFeatures",description:"Go to the features that match the given filter related to the given layerId.",schema:Bt});async function Ut(e){let t=new it({xmin:-180,ymin:-90,xmax:180,ymax:90,spatialReference:{wkid:4326}}).expand(.7);return await e.goTo(t),{text:"Successfully zoomed to world extent"}}async function Kt(e,t){let{mapView:r}=N(t);return await Ut(r)}var Wt=I.object({}),Qi=f(Kt,{name:"goToFullExtent",description:"Zooms the map to the full world extent using Esri's Geocoding Service.",schema:Wt});async function Ht(e){let t=e.map.initialViewProperties?.viewpoint?.targetGeometry;if(t)await e.goTo(t);else throw new Error("Initial extent is undefined");return{text:"Successfully zoomed to home extent"}}async function Jt(e,t){let{mapView:r}=N(t);return await Ht(r)}var Zt=s.object({}),Bi=f(Jt,{name:"goToHomeExtent",description:"Go to the initial web map view extent",schema:Zt});async function Yt(e,t){await t.when();let r=t.map?.allLayers.find(a=>a.id===e);if(!r)return console.warn(`[goToLayer] No matching FeatureLayer found for: ${e}`),{text:`Could not find layer for: ${e}`};let o;return(r.type==="link-chart"||r.type==="knowledge-graph-sublayer")&&t.map?.activeLinkChartLayer?o=t.map.diagramNodesExtent:o=r.fullExtent,o?(await t.goTo(o),r.visible=!0,{text:`Successfully zoomed to: ${r.title??""}`}):{text:"Layer has no defined extent. Cannot zoom to layer."}}async function Xt({layerId:e},t){let{mapView:r}=N(t);return await Yt(e,r)}var er=I.object({layerId:I.string().describe("The id of the layer to navigate to")}),Ui=f(Xt,{name:"goToLayer",description:"Zooms the map view to the full extent of the top matching layer.",schema:er});async function tr(e,t){return await t.goTo({scale:e}),{text:`Successfully zoomed to: ${e}`}}async function rr({scale:e},t){let{mapView:r}=N(t);return await tr(e,r)}var or=s.object({scale:s.number().describe("The map scale of the view to go to.")}),Ki=f(rr,{name:"goToScale",description:"Go to the specified view scale.",schema:or});async function ar(e,t,r){let o={target:new De({longitude:e.longitude,latitude:e.latitude,spatialReference:{wkid:4326}})};return r?.zoom!==void 0&&(o.zoom=r.zoom),r?.scale!==void 0&&(o.scale=r.scale),await t.goTo(o),{text:`Successfully navigated to: ${[`(${e.latitude}\xB0, ${e.longitude}\xB0)`,r?.zoom!==void 0?`zoom ${r.zoom}`:"",r?.scale!==void 0?`scale 1:${r.scale}`:""].filter(Boolean).join(", ")}`}}async function nr({center:e,zoom:t,scale:r},o){let{mapView:a}=N(o);return await ar(e,a,{zoom:t,scale:r})}var ir=s.object({center:s.object({longitude:s.number().describe("The longitude (x-coordinate) of the point to navigate to."),latitude:s.number().describe("The latitude (y-coordinate) of the point to navigate to.")}),zoom:s.number().optional().describe("The zoom level. Higher values = more zoomed in."),scale:s.number().optional().describe("The map scale. Alternative to zoom. Smaller numbers = more zoomed in.")}),Wi=f(nr,{name:"goToViewpoint",description:"Go to the specified viewpoint. This can contain a combination of scale, center, zoom, etc.",schema:ir});async function sr(e,t){return await t.goTo({zoom:e}),{text:`Successfully zoomed to: ${e}`}}async function lr({zoom:e},t){let{mapView:r}=N(t);return await sr(e,r)}var cr=s.object({zoom:s.number().min(1).max(20).describe("The zoom level of the view to go to.")}),Hi=f(lr,{name:"goToZoom",description:'Go to the specified zoom level. If input is generic (e.g. "zoom in", then only zoom to the next appropriate level - increase level for zooming in and decrease for zooming out.).',schema:cr}),ze=Object.assign({"../agents/arcgisKnowledge/prompts/arcgis_knowledge_current_lc_context.md":()=>import("./KMQ3SP4I.js").then(e=>e.default),"../agents/arcgisKnowledge/prompts/arcgis_knowledge_current_map_context.md":()=>import("./5QAHYX7Y.js").then(e=>e.default),"../agents/arcgisKnowledge/prompts/arcgis_knowledge_lucene_generation_prompt.md":()=>import("./5ZZGKP7N.js").then(e=>e.default),"../agents/arcgisKnowledge/prompts/arcgis_knowledge_summarize_result_prompt.md":()=>import("./AXDZBBNL.js").then(e=>e.default),"../agents/arcgisKnowledge/prompts/arcgis_knowledge_tool_prompt.md":()=>import("./ZS2TZ6BF.js").then(e=>e.default),"../agents/dataExploration/prompts/data_explore_filter_prompt.md":()=>import("./LQ6R5YRN.js").then(e=>e.default),"../agents/dataExploration/prompts/data_explore_query_prompt.md":()=>import("./
|
|
2
|
+
import a from"./S75VFYR4.js";import{a as T,b as S}from"./P7DG5T3Z.js";import{_ as w,ea as Ee,g as Se,j as Q,k as B,pa as L,u as xe}from"./DHKUXLU3.js";import{L as z,P as oe,_ as j,wc as f}from"./CHPQM77M.js";import{a as s}from"./WNS5ZUF5.js";import{Dd as I}from"./ZEYIBYSF.js";export default $arcgis.t(([Ae,M,ie,Le,,Ce,ot,{addressToLocations:at},nt,it,De,{createRenderer:st},{getSchemesByTag:lt,getSchemes:ct},{getBackgroundColorTheme:Re},{createAgeRenderer:ut,createContinuousRenderer:dt},{getSchemesByTag:we},{createContinuousRenderer:pt},{createRenderer:mt},{getSchemesByTag:ht},{createRenderer:ft},{getSchemesByTag:yt},{createRenderer:gt},{getSchemesByTag:wt},{createRenderer:bt},{getSchemesByTag:vt},{createAgeRenderer:Tt,createContinuousRenderer:St},{createRenderer:xt},{getSchemesByTag:Et},It,Oe,Pe,{formatDateOnly:Nt,convertDateFormatToIntlOptions:K,formatTimeOnly:$t,formatDate:qe},kt,Ft,Mt,At,Ct,Ge,,{fetchKnowledgeGraph:_e,executeQueryStreaming:Rt,executeSearchStreaming:qt},_t,{b:D,c:Ie,k:Ne}])=>{var Me=e=>Array.isArray(e)&&e.every(z),Xe=e=>typeof e=="object"&&e!=null&&"messages"in e&&Me(e.messages),et=e=>typeof e=="object"&&e!=null&&"lg_tool_call"in e,U=class extends Ee{tools;handleToolErrors=!0;trace=!1;constructor(e,t){let{name:r,tags:o,handleToolErrors:a}=t??{};super({name:r,tags:o,func:(n,l)=>this.run(n,l)}),this.tools=e,this.handleToolErrors=a??this.handleToolErrors}async runTool(e,t){let r=this.tools.find(o=>o.name===e.name);try{if(r===void 0)throw new Error(`Tool "${e.name}" not found.`);let o=await r.invoke({...e,type:"tool_call"},t);return z(o)&&o.getType()==="tool"||B(o)?o:new oe({status:"success",name:r.name,content:typeof o=="string"?o:JSON.stringify(o),tool_call_id:e.id})}catch(o){if(!this.handleToolErrors||xe(o))throw o;return new oe({status:"error",content:`Error: ${o.message}
|
|
3
|
+
Please fix your mistakes.`,name:e.name,tool_call_id:e.id??""})}}async run(e,t){let r;if(et(e))r=[await this.runTool(e.lg_tool_call,t)];else{let n;if(Me(e))n=e;else if(Xe(e))n=e.messages;else throw new Error("ToolNode only accepts BaseMessage[] or { messages: BaseMessage[] } as input.");let l=new Set(n.filter(c=>c.getType()==="tool").map(c=>c.tool_call_id)),i;for(let c=n.length-1;c>=0;c-=1){let u=n[c];if(j(u)){i=u;break}}if(i==null||!j(i))throw new Error("ToolNode only accepts AIMessages as input.");r=await Promise.all(i.tool_calls?.filter(c=>c.id==null||!l.has(c.id)).map(c=>this.runTool(c,t))??[])}if(!r.some(B))return Array.isArray(e)?r:{messages:r};let o=[],a=null;for(let n of r)B(n)?n.graph===Q.PARENT&&Array.isArray(n.goto)&&n.goto.every(l=>Se(l))?a?a.goto.push(...n.goto):a=new Q({graph:Q.PARENT,goto:n.goto}):o.push(n):o.push(Array.isArray(e)?[n]:{messages:[n]});return a&&o.push(a),o}};var An=w.Root({llmInputMessages:w({reducer:(e,t)=>L([],t),default:()=>[]})});var O=(e,t)=>t??e,Oi=w.Root({...Ie(),intent:w({reducer:O}),vectorSearchLayerResults:w({reducer:O,default:()=>[]}),vectorSearchFieldResults:w({reducer:O}),navigationInternalState:w({reducer:O,default:()=>({toolCallMessage:void 0})})});async function zt(e,t){let r=M.getDefault().helperServices,o=r.geocode.find(d=>d.name==="ArcGIS World Geocoding Service")??r.geocode[0];if(!o)throw new Error("No geocoding service found in helperServices.");let a=o.url,n=`${ie.assetsPath?.endsWith("/")?ie.assetsPath:`${ie.assetsPath}/`}esri/images/search/search-symbol-32.png`,l=(await at(a,{address:{SingleLine:e},outFields:["Match_addr"]}))?.[0];if(!l?.extent||!l.location)throw new Error(`Could not find location for: ${e}`);let i=new nt({url:n,width:24,height:24}),c=new ot({geometry:l.location,symbol:i});t.graphics.removeAll(),t.graphics.add(c),await t.goTo(l.extent);let u={address:l.address??"",location:l.location?l.location.toJSON():null,extent:l.extent?l.extent.toJSON():null};return{text:`Successfully zoomed to ${e}.`,sharedStatePatch:{lastResolvedLocation:{value:u}}}}var jt=["mapView"];function N(e){let t=e?.configurable?.context;if(!t||typeof t!="object")throw new Error("NavigationAgent context missing");let r=jt.filter(o=>!(o in t));if(r.length)throw new Error(`NavigationAgent context missing: ${r.join(", ")}`);return t}async function Lt({address:e},t){let{mapView:r}=N(t);return await zt(e,r)}var Dt=s.object({address:s.string().describe("The full address or place name to locate.")}),Pi=f(Lt,{name:"goToAddress",description:"Geocodes an address using Esri's World Geocoding Service and zooms the map to that location.",schema:Dt});async function Ot(e,t){let r=t.map.bookmarks;if(!r||r.length===0)throw new Error("No bookmarks found in the map.");let o=r.find(n=>n.name===e);if(!o)throw new Error(`Bookmark with name "${e}" not found.`);let a=o.viewpoint;if(!a)throw new Error(`Bookmark with name "${e}" does not have a valid viewpoint.`);return await t.goTo(a),{text:`Navigated to bookmark: ${e}`}}async function Pt({bookmarkName:e},t){let{mapView:r}=N(t);return await Promise.resolve(Ot(e,r))}var Gt=I.object({bookmarkName:I.string().describe("The name of the bookmark to navigate to.")}),Gi=f(Pt,{name:"goToBookmark",description:"Go to the extent of the bookmark with the given name.",schema:Gt});async function Vt(e,t,r){let o=r.map?.allLayers.find(l=>l.id===e);if(!o)return{text:`Error: Layer with id ${e} not found`};let a=t?.trim()?t:"1=1",n=o.createQuery();n.where=a;try{let{extent:l,count:i}=await o.queryExtent(n);if(i===0)return{text:`No features found in ${o.title} matching: ${a}`,where:a};if(l)await r.goTo(l);else return{text:`Error: Unable to determine extent for ${o.title}`,where:a};let c={layerId:e,layerTitle:o.title??e,where:a,count:i};return{text:`Successfully zoomed to ${i} feature(s) in ${o.title} matching: ${a}`,where:a,sharedStatePatch:{lastNavigatedFeatures:{value:c}}}}catch(l){return console.error("Error in goToFeatures:",l),{text:`Error: ${l instanceof Error?l.message:"Unknown error"}`,where:a}}}async function Qt({layerId:e,where:t},r){let{mapView:o}=N(r);return await Vt(e,t,o)}var Bt=I.object({layerId:I.string().describe("The layerId of the layer to zoom to."),where:I.string().describe("The sql-92 where clause used to query features to zoom to")}),Vi=f(Qt,{name:"goToFeatures",description:"Go to the features that match the given filter related to the given layerId.",schema:Bt});async function Ut(e){let t=new it({xmin:-180,ymin:-90,xmax:180,ymax:90,spatialReference:{wkid:4326}}).expand(.7);return await e.goTo(t),{text:"Successfully zoomed to world extent"}}async function Kt(e,t){let{mapView:r}=N(t);return await Ut(r)}var Wt=I.object({}),Qi=f(Kt,{name:"goToFullExtent",description:"Zooms the map to the full world extent using Esri's Geocoding Service.",schema:Wt});async function Ht(e){let t=e.map.initialViewProperties?.viewpoint?.targetGeometry;if(t)await e.goTo(t);else throw new Error("Initial extent is undefined");return{text:"Successfully zoomed to home extent"}}async function Jt(e,t){let{mapView:r}=N(t);return await Ht(r)}var Zt=s.object({}),Bi=f(Jt,{name:"goToHomeExtent",description:"Go to the initial web map view extent",schema:Zt});async function Yt(e,t){await t.when();let r=t.map?.allLayers.find(a=>a.id===e);if(!r)return console.warn(`[goToLayer] No matching FeatureLayer found for: ${e}`),{text:`Could not find layer for: ${e}`};let o;return(r.type==="link-chart"||r.type==="knowledge-graph-sublayer")&&t.map?.activeLinkChartLayer?o=t.map.diagramNodesExtent:o=r.fullExtent,o?(await t.goTo(o),r.visible=!0,{text:`Successfully zoomed to: ${r.title??""}`}):{text:"Layer has no defined extent. Cannot zoom to layer."}}async function Xt({layerId:e},t){let{mapView:r}=N(t);return await Yt(e,r)}var er=I.object({layerId:I.string().describe("The id of the layer to navigate to")}),Ui=f(Xt,{name:"goToLayer",description:"Zooms the map view to the full extent of the top matching layer.",schema:er});async function tr(e,t){return await t.goTo({scale:e}),{text:`Successfully zoomed to: ${e}`}}async function rr({scale:e},t){let{mapView:r}=N(t);return await tr(e,r)}var or=s.object({scale:s.number().describe("The map scale of the view to go to.")}),Ki=f(rr,{name:"goToScale",description:"Go to the specified view scale.",schema:or});async function ar(e,t,r){let o={target:new De({longitude:e.longitude,latitude:e.latitude,spatialReference:{wkid:4326}})};return r?.zoom!==void 0&&(o.zoom=r.zoom),r?.scale!==void 0&&(o.scale=r.scale),await t.goTo(o),{text:`Successfully navigated to: ${[`(${e.latitude}\xB0, ${e.longitude}\xB0)`,r?.zoom!==void 0?`zoom ${r.zoom}`:"",r?.scale!==void 0?`scale 1:${r.scale}`:""].filter(Boolean).join(", ")}`}}async function nr({center:e,zoom:t,scale:r},o){let{mapView:a}=N(o);return await ar(e,a,{zoom:t,scale:r})}var ir=s.object({center:s.object({longitude:s.number().describe("The longitude (x-coordinate) of the point to navigate to."),latitude:s.number().describe("The latitude (y-coordinate) of the point to navigate to.")}),zoom:s.number().optional().describe("The zoom level. Higher values = more zoomed in."),scale:s.number().optional().describe("The map scale. Alternative to zoom. Smaller numbers = more zoomed in.")}),Wi=f(nr,{name:"goToViewpoint",description:"Go to the specified viewpoint. This can contain a combination of scale, center, zoom, etc.",schema:ir});async function sr(e,t){return await t.goTo({zoom:e}),{text:`Successfully zoomed to: ${e}`}}async function lr({zoom:e},t){let{mapView:r}=N(t);return await sr(e,r)}var cr=s.object({zoom:s.number().min(1).max(20).describe("The zoom level of the view to go to.")}),Hi=f(lr,{name:"goToZoom",description:'Go to the specified zoom level. If input is generic (e.g. "zoom in", then only zoom to the next appropriate level - increase level for zooming in and decrease for zooming out.).',schema:cr}),ze=Object.assign({"../agents/arcgisKnowledge/prompts/arcgis_knowledge_current_lc_context.md":()=>import("./KMQ3SP4I.js").then(e=>e.default),"../agents/arcgisKnowledge/prompts/arcgis_knowledge_current_map_context.md":()=>import("./5QAHYX7Y.js").then(e=>e.default),"../agents/arcgisKnowledge/prompts/arcgis_knowledge_lucene_generation_prompt.md":()=>import("./5ZZGKP7N.js").then(e=>e.default),"../agents/arcgisKnowledge/prompts/arcgis_knowledge_summarize_result_prompt.md":()=>import("./AXDZBBNL.js").then(e=>e.default),"../agents/arcgisKnowledge/prompts/arcgis_knowledge_tool_prompt.md":()=>import("./ZS2TZ6BF.js").then(e=>e.default),"../agents/dataExploration/prompts/data_explore_filter_prompt.md":()=>import("./LQ6R5YRN.js").then(e=>e.default),"../agents/dataExploration/prompts/data_explore_query_prompt.md":()=>import("./TNMXWUXU.js").then(e=>e.default),"../agents/dataExploration/prompts/summarize_query_response_prompt.md":()=>import("./T537PKP4.js").then(e=>e.default),"../agents/help/prompts/help_prompt.md":()=>import("./F2AHA4GB.js").then(e=>e.default),"../agents/layerStyling/prompts/layer_styling_prompt.md":()=>import("./FX7UOGHP.js").then(e=>e.default),"../agents/navigation/prompts/navigation_intent_prompt.md":()=>import("./NE7E52YR.js").then(e=>e.default),"../agents/navigation/prompts/navigation_tool_prompt.md":()=>import("./6YMR4QSD.js").then(e=>e.default)});async function le(e){let t=Object.entries(ze).find(([r])=>r.endsWith(`/${e}.md`));if(!t)throw new Error(`Prompt not found: ${e}
|
|
4
4
|
Available prompts:
|
|
5
5
|
${Object.keys(ze).join(`
|
|
6
6
|
`)}`);return await t[1]()}var ur=(e,t=300)=>{let r=e.replace(/\s+/gu," ").replace(/[*_`#>\-]/gu,"").trim();return r.length>t?`${r.slice(0,t)}...`:r},Ve=(e,t)=>{let r=e?.configurable?.services?.[t];if(r==null)throw new Error(`${t} missing in config.configurable.services`);return r},Ji=(e,t)=>(r,o)=>{let a=o?.configurable?.services;for(let n of e)if(!a?.[n])throw new Error(`${t} requires services.${n} to be available.`);return r};async function dr(e){let{fields:t,layer:r,view:o,styleName:a,colorSchemeTags:n}=e,l;return n?l=lt({basemapTheme:await Re(o),geometryType:r.geometryType,includedTags:n,numColors:Math.min(t.length,8)})[0]:l=ct({basemapTheme:await Re(o),geometryType:r.geometryType,numColors:Math.min(t.length,8)}).primaryScheme,{layer:r,view:o,attributes:t.map(i=>({field:i,label:r.fields.find(c=>c.name===i)?.alias??""})).slice(0,8),outlineOptimizationEnabled:!0,sizeOptimizationEnabled:!0,includeSizeVariable:a.includes("Size"),pieChartScheme:l}}async function pr(e){return await st(e)}async function mr({arcgisMap:e,arcgisMapView:t,layerId:r,fields:o,colorSchemes:a,includeSize:n}){let l=t,i=e?.allLayers.find(u=>u.id===r);if(!i)return`Could not find layer for id: ${r}`;let c={styleName:n?"chart-size":"chart",fields:o,layer:i,view:l,colorSchemeTags:a};try{let u=await dr(c),d=await pr(u);return i.renderer=d.renderer,i.visible=!0,`Chart renderer applied to layer: ${i.title??i.id} using fields ${o.join(", ")}`}catch(u){return`Error applying chart renderer: ${u instanceof Error?u.message:String(u)}`}}var hr=["mapView"];function x(e){let t=e?.configurable?.context;if(!t||typeof t!="object")throw new Error("LayerStylingAgent context missing");let r=hr.filter(o=>!(o in t));if(r.length)throw new Error(`LayerStylingAgent context missing: ${r.join(", ")}`);return t}async function fr({layerId:e,fields:t,colorSchemes:r,includeSize:o},a){let{mapView:n}=x(a);return await S({type:"show-legend",data:{layerIds:[e]}},a),await mr({arcgisMap:n.map,arcgisMapView:n,layerId:e,fields:t,colorSchemes:r,includeSize:o})}var yr=s.object({layerId:s.string().describe("The id of the layer to apply the chart renderer to"),fields:s.array(s.string()).describe("The fields to use for the chart renderer (multiple numeric fields)"),colorSchemes:s.array(s.string()).optional().describe("Optional color scheme tags to use"),includeSize:s.boolean().optional().describe("Whether to vary the chart size (chart-size)")}),Zi=f(fr,{name:"chart",description:`Label: Charts
|
|
@@ -98,7 +98,7 @@ This is the DEFAULT tool for most queries. When in doubt, use this tool.`,schema
|
|
|
98
98
|
`);return`**${r.layerItem.title}** has ${o.length} field(s):
|
|
99
99
|
|
|
100
100
|
${a}`},ua=async({layerTitle:e},t)=>{let r=Ve(t,"layersAndFieldsRegistry");return ca(r,e)},hs=f(ua,{name:"listLayerFields",description:"Lists all fields for a given layer by title. Use ONLY when the user explicitly asks to see fields, columns, or attributes of a specific named layer. Do NOT call this tool for general help questions, capability overviews, or layer listing.",schema:s.object({layerTitle:s.string().describe("The title or partial title of the layer to list fields for.")})}),fs=w.Root({...D(),intent:w({reducer:(e,t)=>t}),arcgisKnowledgeMessages:w({reducer:L,default:()=>[]}),arcgisKnowledgeToolResult:w({reducer:(e,t)=>t,default:()=>null})}),W={conversationId:""};function ve(e){let t=e.map?.allLayers.filter(r=>r.type==="knowledge-graph");if(!t||t?.length!==1)throw new Error("The Knowledge Agent currently only supports maps with exactly one Knowledge Graph Layer.")}function $(e){return!!e?.map&&!("activeLinkChartLayer"in e.map)}async function ee(e){!e||$(e)||!e.map?.diagramNodesExtent||await e.goTo(e.map.diagramNodesExtent)}function te(e){let t=e?.configurable?.context;if(!t||typeof t!="object")throw new Error("ArcgisKnowledgeAgent context missing");if(!("view"in t))throw new Error("View context missing");let r=t.view;return r.map&&!("activeLinkChartLayer"in r.map)&&ve(r),{view:r}}function ys(e){let t=e?.configurable?.context;if(We(e)==="knowledgeGraph")return"knowledgeGraph";let r=t.view;return $(r)?(ve(r),"map"):"linkChart"}async function V(e){let t=e?.configurable?.context;if(We(e)==="knowledgeGraph")return t;{let r=t.view.map;if(r&&"activeLinkChartLayer"in r){let o=r.knowledgeGraph?.url;if(!o)throw new Error("Knowledge graph url missing from link chart.");return{knowledgeGraph:await _e(o)}}else{ve(t.view);let o=(t.view.map?.allLayers.find(a=>a.type==="knowledge-graph")).url;if(!o)throw new Error("Knowledge graph url missing from map.");return{knowledgeGraph:await _e(o)}}}}function We(e){let t=e?.configurable?.context;if(!t||typeof t!="object")throw new Error("ArcgisKnowledgeAgent context missing");if("knowledgeGraph"in t&&"view"in t)throw new Error("Knowledge Graph context should only have a view or knowledgeGraph, but never both.");if("knowledgeGraph"in t)return"knowledgeGraph";if("view"in t)return"view";throw new Error("ArcgisKnowledgeAgent context must have either a view or knowledgeGraph property.")}var ue=class{constructor(t){this.dataModel=t,this.kind="GraphQueryGenerationRequest",this.explainQuery=!0,this.schemaInformation=de.fromDataModel(t)}},de=class e{constructor(){this.schemaType="ArcgisGraphSchema",this.entityTypes=[],this.relationshipTypes=[],this.identifierInfo={mappingInfo:{identifierMapsTo:"UniformPropertyIdentifier",identifierPropertyName:"globalid"}}}static fromDataModel(t){let r=new e;for(let o of t.entityTypes)r.entityTypes.push(G.fromEntityType(o));for(let o of t.relationshipTypes)r.relationshipTypes.push(pe.fromRelationshipType(o));return r.identifierInfo={mappingInfo:{identifierMapsTo:da(t.identifierInfo.identifierMappingInfo.identifierInfoType),identifierPropertyName:t.identifierInfo.identifierMappingInfo.uniformPropertyIdentifier.identifierPropertyName}},r.spatialReference=JSON.parse(JSON.stringify(t.spatialReference)),r}static getDataModelTypesSummary(t){let r=t.entityTypes.map(a=>a.name).join(", "),o=t.relationshipTypes.map(a=>a.name).join(", ");return`Entity Types: ${r}.
|
|
101
|
-
Relationship Types: ${o}.`}},G=class e{constructor(){this.name="",this.properties=[]}static fromEntityType(t){let r=new e;r.name=t.name,r.alias=t.alias?t.alias:void 0,r.role=pa(t.role);for(let o of t.properties){let a={name:o.name,alias:o.alias?o.alias:void 0,fieldType:o.fieldType,role:ma(o.role),geometryDef:o.fieldType==="esriFieldTypeGeometry"?{geometryType:o.geometryType??"esriGeometryAny",hasM:o.hasM?o.hasM:void 0,hasZ:o.hasZ?o.hasZ:void 0}:void 0};r.properties.push(a)}return r}},pe=class extends G{constructor(){super(...arguments),this.observedEndPoints=[]}static fromRelationshipType(t){let r=G.fromEntityType(t);r.observedEndPoints=[];for(let o of t.endPoints)r.observedEndPoints.push({originEntityType:o.originEntityType,destinationEntityType:o.destinationEntityType});return r}},da=e=>{switch(e){case"esriIdentifierInfoTypeUNSPECIFIED":return"UNSPECIFIED";case"esriIdentifierInfoTypeDatabaseNative":return"DatabaseNative";case"esriIdentifierInfoTypeUniformProperty":return"UniformPropertyIdentifier";default:return e}},pa=e=>{switch(e){case"Regular":return"esriGraphNamedObjectRegular";case"Provenance":return"esriGraphNamedObjectProvenance";case"Document":return"esriGraphNamedObjectDocument";default:return e}};function ma(e){switch(e){case"esriGraphPropertyRegular":return"Regular";case"esriGraphPropertyDocumentName":return"Document_Name";case"esriGraphPropertyDocumentTitle":return"Document_Title";case"esriGraphPropertyDocumentUrl":return"Document_Url";case"esriGraphPropertyDocumentText":return"Document_Text";case"esriGraphPropertyDocumentKeywords":return"Document_Keywords";case"esriGraphPropertyDocumentContentType":return"Document_ContentType";case"esriGraphPropertyDocumentMetadata":return"Document_Metadata";case"esriGraphPropertyDocumentFileExtension":return"Document_FileExtension";case"esriGraphPropertyProvenanceInstanceId":return"Provenance_InstanceId";case"esriGraphPropertyProvenanceSourceType":return"Provenance_SourceType";case"esriGraphPropertyProvenanceSourceName":return"Provenance_SourceName";case"esriGraphPropertyProvenanceSource":return"Provenance_Source";case"esriGraphPropertyProvenanceComment":return"Provenance_Comment";case"esriGraphPropertyProvenanceTypeName":return"Provenance_TypeName";case"esriGraphPropertyProvenancePropertyName":return"Provenance_PropertyName";default:return"Regular"}}function re(e){return e?.
|
|
101
|
+
Relationship Types: ${o}.`}},G=class e{constructor(){this.name="",this.properties=[]}static fromEntityType(t){let r=new e;r.name=t.name,r.alias=t.alias?t.alias:void 0,r.role=pa(t.role);for(let o of t.properties){let a={name:o.name,alias:o.alias?o.alias:void 0,fieldType:o.fieldType,role:ma(o.role),geometryDef:o.fieldType==="esriFieldTypeGeometry"?{geometryType:o.geometryType??"esriGeometryAny",hasM:o.hasM?o.hasM:void 0,hasZ:o.hasZ?o.hasZ:void 0}:void 0};r.properties.push(a)}return r}},pe=class extends G{constructor(){super(...arguments),this.observedEndPoints=[]}static fromRelationshipType(t){let r=G.fromEntityType(t);r.observedEndPoints=[];for(let o of t.endPoints)r.observedEndPoints.push({originEntityType:o.originEntityType,destinationEntityType:o.destinationEntityType});return r}},da=e=>{switch(e){case"esriIdentifierInfoTypeUNSPECIFIED":return"UNSPECIFIED";case"esriIdentifierInfoTypeDatabaseNative":return"DatabaseNative";case"esriIdentifierInfoTypeUniformProperty":return"UniformPropertyIdentifier";default:return e}},pa=e=>{switch(e){case"Regular":return"esriGraphNamedObjectRegular";case"Provenance":return"esriGraphNamedObjectProvenance";case"Document":return"esriGraphNamedObjectDocument";default:return e}};function ma(e){switch(e){case"esriGraphPropertyRegular":return"Regular";case"esriGraphPropertyDocumentName":return"Document_Name";case"esriGraphPropertyDocumentTitle":return"Document_Title";case"esriGraphPropertyDocumentUrl":return"Document_Url";case"esriGraphPropertyDocumentText":return"Document_Text";case"esriGraphPropertyDocumentKeywords":return"Document_Keywords";case"esriGraphPropertyDocumentContentType":return"Document_ContentType";case"esriGraphPropertyDocumentMetadata":return"Document_Metadata";case"esriGraphPropertyDocumentFileExtension":return"Document_FileExtension";case"esriGraphPropertyProvenanceInstanceId":return"Provenance_InstanceId";case"esriGraphPropertyProvenanceSourceType":return"Provenance_SourceType";case"esriGraphPropertyProvenanceSourceName":return"Provenance_SourceName";case"esriGraphPropertyProvenanceSource":return"Provenance_Source";case"esriGraphPropertyProvenanceComment":return"Provenance_Comment";case"esriGraphPropertyProvenanceTypeName":return"Provenance_TypeName";case"esriGraphPropertyProvenancePropertyName":return"Provenance_PropertyName";default:return"Regular"}}function re(e){return e?.signal}function ha(e,t){return t?`${e}
|
|
102
102
|
|
|
103
103
|
Your previous attempt to generate a cypher query failed. See the details below and generate a new cypher query that avoids this error.
|
|
104
104
|
|