@arcgis/ai-components 6.0.0-next.0 → 6.0.0-next.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/agent-utils/LLMAgent.d.ts +9 -2
- package/dist/agent-utils/LLMAgent.js +45 -36
- package/dist/agent-utils/tools/FunctionTool.d.ts +12 -1
- package/dist/agent-utils/tools/FunctionTool.js +15 -14
- package/dist/agent-utils/tools/MCPToolProvider.d.ts +54 -0
- package/dist/agent-utils/tools/MCPToolProvider.js +120 -0
- package/dist/agent-utils/tools/ToolProvider.d.ts +13 -0
- package/dist/agent-utils/tools/WebMCPToolProvider.d.ts +37 -0
- package/dist/agent-utils/tools/WebMCPToolProvider.js +71 -0
- package/dist/agents/tools/query/getAttribute/adapter.js +28 -24
- package/dist/agents/tools/query/getStatistics/adapter.js +70 -66
- package/dist/agents/tools/query/getTopFeatures/adapter.js +74 -70
- package/dist/agents/tools/query/queryFeatures/adapter.js +40 -36
- package/dist/cdn/{3HV6OXCZ.js → 24TK55FP.js} +1 -1
- package/dist/cdn/{4OLV5LA7.js → 2DWN3SKH.js} +1 -1
- package/dist/cdn/2O52MJ3D.js +2 -0
- package/dist/cdn/2UDDCWNW.js +2 -0
- package/dist/cdn/5FDBJI24.js +5 -0
- package/dist/cdn/5LA77ZBW.js +2 -0
- package/dist/cdn/{SBIYXWXZ.js → 5REENYPV.js} +1 -1
- package/dist/cdn/{V6AQFRUC.js → 5TW2NFES.js} +1 -1
- package/dist/cdn/{RBRHDEOB.js → 66VWTARH.js} +1 -1
- package/dist/cdn/6E6T6U7W.js +2 -0
- package/dist/cdn/{KKXOSV62.js → 6PK2UPG3.js} +1 -1
- package/dist/cdn/{OFM2S6U7.js → 6WYVG3JI.js} +1 -1
- package/dist/cdn/7HVIVV3O.js +2 -0
- package/dist/cdn/{U53SVXZK.js → 7MCFHVEH.js} +1 -1
- package/dist/cdn/{XI4BPYGB.js → 7X22QXJP.js} +1 -1
- package/dist/cdn/{EU6YSCZL.js → 7ZTYHZIN.js} +1 -1
- package/dist/cdn/A22375P3.js +2 -0
- package/dist/cdn/{2XXM52PS.js → AMP43OT2.js} +1 -1
- package/dist/cdn/{TTPTZBCM.js → AMURN3LO.js} +1 -1
- package/dist/cdn/AO2G4EXA.js +2 -0
- package/dist/cdn/{6GQCLDLJ.js → AQF6BBWC.js} +1 -1
- package/dist/cdn/AWPLRVPS.js +2 -0
- package/dist/cdn/{W3ZLMBEE.js → BBB5EJUB.js} +1 -1
- package/dist/cdn/{Q6PCXSZT.js → BMPBJXD7.js} +1 -1
- package/dist/cdn/{ZBRZU4XB.js → C67KQCPS.js} +1 -1
- package/dist/cdn/C76HLPKU.js +2 -0
- package/dist/cdn/{FFWPUYGD.js → CDS2HGQY.js} +1 -1
- package/dist/cdn/CHHC6YNW.js +2 -0
- package/dist/cdn/DBRBT54R.js +2 -0
- package/dist/cdn/{NN6MELJ7.js → DGCWQYN3.js} +1 -1
- package/dist/cdn/{IEAHAC6B.js → DI3VGUJY.js} +1 -1
- package/dist/cdn/{B4C7NIB5.js → DJG6DBCU.js} +2 -2
- package/dist/cdn/DJKEGIQZ.js +2 -0
- package/dist/cdn/{T2FKFOHE.js → DZOQFEOB.js} +1 -1
- package/dist/cdn/{AMFZY5QK.js → EEHDAYOG.js} +1 -1
- package/dist/cdn/{YO3L3XIH.js → EG5BMYZO.js} +1 -1
- package/dist/cdn/EGSD465U.js +2 -0
- package/dist/cdn/{ZMMUAYDN.js → EXLDRGUC.js} +1 -1
- package/dist/cdn/{WVMQ3I6F.js → FBARYPZ7.js} +1 -1
- package/dist/cdn/{M7TMD2HP.js → FJV7CI7O.js} +1 -1
- package/dist/cdn/{TRZJYWEB.js → FSLPYC4Y.js} +2 -2
- package/dist/cdn/{W6TS2TIE.js → GBFRJF4F.js} +1 -1
- package/dist/cdn/{7DRHB24Z.js → GHFOAS7T.js} +1 -1
- package/dist/cdn/HC5DJL2U.js +3 -0
- package/dist/cdn/HLWG7OIR.js +2 -0
- package/dist/cdn/{V7ERVXIO.js → HSMAXOOA.js} +1 -1
- package/dist/cdn/HWIM4KWF.js +2 -0
- package/dist/cdn/{VVWKEN53.js → JEWJ4M25.js} +1 -1
- package/dist/cdn/{I5OBL24F.js → JFL5IWPK.js} +1 -1
- package/dist/cdn/JUPTVXLY.js +2 -0
- package/dist/cdn/{B2JRBDJZ.js → JZPPP4QY.js} +1 -1
- package/dist/cdn/KKWCHNYQ.js +2 -0
- package/dist/cdn/{I7PHDOEQ.js → KX6CZEVZ.js} +1 -1
- package/dist/cdn/{XJUYG2M3.js → KY7M4WHO.js} +1 -1
- package/dist/cdn/L5IPMRHC.js +2 -0
- package/dist/cdn/M2G44RTS.js +2 -0
- package/dist/cdn/{H7WJUUJT.js → M6JQGHCE.js} +1 -1
- package/dist/cdn/MB7SEHPZ.js +2 -0
- package/dist/cdn/MC2V5WT3.js +2 -0
- package/dist/cdn/{ZBBI5M2X.js → MD2FTKQT.js} +1 -1
- package/dist/cdn/{645SDZBB.js → MPQ2OZXN.js} +1 -1
- package/dist/cdn/MZFWD5CQ.js +2 -0
- package/dist/cdn/{7OQA4GCM.js → NHWT7CXX.js} +1 -1
- package/dist/cdn/NMFEXE4D.js +2 -0
- package/dist/cdn/{MQSOVP27.js → NPV4MEAZ.js} +1 -1
- package/dist/cdn/{ENVTUTY6.js → OGZFST2A.js} +1 -1
- package/dist/cdn/P4CHI7W3.js +9 -0
- package/dist/cdn/{TPMZRJEC.js → PCAMBPOA.js} +1 -1
- package/dist/cdn/{O62IJLTZ.js → PGH7POKS.js} +1 -1
- package/dist/cdn/{37EJSNE3.js → PGUEODFA.js} +1 -1
- package/dist/cdn/{QJOO6IIX.js → QEGO4B2W.js} +1 -1
- package/dist/cdn/{FXRZCD5Y.js → QT3B5K4R.js} +1 -1
- package/dist/cdn/{2FUTKTNO.js → RE7MJTEF.js} +1 -1
- package/dist/cdn/RF6HWZMB.js +2 -0
- package/dist/cdn/{DWMZ23QK.js → RFDMNYTA.js} +1 -1
- package/dist/cdn/{OJP56R5R.js → RFPTOFM4.js} +1 -1
- package/dist/cdn/RKURZ5T2.js +2 -0
- package/dist/cdn/SJ4UMNIS.js +2 -0
- package/dist/cdn/{U3ZTF2BC.js → SWXUQFB6.js} +1 -1
- package/dist/cdn/{KJZVYKWL.js → T3SCINN5.js} +1 -1
- package/dist/cdn/{W3OJTTVX.js → TENUVOFJ.js} +1 -1
- package/dist/cdn/{UPSFL6U3.js → TJBU5BQK.js} +1 -1
- package/dist/cdn/UOKYHQNO.js +2 -0
- package/dist/cdn/UQRBY7ID.js +11 -0
- package/dist/cdn/{ZS5P7NRI.js → USPB2QBX.js} +1 -1
- package/dist/cdn/{ZKDCEL6K.js → UYP5PH5E.js} +1 -1
- package/dist/cdn/V6EX4YCY.js +2 -0
- package/dist/cdn/VA4M72JC.js +2 -0
- package/dist/cdn/VQ67NANV.js +2 -0
- package/dist/cdn/{2ZH5JNHL.js → X5ET73QZ.js} +1 -1
- package/dist/cdn/{DXCDVRGL.js → XC3T3Z5R.js} +1 -1
- package/dist/cdn/{J37GSI7C.js → XCLICBG7.js} +1 -1
- package/dist/cdn/XEJFVUNQ.js +2 -0
- package/dist/cdn/{EXIA3APU.js → XWNZMKQF.js} +1 -1
- package/dist/cdn/{UYEF3IKE.js → YBWRFVA6.js} +1 -1
- package/dist/cdn/YI6NIHNI.js +14 -0
- package/dist/cdn/{MHUEU6MR.js → YJXRCO4T.js} +1 -1
- package/dist/cdn/{2GSHUAQ2.js → YPLPDUMB.js} +1 -1
- package/dist/cdn/{YOQCQAKT.js → ZKWXHSEQ.js} +1 -1
- package/dist/cdn/{HWNPZ4CF.js → ZSLHB6MF.js} +1 -1
- package/dist/cdn/agent-utils/BaseAgent.js +1 -1
- package/dist/cdn/agent-utils/FunctionAgent.js +1 -1
- package/dist/cdn/agent-utils/LLMAgent.js +1 -1
- package/dist/cdn/agent-utils/SkillAgent.js +1 -1
- package/dist/cdn/agent-utils/WorkflowAgent.js +1 -1
- package/dist/cdn/agent-utils/createSchema.js +1 -1
- package/dist/cdn/agent-utils/middlewares/humanInTheLoop.js +1 -1
- package/dist/cdn/agent-utils/middlewares/middleware.js +1 -1
- package/dist/cdn/agent-utils/middlewares/trace.js +1 -1
- package/dist/cdn/agent-utils/tools/FunctionTool.js +1 -1
- package/dist/cdn/agent-utils/tools/MCPToolProvider.js +15 -0
- package/dist/cdn/agent-utils/tools/WebMCPToolProvider.js +2 -0
- package/dist/cdn/agent-utils/workflows/ConditionalWorkflow.js +1 -1
- package/dist/cdn/agent-utils/workflows/LoopWorkflow.js +1 -1
- package/dist/cdn/agent-utils/workflows/ParallelWorkflow.js +1 -1
- package/dist/cdn/agent-utils/workflows/RouterWorkflow.js +1 -1
- package/dist/cdn/agent-utils/workflows/SequentialWorkflow.js +1 -1
- package/dist/cdn/agent-utils/workflows/SwitchWorkflow.js +1 -1
- package/dist/cdn/index.js +1 -1
- package/dist/cdn/orchestrator/embeddings/getEmbeddings.js +1 -1
- package/dist/cdn/orchestrator/models/chatModel.js +1 -1
- package/dist/cdn/orchestrator/models/prompts.js +1 -1
- package/dist/cdn/orchestrator/state/runtime.js +1 -1
- package/dist/chunks/converterUtils.js +65 -109
- package/dist/chunks/resolveFieldNames.js +9 -0
- package/dist/components/arcgis-assistant-message-log/customElement.js +4 -5
- package/dist/components/arcgis-assistant-message-log/index.js +5 -0
- package/dist/components/arcgis-assistant-message-text/customElement.js +10 -11
- package/dist/components/arcgis-assistant-message-text/index.js +5 -0
- package/dist/components/arcgis-assistant-user-message/customElement.js +7 -8
- package/dist/components/arcgis-assistant-user-message/index.js +5 -0
- package/dist/docs/api.json +1 -1
- package/dist/docs/docs.json +1 -1
- package/package.json +8 -5
- package/dist/cdn/25CQLMB4.js +0 -2
- package/dist/cdn/34HKOU3T.js +0 -2
- package/dist/cdn/3WS4DSWD.js +0 -2
- package/dist/cdn/43OJZMBB.js +0 -2
- package/dist/cdn/4BRIOLDJ.js +0 -2
- package/dist/cdn/4ZPGFIE2.js +0 -2
- package/dist/cdn/6JCDY4FL.js +0 -2
- package/dist/cdn/7GQCNR4P.js +0 -11
- package/dist/cdn/A3KIOUWB.js +0 -2
- package/dist/cdn/BKKLQUK2.js +0 -2
- package/dist/cdn/DQRKGYR3.js +0 -2
- package/dist/cdn/EOSKJPQV.js +0 -2
- package/dist/cdn/F7VQ3WH2.js +0 -2
- package/dist/cdn/FBIPIDP7.js +0 -2
- package/dist/cdn/GOET2CH4.js +0 -2
- package/dist/cdn/ISDNOFHU.js +0 -3
- package/dist/cdn/JZS6ZSWH.js +0 -2
- package/dist/cdn/KEBMHD4R.js +0 -9
- package/dist/cdn/KPHHXMRK.js +0 -2
- package/dist/cdn/LVSIZRTB.js +0 -2
- package/dist/cdn/QQPVN5MG.js +0 -2
- package/dist/cdn/REE4K4J7.js +0 -2
- package/dist/cdn/RFKOCMMT.js +0 -2
- package/dist/cdn/RKHDRUX5.js +0 -2
- package/dist/cdn/TGI7QCB2.js +0 -2
- package/dist/cdn/UALF45Q2.js +0 -2
- package/dist/cdn/WB5AFS42.js +0 -2
- package/dist/cdn/WC6SHIEX.js +0 -2
- package/dist/cdn/XPSPAZUD.js +0 -2
- package/dist/cdn/YAUQJ6NV.js +0 -2
- package/dist/cdn/YD3DLETZ.js +0 -2
- package/dist/cdn/YKKIJTJY.js +0 -2
- package/dist/cdn/ZCNCYKXW.js +0 -14
- package/dist/cdn/ZESTW6HJ.js +0 -2
|
@@ -1,2 +1,2 @@
|
|
|
1
1
|
/* COPYRIGHT Esri - https://js.arcgis.com/5.2/LICENSE.txt */
|
|
2
|
-
import{b as W,c as M}from"./GMZUN5SF.js";import"./OVIQ5NSE.js";import"./QUZTFUWM.js";import{a as B}from"./NN6MELJ7.js";import"./DYSPEU7W.js";import{c as V}from"./U53SVXZK.js";import{B as D,w as R}from"./2FUTKTNO.js";import"./R74ZHFA6.js";import{a as z}from"./ZESTW6HJ.js";import"./IEAHAC6B.js";import"./VIJVRJHL.js";import{a as U}from"./DQRKGYR3.js";import"./OJP56R5R.js";import"./Q6PCXSZT.js";import{a as H}from"./7DRHB24Z.js";import{a as F}from"./OFM2S6U7.js";import{a as $,b as G}from"./V6AQFRUC.js";import{e as L}from"./FFWPUYGD.js";import{S as J,s as q}from"./QJOO6IIX.js";import{a as E}from"./AMFZY5QK.js";import"./EXIA3APU.js";import"./TRZJYWEB.js";import{o as c}from"./2XXM52PS.js";import"./2UKFCF2J.js";import"./UZLQALHY.js";export default $arcgis.t(([oe,se,S,C,{property:a,subclass:l}])=>{var ne=Object.defineProperty,ie=Object.getOwnPropertyDescriptor,f=(e,t,r,s)=>{for(var o=s>1?void 0:s?ie(t,r):t,n=e.length-1,i;n>=0;n--)(i=e[n])&&(o=(s?i(t,r,o):i(o))||o);return s&&o&&ne(t,r,o),o},d=class extends C{constructor(e){super(e)}static fromJSON(e){return new d({id:e.id,sourceAnchorId:e.source_anchor_id,sourceNodeId:e.source_node_id,targetAnchorId:e.target_anchor_id,targetNodeId:e.target_node_id})}};f([a()],d.prototype,"id",2);f([a()],d.prototype,"sourceAnchorId",2);f([a()],d.prototype,"sourceNodeId",2);f([a()],d.prototype,"targetAnchorId",2);f([a()],d.prototype,"targetNodeId",2);d=f([l("Edge")],d);var ae=Object.defineProperty,ce=Object.getOwnPropertyDescriptor,I=(e,t,r,s)=>{for(var o=s>1?void 0:s?ce(t,r):t,n=e.length-1,i;n>=0;n--)(i=e[n])&&(o=(s?i(t,r,o):i(o))||o);return s&&o&&ae(t,r,o),o},p=class extends C{constructor(e){super(e)}async load(){return await Promise.resolve(this)}compile(e){return{runtimeNode:this.createRuntimeNode(),edges:e.outgoingEdges.map(t=>({from:this.id,to:t.targetNodeId}))}}static fromJSON(e){throw new Error("BaseNode is abstract and cannot be instantiated directly.")}};I([a()],p.prototype,"id",2);I([a()],p.prototype,"label",2);I([a()],p.prototype,"type",2);p=I([l("BaseNode")],p);var de=Object.defineProperty,pe=Object.getOwnPropertyDescriptor,j=(e,t,r,s)=>{for(var o=s>1?void 0:s?pe(t,r):t,n=e.length-1,i;n>=0;n--)(i=e[n])&&(o=(s?i(t,r,o):i(o))||o);return s&&o&&de(t,r,o),o},ue=e=>e.replace(/_([a-z])/gu,(t,r)=>r.toUpperCase()),h=class extends C{constructor(e){super(e),this.type="arcgis-tool"}async createRuntimeTools(){if(!this.name)throw new Error("ArcgisTool name is required");return[await U(ue(this.name))]}static fromJSON(e){return new h({name:e.name,requireApproval:e.require_approval})}};j([a()],h.prototype,"name",2);j([a()],h.prototype,"requireApproval",2);j([a()],h.prototype,"type",2);h=j([l("ArcgisTool")],h);var me=Object.defineProperty,he=Object.getOwnPropertyDescriptor,K=e=>{throw TypeError(e)},y=(e,t,r,s)=>{for(var o=s>1?void 0:s?he(t,r):t,n=e.length-1,i;n>=0;n--)(i=e[n])&&(o=(s?i(t,r,o):i(o))||o);return s&&o&&me(t,r,o),o},le=(e,t,r)=>t.has(e)||K("Cannot "+r),ge=(e,t,r)=>t.has(e)?K("Cannot add the same private member more than once"):t instanceof WeakSet?t.add(e):t.set(e,r),fe=(e,t,r)=>(le(e,t,"access private method"),r),x,Q,u=class extends p{constructor(e){super(e),ge(this,x),this.type="agent-node"}createRuntimeNode(){let e;return async(t,r)=>{e??=fe(this,x,Q).call(this);let s=await(await e).run(t,r),o=this.outputSchema?.safeParse(s);if(o&&!o.success)throw o.error;let n=o?.data,i=n??s.outputMessage;return{agentExecutionContext:s.agentExecutionContext,...n?{}:{outputMessage:s.outputMessage},status:s.status,summary:s.summary,nodes:{[this.id]:{output:i}}}}}compile(e){let t=e.outgoingEdges[0]?.targetNodeId;return{runtimeNode:this.createRuntimeNode(),edges:[{from:this.id,decide:r=>r.status==="failed"?void 0:t}],schemas:[c.object({output:this.outputSchema??c.string()})]}}static fromJSON(e){let t=new u({id:e.id,label:e.label,prompt:e.prompt?.content,type:"agent-node",modelTier:e.llm_model?.model_tier});return e.structured_output&&(t.outputSchema=B(e.structured_output)),t.tools=e.tools?.filter(r=>r.type==="arcgis_tool").map(r=>h.fromJSON(r)),t}};x=new WeakSet;Q=async function(){let e=this.prompt;if(!e?.trim())throw new Error(`WebAgent agent node "${this.id}" requires a prompt.`);let t=[];if(this.tools)for(let r of this.tools){let s=await r.createRuntimeTools();t.push(...s)}return new z({name:this.id,outputSchema:this.outputSchema,modelTier:this.modelTier,prompt:e,tools:t})};y([a()],u.prototype,"type",2);y([a()],u.prototype,"prompt",2);y([a()],u.prototype,"outputSchema",2);y([a()],u.prototype,"tools",2);y([a()],u.prototype,"modelTier",2);u=y([l("AgentNode")],u);var ye=Object.defineProperty,we=Object.getOwnPropertyDescriptor,T=(e,t,r,s)=>{for(var o=s>1?void 0:s?we(t,r):t,n=e.length-1,i;n>=0;n--)(i=e[n])&&(o=(s?i(t,r,o):i(o))||o);return s&&o&&ye(t,r,o),o},g=class extends p{constructor(e){super(e),this.type="end-message-node"}createRuntimeNode(){return async e=>{let t=await E.fromTemplate(this.message,{templateFormat:"mustache"}).format(e);return{outputMessage:t,status:"success",summary:t}}}compile(e){return{runtimeNode:this.createRuntimeNode(),edges:[]}}static fromJSON(e){let t=new g({id:e.id,label:e.label,type:"end-message-node"});return t.message=e.message,t}};T([a()],g.prototype,"type",2);T([a()],g.prototype,"message",2);g=T([l("EndMessageNode")],g);var be=Object.defineProperty,Ne=Object.getOwnPropertyDescriptor,X=e=>{throw TypeError(e)},N=(e,t,r,s)=>{for(var o=s>1?void 0:s?Ne(t,r):t,n=e.length-1,i;n>=0;n--)(i=e[n])&&(o=(s?i(t,r,o):i(o))||o);return s&&o&&be(t,r,o),o},Oe=(e,t,r)=>t.has(e)||X("Cannot "+r),Se=(e,t,r)=>t.has(e)?X("Cannot add the same private member more than once"):t instanceof WeakSet?t.add(e):t.set(e,r),Z=(e,t,r)=>(Oe(e,t,"access private method"),r),v,Y,ee,m=class extends p{constructor(e){super(e),Se(this,v),this.type="human-in-the-loop-node",this.conditions=[]}createRuntimeNode(){return async(e,t)=>{let r=ve(t,this.id),s=`${r}:${this.id}`,o=V(t);if(o===void 0||!Ie(o,this.response?.type))throw new q({agentId:r,id:s,kind:_e(this.response?.type),message:await Z(this,v,Y).call(this,e),metadata:Z(this,v,ee).call(this,e)});return{nodes:{[this.id]:{output:o}}}}}compile(e){return{runtimeNode:this.createRuntimeNode(),edges:[{from:this.id,decide:t=>{if(!this.conditions.length)return e.outgoingEdges[0]?.targetNodeId;let r=t.nodes?.[this.id]?.output,s=je(r),o=this.conditions.find(n=>n.outcome===s);if(o)return e.outgoingEdges.find(n=>n.sourceAnchorId===o.sourceAnchorId)?.targetNodeId}}]}}static fromJSON(e){let t=new m({id:e.id,label:e.label,type:"human-in-the-loop-node"});return t.message=e.message,t.response=e.response,t.conditions=e.conditions.map(({outcome:r,source_anchor_id:s})=>({outcome:r,sourceAnchorId:s})),t}};v=new WeakSet;Y=async function(e){if(this.message?.source==="generated")throw new Error(`Human-in-the-loop node "${this.id}" does not support generated messages yet.`);let t=this.message?.content;if(!t)throw new Error(`Human-in-the-loop node "${this.id}" requires a message content.`);return await E.fromTemplate(t,{templateFormat:"mustache"}).format(e)};ee=function(e){let t=this.response;if(!t||t.type==="confirmation"||t.type==="textInput")return;let r=t.choices;return r?.source==="fixed"?r.items?.map(s=>s.value??s.label??""):r?.source==="reference"?Ae(e,r.reference)?.map(String):void 0};N([a()],m.prototype,"type",2);N([a()],m.prototype,"message",2);N([a()],m.prototype,"response",2);N([a()],m.prototype,"conditions",2);m=N([l("HumanInTheLoopNode")],m);function ve(e,t){let r=e?.configurable?.agentId;return typeof r=="string"&&r?r:t}function _e(e){switch(e){case"singleSelect":return"singleSelection";case"multipleSelect":return"multipleSelection";case"textInput":return"textInput";default:return"booleanChoice"}}function Ie(e,t){switch(t){case"confirmation":return typeof e=="boolean";case"singleSelect":return typeof e=="string"||Array.isArray(e)&&e.length===1&&typeof e[0]=="string";case"multipleSelect":return Array.isArray(e)&&e.every(r=>typeof r=="string");case"textInput":return typeof e=="string";default:return!0}}function je(e){return e===!1?"dismissed":"confirmed"}function Ae(e,t){if(!t)return;let r=t.split(".").reduce((s,o)=>{if(s&&typeof s=="object"&&o in s)return s[o]},e);return Array.isArray(r)?r:typeof r=="string"?[r]:void 0}var Ee=Object.defineProperty,Je=Object.getOwnPropertyDescriptor,te=(e,t,r,s)=>{for(var o=s>1?void 0:s?Je(t,r):t,n=e.length-1,i;n>=0;n--)(i=e[n])&&(o=(s?i(t,r,o):i(o))||o);return s&&o&&Ee(t,r,o),o},b=class extends p{constructor(e){super(e),this.type="start-node"}createRuntimeNode(){return e=>({question:e.agentExecutionContext.userRequest})}static fromJSON(e){return new b({id:e.id,label:e.label,type:"start-node"})}};te([a()],b.prototype,"type",2);b=te([l("StartNode")],b);function xe(e){switch(e.type){case"agent_node":return u.fromJSON(e);case"end_message_node":return g.fromJSON(e);case"human_input_node":return m.fromJSON(e);case"start_node":return b.fromJSON(e);default:throw new Error(`WebAgent node "${e.id}" uses unsupported type "${e.type}".`)}}function Pe(e={}){let t=Object.keys(e);if($(t),t.includes("nodes"))throw new Error("node state cannot define reserved field: nodes.");let r=G(e);return J.Root({...r,nodes:J({reducer:(s,o)=>({...s,...o}),default:()=>({})}),...L()})}function re(e,t={}){let r=new Set;for(let o of e)for(let n of Object.keys(o.shape??{}))n!=="nodes"&&r.add(n);let s=Object.fromEntries([...r].map(o=>[o,t[o]]));for(let[o,n]of Object.entries(t))s[o]=n;return Pe(s)}var P=class e{constructor(t,r,s){this.sourceJSON=t,this.edges=r,this.nodes=s,this._loaded=!1}static fromJSON(t){return new e(t,t.graph.edges.map(r=>d.fromJSON(r)),t.graph.nodes.map(r=>xe(r)))}async load(){return this._loadPromise??=Promise.all(this.nodes.map(async t=>await t.load())).then(()=>{this._loaded=!0}),await this._loadPromise,this}getSchemas(){let t=Object.fromEntries(this._getNodeCompilations().flatMap((r,s)=>{let o=this.nodes[s];return r.schemas?.map(n=>[o.id,n])??[]}));return[c.object({loopCounts:c.record(c.string(),c.number()).optional(),nodes:c.object(t).partial().optional(),question:c.string().optional(),variables:this._getVariablesSchema()})]}generate(){this._assertLoaded(),this._nodeCompilations=void 0;let t=this._getNodeCompilations(),r=Object.fromEntries(this.sourceJSON.variables.map(({key:w,value:A})=>[w,A])),s=re(this.getSchemas(),{variables:r}),o=this.nodes.find(w=>w.type==="start-node")?.id,n={},i=[];for(let[w,A]of this.nodes.entries()){let O=t[w];O&&(O.runtimeNode&&(n[A.id]=O.runtimeNode),i.push(...O.edges))}return{createGraph:()=>H(n,i,s,{entryNode:o}),workspace:s}}_assertLoaded(){if(!this._loaded)throw new Error("AgenticWorkflowRuntime must be loaded before it can generate a graph.")}_getNodeCompilations(){return this._assertLoaded(),this._nodeCompilations??=this.nodes.map(t=>t.compile({outgoingEdges:this.edges.filter(r=>r.sourceNodeId===t.id)}))}_getVariablesSchema(){return c.object(Object.fromEntries(this.sourceJSON.variables.map(({key:t})=>[t,c.unknown()])))}},_=class extends F{constructor(t){super(),this._createUnloadedGraph=()=>{throw new Error("WebAgent must be loaded before it can run.")},Object.assign(this,t)}async load(){if(this.portalItem){try{await this.portalItem.load()}catch(s){throw new S("web-agent:load-portal-item","Failed to load portal item",{error:s})}let r=await this.portalItem.fetchData();if(this.sourceJSON=r,!this.portalItem.title)throw new S("web-agent:missing-title","The portal item is missing a title")}if(!this.sourceJSON)throw new S("web-agent:missing-source-json","The source JSON is missing");if(!this.sourceJSON.description)throw new S("web-agent:missing-description","The source JSON is missing a description");let t=P.fromJSON(this.sourceJSON);return await t.load(),this._runtime=t,this.description=this.sourceJSON.description,this.name=this.portalItem?.title??`web-agent-${Date.now()}`,this.generate(),this}generate(){if(!this._runtime){this.workspace=re([]),this.createGraph=this._createUnloadedGraph;return}let{createGraph:t,workspace:r}=this._runtime.generate();this.workspace=r,this.createGraph=t}},k=class extends R{static{this.properties={agent:0,context:0,itemId:1,workflow:0}}#e;async getContext(){return W(this.context)?await this.context():this.context}async load(){let t;if(this.itemId){let r=se.getDefault();t=new _({portalItem:new oe({id:this.itemId,portal:r})})}else this.workflow&&(t=new _({sourceJSON:this.workflow}));if(t&&(await t.load(),this.agent=t),!this.agent)throw new Error("Failed to initialize the assistant agent because the agent registration is missing.");this.#e=M(this)}disconnectedCallback(){this.#e?.unregister(this.agent.id),super.disconnectedCallback()}};D("arcgis-assistant-agent",k);return k},"portal/PortalItem","portal/Portal","core/Error","core/Accessor","core/accessorSupport/decorators")
|
|
2
|
+
import{b as W,c as M}from"./GMZUN5SF.js";import"./OVIQ5NSE.js";import"./QUZTFUWM.js";import{a as B}from"./DGCWQYN3.js";import"./DYSPEU7W.js";import{c as V}from"./7MCFHVEH.js";import{C as D,x as R}from"./RE7MJTEF.js";import"./R74ZHFA6.js";import{a as z}from"./2O52MJ3D.js";import"./DI3VGUJY.js";import"./VIJVRJHL.js";import{a as U}from"./C76HLPKU.js";import"./RFPTOFM4.js";import"./BMPBJXD7.js";import{a as H}from"./GHFOAS7T.js";import{a as F}from"./6WYVG3JI.js";import{a as $,b as G}from"./5TW2NFES.js";import{e as L}from"./CDS2HGQY.js";import{S as J,s as q}from"./QEGO4B2W.js";import{a as E}from"./EEHDAYOG.js";import"./XWNZMKQF.js";import"./FSLPYC4Y.js";import{N as c}from"./AMP43OT2.js";import"./2UKFCF2J.js";import"./UZLQALHY.js";export default $arcgis.t(([oe,se,S,C,{property:a,subclass:l}])=>{var ne=Object.defineProperty,ie=Object.getOwnPropertyDescriptor,f=(e,t,r,s)=>{for(var o=s>1?void 0:s?ie(t,r):t,n=e.length-1,i;n>=0;n--)(i=e[n])&&(o=(s?i(t,r,o):i(o))||o);return s&&o&&ne(t,r,o),o},d=class extends C{constructor(e){super(e)}static fromJSON(e){return new d({id:e.id,sourceAnchorId:e.source_anchor_id,sourceNodeId:e.source_node_id,targetAnchorId:e.target_anchor_id,targetNodeId:e.target_node_id})}};f([a()],d.prototype,"id",2);f([a()],d.prototype,"sourceAnchorId",2);f([a()],d.prototype,"sourceNodeId",2);f([a()],d.prototype,"targetAnchorId",2);f([a()],d.prototype,"targetNodeId",2);d=f([l("Edge")],d);var ae=Object.defineProperty,ce=Object.getOwnPropertyDescriptor,I=(e,t,r,s)=>{for(var o=s>1?void 0:s?ce(t,r):t,n=e.length-1,i;n>=0;n--)(i=e[n])&&(o=(s?i(t,r,o):i(o))||o);return s&&o&&ae(t,r,o),o},p=class extends C{constructor(e){super(e)}async load(){return await Promise.resolve(this)}compile(e){return{runtimeNode:this.createRuntimeNode(),edges:e.outgoingEdges.map(t=>({from:this.id,to:t.targetNodeId}))}}static fromJSON(e){throw new Error("BaseNode is abstract and cannot be instantiated directly.")}};I([a()],p.prototype,"id",2);I([a()],p.prototype,"label",2);I([a()],p.prototype,"type",2);p=I([l("BaseNode")],p);var de=Object.defineProperty,pe=Object.getOwnPropertyDescriptor,j=(e,t,r,s)=>{for(var o=s>1?void 0:s?pe(t,r):t,n=e.length-1,i;n>=0;n--)(i=e[n])&&(o=(s?i(t,r,o):i(o))||o);return s&&o&&de(t,r,o),o},ue=e=>e.replace(/_([a-z])/gu,(t,r)=>r.toUpperCase()),h=class extends C{constructor(e){super(e),this.type="arcgis-tool"}async createRuntimeTools(){if(!this.name)throw new Error("ArcgisTool name is required");return[await U(ue(this.name))]}static fromJSON(e){return new h({name:e.name,requireApproval:e.require_approval})}};j([a()],h.prototype,"name",2);j([a()],h.prototype,"requireApproval",2);j([a()],h.prototype,"type",2);h=j([l("ArcgisTool")],h);var me=Object.defineProperty,he=Object.getOwnPropertyDescriptor,K=e=>{throw TypeError(e)},y=(e,t,r,s)=>{for(var o=s>1?void 0:s?he(t,r):t,n=e.length-1,i;n>=0;n--)(i=e[n])&&(o=(s?i(t,r,o):i(o))||o);return s&&o&&me(t,r,o),o},le=(e,t,r)=>t.has(e)||K("Cannot "+r),ge=(e,t,r)=>t.has(e)?K("Cannot add the same private member more than once"):t instanceof WeakSet?t.add(e):t.set(e,r),fe=(e,t,r)=>(le(e,t,"access private method"),r),x,Q,u=class extends p{constructor(e){super(e),ge(this,x),this.type="agent-node"}createRuntimeNode(){let e;return async(t,r)=>{e??=fe(this,x,Q).call(this);let s=await(await e).run(t,r),o=this.outputSchema?.safeParse(s);if(o&&!o.success)throw o.error;let n=o?.data,i=n??s.outputMessage;return{agentExecutionContext:s.agentExecutionContext,...n?{}:{outputMessage:s.outputMessage},status:s.status,summary:s.summary,nodes:{[this.id]:{output:i}}}}}compile(e){let t=e.outgoingEdges[0]?.targetNodeId;return{runtimeNode:this.createRuntimeNode(),edges:[{from:this.id,decide:r=>r.status==="failed"?void 0:t}],schemas:[c.object({output:this.outputSchema??c.string()})]}}static fromJSON(e){let t=new u({id:e.id,label:e.label,prompt:e.prompt?.content,type:"agent-node",modelTier:e.llm_model?.model_tier});return e.structured_output&&(t.outputSchema=B(e.structured_output)),t.tools=e.tools?.filter(r=>r.type==="arcgis_tool").map(r=>h.fromJSON(r)),t}};x=new WeakSet;Q=async function(){let e=this.prompt;if(!e?.trim())throw new Error(`WebAgent agent node "${this.id}" requires a prompt.`);let t=[];if(this.tools)for(let r of this.tools){let s=await r.createRuntimeTools();t.push(...s)}return new z({name:this.id,outputSchema:this.outputSchema,modelTier:this.modelTier,prompt:e,tools:t})};y([a()],u.prototype,"type",2);y([a()],u.prototype,"prompt",2);y([a()],u.prototype,"outputSchema",2);y([a()],u.prototype,"tools",2);y([a()],u.prototype,"modelTier",2);u=y([l("AgentNode")],u);var ye=Object.defineProperty,we=Object.getOwnPropertyDescriptor,T=(e,t,r,s)=>{for(var o=s>1?void 0:s?we(t,r):t,n=e.length-1,i;n>=0;n--)(i=e[n])&&(o=(s?i(t,r,o):i(o))||o);return s&&o&&ye(t,r,o),o},g=class extends p{constructor(e){super(e),this.type="end-message-node"}createRuntimeNode(){return async e=>{let t=await E.fromTemplate(this.message,{templateFormat:"mustache"}).format(e);return{outputMessage:t,status:"success",summary:t}}}compile(e){return{runtimeNode:this.createRuntimeNode(),edges:[]}}static fromJSON(e){let t=new g({id:e.id,label:e.label,type:"end-message-node"});return t.message=e.message,t}};T([a()],g.prototype,"type",2);T([a()],g.prototype,"message",2);g=T([l("EndMessageNode")],g);var be=Object.defineProperty,Ne=Object.getOwnPropertyDescriptor,X=e=>{throw TypeError(e)},N=(e,t,r,s)=>{for(var o=s>1?void 0:s?Ne(t,r):t,n=e.length-1,i;n>=0;n--)(i=e[n])&&(o=(s?i(t,r,o):i(o))||o);return s&&o&&be(t,r,o),o},Oe=(e,t,r)=>t.has(e)||X("Cannot "+r),Se=(e,t,r)=>t.has(e)?X("Cannot add the same private member more than once"):t instanceof WeakSet?t.add(e):t.set(e,r),Z=(e,t,r)=>(Oe(e,t,"access private method"),r),v,Y,ee,m=class extends p{constructor(e){super(e),Se(this,v),this.type="human-in-the-loop-node",this.conditions=[]}createRuntimeNode(){return async(e,t)=>{let r=ve(t,this.id),s=`${r}:${this.id}`,o=V(t);if(o===void 0||!Ie(o,this.response?.type))throw new q({agentId:r,id:s,kind:_e(this.response?.type),message:await Z(this,v,Y).call(this,e),metadata:Z(this,v,ee).call(this,e)});return{nodes:{[this.id]:{output:o}}}}}compile(e){return{runtimeNode:this.createRuntimeNode(),edges:[{from:this.id,decide:t=>{if(!this.conditions.length)return e.outgoingEdges[0]?.targetNodeId;let r=t.nodes?.[this.id]?.output,s=je(r),o=this.conditions.find(n=>n.outcome===s);if(o)return e.outgoingEdges.find(n=>n.sourceAnchorId===o.sourceAnchorId)?.targetNodeId}}]}}static fromJSON(e){let t=new m({id:e.id,label:e.label,type:"human-in-the-loop-node"});return t.message=e.message,t.response=e.response,t.conditions=e.conditions.map(({outcome:r,source_anchor_id:s})=>({outcome:r,sourceAnchorId:s})),t}};v=new WeakSet;Y=async function(e){if(this.message?.source==="generated")throw new Error(`Human-in-the-loop node "${this.id}" does not support generated messages yet.`);let t=this.message?.content;if(!t)throw new Error(`Human-in-the-loop node "${this.id}" requires a message content.`);return await E.fromTemplate(t,{templateFormat:"mustache"}).format(e)};ee=function(e){let t=this.response;if(!t||t.type==="confirmation"||t.type==="textInput")return;let r=t.choices;return r?.source==="fixed"?r.items?.map(s=>s.value??s.label??""):r?.source==="reference"?Ae(e,r.reference)?.map(String):void 0};N([a()],m.prototype,"type",2);N([a()],m.prototype,"message",2);N([a()],m.prototype,"response",2);N([a()],m.prototype,"conditions",2);m=N([l("HumanInTheLoopNode")],m);function ve(e,t){let r=e?.configurable?.agentId;return typeof r=="string"&&r?r:t}function _e(e){switch(e){case"singleSelect":return"singleSelection";case"multipleSelect":return"multipleSelection";case"textInput":return"textInput";default:return"booleanChoice"}}function Ie(e,t){switch(t){case"confirmation":return typeof e=="boolean";case"singleSelect":return typeof e=="string"||Array.isArray(e)&&e.length===1&&typeof e[0]=="string";case"multipleSelect":return Array.isArray(e)&&e.every(r=>typeof r=="string");case"textInput":return typeof e=="string";default:return!0}}function je(e){return e===!1?"dismissed":"confirmed"}function Ae(e,t){if(!t)return;let r=t.split(".").reduce((s,o)=>{if(s&&typeof s=="object"&&o in s)return s[o]},e);return Array.isArray(r)?r:typeof r=="string"?[r]:void 0}var Ee=Object.defineProperty,Je=Object.getOwnPropertyDescriptor,te=(e,t,r,s)=>{for(var o=s>1?void 0:s?Je(t,r):t,n=e.length-1,i;n>=0;n--)(i=e[n])&&(o=(s?i(t,r,o):i(o))||o);return s&&o&&Ee(t,r,o),o},b=class extends p{constructor(e){super(e),this.type="start-node"}createRuntimeNode(){return e=>({question:e.agentExecutionContext.userRequest})}static fromJSON(e){return new b({id:e.id,label:e.label,type:"start-node"})}};te([a()],b.prototype,"type",2);b=te([l("StartNode")],b);function xe(e){switch(e.type){case"agent_node":return u.fromJSON(e);case"end_message_node":return g.fromJSON(e);case"human_input_node":return m.fromJSON(e);case"start_node":return b.fromJSON(e);default:throw new Error(`WebAgent node "${e.id}" uses unsupported type "${e.type}".`)}}function Pe(e={}){let t=Object.keys(e);if($(t),t.includes("nodes"))throw new Error("node state cannot define reserved field: nodes.");let r=G(e);return J.Root({...r,nodes:J({reducer:(s,o)=>({...s,...o}),default:()=>({})}),...L()})}function re(e,t={}){let r=new Set;for(let o of e)for(let n of Object.keys(o.shape??{}))n!=="nodes"&&r.add(n);let s=Object.fromEntries([...r].map(o=>[o,t[o]]));for(let[o,n]of Object.entries(t))s[o]=n;return Pe(s)}var P=class e{constructor(t,r,s){this.sourceJSON=t,this.edges=r,this.nodes=s,this._loaded=!1}static fromJSON(t){return new e(t,t.graph.edges.map(r=>d.fromJSON(r)),t.graph.nodes.map(r=>xe(r)))}async load(){return this._loadPromise??=Promise.all(this.nodes.map(async t=>await t.load())).then(()=>{this._loaded=!0}),await this._loadPromise,this}getSchemas(){let t=Object.fromEntries(this._getNodeCompilations().flatMap((r,s)=>{let o=this.nodes[s];return r.schemas?.map(n=>[o.id,n])??[]}));return[c.object({loopCounts:c.record(c.string(),c.number()).optional(),nodes:c.object(t).partial().optional(),question:c.string().optional(),variables:this._getVariablesSchema()})]}generate(){this._assertLoaded(),this._nodeCompilations=void 0;let t=this._getNodeCompilations(),r=Object.fromEntries(this.sourceJSON.variables.map(({key:w,value:A})=>[w,A])),s=re(this.getSchemas(),{variables:r}),o=this.nodes.find(w=>w.type==="start-node")?.id,n={},i=[];for(let[w,A]of this.nodes.entries()){let O=t[w];O&&(O.runtimeNode&&(n[A.id]=O.runtimeNode),i.push(...O.edges))}return{createGraph:()=>H(n,i,s,{entryNode:o}),workspace:s}}_assertLoaded(){if(!this._loaded)throw new Error("AgenticWorkflowRuntime must be loaded before it can generate a graph.")}_getNodeCompilations(){return this._assertLoaded(),this._nodeCompilations??=this.nodes.map(t=>t.compile({outgoingEdges:this.edges.filter(r=>r.sourceNodeId===t.id)}))}_getVariablesSchema(){return c.object(Object.fromEntries(this.sourceJSON.variables.map(({key:t})=>[t,c.unknown()])))}},_=class extends F{constructor(t){super(),this._createUnloadedGraph=()=>{throw new Error("WebAgent must be loaded before it can run.")},Object.assign(this,t)}async load(){if(this.portalItem){try{await this.portalItem.load()}catch(s){throw new S("web-agent:load-portal-item","Failed to load portal item",{error:s})}let r=await this.portalItem.fetchData();if(this.sourceJSON=r,!this.portalItem.title)throw new S("web-agent:missing-title","The portal item is missing a title")}if(!this.sourceJSON)throw new S("web-agent:missing-source-json","The source JSON is missing");if(!this.sourceJSON.description)throw new S("web-agent:missing-description","The source JSON is missing a description");let t=P.fromJSON(this.sourceJSON);return await t.load(),this._runtime=t,this.description=this.sourceJSON.description,this.name=this.portalItem?.title??`web-agent-${Date.now()}`,this.generate(),this}generate(){if(!this._runtime){this.workspace=re([]),this.createGraph=this._createUnloadedGraph;return}let{createGraph:t,workspace:r}=this._runtime.generate();this.workspace=r,this.createGraph=t}},k=class extends R{static{this.properties={agent:0,context:0,itemId:1,workflow:0}}#e;async getContext(){return W(this.context)?await this.context():this.context}async load(){let t;if(this.itemId){let r=se.getDefault();t=new _({portalItem:new oe({id:this.itemId,portal:r})})}else this.workflow&&(t=new _({sourceJSON:this.workflow}));if(t&&(await t.load(),this.agent=t),!this.agent)throw new Error("Failed to initialize the assistant agent because the agent registration is missing.");this.#e=M(this)}disconnectedCallback(){this.#e?.unregister(this.agent.id),super.disconnectedCallback()}};D("arcgis-assistant-agent",k);return k},"portal/PortalItem","portal/Portal","core/Error","core/Accessor","core/accessorSupport/decorators")
|
|
@@ -1,2 +1,2 @@
|
|
|
1
1
|
/* COPYRIGHT Esri - https://js.arcgis.com/5.2/LICENSE.txt */
|
|
2
|
-
import{o}from"./
|
|
2
|
+
import{N as o}from"./AMP43OT2.js";var r=o;export{r as a};
|
|
@@ -1,2 +1,2 @@
|
|
|
1
1
|
/* COPYRIGHT Esri - https://js.arcgis.com/5.2/LICENSE.txt */
|
|
2
|
-
import{a as
|
|
2
|
+
import{a as R}from"./ONQ6JSBJ.js";import{a as g}from"./FDOMMK2M.js";import{a as m}from"./RFPTOFM4.js";import{Ga as q}from"./FSLPYC4Y.js";import"./AMP43OT2.js";import"./2UKFCF2J.js";import"./UZLQALHY.js";export default $arcgis.t(([C,x])=>{var L=10,N=["string","small-integer","integer"],$=async(i,e,{includeSummaryStatistics:o=!0,includeUniqueValues:u=!0}={})=>{let r=null,a=null;try{if(e.type!=="geometry"&&e.type!=="oid"&&e.type!=="global-id"){o&&(r=await C({layer:i,field:e.name}));let s=e.domain?.type==="coded-value"?e.domain:null;u&&(N.includes(e.type)||s)&&(a=(await x({layer:i,field:e.name})).uniqueValueInfos.sort((n,d)=>d.count-n.count).slice(0,L),s&&(a=a.map(n=>({...n,value:s.getName(n.value)??n.value}))))}}catch(s){console.error(`Error fetching statistics for field ${e.name}:`,s)}return{summaryStatistics:r,uniqueValues:a}};function A(i,e){return["string","small-integer","integer"].includes(i)||e==="coded-value"}async function V(i,e,o,u=!0){let r=[],a=[],s=[];for(let n of i){let d=function(c){let t=e.get(c)?.layerItem;return t?[t.name&&`Name: ${t.name}`,t.title&&`Title: ${t.title}`,t.description&&`Description: ${t.description}`].filter(Boolean).join(" | "):c},{layerId:l,results:y}=n,S=o.map?.allLayers.find(c=>c.id===l),v=e.get(l)?.fieldRegistry;if(!v)continue;let f=r.find(c=>c.layerId===l);f||(f={layerId:l,layerSummary:d(l),fieldInfos:[]},r.push(f));for(let c of y){let t=v.get(c.name);if(!t)continue;let p=t.statistics,b=u&&!p?.summaryStatistics,w=A(t.type,t.domain?.type)&&!p?.uniqueValues,I=b||w;if(s.push({layerId:l,fieldName:t.name,didFetchStatistics:I}),I){let k=$(S,t,{includeSummaryStatistics:b,includeUniqueValues:w}).then(F=>{let h={summaryStatistics:p?.summaryStatistics??null,uniqueValues:p?.uniqueValues??null};b&&(h.summaryStatistics=F.summaryStatistics),w&&(h.uniqueValues=F.uniqueValues),v.set(t.name,{...t,statistics:h}),t.statistics=h});a.push(k)}f.fieldInfos.push(t)}}return await Promise.all(a),{layerFieldInfo:r,didFetchStatistics:a.length>0,fieldStatisticsFetchStatus:s}}var D=.7,j=10;async function T(i){let{query:e,layerIds:o,includeSummaryStatistics:u=!1,fieldSearch:r,layersAndFieldsRegistry:a,embeddingCache:s,mapView:n,minScore:d=D,topResults:l=j}=i,y=await r.searchFields({text:e,layerIds:o,minScore:d,topResults:l,embeddingCache:s}),S=await V(y,a,n,u);return{matches:y,...S}}var U=m.object({query:m.string().describe("A concise semantic description of the fields relevant to the user's task."),layerIds:m.array(m.string()).min(1).describe("Layer IDs returned by findRelevantLayers, restricted to layers relevant to the current task."),includeSummaryStatistics:m.boolean().optional().default(!1).describe("Set to true only when the task directly asks for numeric summaries such as average, minimum, maximum, total, variance, or range.")});async function B(i,e){let{mapView:o}=R(e,["mapView"]),u=await T({...i,fieldSearch:g(e,"fieldSearch"),layersAndFieldsRegistry:g(e,"layersAndFieldsRegistry"),embeddingCache:g(e,"embeddingCache"),mapView:o});return JSON.stringify(u,null,2)}var M=q(B,{name:"findRelevantFields",description:"Finds relevant fields within candidate layers. Returns ranked matches, field metadata, categorical values, and optional numeric summary statistics. Call findRelevantLayers first when layer IDs are not already known.",schema:U});return M},"smartMapping/statistics/summaryStatistics","smartMapping/statistics/uniqueValues")
|
|
@@ -1,2 +1,2 @@
|
|
|
1
1
|
/* COPYRIGHT Esri - https://js.arcgis.com/5.2/LICENSE.txt */
|
|
2
|
-
import{a as r}from"./434TAA3J.js";import{a as m,b}from"./
|
|
2
|
+
import{a as r}from"./434TAA3J.js";import{a as m,b}from"./UYP5PH5E.js";import"./QUZTFUWM.js";import"./A22375P3.js";import"./DYSPEU7W.js";import{A as d,C as g,g as l,h as e,x as c}from"./RE7MJTEF.js";import"./R74ZHFA6.js";import"./UZLQALHY.js";var p=l`:host{display:block;container-type:inline-size}.container{display:flex;flex-direction:column;align-items:flex-start;gap:var(--calcite-spacing-sm);width:100%;text-align:left}.icon{padding:var(--calcite-spacing-sm);border-radius:var(--calcite-spacing-xl);background:var(--calcite-color-brand);color:var(--calcite-color-foreground-1)}.content-container{display:flex;flex:1;flex-direction:column;width:100%;min-width:0;gap:var(--calcite-spacing-md)}.content{display:flex;flex-direction:column;min-width:0;gap:var(--calcite-spacing-sm)}.blocks{display:flex;flex-direction:column;gap:var(--calcite-spacing-sm)}.block-pending{display:flex;justify-content:center;align-items:center;padding:var(--calcite-spacing-sm);background:linear-gradient(90deg,color-mix(in srgb,var(--calcite-color-foreground-2) 65%,transparent),color-mix(in srgb,var(--calcite-color-foreground-3) 85%,transparent),color-mix(in srgb,var(--calcite-color-foreground-2) 65%,transparent));background-size:200% 100%;animation:assistant-message-loading-shimmer 2s ease-in-out infinite;border-radius:var(--calcite-border-radius);min-height:100px}.message-error{font-style:italic}@container (min-width: 480px){.container{max-width:80%}}@keyframes assistant-message-loading-shimmer{0%{background-position:-150% 0}to{background-position:150% 0}}@media(prefers-reduced-motion){.block-pending{animation:none}}`;function u({message:a}){let s=new Map;return a&&a.blocks?.forEach((i,t)=>{if(!i.isPending){let n=r(a.id,t);s.set(n,{data:{block:i,index:t,message:a},name:"block",slotName:n})}}),s}var o=class extends c{constructor(){super(...arguments),this._messages=b({blocking:!0}),this.arcgisSlottableRequest=m(this,["message"],u),this.feedbackEnabled=!1,this.logEnabled=!1,this.copyEnabled=!1,this.readAloudEnabled=!1,this.footerDisabled=!1,this.assistantAvatarEnabled=!1}static{this.properties={_isStreaming:16,feedbackEnabled:5,logEnabled:5,copyEnabled:5,readAloudEnabled:5,footerDisabled:5,message:0,assistantAvatarEnabled:5}}static{this.styles=p}get _isStreaming(){return!!this.message?.isStreaming}_renderContent(){let s=this.message,i=s?.id;if(i)return e`<div class="content"><arcgis-assistant-interrupt-preview .interrupts=${this.message?.interrupts}></arcgis-assistant-interrupt-preview>${s.blocks?.length?e`<div class="blocks">${s.blocks.map((t,n)=>t.isPending&&t.type!=="text"?e`<div class="block-pending"></div>`:e`<slot name=${r(i,n)??d}></slot>`)}</div>`:null}</div>`}_renderFooter(){return e`<arcgis-assistant-message-footer .message=${this.message} .feedbackEnabled=${this.feedbackEnabled} .logEnabled=${this.logEnabled} .copyEnabled=${this.copyEnabled} .readAloudEnabled=${this.readAloudEnabled}></arcgis-assistant-message-footer>`}render(){return e`<div class="container">${this.assistantAvatarEnabled?e`<slot name=icon><calcite-icon icon=effects class="icon" scale=s></calcite-icon></slot>`:null}<div class="content-container"><slot name=content>${this._renderContent()}</slot>${this.message?.error?e`<div class="message-error">${this.message.error}</div>`:null}${this._isStreaming?e`<div class="streaming-indicator"><calcite-loader .label=${this._messages.loadingLabel} inline></calcite-loader></div>`:null}${!this.footerDisabled&&!this._isStreaming?e`<slot name=footer>${this._renderFooter()}</slot>`:null}</div></div>`}};g("arcgis-assistant-message",o);export{o as ArcgisAssistantMessage};
|
|
@@ -1,2 +1,2 @@
|
|
|
1
1
|
/* COPYRIGHT Esri - https://js.arcgis.com/5.2/LICENSE.txt */
|
|
2
|
-
import{a as w}from"./
|
|
2
|
+
import{a as w}from"./AMURN3LO.js";import{a as r,f as o,h as x}from"./GEFFWUB2.js";import{a as b,c as S}from"./AAUVOBPS.js";import{A as v,C as f,g,h as n,o as c,x as $}from"./RE7MJTEF.js";import"./R74ZHFA6.js";import"./UZLQALHY.js";var R=g`:host{display:block;min-width:0}.span-title.completed{color:var(--calcite-color-status-success)}.span-title.failed{color:var(--calcite-color-status-danger)}.span-title.interrupted{color:var(--calcite-color-status-warning)}.span-title.running{color:var(--calcite-color-status-info)}.duration{color:var(--calcite-color-text-3);font-size:var(--calcite-font-size-relative-sm);min-width:3.4rem;text-align:right;font-variant-numeric:tabular-nums}.span-title{display:inline-flex;align-items:center;gap:var(--calcite-spacing-xxs)}.span-title>span{color:var(--calcite-color-text-1);overflow-wrap:anywhere}`,p=class extends ${constructor(){super(...arguments),this.events=[],this.pricing=b,this.arcgisInternalSpanSelect=c(),this.arcgisInternalRunSelect=c()}static{this.properties={events:0,run:0,pricing:0,selectedSpanId:1}}static{this.styles=R}#t;willUpdate(t){(!this.hasUpdated||t.has("run")||t.has("events")||t.has("pricing"))&&(this.#t=this.run??w(this.events,this.pricing).runs[0])}renderSpan(t,a){let s=a.get(t.id)??[];return n`<calcite-tree-item .label=${t.label} data-span-id=${t.id??v} .selected=${t.id===this.selectedSpanId} .expanded=${s.length>0}><span class=${`span-title ${t.status}`}><calcite-icon .icon=${r[t.status]} scale=s></calcite-icon><span>${t.label}</span></span><span class="duration" slot=actions-end>${o(t)}</span>${s.length?n`<calcite-tree slot=children lines scale=s selection-mode=single>${s.map(l=>this.renderSpan(l,a))}</calcite-tree>`:null}</calcite-tree-item>`}render(){let t=this.#t;if(!t)return null;let{visibleSpans:a,childrenByParent:s,rootSpans:l}=x(t.spans),I=t.prompt.length>80?`${t.prompt.slice(0,77)}...`:t.prompt,i=t.status,k=t.usage.knownTokens.total,d=a.filter(e=>e.status==="failed").length,u=t.usage.cost?.total,m=u===void 0?void 0:S(u);return n`<calcite-block .heading=${I||`Run ${t.number}`} .description=${`${a.length} spans | ${o(t)} | ${k.toLocaleString()} tokens${m===void 0?"":` (${m})`}${d?` | ${d} failed`:""}`} .iconStart=${i==="running"?void 0:r[i]} .label=${`Run ${t.number}: ${i}`} scale=s expandable expanded><calcite-action slot=actions-end icon=information scale=s text="View run details" @click=${e=>{e.stopPropagation(),this.arcgisInternalRunSelect.emit()}}></calcite-action>${i==="running"?n`<calcite-loader slot=content-start inline scale=s .label=${`Run ${t.number} running`}></calcite-loader>`:null}<calcite-tree aria-label=${`Run ${t.number} spans`} lines scale=s selection-mode=children @calciteTreeSelect=${e=>{let h=e.currentTarget.selectedItems[0]?.dataset.spanId;h&&this.arcgisInternalSpanSelect.emit(h)}}>${l.map(e=>this.renderSpan(e,s))}</calcite-tree></calcite-block>`}};f("arcgis-assistant-observation-run",p);export{p as ArcgisAssistantObservationRun};
|
|
@@ -1,2 +1,2 @@
|
|
|
1
1
|
/* COPYRIGHT Esri - https://js.arcgis.com/5.2/LICENSE.txt */
|
|
2
|
-
import{a as c}from"./ONQ6JSBJ.js";import{a as t}from"./
|
|
2
|
+
import{a as c}from"./ONQ6JSBJ.js";import{a as t}from"./RFPTOFM4.js";import{Ga as a}from"./FSLPYC4Y.js";async function i(o,e){return await e.goTo({scale:o}),{text:`Successfully zoomed to: ${o}`}}async function r({scale:o},e){let{mapView:s}=c(e,["mapView"]);return await i(o,s)}var m=t.object({scale:t.number().describe("The map scale of the view to go to.")}),p=a(r,{name:"goToScale",description:"Go to the specified view scale.",schema:m});export{p as a};
|
|
@@ -0,0 +1,2 @@
|
|
|
1
|
+
/* COPYRIGHT Esri - https://js.arcgis.com/5.2/LICENSE.txt */
|
|
2
|
+
import a from"./FX4LV2S3.js";import{a as y}from"./XEJFVUNQ.js";import{a as c}from"./ONQ6JSBJ.js";import{a as n}from"./RFPTOFM4.js";import{Ga as f}from"./FSLPYC4Y.js";export default $arcgis.t(([{a:d,b:h}])=>{var b=(a,i,o)=>{let e=a.createQuery();return e.outFields=[i],e.where=o||"1=1",e.num=1,e},p=async(a,i,o,e)=>{let t=e.map?.allLayers.find(l=>l.id===a),r=y(i,t.fields.map(l=>l.name)),g=b(t,r,o.where),u=(await t.queryFeatures(g)).features[0],w=u?u.attributes[r]:null,m=d(t,r,w,e.timeZone),s=h(t,r);return{tool:"getAttribute",layerName:t.title??a,summary:`${s} = ${m}`,details:{fieldName:r,fieldAlias:s!==i?s:void 0,value:m,where:o.where}}};async function v({layerId:a,fieldName:i,query:o},e){let{mapView:t}=c(e,["mapView"]),r=await p(a,i,o,t);return JSON.stringify(r,null,2)}var A=n.object({layerId:n.string().describe("The layerId of the layer containing the field from which to get a value."),fieldName:n.string().describe("The name of the field/attribute from which to get a field value."),query:n.object({where:n.string().describe("The SQL-92 where clause representing the feature from which to get an attribute value.")})}),F=f(v,{name:"getAttribute",description:"Returns an attribute value for a given feature.",schema:A});return F},a)
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
/* COPYRIGHT Esri - https://js.arcgis.com/5.2/LICENSE.txt */
|
|
2
|
+
import b from"./FX4LV2S3.js";import{a as O,b as C}from"./34O57OGV.js";import{b as x}from"./XEJFVUNQ.js";import a from"./JZPPP4QY.js";import{a as L}from"./ONQ6JSBJ.js";import{a as e}from"./RFPTOFM4.js";import{Ga as T}from"./FSLPYC4Y.js";export default $arcgis.t(([{a:p,b:g,c:b,d:v,e:R,f:j},{c:N}])=>{var w=25,W=i=>i.flatMap(r=>r.split(",")).map(r=>r.trim()).map(r=>r.split(/\s+/u)[0]?.replace(/^"|"$/gu,"")).filter(r=>!!r),B=async(i,r,t,l)=>{let o=r.map?.allLayers.find(u=>u.id===i.layerId),d=await r.whenLayerView(o),f=o.title??i.layerId,h;if(t){let u=await v(t,r);if("error"in u){let s={error:u.error};if(b(t)){let c=r.map?.allLayers.find(y=>y.id===t.layerId);s.geometryLayerName=c?.title??c?.id,s.geometryLayerId=t.layerId,s.geometryWhere=t.where}else g(t)&&(s.point=t.point);return{tool:"queryFeatures",layerName:f,summary:"Geometry lookup failed",details:s}}if(!u.geometry){let s={};if(b(t)){let c=r.map?.allLayers.find(y=>y.id===t.layerId);s.error=`No features found matching: ${t.where}`,s.geometryLayerName=c?.title??c?.id,s.geometryLayerId=t.layerId,s.geometryWhere=t.where}else g(t)&&(s.error="Failed to create point geometry",s.point=t.point);return{tool:"queryFeatures",layerName:f,summary:"No features found for geometry filter",details:s}}h=u.geometry}else l&&(h=r.extent.clone());let E=[...new Set([...i.outFields,...W(i.orderByFields)])],F=O(d,E,l??!1),I=o.objectIdField,a=o.createQuery();a.where=C(o.definitionExpression,i.where||"1=1"),a.outFields=i.outFields.includes("*")?["*"]:[...new Set([...i.outFields,I])],a.orderByFields=i.orderByFields,h&&(a.geometry=h,a.spatialRelationship="intersects"),t?.distance&&(a.distance=t.distance),t?.units&&(a.units=t.units),a.outSpatialReference=r.spatialReference;let n,m;try{n=F?await d.queryFeatureCount(a):await o.queryFeatureCount(a),n>0&&n<=w&&(m=F?await d.queryFeatures(a):await o.queryFeatures(a))}catch(u){console.warn("Client-side query failed, falling back to server:",u),n=await o.queryFeatureCount(a),n>0&&n<=w&&(m=await o.queryFeatures(a))}let{objectIds:q,attributes:S}=m?N(o,m,r.timeZone):{objectIds:void 0,attributes:void 0},k=x(i.outFields,o.fields.map(u=>u.name));return{tool:"queryFeatures",layerName:f,summary:`${n} features found`,details:{totalCount:n,where:i.where,orderByFields:i.orderByFields,outFields:k,...q&&{objectIds:q,objectIdField:I},...S&&{attributes:S},...n>w&&{note:`${n} features found.`}}}};async function U({targetLayer:i,geometryFilter:r,useCurrentExtent:t},l){let{mapView:o}=L(l,["mapView"]),d=j(r,l.state?.agentExecutionContext?.sharedResources),f=await B(i,o,d,t);return JSON.stringify(f,null,2)}var D=e.object({layerId:e.string().describe("The layerId of the layer containing the geometry by which to filter."),where:e.string().describe("The SQL-92 where clause representing the features from which to filter."),distance:e.number().optional().describe("The buffer distance around the geometry."),units:p.optional().describe("The units for the distance buffer.")}),A=e.object({point:e.object({x:e.number().describe("X coordinate (longitude) from navigation result"),y:e.number().describe("Y coordinate (latitude) from navigation result"),spatialReference:e.object({wkid:e.number().describe("Spatial reference WKID (e.g., 4326 for WGS84)")}).optional().describe("Spatial reference. Defaults to map's spatial reference if not provided.")}).describe("Point coordinates from a previous navigation/geocoding result"),distance:e.number().optional().describe("Optional buffer distance around the point."),units:p.optional().describe("The units for the distance buffer.")}),G=e.object({targetLayer:e.object({layerId:e.string().describe("The layerId of the layer containing the field from which to get a value."),where:e.string().describe("SQL-92 where clause. IMPORTANT: When using geometryFilter.point or geometryFilter.sharedResourceId for point-in-polygon queries, set this to '1=1' to return all features that intersect the point. Only add attribute filters if the user specifically requests them in addition to the spatial query."),orderByFields:e.array(e.string().describe("The field(s) and order for which to sort the resulting features.")),outFields:e.array(e.string().describe('The fields to include in the output that will be presented to the user. This should include identifying information about the resulting features, like a name or id, along with the values desired in the output. If unsure, choose all fields ("*").').default("*"))}),geometryFilter:e.union([D,A,R]).optional().describe("Geometry filter for spatial queries. Use 'sharedResourceId' with an ID from listSharedResources for a previously geocoded location. Use 'point' for inline coordinates or 'layerId/where' for features from another layer."),useCurrentExtent:e.boolean().optional().describe("Set to true ONLY when user explicitly asks about features 'in my view', 'on my map', 'I am looking at', OR when the user refers back to features previously identified using the current extent (e.g. 'these', 'those', 'them', 'the same ones'). Default is false (queries entire layer).")}),X=T(U,{name:"queryFeatures",description:`Queries features from a layer. Returns the total count of matching features, plus individual feature attributes if \u226425 features match.
|
|
3
|
+
|
|
4
|
+
USE THIS TOOL FOR:
|
|
5
|
+
- "Show / display / list features where..." \u2014 finding and listing features
|
|
6
|
+
- "How many X are Y?" \u2014 counting features that match a condition
|
|
7
|
+
- "Which features..." / "Find features..." \u2014 identifying specific features
|
|
8
|
+
- Spatial queries \u2014 finding features near/within/intersecting other features
|
|
9
|
+
- Any question where the user wants to SEE or COUNT matching features
|
|
10
|
+
|
|
11
|
+
This is the DEFAULT tool for most queries. When in doubt, use this tool.`,schema:G});return X},a,b)
|
|
@@ -1,2 +1,2 @@
|
|
|
1
1
|
/* COPYRIGHT Esri - https://js.arcgis.com/5.2/LICENSE.txt */
|
|
2
|
-
import{a}from"./
|
|
2
|
+
import{a}from"./2DWN3SKH.js";import"./FDOMMK2M.js";import"./RFPTOFM4.js";import"./FSLPYC4Y.js";import"./AMP43OT2.js";import"./2UKFCF2J.js";import"./UZLQALHY.js";export{a as listLayerFieldsTool};
|
|
@@ -1,2 +1,2 @@
|
|
|
1
1
|
/* COPYRIGHT Esri - https://js.arcgis.com/5.2/LICENSE.txt */
|
|
2
|
-
import{a as w,b as L}from"./
|
|
2
|
+
import{a as w,b as L}from"./A22375P3.js";import{D as O,a as b,b as E,c as u,d as h,e as y,f as x,n as f,o as C,p as P}from"./RE7MJTEF.js";var _=e=>(...n)=>{let t=h(),o=new e(...n),s=o.exports;u(t.at(-1));let r=o.component.manager;r.W(o,s),o.watchExports(r.W.bind(r,o)),y(o);let i=[o.component,...t].reverse();return f(i,a=>a===void 0?void 0:M(o,a,s),s)},M=(e,{host:n,key:t,isReactive:o},s)=>{let r=n,i=r[t]!==e.exports,a=r[t]!==s,p=s!==e.exports;if(i&&!a&&p&&(r[t]=e.exports),n===e.component){if(o){let l=e.component.manager;a&&l.W(e,r[t]),e.onUpdate(m=>{if(m.has(t)){let g=r[t];g!==e.exports&&l.W(e,g)}})}e.O=o?void 0:t}let c=e.component.constructor.elementProperties.get(t)?.readOnly;e.watchExports(()=>{r[t]!==e.exports&&(c?x(()=>{r[t]=e.exports}):r[t]=e.exports)})};var D=e=>R(void 0,e);var v=class extends P{constructor(n,t){super(n);let o=this.exports;try{E(this.component);let s=t(this.component,this),r=this.exports!==o;if(b(s)){r||this.setProvisionalExports(s);let i=s.then(a=>{this.exports=a,super.catchUpLifecycle()}).catch(a=>{this.P.reject(a)});this.onLoad(async()=>await i)}else(!r||s!==void 0)&&(this.exports=s),queueMicrotask(()=>super.catchUpLifecycle())}catch(s){this.P.reject(s)}}catchUpLifecycle(){}},R=_(v);var S=(e,n,t)=>D((o,s)=>{let r=n,i=C({bubbles:!1,composed:!1});return s.onUpdated(a=>{if(!r.some(c=>a.has(c)))return;let p=t(A(e,r,a)),d=t(A(e,r));p.forEach((c,l)=>{d.has(l)||i.emit({...c,data:void 0})}),d.forEach((c,l)=>{let m=p.get(l);(!m||!N(m,c))&&i.emit(c)})}),i});function A(e,n,t){let o={};return n.forEach(s=>{o[s]=t?.has(s)?t.get(s):e[s]}),o}function N(e,n){if(e===n)return!0;if(!e||!n||typeof e!="object"||typeof n!="object"||Array.isArray(e)||Array.isArray(n))return!1;let t=Object.entries(e),o=Object.entries(n);return t.length!==o.length?!1:t.every(([s,r])=>N(r,n[s]))}var V=e=>(n={})=>D((t,o)=>{let s=w(t.el),r={_lang:s.lang,_t9nLocale:s.t9nLocale,_loading:!0},i=t;o.onLifecycle(()=>L(t.el,()=>e("./assets"),({t9nLocale:p,t9nStrings:d,lang:c})=>{let l={...d,_lang:c,_t9nLocale:p,_loading:!1};o.exports=l;let m=d.componentLabel;typeof m=="string"&&"label"in t&&t.label==null&&(t.label??=m),a(i.messageOverrides)},n.name));let a=p=>{let d=o.exports,c=d._original??d,l=j(c,p);p&&(l._original=c),o.exports=l};return"messageOverrides"in i&&o.onUpdate(p=>{p.has("messageOverrides")&&a(i.messageOverrides)}),n.blocking?(o.setProvisionalExports(r,!1),o.ready):r}),j=(e,n)=>{if(!n)return e;let t={...e};return Object.entries(n).forEach(([o,s])=>{e[o]!==void 0&&(typeof s=="object"?t[o]=j(e[o],s):t[o]=s??e[o])}),t};var X=V(O);export{S as a,X as b};
|
|
@@ -0,0 +1,2 @@
|
|
|
1
|
+
/* COPYRIGHT Esri - https://js.arcgis.com/5.2/LICENSE.txt */
|
|
2
|
+
import b from"./YI6NIHNI.js";import"./34O57OGV.js";import"./XEJFVUNQ.js";import a from"./JZPPP4QY.js";import"./ONQ6JSBJ.js";import"./FDOMMK2M.js";import"./RFPTOFM4.js";import"./FSLPYC4Y.js";import"./AMP43OT2.js";import"./2UKFCF2J.js";import"./UZLQALHY.js";export default $arcgis.t(([,a])=>{return a},a,b)
|
|
@@ -1,2 +1,2 @@
|
|
|
1
1
|
/* COPYRIGHT Esri - https://js.arcgis.com/5.2/LICENSE.txt */
|
|
2
|
-
import{a as s}from"./ONQ6JSBJ.js";import{a as i}from"./
|
|
2
|
+
import{a as s}from"./ONQ6JSBJ.js";import{a as i}from"./RFPTOFM4.js";import{Ga as o}from"./FSLPYC4Y.js";var n=async t=>{t.map?.allLayers.filter(e=>e.type==="feature")?.forEach(e=>{let r=e;r.featureEffect&&(r.featureEffect=null)});let a=t.map.initialViewProperties?.viewpoint?.targetGeometry;return a?(await t.goTo(a),"Cleared all filters and returned to home extent."):"Cleared all filters. Could not determine home extent."},l=async(t,a)=>{let{mapView:e}=s(a,["mapView"]);return await n(e)},c=o(l,{name:"resetMap",description:"Clears all feature effects/filters from the map AND zooms to the home extent (initial map view). Use when user says 'reset map', 'reset the map', 'start over', or wants to both clear filters and return to the initial view.",schema:i.object({})});export{c as a};
|
|
@@ -1,2 +1,2 @@
|
|
|
1
1
|
/* COPYRIGHT Esri - https://js.arcgis.com/5.2/LICENSE.txt */
|
|
2
|
-
import{a as c}from"./ONQ6JSBJ.js";import{a}from"./
|
|
2
|
+
import{a as c}from"./ONQ6JSBJ.js";import{a}from"./RFPTOFM4.js";import{Ga as d}from"./FSLPYC4Y.js";export default $arcgis.t(([i,u,w,{addressToLocations:S},v])=>{async function y(e,s){let r=w.getDefault().helperServices,n=r.geocode.find(g=>g.name==="ArcGIS World Geocoding Service")??r.geocode[0];if(!n)throw new Error("No geocoding service found in helperServices.");let l=n.url,m=`${i.assetsPath?.endsWith("/")?i.assetsPath:`${i.assetsPath}/`}esri/images/search/search-symbol-32.png`,o=(await S(l,{address:{SingleLine:e},outFields:["Match_addr"]}))?.[0];if(!o?.extent||!o.location)throw new Error(`Could not find location for: ${e}`);let h=new v({url:m,width:24,height:24}),p=new u({geometry:o.location,symbol:h});s.graphics.removeAll(),s.graphics.add(p),await s.goTo(o.extent);let t={address:o.address??e,location:o.location.toJSON(),extent:o.extent.toJSON()},f={value:t,sharedStatePatch:{lastResolvedLocation:{value:t}},sharedResourceAdditions:[{kind:"point",description:t.address,payload:t.location}]};return[`Successfully zoomed to ${t.address}.`,f]}async function T({address:e},s){let{mapView:r}=c(s,["mapView"]);return await y(e,r)}var A=a.object({address:a.string().describe("The full address or place name to locate.")}),W=d(T,{name:"goToAddress",description:"Geocodes an address using Esri's World Geocoding Service and zooms the map to that location.",schema:A,responseFormat:"content_and_artifact"});return W},"config","Graphic","portal/Portal","rest/locator","symbols/PictureMarkerSymbol")
|
|
@@ -1,2 +1,2 @@
|
|
|
1
1
|
/* COPYRIGHT Esri - https://js.arcgis.com/5.2/LICENSE.txt */
|
|
2
|
-
import{b as c}from"./
|
|
2
|
+
import{b as c}from"./UYP5PH5E.js";import"./QUZTFUWM.js";import"./A22375P3.js";import"./DYSPEU7W.js";import{C as p,g as i,h as s,o as r,x as a}from"./RE7MJTEF.js";import"./R74ZHFA6.js";import"./UZLQALHY.js";var l=i`:host{display:block;max-width:100%}.group{max-width:100%}.prompt{max-width:100%;overflow:hidden;text-overflow:ellipsis;white-space:nowrap;font-style:normal;cursor:pointer;font-weight:var(--calcite-font-weight-regular)}calcite-chip{max-width:100%}`,e=class extends a{constructor(){super(...arguments),this._messages=c({blocking:!0}),this.prompts=[],this.arcgisPromptSelect=r()}static{this.properties={label:1,prompts:0}}static{this.styles=l}_emitPromptSelect(t){this.arcgisPromptSelect.emit({prompt:t})}render(){return this.prompts.length?s`<calcite-chip-group class="group" .label=${this.label??this._messages.suggestedPromptsLabel}>${this.prompts.map(t=>s`<calcite-chip .value=${t} .label=${t} appearance=outline-fill kind=brand @calciteChipSelect=${()=>this._emitPromptSelect(t)}><div class="prompt">${t}</div></calcite-chip>`)}</calcite-chip-group>`:null}};p("arcgis-assistant-suggested-prompts",e);export{e as ArcgisAssistantSuggestedPrompts};
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
/* COPYRIGHT Esri - https://js.arcgis.com/5.2/LICENSE.txt */
|
|
2
|
-
import{$ as ie,A as $e,Aa as ta,B as Je,Ba as na,C as Mn,Ca as ft,D as In,E as ze,F as On,G as An,H as xn,I as Nn,J as Pn,K as Ln,L as Rn,M as Fn,N as Dn,O as Bn,P as Un,Q as jn,R as Gn,S as Vn,T as $n,U as Jn,V as zn,X as xe,Y as Kn,ca as Wn,d as yn,da as V,ea as Ke,fa as Hn,g as K,ga as Yn,ha as We,i as bn,ia as He,j as pe,ja as $,ka as Zn,la as Xn,m as de,ma as he,n as Ve,na as Ye,o as mt,oa as qn,pa as Qn,q as Tn,s as ge,t as vn,u as wn,v as Cn,w as Z,x as Sn,y as kn,ya as Ze,z as En,za as ea}from"./
|
|
2
|
+
import{$ as ie,A as $e,Aa as ta,B as Je,Ba as na,C as Mn,Ca as ft,D as In,E as ze,F as On,G as An,H as xn,I as Nn,J as Pn,K as Ln,L as Rn,M as Fn,N as Dn,O as Bn,P as Un,Q as jn,R as Gn,S as Vn,T as $n,U as Jn,V as zn,X as xe,Y as Kn,ca as Wn,d as yn,da as V,ea as Ke,fa as Hn,g as K,ga as Yn,ha as We,i as bn,ia as He,j as pe,ja as $,ka as Zn,la as Xn,m as de,ma as he,n as Ve,na as Ye,o as mt,oa as qn,pa as Qn,q as Tn,s as ge,t as vn,u as wn,v as Cn,w as Z,x as Sn,y as kn,ya as Ze,z as En,za as ea}from"./FSLPYC4Y.js";import{$a as hn,A as Nt,Aa as cn,B as Pt,Ba as fe,C as Ue,Ca as un,D as Lt,Da as mn,E as Rt,Ea as fn,F as Ft,Fa as pn,G as Dt,Ga as re,H as Bt,Ha as dn,I as Ut,J as jt,Ja as je,K as Gt,Ka as gn,L as Vt,M as $t,N as Jt,O as zt,P as Kt,Q as Wt,R as U,S as ue,U as Ht,V as ve,W as we,Wa as Y,X as Yt,Y as Zt,Z as Xt,_a as Ge,a as S,ab as oe,ba as te,bb as z,ca as Ce,cb as _n,da as qt,ea as Qt,fa as j,ga as me,ha as Se,ia as G,ja as ke,ka as Ee,la as en,ma as tn,na as Me,oa as Ie,pa as nn,q as ce,qa as an,ra as ne,s as At,sa as Oe,ta as sn,ua as rn,v as ut,va as Ae,wa as ae,x as xt,xa as se,y as De,ya as on,z as Be,za as ln}from"./2UKFCF2J.js";var Xe=(e,t)=>{let n=[...new Set(t?.map(o=>{if(typeof o=="string")return o;let i=new o({});if(!("getType"in i)||typeof i.getType!="function")throw new Error("Invalid type provided.");return i.getType()}))],s=e.getType();return n.some(o=>o===s)};function ia(e,t){return Array.isArray(e)?aa(e,t):$.from(n=>aa(n,e))}function aa(e,t={}){let{includeNames:n,excludeNames:s,includeTypes:o,excludeTypes:i,includeIds:u,excludeIds:m}=t,p=[];for(let g of e)if(!(s&&g.name&&s.includes(g.name))){{if(i&&Xe(g,i))continue;if(m&&g.id&&m.includes(g.id))continue}o||u||n?(n&&g.name&&n.some(h=>h===g.name)||o&&Xe(g,o)||u&&g.id&&u.some(h=>h===g.id))&&p.push(g):p.push(g)}return p}function la(e){return Array.isArray(e)?sa(e):$.from(sa)}function sa(e){if(!e.length)return[];let t=[];for(let n of e){let s=n,o=t.pop();if(!o)t.push(s);else if(s.getType()==="tool"||s.getType()!==o.getType())t.push(o,s);else{let i=re(o),u=re(s),m=i.concat(u);typeof i.content=="string"&&typeof u.content=="string"&&(m.content=`${i.content}
|
|
3
3
|
${u.content}`),t.push(za(m))}}return t}function ca(e,t){if(Array.isArray(e)){let n=e;if(!t)throw new Error("Options parameter is required when providing messages.");return ra(n,t)}else{let n=e;return $.from(s=>ra(s,n)).withConfig({runName:"trim_messages"})}}async function ra(e,t){let{maxTokens:n,tokenCounter:s,strategy:o="last",allowPartial:i=!1,endOn:u,startOn:m,includeSystem:p=!1,textSplitter:g}=t;if(m&&o==="first")throw new Error("`startOn` should only be specified if `strategy` is 'last'.");if(p&&o==="first")throw new Error("`includeSystem` should only be specified if `strategy` is 'last'.");let h;"getNumTokens"in s?h=async _=>(await Promise.all(_.map(y=>s.getNumTokens(y.content)))).reduce((y,f)=>y+f,0):h=async _=>s(_);let b=dt;if(g&&("splitText"in g?b=g.splitText.bind(g):b=async _=>g(_)),o==="first")return ua(e,{maxTokens:n,tokenCounter:h,textSplitter:b,partialStrategy:i?"first":void 0,endOn:u});if(o==="last")return Ja(e,{maxTokens:n,tokenCounter:h,textSplitter:b,allowPartial:i,includeSystem:p,startOn:m,endOn:u});throw new Error(`Unrecognized strategy: '${o}'. Must be one of 'first' or 'last'.`)}async function ua(e,t){let{maxTokens:n,tokenCounter:s,textSplitter:o,partialStrategy:i,endOn:u}=t,m=[...e],p=0;for(let g=0;g<m.length;g+=1)if(await s(g>0?m.slice(0,-g):m)<=n){p=m.length-g;break}if(p<m.length&&i){let g=!1;if(Array.isArray(m[p].content)){let h=m[p];if(typeof h.content=="string")throw new Error("Expected content to be an array.");let b=h.content.length,_=i==="last"?[...h.content].reverse():h.content;for(let y=1;y<=b;y+=1){let f=i==="first"?_.slice(0,y):_.slice(-y),T=Object.fromEntries(Object.entries(h).filter(([E])=>E!=="type"&&!E.startsWith("lc_"))),w=pt(h.getType(),{...T,content:f}),v=[...m.slice(0,p),w];if(await s(v)<=n)m=v,p+=1,g=!0;else break}g&&i==="last"&&(h.content=[..._].reverse())}if(!g){let h=m[p],b;if(Array.isArray(h.content)&&h.content.some(_=>typeof _=="string"||_.type==="text")?b=h.content.find(_=>_.type==="text"&&_.text)?.text:typeof h.content=="string"&&(b=h.content),b){let _=await o(b),y=_.length;i==="last"&&_.reverse();for(let f=0;f<y-1;f+=1)if(_.pop(),h.content=_.join(""),await s([...m.slice(0,p),h])<=n){i==="last"&&(h.content=[..._].reverse().join("")),m=[...m.slice(0,p),h],p+=1;break}}}}if(u){let g=Array.isArray(u)?u:[u];for(;p>0&&!Xe(m[p-1],g);)p-=1}return m.slice(0,p)}async function Ja(e,t){let{allowPartial:n=!1,includeSystem:s=!1,endOn:o,startOn:i,...u}=t,m=e.map(h=>{let b=Object.fromEntries(Object.entries(h).filter(([_])=>_!=="type"&&!_.startsWith("lc_")));return pt(h.getType(),b,ue(h))});if(o){let h=Array.isArray(o)?o:[o];for(;m.length>0&&!Xe(m[m.length-1],h);)m=m.slice(0,-1)}let p=s&&m[0]?.getType()==="system",g=p?m.slice(0,1).concat(m.slice(1).reverse()):m.reverse();return g=await ua(g,{...u,partialStrategy:n?"last":void 0,endOn:i}),p?[g[0],...g.slice(1).reverse()]:g.reverse()}var oa={human:{message:ne,messageChunk:Oe},ai:{message:j,messageChunk:G},system:{message:ae,messageChunk:se},developer:{message:ae,messageChunk:se},tool:{message:ve,messageChunk:we},function:{message:Me,messageChunk:Ie},generic:{message:ke,messageChunk:Ee},remove:{message:Ae,messageChunk:Ae}};function pt(e,t,n){let s,o;switch(e){case"human":n?s=new Oe(t):o=new ne(t);break;case"ai":if(n){let i={...t};"tool_calls"in i&&(i={...i,tool_call_chunks:i.tool_calls?.map(u=>({...u,type:"tool_call_chunk",index:void 0,args:JSON.stringify(u.args)}))}),s=new G(i)}else o=new j(t);break;case"system":n?s=new se(t):o=new ae(t);break;case"developer":n?s=new se({...t,additional_kwargs:{...t.additional_kwargs,__openai_role__:"developer"}}):o=new ae({...t,additional_kwargs:{...t.additional_kwargs,__openai_role__:"developer"}});break;case"tool":if("tool_call_id"in t)n?s=new we(t):o=new ve(t);else throw new Error("Can not convert ToolMessage to ToolMessageChunk if 'tool_call_id' field is not defined.");break;case"function":if(n)s=new Ie(t);else{if(!t.name)throw new Error("FunctionMessage must have a 'name' field");o=new Me(t)}break;case"generic":if("role"in t)n?s=new Ee(t):o=new ke(t);else throw new Error("Can not convert ChatMessage to ChatMessageChunk if 'role' field is not defined.");break;default:throw new Error(`Unrecognized message type ${e}`)}if(n&&s)return s;if(o)return o;throw new Error(`Unrecognized message type ${e}`)}function za(e){let t=e.getType(),n,s=Object.fromEntries(Object.entries(e).filter(([o])=>!["type","tool_call_chunks"].includes(o)&&!o.startsWith("lc_")));if(t in oa&&(n=pt(t,s)),!n)throw new Error(`Unrecognized message chunk class ${t}. Supported classes are ${Object.keys(oa)}`);return n}function dt(e){let t=e.split(`
|
|
4
4
|
`);return Promise.resolve([...t.slice(0,-1).map(n=>`${n}
|
|
5
5
|
`),t[t.length-1]])}var ma=["tool_call","tool_call_chunk","invalid_tool_call","server_tool_call","server_tool_call_chunk","server_tool_call_result"];var fa=["image","video","audio","text-plain","file"];var pa=["text","reasoning",...ma,...fa];var tr=S({AIMessage:()=>j,AIMessageChunk:()=>G,BaseMessage:()=>jt,BaseMessageChunk:()=>Kt,ChatMessage:()=>ke,ChatMessageChunk:()=>Ee,DEFAULT_MERGE_IGNORE_KEYS:()=>Vt,FunctionMessage:()=>Me,FunctionMessageChunk:()=>Ie,HumanMessage:()=>ne,HumanMessageChunk:()=>Oe,KNOWN_BLOCK_TYPES:()=>pa,RemoveMessage:()=>Ae,SystemMessage:()=>ae,SystemMessageChunk:()=>se,ToolMessage:()=>ve,ToolMessageChunk:()=>we,_isMessageFieldWithRole:()=>Wt,_mergeDicts:()=>$t,_mergeLists:()=>Jt,_mergeObj:()=>zt,_mergeStatus:()=>Ut,coerceMessageLikeToMessage:()=>fe,collapseToolCallChunks:()=>dn,convertToChunk:()=>re,convertToOpenAIImageBlock:()=>Ue,convertToProviderContentBlock:()=>Ft,defaultTextSplitter:()=>dt,defaultToolCallParser:()=>Yt,filterMessages:()=>ia,getBufferString:()=>un,iife:()=>cn,isAIMessage:()=>me,isAIMessageChunk:()=>Se,isBase64ContentBlock:()=>Be,isBaseMessage:()=>U,isBaseMessageChunk:()=>ue,isChatMessage:()=>en,isChatMessageChunk:()=>tn,isDataContentBlock:()=>xt,isDirectToolOutput:()=>Ht,isFunctionMessage:()=>nn,isFunctionMessageChunk:()=>an,isHumanMessage:()=>sn,isHumanMessageChunk:()=>rn,isIDContentBlock:()=>Pt,isMessage:()=>Dt,isOpenAIToolCallArray:()=>Gt,isPlainTextContentBlock:()=>Nt,isSystemMessage:()=>on,isSystemMessageChunk:()=>ln,isToolMessage:()=>Zt,isToolMessageChunk:()=>Xt,isURLContentBlock:()=>De,mapChatMessagesToStoredMessages:()=>pn,mapStoredMessageToChatMessage:()=>mn,mapStoredMessagesToChatMessages:()=>fn,mergeContent:()=>Bt,mergeMessageRuns:()=>la,mergeResponseMetadata:()=>qt,mergeUsageMetadata:()=>Qt,parseBase64DataUrl:()=>Rt,parseMimeType:()=>Lt,trimMessages:()=>ca});var rr=S({ChatModelStream:()=>Qe,ReasoningContentStream:()=>_a,TextContentStream:()=>ga,ToolCallsStream:()=>ha,UsageMetadataStream:()=>ya}),Ka=class{events=[];finished=!1;waiters=[];error=null;push(e){this.events.push(e);let t=this.waiters.splice(0);for(let n of t)n()}finish(){this.finished=!0;let e=this.waiters.splice(0);for(let t of e)t()}setError(e){this.error=e,this.finished=!0;let t=this.waiters.splice(0);for(let n of t)n()}async*iterate(){if(this.finished){if(this.error)throw this.error;yield*this.events;return}let e=0;for(;;){for(;e<this.events.length;)yield this.events[e],e++;if(this.finished){if(this.error)throw this.error;return}await new Promise(t=>{if(e<this.events.length||this.finished){t();return}this.waiters.push(t)})}}};function Wa(e,t){switch(t.type){case"text-delta":return e.type==="text"?{...e,text:(e.text??"")+t.text}:e;case"reasoning-delta":return e.type==="thinking"?{...e,thinking:(e.thinking??"")+t.reasoning}:e.type==="reasoning"?{...e,reasoning:(e.reasoning??"")+t.reasoning}:e;case"data-delta":return{...e,data:(e.data??"")+t.data};case"block-delta":return{...e,...t.fields};default:throw new Error(`Unknown delta type: ${JSON.stringify(t)}`)}}function Ne(e){if(e.event!=="content-block-delta")return;if("delta"in e&&e.delta)return e.delta;let t=e.content;if(t==null||typeof t!="object")return;let n=t;if(n.type==="text"&&typeof n.text=="string")return{type:"text-delta",text:n.text};if(n.type==="reasoning"&&typeof n.reasoning=="string")return{type:"reasoning-delta",reasoning:n.reasoning};if(n.type==="thinking"&&typeof n.thinking=="string")return{type:"reasoning-delta",reasoning:n.thinking};if(typeof n.data=="string")return{type:"data-delta",data:n.data,encoding:"base64"};if(typeof n.type=="string")return{type:"block-delta",fields:{...n,type:n.type}}}function da(e){if(e==null||typeof e!="object")return;let t=e;if(t.type==="reasoning"&&typeof t.reasoning=="string")return t.reasoning;if(t.type==="thinking"&&typeof t.thinking=="string")return t.thinking}function qe(e){if(e==null||typeof e!="object")return!1;let t=e.type;return t==="reasoning"||t==="thinking"}function _e(e){if(e)return{...e,input_tokens:e.input_tokens??0,output_tokens:e.output_tokens??0,total_tokens:e.total_tokens??0}}function Ha(e){if(e!=null&&typeof e=="object"&&!Array.isArray(e))return e;if(typeof e!="string"||e.length===0)return{};try{let t=JSON.parse(e);return t!=null&&typeof t=="object"&&!Array.isArray(t)?t:{}}catch{return{}}}function Ya(e){let t=e;if(e.type==="tool_call"||e.type!=="tool_call_chunk"&&e.type!=="tool_use"&&e.type!=="input_json_delta")return e;let n=typeof t.name=="string"?t.name:void 0;if(n==null)return e;let s=t.args??t.input;return{...t,type:"tool_call",name:n,args:Ha(s)}}var ga=class{_buffer;constructor(e){this._buffer=e}get full(){let e=this._buffer;return{async*[Symbol.asyncIterator](){let t="";for await(let n of e.iterate()){let s=Ne(n);s?.type==="text-delta"&&(t+=s.text,yield t)}}}}[Symbol.asyncIterator](){let e=this._buffer;async function*t(){for await(let n of e.iterate()){let s=Ne(n);s?.type==="text-delta"&&(yield s.text)}}return t()}then(e,t){return(async()=>{let n="";for await(let s of this)n+=s;return n})().then(e,t)}},ha=class{_buffer;constructor(e){this._buffer=e}get full(){let e=this._buffer;return{async*[Symbol.asyncIterator](){let t=[];for await(let n of e.iterate())n.event==="content-block-finish"&&n.content.type==="tool_call"&&(t.push(n.content),yield[...t])}}}[Symbol.asyncIterator](){let e=this._buffer;async function*t(){for await(let n of e.iterate())n.event==="content-block-finish"&&n.content.type==="tool_call"&&(yield n.content)}return t()}then(e,t){return(async()=>{let n=[];for await(let s of this)n.push(s);return n})().then(e,t)}},_a=class{_buffer;constructor(e){this._buffer=e}get full(){let e=this._buffer;return{async*[Symbol.asyncIterator](){let t="",n=!1;for await(let s of e.iterate())if(s.event==="content-block-start"){if(!qe(s.content)){if(n)return;continue}n=!0;let o=da(s.content);if(o==null||o.length===0)continue;t+=o,yield t}else if(s.event==="content-block-delta"){let o=Ne(s);if(o?.type!=="reasoning-delta")continue;n=!0;let i=o.reasoning;if(i==null||i.length===0)continue;t+=i,yield t}else{if(s.event==="content-block-finish"&&qe(s.content))return;if(s.event==="message-finish")return}}}}[Symbol.asyncIterator](){let e=this._buffer;async function*t(){let n=!1;for await(let s of e.iterate())if(s.event==="content-block-start"){if(!qe(s.content)){if(n)return;continue}n=!0;let o=da(s.content);o!=null&&o.length>0&&(yield o)}else if(s.event==="content-block-delta"){let o=Ne(s);if(o?.type!=="reasoning-delta")continue;n=!0;let i=o.reasoning;i!=null&&i.length>0&&(yield i)}else{if(s.event==="content-block-finish"&&qe(s.content))return;if(s.event==="message-finish")return}}return t()}then(e,t){return(async()=>{let n="";for await(let s of this)n+=s;return n})().then(e,t)}},ya=class{_buffer;constructor(e){this._buffer=e}[Symbol.asyncIterator](){let e=this._buffer;async function*t(){for await(let n of e.iterate())if(n.event==="usage"){let s=_e(n.usage);s&&(yield s)}else if(n.event==="message-start"&&n.usage){let s=_e(n.usage);s&&(yield s)}else if(n.event==="message-finish"&&n.usage){let s=_e(n.usage);s&&(yield s)}}return t()}then(e,t){return(async()=>{let n;for await(let s of this)n=s;return n})().then(e,t)}},Qe=class{_buffer;constructor(e){this._buffer=new Ka,this._consume(e)}async _consume(e){try{for await(let t of e)this._buffer.push(t);this._buffer.finish()}catch(t){this._buffer.setError(t instanceof Error?t:new Error(String(t)))}}[Symbol.asyncIterator](){return this._buffer.iterate()}get text(){return new ga(this._buffer)}get toolCalls(){return new ha(this._buffer)}get reasoning(){return new _a(this._buffer)}get usage(){return new ya(this._buffer)}get output(){return this._assembleMessage()}then(e,t){return this._assembleMessage().then(e,t)}async _assembleMessage(){let e=[],t,n,s={},o;for await(let u of this._buffer.iterate())switch(u.event){case"message-start":t=u.id??t,u.usage&&(n=_e(u.usage));break;case"content-block-start":e[u.index]=u.content;break;case"content-block-delta":{let m=e[u.index],p=Ne(u);m&&p&&(e[u.index]=Wa(m,p));break}case"content-block-finish":e[u.index]=u.content;break;case"usage":n=_e(u.usage);break;case"message-finish":o=u.reason,u.usage&&(n=_e(u.usage)),u.responseMetadata&&(s={...s,...u.responseMetadata});break;default:break}let i=e.filter(u=>u!=null).map(Ya);return new j({id:t,content:i,usage_metadata:n,response_metadata:{...s,...o?{finish_reason:o}:{},output_version:"v1"}})}};var gr=S({Embeddings:()=>Za}),Za=class{caller;constructor(e){this.caller=new Tn(e??{})}};var le=class extends V{static lc_name(){return"RunnablePassthrough"}lc_namespace=["langchain_core","runnables"];lc_serializable=!0;func;constructor(e){super(e),e&&(this.func=e.func)}async invoke(e,t){let n=oe(t);return this.func&&await this.func(e,n),this._callWithConfig(s=>Promise.resolve(s),e,n)}async*transform(e,t){let n=oe(t),s,o=!0;for await(let i of this._transformStreamWithConfig(e,u=>u,n))if(yield i,o)if(s===void 0)s=i;else try{s=K(s,i)}catch{s=void 0,o=!1}this.func&&s!==void 0&&await this.func(s,n)}static assign(e){return new Ye(new He({steps:e}))}};var ba=class extends V{static lc_name(){return"RouterRunnable"}lc_namespace=["langchain_core","runnables"];lc_serializable=!0;runnables;constructor(e){super(e),this.runnables=e.runnables}async invoke(e,t){let{key:n,input:s}=e,o=this.runnables[n];if(o===void 0)throw new Error(`No runnable associated with key "${n}".`);return o.invoke(s,oe(t))}async batch(e,t,n){let s=e.map(h=>h.key),o=e.map(h=>h.input);if(s.find(h=>this.runnables[h]===void 0)!==void 0)throw new Error("One or more keys do not have a corresponding runnable.");let i=s.map(h=>this.runnables[h]),u=this._getOptionsList(t??{},e.length),m=u[0]?.maxConcurrency??n?.maxConcurrency,p=m&&m>0?m:e.length,g=[];for(let h=0;h<o.length;h+=p){let b=o.slice(h,h+p).map((y,f)=>i[f].invoke(y,u[f])),_=await Promise.all(b);g.push(_)}return g.flat()}async stream(e,t){let{key:n,input:s}=e,o=this.runnables[n];if(o===void 0)throw new Error(`No runnable associated with key "${n}".`);return o.stream(s,t)}};var Ta=class extends V{static lc_name(){return"RunnableBranch"}lc_namespace=["langchain_core","runnables"];lc_serializable=!0;default;branches;constructor(e){super(e),this.branches=e.branches,this.default=e.default}static from(e){if(e.length<1)throw new Error("RunnableBranch requires at least one branch");let t=e.slice(0,-1).map(([s,o])=>[he(s),he(o)]),n=he(e[e.length-1]);return new this({branches:t,default:n})}async _invoke(e,t,n){let s;for(let o=0;o<this.branches.length;o+=1){let[i,u]=this.branches[o];if(await i.invoke(e,z(t,{callbacks:n?.getChild(`condition:${o+1}`)}))){s=await u.invoke(e,z(t,{callbacks:n?.getChild(`branch:${o+1}`)}));break}}return s||(s=await this.default.invoke(e,z(t,{callbacks:n?.getChild("branch:default")}))),s}async invoke(e,t={}){return this._callWithConfig(this._invoke,e,t)}async*_streamIterator(e,t){let n=await(await Ge(t))?.handleChainStart(this.toJSON(),Wn(e,"input"),t?.runId,void 0,void 0,void 0,t?.runName),s,o=!0,i;try{for(let u=0;u<this.branches.length;u+=1){let[m,p]=this.branches[u];if(await m.invoke(e,z(t,{callbacks:n?.getChild(`condition:${u+1}`)}))){i=await p.stream(e,z(t,{callbacks:n?.getChild(`branch:${u+1}`)}));for await(let g of i)if(yield g,o)if(s===void 0)s=g;else try{s=K(s,g)}catch{s=void 0,o=!1}break}}if(i===void 0){i=await this.default.stream(e,z(t,{callbacks:n?.getChild("branch:default")}));for await(let u of i)if(yield u,o)if(s===void 0)s=u;else try{s=K(s,u)}catch{s=void 0,o=!1}}}catch(u){throw await n?.handleChainError(u),u}await n?.handleChainEnd(s??{})}};var va=class extends Ke{runnable;inputMessagesKey;outputMessagesKey;historyMessagesKey;getMessageHistory;constructor(e){let t=$.from((i,u)=>this._enterHistory(i,u??{})).withConfig({runName:"loadHistory"}),n=e.historyMessagesKey??e.inputMessagesKey;n&&(t=le.assign({[n]:t}).withConfig({runName:"insertHistory"}));let s=t.pipe(e.runnable.withListeners({onEnd:(i,u)=>this._exitHistory(i,u??{})})).withConfig({runName:"RunnableWithMessageHistory"}),o=e.config??{};super({...e,config:o,bound:s}),this.runnable=e.runnable,this.getMessageHistory=e.getMessageHistory,this.inputMessagesKey=e.inputMessagesKey,this.outputMessagesKey=e.outputMessagesKey,this.historyMessagesKey=e.historyMessagesKey}_getInputMessages(e){let t;if(typeof e=="object"&&!Array.isArray(e)&&!U(e)){let n;this.inputMessagesKey?n=this.inputMessagesKey:Object.keys(e).length===1?n=Object.keys(e)[0]:n="input",Array.isArray(e[n])&&Array.isArray(e[n][0])?t=e[n][0]:t=e[n]}else t=e;if(typeof t=="string")return[new ne(t)];if(Array.isArray(t))return t;if(U(t))return[t];throw new Error(`Expected a string, BaseMessage, or array of BaseMessages.
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
/* COPYRIGHT Esri - https://js.arcgis.com/5.2/LICENSE.txt */
|
|
2
|
-
import{a as I}from"./XQ3NBBQ3.js";import o from"./
|
|
2
|
+
import{a as I}from"./XQ3NBBQ3.js";import o from"./BBB5EJUB.js";import{c as A,d as K}from"./GMZUN5SF.js";import"./KY7M4WHO.js";import n from"./UOKYHQNO.js";import m from"./YI6NIHNI.js";import l from"./L5IPMRHC.js";import j from"./UQRBY7ID.js";import i from"./FX4LV2S3.js";import"./34O57OGV.js";import"./XEJFVUNQ.js";import h from"./XC3T3Z5R.js";import"./KX6CZEVZ.js";import"./PGH7POKS.js";import g from"./NPV4MEAZ.js";import"./AQF6BBWC.js";import"./ZSLHB6MF.js";import"./TJBU5BQK.js";import f from"./C67KQCPS.js";import"./OVIQ5NSE.js";import"./QUZTFUWM.js";import"./OGZFST2A.js";import"./X5ET73QZ.js";import e from"./MPQ2OZXN.js";import a from"./JZPPP4QY.js";import"./ONQ6JSBJ.js";import"./2DWN3SKH.js";import"./FDOMMK2M.js";import"./DYSPEU7W.js";import{a as S,c as T}from"./66VWTARH.js";import"./24TK55FP.js";import"./FJV7CI7O.js";import"./WSIZ2OTL.js";import{C as x,x as y}from"./RE7MJTEF.js";import"./R74ZHFA6.js";import"./DJG6DBCU.js";import"./C76HLPKU.js";import"./RFPTOFM4.js";import{a as c,b}from"./CADNOKIK.js";import"./BMPBJXD7.js";import"./CDS2HGQY.js";import{Ea as _,a as k,b as d,j as v}from"./QEGO4B2W.js";import"./EEHDAYOG.js";import"./XWNZMKQF.js";import"./FSLPYC4Y.js";import"./AMP43OT2.js";import{fa as u}from"./2UKFCF2J.js";import"./UZLQALHY.js";export default $arcgis.t(([,,,{fetchKnowledgeGraph:W},,,,,,,,,,,{a:q,b:h,o:m,p:w,q:E,r:M,s:C,t:G,u:N,v:R,w:z,x:L,y:$,z:F}])=>{var D=[N,R,$,z,G,F,L];async function O(e,t){let o=await m("arcgis_knowledge_tool_prompt"),s=E(t),r={assignedTask:e.agentExecutionContext.assignedTask,userRequest:e.agentExecutionContext.userRequest,priorSteps:e.agentExecutionContext.priorSteps,contextType:s},n=await T({promptText:o,messages:e.arcgisKnowledgeMessages,inputVariables:r,tools:D,config:t}),i=(n.tool_calls?.length??0)>0,a=typeof n.text=="string"?n.text.trim():"",l=a.length>0,g=n.text;return!i&&(s==="map"||s==="knowledgeGraph")?{...e,arcgisKnowledgeMessages:[...e.arcgisKnowledgeMessages,n],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,n],outputMessage:i?g:a,status:i?e.status:l?"success":"failed",summary:g?h(g):"ArcGIS Knowledge Agent tool executed."}}var U={generateCypher:"generated-cypher-query",queryGraphData:"graph-query-result",searchGraphData:"graph-search-result",addRecords:"added-records",applyLayout:"applied-layout",changeNonspatialVisibility:"changed-nonspatial-visibility",createLinkChart:"created-link-chart"};function j(e){return!!e&&e.status==="success"&&!!U[e.toolName]}function J(e){return{type:U[e.toolName],data:e.details}}async function P(e,t){let o=new q(D,{handleToolErrors:!1});try{let s=await o.invoke({messages:e.arcgisKnowledgeMessages},t),r=[];for(let a of s.messages){let l;if(typeof a.content!="string")throw new Error(`Unexpected tool message content type: ${typeof a.content}. Expected string.`);try{l=JSON.parse(a.content)}catch{throw new Error(`Failed to parse tool message content as JSON. Tool: ${a.name??"unknown"}.
|
|
3
3
|
|
|
4
4
|
Original Content: ${a.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)}`);r.push(l)}await c({text:`Finished executing ArcGIS Knowledge Agent tools: ${s.messages.filter(a=>a.name).map(a=>a.name).join(", ")}`},t);let n=r.filter(a=>typeof a!="string").map(a=>`- Called Tool: ${a.toolName}, Status: ${a.status}`),i=r[0];return i&&j(i)&&await b(J(i),t),{...e,outputMessage:n.join(`
|
|
5
5
|
`),summary:n.length?h(n.join(`
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
/* COPYRIGHT Esri - https://js.arcgis.com/5.2/LICENSE.txt */
|
|
2
|
+
import{a as V,b as I}from"./34O57OGV.js";import{a as x}from"./XEJFVUNQ.js";import a from"./JZPPP4QY.js";import{a as q}from"./ONQ6JSBJ.js";import{a as E}from"./FDOMMK2M.js";import{a as e}from"./RFPTOFM4.js";import{Ga as F}from"./FSLPYC4Y.js";export default $arcgis.t(([U,W,C,{a:v,b:L,c:T,d:N,e:O,f:R}])=>{var $=async p=>{let{targetLayer:s,fieldName:l,statisticType:n,mapView:r,layersAndFieldsRegistry:h,geometryFilter:t}=p,a=r.map?.allLayers.find(i=>i.id===s.layerId);if(!a)throw new Error(`Layer '${s.layerId}' not found.`);let w=await r.whenLayerView(a),S=x(l,a.fields.map(i=>i.name)),o=h.get(s.layerId)?.fieldRegistry.get(S),j=o?.alias;if(!o)throw new Error(`Field '${S}' not found.`);let b,c;if(t){let i=await N(t,r);if("error"in i)throw new Error(i.error);if(!i.geometry)throw T(t)?new Error(`No features found matching: ${t.where}`):new Error("Failed to create geometry");if(T(t)){let g=r.map?.allLayers.find(f=>f.id===t.layerId);b={geometryLayerName:g?.title??g?.id,geometryLayerId:t.layerId,geometryWhere:t.where,distance:t.distance,units:t.units,applied:!0}}else L(t)&&(b={point:t.point,distance:t.distance,units:t.units,applied:!0});c=new C({geometry:i.geometry,distance:t.distance,units:t.units,spatialRelationship:"intersects"})}let y=V(w,[l],!1),u=null,m=null,A=10;if(o.type!=="geometry"&&o.type!=="oid"&&o.type!=="global-id")try{let i={layer:a,useFeaturesInView:y,view:y?r:void 0,field:l,sqlWhere:I(a.definitionExpression,s.where),...c&&{filter:c},outStatisticTypes:{include:[n]}};u=await U(i);let g=["string","small-integer","integer"],f=o.domain?.type==="coded-value"?o.domain:null;(g.includes(o.type)||f)&&(m=(await W({layer:a,useFeaturesInView:y,view:y?r:void 0,field:l,sqlWhere:I(a.definitionExpression,s.where),...c&&{filter:c}})).uniqueValueInfos.sort((d,D)=>D.count-d.count).slice(0,A)),m&&o.domain?.type==="coded-value"&&(m=m.map(d=>({...d,value:f?f.getName(d.value)??d.value:d.value})))}catch(i){console.error("Statistics error:",i)}return{tool:"getStatistics",layerName:a.title??s.layerId,summary:`${n} = ${typeof u?.[n]=="number"?u[n]:"N/A"}`,details:{fieldName:l,fieldAlias:j,statisticType:n,statistic:u?.[n]??null,summaryStatistics:u,uniqueValues:m,where:s.where,spatialFilterInfo:b}}};async function Q({targetLayer:p,fieldName:s,statisticType:l,geometryFilter:n},r){let h=E(r,"layersAndFieldsRegistry"),{mapView:t}=q(r,["mapView"]),a=R(n,r.state?.agentExecutionContext?.sharedResources),w=await $({targetLayer:p,fieldName:s,statisticType:l,mapView:t,layersAndFieldsRegistry:h,geometryFilter:a});return JSON.stringify(w,null,2)}var G=e.object({layerId:e.string().describe("The layerId of the layer containing the geometry by which to filter."),where:e.string().describe("The SQL-92 where clause representing the features from which to filter."),distance:e.number().optional().describe("The buffer distance around the geometry."),units:v.optional().describe("The units for the distance buffer.")}),H=e.object({point:e.object({x:e.number().describe("X coordinate (longitude) from navigation result"),y:e.number().describe("Y coordinate (latitude) from navigation result"),spatialReference:e.object({wkid:e.number().describe("Spatial reference WKID (e.g., 4326 for WGS84)")}).optional().describe("Spatial reference. Defaults to map's spatial reference if not provided.")}).describe("Point coordinates from a previous navigation/geocoding result"),distance:e.number().optional().describe("Optional buffer distance around the point."),units:v.optional().describe("The units for the distance buffer.")}),J=e.object({targetLayer:e.object({layerId:e.string().describe("The layerId of the layer containing the field from which to get a value."),where:e.string().describe("The SQL-92 where clause representing the feature from which to get an attribute value.")}),geometryFilter:e.union([G,H,O]).optional().describe("Geometry filter for spatial queries. Use 'sharedResourceId' with an ID from listSharedResources for a previously geocoded location. Use 'point' for inline coordinates or 'layerId/where' for features from another layer."),fieldName:e.string().describe("The name of the field for which to get statistics. STRICTLY DO NOT use OBJECTID. Use any other field"),statisticType:e.enum(["avg","max","median","min","stddev","sum","variance","nullcount","count"]).describe("The statistic type to calculate.")}),te=F(Q,{name:"getStatistics",description:`Computes a single aggregate statistic (max, min, avg, sum, median, stddev, variance) for a numeric field across matching features. Also returns frequency analysis for categorical fields.
|
|
3
|
+
|
|
4
|
+
USE THIS TOOL FOR:
|
|
5
|
+
- "What is the average/maximum/minimum/total [field]?" \u2014 aggregate computations
|
|
6
|
+
- "Most common/frequent value of [field]?" \u2014 frequency analysis
|
|
7
|
+
- Questions requiring a mathematical aggregation across many features
|
|
8
|
+
|
|
9
|
+
DO NOT USE FOR:
|
|
10
|
+
- "How many features match X?" \u2014 use queryFeatures instead (it returns totalCount)
|
|
11
|
+
- "Show / list / find features" \u2014 use queryFeatures instead
|
|
12
|
+
- Simple counts of features matching a condition \u2014 use queryFeatures instead
|
|
13
|
+
|
|
14
|
+
Only call this tool when the answer requires computing an aggregate (avg, max, min, sum, median, stddev) over a field's values, not just counting or listing features.`,schema:J});return te},"smartMapping/statistics/summaryStatistics","smartMapping/statistics/uniqueValues","layers/support/FeatureFilter",a)
|
|
@@ -1,2 +1,2 @@
|
|
|
1
1
|
/* COPYRIGHT Esri - https://js.arcgis.com/5.2/LICENSE.txt */
|
|
2
|
-
import{a as p,c}from"./AAUVOBPS.js";import{
|
|
2
|
+
import{a as p,c}from"./AAUVOBPS.js";import{C as b,g,h as l,x as u}from"./RE7MJTEF.js";import"./R74ZHFA6.js";import"./UZLQALHY.js";var m=g`:host{display:block;min-width:0}h3{margin:0 0 var(--calcite-spacing-sm);font-size:var(--calcite-font-size-relative-base);font-weight:var(--calcite-font-weight-semibold)}.token-table{overflow-x:auto}calcite-table{font-variant-numeric:tabular-nums}.pricing{margin:var(--calcite-spacing-sm) 0 0;color:var(--calcite-color-text-3);font-size:var(--calcite-font-size-relative-sm);overflow-wrap:anywhere}`,v=new Intl.NumberFormat(void 0,{style:"currency",currency:"USD",maximumFractionDigits:6});function n(r){return r===void 0?"Unavailable":v.format(r)}var s=class extends u{constructor(){super(...arguments),this.aggregate=!1,this.pricing=p}static{this.properties={usage:0,aggregate:5,pricing:0}}static{this.styles=m}render(){let d=this.usage;if(!d)return null;let{tokens:t,cost:e,rates:i,uncached:o}=d,h=[{group:"Input",groupRows:4,label:"Non-cached input",tokens:o===void 0?"Not reported":Number.isFinite(o)&&o>=0?o.toLocaleString():"Invalid usage",rate:n(i?.input),cost:c(e?.input)},{label:"Cache reads",tokens:t.cacheRead?.toLocaleString()??"Not reported",rate:n(i?.cachedInput),cost:t.cacheRead===void 0?"Not reported":c(e?.cachedInput)},{label:"Cache writes",tokens:t.cacheWrite?.toLocaleString()??"Not reported",rate:n(i?.cacheWrite),cost:t.cacheWrite===void 0?"Not reported":c(e?.cacheWrite)},{label:"Input (total)",tokens:t.input?.toLocaleString()??"Unavailable",rate:"-",cost:c(e?e.input+e.cachedInput+e.cacheWrite:void 0)},{group:"Output",groupRows:2,label:"Reasoning (within output)",tokens:t.reasoning?.toLocaleString()??"Not reported",rate:"-",cost:"Included in output"},{label:"Output (total)",tokens:t.output?.toLocaleString()??"Unavailable",rate:n(i?.output),cost:c(e?.output)}];return l`<section aria-label=Usage><h3>Usage</h3><div class="token-table"><calcite-table aria-label="Token usage and estimated cost (USD)" caption="Token usage and estimated cost (USD)" scale=s interaction-mode=static bordered><calcite-table-row slot=table-header><calcite-table-header heading=Category col-span=2></calcite-table-header><calcite-table-header heading=Tokens alignment=end></calcite-table-header>${this.aggregate?null:l`<calcite-table-header heading="Rate / 1M" alignment=end></calcite-table-header>`}<calcite-table-header heading="Est. cost" alignment=end></calcite-table-header></calcite-table-row>${h.map(a=>l`<calcite-table-row>${a.group?l`<calcite-table-header .heading=${a.group} .rowSpan=${a.groupRows}></calcite-table-header>`:null}<calcite-table-header .heading=${a.label}></calcite-table-header><calcite-table-cell alignment=end>${a.tokens}</calcite-table-cell>${this.aggregate?null:l`<calcite-table-cell alignment=end>${a.rate}</calcite-table-cell>`}<calcite-table-cell alignment=end>${a.cost}</calcite-table-cell></calcite-table-row>`)}<calcite-table-row slot=table-footer><calcite-table-header heading=Total col-span=2></calcite-table-header><calcite-table-cell alignment=end>${t.total?.toLocaleString()??"Unavailable"}</calcite-table-cell>${this.aggregate?null:l`<calcite-table-cell alignment=end>-</calcite-table-cell>`}<calcite-table-cell alignment=end>${c(e?.total)}</calcite-table-cell></calcite-table-row></calcite-table></div><p class="pricing">Rates last updated: ${this.pricing.updatedAt}</p></section>`}};b("arcgis-assistant-observation-usage",s);export{s as ArcgisAssistantObservationUsage};
|
|
@@ -1,2 +1,2 @@
|
|
|
1
1
|
/* COPYRIGHT Esri - https://js.arcgis.com/5.2/LICENSE.txt */
|
|
2
|
-
import{B as y,g as C,h as S,n as c,w as R,z as m}from"./2FUTKTNO.js";import"./R74ZHFA6.js";import"./UZLQALHY.js";export default $arcgis.t(([{watch:u},{property:d,subclass:f},w])=>{var I=C`.button{--calcite-button-background-color: var(--calcite-color-transparent);--calcite-button-border-color: transparent;--calcite-button-icon-color: var(--calcite-color-text-3);--calcite-button-text-color: var(--calcite-color-text-3);flex:0 0 auto;position:relative}.button[data-state=disabled]{--calcite-button-icon-color: var(--calcite-color-text-3);opacity:var(--calcite-opacity-disabled)}.button[data-state=listening]{--calcite-button-background-color: color-mix( in srgb, var(--calcite-color-brand) 14%, var(--calcite-color-foreground-1) );--calcite-button-border-color: color-mix(in srgb, var(--calcite-color-brand) 24%, transparent);--calcite-button-icon-color: var(--calcite-color-brand);--calcite-button-text-color: var(--calcite-color-brand);box-shadow:var(--calcite-shadow-sm)}.button[data-state=listening]:hover{--calcite-button-background-color: color-mix( in srgb, var(--calcite-color-brand-hover, var(--calcite-color-brand)) 18%, var(--calcite-color-foreground-1) )}.button[data-state=listening]:active{--calcite-button-background-color: color-mix( in srgb, var(--calcite-color-brand) 24%, var(--calcite-color-foreground-1) )}.button[data-state=processing]{--calcite-button-background-color: color-mix( in srgb, var(--calcite-color-brand) 10%, var(--calcite-color-foreground-1) );--calcite-button-border-color: color-mix(in srgb, var(--calcite-color-brand) 20%, transparent);--calcite-button-icon-color: var(--calcite-color-brand);--calcite-button-text-color: var(--calcite-color-brand)}.button[data-state=error]{--calcite-button-background-color: color-mix( in srgb, var(--calcite-color-status-danger) 12%, var(--calcite-color-foreground-1) );--calcite-button-border-color: color-mix(in srgb, var(--calcite-color-status-danger) 24%, transparent);--calcite-button-icon-color: var(--calcite-color-status-danger);--calcite-button-text-color: var(--calcite-color-status-danger)}.button[data-state=listening]:after{content:"";position:absolute;inset:-4px;border:1px solid color-mix(in srgb,var(--calcite-color-brand) 40%,transparent);border-radius:inherit;opacity:0;pointer-events:none;transform:scale(.92);animation:assistant-speech-input-recording-pulse 1.8s ease-out infinite}@keyframes assistant-speech-input-recording-pulse{0%{opacity:.65;transform:scale(.92)}70%{opacity:0;transform:scale(1.16)}to{opacity:0;transform:scale(1.16)}}@media(prefers-reduced-motion){.button[data-state=listening]:after{animation:none}}`,T=["audio/webm;codecs=opus","audio/webm","audio/mp4","audio/ogg;codecs=opus","audio/ogg"];function h(e){return e.replace(/\s+/gu," ").trim()}var x=Object.defineProperty,V=Object.getOwnPropertyDescriptor,p=(e,t,s,i)=>{for(var r=i>1?void 0:i?V(t,s):t,n=e.length-1,o;n>=0;n--)(o=e[n])&&(r=(i?o(t,s,r):o(r))||r);return i&&r&&x(t,s,r),r},a=class extends w{constructor(e){super(e),this.state="idle",this.liveTranscript="",this.transcript="",this.errorCode=void 0}static isSupported(){return!1}};p([d()],a.prototype,"language",2);p([d({readOnly:!0})],a.prototype,"state",2);p([d({readOnly:!0})],a.prototype,"liveTranscript",2);p([d({readOnly:!0})],a.prototype,"transcript",2);p([d({readOnly:!0})],a.prototype,"errorCode",2);a=p([f("SpeechController")],a);var O=Object.defineProperty,M=Object.getOwnPropertyDescriptor,g=(e,t,s,i)=>{for(var r=i>1?void 0:i?M(t,s):t,n=e.length-1,o;n>=0;n--)(o=e[n])&&(r=(i?o(t,s,r):o(r))||r);return i&&r&&O(t,s,r),r},l=class extends a{constructor(e){super(e),this._activeSessionId=null,this._mediaRecorder=null,this._mediaRecorderChunkIndex=0,this._mediaRecorderStopReason=null,this._mediaStream=null,this._pendingChunkOperations=new Set,this._recordedChunks=[],this.handleRecording=null,this.chunkTimeSlice=3e3}get _mimeType(){return typeof window>"u"||typeof window.MediaRecorder?.isTypeSupported!="function"?"":T.find(e=>window.MediaRecorder.isTypeSupported(e))??""}destroy(){this._mediaRecorder&&(this._mediaRecorder.onstart=null,this._mediaRecorder.ondataavailable=null,this._mediaRecorder.onerror=null,this._mediaRecorder.onstop=null),this.cancel(),this._mediaRecorder=null}_queuePendingChunkOperation(e){this._pendingChunkOperations.add(e),e.finally(()=>{this._pendingChunkOperations.delete(e)})}async _awaitPendingChunkOperations(){this._pendingChunkOperations.size&&await Promise.allSettled(Array.from(this._pendingChunkOperations))}_onDataAvailable(e){let t=this._activeSessionId;t!=null&&this._queuePendingChunkOperation(this._processDataAvailable(e,t))}async _processDataAvailable(e,t){let s=e.data;if(!s.size||t!==this._activeSessionId)return;this._recordedChunks.push(s);let i=s.type||this._mediaRecorder?.mimeType||this._mimeType,r=this._mediaRecorderStopReason==="toggle"&&this._mediaRecorder?.state==="inactive";try{if(!this.handleRecording)return;let n=h(await this.handleRecording(s,i,this._mediaRecorderChunkIndex,r)??"");if(t!==this._activeSessionId)return;n&&this._set("liveTranscript",h(`${this.liveTranscript} ${n}`))}catch(n){if(t!==this._activeSessionId)return;this._failSession(n instanceof Error&&n.message==="transcription-unavailable"?"transcription-unavailable":"transcription-failed");return}!r&&t===this._activeSessionId&&(this._mediaRecorderChunkIndex+=1)}_failSession(e){let t=this._mediaRecorder;if(t){t.onstart=null,t.ondataavailable=null,t.onerror=null,t.onstop=null;try{t.state!=="inactive"&&t.stop()}catch{}}this._activeSessionId=null,this._mediaRecorder=null,this._mediaRecorderChunkIndex=0,this._mediaRecorderStopReason=null,this._pendingChunkOperations.clear(),this._recordedChunks=[],this._releaseMediaStream(),this._set("liveTranscript",""),this._set("transcript",""),this._set("state","error"),this._set("errorCode",e)}_onError(){this._failSession("recording-failed")}_onStart(){this._set("state","listening")}_onStop(){this._handleStop()}_releaseMediaStream(){this._mediaStream?.getTracks().forEach(e=>e.stop()),this._mediaStream=null}async _handleStop(){let e=this._mediaRecorder,t=this._activeSessionId,s=this._mediaRecorderStopReason,i=e?.mimeType||this._recordedChunks.find(n=>!!n.type)?.type||"",r=[...this._recordedChunks];if(this._mediaRecorder=null,this._mediaRecorderChunkIndex=0,this._releaseMediaStream(),s==="cancel"){this._activeSessionId===t&&(this._activeSessionId=null),this._mediaRecorderStopReason=null,this._pendingChunkOperations.clear(),this._recordedChunks=[],this._set("liveTranscript",""),this._set("transcript",""),this._set("state","idle"),this._set("errorCode",void 0);return}if(t==null){this._mediaRecorderStopReason=null,this._pendingChunkOperations.clear(),this._recordedChunks=[],this._set("state","idle"),this._set("errorCode",void 0);return}if(await this._awaitPendingChunkOperations(),t===this._activeSessionId){if(!(i?new Blob(r,{type:i}):new Blob(r)).size){this._activeSessionId===t&&(this._activeSessionId=null),this._mediaRecorderStopReason=null,this._recordedChunks=[],this._set("state","error"),this._set("errorCode","recording-failed");return}this._set("state","processing"),this._set("transcript",h(`${this.transcript} ${this.liveTranscript}`)),this._set("liveTranscript",""),this._activeSessionId===t&&(this._activeSessionId=null),this._set("state","idle"),this._set("errorCode",void 0),this._mediaRecorderStopReason=null,this._recordedChunks=[]}}start(){if(!l.isSupported()){this._set("errorCode","not-supported");return}let e=Date.now();this._activeSessionId=e,this._mediaRecorderChunkIndex=0,this._mediaRecorderStopReason=null,this._pendingChunkOperations.clear(),this._recordedChunks=[],this._set("liveTranscript",""),this._set("transcript",""),this._set("errorCode",void 0),navigator.mediaDevices.getUserMedia({audio:!0}).then(t=>{if(e!==this._activeSessionId){t.getTracks().forEach(r=>r.stop());return}let s=this._mimeType,i=s?new window.MediaRecorder(t,{mimeType:s}):new window.MediaRecorder(t);this._mediaStream=t,this._mediaRecorder=i,this._mediaRecorderChunkIndex=0,this._mediaRecorderStopReason=null,this._recordedChunks=[],i.ondataavailable=this._onDataAvailable.bind(this),i.onerror=this._onError.bind(this),i.onstart=this._onStart.bind(this),i.onstop=this._onStop.bind(this),this._mediaRecorder.start(this.chunkTimeSlice)}).catch(t=>{e===this._activeSessionId&&(this._activeSessionId=null,this._mediaRecorder=null,this._mediaRecorderChunkIndex=0,this._mediaRecorderStopReason=null,this._pendingChunkOperations.clear(),this._recordedChunks=[],this._releaseMediaStream(),t instanceof DOMException&&t.name==="NotAllowedError"?(this._set("state","error"),this._set("errorCode","not-allowed")):(this._set("state","error"),this._set("errorCode","recording-failed")))})}stop(){if(this._mediaRecorder){this._mediaRecorderStopReason="toggle";try{this._mediaRecorder.state!=="inactive"?this._mediaRecorder.stop():this._handleStop()}catch{}}}cancel(){let e=this._mediaRecorder;if(this._activeSessionId=null,this._mediaRecorderStopReason="cancel",this._mediaRecorderChunkIndex=0,this._pendingChunkOperations.clear(),this._recordedChunks=[],this._set("liveTranscript",""),this._set("transcript",""),this._set("state","idle"),this._set("errorCode",void 0),!e){this._releaseMediaStream();return}try{if(e.state!=="inactive"){e.stop();return}}catch{}this._mediaRecorder=null,this._releaseMediaStream()}static isSupported(){return typeof window<"u"&&!!(window.MediaRecorder&&navigator.mediaDevices?.getUserMedia)}};g([d()],l.prototype,"_mimeType",1);g([d()],l.prototype,"handleRecording",2);g([d()],l.prototype,"chunkTimeSlice",2);l=g([f("MediaRecorderController")],l);var D=Object.getOwnPropertyDescriptor,E=(e,t,s,i)=>{for(var r=i>1?void 0:i?D(t,s):t,n=e.length-1,o;n>=0;n--)(o=e[n])&&(r=o(r)||r);return r};function k(){if(typeof window>"u")return null;let e=window;return e.SpeechRecognition??e.webkitSpeechRecognition??null}var _=class extends a{constructor(e){super(e),this._isCancelled=!1,this._recognition=null}initialize(){let e=k();if(!e)return;let t=new e;t.continuous=!0,t.interimResults=!0,this.language&&(t.lang=this.language),t.onstart=this._onStart.bind(this),t.onresult=this._onResult.bind(this),t.onerror=this._onError.bind(this),t.onend=this._onEnd.bind(this),t.onspeechend=this._onSpeechEnd.bind(this),this._recognition=t}destroy(){this._recognition&&(this._recognition.onstart=null,this._recognition.onresult=null,this._recognition.onerror=null,this._recognition.onend=null,this._recognition.onspeechend=null,this.cancel(),this._recognition=null)}_onStart(){this._isCancelled=!1,this._set("state","listening")}_onResult(e){let{finalTranscript:t,liveTranscript:s}=Array.from(e.results).reduce((i,r)=>(r.isFinal?i.finalTranscript+=r[0].transcript:i.liveTranscript+=r[0].transcript,i),{finalTranscript:"",liveTranscript:""});this._set("transcript",h(t)),this._set("liveTranscript",h(s))}_onError(e){if(e.error==="aborted"&&this._isCancelled){this._set("state","idle");return}let t="unhandled";switch(e.error){case"no-speech":t="no-speech";break;case"service-not-allowed":case"not-allowed":t="not-allowed";break;default:t="unhandled"}this._set("state","error"),this._set("errorCode",t)}_onEnd(){let e=h(`${this.transcript} ${this.liveTranscript}`);if(this._set("liveTranscript",""),this._isCancelled){this._set("transcript",""),this._set("state","idle"),this._set("errorCode",void 0);return}this.errorCode?this._set("transcript",""):(this._set("transcript",e),this._set("state","idle")),this._set("errorCode",void 0)}_onSpeechEnd(){this._set("state","processing")}_reset(e=!1){this._isCancelled=e,this._set("liveTranscript",""),this._set("transcript",""),this._set("errorCode",void 0),this._set("state","idle")}start(){if(!this._recognition){this._set("errorCode","not-supported");return}this._reset(!1);try{this._recognition.start()}catch{this._set("state","error"),this._set("errorCode","unhandled")}}stop(){if(this._recognition){this._set("state","processing");try{this._recognition.stop()}catch{}}}cancel(){if(this._recognition){this._reset(!0);try{this._recognition.abort()}catch{}}}static isSupported(){return!!k()}};_=E([f("WebSpeechController")],_);function b(e){let{baseValue:t,transcript:s}=e;if(!s)return t;let i=t.trim();return i?`${i} ${s}`:s}var v=class extends R{constructor(){super(...arguments),this.#t=null,this._resolvedMode="disabled",this.awaitingResponse=!1,this.inputValue="",this.mode="web-speech",this.arcgisVoiceInputDraftChange=c(),this.arcgisVoiceInputError=c(),this.arcgisVoiceInputInterimTranscription=c(),this.arcgisVoiceInputStart=c(),this.arcgisVoiceInputStop=c(),this.arcgisVoiceInputTranscription=c(),this.arcgisVoiceInputTranscriptionStreamChunk=c()}static{this.properties={_resolvedMode:16,_state:16,_errorCode:16,_liveTranscript:16,_transcript:16,_isButtonDisabled:16,_buttonLabel:16,awaitingResponse:5,inputValue:1,language:1,mode:1}}static{this.styles=I}#t;get _state(){return this._speechController?.state??"idle"}get _errorCode(){return this._speechController?.errorCode??null}get _liveTranscript(){return this._speechController?.liveTranscript??""}get _transcript(){return this._speechController?.transcript??""}get _isButtonDisabled(){return this._resolvedMode==="disabled"||this.awaitingResponse||this._state==="processing"}get _buttonLabel(){if(this.awaitingResponse)return"Voice input unavailable while assistant is responding";if(this._resolvedMode==="disabled")return"Voice input unavailable";switch(this._state){case"error":return this._errorCode==="not-allowed"?"Microphone permission denied. Retry voice input":"Retry voice input";case"listening":return"Stop voice input";case"processing":return"Processing voice input";default:return"Start voice input"}}clearDraftSession(){this.#t=null}loaded(){this.manager.onLifecycle(()=>[u(()=>[this.mode,this.language],()=>{this._configureController()},{initial:!0}),u(()=>this.awaitingResponse,t=>{t&&this._cancelActiveSession()},{initial:!0}),u(()=>this._liveTranscript,t=>{if(t){let s=h(`${this._transcript} ${t}`);this.arcgisVoiceInputInterimTranscription.emit({transcript:s}),this._applyVoiceInputTranscript(s)}}),u(()=>this._transcript,t=>{t&&(this.arcgisVoiceInputTranscription.emit({transcript:t}),this._applyVoiceInputTranscript(t,{final:!0}))}),u(()=>this._state,t=>{t==="error"&&this._errorCode&&this.arcgisVoiceInputError.emit({errorCode:this._errorCode})})])}disconnectedCallback(){super.disconnectedCallback(),this._destroySpeechController()}_configureController(){let t=this._resolveMode();this._destroySpeechController(),this._resolvedMode=t,t!=="disabled"&&(this._speechController=t==="web-speech"?new _({language:this.language}):new l({language:this.language,handleRecording:this._handleRecording.bind(this)}))}_destroySpeechController(){this._speechController?.cancel(),this._speechController?.destroy(),this._speechController=void 0}_emitDraftChange(t,s){this.arcgisVoiceInputDraftChange.emit({focusInput:s?.focusInput,value:t})}_startVoiceInputSession(){this.#t={baseValue:this.inputValue.trim(),phase:"listening",transcript:""}}_finishVoiceInputSession(){let t=this.#t;if(!t){this._emitDraftChange(this.inputValue.trim());return}let s={...t,phase:"stopped"},i=b(s);this.#t=s,this._emitDraftChange(i)}async _applyVoiceInputTranscript(t,s){let i=this.#t;if(!t||!i)return;if(i.phase==="stopped"){let o=b(i);if(this.inputValue.trim()!==o){this.clearDraftSession();return}}let r={...i,transcript:t},n=b(r);this.#t=r,this._emitDraftChange(n,{focusInput:s?.final&&r.phase==="stopped"})}async _handleToggle(){if(!(this._isButtonDisabled||!this._speechController)){if(this._state==="listening"){this._speechController.stop(),this._finishVoiceInputSession(),this.arcgisVoiceInputStop.emit();return}this._speechController.start(),this._startVoiceInputSession(),this.arcgisVoiceInputStart.emit()}}async _handleRecording(t,s,i,r){let n;return this.arcgisVoiceInputTranscriptionStreamChunk.emit({blob:t,chunkIndex:i,isFinal:r,mimeType:s,respondWithTranscript:o=>{n=o}}),n}_resolveMode(){return this.mode==="disabled"?"disabled":this.mode==="web-speech"&&_.isSupported()?"web-speech":l.isSupported()?"media-recorder":"disabled"}async _cancelActiveSession(){this._speechController&&this._resolvedMode!=="disabled"&&this._speechController.cancel(),this.clearDraftSession()}render(){return S`<calcite-button appearance=transparent class="button" data-mode=${this._resolvedMode??m} data-state=${(this._resolvedMode==="disabled"?"disabled":this._state)??m} .disabled=${this._isButtonDisabled} icon-start=microphone kind=neutral .label=${this._buttonLabel} .loading=${this._state==="processing"} round scale=m @click=${()=>{this._handleToggle()}}></calcite-button>`}};y("arcgis-assistant-speech-input",v);return v},"core/reactiveUtils","core/accessorSupport/decorators","core/Accessor")
|
|
2
|
+
import{A as m,C as y,g as C,h as S,o as c,x as R}from"./RE7MJTEF.js";import"./R74ZHFA6.js";import"./UZLQALHY.js";export default $arcgis.t(([{watch:u},{property:d,subclass:f},w])=>{var I=C`.button{--calcite-button-background-color: var(--calcite-color-transparent);--calcite-button-border-color: transparent;--calcite-button-icon-color: var(--calcite-color-text-3);--calcite-button-text-color: var(--calcite-color-text-3);flex:0 0 auto;position:relative}.button[data-state=disabled]{--calcite-button-icon-color: var(--calcite-color-text-3);opacity:var(--calcite-opacity-disabled)}.button[data-state=listening]{--calcite-button-background-color: color-mix( in srgb, var(--calcite-color-brand) 14%, var(--calcite-color-foreground-1) );--calcite-button-border-color: color-mix(in srgb, var(--calcite-color-brand) 24%, transparent);--calcite-button-icon-color: var(--calcite-color-brand);--calcite-button-text-color: var(--calcite-color-brand);box-shadow:var(--calcite-shadow-sm)}.button[data-state=listening]:hover{--calcite-button-background-color: color-mix( in srgb, var(--calcite-color-brand-hover, var(--calcite-color-brand)) 18%, var(--calcite-color-foreground-1) )}.button[data-state=listening]:active{--calcite-button-background-color: color-mix( in srgb, var(--calcite-color-brand) 24%, var(--calcite-color-foreground-1) )}.button[data-state=processing]{--calcite-button-background-color: color-mix( in srgb, var(--calcite-color-brand) 10%, var(--calcite-color-foreground-1) );--calcite-button-border-color: color-mix(in srgb, var(--calcite-color-brand) 20%, transparent);--calcite-button-icon-color: var(--calcite-color-brand);--calcite-button-text-color: var(--calcite-color-brand)}.button[data-state=error]{--calcite-button-background-color: color-mix( in srgb, var(--calcite-color-status-danger) 12%, var(--calcite-color-foreground-1) );--calcite-button-border-color: color-mix(in srgb, var(--calcite-color-status-danger) 24%, transparent);--calcite-button-icon-color: var(--calcite-color-status-danger);--calcite-button-text-color: var(--calcite-color-status-danger)}.button[data-state=listening]:after{content:"";position:absolute;inset:-4px;border:1px solid color-mix(in srgb,var(--calcite-color-brand) 40%,transparent);border-radius:inherit;opacity:0;pointer-events:none;transform:scale(.92);animation:assistant-speech-input-recording-pulse 1.8s ease-out infinite}@keyframes assistant-speech-input-recording-pulse{0%{opacity:.65;transform:scale(.92)}70%{opacity:0;transform:scale(1.16)}to{opacity:0;transform:scale(1.16)}}@media(prefers-reduced-motion){.button[data-state=listening]:after{animation:none}}`,T=["audio/webm;codecs=opus","audio/webm","audio/mp4","audio/ogg;codecs=opus","audio/ogg"];function h(e){return e.replace(/\s+/gu," ").trim()}var x=Object.defineProperty,V=Object.getOwnPropertyDescriptor,p=(e,t,s,i)=>{for(var r=i>1?void 0:i?V(t,s):t,n=e.length-1,o;n>=0;n--)(o=e[n])&&(r=(i?o(t,s,r):o(r))||r);return i&&r&&x(t,s,r),r},a=class extends w{constructor(e){super(e),this.state="idle",this.liveTranscript="",this.transcript="",this.errorCode=void 0}static isSupported(){return!1}};p([d()],a.prototype,"language",2);p([d({readOnly:!0})],a.prototype,"state",2);p([d({readOnly:!0})],a.prototype,"liveTranscript",2);p([d({readOnly:!0})],a.prototype,"transcript",2);p([d({readOnly:!0})],a.prototype,"errorCode",2);a=p([f("SpeechController")],a);var O=Object.defineProperty,M=Object.getOwnPropertyDescriptor,g=(e,t,s,i)=>{for(var r=i>1?void 0:i?M(t,s):t,n=e.length-1,o;n>=0;n--)(o=e[n])&&(r=(i?o(t,s,r):o(r))||r);return i&&r&&O(t,s,r),r},l=class extends a{constructor(e){super(e),this._activeSessionId=null,this._mediaRecorder=null,this._mediaRecorderChunkIndex=0,this._mediaRecorderStopReason=null,this._mediaStream=null,this._pendingChunkOperations=new Set,this._recordedChunks=[],this.handleRecording=null,this.chunkTimeSlice=3e3}get _mimeType(){return typeof window>"u"||typeof window.MediaRecorder?.isTypeSupported!="function"?"":T.find(e=>window.MediaRecorder.isTypeSupported(e))??""}destroy(){this._mediaRecorder&&(this._mediaRecorder.onstart=null,this._mediaRecorder.ondataavailable=null,this._mediaRecorder.onerror=null,this._mediaRecorder.onstop=null),this.cancel(),this._mediaRecorder=null}_queuePendingChunkOperation(e){this._pendingChunkOperations.add(e),e.finally(()=>{this._pendingChunkOperations.delete(e)})}async _awaitPendingChunkOperations(){this._pendingChunkOperations.size&&await Promise.allSettled(Array.from(this._pendingChunkOperations))}_onDataAvailable(e){let t=this._activeSessionId;t!=null&&this._queuePendingChunkOperation(this._processDataAvailable(e,t))}async _processDataAvailable(e,t){let s=e.data;if(!s.size||t!==this._activeSessionId)return;this._recordedChunks.push(s);let i=s.type||this._mediaRecorder?.mimeType||this._mimeType,r=this._mediaRecorderStopReason==="toggle"&&this._mediaRecorder?.state==="inactive";try{if(!this.handleRecording)return;let n=h(await this.handleRecording(s,i,this._mediaRecorderChunkIndex,r)??"");if(t!==this._activeSessionId)return;n&&this._set("liveTranscript",h(`${this.liveTranscript} ${n}`))}catch(n){if(t!==this._activeSessionId)return;this._failSession(n instanceof Error&&n.message==="transcription-unavailable"?"transcription-unavailable":"transcription-failed");return}!r&&t===this._activeSessionId&&(this._mediaRecorderChunkIndex+=1)}_failSession(e){let t=this._mediaRecorder;if(t){t.onstart=null,t.ondataavailable=null,t.onerror=null,t.onstop=null;try{t.state!=="inactive"&&t.stop()}catch{}}this._activeSessionId=null,this._mediaRecorder=null,this._mediaRecorderChunkIndex=0,this._mediaRecorderStopReason=null,this._pendingChunkOperations.clear(),this._recordedChunks=[],this._releaseMediaStream(),this._set("liveTranscript",""),this._set("transcript",""),this._set("state","error"),this._set("errorCode",e)}_onError(){this._failSession("recording-failed")}_onStart(){this._set("state","listening")}_onStop(){this._handleStop()}_releaseMediaStream(){this._mediaStream?.getTracks().forEach(e=>e.stop()),this._mediaStream=null}async _handleStop(){let e=this._mediaRecorder,t=this._activeSessionId,s=this._mediaRecorderStopReason,i=e?.mimeType||this._recordedChunks.find(n=>!!n.type)?.type||"",r=[...this._recordedChunks];if(this._mediaRecorder=null,this._mediaRecorderChunkIndex=0,this._releaseMediaStream(),s==="cancel"){this._activeSessionId===t&&(this._activeSessionId=null),this._mediaRecorderStopReason=null,this._pendingChunkOperations.clear(),this._recordedChunks=[],this._set("liveTranscript",""),this._set("transcript",""),this._set("state","idle"),this._set("errorCode",void 0);return}if(t==null){this._mediaRecorderStopReason=null,this._pendingChunkOperations.clear(),this._recordedChunks=[],this._set("state","idle"),this._set("errorCode",void 0);return}if(await this._awaitPendingChunkOperations(),t===this._activeSessionId){if(!(i?new Blob(r,{type:i}):new Blob(r)).size){this._activeSessionId===t&&(this._activeSessionId=null),this._mediaRecorderStopReason=null,this._recordedChunks=[],this._set("state","error"),this._set("errorCode","recording-failed");return}this._set("state","processing"),this._set("transcript",h(`${this.transcript} ${this.liveTranscript}`)),this._set("liveTranscript",""),this._activeSessionId===t&&(this._activeSessionId=null),this._set("state","idle"),this._set("errorCode",void 0),this._mediaRecorderStopReason=null,this._recordedChunks=[]}}start(){if(!l.isSupported()){this._set("errorCode","not-supported");return}let e=Date.now();this._activeSessionId=e,this._mediaRecorderChunkIndex=0,this._mediaRecorderStopReason=null,this._pendingChunkOperations.clear(),this._recordedChunks=[],this._set("liveTranscript",""),this._set("transcript",""),this._set("errorCode",void 0),navigator.mediaDevices.getUserMedia({audio:!0}).then(t=>{if(e!==this._activeSessionId){t.getTracks().forEach(r=>r.stop());return}let s=this._mimeType,i=s?new window.MediaRecorder(t,{mimeType:s}):new window.MediaRecorder(t);this._mediaStream=t,this._mediaRecorder=i,this._mediaRecorderChunkIndex=0,this._mediaRecorderStopReason=null,this._recordedChunks=[],i.ondataavailable=this._onDataAvailable.bind(this),i.onerror=this._onError.bind(this),i.onstart=this._onStart.bind(this),i.onstop=this._onStop.bind(this),this._mediaRecorder.start(this.chunkTimeSlice)}).catch(t=>{e===this._activeSessionId&&(this._activeSessionId=null,this._mediaRecorder=null,this._mediaRecorderChunkIndex=0,this._mediaRecorderStopReason=null,this._pendingChunkOperations.clear(),this._recordedChunks=[],this._releaseMediaStream(),t instanceof DOMException&&t.name==="NotAllowedError"?(this._set("state","error"),this._set("errorCode","not-allowed")):(this._set("state","error"),this._set("errorCode","recording-failed")))})}stop(){if(this._mediaRecorder){this._mediaRecorderStopReason="toggle";try{this._mediaRecorder.state!=="inactive"?this._mediaRecorder.stop():this._handleStop()}catch{}}}cancel(){let e=this._mediaRecorder;if(this._activeSessionId=null,this._mediaRecorderStopReason="cancel",this._mediaRecorderChunkIndex=0,this._pendingChunkOperations.clear(),this._recordedChunks=[],this._set("liveTranscript",""),this._set("transcript",""),this._set("state","idle"),this._set("errorCode",void 0),!e){this._releaseMediaStream();return}try{if(e.state!=="inactive"){e.stop();return}}catch{}this._mediaRecorder=null,this._releaseMediaStream()}static isSupported(){return typeof window<"u"&&!!(window.MediaRecorder&&navigator.mediaDevices?.getUserMedia)}};g([d()],l.prototype,"_mimeType",1);g([d()],l.prototype,"handleRecording",2);g([d()],l.prototype,"chunkTimeSlice",2);l=g([f("MediaRecorderController")],l);var D=Object.getOwnPropertyDescriptor,E=(e,t,s,i)=>{for(var r=i>1?void 0:i?D(t,s):t,n=e.length-1,o;n>=0;n--)(o=e[n])&&(r=o(r)||r);return r};function k(){if(typeof window>"u")return null;let e=window;return e.SpeechRecognition??e.webkitSpeechRecognition??null}var _=class extends a{constructor(e){super(e),this._isCancelled=!1,this._recognition=null}initialize(){let e=k();if(!e)return;let t=new e;t.continuous=!0,t.interimResults=!0,this.language&&(t.lang=this.language),t.onstart=this._onStart.bind(this),t.onresult=this._onResult.bind(this),t.onerror=this._onError.bind(this),t.onend=this._onEnd.bind(this),t.onspeechend=this._onSpeechEnd.bind(this),this._recognition=t}destroy(){this._recognition&&(this._recognition.onstart=null,this._recognition.onresult=null,this._recognition.onerror=null,this._recognition.onend=null,this._recognition.onspeechend=null,this.cancel(),this._recognition=null)}_onStart(){this._isCancelled=!1,this._set("state","listening")}_onResult(e){let{finalTranscript:t,liveTranscript:s}=Array.from(e.results).reduce((i,r)=>(r.isFinal?i.finalTranscript+=r[0].transcript:i.liveTranscript+=r[0].transcript,i),{finalTranscript:"",liveTranscript:""});this._set("transcript",h(t)),this._set("liveTranscript",h(s))}_onError(e){if(e.error==="aborted"&&this._isCancelled){this._set("state","idle");return}let t="unhandled";switch(e.error){case"no-speech":t="no-speech";break;case"service-not-allowed":case"not-allowed":t="not-allowed";break;default:t="unhandled"}this._set("state","error"),this._set("errorCode",t)}_onEnd(){let e=h(`${this.transcript} ${this.liveTranscript}`);if(this._set("liveTranscript",""),this._isCancelled){this._set("transcript",""),this._set("state","idle"),this._set("errorCode",void 0);return}this.errorCode?this._set("transcript",""):(this._set("transcript",e),this._set("state","idle")),this._set("errorCode",void 0)}_onSpeechEnd(){this._set("state","processing")}_reset(e=!1){this._isCancelled=e,this._set("liveTranscript",""),this._set("transcript",""),this._set("errorCode",void 0),this._set("state","idle")}start(){if(!this._recognition){this._set("errorCode","not-supported");return}this._reset(!1);try{this._recognition.start()}catch{this._set("state","error"),this._set("errorCode","unhandled")}}stop(){if(this._recognition){this._set("state","processing");try{this._recognition.stop()}catch{}}}cancel(){if(this._recognition){this._reset(!0);try{this._recognition.abort()}catch{}}}static isSupported(){return!!k()}};_=E([f("WebSpeechController")],_);function b(e){let{baseValue:t,transcript:s}=e;if(!s)return t;let i=t.trim();return i?`${i} ${s}`:s}var v=class extends R{constructor(){super(...arguments),this.#t=null,this._resolvedMode="disabled",this.awaitingResponse=!1,this.inputValue="",this.mode="web-speech",this.arcgisVoiceInputDraftChange=c(),this.arcgisVoiceInputError=c(),this.arcgisVoiceInputInterimTranscription=c(),this.arcgisVoiceInputStart=c(),this.arcgisVoiceInputStop=c(),this.arcgisVoiceInputTranscription=c(),this.arcgisVoiceInputTranscriptionStreamChunk=c()}static{this.properties={_resolvedMode:16,_state:16,_errorCode:16,_liveTranscript:16,_transcript:16,_isButtonDisabled:16,_buttonLabel:16,awaitingResponse:5,inputValue:1,language:1,mode:1}}static{this.styles=I}#t;get _state(){return this._speechController?.state??"idle"}get _errorCode(){return this._speechController?.errorCode??null}get _liveTranscript(){return this._speechController?.liveTranscript??""}get _transcript(){return this._speechController?.transcript??""}get _isButtonDisabled(){return this._resolvedMode==="disabled"||this.awaitingResponse||this._state==="processing"}get _buttonLabel(){if(this.awaitingResponse)return"Voice input unavailable while assistant is responding";if(this._resolvedMode==="disabled")return"Voice input unavailable";switch(this._state){case"error":return this._errorCode==="not-allowed"?"Microphone permission denied. Retry voice input":"Retry voice input";case"listening":return"Stop voice input";case"processing":return"Processing voice input";default:return"Start voice input"}}clearDraftSession(){this.#t=null}loaded(){this.manager.onLifecycle(()=>[u(()=>[this.mode,this.language],()=>{this._configureController()},{initial:!0}),u(()=>this.awaitingResponse,t=>{t&&this._cancelActiveSession()},{initial:!0}),u(()=>this._liveTranscript,t=>{if(t){let s=h(`${this._transcript} ${t}`);this.arcgisVoiceInputInterimTranscription.emit({transcript:s}),this._applyVoiceInputTranscript(s)}}),u(()=>this._transcript,t=>{t&&(this.arcgisVoiceInputTranscription.emit({transcript:t}),this._applyVoiceInputTranscript(t,{final:!0}))}),u(()=>this._state,t=>{t==="error"&&this._errorCode&&this.arcgisVoiceInputError.emit({errorCode:this._errorCode})})])}disconnectedCallback(){super.disconnectedCallback(),this._destroySpeechController()}_configureController(){let t=this._resolveMode();this._destroySpeechController(),this._resolvedMode=t,t!=="disabled"&&(this._speechController=t==="web-speech"?new _({language:this.language}):new l({language:this.language,handleRecording:this._handleRecording.bind(this)}))}_destroySpeechController(){this._speechController?.cancel(),this._speechController?.destroy(),this._speechController=void 0}_emitDraftChange(t,s){this.arcgisVoiceInputDraftChange.emit({focusInput:s?.focusInput,value:t})}_startVoiceInputSession(){this.#t={baseValue:this.inputValue.trim(),phase:"listening",transcript:""}}_finishVoiceInputSession(){let t=this.#t;if(!t){this._emitDraftChange(this.inputValue.trim());return}let s={...t,phase:"stopped"},i=b(s);this.#t=s,this._emitDraftChange(i)}async _applyVoiceInputTranscript(t,s){let i=this.#t;if(!t||!i)return;if(i.phase==="stopped"){let o=b(i);if(this.inputValue.trim()!==o){this.clearDraftSession();return}}let r={...i,transcript:t},n=b(r);this.#t=r,this._emitDraftChange(n,{focusInput:s?.final&&r.phase==="stopped"})}async _handleToggle(){if(!(this._isButtonDisabled||!this._speechController)){if(this._state==="listening"){this._speechController.stop(),this._finishVoiceInputSession(),this.arcgisVoiceInputStop.emit();return}this._speechController.start(),this._startVoiceInputSession(),this.arcgisVoiceInputStart.emit()}}async _handleRecording(t,s,i,r){let n;return this.arcgisVoiceInputTranscriptionStreamChunk.emit({blob:t,chunkIndex:i,isFinal:r,mimeType:s,respondWithTranscript:o=>{n=o}}),n}_resolveMode(){return this.mode==="disabled"?"disabled":this.mode==="web-speech"&&_.isSupported()?"web-speech":l.isSupported()?"media-recorder":"disabled"}async _cancelActiveSession(){this._speechController&&this._resolvedMode!=="disabled"&&this._speechController.cancel(),this.clearDraftSession()}render(){return S`<calcite-button appearance=transparent class="button" data-mode=${this._resolvedMode??m} data-state=${(this._resolvedMode==="disabled"?"disabled":this._state)??m} .disabled=${this._isButtonDisabled} icon-start=microphone kind=neutral .label=${this._buttonLabel} .loading=${this._state==="processing"} round scale=m @click=${()=>{this._handleToggle()}}></calcite-button>`}};y("arcgis-assistant-speech-input",v);return v},"core/reactiveUtils","core/accessorSupport/decorators","core/Accessor")
|
|
@@ -1,2 +1,2 @@
|
|
|
1
1
|
/* COPYRIGHT Esri - https://js.arcgis.com/5.2/LICENSE.txt */
|
|
2
|
-
import{b as n}from"./
|
|
2
|
+
import{b as n}from"./UYP5PH5E.js";import"./QUZTFUWM.js";import"./A22375P3.js";import"./DYSPEU7W.js";import{C as e,g as i,h as a,x as t}from"./RE7MJTEF.js";import"./R74ZHFA6.js";import"./UZLQALHY.js";var r=i`:host{display:contents}.icon{padding:var(--calcite-spacing-sm);border-radius:var(--calcite-spacing-xl);background:var(--calcite-color-brand);color:var(--calcite-color-foreground-1)}.loading-container{display:flex;flex-direction:column;gap:var(--calcite-spacing-sm);padding:0 var(--calcite-spacing-sm)}.loading{display:flex;align-items:center;gap:var(--calcite-spacing-sm)}.text{font-style:italic;word-wrap:break-word;word-break:break-all;overflow:hidden;text-overflow:ellipsis;display:-webkit-box;-webkit-line-clamp:1;line-clamp:1;-webkit-box-orient:vertical}.skeleton-block{display:flex;flex-direction:column;gap:var(--calcite-spacing-sm);width:100%}.skeleton-text{display:block;height:.95em;border-radius:var(--calcite-border-radius);background:linear-gradient(90deg,color-mix(in srgb,var(--calcite-color-foreground-2) 65%,transparent),color-mix(in srgb,var(--calcite-color-foreground-3) 85%,transparent),color-mix(in srgb,var(--calcite-color-foreground-2) 65%,transparent));background-size:200% 100%;animation:assistant-message-loading-shimmer 1.2s ease-in-out infinite;width:85%}.skeleton-text:last-child{width:70%}@keyframes assistant-message-loading-shimmer{0%{background-position:-150% 0}to{background-position:150% 0}}@media(prefers-reduced-motion){.skeleton-text{animation:none}}`,s=class extends t{constructor(){super(...arguments),this._messages=n({blocking:!0}),this.loading=!1,this.loadingMessage="",this.assistantAvatarEnabled=!1}static{this.properties={loading:5,loadingMessage:1,assistantAvatarEnabled:5,interrupts:0}}static{this.styles=r}render(){return this.loading?a`<arcgis-assistant-message .assistantAvatarEnabled=${this.assistantAvatarEnabled} footer-disabled>${this.assistantAvatarEnabled?a`<slot name=icon slot=icon><calcite-icon class="icon" icon=effects scale=s></calcite-icon></slot>`:null}<slot name=content slot=content><arcgis-assistant-interrupt-preview .interrupts=${this.interrupts}></arcgis-assistant-interrupt-preview><div class="loading-container"><div class="loading"><calcite-loader .label=${this._messages.loadingLabel} inline></calcite-loader><div class="text">${this.loadingMessage}</div></div><div class="skeleton-block"><span class="skeleton-text"></span><span class="skeleton-text"></span></div></div></slot></arcgis-assistant-message>`:null}};e("arcgis-assistant-message-loading",s);export{s as ArcgisAssistantMessageLoading};
|
|
@@ -1,2 +1,2 @@
|
|
|
1
1
|
/* COPYRIGHT Esri - https://js.arcgis.com/5.2/LICENSE.txt */
|
|
2
|
-
import{a as i}from"./ONQ6JSBJ.js";import{
|
|
2
|
+
import{a as i}from"./ONQ6JSBJ.js";import{Ga as n}from"./FSLPYC4Y.js";import{N as r}from"./AMP43OT2.js";async function s(a,t){await t.when();let e=t.map?.allLayers.find(l=>l.id===a);if(!e)return console.warn(`[goToLayer] No matching FeatureLayer found for: ${a}`),{text:`Could not find layer for: ${a}`};let o;return(e.type==="link-chart"||e.type==="knowledge-graph-sublayer")&&t.map?.activeLinkChartLayer?o=t.map.diagramNodesExtent:o=e.fullExtent,o?(await t.goTo(o),e.visible=!0,{text:`Successfully zoomed to: ${e.title??""}`}):{text:"Layer has no defined extent. Cannot zoom to layer."}}async function m({layerId:a},t){let{mapView:e}=i(t,["mapView"]);return await s(a,e)}var c=r.object({layerId:r.string().describe("The id of the layer to navigate to")}),p=n(m,{name:"goToLayer",description:"Zooms the map view to the full extent of the top matching layer.",schema:c});export{p as a};
|
|
@@ -1,2 +1,2 @@
|
|
|
1
1
|
/* COPYRIGHT Esri - https://js.arcgis.com/5.2/LICENSE.txt */
|
|
2
|
-
import{a}from"../
|
|
2
|
+
import{a}from"../6WYVG3JI.js";import"../5TW2NFES.js";import"../CDS2HGQY.js";import"../QEGO4B2W.js";import"../EEHDAYOG.js";import"../XWNZMKQF.js";import"../FSLPYC4Y.js";import"../AMP43OT2.js";import"../2UKFCF2J.js";import"../UZLQALHY.js";export{a as BaseAgent};
|
|
@@ -1,2 +1,2 @@
|
|
|
1
1
|
/* COPYRIGHT Esri - https://js.arcgis.com/5.2/LICENSE.txt */
|
|
2
|
-
import{a as i,b as h,c as m}from"../VIJVRJHL.js";import{a as u}from"../
|
|
2
|
+
import{a as i,b as h,c as m}from"../VIJVRJHL.js";import{a as u}from"../GHFOAS7T.js";import{a as c}from"../6WYVG3JI.js";import{d as o}from"../5TW2NFES.js";import"../CDS2HGQY.js";import{y as n}from"../QEGO4B2W.js";import"../EEHDAYOG.js";import"../XWNZMKQF.js";import"../FSLPYC4Y.js";import"../AMP43OT2.js";import"../2UKFCF2J.js";import"../UZLQALHY.js";var d=class extends c{constructor(t){super(),this.middlewares=[],Object.assign(this,t),this.generate()}generate(){let t=o([this.inputSchema,this.outputSchema].filter(Boolean)),e=`${this.id}-execute`,r={[e]:this._invokeExecuteNode.bind(this)},s=[{from:e,decide:()=>{}}];this.workspace=t,this.createGraph=()=>u(r,s,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(r){if(n(r)||e?.signal?.aborted||r instanceof Error&&r.name==="AbortError")throw r;let s=r instanceof Error?r.message:String(r);return i({outputMessage:s},"failed",s)}}async _invokeStructured(t,e){if(!this.outputSchema)throw new Error("Output schema is required for structured invocation.");let r=this._validateInputState(t),s=await this.execute(r,e);if(typeof s=="string")throw new Error("Expected execute function to return an object matching the output schema, but received a string.");return h(s,this.outputSchema,t.agentExecutionContext.messages)}async _invokeUnstructured(t,e){let r=this._validateInputState(t),s=await this.execute(r,e),a=typeof s=="string"?s:JSON.stringify(s),p=a.trim()||"FunctionAgent completed.";return i({outputMessage:a},"success",p)}_validateInputState(t){if(!this.inputSchema)return t;let e=this.inputSchema.safeParse(m(t,this.inputSchema));if(!e.success)throw new Error(`FunctionAgent input schema validation failed: ${e.error.message}`);return{...t,...e.data}}};export{d as FunctionAgent};
|
|
@@ -1,2 +1,2 @@
|
|
|
1
1
|
/* COPYRIGHT Esri - https://js.arcgis.com/5.2/LICENSE.txt */
|
|
2
|
-
import{a}from"../
|
|
2
|
+
import{a}from"../2O52MJ3D.js";import"../DI3VGUJY.js";import"../VIJVRJHL.js";import"../BMPBJXD7.js";import"../GHFOAS7T.js";import"../6WYVG3JI.js";import"../5TW2NFES.js";import"../CDS2HGQY.js";import"../QEGO4B2W.js";import"../EEHDAYOG.js";import"../XWNZMKQF.js";import"../FSLPYC4Y.js";import"../AMP43OT2.js";import"../2UKFCF2J.js";import"../UZLQALHY.js";export{a as LLMAgent};
|
|
@@ -1,2 +1,2 @@
|
|
|
1
1
|
/* COPYRIGHT Esri - https://js.arcgis.com/5.2/LICENSE.txt */
|
|
2
|
-
import{a as o}from"../
|
|
2
|
+
import{a as o}from"../DJG6DBCU.js";import"../C76HLPKU.js";import"../RFPTOFM4.js";import"../CADNOKIK.js";import"../BMPBJXD7.js";import{a as i}from"../6WYVG3JI.js";import"../5TW2NFES.js";import"../CDS2HGQY.js";import"../QEGO4B2W.js";import"../EEHDAYOG.js";import"../XWNZMKQF.js";import"../FSLPYC4Y.js";import"../AMP43OT2.js";import"../2UKFCF2J.js";import"../UZLQALHY.js";var r=class extends i{constructor(t){super(),this.modelTier="default",Object.assign(this,t),this.generate()}generate(){let t=this.toolLoaders?Object.fromEntries(Object.entries(this.toolLoaders).map(([a,n])=>[a,async()=>{let e=await n();return"getTool"in e?e.getTool():e}])):void 0,s=o({id:this.id,name:this.name,description:this.description,systemPrompt:this.systemPrompt,skillLoaders:this.skillLoaders,toolLoaders:t,modelTier:this.modelTier,runtimeContextLoader:this.runtimeContextLoader,instructions:this.instructions});this.createGraph=s.createGraph,this.workspace=s.workspace}};export{r as SkillAgent};
|