@arcgis/ai-components 5.2.0-next.1 → 5.2.0-next.10

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (105) hide show
  1. package/dist/agent-utils/LLMAgent.js +22 -22
  2. package/dist/cdn/{DHOVCT6R.js → 2SJAOYZT.js} +1 -1
  3. package/dist/cdn/434TAA3J.js +2 -0
  4. package/dist/cdn/{AMP6IALT.js → 5W7S2RS4.js} +1 -1
  5. package/dist/cdn/64PJB5NU.js +2 -0
  6. package/dist/cdn/{OH64RMOR.js → 6AWNQHCO.js} +2 -2
  7. package/dist/cdn/BIV2IPHH.js +2 -0
  8. package/dist/cdn/CCY4TSBO.js +2 -0
  9. package/dist/cdn/{AO7BQHKC.js → CTSALWEP.js} +1 -1
  10. package/dist/cdn/{NAUXSHIE.js → D2N2NSRQ.js} +2 -2
  11. package/dist/cdn/{3PKJWIC3.js → D3TNNRP4.js} +1 -1
  12. package/dist/cdn/{H7422XUG.js → DOV5ZJ7M.js} +1 -1
  13. package/dist/cdn/EEUCKMU7.js +2 -0
  14. package/dist/cdn/EGHBXLNG.js +2 -0
  15. package/dist/cdn/{GSEPHN3A.js → ETRWZ3MS.js} +31 -29
  16. package/dist/cdn/{S6W6HV4T.js → EWI4V3GQ.js} +10 -10
  17. package/dist/cdn/GTLS44GI.js +2 -0
  18. package/dist/cdn/{YY2SBO3V.js → I6HNBTWY.js} +1 -1
  19. package/dist/cdn/JBHNHHWO.js +3 -0
  20. package/dist/cdn/{FX5JFRDL.js → JOFUPKIB.js} +1 -1
  21. package/dist/cdn/KUEOKIQR.js +2 -0
  22. package/dist/cdn/{FHVXO2WG.js → LKRAPK4A.js} +30 -31
  23. package/dist/cdn/{4HU7735A.js → MODWHY3R.js} +2 -2
  24. package/dist/cdn/NXKKG5TK.js +2 -0
  25. package/dist/cdn/{2AXF774U.js → OBUZ7HBN.js} +1 -1
  26. package/dist/cdn/OIVRK7HT.js +2 -0
  27. package/dist/cdn/{HB5A5R2E.js → RUURNLTP.js} +1 -1
  28. package/dist/cdn/SWOXSJ62.js +2 -0
  29. package/dist/cdn/{ZLXN7NMF.js → T537PKP4.js} +9 -7
  30. package/dist/cdn/{JY6LLOUJ.js → TSZPHE7L.js} +2 -2
  31. package/dist/cdn/VAZNJSKA.js +16 -0
  32. package/dist/cdn/{V2P4AIGG.js → VMXLYWUK.js} +1 -1
  33. package/dist/cdn/{MDVYQQUG.js → VNQN5ZQO.js} +2 -2
  34. package/dist/cdn/WIDTPVSU.js +2 -0
  35. package/dist/cdn/{P6OPJQMC.js → XER22VYQ.js} +1 -1
  36. package/dist/cdn/index.js +1 -1
  37. package/dist/cdn/main.css +1 -1
  38. package/dist/chunks/adapter.js +491 -496
  39. package/dist/chunks/arcgisKnowledgeGraph.js +3 -3
  40. package/dist/chunks/dataExplorationGraph.js +101 -94
  41. package/dist/chunks/generateLayerDescriptions.js +236 -209
  42. package/dist/chunks/helpGraph.js +4 -4
  43. package/dist/chunks/layerStylingGraph.js +10 -10
  44. package/dist/chunks/navigationGraph.js +27 -27
  45. package/dist/chunks/orchestrator.js +240 -201
  46. package/dist/chunks/slottableRequestUtils.js +3 -7
  47. package/dist/chunks/summarize_query_response_prompt.js +9 -7
  48. package/dist/components/arcgis-assistant/customElement.d.ts +15 -0
  49. package/dist/components/arcgis-assistant/customElement.js +227 -127
  50. package/dist/components/arcgis-assistant/index.js +2 -3
  51. package/dist/components/arcgis-assistant/types.d.ts +14 -1
  52. package/dist/components/arcgis-assistant-chat/customElement.d.ts +8 -2
  53. package/dist/components/arcgis-assistant-chat/customElement.js +7 -7
  54. package/dist/components/arcgis-assistant-chat-entry/customElement.d.ts +4 -1
  55. package/dist/components/arcgis-assistant-chat-entry/customElement.js +25 -18
  56. package/dist/components/arcgis-assistant-interrupt/customElement.d.ts +4 -1
  57. package/dist/components/arcgis-assistant-interrupt/customElement.js +13 -9
  58. package/dist/components/arcgis-assistant-interrupt-preview/customElement.js +20 -0
  59. package/dist/components/arcgis-assistant-interrupt-preview/index.js +2 -0
  60. package/dist/components/arcgis-assistant-message/customElement.d.ts +23 -0
  61. package/dist/components/arcgis-assistant-message/customElement.js +28 -26
  62. package/dist/components/arcgis-assistant-message/index.d.ts +1 -0
  63. package/dist/components/arcgis-assistant-message/index.js +2 -0
  64. package/dist/components/arcgis-assistant-message-block/customElement.d.ts +1 -1
  65. package/dist/components/arcgis-assistant-message-block/customElement.js +18 -11
  66. package/dist/components/arcgis-assistant-message-block/index.js +1 -0
  67. package/dist/components/arcgis-assistant-message-feedback/customElement.d.ts +4 -1
  68. package/dist/components/arcgis-assistant-message-footer/customElement.d.ts +4 -1
  69. package/dist/components/arcgis-assistant-message-loading/customElement.d.ts +8 -1
  70. package/dist/components/arcgis-assistant-message-loading/customElement.js +8 -8
  71. package/dist/components/arcgis-assistant-message-loading/index.js +1 -0
  72. package/dist/components/arcgis-assistant-message-log/customElement.d.ts +4 -1
  73. package/dist/components/arcgis-assistant-message-read-aloud/customElement.d.ts +4 -1
  74. package/dist/components/arcgis-assistant-message-text/customElement.d.ts +4 -1
  75. package/dist/components/arcgis-assistant-speech-input/customElement.d.ts +6 -1
  76. package/dist/components/arcgis-assistant-suggested-prompts/customElement.d.ts +4 -1
  77. package/dist/components/arcgis-assistant-suggested-prompts/customElement.js +8 -8
  78. package/dist/components/arcgis-assistant-user-message/customElement.d.ts +4 -1
  79. package/dist/components/arcgis-assistant-user-message/customElement.js +1 -1
  80. package/dist/docs/api.json +1 -1
  81. package/dist/docs/docs.json +1 -1
  82. package/dist/docs/vscode.html-custom-data.json +1 -1
  83. package/dist/docs/web-types.json +1 -1
  84. package/dist/index.d.ts +4 -0
  85. package/dist/loader.js +6 -5
  86. package/dist/types/lumina.d.ts +10 -4
  87. package/dist/types/preact.d.ts +11 -4
  88. package/dist/types/react.d.ts +12 -4
  89. package/dist/types/stencil.d.ts +10 -4
  90. package/dist/utils/index.d.ts +85 -42
  91. package/dist/utils/index.js +22 -18
  92. package/package.json +7 -7
  93. package/dist/cdn/7BCR6TUO.js +0 -2
  94. package/dist/cdn/7GH7VSB2.js +0 -2
  95. package/dist/cdn/7PLV4QH6.js +0 -2
  96. package/dist/cdn/DDLZOMUY.js +0 -2
  97. package/dist/cdn/MH5RPXHM.js +0 -2
  98. package/dist/cdn/NVI3I46B.js +0 -2
  99. package/dist/cdn/OAVEHGB6.js +0 -2
  100. package/dist/cdn/ON2V5XI2.js +0 -3
  101. package/dist/cdn/QR54T33D.js +0 -2
  102. package/dist/cdn/SXDLXCIM.js +0 -2
  103. package/dist/cdn/USMDJUFS.js +0 -2
  104. package/dist/cdn/V5YEZSRY.js +0 -16
  105. package/dist/cdn/Y333DGV6.js +0 -2
@@ -1,9 +1,9 @@
1
1
  /* COPYRIGHT Esri - https://js.arcgis.com/5.2/LICENSE.txt */
2
- import a from"./GSEPHN3A.js";import{Bb as j,L as q,M as ee,R as z,Za as I,_a as h,g as ge,j as V,k as Q,kb as g,qb as be,u as we}from"./462JBSEV.js";export default $arcgis.t(([$e,M,Ce,,Ne,oe,tt,{addressToLocations:rt},ot,at,Re,{createRenderer:nt},{getSchemesByTag:it,getSchemes:st},{getBackgroundColorTheme:ke},{createAgeRenderer:lt,createContinuousRenderer:ct},{getSchemesByTag:pe},{createContinuousRenderer:ut},{createRenderer:dt},{getSchemesByTag:pt},{createRenderer:mt},{getSchemesByTag:ht},{createRenderer:ft},{getSchemesByTag:yt},{createRenderer:gt},{getSchemesByTag:wt},{createAgeRenderer:bt,createContinuousRenderer:vt},{createRenderer:Tt},{getSchemesByTag:St},xt,_e,qe,{formatDateOnly:Et,convertDateFormatToIntlOptions:U,formatTimeOnly:It,formatDate:Fe},$t,Nt,kt,Ft,Mt,ze,,{fetchKnowledgeGraph:Me,executeQueryStreaming:At,executeSearchStreaming:Ct},Rt,{a:i,c:L,d:ve,f:T,g:S,l:Te}])=>{var Ie=e=>Array.isArray(e)&&e.every(q),Ze=e=>typeof e=="object"&&e!=null&&"messages"in e&&Ie(e.messages),Ye=e=>typeof e=="object"&&e!=null&&"lg_tool_call"in e,B=class extends be{tools;handleToolErrors=!0;trace=!1;constructor(e,t){let{name:r,tags:o,handleToolErrors:a}=t??{};super({name:r,tags:o,func:(n,s)=>this.run(n,s)}),this.tools=e,this.handleToolErrors=a??this.handleToolErrors}async runTool(e,t){let r=this.tools.find(o=>o.name===e.name);try{if(r===void 0)throw new Error(`Tool "${e.name}" not found.`);let o=await r.invoke({...e,type:"tool_call"},t);return q(o)&&o.getType()==="tool"||Q(o)?o:new ee({status:"success",name:r.name,content:typeof o=="string"?o:JSON.stringify(o),tool_call_id:e.id})}catch(o){if(!this.handleToolErrors||we(o))throw o;return new ee({status:"error",content:`Error: ${o.message}
3
- Please fix your mistakes.`,name:e.name,tool_call_id:e.id??""})}}async run(e,t){let r;if(Ye(e))r=[await this.runTool(e.lg_tool_call,t)];else{let n;if(Ie(e))n=e;else if(Ze(e))n=e.messages;else throw new Error("ToolNode only accepts BaseMessage[] or { messages: BaseMessage[] } as input.");let s=new Set(n.filter(u=>u.getType()==="tool").map(u=>u.tool_call_id)),l;for(let u=n.length-1;u>=0;u-=1){let c=n[u];if(z(c)){l=c;break}}if(l==null||!z(l))throw new Error("ToolNode only accepts AIMessages as input.");r=await Promise.all(l.tool_calls?.filter(u=>u.id==null||!s.has(u.id)).map(u=>this.runTool(u,t))??[])}if(!r.some(Q))return Array.isArray(e)?r:{messages:r};let o=[],a=null;for(let n of r)Q(n)?n.graph===V.PARENT&&Array.isArray(n.goto)&&n.goto.every(s=>ge(s))?a?a.goto.push(...n.goto):a=new V({graph:V.PARENT,goto:n.goto}):o.push(n):o.push(Array.isArray(e)?[n]:{messages:[n]});return a&&o.push(a),o}};var Fn=g.Root({llmInputMessages:g({reducer:(e,t)=>j([],t),default:()=>[]})});var O=(e,t)=>t??e,ji=g.Root({...ve(),intent:g({reducer:O}),vectorSearchLayerResults:g({reducer:O,default:()=>[]}),vectorSearchFieldResults:g({reducer:O}),navigationInternalState:g({reducer:O,default:()=>({toolCallMessage:void 0})})});async function _t(e,t){let r=M.getDefault().helperServices,o=r.geocode.find(d=>d.name==="ArcGIS World Geocoding Service")??r.geocode[0];if(!o)throw new Error("No geocoding service found in helperServices.");let a=o.url,n=`${oe.assetsPath?.endsWith("/")?oe.assetsPath:`${oe.assetsPath}/`}esri/images/search/search-symbol-32.png`,s=(await rt(a,{address:{SingleLine:e},outFields:["Match_addr"]}))?.[0];if(!s?.extent||!s.location)throw new Error(`Could not find location for: ${e}`);let l=new ot({url:n,width:24,height:24}),u=new tt({geometry:s.location,symbol:l});t.graphics.removeAll(),t.graphics.add(u),await t.goTo(s.extent);let c={address:s.address??"",location:s.location?s.location.toJSON():null,extent:s.extent?s.extent.toJSON():null};return{text:`Successfully zoomed to ${e}.`,sharedStatePatch:{lastResolvedLocation:{value:c}}}}var qt=["mapView"];function $(e){let t=e?.configurable?.context;if(!t||typeof t!="object")throw new Error("NavigationAgent context missing");let r=qt.filter(o=>!(o in t));if(r.length)throw new Error(`NavigationAgent context missing: ${r.join(", ")}`);return t}async function zt({address:e},t){let{mapView:r}=$(t);return await _t(e,r)}var jt=i.object({address:i.string().describe("The full address or place name to locate.")}),Li=h(zt,{name:"goToAddress",description:"Geocodes an address using Esri's World Geocoding Service and zooms the map to that location.",schema:jt});async function Lt(e,t){let r=t.map.bookmarks;if(!r||r.length===0)throw new Error("No bookmarks found in the map.");let o=r.find(n=>n.name===e);if(!o)throw new Error(`Bookmark with name "${e}" not found.`);let a=o.viewpoint;if(!a)throw new Error(`Bookmark with name "${e}" does not have a valid viewpoint.`);return await t.goTo(a),{text:`Navigated to bookmark: ${e}`}}async function Ot({bookmarkName:e},t){let{mapView:r}=$(t);return await Promise.resolve(Lt(e,r))}var Dt=I.object({bookmarkName:I.string().describe("The name of the bookmark to navigate to.")}),Oi=h(Ot,{name:"goToBookmark",description:"Go to the extent of the bookmark with the given name.",schema:Dt});async function Pt(e,t,r){let o=r.map?.allLayers.find(s=>s.id===e);if(!o)return{text:`Error: Layer with id ${e} not found`};let a=t?.trim()?t:"1=1",n=o.createQuery();n.where=a;try{let{extent:s,count:l}=await o.queryExtent(n);if(l===0)return{text:`No features found in ${o.title} matching: ${a}`,where:a};if(s)await r.goTo(s);else return{text:`Error: Unable to determine extent for ${o.title}`,where:a};let u={layerId:e,layerTitle:o.title??e,where:a,count:l};return{text:`Successfully zoomed to ${l} feature(s) in ${o.title} matching: ${a}`,where:a,sharedStatePatch:{lastNavigatedFeatures:{value:u}}}}catch(s){return console.error("Error in goToFeatures:",s),{text:`Error: ${s instanceof Error?s.message:"Unknown error"}`,where:a}}}async function Gt({layerId:e,where:t},r){let{mapView:o}=$(r);return await Pt(e,t,o)}var Vt=I.object({layerId:I.string().describe("The layerId of the layer to zoom to."),where:I.string().describe("The sql-92 where clause used to query features to zoom to")}),Di=h(Gt,{name:"goToFeatures",description:"Go to the features that match the given filter related to the given layerId.",schema:Vt});async function Qt(e){let t=new at({xmin:-180,ymin:-90,xmax:180,ymax:90,spatialReference:{wkid:4326}}).expand(.7);return await e.goTo(t),{text:"Successfully zoomed to world extent"}}async function Bt(e,t){let{mapView:r}=$(t);return await Qt(r)}var Ut=I.object({}),Pi=h(Bt,{name:"goToFullExtent",description:"Zooms the map to the full world extent using Esri's Geocoding Service.",schema:Ut});async function Kt(e){let t=e.map.initialViewProperties?.viewpoint?.targetGeometry;if(t)await e.goTo(t);else throw new Error("Initial extent is undefined");return{text:"Successfully zoomed to home extent"}}async function Wt(e,t){let{mapView:r}=$(t);return await Kt(r)}var Ht=i.object({}),Gi=h(Wt,{name:"goToHomeExtent",description:"Go to the initial web map view extent",schema:Ht});async function Jt(e,t){await t.when();let r=t.map?.allLayers.find(a=>a.id===e);if(!r)return console.warn(`[goToLayer] No matching FeatureLayer found for: ${e}`),{text:`Could not find layer for: ${e}`};let o;return(r.type==="link-chart"||r.type==="knowledge-graph-sublayer")&&t.map?.activeLinkChartLayer?o=t.map.diagramNodesExtent:o=r.fullExtent,o?(await t.goTo(o),r.visible=!0,{text:`Successfully zoomed to: ${r.title??""}`}):{text:"Layer has no defined extent. Cannot zoom to layer."}}async function Zt({layerId:e},t){let{mapView:r}=$(t);return await Jt(e,r)}var Yt=I.object({layerId:I.string().describe("The id of the layer to navigate to")}),Vi=h(Zt,{name:"goToLayer",description:"Zooms the map view to the full extent of the top matching layer.",schema:Yt});async function Xt(e,t){return await t.goTo({scale:e}),{text:`Successfully zoomed to: ${e}`}}async function er({scale:e},t){let{mapView:r}=$(t);return await Xt(e,r)}var tr=i.object({scale:i.number().describe("The map scale of the view to go to.")}),Qi=h(er,{name:"goToScale",description:"Go to the specified view scale.",schema:tr});async function rr(e,t,r){let o={target:new Re({longitude:e.longitude,latitude:e.latitude,spatialReference:{wkid:4326}})};return r?.zoom!==void 0&&(o.zoom=r.zoom),r?.scale!==void 0&&(o.scale=r.scale),await t.goTo(o),{text:`Successfully navigated to: ${[`(${e.latitude}\xB0, ${e.longitude}\xB0)`,r?.zoom!==void 0?`zoom ${r.zoom}`:"",r?.scale!==void 0?`scale 1:${r.scale}`:""].filter(Boolean).join(", ")}`}}async function or({center:e,zoom:t,scale:r},o){let{mapView:a}=$(o);return await rr(e,a,{zoom:t,scale:r})}var ar=i.object({center:i.object({longitude:i.number().describe("The longitude (x-coordinate) of the point to navigate to."),latitude:i.number().describe("The latitude (y-coordinate) of the point to navigate to.")}),zoom:i.number().optional().describe("The zoom level. Higher values = more zoomed in."),scale:i.number().optional().describe("The map scale. Alternative to zoom. Smaller numbers = more zoomed in.")}),Bi=h(or,{name:"goToViewpoint",description:"Go to the specified viewpoint. This can contain a combination of scale, center, zoom, etc.",schema:ar});async function nr(e,t){return await t.goTo({zoom:e}),{text:`Successfully zoomed to: ${e}`}}async function ir({zoom:e},t){let{mapView:r}=$(t);return await nr(e,r)}var sr=i.object({zoom:i.number().min(1).max(20).describe("The zoom level of the view to go to.")}),Ui=h(ir,{name:"goToZoom",description:'Go to the specified zoom level. If input is generic (e.g. "zoom in", then only zoom to the next appropriate level - increase level for zooming in and decrease for zooming out.).',schema:sr}),Ae=Object.assign({"../agents/arcgisKnowledge/prompts/arcgis_knowledge_current_lc_context.md":()=>import("./KMQ3SP4I.js").then(e=>e.default),"../agents/arcgisKnowledge/prompts/arcgis_knowledge_current_map_context.md":()=>import("./5QAHYX7Y.js").then(e=>e.default),"../agents/arcgisKnowledge/prompts/arcgis_knowledge_lucene_generation_prompt.md":()=>import("./5ZZGKP7N.js").then(e=>e.default),"../agents/arcgisKnowledge/prompts/arcgis_knowledge_summarize_result_prompt.md":()=>import("./AXDZBBNL.js").then(e=>e.default),"../agents/arcgisKnowledge/prompts/arcgis_knowledge_tool_prompt.md":()=>import("./ZS2TZ6BF.js").then(e=>e.default),"../agents/dataExploration/prompts/data_explore_filter_prompt.md":()=>import("./LQ6R5YRN.js").then(e=>e.default),"../agents/dataExploration/prompts/data_explore_query_prompt.md":()=>import("./X2ZDYHCG.js").then(e=>e.default),"../agents/dataExploration/prompts/summarize_query_response_prompt.md":()=>import("./ZLXN7NMF.js").then(e=>e.default),"../agents/help/prompts/help_prompt.md":()=>import("./F2AHA4GB.js").then(e=>e.default),"../agents/layerStyling/prompts/layer_styling_prompt.md":()=>import("./FX7UOGHP.js").then(e=>e.default),"../agents/navigation/prompts/navigation_intent_prompt.md":()=>import("./NE7E52YR.js").then(e=>e.default),"../agents/navigation/prompts/navigation_tool_prompt.md":()=>import("./6YMR4QSD.js").then(e=>e.default)});async function ne(e){let t=Object.entries(Ae).find(([r])=>r.endsWith(`/${e}.md`));if(!t)throw new Error(`Prompt not found: ${e}
2
+ import a from"./ETRWZ3MS.js";import{Bb as j,L as q,M as ee,R as z,Za as I,_a as h,g as ge,j as V,k as Q,kb as g,qb as be,u as we}from"./462JBSEV.js";export default $arcgis.t(([$e,M,Re,,Ne,oe,rt,{addressToLocations:ot},at,nt,_e,{createRenderer:it},{getSchemesByTag:st,getSchemes:lt},{getBackgroundColorTheme:ke},{createAgeRenderer:ct,createContinuousRenderer:ut},{getSchemesByTag:me},{createContinuousRenderer:dt},{createRenderer:mt},{getSchemesByTag:pt},{createRenderer:ht},{getSchemesByTag:ft},{createRenderer:yt},{getSchemesByTag:gt},{createRenderer:wt},{getSchemesByTag:bt},{createAgeRenderer:vt,createContinuousRenderer:Tt},{createRenderer:St},{getSchemesByTag:xt},Et,qe,ze,{formatDateOnly:It,convertDateFormatToIntlOptions:U,formatTimeOnly:$t,formatDate:Fe},Nt,kt,Ft,Mt,At,je,,{fetchKnowledgeGraph:Me,executeQueryStreaming:Ct,executeSearchStreaming:Rt},_t,{a:i,c:L,d:ve,f:T,g:S,m:Te}])=>{var Ie=e=>Array.isArray(e)&&e.every(q),Ye=e=>typeof e=="object"&&e!=null&&"messages"in e&&Ie(e.messages),Xe=e=>typeof e=="object"&&e!=null&&"lg_tool_call"in e,B=class extends be{tools;handleToolErrors=!0;trace=!1;constructor(e,t){let{name:r,tags:o,handleToolErrors:a}=t??{};super({name:r,tags:o,func:(n,s)=>this.run(n,s)}),this.tools=e,this.handleToolErrors=a??this.handleToolErrors}async runTool(e,t){let r=this.tools.find(o=>o.name===e.name);try{if(r===void 0)throw new Error(`Tool "${e.name}" not found.`);let o=await r.invoke({...e,type:"tool_call"},t);return q(o)&&o.getType()==="tool"||Q(o)?o:new ee({status:"success",name:r.name,content:typeof o=="string"?o:JSON.stringify(o),tool_call_id:e.id})}catch(o){if(!this.handleToolErrors||we(o))throw o;return new ee({status:"error",content:`Error: ${o.message}
3
+ Please fix your mistakes.`,name:e.name,tool_call_id:e.id??""})}}async run(e,t){let r;if(Xe(e))r=[await this.runTool(e.lg_tool_call,t)];else{let n;if(Ie(e))n=e;else if(Ye(e))n=e.messages;else throw new Error("ToolNode only accepts BaseMessage[] or { messages: BaseMessage[] } as input.");let s=new Set(n.filter(u=>u.getType()==="tool").map(u=>u.tool_call_id)),l;for(let u=n.length-1;u>=0;u-=1){let c=n[u];if(z(c)){l=c;break}}if(l==null||!z(l))throw new Error("ToolNode only accepts AIMessages as input.");r=await Promise.all(l.tool_calls?.filter(u=>u.id==null||!s.has(u.id)).map(u=>this.runTool(u,t))??[])}if(!r.some(Q))return Array.isArray(e)?r:{messages:r};let o=[],a=null;for(let n of r)Q(n)?n.graph===V.PARENT&&Array.isArray(n.goto)&&n.goto.every(s=>ge(s))?a?a.goto.push(...n.goto):a=new V({graph:V.PARENT,goto:n.goto}):o.push(n):o.push(Array.isArray(e)?[n]:{messages:[n]});return a&&o.push(a),o}};var Mn=g.Root({llmInputMessages:g({reducer:(e,t)=>j([],t),default:()=>[]})});var O=(e,t)=>t??e,Li=g.Root({...ve(),intent:g({reducer:O}),vectorSearchLayerResults:g({reducer:O,default:()=>[]}),vectorSearchFieldResults:g({reducer:O}),navigationInternalState:g({reducer:O,default:()=>({toolCallMessage:void 0})})});async function qt(e,t){let r=M.getDefault().helperServices,o=r.geocode.find(d=>d.name==="ArcGIS World Geocoding Service")??r.geocode[0];if(!o)throw new Error("No geocoding service found in helperServices.");let a=o.url,n=`${oe.assetsPath?.endsWith("/")?oe.assetsPath:`${oe.assetsPath}/`}esri/images/search/search-symbol-32.png`,s=(await ot(a,{address:{SingleLine:e},outFields:["Match_addr"]}))?.[0];if(!s?.extent||!s.location)throw new Error(`Could not find location for: ${e}`);let l=new at({url:n,width:24,height:24}),u=new rt({geometry:s.location,symbol:l});t.graphics.removeAll(),t.graphics.add(u),await t.goTo(s.extent);let c={address:s.address??"",location:s.location?s.location.toJSON():null,extent:s.extent?s.extent.toJSON():null};return{text:`Successfully zoomed to ${e}.`,sharedStatePatch:{lastResolvedLocation:{value:c}}}}var zt=["mapView"];function $(e){let t=e?.configurable?.context;if(!t||typeof t!="object")throw new Error("NavigationAgent context missing");let r=zt.filter(o=>!(o in t));if(r.length)throw new Error(`NavigationAgent context missing: ${r.join(", ")}`);return t}async function jt({address:e},t){let{mapView:r}=$(t);return await qt(e,r)}var Lt=i.object({address:i.string().describe("The full address or place name to locate.")}),Oi=h(jt,{name:"goToAddress",description:"Geocodes an address using Esri's World Geocoding Service and zooms the map to that location.",schema:Lt});async function Ot(e,t){let r=t.map.bookmarks;if(!r||r.length===0)throw new Error("No bookmarks found in the map.");let o=r.find(n=>n.name===e);if(!o)throw new Error(`Bookmark with name "${e}" not found.`);let a=o.viewpoint;if(!a)throw new Error(`Bookmark with name "${e}" does not have a valid viewpoint.`);return await t.goTo(a),{text:`Navigated to bookmark: ${e}`}}async function Dt({bookmarkName:e},t){let{mapView:r}=$(t);return await Promise.resolve(Ot(e,r))}var Pt=I.object({bookmarkName:I.string().describe("The name of the bookmark to navigate to.")}),Di=h(Dt,{name:"goToBookmark",description:"Go to the extent of the bookmark with the given name.",schema:Pt});async function Gt(e,t,r){let o=r.map?.allLayers.find(s=>s.id===e);if(!o)return{text:`Error: Layer with id ${e} not found`};let a=t?.trim()?t:"1=1",n=o.createQuery();n.where=a;try{let{extent:s,count:l}=await o.queryExtent(n);if(l===0)return{text:`No features found in ${o.title} matching: ${a}`,where:a};if(s)await r.goTo(s);else return{text:`Error: Unable to determine extent for ${o.title}`,where:a};let u={layerId:e,layerTitle:o.title??e,where:a,count:l};return{text:`Successfully zoomed to ${l} feature(s) in ${o.title} matching: ${a}`,where:a,sharedStatePatch:{lastNavigatedFeatures:{value:u}}}}catch(s){return console.error("Error in goToFeatures:",s),{text:`Error: ${s instanceof Error?s.message:"Unknown error"}`,where:a}}}async function Vt({layerId:e,where:t},r){let{mapView:o}=$(r);return await Gt(e,t,o)}var Qt=I.object({layerId:I.string().describe("The layerId of the layer to zoom to."),where:I.string().describe("The sql-92 where clause used to query features to zoom to")}),Pi=h(Vt,{name:"goToFeatures",description:"Go to the features that match the given filter related to the given layerId.",schema:Qt});async function Bt(e){let t=new nt({xmin:-180,ymin:-90,xmax:180,ymax:90,spatialReference:{wkid:4326}}).expand(.7);return await e.goTo(t),{text:"Successfully zoomed to world extent"}}async function Ut(e,t){let{mapView:r}=$(t);return await Bt(r)}var Kt=I.object({}),Gi=h(Ut,{name:"goToFullExtent",description:"Zooms the map to the full world extent using Esri's Geocoding Service.",schema:Kt});async function Wt(e){let t=e.map.initialViewProperties?.viewpoint?.targetGeometry;if(t)await e.goTo(t);else throw new Error("Initial extent is undefined");return{text:"Successfully zoomed to home extent"}}async function Ht(e,t){let{mapView:r}=$(t);return await Wt(r)}var Jt=i.object({}),Vi=h(Ht,{name:"goToHomeExtent",description:"Go to the initial web map view extent",schema:Jt});async function Zt(e,t){await t.when();let r=t.map?.allLayers.find(a=>a.id===e);if(!r)return console.warn(`[goToLayer] No matching FeatureLayer found for: ${e}`),{text:`Could not find layer for: ${e}`};let o;return(r.type==="link-chart"||r.type==="knowledge-graph-sublayer")&&t.map?.activeLinkChartLayer?o=t.map.diagramNodesExtent:o=r.fullExtent,o?(await t.goTo(o),r.visible=!0,{text:`Successfully zoomed to: ${r.title??""}`}):{text:"Layer has no defined extent. Cannot zoom to layer."}}async function Yt({layerId:e},t){let{mapView:r}=$(t);return await Zt(e,r)}var Xt=I.object({layerId:I.string().describe("The id of the layer to navigate to")}),Qi=h(Yt,{name:"goToLayer",description:"Zooms the map view to the full extent of the top matching layer.",schema:Xt});async function er(e,t){return await t.goTo({scale:e}),{text:`Successfully zoomed to: ${e}`}}async function tr({scale:e},t){let{mapView:r}=$(t);return await er(e,r)}var rr=i.object({scale:i.number().describe("The map scale of the view to go to.")}),Bi=h(tr,{name:"goToScale",description:"Go to the specified view scale.",schema:rr});async function or(e,t,r){let o={target:new _e({longitude:e.longitude,latitude:e.latitude,spatialReference:{wkid:4326}})};return r?.zoom!==void 0&&(o.zoom=r.zoom),r?.scale!==void 0&&(o.scale=r.scale),await t.goTo(o),{text:`Successfully navigated to: ${[`(${e.latitude}\xB0, ${e.longitude}\xB0)`,r?.zoom!==void 0?`zoom ${r.zoom}`:"",r?.scale!==void 0?`scale 1:${r.scale}`:""].filter(Boolean).join(", ")}`}}async function ar({center:e,zoom:t,scale:r},o){let{mapView:a}=$(o);return await or(e,a,{zoom:t,scale:r})}var nr=i.object({center:i.object({longitude:i.number().describe("The longitude (x-coordinate) of the point to navigate to."),latitude:i.number().describe("The latitude (y-coordinate) of the point to navigate to.")}),zoom:i.number().optional().describe("The zoom level. Higher values = more zoomed in."),scale:i.number().optional().describe("The map scale. Alternative to zoom. Smaller numbers = more zoomed in.")}),Ui=h(ar,{name:"goToViewpoint",description:"Go to the specified viewpoint. This can contain a combination of scale, center, zoom, etc.",schema:nr});async function ir(e,t){return await t.goTo({zoom:e}),{text:`Successfully zoomed to: ${e}`}}async function sr({zoom:e},t){let{mapView:r}=$(t);return await ir(e,r)}var lr=i.object({zoom:i.number().min(1).max(20).describe("The zoom level of the view to go to.")}),Ki=h(sr,{name:"goToZoom",description:'Go to the specified zoom level. If input is generic (e.g. "zoom in", then only zoom to the next appropriate level - increase level for zooming in and decrease for zooming out.).',schema:lr}),Ae=Object.assign({"../agents/arcgisKnowledge/prompts/arcgis_knowledge_current_lc_context.md":()=>import("./KMQ3SP4I.js").then(e=>e.default),"../agents/arcgisKnowledge/prompts/arcgis_knowledge_current_map_context.md":()=>import("./5QAHYX7Y.js").then(e=>e.default),"../agents/arcgisKnowledge/prompts/arcgis_knowledge_lucene_generation_prompt.md":()=>import("./5ZZGKP7N.js").then(e=>e.default),"../agents/arcgisKnowledge/prompts/arcgis_knowledge_summarize_result_prompt.md":()=>import("./AXDZBBNL.js").then(e=>e.default),"../agents/arcgisKnowledge/prompts/arcgis_knowledge_tool_prompt.md":()=>import("./ZS2TZ6BF.js").then(e=>e.default),"../agents/dataExploration/prompts/data_explore_filter_prompt.md":()=>import("./LQ6R5YRN.js").then(e=>e.default),"../agents/dataExploration/prompts/data_explore_query_prompt.md":()=>import("./X2ZDYHCG.js").then(e=>e.default),"../agents/dataExploration/prompts/summarize_query_response_prompt.md":()=>import("./T537PKP4.js").then(e=>e.default),"../agents/help/prompts/help_prompt.md":()=>import("./F2AHA4GB.js").then(e=>e.default),"../agents/layerStyling/prompts/layer_styling_prompt.md":()=>import("./FX7UOGHP.js").then(e=>e.default),"../agents/navigation/prompts/navigation_intent_prompt.md":()=>import("./NE7E52YR.js").then(e=>e.default),"../agents/navigation/prompts/navigation_tool_prompt.md":()=>import("./6YMR4QSD.js").then(e=>e.default)});async function ne(e){let t=Object.entries(Ae).find(([r])=>r.endsWith(`/${e}.md`));if(!t)throw new Error(`Prompt not found: ${e}
4
4
  Available prompts:
5
5
  ${Object.keys(Ae).join(`
6
- `)}`);return await t[1]()}var lr=(e,t=300)=>{let r=e.replace(/\s+/gu," ").replace(/[*_`#>\-]/gu,"").trim();return r.length>t?`${r.slice(0,t)}...`:r},je=(e,t)=>{let r=e?.configurable?.services?.[t];if(r==null)throw new Error(`${t} missing in config.configurable.services`);return r},Ki=(e,t)=>(r,o)=>{let a=o?.configurable?.services;for(let n of e)if(!a?.[n])throw new Error(`${t} requires services.${n} to be available.`);return r};async function cr(e){let{fields:t,layer:r,view:o,styleName:a,colorSchemeTags:n}=e,s;return n?s=it({basemapTheme:await ke(o),geometryType:r.geometryType,includedTags:n,numColors:Math.min(t.length,8)})[0]:s=st({basemapTheme:await ke(o),geometryType:r.geometryType,numColors:Math.min(t.length,8)}).primaryScheme,{layer:r,view:o,attributes:t.map(l=>({field:l,label:r.fields.find(u=>u.name===l)?.alias??""})).slice(0,8),outlineOptimizationEnabled:!0,sizeOptimizationEnabled:!0,includeSizeVariable:a.includes("Size"),pieChartScheme:s}}async function ur(e){return await nt(e)}async function dr({arcgisMap:e,arcgisMapView:t,layerId:r,fields:o,colorSchemes:a,includeSize:n}){let s=t,l=e?.allLayers.find(c=>c.id===r);if(!l)return`Could not find layer for id: ${r}`;let u={styleName:n?"chart-size":"chart",fields:o,layer:l,view:s,colorSchemeTags:a};try{let c=await cr(u),d=await ur(c);return l.renderer=d.renderer,l.visible=!0,`Chart renderer applied to layer: ${l.title??l.id} using fields ${o.join(", ")}`}catch(c){return`Error applying chart renderer: ${c instanceof Error?c.message:String(c)}`}}var pr=["mapView"];function x(e){let t=e?.configurable?.context;if(!t||typeof t!="object")throw new Error("LayerStylingAgent context missing");let r=pr.filter(o=>!(o in t));if(r.length)throw new Error(`LayerStylingAgent context missing: ${r.join(", ")}`);return t}async function mr({layerId:e,fields:t,colorSchemes:r,includeSize:o},a){let{mapView:n}=x(a);return await S({type:"show-legend",data:{layerIds:[e]}},a),await dr({arcgisMap:n.map,arcgisMapView:n,layerId:e,fields:t,colorSchemes:r,includeSize:o})}var hr=i.object({layerId:i.string().describe("The id of the layer to apply the chart renderer to"),fields:i.array(i.string()).describe("The fields to use for the chart renderer (multiple numeric fields)"),colorSchemes:i.array(i.string()).optional().describe("Optional color scheme tags to use"),includeSize:i.boolean().optional().describe("Whether to vary the chart size (chart-size)")}),Wi=h(mr,{name:"chart",description:`Label: Charts
6
+ `)}`);return await t[1]()}var cr=(e,t=300)=>{let r=e.replace(/\s+/gu," ").replace(/[*_`#>\-]/gu,"").trim();return r.length>t?`${r.slice(0,t)}...`:r},Le=(e,t)=>{let r=e?.configurable?.services?.[t];if(r==null)throw new Error(`${t} missing in config.configurable.services`);return r},Wi=(e,t)=>(r,o)=>{let a=o?.configurable?.services;for(let n of e)if(!a?.[n])throw new Error(`${t} requires services.${n} to be available.`);return r};async function ur(e){let{fields:t,layer:r,view:o,styleName:a,colorSchemeTags:n}=e,s;return n?s=st({basemapTheme:await ke(o),geometryType:r.geometryType,includedTags:n,numColors:Math.min(t.length,8)})[0]:s=lt({basemapTheme:await ke(o),geometryType:r.geometryType,numColors:Math.min(t.length,8)}).primaryScheme,{layer:r,view:o,attributes:t.map(l=>({field:l,label:r.fields.find(u=>u.name===l)?.alias??""})).slice(0,8),outlineOptimizationEnabled:!0,sizeOptimizationEnabled:!0,includeSizeVariable:a.includes("Size"),pieChartScheme:s}}async function dr(e){return await it(e)}async function mr({arcgisMap:e,arcgisMapView:t,layerId:r,fields:o,colorSchemes:a,includeSize:n}){let s=t,l=e?.allLayers.find(c=>c.id===r);if(!l)return`Could not find layer for id: ${r}`;let u={styleName:n?"chart-size":"chart",fields:o,layer:l,view:s,colorSchemeTags:a};try{let c=await ur(u),d=await dr(c);return l.renderer=d.renderer,l.visible=!0,`Chart renderer applied to layer: ${l.title??l.id} using fields ${o.join(", ")}`}catch(c){return`Error applying chart renderer: ${c instanceof Error?c.message:String(c)}`}}var pr=["mapView"];function x(e){let t=e?.configurable?.context;if(!t||typeof t!="object")throw new Error("LayerStylingAgent context missing");let r=pr.filter(o=>!(o in t));if(r.length)throw new Error(`LayerStylingAgent context missing: ${r.join(", ")}`);return t}async function hr({layerId:e,fields:t,colorSchemes:r,includeSize:o},a){let{mapView:n}=x(a);return await S({type:"show-legend",data:{layerIds:[e]}},a),await mr({arcgisMap:n.map,arcgisMapView:n,layerId:e,fields:t,colorSchemes:r,includeSize:o})}var fr=i.object({layerId:i.string().describe("The id of the layer to apply the chart renderer to"),fields:i.array(i.string()).describe("The fields to use for the chart renderer (multiple numeric fields)"),colorSchemes:i.array(i.string()).optional().describe("Optional color scheme tags to use"),includeSize:i.boolean().optional().describe("Whether to vary the chart size (chart-size)")}),Hi=h(hr,{name:"chart",description:`Label: Charts
7
7
  Description: Show the values of two or more categories as a proportion of the total using a pie chart.
8
8
  Keywords: pie, chart, all categories, breakdown, proportion
9
9
  Example: Show the total number of homes built in each decade using a pie chart for each feature.
@@ -13,19 +13,19 @@ ${Object.keys(Ae).join(`
13
13
  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.
14
14
  Keywords: pie, chart, all categories, breakdown, proportion, total, amount, how much, sum, graduated size, proportional size
15
15
  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.
16
- Fields: This style requires 2-8 number fields.`,schema:hr});function fr(e){let{fields:t,layer:r,view:o,theme:a,colorSchemeTags:n}=e,s=t[0],l;return n&&(l=pe({geometryType:r.geometryType,includedTags:n,theme:a||"high-to-low"})[0]),{layer:r,view:o,startTime:s,endTime:new Date,theme:a,sizeOptimizationEnabled:!0,outlineOptimizationEnabled:!0,colorScheme:l}}async function yr(e){return await lt(e)}async function gr({arcgisMap:e,arcgisMapView:t,layerId:r,fields:o,colorSchemes:a,theme:n}){let s=t,l=e?.allLayers.find(c=>c.id===r);if(!l)return`Could not find layer for id: ${r}`;let u={styleName:"color-age",fields:o,layer:l,view:s,colorSchemeTags:a,theme:n};try{let c=fr(u),d=await yr(c);return l.renderer=d.renderer,l.visible=!0,`Color-age renderer applied to layer: ${l.title??l.id} using fields ${o.join(", ")}`}catch(c){return`Error applying color-age renderer: ${c instanceof Error?c.message:String(c)}`}}async function wr({layerId:e,fields:t,colorSchemes:r,theme:o},a){let{mapView:n}=x(a);return await S({type:"show-legend",data:{layerIds:[e]}},a),await gr({arcgisMap:n.map,arcgisMapView:n,layerId:e,fields:t,colorSchemes:r,theme:o})}var br=i.object({layerId:i.string().describe("The id of the layer to apply the color-age renderer to"),fields:i.array(i.string()).describe("The field(s) to use for the color-age renderer (temporal/date data)"),colorSchemes:i.array(i.string()).optional().describe("Optional color scheme tags to use"),theme:i.enum(["above-and-below","above","below","centered-on","extremes","high-to-low"]).optional().describe("Optional theme for the color ramp")}),Hi=h(wr,{name:"color-age",description:`Label: Age (color)
16
+ Fields: This style requires 2-8 number fields.`,schema:fr});function yr(e){let{fields:t,layer:r,view:o,theme:a,colorSchemeTags:n}=e,s=t[0],l;return n&&(l=me({geometryType:r.geometryType,includedTags:n,theme:a||"high-to-low"})[0]),{layer:r,view:o,startTime:s,endTime:new Date,theme:a,sizeOptimizationEnabled:!0,outlineOptimizationEnabled:!0,colorScheme:l}}async function gr(e){return await ct(e)}async function wr({arcgisMap:e,arcgisMapView:t,layerId:r,fields:o,colorSchemes:a,theme:n}){let s=t,l=e?.allLayers.find(c=>c.id===r);if(!l)return`Could not find layer for id: ${r}`;let u={styleName:"color-age",fields:o,layer:l,view:s,colorSchemeTags:a,theme:n};try{let c=yr(u),d=await gr(c);return l.renderer=d.renderer,l.visible=!0,`Color-age renderer applied to layer: ${l.title??l.id} using fields ${o.join(", ")}`}catch(c){return`Error applying color-age renderer: ${c instanceof Error?c.message:String(c)}`}}async function br({layerId:e,fields:t,colorSchemes:r,theme:o},a){let{mapView:n}=x(a);return await S({type:"show-legend",data:{layerIds:[e]}},a),await wr({arcgisMap:n.map,arcgisMapView:n,layerId:e,fields:t,colorSchemes:r,theme:o})}var vr=i.object({layerId:i.string().describe("The id of the layer to apply the color-age renderer to"),fields:i.array(i.string()).describe("The field(s) to use for the color-age renderer (temporal/date data)"),colorSchemes:i.array(i.string()).optional().describe("Optional color scheme tags to use"),theme:i.enum(["above-and-below","above","below","centered-on","extremes","high-to-low"]).optional().describe("Optional theme for the color ramp")}),Ji=h(br,{name:"color-age",description:`Label: Age (color)
17
17
  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.
18
18
  Keywords: since, age, how old, how long
19
19
  Example: Show the age of each feature based on its reported date.
20
- Fields: This style requires at least one field with a date type.`,schema:br});function vr(e){let{fields:t,layer:r,view:o,colorSchemeTags:a}=e,{theme:n}=e,s=t[1],l=t[0],u;return a&&(u=pe({geometryType:r.geometryType,includedTags:a,theme:n||"high-to-low"})[0]),{layer:r,view:o,field:l,normalizationField:s,theme:n,sizeOptimizationEnabled:!0,outlineOptimizationEnabled:!0,colorScheme:u}}async function Tr(e){return await ct(e)}async function Sr({arcgisMap:e,arcgisMapView:t,layerId:r,fields:o,colorSchemes:a,theme:n}){let s=t,l=e?.allLayers.find(c=>c.id===r);if(!l)return`Could not find layer for id: ${r}`;let u={styleName:"color",fields:o,layer:l,view:s,colorSchemeTags:a,theme:n};try{let c=vr(u),d=await Tr(c);return l.renderer=d.renderer,l.visible=!0,`Color renderer applied to layer: ${l.title??l.id} using fields ${o.join(", ")}`}catch(c){return`Error applying color renderer: ${c instanceof Error?c.message:String(c)}`}}async function xr({layerId:e,fields:t,colorSchemes:r,theme:o},a){let{mapView:n}=x(a);return await S({type:"show-legend",data:{layerIds:[e]}},a),await Sr({arcgisMap:n.map,arcgisMapView:n,layerId:e,fields:t,colorSchemes:r,theme:o})}var Er=i.object({layerId:i.string().describe("The id of the layer to apply the color renderer to"),fields:i.array(i.string()).describe("The field(s) to use for the color renderer"),colorSchemes:i.array(i.string()).optional().describe("Optional color scheme tags to use"),theme:i.enum(["above-and-below","above","below","centered-on","extremes","high-to-low"]).optional().describe("Optional theme for the color ramp")}),Ji=h(xr,{name:"color",description:`Label: Counts and Amounts (color)
20
+ Fields: This style requires at least one field with a date type.`,schema:vr});function Tr(e){let{fields:t,layer:r,view:o,colorSchemeTags:a}=e,{theme:n}=e,s=t[1],l=t[0],u;return a&&(u=me({geometryType:r.geometryType,includedTags:a,theme:n||"high-to-low"})[0]),{layer:r,view:o,field:l,normalizationField:s,theme:n,sizeOptimizationEnabled:!0,outlineOptimizationEnabled:!0,colorScheme:u}}async function Sr(e){return await ut(e)}async function xr({arcgisMap:e,arcgisMapView:t,layerId:r,fields:o,colorSchemes:a,theme:n}){let s=t,l=e?.allLayers.find(c=>c.id===r);if(!l)return`Could not find layer for id: ${r}`;let u={styleName:"color",fields:o,layer:l,view:s,colorSchemeTags:a,theme:n};try{let c=Tr(u),d=await Sr(c);return l.renderer=d.renderer,l.visible=!0,`Color renderer applied to layer: ${l.title??l.id} using fields ${o.join(", ")}`}catch(c){return`Error applying color renderer: ${c instanceof Error?c.message:String(c)}`}}async function Er({layerId:e,fields:t,colorSchemes:r,theme:o},a){let{mapView:n}=x(a);return await S({type:"show-legend",data:{layerIds:[e]}},a),await xr({arcgisMap:n.map,arcgisMapView:n,layerId:e,fields:t,colorSchemes:r,theme:o})}var Ir=i.object({layerId:i.string().describe("The id of the layer to apply the color renderer to"),fields:i.array(i.string()).describe("The field(s) to use for the color renderer"),colorSchemes:i.array(i.string()).optional().describe("Optional color scheme tags to use"),theme:i.enum(["above-and-below","above","below","centered-on","extremes","high-to-low"]).optional().describe("Optional theme for the color ramp")}),Zi=h(Er,{name:"color",description:`Label: Counts and Amounts (color)
21
21
  Description: Vary color along a continuous color ramp to represent numeric or ranked data.
22
22
  Keywords: graduated color, choropleth, continuous color, hue, color, gradation, saturation, lightness, percent, rate, ratio, index, how much, increase, decrease
23
23
  Example: Color each feature based on the population density.
24
- 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:Er});function Ir(e){let{fields:t,layer:r,view:o,colorSchemeTags:a,theme:n}=e,s,l,u=t[0];return a&&(l=pe({geometryType:r.geometryType,includedTags:a,theme:n||"high-to-low"})[0]),{layer:r,view:o,field:u,normalizationField:s,theme:n,colorOptions:{colorScheme:l}}}async function $r(e){return await ut(e)}async function Nr({arcgisMap:e,arcgisMapView:t,layerId:r,fields:o,colorSchemes:a,theme:n}){let s=t,l=e?.allLayers.find(c=>c.id===r);if(!l)return`Could not find layer for id: ${r}`;let u={styleName:"color-size-univariate",fields:o,layer:l,view:s,colorSchemeTags:a,theme:n};try{let c=Ir(u),d=await $r(c);return l.renderer=d.renderer,l.visible=!0,`Color-size-univariate renderer applied to layer: ${l.title??l.id} using fields ${o.join(", ")}`}catch(c){return`Error applying color-size-univariate renderer: ${c instanceof Error?c.message:String(c)}`}}async function kr({layerId:e,fields:t,colorSchemes:r,theme:o},a){let{mapView:n}=x(a);return await S({type:"show-legend",data:{layerIds:[e]}},a),await Nr({arcgisMap:n.map,arcgisMapView:n,layerId:e,fields:t,colorSchemes:r,theme:o})}var Fr=i.object({layerId:i.string().describe("The id of the layer to apply the color-size univariate renderer to"),fields:i.array(i.string()).describe("The fields to use for the color-size univariate renderer"),colorSchemes:i.array(i.string()).optional().describe("Optional color scheme tags to use"),theme:i.enum(["above-and-below","above","below","centered-on","extremes","high-to-low"]).optional().describe("Optional theme for the color and size ramps")}),Zi=h(kr,{name:"color-size-univariate",description:`Label: Color and Size (univariate)
24
+ 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:Ir});function $r(e){let{fields:t,layer:r,view:o,colorSchemeTags:a,theme:n}=e,s,l,u=t[0];return a&&(l=me({geometryType:r.geometryType,includedTags:a,theme:n||"high-to-low"})[0]),{layer:r,view:o,field:u,normalizationField:s,theme:n,colorOptions:{colorScheme:l}}}async function Nr(e){return await dt(e)}async function kr({arcgisMap:e,arcgisMapView:t,layerId:r,fields:o,colorSchemes:a,theme:n}){let s=t,l=e?.allLayers.find(c=>c.id===r);if(!l)return`Could not find layer for id: ${r}`;let u={styleName:"color-size-univariate",fields:o,layer:l,view:s,colorSchemeTags:a,theme:n};try{let c=$r(u),d=await Nr(c);return l.renderer=d.renderer,l.visible=!0,`Color-size-univariate renderer applied to layer: ${l.title??l.id} using fields ${o.join(", ")}`}catch(c){return`Error applying color-size-univariate renderer: ${c instanceof Error?c.message:String(c)}`}}async function Fr({layerId:e,fields:t,colorSchemes:r,theme:o},a){let{mapView:n}=x(a);return await S({type:"show-legend",data:{layerIds:[e]}},a),await kr({arcgisMap:n.map,arcgisMapView:n,layerId:e,fields:t,colorSchemes:r,theme:o})}var Mr=i.object({layerId:i.string().describe("The id of the layer to apply the color-size univariate renderer to"),fields:i.array(i.string()).describe("The fields to use for the color-size univariate renderer"),colorSchemes:i.array(i.string()).optional().describe("Optional color scheme tags to use"),theme:i.enum(["above-and-below","above","below","centered-on","extremes","high-to-low"]).optional().describe("Optional theme for the color and size ramps")}),Yi=h(Fr,{name:"color-size-univariate",description:`Label: Color and Size (univariate)
25
25
  Description: Vary symbol size and color based on the values of two numeric attributes.
26
26
  Keywords: continuous color, hue, color, size, gradation, saturation, lightness, percent, rate, ratio, index, how much, increase, decrease, amount
27
27
  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.
28
- Fields: This style requires at least two fields: one determining the color of each feature, the other determining the size of each feature. Each field may be normalized by an additional normalization field.`,schema:Fr});function Mr(e){let{fields:t,layer:r,view:o,colorSchemeTags:a}=e,n;return a&&(n=pt({includedTags:a,numColors:Math.min(t.length,8)})[0]),{layer:r,view:o,legendOptions:{unit:"units"},attributes:t.map(s=>({field:s,label:r.fields.find(l=>l.name===s)?.alias??""})).slice(0,8),outlineOptimizationEnabled:!0,dotDensityScheme:n}}async function Ar(e){return await dt(e)}async function Cr({arcgisMap:e,arcgisMapView:t,layerId:r,fields:o,colorSchemes:a}){let n=t,s=e?.allLayers.find(u=>u.id===r);if(!s)return`Could not find layer for id: ${r}`;let l={styleName:"dot-density",fields:o,layer:s,view:n,colorSchemeTags:a};try{let u=Mr(l),c=await Ar(u);return s.renderer=c.renderer,s.visible=!0,`Dot Density renderer applied to layer: ${s.title??s.id} using fields ${o.join(", ")}`}catch(u){return`Error applying dot density renderer: ${u instanceof Error?u.message:String(u)}`}}async function Rr({layerId:e,fields:t,colorSchemes:r},o){let{mapView:a}=x(o);return await S({type:"show-legend",data:{layerIds:[e]}},o),await Cr({arcgisMap:a.map,arcgisMapView:a,layerId:e,fields:t,colorSchemes:r})}var _r=i.object({layerId:i.string().describe("The id of the layer to apply the dot density renderer to"),fields:i.array(i.string()).describe("The field(s) to use for the dot density renderer (population or count data)"),colorSchemes:i.array(i.string()).optional().describe("Optional color scheme tags to use")}),Yi=h(Rr,{name:"dot-density",description:`Dot Density
28
+ Fields: This style requires at least two fields: one determining the color of each feature, the other determining the size of each feature. Each field may be normalized by an additional normalization field.`,schema:Mr});function Ar(e){let{fields:t,layer:r,view:o,colorSchemeTags:a}=e,n;return a&&(n=pt({includedTags:a,numColors:Math.min(t.length,8)})[0]),{layer:r,view:o,legendOptions:{unit:"units"},attributes:t.map(s=>({field:s,label:r.fields.find(l=>l.name===s)?.alias??""})).slice(0,8),outlineOptimizationEnabled:!0,dotDensityScheme:n}}async function Cr(e){return await mt(e)}async function Rr({arcgisMap:e,arcgisMapView:t,layerId:r,fields:o,colorSchemes:a}){let n=t,s=e?.allLayers.find(u=>u.id===r);if(!s)return`Could not find layer for id: ${r}`;let l={styleName:"dot-density",fields:o,layer:s,view:n,colorSchemeTags:a};try{let u=Ar(l),c=await Cr(u);return s.renderer=c.renderer,s.visible=!0,`Dot Density renderer applied to layer: ${s.title??s.id} using fields ${o.join(", ")}`}catch(u){return`Error applying dot density renderer: ${u instanceof Error?u.message:String(u)}`}}async function _r({layerId:e,fields:t,colorSchemes:r},o){let{mapView:a}=x(o);return await S({type:"show-legend",data:{layerIds:[e]}},o),await Rr({arcgisMap:a.map,arcgisMapView:a,layerId:e,fields:t,colorSchemes:r})}var qr=i.object({layerId:i.string().describe("The id of the layer to apply the dot density renderer to"),fields:i.array(i.string()).describe("The field(s) to use for the dot density renderer (population or count data)"),colorSchemes:i.array(i.string()).optional().describe("Optional color scheme tags to use")}),Xi=h(_r,{name:"dot-density",description:`Dot Density
29
29
  Use dot density to visualize the distribution of one attribute or compare the density of multiple attributes. This is only valid for polygon layers.
30
30
  **Use cases:**
31
31
  - Population distribution visualization
@@ -36,11 +36,11 @@ ${Object.keys(Ae).join(`
36
36
  - Visualize distribution of different crops across regions
37
37
  - Display demographic patterns within census tracts
38
38
  **Fields:** Requires 2-8 number fields.
39
- **Keywords:** density, how much, how many, total, number, amount`,schema:_r});function qr(e){let{fields:t,layer:r,view:o,colorSchemeTags:a}=e,n,s=t[0];return a&&(n=ht({includedTags:a,basemap:o.map?.basemap||"topo"})[0]),{layer:r,view:o,field:s,heatmapScheme:n}}async function zr(e){return await mt(e)}async function jr({arcgisMap:e,arcgisMapView:t,layerId:r,fields:o,colorSchemes:a}){let n=t,s=e?.allLayers.find(u=>u.id===r);if(!s)return`Could not find layer for id: ${r}`;let l={styleName:"heatmap",fields:o,layer:s,view:n,colorSchemeTags:a};try{let u=qr(l),c=await zr(u);return s.renderer=c.renderer,s.visible=!0,`Heatmap renderer applied to layer: ${s.title??s.id} using fields ${o.join(", ")}`}catch(u){return`Error applying heatmap renderer: ${u instanceof Error?u.message:String(u)}`}}async function Lr({layerId:e,fields:t,colorSchemes:r},o){let{mapView:a}=x(o);return await S({type:"show-legend",data:{layerIds:[e]}},o),await jr({arcgisMap:a.map,arcgisMapView:a,layerId:e,fields:t,colorSchemes:r})}var Or=i.object({layerId:i.string().describe("The id of the layer to apply the heatmap renderer to"),fields:i.array(i.string()).describe("The field(s) to use for the heatmap renderer (typically point density)"),colorSchemes:i.array(i.string()).optional().describe("Optional color scheme tags to use")}),Xi=h(Lr,{name:"heatmap",description:`Label: Heat Map
39
+ **Keywords:** density, how much, how many, total, number, amount`,schema:qr});function zr(e){let{fields:t,layer:r,view:o,colorSchemeTags:a}=e,n,s=t[0];return a&&(n=ft({includedTags:a,basemap:o.map?.basemap||"topo"})[0]),{layer:r,view:o,field:s,heatmapScheme:n}}async function jr(e){return await ht(e)}async function Lr({arcgisMap:e,arcgisMapView:t,layerId:r,fields:o,colorSchemes:a}){let n=t,s=e?.allLayers.find(u=>u.id===r);if(!s)return`Could not find layer for id: ${r}`;let l={styleName:"heatmap",fields:o,layer:s,view:n,colorSchemeTags:a};try{let u=zr(l),c=await jr(u);return s.renderer=c.renderer,s.visible=!0,`Heatmap renderer applied to layer: ${s.title??s.id} using fields ${o.join(", ")}`}catch(u){return`Error applying heatmap renderer: ${u instanceof Error?u.message:String(u)}`}}async function Or({layerId:e,fields:t,colorSchemes:r},o){let{mapView:a}=x(o);return await S({type:"show-legend",data:{layerIds:[e]}},o),await Lr({arcgisMap:a.map,arcgisMapView:a,layerId:e,fields:t,colorSchemes:r})}var Dr=i.object({layerId:i.string().describe("The id of the layer to apply the heatmap renderer to"),fields:i.array(i.string()).describe("The field(s) to use for the heatmap renderer (typically point density)"),colorSchemes:i.array(i.string()).optional().describe("Optional color scheme tags to use")}),es=h(Or,{name:"heatmap",description:`Label: Heat Map
40
40
  Description: Show areas of high density with colors that appear to glow hotter. This is only valid for point layers.
41
41
  Keywords: density, heatmap, hot spots, pattern, cluster
42
42
  Example: Create a heatmap
43
- Fields: This typically requires zero or one field of type number.`,schema:Or});function Dr(e){let{fields:t,layer:r,view:o,styleName:a,colorSchemeTags:n}=e,s;return n&&(s=yt({geometryType:r.geometryType,includedTags:n,numColors:Math.min(t.length,10)})[0]),{layer:r,view:o,fields:t.map(l=>({name:l})).slice(0,9),outlineOptimizationEnabled:!0,sizeOptimizationEnabled:!0,includeSizeVariable:a.includes("Size"),predominanceScheme:s}}async function Pr(e){return await ft(e)}async function Gr({arcgisMap:e,arcgisMapView:t,layerId:r,fields:o,colorSchemes:a,includeSize:n}){let s=t,l=e?.allLayers.find(c=>c.id===r);if(!l)return`Could not find layer for id: ${r}`;let u={styleName:n?"predominance-size":"predominance",fields:o,layer:l,view:s,colorSchemeTags:a};try{let c=Dr(u),d=await Pr(c);return l.renderer=d.renderer,l.visible=!0,`Predominance renderer applied to layer: ${l.title??l.id} using fields ${o.join(", ")}`}catch(c){return`Error applying predominance renderer: ${c instanceof Error?c.message:String(c)}`}}async function Vr({layerId:e,fields:t,colorSchemes:r,includeSize:o},a){let{mapView:n}=x(a);return await S({type:"show-legend",data:{layerIds:[e]}},a),await Gr({arcgisMap:n.map,arcgisMapView:n,layerId:e,fields:t,colorSchemes:r,includeSize:o})}var Qr=i.object({layerId:i.string().describe("The id of the layer to apply the predominance renderer to"),fields:i.array(i.string()).describe("The fields to use for the predominance renderer (competing categories)"),colorSchemes:i.array(i.string()).optional().describe("Optional color scheme tags to use"),includeSize:i.boolean().optional().describe("Whether to include size visualization (predominance-size)")}),es=h(Vr,{name:"predominance",description:`Label: Predominant category
43
+ Fields: This typically requires zero or one field of type number.`,schema:Dr});function Pr(e){let{fields:t,layer:r,view:o,styleName:a,colorSchemeTags:n}=e,s;return n&&(s=gt({geometryType:r.geometryType,includedTags:n,numColors:Math.min(t.length,10)})[0]),{layer:r,view:o,fields:t.map(l=>({name:l})).slice(0,9),outlineOptimizationEnabled:!0,sizeOptimizationEnabled:!0,includeSizeVariable:a.includes("Size"),predominanceScheme:s}}async function Gr(e){return await yt(e)}async function Vr({arcgisMap:e,arcgisMapView:t,layerId:r,fields:o,colorSchemes:a,includeSize:n}){let s=t,l=e?.allLayers.find(c=>c.id===r);if(!l)return`Could not find layer for id: ${r}`;let u={styleName:n?"predominance-size":"predominance",fields:o,layer:l,view:s,colorSchemeTags:a};try{let c=Pr(u),d=await Gr(c);return l.renderer=d.renderer,l.visible=!0,`Predominance renderer applied to layer: ${l.title??l.id} using fields ${o.join(", ")}`}catch(c){return`Error applying predominance renderer: ${c instanceof Error?c.message:String(c)}`}}async function Qr({layerId:e,fields:t,colorSchemes:r,includeSize:o},a){let{mapView:n}=x(a);return await S({type:"show-legend",data:{layerIds:[e]}},a),await Vr({arcgisMap:n.map,arcgisMapView:n,layerId:e,fields:t,colorSchemes:r,includeSize:o})}var Br=i.object({layerId:i.string().describe("The id of the layer to apply the predominance renderer to"),fields:i.array(i.string()).describe("The fields to use for the predominance renderer (competing categories)"),colorSchemes:i.array(i.string()).optional().describe("Optional color scheme tags to use"),includeSize:i.boolean().optional().describe("Whether to include size visualization (predominance-size)")}),ts=h(Qr,{name:"predominance",description:`Label: Predominant category
44
44
  Description: Compare attributes that share a common subject and unit of measurement to see which has the highest value.
45
45
  Keywords: predominant, winner, won, competing, most, most common, most frequent, dominant, prevalent, top
46
46
  Example: Using fields for Corn Acres, Wheat Acres, and Cotton Acres, show the predominant crop harvested in each area.
@@ -50,15 +50,15 @@ Fields: This typically requires zero or one field of type number.`,schema:Or});f
50
50
  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.
51
51
  Keywords: predominant, winner, won, competing, most, most common, most frequent, dominant, prevalent, top, amount, total, how much, proportional size, graduated size, sum
52
52
  Example: Show the predominant crop in each area and vary the size of each symbol based on the total of all categories.
53
- Fields: This style relies on 2-10 number fields.`,schema:Qr});function Br(e){let{fields:t,layer:r,view:o,colorSchemeTags:a}=e,n,s={field:t[0]},l={field:t[1]};return a&&(n=wt({geometryType:r.geometryType,includedTags:a})[0]),{layer:r,view:o,field1:s,field2:l,outlineOptimizationEnabled:!0,sizeOptimizationEnabled:!0,relationshipScheme:n}}async function Ur(e){return await gt(e)}async function Kr({arcgisMap:e,arcgisMapView:t,layerId:r,fields:o,colorSchemes:a}){let n=t,s=e?.allLayers.find(u=>u.id===r);if(!s)return`Could not find layer for id: ${r}`;let l={styleName:"relationship",fields:o,layer:s,view:n,colorSchemeTags:a};try{let u=Br(l),c=await Ur(u);return s.renderer=c.renderer,s.visible=!0,`Relationship renderer applied to layer: ${s.title??s.id} using fields ${o.join(", ")}`}catch(u){return`Error applying relationship renderer: ${u instanceof Error?u.message:String(u)}`}}async function Wr({layerId:e,fields:t,colorSchemes:r},o){let{mapView:a}=x(o);return await S({type:"show-legend",data:{layerIds:[e]}},o),await Kr({arcgisMap:a.map,arcgisMapView:a,layerId:e,fields:t,colorSchemes:r})}var Hr=i.object({layerId:i.string().describe("The id of the layer to apply the relationship renderer to"),fields:i.array(i.string()).describe("The two fields to use for the relationship renderer (bivariate visualization)"),colorSchemes:i.array(i.string()).optional().describe("Optional color scheme tags to use")}),ts=h(Wr,{name:"relationship",description:`Label: Relationship
53
+ Fields: This style relies on 2-10 number fields.`,schema:Br});function Ur(e){let{fields:t,layer:r,view:o,colorSchemeTags:a}=e,n,s={field:t[0]},l={field:t[1]};return a&&(n=bt({geometryType:r.geometryType,includedTags:a})[0]),{layer:r,view:o,field1:s,field2:l,outlineOptimizationEnabled:!0,sizeOptimizationEnabled:!0,relationshipScheme:n}}async function Kr(e){return await wt(e)}async function Wr({arcgisMap:e,arcgisMapView:t,layerId:r,fields:o,colorSchemes:a}){let n=t,s=e?.allLayers.find(u=>u.id===r);if(!s)return`Could not find layer for id: ${r}`;let l={styleName:"relationship",fields:o,layer:s,view:n,colorSchemeTags:a};try{let u=Ur(l),c=await Kr(u);return s.renderer=c.renderer,s.visible=!0,`Relationship renderer applied to layer: ${s.title??s.id} using fields ${o.join(", ")}`}catch(u){return`Error applying relationship renderer: ${u instanceof Error?u.message:String(u)}`}}async function Hr({layerId:e,fields:t,colorSchemes:r},o){let{mapView:a}=x(o);return await S({type:"show-legend",data:{layerIds:[e]}},o),await Wr({arcgisMap:a.map,arcgisMapView:a,layerId:e,fields:t,colorSchemes:r})}var Jr=i.object({layerId:i.string().describe("The id of the layer to apply the relationship renderer to"),fields:i.array(i.string()).describe("The two fields to use for the relationship renderer (bivariate visualization)"),colorSchemes:i.array(i.string()).optional().describe("Optional color scheme tags to use")}),rs=h(Hr,{name:"relationship",description:`Label: Relationship
54
54
  Description: Overlays two color ramps to represent the relationship between two numeric attributes.
55
55
  Keywords: relationship, correlation, compare, related, bivariate choropleth, bivariate color
56
56
  Example: Show the relationship between tree height and carbon storage
57
- Fields: This style requires two number fields.`,schema:Hr});function Jr(e){let{fields:t,layer:r,view:o,theme:a}=e,n=t[0];return{layer:r,view:o,startTime:n,endTime:new Date,theme:a,sizeOptimizationEnabled:!0,outlineOptimizationEnabled:!0}}async function Zr(e){return await bt(e)}async function Yr({arcgisMap:e,arcgisMapView:t,layerId:r,fields:o,colorSchemes:a,theme:n}){let s=t,l=e?.allLayers.find(c=>c.id===r);if(!l)return`Could not find layer for id: ${r}`;let u={styleName:"size-age",fields:o,layer:l,view:s,colorSchemeTags:a,theme:n};try{let c=Jr(u),d=await Zr(c);return l.renderer=d.renderer,l.visible=!0,`Size-age renderer applied to layer: ${l.title??l.id} using fields ${o.join(", ")}`}catch(c){return`Error applying size-age renderer: ${c instanceof Error?c.message:String(c)}`}}async function Xr({layerId:e,fields:t,colorSchemes:r,theme:o},a){let{mapView:n}=x(a);return await S({type:"show-legend",data:{layerIds:[e]}},a),await Yr({arcgisMap:n.map,arcgisMapView:n,layerId:e,fields:t,colorSchemes:r,theme:o})}var eo=i.object({layerId:i.string().describe("The id of the layer to apply the size-age renderer to"),fields:i.array(i.string()).describe("The field(s) to use for the size-age renderer (temporal data with size)"),colorSchemes:i.array(i.string()).optional().describe("Optional color scheme tags to use"),theme:i.enum(["above-and-below","above","below","centered-on","extremes","high-to-low"]).optional().describe("Optional theme for the size ramp")}),rs=h(Xr,{name:"size-age",description:`Label: Age (size)
57
+ Fields: This style requires two number fields.`,schema:Jr});function Zr(e){let{fields:t,layer:r,view:o,theme:a}=e,n=t[0];return{layer:r,view:o,startTime:n,endTime:new Date,theme:a,sizeOptimizationEnabled:!0,outlineOptimizationEnabled:!0}}async function Yr(e){return await vt(e)}async function Xr({arcgisMap:e,arcgisMapView:t,layerId:r,fields:o,colorSchemes:a,theme:n}){let s=t,l=e?.allLayers.find(c=>c.id===r);if(!l)return`Could not find layer for id: ${r}`;let u={styleName:"size-age",fields:o,layer:l,view:s,colorSchemeTags:a,theme:n};try{let c=Zr(u),d=await Yr(c);return l.renderer=d.renderer,l.visible=!0,`Size-age renderer applied to layer: ${l.title??l.id} using fields ${o.join(", ")}`}catch(c){return`Error applying size-age renderer: ${c instanceof Error?c.message:String(c)}`}}async function eo({layerId:e,fields:t,colorSchemes:r,theme:o},a){let{mapView:n}=x(a);return await S({type:"show-legend",data:{layerIds:[e]}},a),await Xr({arcgisMap:n.map,arcgisMapView:n,layerId:e,fields:t,colorSchemes:r,theme:o})}var to=i.object({layerId:i.string().describe("The id of the layer to apply the size-age renderer to"),fields:i.array(i.string()).describe("The field(s) to use for the size-age renderer (temporal data with size)"),colorSchemes:i.array(i.string()).optional().describe("Optional color scheme tags to use"),theme:i.enum(["above-and-below","above","below","centered-on","extremes","high-to-low"]).optional().describe("Optional theme for the size ramp")}),os=h(eo,{name:"size-age",description:`Label: Age (size)
58
58
  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.
59
59
  Keywords: since, age, how old, how long
60
60
  Example: Change the size of features so older features are larger than new features.
61
- Fields: This style requires at least one field with a date type.`,schema:eo});function to(e){let{fields:t,layer:r,view:o}=e,{theme:a}=e,n=t[1],s=t[0];return{layer:r,view:o,field:s,normalizationField:n,theme:a,sizeOptimizationEnabled:!0,outlineOptimizationEnabled:!0}}async function ro(e){return await vt(e)}async function oo({arcgisMap:e,arcgisMapView:t,layerId:r,fields:o,colorSchemes:a,theme:n}){let s=t,l=e?.allLayers.find(c=>c.id===r);if(!l)return`Could not find layer for id: ${r}`;let u={styleName:"size",fields:o,layer:l,view:s,colorSchemeTags:a,theme:n};try{let c=to(u),d=await ro(c);return l.renderer=d.renderer,l.visible=!0,`Size renderer applied to layer: ${l.title??l.id} using fields ${o.join(", ")}`}catch(c){return`Error applying size renderer: ${c instanceof Error?c.message:String(c)}`}}async function ao({layerId:e,fields:t,colorSchemes:r,theme:o},a){let{mapView:n}=x(a);return await S({type:"show-legend",data:{layerIds:[e]}},a),await oo({arcgisMap:n.map,arcgisMapView:n,layerId:e,fields:t,colorSchemes:r,theme:o})}var no=i.object({layerId:i.string().describe("The id of the layer to apply the size renderer to"),fields:i.array(i.string()).describe("The field(s) to use for the size renderer (numeric data)"),colorSchemes:i.array(i.string()).optional().describe("Optional color scheme tags to use"),theme:i.enum(["above-and-below","above","below","centered-on","extremes","high-to-low"]).optional().describe("Optional theme for the size ramp")}),os=h(ao,{name:"size",description:`Label: Counts and Amounts (size)
61
+ Fields: This style requires at least one field with a date type.`,schema:to});function ro(e){let{fields:t,layer:r,view:o}=e,{theme:a}=e,n=t[1],s=t[0];return{layer:r,view:o,field:s,normalizationField:n,theme:a,sizeOptimizationEnabled:!0,outlineOptimizationEnabled:!0}}async function oo(e){return await Tt(e)}async function ao({arcgisMap:e,arcgisMapView:t,layerId:r,fields:o,colorSchemes:a,theme:n}){let s=t,l=e?.allLayers.find(c=>c.id===r);if(!l)return`Could not find layer for id: ${r}`;let u={styleName:"size",fields:o,layer:l,view:s,colorSchemeTags:a,theme:n};try{let c=ro(u),d=await oo(c);return l.renderer=d.renderer,l.visible=!0,`Size renderer applied to layer: ${l.title??l.id} using fields ${o.join(", ")}`}catch(c){return`Error applying size renderer: ${c instanceof Error?c.message:String(c)}`}}async function no({layerId:e,fields:t,colorSchemes:r,theme:o},a){let{mapView:n}=x(a);return await S({type:"show-legend",data:{layerIds:[e]}},a),await ao({arcgisMap:n.map,arcgisMapView:n,layerId:e,fields:t,colorSchemes:r,theme:o})}var io=i.object({layerId:i.string().describe("The id of the layer to apply the size renderer to"),fields:i.array(i.string()).describe("The field(s) to use for the size renderer (numeric data)"),colorSchemes:i.array(i.string()).optional().describe("Optional color scheme tags to use"),theme:i.enum(["above-and-below","above","below","centered-on","extremes","high-to-low"]).optional().describe("Optional theme for the size ramp")}),as=h(no,{name:"size",description:`Label: Counts and Amounts (size)
62
62
  Description: Vary symbol sizes along a continuous ramp to represent numeric or ranked data.
63
63
  Keywords: graduated size, proportional size, how much, total, number, amount, size
64
64
  Example: Vary the size of each point based on the total population.
@@ -68,11 +68,11 @@ Fields: This typically requires zero or one field of type number.`,schema:Or});f
68
68
  Description: Vary symbol sizes along a continuous ramp to represent dates.
69
69
  Keywords: graduated size, proportional size, classed size, how much, total, number, when
70
70
  Example: Vary the size of each feature based on the date a ticket was completed.
71
- Fields: This style requires a single field with a date type.`,schema:no});function io(e){let{fields:t,layer:r,view:o,colorSchemeTags:a}=e,n=t[0],s=t[1],l=t[2],u;return a&&(u=St({geometryType:r.geometryType,includedTags:a})[0]),{layer:r,view:o,field:n,field2:s,field3:l,outlineOptimizationEnabled:!0,sizeOptimizationEnabled:!0,typeScheme:u}}async function so(e){return await Tt(e)}async function lo({arcgisMap:e,arcgisMapView:t,layerId:r,fields:o,colorSchemes:a,theme:n}){let s=t,l=e?.allLayers.find(c=>c.id===r);if(!l)return`Could not find layer for id: ${r}`;let u={styleName:"type",fields:o,layer:l,view:s,colorSchemeTags:a,theme:n};try{let c=io(u),d=await so(c);return l.renderer=d.renderer,l.visible=!0,`Type renderer applied to layer: ${l.title??l.id} using fields ${o.join(", ")}`}catch(c){return`Error applying type renderer: ${c instanceof Error?c.message:String(c)}`}}async function co({layerId:e,fields:t,colorSchemes:r,theme:o},a){let{mapView:n}=x(a);return await S({type:"show-legend",data:{layerIds:[e]}},a),await lo({arcgisMap:n.map,arcgisMapView:n,layerId:e,fields:t,colorSchemes:r,theme:o})}var uo=i.object({layerId:i.string().describe("The id of the layer to apply the type renderer to"),fields:i.array(i.string()).describe("The field(s) to use for the type renderer (categorical data)"),colorSchemes:i.array(i.string()).optional().describe("Optional color scheme tags to use"),theme:i.enum(["above-and-below","above","below","centered-on","extremes","high-to-low"]).optional().describe("Optional theme for the color scheme")}),as=h(co,{name:"type",description:`Label: Types (unique symbols)
71
+ Fields: This style requires a single field with a date type.`,schema:io});function so(e){let{fields:t,layer:r,view:o,colorSchemeTags:a}=e,n=t[0],s=t[1],l=t[2],u;return a&&(u=xt({geometryType:r.geometryType,includedTags:a})[0]),{layer:r,view:o,field:n,field2:s,field3:l,outlineOptimizationEnabled:!0,sizeOptimizationEnabled:!0,typeScheme:u}}async function lo(e){return await St(e)}async function co({arcgisMap:e,arcgisMapView:t,layerId:r,fields:o,colorSchemes:a,theme:n}){let s=t,l=e?.allLayers.find(c=>c.id===r);if(!l)return`Could not find layer for id: ${r}`;let u={styleName:"type",fields:o,layer:l,view:s,colorSchemeTags:a,theme:n};try{let c=so(u),d=await lo(c);return l.renderer=d.renderer,l.visible=!0,`Type renderer applied to layer: ${l.title??l.id} using fields ${o.join(", ")}`}catch(c){return`Error applying type renderer: ${c instanceof Error?c.message:String(c)}`}}async function uo({layerId:e,fields:t,colorSchemes:r,theme:o},a){let{mapView:n}=x(a);return await S({type:"show-legend",data:{layerIds:[e]}},a),await co({arcgisMap:n.map,arcgisMapView:n,layerId:e,fields:t,colorSchemes:r,theme:o})}var mo=i.object({layerId:i.string().describe("The id of the layer to apply the type renderer to"),fields:i.array(i.string()).describe("The field(s) to use for the type renderer (categorical data)"),colorSchemes:i.array(i.string()).optional().describe("Optional color scheme tags to use"),theme:i.enum(["above-and-below","above","below","centered-on","extremes","high-to-low"]).optional().describe("Optional theme for the color scheme")}),ns=h(uo,{name:"type",description:`Label: Types (unique symbols)
72
72
  Description: Represent features as categories with different symbol colors or shapes. Examples include type of tree, road class, or province name.
73
73
  Keywords: categorical, category, type, unique, discrete, point of interest, region, group
74
74
  Example: Color each feature based on the region it belongs to
75
- Fields: This style requires a single field which may be a string, number, or date type. It is usually a string.`,schema:uo}),ns=g.Root({...L(),vectorSearchLayerIds:g(),vectorSearchFieldResults:g(),layerFieldInfo:g(),selectedLayerId:g()}),is=g.Root({...L(),vectorSearchLayerIds:g(),vectorSearchFieldResults:g(),layerFieldInfo:g(),queryResponse:g(),dataExplorationMessages:g({reducer:j,default:()=>[]})}),po=["mapView"];function A(e){let t=e?.configurable?.context;if(!t||typeof t!="object")throw new Error("DataExplorationAgent context missing");let r=po.filter(o=>!(o in t));if(r.length)throw new Error(`DataExplorationAgent context missing: ${r.join(", ")}`);return t}var mo=e=>{let t=e.map?.allLayers.filter(o=>o.type==="feature"),r=0;return t?.forEach(o=>{let a=o;a.featureEffect&&(a.featureEffect=null,r++)}),r>0?`Cleared filters from ${r} layer(s). View unchanged.`:"No active filters to clear. View unchanged."},ho=async(e,t)=>{let{mapView:r}=A(t);return mo(r)},fo=h(ho,{name:"clearFilters",description:"Clears all feature effects/filters from the map but does NOT change the current view. Use when user says 'clear filters', 'reset filters', 'remove filters', 'show all features', or wants to remove emphasis without navigating anywhere.",schema:i.object({})}),yo=async e=>{e.map?.allLayers.filter(r=>r.type==="feature")?.forEach(r=>{let o=r;o.featureEffect&&(o.featureEffect=null)});let t=e.map.initialViewProperties?.viewpoint?.targetGeometry;return t?(await e.goTo(t),"Cleared all filters and returned to home extent."):"Cleared all filters. Could not determine home extent."},go=async(e,t)=>{let{mapView:r}=A(t);return await yo(r)},wo=h(go,{name:"resetMap",description:"Clears all feature effects/filters from the map AND zooms to the home extent (initial map view). Use when user says 'reset map', 'reset the map', 'start over', or wants to both clear filters and return to the initial view.",schema:i.object({})});function H(e){return"point"in e&&e.point!==void 0}function D(e){return"layerId"in e&&e.layerId!==void 0}var Z=async(e,t)=>{if(H(e)){let{point:r}=e;return{geometry:new Re({x:r.x,y:r.y,spatialReference:r.spatialReference?{wkid:r.spatialReference.wkid}:t.spatialReference})}}if(D(e)){let r=t.map?.allLayers.find(a=>a.id===e.layerId);if(!r)return{error:`Could not find geometry layer with ID: ${e.layerId}`};let o=r.title??r.id;try{let a=await r.queryFeatures({where:e.where,returnGeometry:!0,outSpatialReference:t.spatialReference});if(!a.features.length)return{error:`No features found in geometry layer "${o}" with the specified where clause: ${e.where}`};let n;if(a.features.length===1){let s=a.features[0].geometry;if(!s)return{error:"The geometry of the first feature is undefined or null."};n=s}else{let s=a.features.map(u=>u.geometry),l=qe.executeMany(s);if(!l)return{error:"Failed to create a combined geometry."};n=l}return n.spatialReference||(n.spatialReference=t.spatialReference),{geometry:n}}catch(a){return{error:`Failed to query geometry: ${String(a)}`}}}return{error:"Invalid geometry configuration provided"}},bo=async(e,t,r,o,a,n)=>{let s=e.map?.allLayers.find(u=>u.id===t);if(!s)return{success:!1,error:`Layer '${t}' not found.`};let l=s.createQuery();l.where=r??"1=1",o&&(l.geometry=o,l.spatialRelationship="intersects",a&&(l.distance=a),n&&(l.units=n));try{let{extent:u,count:c}=await s.queryExtent(l);return!u||c===0?{success:!1,error:`No features found for filter (where: ${l.where}${o?", spatial filter used":""})`}:(await e.goTo(u),{success:!0})}catch(u){return{success:!1,error:u instanceof Error?u.message:String(u)}}},vo=async(e,t,r,o,a,n)=>{let s=t.map?.allLayers.find(p=>p.id===e.layerId);if(!s)return`Could not find target layer with ID: ${e.layerId}`;let l;if(a){let p=await Z(a,t);if("error"in p)return p.error;l=p.geometry}if(s.featureEffect=null,s.featureEffect=new xt({filter:new _e({...e.objectIds?.length?{objectIds:e.objectIds}:{where:e.where},geometry:l,spatialRelationship:"intersects",distance:a?.distance,units:a?.units}),includedEffect:r,excludedEffect:o}),s.visible=!0,n)return`Applied feature effects to "${s.title??e.layerId}" within current map extent.`;let u=e.objectIds?.length?`${s.objectIdField} IN (${e.objectIds.join(",")})`:e.where,c=await bo(t,e.layerId,u,l,a?.distance,a?.units),d=s.title??e.layerId;return c.success?`Applied feature effects to target layer "${s.title??e.layerId}"${a&&"layerId"in a?` using geometry from layer "${a.layerId}"`:""}.`:`Applied filter to "${d}" but no features matched. ${c.error}`},To=["feet","kilometers","meters","miles","nautical-miles","us-nautical-miles"],N=i.enum(To),So=async({targetLayer:e,geometryFilter:t,useCurrentExtent:r,includedEffect:o="drop-shadow(2px, 2px, 2px, gray)",excludedEffect:a="grayscale(100%) opacity(60%) blur(2px)"},n)=>{let{mapView:s}=A(n);return await vo(e,s,o,a,t,r)},xo=i.object({layerId:i.string().describe("The layerId of the layer containing the geometry by which to filter."),where:i.string().describe("The SQL-92 where clause representing the features from which to filter."),distance:i.number().optional().describe("The buffer distance around the geometry."),units:N.optional().describe("The units for the distance buffer.")}),Eo=i.object({point:i.object({x:i.number().describe("X coordinate (longitude) from navigation result"),y:i.number().describe("Y coordinate (latitude) from navigation result"),spatialReference:i.object({wkid:i.number().describe("Spatial reference WKID (e.g., 4326 for WGS84)")}).optional().describe("Spatial reference. Defaults to map's spatial reference if not provided.")}).describe("Point coordinates from a previous navigation/geocoding result"),distance:i.number().optional().describe("Optional buffer distance around the point."),units:N.optional().describe("The units for the distance buffer.")}),Io=i.object({targetLayer:i.object({layerId:i.string().describe("The layerId of the layer on which to set a feature effect."),where:i.string().describe("The SQL-92 where clause representing the features to emphasize."),objectIds:i.array(i.number()).optional().describe("Array of objectIds from a previous query result. Use this instead of a where clause when the query returned objectIds (e.g. top N results). If provided, takes precedence over where clause.")}),geometryFilter:i.union([xo,Eo]).optional().describe("Optional geometry-based filtering parameters for spatial queries."),useCurrentExtent:i.boolean().optional().describe("Set to true when the previous query used the current map extent as a spatial filter. This ensures the feature effect applies only to features visible in the current view. Default is false."),includedEffect:i.string().default("drop-shadow(2px, 2px, 2px, gray)").describe("The effect applied to features that meet the filter requirements. Valid effects include: bloom, blur, brightness, contrast, drop-shadow, grayscale, hue-rotate, invert, opacity, saturate, and sepia. Prefer default unless specified."),excludedEffect:i.string().default("grayscale(100%) opacity(60%) blur(2px)").describe("The effect applied to features that do not meet the filter requirements. Valid effects include: bloom, blur, brightness, contrast, drop-shadow, grayscale, hue-rotate, invert, opacity, saturate, and sepia. Prefer default unless specified.")}),$o=h(So,{name:"setFeatureEffect",description:"Sets a feature effect on a given layer with given filter parameters and feature effects to emphasize certain features that meet a filter requirement. If no feature effect information is provided, then use the default effect provided.",schema:Io}),ie=e=>{if(e instanceof Date)return Number.isNaN(e.getTime())?null:e;if(typeof e=="number"&&Number.isFinite(e)){let t=new Date(e);return Number.isNaN(t.getTime())?null:t}return null},No=e=>!e||e==="system"?Intl.DateTimeFormat().resolvedOptions().timeZone:e==="unknown"?"UTC":e,ko=e=>{if(typeof e=="string"&&e)return e;let t=ie(e);return t?t.toISOString().slice(0,10):null},ss=()=>{let e=new Date().getTimezoneOffset(),t=e<=0?"+":"-",r=Math.floor(Math.abs(e)/60).toString().padStart(2,"0"),o=(Math.abs(e)%60).toString().padStart(2,"0"),a=`${t}${r}:${o}`;return{userTimezone:Intl.DateTimeFormat().resolvedOptions().timeZone,userTimezoneOffset:a}},Fo=(e,t,r)=>{let o=t?.toLowerCase();if(o==="date-only"){let n=ko(e);return n?Et(n,U("short-date")):e}if(o==="time-only"){if(typeof e=="string"&&e)return It(e,U("long-time"));let n=ie(e);return n?Fe(n,{...U("long-time"),timeZone:"UTC"}):e}let a=ie(e);return a?Fe(a,{...U("short-date-short-time"),timeZone:No(r)}):e},Le=(e,t,r)=>{if(e&&typeof e!="function"){let o="getField"in r&&r.getField?.(e),a=o&&"getFieldDomain"in r&&r.getFieldDomain?r.getFieldDomain(o.name):null;if(a?.type==="coded-value"){let n=a.codedValues.find(s=>s.code===t);return n?n.name:null}}return null},Mo=e=>!e||e==="system"?Intl.DateTimeFormat().resolvedOptions().timeZone:e==="unknown"?"UTC":e,Ao=e=>{if(e instanceof Date)return Number.isNaN(e.getTime())?null:e;if(typeof e=="number"&&Number.isFinite(e)){let t=new Date(e);return Number.isNaN(t.getTime())?null:t}if(typeof e=="string"&&e){let t=new Date(e);return Number.isNaN(t.getTime())?null:t}return null},Co=(e,t)=>{if(typeof e!="number")return e;let r={};t.minimumFractionDigits!==void 0&&(r.minimumFractionDigits=t.minimumFractionDigits),t.maximumFractionDigits!==void 0&&(r.maximumFractionDigits=t.maximumFractionDigits),t.useGrouping==="always"?r.useGrouping=!0:t.useGrouping==="never"&&(r.useGrouping=!1);try{return new Intl.NumberFormat(void 0,r).format(e)}catch{return e}},Ro=(e,t,r)=>{let o=Ao(e);if(!o)return e;let a={};t.dateStyle?a.dateStyle=t.dateStyle:(t.year&&(a.year=t.year),t.month&&(a.month=t.month)),t.timeStyle&&(a.timeStyle=t.timeStyle),t.timeStyle&&t.hour12==="always"?a.hour12=!0:t.timeStyle&&t.hour12==="never"&&(a.hour12=!1),a.timeZone=Mo(r);try{return new Intl.DateTimeFormat(void 0,a).format(o)}catch{return e}},Oe=(e,t)=>e.getFieldAlias?.(t)??e.fieldsIndex?.get(t)?.alias??e.fieldsIndex?.get(t)?.name??t,De=(e,t,r,o,a)=>{if(r==null)return r;let n=e.getFieldConfiguration?.(t)?.fieldFormat;return n?.type==="number"?Co(r,n):n?.type==="date-time"?Ro(r,n,a):Fo(r,o,a)},_o=(e,t,r,o)=>{let a=e.fieldsIndex?.get(t),n=Le(t,r,e)??r;return De(e,t,n,a?.type,o)},qo=(e,t)=>Oe(e,t),Pe=(e,t,r)=>{let o=e.objectIdField,a=t.features.map(s=>s.attributes[o]),n=t.features.map(s=>{let l=s.attributes,u={};return e.fields.forEach(c=>{if(!Object.hasOwn(l,c.name))return;let d=l[c.name];if(c.name===o){u[c.name]=d;return}let p=Le(c.name,d,e)??d,m=Oe(e,c.name);u[m]=De(e,c.name,p,c.type,r)}),u});return{objectIds:a,attributes:n}},zo=(e,t,r)=>{let o=e.createQuery();return o.outFields=[t],o.where=r||"1=1",o.num=1,o},jo=async(e,t,r,o)=>{let a=o.map?.allLayers.find(d=>d.id===e),n=zo(a,t,r.where),s=(await a.queryFeatures(n)).features[0],l=s?s.attributes[t]:null,u=_o(a,t,l,o.timeZone),c=qo(a,t);return{tool:"getAttribute",layerName:a.title??e,summary:`${c} = ${u}`,details:{fieldName:t,fieldAlias:c!==t?c:void 0,value:u,where:r.where}}};async function Lo({layerId:e,fieldName:t,query:r},o){let{mapView:a}=A(o),n=await jo(e,t,r,a);return JSON.stringify(n,null,2)}var Oo=i.object({layerId:i.string().describe("The layerId of the layer containing the field from which to get a value."),fieldName:i.string().describe("The name of the field/attribute from which to get a field value."),query:i.object({where:i.string().describe("The SQL-92 where clause representing the feature from which to get an attribute value.")})}),Do=h(Lo,{name:"getAttribute",description:"Returns an attribute value for a given feature.",schema:Oo}),me=(e,t,r)=>r?e.hasAllFeaturesInView&&e.availableFields===t:e.hasAllFeatures&&e.availableFields===t;function J(e,t){let r=e??"";return t!=null&&t&&(r=r?`(${r}) AND (${t})`:t),r||null}var Po=async e=>{let{targetLayer:t,fieldName:r,statisticType:o,mapView:a,layersAndFieldsRegistry:n,geometryFilter:s}=e,l=a.map?.allLayers.find(v=>v.id===t.layerId);if(!l)throw new Error(`Layer '${t.layerId}' not found.`);let u=await a.whenLayerView(l),c=n.get(t.layerId)?.fieldRegistry.get(r),d=c?.alias;if(!c)throw new Error(`Field '${r}' not found.`);let p,m;if(s){let v=await Z(s,a);if("error"in v)throw new Error(v.error);if(!v.geometry)throw D(s)?new Error(`No features found matching: ${s.where}`):new Error("Failed to create geometry");if(D(s)){let E=a.map?.allLayers.find(k=>k.id===s.layerId);p={geometryLayerName:E?.title??E?.id,geometryLayerId:s.layerId,geometryWhere:s.where,distance:s.distance,units:s.units,applied:!0}}else H(s)&&(p={point:s.point,distance:s.distance,units:s.units,applied:!0});m=new _e({geometry:v.geometry,distance:s.distance,units:s.units,spatialRelationship:"intersects"})}let y=me(u,[r],!1),b=null,f=null,w=10;if(c.type!=="geometry"&&c.type!=="oid"&&c.type!=="global-id")try{let v={layer:l,useFeaturesInView:y,view:y?a:void 0,field:r,sqlWhere:J(l.definitionExpression,t.where),...m&&{filter:m},outStatisticTypes:{include:[o]}};b=await $t(v);let E=["string","small-integer","integer"],k=c.domain?.type==="coded-value"?c.domain:null;(E.includes(c.type)||k)&&(f=(await Nt({layer:l,useFeaturesInView:y,view:y?a:void 0,field:r,sqlWhere:J(l.definitionExpression,t.where),...m&&{filter:m}})).uniqueValueInfos.sort((R,He)=>He.count-R.count).slice(0,w)),f&&c.domain?.type==="coded-value"&&(f=f.map(R=>({...R,value:k?k.getName(R.value)??R.value:R.value})))}catch(v){console.error("Statistics error:",v)}return{tool:"getStatistics",layerName:l.title??t.layerId,summary:`${o} = ${typeof b?.[o]=="number"?b[o]:"N/A"}`,details:{fieldName:r,fieldAlias:d,statisticType:o,statistic:b?.[o]??null,summaryStatistics:b,uniqueValues:f,where:t.where,spatialFilterInfo:p}}};async function Go({targetLayer:e,fieldName:t,statisticType:r,geometryFilter:o},a){let n=je(a,"layersAndFieldsRegistry"),{mapView:s}=A(a),l=await Po({targetLayer:e,fieldName:t,statisticType:r,mapView:s,layersAndFieldsRegistry:n,geometryFilter:o});return JSON.stringify(l,null,2)}var Vo=i.object({layerId:i.string().describe("The layerId of the layer containing the geometry by which to filter."),where:i.string().describe("The SQL-92 where clause representing the features from which to filter."),distance:i.number().optional().describe("The buffer distance around the geometry."),units:N.optional().describe("The units for the distance buffer.")}),Qo=i.object({point:i.object({x:i.number().describe("X coordinate (longitude) from navigation result"),y:i.number().describe("Y coordinate (latitude) from navigation result"),spatialReference:i.object({wkid:i.number().describe("Spatial reference WKID (e.g., 4326 for WGS84)")}).optional().describe("Spatial reference. Defaults to map's spatial reference if not provided.")}).describe("Point coordinates from a previous navigation/geocoding result"),distance:i.number().optional().describe("Optional buffer distance around the point."),units:N.optional().describe("The units for the distance buffer.")}),Bo=i.object({targetLayer:i.object({layerId:i.string().describe("The layerId of the layer containing the field from which to get a value."),where:i.string().describe("The SQL-92 where clause representing the feature from which to get an attribute value.")}),geometryFilter:i.union([Vo,Qo]).optional().describe("Geometry filter for spatial queries. Use 'point' option with x/y coordinates from navigation results to find features at that location (point-in-polygon). Use 'layerId/where' option to filter by features from another layer."),fieldName:i.string().describe("The name of the field for which to get statistics. STRICTLY DO NOT use OBJECTID. Use any other field"),statisticType:i.enum(["avg","max","median","min","stddev","sum","variance","nullcount","count"]).describe("The statistic type to calculate.")}),Uo=h(Go,{name:"getStatistics",description:`Computes a single aggregate statistic (max, min, avg, sum, median, stddev, variance) for a numeric field across matching features. Also returns frequency analysis for categorical fields.
75
+ Fields: This style requires a single field which may be a string, number, or date type. It is usually a string.`,schema:mo}),is=g.Root({...L(),vectorSearchLayerIds:g(),vectorSearchFieldResults:g(),layerFieldInfo:g(),selectedLayerId:g()}),ss=g.Root({...L(),vectorSearchLayerIds:g(),vectorSearchFieldResults:g(),layerFieldInfo:g(),queryResponse:g(),dataExplorationMessages:g({reducer:j,default:()=>[]})}),po=["mapView"];function A(e){let t=e?.configurable?.context;if(!t||typeof t!="object")throw new Error("DataExplorationAgent context missing");let r=po.filter(o=>!(o in t));if(r.length)throw new Error(`DataExplorationAgent context missing: ${r.join(", ")}`);return t}var ho=e=>{let t=e.map?.allLayers.filter(o=>o.type==="feature"),r=0;return t?.forEach(o=>{let a=o;a.featureEffect&&(a.featureEffect=null,r++)}),r>0?`Cleared filters from ${r} layer(s). View unchanged.`:"No active filters to clear. View unchanged."},fo=async(e,t)=>{let{mapView:r}=A(t);return ho(r)},yo=h(fo,{name:"clearFilters",description:"Clears all feature effects/filters from the map but does NOT change the current view. Use when user says 'clear filters', 'reset filters', 'remove filters', 'show all features', or wants to remove emphasis without navigating anywhere.",schema:i.object({})}),go=async e=>{e.map?.allLayers.filter(r=>r.type==="feature")?.forEach(r=>{let o=r;o.featureEffect&&(o.featureEffect=null)});let t=e.map.initialViewProperties?.viewpoint?.targetGeometry;return t?(await e.goTo(t),"Cleared all filters and returned to home extent."):"Cleared all filters. Could not determine home extent."},wo=async(e,t)=>{let{mapView:r}=A(t);return await go(r)},bo=h(wo,{name:"resetMap",description:"Clears all feature effects/filters from the map AND zooms to the home extent (initial map view). Use when user says 'reset map', 'reset the map', 'start over', or wants to both clear filters and return to the initial view.",schema:i.object({})}),Ce=5;function H(e){return"point"in e&&e.point!==void 0}function D(e){return"layerId"in e&&e.layerId!==void 0}var Z=async(e,t)=>{if(H(e)){let{point:r}=e;return{geometry:new _e({x:r.x,y:r.y,spatialReference:r.spatialReference?{wkid:r.spatialReference.wkid}:t.spatialReference})}}if(D(e)){let r=t.map?.allLayers.find(n=>n.id===e.layerId);if(!r)return{error:`Could not find geometry layer with ID: ${e.layerId}`};let o=r.title??r.id,a=e.where?.trim()||"1=1";try{let n=await r.queryFeatures({where:a,returnGeometry:!0,outSpatialReference:t.spatialReference,num:Ce+1});if(!n.features.length)return{error:`No features found in geometry layer "${o}" with the specified where clause: ${a}`};if(n.features.length>Ce)return{error:`Geometry filter for layer "${o}" matched too many features (${n.features.length}+). Please narrow the geometry layer filter.`};let s=n.features.map(u=>u.geometry).filter(u=>!!u);if(!s.length)return{error:"No valid geometries found for the matched geometry layer features."};let l=s.length===1?s[0]:ze.executeMany(s);return l?(l.spatialReference||(l.spatialReference=t.spatialReference),{geometry:l}):{error:"Failed to combine geometries from geometry layer."}}catch(n){return{error:`Failed to query geometry: ${String(n)}`}}}return{error:"Invalid geometry configuration provided"}},vo=async(e,t,r,o,a,n)=>{let s=e.map?.allLayers.find(u=>u.id===t);if(!s)return{success:!1,error:`Layer '${t}' not found.`};let l=s.createQuery();l.where=r??"1=1",o&&(l.geometry=o,l.spatialRelationship="intersects",a&&(l.distance=a),n&&(l.units=n));try{let{extent:u,count:c}=await s.queryExtent(l);return!u||c===0?{success:!1,error:`No features found for filter (where: ${l.where}${o?", spatial filter used":""})`}:(await e.goTo(u),{success:!0})}catch(u){return{success:!1,error:u instanceof Error?u.message:String(u)}}},To=async(e,t,r,o,a,n)=>{let s=t.map?.allLayers.find(m=>m.id===e.layerId);if(!s)return`Could not find target layer with ID: ${e.layerId}`;let l;if(a){let m=await Z(a,t);if("error"in m)return m.error;l=m.geometry}if(s.featureEffect=null,s.featureEffect=new Et({filter:new qe({...e.objectIds?.length?{objectIds:e.objectIds}:{where:e.where},geometry:l,spatialRelationship:"intersects",distance:a?.distance,units:a?.units}),includedEffect:r,excludedEffect:o}),s.visible=!0,n)return`Applied feature effects to "${s.title??e.layerId}" within current map extent.`;let u=e.objectIds?.length?`${s.objectIdField} IN (${e.objectIds.join(",")})`:e.where,c=await vo(t,e.layerId,u,l,a?.distance,a?.units),d=s.title??e.layerId;return c.success?`Applied feature effects to target layer "${s.title??e.layerId}"${a&&"layerId"in a?` using geometry from layer "${a.layerId}"`:""}.`:`Applied filter to "${d}" but no features matched. ${c.error}`},So=["feet","kilometers","meters","miles","nautical-miles","us-nautical-miles"],N=i.enum(So),xo=async({targetLayer:e,geometryFilter:t,useCurrentExtent:r,includedEffect:o="drop-shadow(2px, 2px, 2px, gray)",excludedEffect:a="grayscale(100%) opacity(60%) blur(2px)"},n)=>{let{mapView:s}=A(n);return await To(e,s,o,a,t,r)},Eo=i.object({layerId:i.string().describe("The layerId of the layer containing the geometry by which to filter."),where:i.string().describe("The SQL-92 where clause representing the features from which to filter."),distance:i.number().optional().describe("The buffer distance around the geometry."),units:N.optional().describe("The units for the distance buffer.")}),Io=i.object({point:i.object({x:i.number().describe("X coordinate (longitude) from navigation result"),y:i.number().describe("Y coordinate (latitude) from navigation result"),spatialReference:i.object({wkid:i.number().describe("Spatial reference WKID (e.g., 4326 for WGS84)")}).optional().describe("Spatial reference. Defaults to map's spatial reference if not provided.")}).describe("Point coordinates from a previous navigation/geocoding result"),distance:i.number().optional().describe("Optional buffer distance around the point."),units:N.optional().describe("The units for the distance buffer.")}),$o=i.object({targetLayer:i.object({layerId:i.string().describe("The layerId of the layer on which to set a feature effect."),where:i.string().describe("The SQL-92 where clause representing the features to emphasize."),objectIds:i.array(i.number()).optional().describe("Array of objectIds from a previous query result. Use this instead of a where clause when the query returned objectIds (e.g. top N results). If provided, takes precedence over where clause.")}),geometryFilter:i.union([Eo,Io]).optional().describe("Optional geometry-based filtering parameters for spatial queries."),useCurrentExtent:i.boolean().optional().describe("Set to true when the previous query used the current map extent as a spatial filter. This ensures the feature effect applies only to features visible in the current view. Default is false."),includedEffect:i.string().default("drop-shadow(2px, 2px, 2px, gray)").describe("The effect applied to features that meet the filter requirements. Valid effects include: bloom, blur, brightness, contrast, drop-shadow, grayscale, hue-rotate, invert, opacity, saturate, and sepia. Prefer default unless specified."),excludedEffect:i.string().default("grayscale(100%) opacity(60%) blur(2px)").describe("The effect applied to features that do not meet the filter requirements. Valid effects include: bloom, blur, brightness, contrast, drop-shadow, grayscale, hue-rotate, invert, opacity, saturate, and sepia. Prefer default unless specified.")}),No=h(xo,{name:"setFeatureEffect",description:"Sets a feature effect on a given layer with given filter parameters and feature effects to emphasize certain features that meet a filter requirement. If no feature effect information is provided, then use the default effect provided.",schema:$o}),ie=e=>{if(e instanceof Date)return Number.isNaN(e.getTime())?null:e;if(typeof e=="number"&&Number.isFinite(e)){let t=new Date(e);return Number.isNaN(t.getTime())?null:t}return null},ko=e=>!e||e==="system"?Intl.DateTimeFormat().resolvedOptions().timeZone:e==="unknown"?"UTC":e,Fo=e=>{if(typeof e=="string"&&e)return e;let t=ie(e);return t?t.toISOString().slice(0,10):null},ls=()=>{let e=new Date().getTimezoneOffset(),t=e<=0?"+":"-",r=Math.floor(Math.abs(e)/60).toString().padStart(2,"0"),o=(Math.abs(e)%60).toString().padStart(2,"0"),a=`${t}${r}:${o}`;return{userTimezone:Intl.DateTimeFormat().resolvedOptions().timeZone,userTimezoneOffset:a}},Mo=(e,t,r)=>{let o=t?.toLowerCase();if(o==="date-only"){let n=Fo(e);return n?It(n,U("short-date")):e}if(o==="time-only"){if(typeof e=="string"&&e)return $t(e,U("long-time"));let n=ie(e);return n?Fe(n,{...U("long-time"),timeZone:"UTC"}):e}let a=ie(e);return a?Fe(a,{...U("short-date-short-time"),timeZone:ko(r)}):e},Oe=(e,t,r)=>{if(e&&typeof e!="function"){let o="getField"in r&&r.getField?.(e),a=o&&"getFieldDomain"in r&&r.getFieldDomain?r.getFieldDomain(o.name):null;if(a?.type==="coded-value"){let n=a.codedValues.find(s=>s.code===t);return n?n.name:null}}return null},Ao=e=>!e||e==="system"?Intl.DateTimeFormat().resolvedOptions().timeZone:e==="unknown"?"UTC":e,Co=e=>{if(e instanceof Date)return Number.isNaN(e.getTime())?null:e;if(typeof e=="number"&&Number.isFinite(e)){let t=new Date(e);return Number.isNaN(t.getTime())?null:t}if(typeof e=="string"&&e){let t=new Date(e);return Number.isNaN(t.getTime())?null:t}return null},Ro=(e,t)=>{if(typeof e!="number")return e;let r={};t.minimumFractionDigits!==void 0&&(r.minimumFractionDigits=t.minimumFractionDigits),t.maximumFractionDigits!==void 0&&(r.maximumFractionDigits=t.maximumFractionDigits),t.useGrouping==="always"?r.useGrouping=!0:t.useGrouping==="never"&&(r.useGrouping=!1);try{return new Intl.NumberFormat(void 0,r).format(e)}catch{return e}},_o=(e,t,r)=>{let o=Co(e);if(!o)return e;let a={};t.dateStyle?a.dateStyle=t.dateStyle:(t.year&&(a.year=t.year),t.month&&(a.month=t.month)),t.timeStyle&&(a.timeStyle=t.timeStyle),t.timeStyle&&t.hour12==="always"?a.hour12=!0:t.timeStyle&&t.hour12==="never"&&(a.hour12=!1),a.timeZone=Ao(r);try{return new Intl.DateTimeFormat(void 0,a).format(o)}catch{return e}},De=(e,t)=>e.getFieldAlias?.(t)??e.fieldsIndex?.get(t)?.alias??e.fieldsIndex?.get(t)?.name??t,Pe=(e,t,r,o,a)=>{if(r==null)return r;let n=e.getFieldConfiguration?.(t)?.fieldFormat;return n?.type==="number"?Ro(r,n):n?.type==="date-time"?_o(r,n,a):Mo(r,o,a)},qo=(e,t,r,o)=>{let a=e.fieldsIndex?.get(t),n=Oe(t,r,e)??r;return Pe(e,t,n,a?.type,o)},zo=(e,t)=>De(e,t),Ge=(e,t,r)=>{let o=e.objectIdField,a=t.features.map(s=>s.attributes[o]),n=t.features.map(s=>{let l=s.attributes,u={};return e.fields.forEach(c=>{if(!Object.hasOwn(l,c.name))return;let d=l[c.name];if(c.name===o){u[c.name]=d;return}let m=Oe(c.name,d,e)??d,p=De(e,c.name);u[p]=Pe(e,c.name,m,c.type,r)}),u});return{objectIds:a,attributes:n}},jo=(e,t,r)=>{let o=e.createQuery();return o.outFields=[t],o.where=r||"1=1",o.num=1,o},Lo=async(e,t,r,o)=>{let a=o.map?.allLayers.find(d=>d.id===e),n=jo(a,t,r.where),s=(await a.queryFeatures(n)).features[0],l=s?s.attributes[t]:null,u=qo(a,t,l,o.timeZone),c=zo(a,t);return{tool:"getAttribute",layerName:a.title??e,summary:`${c} = ${u}`,details:{fieldName:t,fieldAlias:c!==t?c:void 0,value:u,where:r.where}}};async function Oo({layerId:e,fieldName:t,query:r},o){let{mapView:a}=A(o),n=await Lo(e,t,r,a);return JSON.stringify(n,null,2)}var Do=i.object({layerId:i.string().describe("The layerId of the layer containing the field from which to get a value."),fieldName:i.string().describe("The name of the field/attribute from which to get a field value."),query:i.object({where:i.string().describe("The SQL-92 where clause representing the feature from which to get an attribute value.")})}),Po=h(Oo,{name:"getAttribute",description:"Returns an attribute value for a given feature.",schema:Do}),pe=(e,t,r)=>r?e.hasAllFeaturesInView&&e.availableFields===t:e.hasAllFeatures&&e.availableFields===t;function J(e,t){let r=e??"";return t!=null&&t&&(r=r?`(${r}) AND (${t})`:t),r||null}var Go=async e=>{let{targetLayer:t,fieldName:r,statisticType:o,mapView:a,layersAndFieldsRegistry:n,geometryFilter:s}=e,l=a.map?.allLayers.find(v=>v.id===t.layerId);if(!l)throw new Error(`Layer '${t.layerId}' not found.`);let u=await a.whenLayerView(l),c=n.get(t.layerId)?.fieldRegistry.get(r),d=c?.alias;if(!c)throw new Error(`Field '${r}' not found.`);let m,p;if(s){let v=await Z(s,a);if("error"in v)throw new Error(v.error);if(!v.geometry)throw D(s)?new Error(`No features found matching: ${s.where}`):new Error("Failed to create geometry");if(D(s)){let E=a.map?.allLayers.find(k=>k.id===s.layerId);m={geometryLayerName:E?.title??E?.id,geometryLayerId:s.layerId,geometryWhere:s.where,distance:s.distance,units:s.units,applied:!0}}else H(s)&&(m={point:s.point,distance:s.distance,units:s.units,applied:!0});p=new qe({geometry:v.geometry,distance:s.distance,units:s.units,spatialRelationship:"intersects"})}let y=pe(u,[r],!1),b=null,f=null,w=10;if(c.type!=="geometry"&&c.type!=="oid"&&c.type!=="global-id")try{let v={layer:l,useFeaturesInView:y,view:y?a:void 0,field:r,sqlWhere:J(l.definitionExpression,t.where),...p&&{filter:p},outStatisticTypes:{include:[o]}};b=await Nt(v);let E=["string","small-integer","integer"],k=c.domain?.type==="coded-value"?c.domain:null;(E.includes(c.type)||k)&&(f=(await kt({layer:l,useFeaturesInView:y,view:y?a:void 0,field:r,sqlWhere:J(l.definitionExpression,t.where),...p&&{filter:p}})).uniqueValueInfos.sort((R,Je)=>Je.count-R.count).slice(0,w)),f&&c.domain?.type==="coded-value"&&(f=f.map(R=>({...R,value:k?k.getName(R.value)??R.value:R.value})))}catch(v){console.error("Statistics error:",v)}return{tool:"getStatistics",layerName:l.title??t.layerId,summary:`${o} = ${typeof b?.[o]=="number"?b[o]:"N/A"}`,details:{fieldName:r,fieldAlias:d,statisticType:o,statistic:b?.[o]??null,summaryStatistics:b,uniqueValues:f,where:t.where,spatialFilterInfo:m}}};async function Vo({targetLayer:e,fieldName:t,statisticType:r,geometryFilter:o},a){let n=Le(a,"layersAndFieldsRegistry"),{mapView:s}=A(a),l=await Go({targetLayer:e,fieldName:t,statisticType:r,mapView:s,layersAndFieldsRegistry:n,geometryFilter:o});return JSON.stringify(l,null,2)}var Qo=i.object({layerId:i.string().describe("The layerId of the layer containing the geometry by which to filter."),where:i.string().describe("The SQL-92 where clause representing the features from which to filter."),distance:i.number().optional().describe("The buffer distance around the geometry."),units:N.optional().describe("The units for the distance buffer.")}),Bo=i.object({point:i.object({x:i.number().describe("X coordinate (longitude) from navigation result"),y:i.number().describe("Y coordinate (latitude) from navigation result"),spatialReference:i.object({wkid:i.number().describe("Spatial reference WKID (e.g., 4326 for WGS84)")}).optional().describe("Spatial reference. Defaults to map's spatial reference if not provided.")}).describe("Point coordinates from a previous navigation/geocoding result"),distance:i.number().optional().describe("Optional buffer distance around the point."),units:N.optional().describe("The units for the distance buffer.")}),Uo=i.object({targetLayer:i.object({layerId:i.string().describe("The layerId of the layer containing the field from which to get a value."),where:i.string().describe("The SQL-92 where clause representing the feature from which to get an attribute value.")}),geometryFilter:i.union([Qo,Bo]).optional().describe("Geometry filter for spatial queries. Use 'point' option with x/y coordinates from navigation results to find features at that location (point-in-polygon). Use 'layerId/where' option to filter by features from another layer."),fieldName:i.string().describe("The name of the field for which to get statistics. STRICTLY DO NOT use OBJECTID. Use any other field"),statisticType:i.enum(["avg","max","median","min","stddev","sum","variance","nullcount","count"]).describe("The statistic type to calculate.")}),Ko=h(Vo,{name:"getStatistics",description:`Computes a single aggregate statistic (max, min, avg, sum, median, stddev, variance) for a numeric field across matching features. Also returns frequency analysis for categorical fields.
76
76
 
77
77
  USE THIS TOOL FOR:
78
78
  - "What is the average/maximum/minimum/total [field]?" \u2014 aggregate computations
@@ -84,7 +84,7 @@ DO NOT USE FOR:
84
84
  - "Show / list / find features" \u2014 use queryFeatures instead
85
85
  - Simple counts of features matching a condition \u2014 use queryFeatures instead
86
86
 
87
- Only call this tool when the answer requires computing an aggregate (avg, max, min, sum, median, stddev) over a field's values, not just counting or listing features.`,schema:Bo}),Ko=async(e,t,r,o,a)=>{let n=r.map?.allLayers.find(m=>m.id===e.layerId),s=await r.whenLayerView(n),l=n.title??e.layerId,u;if(o){let m=await Z(o,r);if("error"in m)return{tool:"getTopFeatures",layerName:l,summary:"Geometry lookup failed",details:{error:m.error}};if(!m.geometry)return{tool:"getTopFeatures",layerName:l,summary:"No features found for geometry filter",details:{error:`No features found matching: ${"where"in o?o.where:"unknown criteria"}`}};u=m.geometry}else a&&(u=r.extent.clone());let c=t.groupByFields&&t.groupByFields.length>0,d=n.objectIdField,p=e.outFields.includes("*")?["*"]:[...new Set([...e.outFields,d])];try{let m;if(c){let f=new kt({where:e.where||"1=1",outFields:p,orderByFields:e.orderByFields,geometry:u,spatialRelationship:u?"intersects":void 0,distance:o?.distance,units:o?.units,topFilter:new Ft({topCount:t.topCount,groupByFields:t.groupByFields,orderByFields:t.orderByFields})});m=await n.queryTopFeatures(f)}else{let f=n.createQuery();f.where=J(n.definitionExpression,e.where||"1=1"),f.outFields=p.length?p:["*"],f.orderByFields=t.orderByFields,f.num=t.topCount,u&&(f.geometry=u,f.spatialRelationship="intersects"),o?.distance&&(f.distance=o.distance),o?.units&&(f.units=o.units),f.outSpatialReference=r.spatialReference;let w=me(s,e.outFields,a??!1);try{m=w?await s.queryFeatures(f):await n.queryFeatures(f)}catch(v){console.warn("Client-side query failed, falling back to server:",v),m=await n.queryFeatures(f)}}let y=m.features.map(f=>f.attributes[d]),{attributes:b}=Pe(n,m,r.timeZone);return{tool:"getTopFeatures",layerName:l,summary:`Top ${t.topCount} features extracted`,details:{topCount:t.topCount,attributes:b,objectIds:y,objectIdField:d,where:e.where,orderByFields:t.orderByFields,...c&&{groupByFields:t.groupByFields}}}}catch(m){return{tool:"getTopFeatures",layerName:l,summary:"Query failed",details:{error:m instanceof Error?m.message:String(m)}}}},Wo=async({targetLayer:e,topFilter:t,geometryFilter:r,useCurrentExtent:o},a)=>{let{mapView:n}=A(a),s=await Ko(e,t,n,r,o);return JSON.stringify(s,null,2)},Ho=i.object({layerId:i.string().describe("The layerId of the layer containing the geometry by which to filter."),where:i.string().describe("The SQL-92 where clause representing the features from which to filter."),distance:i.number().optional().describe("The buffer distance around the geometry."),units:N.optional().describe("The units for the distance buffer.")}),Jo=i.object({point:i.object({x:i.number().describe("X coordinate (longitude) from navigation result"),y:i.number().describe("Y coordinate (latitude) from navigation result"),spatialReference:i.object({wkid:i.number().describe("Spatial reference WKID (e.g., 4326 for WGS84)")}).optional().describe("Spatial reference. Defaults to map's spatial reference if not provided.")}).describe("Point coordinates from a previous navigation/geocoding result"),distance:i.number().optional().describe("Optional buffer distance around the point."),units:N.optional().describe("The units for the distance buffer.")}),Zo=i.object({targetLayer:i.object({layerId:i.string().describe("The layerId of the layer containing the field from which to get a value."),where:i.string().describe("The SQL-92 where clause representing the feature from which to get an attribute value."),orderByFields:i.array(i.string().describe("The field(s) and order for which to sort the resulting features.")),outFields:i.array(i.string().describe('The fields to include in the output that will be presented to the user. This should include identifying information about the resulting features, like a name or id, along with the values desired in the output. If unsure, choose all fields ("*").').default("*"))}),geometryFilter:i.union([Ho,Jo]).optional().describe("Geometry filter for spatial queries. Use 'point' option with x/y coordinates from navigation results to find features at that location (point-in-polygon). Use 'layerId/where' option to filter by features from another layer."),topFilter:i.object({topCount:i.number().describe("Number of top features to return per group."),orderByFields:i.array(i.string().describe("Field(s) to rank by with ASC/DESC. Must be existing field names, not aggregate functions.")),groupByFields:i.array(i.string().describe("Field(s) to group results by. Returns top N per group."))}).required(),useCurrentExtent:i.boolean().optional().describe("Set to true ONLY when user explicitly asks about features 'in my view', 'on my map', 'I am looking at'. Default is false (queries entire layer).")}),Yo=h(Wo,{name:"getTopFeatures",description:'Returns top N features ranked by an existing field value. Use for "highest", "lowest", "top N" questions where ranking is based on a field that already exists in the data (e.g., population, value, date, depth). orderByFields must be actual field names with ASC/DESC. Do NOT use aggregate functions like COUNT(), SUM(), AVG() - those require getStatistics.',schema:Zo}),ae=25,Xo=async(e,t,r,o)=>{let a=t.map?.allLayers.find(f=>f.id===e.layerId),n=await t.whenLayerView(a),s=a.title??e.layerId,l;if(r){let f=await Z(r,t);if("error"in f){let w={error:f.error};if(D(r)){let v=t.map?.allLayers.find(E=>E.id===r.layerId);w.geometryLayerName=v?.title??v?.id,w.geometryLayerId=r.layerId,w.geometryWhere=r.where}else H(r)&&(w.point=r.point);return{tool:"queryFeatures",layerName:s,summary:"Geometry lookup failed",details:w}}if(!f.geometry){let w={};if(D(r)){let v=t.map?.allLayers.find(E=>E.id===r.layerId);w.error=`No features found matching: ${r.where}`,w.geometryLayerName=v?.title??v?.id,w.geometryLayerId=r.layerId,w.geometryWhere=r.where}else H(r)&&(w.error="Failed to create point geometry",w.point=r.point);return{tool:"queryFeatures",layerName:s,summary:"No features found for geometry filter",details:w}}l=f.geometry}else o&&(l=t.extent.clone());let u=me(n,e.outFields,o??!1),c=a.objectIdField,d=a.createQuery();d.where=J(a.definitionExpression,e.where||"1=1"),d.outFields=e.outFields.includes("*")?["*"]:[...new Set([...e.outFields,c])],d.orderByFields=e.orderByFields,l&&(d.geometry=l,d.spatialRelationship="intersects"),r?.distance&&(d.distance=r.distance),r?.units&&(d.units=r.units),d.outSpatialReference=t.spatialReference;let p,m;try{p=u?await n.queryFeatureCount(d):await a.queryFeatureCount(d),p>0&&p<=ae&&(m=u?await n.queryFeatures(d):await a.queryFeatures(d))}catch(f){console.warn("Client-side query failed, falling back to server:",f),p=await a.queryFeatureCount(d),p>0&&p<=ae&&(m=await a.queryFeatures(d))}let{objectIds:y,attributes:b}=m?Pe(a,m,t.timeZone):{objectIds:void 0,attributes:void 0};return{tool:"queryFeatures",layerName:s,summary:`${p} features found`,details:{totalCount:p,where:e.where,orderByFields:e.orderByFields,outFields:e.outFields,...y&&{objectIds:y,objectIdField:c},...b&&{attributes:b},...p>ae&&{note:`${p} features found.`}}}};async function ea({targetLayer:e,geometryFilter:t,useCurrentExtent:r},o){let{mapView:a}=A(o),n=await Xo(e,a,t,r);return JSON.stringify(n,null,2)}var ta=i.object({layerId:i.string().describe("The layerId of the layer containing the geometry by which to filter."),where:i.string().describe("The SQL-92 where clause representing the features from which to filter."),distance:i.number().optional().describe("The buffer distance around the geometry."),units:N.optional().describe("The units for the distance buffer.")}),ra=i.object({point:i.object({x:i.number().describe("X coordinate (longitude) from navigation result"),y:i.number().describe("Y coordinate (latitude) from navigation result"),spatialReference:i.object({wkid:i.number().describe("Spatial reference WKID (e.g., 4326 for WGS84)")}).optional().describe("Spatial reference. Defaults to map's spatial reference if not provided.")}).describe("Point coordinates from a previous navigation/geocoding result"),distance:i.number().optional().describe("Optional buffer distance around the point."),units:N.optional().describe("The units for the distance buffer.")}),oa=i.object({targetLayer:i.object({layerId:i.string().describe("The layerId of the layer containing the field from which to get a value."),where:i.string().describe("SQL-92 where clause. IMPORTANT: When using geometryFilter.point for point-in-polygon queries, set this to '1=1' to return all features that intersect the point. Only add attribute filters if the user specifically requests them in addition to the spatial query."),orderByFields:i.array(i.string().describe("The field(s) and order for which to sort the resulting features.")),outFields:i.array(i.string().describe('The fields to include in the output that will be presented to the user. This should include identifying information about the resulting features, like a name or id, along with the values desired in the output. If unsure, choose all fields ("*").').default("*"))}),geometryFilter:i.union([ta,ra]).optional().describe("Geometry filter for spatial queries. Use 'point' option with x/y coordinates from navigation results to find features at that location (point-in-polygon). Use 'layerId/where' option to filter by features from another layer."),useCurrentExtent:i.boolean().optional().describe("Set to true ONLY when user explicitly asks about features 'in my view', 'on my map', 'I am looking at', OR when the user refers back to features previously identified using the current extent (e.g. 'these', 'those', 'them', 'the same ones'). Default is false (queries entire layer).")}),aa=h(ea,{name:"queryFeatures",description:`Queries features from a layer. Returns the total count of matching features, plus individual feature attributes if \u226425 features match.
87
+ Only call this tool when the answer requires computing an aggregate (avg, max, min, sum, median, stddev) over a field's values, not just counting or listing features.`,schema:Uo}),Wo=async(e,t,r,o,a)=>{let n=r.map?.allLayers.find(p=>p.id===e.layerId),s=await r.whenLayerView(n),l=n.title??e.layerId,u;if(o){let p=await Z(o,r);if("error"in p)return{tool:"getTopFeatures",layerName:l,summary:"Geometry lookup failed",details:{error:p.error}};if(!p.geometry)return{tool:"getTopFeatures",layerName:l,summary:"No features found for geometry filter",details:{error:`No features found matching: ${"where"in o?o.where:"unknown criteria"}`}};u=p.geometry}else a&&(u=r.extent.clone());let c=t.groupByFields&&t.groupByFields.length>0,d=n.objectIdField,m=e.outFields.includes("*")?["*"]:[...new Set([...e.outFields,d])];try{let p;if(c){let f=new Ft({where:e.where||"1=1",outFields:m,orderByFields:e.orderByFields,geometry:u,spatialRelationship:u?"intersects":void 0,distance:o?.distance,units:o?.units,topFilter:new Mt({topCount:t.topCount,groupByFields:t.groupByFields,orderByFields:t.orderByFields})});p=await n.queryTopFeatures(f)}else{let f=n.createQuery();f.where=J(n.definitionExpression,e.where||"1=1"),f.outFields=m.length?m:["*"],f.orderByFields=t.orderByFields,f.num=t.topCount,u&&(f.geometry=u,f.spatialRelationship="intersects"),o?.distance&&(f.distance=o.distance),o?.units&&(f.units=o.units),f.outSpatialReference=r.spatialReference;let w=pe(s,e.outFields,a??!1);try{p=w?await s.queryFeatures(f):await n.queryFeatures(f)}catch(v){console.warn("Client-side query failed, falling back to server:",v),p=await n.queryFeatures(f)}}let y=p.features.map(f=>f.attributes[d]),{attributes:b}=Ge(n,p,r.timeZone);return{tool:"getTopFeatures",layerName:l,summary:`Top ${t.topCount} features extracted`,details:{topCount:t.topCount,attributes:b,objectIds:y,objectIdField:d,where:e.where,orderByFields:t.orderByFields,...c&&{groupByFields:t.groupByFields}}}}catch(p){return{tool:"getTopFeatures",layerName:l,summary:"Query failed",details:{error:p instanceof Error?p.message:String(p)}}}},Ho=async({targetLayer:e,topFilter:t,geometryFilter:r,useCurrentExtent:o},a)=>{let{mapView:n}=A(a),s=await Wo(e,t,n,r,o);return JSON.stringify(s,null,2)},Jo=i.object({layerId:i.string().describe("The layerId of the layer containing the geometry by which to filter."),where:i.string().describe("The SQL-92 where clause representing the features from which to filter."),distance:i.number().optional().describe("The buffer distance around the geometry."),units:N.optional().describe("The units for the distance buffer.")}),Zo=i.object({point:i.object({x:i.number().describe("X coordinate (longitude) from navigation result"),y:i.number().describe("Y coordinate (latitude) from navigation result"),spatialReference:i.object({wkid:i.number().describe("Spatial reference WKID (e.g., 4326 for WGS84)")}).optional().describe("Spatial reference. Defaults to map's spatial reference if not provided.")}).describe("Point coordinates from a previous navigation/geocoding result"),distance:i.number().optional().describe("Optional buffer distance around the point."),units:N.optional().describe("The units for the distance buffer.")}),Yo=i.object({targetLayer:i.object({layerId:i.string().describe("The layerId of the layer containing the field from which to get a value."),where:i.string().describe("The SQL-92 where clause representing the feature from which to get an attribute value."),orderByFields:i.array(i.string().describe("The field(s) and order for which to sort the resulting features.")),outFields:i.array(i.string().describe('The fields to include in the output that will be presented to the user. This should include identifying information about the resulting features, like a name or id, along with the values desired in the output. If unsure, choose all fields ("*").').default("*"))}),geometryFilter:i.union([Jo,Zo]).optional().describe("Geometry filter for spatial queries. Use 'point' option with x/y coordinates from navigation results to find features at that location (point-in-polygon). Use 'layerId/where' option to filter by features from another layer."),topFilter:i.object({topCount:i.number().describe("Number of top features to return per group."),orderByFields:i.array(i.string().describe("Field(s) to rank by with ASC/DESC. Must be existing field names, not aggregate functions.")),groupByFields:i.array(i.string().describe("Field(s) to group results by. Returns top N per group."))}).required(),useCurrentExtent:i.boolean().optional().describe("Set to true ONLY when user explicitly asks about features 'in my view', 'on my map', 'I am looking at'. Default is false (queries entire layer).")}),Xo=h(Ho,{name:"getTopFeatures",description:'Returns top N features ranked by an existing field value. Use for "highest", "lowest", "top N" questions where ranking is based on a field that already exists in the data (e.g., population, value, date, depth). orderByFields must be actual field names with ASC/DESC. Do NOT use aggregate functions like COUNT(), SUM(), AVG() - those require getStatistics.',schema:Yo}),ae=25,ea=async(e,t,r,o)=>{let a=t.map?.allLayers.find(f=>f.id===e.layerId),n=await t.whenLayerView(a),s=a.title??e.layerId,l;if(r){let f=await Z(r,t);if("error"in f){let w={error:f.error};if(D(r)){let v=t.map?.allLayers.find(E=>E.id===r.layerId);w.geometryLayerName=v?.title??v?.id,w.geometryLayerId=r.layerId,w.geometryWhere=r.where}else H(r)&&(w.point=r.point);return{tool:"queryFeatures",layerName:s,summary:"Geometry lookup failed",details:w}}if(!f.geometry){let w={};if(D(r)){let v=t.map?.allLayers.find(E=>E.id===r.layerId);w.error=`No features found matching: ${r.where}`,w.geometryLayerName=v?.title??v?.id,w.geometryLayerId=r.layerId,w.geometryWhere=r.where}else H(r)&&(w.error="Failed to create point geometry",w.point=r.point);return{tool:"queryFeatures",layerName:s,summary:"No features found for geometry filter",details:w}}l=f.geometry}else o&&(l=t.extent.clone());let u=pe(n,e.outFields,o??!1),c=a.objectIdField,d=a.createQuery();d.where=J(a.definitionExpression,e.where||"1=1"),d.outFields=e.outFields.includes("*")?["*"]:[...new Set([...e.outFields,c])],d.orderByFields=e.orderByFields,l&&(d.geometry=l,d.spatialRelationship="intersects"),r?.distance&&(d.distance=r.distance),r?.units&&(d.units=r.units),d.outSpatialReference=t.spatialReference;let m,p;try{m=u?await n.queryFeatureCount(d):await a.queryFeatureCount(d),m>0&&m<=ae&&(p=u?await n.queryFeatures(d):await a.queryFeatures(d))}catch(f){console.warn("Client-side query failed, falling back to server:",f),m=await a.queryFeatureCount(d),m>0&&m<=ae&&(p=await a.queryFeatures(d))}let{objectIds:y,attributes:b}=p?Ge(a,p,t.timeZone):{objectIds:void 0,attributes:void 0};return{tool:"queryFeatures",layerName:s,summary:`${m} features found`,details:{totalCount:m,where:e.where,orderByFields:e.orderByFields,outFields:e.outFields,...y&&{objectIds:y,objectIdField:c},...b&&{attributes:b},...m>ae&&{note:`${m} features found.`}}}};async function ta({targetLayer:e,geometryFilter:t,useCurrentExtent:r},o){let{mapView:a}=A(o),n=await ea(e,a,t,r);return JSON.stringify(n,null,2)}var ra=i.object({layerId:i.string().describe("The layerId of the layer containing the geometry by which to filter."),where:i.string().describe("The SQL-92 where clause representing the features from which to filter."),distance:i.number().optional().describe("The buffer distance around the geometry."),units:N.optional().describe("The units for the distance buffer.")}),oa=i.object({point:i.object({x:i.number().describe("X coordinate (longitude) from navigation result"),y:i.number().describe("Y coordinate (latitude) from navigation result"),spatialReference:i.object({wkid:i.number().describe("Spatial reference WKID (e.g., 4326 for WGS84)")}).optional().describe("Spatial reference. Defaults to map's spatial reference if not provided.")}).describe("Point coordinates from a previous navigation/geocoding result"),distance:i.number().optional().describe("Optional buffer distance around the point."),units:N.optional().describe("The units for the distance buffer.")}),aa=i.object({targetLayer:i.object({layerId:i.string().describe("The layerId of the layer containing the field from which to get a value."),where:i.string().describe("SQL-92 where clause. IMPORTANT: When using geometryFilter.point for point-in-polygon queries, set this to '1=1' to return all features that intersect the point. Only add attribute filters if the user specifically requests them in addition to the spatial query."),orderByFields:i.array(i.string().describe("The field(s) and order for which to sort the resulting features.")),outFields:i.array(i.string().describe('The fields to include in the output that will be presented to the user. This should include identifying information about the resulting features, like a name or id, along with the values desired in the output. If unsure, choose all fields ("*").').default("*"))}),geometryFilter:i.union([ra,oa]).optional().describe("Geometry filter for spatial queries. Use 'point' option with x/y coordinates from navigation results to find features at that location (point-in-polygon). Use 'layerId/where' option to filter by features from another layer."),useCurrentExtent:i.boolean().optional().describe("Set to true ONLY when user explicitly asks about features 'in my view', 'on my map', 'I am looking at', OR when the user refers back to features previously identified using the current extent (e.g. 'these', 'those', 'them', 'the same ones'). Default is false (queries entire layer).")}),na=h(ta,{name:"queryFeatures",description:`Queries features from a layer. Returns the total count of matching features, plus individual feature attributes if \u226425 features match.
88
88
 
89
89
  USE THIS TOOL FOR:
90
90
  - "Show / display / list features where..." \u2014 finding and listing features
@@ -93,43 +93,42 @@ USE THIS TOOL FOR:
93
93
  - Spatial queries \u2014 finding features near/within/intersecting other features
94
94
  - Any question where the user wants to SEE or COUNT matching features
95
95
 
96
- This is the DEFAULT tool for most queries. When in doubt, use this tool.`,schema:oa}),na=[Do,Uo,Yo,aa],ls=[$o,wo,fo],ia=new B(na);async function cs(e,t){let{messages:r}=await ia.invoke({messages:e.dataExplorationMessages},t),o=[],a=[];for(let n of r){let s=n.content,l;typeof s!="string"&&(l={tool:n.name??"unknown",layerName:"unknown",summary:"Query failed",details:{error:"Skipping non-string tool output:",raw:s}});try{typeof s=="string"?l=JSON.parse(s):l={tool:n.name??"unknown",layerName:"unknown",summary:"Query failed",details:{error:"Invalid tool output type",raw:s}}}catch{l={tool:n.name??"unknown",layerName:"unknown",summary:"Query failed",details:{error:s}}}o.push(l),l.details&&typeof l.details=="object"&&"error"in l.details?a.push(`- ${l.tool}: Error - ${String(l.details.error)}`):a.push(`- ${l.layerName}: ${l.summary}`)}return await T({text:`Finished executing layer query tool: ${a.join(", ")}`},t),{...e,dataExplorationMessages:[...e.dataExplorationMessages,...r],queryResponse:o,status:"success",outputMessage:a.join(`
97
- `),summary:a.length>0?lr(a.join(`
98
- `)):"Query executed."}}var us=g.Root({...L(),helpInternalState:g({reducer:O,default:()=>({toolCallMessage:void 0})})}),sa=(e,t)=>{let r=Array.from(e.values()).find(({layerItem:n})=>n.title?.toLowerCase().includes(t.toLowerCase()));if(!r){let n=Array.from(e.values()).map(s=>s.layerItem.title).join(", ");return`Could not find a layer matching "${t}". Available layers: ${n}`}let o=Array.from(r.fieldRegistry.values()),a=o.map(n=>`- **${n.alias||n.name}** (\`${n.name}\`, ${n.type})${n.description?`: ${n.description}`:""}`).join(`
96
+ This is the DEFAULT tool for most queries. When in doubt, use this tool.`,schema:aa}),ia=[Po,Ko,Xo,na],cs=[No,bo,yo],sa=new B(ia,{handleToolErrors:!1});async function us(e,t){let{messages:r}=await sa.invoke({messages:e.dataExplorationMessages},t),o=[],a=[];for(let n of r){let s=n.content,l;typeof s!="string"&&(l={tool:n.name??"unknown",layerName:"unknown",summary:"Query failed",details:{error:"Skipping non-string tool output:",raw:s}});try{typeof s=="string"?l=JSON.parse(s):l={tool:n.name??"unknown",layerName:"unknown",summary:"Query failed",details:{error:"Invalid tool output type",raw:s}}}catch{l={tool:n.name??"unknown",layerName:"unknown",summary:"Query failed",details:{error:s}}}o.push(l),l.details&&typeof l.details=="object"&&"error"in l.details?a.push(`- ${l.tool}: Error - ${String(l.details.error)}`):a.push(`- ${l.layerName}: ${l.summary}`)}return await T({text:`Finished executing layer query tool: ${a.join(", ")}`},t),{...e,dataExplorationMessages:[...e.dataExplorationMessages,...r],queryResponse:o,status:"success",summary:a.length>0?cr(a.join(`
97
+ `)):"Query executed."}}var ds=g.Root({...L(),helpInternalState:g({reducer:O,default:()=>({toolCallMessage:void 0})})}),la=(e,t)=>{let r=Array.from(e.values()).find(({layerItem:n})=>n.title?.toLowerCase().includes(t.toLowerCase()));if(!r){let n=Array.from(e.values()).map(s=>s.layerItem.title).join(", ");return`Could not find a layer matching "${t}". Available layers: ${n}`}let o=Array.from(r.fieldRegistry.values()),a=o.map(n=>`- **${n.alias||n.name}** (\`${n.name}\`, ${n.type})${n.description?`: ${n.description}`:""}`).join(`
99
98
  `);return`**${r.layerItem.title}** has ${o.length} field(s):
100
99
 
101
- ${a}`},la=async({layerTitle:e},t)=>{let r=je(t,"layersAndFieldsRegistry");return sa(r,e)},ds=h(la,{name:"listLayerFields",description:"Lists all fields for a given layer by title. Use ONLY when the user explicitly asks to see fields, columns, or attributes of a specific named layer. Do NOT call this tool for general help questions, capability overviews, or layer listing.",schema:i.object({layerTitle:i.string().describe("The title or partial title of the layer to list fields for.")})}),ps=g.Root({...L(),intent:g({reducer:(e,t)=>t}),arcgisKnowledgeMessages:g({reducer:j,default:()=>[]}),arcgisKnowledgeToolResult:g({reducer:(e,t)=>t,default:()=>null})}),K={conversationId:""};function he(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 C(e){return!!e?.map&&!("activeLinkChartLayer"in e.map)}async function Y(e){!e||C(e)||!e.map?.diagramNodesExtent||await e.goTo(e.map.diagramNodesExtent)}function X(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)&&he(r),{view:r}}function ms(e){let t=e?.configurable?.context;if(Ge(e)==="knowledgeGraph")return"knowledgeGraph";let r=t.view;return C(r)?(he(r),"map"):"linkChart"}async function G(e){let t=e?.configurable?.context;if(Ge(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 Me(o)}}else{he(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 Me(o)}}}}function Ge(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 se=class{constructor(t){this.dataModel=t,this.kind="GraphQueryGenerationRequest",this.explainQuery=!0,this.schemaInformation=le.fromDataModel(t)}},le=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(P.fromEntityType(o));for(let o of t.relationshipTypes)r.relationshipTypes.push(ce.fromRelationshipType(o));return r.identifierInfo={mappingInfo:{identifierMapsTo:ca(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}.
102
- Relationship Types: ${o}.`}},P=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=ua(t.role);for(let o of t.properties){let a={name:o.name,alias:o.alias?o.alias:void 0,fieldType:o.fieldType,role:da(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}},ce=class extends P{constructor(){super(...arguments),this.observedEndPoints=[]}static fromRelationshipType(t){let r=P.fromEntityType(t);r.observedEndPoints=[];for(let o of t.endPoints)r.observedEndPoints.push({originEntityType:o.originEntityType,destinationEntityType:o.destinationEntityType});return r}},ca=e=>{switch(e){case"esriIdentifierInfoTypeUNSPECIFIED":return"UNSPECIFIED";case"esriIdentifierInfoTypeDatabaseNative":return"DatabaseNative";case"esriIdentifierInfoTypeUniformProperty":return"UniformPropertyIdentifier";default:return e}},ua=e=>{switch(e){case"Regular":return"esriGraphNamedObjectRegular";case"Provenance":return"esriGraphNamedObjectProvenance";case"Document":return"esriGraphNamedObjectDocument";default:return e}};function da(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 pa(e,t){return t?`${e}
100
+ ${a}`},ca=async({layerTitle:e},t)=>{let r=Le(t,"layersAndFieldsRegistry");return la(r,e)},ms=h(ca,{name:"listLayerFields",description:"Lists all fields for a given layer by title. Use ONLY when the user explicitly asks to see fields, columns, or attributes of a specific named layer. Do NOT call this tool for general help questions, capability overviews, or layer listing.",schema:i.object({layerTitle:i.string().describe("The title or partial title of the layer to list fields for.")})}),ps=g.Root({...L(),intent:g({reducer:(e,t)=>t}),arcgisKnowledgeMessages:g({reducer:j,default:()=>[]}),arcgisKnowledgeToolResult:g({reducer:(e,t)=>t,default:()=>null})}),K={conversationId:""};function he(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 C(e){return!!e?.map&&!("activeLinkChartLayer"in e.map)}async function Y(e){!e||C(e)||!e.map?.diagramNodesExtent||await e.goTo(e.map.diagramNodesExtent)}function X(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)&&he(r),{view:r}}function hs(e){let t=e?.configurable?.context;if(Ve(e)==="knowledgeGraph")return"knowledgeGraph";let r=t.view;return C(r)?(he(r),"map"):"linkChart"}async function G(e){let t=e?.configurable?.context;if(Ve(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 Me(o)}}else{he(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 Me(o)}}}}function Ve(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 se=class{constructor(t){this.dataModel=t,this.kind="GraphQueryGenerationRequest",this.explainQuery=!0,this.schemaInformation=le.fromDataModel(t)}},le=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(P.fromEntityType(o));for(let o of t.relationshipTypes)r.relationshipTypes.push(ce.fromRelationshipType(o));return r.identifierInfo={mappingInfo:{identifierMapsTo:ua(t.identifierInfo.identifierMappingInfo.identifierInfoType),identifierPropertyName:t.identifierInfo.identifierMappingInfo.uniformPropertyIdentifier.identifierPropertyName}},r.spatialReference=JSON.parse(JSON.stringify(t.spatialReference)),r}static getDataModelTypesSummary(t){let r=t.entityTypes.map(a=>a.name).join(", "),o=t.relationshipTypes.map(a=>a.name).join(", ");return`Entity Types: ${r}.
101
+ Relationship Types: ${o}.`}},P=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=da(t.role);for(let o of t.properties){let a={name:o.name,alias:o.alias?o.alias:void 0,fieldType:o.fieldType,role:ma(o.role),geometryDef:o.fieldType==="esriFieldTypeGeometry"?{geometryType:o.geometryType??"esriGeometryAny",hasM:o.hasM?o.hasM:void 0,hasZ:o.hasZ?o.hasZ:void 0}:void 0};r.properties.push(a)}return r}},ce=class extends P{constructor(){super(...arguments),this.observedEndPoints=[]}static fromRelationshipType(t){let r=P.fromEntityType(t);r.observedEndPoints=[];for(let o of t.endPoints)r.observedEndPoints.push({originEntityType:o.originEntityType,destinationEntityType:o.destinationEntityType});return r}},ua=e=>{switch(e){case"esriIdentifierInfoTypeUNSPECIFIED":return"UNSPECIFIED";case"esriIdentifierInfoTypeDatabaseNative":return"DatabaseNative";case"esriIdentifierInfoTypeUniformProperty":return"UniformPropertyIdentifier";default:return e}},da=e=>{switch(e){case"Regular":return"esriGraphNamedObjectRegular";case"Provenance":return"esriGraphNamedObjectProvenance";case"Document":return"esriGraphNamedObjectDocument";default:return e}};function ma(e){switch(e){case"esriGraphPropertyRegular":return"Regular";case"esriGraphPropertyDocumentName":return"Document_Name";case"esriGraphPropertyDocumentTitle":return"Document_Title";case"esriGraphPropertyDocumentUrl":return"Document_Url";case"esriGraphPropertyDocumentText":return"Document_Text";case"esriGraphPropertyDocumentKeywords":return"Document_Keywords";case"esriGraphPropertyDocumentContentType":return"Document_ContentType";case"esriGraphPropertyDocumentMetadata":return"Document_Metadata";case"esriGraphPropertyDocumentFileExtension":return"Document_FileExtension";case"esriGraphPropertyProvenanceInstanceId":return"Provenance_InstanceId";case"esriGraphPropertyProvenanceSourceType":return"Provenance_SourceType";case"esriGraphPropertyProvenanceSourceName":return"Provenance_SourceName";case"esriGraphPropertyProvenanceSource":return"Provenance_Source";case"esriGraphPropertyProvenanceComment":return"Provenance_Comment";case"esriGraphPropertyProvenanceTypeName":return"Provenance_TypeName";case"esriGraphPropertyProvenancePropertyName":return"Provenance_PropertyName";default:return"Regular"}}function pa(e,t){return t?`${e}
103
102
 
104
103
  Your previous attempt to generate a cypher query failed. See the details below and generate a new cypher query that avoids this error.
105
104
 
106
105
  Attempt Number: ${t.attemptCount}
107
106
  Execution Error: ${t.executionError}
108
107
  Failed Query:
109
- ${t.failedGraphQuery}`:e}async function ma(e,t,r,o){let{graphQuery:a,explanation:n}=await fe(e,t,r,o);return`Generated Graph Query:
108
+ ${t.failedGraphQuery}`:e}async function ha(e,t,r,o){let{graphQuery:a,explanation:n}=await fe(e,t,r,o);return`Generated Graph Query:
110
109
  ${a}
111
110
 
112
- Explanation: ${n}`}async function fe(e,t,r,o,a){let n={message:pa(e,a),context:new se(t)};K.conversationId&&(n.conversationId=K.conversationId),await T({text:"Attempting to generate a cypher query from your prompt..."},o);let s=await Ne(`${r}/chat`,{method:"post",body:JSON.stringify(n),headers:{"Content-Type":"application/json",token:$e.findCredential(M.getDefault().url)?.token??""}});if(s.httpStatus!==200)throw new Error(`Graph query service returned an error: ${s.httpStatus}`,{cause:s.data});K.conversationId||(K.conversationId=s.data.conversationId);let l=!1,u=Date.now(),c=s.data.sequenceNumber,d="",p="",m=1;for(;!l;){await new Promise(b=>setTimeout(b,1e3)),await T({text:`Periodically requesting status of job from ArcGIS AI Services${"...".substring(0,m)}`},o),m=m%3+1;let y=await Ne(`${r}/chat`,{method:"post",body:JSON.stringify({conversationId:s.data.conversationId,inquiryId:s.data.inquiryId,ackSequenceNumber:c}),headers:{"Content-Type":"application/json",token:$e.findCredential(M.getDefault().url)?.token??""}});if(y.httpStatus!==200)throw new Error(`Graph query service polling returned an error: ${y.httpStatus}`,{cause:y.data});if(y.data.context)d=y.data.context.graphQuery,p=y.data.message||"";else if(!y.data.hasMore)l=!0;else if(Date.now()-u>6e4)throw new Error("Graph query service polling timed out after 1 minute.");c=y.data.sequenceNumber}return{graphQuery:d,explanation:p}}var F=3;function Ve(e,t=100){let r={};for(let o of Object.entries(e.properties??{})){let[a,n]=o;typeof n=="string"&&n.length>t?r[a]=`${n.slice(0,t)}... (truncated, original length: ${n.length})`:r[a]=n}return e.properties=r,e}function ye(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 ha=async({kg:e,queryParams:t,targetStructure:r,targetStructureReducer:o,requestOptions:a,queryRowLimit:n,queryTimeoutMs:s})=>{let l=null,u=r,c=new AbortController,d=a?.signal,p=()=>{c.abort(d?.reason)};d&&(d.aborted?c.abort(d.reason):d.addEventListener("abort",p,{once:!0}));try{let m=await At(e,t,a);l=m.resultHeader;let y=m.resultRowsStream.getReader(),b=0,f=Date.now(),w=!1;for(;;){let{done:v,value:E}=await y.read();if(v)break;if(!w&&s&&Date.now()-f>s)return c.abort(),{type:"timeout"};for(let k of E){if(b++,n&&b>n)return c.abort(),{type:"success",rowLimitReached:!0,resultHeader:l,processedResult:u};u=o(u,k)}}}catch(m){return c.signal.aborted?{type:"aborted"}:{type:"error",errorMessage:ye(m),error:m}}finally{d?.removeEventListener("abort",p)}return{type:"success",rowLimitReached:!1,resultHeader:l,processedResult:u}};async function Qe({prompt:e,kg:t,graphQueryServiceUrl:r,targetStructure:o,targetStructureReducer:a,requestOptions:n,queryRowLimit:s,queryTimeoutMs:l,config:u}){let c;for(let d=1;d<=F;d++){let p;try{p=await fe(e,t.dataModel,r,u,c)}catch(b){return{type:"generation-error",errorMessage:ye(b),error:b}}await T({text:`Attempting to execute query: ${p.graphQuery.substring(0,500)}${p.graphQuery.length>500?"...":""}`},u);let m=await ha({kg:t,queryParams:new ze({openCypherQuery:p.graphQuery}),targetStructure:o,targetStructureReducer:a,requestOptions:n,queryRowLimit:s,queryTimeoutMs:l}),y=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:p.graphQuery,explanation:p.explanation,rowLimitReached:m.rowLimitReached,resultHeader:m.resultHeader,processedResult:m.processedResult};if(m.type==="aborted")return{type:"aborted",errorMessage:y,graphQuery:p.graphQuery,explanation:p.explanation};if(d>=F)return m.type==="timeout"?{type:"timeout",errorMessage:y,graphQuery:p.graphQuery,explanation:p.explanation}:{type:"execution-error",errorMessage:y,error:m.error,graphQuery:p.graphQuery,explanation:p.explanation};c={failedGraphQuery:p.graphQuery,executionError:y,attemptCount:d},await T({text:`Attempt ${d} failed with error: ${y}. Retrying...`},u)}throw new Error(`Failed to execute generated cypher due to an unexpected error after ${F} attempts.`)}var fa=async({kg:e,searchQuery:t,typeCategoryFilter:r,namedTypesFilter:o,searchResultLimit:a,requestOptions:n})=>{let s=[],l=[r];r==="both"&&!e.serviceDefinition.serviceCapabilities.searchCapabilities.searchTypeFilterCapabilities.includes("esriTypeBoth")&&(l=["entity","relationship"]);let u=a??1/0;try{for(let c of l){let d=u-s.length;if(d<=0)break;let p=(await Ct(e,new Rt({searchQuery:t,typeCategoryFilter:c,namedTypesFilter:o??void 0,num:d}),n)).resultRowsStream.getReader(),m=!1;for(;!m;){let{done:y,value:b}=await p.read();if(y){m=!0;break}for(let f of b)for(let w of f)s.push(w)}}}catch(c){return console.log('Error when running graph search with query: "',t,'" - error: ',c),n?.signal?.aborted?{type:"aborted"}:{type:"error",errorMessage:ye(c),error:c}}return{type:"success",results:s}};function ya(e,t){_(e,r=>{t.set(`${r.typeName}__${r.id}`,{id:r.id,typeName:r.typeName})})}function _(e,t){if(!(!e||typeof e!="object")){if(wa(e))for(let r of e.path)_(r,t);else if(ga(e))t(e);else if(Array.isArray(e))for(let r of e)_(r,t);else if(ba(e))for(let r of Object.values(e.properties??{}))_(r,t)}}function ga(e){return!e||typeof e!="object"||Array.isArray(e)?!1:"id"in e&&"typeName"in e}function wa(e){return!e||typeof e!="object"||Array.isArray(e)?!1:e&&"path"in e&&Array.isArray(e.path)}function ba(e){return!e||typeof e!="object"||Array.isArray(e)||"id"in e?!1:"properties"in e&&typeof e.properties=="object"}function va(e,t){let r=[];for(let o of[...t.dataModel.entityTypes,...t.dataModel.relationshipTypes]){let a=e.getMemberIdsByType(o.name);for(let n of a)r.push({id:n,typeName:o.name})}return r}function Ta(e){let t=[],r=[],o=e?.allLayers.find(a=>a.type==="knowledge-graph")?.inclusionModeDefinition;if(o?.generateAllSublayers)return{allNamedTypesFullyDynamic:!0,idTypePairs:t,dynamicTypes:r};for(let[a,n]of o?.namedTypeDefinitions??[])if(n.useAllData)r.push(a);else for(let[s]of n.members)t.push({id:s,typeName:a});return{allNamedTypesFullyDynamic:!1,idTypePairs:t,dynamicTypes:r}}async function Sa(e,t,r,o,a){let{view:n}=o,s=await Qe({prompt:e,kg:t,graphQueryServiceUrl:r,targetStructure:new Map,targetStructureReducer:(p,m)=>{for(let y of m)ya(y,p);return p},requestOptions:{signal:a?.signal,timeout:a?.timeout},config:a});if(s.type!=="success"){let p=s.type==="generation-error"?s.errorMessage:`${s.errorMessage} Cypher query: ${s.graphQuery}`;throw new Error(`Failed to add records to the link chart. ${p}`)}let{graphQuery:l,explanation:u,processedResult:c}=s,d=Array.from(c.values());return await T({text:`Query Results parsed into ${d.length} unique relationships and entities. Atempting to add to link chart...`},a),!C(n)&&n?.map?(await n.map.addRecords(d),await Y(n),`Link Chart updated successfully. Cypher Query used:
111
+ Explanation: ${n}`}async function fe(e,t,r,o,a){let n={message:pa(e,a),context:new se(t)};K.conversationId&&(n.conversationId=K.conversationId),await T({text:"Attempting to generate a cypher query from your prompt..."},o);let s=await Ne(`${r}/chat`,{method:"post",body:JSON.stringify(n),headers:{"Content-Type":"application/json",token:$e.findCredential(M.getDefault().url)?.token??""}});if(s.httpStatus!==200)throw new Error(`Graph query service returned an error: ${s.httpStatus}`,{cause:s.data});K.conversationId||(K.conversationId=s.data.conversationId);let l=!1,u=Date.now(),c=s.data.sequenceNumber,d="",m="",p=1;for(;!l;){await new Promise(b=>setTimeout(b,1e3)),await T({text:`Periodically requesting status of job from ArcGIS AI Services${"...".substring(0,p)}`},o),p=p%3+1;let y=await Ne(`${r}/chat`,{method:"post",body:JSON.stringify({conversationId:s.data.conversationId,inquiryId:s.data.inquiryId,ackSequenceNumber:c}),headers:{"Content-Type":"application/json",token:$e.findCredential(M.getDefault().url)?.token??""}});if(y.httpStatus!==200)throw new Error(`Graph query service polling returned an error: ${y.httpStatus}`,{cause:y.data});if(y.data.context)d=y.data.context.graphQuery,m=y.data.message||"";else if(!y.data.hasMore)l=!0;else if(Date.now()-u>6e4)throw new Error("Graph query service polling timed out after 1 minute.");c=y.data.sequenceNumber}return{graphQuery:d,explanation:m}}var F=3;function Qe(e,t=100){let r={};for(let o of Object.entries(e.properties??{})){let[a,n]=o;typeof n=="string"&&n.length>t?r[a]=`${n.slice(0,t)}... (truncated, original length: ${n.length})`:r[a]=n}return e.properties=r,e}function ye(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 fa=async({kg:e,queryParams:t,targetStructure:r,targetStructureReducer:o,requestOptions:a,queryRowLimit:n,queryTimeoutMs:s})=>{let l=null,u=r,c=new AbortController,d=a?.signal,m=()=>{c.abort(d?.reason)};d&&(d.aborted?c.abort(d.reason):d.addEventListener("abort",m,{once:!0}));try{let p=await Ct(e,t,a);l=p.resultHeader;let y=p.resultRowsStream.getReader(),b=0,f=Date.now(),w=!1;for(;;){let{done:v,value:E}=await y.read();if(v)break;if(!w&&s&&Date.now()-f>s)return c.abort(),{type:"timeout"};for(let k of E){if(b++,n&&b>n)return c.abort(),{type:"success",rowLimitReached:!0,resultHeader:l,processedResult:u};u=o(u,k)}}}catch(p){return c.signal.aborted?{type:"aborted"}:{type:"error",errorMessage:ye(p),error:p}}finally{d?.removeEventListener("abort",m)}return{type:"success",rowLimitReached:!1,resultHeader:l,processedResult:u}};async function Be({prompt:e,kg:t,graphQueryServiceUrl:r,targetStructure:o,targetStructureReducer:a,requestOptions:n,queryRowLimit:s,queryTimeoutMs:l,config:u}){let c;for(let d=1;d<=F;d++){let m;try{m=await fe(e,t.dataModel,r,u,c)}catch(b){return{type:"generation-error",errorMessage:ye(b),error:b}}await T({text:`Attempting to execute query: ${m.graphQuery.substring(0,500)}${m.graphQuery.length>500?"...":""}`},u);let p=await fa({kg:t,queryParams:new je({openCypherQuery:m.graphQuery}),targetStructure:o,targetStructureReducer:a,requestOptions:n,queryRowLimit:s,queryTimeoutMs:l}),y=p.type==="aborted"?"Query execution was aborted.":p.type==="timeout"?"Query execution timed out.":p.type==="error"?`Query failed with error: ${p.errorMessage}`:"";if(p.type==="success")return{type:"success",graphQuery:m.graphQuery,explanation:m.explanation,rowLimitReached:p.rowLimitReached,resultHeader:p.resultHeader,processedResult:p.processedResult};if(p.type==="aborted")return{type:"aborted",errorMessage:y,graphQuery:m.graphQuery,explanation:m.explanation};if(d>=F)return p.type==="timeout"?{type:"timeout",errorMessage:y,graphQuery:m.graphQuery,explanation:m.explanation}:{type:"execution-error",errorMessage:y,error:p.error,graphQuery:m.graphQuery,explanation:m.explanation};c={failedGraphQuery:m.graphQuery,executionError:y,attemptCount:d},await T({text:`Attempt ${d} failed with error: ${y}. Retrying...`},u)}throw new Error(`Failed to execute generated cypher due to an unexpected error after ${F} attempts.`)}var ya=async({kg:e,searchQuery:t,typeCategoryFilter:r,namedTypesFilter:o,searchResultLimit:a,requestOptions:n})=>{let s=[],l=[r];r==="both"&&!e.serviceDefinition.serviceCapabilities.searchCapabilities.searchTypeFilterCapabilities.includes("esriTypeBoth")&&(l=["entity","relationship"]);let u=a??1/0;try{for(let c of l){let d=u-s.length;if(d<=0)break;let m=(await Rt(e,new _t({searchQuery:t,typeCategoryFilter:c,namedTypesFilter:o??void 0,num:d}),n)).resultRowsStream.getReader(),p=!1;for(;!p;){let{done:y,value:b}=await m.read();if(y){p=!0;break}for(let f of b)for(let w of f)s.push(w)}}}catch(c){return console.log('Error when running graph search with query: "',t,'" - error: ',c),n?.signal?.aborted?{type:"aborted"}:{type:"error",errorMessage:ye(c),error:c}}return{type:"success",results:s}};function ga(e,t){_(e,r=>{t.set(`${r.typeName}__${r.id}`,{id:r.id,typeName:r.typeName})})}function _(e,t){if(!(!e||typeof e!="object")){if(ba(e))for(let r of e.path)_(r,t);else if(wa(e))t(e);else if(Array.isArray(e))for(let r of e)_(r,t);else if(va(e))for(let r of Object.values(e.properties??{}))_(r,t)}}function wa(e){return!e||typeof e!="object"||Array.isArray(e)?!1:"id"in e&&"typeName"in e}function ba(e){return!e||typeof e!="object"||Array.isArray(e)?!1:e&&"path"in e&&Array.isArray(e.path)}function va(e){return!e||typeof e!="object"||Array.isArray(e)||"id"in e?!1:"properties"in e&&typeof e.properties=="object"}function Ta(e,t){let r=[];for(let o of[...t.dataModel.entityTypes,...t.dataModel.relationshipTypes]){let a=e.getMemberIdsByType(o.name);for(let n of a)r.push({id:n,typeName:o.name})}return r}function Sa(e){let t=[],r=[],o=e?.allLayers.find(a=>a.type==="knowledge-graph")?.inclusionModeDefinition;if(o?.generateAllSublayers)return{allNamedTypesFullyDynamic:!0,idTypePairs:t,dynamicTypes:r};for(let[a,n]of o?.namedTypeDefinitions??[])if(n.useAllData)r.push(a);else for(let[s]of n.members)t.push({id:s,typeName:a});return{allNamedTypesFullyDynamic:!1,idTypePairs:t,dynamicTypes:r}}async function xa(e,t,r,o,a){let{view:n}=o,s=await Be({prompt:e,kg:t,graphQueryServiceUrl:r,targetStructure:new Map,targetStructureReducer:(m,p)=>{for(let y of p)ga(y,m);return m},requestOptions:{signal:a?.signal,timeout:a?.timeout},config:a});if(s.type!=="success"){let m=s.type==="generation-error"?s.errorMessage:`${s.errorMessage} Cypher query: ${s.graphQuery}`;throw new Error(`Failed to add records to the link chart. ${m}`)}let{graphQuery:l,explanation:u,processedResult:c}=s,d=Array.from(c.values());return await T({text:`Query Results parsed into ${d.length} unique relationships and entities. Atempting to add to link chart...`},a),!C(n)&&n?.map?(await n.map.addRecords(d),await Y(n),`Link Chart updated successfully. Cypher Query used:
113
112
  ${l}
114
113
 
115
- Explanation: ${u}`):(await n?.map?.allLayers.find(p=>p.type==="knowledge-graph")?.addRecords(d),`Map updated successfully. Cypher Query used:
114
+ Explanation: ${u}`):(await n?.map?.allLayers.find(m=>m.type==="knowledge-graph")?.addRecords(d),`Map updated successfully. Cypher Query used:
116
115
  ${l}
117
116
 
118
- Explanation: ${u}`)}var Be="addRecords",xa=i.object({prompt:i.string().describe("The user's inquiry into the knowledge graph that needs to be run.")}),Ea=async({prompt:e},t)=>{let{knowledgeGraph:r}=await G(t),o=X(t),{view:a}=o,n=M.getDefault().helperServices,s=e;if(C(a)){let u=a.map,{allNamedTypesFullyDynamic:c,idTypePairs:d,dynamicTypes:p}=Ta(u),m=await ne("arcgis_knowledge_current_map_context");if(s=`${e}
117
+ Explanation: ${u}`)}var Ue="addRecords",Ea=i.object({prompt:i.string().describe("The user's inquiry into the knowledge graph that needs to be run.")}),Ia=async({prompt:e},t)=>{let{knowledgeGraph:r}=await G(t),o=X(t),{view:a}=o,n=M.getDefault().helperServices,s=e;if(!C(a)&&a.map){let u=a.map,c=await ne("arcgis_knowledge_current_lc_context"),d=Ta(u,r);s=`${e}
119
118
 
120
- ${m}${JSON.stringify(d)} and all entities or relationships with the the following typeNames in the array: ${JSON.stringify(p)}`,c)throw new Error("No records have been added to the map because all data in the knowledge graph is contained in the map.")}else{let u=a.map,c=await ne("arcgis_knowledge_current_lc_context"),d=va(u,r);s=`${e}
119
+ ${c}${JSON.stringify(d)}`}else{let u=a.map,{allNamedTypesFullyDynamic:c,idTypePairs:d,dynamicTypes:m}=Sa(u),p=await ne("arcgis_knowledge_current_map_context");if(s=`${e}
121
120
 
122
- ${c}${JSON.stringify(d)}`}let l=await Sa(s,r,`${n.aiAssistantServices.url}${n.aiAssistantServices.graphQueryAssistant}`,o,t);return{toolName:Be,status:"success",summary:l}},hs=h(Ea,{name:Be,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.",schema:xa});async function Ia(e,t){return await t.map?.applyLayout(e),await Y(t),`Successfully applied layout: ${e}.`}var ue="applyLayout",$a=i.object({layout:i.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")}),Na=async({layout:e},t)=>{let{view:r}=X(t);if(C(r))return{toolName:ue,status:"error",errorMessage:"The applyLayout tool can only be used with a LinkChartView.",error:new Error};{let o=await Ia(e,r);return{toolName:ue,status:"success",summary:o}}},fs=h(Na,{name:ue,description:"Apply a diagram layout to the link chart",schema:$a});async function ka(e,t){return t.map?.changeNonspatialDataDisplay(e),await Y(t),`Successfully applied nonspatial visibility setting: ${e}.`}var de="changeNonspatialVisibility",Fa=i.object({setting:i.enum(["hidden","visible"]).describe("The setting of nonspatial visibility")}),Ma=async({setting:e},t)=>{let{view:r}=X(t);if(C(r))return{toolName:de,status:"error",errorMessage:"The changeNonspatialVisibility tool can only be used with a LinkChartView.",error:new Error};{let o=await ka(e,r);return{toolName:de,status:"success",summary:o}}},ys=h(Ma,{name:de,description:"Change whether or not nonspatial data is visible in the link chart. The value must be either 'hidden' or 'visible'.",schema:Fa});async function Aa(e,t,r,o,a){let n;for(let s=1;s<=F;s++){let{graphQuery:l,explanation:u}=await fe(e,t.dataModel,r,a,n);try{await T({text:`Attempting to create link chart from derived query: ${l}`},a);let c=await Mt.fromCypherQuery(t,new ze({openCypherQuery:l}));await T({text:"Link chart created successfully, loading..."},a),await c.load();let d=o.map;return o.map=c,await o.when(),await Ce.whenOnce(()=>!o.updating),c.entityCount===0&&c.relationshipCount===0?(o.map===c&&(o.map=d),c.destroy(),{type:"error",message:`Query returned no results. Cypher Query used to create the link chart:
121
+ ${p}${JSON.stringify(d)} and all entities or relationships with the the following typeNames in the array: ${JSON.stringify(m)}`,c)throw new Error("No records have been added to the map because all data in the knowledge graph is contained in the map.")}let l=await xa(s,r,`${n.aiAssistantServices.url}${n.aiAssistantServices.graphQueryAssistant}`,o,t);return{toolName:Ue,status:"success",summary:l}},fs=h(Ia,{name:Ue,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.",schema:Ea});async function $a(e,t){return await t.map?.applyLayout(e),await Y(t),`Successfully applied layout: ${e}.`}var ue="applyLayout",Na=i.object({layout:i.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")}),ka=async({layout:e},t)=>{let{view:r}=X(t);if(C(r))return{toolName:ue,status:"error",errorMessage:"The applyLayout tool can only be used with a LinkChartView.",error:new Error};{let o=await $a(e,r);return{toolName:ue,status:"success",summary:o}}},ys=h(ka,{name:ue,description:"Apply a diagram layout to the link chart",schema:Na});async function Fa(e,t){return t.map?.changeNonspatialDataDisplay(e),await Y(t),`Successfully applied nonspatial visibility setting: ${e}.`}var de="changeNonspatialVisibility",Ma=i.object({setting:i.enum(["hidden","visible"]).describe("The setting of nonspatial visibility")}),Aa=async({setting:e},t)=>{let{view:r}=X(t);if(C(r))return{toolName:de,status:"error",errorMessage:"The changeNonspatialVisibility tool can only be used with a LinkChartView.",error:new Error};{let o=await Fa(e,r);return{toolName:de,status:"success",summary:o}}},gs=h(Aa,{name:de,description:"Change whether or not nonspatial data is visible in the link chart. The value must be either 'hidden' or 'visible'.",schema:Ma});async function Ca(e,t,r,o,a){let n;for(let s=1;s<=F;s++){let{graphQuery:l,explanation:u}=await fe(e,t.dataModel,r,a,n);try{await T({text:`Attempting to create link chart from derived query: ${l}`},a);let c=await At.fromCypherQuery(t,new je({openCypherQuery:l}));await T({text:"Link chart created successfully, loading..."},a),await c.load();let d=o.map;return o.map=c,await o.when(),await Re.whenOnce(()=>!o.updating),c.entityCount===0&&c.relationshipCount===0?(o.map===c&&(o.map=d),c.destroy(),{type:"error",message:`Query returned no results. Cypher Query used to create the link chart:
123
122
  ${l}
124
123
 
125
124
  Explanation: ${u}`}):(await Y(o),{type:"success",message:`Link chart created successfully. Cypher Query used to create the link chart:
126
125
  ${l}
127
126
 
128
- Explanation: ${u}`})}catch(c){let d=c instanceof Error?c.message:String(c);if(s>=F)throw new Error(`Failed to create link chart after ${F} attempts. Last error: ${d}`);n={failedGraphQuery:l,executionError:d,attemptCount:s},await T({text:`Attempt ${s} to create link chart failed with error: ${d}. Retrying ...`},a)}}throw new Error(`Failed to create link chart after ${F} attempts.`)}var W="createLinkChart",Ca=i.object({prompt:i.string().describe("The user's inquiry into the knowledge graph that needs to be transformed into a link chart visualization.")}),Ra=async({prompt:e},t)=>{let{knowledgeGraph:r}=await G(t),{view:o}=X(t);if(C(o))return{toolName:W,status:"error",errorMessage:"The createLinkChart tool can only be used with a LinkChartView.",error:new Error};{let a=M.getDefault().helperServices,n=await Aa(e,r,`${a.aiAssistantServices.url}${a.aiAssistantServices.graphQueryAssistant}`,o,t);return n.type==="error"?{toolName:W,status:"error",errorMessage:n.message,error:new Error}:{toolName:W,status:"success",summary:n.message}}},gs=h(Ra,{name:W,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.",schema:Ca}),Ue="queryGraphData",_a=i.object({prompt:i.string().describe(`The user's inquiry into the knowledge graph, from which a cypher query will be generated and executed to answer the inquiry. IMPORTANT:
127
+ Explanation: ${u}`})}catch(c){let d=c instanceof Error?c.message:String(c);if(s>=F)throw new Error(`Failed to create link chart after ${F} attempts. Last error: ${d}`);n={failedGraphQuery:l,executionError:d,attemptCount:s},await T({text:`Attempt ${s} to create link chart failed with error: ${d}. Retrying ...`},a)}}throw new Error(`Failed to create link chart after ${F} attempts.`)}var W="createLinkChart",Ra=i.object({prompt:i.string().describe("The user's inquiry into the knowledge graph that needs to be transformed into a link chart visualization.")}),_a=async({prompt:e},t)=>{let{knowledgeGraph:r}=await G(t),{view:o}=X(t);if(C(o))return{toolName:W,status:"error",errorMessage:"The createLinkChart tool can only be used with a LinkChartView.",error:new Error};{let a=M.getDefault().helperServices,n=await Ca(e,r,`${a.aiAssistantServices.url}${a.aiAssistantServices.graphQueryAssistant}`,o,t);return n.type==="error"?{toolName:W,status:"error",errorMessage:n.message,error:new Error}:{toolName:W,status:"success",summary:n.message}}},ws=h(_a,{name:W,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.",schema:Ra}),Ke="queryGraphData",qa=i.object({prompt:i.string().describe(`The user's inquiry into the knowledge graph, from which a cypher query will be generated and executed to answer the inquiry. IMPORTANT:
129
128
 
130
129
  REQUEST LIMIT: If the user does not specifically request for no limits or an explicit limit to be placed on the query, or the number of rows will not be limited by e.g. the number of entity or relationship types in the graph, ensure that the generated query has a reasonable row limit (e.g. 10 rows).
131
130
 
132
- DESCRIPTIVE COLUMN NAMES: If the user's prompt does not explicitly request for specific column names in the result, ensure that the generated query has descriptive column names (using AS statements) to make the results easier to understand when displayed in a table format.`)}),qa=async({prompt:e},t)=>{let{knowledgeGraph:r}=await G(t),o=M.getDefault().helperServices,a=await Qe({prompt:e,kg:r,graphQueryServiceUrl:`${o.aiAssistantServices.url}${o.aiAssistantServices.graphQueryAssistant}`,targetStructure:new Array,targetStructureReducer:(p,m)=>(p.push(m),p),requestOptions:{signal:t?.signal,timeout:t?.timeout},config:t});if(a.type!=="success"){let p=a.type==="generation-error"?a.errorMessage:`${a.errorMessage} Cypher query: ${a.graphQuery}`;throw new Error(`Failed to query the knowledge graph. ${p}`)}let{graphQuery:n,processedResult:s,resultHeader:l}=a,u=l.headerKeys;for(let p of s)for(let m of p)_(m,y=>Ve(y));let c=50,d=s.slice(0,c).map(p=>JSON.stringify(p));return{toolName:Ue,status:"success",summary:`To answer the inquiry, the following cypher query was executed against the knowledge graph:
131
+ DESCRIPTIVE COLUMN NAMES: If the user's prompt does not explicitly request for specific column names in the result, ensure that the generated query has descriptive column names (using AS statements) to make the results easier to understand when displayed in a table format.`)}),za=async({prompt:e},t)=>{let{knowledgeGraph:r}=await G(t),o=M.getDefault().helperServices,a=await Be({prompt:e,kg:r,graphQueryServiceUrl:`${o.aiAssistantServices.url}${o.aiAssistantServices.graphQueryAssistant}`,targetStructure:new Array,targetStructureReducer:(m,p)=>(m.push(p),m),requestOptions:{signal:t?.signal,timeout:t?.timeout},config:t});if(a.type!=="success"){let m=a.type==="generation-error"?a.errorMessage:`${a.errorMessage} Cypher query: ${a.graphQuery}`;throw new Error(`Failed to query the knowledge graph. ${m}`)}let{graphQuery:n,processedResult:s,resultHeader:l}=a,u=l.headerKeys;for(let m of s)for(let p of m)_(p,y=>Qe(y));let c=50,d=s.slice(0,c).map(m=>JSON.stringify(m));return{toolName:Ke,status:"success",summary:`To answer the inquiry, the following cypher query was executed against the knowledge graph:
133
132
 
134
133
  \`\`\`cypher
135
134
  ${n}
@@ -146,13 +145,13 @@ ${d.length>c?`Showing top ${c} results:
146
145
 
147
146
  `}${d.join(`
148
147
  `)}
149
- `,details:{generatedQuery:n,resultHeader:l,queryResults:s}}},ws=h(qa,{name:Ue,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:_a}),Ke="generateCypher",za=i.object({prompt:i.string().describe("The user's inquiry into the knowledge graph that needs to be translated into a cypher query.")}),ja=async({prompt:e},t)=>{let{knowledgeGraph:r}=await G(t),o=M.getDefault().helperServices,a=await ma(e,r.dataModel,`${o.aiAssistantServices.url}${o.aiAssistantServices.graphQueryAssistant}`,t);return{toolName:Ke,status:"success",summary:a}},bs=h(ja,{name:Ke,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:za}),La=e=>{let t=e.dataModel,r=new Map;for(let l of t.searchIndexes)if(l.supportedCategory!=="esriTypeMetaEntityProvenance")for(let[u,c]of l.searchProperties.entries()){let d=r.get(u)??new Set;c.propertyNames.forEach(p=>d.add(p)),r.set(u,d)}let o=t.entityTypes.filter(l=>r.has(l.name)),a=t.relationshipTypes.filter(l=>r.has(l.name)),n=`Entity Types:
148
+ `,details:{generatedQuery:n,resultHeader:l,queryResults:s}}},bs=h(za,{name:Ke,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:qa}),We="generateCypher",ja=i.object({prompt:i.string().describe("The user's inquiry into the knowledge graph that needs to be translated into a cypher query.")}),La=async({prompt:e},t)=>{let{knowledgeGraph:r}=await G(t),o=M.getDefault().helperServices,a=await ha(e,r.dataModel,`${o.aiAssistantServices.url}${o.aiAssistantServices.graphQueryAssistant}`,t);return{toolName:We,status:"success",summary:a}},vs=h(La,{name:We,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:ja}),Oa=e=>{let t=e.dataModel,r=new Map;for(let l of t.searchIndexes)if(l.supportedCategory!=="esriTypeMetaEntityProvenance")for(let[u,c]of l.searchProperties.entries()){let d=r.get(u)??new Set;c.propertyNames.forEach(m=>d.add(m)),r.set(u,d)}let o=t.entityTypes.filter(l=>r.has(l.name)),a=t.relationshipTypes.filter(l=>r.has(l.name)),n=`Entity Types:
150
149
  ${o.map(({name:l})=>`${l}: [${Array.from(r.get(l)??[]).join(", ")}]`).join(`
151
150
  `)}`,s=`Relationship Types:
152
151
  ${a.map(({name:l})=>`${l}: [${Array.from(r.get(l)??[]).join(", ")}]`).join(`
153
152
  `)}`;return`${n}
154
153
 
155
- ${s}`};async function Oa(e,t){let r=await ne("arcgis_knowledge_lucene_generation_prompt"),o={inquiry:e,dataModelForSearch:La(t)},a=i.enum(["entity","relationship","both"]).describe("The graph element category to search against - entity, relationship, or both"),n=i.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."),s=i.array(i.enum(t.dataModel.entityTypes.map(u=>u.name).concat(t.dataModel.relationshipTypes.map(u=>u.name)))).min(1),l=i.object({query:i.string().describe("A lucene syntax query string to be executed against the knowledge graph search API"),typeFilters:s.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:a,resultLimit:n});return await Te({promptText:r,inputVariables:o,schema:l})}var We="searchGraphData",Da=i.object({prompt:i.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.")}),Pa=async({prompt:e},t)=>{let{knowledgeGraph:r}=await G(t);await T({text:"Generating search query for the user inquiry"},t);let o=await Oa(e,r);await T({text:"Executing graph search with generated search query"},t);let a=await fa({kg:r,searchQuery:o.query,typeCategoryFilter:o.typeCategoryFilter,namedTypesFilter:o.typeFilters,searchResultLimit:o.resultLimit,requestOptions:{signal:t?.signal,timeout:t?.timeout}});if(a.type!=="success")throw new Error(`Graph search failed with error: ${a.type==="error"?a.errorMessage:"aborted"}`);for(let l of a.results)_(l,u=>Ve(u));let n=10,s=a.results.slice(0,n);return{toolName:We,status:"success",summary:`To answer the query, the following lucene query was generated and executed:
154
+ ${s}`};async function Da(e,t){let r=await ne("arcgis_knowledge_lucene_generation_prompt"),o={inquiry:e,dataModelForSearch:Oa(t)},a=i.enum(["entity","relationship","both"]).describe("The graph element category to search against - entity, relationship, or both"),n=i.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."),s=i.array(i.enum(t.dataModel.entityTypes.map(u=>u.name).concat(t.dataModel.relationshipTypes.map(u=>u.name)))).min(1),l=i.object({query:i.string().describe("A lucene syntax query string to be executed against the knowledge graph search API"),typeFilters:s.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:a,resultLimit:n});return await Te({promptText:r,inputVariables:o,schema:l})}var He="searchGraphData",Pa=i.object({prompt:i.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.")}),Ga=async({prompt:e},t)=>{let{knowledgeGraph:r}=await G(t);await T({text:"Generating search query for the user inquiry"},t);let o=await Da(e,r);await T({text:"Executing graph search with generated search query"},t);let a=await ya({kg:r,searchQuery:o.query,typeCategoryFilter:o.typeCategoryFilter,namedTypesFilter:o.typeFilters,searchResultLimit:o.resultLimit,requestOptions:{signal:t?.signal,timeout:t?.timeout}});if(a.type!=="success")throw new Error(`Graph search failed with error: ${a.type==="error"?a.errorMessage:"aborted"}`);for(let l of a.results)_(l,u=>Qe(u));let n=10,s=a.results.slice(0,n);return{toolName:He,status:"success",summary:`To answer the query, the following lucene query was generated and executed:
156
155
  Query: ${o.query}
157
156
  Type Category Filter: ${o.typeCategoryFilter}
158
157
  Named Type Filters: ${o.typeFilters?o.typeFilters.join(", "):"None"}
@@ -163,4 +162,4 @@ ${s}`};async function Oa(e,t){let r=await ne("arcgis_knowledge_lucene_generation
163
162
  ${a.results.length>n?`Showing top ${n} results:
164
163
 
165
164
  `:""}${s.map(l=>JSON.stringify(l)).join(`
166
- `)}`,details:{generatedQuery:o,searchResults:{...a}}}},vs=h(Pa,{name:We,description:"Allows users to search the knowledge graph for text matching their inquiry, using lucene search syntax, against indexed string properties defined on their entities and relationships. Use this tool when the user asks a question about their knowledge graph data as a whole, that could be answered via lucene text search of properties stored on graph elements, e.g requiring fuzzy matching. Otherwise if the inquiry is looking for connected records (e.g. paths), data aggregations, etc explore the data via the queryGraphData tool.",schema:Da});return{a:B,b:ji,c:$,d:Li,e:Oi,f:Di,g:Pi,h:Gi,i:Vi,j:Qi,k:Bi,l:Ui,m:ne,n:lr,o:je,p:Ki,q:Wi,r:Hi,s:Ji,t:Zi,u:Yi,v:Xi,w:es,x:ts,y:rs,z:os,A:as,B:ns,C:is,D:A,E:ss,F:na,G:ls,H:cs,I:us,J:ds,K:ps,L:ms,M:G,N:le,O:hs,P:fs,Q:ys,R:gs,S:ws,T:bs,U:vs}},"identity/IdentityManager","portal/Portal","core/reactiveUtils","layers/FeatureLayer","request","config","Graphic","rest/locator","symbols/PictureMarkerSymbol","geometry/Extent","geometry/Point","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","layers/support/FeatureEffect","layers/support/FeatureFilter","geometry/operators/unionOperator","intl","smartMapping/statistics/summaryStatistics","smartMapping/statistics/uniqueValues","rest/support/TopFeaturesQuery","rest/support/TopFilter","WebLinkChart","rest/knowledgeGraph/GraphQueryStreaming","views/LinkChartView","rest/knowledgeGraphService","rest/knowledgeGraph/GraphSearchStreaming",a)
165
+ `)}`,details:{generatedQuery:o,searchResults:{...a}}}},Ts=h(Ga,{name:He,description:"Allows users to search the knowledge graph for text matching their inquiry, using lucene search syntax, against indexed string properties defined on their entities and relationships. Use this tool when the user asks a question about their knowledge graph data as a whole, that could be answered via lucene text search of properties stored on graph elements, e.g requiring fuzzy matching. Otherwise if the inquiry is looking for connected records (e.g. paths), data aggregations, etc explore the data via the queryGraphData tool.",schema:Pa});return{a:B,b:Li,c:$,d:Oi,e:Di,f:Pi,g:Gi,h:Vi,i:Qi,j:Bi,k:Ui,l:Ki,m:ne,n:cr,o:Le,p:Wi,q:Hi,r:Ji,s:Zi,t:Yi,u:Xi,v:es,w:ts,x:rs,y:os,z:as,A:ns,B:is,C:ss,D:A,E:ls,F:ia,G:cs,H:us,I:ds,J:ms,K:ps,L:hs,M:G,N:le,O:fs,P:ys,Q:gs,R:ws,S:bs,T:vs,U:Ts}},"identity/IdentityManager","portal/Portal","core/reactiveUtils","layers/FeatureLayer","request","config","Graphic","rest/locator","symbols/PictureMarkerSymbol","geometry/Extent","geometry/Point","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","layers/support/FeatureEffect","layers/support/FeatureFilter","geometry/operators/unionOperator","intl","smartMapping/statistics/summaryStatistics","smartMapping/statistics/uniqueValues","rest/support/TopFeaturesQuery","rest/support/TopFilter","WebLinkChart","rest/knowledgeGraph/GraphQueryStreaming","views/LinkChartView","rest/knowledgeGraphService","rest/knowledgeGraph/GraphSearchStreaming",a)