@arcgis/ai-components 5.2.0-next.40 → 5.2.0-next.42

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 (41) hide show
  1. package/dist/cdn/{FY7YTXS4.js → 3DJDRAGV.js} +1 -1
  2. package/dist/cdn/{MHMBHWYX.js → 4CEMUECT.js} +1 -1
  3. package/dist/cdn/{SBP6WNDY.js → 57OMVTIU.js} +1 -1
  4. package/dist/cdn/{JMODFBN6.js → 5I35MJXT.js} +1 -1
  5. package/dist/cdn/{E54QF5FR.js → 6O6KMX3M.js} +1 -1
  6. package/dist/cdn/{BNJFXDJV.js → 6U7TEAAJ.js} +1 -1
  7. package/dist/cdn/{AFKLWPPM.js → 7FY4G4K2.js} +1 -1
  8. package/dist/cdn/{XNWCRFTJ.js → BE7ZN5FZ.js} +1 -1
  9. package/dist/cdn/{5VTVHDQ5.js → CMG2NY3K.js} +1 -1
  10. package/dist/cdn/{TI7K3I3K.js → EQLRFZVU.js} +1 -1
  11. package/dist/cdn/{HBUW4KGU.js → EW6AYEUX.js} +1 -1
  12. package/dist/cdn/{F3VYFN2Q.js → FYW633VX.js} +1 -1
  13. package/dist/cdn/{MMRRNKWJ.js → HBLRVXEB.js} +1 -1
  14. package/dist/cdn/{PRN4OPLW.js → HQXPPYMD.js} +1 -1
  15. package/dist/cdn/{SYEI4BB2.js → ICYUPLZM.js} +1 -1
  16. package/dist/cdn/{BST5ZU46.js → IEHPNCTL.js} +1 -1
  17. package/dist/cdn/{XFL2VQFM.js → JSIGEUX7.js} +1 -1
  18. package/dist/cdn/{6JX2ACRF.js → JSJ4RMOE.js} +1 -1
  19. package/dist/cdn/{FNBXR5WD.js → LHLO6PTD.js} +1 -1
  20. package/dist/cdn/{3Y5INO72.js → MIPOMGT5.js} +1 -1
  21. package/dist/cdn/{BF2IYMM6.js → O5TONDCH.js} +1 -1
  22. package/dist/cdn/{EIPHHMWX.js → PNFBQ6JV.js} +1 -1
  23. package/dist/cdn/{D664PQPF.js → PVE7Q43N.js} +1 -1
  24. package/dist/cdn/{SKXDXIQO.js → SUA3YJTU.js} +1 -1
  25. package/dist/cdn/{37Q23IS4.js → THR22OXW.js} +1 -1
  26. package/dist/cdn/{GPVY5GM6.js → VPFIUEKT.js} +1 -1
  27. package/dist/cdn/{C7DSVDSP.js → XCRR2EEG.js} +1 -1
  28. package/dist/cdn/{FQ5XLE4I.js → YHQJ66WJ.js} +1 -1
  29. package/dist/cdn/{5SW5CPQT.js → Z6I6JACX.js} +1 -1
  30. package/dist/cdn/{3OH4DXSY.js → ZS6SXJP2.js} +1 -1
  31. package/dist/cdn/agent-utils/index.js +1 -1
  32. package/dist/cdn/agent-utils/middlewares/humanInTheLoop.js +1 -1
  33. package/dist/cdn/agent-utils/middlewares/middleware.js +1 -1
  34. package/dist/cdn/agent-utils/middlewares/trace.js +1 -1
  35. package/dist/cdn/index.js +1 -1
  36. package/dist/docs/api.json +1 -1
  37. package/dist/docs/docs.json +1 -1
  38. package/dist/docs/web-types.json +1 -1
  39. package/dist/oauth-callback.html +1 -1
  40. package/package.json +4 -4
  41. /package/dist/cdn/{ZQ7PGNWB.js → TFT6HK3O.js} +0 -0
@@ -1,2 +1,2 @@
1
1
  /* COPYRIGHT Esri - https://js.arcgis.com/5.2/LICENSE.txt */
2
- import a from"./3OH4DXSY.js";import{c as l}from"./SBP6WNDY.js";import"./ZQ7PGNWB.js";import"./LUY6V4TP.js";import"./MWYBF3F3.js";import"./UZLQALHY.js";export default $arcgis.t(([{property:g,subclass:u},{d:w}])=>{var f=Object.defineProperty,m=Object.getOwnPropertyDescriptor,c=(o,r,n,s)=>{for(var e=s>1?void 0:s?m(r,n):r,a=o.length-1,t;a>=0;a--)(t=o[a])&&(e=(s?t(r,n,e):t(e))||e);return s&&e&&f(r,n,e),e},p=class extends w{constructor(o){super(o)}getAgents(){return this.workflow.getAgents()}generate(){let o=this.workflow.generate(),r=o.workspace,n=o.createGraph().compile(),{decideContinue:s}=this,e={[i]:async(t,d)=>await n.invoke(t,d)},a=[{from:i,decide:async(t,d)=>await Promise.resolve(s(t,d))?i:void 0}];return{workspace:r,createGraph:()=>l(e,a,r,{entryNode:i})}}buildEdges(){throw new Error("LoopWorkflow overrides generate(); buildEdges should not be called.")}getEntryNode(){return i}isTerminalAgent(){return!0}};c([g()],p.prototype,"workflow",2);c([g()],p.prototype,"decideContinue",2);p=c([u("LoopWorkflow")],p);var i="__loop_body";return p},"core/accessorSupport/decorators",a)
2
+ import a from"./ZS6SXJP2.js";import{c as l}from"./57OMVTIU.js";import"./TFT6HK3O.js";import"./LUY6V4TP.js";import"./MWYBF3F3.js";import"./UZLQALHY.js";export default $arcgis.t(([{property:g,subclass:u},{d:w}])=>{var f=Object.defineProperty,m=Object.getOwnPropertyDescriptor,c=(o,r,n,s)=>{for(var e=s>1?void 0:s?m(r,n):r,a=o.length-1,t;a>=0;a--)(t=o[a])&&(e=(s?t(r,n,e):t(e))||e);return s&&e&&f(r,n,e),e},p=class extends w{constructor(o){super(o)}getAgents(){return this.workflow.getAgents()}generate(){let o=this.workflow.generate(),r=o.workspace,n=o.createGraph().compile(),{decideContinue:s}=this,e={[i]:async(t,d)=>await n.invoke(t,d)},a=[{from:i,decide:async(t,d)=>await Promise.resolve(s(t,d))?i:void 0}];return{workspace:r,createGraph:()=>l(e,a,r,{entryNode:i})}}buildEdges(){throw new Error("LoopWorkflow overrides generate(); buildEdges should not be called.")}getEntryNode(){return i}isTerminalAgent(){return!0}};c([g()],p.prototype,"workflow",2);c([g()],p.prototype,"decideContinue",2);p=c([u("LoopWorkflow")],p);var i="__loop_body";return p},"core/accessorSupport/decorators",a)
@@ -1,2 +1,2 @@
1
1
  /* COPYRIGHT Esri - https://js.arcgis.com/5.2/LICENSE.txt */
2
- import b from"./3OH4DXSY.js";import a from"./MMRRNKWJ.js";import{c as m}from"./SBP6WNDY.js";import"./ZQ7PGNWB.js";import"./LUY6V4TP.js";import"./MWYBF3F3.js";import"./UZLQALHY.js";export default $arcgis.t(([{property:n,subclass:l},{watch:w},c])=>{var d=Object.defineProperty,f=Object.getOwnPropertyDescriptor,p=(e,r,s,o)=>{for(var t=o>1?void 0:o?f(r,s):r,i=e.length-1,a;i>=0;i--)(a=e[i])&&(t=(o?a(r,s,t):a(t))||t);return o&&t&&d(r,s,t),t},h=class extends c{constructor(e){super(e)}initialize(){this.addHandles(w(()=>[this.name,this.description,this.inputSchema,this.outputSchema,this.workflow],()=>this.generate(),{initial:!0,sync:!0}))}getSchemas(){return[this.inputSchema,...this.workflow.getAgents().flatMap(e=>e.getSchemas()),this.outputSchema].filter(Boolean)}generate(){let{workspace:e,createGraph:r}=this.workflow.generate();if(this._set("workspace",e),!this.middlewares?.length)this._set("createGraph",r);else{let s=this.id,o={[s]:async(i,a)=>await r().compile().invoke(i,a)},t=[{from:s,decide:()=>{}}];this._set("createGraph",()=>m(o,t,e,{agent:this,entryNode:s,middlewares:this.middlewares}))}}};p([n()],h.prototype,"workflow",2);p([n()],h.prototype,"inputSchema",2);p([n()],h.prototype,"outputSchema",2);h=p([l("WorkflowAgent")],h);return h},"core/accessorSupport/decorators","core/reactiveUtils",a,b)
2
+ import b from"./ZS6SXJP2.js";import a from"./HBLRVXEB.js";import{c as m}from"./57OMVTIU.js";import"./TFT6HK3O.js";import"./LUY6V4TP.js";import"./MWYBF3F3.js";import"./UZLQALHY.js";export default $arcgis.t(([{property:n,subclass:l},{watch:w},c])=>{var d=Object.defineProperty,f=Object.getOwnPropertyDescriptor,p=(e,r,s,o)=>{for(var t=o>1?void 0:o?f(r,s):r,i=e.length-1,a;i>=0;i--)(a=e[i])&&(t=(o?a(r,s,t):a(t))||t);return o&&t&&d(r,s,t),t},h=class extends c{constructor(e){super(e)}initialize(){this.addHandles(w(()=>[this.name,this.description,this.inputSchema,this.outputSchema,this.workflow],()=>this.generate(),{initial:!0,sync:!0}))}getSchemas(){return[this.inputSchema,...this.workflow.getAgents().flatMap(e=>e.getSchemas()),this.outputSchema].filter(Boolean)}generate(){let{workspace:e,createGraph:r}=this.workflow.generate();if(this._set("workspace",e),!this.middlewares?.length)this._set("createGraph",r);else{let s=this.id,o={[s]:async(i,a)=>await r().compile().invoke(i,a)},t=[{from:s,decide:()=>{}}];this._set("createGraph",()=>m(o,t,e,{agent:this,entryNode:s,middlewares:this.middlewares}))}}};p([n()],h.prototype,"workflow",2);p([n()],h.prototype,"inputSchema",2);p([n()],h.prototype,"outputSchema",2);h=p([l("WorkflowAgent")],h);return h},"core/accessorSupport/decorators","core/reactiveUtils",a,b)
@@ -1,2 +1,2 @@
1
1
  /* COPYRIGHT Esri - https://js.arcgis.com/5.2/LICENSE.txt */
2
- import{Va as k,a as E,b as y,ha as h}from"./ZQ7PGNWB.js";var j=new Set(["agentExecutionContext","outputMessage","summary","status"]);function x(){return{assignedTask:"",messages:[],priorSteps:[],sharedState:{},userRequest:""}}function O(r){let o=[...new Set([...r].filter(n=>j.has(n)))];if(o.length!==0)throw new Error(`custom state cannot define reserved runtime fields: ${o.join(", ")}.`)}function S(r){let o=Object.entries(r);return Object.fromEntries(o.map(([n,t])=>[n,h({reducer:(i,g)=>g,default:()=>t})]))}function $(r={}){O(Object.keys(r));let o=S(r);return h.Root({...o,agentExecutionContext:h({reducer:(n,t)=>({...n,...t}),default:x}),outputMessage:h({reducer:(n="",t)=>typeof t=="string"&&t.trim()?t:n,default:()=>""}),summary:h({reducer:(n="",t)=>typeof t=="string"?t:n,default:()=>""}),status:h({reducer:(n,t)=>t??n,default:()=>{}})})}function M(r){let o=new Set;for(let t of r)for(let i of Object.keys(t.shape??{}))o.add(i);let n=Object.fromEntries([...o].map(t=>[t,void 0]));return $(n)}function T(r,o,n,t={}){let{agent:i,entryNode:g,middlewares:c=[]}=t,a=new k(n);if(Object.keys(r).length===0)throw new Error("Graph requires at least one node.");if(o.length===0)throw new Error("Graph requires at least one edge.");if(c.length>0&&!i)throw new Error("Graph middleware requires agent metadata.");let s=new Set(Object.keys(r)),l=new Map,w=new Map;for(let e of s)l.set(e,0),w.set(e,0);for(let e of o)"to"in e?(s.has(e.from)&&w.set(e.from,(w.get(e.from)??0)+1),s.has(e.to)&&l.set(e.to,(l.get(e.to)??0)+1)):s.has(e.from)&&w.set(e.from,(w.get(e.from)??0)+1);for(let[e,f]of Object.entries(r)){let u=N(i,e,c,async(d,p)=>await Promise.resolve(f(d,p))),m=async(d,p)=>await u(d,p);a=a.addNode(e,m)}for(let e of o)if("to"in e){let f=e.from,u=e.to;if(!s.has(f))throw new Error(`Graph edge references unknown from-node: ${f}`);if(!s.has(u))throw new Error(`Graph edge references unknown to-node: ${u}`);a.addEdge(f,u)}else{let f=e.from;if(!s.has(f))throw new Error(`Graph conditional edge references unknown from-node: ${f}`);a.addConditionalEdges(f,async(u,m)=>{let d=await e.decide(u,m);if(!d)return y;if(!s.has(d))throw new Error(`Graph conditional edge returned unknown node: ${d}`);return d})}let G=q(s,l,g);a.addEdge(E,G);let b=[...s].filter(e=>(w.get(e)??0)===0);for(let e of b)a.addEdge(e,y);return a}function N(r,o,n,t){return!n.length||!r?t:async(i,g)=>await n.reduceRight((c,a)=>async s=>await a.handler(s,c),async c=>{let a=await t(c.state,c.config);return{...c.state,...a}})({agent:r,config:g,nodeName:o,state:i})}function q(r,o,n){if(n){if(!r.has(n))throw new Error(`Graph entry node references unknown node: ${n}`);return n}let t=[...r].filter(i=>(o.get(i)??0)===0);if(t.length!==1)throw new Error(`Graph could not infer a single entry node (found ${t.length}). Provide an explicit entryNode or ensure exactly one node has no incoming edges.`);return t[0]}export{$ as a,M as b,T as c};
2
+ import{Va as k,a as E,b as y,ha as h}from"./TFT6HK3O.js";var j=new Set(["agentExecutionContext","outputMessage","summary","status"]);function x(){return{assignedTask:"",messages:[],priorSteps:[],sharedState:{},userRequest:""}}function O(r){let o=[...new Set([...r].filter(n=>j.has(n)))];if(o.length!==0)throw new Error(`custom state cannot define reserved runtime fields: ${o.join(", ")}.`)}function S(r){let o=Object.entries(r);return Object.fromEntries(o.map(([n,t])=>[n,h({reducer:(i,g)=>g,default:()=>t})]))}function $(r={}){O(Object.keys(r));let o=S(r);return h.Root({...o,agentExecutionContext:h({reducer:(n,t)=>({...n,...t}),default:x}),outputMessage:h({reducer:(n="",t)=>typeof t=="string"&&t.trim()?t:n,default:()=>""}),summary:h({reducer:(n="",t)=>typeof t=="string"?t:n,default:()=>""}),status:h({reducer:(n,t)=>t??n,default:()=>{}})})}function M(r){let o=new Set;for(let t of r)for(let i of Object.keys(t.shape??{}))o.add(i);let n=Object.fromEntries([...o].map(t=>[t,void 0]));return $(n)}function T(r,o,n,t={}){let{agent:i,entryNode:g,middlewares:c=[]}=t,a=new k(n);if(Object.keys(r).length===0)throw new Error("Graph requires at least one node.");if(o.length===0)throw new Error("Graph requires at least one edge.");if(c.length>0&&!i)throw new Error("Graph middleware requires agent metadata.");let s=new Set(Object.keys(r)),l=new Map,w=new Map;for(let e of s)l.set(e,0),w.set(e,0);for(let e of o)"to"in e?(s.has(e.from)&&w.set(e.from,(w.get(e.from)??0)+1),s.has(e.to)&&l.set(e.to,(l.get(e.to)??0)+1)):s.has(e.from)&&w.set(e.from,(w.get(e.from)??0)+1);for(let[e,f]of Object.entries(r)){let u=N(i,e,c,async(d,p)=>await Promise.resolve(f(d,p))),m=async(d,p)=>await u(d,p);a=a.addNode(e,m)}for(let e of o)if("to"in e){let f=e.from,u=e.to;if(!s.has(f))throw new Error(`Graph edge references unknown from-node: ${f}`);if(!s.has(u))throw new Error(`Graph edge references unknown to-node: ${u}`);a.addEdge(f,u)}else{let f=e.from;if(!s.has(f))throw new Error(`Graph conditional edge references unknown from-node: ${f}`);a.addConditionalEdges(f,async(u,m)=>{let d=await e.decide(u,m);if(!d)return y;if(!s.has(d))throw new Error(`Graph conditional edge returned unknown node: ${d}`);return d})}let G=q(s,l,g);a.addEdge(E,G);let b=[...s].filter(e=>(w.get(e)??0)===0);for(let e of b)a.addEdge(e,y);return a}function N(r,o,n,t){return!n.length||!r?t:async(i,g)=>await n.reduceRight((c,a)=>async s=>await a.handler(s,c),async c=>{let a=await t(c.state,c.config);return{...c.state,...a}})({agent:r,config:g,nodeName:o,state:i})}function q(r,o,n){if(n){if(!r.has(n))throw new Error(`Graph entry node references unknown node: ${n}`);return n}let t=[...r].filter(i=>(o.get(i)??0)===0);if(t.length!==1)throw new Error(`Graph could not infer a single entry node (found ${t.length}). Provide an explicit entryNode or ensure exactly one node has no incoming edges.`);return t[0]}export{$ as a,M as b,T as c};
@@ -1,5 +1,5 @@
1
1
  /* COPYRIGHT Esri - https://js.arcgis.com/5.2/LICENSE.txt */
2
- import{b as Go}from"./R74ZHFA6.js";import{a as rt}from"./HJG7QM2R.js";import{b as Ai,c as Ii,d as bi}from"./SYEI4BB2.js";import{K as pi,L as mi,M as Bs,N as Fn,O as Dt,P as Bn,Q as di,R as fi,T as hi,U as _i,V as qs,W as gi,X as qn,Y as Wn,Z as yi,ha as re}from"./ZQ7PGNWB.js";import{Ab as li,C as Un,D as Dn,E as Us,Sb as E,U as Ds,V as Qo,X as ei,Xb as Ut,ca as ae,da as Ls,fa as jt,fc as ci,ga as Ks,ha as ti,kb as ns,la as ri,o as Xo,ob as Kn,p as pe,pa as si,pb as ai,qb as ui,sb as os,tc as Fs,ua as Ln,v as Yo,w as js,xa as ni,yc as Ws}from"./LUY6V4TP.js";import{a as ue}from"./VXFQANGJ.js";import{$ as ii,Dd as x,j as oi}from"./MWYBF3F3.js";export default $arcgis.t(([Yu,Zp,Vp])=>{function is(t,e){return t.lc_error_code=e,t.message=`${t.message}
2
+ import{b as Go}from"./R74ZHFA6.js";import{a as rt}from"./HJG7QM2R.js";import{b as Ai,c as Ii,d as bi}from"./ICYUPLZM.js";import{K as pi,L as mi,M as Bs,N as Fn,O as Dt,P as Bn,Q as di,R as fi,T as hi,U as _i,V as qs,W as gi,X as qn,Y as Wn,Z as yi,ha as re}from"./TFT6HK3O.js";import{Ab as li,C as Un,D as Dn,E as Us,Sb as E,U as Ds,V as Qo,X as ei,Xb as Ut,ca as ae,da as Ls,fa as jt,fc as ci,ga as Ks,ha as ti,kb as ns,la as ri,o as Xo,ob as Kn,p as pe,pa as si,pb as ai,qb as ui,sb as os,tc as Fs,ua as Ln,v as Yo,w as js,xa as ni,yc as Ws}from"./LUY6V4TP.js";import{a as ue}from"./VXFQANGJ.js";import{$ as ii,Dd as x,j as oi}from"./MWYBF3F3.js";export default $arcgis.t(([Yu,Zp,Vp])=>{function is(t,e){return t.lc_error_code=e,t.message=`${t.message}
3
3
 
4
4
  Troubleshooting URL: https://docs.langchain.com/oss/javascript/langchain/errors/${e}/
5
5
  `,t}function k(t,e,r,s,n){if(s==="m")throw new TypeError("Private method is not writable");if(s==="a"&&!n)throw new TypeError("Private accessor was defined without a setter");if(typeof e=="function"?t!==e||!n:!e.has(t))throw new TypeError("Cannot write private member to an object whose class did not declare it");return s==="a"?n.call(t,r):n?n.value=r:e.set(t,r),r}function d(t,e,r,s){if(r==="a"&&!s)throw new TypeError("Private accessor was defined without a getter");if(typeof e=="function"?t!==e||!s:!e.has(t))throw new TypeError("Cannot read private member from an object whose class did not declare it");return r==="m"?s:r==="a"?s.call(t):s?s.value:e.get(t)}var Hn=function(){let{crypto:t}=globalThis;if(t?.randomUUID)return Hn=t.randomUUID.bind(t),t.randomUUID();let e=new Uint8Array(1),r=t?()=>t.getRandomValues(e)[0]:()=>Math.random()*255&255;return"10000000-1000-4000-8000-100000000000".replace(/[018]/g,s=>(+s^r()&15>>+s/4).toString(16))};function as(t){return typeof t=="object"&&t!==null&&("name"in t&&t.name==="AbortError"||"message"in t&&String(t.message).includes("FetchRequestCanceledException"))}var us=t=>{if(t instanceof Error)return t;if(typeof t=="object"&&t!==null){try{if(Object.prototype.toString.call(t)==="[object Error]"){let e=new Error(t.message,t.cause?{cause:t.cause}:{});return t.stack&&(e.stack=t.stack),t.cause&&!e.cause&&(e.cause=t.cause),t.name&&(e.name=t.name),e}}catch{}try{return new Error(JSON.stringify(t))}catch{}}return new Error(t)};var P=class extends Error{},U=class t extends P{constructor(e,r,s,n){super(`${t.makeMessage(e,r,s)}`),this.status=e,this.headers=n,this.requestID=n?.get("x-request-id"),this.error=r;let o=r;this.code=o?.code,this.param=o?.param,this.type=o?.type}static makeMessage(e,r,s){let n=r?.message?typeof r.message=="string"?r.message:JSON.stringify(r.message):r?JSON.stringify(r):s;return e&&n?`${e} ${n}`:e?`${e} status code (no body)`:n||"(no status code or body)"}static generate(e,r,s,n){if(!e||!n)return new Le({message:s,cause:us(r)});let o=r?.error;return e===400?new Lt(e,o,s,n):e===401?new Kt(e,o,s,n):e===403?new Ft(e,o,s,n):e===404?new Bt(e,o,s,n):e===409?new qt(e,o,s,n):e===422?new Wt(e,o,s,n):e===429?new Ht(e,o,s,n):e>=500?new Zt(e,o,s,n):new t(e,o,s,n)}},D=class extends U{constructor({message:e}={}){super(void 0,void 0,e||"Request was aborted.",void 0)}},Le=class extends U{constructor({message:e,cause:r}){super(void 0,void 0,e||"Connection error.",void 0),r&&(this.cause=r)}},Ae=class extends Le{constructor({message:e}={}){super({message:e??"Request timed out."})}},Lt=class extends U{},Kt=class extends U{},Ft=class extends U{},Bt=class extends U{},qt=class extends U{},Wt=class extends U{},Ht=class extends U{},Zt=class extends U{},Vt=class extends P{constructor(){super("Could not parse response content as the length limit was reached")}},Jt=class extends P{constructor(){super("Could not parse response content as the request was rejected by the content filter")}},Ie=class extends Error{constructor(e){super(e)}},st=class extends U{constructor(e,r,s){let n="OAuth2 authentication error",o;if(r&&typeof r=="object"){let i=r;o=i.error;let a=i.error_description;a&&typeof a=="string"?n=a:o&&(n=o)}super(e,r,n,s),this.error_code=o}},ls=class extends P{constructor(e,r,s){super(e),this.provider=r,this.cause=s}};var ll=/^[a-z][a-z0-9+.-]*:/i,xi=t=>ll.test(t),Y=t=>(Y=Array.isArray,Y(t)),Zn=Y;function Hs(t){return typeof t!="object"?{}:t??{}}function Vn(t){if(!t)return!0;for(let e in t)return!1;return!0}function wi(t,e){return Object.prototype.hasOwnProperty.call(t,e)}function cs(t){return t!=null&&typeof t=="object"&&!Array.isArray(t)}var Pi=(t,e)=>{if(typeof e!="number"||!Number.isInteger(e))throw new P(`${t} must be an integer`);if(e<0)throw new P(`${t} must be a positive integer`);return e};var Oi=t=>{try{return JSON.parse(t)}catch{return}};var be=t=>new Promise(e=>setTimeout(e,t));var Ke="6.45.0";var Ci=()=>typeof window<"u"&&typeof window.document<"u"&&typeof navigator<"u";function cl(){return typeof Deno<"u"&&Deno.build!=null?"deno":typeof EdgeRuntime<"u"?"edge":Object.prototype.toString.call(typeof globalThis.process<"u"?globalThis.process:0)==="[object process]"?"node":"unknown"}var pl=()=>{let t=cl();if(t==="deno")return{"X-Stainless-Lang":"js","X-Stainless-Package-Version":Ke,"X-Stainless-OS":vi(Deno.build.os),"X-Stainless-Arch":ki(Deno.build.arch),"X-Stainless-Runtime":"deno","X-Stainless-Runtime-Version":typeof Deno.version=="string"?Deno.version:Deno.version?.deno??"unknown"};if(typeof EdgeRuntime<"u")return{"X-Stainless-Lang":"js","X-Stainless-Package-Version":Ke,"X-Stainless-OS":"Unknown","X-Stainless-Arch":`other:${EdgeRuntime}`,"X-Stainless-Runtime":"edge","X-Stainless-Runtime-Version":globalThis.process.version};if(t==="node")return{"X-Stainless-Lang":"js","X-Stainless-Package-Version":Ke,"X-Stainless-OS":vi(globalThis.process.platform??"unknown"),"X-Stainless-Arch":ki(globalThis.process.arch??"unknown"),"X-Stainless-Runtime":"node","X-Stainless-Runtime-Version":globalThis.process.version??"unknown"};let e=ml();return e?{"X-Stainless-Lang":"js","X-Stainless-Package-Version":Ke,"X-Stainless-OS":"Unknown","X-Stainless-Arch":"unknown","X-Stainless-Runtime":`browser:${e.browser}`,"X-Stainless-Runtime-Version":e.version}:{"X-Stainless-Lang":"js","X-Stainless-Package-Version":Ke,"X-Stainless-OS":"Unknown","X-Stainless-Arch":"unknown","X-Stainless-Runtime":"unknown","X-Stainless-Runtime-Version":"unknown"}};function ml(){if(typeof navigator>"u"||!navigator)return null;let t=[{key:"edge",pattern:/Edge(?:\W+(\d+)\.(\d+)(?:\.(\d+))?)?/},{key:"ie",pattern:/MSIE(?:\W+(\d+)\.(\d+)(?:\.(\d+))?)?/},{key:"ie",pattern:/Trident(?:.*rv\:(\d+)\.(\d+)(?:\.(\d+))?)?/},{key:"chrome",pattern:/Chrome(?:\W+(\d+)\.(\d+)(?:\.(\d+))?)?/},{key:"firefox",pattern:/Firefox(?:\W+(\d+)\.(\d+)(?:\.(\d+))?)?/},{key:"safari",pattern:/(?:Version\W+(\d+)\.(\d+)(?:\.(\d+))?)?(?:\W+Mobile\S*)?\W+Safari/}];for(let{key:e,pattern:r}of t){let s=r.exec(navigator.userAgent);if(s){let n=s[1]||0,o=s[2]||0,i=s[3]||0;return{browser:e,version:`${n}.${o}.${i}`}}}return null}var ki=t=>t==="x32"?"x32":t==="x86_64"||t==="x64"?"x64":t==="arm"?"arm":t==="aarch64"||t==="arm64"?"arm64":t?`other:${t}`:"unknown",vi=t=>(t=t.toLowerCase(),t.includes("ios")?"iOS":t==="android"?"Android":t==="darwin"?"MacOS":t==="win32"?"Windows":t==="freebsd"?"FreeBSD":t==="openbsd"?"OpenBSD":t==="linux"?"Linux":t?`Other:${t}`:"Unknown"),Ti,Ri=()=>Ti??(Ti=pl());function Zs(){if(typeof fetch<"u")return fetch;throw new Error("`fetch` is not defined as a global; Either pass `fetch` to the client, `new OpenAI({ fetch })` or polyfill the global, `globalThis.fetch = fetch`")}function Jn(...t){let e=globalThis.ReadableStream;if(typeof e>"u")throw new Error("`ReadableStream` is not defined as a global; You will need to polyfill it, `globalThis.ReadableStream = ReadableStream`");return new e(...t)}function Vs(t){let e=Symbol.asyncIterator in t?t[Symbol.asyncIterator]():t[Symbol.iterator]();return Jn({start(){},async pull(r){let{done:s,value:n}=await e.next();s?r.close():r.enqueue(n)},async cancel(){await e.return?.()}})}function Gn(t){if(t[Symbol.asyncIterator])return t;let e=t.getReader();return{async next(){try{let r=await e.read();return r?.done&&e.releaseLock(),r}catch(r){throw e.releaseLock(),r}},async return(){let r=e.cancel();return e.releaseLock(),await r,{done:!0,value:void 0}},[Symbol.asyncIterator](){return this}}}async function Xn(t){if(t===null||typeof t!="object")return;if(t[Symbol.asyncIterator]){await t[Symbol.asyncIterator]().return?.();return}let e=t.getReader(),r=e.cancel();e.releaseLock(),await r}var Si=({headers:t,body:e})=>({bodyHeaders:{"content-type":"application/json"},body:JSON.stringify(e)});var Yn="RFC3986",Qn=t=>String(t),eo={RFC1738:t=>String(t).replace(/%20/g,"+"),RFC3986:Qn},$i="RFC1738";var Js=(t,e)=>(Js=Object.hasOwn??Function.prototype.call.bind(Object.prototype.hasOwnProperty),Js(t,e)),xe=(()=>{let t=[];for(let e=0;e<256;++e)t.push("%"+((e<16?"0":"")+e.toString(16)).toUpperCase());return t})();var to=1024,Mi=(t,e,r,s,n)=>{if(t.length===0)return t;let o=t;if(typeof t=="symbol"?o=Symbol.prototype.toString.call(t):typeof t!="string"&&(o=String(t)),r==="iso-8859-1")return escape(o).replace(/%u[0-9a-f]{4}/gi,function(a){return"%26%23"+parseInt(a.slice(2),16)+"%3B"});let i="";for(let a=0;a<o.length;a+=to){let c=o.length>=to?o.slice(a,a+to):o,u=[];for(let f=0;f<c.length;++f){let h=c.charCodeAt(f);if(h===45||h===46||h===95||h===126||h>=48&&h<=57||h>=65&&h<=90||h>=97&&h<=122||n===$i&&(h===40||h===41)){u[u.length]=c.charAt(f);continue}if(h<128){u[u.length]=xe[h];continue}if(h<2048){u[u.length]=xe[192|h>>6]+xe[128|h&63];continue}if(h<55296||h>=57344){u[u.length]=xe[224|h>>12]+xe[128|h>>6&63]+xe[128|h&63];continue}f+=1,h=65536+((h&1023)<<10|c.charCodeAt(f)&1023),u[u.length]=xe[240|h>>18]+xe[128|h>>12&63]+xe[128|h>>6&63]+xe[128|h&63]}i+=u.join("")}return i};function Ni(t){return!t||typeof t!="object"?!1:!!(t.constructor&&t.constructor.isBuffer&&t.constructor.isBuffer(t))}function ro(t,e){if(Y(t)){let r=[];for(let s=0;s<t.length;s+=1)r.push(e(t[s]));return r}return e(t)}var ji={brackets(t){return String(t)+"[]"},comma:"comma",indices(t,e){return String(t)+"["+e+"]"},repeat(t){return String(t)}},Ui=function(t,e){Array.prototype.push.apply(t,Y(e)?e:[e])},zi,W={addQueryPrefix:!1,allowDots:!1,allowEmptyArrays:!1,arrayFormat:"indices",charset:"utf-8",charsetSentinel:!1,delimiter:"&",encode:!0,encodeDotInKeys:!1,encoder:Mi,encodeValuesOnly:!1,format:Yn,formatter:Qn,indices:!1,serializeDate(t){return(zi??(zi=Function.prototype.call.bind(Date.prototype.toISOString)))(t)},skipNulls:!1,strictNullHandling:!1};function fl(t){return typeof t=="string"||typeof t=="number"||typeof t=="boolean"||typeof t=="symbol"||typeof t=="bigint"}var so={};function Di(t,e,r,s,n,o,i,a,c,u,f,h,y,A,I,b,_,m){let g=t,O=m,R=0,N=!1;for(;(O=O.get(so))!==void 0&&!N;){let F=O.get(t);if(R+=1,typeof F<"u"){if(F===R)throw new RangeError("Cyclic object value");N=!0}typeof O.get(so)>"u"&&(R=0)}if(typeof u=="function"?g=u(e,g):g instanceof Date?g=y?.(g):r==="comma"&&Y(g)&&(g=ro(g,function(F){return F instanceof Date?y?.(F):F})),g===null){if(o)return c&&!b?c(e,W.encoder,_,"key",A):e;g=""}if(fl(g)||Ni(g)){if(c){let F=b?e:c(e,W.encoder,_,"key",A);return[I?.(F)+"="+I?.(c(g,W.encoder,_,"value",A))]}return[I?.(e)+"="+I?.(String(g))]}let z=[];if(typeof g>"u")return z;let j;if(r==="comma"&&Y(g))b&&c&&(g=ro(g,c)),j=[{value:g.length>0?g.join(",")||null:void 0}];else if(Y(u))j=u;else{let F=Object.keys(g);j=f?F.sort(f):F}let L=a?String(e).replace(/\./g,"%2E"):String(e),X=s&&Y(g)&&g.length===1?L+"[]":L;if(n&&Y(g)&&g.length===0)return X+"[]";for(let F=0;F<j.length;++F){let q=j[F],Vo=typeof q=="object"&&typeof q.value<"u"?q.value:g[q];if(i&&Vo===null)continue;let jn=h&&a?q.replace(/\./g,"%2E"):q,al=Y(g)?typeof r=="function"?r(X,jn):X:X+(h?"."+jn:"["+jn+"]");m.set(t,R);let Jo=new WeakMap;Jo.set(so,m),Ui(z,Di(Vo,al,r,s,n,o,i,a,r==="comma"&&b&&Y(g)?null:c,u,f,h,y,A,I,b,_,Jo))}return z}function hl(t=W){if(typeof t.allowEmptyArrays<"u"&&typeof t.allowEmptyArrays!="boolean")throw new TypeError("`allowEmptyArrays` option can only be `true` or `false`, when provided");if(typeof t.encodeDotInKeys<"u"&&typeof t.encodeDotInKeys!="boolean")throw new TypeError("`encodeDotInKeys` option can only be `true` or `false`, when provided");if(t.encoder!==null&&typeof t.encoder<"u"&&typeof t.encoder!="function")throw new TypeError("Encoder has to be a function.");let e=t.charset||W.charset;if(typeof t.charset<"u"&&t.charset!=="utf-8"&&t.charset!=="iso-8859-1")throw new TypeError("The charset option must be either utf-8, iso-8859-1, or undefined");let r=Yn;if(typeof t.format<"u"){if(!Js(eo,t.format))throw new TypeError("Unknown format option provided.");r=t.format}let s=eo[r],n=W.filter;(typeof t.filter=="function"||Y(t.filter))&&(n=t.filter);let o;if(t.arrayFormat&&t.arrayFormat in ji?o=t.arrayFormat:"indices"in t?o=t.indices?"indices":"repeat":o=W.arrayFormat,"commaRoundTrip"in t&&typeof t.commaRoundTrip!="boolean")throw new TypeError("`commaRoundTrip` must be a boolean, or absent");let i=typeof t.allowDots>"u"?t.encodeDotInKeys?!0:W.allowDots:!!t.allowDots;return{addQueryPrefix:typeof t.addQueryPrefix=="boolean"?t.addQueryPrefix:W.addQueryPrefix,allowDots:i,allowEmptyArrays:typeof t.allowEmptyArrays=="boolean"?!!t.allowEmptyArrays:W.allowEmptyArrays,arrayFormat:o,charset:e,charsetSentinel:typeof t.charsetSentinel=="boolean"?t.charsetSentinel:W.charsetSentinel,commaRoundTrip:!!t.commaRoundTrip,delimiter:typeof t.delimiter>"u"?W.delimiter:t.delimiter,encode:typeof t.encode=="boolean"?t.encode:W.encode,encodeDotInKeys:typeof t.encodeDotInKeys=="boolean"?t.encodeDotInKeys:W.encodeDotInKeys,encoder:typeof t.encoder=="function"?t.encoder:W.encoder,encodeValuesOnly:typeof t.encodeValuesOnly=="boolean"?t.encodeValuesOnly:W.encodeValuesOnly,filter:n,format:r,formatter:s,serializeDate:typeof t.serializeDate=="function"?t.serializeDate:W.serializeDate,skipNulls:typeof t.skipNulls=="boolean"?t.skipNulls:W.skipNulls,sort:typeof t.sort=="function"?t.sort:null,strictNullHandling:typeof t.strictNullHandling=="boolean"?t.strictNullHandling:W.strictNullHandling}}function Li(t,e={}){let r=t,s=hl(e),n,o;typeof s.filter=="function"?(o=s.filter,r=o("",r)):Y(s.filter)&&(o=s.filter,n=o);let i=[];if(typeof r!="object"||r===null)return"";let a=ji[s.arrayFormat],c=a==="comma"&&s.commaRoundTrip;n||(n=Object.keys(r)),s.sort&&n.sort(s.sort);let u=new WeakMap;for(let y=0;y<n.length;++y){let A=n[y];s.skipNulls&&r[A]===null||Ui(i,Di(r[A],A,a,c,s.allowEmptyArrays,s.strictNullHandling,s.skipNulls,s.encodeDotInKeys,s.encode?s.encoder:null,s.filter,s.sort,s.allowDots,s.serializeDate,s.format,s.formatter,s.encodeValuesOnly,s.charset,u))}let f=i.join(s.delimiter),h=s.addQueryPrefix===!0?"?":"";return s.charsetSentinel&&(s.charset==="iso-8859-1"?h+="utf8=%26%2310003%3B&":h+="utf8=%E2%9C%93&"),f.length>0?h+f:""}function Ki(t){return Li(t,{arrayFormat:"brackets"})}function qi(t){let e=0;for(let n of t)e+=n.length;let r=new Uint8Array(e),s=0;for(let n of t)r.set(n,s),s+=n.length;return r}var Fi;function Gt(t){let e;return(Fi??(e=new globalThis.TextEncoder,Fi=e.encode.bind(e)))(t)}var Bi;function no(t){let e;return(Bi??(e=new globalThis.TextDecoder,Bi=e.decode.bind(e)))(t)}var se,ne,nt=class{constructor(){se.set(this,void 0),ne.set(this,void 0),k(this,se,new Uint8Array,"f"),k(this,ne,null,"f")}decode(e){if(e==null)return[];let r=e instanceof ArrayBuffer?new Uint8Array(e):typeof e=="string"?Gt(e):e;k(this,se,qi([d(this,se,"f"),r]),"f");let s=[],n;for(;(n=gl(d(this,se,"f"),d(this,ne,"f")))!=null;){if(n.carriage&&d(this,ne,"f")==null){k(this,ne,n.index,"f");continue}if(d(this,ne,"f")!=null&&(n.index!==d(this,ne,"f")+1||n.carriage)){s.push(no(d(this,se,"f").subarray(0,d(this,ne,"f")-1))),k(this,se,d(this,se,"f").subarray(d(this,ne,"f")),"f"),k(this,ne,null,"f");continue}let o=d(this,ne,"f")!==null?n.preceding-1:n.preceding,i=no(d(this,se,"f").subarray(0,o));s.push(i),k(this,se,d(this,se,"f").subarray(n.index),"f"),k(this,ne,null,"f")}return s}flush(){return d(this,se,"f").length?this.decode(`
@@ -1,2 +1,2 @@
1
1
  /* COPYRIGHT Esri - https://js.arcgis.com/5.2/LICENSE.txt */
2
- import c from"./SKXDXIQO.js";import b from"./EIPHHMWX.js";import a from"./JMODFBN6.js";import{a as s,c as e}from"./V6HOUZPZ.js";import"./3UEKINYC.js";import"./RLEHNAIA.js";import{v as i,z as r}from"./NAKAZDJ7.js";import"./R74ZHFA6.js";import"./HJG7QM2R.js";import"./SYEI4BB2.js";import"./ZQ7PGNWB.js";import"./LUY6V4TP.js";import"./VXFQANGJ.js";import"./MWYBF3F3.js";import"./UZLQALHY.js";export default $arcgis.t(([,,,,,,,,,,,,,o])=>{var t=class extends i{constructor(){super(...arguments),this.agent=o}static{this.properties={referenceElement:1}}#t;#i;getContext(){if(!this.#t)throw new Error("arcgis-assistant-help-agent requires a mapView");return{mapView:this.#t}}load(){this.#t=s(this,"arcgis-assistant-help-agent"),this.#i=e(this)}disconnectedCallback(){this.#i?.unregister(this.agent.id),super.disconnectedCallback()}};r("arcgis-assistant-help-agent",t);return t},"identity/IdentityManager","portal/Portal","config","core/reactiveUtils","layers/FeatureLayer","request","intl","smartMapping/statistics/summaryStatistics","smartMapping/statistics/uniqueValues","views/LinkChartView","rest/knowledgeGraphService",a,b,c)
2
+ import c from"./SUA3YJTU.js";import b from"./PNFBQ6JV.js";import a from"./5I35MJXT.js";import{a as s,c as e}from"./V6HOUZPZ.js";import"./3UEKINYC.js";import"./RLEHNAIA.js";import{v as i,z as r}from"./NAKAZDJ7.js";import"./R74ZHFA6.js";import"./HJG7QM2R.js";import"./ICYUPLZM.js";import"./TFT6HK3O.js";import"./LUY6V4TP.js";import"./VXFQANGJ.js";import"./MWYBF3F3.js";import"./UZLQALHY.js";export default $arcgis.t(([,,,,,,,,,,,,,o])=>{var t=class extends i{constructor(){super(...arguments),this.agent=o}static{this.properties={referenceElement:1}}#t;#i;getContext(){if(!this.#t)throw new Error("arcgis-assistant-help-agent requires a mapView");return{mapView:this.#t}}load(){this.#t=s(this,"arcgis-assistant-help-agent"),this.#i=e(this)}disconnectedCallback(){this.#i?.unregister(this.agent.id),super.disconnectedCallback()}};r("arcgis-assistant-help-agent",t);return t},"identity/IdentityManager","portal/Portal","config","core/reactiveUtils","layers/FeatureLayer","request","intl","smartMapping/statistics/summaryStatistics","smartMapping/statistics/uniqueValues","views/LinkChartView","rest/knowledgeGraphService",a,b,c)
@@ -1,2 +1,2 @@
1
1
  /* COPYRIGHT Esri - https://js.arcgis.com/5.2/LICENSE.txt */
2
- import a from"./3OH4DXSY.js";import"./SBP6WNDY.js";import"./ZQ7PGNWB.js";import"./LUY6V4TP.js";import"./MWYBF3F3.js";import"./UZLQALHY.js";export default $arcgis.t(([{property:g,subclass:p},{c:d,d:u}])=>{var f=Object.defineProperty,w=Object.getOwnPropertyDescriptor,c=(e,r,n,o)=>{for(var t=o>1?void 0:o?w(r,n):r,i=e.length-1,a;i>=0;i--)(a=e[i])&&(t=(o?a(r,n,t):a(t))||t);return o&&t&&f(r,n,t),t},s=class extends u{constructor(e){super(e)}getAgents(){return this.agents}buildNodes(e){let r=super.buildNodes(e);return r[l]=()=>({}),r}buildEdges(e){let r=this.condition;if(!r)throw new Error("ConditionalWorkflow requires a condition.");let n=d(e[0],0),o=d(e[1],1);return[{from:l,decide:async(t,i)=>await Promise.resolve(r(t,i))?n:o}]}getEntryNode(){return l}isTerminalAgent(){return!0}validateAgents(e){if(super.validateAgents(e),e.length!==2)throw new Error(`ConditionalWorkflow requires exactly 2 agents; received ${e.length}.`)}};c([g()],s.prototype,"condition",2);c([g()],s.prototype,"agents",2);s=c([p("ConditionalWorkflow")],s);var l="__conditional_decide";return s},"core/accessorSupport/decorators",a)
2
+ import a from"./ZS6SXJP2.js";import"./57OMVTIU.js";import"./TFT6HK3O.js";import"./LUY6V4TP.js";import"./MWYBF3F3.js";import"./UZLQALHY.js";export default $arcgis.t(([{property:g,subclass:p},{c:d,d:u}])=>{var f=Object.defineProperty,w=Object.getOwnPropertyDescriptor,c=(e,r,n,o)=>{for(var t=o>1?void 0:o?w(r,n):r,i=e.length-1,a;i>=0;i--)(a=e[i])&&(t=(o?a(r,n,t):a(t))||t);return o&&t&&f(r,n,t),t},s=class extends u{constructor(e){super(e)}getAgents(){return this.agents}buildNodes(e){let r=super.buildNodes(e);return r[l]=()=>({}),r}buildEdges(e){let r=this.condition;if(!r)throw new Error("ConditionalWorkflow requires a condition.");let n=d(e[0],0),o=d(e[1],1);return[{from:l,decide:async(t,i)=>await Promise.resolve(r(t,i))?n:o}]}getEntryNode(){return l}isTerminalAgent(){return!0}validateAgents(e){if(super.validateAgents(e),e.length!==2)throw new Error(`ConditionalWorkflow requires exactly 2 agents; received ${e.length}.`)}};c([g()],s.prototype,"condition",2);c([g()],s.prototype,"agents",2);s=c([p("ConditionalWorkflow")],s);var l="__conditional_decide";return s},"core/accessorSupport/decorators",a)
@@ -1,2 +1,2 @@
1
1
  /* COPYRIGHT Esri - https://js.arcgis.com/5.2/LICENSE.txt */
2
- import{a as u,b as S,c as v}from"./M3MRIGDZ.js";import b from"./MMRRNKWJ.js";import{b as f,c as y}from"./SBP6WNDY.js";import a from"./JMODFBN6.js";import"./R74ZHFA6.js";import"./HJG7QM2R.js";import{c as d}from"./FQ5XLE4I.js";import{b as c}from"./SYEI4BB2.js";import{X as g,y as l}from"./ZQ7PGNWB.js";import"./LUY6V4TP.js";import"./VXFQANGJ.js";import"./MWYBF3F3.js";import"./UZLQALHY.js";export default $arcgis.t(([,,{watch:T},,,{property:m,subclass:_},{f:h},w])=>{var k=Object.defineProperty,x=Object.getOwnPropertyDescriptor,a=(e,s,t,r)=>{for(var o=r>1?void 0:r?x(s,t):s,n=e.length-1,p;n>=0;n--)(p=e[n])&&(o=(r?p(s,t,o):p(o))||o);return r&&o&&k(s,t,o),o},i=class extends w{constructor(e){super(e),this.modelTier="default"}initialize(){this.addHandles(T(()=>[this.description,this.inputSchema,this.modelTier,this.name,this.outputSchema,this.prompt,this.tools],()=>{this.generate()},{initial:!0,sync:!0}))}getSchemas(){return[this.inputSchema,this.outputSchema].filter(Boolean)}generate(){let e=f(this.getSchemas());this._set("workspace",e);let s=this.id,t={[s]:this._invoke.bind(this)},r=[{from:s,decide:()=>{}}];this._set("createGraph",()=>y(t,r,e,{agent:this,entryNode:s,middlewares:this.middlewares}))}async _invoke(e,s){try{return this.outputSchema?await this._invokeStructured(e,s):await this._invokeUnstructured(e,s)}catch(t){if(l(t))throw t;let r=t instanceof Error?t.message:String(t);return u({outputMessage:r},"failed",r)}}async _invokeStructured(e,s){if(!this.outputSchema)throw new Error("Output schema is required for structured invocation.");let t=await c({model:await h({modelTier:this.modelTier}),systemPrompt:await this._getPromptWithInputVariables(e),tools:this._getTools(),checkpointer:!0,middleware:d(this.middlewares),responseFormat:this.outputSchema}).invoke({messages:e.agentExecutionContext.messages},s);if(!("structuredResponse"in t)||t.structuredResponse===void 0)throw new Error("LLMAgent did not receive structured output from createAgent.");return S(t.structuredResponse,this.outputSchema,t.messages)}async _invokeUnstructured(e,s){let t=(await c({model:await h({modelTier:this.modelTier}),systemPrompt:await this._getPromptWithInputVariables(e),tools:this._getTools(),checkpointer:!0,middleware:d(this.middlewares)}).invoke({messages:e.agentExecutionContext.messages},s)).messages,r=t.at(-1)?.content??"",o=typeof r=="string"?r:JSON.stringify(r),n=o.trim()||"LLMAgent completed.";return u({agentExecutionContext:{...e.agentExecutionContext,messages:t},outputMessage:o},"success",n)}async _getPromptWithInputVariables(e){let s=v(e,this.inputSchema);for(let{outputKey:t}of this.middlewares)t&&(s[String(t)]=e[t]);return await g.fromTemplate(this.prompt).format(s)}_getTools(){return this.tools?.map(e=>e.getTool())??[]}};a([m()],i.prototype,"prompt",2);a([m()],i.prototype,"tools",2);a([m()],i.prototype,"inputSchema",2);a([m()],i.prototype,"outputSchema",2);a([m()],i.prototype,"modelTier",2);i=a([_("LLMAgent")],i);return i},"identity/IdentityManager","portal/Portal","core/reactiveUtils","layers/FeatureLayer","request","core/accessorSupport/decorators",a,b)
2
+ import{a as u,b as S,c as v}from"./M3MRIGDZ.js";import b from"./HBLRVXEB.js";import{b as f,c as y}from"./57OMVTIU.js";import a from"./5I35MJXT.js";import"./R74ZHFA6.js";import"./HJG7QM2R.js";import{c as d}from"./YHQJ66WJ.js";import{b as c}from"./ICYUPLZM.js";import{X as g,y as l}from"./TFT6HK3O.js";import"./LUY6V4TP.js";import"./VXFQANGJ.js";import"./MWYBF3F3.js";import"./UZLQALHY.js";export default $arcgis.t(([,,{watch:T},,,{property:m,subclass:_},{f:h},w])=>{var k=Object.defineProperty,x=Object.getOwnPropertyDescriptor,a=(e,s,t,r)=>{for(var o=r>1?void 0:r?x(s,t):s,n=e.length-1,p;n>=0;n--)(p=e[n])&&(o=(r?p(s,t,o):p(o))||o);return r&&o&&k(s,t,o),o},i=class extends w{constructor(e){super(e),this.modelTier="default"}initialize(){this.addHandles(T(()=>[this.description,this.inputSchema,this.modelTier,this.name,this.outputSchema,this.prompt,this.tools],()=>{this.generate()},{initial:!0,sync:!0}))}getSchemas(){return[this.inputSchema,this.outputSchema].filter(Boolean)}generate(){let e=f(this.getSchemas());this._set("workspace",e);let s=this.id,t={[s]:this._invoke.bind(this)},r=[{from:s,decide:()=>{}}];this._set("createGraph",()=>y(t,r,e,{agent:this,entryNode:s,middlewares:this.middlewares}))}async _invoke(e,s){try{return this.outputSchema?await this._invokeStructured(e,s):await this._invokeUnstructured(e,s)}catch(t){if(l(t))throw t;let r=t instanceof Error?t.message:String(t);return u({outputMessage:r},"failed",r)}}async _invokeStructured(e,s){if(!this.outputSchema)throw new Error("Output schema is required for structured invocation.");let t=await c({model:await h({modelTier:this.modelTier}),systemPrompt:await this._getPromptWithInputVariables(e),tools:this._getTools(),checkpointer:!0,middleware:d(this.middlewares),responseFormat:this.outputSchema}).invoke({messages:e.agentExecutionContext.messages},s);if(!("structuredResponse"in t)||t.structuredResponse===void 0)throw new Error("LLMAgent did not receive structured output from createAgent.");return S(t.structuredResponse,this.outputSchema,t.messages)}async _invokeUnstructured(e,s){let t=(await c({model:await h({modelTier:this.modelTier}),systemPrompt:await this._getPromptWithInputVariables(e),tools:this._getTools(),checkpointer:!0,middleware:d(this.middlewares)}).invoke({messages:e.agentExecutionContext.messages},s)).messages,r=t.at(-1)?.content??"",o=typeof r=="string"?r:JSON.stringify(r),n=o.trim()||"LLMAgent completed.";return u({agentExecutionContext:{...e.agentExecutionContext,messages:t},outputMessage:o},"success",n)}async _getPromptWithInputVariables(e){let s=v(e,this.inputSchema);for(let{outputKey:t}of this.middlewares)t&&(s[String(t)]=e[t]);return await g.fromTemplate(this.prompt).format(s)}_getTools(){return this.tools?.map(e=>e.getTool())??[]}};a([m()],i.prototype,"prompt",2);a([m()],i.prototype,"tools",2);a([m()],i.prototype,"inputSchema",2);a([m()],i.prototype,"outputSchema",2);a([m()],i.prototype,"modelTier",2);i=a([_("LLMAgent")],i);return i},"identity/IdentityManager","portal/Portal","core/reactiveUtils","layers/FeatureLayer","request","core/accessorSupport/decorators",a,b)
@@ -1,2 +1,2 @@
1
1
  /* COPYRIGHT Esri - https://js.arcgis.com/5.2/LICENSE.txt */
2
- import{a as u,b as g,c as S}from"./M3MRIGDZ.js";import a from"./MMRRNKWJ.js";import{b as m,c as f}from"./SBP6WNDY.js";import{y as p}from"./ZQ7PGNWB.js";import"./LUY6V4TP.js";import"./MWYBF3F3.js";import"./UZLQALHY.js";export default $arcgis.t(([{property:h,subclass:l},{watch:w},d])=>{var v=Object.defineProperty,y=Object.getOwnPropertyDescriptor,o=(t,e,s,r)=>{for(var i=r>1?void 0:r?y(e,s):e,a=t.length-1,c;a>=0;a--)(c=t[a])&&(i=(r?c(e,s,i):c(i))||i);return r&&i&&v(e,s,i),i},n=class extends d{constructor(t){super(t)}initialize(){this.addHandles(w(()=>[this.name,this.description,this.inputSchema,this.outputSchema,this.execute],()=>{this.generate()},{initial:!0,sync:!0}))}getSchemas(){return[this.inputSchema,this.outputSchema].filter(Boolean)}generate(){let t=m(this.getSchemas());this._set("workspace",t);let e=`${this.id}-execute`,s={[e]:this._invokeExecuteNode.bind(this)},r=[{from:e,decide:()=>{}}];this._set("createGraph",()=>f(s,r,t,{agent:this,entryNode:e,middlewares:this.middlewares}))}async _invokeExecuteNode(t,e){try{return this.outputSchema?await this._invokeStructured(t,e):await this._invokeUnstructured(t,e)}catch(s){if(p(s))throw s;let r=s instanceof Error?s.message:String(s);return u({outputMessage:r},"failed",r)}}async _invokeStructured(t,e){if(!this.outputSchema)throw new Error("Output schema is required for structured invocation.");let s=this._validateInputState(t),r=await this.execute(s,e);if(typeof r=="string")throw new Error("Expected execute function to return an object matching the output schema, but received a string.");return g(r,this.outputSchema,t.agentExecutionContext.messages)}async _invokeUnstructured(t,e){let s=this._validateInputState(t),r=await this.execute(s,e),i=typeof r=="string"?r:JSON.stringify(r),a=i.trim()||"FunctionAgent completed.";return u({outputMessage:i},"success",a)}_validateInputState(t){if(!this.inputSchema)return t;let e=this.inputSchema.safeParse(S(t,this.inputSchema));if(!e.success)throw new Error(`FunctionAgent input schema validation failed: ${e.error.message}`);return{...t,...e.data}}};o([h()],n.prototype,"inputSchema",2);o([h()],n.prototype,"outputSchema",2);o([h()],n.prototype,"execute",2);n=o([l("FunctionAgent")],n);return n},"core/accessorSupport/decorators","core/reactiveUtils",a)
2
+ import{a as u,b as g,c as S}from"./M3MRIGDZ.js";import a from"./HBLRVXEB.js";import{b as m,c as f}from"./57OMVTIU.js";import{y as p}from"./TFT6HK3O.js";import"./LUY6V4TP.js";import"./MWYBF3F3.js";import"./UZLQALHY.js";export default $arcgis.t(([{property:h,subclass:l},{watch:w},d])=>{var v=Object.defineProperty,y=Object.getOwnPropertyDescriptor,o=(t,e,s,r)=>{for(var i=r>1?void 0:r?y(e,s):e,a=t.length-1,c;a>=0;a--)(c=t[a])&&(i=(r?c(e,s,i):c(i))||i);return r&&i&&v(e,s,i),i},n=class extends d{constructor(t){super(t)}initialize(){this.addHandles(w(()=>[this.name,this.description,this.inputSchema,this.outputSchema,this.execute],()=>{this.generate()},{initial:!0,sync:!0}))}getSchemas(){return[this.inputSchema,this.outputSchema].filter(Boolean)}generate(){let t=m(this.getSchemas());this._set("workspace",t);let e=`${this.id}-execute`,s={[e]:this._invokeExecuteNode.bind(this)},r=[{from:e,decide:()=>{}}];this._set("createGraph",()=>f(s,r,t,{agent:this,entryNode:e,middlewares:this.middlewares}))}async _invokeExecuteNode(t,e){try{return this.outputSchema?await this._invokeStructured(t,e):await this._invokeUnstructured(t,e)}catch(s){if(p(s))throw s;let r=s instanceof Error?s.message:String(s);return u({outputMessage:r},"failed",r)}}async _invokeStructured(t,e){if(!this.outputSchema)throw new Error("Output schema is required for structured invocation.");let s=this._validateInputState(t),r=await this.execute(s,e);if(typeof r=="string")throw new Error("Expected execute function to return an object matching the output schema, but received a string.");return g(r,this.outputSchema,t.agentExecutionContext.messages)}async _invokeUnstructured(t,e){let s=this._validateInputState(t),r=await this.execute(s,e),i=typeof r=="string"?r:JSON.stringify(r),a=i.trim()||"FunctionAgent completed.";return u({outputMessage:i},"success",a)}_validateInputState(t){if(!this.inputSchema)return t;let e=this.inputSchema.safeParse(S(t,this.inputSchema));if(!e.success)throw new Error(`FunctionAgent input schema validation failed: ${e.error.message}`);return{...t,...e.data}}};o([h()],n.prototype,"inputSchema",2);o([h()],n.prototype,"outputSchema",2);o([h()],n.prototype,"execute",2);n=o([l("FunctionAgent")],n);return n},"core/accessorSupport/decorators","core/reactiveUtils",a)
@@ -1,2 +1,2 @@
1
1
  /* COPYRIGHT Esri - https://js.arcgis.com/5.2/LICENSE.txt */
2
- import d from"./GPVY5GM6.js";import c from"./UK7PR2FE.js";import b from"./EIPHHMWX.js";import a from"./JMODFBN6.js";import{a as s,c as e}from"./V6HOUZPZ.js";import"./3UEKINYC.js";import"./RLEHNAIA.js";import{v as i,z as r}from"./NAKAZDJ7.js";import"./R74ZHFA6.js";import"./HJG7QM2R.js";import"./SYEI4BB2.js";import"./ZQ7PGNWB.js";import"./LUY6V4TP.js";import"./VXFQANGJ.js";import"./MWYBF3F3.js";import"./UZLQALHY.js";export default $arcgis.t(([,,,,,,,,,,,,,,o])=>{var t=class extends i{constructor(){super(...arguments),this.agent=o}static{this.properties={referenceElement:1}}#t;#i;getContext(){if(!this.#t)throw new Error("arcgis-assistant-layer-styling-agent requires a mapView");return{mapView:this.#t}}load(){this.#t=s(this,"arcgis-assistant-layer-styling-agent"),this.#i=e(this)}disconnectedCallback(){this.#i?.unregister(this.agent.id),super.disconnectedCallback()}};r("arcgis-assistant-layer-styling-agent",t);return t},"identity/IdentityManager","portal/Portal","config","core/reactiveUtils","layers/FeatureLayer","request","intl","smartMapping/statistics/summaryStatistics","smartMapping/statistics/uniqueValues","views/LinkChartView","rest/knowledgeGraphService",a,b,c,d)
2
+ import d from"./VPFIUEKT.js";import c from"./UK7PR2FE.js";import b from"./PNFBQ6JV.js";import a from"./5I35MJXT.js";import{a as s,c as e}from"./V6HOUZPZ.js";import"./3UEKINYC.js";import"./RLEHNAIA.js";import{v as i,z as r}from"./NAKAZDJ7.js";import"./R74ZHFA6.js";import"./HJG7QM2R.js";import"./ICYUPLZM.js";import"./TFT6HK3O.js";import"./LUY6V4TP.js";import"./VXFQANGJ.js";import"./MWYBF3F3.js";import"./UZLQALHY.js";export default $arcgis.t(([,,,,,,,,,,,,,,o])=>{var t=class extends i{constructor(){super(...arguments),this.agent=o}static{this.properties={referenceElement:1}}#t;#i;getContext(){if(!this.#t)throw new Error("arcgis-assistant-layer-styling-agent requires a mapView");return{mapView:this.#t}}load(){this.#t=s(this,"arcgis-assistant-layer-styling-agent"),this.#i=e(this)}disconnectedCallback(){this.#i?.unregister(this.agent.id),super.disconnectedCallback()}};r("arcgis-assistant-layer-styling-agent",t);return t},"identity/IdentityManager","portal/Portal","config","core/reactiveUtils","layers/FeatureLayer","request","intl","smartMapping/statistics/summaryStatistics","smartMapping/statistics/uniqueValues","views/LinkChartView","rest/knowledgeGraphService",a,b,c,d)
@@ -1,5 +1,5 @@
1
1
  /* COPYRIGHT Esri - https://js.arcgis.com/5.2/LICENSE.txt */
2
- import c from"./UK7PR2FE.js";import b from"./EIPHHMWX.js";import a from"./JMODFBN6.js";import{a as n}from"./HJG7QM2R.js";import{Va as N,a as I,b as S}from"./ZQ7PGNWB.js";import{ca as $}from"./LUY6V4TP.js";export default $arcgis.t(([,,,,,,P,U,{p:k,r:T},{C:M,D:z,E:L,F:D,G:F,H:O,a:A,m:w,n:R,o:y,p:V},b])=>{var W=async(e,t)=>(await n({text:"Exiting Data Exploration agent"},t),e),B=async(e,t)=>{await n({text:"Requesting LLM for layer filter results"},t);let a=await w("data_explore_filter_prompt");if(!t?.configurable)throw new Error("config.configurable is required for layer filter tools");let{userTimezone:d,userTimezoneOffset:o}=L(),s={layerFieldInfo:e.layerFieldInfo,userTimezone:d,userTimezoneOffset:o,queryResponse:e.queryResponse,assignedTask:e.agentExecutionContext.assignedTask,userRequest:e.agentExecutionContext.userRequest,priorSteps:e.agentExecutionContext.priorSteps},i=await T({promptText:a,modelTier:"advanced",config:t,messages:e.dataExplorationMessages,inputVariables:s,tools:F}),r=[...e.dataExplorationMessages,i];if(!((i.tool_calls?.length??0)>0))return await n({text:"LLM determined no filter changes needed"},t),{...e,dataExplorationMessages:r};let c=r,l=i.content.toString();return await b(i,t),{...e,dataExplorationMessages:c,outputMessage:l}},H=async(e,t)=>{await n({text:"Requesting LLM for layer query results"},t);let a=await w("data_explore_query_prompt");if(!t?.configurable)throw new Error("config.configurable is required for layer query tools");let{userTimezone:d,userTimezoneOffset:o}=L(),s=e.agentExecutionContext.sharedState,i=s.lastNavigatedFeatures?.value,r=s.lastResolvedLocation?.value,c="none";if(i!=null)try{c=JSON.stringify(i)}catch{c="none"}let l="none";if(r!=null)try{l=JSON.stringify({address:r.address,location:r.location})}catch{l="none"}let g={layerFieldInfo:e.layerFieldInfo,userTimezone:d,userTimezoneOffset:o,assignedTask:e.agentExecutionContext.assignedTask,userRequest:e.agentExecutionContext.userRequest,priorSteps:e.agentExecutionContext.priorSteps,lastNavigatedFeatures:c,lastResolvedLocation:l},m=await T({promptText:a,modelTier:"advanced",config:t,messages:e.dataExplorationMessages,inputVariables:g,tools:D}),h=(m.tool_calls?.length??0)>0,f=m.content.toString();return await b(m,t),{...e,dataExplorationMessages:[...e.dataExplorationMessages,m],...h?{}:{outputMessage:f},status:"success",summary:f&&!h?R(f):"Query planning completed."}},J=async(e,t)=>{try{await n({text:"Requesting LLM for summary on query results"},t);let a=await w("summarize_query_response_prompt"),d={queryResponse:e.queryResponse,assignedTask:e.agentExecutionContext.assignedTask,userRequest:e.agentExecutionContext.userRequest,priorSteps:e.agentExecutionContext.priorSteps},o=await k({promptText:a,modelTier:"fast",config:t,messages:e.dataExplorationMessages,inputVariables:d}),s=typeof o=="string"?o:o.content,i=new $(s);await n({text:`Received response from LLM: ${s}`},t);let r=s;return{...e,outputMessage:r,status:"success",summary:r?R(r):"Summary generated.",dataExplorationMessages:[...e.dataExplorationMessages,i]}}catch(a){throw await n({text:"Error during filter LLM request"},t),new Error(`Error during filter LLM request: ${a instanceof Error?a.message:String(a)}`)}};async function K(e,t){if((e.queryResponse??[]).some(d=>{let o=d.details;return typeof o=="object"&&o!==null&&"error"in o}))return await n({text:"Skipping layer filter tool because query response contains an error."},t),{...e};let a=await new A(F,{handleToolErrors:!1}).invoke({messages:e.dataExplorationMessages},t);return await n({text:`Finished executing layer filter tool: ${a.messages.map(d=>d.content).join(", ")}`},t),{...e}}var X=10,Y=["string","small-integer","integer"],Z=async(e,t,{includeSummaryStatistics:a=!0,includeUniqueValues:d=!0}={})=>{let o=null,s=null;try{if(t.type!=="geometry"&&t.type!=="oid"&&t.type!=="global-id"){a&&(o=await P({layer:e,field:t.name}));let i=t.domain?.type==="coded-value"?t.domain:null;d&&(Y.includes(t.type)||i)&&(s=(await U({layer:e,field:t.name})).uniqueValueInfos.sort((r,c)=>c.count-r.count).slice(0,X),i&&(s=s.map(r=>({...r,value:i.getName(r.value)??r.value}))))}}catch(i){console.error(`Error fetching statistics for field ${t.name}:`,i)}return{summaryStatistics:o,uniqueValues:s}};function ee(e,t){return["string","small-integer","integer"].includes(e)||t==="coded-value"}async function te(e,t,a,d=!0){let o=[],s=[],i=[];for(let r of e){let c=function(p){let u=t.get(p)?.layerItem;return u?[u.name&&`Name: ${u.name}`,u.title&&`Title: ${u.title}`,u.description&&`Description: ${u.description}`].filter(Boolean).join(" | "):p},{layerId:l,results:g}=r,m=a.map?.allLayers.find(p=>p.id===l),h=t.get(l)?.fieldRegistry;if(!h)continue;let f=o.find(p=>p.layerId===l);f||(f={layerId:l,layerSummary:c(l),fieldInfos:[]},o.push(f));for(let p of g){let u=h.get(p.name);if(!u)continue;let x=u.statistics,v=d&&!x?.summaryStatistics,q=ee(u.type,u.domain?.type)&&!x?.uniqueValues,_=v||q;if(i.push({layerId:l,fieldName:u.name,didFetchStatistics:_}),_){let G=Z(m,u,{includeSummaryStatistics:v,includeUniqueValues:q}).then(C=>{let E={summaryStatistics:x?.summaryStatistics??null,uniqueValues:x?.uniqueValues??null};v&&(E.summaryStatistics=C.summaryStatistics),q&&(E.uniqueValues=C.uniqueValues),h.set(u.name,{...u,statistics:E}),u.statistics=E});s.push(G)}f.fieldInfos.push(u)}}return await Promise.all(s),{layerFieldInfo:o,didFetchStatistics:s.length>0,fieldStatisticsFetchStatus:i}}var j=/\b(average|avg|mean|median|max(?:imum)?|min(?:imum)?|sum|total|count|std(?:dev|\s*deviation)|variance|null\s*count|missing\s*values?|range)\b/iu;function ae(e,t){return j.test(e)||j.test(t)}var se=async(e,t)=>{try{await n({text:"Preparing field information for vector search results"},t);let a=y(t,"layersAndFieldsRegistry"),{mapView:d}=z(t),{assignedTask:o,userRequest:s}=e.agentExecutionContext,i=ae(o,s),{layerFieldInfo:r,didFetchStatistics:c,fieldStatisticsFetchStatus:l}=await te(e.vectorSearchFieldResults,a,d,i);c?await n({text:"Statistics fetched"},t):await n({text:"Statistics skipped"},t);for(let g of l)await n({text:` - ${g.fieldName} - stats ${g.didFetchStatistics?"fetched":"skipped"}`},t);return await n({text:"Field information prepared"},t),{...e,layerFieldInfo:r}}catch(a){throw await n({text:"Error during fetching statistics"},t),new Error(`Error during fetching statistics: ${a instanceof Error?a.message:String(a)}`)}},Q=.7,re=10,ie=async(e,t)=>{try{await n({text:"Similarity search to find fields"},t);let a=y(t,"fieldSearch"),d=y(t,"layersAndFieldsRegistry"),o=y(t,"embeddingCache"),s=await a.searchFields({text:e.agentExecutionContext.assignedTask,layerIds:e.vectorSearchLayerIds,minScore:Q,topResults:re,embeddingCache:o}),i=s.map(({layerId:c,results:l})=>{let g=l.map(m=>` - ${m.name} (${m.score.toFixed(2)})`).join(`
2
+ import c from"./UK7PR2FE.js";import b from"./PNFBQ6JV.js";import a from"./5I35MJXT.js";import{a as n}from"./HJG7QM2R.js";import{Va as N,a as I,b as S}from"./TFT6HK3O.js";import{ca as $}from"./LUY6V4TP.js";export default $arcgis.t(([,,,,,,P,U,{p:k,r:T},{C:M,D:z,E:L,F:D,G:F,H:O,a:A,m:w,n:R,o:y,p:V},b])=>{var W=async(e,t)=>(await n({text:"Exiting Data Exploration agent"},t),e),B=async(e,t)=>{await n({text:"Requesting LLM for layer filter results"},t);let a=await w("data_explore_filter_prompt");if(!t?.configurable)throw new Error("config.configurable is required for layer filter tools");let{userTimezone:d,userTimezoneOffset:o}=L(),s={layerFieldInfo:e.layerFieldInfo,userTimezone:d,userTimezoneOffset:o,queryResponse:e.queryResponse,assignedTask:e.agentExecutionContext.assignedTask,userRequest:e.agentExecutionContext.userRequest,priorSteps:e.agentExecutionContext.priorSteps},i=await T({promptText:a,modelTier:"advanced",config:t,messages:e.dataExplorationMessages,inputVariables:s,tools:F}),r=[...e.dataExplorationMessages,i];if(!((i.tool_calls?.length??0)>0))return await n({text:"LLM determined no filter changes needed"},t),{...e,dataExplorationMessages:r};let c=r,l=i.content.toString();return await b(i,t),{...e,dataExplorationMessages:c,outputMessage:l}},H=async(e,t)=>{await n({text:"Requesting LLM for layer query results"},t);let a=await w("data_explore_query_prompt");if(!t?.configurable)throw new Error("config.configurable is required for layer query tools");let{userTimezone:d,userTimezoneOffset:o}=L(),s=e.agentExecutionContext.sharedState,i=s.lastNavigatedFeatures?.value,r=s.lastResolvedLocation?.value,c="none";if(i!=null)try{c=JSON.stringify(i)}catch{c="none"}let l="none";if(r!=null)try{l=JSON.stringify({address:r.address,location:r.location})}catch{l="none"}let g={layerFieldInfo:e.layerFieldInfo,userTimezone:d,userTimezoneOffset:o,assignedTask:e.agentExecutionContext.assignedTask,userRequest:e.agentExecutionContext.userRequest,priorSteps:e.agentExecutionContext.priorSteps,lastNavigatedFeatures:c,lastResolvedLocation:l},m=await T({promptText:a,modelTier:"advanced",config:t,messages:e.dataExplorationMessages,inputVariables:g,tools:D}),h=(m.tool_calls?.length??0)>0,f=m.content.toString();return await b(m,t),{...e,dataExplorationMessages:[...e.dataExplorationMessages,m],...h?{}:{outputMessage:f},status:"success",summary:f&&!h?R(f):"Query planning completed."}},J=async(e,t)=>{try{await n({text:"Requesting LLM for summary on query results"},t);let a=await w("summarize_query_response_prompt"),d={queryResponse:e.queryResponse,assignedTask:e.agentExecutionContext.assignedTask,userRequest:e.agentExecutionContext.userRequest,priorSteps:e.agentExecutionContext.priorSteps},o=await k({promptText:a,modelTier:"fast",config:t,messages:e.dataExplorationMessages,inputVariables:d}),s=typeof o=="string"?o:o.content,i=new $(s);await n({text:`Received response from LLM: ${s}`},t);let r=s;return{...e,outputMessage:r,status:"success",summary:r?R(r):"Summary generated.",dataExplorationMessages:[...e.dataExplorationMessages,i]}}catch(a){throw await n({text:"Error during filter LLM request"},t),new Error(`Error during filter LLM request: ${a instanceof Error?a.message:String(a)}`)}};async function K(e,t){if((e.queryResponse??[]).some(d=>{let o=d.details;return typeof o=="object"&&o!==null&&"error"in o}))return await n({text:"Skipping layer filter tool because query response contains an error."},t),{...e};let a=await new A(F,{handleToolErrors:!1}).invoke({messages:e.dataExplorationMessages},t);return await n({text:`Finished executing layer filter tool: ${a.messages.map(d=>d.content).join(", ")}`},t),{...e}}var X=10,Y=["string","small-integer","integer"],Z=async(e,t,{includeSummaryStatistics:a=!0,includeUniqueValues:d=!0}={})=>{let o=null,s=null;try{if(t.type!=="geometry"&&t.type!=="oid"&&t.type!=="global-id"){a&&(o=await P({layer:e,field:t.name}));let i=t.domain?.type==="coded-value"?t.domain:null;d&&(Y.includes(t.type)||i)&&(s=(await U({layer:e,field:t.name})).uniqueValueInfos.sort((r,c)=>c.count-r.count).slice(0,X),i&&(s=s.map(r=>({...r,value:i.getName(r.value)??r.value}))))}}catch(i){console.error(`Error fetching statistics for field ${t.name}:`,i)}return{summaryStatistics:o,uniqueValues:s}};function ee(e,t){return["string","small-integer","integer"].includes(e)||t==="coded-value"}async function te(e,t,a,d=!0){let o=[],s=[],i=[];for(let r of e){let c=function(p){let u=t.get(p)?.layerItem;return u?[u.name&&`Name: ${u.name}`,u.title&&`Title: ${u.title}`,u.description&&`Description: ${u.description}`].filter(Boolean).join(" | "):p},{layerId:l,results:g}=r,m=a.map?.allLayers.find(p=>p.id===l),h=t.get(l)?.fieldRegistry;if(!h)continue;let f=o.find(p=>p.layerId===l);f||(f={layerId:l,layerSummary:c(l),fieldInfos:[]},o.push(f));for(let p of g){let u=h.get(p.name);if(!u)continue;let x=u.statistics,v=d&&!x?.summaryStatistics,q=ee(u.type,u.domain?.type)&&!x?.uniqueValues,_=v||q;if(i.push({layerId:l,fieldName:u.name,didFetchStatistics:_}),_){let G=Z(m,u,{includeSummaryStatistics:v,includeUniqueValues:q}).then(C=>{let E={summaryStatistics:x?.summaryStatistics??null,uniqueValues:x?.uniqueValues??null};v&&(E.summaryStatistics=C.summaryStatistics),q&&(E.uniqueValues=C.uniqueValues),h.set(u.name,{...u,statistics:E}),u.statistics=E});s.push(G)}f.fieldInfos.push(u)}}return await Promise.all(s),{layerFieldInfo:o,didFetchStatistics:s.length>0,fieldStatisticsFetchStatus:i}}var j=/\b(average|avg|mean|median|max(?:imum)?|min(?:imum)?|sum|total|count|std(?:dev|\s*deviation)|variance|null\s*count|missing\s*values?|range)\b/iu;function ae(e,t){return j.test(e)||j.test(t)}var se=async(e,t)=>{try{await n({text:"Preparing field information for vector search results"},t);let a=y(t,"layersAndFieldsRegistry"),{mapView:d}=z(t),{assignedTask:o,userRequest:s}=e.agentExecutionContext,i=ae(o,s),{layerFieldInfo:r,didFetchStatistics:c,fieldStatisticsFetchStatus:l}=await te(e.vectorSearchFieldResults,a,d,i);c?await n({text:"Statistics fetched"},t):await n({text:"Statistics skipped"},t);for(let g of l)await n({text:` - ${g.fieldName} - stats ${g.didFetchStatistics?"fetched":"skipped"}`},t);return await n({text:"Field information prepared"},t),{...e,layerFieldInfo:r}}catch(a){throw await n({text:"Error during fetching statistics"},t),new Error(`Error during fetching statistics: ${a instanceof Error?a.message:String(a)}`)}},Q=.7,re=10,ie=async(e,t)=>{try{await n({text:"Similarity search to find fields"},t);let a=y(t,"fieldSearch"),d=y(t,"layersAndFieldsRegistry"),o=y(t,"embeddingCache"),s=await a.searchFields({text:e.agentExecutionContext.assignedTask,layerIds:e.vectorSearchLayerIds,minScore:Q,topResults:re,embeddingCache:o}),i=s.map(({layerId:c,results:l})=>{let g=l.map(m=>` - ${m.name} (${m.score.toFixed(2)})`).join(`
3
3
  `);return`${d.get(c)?.layerItem.name??c}:
4
4
  ${g}`}).join(`
5
5
  `),r;return s.length>0?r=`Vector search completed. Matching layers and fields with scores:
@@ -1,5 +1,5 @@
1
1
  /* COPYRIGHT Esri - https://js.arcgis.com/5.2/LICENSE.txt */
2
- import b from"./EIPHHMWX.js";import a from"./JMODFBN6.js";import{a as m}from"./HJG7QM2R.js";import{Va as $,a as k,b as E}from"./ZQ7PGNWB.js";import{a as f}from"./VXFQANGJ.js";export default $arcgis.t(([,,,,,,{q:N,r:T},{a:b,b:v,c:x,d:C,e:F,f:R,g:L,h:_,i:I,j:M,k:Z,l:A,m:S,n:q,o:p,p:j}])=>{var w=[C,F,R,L,_,I,M,Z,A];async function G(e,t){let a=await S("navigation_tool_prompt"),{mapView:r}=x(t),c=r.map.bookmarks?.map(h=>h.name).filter(Boolean)??[],s=e.vectorSearchLayerResults?.length>0?e.vectorSearchLayerResults.map((h,z)=>`${z+1}. layerId=${h.id} | title=${h.title??""} | name=${h.name??""} | score=${h.score.toFixed(2)}`).join(`
2
+ import b from"./PNFBQ6JV.js";import a from"./5I35MJXT.js";import{a as m}from"./HJG7QM2R.js";import{Va as $,a as k,b as E}from"./TFT6HK3O.js";import{a as f}from"./VXFQANGJ.js";export default $arcgis.t(([,,,,,,{q:N,r:T},{a:b,b:v,c:x,d:C,e:F,f:R,g:L,h:_,i:I,j:M,k:Z,l:A,m:S,n:q,o:p,p:j}])=>{var w=[C,F,R,L,_,I,M,Z,A];async function G(e,t){let a=await S("navigation_tool_prompt"),{mapView:r}=x(t),c=r.map.bookmarks?.map(h=>h.name).filter(Boolean)??[],s=e.vectorSearchLayerResults?.length>0?e.vectorSearchLayerResults.map((h,z)=>`${z+1}. layerId=${h.id} | title=${h.title??""} | name=${h.name??""} | score=${h.score.toFixed(2)}`).join(`
3
3
  `):"",l=e.vectorSearchFieldResults?.length>0?JSON.stringify(e.vectorSearchFieldResults,null,2):"",i=e.intent==="goToBookmark"&&c.length?`Available bookmarks:
4
4
  ${c.map(h=>`- ${h}`).join(`
5
5
  `)}`:"",o=(e.intent==="goToLayer"||e.intent==="goToFeatures")&&e.vectorSearchLayerResults?.length?`Candidate layers:
@@ -1,2 +1,2 @@
1
1
  /* COPYRIGHT Esri - https://js.arcgis.com/5.2/LICENSE.txt */
2
- import c from"./XFL2VQFM.js";import b from"./EIPHHMWX.js";import a from"./JMODFBN6.js";import{c as s,d as n}from"./V6HOUZPZ.js";import"./3UEKINYC.js";import"./RLEHNAIA.js";import{v as r,z as o}from"./NAKAZDJ7.js";import"./R74ZHFA6.js";import"./HJG7QM2R.js";import"./SYEI4BB2.js";import"./ZQ7PGNWB.js";import"./LUY6V4TP.js";import"./VXFQANGJ.js";import"./MWYBF3F3.js";import"./UZLQALHY.js";export default $arcgis.t(([,,,,,,,,,{fetchKnowledgeGraph:p},,,a])=>{var i=class extends r{constructor(){super(...arguments),this.agent=a}static{this.properties={referenceElement:1,serviceUrl:3,context:0}}#e;#i;#t;#r;get serviceUrl(){return this.#i}set serviceUrl(t){this.#i=t}async getContext(){let t=this.context?{...this.context,knowledgeGraph:void 0,view:void 0}:{};if(this.#e)return{...t,view:this.#e};if(this.#t)try{let e=await this.#t;return{...t,knowledgeGraph:e}}catch(e){console.error("Failed to load knowledge graph via service URL:",e)}if(!this.context?.knowledgeGraph&&!this.context?.view)throw new Error("arcgis-assistant-knowledge-agent requires either a knowledgeGraph or view in context, and neither were provided");return this.context}willUpdate(t){t.has("serviceUrl")&&this.serviceUrl?this.#t=p(this.serviceUrl):this.#t=void 0}load(){this.#e=n(this)??void 0,this.#r=s(this)}disconnectedCallback(){this.#r?.unregister(this.agent.id),super.disconnectedCallback()}};o("arcgis-assistant-knowledge-agent",i);return i},"identity/IdentityManager","portal/Portal","config","core/reactiveUtils","layers/FeatureLayer","request","intl","smartMapping/statistics/summaryStatistics","smartMapping/statistics/uniqueValues","rest/knowledgeGraphService",a,b,c)
2
+ import c from"./JSIGEUX7.js";import b from"./PNFBQ6JV.js";import a from"./5I35MJXT.js";import{c as s,d as n}from"./V6HOUZPZ.js";import"./3UEKINYC.js";import"./RLEHNAIA.js";import{v as r,z as o}from"./NAKAZDJ7.js";import"./R74ZHFA6.js";import"./HJG7QM2R.js";import"./ICYUPLZM.js";import"./TFT6HK3O.js";import"./LUY6V4TP.js";import"./VXFQANGJ.js";import"./MWYBF3F3.js";import"./UZLQALHY.js";export default $arcgis.t(([,,,,,,,,,{fetchKnowledgeGraph:p},,,a])=>{var i=class extends r{constructor(){super(...arguments),this.agent=a}static{this.properties={referenceElement:1,serviceUrl:3,context:0}}#e;#i;#t;#r;get serviceUrl(){return this.#i}set serviceUrl(t){this.#i=t}async getContext(){let t=this.context?{...this.context,knowledgeGraph:void 0,view:void 0}:{};if(this.#e)return{...t,view:this.#e};if(this.#t)try{let e=await this.#t;return{...t,knowledgeGraph:e}}catch(e){console.error("Failed to load knowledge graph via service URL:",e)}if(!this.context?.knowledgeGraph&&!this.context?.view)throw new Error("arcgis-assistant-knowledge-agent requires either a knowledgeGraph or view in context, and neither were provided");return this.context}willUpdate(t){t.has("serviceUrl")&&this.serviceUrl?this.#t=p(this.serviceUrl):this.#t=void 0}load(){this.#e=n(this)??void 0,this.#r=s(this)}disconnectedCallback(){this.#r?.unregister(this.agent.id),super.disconnectedCallback()}};o("arcgis-assistant-knowledge-agent",i);return i},"identity/IdentityManager","portal/Portal","config","core/reactiveUtils","layers/FeatureLayer","request","intl","smartMapping/statistics/summaryStatistics","smartMapping/statistics/uniqueValues","rest/knowledgeGraphService",a,b,c)
@@ -1,2 +1,2 @@
1
1
  /* COPYRIGHT Esri - https://js.arcgis.com/5.2/LICENSE.txt */
2
- import{a as c}from"./SBP6WNDY.js";export default $arcgis.t(([l,{property:i,subclass:y},{watch:d}])=>{var w=Object.defineProperty,g=Object.getOwnPropertyDescriptor,t=(s,a,p,o)=>{for(var r=o>1?void 0:o?g(a,p):a,h=s.length-1,n;h>=0;h--)(n=s[h])&&(r=(o?n(a,p,r):n(r))||r);return o&&r&&w(a,p,r),r},m=()=>{throw new Error("createGraph method not implemented.")},e=class extends l{constructor(){super(...arguments),this.description="",this.middlewares=[],this.createGraph=m,this.workspace=c()}initialize(){this.addHandles([d(()=>[this.name,this.description],()=>this.generate(),{initial:!0,sync:!0}),d(()=>this.createGraph,()=>this._compiledGraph=void 0)])}get id(){return this.name.replace(/\s+/gu,"-").toLowerCase()}get registration(){return{id:this.id,name:this.name,description:this.description,createGraph:this.createGraph,workspace:this.workspace}}async run(s={},a){return this.createGraph===m&&this.generate(),this._compiledGraph=this._compiledGraph??this.createGraph().compile(),await this._compiledGraph.invoke(s,a)}};t([i({readOnly:!0})],e.prototype,"id",1);t([i()],e.prototype,"name",2);t([i()],e.prototype,"description",2);t([i()],e.prototype,"middlewares",2);t([i({readOnly:!0})],e.prototype,"createGraph",2);t([i({readOnly:!0})],e.prototype,"workspace",2);t([i({readOnly:!0})],e.prototype,"registration",1);e=t([y("BaseAgent")],e);return e},"core/Accessor","core/accessorSupport/decorators","core/reactiveUtils")
2
+ import{a as c}from"./57OMVTIU.js";export default $arcgis.t(([l,{property:i,subclass:y},{watch:d}])=>{var w=Object.defineProperty,g=Object.getOwnPropertyDescriptor,t=(s,a,p,o)=>{for(var r=o>1?void 0:o?g(a,p):a,h=s.length-1,n;h>=0;h--)(n=s[h])&&(r=(o?n(a,p,r):n(r))||r);return o&&r&&w(a,p,r),r},m=()=>{throw new Error("createGraph method not implemented.")},e=class extends l{constructor(){super(...arguments),this.description="",this.middlewares=[],this.createGraph=m,this.workspace=c()}initialize(){this.addHandles([d(()=>[this.name,this.description],()=>this.generate(),{initial:!0,sync:!0}),d(()=>this.createGraph,()=>this._compiledGraph=void 0)])}get id(){return this.name.replace(/\s+/gu,"-").toLowerCase()}get registration(){return{id:this.id,name:this.name,description:this.description,createGraph:this.createGraph,workspace:this.workspace}}async run(s={},a){return this.createGraph===m&&this.generate(),this._compiledGraph=this._compiledGraph??this.createGraph().compile(),await this._compiledGraph.invoke(s,a)}};t([i({readOnly:!0})],e.prototype,"id",1);t([i()],e.prototype,"name",2);t([i()],e.prototype,"description",2);t([i()],e.prototype,"middlewares",2);t([i({readOnly:!0})],e.prototype,"createGraph",2);t([i({readOnly:!0})],e.prototype,"workspace",2);t([i({readOnly:!0})],e.prototype,"registration",1);e=t([y("BaseAgent")],e);return e},"core/Accessor","core/accessorSupport/decorators","core/reactiveUtils")
@@ -1,2 +1,2 @@
1
1
  /* COPYRIGHT Esri - https://js.arcgis.com/5.2/LICENSE.txt */
2
- import{$ as K,$a as Ha,A as z,Aa as ja,B as A,Ba as ka,C as B,D as C,Da as la,E as D,Ea as ma,F as E,Fa as na,G as F,Ga as oa,H as G,Ha as pa,I as H,Ia as qa,Ja as ra,Ka as sa,La as ta,Ma as ua,Na as va,Oa as wa,Pa as xa,Qa as ya,Ra as za,S as I,Sa as Aa,Va as Ba,Wa as Ca,Xa as Da,Ya as Ea,Za as Fa,_ as J,_a as Ga,a,aa as L,ab as Ia,b,ba as M,bb as Ja,c,ca as N,cb as Ka,d,da as O,db as La,e,ea as P,f,fa as Q,ga as R,h as g,ha as S,i as h,ia as T,j as i,ja as U,k as j,ka as V,l as k,la as W,m as l,ma as X,n as m,na as Y,o as n,oa as Z,p as o,pa as _,q as p,qa as $,r as q,ra as aa,s as r,sa as ba,t as s,ta as ca,u as t,ua as da,v as u,va as ea,w as v,wa as fa,x as w,xa as ga,y as x,ya as ha,z as y,za as ia}from"./ZQ7PGNWB.js";import"./LUY6V4TP.js";import"./MWYBF3F3.js";import"./UZLQALHY.js";export{S as Annotation,O as AsyncBatchedStore,Q as BaseChannel,L as BaseCheckpointSaver,k as BaseLangGraphError,N as BaseStore,R as BinaryOperatorAggregate,d as COMMAND_SYMBOL,I as ChatModelStreamImpl,i as Command,e as CommandInstance,Ca as CompiledStateGraph,qa as DeltaChannel,ua as DeltaValue,b as END,B as EmptyChannelError,A as EmptyInputError,$ as EventLog,la as Graph,l as GraphBubbleUp,o as GraphDrained,q as GraphInterrupt,m as GraphRecursionError,ha as GraphRunStream,n as GraphValueError,c as INTERRUPT,P as InMemoryStore,C as InvalidUpdateError,M as MemorySaver,Da as MessageGraph,Ia as MessagesAnnotation,Aa as MessagesDeltaValue,za as MessagesValue,Ja as MessagesZodMeta,Ka as MessagesZodState,D as MultipleSubgraphsError,s as NodeError,r as NodeInterrupt,y as NodeTimeoutError,g as Overwrite,u as ParentCommand,wa as REMOVE_ALL_MESSAGES,sa as ReducedValue,F as RemoteException,X as RunControl,a as START,Y as STREAM_EVENTS_V3_MODES,f as Send,Ba as StateGraph,G as StateGraphInputError,va as StateSchema,$ as StreamChannel,ia as SubgraphRunStream,E as UnreachableNodeError,ta as UntrackedValue,ra as UntrackedValueChannel,xa as addMessages,_ as convertToProtocolEvent,K as copyCheckpoint,ja as createGraphRunStream,ba as createLifecycleTransformer,ca as createMessagesTransformer,ea as createSubgraphDiscoveryTransformer,fa as createValuesTransformer,J as emptyCheckpoint,Ga as entrypoint,aa as filterLifecycleEntries,da as filterSubgraphHandles,V as getConfig,W as getCurrentTaskInput,oa as getJsonSchemaFromSchema,Ha as getPreviousState,pa as getSchemaDefaultGetter,T as getStore,H as getSubgraphsSeenSet,U as getWriter,ka as interrupt,Z as isCheckpointEnvelope,j as isCommand,w as isGraphBubbleUp,p as isGraphDrained,x as isGraphInterrupt,h as isInterrupted,ga as isNativeTransformer,t as isNodeError,z as isNodeTimeoutError,v as isParentCommand,na as isSerializableSchema,ma as isStandardSchema,ya as messagesDeltaReducer,xa as messagesStateReducer,Ea as pushMessage,Fa as task,La as writer};
2
+ import{$ as K,$a as Ha,A as z,Aa as ja,B as A,Ba as ka,C as B,D as C,Da as la,E as D,Ea as ma,F as E,Fa as na,G as F,Ga as oa,H as G,Ha as pa,I as H,Ia as qa,Ja as ra,Ka as sa,La as ta,Ma as ua,Na as va,Oa as wa,Pa as xa,Qa as ya,Ra as za,S as I,Sa as Aa,Va as Ba,Wa as Ca,Xa as Da,Ya as Ea,Za as Fa,_ as J,_a as Ga,a,aa as L,ab as Ia,b,ba as M,bb as Ja,c,ca as N,cb as Ka,d,da as O,db as La,e,ea as P,f,fa as Q,ga as R,h as g,ha as S,i as h,ia as T,j as i,ja as U,k as j,ka as V,l as k,la as W,m as l,ma as X,n as m,na as Y,o as n,oa as Z,p as o,pa as _,q as p,qa as $,r as q,ra as aa,s as r,sa as ba,t as s,ta as ca,u as t,ua as da,v as u,va as ea,w as v,wa as fa,x as w,xa as ga,y as x,ya as ha,z as y,za as ia}from"./TFT6HK3O.js";import"./LUY6V4TP.js";import"./MWYBF3F3.js";import"./UZLQALHY.js";export{S as Annotation,O as AsyncBatchedStore,Q as BaseChannel,L as BaseCheckpointSaver,k as BaseLangGraphError,N as BaseStore,R as BinaryOperatorAggregate,d as COMMAND_SYMBOL,I as ChatModelStreamImpl,i as Command,e as CommandInstance,Ca as CompiledStateGraph,qa as DeltaChannel,ua as DeltaValue,b as END,B as EmptyChannelError,A as EmptyInputError,$ as EventLog,la as Graph,l as GraphBubbleUp,o as GraphDrained,q as GraphInterrupt,m as GraphRecursionError,ha as GraphRunStream,n as GraphValueError,c as INTERRUPT,P as InMemoryStore,C as InvalidUpdateError,M as MemorySaver,Da as MessageGraph,Ia as MessagesAnnotation,Aa as MessagesDeltaValue,za as MessagesValue,Ja as MessagesZodMeta,Ka as MessagesZodState,D as MultipleSubgraphsError,s as NodeError,r as NodeInterrupt,y as NodeTimeoutError,g as Overwrite,u as ParentCommand,wa as REMOVE_ALL_MESSAGES,sa as ReducedValue,F as RemoteException,X as RunControl,a as START,Y as STREAM_EVENTS_V3_MODES,f as Send,Ba as StateGraph,G as StateGraphInputError,va as StateSchema,$ as StreamChannel,ia as SubgraphRunStream,E as UnreachableNodeError,ta as UntrackedValue,ra as UntrackedValueChannel,xa as addMessages,_ as convertToProtocolEvent,K as copyCheckpoint,ja as createGraphRunStream,ba as createLifecycleTransformer,ca as createMessagesTransformer,ea as createSubgraphDiscoveryTransformer,fa as createValuesTransformer,J as emptyCheckpoint,Ga as entrypoint,aa as filterLifecycleEntries,da as filterSubgraphHandles,V as getConfig,W as getCurrentTaskInput,oa as getJsonSchemaFromSchema,Ha as getPreviousState,pa as getSchemaDefaultGetter,T as getStore,H as getSubgraphsSeenSet,U as getWriter,ka as interrupt,Z as isCheckpointEnvelope,j as isCommand,w as isGraphBubbleUp,p as isGraphDrained,x as isGraphInterrupt,h as isInterrupted,ga as isNativeTransformer,t as isNodeError,z as isNodeTimeoutError,v as isParentCommand,na as isSerializableSchema,ma as isStandardSchema,ya as messagesDeltaReducer,xa as messagesStateReducer,Ea as pushMessage,Fa as task,La as writer};
@@ -1,5 +1,5 @@
1
1
  /* COPYRIGHT Esri - https://js.arcgis.com/5.2/LICENSE.txt */
2
- import{J as qe,Ka as te,La as nt,Na as W,Oa as Et,Ra as Ie,S as xt,Ta as ge,U as tt,Ua as Oe,Va as At,Z as St,a as ut,b as A,f as $,j as L,k as H,qa as Ae,ta as kt,x as mt,y as ft}from"./ZQ7PGNWB.js";import{$a as gt,$b as he,Ab as bt,I as Ge,Ib as F,Jb as le,Lb as vt,Ob as Se,Qb as Ct,Tb as a,U as T,Ua as Ke,Vb as Qe,Xa as z,Xb as ke,Ya as ie,Z as pt,_a as Ye,ac as K,bb as Xe,c as Je,ca as M,db as wt,dc as ce,fa as Ve,fc as Ee,oa as Q,ob as pe,pb as _e,sa as Ze,sb as xe,sc as et,ta as U,uc as _t,wb as Mt,yb as Tt,yc as ot,za as ht,zb as ee}from"./LUY6V4TP.js";import{Dd as B,s as yt}from"./MWYBF3F3.js";var rt=Symbol.for("AgentMiddleware");function O(e){return{[rt]:!0,name:e.name,stateSchema:e.stateSchema,contextSchema:e.contextSchema,wrapToolCall:e.wrapToolCall,wrapModelCall:e.wrapModelCall,beforeAgent:e.beforeAgent,beforeModel:e.beforeModel,afterModel:e.afterModel,afterAgent:e.afterAgent,tools:e.tools,streamTransformers:e.streamTransformers}}var Re=class extends Error{constructor(){super("The provided LLM already has bound tools. Please provide an LLM without bound tools to createAgent. The agent will bind the tools provided in the 'tools' parameter.")}},Pe=class extends Error{toolNames;constructor(e){super(`The model has called multiple tools: ${e.join(", ")} to return a structured output. This is not supported. Please provide a single structured output.`),this.toolNames=e}},we=class extends Error{toolName;errors;constructor(e,t){super(`Failed to parse structured output for tool '${e}':${t.map(o=>`
2
+ import{J as qe,Ka as te,La as nt,Na as W,Oa as Et,Ra as Ie,S as xt,Ta as ge,U as tt,Ua as Oe,Va as At,Z as St,a as ut,b as A,f as $,j as L,k as H,qa as Ae,ta as kt,x as mt,y as ft}from"./TFT6HK3O.js";import{$a as gt,$b as he,Ab as bt,I as Ge,Ib as F,Jb as le,Lb as vt,Ob as Se,Qb as Ct,Tb as a,U as T,Ua as Ke,Vb as Qe,Xa as z,Xb as ke,Ya as ie,Z as pt,_a as Ye,ac as K,bb as Xe,c as Je,ca as M,db as wt,dc as ce,fa as Ve,fc as Ee,oa as Q,ob as pe,pb as _e,sa as Ze,sb as xe,sc as et,ta as U,uc as _t,wb as Mt,yb as Tt,yc as ot,za as ht,zb as ee}from"./LUY6V4TP.js";import{Dd as B,s as yt}from"./MWYBF3F3.js";var rt=Symbol.for("AgentMiddleware");function O(e){return{[rt]:!0,name:e.name,stateSchema:e.stateSchema,contextSchema:e.contextSchema,wrapToolCall:e.wrapToolCall,wrapModelCall:e.wrapModelCall,beforeAgent:e.beforeAgent,beforeModel:e.beforeModel,afterModel:e.afterModel,afterAgent:e.afterAgent,tools:e.tools,streamTransformers:e.streamTransformers}}var Re=class extends Error{constructor(){super("The provided LLM already has bound tools. Please provide an LLM without bound tools to createAgent. The agent will bind the tools provided in the 'tools' parameter.")}},Pe=class extends Error{toolNames;constructor(e){super(`The model has called multiple tools: ${e.join(", ")} to return a structured output. This is not supported. Please provide a single structured output.`),this.toolNames=e}},we=class extends Error{toolName;errors;constructor(e,t){super(`Failed to parse structured output for tool '${e}':${t.map(o=>`
3
3
  - ${o}`).join("")}.`),this.toolName=e,this.errors=t}},je=class extends Error{toolCall;toolError;constructor(e,t){let o=e instanceof Error?e:new Error(String(e)),n=JSON.stringify(t.args);super(`Error invoking tool '${t.name}' with kwargs ${n} with error: ${o.stack}
4
4
  Please fix the error and try again.`),this.toolCall=t,this.toolError=o}},ye=class It extends Error{static"~brand"="MiddlewareError";constructor(t,o){let n=t instanceof Error?t.message:String(t);super(n),this.name=t instanceof Error?t.name:`${o[0].toUpperCase()+o.slice(1)}Error`,t instanceof Error&&(this.cause=t)}static wrap(t,o){return mt(t)?t:new It(t,o)}static isInstance(t){return t instanceof Error&&"~brand"in t&&t["~brand"]==="MiddlewareError"}};function Me(e){return"invoke"in e&&typeof e.invoke=="function"&&"_streamResponseChunks"in e}function de(e){return typeof e=="object"&&e!=null&&"_queuedMethodOperations"in e&&"_getModelInstance"in e&&typeof e._getModelInstance=="function"}var Ot=!0,ho=0,G=class st{constructor(t,o,n){this.schema=t,this.tool=o,this.options=n}get name(){return this.tool.function.name}static fromSchema(t,o){function n(s){return s??`extract-${++ho}`}if(pe(t)||xe(t)){let s=ke(t);return new st(s,{type:"function",function:{name:n(s.title),strict:!1,description:s.description??"Tool for extracting structured output from the model's response.",parameters:s}},o)}let r;return typeof t.name=="string"&&typeof t.parameters=="object"&&t.parameters!=null?r=t:r={name:n(t.title),description:t.description??"",parameters:t.schema||t},new st(ke(t),{type:"function",function:r},o)}parse(t){let o=new Qe(this.schema).validate(t);if(!o.valid)throw new we(this.name,o.errors.map(n=>n.error));return t}},oe=class Rt{_schemaType;schema;strict;constructor(t,o){if("schema"in t&&typeof t.schema=="object"&&t.schema!==null&&!("type"in t)){let n=t;this.schema=n.schema,this.strict=n.strict??Ot}else this.schema=t,this.strict=o??Ot}static fromSchema(t,o){return new Rt(ke(t),o)}parse(t){let o;if(typeof t.content=="string")o=t.content;else if(Array.isArray(t.content)){for(let n of t.content)if(typeof n=="object"&&n!==null&&"type"in n&&n.type==="text"&&"text"in n&&typeof n.text=="string"){o=n.text;break}}if(!(!o||o===""))try{let n=JSON.parse(o);return new Qe(this.schema).validate(n).valid?n:void 0}catch{}}};function Pt(e,t,o){if(!e)return[];if(typeof e=="object"&&e!==null&&"__responseFormatUndefined"in e)return[];if(Array.isArray(e)){if(e.every(r=>r instanceof G||r instanceof oe))return e;if(e.every(r=>pe(r)))return e.map(r=>G.fromSchema(r,t));if(e.every(r=>F(r)))return e.map(r=>G.fromSchema(r,t));if(e.every(r=>typeof r=="object"&&r!==null&&!F(r)&&!pe(r)))return e.map(r=>G.fromSchema(r,t));throw new Error(`Invalid response format: list contains mixed types.
5
5
  All items must be either InteropZodObject, Standard Schema, or plain JSON schema objects.`)}if(e instanceof G||e instanceof oe)return[e];let n=go(o);if(pe(e))return n?[oe.fromSchema(e)]:[G.fromSchema(e,t)];if(F(e))return n?[oe.fromSchema(e)]:[G.fromSchema(e,t)];if(typeof e=="object"&&e!==null&&"properties"in e)return n?[oe.fromSchema(e)]:[G.fromSchema(e,t)];throw new Error(`Invalid response format: ${String(e)}`)}function go(e){return!e||!Me(e)||!("profile"in e)||typeof e.profile!="object"||!e.profile?!1:"structuredOutput"in e.profile&&e.profile.structuredOutput===!0}function wo(e,t){if(e.length<t.length||e.length>t.length+1)return!1;for(let o=0;o<t.length;o+=1)if(e[o]!==t[o])return!1;return!0}function yo(e){let t;try{t=JSON.parse(e)}catch{return!1}return!Array.isArray(t)||t.length===0?!1:t.every(o=>{if(o==null||typeof o!="object")return!1;let n=o;return typeof n.id=="string"&&"value"in n})}function Mo(e){if(e==null||typeof e!="object")return!1;let t=e;return t.type!=="constructor"||!Array.isArray(t.id)?!1:t.id[t.id.length-1]==="ToolMessage"}function To(e){return T.isInstance(e)?e.content:Mo(e)?e.kwargs?.content:e}function Te(e){return()=>{let t=Ae.local(),o=new Map;function n(r,s,i){if(o.has(r))return;let l=typeof i=="string"?JSON.parse(i):i,m,c,u,g,d=new Promise((x,y)=>{m=x,c=y}),f=new Promise(x=>{u=x}),h=new Promise(x=>{g=x});o.set(r,{resolveOutput:m,rejectOutput:c,resolveStatus:u,resolveError:g}),t.push({name:s,callId:r,input:l,output:d,status:f,error:h})}return{__native:!0,init:()=>({toolCalls:t}),process(r){if(!wo(r.params.namespace,e))return!0;if(r.method==="messages"){let s=r.params.data;if(s.event==="content-block-finish"){let i=s.contentBlock??s.content_block;i?.type==="tool_call"&&n(String(i.id??""),String(i.name??""),i.args??i.input)}}if(r.method==="tools"){let s=r.params.data,i=s.tool_call_id;s.event==="tool-started"&&n(i,s.tool_name??"unknown",s.input);let l=i?o.get(i):void 0;if(l){if(s.event==="tool-finished")l.resolveOutput(To(s.output)),l.resolveStatus("finished"),l.resolveError(void 0),o.delete(i);else if(s.event==="tool-error"){let m=s.message??"unknown error";if(yo(m))return!0;l.rejectOutput(new Error(m)),l.resolveStatus("error"),l.resolveError(m),o.delete(i)}}}return!0},finalize(){for(let r of o.values())r.resolveStatus("finished"),r.resolveError(void 0),r.resolveOutput(void 0);o.clear(),t.close()},fail(r){for(let s of o.values())s.resolveStatus("error"),s.resolveError(r instanceof Error?r.message:String(r)),s.rejectOutput(r);o.clear(),t.fail(r)}}}}function Y(e){return typeof e=="object"&&e!==null&&!Array.isArray(e)}function be(e){return e.join("\0")}function jt(e,t){if(t.length>e.length)return!1;for(let o=0;o<t.length;o+=1)if(e[o]!==t[o])return!1;return!0}function Ne(e=[]){return()=>{let t=Ae.local(),o=new Map,n=new Map,r=new Map,s=new Map,i=e.length;function l(d,f){let h=be(d);if(o.has(h))return;let x=(Y(f)&&Y(f.metadata)?f.metadata:void 0)?.lc_agent_name;o.set(h,typeof x=="string"?x:void 0)}function m(d){if(!Y(d))return;let f=d.id;if(typeof f!="string")return;let h=d.input,x;if(Y(h)&&Y(h.tool_call)){let y=h.tool_call.id;typeof y=="string"&&(x=y)}else if(Array.isArray(h)){for(let y of h)if(Y(y)&&typeof y.id=="string"){x=y.id;break}}x!=null&&n.set(f,x)}function c(d){let f=r.get(be(d));if(typeof f=="string"&&f.length>0)return{type:"toolCall",tool_call_id:f};let h=d[d.length-1],x=h.indexOf(":");if(x===-1)return;let y=h.slice(x+1);if(y.length===0)return;let w=n.get(y);if(!(typeof w!="string"||w.length===0))return{type:"toolCall",tool_call_id:w}}function u(d){if(d.length!==i+1||!jt(d,e))return;let f=be(d);if(s.has(f))return;let h=o.get(f);if(typeof h!="string"||h.length===0)return;let x=kt(d),y=x.init(),w=Te(d)(),P=w.init(),I=Ne(d)(),j=I.init(),Z,N,b=new Promise((J,ae)=>{Z=J,N=ae});s.set(f,{key:f,path:d,name:h,messages:x,toolCall:w,nested:I,resolveOutput:Z,rejectOutput:N,latestValues:void 0,done:!1}),t.push({name:h,cause:c(d),output:b,messages:y.messages,toolCalls:P.toolCalls,subagents:j.subagents})}function g(d,f){d.done||(d.done=!0,f.type==="resolve"?d.resolveOutput(d.latestValues):d.rejectOutput(f.error),d.messages.finalize?.(),d.toolCall.finalize?.(),d.nested.finalize?.())}return{__native:!0,init:()=>({subagents:t}),process(d){let f=d.params.namespace,h=d.params.data,x=d.method==="tasks"&&Y(h)&&"result"in h;d.method==="tools"&&Y(h)&&h.event==="tool-started"&&typeof h.tool_call_id=="string"&&h.tool_call_id.length>0&&r.set(be(f),h.tool_call_id),d.method==="tasks"&&!x&&(l(f,h),m(h),u(f));for(let y of s.values())if(!y.done&&jt(f,y.path)&&(y.messages.process(d),y.toolCall.process(d),y.nested.process(d),be(f)===y.key)){if(d.method==="values"&&Y(h))y.latestValues=h;else if(d.method==="lifecycle"&&Y(h)){let w=h.event;w==="completed"||w==="interrupted"?g(y,{type:"resolve"}):w==="failed"&&g(y,{type:"reject",error:new Error(`Subagent ${y.name} failed`)})}}return!0},finalize(){for(let d of s.values())g(d,{type:"resolve"});t.close()},fail(d){for(let f of s.values())g(f,{type:"reject",error:d});t.fail(d)}}}}var at=Symbol.for("langgraph-zod");at in globalThis||(globalThis[at]=new WeakSet);function Nt(e){let t=globalThis[at];t.has(e)||(Object.defineProperty(e,"langgraph",{get(){let o=this;return{metadata(n){return Oe(o,{jsonSchemaExtra:n})},reducer(n,r){return Oe(o,{default:Se(o),reducer:{schema:r,fn:n}})}}}}),t.add(e))}try{Nt(a.ZodType.prototype),Nt(B.ZodType.prototype)}catch(e){throw new Error("Failed to extend Zod with LangGraph-related methods. This is most likely a bug, consider opening an issue and/or using `withLangGraph` to augment your Zod schema.",{cause:e})}var Lt=class extends yt{constructor(e){super(),this.parent=e,this._map=this.parent._map}add(e,...t){let o=t[0];if(o&&!o?.default){let n=Se(e);n!=null&&(o.default=n)}return super.add(e,...t)}},bo=new Lt(ge);function Dt(e=!0,t,o=[]){let n={jumpTo:new nt},r={},s={},i=l=>{if(W.isInstance(l)){for(let[c,u]of Object.entries(l.fields))if(!(c in n)){if(n[c]=u,c.startsWith("_"))continue;te.isInstance(u)?(r[c]=u.inputSchema||u.valueSchema,s[c]=u.valueSchema):(r[c]=u,s[c]=u)}return}let m=le(l);for(let[c,u]of Object.entries(m)){let g=c.startsWith("_");if(!(c in n)){if(_e(u)){let d=ge.get(u);if(d?.reducer){d.reducer.schema?(n[c]=new te(u,{inputSchema:d.reducer.schema,reducer:d.reducer.fn}),g||(r[c]=d.reducer.schema,s[c]=u)):(n[c]=new te(u,{reducer:d.reducer.fn}),g||(r[c]=u,s[c]=u));continue}}n[c]=u,g||(r[c]=u,s[c]=u)}}};t&&(W.isInstance(t)||F(t))&&i(t);for(let l of o)l.stateSchema&&(W.isInstance(l.stateSchema)||F(l.stateSchema))&&i(l.stateSchema);return e&&(s.structuredResponse=new nt),{state:new W({messages:Ie,...n}),input:new W({messages:Ie,...r}),output:new W({messages:Ie,...s})}}var it=/<name>(.*?)<\/name>/s,lt=/<content>(.*?)<\/content>/s;function vo(e,t){if(W.isInstance(e)){let o={};for(let n of Object.keys(e.fields))n in t&&(o[n]=t[n]);return o}if(xe(e))return ee(e,t);throw new Error(`Invalid state schema type: ${typeof e}`)}function Bt(e){if(!M.isInstance(e)||Ve.isInstance(e)||!e.name)return e;let{name:t}=e;if(typeof e.content=="string")return new M({...e.lc_kwargs,content:`<name>${t}</name><content>${e.content}</content>`,name:void 0});let o=[],n=0;for(let r of e.content)typeof r=="string"?(n+=1,o.push(`<name>${t}</name><content>${r}</content>`)):typeof r=="object"&&"type"in r&&r.type==="text"?(n+=1,o.push({...r,text:`<name>${t}</name><content>${r.text}</content>`})):o.push(r);return n||o.unshift({type:"text",text:`<name>${t}</name><content></content>`}),new M({...e.lc_kwargs,content:o,name:void 0})}function Ut(e){if(!M.isInstance(e)||!e.content)return e;let t=[],o;if(Array.isArray(e.content))t=e.content.filter(n=>{if(n.type==="text"&&typeof n.text=="string"){let r=n.text.match(it),s=n.text.match(lt);return r&&(!s||s[1]==="")?(o=r[1],!1):!0}return!0}).map(n=>{if(n.type==="text"&&typeof n.text=="string"){let r=n.text.match(it),s=n.text.match(lt);return!r||!s?n:(o=r[1],{...n,text:s[1]})}return n});else{let n=e.content,r=n.match(it),s=n.match(lt);if(!r||!s)return e;o=r[1],t=s[1]}return new M({...Object.keys(e.lc_kwargs??{}).length>0?e.lc_kwargs:e,content:t,name:o})}function se(e){return he.isRunnable(e)}function $t(e){return Me(e)?"bindTools"in e&&typeof e.bindTools=="function":!1}var ct=(e,t,o={})=>{if($t(e))return e.bindTools(t,o);if(K.isRunnableBinding(e)&&$t(e.bound)){let n=e.bound.bindTools(t,o);return K.isRunnableBinding(n)?new K({bound:n.bound,config:{...e.config,...n.config},kwargs:{...e.kwargs,...n.kwargs},configFactories:n.configFactories??e.configFactories}):new K({bound:n,config:e.config,kwargs:e.kwargs,configFactories:e.configFactories})}return null};function Le(e){if(typeof e=="function")return;let t=e;if(ce.isRunnableSequence(t)&&(t=t.steps.find(o=>K.isRunnableBinding(o))||t),!de(t)){if(K.isRunnableBinding(t)){let o=t.kwargs!=null&&typeof t.kwargs=="object"&&"tools"in t.kwargs&&Array.isArray(t.kwargs.tools)&&t.kwargs.tools.length>0,n=t.config!=null&&typeof t.config=="object"&&"tools"in t.config&&Array.isArray(t.config.tools)&&t.config.tools.length>0;if(o||n)throw new Re}if("tools"in t&&t.tools!==void 0&&Array.isArray(t.tools)&&t.tools.length>0)throw new Re}}function ue(e){return!!(M.isInstance(e)&&e.tool_calls&&e.tool_calls.length>0)}function zt(e){if(e==null)return new U("");if(U.isInstance(e))return e;if(typeof e=="string")return new U({content:[{type:"text",text:e}]});throw new Error(`Invalid systemPrompt type: expected string or SystemMessage, got ${typeof e}`)}async function Ft(e,t,o={}){let n=ct(e,t,o);if(n)return n;if(de(e)){let r=ct(await e._getModelInstance(),t,o);if(r)return r}if(ce.isRunnableSequence(e)){let r=e.steps.findIndex(s=>K.isRunnableBinding(s)||Me(s)||de(s));if(r>=0){let s=ct(e.steps[r],t,o);if(s){let i=e.steps.slice();return i.splice(r,1,s),ce.from(i)}}}throw new Error(`llm ${e} must define bindTools method.`)}function Co(e){if(e.length===0)return;if(e.length===1)return e[0];function t(n,r){return async(s,i)=>n(s,async m=>r(m,i))}let o=e[e.length-1];for(let n=e.length-2;n>=0;n--)o=t(e[n],o);return o}function Wt(e){let t=e.filter(o=>o.wrapToolCall);if(t.length!==0)return Co(t.map(o=>{let n=o.wrapToolCall;return async(s,i)=>{let l=s.state,m=async c=>{let u={...l,...c.state};return i({...c,state:u})};try{let c=await n({...s,state:{messages:l.messages,...o.stateSchema?vo(o.stateSchema,{...l}):{}}},m);if(!T.isInstance(c)&&!H(c))throw new Error(`Invalid response from "wrapToolCall" in middleware "${o.name}": expected ToolMessage or Command, got ${typeof c}`);return c}catch(c){throw ye.wrap(c,o.name)}}}))}var _o=["tags","metadata","runName","maxConcurrency","recursionLimit","configurable"];function Ht(e){let t={};for(let o of _o){let n=e[o];n!==void 0&&(t[o]=n)}return t}async function Jt(e,t){let o={};for(let n of e){if(!n.stateSchema)continue;let r;if(W.isInstance(n.stateSchema)){let l={};for(let[m,c]of Object.entries(n.stateSchema.fields))te.isInstance(c)?l[m]=c.inputSchema||c.valueSchema:l[m]=c;r=B.object(l)}else if(F(n.stateSchema))r=n.stateSchema;else continue;let s=await Mt(Ct(r,l=>l.startsWith("_")),t);if(s.success){Object.assign(o,s.data);continue}let i=s.error.issues.filter(l=>l.code==="invalid_type").map(l=>` - ${l.path.join(".")}: Required`).join(`
@@ -1,2 +1,2 @@
1
1
  /* COPYRIGHT Esri - https://js.arcgis.com/5.2/LICENSE.txt */
2
- import a from"./3OH4DXSY.js";import"./SBP6WNDY.js";import"./ZQ7PGNWB.js";import"./LUY6V4TP.js";import"./MWYBF3F3.js";import"./UZLQALHY.js";export default $arcgis.t(([{property:g,subclass:y},{c:p,d:w}])=>{var b=Object.defineProperty,k=Object.getOwnPropertyDescriptor,v=e=>{throw TypeError(e)},h=(e,t,r,s)=>{for(var n=s>1?void 0:s?k(t,r):t,o=e.length-1,a;o>=0;o--)(a=e[o])&&(n=(s?a(t,r,n):a(n))||n);return s&&n&&b(t,r,n),n},A=(e,t,r)=>t.has(e)||v("Cannot "+r),M=(e,t,r)=>t.has(e)?v("Cannot add the same private member more than once"):t instanceof WeakSet?t.add(e):t.set(e,r),m=(e,t,r)=>(A(e,t,"access private method"),r),c,u,i=class extends w{constructor(e){super(e),M(this,c)}getAgents(){let e=Object.values(this.agentsMap);return this.defaultAgent?e.concat(this.defaultAgent):e}buildNodes(e){let t=super.buildNodes(e);return t[d]=()=>({}),t}buildEdges(e){m(this,c,u).call(this);let t=this.resolver,r=new Map;for(let[o,[a]]of Object.entries(this.agentsMap).entries())r.set(a,p(e[o],o));let{defaultAgent:s}=this,n=s?p(s,e.length-1):void 0;return[{from:d,decide:async(o,a)=>{let l=await Promise.resolve(t(o,a));if(!l)return;let f=r.get(l);if(f)return f;if(s)return n;throw new Error(`SwitchWorkflow resolver returned unknown case: ${l}. Expected one of: ${Object.keys(this.agentsMap).join(", ")||"(none)"}.`)}}]}getEntryNode(){return d}isTerminalAgent(){return!0}validateAgents(e){m(this,c,u).call(this),super.validateAgents(e)}};c=new WeakSet;u=function(){if(!Object.keys(this.agentsMap).length)throw new Error("SwitchWorkflow requires a non-empty agentsMap.")};h([g()],i.prototype,"agentsMap",2);h([g()],i.prototype,"resolver",2);h([g()],i.prototype,"defaultAgent",2);i=h([y("SwitchWorkflow")],i);var d="__switch_decide";return i},"core/accessorSupport/decorators",a)
2
+ import a from"./ZS6SXJP2.js";import"./57OMVTIU.js";import"./TFT6HK3O.js";import"./LUY6V4TP.js";import"./MWYBF3F3.js";import"./UZLQALHY.js";export default $arcgis.t(([{property:g,subclass:y},{c:p,d:w}])=>{var b=Object.defineProperty,k=Object.getOwnPropertyDescriptor,v=e=>{throw TypeError(e)},h=(e,t,r,s)=>{for(var n=s>1?void 0:s?k(t,r):t,o=e.length-1,a;o>=0;o--)(a=e[o])&&(n=(s?a(t,r,n):a(n))||n);return s&&n&&b(t,r,n),n},A=(e,t,r)=>t.has(e)||v("Cannot "+r),M=(e,t,r)=>t.has(e)?v("Cannot add the same private member more than once"):t instanceof WeakSet?t.add(e):t.set(e,r),m=(e,t,r)=>(A(e,t,"access private method"),r),c,u,i=class extends w{constructor(e){super(e),M(this,c)}getAgents(){let e=Object.values(this.agentsMap);return this.defaultAgent?e.concat(this.defaultAgent):e}buildNodes(e){let t=super.buildNodes(e);return t[d]=()=>({}),t}buildEdges(e){m(this,c,u).call(this);let t=this.resolver,r=new Map;for(let[o,[a]]of Object.entries(this.agentsMap).entries())r.set(a,p(e[o],o));let{defaultAgent:s}=this,n=s?p(s,e.length-1):void 0;return[{from:d,decide:async(o,a)=>{let l=await Promise.resolve(t(o,a));if(!l)return;let f=r.get(l);if(f)return f;if(s)return n;throw new Error(`SwitchWorkflow resolver returned unknown case: ${l}. Expected one of: ${Object.keys(this.agentsMap).join(", ")||"(none)"}.`)}}]}getEntryNode(){return d}isTerminalAgent(){return!0}validateAgents(e){m(this,c,u).call(this),super.validateAgents(e)}};c=new WeakSet;u=function(){if(!Object.keys(this.agentsMap).length)throw new Error("SwitchWorkflow requires a non-empty agentsMap.")};h([g()],i.prototype,"agentsMap",2);h([g()],i.prototype,"resolver",2);h([g()],i.prototype,"defaultAgent",2);i=h([y("SwitchWorkflow")],i);var d="__switch_decide";return i},"core/accessorSupport/decorators",a)
@@ -1,5 +1,5 @@
1
1
  /* COPYRIGHT Esri - https://js.arcgis.com/5.2/LICENSE.txt */
2
- import b from"./EIPHHMWX.js";import a from"./JMODFBN6.js";import{a as c,b as k}from"./HJG7QM2R.js";import{Va as x,a as w,b as d,j as f}from"./ZQ7PGNWB.js";import{ca as u}from"./LUY6V4TP.js";export default $arcgis.t(([,,,,,,{p:_,r:b},{K:y,L:K,M:q,N:S,O:M,P:T,Q:E,R:C,S:G,T:N,U:R,a:v,m:m,n:h,p:A}])=>{var z=[T,E,N,C,M,R,G];async function $(e,a){let o=await m("arcgis_knowledge_tool_prompt"),s=K(a),n={assignedTask:e.agentExecutionContext.assignedTask,userRequest:e.agentExecutionContext.userRequest,priorSteps:e.agentExecutionContext.priorSteps,contextType:s},r=await b({promptText:o,messages:e.arcgisKnowledgeMessages,inputVariables:n,tools:z,config:a}),i=(r.tool_calls?.length??0)>0,t=typeof r.text=="string"?r.text.trim():"",l=t.length>0,p=r.content.toString();return!i&&(s==="map"||s==="knowledgeGraph")?{...e,arcgisKnowledgeMessages:[...e.arcgisKnowledgeMessages,r],outputMessage:s==="map"?"No tools were found for the current view and prompt. Maps do not support changing nonspatial visibility, layout changes, or generation from queries.":"No tools were found for the current prompt and knowledge graph service. A knowledge graph service only supports search and query.",status:"success"}:{...e,arcgisKnowledgeMessages:[...e.arcgisKnowledgeMessages,r],outputMessage:i?p:t,status:i?e.status:l?"success":"failed",summary:p?h(p):"ArcGIS Knowledge Agent tool executed."}}var L={generateCypher:"generated-cypher-query",queryGraphData:"graph-query-result",searchGraphData:"graph-search-result",addRecords:"added-records",applyLayout:"applied-layout",changeNonspatialVisibility:"changed-nonspatial-visibility",createLinkChart:"created-link-chart"};function I(e){return!!e&&e.status==="success"&&!!L[e.toolName]}function D(e){return{type:L[e.toolName],data:e.details}}async function F(e,a){let o=new v(z,{handleToolErrors:!1});try{let s=await o.invoke({messages:e.arcgisKnowledgeMessages},a),n=[];for(let t of s.messages){let l;if(typeof t.content!="string")throw new Error(`Unexpected tool message content type: ${typeof t.content}. Expected string.`);try{l=JSON.parse(t.content)}catch{throw new Error(`Failed to parse tool message content as JSON. Tool: ${t.name??"unknown"}.
2
+ import b from"./PNFBQ6JV.js";import a from"./5I35MJXT.js";import{a as c,b as k}from"./HJG7QM2R.js";import{Va as x,a as w,b as d,j as f}from"./TFT6HK3O.js";import{ca as u}from"./LUY6V4TP.js";export default $arcgis.t(([,,,,,,{p:_,r:b},{K:y,L:K,M:q,N:S,O:M,P:T,Q:E,R:C,S:G,T:N,U:R,a:v,m:m,n:h,p:A}])=>{var z=[T,E,N,C,M,R,G];async function $(e,a){let o=await m("arcgis_knowledge_tool_prompt"),s=K(a),n={assignedTask:e.agentExecutionContext.assignedTask,userRequest:e.agentExecutionContext.userRequest,priorSteps:e.agentExecutionContext.priorSteps,contextType:s},r=await b({promptText:o,messages:e.arcgisKnowledgeMessages,inputVariables:n,tools:z,config:a}),i=(r.tool_calls?.length??0)>0,t=typeof r.text=="string"?r.text.trim():"",l=t.length>0,p=r.content.toString();return!i&&(s==="map"||s==="knowledgeGraph")?{...e,arcgisKnowledgeMessages:[...e.arcgisKnowledgeMessages,r],outputMessage:s==="map"?"No tools were found for the current view and prompt. Maps do not support changing nonspatial visibility, layout changes, or generation from queries.":"No tools were found for the current prompt and knowledge graph service. A knowledge graph service only supports search and query.",status:"success"}:{...e,arcgisKnowledgeMessages:[...e.arcgisKnowledgeMessages,r],outputMessage:i?p:t,status:i?e.status:l?"success":"failed",summary:p?h(p):"ArcGIS Knowledge Agent tool executed."}}var L={generateCypher:"generated-cypher-query",queryGraphData:"graph-query-result",searchGraphData:"graph-search-result",addRecords:"added-records",applyLayout:"applied-layout",changeNonspatialVisibility:"changed-nonspatial-visibility",createLinkChart:"created-link-chart"};function I(e){return!!e&&e.status==="success"&&!!L[e.toolName]}function D(e){return{type:L[e.toolName],data:e.details}}async function F(e,a){let o=new v(z,{handleToolErrors:!1});try{let s=await o.invoke({messages:e.arcgisKnowledgeMessages},a),n=[];for(let t of s.messages){let l;if(typeof t.content!="string")throw new Error(`Unexpected tool message content type: ${typeof t.content}. Expected string.`);try{l=JSON.parse(t.content)}catch{throw new Error(`Failed to parse tool message content as JSON. Tool: ${t.name??"unknown"}.
3
3
 
4
4
  Original Content: ${t.content}`)}if(!l||typeof l!="object"||!("toolName"in l))throw new Error(`Parsed tool message content does not have expected structure. Parsed content: ${JSON.stringify(l)}`);n.push(l)}await c({text:`Finished executing ArcGIS Knowledge Agent tools: ${s.messages.filter(t=>t.name).map(t=>t.name).join(", ")}`},a);let r=n.filter(t=>typeof t!="string").map(t=>`- Called Tool: ${t.toolName}, Status: ${t.status}`),i=n[0];return i&&I(i)&&await k(D(i),a),{...e,outputMessage:r.join(`
5
5
  `),summary:r.length?h(r.join(`
@@ -1,2 +1,2 @@
1
1
  /* COPYRIGHT Esri - https://js.arcgis.com/5.2/LICENSE.txt */
2
- import c from"./HBUW4KGU.js";import b from"./EIPHHMWX.js";import a from"./JMODFBN6.js";import{a as s,c as o}from"./V6HOUZPZ.js";import"./3UEKINYC.js";import"./RLEHNAIA.js";import{v as i,z as r}from"./NAKAZDJ7.js";import"./R74ZHFA6.js";import"./HJG7QM2R.js";import"./SYEI4BB2.js";import"./ZQ7PGNWB.js";import"./LUY6V4TP.js";import"./VXFQANGJ.js";import"./MWYBF3F3.js";import"./UZLQALHY.js";export default $arcgis.t(([,,,,,,,,,,,,,a])=>{var t=class extends i{constructor(){super(...arguments),this.agent=a}static{this.properties={referenceElement:1}}#t;#i;getContext(){if(!this.#t)throw new Error("arcgis-assistant-navigation-agent requires a mapView");return{mapView:this.#t}}load(){this.#t=s(this,"arcgis-assistant-navigation-agent"),this.#i=o(this)}disconnectedCallback(){this.#i?.unregister(this.agent.id),super.disconnectedCallback()}};r("arcgis-assistant-navigation-agent",t);return t},"identity/IdentityManager","portal/Portal","config","core/reactiveUtils","layers/FeatureLayer","request","intl","smartMapping/statistics/summaryStatistics","smartMapping/statistics/uniqueValues","views/LinkChartView","rest/knowledgeGraphService",a,b,c)
2
+ import c from"./EW6AYEUX.js";import b from"./PNFBQ6JV.js";import a from"./5I35MJXT.js";import{a as s,c as o}from"./V6HOUZPZ.js";import"./3UEKINYC.js";import"./RLEHNAIA.js";import{v as i,z as r}from"./NAKAZDJ7.js";import"./R74ZHFA6.js";import"./HJG7QM2R.js";import"./ICYUPLZM.js";import"./TFT6HK3O.js";import"./LUY6V4TP.js";import"./VXFQANGJ.js";import"./MWYBF3F3.js";import"./UZLQALHY.js";export default $arcgis.t(([,,,,,,,,,,,,,a])=>{var t=class extends i{constructor(){super(...arguments),this.agent=a}static{this.properties={referenceElement:1}}#t;#i;getContext(){if(!this.#t)throw new Error("arcgis-assistant-navigation-agent requires a mapView");return{mapView:this.#t}}load(){this.#t=s(this,"arcgis-assistant-navigation-agent"),this.#i=o(this)}disconnectedCallback(){this.#i?.unregister(this.agent.id),super.disconnectedCallback()}};r("arcgis-assistant-navigation-agent",t);return t},"identity/IdentityManager","portal/Portal","config","core/reactiveUtils","layers/FeatureLayer","request","intl","smartMapping/statistics/summaryStatistics","smartMapping/statistics/uniqueValues","views/LinkChartView","rest/knowledgeGraphService",a,b,c)
@@ -1,2 +1,2 @@
1
1
  /* COPYRIGHT Esri - https://js.arcgis.com/5.2/LICENSE.txt */
2
- import a from"./3OH4DXSY.js";import"./SBP6WNDY.js";import"./ZQ7PGNWB.js";import"./LUY6V4TP.js";import"./MWYBF3F3.js";import"./UZLQALHY.js";export default $arcgis.t(([{property:d,subclass:f},{a:u,c:i,d:c}])=>{var m=Object.defineProperty,g=Object.getOwnPropertyDescriptor,p=(e,o,r,t)=>{for(var s=t>1?void 0:t?g(o,r):o,a=e.length-1,n;a>=0;a--)(n=e[a])&&(s=(t?n(o,r,s):n(s))||s);return t&&s&&m(o,r,s),s},l=class extends c{constructor(e){super(e)}getAgents(){return this.agents}getEntryNode(e){return e[0]?i(e[0],0):void 0}isTerminalAgent(e,o){return o===e.length-1}validateAgents(e){super.validateAgents(e);let o=new Map;for(let[r,t]of e.entries()){let s=e[r-1];if(t.outputSchema)for(let a of u(t.outputSchema)){let n=o.get(a)??[];n.push(`${t.name} [${r}]`),o.set(a,n)}if(!(r===0||!t.inputSchema||s?.outputSchema))throw new Error(`Workflow agent "${t.name}" declares an input schema, so upstream agent "${s.name}" must declare an output schema.`)}for(let[r,t]of o.entries())t.length>1&&console.warn(`Workflow output field "${r}" is declared by multiple steps (${t.join(", ")}). Later steps will overwrite earlier values in shared state.`)}buildEdges(e){return e.length===1?[{from:i(e[0],0),decide:()=>{}}]:e.slice(0,-1).map((o,r)=>({from:i(o,r),decide:t=>t.status==="failed"?void 0:i(e[r+1],r+1)}))}};p([d()],l.prototype,"agents",2);l=p([f("SequentialWorkflow")],l);return l},"core/accessorSupport/decorators",a)
2
+ import a from"./ZS6SXJP2.js";import"./57OMVTIU.js";import"./TFT6HK3O.js";import"./LUY6V4TP.js";import"./MWYBF3F3.js";import"./UZLQALHY.js";export default $arcgis.t(([{property:d,subclass:f},{a:u,c:i,d:c}])=>{var m=Object.defineProperty,g=Object.getOwnPropertyDescriptor,p=(e,o,r,t)=>{for(var s=t>1?void 0:t?g(o,r):o,a=e.length-1,n;a>=0;a--)(n=e[a])&&(s=(t?n(o,r,s):n(s))||s);return t&&s&&m(o,r,s),s},l=class extends c{constructor(e){super(e)}getAgents(){return this.agents}getEntryNode(e){return e[0]?i(e[0],0):void 0}isTerminalAgent(e,o){return o===e.length-1}validateAgents(e){super.validateAgents(e);let o=new Map;for(let[r,t]of e.entries()){let s=e[r-1];if(t.outputSchema)for(let a of u(t.outputSchema)){let n=o.get(a)??[];n.push(`${t.name} [${r}]`),o.set(a,n)}if(!(r===0||!t.inputSchema||s?.outputSchema))throw new Error(`Workflow agent "${t.name}" declares an input schema, so upstream agent "${s.name}" must declare an output schema.`)}for(let[r,t]of o.entries())t.length>1&&console.warn(`Workflow output field "${r}" is declared by multiple steps (${t.join(", ")}). Later steps will overwrite earlier values in shared state.`)}buildEdges(e){return e.length===1?[{from:i(e[0],0),decide:()=>{}}]:e.slice(0,-1).map((o,r)=>({from:i(o,r),decide:t=>t.status==="failed"?void 0:i(e[r+1],r+1)}))}};p([d()],l.prototype,"agents",2);l=p([f("SequentialWorkflow")],l);return l},"core/accessorSupport/decorators",a)
@@ -1,3 +1,3 @@
1
1
  /* COPYRIGHT Esri - https://js.arcgis.com/5.2/LICENSE.txt */
2
- import{a as E}from"./PBTINZTK.js";import b from"./5SW5CPQT.js";import{a as I}from"./434TAA3J.js";import{a as D}from"./GYVSHAUI.js";import"./F5SUU35Z.js";import a from"./JMODFBN6.js";import{a as R}from"./3UEKINYC.js";import"./RLEHNAIA.js";import{g as $,h as c,k as C,l as P,n as d,t as _,u as y,v as T,x as k,z as A}from"./NAKAZDJ7.js";import"./R74ZHFA6.js";import"./HJG7QM2R.js";import"./SYEI4BB2.js";import"./ZQ7PGNWB.js";import"./LUY6V4TP.js";import"./VXFQANGJ.js";import"./MWYBF3F3.js";import"./UZLQALHY.js";export default $arcgis.t(([N,{whenOnce:U,watch:B,when:V},j,q,,,H,{property:m,subclass:F},,{b:L}])=>{var G=$`:host{display:block;width:var(--arcgis-internal-panel-width, 100%);height:var(--arcgis-internal-expand-max-height, 100%);--calcite-panel-content-bottom-space: 0}.footer-container{display:flex;flex-direction:column;flex:1 1 0;gap:var(--calcite-spacing-md)}.content-container{display:flex;flex-direction:column;flex:1 1 0;min-height:0;position:relative;overflow:auto}.suggested-prompts-container{display:flex;justify-content:center;width:100%;background:var(--calcite-panel-background-color, var(--calcite-color-background))}.suggested-prompts{display:block;padding:var(--calcite-spacing-md);max-width:100%;box-sizing:border-box}.error-notice{padding:var(--calcite-spacing-sm)}.interrupt-waiting-message{font-style:italic;color:var(--calcite-color-text-2)}`;function S(o){return o.trim()?E.lexer(o).filter(t=>t.type!=="space").map(t=>E.parser([t])):[]}var f=class{constructor(){this._stableParts=[],this._stableText="",this._rawText=""}push(t){return this._rawText+=t,this._advanceStableBoundary(),this.getParts()}finalize(){let t=this._rawText.slice(this._stableText.length);return t.trim()&&(this._stableParts.push(...S(t)),this._stableText=this._rawText),this._stableParts}getParts(){let t=this._trimIncompleteTail(this._rawText.slice(this._stableText.length)),s=t.trim()?S(t):[];return[...this._stableParts,...s]}reset(){this._stableParts=[],this._stableText="",this._rawText=""}_advanceStableBoundary(){let t=this._rawText.slice(this._stableText.length),s=this._lastSafeBoundary(t);if(s<=0)return;let i=t.slice(0,s);this._stableParts.push(...S(i)),this._stableText+=i}_lastSafeBoundary(t){let s=t.split(`
2
+ import{a as E}from"./PBTINZTK.js";import b from"./Z6I6JACX.js";import{a as I}from"./434TAA3J.js";import{a as D}from"./GYVSHAUI.js";import"./F5SUU35Z.js";import a from"./5I35MJXT.js";import{a as R}from"./3UEKINYC.js";import"./RLEHNAIA.js";import{g as $,h as c,k as C,l as P,n as d,t as _,u as y,v as T,x as k,z as A}from"./NAKAZDJ7.js";import"./R74ZHFA6.js";import"./HJG7QM2R.js";import"./ICYUPLZM.js";import"./TFT6HK3O.js";import"./LUY6V4TP.js";import"./VXFQANGJ.js";import"./MWYBF3F3.js";import"./UZLQALHY.js";export default $arcgis.t(([N,{whenOnce:U,watch:B,when:V},j,q,,,H,{property:m,subclass:F},,{b:L}])=>{var G=$`:host{display:block;width:var(--arcgis-internal-panel-width, 100%);height:var(--arcgis-internal-expand-max-height, 100%);--calcite-panel-content-bottom-space: 0}.footer-container{display:flex;flex-direction:column;flex:1 1 0;gap:var(--calcite-spacing-md)}.content-container{display:flex;flex-direction:column;flex:1 1 0;min-height:0;position:relative;overflow:auto}.suggested-prompts-container{display:flex;justify-content:center;width:100%;background:var(--calcite-panel-background-color, var(--calcite-color-background))}.suggested-prompts{display:block;padding:var(--calcite-spacing-md);max-width:100%;box-sizing:border-box}.error-notice{padding:var(--calcite-spacing-sm)}.interrupt-waiting-message{font-style:italic;color:var(--calcite-color-text-2)}`;function S(o){return o.trim()?E.lexer(o).filter(t=>t.type!=="space").map(t=>E.parser([t])):[]}var f=class{constructor(){this._stableParts=[],this._stableText="",this._rawText=""}push(t){return this._rawText+=t,this._advanceStableBoundary(),this.getParts()}finalize(){let t=this._rawText.slice(this._stableText.length);return t.trim()&&(this._stableParts.push(...S(t)),this._stableText=this._rawText),this._stableParts}getParts(){let t=this._trimIncompleteTail(this._rawText.slice(this._stableText.length)),s=t.trim()?S(t):[];return[...this._stableParts,...s]}reset(){this._stableParts=[],this._stableText="",this._rawText=""}_advanceStableBoundary(){let t=this._rawText.slice(this._stableText.length),s=this._lastSafeBoundary(t);if(s<=0)return;let i=t.slice(0,s);this._stableParts.push(...S(i)),this._stableText+=i}_lastSafeBoundary(t){let s=t.split(`
3
3
  `),i=!1,e=0,n=0;for(let r of s)/^\s*(```|~~~)/u.test(r)&&(i=!i),n+=r.length+1,r.trim()===""&&!i&&(e=n);return e<t.length?e:0}_trimIncompleteTail(t){let s=t.lastIndexOf("<");if(s!==-1&&!t.includes(">",s))return t.slice(0,s);let i=this._earliestUnclosedTag(t);if(i!==-1)return t.slice(0,i);let e=t.lastIndexOf("[");if(e!==-1){let n=t.slice(e);if(!/\[[^\]]*\]\([^)]*\)/u.test(n))return t.slice(0,e)}return t}_earliestUnclosedTag(t){let s=new Set(["br","img","hr","input","meta","link","area","base","col","embed","source","track","wbr"]),i=/<(\/?)([a-zA-Z][\w-]*)\b[^>]*?(\/?)>/gu,e=[];for(let n=i.exec(t);n;n=i.exec(t)){let[,r,a,l]=n,h=a.toLowerCase();if(!(s.has(h)||l==="/"))if(r==="/"){for(let g=e.length-1;g>=0;g--)if(e[g].name===h){e.splice(g);break}}else e.push({name:h,index:n.index})}return e.length?e[0].index:-1}};function W(o){let t=new f;return t.push(o),t.finalize()}var Y=async o=>await new Promise(t=>setTimeout(t,o));async function*Z(o,{chunkSize:t=15,delay:s=50}={}){let i=new f;for(let e=0;e<o.length;e+=t)yield i.push(o.slice(e,e+t)),await Y(s);yield i.finalize()}var J=Object.defineProperty,K=Object.getOwnPropertyDescriptor,u=(o,t,s,i)=>{for(var e=i>1?void 0:i?K(t,s):t,n=o.length-1,r;n>=0;n--)(r=o[n])&&(e=(i?r(t,s,e):r(e))||e);return i&&e&&J(t,s,e),e},O=o=>!o||typeof o!="object"?!1:o.name==="AbortError";async function*z(o,t,s,i,e=!1){if(e){if(i?.aborted){yield{type:"cancelled",log:s,runId:t};return}yield{type:"block-data",blockType:"text",data:{parts:W(o)},runId:t};return}for await(let n of Z(o)){if(i?.aborted){yield{type:"cancelled",log:s,runId:t};return}yield{type:"block-data",blockType:"text",data:{parts:n},runId:t}}}var p=class extends H{constructor(o){super(o),this.view=null,this.streamingDisabled=!1,this.loading=!1,this.processing=!1,this.processingStep=""}async load(){this._set("loading",!0);try{await this._initialize()}finally{this._set("loading",!1)}}destroy(){this.orchestrator?.dispose(),super.destroy()}async _initialize(){this.removeHandles(),await Promise.all([this.portal.load(),this.view?.when()]),this.view&&await U(()=>!this.view.updating),this._set("orchestrator",await L.init({agents:[...this.agents],view:this.view??void 0})),this.addHandles([B(()=>[this.view,this.agents],()=>{this._initialize()})])}clearChatHistory(){this.orchestrator?.newConversation()}async*ask(o,t){if(!this.orchestrator)throw new Error("Orchestrator not initialized yet.");this._set("processing",!0),this._set("processingStep","");let s=[],i,e="pending";try{let n=this.orchestrator.ask(o);for await(let r of n)switch(e=r.runId,r.type){case"trace":{this._set("processingStep",r.data.text),s.push(r.data.text);break}case"completed":{this._set("processing",!1),this._set("processingStep","");let a=r.result,l=!!a.content.length,h=!!i?.length;if(!l&&!h){yield{type:"completed",error:"No response received.",log:s,runId:e};return}let g=a.content;if(yield{type:"block-start",blockType:"text",runId:e},yield*z(g,e,s,t,this.streamingDisabled),yield{type:"block-end",blockType:"text",runId:e},h)for(let v of i){if(t?.aborted){yield{type:"cancelled",log:s,runId:e};return}let{type:b,data:w}=v;if(yield{type:"block-start",blockType:b,runId:e},b==="text"){let M=typeof w?.content=="string"?w.content:"";yield*z(M,e,s,t,this.streamingDisabled)}else yield{type:"block-data",blockType:b,data:w,runId:e};yield{type:"block-end",blockType:b,runId:e}}yield{type:"completed",response:g,blocks:i,log:s,runId:e};return}case"ux-suggestion":{let a=r.suggestion;i=i?[...i,a]:[a];break}case"interrupt":{let{kind:a,message:l,metadata:h}=r.interrupt,g=Array.isArray(h)?h.filter(b=>typeof b=="string"):[],v=(()=>{switch(a){case"booleanChoice":return{type:"boolean-choice",message:l,options:g};case"singleSelection":return{type:"single-select",message:l,options:g};case"multipleSelection":return{type:"multi-select",message:l,options:g};case"textInput":return{type:"text-input",message:l};default:return{type:a,message:l,options:g}}})();this._set("processingStep","Waiting for user input..."),yield{type:"interrupt",payload:v,runId:e};break}case"cancelled":{yield{type:"cancelled",log:s,runId:e};return}case"error":{if(t?.aborted||O(r.error)){yield{type:"cancelled",log:s,runId:e};return}yield{type:"completed",error:r.error.message,log:s,runId:e};return}default:{console.warn("Unknown event type:",r);break}}}catch(n){if(t?.aborted||O(n)){yield{type:"cancelled",log:s,runId:e};return}console.warn("Error during message processing:",n),yield{type:"completed",error:"An error occurred during message processing.",log:s,runId:"error"};return}finally{this._set("processing",!1)}}cancel(){this.orchestrator?.cancel()}};u([m({readOnly:!0})],p.prototype,"orchestrator",2);u([m()],p.prototype,"agents",2);u([m()],p.prototype,"portal",2);u([m()],p.prototype,"view",2);u([m()],p.prototype,"streamingDisabled",2);u([m({readOnly:!0})],p.prototype,"loading",2);u([m({readOnly:!0})],p.prototype,"processing",2);u([m({readOnly:!0})],p.prototype,"processingStep",2);p=u([F("OrchestratorController")],p);var Q="Embeddings resource 'embeddings-v01.json' not found in the webmap portal item.",X="Embeddings not found for this web map.",tt="https://developers.arcgis.com/javascript/latest/agentic-apps/ai-webmap-setup/#embeddings",x=class extends T{constructor(){super(...arguments),this._messages=D({blocking:!0}),this.#t=_(),this.#l=_(),this.#s=_(),this.#e=null,this.#r=new Map,this.#i=j.getDefault(),this.#a=t=>{t.stopPropagation(),this.cancelInterrupt()},this.#n=t=>{t.stopPropagation();let s=t.detail;this.submitInterrupt(s)},this.#c=t=>{t.stopPropagation(),this.keepSuggestedPrompts||(this.suggestedPrompts=[]);let s=t.detail;this._inputValue="",this.arcgisSubmit.emit(s),this.submitMessage(s)},this.#h=t=>{if(this._canceling=!0,t.stopPropagation(),this.arcgisCancel.emit(),this._interrupt){this.orchestrator?.cancelInterrupt(),this._interrupt=null;return}this._orchestratorController?.cancel(),this.#e?.abort(),this.#e=null},this.#g=t=>{t.stopPropagation();let s=t.detail;this.arcgisFeedback.emit(s)},this.#d=t=>{t.stopPropagation();let s=t.detail;this._inputValue=s.prompt,this.arcgisPromptSelect.emit(s)},this.#p=t=>{this.arcgisSlottableRequest.emit(t.detail)},this._orchestratorController=null,this._interrupt=null,this._interruptDetails=[],this._error=null,this._inputValue="",this._isAnswering=!1,this._canceling=!1,this.messages=new N([]),this.referenceElement=null,this.suggestedPrompts=[],this.feedbackEnabled=!1,this.keepSuggestedPrompts=!1,this.streamingDisabled=!1,this.logEnabled=!1,this.copyEnabled=!1,this.voiceInputEnabled=!1,this.readAloudEnabled=!1,this.assistantAvatarEnabled=!1,this.arcgisCancel=d(),this.arcgisError=d(),this.arcgisFeedback=d(),this.arcgisInterrupt=d(),this.arcgisInterruptCancel=d(),this.arcgisInterruptSubmit=d(),this.arcgisPromptSelect=d(),this.arcgisReady=d(),this.arcgisSubmit=d(),this.arcgisSlottableRequest=d({bubbles:!1,composed:!1}),this.arcgisResponse=d()}static{this.properties={_orchestratorController:16,_interrupt:16,_interruptDetails:16,_error:16,_inputValue:16,_isAnswering:16,_signedInUserId:16,_canceling:16,_isSignedIn:16,_user:16,awaitingResponse:32,awaitingResponseStep:32,interrupt:32,messages:0,orchestrator:32,entryMessage:1,heading:1,description:1,referenceElement:1,suggestedPrompts:0,feedbackEnabled:5,keepSuggestedPrompts:5,streamingDisabled:5,logEnabled:5,copyEnabled:5,voiceInputEnabled:5,readAloudEnabled:5,assistantAvatarEnabled:5}}static{this.styles=G}#t;#l;#s;#e;#r;#i;#a;#n;#c;#h;#g;#d;#p;async#o(){try{let t=R(this.el,this.referenceElement);await t?.componentOnReady();let s=[...this.#r.values()];return s.length?(this._orchestratorController?.destroy(),this._orchestratorController=new p({agents:s,portal:this.#i,streamingDisabled:this.streamingDisabled,view:t?.view}),await this._orchestratorController.load(),!0):(this._error="No agents found.",!1)}catch(t){return this._error=t?.message??"Error initializing orchestrator.",P(this)(t),!1}}get _isSignedIn(){return!!this.#i?.user||!!this._signedInUserId}get _user(){return this.#i?.user?.fullName||this.#i?.user?.username}get awaitingResponse(){return this._orchestratorController?.processing??!1}get awaitingResponseStep(){return this._orchestratorController?.processingStep??""}get interrupt(){return this._interrupt}get orchestrator(){return this._orchestratorController?.orchestrator}async clearChatHistory(){this._reset(),this._orchestratorController?.clearChatHistory()}cancelInterrupt(){this.arcgisInterruptCancel.emit(),this.orchestrator?.cancelInterrupt(),this._interrupt=null}register(t){this.#r.set(t.agent.id,t),this._orchestratorController&&this.#o()}unregister(t){this.#r.delete(t),this._orchestratorController&&this.#o()}async submitMessage(t){let s=t.trim();if(!s||(this.messages.push({id:Date.now().toString(),role:"user",content:s}),!this._orchestratorController))return;this.#e=new AbortController,this._orchestratorController.streamingDisabled=this.streamingDisabled;let i=this._orchestratorController.ask(s,this.#e?.signal);for await(let e of i){let n=e.runId,r=this.messages.at(-1);switch(e.type){case"block-start":{this._isAnswering=!0;let a={type:e.blockType,isPending:!0};if(r?.role==="assistant"&&r.id===n){let l=[...r.blocks??[],a];this.messages.splice(-1,1,{...r,blocks:l})}else this.messages.push({role:"assistant",blocks:[a],id:n,isStreaming:!0,interrupts:this._interruptDetails}),this._interruptDetails=[];break}case"block-data":{if(r?.role!=="assistant"||r?.id!==n)break;let a=[...r.blocks??[]],l=a[a.length-1],{blockType:h,data:g}=e;if(l?.type!==h||!l.isPending)break;h==="text"?a[a.length-1]={...l,data:{...l.data,parts:g?.parts}}:a[a.length-1]={...l,data:{...l.data,...g??{}}},this.messages.splice(-1,1,{...r,blocks:a});break}case"block-end":{if(r?.role!=="assistant"||r?.id!==n)break;let a=[...r.blocks??[]],l=a[a.length-1];if(l?.type!==e.blockType||!l.isPending)break;let h=l;a[a.length-1]={...h,data:{...h.data},isPending:!1},this.messages.splice(-1,1,{...r,blocks:a});break}case"completed":e.error?(this.messages.push({role:"assistant",log:e.log,error:e.error,id:n,interrupts:this._interruptDetails}),this._interruptDetails=[]):r?.role==="assistant"&&r.id===n&&this.messages.splice(-1,1,{...r,content:e.response,blocks:r.blocks?.map(a=>({...a,data:{...a.data},isPending:!1}))??[],isStreaming:!1,log:e.log}),this._isAnswering=!1,this.#e=null,this._canceling=!1;break;case"interrupt":this._interrupt={...e.payload,id:n},this.arcgisInterrupt.emit(this._interrupt);break;case"cancelled":r?.role==="assistant"&&r.id===n?this.messages.splice(-1,1,{...r,blocks:r.blocks?.filter(a=>a.type==="text"||!a.isPending)??[],isStreaming:!1,log:e.log,error:"(Stopped by user)"}):(this.messages.push({role:"assistant",log:e.log,error:"(Stopped by user)",id:n,interrupts:this._interruptDetails}),this._interruptDetails=[]),this._isAnswering=!1,this.#e=null,this._canceling=!1;break}}}submitInterrupt(t){this.arcgisInterruptSubmit.emit(t),this._interrupt&&(this._interruptDetails=[...this._interruptDetails,{interrupt:this._interrupt,response:t}]),this.orchestrator?.resumeInterrupt(t),this._interrupt=null}load(){this.manager.onLifecycle(this._reset.bind(this))}loaded(){this.manager.onLifecycle(()=>{this.#t.value?.addEventListener("arcgisPromptSelect",this.#d),this.#t.value?.addEventListener("arcgisSubmit",this.#c),this.#t.value?.addEventListener("arcgisCancel",this.#h),this.#t.value?.addEventListener("arcgisFeedback",this.#g);let t=V(()=>!!this._interrupt&&!!this.#s.value,()=>{let i=this.#s.value;i.removeEventListener("arcgisSubmit",this.#n),i.removeEventListener("arcgisCancel",this.#a),i.addEventListener("arcgisSubmit",this.#n,{once:!0}),i.addEventListener("arcgisCancel",this.#a,{once:!0})}),s=this.messages.on("after-add",i=>{let e=i.item;e.role==="assistant"&&(e.error||e.content)&&this.arcgisResponse.emit(e)});return queueMicrotask(()=>{this.#o().then(i=>{i?this.arcgisReady.emit():this._error&&this.arcgisError.emit(new Error(this._error))})}),()=>{t.remove(),s.remove(),this.#t.value?.removeEventListener("arcgisPromptSelect",this.#d),this.#s.value?.removeEventListener("arcgisSubmit",this.#n),this.#s.value?.removeEventListener("arcgisCancel",this.#a),this.#t.value?.removeEventListener("arcgisSubmit",this.#c),this.#t.value?.removeEventListener("arcgisCancel",this.#h),this.#t.value?.removeEventListener("arcgisFeedback",this.#g),this._orchestratorController?.destroy(),this._orchestratorController=null}})}_reset(){this._orchestratorController?.cancel(),this.#e?.abort(),this._interrupt=null,this.messages.removeAll(),this._error=null,this._inputValue="",this._signedInUserId=void 0}_renderEntryMessage(){return this._isSignedIn?this._error?this._renderErrorNotice():this.entryMessage?this.messages.length>0?null:c`<calcite-notice open kind=brand closable icon width=full><div slot=message>${this.entryMessage}</div></calcite-notice>`:c`<slot name=entry-message></slot>`:this._renderSignInNotice()}_renderSignInNotice(){let t=this.#i;return c`<calcite-notice slot=entry-message open kind=brand icon width=full><div slot=message>You need to sign in to use the assistant chat.</div>${t?c`<calcite-link slot=link @click=${async()=>{try{let s=await q.getCredential(`${t.url}/sharing`);this._signedInUserId=s.userId,this._error=null,this.requestUpdate(),await this.#o()?this.arcgisReady.emit():this._error&&this.arcgisError.emit(new Error(this._error))}catch(s){this._error=s?.message??"Error signing in.",this.arcgisError.emit(new Error(this._error)),C("error",this,"Error signing in:",{detail:{error:s}})}}} target=_blank title="Sign in to ArcGIS Online">Sign in</calcite-link>`:c`<div slot=link>No portal information available</div>`}</calcite-notice>`}_renderErrorNotice(){return this._error?c`<calcite-notice slot=entry-message open kind=brand icon width=full>${this._error===Q?c`<div slot=message>${X}</div><calcite-link slot=link .href=${tt} target=_blank title="Learn about web map embeddings">Read more</calcite-link>`:c`<div slot=message>${this._error}</div>`}</calcite-notice>`:null}render(){return c`<calcite-panel .loading=${!this._orchestratorController&&!this._error||this._orchestratorController?.loading} .heading=${this.heading??this._messages.assistantLabel} .description=${this.description} ${y(this.#t)}><slot name=header-actions-start slot=header-actions-start></slot><slot name=header-actions-end slot=header-actions-end></slot><div class="content-container"><arcgis-assistant-chat .loading=${this.awaitingResponse} .messages=${this.messages} .interrupt=${this._interrupt}><slot name=message-starter slot=message-starter></slot><slot name=messages slot=messages>${this.messages.map(t=>t.role==="assistant"?c`<arcgis-assistant-message .message=${t} .feedbackEnabled=${this.feedbackEnabled} .logEnabled=${this.logEnabled} .copyEnabled=${this.copyEnabled} .readAloudEnabled=${this.readAloudEnabled} @arcgisSlottableRequest=${this.#p} .assistantAvatarEnabled=${this.assistantAvatarEnabled}>${t.blocks?.map((s,i)=>c`<slot name=${I(t.id,i)??k} slot=${I(t.id,i)??k}><arcgis-assistant-message-block .block=${s}></arcgis-assistant-message-block></slot>`)}</arcgis-assistant-message>`:c`<arcgis-assistant-user-message .message=${t} .user=${this._user}></arcgis-assistant-user-message>`)}</slot>${this._interrupt?c`<div slot=message-loading><div class="interrupt-waiting-message">waiting for user input...</div></div>`:c`<slot name=message-loading slot=message-loading><arcgis-assistant-message-loading .loading=${this.awaitingResponse} .loadingMessage=${this.awaitingResponseStep} .assistantAvatarEnabled=${this.assistantAvatarEnabled} .interrupts=${this._interruptDetails}></arcgis-assistant-message-loading></slot>`}</arcgis-assistant-chat></div>${this._interrupt?c`<slot name=interrupt><arcgis-assistant-interrupt slot=content-bottom .type=${this._interrupt.type} .message=${this._interrupt.message} .options=${this._interrupt.options} ${y(this.#s)}></arcgis-assistant-interrupt></slot>`:this.suggestedPrompts?.length?c`<div class="suggested-prompts-container" slot=content-bottom><arcgis-assistant-suggested-prompts class="suggested-prompts" .prompts=${this.suggestedPrompts}></arcgis-assistant-suggested-prompts></div>`:null}<div class="footer-container" slot=footer>${this._renderEntryMessage()}<slot name=chat-entry><arcgis-assistant-chat-entry .awaitingResponse=${this.awaitingResponse||this._isAnswering} .inputValue=${this._inputValue} .messages=${this.messages} .voiceInputEnabled=${this.voiceInputEnabled} .disabled=${this._canceling||!this._isSignedIn||!!this._interrupt} ${y(this.#l)}><slot name=entry-actions-start slot=entry-actions-start></slot><slot name=entry-actions-end slot=entry-actions-end><calcite-button .iconStart=${this.awaitingResponse||this._isAnswering?"circle-stop":"send"} @click=${()=>{this.#l.value?.submitMessage()}} round>${this.awaitingResponse||this._isAnswering?this._messages.stopButtonLabel:this._messages.askButtonLabel}</calcite-button></slot></arcgis-assistant-chat-entry></slot><slot name=footer-content></slot></div></calcite-panel>`}};A("arcgis-assistant",x);return x},"core/Collection","core/reactiveUtils","portal/Portal","identity/IdentityManager","config","layers/FeatureLayer","core/Accessor","core/accessorSupport/decorators",a,b)
@@ -1,2 +1,2 @@
1
1
  /* COPYRIGHT Esri - https://js.arcgis.com/5.2/LICENSE.txt */
2
- import e from"./TI7K3I3K.js";import d from"./UK7PR2FE.js";import c from"./EIPHHMWX.js";import b from"./JMODFBN6.js";import{a,c as s}from"./V6HOUZPZ.js";import"./3UEKINYC.js";import"./RLEHNAIA.js";import{v as i,z as r}from"./NAKAZDJ7.js";import"./R74ZHFA6.js";import"./HJG7QM2R.js";import"./SYEI4BB2.js";import"./ZQ7PGNWB.js";import"./LUY6V4TP.js";import"./VXFQANGJ.js";import"./MWYBF3F3.js";import"./UZLQALHY.js";export default $arcgis.t(([,,,,,,,,,,,o])=>{var t=class extends i{constructor(){super(...arguments),this.agent=o}static{this.properties={referenceElement:1}}#t;#i;getContext(){if(!this.#t)throw new Error("arcgis-assistant-data-exploration-agent requires a mapView");return{mapView:this.#t}}load(){this.#t=a(this,"arcgis-assistant-data-exploration-agent"),this.#i=s(this)}disconnectedCallback(){this.#i?.unregister(this.agent.id),super.disconnectedCallback()}};r("arcgis-assistant-data-exploration-agent",t);return t},"identity/IdentityManager","portal/Portal","config","core/reactiveUtils","layers/FeatureLayer","request","views/LinkChartView","rest/knowledgeGraphService",b,c,d,e)
2
+ import e from"./EQLRFZVU.js";import d from"./UK7PR2FE.js";import c from"./PNFBQ6JV.js";import b from"./5I35MJXT.js";import{a,c as s}from"./V6HOUZPZ.js";import"./3UEKINYC.js";import"./RLEHNAIA.js";import{v as i,z as r}from"./NAKAZDJ7.js";import"./R74ZHFA6.js";import"./HJG7QM2R.js";import"./ICYUPLZM.js";import"./TFT6HK3O.js";import"./LUY6V4TP.js";import"./VXFQANGJ.js";import"./MWYBF3F3.js";import"./UZLQALHY.js";export default $arcgis.t(([,,,,,,,,,,,o])=>{var t=class extends i{constructor(){super(...arguments),this.agent=o}static{this.properties={referenceElement:1}}#t;#i;getContext(){if(!this.#t)throw new Error("arcgis-assistant-data-exploration-agent requires a mapView");return{mapView:this.#t}}load(){this.#t=a(this,"arcgis-assistant-data-exploration-agent"),this.#i=s(this)}disconnectedCallback(){this.#i?.unregister(this.agent.id),super.disconnectedCallback()}};r("arcgis-assistant-data-exploration-agent",t);return t},"identity/IdentityManager","portal/Portal","config","core/reactiveUtils","layers/FeatureLayer","request","views/LinkChartView","rest/knowledgeGraphService",b,c,d,e)
@@ -1,5 +1,5 @@
1
1
  /* COPYRIGHT Esri - https://js.arcgis.com/5.2/LICENSE.txt */
2
- import a from"./JMODFBN6.js";import{a as S,b as x}from"./HJG7QM2R.js";import{Ca as xe,Pa as D,g as Te,ha as b,j as B,k as U,y as Se}from"./ZQ7PGNWB.js";import{Bc as y,Q as z,U as oe,da as j}from"./LUY6V4TP.js";import{a as l}from"./VXFQANGJ.js";import{Dd as N}from"./MWYBF3F3.js";export default $arcgis.t(([Me,F,ie,je,,Ae,nt,{addressToLocations:it},st,lt,De,{createRenderer:ct},{getSchemesByTag:ut,getSchemes:dt},{getBackgroundColorTheme:Ce},{createAgeRenderer:pt,createContinuousRenderer:mt},{getSchemesByTag:ge},{createContinuousRenderer:ht},{createRenderer:ft},{getSchemesByTag:yt},{createRenderer:gt},{getSchemesByTag:wt},{createRenderer:bt},{getSchemesByTag:vt},{createRenderer:Tt},{getSchemesByTag:St},{createAgeRenderer:xt,createContinuousRenderer:Et},{createRenderer:It},{getSchemesByTag:Nt},kt,Le,Oe,{formatDateOnly:$t,convertDateFormatToIntlOptions:W,formatTimeOnly:Ft,formatDate:Re},Mt,At,Ct,Rt,qt,Pe,,{fetchKnowledgeGraph:qe,executeQueryStreaming:_t,executeSearchStreaming:zt},jt,{getBindParametersFromCypherQuery:Dt},{b:L,c:Ee,q:Ie}])=>{var Fe=e=>Array.isArray(e)&&e.every(z),tt=e=>typeof e=="object"&&e!=null&&"messages"in e&&Fe(e.messages),rt=e=>typeof e=="object"&&e!=null&&"lg_tool_call"in e,K=class extends xe{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,r){let o=this.tools.find(a=>a.name===e.name);try{if(o===void 0)throw new Error(`Tool "${e.name}" not found.`);let a={...e,type:"tool_call"},n={...t,state:r,toolCallId:e.id??"",config:t,context:t.context,store:t.store??null,writer:t.writer??t.configurable?.writer??null},s=await o.invoke(a,n);return z(s)&&s.getType()==="tool"||U(s)?s:new oe({status:"success",name:o.name,content:typeof s=="string"?s:JSON.stringify(s),tool_call_id:e.id})}catch(a){if(!this.handleToolErrors||Se(a))throw a;return new oe({status:"error",content:`Error: ${a.message}
2
+ import a from"./5I35MJXT.js";import{a as S,b as x}from"./HJG7QM2R.js";import{Ca as xe,Pa as D,g as Te,ha as b,j as B,k as U,y as Se}from"./TFT6HK3O.js";import{Bc as y,Q as z,U as oe,da as j}from"./LUY6V4TP.js";import{a as l}from"./VXFQANGJ.js";import{Dd as N}from"./MWYBF3F3.js";export default $arcgis.t(([Me,F,ie,je,,Ae,nt,{addressToLocations:it},st,lt,De,{createRenderer:ct},{getSchemesByTag:ut,getSchemes:dt},{getBackgroundColorTheme:Ce},{createAgeRenderer:pt,createContinuousRenderer:mt},{getSchemesByTag:ge},{createContinuousRenderer:ht},{createRenderer:ft},{getSchemesByTag:yt},{createRenderer:gt},{getSchemesByTag:wt},{createRenderer:bt},{getSchemesByTag:vt},{createRenderer:Tt},{getSchemesByTag:St},{createAgeRenderer:xt,createContinuousRenderer:Et},{createRenderer:It},{getSchemesByTag:Nt},kt,Le,Oe,{formatDateOnly:$t,convertDateFormatToIntlOptions:W,formatTimeOnly:Ft,formatDate:Re},Mt,At,Ct,Rt,qt,Pe,,{fetchKnowledgeGraph:qe,executeQueryStreaming:_t,executeSearchStreaming:zt},jt,{getBindParametersFromCypherQuery:Dt},{b:L,c:Ee,q:Ie}])=>{var Fe=e=>Array.isArray(e)&&e.every(z),tt=e=>typeof e=="object"&&e!=null&&"messages"in e&&Fe(e.messages),rt=e=>typeof e=="object"&&e!=null&&"lg_tool_call"in e,K=class extends xe{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,r){let o=this.tools.find(a=>a.name===e.name);try{if(o===void 0)throw new Error(`Tool "${e.name}" not found.`);let a={...e,type:"tool_call"},n={...t,state:r,toolCallId:e.id??"",config:t,context:t.context,store:t.store??null,writer:t.writer??t.configurable?.writer??null},s=await o.invoke(a,n);return z(s)&&s.getType()==="tool"||U(s)?s:new oe({status:"success",name:o.name,content:typeof s=="string"?s:JSON.stringify(s),tool_call_id:e.id})}catch(a){if(!this.handleToolErrors||Se(a))throw a;return new oe({status:"error",content:`Error: ${a.message}
3
3
  Please fix your mistakes.`,name:e.name,tool_call_id:e.id??""})}}async run(e,t){let r;if(rt(e)){let{lg_tool_call:n,...s}=e;r=[await this.runTool(n,t,s)]}else{let n;if(Fe(e))n=e;else if(tt(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)),i;for(let u=n.length-1;u>=0;u-=1){let c=n[u];if(j(c)){i=c;break}}if(i==null||!j(i))throw new Error("ToolNode only accepts AIMessages as input.");r=await Promise.all(i.tool_calls?.filter(u=>u.id==null||!s.has(u.id)).map(u=>this.runTool(u,t,e))??[])}if(!r.some(U))return Array.isArray(e)?r:{messages:r};let o=[],a=null;for(let n of r)U(n)?n.graph===B.PARENT&&Array.isArray(n.goto)&&n.goto.every(s=>Te(s))?a?a.goto.push(...n.goto):a=new B({graph:B.PARENT,goto:n.goto}):o.push(n):o.push(Array.isArray(e)?[n]:{messages:[n]});return a&&o.push(a),o}};var Dn=b.Root({llmInputMessages:b({reducer:(e,t)=>D([],t),default:()=>[]})});var O=(e,t)=>t??e,Wi=b.Root({...Ee(),intent:b({reducer:O}),vectorSearchLayerResults:b({reducer:O,default:()=>[]}),vectorSearchFieldResults:b({reducer:O}),navigationInternalState:b({reducer:O,default:()=>({toolCallMessage:void 0})})});async function Lt(e,t){let r=F.getDefault().helperServices,o=r.geocode.find(d=>d.name==="ArcGIS World Geocoding Service")??r.geocode[0];if(!o)throw new Error("No geocoding service found in helperServices.");let a=o.url,n=`${ie.assetsPath?.endsWith("/")?ie.assetsPath:`${ie.assetsPath}/`}esri/images/search/search-symbol-32.png`,s=(await it(a,{address:{SingleLine:e},outFields:["Match_addr"]}))?.[0];if(!s?.extent||!s.location)throw new Error(`Could not find location for: ${e}`);let i=new st({url:n,width:24,height:24}),u=new nt({geometry:s.location,symbol:i});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 Ot=["mapView"];function k(e){let t=e?.configurable?.context;if(!t||typeof t!="object")throw new Error("NavigationAgent context missing");let r=Ot.filter(o=>!(o in t));if(r.length)throw new Error(`NavigationAgent context missing: ${r.join(", ")}`);return t}async function Pt({address:e},t){let{mapView:r}=k(t);return await Lt(e,r)}var Gt=l.object({address:l.string().describe("The full address or place name to locate.")}),Hi=y(Pt,{name:"goToAddress",description:"Geocodes an address using Esri's World Geocoding Service and zooms the map to that location.",schema:Gt});async function Vt(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 Qt({bookmarkName:e},t){let{mapView:r}=k(t);return await Promise.resolve(Vt(e,r))}var Bt=N.object({bookmarkName:N.string().describe("The name of the bookmark to navigate to.")}),Ji=y(Qt,{name:"goToBookmark",description:"Go to the extent of the bookmark with the given name.",schema:Bt});async function Ut(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:i}=await o.queryExtent(n);if(i===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:i};return{text:`Successfully zoomed to ${i} 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 Kt({layerId:e,where:t},r){let{mapView:o}=k(r);return await Ut(e,t,o)}var Wt=N.object({layerId:N.string().describe("The layerId of the layer to zoom to."),where:N.string().describe("ArcGIS SQL-92 WHERE expression used for `query.where` on the selected layer. Use only fields from that layer and return a boolean filter expression (for example comparisons, LIKE, IN, BETWEEN, IS NULL, AND/OR/NOT). Do NOT include subqueries/nested SELECT, JOIN, GROUP BY, HAVING, ORDER BY, or semicolons.")}),Zi=y(Kt,{name:"goToFeatures",description:"Go to the features that match the given filter related to the given layerId.",schema:Wt});async function Ht(e){let t=new lt({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 Jt(e,t){let{mapView:r}=k(t);return await Ht(r)}var Zt=N.object({}),Yi=y(Jt,{name:"goToFullExtent",description:"Zooms the map to the full world extent using Esri's Geocoding Service.",schema:Zt});async function Yt(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 Xt(e,t){let{mapView:r}=k(t);return await Yt(r)}var er=l.object({}),Xi=y(Xt,{name:"goToHomeExtent",description:"Go to the initial web map view extent",schema:er});async function tr(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 rr({layerId:e},t){let{mapView:r}=k(t);return await tr(e,r)}var or=N.object({layerId:N.string().describe("The id of the layer to navigate to")}),es=y(rr,{name:"goToLayer",description:"Zooms the map view to the full extent of the top matching layer.",schema:or});async function ar(e,t){return await t.goTo({scale:e}),{text:`Successfully zoomed to: ${e}`}}async function nr({scale:e},t){let{mapView:r}=k(t);return await ar(e,r)}var ir=l.object({scale:l.number().describe("The map scale of the view to go to.")}),ts=y(nr,{name:"goToScale",description:"Go to the specified view scale.",schema:ir});async function sr(e,t,r){let o={target:new De({longitude:e.longitude,latitude:e.latitude,spatialReference:{wkid:4326}})};return r?.zoom!==void 0&&(o.zoom=r.zoom),r?.scale!==void 0&&(o.scale=r.scale),await t.goTo(o),{text:`Successfully navigated to: ${[`(${e.latitude}\xB0, ${e.longitude}\xB0)`,r?.zoom!==void 0?`zoom ${r.zoom}`:"",r?.scale!==void 0?`scale 1:${r.scale}`:""].filter(Boolean).join(", ")}`}}async function lr({center:e,zoom:t,scale:r},o){let{mapView:a}=k(o);return await sr(e,a,{zoom:t,scale:r})}var cr=l.object({center:l.object({longitude:l.number().describe("The longitude (x-coordinate) of the point to navigate to."),latitude:l.number().describe("The latitude (y-coordinate) of the point to navigate to.")}),zoom:l.number().optional().describe("The zoom level. Higher values = more zoomed in."),scale:l.number().optional().describe("The map scale. Alternative to zoom. Smaller numbers = more zoomed in.")}),rs=y(lr,{name:"goToViewpoint",description:"Go to the specified viewpoint. This can contain a combination of scale, center, zoom, etc.",schema:cr});async function ur(e,t){return await t.goTo({zoom:e}),{text:`Successfully zoomed to: ${e}`}}async function dr({zoom:e},t){let{mapView:r}=k(t);return await ur(e,r)}var pr=l.object({zoom:l.number().min(1).max(20).describe("The zoom level of the view to go to.")}),os=y(dr,{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:pr}),_e=Object.assign({"../agents/arcgisKnowledge/prompts/arcgis_knowledge_current_lc_context.md":()=>import("./J6A4AS7E.js").then(e=>e.default),"../agents/arcgisKnowledge/prompts/arcgis_knowledge_current_map_context.md":()=>import("./TPULIO6I.js").then(e=>e.default),"../agents/arcgisKnowledge/prompts/arcgis_knowledge_cypher_query_prompt.md":()=>import("./IHP25JWI.js").then(e=>e.default),"../agents/arcgisKnowledge/prompts/arcgis_knowledge_lucene_generation_prompt.md":()=>import("./CEKOEHB3.js").then(e=>e.default),"../agents/arcgisKnowledge/prompts/arcgis_knowledge_summarize_result_prompt.md":()=>import("./VAXH6RUQ.js").then(e=>e.default),"../agents/arcgisKnowledge/prompts/arcgis_knowledge_tool_prompt.md":()=>import("./AOVJ34QE.js").then(e=>e.default),"../agents/dataExploration/prompts/data_explore_filter_prompt.md":()=>import("./PQ2DPOFM.js").then(e=>e.default),"../agents/dataExploration/prompts/data_explore_query_prompt.md":()=>import("./SDWWUWAF.js").then(e=>e.default),"../agents/dataExploration/prompts/summarize_query_response_prompt.md":()=>import("./FYZATVB3.js").then(e=>e.default),"../agents/help/prompts/help_prompt.md":()=>import("./NEV6OZN3.js").then(e=>e.default),"../agents/layerStyling/prompts/layer_styling_prompt.md":()=>import("./ICBIUFK7.js").then(e=>e.default),"../agents/navigation/prompts/navigation_intent_prompt.md":()=>import("./JEBRN3EU.js").then(e=>e.default),"../agents/navigation/prompts/navigation_tool_prompt.md":()=>import("./UHEYPSOR.js").then(e=>e.default)});async function Z(e){let t=Object.entries(_e).find(([r])=>r.endsWith(`/${e}.md`));if(!t)throw new Error(`Prompt not found: ${e}
4
4
  Available prompts:
5
5
  ${Object.keys(_e).join(`
@@ -1,2 +1,2 @@
1
1
  /* COPYRIGHT Esri - https://js.arcgis.com/5.2/LICENSE.txt */
2
- import a from"./3OH4DXSY.js";import"./SBP6WNDY.js";import"./ZQ7PGNWB.js";import"./LUY6V4TP.js";import"./MWYBF3F3.js";import"./UZLQALHY.js";export default $arcgis.t(([{property:l,subclass:w},{c:p,d:d}])=>{var y=Object.defineProperty,m=Object.getOwnPropertyDescriptor,f=e=>{throw TypeError(e)},h=(e,t,o,n)=>{for(var r=n>1?void 0:n?m(t,o):t,s=e.length-1,g;s>=0;s--)(g=e[s])&&(r=(n?g(t,o,r):g(r))||r);return n&&r&&y(t,o,r),r},k=(e,t,o)=>t.has(e)||f("Cannot "+o),b=(e,t,o)=>t.has(e)?f("Cannot add the same private member more than once"):t instanceof WeakSet?t.add(e):t.set(e,o),c=(e,t,o)=>(k(e,t,"access private method"),o),a,i,u=class extends d{constructor(e){super(e),b(this,a)}getAgents(){return c(this,a,i).call(this),[this.routerAgent,...Object.values(this.agentsMap)]}buildEdges(e){c(this,a,i).call(this);let t=p(this.routerAgent,0),o=new Map;for(let[n,[r]]of Object.entries(this.agentsMap).entries())o.set(r,p(e[n+1],n+1));return[{from:t,decide:n=>{let r=n[this.routerOutputKey];if(typeof r!="string"||!r)throw new Error("RouterWorkflow decideRoute could not determine next agent from state.");let s=o.get(r);if(!s)throw new Error(`RouterWorkflow decideRoute returned unknown agent: ${r}. Expected one of: ${Object.keys(this.agentsMap).join(", ")||"(none)"}.`);return s}}]}getEntryNode(){return c(this,a,i).call(this),p(this.routerAgent,0)}isTerminalAgent(e,t){return t>0}validateAgents(e){c(this,a,i).call(this),super.validateAgents(e)}};a=new WeakSet;i=function(){if(!Object.keys(this.agentsMap).length)throw new Error("RouterWorkflow requires a non-empty agentsMap.")};h([l()],u.prototype,"agentsMap",2);h([l()],u.prototype,"routerAgent",2);h([l()],u.prototype,"routerOutputKey",2);u=h([w("RouterWorkflow")],u);return u},"core/accessorSupport/decorators",a)
2
+ import a from"./ZS6SXJP2.js";import"./57OMVTIU.js";import"./TFT6HK3O.js";import"./LUY6V4TP.js";import"./MWYBF3F3.js";import"./UZLQALHY.js";export default $arcgis.t(([{property:l,subclass:w},{c:p,d:d}])=>{var y=Object.defineProperty,m=Object.getOwnPropertyDescriptor,f=e=>{throw TypeError(e)},h=(e,t,o,n)=>{for(var r=n>1?void 0:n?m(t,o):t,s=e.length-1,g;s>=0;s--)(g=e[s])&&(r=(n?g(t,o,r):g(r))||r);return n&&r&&y(t,o,r),r},k=(e,t,o)=>t.has(e)||f("Cannot "+o),b=(e,t,o)=>t.has(e)?f("Cannot add the same private member more than once"):t instanceof WeakSet?t.add(e):t.set(e,o),c=(e,t,o)=>(k(e,t,"access private method"),o),a,i,u=class extends d{constructor(e){super(e),b(this,a)}getAgents(){return c(this,a,i).call(this),[this.routerAgent,...Object.values(this.agentsMap)]}buildEdges(e){c(this,a,i).call(this);let t=p(this.routerAgent,0),o=new Map;for(let[n,[r]]of Object.entries(this.agentsMap).entries())o.set(r,p(e[n+1],n+1));return[{from:t,decide:n=>{let r=n[this.routerOutputKey];if(typeof r!="string"||!r)throw new Error("RouterWorkflow decideRoute could not determine next agent from state.");let s=o.get(r);if(!s)throw new Error(`RouterWorkflow decideRoute returned unknown agent: ${r}. Expected one of: ${Object.keys(this.agentsMap).join(", ")||"(none)"}.`);return s}}]}getEntryNode(){return c(this,a,i).call(this),p(this.routerAgent,0)}isTerminalAgent(e,t){return t>0}validateAgents(e){c(this,a,i).call(this),super.validateAgents(e)}};a=new WeakSet;i=function(){if(!Object.keys(this.agentsMap).length)throw new Error("RouterWorkflow requires a non-empty agentsMap.")};h([l()],u.prototype,"agentsMap",2);h([l()],u.prototype,"routerAgent",2);h([l()],u.prototype,"routerOutputKey",2);u=h([w("RouterWorkflow")],u);return u},"core/accessorSupport/decorators",a)
@@ -1,5 +1,5 @@
1
1
  /* COPYRIGHT Esri - https://js.arcgis.com/5.2/LICENSE.txt */
2
- import b from"./EIPHHMWX.js";import a from"./JMODFBN6.js";import{a as p}from"./HJG7QM2R.js";import{Va as c,a as u,b as i}from"./ZQ7PGNWB.js";export default $arcgis.t(([,,,,,,{r:g},{I:d,J:E,a:h,m:f,n:y,o:m,p:x}])=>{var S=[E],_=e=>{if(!e||e.size===0)return"No layers available in this map.";let t=Array.from(e.values()).map(({layerItem:r,fieldRegistry:a},s)=>{let o=Array.from(a.values()).map(n=>n.name).slice(0,10).join(", "),l=a.size>10?` (and ${a.size-10} more)`:"";return`${s+1}. "${r.title}". Description: ${r.description}
2
+ import b from"./PNFBQ6JV.js";import a from"./5I35MJXT.js";import{a as p}from"./HJG7QM2R.js";import{Va as c,a as u,b as i}from"./TFT6HK3O.js";export default $arcgis.t(([,,,,,,{r:g},{I:d,J:E,a:h,m:f,n:y,o:m,p:x}])=>{var S=[E],_=e=>{if(!e||e.size===0)return"No layers available in this map.";let t=Array.from(e.values()).map(({layerItem:r,fieldRegistry:a},s)=>{let o=Array.from(a.values()).map(n=>n.name).slice(0,10).join(", "),l=a.size>10?` (and ${a.size-10} more)`:"";return`${s+1}. "${r.title}". Description: ${r.description}
3
3
  Fields: ${o}${l}`}).join(`
4
4
 
5
5
  `);return`This map contains ${e.size} layer(s):
@@ -1,2 +1,2 @@
1
1
  /* COPYRIGHT Esri - https://js.arcgis.com/5.2/LICENSE.txt */
2
- import k from"./TI7K3I3K.js";import j from"./SKXDXIQO.js";import i from"./XFL2VQFM.js";import f from"./GPVY5GM6.js";import e from"./UK7PR2FE.js";import d from"./HBUW4KGU.js";import c from"./EIPHHMWX.js";import b from"./5SW5CPQT.js";import a from"./JMODFBN6.js";import"./R74ZHFA6.js";import{a as g,b as h}from"./HJG7QM2R.js";import"./SYEI4BB2.js";import"./ZQ7PGNWB.js";import"./LUY6V4TP.js";import"./VXFQANGJ.js";import"./MWYBF3F3.js";import"./UZLQALHY.js";export default $arcgis.t(([C,I,{b:u,c:y,f:w,i:v,j:A,k:S,l:b,m:d,n:p,o:M,p:E,q:P,r:T,s:W,t:x},{a:f,b:V},,O,,L,D,k,R])=>{var U=async e=>{let a=e.allLayers.toArray(),s=[],o=new Map;for(let t of a)if(t instanceof C){let i=(async()=>{let n=await W(t),r=await x(t,n);o.set(t.id,{layerItem:r,fieldRegistry:n})})();s.push(i)}return await Promise.all(s),o},j=async e=>{await I.whenOnce(()=>e.ready);let a=await U(e.map),{layers:s}=await q(a),o={schemaVersion:v,modified:Date.now(),embeddings:{modelProvider:S,model:b,dimensions:A,templates:{layer:d,field:p}},layers:s},t=M.safeParse(o);if(!t.success)throw console.error("Schema Mismatch:",t.error.format()),new Error("Webmap embedding generation failed validation.");return t.data},q=async e=>{let a=[],s=[];for(let[i,{fieldRegistry:n,layerItem:r}]of e.entries()){let l=H(d,{name:r.name,title:r.title,description:r.description});a.push(l);let m={id:i,name:r.name??"",title:r.title,description:r.description,vector:[],fields:[]};for(let[,c]of n.entries()){let N=H(p,{name:c.name,alias:c.alias,description:c.description});a.push(N),m.fields.push({name:c.name,alias:c.alias,description:c.description,vector:[]})}s.push(m)}let o=await f(a),t=0;return{layers:s.map(i=>(i.vector=o[t++],i.fields.forEach(n=>{n.vector=o[t++]}),i))}},H=(e,a)=>e.replace(/\{(\w+)\}/gu,(s,o)=>a[o]??""),z=(e,a)=>{if(e.length!==a.length)throw new Error("Vectors must be the same length");let s=0,o=0,t=0;for(let r=0;r<e.length;++r){let l=e[r],m=a[r];s+=l*m,o+=l*l,t+=m*m}let i=Math.sqrt(o*t);if(i===0)return 0;let n=s/i;return Math.max(-1,Math.min(1,n))},_=E,ee=P,ae=T,te=g,se=f,re=z,oe=O,ie=L,ne=R,me=k,ce=D,le=j,de=()=>u(),pe=()=>y(),fe=async(e,a)=>await h(e,a),ge=async({modelTier:e="default",temperature:a=0,config:s}={})=>await w({modelTier:e,temperature:a,config:s});return{ArcgisKnowledgeAgent:ce,DataExplorationAgent:ne,HelpAgent:me,LayerStylingAgent:ie,NavigationAgent:oe,Orchestrator:V,cosineSimilarity:re,createAgentRuntimeState:de,createAgentRuntimeStateWithSharedState:pe,createChatModel:ge,createWebmapEmbeddings:le,getEmbeddings:se,invokeStructuredPrompt:ee,invokeTextPrompt:_,invokeToolPrompt:ae,sendTraceMessage:te,sendUXSuggestion:fe}},"layers/FeatureLayer","core/reactiveUtils",a,b,c,d,e,f,i,j,k)
2
+ import k from"./EQLRFZVU.js";import j from"./SUA3YJTU.js";import i from"./JSIGEUX7.js";import f from"./VPFIUEKT.js";import e from"./UK7PR2FE.js";import d from"./EW6AYEUX.js";import c from"./PNFBQ6JV.js";import b from"./Z6I6JACX.js";import a from"./5I35MJXT.js";import"./R74ZHFA6.js";import{a as g,b as h}from"./HJG7QM2R.js";import"./ICYUPLZM.js";import"./TFT6HK3O.js";import"./LUY6V4TP.js";import"./VXFQANGJ.js";import"./MWYBF3F3.js";import"./UZLQALHY.js";export default $arcgis.t(([C,I,{b:u,c:y,f:w,i:v,j:A,k:S,l:b,m:d,n:p,o:M,p:E,q:P,r:T,s:W,t:x},{a:f,b:V},,O,,L,D,k,R])=>{var U=async e=>{let a=e.allLayers.toArray(),s=[],o=new Map;for(let t of a)if(t instanceof C){let i=(async()=>{let n=await W(t),r=await x(t,n);o.set(t.id,{layerItem:r,fieldRegistry:n})})();s.push(i)}return await Promise.all(s),o},j=async e=>{await I.whenOnce(()=>e.ready);let a=await U(e.map),{layers:s}=await q(a),o={schemaVersion:v,modified:Date.now(),embeddings:{modelProvider:S,model:b,dimensions:A,templates:{layer:d,field:p}},layers:s},t=M.safeParse(o);if(!t.success)throw console.error("Schema Mismatch:",t.error.format()),new Error("Webmap embedding generation failed validation.");return t.data},q=async e=>{let a=[],s=[];for(let[i,{fieldRegistry:n,layerItem:r}]of e.entries()){let l=H(d,{name:r.name,title:r.title,description:r.description});a.push(l);let m={id:i,name:r.name??"",title:r.title,description:r.description,vector:[],fields:[]};for(let[,c]of n.entries()){let N=H(p,{name:c.name,alias:c.alias,description:c.description});a.push(N),m.fields.push({name:c.name,alias:c.alias,description:c.description,vector:[]})}s.push(m)}let o=await f(a),t=0;return{layers:s.map(i=>(i.vector=o[t++],i.fields.forEach(n=>{n.vector=o[t++]}),i))}},H=(e,a)=>e.replace(/\{(\w+)\}/gu,(s,o)=>a[o]??""),z=(e,a)=>{if(e.length!==a.length)throw new Error("Vectors must be the same length");let s=0,o=0,t=0;for(let r=0;r<e.length;++r){let l=e[r],m=a[r];s+=l*m,o+=l*l,t+=m*m}let i=Math.sqrt(o*t);if(i===0)return 0;let n=s/i;return Math.max(-1,Math.min(1,n))},_=E,ee=P,ae=T,te=g,se=f,re=z,oe=O,ie=L,ne=R,me=k,ce=D,le=j,de=()=>u(),pe=()=>y(),fe=async(e,a)=>await h(e,a),ge=async({modelTier:e="default",temperature:a=0,config:s}={})=>await w({modelTier:e,temperature:a,config:s});return{ArcgisKnowledgeAgent:ce,DataExplorationAgent:ne,HelpAgent:me,LayerStylingAgent:ie,NavigationAgent:oe,Orchestrator:V,cosineSimilarity:re,createAgentRuntimeState:de,createAgentRuntimeStateWithSharedState:pe,createChatModel:ge,createWebmapEmbeddings:le,getEmbeddings:se,invokeStructuredPrompt:ee,invokeTextPrompt:_,invokeToolPrompt:ae,sendTraceMessage:te,sendUXSuggestion:fe}},"layers/FeatureLayer","core/reactiveUtils",a,b,c,d,e,f,i,j,k)
@@ -1,5 +1,5 @@
1
1
  /* COPYRIGHT Esri - https://js.arcgis.com/5.2/LICENSE.txt */
2
- import c from"./UK7PR2FE.js";import b from"./EIPHHMWX.js";import a from"./JMODFBN6.js";import{a as i}from"./HJG7QM2R.js";import{Va as S,a as u,b as p,s as f}from"./ZQ7PGNWB.js";export default $arcgis.t(([,,,,,,{r:x},{A:_,B:h,a:w,m:E,o:y,p:I,q:L,r:v,s:F,t:$,u:C,v:N,w:R,x:T,y:b,z:A},q])=>{var V=.7,z=10,D=async(a,t)=>{try{await i({text:"Similarity search to find fields"},t);let e=y(t,"fieldSearch"),n=y(t,"layersAndFieldsRegistry"),o=y(t,"embeddingCache"),r=await e.searchFields({text:a.agentExecutionContext.assignedTask,layerIds:a.vectorSearchLayerIds,minScore:V,topResults:z,embeddingCache:o}),m=r.map(({layerId:d,results:c})=>{let g=c.map(s=>` - ${s.name} (${s.score.toFixed(2)})`).join(`
2
+ import c from"./UK7PR2FE.js";import b from"./PNFBQ6JV.js";import a from"./5I35MJXT.js";import{a as i}from"./HJG7QM2R.js";import{Va as S,a as u,b as p,s as f}from"./TFT6HK3O.js";export default $arcgis.t(([,,,,,,{r:x},{A:_,B:h,a:w,m:E,o:y,p:I,q:L,r:v,s:F,t:$,u:C,v:N,w:R,x:T,y:b,z:A},q])=>{var V=.7,z=10,D=async(a,t)=>{try{await i({text:"Similarity search to find fields"},t);let e=y(t,"fieldSearch"),n=y(t,"layersAndFieldsRegistry"),o=y(t,"embeddingCache"),r=await e.searchFields({text:a.agentExecutionContext.assignedTask,layerIds:a.vectorSearchLayerIds,minScore:V,topResults:z,embeddingCache:o}),m=r.map(({layerId:d,results:c})=>{let g=c.map(s=>` - ${s.name} (${s.score.toFixed(2)})`).join(`
3
3
  `);return`${n.get(d)?.layerItem.name??d}:
4
4
  ${g}`}).join(`
5
5
  `),l;return r.length>0?l=`Vector search completed. Matching layers and fields with scores:
@@ -1,5 +1,5 @@
1
1
  /* COPYRIGHT Esri - https://js.arcgis.com/5.2/LICENSE.txt */
2
- import a from"./3OH4DXSY.js";import{a as C,c as N}from"./SBP6WNDY.js";import"./ZQ7PGNWB.js";import"./LUY6V4TP.js";import"./MWYBF3F3.js";import"./UZLQALHY.js";export default $arcgis.t(([{property:B,subclass:D},{a:h,b:S,c:p,d:A}])=>{var G=Object.defineProperty,z=Object.getOwnPropertyDescriptor,P=(t,e,s,n)=>{for(var r=n>1?void 0:n?z(e,s):e,o=t.length-1,a;o>=0;o--)(a=t[o])&&(r=(n?a(e,s,r):a(r))||r);return n&&r&&G(e,s,r),r},x=class extends A{constructor(t){super(t)}getAgents(){return this.agents}generate(){let t=this.getAgents();this.validateAgents(t);for(let o of t)o.generate();let e=S(t.flatMap(o=>o.getSchemas()));for(let[o]of t.entries())e[_(o)]=void 0;let s=C(e),n=this.buildNodes(t),r=this.buildEdges(t);return{workspace:s,createGraph:()=>N(n,r,s,{entryNode:this.getEntryNode(t)})}}getEntryNode(t){return y}isTerminalAgent(t,e){return!1}buildNodes(t){let e={};for(let[s,n]of t.entries()){let r=_(s),o=p(n,s);e[o]=async(a,u)=>{let l=await n.run(F(a,n),u),i={},m=i;return m[r]=l,i}}return e[y]=()=>({}),e[k]=s=>R(s,t),e}buildEdges(t){return[...t.map((e,s)=>({from:y,to:p(e,s)})),...t.map((e,s)=>({from:p(e,s),to:k}))]}};P([B()],x.prototype,"agents",2);x=P([D("ParallelWorkflow")],x);var y="__parallel_fanOut",k="__parallel_join";function _(t){return`__parallel_update_${t}`}function W(t,e){return Object.fromEntries(e.filter(s=>Object.hasOwn(t,s)).map(s=>[s,t[s]]))}function F(t,e){let s=e.inputSchema;return s?{...W(t,h(s)),agentExecutionContext:t.agentExecutionContext,outputMessage:t.outputMessage,status:void 0,summary:""}:{...t,status:void 0,summary:""}}function I(t,e){return t.outputSchema?W(e,h(t.outputSchema)):{}}function K(t,e){let s=t.agentExecutionContext?.messages??[],n=e.agentExecutionContext?.messages??[];return n.length>s.length?n.slice(s.length):void 0}function R(t,e){let s=[],n=[],r=[],o={},a={},u=new Set;for(let[m,J]of e.entries()){let E=_(m),d=t[E];if(a[E]=void 0,!d||typeof d!="object")continue;let c=d,b=c.outputMessage,O=K(t,c),v=c.summary,$=I(J,c),w=b.trim();typeof b=="string"&&w&&s.push(w);let j=v.trim();typeof v=="string"&&j&&n.push(j),Array.isArray(O)&&r.push(...O),c.status&&u.add(c.status);for(let[f,g]of Object.entries($))if(!(g===void 0||f.startsWith("__parallel_update_"))&&!M(t[f],g)){if(!Object.hasOwn(o,f)){o[f]=g;continue}if(!M(o[f],g))throw new Error(`ParallelWorkflow detected conflicting updates for state key "${f}".`)}}let l={...a,...o},i=l;return r.length>0&&(i.agentExecutionContext={...t.agentExecutionContext,messages:[...t.agentExecutionContext.messages,...r]}),s.length&&(i.outputMessage=s.join(`
2
+ import a from"./ZS6SXJP2.js";import{a as C,c as N}from"./57OMVTIU.js";import"./TFT6HK3O.js";import"./LUY6V4TP.js";import"./MWYBF3F3.js";import"./UZLQALHY.js";export default $arcgis.t(([{property:B,subclass:D},{a:h,b:S,c:p,d:A}])=>{var G=Object.defineProperty,z=Object.getOwnPropertyDescriptor,P=(t,e,s,n)=>{for(var r=n>1?void 0:n?z(e,s):e,o=t.length-1,a;o>=0;o--)(a=t[o])&&(r=(n?a(e,s,r):a(r))||r);return n&&r&&G(e,s,r),r},x=class extends A{constructor(t){super(t)}getAgents(){return this.agents}generate(){let t=this.getAgents();this.validateAgents(t);for(let o of t)o.generate();let e=S(t.flatMap(o=>o.getSchemas()));for(let[o]of t.entries())e[_(o)]=void 0;let s=C(e),n=this.buildNodes(t),r=this.buildEdges(t);return{workspace:s,createGraph:()=>N(n,r,s,{entryNode:this.getEntryNode(t)})}}getEntryNode(t){return y}isTerminalAgent(t,e){return!1}buildNodes(t){let e={};for(let[s,n]of t.entries()){let r=_(s),o=p(n,s);e[o]=async(a,u)=>{let l=await n.run(F(a,n),u),i={},m=i;return m[r]=l,i}}return e[y]=()=>({}),e[k]=s=>R(s,t),e}buildEdges(t){return[...t.map((e,s)=>({from:y,to:p(e,s)})),...t.map((e,s)=>({from:p(e,s),to:k}))]}};P([B()],x.prototype,"agents",2);x=P([D("ParallelWorkflow")],x);var y="__parallel_fanOut",k="__parallel_join";function _(t){return`__parallel_update_${t}`}function W(t,e){return Object.fromEntries(e.filter(s=>Object.hasOwn(t,s)).map(s=>[s,t[s]]))}function F(t,e){let s=e.inputSchema;return s?{...W(t,h(s)),agentExecutionContext:t.agentExecutionContext,outputMessage:t.outputMessage,status:void 0,summary:""}:{...t,status:void 0,summary:""}}function I(t,e){return t.outputSchema?W(e,h(t.outputSchema)):{}}function K(t,e){let s=t.agentExecutionContext?.messages??[],n=e.agentExecutionContext?.messages??[];return n.length>s.length?n.slice(s.length):void 0}function R(t,e){let s=[],n=[],r=[],o={},a={},u=new Set;for(let[m,J]of e.entries()){let E=_(m),d=t[E];if(a[E]=void 0,!d||typeof d!="object")continue;let c=d,b=c.outputMessage,O=K(t,c),v=c.summary,$=I(J,c),w=b.trim();typeof b=="string"&&w&&s.push(w);let j=v.trim();typeof v=="string"&&j&&n.push(j),Array.isArray(O)&&r.push(...O),c.status&&u.add(c.status);for(let[f,g]of Object.entries($))if(!(g===void 0||f.startsWith("__parallel_update_"))&&!M(t[f],g)){if(!Object.hasOwn(o,f)){o[f]=g;continue}if(!M(o[f],g))throw new Error(`ParallelWorkflow detected conflicting updates for state key "${f}".`)}}let l={...a,...o},i=l;return r.length>0&&(i.agentExecutionContext={...t.agentExecutionContext,messages:[...t.agentExecutionContext.messages,...r]}),s.length&&(i.outputMessage=s.join(`
3
3
 
4
4
  `)),n.length&&(i.summary=n.join(`
5
5
 
@@ -1,2 +1,2 @@
1
1
  /* COPYRIGHT Esri - https://js.arcgis.com/5.2/LICENSE.txt */
2
- import{a as p}from"./SYEI4BB2.js";function f(r,e,o){return{name:r,handler:async(a,t)=>{let n=async l=>{let u=await e.beforeAgent?.(l),w=u?{...l,state:{...l.state,...u}}:l,i=await t(w),d=await e.afterAgent?.({...w,result:i});return d?{...i,...d}:i};return e.wrapAgent?await e.wrapAgent(a,n):await n(a)},hooks:e,outputKey:o?.outputKey}}function M(r,e,o){return{name:r,handler:async(a,t)=>e.wrapToolCall?await e.wrapToolCall(a,t):await t(a),outputKey:o?.outputKey}}function y(r){return r.map(e=>s(e.name,e.hooks??{})).filter(e=>!!e)}function s(r,e){let{afterModel:o,beforeModel:a,wrapModelCall:t,wrapToolCall:n}=e;if(!(!o&&!a&&!t&&!n))return p({afterModel:o,beforeModel:a,name:r,wrapModelCall:t,wrapToolCall:n})}export{f as a,M as b,y as c};
2
+ import{a as p}from"./ICYUPLZM.js";function f(r,e,o){return{name:r,handler:async(a,t)=>{let n=async l=>{let u=await e.beforeAgent?.(l),w=u?{...l,state:{...l.state,...u}}:l,i=await t(w),d=await e.afterAgent?.({...w,result:i});return d?{...i,...d}:i};return e.wrapAgent?await e.wrapAgent(a,n):await n(a)},hooks:e,outputKey:o?.outputKey}}function M(r,e,o){return{name:r,handler:async(a,t)=>e.wrapToolCall?await e.wrapToolCall(a,t):await t(a),outputKey:o?.outputKey}}function y(r){return r.map(e=>s(e.name,e.hooks??{})).filter(e=>!!e)}function s(r,e){let{afterModel:o,beforeModel:a,wrapModelCall:t,wrapToolCall:n}=e;if(!(!o&&!a&&!t&&!n))return p({afterModel:o,beforeModel:a,name:r,wrapModelCall:t,wrapToolCall:n})}export{f as a,M as b,y as c};