@arcgis/ai-components 5.2.0-next.86 → 5.2.0-next.87

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.
@@ -1,10 +1,10 @@
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 A,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 N}from"./AI6DYOKR.js";import{a as d}from"./VXFQANGJ.js";export default $arcgis.t(([ve,_,Se,,_e,,{createRenderer:Fe},{getSchemesByTag:Le,getSchemes:Qe},{getBackgroundColorTheme:xe},{createAgeRenderer:Ge,createContinuousRenderer:Ve},{getSchemesByTag:re},{createContinuousRenderer:Be},{createRenderer:Ke},{getSchemesByTag:Ue},{createRenderer:He},{getSchemesByTag:We},{createRenderer:Je},{getSchemesByTag:Ze},{createRenderer:Ye},{getSchemesByTag:Xe},{createAgeRenderer:et,createContinuousRenderer:tt},{createRenderer:rt},{getSchemesByTag:ot},at,ke,,{fetchKnowledgeGraph:Ee,executeQueryStreaming:nt,executeSearchStreaming:it},st,{getBindParametersFromCypherQuery:lt},pe,{o:ce},fe,ye,he,me])=>{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
- 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(N(l)){n=l;break}}if(n==null||!N(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)=>A([],t),default:()=>[]})});var I=(e,t)=>t??e,La=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 L(e){let t=Object.entries(Me).find(([r])=>r.endsWith(`/${e}.md`));if(!t)throw new Error(`Prompt not found: ${e}
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:Fe},{getSchemesByTag:Le,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
+ 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 L(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(`
6
- `)}`);return await t[1]()}var ct=(e,t=300)=>{let r=e.replace(/\s+/gu," ").replace(/[*_`#>\-]/gu,"").trim();return r.length>t?`${r.slice(0,t)}...`:r},Qa=(e,t)=>(r,o)=>{let a=o?.configurable?.services;for(let i of e)if(!a?.[i])throw new Error(`${t} requires services.${i} to be available.`);return r},Ga=y.Root({...R(),vectorSearchLayerIds:y(),vectorSearchFieldResults:y(),layerFieldInfo:y(),queryResponse:y(),dataExplorationMessages:y({reducer:A,default:()=>[]})}),dt=[me,he,ye,fe],Va=[pe,ue,de],ut=new O(dt,{handleToolErrors:!1});async function Ba(e,t){let{messages:r}=await ut.invoke({messages:e.dataExplorationMessages},t),o=[],a=[];for(let i of r){let s=i.content,n;typeof s!="string"&&(n={tool:i.name??"unknown",layerName:"unknown",summary:"Query failed",details:{error:"Skipping non-string tool output:",raw:s}});try{typeof s=="string"?n=JSON.parse(s):n={tool:i.name??"unknown",layerName:"unknown",summary:"Query failed",details:{error:"Invalid tool output type",raw:s}}}catch{n={tool:i.name??"unknown",layerName:"unknown",summary:"Query failed",details:{error:s}}}o.push(n),n.details&&typeof n.details=="object"&&"error"in n.details?a.push(`- ${n.tool}: Error - ${String(n.details.error)}`):a.push(`- ${n.layerName}: ${n.summary}`)}return await b({text:`Finished executing layer query tool: ${a.join(", ")}`},t),{...e,dataExplorationMessages:[...e.dataExplorationMessages,...r],queryResponse:o,status:"success",summary:a.length>0?ct(a.join(`
7
- `)):"Query executed."}}async function pt(e){let{fields:t,layer:r,view:o,styleName:a,colorSchemeTags:i}=e,s;return i?s=Le({basemapTheme:await xe(o),geometryType:r.geometryType,includedTags:i,numColors:Math.min(t.length,8)})[0]:s=Qe({basemapTheme:await xe(o),geometryType:r.geometryType,numColors:Math.min(t.length,8)}).primaryScheme,{layer:r,view:o,attributes:t.map(n=>({field:n,label:r.fields.find(c=>c.name===n)?.alias??""})).slice(0,8),outlineOptimizationEnabled:!0,sizeOptimizationEnabled:!0,includeSizeVariable:a.includes("Size"),pieChartScheme:s}}async function mt(e){return await Fe(e)}async function ht({arcgisMap:e,arcgisMapView:t,layerId:r,fields:o,colorSchemes:a,includeSize:i}){let s=t,n=e?.allLayers.find(l=>l.id===r);if(!n)return`Could not find layer for id: ${r}`;let c={styleName:i?"chart-size":"chart",fields:o,layer:n,view:s,colorSchemeTags:a};try{let l=await pt(c),u=await mt(l);return n.renderer=u.renderer,n.visible=!0,`Chart renderer applied to layer: ${n.title??n.id} using fields ${o.join(", ")}`}catch(l){return`Error applying chart renderer: ${l instanceof Error?l.message:String(l)}`}}var yt=["mapView"];function v(e){let t=e?.configurable?.context;if(!t||typeof t!="object")throw new Error("LayerStylingAgent context missing");let r=yt.filter(o=>!(o in t));if(r.length)throw new Error(`LayerStylingAgent context missing: ${r.join(", ")}`);return t}async function ft({layerId:e,fields:t,colorSchemes:r,includeSize:o},a){let{mapView:i}=v(a);return await T({type:"show-legend",data:{layerIds:[e]}},a),await ht({arcgisMap:i.map,arcgisMapView:i,layerId:e,fields:t,colorSchemes:r,includeSize:o})}var gt=d.object({layerId:d.string().describe("The id of the layer to apply the chart renderer to"),fields:d.array(d.string()).describe("The fields to use for the chart renderer (multiple numeric fields)"),colorSchemes:d.array(d.string()).optional().describe("Optional color scheme tags to use"),includeSize:d.boolean().optional().describe("Whether to vary the chart size (chart-size)")}),Ka=g(ft,{name:"chart",description:`Label: Charts
6
+ `)}`);return await t[1]()}var ct=(e,t=300)=>{let r=e.replace(/\s+/gu," ").replace(/[*_`#>\-]/gu,"").trim();return r.length>t?`${r.slice(0,t)}...`:r},La=(e,t)=>(r,o)=>{let a=o?.configurable?.services;for(let i of e)if(!a?.[i])throw new Error(`${t} requires services.${i} to be available.`);return r},Qa=y.Root({...R(),vectorSearchLayerIds:y(),vectorSearchFieldResults:y(),layerFieldInfo:y(),queryResponse:y(),dataExplorationMessages:y({reducer:N,default:()=>[]})}),dt=[he,me,ye,fe],Ga=[pe,ue,de],ut=new O(dt,{handleToolErrors:!1});async function Va(e,t){let{messages:r}=await ut.invoke({messages:e.dataExplorationMessages},t),o=[],a=[];for(let i of r){let s=i.content,n;typeof s!="string"&&(n={tool:i.name??"unknown",layerName:"unknown",summary:"Query failed",details:{error:"Skipping non-string tool output:",raw:s}});try{typeof s=="string"?n=JSON.parse(s):n={tool:i.name??"unknown",layerName:"unknown",summary:"Query failed",details:{error:"Invalid tool output type",raw:s}}}catch{n={tool:i.name??"unknown",layerName:"unknown",summary:"Query failed",details:{error:s}}}o.push(n),n.details&&typeof n.details=="object"&&"error"in n.details?a.push(`- ${n.tool}: Error - ${String(n.details.error)}`):a.push(`- ${n.layerName}: ${n.summary}`)}return await b({text:`Finished executing layer query tool: ${a.join(", ")}`},t),{...e,dataExplorationMessages:[...e.dataExplorationMessages,...r],queryResponse:o,status:"success",summary:a.length>0?ct(a.join(`
7
+ `)):"Query executed."}}async function pt(e){let{fields:t,layer:r,view:o,styleName:a,colorSchemeTags:i}=e,s;return i?s=Le({basemapTheme:await xe(o),geometryType:r.geometryType,includedTags:i,numColors:Math.min(t.length,8)})[0]:s=Qe({basemapTheme:await xe(o),geometryType:r.geometryType,numColors:Math.min(t.length,8)}).primaryScheme,{layer:r,view:o,attributes:t.map(n=>({field:n,label:r.fields.find(c=>c.name===n)?.alias??""})).slice(0,8),outlineOptimizationEnabled:!0,sizeOptimizationEnabled:!0,includeSizeVariable:a.includes("Size"),pieChartScheme:s}}async function ht(e){return await Fe(e)}async function mt({arcgisMap:e,arcgisMapView:t,layerId:r,fields:o,colorSchemes:a,includeSize:i}){let s=t,n=e?.allLayers.find(l=>l.id===r);if(!n)return`Could not find layer for id: ${r}`;let c={styleName:i?"chart-size":"chart",fields:o,layer:n,view:s,colorSchemeTags:a};try{let l=await pt(c),u=await ht(l);return n.renderer=u.renderer,n.visible=!0,`Chart renderer applied to layer: ${n.title??n.id} using fields ${o.join(", ")}`}catch(l){return`Error applying chart renderer: ${l instanceof Error?l.message:String(l)}`}}var yt=["mapView"];function v(e){let t=e?.configurable?.context;if(!t||typeof t!="object")throw new Error("LayerStylingAgent context missing");let r=yt.filter(o=>!(o in t));if(r.length)throw new Error(`LayerStylingAgent context missing: ${r.join(", ")}`);return t}async function ft({layerId:e,fields:t,colorSchemes:r,includeSize:o},a){let{mapView:i}=v(a);return await T({type:"show-legend",data:{layerIds:[e]}},a),await mt({arcgisMap:i.map,arcgisMapView:i,layerId:e,fields:t,colorSchemes:r,includeSize:o})}var gt=d.object({layerId:d.string().describe("The id of the layer to apply the chart renderer to"),fields:d.array(d.string()).describe("The fields to use for the chart renderer (multiple numeric fields)"),colorSchemes:d.array(d.string()).optional().describe("Optional color scheme tags to use"),includeSize:d.boolean().optional().describe("Whether to vary the chart size (chart-size)")}),Ba=g(ft,{name:"chart",description:`Label: Charts
8
8
  Description: Show the values of two or more categories as a proportion of the total using a pie chart.
9
9
  Keywords: pie, chart, all categories, breakdown, proportion
10
10
  Example: Show the total number of homes built in each decade using a pie chart for each feature.
@@ -14,15 +14,15 @@ ${Object.keys(Me).join(`
14
14
  Description: Show the values of two or more categories as a proportion of the total using a pie chart and use size to capture the total amount or magnitude.
15
15
  Keywords: pie, chart, all categories, breakdown, proportion, total, amount, how much, sum, graduated size, proportional size
16
16
  Example: Show the total number of homes built in each decade using a pie chart for each feature and vary the size of each chart based on the total of all categories.
17
- Fields: This style requires 2-8 number fields.`,schema:gt});function wt(e){let{fields:t,layer:r,view:o,theme:a,colorSchemeTags:i}=e,s=t[0],n;return i&&(n=re({geometryType:r.geometryType,includedTags:i,theme:a||"high-to-low"})[0]),{layer:r,view:o,startTime:s,endTime:new Date,theme:a,sizeOptimizationEnabled:!0,outlineOptimizationEnabled:!0,colorScheme:n}}async function bt(e){return await Ge(e)}async function Tt({arcgisMap:e,arcgisMapView:t,layerId:r,fields:o,colorSchemes:a,theme:i}){let s=t,n=e?.allLayers.find(l=>l.id===r);if(!n)return`Could not find layer for id: ${r}`;let c={styleName:"color-age",fields:o,layer:n,view:s,colorSchemeTags:a,theme:i};try{let l=wt(c),u=await bt(l);return n.renderer=u.renderer,n.visible=!0,`Color-age renderer applied to layer: ${n.title??n.id} using fields ${o.join(", ")}`}catch(l){return`Error applying color-age renderer: ${l instanceof Error?l.message:String(l)}`}}async function vt({layerId:e,fields:t,colorSchemes:r,theme:o},a){let{mapView:i}=v(a);return await T({type:"show-legend",data:{layerIds:[e]}},a),await Tt({arcgisMap:i.map,arcgisMapView:i,layerId:e,fields:t,colorSchemes:r,theme:o})}var St=d.object({layerId:d.string().describe("The id of the layer to apply the color-age renderer to"),fields:d.array(d.string()).describe("The field(s) to use for the color-age renderer (temporal/date data)"),colorSchemes:d.array(d.string()).optional().describe("Optional color scheme tags to use"),theme:d.enum(["above-and-below","above","below","centered-on","extremes","high-to-low"]).optional().describe("Optional theme for the color ramp")}),Ua=g(vt,{name:"color-age",description:`Label: Age (color)
17
+ Fields: This style requires 2-8 number fields.`,schema:gt});function wt(e){let{fields:t,layer:r,view:o,theme:a,colorSchemeTags:i}=e,s=t[0],n;return i&&(n=re({geometryType:r.geometryType,includedTags:i,theme:a||"high-to-low"})[0]),{layer:r,view:o,startTime:s,endTime:new Date,theme:a,sizeOptimizationEnabled:!0,outlineOptimizationEnabled:!0,colorScheme:n}}async function bt(e){return await Ge(e)}async function Tt({arcgisMap:e,arcgisMapView:t,layerId:r,fields:o,colorSchemes:a,theme:i}){let s=t,n=e?.allLayers.find(l=>l.id===r);if(!n)return`Could not find layer for id: ${r}`;let c={styleName:"color-age",fields:o,layer:n,view:s,colorSchemeTags:a,theme:i};try{let l=wt(c),u=await bt(l);return n.renderer=u.renderer,n.visible=!0,`Color-age renderer applied to layer: ${n.title??n.id} using fields ${o.join(", ")}`}catch(l){return`Error applying color-age renderer: ${l instanceof Error?l.message:String(l)}`}}async function vt({layerId:e,fields:t,colorSchemes:r,theme:o},a){let{mapView:i}=v(a);return await T({type:"show-legend",data:{layerIds:[e]}},a),await Tt({arcgisMap:i.map,arcgisMapView:i,layerId:e,fields:t,colorSchemes:r,theme:o})}var St=d.object({layerId:d.string().describe("The id of the layer to apply the color-age renderer to"),fields:d.array(d.string()).describe("The field(s) to use for the color-age renderer (temporal/date data)"),colorSchemes:d.array(d.string()).optional().describe("Optional color scheme tags to use"),theme:d.enum(["above-and-below","above","below","centered-on","extremes","high-to-low"]).optional().describe("Optional theme for the color ramp")}),Ka=g(vt,{name:"color-age",description:`Label: Age (color)
18
18
  Description: Use colors along a continuous color ramp to represent the age of features. Age reflects the length of time from a start date to an end date.
19
19
  Keywords: since, age, how old, how long
20
20
  Example: Show the age of each feature based on its reported date.
21
- Fields: This style requires at least one field with a date type.`,schema:St});function xt(e){let{fields:t,layer:r,view:o,colorSchemeTags:a}=e,{theme:i}=e,s=t[1],n=t[0],c;return a&&(c=re({geometryType:r.geometryType,includedTags:a,theme:i||"high-to-low"})[0]),{layer:r,view:o,field:n,normalizationField:s,theme:i,sizeOptimizationEnabled:!0,outlineOptimizationEnabled:!0,colorScheme:c}}async function Et(e){return await Ve(e)}async function Mt({arcgisMap:e,arcgisMapView:t,layerId:r,fields:o,colorSchemes:a,theme:i}){let s=t,n=e?.allLayers.find(l=>l.id===r);if(!n)return`Could not find layer for id: ${r}`;let c={styleName:"color",fields:o,layer:n,view:s,colorSchemeTags:a,theme:i};try{let l=xt(c),u=await Et(l);return n.renderer=u.renderer,n.visible=!0,`Color renderer applied to layer: ${n.title??n.id} using fields ${o.join(", ")}`}catch(l){return`Error applying color renderer: ${l instanceof Error?l.message:String(l)}`}}async function _t({layerId:e,fields:t,colorSchemes:r,theme:o},a){let{mapView:i}=v(a);return await T({type:"show-legend",data:{layerIds:[e]}},a),await Mt({arcgisMap:i.map,arcgisMapView:i,layerId:e,fields:t,colorSchemes:r,theme:o})}var kt=d.object({layerId:d.string().describe("The id of the layer to apply the color renderer to"),fields:d.array(d.string()).describe("The field(s) to use for the color renderer"),colorSchemes:d.array(d.string()).optional().describe("Optional color scheme tags to use"),theme:d.enum(["above-and-below","above","below","centered-on","extremes","high-to-low"]).optional().describe("Optional theme for the color ramp")}),Ha=g(_t,{name:"color",description:`Label: Counts and Amounts (color)
21
+ Fields: This style requires at least one field with a date type.`,schema:St});function xt(e){let{fields:t,layer:r,view:o,colorSchemeTags:a}=e,{theme:i}=e,s=t[1],n=t[0],c;return a&&(c=re({geometryType:r.geometryType,includedTags:a,theme:i||"high-to-low"})[0]),{layer:r,view:o,field:n,normalizationField:s,theme:i,sizeOptimizationEnabled:!0,outlineOptimizationEnabled:!0,colorScheme:c}}async function Et(e){return await Ve(e)}async function Mt({arcgisMap:e,arcgisMapView:t,layerId:r,fields:o,colorSchemes:a,theme:i}){let s=t,n=e?.allLayers.find(l=>l.id===r);if(!n)return`Could not find layer for id: ${r}`;let c={styleName:"color",fields:o,layer:n,view:s,colorSchemeTags:a,theme:i};try{let l=xt(c),u=await Et(l);return n.renderer=u.renderer,n.visible=!0,`Color renderer applied to layer: ${n.title??n.id} using fields ${o.join(", ")}`}catch(l){return`Error applying color renderer: ${l instanceof Error?l.message:String(l)}`}}async function _t({layerId:e,fields:t,colorSchemes:r,theme:o},a){let{mapView:i}=v(a);return await T({type:"show-legend",data:{layerIds:[e]}},a),await Mt({arcgisMap:i.map,arcgisMapView:i,layerId:e,fields:t,colorSchemes:r,theme:o})}var kt=d.object({layerId:d.string().describe("The id of the layer to apply the color renderer to"),fields:d.array(d.string()).describe("The field(s) to use for the color renderer"),colorSchemes:d.array(d.string()).optional().describe("Optional color scheme tags to use"),theme:d.enum(["above-and-below","above","below","centered-on","extremes","high-to-low"]).optional().describe("Optional theme for the color ramp")}),Ua=g(_t,{name:"color",description:`Label: Counts and Amounts (color)
22
22
  Description: Vary color along a continuous color ramp to represent numeric or ranked data.
23
23
  Keywords: graduated color, choropleth, continuous color, hue, color, gradation, saturation, lightness, percent, rate, ratio, index, how much, increase, decrease
24
24
  Example: Color each feature based on the population density.
25
- Fields: This style requires a single field with a number type. A second number field may be specified for normalizing the value of the first field.`,schema:kt});function $t(e){let{fields:t,layer:r,view:o,colorSchemeTags:a,theme:i}=e,s,n,c=t[0];return a&&(n=re({geometryType:r.geometryType,includedTags:a,theme:i||"high-to-low"})[0]),{layer:r,view:o,field:c,normalizationField:s,theme:i,colorOptions:{colorScheme:n}}}async function Nt(e){return await Be(e)}async function At({arcgisMap:e,arcgisMapView:t,layerId:r,fields:o,colorSchemes:a,theme:i}){let s=t,n=e?.allLayers.find(l=>l.id===r);if(!n)return`Could not find layer for id: ${r}`;let c={styleName:"color-size-univariate",fields:o,layer:n,view:s,colorSchemeTags:a,theme:i};try{let l=$t(c),u=await Nt(l);return n.renderer=u.renderer,n.visible=!0,`Color-size-univariate renderer applied to layer: ${n.title??n.id} using fields ${o.join(", ")}`}catch(l){return`Error applying color-size-univariate renderer: ${l instanceof Error?l.message:String(l)}`}}async function Rt({layerId:e,fields:t,colorSchemes:r,theme:o},a){let{mapView:i}=v(a);return await T({type:"show-legend",data:{layerIds:[e]}},a),await At({arcgisMap:i.map,arcgisMapView:i,layerId:e,fields:t,colorSchemes:r,theme:o})}var It=d.object({layerId:d.string().describe("The id of the layer to apply the color-size univariate renderer to"),fields:d.array(d.string()).describe("The fields to use for the color-size univariate renderer"),colorSchemes:d.array(d.string()).optional().describe("Optional color scheme tags to use"),theme:d.enum(["above-and-below","above","below","centered-on","extremes","high-to-low"]).optional().describe("Optional theme for the color and size ramps")}),Wa=g(Rt,{name:"color-size-univariate",description:`Label: Color and Size (univariate)
25
+ Fields: This style requires a single field with a number type. A second number field may be specified for normalizing the value of the first field.`,schema:kt});function $t(e){let{fields:t,layer:r,view:o,colorSchemeTags:a,theme:i}=e,s,n,c=t[0];return a&&(n=re({geometryType:r.geometryType,includedTags:a,theme:i||"high-to-low"})[0]),{layer:r,view:o,field:c,normalizationField:s,theme:i,colorOptions:{colorScheme:n}}}async function At(e){return await Be(e)}async function Nt({arcgisMap:e,arcgisMapView:t,layerId:r,fields:o,colorSchemes:a,theme:i}){let s=t,n=e?.allLayers.find(l=>l.id===r);if(!n)return`Could not find layer for id: ${r}`;let c={styleName:"color-size-univariate",fields:o,layer:n,view:s,colorSchemeTags:a,theme:i};try{let l=$t(c),u=await At(l);return n.renderer=u.renderer,n.visible=!0,`Color-size-univariate renderer applied to layer: ${n.title??n.id} using fields ${o.join(", ")}`}catch(l){return`Error applying color-size-univariate renderer: ${l instanceof Error?l.message:String(l)}`}}async function Rt({layerId:e,fields:t,colorSchemes:r,theme:o},a){let{mapView:i}=v(a);return await T({type:"show-legend",data:{layerIds:[e]}},a),await Nt({arcgisMap:i.map,arcgisMapView:i,layerId:e,fields:t,colorSchemes:r,theme:o})}var It=d.object({layerId:d.string().describe("The id of the layer to apply the color-size univariate renderer to"),fields:d.array(d.string()).describe("The fields to use for the color-size univariate renderer"),colorSchemes:d.array(d.string()).optional().describe("Optional color scheme tags to use"),theme:d.enum(["above-and-below","above","below","centered-on","extremes","high-to-low"]).optional().describe("Optional theme for the color and size ramps")}),Ha=g(Rt,{name:"color-size-univariate",description:`Label: Color and Size (univariate)
26
26
  Description: Vary symbol size and color based on the values of two numeric attributes.
27
27
  Keywords: continuous color, hue, color, size, gradation, saturation, lightness, percent, rate, ratio, index, how much, increase, decrease, amount
28
28
  Example: Color each feature based on the percentage of the population that owns a home and vary the size of each point based on total population.
@@ -37,11 +37,11 @@ ${Object.keys(Me).join(`
37
37
  - Visualize distribution of different crops across regions
38
38
  - Display demographic patterns within census tracts
39
39
  **Fields:** Requires 2-8 number fields.
40
- **Keywords:** density, how much, how many, total, number, amount`,schema:Pt});function Ot(e){let{fields:t,layer:r,view:o,colorSchemeTags:a}=e,i,s=t[0];return a&&(i=We({includedTags:a,basemap:o.map?.basemap||"topo"})[0]),{layer:r,view:o,field:s,heatmapScheme:i}}async function jt(e){return await He(e)}async function Ft({arcgisMap:e,arcgisMapView:t,layerId:r,fields:o,colorSchemes:a}){let i=t,s=e?.allLayers.find(c=>c.id===r);if(!s)return`Could not find layer for id: ${r}`;let n={styleName:"heatmap",fields:o,layer:s,view:i,colorSchemeTags:a};try{let c=Ot(n),l=await jt(c);return s.renderer=l.renderer,s.visible=!0,`Heatmap renderer applied to layer: ${s.title??s.id} using fields ${o.join(", ")}`}catch(c){return`Error applying heatmap renderer: ${c instanceof Error?c.message:String(c)}`}}async function Lt({layerId:e,fields:t,colorSchemes:r},o){let{mapView:a}=v(o);return await T({type:"show-legend",data:{layerIds:[e]}},o),await Ft({arcgisMap:a.map,arcgisMapView:a,layerId:e,fields:t,colorSchemes:r})}var Qt=d.object({layerId:d.string().describe("The id of the layer to apply the heatmap renderer to"),fields:d.array(d.string()).describe("The field(s) to use for the heatmap renderer (typically point density)"),colorSchemes:d.array(d.string()).optional().describe("Optional color scheme tags to use")}),Za=g(Lt,{name:"heatmap",description:`Label: Heat Map
40
+ **Keywords:** density, how much, how many, total, number, amount`,schema:Pt});function Ot(e){let{fields:t,layer:r,view:o,colorSchemeTags:a}=e,i,s=t[0];return a&&(i=Je({includedTags:a,basemap:o.map?.basemap||"topo"})[0]),{layer:r,view:o,field:s,heatmapScheme:i}}async function jt(e){return await He(e)}async function Ft({arcgisMap:e,arcgisMapView:t,layerId:r,fields:o,colorSchemes:a}){let i=t,s=e?.allLayers.find(c=>c.id===r);if(!s)return`Could not find layer for id: ${r}`;let n={styleName:"heatmap",fields:o,layer:s,view:i,colorSchemeTags:a};try{let c=Ot(n),l=await jt(c);return s.renderer=l.renderer,s.visible=!0,`Heatmap renderer applied to layer: ${s.title??s.id} using fields ${o.join(", ")}`}catch(c){return`Error applying heatmap renderer: ${c instanceof Error?c.message:String(c)}`}}async function Lt({layerId:e,fields:t,colorSchemes:r},o){let{mapView:a}=v(o);return await T({type:"show-legend",data:{layerIds:[e]}},o),await Ft({arcgisMap:a.map,arcgisMapView:a,layerId:e,fields:t,colorSchemes:r})}var Qt=d.object({layerId:d.string().describe("The id of the layer to apply the heatmap renderer to"),fields:d.array(d.string()).describe("The field(s) to use for the heatmap renderer (typically point density)"),colorSchemes:d.array(d.string()).optional().describe("Optional color scheme tags to use")}),Wa=g(Lt,{name:"heatmap",description:`Label: Heat Map
41
41
  Description: Show areas of high density with colors that appear to glow hotter. This is only valid for point layers.
42
42
  Keywords: density, heatmap, hot spots, pattern, cluster
43
43
  Example: Create a heatmap
44
- Fields: This typically requires zero or one field of type number.`,schema:Qt});function Gt(e){let{fields:t,layer:r,view:o,styleName:a,colorSchemeTags:i}=e,s;return i&&(s=Ze({geometryType:r.geometryType,includedTags:i,numColors:Math.min(t.length,10)})[0]),{layer:r,view:o,fields:t.map(n=>({name:n})).slice(0,9),outlineOptimizationEnabled:!0,sizeOptimizationEnabled:!0,includeSizeVariable:a.includes("Size"),predominanceScheme:s}}async function Vt(e){return await Je(e)}async function Bt({arcgisMap:e,arcgisMapView:t,layerId:r,fields:o,colorSchemes:a,includeSize:i}){let s=t,n=e?.allLayers.find(l=>l.id===r);if(!n)return`Could not find layer for id: ${r}`;let c={styleName:i?"predominance-size":"predominance",fields:o,layer:n,view:s,colorSchemeTags:a};try{let l=Gt(c),u=await Vt(l);return n.renderer=u.renderer,n.visible=!0,`Predominance renderer applied to layer: ${n.title??n.id} using fields ${o.join(", ")}`}catch(l){return`Error applying predominance renderer: ${l instanceof Error?l.message:String(l)}`}}async function Kt({layerId:e,fields:t,colorSchemes:r,includeSize:o},a){let{mapView:i}=v(a);return await T({type:"show-legend",data:{layerIds:[e]}},a),await Bt({arcgisMap:i.map,arcgisMapView:i,layerId:e,fields:t,colorSchemes:r,includeSize:o})}var Ut=d.object({layerId:d.string().describe("The id of the layer to apply the predominance renderer to"),fields:d.array(d.string()).describe("The fields to use for the predominance renderer (competing categories)"),colorSchemes:d.array(d.string()).optional().describe("Optional color scheme tags to use"),includeSize:d.boolean().optional().describe("Whether to include size visualization (predominance-size)")}),Ya=g(Kt,{name:"predominance",description:`Label: Predominant category
44
+ Fields: This typically requires zero or one field of type number.`,schema:Qt});function Gt(e){let{fields:t,layer:r,view:o,styleName:a,colorSchemeTags:i}=e,s;return i&&(s=Ze({geometryType:r.geometryType,includedTags:i,numColors:Math.min(t.length,10)})[0]),{layer:r,view:o,fields:t.map(n=>({name:n})).slice(0,9),outlineOptimizationEnabled:!0,sizeOptimizationEnabled:!0,includeSizeVariable:a.includes("Size"),predominanceScheme:s}}async function Vt(e){return await We(e)}async function Bt({arcgisMap:e,arcgisMapView:t,layerId:r,fields:o,colorSchemes:a,includeSize:i}){let s=t,n=e?.allLayers.find(l=>l.id===r);if(!n)return`Could not find layer for id: ${r}`;let c={styleName:i?"predominance-size":"predominance",fields:o,layer:n,view:s,colorSchemeTags:a};try{let l=Gt(c),u=await Vt(l);return n.renderer=u.renderer,n.visible=!0,`Predominance renderer applied to layer: ${n.title??n.id} using fields ${o.join(", ")}`}catch(l){return`Error applying predominance renderer: ${l instanceof Error?l.message:String(l)}`}}async function Kt({layerId:e,fields:t,colorSchemes:r,includeSize:o},a){let{mapView:i}=v(a);return await T({type:"show-legend",data:{layerIds:[e]}},a),await Bt({arcgisMap:i.map,arcgisMapView:i,layerId:e,fields:t,colorSchemes:r,includeSize:o})}var Ut=d.object({layerId:d.string().describe("The id of the layer to apply the predominance renderer to"),fields:d.array(d.string()).describe("The fields to use for the predominance renderer (competing categories)"),colorSchemes:d.array(d.string()).optional().describe("Optional color scheme tags to use"),includeSize:d.boolean().optional().describe("Whether to include size visualization (predominance-size)")}),Za=g(Kt,{name:"predominance",description:`Label: Predominant category
45
45
  Description: Compare attributes that share a common subject and unit of measurement to see which has the highest value.
46
46
  Keywords: predominant, winner, won, competing, most, most common, most frequent, dominant, prevalent, top
47
47
  Example: Using fields for Corn Acres, Wheat Acres, and Cotton Acres, show the predominant crop harvested in each area.
@@ -51,15 +51,15 @@ Fields: This typically requires zero or one field of type number.`,schema:Qt});f
51
51
  Description: Compare attributes that share a common subject and unit of measurement to see which has the highest value. Also varies the size of each symbol based on the total of all categories.
52
52
  Keywords: predominant, winner, won, competing, most, most common, most frequent, dominant, prevalent, top, amount, total, how much, proportional size, graduated size, sum
53
53
  Example: Show the predominant crop in each area and vary the size of each symbol based on the total of all categories.
54
- Fields: This style relies on 2-10 number fields.`,schema:Ut});function Ht(e){let{fields:t,layer:r,view:o,colorSchemeTags:a}=e,i,s={field:t[0]},n={field:t[1]};return a&&(i=Xe({geometryType:r.geometryType,includedTags:a})[0]),{layer:r,view:o,field1:s,field2:n,outlineOptimizationEnabled:!0,sizeOptimizationEnabled:!0,relationshipScheme:i}}async function Wt(e){return await Ye(e)}async function Jt({arcgisMap:e,arcgisMapView:t,layerId:r,fields:o,colorSchemes:a}){let i=t,s=e?.allLayers.find(c=>c.id===r);if(!s)return`Could not find layer for id: ${r}`;let n={styleName:"relationship",fields:o,layer:s,view:i,colorSchemeTags:a};try{let c=Ht(n),l=await Wt(c);return s.renderer=l.renderer,s.visible=!0,`Relationship renderer applied to layer: ${s.title??s.id} using fields ${o.join(", ")}`}catch(c){return`Error applying relationship renderer: ${c instanceof Error?c.message:String(c)}`}}async function Zt({layerId:e,fields:t,colorSchemes:r},o){let{mapView:a}=v(o);return await T({type:"show-legend",data:{layerIds:[e]}},o),await Jt({arcgisMap:a.map,arcgisMapView:a,layerId:e,fields:t,colorSchemes:r})}var Yt=d.object({layerId:d.string().describe("The id of the layer to apply the relationship renderer to"),fields:d.array(d.string()).describe("The two fields to use for the relationship renderer (bivariate visualization)"),colorSchemes:d.array(d.string()).optional().describe("Optional color scheme tags to use")}),Xa=g(Zt,{name:"relationship",description:`Label: Relationship
54
+ Fields: This style relies on 2-10 number fields.`,schema:Ut});function Ht(e){let{fields:t,layer:r,view:o,colorSchemeTags:a}=e,i,s={field:t[0]},n={field:t[1]};return a&&(i=Ye({geometryType:r.geometryType,includedTags:a})[0]),{layer:r,view:o,field1:s,field2:n,outlineOptimizationEnabled:!0,sizeOptimizationEnabled:!0,relationshipScheme:i}}async function Jt(e){return await Xe(e)}async function Wt({arcgisMap:e,arcgisMapView:t,layerId:r,fields:o,colorSchemes:a}){let i=t,s=e?.allLayers.find(c=>c.id===r);if(!s)return`Could not find layer for id: ${r}`;let n={styleName:"relationship",fields:o,layer:s,view:i,colorSchemeTags:a};try{let c=Ht(n),l=await Jt(c);return s.renderer=l.renderer,s.visible=!0,`Relationship renderer applied to layer: ${s.title??s.id} using fields ${o.join(", ")}`}catch(c){return`Error applying relationship renderer: ${c instanceof Error?c.message:String(c)}`}}async function Zt({layerId:e,fields:t,colorSchemes:r},o){let{mapView:a}=v(o);return await T({type:"show-legend",data:{layerIds:[e]}},o),await Wt({arcgisMap:a.map,arcgisMapView:a,layerId:e,fields:t,colorSchemes:r})}var Xt=d.object({layerId:d.string().describe("The id of the layer to apply the relationship renderer to"),fields:d.array(d.string()).describe("The two fields to use for the relationship renderer (bivariate visualization)"),colorSchemes:d.array(d.string()).optional().describe("Optional color scheme tags to use")}),Xa=g(Zt,{name:"relationship",description:`Label: Relationship
55
55
  Description: Overlays two color ramps to represent the relationship between two numeric attributes.
56
56
  Keywords: relationship, correlation, compare, related, bivariate choropleth, bivariate color
57
57
  Example: Show the relationship between tree height and carbon storage
58
- Fields: This style requires two number fields.`,schema:Yt});function Xt(e){let{fields:t,layer:r,view:o,theme:a}=e,i=t[0];return{layer:r,view:o,startTime:i,endTime:new Date,theme:a,sizeOptimizationEnabled:!0,outlineOptimizationEnabled:!0}}async function er(e){return await et(e)}async function tr({arcgisMap:e,arcgisMapView:t,layerId:r,fields:o,colorSchemes:a,theme:i}){let s=t,n=e?.allLayers.find(l=>l.id===r);if(!n)return`Could not find layer for id: ${r}`;let c={styleName:"size-age",fields:o,layer:n,view:s,colorSchemeTags:a,theme:i};try{let l=Xt(c),u=await er(l);return n.renderer=u.renderer,n.visible=!0,`Size-age renderer applied to layer: ${n.title??n.id} using fields ${o.join(", ")}`}catch(l){return`Error applying size-age renderer: ${l instanceof Error?l.message:String(l)}`}}async function rr({layerId:e,fields:t,colorSchemes:r,theme:o},a){let{mapView:i}=v(a);return await T({type:"show-legend",data:{layerIds:[e]}},a),await tr({arcgisMap:i.map,arcgisMapView:i,layerId:e,fields:t,colorSchemes:r,theme:o})}var or=d.object({layerId:d.string().describe("The id of the layer to apply the size-age renderer to"),fields:d.array(d.string()).describe("The field(s) to use for the size-age renderer (temporal data with size)"),colorSchemes:d.array(d.string()).optional().describe("Optional color scheme tags to use"),theme:d.enum(["above-and-below","above","below","centered-on","extremes","high-to-low"]).optional().describe("Optional theme for the size ramp")}),en=g(rr,{name:"size-age",description:`Label: Age (size)
58
+ Fields: This style requires two number fields.`,schema:Xt});function Yt(e){let{fields:t,layer:r,view:o,theme:a}=e,i=t[0];return{layer:r,view:o,startTime:i,endTime:new Date,theme:a,sizeOptimizationEnabled:!0,outlineOptimizationEnabled:!0}}async function er(e){return await et(e)}async function tr({arcgisMap:e,arcgisMapView:t,layerId:r,fields:o,colorSchemes:a,theme:i}){let s=t,n=e?.allLayers.find(l=>l.id===r);if(!n)return`Could not find layer for id: ${r}`;let c={styleName:"size-age",fields:o,layer:n,view:s,colorSchemeTags:a,theme:i};try{let l=Yt(c),u=await er(l);return n.renderer=u.renderer,n.visible=!0,`Size-age renderer applied to layer: ${n.title??n.id} using fields ${o.join(", ")}`}catch(l){return`Error applying size-age renderer: ${l instanceof Error?l.message:String(l)}`}}async function rr({layerId:e,fields:t,colorSchemes:r,theme:o},a){let{mapView:i}=v(a);return await T({type:"show-legend",data:{layerIds:[e]}},a),await tr({arcgisMap:i.map,arcgisMapView:i,layerId:e,fields:t,colorSchemes:r,theme:o})}var or=d.object({layerId:d.string().describe("The id of the layer to apply the size-age renderer to"),fields:d.array(d.string()).describe("The field(s) to use for the size-age renderer (temporal data with size)"),colorSchemes:d.array(d.string()).optional().describe("Optional color scheme tags to use"),theme:d.enum(["above-and-below","above","below","centered-on","extremes","high-to-low"]).optional().describe("Optional theme for the size ramp")}),Ya=g(rr,{name:"size-age",description:`Label: Age (size)
59
59
  Description: Vary symbol sizes along a continuous ramp to represent the age of features. Age reflects the length of time from a start date to an end date.
60
60
  Keywords: since, age, how old, how long
61
61
  Example: Change the size of features so older features are larger than new features.
62
- Fields: This style requires at least one field with a date type.`,schema:or});function ar(e){let{fields:t,layer:r,view:o}=e,{theme:a}=e,i=t[1],s=t[0];return{layer:r,view:o,field:s,normalizationField:i,theme:a,sizeOptimizationEnabled:!0,outlineOptimizationEnabled:!0}}async function nr(e){return await tt(e)}async function ir({arcgisMap:e,arcgisMapView:t,layerId:r,fields:o,colorSchemes:a,theme:i}){let s=t,n=e?.allLayers.find(l=>l.id===r);if(!n)return`Could not find layer for id: ${r}`;let c={styleName:"size",fields:o,layer:n,view:s,colorSchemeTags:a,theme:i};try{let l=ar(c),u=await nr(l);return n.renderer=u.renderer,n.visible=!0,`Size renderer applied to layer: ${n.title??n.id} using fields ${o.join(", ")}`}catch(l){return`Error applying size renderer: ${l instanceof Error?l.message:String(l)}`}}async function sr({layerId:e,fields:t,colorSchemes:r,theme:o},a){let{mapView:i}=v(a);return await T({type:"show-legend",data:{layerIds:[e]}},a),await ir({arcgisMap:i.map,arcgisMapView:i,layerId:e,fields:t,colorSchemes:r,theme:o})}var lr=d.object({layerId:d.string().describe("The id of the layer to apply the size renderer to"),fields:d.array(d.string()).describe("The field(s) to use for the size renderer (numeric data)"),colorSchemes:d.array(d.string()).optional().describe("Optional color scheme tags to use"),theme:d.enum(["above-and-below","above","below","centered-on","extremes","high-to-low"]).optional().describe("Optional theme for the size ramp")}),tn=g(sr,{name:"size",description:`Label: Counts and Amounts (size)
62
+ Fields: This style requires at least one field with a date type.`,schema:or});function ar(e){let{fields:t,layer:r,view:o}=e,{theme:a}=e,i=t[1],s=t[0];return{layer:r,view:o,field:s,normalizationField:i,theme:a,sizeOptimizationEnabled:!0,outlineOptimizationEnabled:!0}}async function nr(e){return await tt(e)}async function ir({arcgisMap:e,arcgisMapView:t,layerId:r,fields:o,colorSchemes:a,theme:i}){let s=t,n=e?.allLayers.find(l=>l.id===r);if(!n)return`Could not find layer for id: ${r}`;let c={styleName:"size",fields:o,layer:n,view:s,colorSchemeTags:a,theme:i};try{let l=ar(c),u=await nr(l);return n.renderer=u.renderer,n.visible=!0,`Size renderer applied to layer: ${n.title??n.id} using fields ${o.join(", ")}`}catch(l){return`Error applying size renderer: ${l instanceof Error?l.message:String(l)}`}}async function sr({layerId:e,fields:t,colorSchemes:r,theme:o},a){let{mapView:i}=v(a);return await T({type:"show-legend",data:{layerIds:[e]}},a),await ir({arcgisMap:i.map,arcgisMapView:i,layerId:e,fields:t,colorSchemes:r,theme:o})}var lr=d.object({layerId:d.string().describe("The id of the layer to apply the size renderer to"),fields:d.array(d.string()).describe("The field(s) to use for the size renderer (numeric data)"),colorSchemes:d.array(d.string()).optional().describe("Optional color scheme tags to use"),theme:d.enum(["above-and-below","above","below","centered-on","extremes","high-to-low"]).optional().describe("Optional theme for the size ramp")}),en=g(sr,{name:"size",description:`Label: Counts and Amounts (size)
63
63
  Description: Vary symbol sizes along a continuous ramp to represent numeric or ranked data.
64
64
  Keywords: graduated size, proportional size, how much, total, number, amount, size
65
65
  Example: Vary the size of each point based on the total population.
@@ -69,27 +69,27 @@ Fields: This typically requires zero or one field of type number.`,schema:Qt});f
69
69
  Description: Vary symbol sizes along a continuous ramp to represent dates.
70
70
  Keywords: graduated size, proportional size, classed size, how much, total, number, when
71
71
  Example: Vary the size of each feature based on the date a ticket was completed.
72
- Fields: This style requires a single field with a date type.`,schema:lr});function cr(e){let{fields:t,layer:r,view:o,colorSchemeTags:a}=e,i=t[0],s=t[1],n=t[2],c;return a&&(c=ot({geometryType:r.geometryType,includedTags:a})[0]),{layer:r,view:o,field:i,field2:s,field3:n,outlineOptimizationEnabled:!0,sizeOptimizationEnabled:!0,typeScheme:c}}async function dr(e){return await rt(e)}async function ur({arcgisMap:e,arcgisMapView:t,layerId:r,fields:o,colorSchemes:a,theme:i}){let s=t,n=e?.allLayers.find(l=>l.id===r);if(!n)return`Could not find layer for id: ${r}`;let c={styleName:"type",fields:o,layer:n,view:s,colorSchemeTags:a,theme:i};try{let l=cr(c),u=await dr(l);return n.renderer=u.renderer,n.visible=!0,`Type renderer applied to layer: ${n.title??n.id} using fields ${o.join(", ")}`}catch(l){return`Error applying type renderer: ${l instanceof Error?l.message:String(l)}`}}async function pr({layerId:e,fields:t,colorSchemes:r,theme:o},a){let{mapView:i}=v(a);return await T({type:"show-legend",data:{layerIds:[e]}},a),await ur({arcgisMap:i.map,arcgisMapView:i,layerId:e,fields:t,colorSchemes:r,theme:o})}var mr=d.object({layerId:d.string().describe("The id of the layer to apply the type renderer to"),fields:d.array(d.string()).describe("The field(s) to use for the type renderer (categorical data)"),colorSchemes:d.array(d.string()).optional().describe("Optional color scheme tags to use"),theme:d.enum(["above-and-below","above","below","centered-on","extremes","high-to-low"]).optional().describe("Optional theme for the color scheme")}),rn=g(pr,{name:"type",description:`Label: Types (unique symbols)
72
+ Fields: This style requires a single field with a date type.`,schema:lr});function cr(e){let{fields:t,layer:r,view:o,colorSchemeTags:a}=e,i=t[0],s=t[1],n=t[2],c;return a&&(c=ot({geometryType:r.geometryType,includedTags:a})[0]),{layer:r,view:o,field:i,field2:s,field3:n,outlineOptimizationEnabled:!0,sizeOptimizationEnabled:!0,typeScheme:c}}async function dr(e){return await rt(e)}async function ur({arcgisMap:e,arcgisMapView:t,layerId:r,fields:o,colorSchemes:a,theme:i}){let s=t,n=e?.allLayers.find(l=>l.id===r);if(!n)return`Could not find layer for id: ${r}`;let c={styleName:"type",fields:o,layer:n,view:s,colorSchemeTags:a,theme:i};try{let l=cr(c),u=await dr(l);return n.renderer=u.renderer,n.visible=!0,`Type renderer applied to layer: ${n.title??n.id} using fields ${o.join(", ")}`}catch(l){return`Error applying type renderer: ${l instanceof Error?l.message:String(l)}`}}async function pr({layerId:e,fields:t,colorSchemes:r,theme:o},a){let{mapView:i}=v(a);return await T({type:"show-legend",data:{layerIds:[e]}},a),await ur({arcgisMap:i.map,arcgisMapView:i,layerId:e,fields:t,colorSchemes:r,theme:o})}var hr=d.object({layerId:d.string().describe("The id of the layer to apply the type renderer to"),fields:d.array(d.string()).describe("The field(s) to use for the type renderer (categorical data)"),colorSchemes:d.array(d.string()).optional().describe("Optional color scheme tags to use"),theme:d.enum(["above-and-below","above","below","centered-on","extremes","high-to-low"]).optional().describe("Optional theme for the color scheme")}),tn=g(pr,{name:"type",description:`Label: Types (unique symbols)
73
73
  Description: Represent features as categories with different symbol colors or shapes. Examples include type of tree, road class, or province name.
74
74
  Keywords: categorical, category, type, unique, discrete, point of interest, region, group
75
75
  Example: Color each feature based on the region it belongs to
76
- Fields: This style requires a single field which may be a string, number, or date type. It is usually a string.`,schema:mr}),on=y.Root({...R(),vectorSearchLayerIds:y(),vectorSearchFieldResults:y(),layerFieldInfo:y(),selectedLayerId:y()}),an=y.Root({...R(),helpInternalState:y({reducer:I,default:()=>({toolCallMessage:void 0})})}),nn=y.Root({...R(),intent:y({reducer:(e,t)=>t}),arcgisKnowledgeMessages:y({reducer:A,default:()=>[]}),arcgisKnowledgeToolResult:y({reducer:(e,t)=>t,default:()=>null})});function oe(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 x(e){return!!e?.map&&"activeLinkChartLayer"in e.map}async function Q(e){!x(e)||!e.map.diagramNodesExtent||await e.goTo(e.map.diagramNodesExtent)}function q(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)&&oe(r),{view:r}}function sn(e){let t=e?.configurable?.context;if($e(e)==="knowledgeGraph")return"knowledgeGraph";let r=t.view;return x(r)?"linkChart":(oe(r),"map")}async function z(e){let t=e?.configurable?.context;if($e(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 Ee(o)}}else{oe(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 Ee(o)}}}}function $e(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 H=class{constructor(t){this.dataModel=t,this.kind="GraphQueryGenerationRequest",this.explainQuery=!0,this.schemaInformation=W.fromDataModel(t)}},W=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(C.fromEntityType(o));for(let o of t.relationshipTypes)r.relationshipTypes.push(J.fromRelationshipType(o));return r.identifierInfo={mappingInfo:{identifierMapsTo:hr(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}.
77
- Relationship Types: ${o}.`}},C=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=yr(t.role);for(let o of t.properties){let a={name:o.name,alias:o.alias?o.alias:void 0,fieldType:o.fieldType,role:fr(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}},J=class extends C{constructor(){super(...arguments),this.observedEndPoints=[]}static fromRelationshipType(t){let r=C.fromEntityType(t);r.observedEndPoints=[];for(let o of t.endPoints)r.observedEndPoints.push({originEntityType:o.originEntityType,destinationEntityType:o.destinationEntityType});return r}},hr=e=>{switch(e){case"esriIdentifierInfoTypeUNSPECIFIED":return"UNSPECIFIED";case"esriIdentifierInfoTypeDatabaseNative":return"DatabaseNative";case"esriIdentifierInfoTypeUniformProperty":return"UniformPropertyIdentifier";default:return e}},yr=e=>{switch(e){case"Regular":return"esriGraphNamedObjectRegular";case"Provenance":return"esriGraphNamedObjectProvenance";case"Document":return"esriGraphNamedObjectDocument";default:return e}};function fr(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 G(e){return e?.signal}async function gr(e,t){let r=await L("arcgis_knowledge_cypher_query_prompt");return t?`${e} ${r}
76
+ Fields: This style requires a single field which may be a string, number, or date type. It is usually a string.`,schema:hr}),rn=y.Root({...R(),vectorSearchLayerIds:y(),vectorSearchFieldResults:y(),layerFieldInfo:y(),selectedLayerId:y()}),on=y.Root({...R(),helpInternalState:y({reducer:I,default:()=>({toolCallMessage:void 0})})}),an=y.Root({...R(),intent:y({reducer:(e,t)=>t}),arcgisKnowledgeMessages:y({reducer:N,default:()=>[]}),arcgisKnowledgeToolResult:y({reducer:(e,t)=>t,default:()=>null})});function oe(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 x(e){return!!e?.map&&"activeLinkChartLayer"in e.map}async function Q(e){!x(e)||!e.map.diagramNodesExtent||await e.goTo(e.map.diagramNodesExtent)}function q(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)&&oe(r),{view:r}}function nn(e){let t=e?.configurable?.context;if($e(e)==="knowledgeGraph")return"knowledgeGraph";let r=t.view;return x(r)?"linkChart":(oe(r),"map")}async function z(e){let t=e?.configurable?.context;if($e(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 Ee(o)}}else{oe(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 Ee(o)}}}}function $e(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 H=class{constructor(t){this.dataModel=t,this.kind="GraphQueryGenerationRequest",this.explainQuery=!0,this.schemaInformation=J.fromDataModel(t)}},J=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(C.fromEntityType(o));for(let o of t.relationshipTypes)r.relationshipTypes.push(W.fromRelationshipType(o));return r.identifierInfo={mappingInfo:{identifierMapsTo:mr(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}.
77
+ Relationship Types: ${o}.`}},C=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=yr(t.role);for(let o of t.properties){let a={name:o.name,alias:o.alias?o.alias:void 0,fieldType:o.fieldType,role:fr(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}},W=class extends C{constructor(){super(...arguments),this.observedEndPoints=[]}static fromRelationshipType(t){let r=C.fromEntityType(t);r.observedEndPoints=[];for(let o of t.endPoints)r.observedEndPoints.push({originEntityType:o.originEntityType,destinationEntityType:o.destinationEntityType});return r}},mr=e=>{switch(e){case"esriIdentifierInfoTypeUNSPECIFIED":return"UNSPECIFIED";case"esriIdentifierInfoTypeDatabaseNative":return"DatabaseNative";case"esriIdentifierInfoTypeUniformProperty":return"UniformPropertyIdentifier";default:return e}},yr=e=>{switch(e){case"Regular":return"esriGraphNamedObjectRegular";case"Provenance":return"esriGraphNamedObjectProvenance";case"Document":return"esriGraphNamedObjectDocument";default:return e}};function fr(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 G(e){return e?.signal}async function gr(e,t){let r=await L("arcgis_knowledge_cypher_query_prompt");return t?`${e} ${r}
78
78
 
79
79
  Your previous attempt to generate a cypher query failed. See the details below and generate a new cypher query that avoids this error.
80
80
 
81
81
  Attempt Number: ${t.attemptCount}
82
82
  Execution Error: ${t.executionError}
83
83
  Failed Query:
84
- ${t.failedGraphQuery}`:`${e} ${r}`}async function wr(e,t,r,o){let{graphQuery:a,explanation:i}=await ae(e,t,r,o);return{graphQuery:a,explanation:i}}async function ae(e,t,r,o,a){let i={message:await gr(e,a),context:new H(t)},s=G(o);await b({text:"Attempting to generate a cypher query from your prompt..."},o);let n=await Se(`${r}/chat`,{method:"post",body:JSON.stringify(i),headers:{"Content-Type":"application/json",token:ve.findCredential(_.getDefault().url)?.token??""},signal:s});if(n.httpStatus!==200)throw new Error(`Graph query service returned an error: ${n.httpStatus}`,{cause:n.data});let c=!1,l=Date.now(),u=n.data.sequenceNumber,p="",m="",w=1;for(;!c;){await new Promise(f=>setTimeout(f,1e3)),await b({text:`Periodically requesting status of job from ArcGIS AI Services${"...".substring(0,w)}`},o),w=w%3+1;let h=await Se(`${r}/chat`,{method:"post",body:JSON.stringify({conversationId:n.data.conversationId,inquiryId:n.data.inquiryId,ackSequenceNumber:u}),headers:{"Content-Type":"application/json",token:ve.findCredential(_.getDefault().url)?.token??""},signal:s});if(h.httpStatus!==200)throw new Error(`Graph query service polling returned an error: ${h.httpStatus}`,{cause:h.data});if(h.data.context?.kind){if(h.data.context.kind!=="GraphQueryGenerationResponse")throw new Error(`Unexpected response from graph query service polling. Message: ${h.data.message}`,{cause:h.data});p=h.data.context.graphQuery,m=h.data.message||"",c=!0}else if(!h.data.hasMore)c=!0;else if(Date.now()-l>6e4)throw new Error("Graph query service polling timed out after 1 minute.");u=h.data.sequenceNumber}return{graphQuery:p,explanation:m}}function br(e,t){E(e,r=>{t.set(`${r.typeName}__${r.id}`,{id:r.id,typeName:r.typeName})})}function E(e,t){if(!(!e||typeof e!="object")){if(vr(e))for(let r of e.path)E(r,t);else if(Tr(e))t(e);else if(Array.isArray(e))for(let r of e)E(r,t);else if(Sr(e))for(let r of Object.values(e.properties??{}))E(r,t)}}function Tr(e){return!e||typeof e!="object"||Array.isArray(e)?!1:"id"in e&&"typeName"in e}function vr(e){return!e||typeof e!="object"||Array.isArray(e)?!1:e&&"path"in e&&Array.isArray(e.path)}function Sr(e){return!e||typeof e!="object"||Array.isArray(e)||"id"in e?!1:"properties"in e&&typeof e.properties=="object"}function xr(e,t){let r=[],o=[],a=[[t.dataModel.entityTypes,r],[t.dataModel.relationshipTypes,o]];for(let[i,s]of a)for(let n of i){let c=e.getMemberIdsByType(n.name);s.push(...c)}return{entityIds:r,relationshipIds:o}}function Er(e,t){let r={entityIds:new Array,relationshipIds:new Array},o=[],a=e?.allLayers.find(n=>n.type==="knowledge-graph")?.inclusionModeDefinition;if(!a)return{allNamedTypesFullyDynamic:!0,bindParameters:r,nonDynamicTypes:o};let i=[[t.dataModel.entityTypes,r.entityIds],[t.dataModel.relationshipTypes,r.relationshipIds]],s=!0;for(let[n,c]of i)for(let l of n){let u=a.namedTypeDefinitions.get(l.name);if(!u){s=!1,o.push(l.name);continue}if(!u.useAllData){s=!1,o.push(l.name);for(let[p]of u.members||[])c.push(p)}}return{allNamedTypesFullyDynamic:s,bindParameters:r,nonDynamicTypes:o}}var M=3;function Ne(e,t=100){let r={};for(let o of Object.entries(e.properties??{})){let[a,i]=o;typeof i=="string"&&i.length>t?r[a]=`${i.slice(0,t)}... (truncated, original length: ${i.length})`:r[a]=i}return e.properties=r,e}function k(e){return typeof e!="object"||e===null?String(e):"details"in e&&typeof e.details=="object"&&e.details!==null&&"errorMessage"in e.details&&typeof e.details.errorMessage=="string"?e.details.errorMessage:"message"in e&&typeof e.message=="string"?e.message:String(e)}var Mr=async({kg:e,queryParams:t,targetStructure:r,targetStructureReducer:o,requestOptions:a,queryRowLimit:i,queryTimeoutMs:s})=>{let n=null,c=r,l=new AbortController,u=a?.signal,p=()=>{l.abort(u?.reason)};u&&(u.aborted?l.abort(u.reason):u.addEventListener("abort",p,{once:!0}));try{let m=await nt(e,t,a);n=m.resultHeader;let w=m.resultRowsStream.getReader(),h=0,f=Date.now(),S=!1;for(;;){let{done:V,value:Ce}=await w.read();if(V)break;if(!S&&s&&Date.now()-f>s)return l.abort(),{type:"timeout"};for(let qe of Ce){if(h++,i&&h>i)return l.abort(),{type:"success",rowLimitReached:!0,resultHeader:n,processedResult:c};c=o(c,qe)}}}catch(m){return l.signal.aborted?{type:"aborted"}:{type:"error",errorMessage:k(m),error:m}}finally{u?.removeEventListener("abort",p)}return{type:"success",rowLimitReached:!1,resultHeader:n,processedResult:c}};async function Ae({prompt:e,bindParameters:t,kg:r,graphQueryServiceUrl:o,targetStructure:a,targetStructureReducer:i,requestOptions:s,queryRowLimit:n,queryTimeoutMs:c,config:l}){let u;for(let p=1;p<=M;p++){let m;try{m=await ae(e,r.dataModel,o,l,u)}catch(S){return{type:"generation-error",errorMessage:k(S),error:S}}await b({text:`Attempting to execute query: ${m.graphQuery.substring(0,500)}${m.graphQuery.length>500?"...":""}`},l);let w=await _r(m.graphQuery,t),h=await Mr({kg:r,queryParams:new ke({openCypherQuery:m.graphQuery,bindParameters:w}),targetStructure:a,targetStructureReducer:i,requestOptions:s,queryRowLimit:n,queryTimeoutMs:c}),f=h.type==="aborted"?"Query execution was aborted.":h.type==="timeout"?"Query execution timed out.":h.type==="error"?`Query failed with error: ${h.errorMessage}`:"";if(h.type==="success")return{type:"success",graphQuery:m.graphQuery,explanation:m.explanation,rowLimitReached:h.rowLimitReached,resultHeader:h.resultHeader,processedResult:h.processedResult};if(h.type==="aborted")return{type:"aborted",errorMessage:f,graphQuery:m.graphQuery,explanation:m.explanation};if(p>=M)return h.type==="timeout"?{type:"timeout",errorMessage:f,graphQuery:m.graphQuery,explanation:m.explanation}:{type:"execution-error",errorMessage:f,error:h.error,graphQuery:m.graphQuery,explanation:m.explanation};u={failedGraphQuery:m.graphQuery,executionError:f,attemptCount:p},await b({text:`Attempt ${p} failed with error: ${f}. Retrying...`},l)}throw new Error(`Failed to execute generated cypher due to an unexpected error after ${M} attempts.`)}var _r=async(e,t)=>{if(!t)return{};let{bindParameters:r,parseErrors:o}=await lt(e);if(o)return t;let a={};for(let i of r)i in t&&(a[i]=t[i]);return a},kr=async({kg:e,searchQuery:t,typeCategoryFilter:r,namedTypesFilter:o,searchResultLimit:a,requestOptions:i})=>{let s=[],n=[r];r==="both"&&!e.serviceDefinition.serviceCapabilities.searchCapabilities.searchTypeFilterCapabilities.includes("esriTypeBoth")&&(n=["entity","relationship"]);let c=a??1/0;try{for(let l of n){let u=c-s.length;if(u<=0)break;let p=(await it(e,new st({searchQuery:t,typeCategoryFilter:l,namedTypesFilter:o??void 0,num:u}),i)).resultRowsStream.getReader(),m=!1;for(;!m;){let{done:w,value:h}=await p.read();if(w){m=!0;break}for(let f of h)for(let S of f)s.push(S)}}}catch(l){let u=k(l);return i?.signal?.aborted?{type:"aborted",errorMessage:u,error:l}:{type:"error",errorMessage:u,error:l}}return{type:"success",results:s}},Re="IMPORTANT: The generated cypher query must return entire entities and relationships ONLY.";async function Ie({prompt:e,view:t,knowledgeGraph:r,includeReturnEntityAndRelationshipContext:o=!1}){let a=[e];if(o&&a.push(Re),x(t)){let u=await L("arcgis_knowledge_current_lc_context"),p=xr(t.map,r);return a.push(u),{enhancedPrompt:a.join(`
84
+ ${t.failedGraphQuery}`:`${e} ${r}`}async function wr(e,t,r,o){let{graphQuery:a,explanation:i}=await ae(e,t,r,o);return{graphQuery:a,explanation:i}}async function ae(e,t,r,o,a){let i={message:await gr(e,a),context:new H(t)},s=G(o);await b({text:"Attempting to generate a cypher query from your prompt..."},o);let n=await Se(`${r}/chat`,{method:"post",body:JSON.stringify(i),headers:{"Content-Type":"application/json","X-Esri-Authorization":`Bearer ${ve.findCredential(_.getDefault().url)?.token??""}`},signal:s});if(n.httpStatus!==200)throw new Error(`Graph query service returned an error: ${n.httpStatus}`,{cause:n.data});let c=!1,l=Date.now(),u=n.data.sequenceNumber,p="",h="",w=1;for(;!c;){await new Promise(f=>setTimeout(f,1e3)),await b({text:`Periodically requesting status of job from ArcGIS AI Services${"...".substring(0,w)}`},o),w=w%3+1;let m=await Se(`${r}/chat`,{method:"post",body:JSON.stringify({conversationId:n.data.conversationId,inquiryId:n.data.inquiryId,ackSequenceNumber:u}),headers:{"Content-Type":"application/json","X-Esri-Authorization":`Bearer ${ve.findCredential(_.getDefault().url)?.token??""}`},signal:s});if(m.httpStatus!==200)throw new Error(`Graph query service polling returned an error: ${m.httpStatus}`,{cause:m.data});if(m.data.context?.kind){if(m.data.context.kind!=="GraphQueryGenerationResponse")throw new Error(`Unexpected response from graph query service polling. Message: ${m.data.message}`,{cause:m.data});p=m.data.context.graphQuery,h=m.data.message||"",c=!0}else if(!m.data.hasMore)c=!0;else if(Date.now()-l>6e4)throw new Error("Graph query service polling timed out after 1 minute.");u=m.data.sequenceNumber}return{graphQuery:p,explanation:h}}function br(e,t){E(e,r=>{t.set(`${r.typeName}__${r.id}`,{id:r.id,typeName:r.typeName})})}function E(e,t){if(!(!e||typeof e!="object")){if(vr(e))for(let r of e.path)E(r,t);else if(Tr(e))t(e);else if(Array.isArray(e))for(let r of e)E(r,t);else if(Sr(e))for(let r of Object.values(e.properties??{}))E(r,t)}}function Tr(e){return!e||typeof e!="object"||Array.isArray(e)?!1:"id"in e&&"typeName"in e}function vr(e){return!e||typeof e!="object"||Array.isArray(e)?!1:e&&"path"in e&&Array.isArray(e.path)}function Sr(e){return!e||typeof e!="object"||Array.isArray(e)||"id"in e?!1:"properties"in e&&typeof e.properties=="object"}function xr(e,t){let r=[],o=[],a=[[t.dataModel.entityTypes,r],[t.dataModel.relationshipTypes,o]];for(let[i,s]of a)for(let n of i){let c=e.getMemberIdsByType(n.name);s.push(...c)}return{entityIds:r,relationshipIds:o}}function Er(e,t){let r={entityIds:new Array,relationshipIds:new Array},o=[],a=e?.allLayers.find(n=>n.type==="knowledge-graph")?.inclusionModeDefinition;if(!a)return{allNamedTypesFullyDynamic:!0,bindParameters:r,nonDynamicTypes:o};let i=[[t.dataModel.entityTypes,r.entityIds],[t.dataModel.relationshipTypes,r.relationshipIds]],s=!0;for(let[n,c]of i)for(let l of n){let u=a.namedTypeDefinitions.get(l.name);if(!u){s=!1,o.push(l.name);continue}if(!u.useAllData){s=!1,o.push(l.name);for(let[p]of u.members||[])c.push(p)}}return{allNamedTypesFullyDynamic:s,bindParameters:r,nonDynamicTypes:o}}var M=3;function Ae(e,t=100){let r={};for(let o of Object.entries(e.properties??{})){let[a,i]=o;typeof i=="string"&&i.length>t?r[a]=`${i.slice(0,t)}... (truncated, original length: ${i.length})`:r[a]=i}return e.properties=r,e}function k(e){return typeof e!="object"||e===null?String(e):"details"in e&&typeof e.details=="object"&&e.details!==null&&"errorMessage"in e.details&&typeof e.details.errorMessage=="string"?e.details.errorMessage:"message"in e&&typeof e.message=="string"?e.message:String(e)}var Mr=async({kg:e,queryParams:t,targetStructure:r,targetStructureReducer:o,requestOptions:a,queryRowLimit:i,queryTimeoutMs:s})=>{let n=null,c=r,l=new AbortController,u=a?.signal,p=()=>{l.abort(u?.reason)};u&&(u.aborted?l.abort(u.reason):u.addEventListener("abort",p,{once:!0}));try{let h=await nt(e,t,a);n=h.resultHeader;let w=h.resultRowsStream.getReader(),m=0,f=Date.now(),S=!1;for(;;){let{done:V,value:Ce}=await w.read();if(V)break;if(!S&&s&&Date.now()-f>s)return l.abort(),{type:"timeout"};for(let qe of Ce){if(m++,i&&m>i)return l.abort(),{type:"success",rowLimitReached:!0,resultHeader:n,processedResult:c};c=o(c,qe)}}}catch(h){return l.signal.aborted?{type:"aborted"}:{type:"error",errorMessage:k(h),error:h}}finally{u?.removeEventListener("abort",p)}return{type:"success",rowLimitReached:!1,resultHeader:n,processedResult:c}};async function Ne({prompt:e,bindParameters:t,kg:r,graphQueryServiceUrl:o,targetStructure:a,targetStructureReducer:i,requestOptions:s,queryRowLimit:n,queryTimeoutMs:c,config:l}){let u;for(let p=1;p<=M;p++){let h;try{h=await ae(e,r.dataModel,o,l,u)}catch(S){return{type:"generation-error",errorMessage:k(S),error:S}}await b({text:`Attempting to execute query: ${h.graphQuery.substring(0,500)}${h.graphQuery.length>500?"...":""}`},l);let w=await _r(h.graphQuery,t),m=await Mr({kg:r,queryParams:new ke({openCypherQuery:h.graphQuery,bindParameters:w}),targetStructure:a,targetStructureReducer:i,requestOptions:s,queryRowLimit:n,queryTimeoutMs:c}),f=m.type==="aborted"?"Query execution was aborted.":m.type==="timeout"?"Query execution timed out.":m.type==="error"?`Query failed with error: ${m.errorMessage}`:"";if(m.type==="success")return{type:"success",graphQuery:h.graphQuery,explanation:h.explanation,rowLimitReached:m.rowLimitReached,resultHeader:m.resultHeader,processedResult:m.processedResult};if(m.type==="aborted")return{type:"aborted",errorMessage:f,graphQuery:h.graphQuery,explanation:h.explanation};if(p>=M)return m.type==="timeout"?{type:"timeout",errorMessage:f,graphQuery:h.graphQuery,explanation:h.explanation}:{type:"execution-error",errorMessage:f,error:m.error,graphQuery:h.graphQuery,explanation:h.explanation};u={failedGraphQuery:h.graphQuery,executionError:f,attemptCount:p},await b({text:`Attempt ${p} failed with error: ${f}. Retrying...`},l)}throw new Error(`Failed to execute generated cypher due to an unexpected error after ${M} attempts.`)}var _r=async(e,t)=>{if(!t)return{};let{bindParameters:r,parseErrors:o}=await lt(e);if(o)return t;let a={};for(let i of r)i in t&&(a[i]=t[i]);return a},kr=async({kg:e,searchQuery:t,typeCategoryFilter:r,namedTypesFilter:o,searchResultLimit:a,requestOptions:i})=>{let s=[],n=[r];r==="both"&&!e.serviceDefinition.serviceCapabilities.searchCapabilities.searchTypeFilterCapabilities.includes("esriTypeBoth")&&(n=["entity","relationship"]);let c=a??1/0;try{for(let l of n){let u=c-s.length;if(u<=0)break;let p=(await it(e,new st({searchQuery:t,typeCategoryFilter:l,namedTypesFilter:o??void 0,num:u}),i)).resultRowsStream.getReader(),h=!1;for(;!h;){let{done:w,value:m}=await p.read();if(w){h=!0;break}for(let f of m)for(let S of f)s.push(S)}}}catch(l){let u=k(l);return i?.signal?.aborted?{type:"aborted",errorMessage:u,error:l}:{type:"error",errorMessage:u,error:l}}return{type:"success",results:s}},Re="IMPORTANT: The generated cypher query must return entire entities and relationships ONLY.";async function Ie({prompt:e,view:t,knowledgeGraph:r,includeReturnEntityAndRelationshipContext:o=!1}){let a=[e];if(o&&a.push(Re),x(t)){let u=await L("arcgis_knowledge_current_lc_context"),p=xr(t.map,r);return a.push(u),{enhancedPrompt:a.join(`
85
85
 
86
86
  `),bindParameters:p,allNamedTypesFullyDynamic:!1}}let i=t.map,{allNamedTypesFullyDynamic:s,bindParameters:n,nonDynamicTypes:c}=Er(i,r);if(s)return{enhancedPrompt:a.join(`
87
87
 
88
88
  `),bindParameters:n,allNamedTypesFullyDynamic:!0};let l=(await L("arcgis_knowledge_current_map_context")).replaceAll("{nonDynamicTypes}",JSON.stringify(c));return a.push(l),{enhancedPrompt:a.join(`
89
89
 
90
- `),bindParameters:n,allNamedTypesFullyDynamic:s}}async function $r(e,t,r,o,a,i){let{view:s}=a,n=await Ae({prompt:e,bindParameters:t,kg:r,graphQueryServiceUrl:o,targetStructure:new Map,targetStructureReducer:(m,w)=>{for(let h of w)br(h,m);return m},requestOptions:{signal:G(i),timeout:i?.timeout},config:i});if(n.type!=="success"){let m=n.type==="generation-error"?n.errorMessage:`${n.errorMessage} Cypher query: ${n.graphQuery}`;throw new Error(`Failed to add records to the link chart. ${m}`)}let{graphQuery:c,explanation:l,processedResult:u}=n,p=Array.from(u.values());return await b({text:`Query Results parsed into ${p.length} unique relationships and entities. Atempting to add to link chart...`},i),x(s)?(await s.map.addRecords(p),await Q(s),{generatedQuery:c,explanation:l,addedIdTypePairs:p}):(await s?.map?.allLayers.find(m=>m.type==="knowledge-graph")?.addRecords(p),{generatedQuery:c,explanation:l,addedIdTypePairs:p})}var j="addRecords",Nr=d.object({prompt:d.string().describe("The user's inquiry and context required in order to generate a cypher query that will be used to add records to the link chart.")}),Ar=async({prompt:e},t)=>{let{knowledgeGraph:r}=await z(t),o=q(t),{view:a}=o,i=_.getDefault().helperServices,{enhancedPrompt:s,bindParameters:n,allNamedTypesFullyDynamic:c}=await Ie({prompt:e,view:a,knowledgeGraph:r,includeReturnEntityAndRelationshipContext:!0});if(c)return{toolName:j,status:"success",summary:"No records have been added to the map because all data in the knowledge graph is contained in the map.",details:{generatedQuery:"N/A",explanation:"All named types in the knowledge graph are fully dynamic and therefore all data is already contained in the map. No records have been added.",addedIdTypePairs:[]}};try{let{generatedQuery:l,explanation:u,addedIdTypePairs:p}=await $r(s,n,r,`${i.aiAssistantServices.url}${i.aiAssistantServices.graphQueryAssistant}`,o,t);return{toolName:j,status:"success",summary:`Records added successfully. Cypher Query used: ${l}
90
+ `),bindParameters:n,allNamedTypesFullyDynamic:s}}async function $r(e,t,r,o,a,i){let{view:s}=a,n=await Ne({prompt:e,bindParameters:t,kg:r,graphQueryServiceUrl:o,targetStructure:new Map,targetStructureReducer:(h,w)=>{for(let m of w)br(m,h);return h},requestOptions:{signal:G(i),timeout:i?.timeout},config:i});if(n.type!=="success"){let h=n.type==="generation-error"?n.errorMessage:`${n.errorMessage} Cypher query: ${n.graphQuery}`;throw new Error(`Failed to add records to the link chart. ${h}`)}let{graphQuery:c,explanation:l,processedResult:u}=n,p=Array.from(u.values());return await b({text:`Query Results parsed into ${p.length} unique relationships and entities. Atempting to add to link chart...`},i),x(s)?(await s.map.addRecords(p),await Q(s),{generatedQuery:c,explanation:l,addedIdTypePairs:p}):(await s?.map?.allLayers.find(h=>h.type==="knowledge-graph")?.addRecords(p),{generatedQuery:c,explanation:l,addedIdTypePairs:p})}var j="addRecords",Ar=d.object({prompt:d.string().describe("The user's inquiry and context required in order to generate a cypher query that will be used to add records to the link chart.")}),Nr=async({prompt:e},t)=>{let{knowledgeGraph:r}=await z(t),o=q(t),{view:a}=o,i=_.getDefault().helperServices,{enhancedPrompt:s,bindParameters:n,allNamedTypesFullyDynamic:c}=await Ie({prompt:e,view:a,knowledgeGraph:r,includeReturnEntityAndRelationshipContext:!0});if(c)return{toolName:j,status:"success",summary:"No records have been added to the map because all data in the knowledge graph is contained in the map.",details:{generatedQuery:"N/A",explanation:"All named types in the knowledge graph are fully dynamic and therefore all data is already contained in the map. No records have been added.",addedIdTypePairs:[]}};try{let{generatedQuery:l,explanation:u,addedIdTypePairs:p}=await $r(s,n,r,`${i.aiAssistantServices.url}${i.aiAssistantServices.graphQueryAssistant}`,o,t);return{toolName:j,status:"success",summary:`Records added successfully. Cypher Query used: ${l}
91
91
 
92
- Number of records added: ${p.length}`,details:{generatedQuery:l,explanation:u,addedIdTypePairs:p}}}catch(l){let u=k(l);return{toolName:j,status:"error",errorMessage:`Failed to add records to the link chart. ${u}`,error:l}}},ln=g(Ar,{name:j,description:`Adds records (entities or relationships) to the current link chart visualization from an inquiry into the knowledge graph data. The inquiry will retrieve data from the graph database that will serve as the basis for the records to be added to the link chart. The user should have explicitly requested to add records to the current link chart from their prompt. "add to new link chart" is not a valid prompt for this tool.
92
+ Number of records added: ${p.length}`,details:{generatedQuery:l,explanation:u,addedIdTypePairs:p}}}catch(l){let u=k(l);return{toolName:j,status:"error",errorMessage:`Failed to add records to the link chart. ${u}`,error:l}}},sn=g(Nr,{name:j,description:`Adds records (entities or relationships) to the current link chart visualization from an inquiry into the knowledge graph data. The inquiry will retrieve data from the graph database that will serve as the basis for the records to be added to the link chart. The user should have explicitly requested to add records to the current link chart from their prompt. "add to new link chart" is not a valid prompt for this tool.
93
93
 
94
94
  example prompts:
95
95
  - "add all suppliers and the parts they produce to the link chart"
@@ -99,7 +99,7 @@ Number of records added: ${p.length}`,details:{generatedQuery:l,explanation:u,ad
99
99
  - "expand company x through all the buildings it owns"
100
100
  - "connect company x and company y"
101
101
  - "connect all buildings on the link chart"
102
- `,schema:Nr});async function Rr(e,t){return await t.map?.applyLayout(e),await Q(t),{appliedLayout:e}}var Z="applyLayout",Ir=d.object({layout:d.enum(["organic-standard","organic-community","basic-grid","hierarchical-bottom-to-top","radial-root-centric","tree-left-to-right","geographic-organic-standard","chronological-mono-timeline","chronological-multi-timeline"]).describe("The layout mode to apply to the link chart. The value must be one of the following: organic-standard, organic-community, basic-grid, hierarchical-bottom-to-top, radial-root-centric, tree-left-to-right, geographic-organic-standard, chronological-mono-timeline, chronological-multi-timeline")}),Cr=async({layout:e},t)=>{let{view:r}=q(t);if(x(r)){let{appliedLayout:o}=await Rr(e,r);return{toolName:Z,status:"success",summary:`Successfully applied layout: ${o}.`,details:{appliedLayout:o}}}else return{toolName:Z,status:"error",errorMessage:"The applyLayout tool can only be used with a LinkChartView.",error:new Error}},cn=g(Cr,{name:Z,description:"Apply a diagram layout to the link chart",schema:Ir});async function qr(e,t){return t.map?.changeNonspatialDataDisplay(e),await Q(t),{appliedNonspatialDataDisplayMode:e}}var Y="changeNonspatialVisibility",zr=d.object({setting:d.enum(["hidden","visible"]).describe("The setting of nonspatial visibility")}),Dr=async({setting:e},t)=>{let{view:r}=q(t);if(x(r)){let{appliedNonspatialDataDisplayMode:o}=await qr(e,r);return{toolName:Y,status:"success",summary:`Successfully applied nonspatial visibility setting: ${o}.`,details:{appliedNonspatialDataDisplayMode:o}}}else return{toolName:Y,status:"error",errorMessage:"The changeNonspatialVisibility tool can only be used with a LinkChartView.",error:new Error}},dn=g(Dr,{name:Y,description:"Change whether or not nonspatial data is visible in the link chart. The value must be either 'hidden' or 'visible'.",schema:zr});async function Pr(e,t,r,o,a){let i,s="";for(let n=1;n<=M;n++){let{graphQuery:c,explanation:l}=await ae(e,t.dataModel,r,a,i);try{await b({text:`Attempting to create link chart from derived query: ${c}`},a);let u=await at.fromCypherQuery(t,new ke({openCypherQuery:c}));await b({text:"Link chart created successfully, loading..."},a),await u.load();let p=o.map;return o.map=u,await o.when(),await _e.whenOnce(()=>!o.updating),u.entityCount===0&&u.relationshipCount===0?(o.map===u&&(o.map=p),u.destroy(),{type:"error",errorMessage:`Query returned no results. Cypher Query used to create the link chart:
102
+ `,schema:Ar});async function Rr(e,t){return await t.map?.applyLayout(e),await Q(t),{appliedLayout:e}}var Z="applyLayout",Ir=d.object({layout:d.enum(["organic-standard","organic-community","basic-grid","hierarchical-bottom-to-top","radial-root-centric","tree-left-to-right","geographic-organic-standard","chronological-mono-timeline","chronological-multi-timeline"]).describe("The layout mode to apply to the link chart. The value must be one of the following: organic-standard, organic-community, basic-grid, hierarchical-bottom-to-top, radial-root-centric, tree-left-to-right, geographic-organic-standard, chronological-mono-timeline, chronological-multi-timeline")}),Cr=async({layout:e},t)=>{let{view:r}=q(t);if(x(r)){let{appliedLayout:o}=await Rr(e,r);return{toolName:Z,status:"success",summary:`Successfully applied layout: ${o}.`,details:{appliedLayout:o}}}else return{toolName:Z,status:"error",errorMessage:"The applyLayout tool can only be used with a LinkChartView.",error:new Error}},ln=g(Cr,{name:Z,description:"Apply a diagram layout to the link chart",schema:Ir});async function qr(e,t){return t.map?.changeNonspatialDataDisplay(e),await Q(t),{appliedNonspatialDataDisplayMode:e}}var X="changeNonspatialVisibility",zr=d.object({setting:d.enum(["hidden","visible"]).describe("The setting of nonspatial visibility")}),Dr=async({setting:e},t)=>{let{view:r}=q(t);if(x(r)){let{appliedNonspatialDataDisplayMode:o}=await qr(e,r);return{toolName:X,status:"success",summary:`Successfully applied nonspatial visibility setting: ${o}.`,details:{appliedNonspatialDataDisplayMode:o}}}else return{toolName:X,status:"error",errorMessage:"The changeNonspatialVisibility tool can only be used with a LinkChartView.",error:new Error}},cn=g(Dr,{name:X,description:"Change whether or not nonspatial data is visible in the link chart. The value must be either 'hidden' or 'visible'.",schema:zr});async function Pr(e,t,r,o,a){let i,s="";for(let n=1;n<=M;n++){let{graphQuery:c,explanation:l}=await ae(e,t.dataModel,r,a,i);try{await b({text:`Attempting to create link chart from derived query: ${c}`},a);let u=await at.fromCypherQuery(t,new ke({openCypherQuery:c}));await b({text:"Link chart created successfully, loading..."},a),await u.load();let p=o.map;return o.map=u,await o.when(),await _e.whenOnce(()=>!o.updating),u.entityCount===0&&u.relationshipCount===0?(o.map===u&&(o.map=p),u.destroy(),{type:"error",errorMessage:`Query returned no results. Cypher Query used to create the link chart:
103
103
  ${c}
104
104
 
105
105
  Explanation: ${l}`}):(await Q(o),{type:"success",graphQuery:c,explanation:l})}catch(u){let p=k(u);if(n>=M){s=p;break}i={failedGraphQuery:c,executionError:p,attemptCount:n},await b({text:`Attempt ${n} to create link chart failed with error: ${p}. Retrying ...`},a)}}return{type:"error",errorMessage:`Failed to create link chart after ${M} attempts. Last error: ${s}`}}var F="createLinkChart",Or=d.object({prompt:d.string().describe("The user's inquiry and context required in order to generate a cypher query that will be used to create a link chart visualization. Only include information relevant to generating a cypher query. Do not suggest entity types, relationship types or properties. Do not include limits or formatting instructions for the query results unless specifically requested by the user. The prompt should be focused on the data the user wants to see in the link chart, not how to generate it.")}),jr=async({prompt:e},t)=>{let{knowledgeGraph:r}=await z(t),{view:o}=q(t);if(x(o)){let a=_.getDefault().helperServices,i=await Pr(`${e}
@@ -107,33 +107,33 @@ Explanation: ${l}`}):(await Q(o),{type:"success",graphQuery:c,explanation:l})}ca
107
107
  ${Re}`,r,`${a.aiAssistantServices.url}${a.aiAssistantServices.graphQueryAssistant}`,o,t);if(i.type==="error")return{toolName:F,status:"error",errorMessage:i.errorMessage,error:new Error};let{graphQuery:s,explanation:n}=i;return{toolName:F,status:"success",summary:`Link chart created successfully. Cypher Query used to create the link chart:
108
108
  ${s}
109
109
 
110
- Explanation: ${n}`,details:{generatedQuery:s,explanation:n}}}else return{toolName:F,status:"error",errorMessage:"The createLinkChart tool can only be used with a LinkChartView.",error:new Error}},un=g(jr,{name:F,description:"Creates a new link chart visualization from an inquiry into the knowledge graph data. The inquiry will retrieve data from the graph database that will serve as the basis for the new link chart. The user should have explicitly requested the creation of a new link chart from their prompt using language like 'create new link chart' or 'add to new link chart'.",schema:Or}),X="queryGraphData",Fr=d.object({prompt:d.string().describe("The user's inquiry into the knowledge graph, from which a cypher query will be generated and executed to answer the inquiry. Only include entity types, relationship types or properties if they are provided in the user prompt or prior steps. Do not suggest entity types, relationship types or properties. Do not include limits, information on what to return, instructions on how to write the query, or formatting instructions for the query results unless specifically requested by the user.")}),Lr=async({prompt:e},t)=>{let{knowledgeGraph:r}=await z(t),o=_.getDefault().helperServices,a=e,i=null,s=null;try{({view:s}=q(t))}catch{}s&&({enhancedPrompt:a,bindParameters:i}=await Ie({prompt:e,view:s,knowledgeGraph:r,includeReturnEntityAndRelationshipContext:!1}));let n=await Ae({prompt:a,bindParameters:i,kg:r,graphQueryServiceUrl:`${o.aiAssistantServices.url}${o.aiAssistantServices.graphQueryAssistant}`,targetStructure:new Array,targetStructureReducer:(f,S)=>(f.push(S),f),requestOptions:{signal:G(t),timeout:t?.timeout},config:t});if(n.type!=="success"){let f=n.type==="generation-error"?n.errorMessage:`${n.errorMessage} Cypher query: ${n.graphQuery}`;return{toolName:X,status:"error",errorMessage:`Failed to query the knowledge graph. ${f}`,error:"error"in n?n.error:null}}let{graphQuery:c,explanation:l,processedResult:u,resultHeader:p}=n,m=p.headerKeys;for(let f of u)for(let S of f)E(S,V=>Ne(V));let w=50,h=u.slice(0,w).map(f=>JSON.stringify(f));return{toolName:X,status:"success",summary:`To answer the inquiry, the following cypher query was executed against the knowledge graph:
110
+ Explanation: ${n}`,details:{generatedQuery:s,explanation:n}}}else return{toolName:F,status:"error",errorMessage:"The createLinkChart tool can only be used with a LinkChartView.",error:new Error}},dn=g(jr,{name:F,description:"Creates a new link chart visualization from an inquiry into the knowledge graph data. The inquiry will retrieve data from the graph database that will serve as the basis for the new link chart. The user should have explicitly requested the creation of a new link chart from their prompt using language like 'create new link chart' or 'add to new link chart'.",schema:Or}),Y="queryGraphData",Fr=d.object({prompt:d.string().describe("The user's inquiry into the knowledge graph, from which a cypher query will be generated and executed to answer the inquiry. Only include entity types, relationship types or properties if they are provided in the user prompt or prior steps. Do not suggest entity types, relationship types or properties. Do not include limits, information on what to return, instructions on how to write the query, or formatting instructions for the query results unless specifically requested by the user.")}),Lr=async({prompt:e},t)=>{let{knowledgeGraph:r}=await z(t),o=_.getDefault().helperServices,a=e,i=null,s=null;try{({view:s}=q(t))}catch{}s&&({enhancedPrompt:a,bindParameters:i}=await Ie({prompt:e,view:s,knowledgeGraph:r,includeReturnEntityAndRelationshipContext:!1}));let n=await Ne({prompt:a,bindParameters:i,kg:r,graphQueryServiceUrl:`${o.aiAssistantServices.url}${o.aiAssistantServices.graphQueryAssistant}`,targetStructure:new Array,targetStructureReducer:(f,S)=>(f.push(S),f),requestOptions:{signal:G(t),timeout:t?.timeout},config:t});if(n.type!=="success"){let f=n.type==="generation-error"?n.errorMessage:`${n.errorMessage} Cypher query: ${n.graphQuery}`;return{toolName:Y,status:"error",errorMessage:`Failed to query the knowledge graph. ${f}`,error:"error"in n?n.error:null}}let{graphQuery:c,explanation:l,processedResult:u,resultHeader:p}=n,h=p.headerKeys;for(let f of u)for(let S of f)E(S,V=>Ae(V));let w=50,m=u.slice(0,w).map(f=>JSON.stringify(f));return{toolName:Y,status:"success",summary:`To answer the inquiry, the following cypher query was executed against the knowledge graph:
111
111
 
112
112
  \`\`\`cypher
113
113
  ${c}
114
114
  \`\`\`
115
115
 
116
116
  Query Results:
117
- ${h.length} result(s) found.
117
+ ${m.length} result(s) found.
118
118
 
119
- Column Headers: ${m.join(", ")}
119
+ Column Headers: ${h.join(", ")}
120
120
 
121
- ${h.length>w?`Showing top ${w} results:
121
+ ${m.length>w?`Showing top ${w} results:
122
122
 
123
123
  `:`Results:
124
124
 
125
- `}${h.join(`
125
+ `}${m.join(`
126
126
  `)}
127
- `,details:{generatedQuery:c,explanation:l,resultHeader:p,queryResults:u}}},pn=g(Lr,{name:X,description:"Allows users to explore the data in their knowledge graph via cypher query. Generates and executes a cypher query based on the user's inquiry into the knowledge graph, and displays the results in the chat pane without modifying the user's link chart if any. Use this tool when the user is asking an exploratory question about their data as a whole that can be answered via cypher query, for example 'What are the top 5 suppliers by total parts cost?' or 'How many employees do we have in each department?'.",schema:Fr}),ee="generateCypher",Qr=d.object({prompt:d.string().describe("The user's inquiry into the knowledge graph that needs to be translated into a cypher query.")}),Gr=async({prompt:e},t)=>{let{knowledgeGraph:r}=await z(t),o=_.getDefault().helperServices;try{let{graphQuery:a,explanation:i}=await wr(e,r.dataModel,`${o.aiAssistantServices.url}${o.aiAssistantServices.graphQueryAssistant}`,t);return{toolName:ee,status:"success",summary:`Generated Graph Query:
127
+ `,details:{generatedQuery:c,explanation:l,resultHeader:p,queryResults:u}}},un=g(Lr,{name:Y,description:"Allows users to explore the data in their knowledge graph via cypher query. Generates and executes a cypher query based on the user's inquiry into the knowledge graph, and displays the results in the chat pane without modifying the user's link chart if any. Use this tool when the user is asking an exploratory question about their data as a whole that can be answered via cypher query, for example 'What are the top 5 suppliers by total parts cost?' or 'How many employees do we have in each department?'.",schema:Fr}),ee="generateCypher",Qr=d.object({prompt:d.string().describe("The user's inquiry into the knowledge graph that needs to be translated into a cypher query.")}),Gr=async({prompt:e},t)=>{let{knowledgeGraph:r}=await z(t),o=_.getDefault().helperServices;try{let{graphQuery:a,explanation:i}=await wr(e,r.dataModel,`${o.aiAssistantServices.url}${o.aiAssistantServices.graphQueryAssistant}`,t);return{toolName:ee,status:"success",summary:`Generated Graph Query:
128
128
  ${a}
129
129
 
130
- Explanation: ${i}`,details:{generatedQuery:a,explanation:i}}}catch(a){let i=k(a);return{toolName:ee,status:"error",errorMessage:`Failed to generate Cypher query. ${i}`,error:a}}},mn=g(Gr,{name:ee,description:"Generates an Open Cypher query based on the user's prompt which represents an inquiry into the data of the knowledge service and its graph database, attempting to filter based on certain conditions and traverse specified relationships. The generated query should be syntactically correct and optimized for performance.",schema:Qr}),Vr=e=>{let t=e.dataModel,r=new Map;for(let n of t.searchIndexes)if(n.supportedCategory!=="esriTypeMetaEntityProvenance")for(let[c,l]of n.searchProperties.entries()){let u=r.get(c)??new Set;l.propertyNames.forEach(p=>u.add(p)),r.set(c,u)}let o=t.entityTypes.filter(n=>r.has(n.name)),a=t.relationshipTypes.filter(n=>r.has(n.name)),i=`Entity Types:
130
+ Explanation: ${i}`,details:{generatedQuery:a,explanation:i}}}catch(a){let i=k(a);return{toolName:ee,status:"error",errorMessage:`Failed to generate Cypher query. ${i}`,error:a}}},pn=g(Gr,{name:ee,description:"Generates an Open Cypher query based on the user's prompt which represents an inquiry into the data of the knowledge service and its graph database, attempting to filter based on certain conditions and traverse specified relationships. The generated query should be syntactically correct and optimized for performance.",schema:Qr}),Vr=e=>{let t=e.dataModel,r=new Map;for(let n of t.searchIndexes)if(n.supportedCategory!=="esriTypeMetaEntityProvenance")for(let[c,l]of n.searchProperties.entries()){let u=r.get(c)??new Set;l.propertyNames.forEach(p=>u.add(p)),r.set(c,u)}let o=t.entityTypes.filter(n=>r.has(n.name)),a=t.relationshipTypes.filter(n=>r.has(n.name)),i=`Entity Types:
131
131
  ${o.map(({name:n})=>`${n}: [${Array.from(r.get(n)??[]).join(", ")}]`).join(`
132
132
  `)}`,s=`Relationship Types:
133
133
  ${a.map(({name:n})=>`${n}: [${Array.from(r.get(n)??[]).join(", ")}]`).join(`
134
134
  `)}`;return`${i}
135
135
 
136
- ${s}`};async function Br(e,t,r){let o=await L("arcgis_knowledge_lucene_generation_prompt"),a={inquiry:e,dataModelForSearch:Vr(t)},i=d.enum(["entity","relationship","both"]).describe("The graph element category to search against - entity, relationship, or both"),s=d.number().int().positive().nullable().describe("The maximum number of search results to return. Default to 10 if not specified by the user, or set to null if the user specifically requests no limits or all results."),n=d.array(d.enum(t.dataModel.entityTypes.map(l=>l.name).concat(t.dataModel.relationshipTypes.map(l=>l.name)))).min(1),c=d.object({query:d.string().describe("A lucene syntax query string to be executed against the knowledge graph search API"),typeFilters:n.nullable().describe("Nullable list of entity or relationship types from the graph to limit the search to. If set to null, search will execute against all named types with indexed properties in the graph"),typeCategoryFilter:i,resultLimit:s});return await ce({promptText:o,inputVariables:a,schema:c,config:r})}var te="searchGraphData",Kr=d.object({prompt:d.string().describe("The user's inquiry into the knowledge graph, from which a lucene search query will be generated and executed against the graph to return relevant results.")}),Ur=async({prompt:e},t)=>{let{knowledgeGraph:r}=await z(t);await b({text:"Generating search query for the user inquiry"},t);let o=await Br(e,r,t);await b({text:"Executing graph search with generated search query"},t);let a=await kr({kg:r,searchQuery:o.query,typeCategoryFilter:o.typeCategoryFilter,namedTypesFilter:o.typeFilters,searchResultLimit:o.resultLimit,requestOptions:{signal:G(t),timeout:t?.timeout}});if(a.type!=="success")return{toolName:te,status:"error",errorMessage:a.errorMessage,error:"error"in a?a.error:null};for(let n of a.results)E(n,c=>Ne(c));let i=10,s=a.results.slice(0,i);return{toolName:te,status:"success",summary:`To answer the query, the following lucene query was generated and executed:
136
+ ${s}`};async function Br(e,t,r){let o=await L("arcgis_knowledge_lucene_generation_prompt"),a={inquiry:e,dataModelForSearch:Vr(t)},i=d.enum(["entity","relationship","both"]).describe("The graph element category to search against - entity, relationship, or both"),s=d.number().int().positive().nullable().describe("The maximum number of search results to return. Default to 10 if not specified by the user, or set to null if the user specifically requests no limits or all results."),n=d.array(d.enum(t.dataModel.entityTypes.map(l=>l.name).concat(t.dataModel.relationshipTypes.map(l=>l.name)))).min(1),c=d.object({query:d.string().describe("A lucene syntax query string to be executed against the knowledge graph search API"),typeFilters:n.nullable().describe("Nullable list of entity or relationship types from the graph to limit the search to. If set to null, search will execute against all named types with indexed properties in the graph"),typeCategoryFilter:i,resultLimit:s});return await ce({promptText:o,inputVariables:a,schema:c,config:r})}var te="searchGraphData",Kr=d.object({prompt:d.string().describe("The user's inquiry into the knowledge graph, from which a lucene search query will be generated and executed against the graph to return relevant results.")}),Ur=async({prompt:e},t)=>{let{knowledgeGraph:r}=await z(t);await b({text:"Generating search query for the user inquiry"},t);let o=await Br(e,r,t);await b({text:"Executing graph search with generated search query"},t);let a=await kr({kg:r,searchQuery:o.query,typeCategoryFilter:o.typeCategoryFilter,namedTypesFilter:o.typeFilters,searchResultLimit:o.resultLimit,requestOptions:{signal:G(t),timeout:t?.timeout}});if(a.type!=="success")return{toolName:te,status:"error",errorMessage:a.errorMessage,error:"error"in a?a.error:null};for(let n of a.results)E(n,c=>Ae(c));let i=10,s=a.results.slice(0,i);return{toolName:te,status:"success",summary:`To answer the query, the following lucene query was generated and executed:
137
137
  Query: ${o.query}
138
138
  Type Category Filter: ${o.typeCategoryFilter}
139
139
  Named Type Filters: ${o.typeFilters?o.typeFilters.join(", "):"None"}
@@ -153,4 +153,4 @@ ${s}`};async function Br(e,t,r){let o=await L("arcgis_knowledge_lucene_generatio
153
153
  - "Find all references to 'delayed parts shipment'"
154
154
  - "Find all reports authored by someone with the title of 'Researcher'"
155
155
  - "Find the first 5 reports where summary mentions flood zoning near Sacramento, and the organization name is the City of Sacramento Utilities, and tags containing stormwater".
156
- - "Search for all john smiths and show their global ids`,schema:Kr});return{a:O,b:La,c:L,d:ct,e:Qa,f:Ga,g:dt,h:Va,i:Ba,j:Ka,k:Ua,l:Ha,m:Wa,n:Ja,o:Za,p:Ya,q:Xa,r:en,s:tn,t:rn,u:on,v:an,w:nn,x:sn,y:z,z:W,A:ln,B:cn,C:dn,D:un,E:pn,F:mn,G:hn}},"identity/IdentityManager","portal/Portal","request","config","core/reactiveUtils","layers/FeatureLayer","smartMapping/renderers/pieChart","smartMapping/symbology/pieChart","views/support/colorUtils","smartMapping/renderers/color","smartMapping/symbology/color","smartMapping/renderers/univariateColorSize","smartMapping/renderers/dotDensity","smartMapping/symbology/dotDensity","smartMapping/renderers/heatmap","smartMapping/symbology/heatmap","smartMapping/renderers/predominance","smartMapping/symbology/predominance","smartMapping/renderers/relationship","smartMapping/symbology/relationship","smartMapping/renderers/size","smartMapping/renderers/type","smartMapping/symbology/type","WebLinkChart","rest/knowledgeGraph/GraphQueryStreaming","views/LinkChartView","rest/knowledgeGraphService","rest/knowledgeGraph/GraphSearchStreaming","applications/KnowledgeStudio/generalSharedKgUtils",a,c,e,f,h,i)
156
+ - "Search for all john smiths and show their global ids`,schema:Kr});return{a:O,b:Fa,c:L,d:ct,e:La,f:Qa,g:dt,h:Ga,i:Va,j:Ba,k:Ka,l:Ua,m:Ha,n:Ja,o:Wa,p:Za,q:Xa,r:Ya,s:en,t:tn,u:rn,v:on,w:an,x:nn,y:z,z:J,A:sn,B:ln,C:cn,D:dn,E:un,F:pn,G:hn}},"identity/IdentityManager","portal/Portal","request","config","core/reactiveUtils","layers/FeatureLayer","smartMapping/renderers/pieChart","smartMapping/symbology/pieChart","views/support/colorUtils","smartMapping/renderers/color","smartMapping/symbology/color","smartMapping/renderers/univariateColorSize","smartMapping/renderers/dotDensity","smartMapping/symbology/dotDensity","smartMapping/renderers/heatmap","smartMapping/symbology/heatmap","smartMapping/renderers/predominance","smartMapping/symbology/predominance","smartMapping/renderers/relationship","smartMapping/symbology/relationship","smartMapping/renderers/size","smartMapping/renderers/type","smartMapping/symbology/type","WebLinkChart","rest/knowledgeGraph/GraphQueryStreaming","rest/knowledgeGraphService","rest/knowledgeGraph/GraphSearchStreaming","applications/KnowledgeStudio/generalSharedKgUtils",a,c,e,f,h,i)
@@ -1,2 +1,2 @@
1
1
  /* COPYRIGHT Esri - https://js.arcgis.com/5.2/LICENSE.txt */
2
- import"../UZLQALHY.js";var e,a,i,c,u,s,w,l,f,m,p,y;async function r(n,t){if(t in n)return n[t];if("default"in n){let o=await n.default;return typeof o=="object"&&o!==null&&t in o?o[t]:o}throw new Error(`Unable to resolve ${String(t)} from module.`)}function W(n,t){let o={};for(let[b,k]of Object.entries(t))o[b]=h(n,k);return o}function d(n,t){return n.object(W(n,t))}function h(n,t){let o=g(n,t);return t.required===!0?o:o.optional()}function g(n,t){let o=T(n,t);return t.description!==void 0&&(o=o.describe(t.description)),o}function S(n,t){switch(t){case"string":return n.string();case"number":return n.number();case"boolean":return n.boolean()}}function A(n){return n==="string"||n==="number"||n==="boolean"}function T(n,t){switch(t.type){case"string":{if(t.enum!=null){if(t.enum.length===0)throw new Error("String schema field enum must include at least one value.");return n.enum(t.enum)}return n.string()}case"number":return n.number();case"boolean":return n.boolean();case"array":{if(t.itemType==null)throw new Error("Array schema field requires an itemType definition.");return n.array(A(t.itemType)?S(n,t.itemType):g(n,t.itemType))}case"object":{if(t.fields==null)throw new Error("Object schema field requires a fields definition.");return d(n,t.fields)}}}async function L(n){p??=import("../APFZY4PI.js");let t=await p;return d(t.z,n)}async function j(n,t){y??=import("../6NHYXISD.js");let o=await y;return await(await r(o,"sendUXSuggestion"))(n,t)}async function q(n){e??=import("../6KFMRBAA.js");let t=await e,o=await r(t,"FunctionAgent");return new o(n)}async function E(n){a??=import("../J6SZIQJA.js");let t=await a,o=await r(t,"FunctionTool");return new o(n)}async function F(n){i??=import("../EMLOVMD4.js");let t=await i,o=await r(t,"LLMAgent");return new o(n)}async function v(n){c??=import("../KPO4XX6J.js");let t=await c,o=await r(t,"WorkflowAgent");return new o(n)}async function U(n){u??=import("../PSYRZMX2.js");let t=await u,o=await r(t,"ConditionalWorkflow");return new o(n)}async function M(n){s??=import("../4HDDRBIY.js");let t=await s,o=await r(t,"LoopWorkflow");return new o(n)}async function P(n){w??=import("../WP7ORLSB.js");let t=await w,o=await r(t,"ParallelWorkflow");return new o(n)}async function R(n){l??=import("../HMUWQCXU.js");let t=await l,o=await r(t,"RouterWorkflow");return new o(n)}async function X(n){f??=import("../4NJ2FF7H.js");let t=await f,o=await r(t,"SequentialWorkflow");return new o(n)}async function x(n){m??=import("../ZQMBJ6MI.js");let t=await m,o=await r(t,"SwitchWorkflow");return new o(n)}export{U as createConditionalWorkflow,q as createFunctionAgent,E as createFunctionTool,F as createLLMAgent,M as createLoopWorkflow,P as createParallelWorkflow,R as createRouterWorkflow,L as createSchema,X as createSequentialWorkflow,x as createSwitchWorkflow,v as createWorkflowAgent,j as sendUXSuggestion};
2
+ import"../UZLQALHY.js";var e,a,i,c,u,s,w,l,f,m,p,y;async function r(n,t){if(t in n)return n[t];if("default"in n){let o=await n.default;return typeof o=="object"&&o!==null&&t in o?o[t]:o}throw new Error(`Unable to resolve ${String(t)} from module.`)}function W(n,t){let o={};for(let[b,k]of Object.entries(t))o[b]=h(n,k);return o}function d(n,t){return n.object(W(n,t))}function h(n,t){let o=g(n,t);return t.required===!0?o:o.optional()}function g(n,t){let o=T(n,t);return t.description!==void 0&&(o=o.describe(t.description)),o}function S(n,t){switch(t){case"string":return n.string();case"number":return n.number();case"boolean":return n.boolean()}}function A(n){return n==="string"||n==="number"||n==="boolean"}function T(n,t){switch(t.type){case"string":{if(t.enum!=null){if(t.enum.length===0)throw new Error("String schema field enum must include at least one value.");return n.enum(t.enum)}return n.string()}case"number":return n.number();case"boolean":return n.boolean();case"array":{if(t.itemType==null)throw new Error("Array schema field requires an itemType definition.");return n.array(A(t.itemType)?S(n,t.itemType):g(n,t.itemType))}case"object":{if(t.fields==null)throw new Error("Object schema field requires a fields definition.");return d(n,t.fields)}}}async function L(n){p??=import("../APFZY4PI.js");let t=await p;return d(t.z,n)}async function j(n,t){y??=import("../HNL4WZKH.js");let o=await y;return await(await r(o,"sendUXSuggestion"))(n,t)}async function q(n){e??=import("../6KFMRBAA.js");let t=await e,o=await r(t,"FunctionAgent");return new o(n)}async function E(n){a??=import("../J6SZIQJA.js");let t=await a,o=await r(t,"FunctionTool");return new o(n)}async function F(n){i??=import("../EMLOVMD4.js");let t=await i,o=await r(t,"LLMAgent");return new o(n)}async function v(n){c??=import("../OL5656NI.js");let t=await c,o=await r(t,"WorkflowAgent");return new o(n)}async function U(n){u??=import("../PSYRZMX2.js");let t=await u,o=await r(t,"ConditionalWorkflow");return new o(n)}async function M(n){s??=import("../4HDDRBIY.js");let t=await s,o=await r(t,"LoopWorkflow");return new o(n)}async function P(n){w??=import("../WP7ORLSB.js");let t=await w,o=await r(t,"ParallelWorkflow");return new o(n)}async function R(n){l??=import("../HMUWQCXU.js");let t=await l,o=await r(t,"RouterWorkflow");return new o(n)}async function X(n){f??=import("../4NJ2FF7H.js");let t=await f,o=await r(t,"SequentialWorkflow");return new o(n)}async function x(n){m??=import("../ZQMBJ6MI.js");let t=await m,o=await r(t,"SwitchWorkflow");return new o(n)}export{U as createConditionalWorkflow,q as createFunctionAgent,E as createFunctionTool,F as createLLMAgent,M as createLoopWorkflow,P as createParallelWorkflow,R as createRouterWorkflow,L as createSchema,X as createSequentialWorkflow,x as createSwitchWorkflow,v as createWorkflowAgent,j as sendUXSuggestion};
package/dist/cdn/index.js CHANGED
@@ -1,2 +1,2 @@
1
1
  /* COPYRIGHT Esri - https://js.arcgis.com/5.2/LICENSE.txt */
2
- import{p as s,y as e}from"./TMJMDCSA.js";import"./R74ZHFA6.js";import"./UZLQALHY.js";var a=s(e,{"arcgis-assistant":[()=>import("./ZUNLFO6M.js"),"_messages:,assistantAvatarEnabled,awaitingResponse:,awaitingResponseStep:,copyEnabled,description,entryMessage,feedbackEnabled,heading,interrupt:,keepSuggestedPrompts,logEnabled,messages:,orchestrator:,readAloudEnabled,referenceElement,streamingDisabled,suggestedPrompts:,userAvatarEnabled,voiceInputEnabled;clearChatHistory,submitMessage;cancelInterrupt,register,submitInterrupt,unregister"],"arcgis-assistant-agent":[()=>import("./W5G35GO4.js"),"agent:,context:,itemId,workflow:;getContext"],"arcgis-assistant-data-exploration-agent":[()=>import("./3POGAH2X.js"),"referenceElement;;getContext"],"arcgis-assistant-help-agent":[()=>import("./7GMCLVSZ.js"),"referenceElement;;getContext"],"arcgis-assistant-knowledge-agent":[()=>import("./7TXR75RG.js"),"context:,referenceElement,serviceUrl;getContext"],"arcgis-assistant-layer-styling-agent":[()=>import("./ZRESBCJL.js"),"referenceElement;;getContext"],"arcgis-assistant-navigation-agent":[()=>import("./DPALM2OW.js"),"referenceElement;;getContext"],"arcgis-assistant-chat":[()=>import("./NQDOAPE3.js"),"interrupt:,loading,messages:"],"arcgis-assistant-chat-entry":[()=>import("./JWIE3YK3.js"),"_messages:,awaitingResponse,disabled,entryPlaceholder,inputValue,keyboardShortcutsDisabled,messages:,status,voiceInputEnabled;submitMessage"],"arcgis-assistant-interrupt":[()=>import("./MDAKBX7N.js"),"_messages:,message,options:,type"],"arcgis-assistant-interrupt-preview":[()=>import("./HDM2D2GD.js"),"interrupts:"],"arcgis-assistant-message":[()=>import("./TACBKKBI.js"),"_messages:,assistantAvatarEnabled,copyEnabled,feedbackEnabled,footerDisabled,logEnabled,message:,readAloudEnabled"],"arcgis-assistant-message-block":[()=>import("./LYKCYBGB.js"),"block:"],"arcgis-assistant-message-feedback":[()=>import("./M4URMXDS.js"),"_messages:,feedbackEnabled,message:"],"arcgis-assistant-message-footer":[()=>import("./M2L5R4LA.js"),"_messages:,copyEnabled,feedbackEnabled,logEnabled,message:,readAloudEnabled"],"arcgis-assistant-message-loading":[()=>import("./I3ONG4AX.js"),"_messages:,assistantAvatarEnabled,interrupts:,loading,loadingMessage"],"arcgis-assistant-message-log":[()=>import("./AZ5G7YZH.js"),"log:,logEnabled,showLog"],"arcgis-assistant-message-read-aloud":[()=>import("./BPCBE7J6.js"),"_messages:,message:,readAloudEnabled"],"arcgis-assistant-message-text":[()=>import("./IFJM5XEQ.js"),"content,parts:"],"arcgis-assistant-speech-input":[()=>import("./RWWOOC7S.js"),"awaitingResponse,inputValue,language,mode;;clearDraftSession"],"arcgis-assistant-suggested-prompts":[()=>import("./LMPNXXTQ.js"),"_messages:,label,prompts:"],"arcgis-assistant-user-message":[()=>import("./BM3WFHJG.js"),"content,message:,user,userAvatarEnabled"]});a({resourcesUrl:import.meta.url});var t=new CSSStyleSheet;t.replaceSync("@layer{:not([hydrated]):is(arcgis-assistant,arcgis-assistant-agent,arcgis-assistant-data-exploration-agent,arcgis-assistant-help-agent,arcgis-assistant-knowledge-agent,arcgis-assistant-layer-styling-agent,arcgis-assistant-navigation-agent,arcgis-assistant-chat,arcgis-assistant-chat-entry,arcgis-assistant-interrupt,arcgis-assistant-message,arcgis-assistant-message-block,arcgis-assistant-message-feedback,arcgis-assistant-message-footer,arcgis-assistant-message-loading,arcgis-assistant-message-log,arcgis-assistant-message-read-aloud,arcgis-assistant-message-text,arcgis-assistant-speech-input,arcgis-assistant-suggested-prompts,arcgis-assistant-user-message){visibility:hidden}}");document.adoptedStyleSheets=[...document.adoptedStyleSheets,t];window.$arcgis||Object.defineProperty(window,"$arcgis",{configurable:!1,enumerable:!0,writable:!1,value:{}}),((a,r,p,j,i=(a.importMap??={}).imports??={})=>{"agent-utils/index,agent-utils/middlewares/middleware,agent-utils/middlewares/humanInTheLoop,agent-utils/middlewares/trace".split(",").map(e=>i[p+e+j]=i[p+e]=import.meta.resolve("./"+e+j));a.t=(c,...x)=>Promise.all(x.map(x=>x.then?x:(!a?.forceESM&&a?.import||(x=>import(x+".js").then(m=>m.default??m)))("@arcgis/core/"+x))).then(c);r.p=a.t(([m])=>{r.t=m.trackAccess;r.o=m.createObservable;r.c=m.createTrackingTarget;r.r=m.runTracked},"applications/Components/reactiveUtils")})($arcgis,e,"@arcgis/ai-components/",".js")
2
+ import{p as s,y as e}from"./TMJMDCSA.js";import"./R74ZHFA6.js";import"./UZLQALHY.js";var a=s(e,{"arcgis-assistant":[()=>import("./ZUNLFO6M.js"),"_messages:,assistantAvatarEnabled,awaitingResponse:,awaitingResponseStep:,copyEnabled,description,entryMessage,feedbackEnabled,heading,interrupt:,keepSuggestedPrompts,logEnabled,messages:,orchestrator:,readAloudEnabled,referenceElement,streamingDisabled,suggestedPrompts:,userAvatarEnabled,voiceInputEnabled;clearChatHistory,submitMessage;cancelInterrupt,register,submitInterrupt,unregister"],"arcgis-assistant-agent":[()=>import("./W5G35GO4.js"),"agent:,context:,itemId,workflow:;getContext"],"arcgis-assistant-data-exploration-agent":[()=>import("./CF6ZLMFG.js"),"referenceElement;;getContext"],"arcgis-assistant-help-agent":[()=>import("./7XY54M57.js"),"referenceElement;;getContext"],"arcgis-assistant-knowledge-agent":[()=>import("./JKMZQOJQ.js"),"context:,referenceElement,serviceUrl;getContext"],"arcgis-assistant-layer-styling-agent":[()=>import("./B3YSZHAE.js"),"referenceElement;;getContext"],"arcgis-assistant-navigation-agent":[()=>import("./PNFK73E5.js"),"referenceElement;;getContext"],"arcgis-assistant-chat":[()=>import("./NQDOAPE3.js"),"interrupt:,loading,messages:"],"arcgis-assistant-chat-entry":[()=>import("./JWIE3YK3.js"),"_messages:,awaitingResponse,disabled,entryPlaceholder,inputValue,keyboardShortcutsDisabled,messages:,status,voiceInputEnabled;submitMessage"],"arcgis-assistant-interrupt":[()=>import("./MDAKBX7N.js"),"_messages:,message,options:,type"],"arcgis-assistant-interrupt-preview":[()=>import("./HDM2D2GD.js"),"interrupts:"],"arcgis-assistant-message":[()=>import("./TACBKKBI.js"),"_messages:,assistantAvatarEnabled,copyEnabled,feedbackEnabled,footerDisabled,logEnabled,message:,readAloudEnabled"],"arcgis-assistant-message-block":[()=>import("./LYKCYBGB.js"),"block:"],"arcgis-assistant-message-feedback":[()=>import("./M4URMXDS.js"),"_messages:,feedbackEnabled,message:"],"arcgis-assistant-message-footer":[()=>import("./M2L5R4LA.js"),"_messages:,copyEnabled,feedbackEnabled,logEnabled,message:,readAloudEnabled"],"arcgis-assistant-message-loading":[()=>import("./I3ONG4AX.js"),"_messages:,assistantAvatarEnabled,interrupts:,loading,loadingMessage"],"arcgis-assistant-message-log":[()=>import("./AZ5G7YZH.js"),"log:,logEnabled,showLog"],"arcgis-assistant-message-read-aloud":[()=>import("./BPCBE7J6.js"),"_messages:,message:,readAloudEnabled"],"arcgis-assistant-message-text":[()=>import("./IFJM5XEQ.js"),"content,parts:"],"arcgis-assistant-speech-input":[()=>import("./R4GPUHUB.js"),"awaitingResponse,inputValue,language,mode;;clearDraftSession"],"arcgis-assistant-suggested-prompts":[()=>import("./LMPNXXTQ.js"),"_messages:,label,prompts:"],"arcgis-assistant-user-message":[()=>import("./BM3WFHJG.js"),"content,message:,user,userAvatarEnabled"]});a({resourcesUrl:import.meta.url});var t=new CSSStyleSheet;t.replaceSync("@layer{:not([hydrated]):is(arcgis-assistant,arcgis-assistant-agent,arcgis-assistant-data-exploration-agent,arcgis-assistant-help-agent,arcgis-assistant-knowledge-agent,arcgis-assistant-layer-styling-agent,arcgis-assistant-navigation-agent,arcgis-assistant-chat,arcgis-assistant-chat-entry,arcgis-assistant-interrupt,arcgis-assistant-message,arcgis-assistant-message-block,arcgis-assistant-message-feedback,arcgis-assistant-message-footer,arcgis-assistant-message-loading,arcgis-assistant-message-log,arcgis-assistant-message-read-aloud,arcgis-assistant-message-text,arcgis-assistant-speech-input,arcgis-assistant-suggested-prompts,arcgis-assistant-user-message){visibility:hidden}}");document.adoptedStyleSheets=[...document.adoptedStyleSheets,t];window.$arcgis||Object.defineProperty(window,"$arcgis",{configurable:!1,enumerable:!0,writable:!1,value:{}}),((a,r,p,j,i=(a.importMap??={}).imports??={})=>{"agent-utils/index,agent-utils/middlewares/middleware,agent-utils/middlewares/humanInTheLoop,agent-utils/middlewares/trace".split(",").map(e=>i[p+e+j]=i[p+e]=import.meta.resolve("./"+e+j));a.t=(c,...x)=>Promise.all(x.map(x=>x.then?x:(!a?.forceESM&&a?.import||(x=>import(x+".js").then(m=>m.default??m)))("@arcgis/core/"+x))).then(c);r.p=a.t(([m])=>{r.t=m.trackAccess;r.o=m.createObservable;r.c=m.createTrackingTarget;r.r=m.runTracked},"applications/Components/reactiveUtils")})($arcgis,e,"@arcgis/ai-components/",".js")