@arcgis/ai-components 5.1.0-next.61 → 5.1.0-next.63

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (41) hide show
  1. package/dist/cdn/5RA2JKQ5.js +3 -0
  2. package/dist/cdn/6IDESYBP.js +2 -0
  3. package/dist/cdn/E4J4SWHB.js +2 -0
  4. package/dist/cdn/MP7AEALE.js +2 -0
  5. package/dist/cdn/SOPNKXO5.js +2 -0
  6. package/dist/cdn/VJGA26MX.js +2 -0
  7. package/dist/cdn/assets/assistant-chat-card/t9n/messages.en.json +1 -1
  8. package/dist/cdn/index.js +1 -1
  9. package/dist/cdn/main.css +1 -1
  10. package/dist/components/arcgis-assistant/customElement.d.ts +4 -0
  11. package/dist/components/arcgis-assistant/customElement.js +30 -30
  12. package/dist/components/arcgis-assistant-chat/customElement.d.ts +2 -0
  13. package/dist/components/arcgis-assistant-chat/customElement.js +7 -7
  14. package/dist/components/arcgis-assistant-chat-card/customElement.d.ts +6 -0
  15. package/dist/components/arcgis-assistant-chat-card/customElement.js +101 -25
  16. package/dist/components/arcgis-assistant-chat-entry/customElement.d.ts +2 -0
  17. package/dist/components/arcgis-assistant-chat-entry/customElement.js +129 -33
  18. package/dist/components/arcgis-assistant-chat-entry/index.js +1 -0
  19. package/dist/components/arcgis-assistant-chat-entry-speech-input/customElement.d.ts +26 -0
  20. package/dist/components/arcgis-assistant-chat-entry-speech-input/customElement.js +437 -0
  21. package/dist/components/arcgis-assistant-chat-entry-speech-input/index.d.ts +1 -0
  22. package/dist/components/arcgis-assistant-chat-entry-speech-input/index.js +2 -0
  23. package/dist/components/arcgis-assistant-chat-entry-speech-input/support/types.d.ts +15 -0
  24. package/dist/components/arcgis-assistant-shell/customElement.d.ts +2 -0
  25. package/dist/components/arcgis-assistant-shell/customElement.js +6 -6
  26. package/dist/docs/api.json +1 -1
  27. package/dist/docs/docs.json +1 -1
  28. package/dist/docs/vscode.html-custom-data.json +1 -1
  29. package/dist/docs/web-types.json +1 -1
  30. package/dist/index.d.ts +10 -0
  31. package/dist/loader.js +6 -5
  32. package/dist/types/lumina.d.ts +16 -5
  33. package/dist/types/preact.d.ts +17 -5
  34. package/dist/types/react.d.ts +18 -5
  35. package/dist/types/stencil.d.ts +16 -5
  36. package/package.json +6 -6
  37. package/dist/cdn/ETKNVWKV.js +0 -2
  38. package/dist/cdn/JPYSTYTV.js +0 -2
  39. package/dist/cdn/NN7QKIMP.js +0 -2
  40. package/dist/cdn/WO6WO3SH.js +0 -3
  41. package/dist/cdn/ZLYDPB4L.js +0 -2
@@ -0,0 +1,3 @@
1
+ /* COPYRIGHT Esri - https://js.arcgis.com/5.1/LICENSE.txt */
2
+ import{a as v,b as y}from"./UGJXHTYH.js";import{a as b}from"./H3DVSYQV.js";import"./YGW7TUNX.js";import{g as p,h as s,n as g,t as u,u as _,v as m,z as f}from"./WRENCTR3.js";import"./CFDTXKJ6.js";export default $arcgis.t(([{watch:x},k,{property:$,subclass:w}])=>{var L=p`:host{display:block;container-type:inline-size}.assistant-chat-card__prompt-container{display:flex;align-items:center;gap:var(--calcite-spacing-md);background:color-mix(in srgb,var(--calcite-color-brand) 25%,transparent);color:var(--calcite-color-text-1);padding:var(--calcite-spacing-md);border-radius:var(--calcite-border-radius);width:fit-content;margin-left:auto;justify-content:flex-end}.assistant-chat-card__prompt-avatar{display:flex;align-items:center;justify-content:center}.assistant-chat-card__content-container{display:flex;flex:1;flex-direction:column;width:100%}.assistant-chat-card__response-container{display:flex;flex-direction:column;align-items:flex-start;gap:var(--calcite-spacing-sm);width:100%;text-align:left}.assistant-chat-card__response-icon{padding:var(--calcite-spacing-sm);border-radius:var(--calcite-spacing-xl);background:var(--calcite-color-brand);color:var(--calcite-color-foreground-1)}.assistant-chat-card__footer{display:flex;width:100%;justify-content:space-between;padding:0 var(--calcite-spacing-xxs)}.assistant-chat-card__feedback-actions{display:flex;flex-direction:row;gap:var(--calcite-spacing-xxs)}.assistant-chat-card__log-container{padding:0 var(--calcite-spacing-sm);border-radius:var(--calcite-border-radius);margin-bottom:var(--calcite-spacing-sm)}.assistant-chat-card__log{margin:0;background-color:var(--calcite-color-foreground-1);width:100%;max-height:300px;overflow:auto}.assistant-chat-card__log-entry{margin-left:var(--calcite-spacing-sm);padding:var(--calcite-spacing-xxs) var(--calcite-spacing-lg);border-left:1px solid var(--calcite-color-border-1)}.assistant-chat-card__footer-start,.assistant-chat-card__footer-end{display:flex;gap:var(--calcite-spacing-xxs)}@container (min-width: 480px){.assistant-chat-card__prompt-container,.assistant-chat-card__response-container{max-width:80%}}`,A=Object.defineProperty,E=Object.getOwnPropertyDescriptor,h=(a,t,i,n)=>{for(var o=n>1?void 0:n?E(t,i):t,e=a.length-1,c;e>=0;e--)(c=a[e])&&(o=(n?c(t,i,o):c(o))||o);return n&&o&&A(t,i,o),o};function l(){return typeof window>"u"?null:window}var r=class extends k{constructor(){super(...arguments),this._utterance=null,this.state="idle",this.supported=r.isSupported()}destroy(){this.stop(),super.destroy()}start(a){let t=a.trim(),i=l(),n=i?.SpeechSynthesisUtterance,o=i?.speechSynthesis;if(this._set("supported",r.isSupported(i)),!t||!n||!o)return;this.stop();let e=new n(t);e.rate=.9,e.pitch=1.1,e.volume=1,e.onend=()=>{this._utterance===e&&this._reset()},e.onerror=()=>{this._utterance===e&&this._reset()};try{o.speak(e),this._utterance=e,this._set("state","playing")}catch{e.onend=null,e.onerror=null,this._reset()}}stop(){let a=l(),t=a?.speechSynthesis;if(this._set("supported",r.isSupported(a)),t)try{(t.speaking||t.pending)&&t.cancel()}catch{}this._reset()}toggle(a){if(this.state==="playing"){this.stop();return}this.start(a)}static isSupported(a=l()){return!!a?.speechSynthesis&&typeof a.SpeechSynthesisUtterance=="function"}_reset(){this._utterance&&(this._utterance.onend=null,this._utterance.onerror=null),this._utterance=null,this._set("state","idle")}};h([$({readOnly:!0})],r.prototype,"state",2);h([$({readOnly:!0})],r.prototype,"supported",2);r=h([w("ReadAloudController")],r);var d=class extends m{constructor(){super(...arguments),this._messages=b({blocking:!0}),this._endRef=u(),this._readAloudController=new r,this._showLog=!1,this.loading=!1,this.feedbackEnabled=!1,this.logEnabled=!1,this.copyEnabled=!1,this.readAloudEnabled=!1,this.arcgisFeedback=g()}static{this.properties={_showLog:16,_role:16,_content:16,_log:16,_error:16,_feedback:16,loading:5,messageRole:1,feedbackEnabled:5,logEnabled:5,copyEnabled:5,readAloudEnabled:5,content:1,loadingMessage:1,log:0,error:1,user:1,message:0}}static{this.styles=L}get _role(){return this.message?.role??this.messageRole}get _content(){return this.message?.content??this.content}get _log(){return(this.message?.role==="assistant"?this.message?.log:void 0)??this.log}get _error(){return(this.message?.role==="assistant"?this.message?.error:void 0)??this.error}get _feedback(){return this.message?.role==="assistant"?this.message?.feedback?.positive:void 0}loaded(){this.manager.onLifecycle(()=>[x(()=>this._showLog,()=>this._scrollToEnd()),x(()=>this._readAloudController.state,()=>this.requestUpdate(),{initial:!0})])}disconnectedCallback(){super.disconnectedCallback(),this._readAloudController.destroy()}_scrollToEnd(){requestAnimationFrame(()=>{this._endRef.value?.scrollIntoView({behavior:"smooth",block:"end"})})}_handleFeedback(t){this.message?.role==="assistant"&&(this.message.feedback=this.message.feedback?.positive===t?void 0:{positive:t},this.arcgisFeedback.emit(this.message),this.requestUpdate())}_toggleReadAloud(){this._readAloudController.toggle(this._content??"")}_renderLog(){return this._log&&this._showLog&&this.logEnabled?s`<div class="assistant-chat-card__log-container"><div class="assistant-chat-card__log"><calcite-accordion appearance=transparent icon-position=start icon-type=chevron scale=s>${this._log.map(t=>{let i=t.includes(`
3
+ `)||t.length>70;return s`<calcite-accordion-item .heading=${i?`${t.substring(0,70)}...`:t} .expanded=${i}><div class="assistant-chat-card__log-entry">${i?v(y(t)):null}</div></calcite-accordion-item>`})}</calcite-accordion></div></div>`:null}_renderThumbsUpButton(){return s`<calcite-action id=action-thumbs-up icon=thumbs-up scale=s .active=${this._feedback===!0} @click=${()=>this._handleFeedback(!0)} text></calcite-action><calcite-tooltip reference-element=action-thumbs-up overlay-positioning=fixed placement=bottom><span>${this._messages.thumbsUpLabel}</span></calcite-tooltip>`}_renderThumbsDownButton(){return s`<calcite-action id=action-thumbs-down icon=thumbs-down scale=s .active=${this._feedback===!1} @click=${()=>this._handleFeedback(!1)} text></calcite-action><calcite-tooltip reference-element=action-thumbs-down overlay-positioning=fixed placement=bottom><span>${this._messages.thumbsDownLabel}</span></calcite-tooltip>`}_renderFeedback(){return this.feedbackEnabled&&!this._error?s`<div class="assistant-chat-card__feedback-actions">${this._renderThumbsUpButton()}${this._renderThumbsDownButton()}</div>`:null}_renderCopyButton(){return!this._error&&this.copyEnabled?s`<calcite-action id=action-copy icon=copy-to-clipboard scale=s @click=${async()=>{try{this._content&&await navigator.clipboard.writeText(this._content)}catch(t){console.error("Failed to copy text to clipboard:",t)}}} text></calcite-action><calcite-tooltip reference-element=action-copy overlay-positioning=fixed placement=bottom><span>${this._messages.copyButtonLabel}</span></calcite-tooltip>`:null}_renderLogButton(){return this._log&&this.logEnabled?s`<calcite-action id=action-log icon=access-string-results scale=s @click=${()=>this._showLog=!this._showLog} .text=${this._messages.logButtonLabel} .active=${this._showLog}></calcite-action><calcite-tooltip reference-element=action-log overlay-positioning=fixed placement=bottom><span>${this._messages.logButtonLabel}</span></calcite-tooltip>`:null}_renderReadAloudButton(){return this.readAloudEnabled&&!this._error&&this._content?.trim()&&this._readAloudController.supported?s`<calcite-action id=action-read-aloud .icon=${this._readAloudController.state==="playing"?"sound-off":"sound"} scale=s .active=${this._readAloudController.state==="playing"} @click=${()=>this._toggleReadAloud()} text></calcite-action><calcite-tooltip reference-element=action-read-aloud overlay-positioning=fixed placement=bottom><span>${this._readAloudController.state==="playing"?this._messages.stopReadingButtonLabel:this._messages.readAloudButtonLabel}</span></calcite-tooltip>`:null}_renderFooter(){return this.loading?null:s`<div class="assistant-chat-card__footer"><div class="assistant-chat-card__footer-start">${this._renderCopyButton()}${this._renderLogButton()}${this._renderReadAloudButton()}<slot name=footer-actions-start></slot></div><div class="assistant-chat-card__footer-end"><slot name=footer-actions-end></slot>${this._renderFeedback()}</div></div>`}render(){return this._role==="user"?s`<div class="assistant-chat-card__prompt-container"><div>${this._content}</div><div class="assistant-chat-card__prompt-avatar"><calcite-avatar .fullName=${this.user} scale=s></calcite-avatar></div></div>`:s`<div class="assistant-chat-card__response-container"><calcite-icon icon=effects class="assistant-chat-card__response-icon" scale=s></calcite-icon><div class="assistant-chat-card__content-container"><arcgis-assistant-chat-card-content .loading=${this.loading} .loadingMessage=${this.loadingMessage} .type=${this._error?"error":"text"} .content=${this._error??this._content}></arcgis-assistant-chat-card-content>${this._renderLog()}${this._renderFooter()}</div><div ${_(this._endRef)}></div></div>`}};f("arcgis-assistant-chat-card",d);return d},"core/reactiveUtils","core/Accessor","core/accessorSupport/decorators")
@@ -0,0 +1,2 @@
1
+ /* COPYRIGHT Esri - https://js.arcgis.com/5.1/LICENSE.txt */
2
+ import a from"./AAEEDEN7.js";import{a as k}from"./H3DVSYQV.js";import{a as C}from"./KVH3PDVW.js";import"./YGW7TUNX.js";import{g as v,h,l as _,n as o,t as u,u as m,v as f,z as E}from"./WRENCTR3.js";import"./CFDTXKJ6.js";export default $arcgis.t(([I,{whenOnce:S,watch:L,when:P},O,A,{property:p,subclass:M},{x:w}])=>{var x=v`:host{display:block;width:var(--arcgis-internal-panel-width, 100%);height:var(--arcgis-internal-expand-max-height, 100%)}`,R=Object.defineProperty,z=Object.getOwnPropertyDescriptor,l=(c,t,e,i)=>{for(var s=i>1?void 0:i?z(t,e):t,r=c.length-1,n;r>=0;r--)(n=c[r])&&(s=(i?n(t,e,s):n(s))||s);return i&&s&&R(t,e,s),s},a=class extends A{constructor(c){super(c),this.view=null,this.loading=!1,this.processing=!1,this.processingStep=""}async load(){this._set("loading",!0);try{await this._initialize()}finally{this._set("loading",!1)}}destroy(){this.orchestrator?.dispose(),super.destroy()}async _initialize(){this.removeHandles(),await Promise.all([this.portal.load(),this.view?.when()]),this.view&&await S(()=>!this.view.updating),this._set("orchestrator",await w.init({agents:[...this.agents],view:this.view??void 0})),this.addHandles([L(()=>[this.view,this.agents],()=>void this._initialize())])}clearChatHistory(){this.orchestrator?.newConversation()}async*ask(c,t){if(!this.orchestrator)throw new Error("Orchestrator not initialized yet.");this._set("processing",!0),this._set("processingStep","");let e=[];try{let i=this.orchestrator.ask(c);for await(let s of i){let r=s.runId;if(t?.aborted){yield{type:"cancelled",runId:r};break}switch(s.type){case"trace":{this._set("processingStep",s.data.text),e.push(s.data.text);break}case"completed":{if(!s.result.content.length){yield{type:"completed",error:"Could not process the request.",log:e,runId:r};return}let n=s.result.content;this._set("processingStep",""),yield{type:"completed",response:n,log:e,runId:r};return}case"interrupt":{let{kind:n,message:d,metadata:b}=s.interrupt,g=Array.isArray(b)?[...b]:[],$=(()=>{switch(n){case"booleanChoice":return{type:"boolean-choice",message:d,options:g};case"singleSelection":return{type:"single-select",message:d,options:g};case"multipleSelection":return{type:"multi-select",message:d,options:g};case"textInput":return{type:"text-input",message:d};default:return{type:n,message:d,options:g}}})();this._set("processingStep","Waiting for user input..."),yield{type:"interrupt",payload:$,runId:r};break}case"cancelled":{yield{type:"cancelled",runId:r};return}case"error":{yield{type:"completed",error:s.error.message,log:e,runId:r};return}default:{console.warn("Unknown event type:",s);break}}}}catch(i){console.warn("Error during message processing:",i),yield{type:"completed",error:"An error occurred during message processing.",log:e,runId:"error"};return}finally{this._set("processing",!1)}}};l([p({readOnly:!0})],a.prototype,"orchestrator",2);l([p()],a.prototype,"agents",2);l([p()],a.prototype,"portal",2);l([p()],a.prototype,"view",2);l([p({readOnly:!0})],a.prototype,"loading",2);l([p({readOnly:!0})],a.prototype,"processing",2);l([p({readOnly:!0})],a.prototype,"processingStep",2);a=l([M("OrchestratorController")],a);var H="Embeddings resource 'embeddings-v01.json' not found in the webmap portal item.",j="Embeddings not found for this web map.",F="https://developers.arcgis.com/javascript/latest/agentic-apps/ai-webmap-setup/#embeddings",y=class extends f{constructor(){super(...arguments),this._messages=k({blocking:!0}),this.#t=u(),this.#e=u(),this.#s=null,this.#o=new Map,this.#r=O.getDefault(),this.#i=t=>{t.stopPropagation(),this.arcgisInterruptCancel.emit(),this.orchestrator?.cancelInterrupt(),this._interrupt=null},this.#a=t=>{t.stopPropagation();let e=t.detail;this.arcgisInterruptSubmit.emit(e),this.orchestrator?.resumeInterrupt(e),this._interrupt=null},this.#n=t=>{t.stopPropagation(),this.keepSuggestedPrompts||(this.suggestedPrompts=[]);let e=t.detail;this.arcgisSubmit.emit(e),this.submitMessage(e)},this.#l=t=>{if(t.stopPropagation(),this.arcgisCancel.emit(),this._interrupt){this.orchestrator?.cancelInterrupt(),this._interrupt=null;return}this.#s?.abort()},this.#c=t=>{t.stopPropagation();let e=t.detail;this.arcgisFeedback.emit(e)},this._orchestratorController=null,this._interrupt=null,this._error=null,this.messages=new I([]),this.referenceElement=null,this.suggestedPrompts=[],this.feedbackEnabled=!1,this.keepSuggestedPrompts=!1,this.logEnabled=!1,this.copyEnabled=!1,this.voiceInputEnabled=!1,this.readAloudEnabled=!1,this.arcgisCancel=o(),this.arcgisError=o(),this.arcgisFeedback=o(),this.arcgisInterrupt=o(),this.arcgisInterruptCancel=o(),this.arcgisInterruptSubmit=o(),this.arcgisReady=o(),this.arcgisSubmit=o()}static{this.properties={_orchestratorController:16,_interrupt:16,_error:16,_user:16,messages:0,orchestrator:32,entryMessage:1,heading:1,description:1,referenceElement:1,suggestedPrompts:0,feedbackEnabled:5,keepSuggestedPrompts:5,logEnabled:5,copyEnabled:5,voiceInputEnabled:5,readAloudEnabled:5}}static{this.styles=x}#t;#e;#s;#o;#r;#i;#a;#n;#l;#c;async#h(){try{let t=C(this.el,this.referenceElement);await t?.componentOnReady();let e=[...this.#o.values()];return e.length?(this._orchestratorController=new a({agents:e,portal:this.#r,view:t?.view}),await this._orchestratorController.load(),!0):(this._error="No agents found.",!1)}catch(t){return this._error=t?.message??"Error initializing orchestrator.",_(this)(t),!1}}get _user(){return this.#r?.user?.fullName||this.#r?.user?.username}get orchestrator(){return this._orchestratorController?.orchestrator}async clearChatHistory(){this._reset(),this._orchestratorController?.clearChatHistory()}register(t){this.#o.set(t.agent.id,t)}async submitMessage(t){let e=t.trim();if(!e||(this.messages.push({id:Date.now().toString(),role:"user",content:e}),!this._orchestratorController))return;let i=this._orchestratorController.ask(e,this.#s?.signal);for await(let s of i){let r=s.runId;switch(s.type){case"completed":this.messages.push({role:"assistant",content:s.response,log:s.log,error:s.error,id:r});break;case"interrupt":this._interrupt={...s.payload,id:r};break;case"cancelled":this.messages.push({role:"assistant",error:"Request cancelled.",id:r});break}}}load(){this.manager.onLifecycle(this._reset.bind(this))}loaded(){this.manager.onLifecycle(()=>{this.#t.value?.addEventListener("arcgisSubmit",this.#n),this.#t.value?.addEventListener("arcgisCancel",this.#l),this.#t.value?.addEventListener("arcgisFeedback",this.#c);let t=P(()=>!!this._interrupt&&!!this.#e.value,()=>{let e=this.#e.value;e.removeEventListener("arcgisSubmit",this.#a),e.removeEventListener("arcgisCancel",this.#i),e.addEventListener("arcgisSubmit",this.#a,{once:!0}),e.addEventListener("arcgisCancel",this.#i,{once:!0}),this._interrupt&&this.arcgisInterrupt.emit(this._interrupt)});return queueMicrotask(()=>{this.#h().then(e=>{e?this.arcgisReady.emit():this._error&&this.arcgisError.emit(new Error(this._error))})}),()=>{t.remove(),this.#e.value?.removeEventListener("arcgisSubmit",this.#a),this.#e.value?.removeEventListener("arcgisCancel",this.#i),this.#t.value?.removeEventListener("arcgisSubmit",this.#n),this.#t.value?.removeEventListener("arcgisCancel",this.#l),this.#t.value?.removeEventListener("arcgisFeedback",this.#c),this._orchestratorController?.destroy(),this._orchestratorController=null}})}_reset(){this.#s?.abort(),this._interrupt=null,this.messages.removeAll(),this._error=null}_renderErrorNotice(){return this._error?h`<calcite-notice closable slot=entry-message open kind=danger icon width=full>${this._error===H?h`<div slot=message>${j}</div><calcite-link slot=link .href=${F} target=_blank title="Learn about web map embeddings">Read more</calcite-link>`:h`<div slot=message>${this._error}</div>`}</calcite-notice>`:null}render(){return h`<arcgis-assistant-shell .loading=${!this._orchestratorController&&!this._error||this._orchestratorController?.loading} .heading=${this.heading??this._messages.assistantLabel} .description=${this.description} .entryMessage=${this.entryMessage} .entryMessageClosed=${this.messages.length>0} .awaitingResponse=${this._orchestratorController?.processing} .suggestedPrompts=${this.suggestedPrompts} .messages=${this.messages} .voiceInputEnabled=${this.voiceInputEnabled} ${m(this.#t)}>${this._renderErrorNotice()}${this._interrupt?h`<arcgis-assistant-interrupt slot=entry-message .type=${this._interrupt.type} .message=${this._interrupt.message} .options=${this._interrupt.options} ${m(this.#e)}></arcgis-assistant-interrupt>`:null}<arcgis-assistant-chat .loading=${this._orchestratorController?.processing} .loadingMessage=${this._orchestratorController?.processingStep||""} .messages=${this.messages} .user=${this._user} .feedbackEnabled=${this.feedbackEnabled} .logEnabled=${this.logEnabled} .copyEnabled=${this.copyEnabled} .readAloudEnabled=${this.readAloudEnabled}><slot></slot></arcgis-assistant-chat><slot name=header-actions-end slot=header-actions-end></slot>${this.entryMessage?null:h`<slot name=entry-message slot=entry-message></slot>`}<slot name=entry-actions-start slot=entry-actions-start></slot><slot name=footer-content slot=footer-content></slot></arcgis-assistant-shell>`}};E("arcgis-assistant",y);return y},"core/Collection","core/reactiveUtils","portal/Portal","core/Accessor","core/accessorSupport/decorators",a)
@@ -0,0 +1,2 @@
1
+ /* COPYRIGHT Esri - https://js.arcgis.com/5.1/LICENSE.txt */
2
+ import{a as o}from"./H3DVSYQV.js";import"./YGW7TUNX.js";import{g as a,h as s,n as e,v as n,z as l}from"./WRENCTR3.js";import"./CFDTXKJ6.js";export default $arcgis.t(([r])=>{var c=a`.assistant-shell__footer-container{display:flex;flex-direction:column;flex:1 1 0;gap:var(--calcite-spacing-md)}.assistant-shell__content-container{display:flex;flex-direction:column;flex:1 1 0;min-height:0;position:relative;overflow:auto}.assistant-shell__suggested-prompts-container{display:flex;justify-content:center;width:100%}.assistant-shell__suggested-prompts{padding:var(--calcite-spacing-md);max-width:100%;box-sizing:border-box}calcite-chip{max-width:100%}.assistant-shell__suggested-prompt{max-width:100%;overflow:hidden;text-overflow:ellipsis;white-space:nowrap;font-style:normal;cursor:pointer}`,i=class extends n{constructor(){super(...arguments),this._messages=o({blocking:!0}),this.description="",this.loading=!1,this.entryMessageClosed=!1,this.awaitingResponse=!1,this.suggestedPrompts=[],this.inputValue="",this.messages=new r([]),this.voiceInputEnabled=!1,this.arcgisCancel=e(),this.arcgisSubmit=e()}static{this.properties={heading:1,description:1,loading:5,entryMessage:1,entryMessageClosed:5,awaitingResponse:5,suggestedPrompts:0,inputValue:1,status:1,messages:0,voiceInputEnabled:5}}static{this.styles=c}_renderSuggestedPrompts(){return this.suggestedPrompts?.length?s`<div class="assistant-shell__suggested-prompts-container"><calcite-chip-group class="assistant-shell__suggested-prompts" .label=${this._messages.suggestedPromptsLabel??"suggested prompts"}>${this.suggestedPrompts.map(t=>s`<calcite-chip .value=${t} .label=${t} appearance=outline-fill kind=brand @calciteChipSelect=${()=>this.inputValue=t}><div class="assistant-shell__suggested-prompt">${t}</div></calcite-chip>`)}</calcite-chip-group></div>`:null}render(){return s`<calcite-panel .loading=${this.loading} .heading=${this.heading??this._messages.shellHeading} .description=${this.description}><slot slot=header-actions-end name=header-actions-end></slot><div class="assistant-shell__content-container"><slot></slot></div>${this._renderSuggestedPrompts()}<div class="assistant-shell__footer-container" slot=footer><slot name=entry-message>${this.entryMessageClosed?null:s`<calcite-notice slot=entry-message .open=${!this.entryMessageClosed} kind=info closable icon width=full><div slot=message>${this.entryMessage??this._messages.shellEntryMessage}</div></calcite-notice>`}</slot><arcgis-assistant-chat-entry .awaitingResponse=${this.awaitingResponse} .arcgisSubmit=${this.arcgisSubmit} .arcgisCancel=${this.arcgisCancel} .inputValue=${this.inputValue} .status=${this.status} .messages=${this.messages} .voiceInputEnabled=${this.voiceInputEnabled}><slot name=entry-actions-start slot=entry-actions-start></slot></arcgis-assistant-chat-entry><slot name=footer-content></slot></div></calcite-panel>`}};l("arcgis-assistant-shell",i);return i},"core/Collection")
@@ -0,0 +1,2 @@
1
+ /* COPYRIGHT Esri - https://js.arcgis.com/5.1/LICENSE.txt */
2
+ import{g as e,h as s,t,u as i,v as l,z as n}from"./WRENCTR3.js";import"./CFDTXKJ6.js";export default $arcgis.t(([d,{watch:c}])=>{var r=e`.assistant-chat__messages-container{display:flex;flex:1;flex-direction:column}.assistant-chat__messages-list{padding:var(--calcite-spacing-lg);display:flex;flex-direction:column;gap:var(--calcite-spacing-md);flex:1 1 auto;min-height:0;justify-content:flex-end;overflow:auto}`,a=class extends l{constructor(){super(...arguments),this.#s=t(),this.feedbackEnabled=!1,this.logEnabled=!1,this.copyEnabled=!1,this.readAloudEnabled=!1,this.loading=!1,this.loadingMessage="",this.messages=new d([])}static{this.properties={feedbackEnabled:5,logEnabled:5,copyEnabled:5,readAloudEnabled:5,loading:5,loadingMessage:1,user:1,messages:0}}static{this.styles=r}#s;firstUpdated(){this._scrollToEnd()}loaded(){this.manager.onLifecycle(()=>[this.messages.on("change",()=>{this.requestUpdate(),this._scrollToEnd()}),c(()=>this.loading,()=>{this._scrollToEnd()})])}_scrollToEnd(){requestAnimationFrame(()=>{this.#s.value?.scrollIntoView({behavior:"smooth"})})}render(){return s`<div class="assistant-chat__messages-container"><div class="assistant-chat__messages-list"><slot></slot>${this.messages.map(o=>s`<arcgis-assistant-chat-card .message=${o} .user=${this.user} .feedbackEnabled=${this.feedbackEnabled} .logEnabled=${this.logEnabled} .copyEnabled=${this.copyEnabled} .readAloudEnabled=${this.readAloudEnabled}></arcgis-assistant-chat-card>`)}${this.loading?s`<arcgis-assistant-chat-card .loading=${this.loading} .loadingMessage=${this.loadingMessage} .message=${{id:"loading",role:"assistant",content:this.loadingMessage}}></arcgis-assistant-chat-card>`:null}</div><div ${i(this.#s)}></div></div>`}};n("arcgis-assistant-chat",a);return a},"core/Collection","core/reactiveUtils")
@@ -0,0 +1,2 @@
1
+ /* COPYRIGHT Esri - https://js.arcgis.com/5.1/LICENSE.txt */
2
+ import{g as C,h as S,n as l,v as f,x as m,z as y}from"./WRENCTR3.js";import"./CFDTXKJ6.js";export default $arcgis.t(([{when:w,watch:u},k,{property:d,subclass:v}])=>{var T=C`.assistant-chat-entry-speech-input__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}.assistant-chat-entry-speech-input__button[data-state=disabled]{--calcite-button-icon-color: var(--calcite-color-text-3);opacity:var(--calcite-opacity-disabled)}.assistant-chat-entry-speech-input__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)}.assistant-chat-entry-speech-input__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) )}.assistant-chat-entry-speech-input__button[data-state=listening]:active{--calcite-button-background-color: color-mix( in srgb, var(--calcite-color-brand) 24%, var(--calcite-color-foreground-1) )}.assistant-chat-entry-speech-input__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)}.assistant-chat-entry-speech-input__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)}.assistant-chat-entry-speech-input__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-chat-entry-speech-input-recording-pulse 1.8s ease-out infinite}@keyframes assistant-chat-entry-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){.assistant-chat-entry-speech-input__button[data-state=listening]:after{animation:none;opacity:1;transform:none}}`,I=Object.defineProperty,x=Object.getOwnPropertyDescriptor,p=(t,e,s,r)=>{for(var i=r>1?void 0:r?x(e,s):e,n=t.length-1,o;n>=0;n--)(o=t[n])&&(i=(r?o(e,s,i):o(i))||i);return r&&i&&I(e,s,i),i},a=class extends k{constructor(t){super(t),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([v("SpeechController")],a);var O=["audio/webm;codecs=opus","audio/webm","audio/mp4","audio/ogg;codecs=opus","audio/ogg"];function h(t){return t.replace(/\s+/gu," ").trim()}var M=Object.defineProperty,E=Object.getOwnPropertyDescriptor,g=(t,e,s,r)=>{for(var i=r>1?void 0:r?E(e,s):e,n=t.length-1,o;n>=0;n--)(o=t[n])&&(i=(r?o(e,s,i):o(i))||i);return r&&i&&M(e,s,i),i},c=class extends a{constructor(t){super(t),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"?"":O.find(t=>window.MediaRecorder.isTypeSupported(t))??""}initialize(){c.isSupported()&&this.addHandles(w(()=>!!this.errorCode,()=>{this._set("state","error")}))}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(t){this._pendingChunkOperations.add(t),t.finally(()=>{this._pendingChunkOperations.delete(t)})}async _awaitPendingChunkOperations(){this._pendingChunkOperations.size&&await Promise.allSettled(Array.from(this._pendingChunkOperations))}_onDataAvailable(t){let e=this._activeSessionId;e!=null&&this._queuePendingChunkOperation(this._processDataAvailable(t,e))}async _processDataAvailable(t,e){let s=t.data;if(!s.size||e!==this._activeSessionId)return;this._recordedChunks.push(s);let r=s.type||this._mediaRecorder?.mimeType||this._mimeType,i=this._mediaRecorderStopReason==="toggle"&&this._mediaRecorder?.state==="inactive";try{if(!this.handleRecording)return;let n=h(await this.handleRecording(s,r,this._mediaRecorderChunkIndex,i)??"");if(e!==this._activeSessionId)return;n&&this._set("liveTranscript",h(`${this.liveTranscript} ${n}`))}catch(n){if(e!==this._activeSessionId)return;this._failSession(n instanceof Error&&n.message==="transcription-unavailable"?"transcription-unavailable":"transcription-failed");return}!i&&e===this._activeSessionId&&(this._mediaRecorderChunkIndex+=1)}_failSession(t){let e=this._mediaRecorder;if(e){e.onstart=null,e.ondataavailable=null,e.onerror=null,e.onstop=null;try{e.state!=="inactive"&&e.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("errorCode",t)}_onError(){this._failSession("recording-failed")}_onStart(){this._set("state","listening")}_onStop(){this._handleStop()}_releaseMediaStream(){this._mediaStream?.getTracks().forEach(t=>t.stop()),this._mediaStream=null}async _handleStop(){let t=this._mediaRecorder,e=this._activeSessionId,s=this._mediaRecorderStopReason,r=t?.mimeType||this._recordedChunks.find(n=>!!n.type)?.type||"",i=[...this._recordedChunks];if(this._mediaRecorder=null,this._mediaRecorderChunkIndex=0,this._releaseMediaStream(),s==="cancel"){this._activeSessionId===e&&(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(e==null){this._mediaRecorderStopReason=null,this._pendingChunkOperations.clear(),this._recordedChunks=[],this._set("state","idle"),this._set("errorCode",void 0);return}if(await this._awaitPendingChunkOperations(),e===this._activeSessionId){if(!(r?new Blob(i,{type:r}):new Blob(i)).size){this._activeSessionId===e&&(this._activeSessionId=null),this._mediaRecorderStopReason=null,this._recordedChunks=[],this._set("errorCode","recording-failed");return}this._set("state","processing"),this._set("transcript",h(`${this.transcript} ${this.liveTranscript}`)),this._set("liveTranscript",""),this._activeSessionId===e&&(this._activeSessionId=null),this._set("state","idle"),this._set("errorCode",void 0),this._mediaRecorderStopReason=null,this._recordedChunks=[]}}start(){if(!c.isSupported()){this._set("errorCode","not-supported");return}let t=Date.now();this._activeSessionId=t,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(e=>{if(t!==this._activeSessionId){e.getTracks().forEach(i=>i.stop());return}let s=this._mimeType,r=s?new window.MediaRecorder(e,{mimeType:s}):new window.MediaRecorder(e);this._mediaStream=e,this._mediaRecorder=r,this._mediaRecorderChunkIndex=0,this._mediaRecorderStopReason=null,this._recordedChunks=[],r.ondataavailable=this._onDataAvailable.bind(this),r.onerror=this._onError.bind(this),r.onstart=this._onStart.bind(this),r.onstop=this._onStop.bind(this),this._mediaRecorder.start(this.chunkTimeSlice)}).catch(e=>{t===this._activeSessionId&&(this._activeSessionId=null,this._mediaRecorder=null,this._mediaRecorderChunkIndex=0,this._mediaRecorderStopReason=null,this._pendingChunkOperations.clear(),this._recordedChunks=[],this._releaseMediaStream(),e instanceof DOMException&&e.name==="NotAllowedError"?this._set("errorCode","not-allowed"):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 t=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),!t){this._releaseMediaStream();return}try{if(t.state!=="inactive"){t.stop();return}}catch{}this._mediaRecorder=null,this._releaseMediaStream()}static isSupported(){return typeof window<"u"&&!!(window.MediaRecorder&&navigator.mediaDevices?.getUserMedia)}};g([d()],c.prototype,"_mimeType",1);g([d()],c.prototype,"handleRecording",2);g([d()],c.prototype,"chunkTimeSlice",2);c=g([v("MediaRecorderController")],c);var $=Object.getOwnPropertyDescriptor,D=(t,e,s,r)=>{for(var i=r>1?void 0:r?$(e,s):e,n=t.length-1,o;n>=0;n--)(o=t[n])&&(i=o(i)||i);return i};function R(){if(typeof window>"u")return null;let t=window;return t.SpeechRecognition??t.webkitSpeechRecognition??null}var _=class extends a{constructor(t){super(t),this._isCancelled=!1,this._recognition=null}initialize(){let t=R();if(!t)return;let e=new t;e.continuous=!0,e.interimResults=!0,this.language&&(e.lang=this.language),e.onstart=this._onStart.bind(this),e.onresult=this._onResult.bind(this),e.onerror=this._onError.bind(this),e.onend=this._onEnd.bind(this),e.onspeechend=this._onSpeechEnd.bind(this),this._recognition=e,this.addHandles(w(()=>!!this.errorCode,()=>{this._set("state","error")}))}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(t){let{finalTranscript:e,liveTranscript:s}=Array.from(t.results).reduce((r,i)=>(i.isFinal?r.finalTranscript+=i[0].transcript:r.liveTranscript+=i[0].transcript,r),{finalTranscript:"",liveTranscript:""});this._set("transcript",h(e)),this._set("liveTranscript",h(s))}_onError(t){if(t.error==="aborted"&&this._isCancelled){this._set("state","idle");return}let e="unhandled";switch(t.error){case"no-speech":e="no-speech";break;case"service-not-allowed":case"not-allowed":e="not-allowed";break;default:e="unhandled"}this._set("errorCode",e)}_onEnd(){let t=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",t),this._set("state","idle")),this._set("errorCode",void 0)}_onSpeechEnd(){this._set("state","processing")}_reset(t=!1){this._isCancelled=t,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("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!!R()}};_=D([v("WebSpeechController")],_);var b=class extends f{constructor(){super(...arguments),this._resolvedMode="disabled",this.awaitingResponse=!1,this.mode="web-speech",this.arcgisVoiceInputError=l(),this.arcgisVoiceInputStart=l(),this.arcgisVoiceInputStop=l(),this.arcgisVoiceInputInterimTranscription=l(),this.arcgisVoiceInputTranscription=l(),this.arcgisVoiceInputTranscriptionStreamChunk=l()}static{this.properties={_resolvedMode:16,_state:16,_errorCode:16,_liveTranscript:16,_transcript:16,_isButtonDisabled:16,_buttonLabel:16,awaitingResponse:5,language:1,mode:1}}static{this.styles=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"}}loaded(){this.manager.onLifecycle(()=>[u(()=>[this.mode,this.language],()=>{this._configureController()},{initial:!0}),u(()=>this.awaitingResponse,e=>{e&&this._cancelActiveSession()},{initial:!0}),u(()=>this._liveTranscript,e=>{if(e){let s=h(`${this._transcript} ${e}`);this.arcgisVoiceInputInterimTranscription.emit({transcript:s})}}),u(()=>this._transcript,e=>{e&&this.arcgisVoiceInputTranscription.emit({transcript:e})}),u(()=>this._state,e=>{e==="error"&&this._errorCode&&this.arcgisVoiceInputError.emit({errorCode:this._errorCode})})])}disconnectedCallback(){super.disconnectedCallback(),this._destroySpeechController()}_configureController(){let e=this._resolveMode();this._destroySpeechController(),this._resolvedMode=e,e!=="disabled"&&(this._speechController=e==="web-speech"?new _({language:this.language}):new c({language:this.language,handleRecording:this._handleRecording.bind(this)}))}_destroySpeechController(){this._speechController?.cancel(),this._speechController?.destroy(),this._speechController=void 0}async _handleToggle(){if(!(this._isButtonDisabled||!this._speechController)){if(this._state==="listening"){this._speechController.stop(),this.arcgisVoiceInputStop.emit();return}this._speechController.start(),this.arcgisVoiceInputStart.emit()}}async _handleRecording(e,s,r,i){let n;return this.arcgisVoiceInputTranscriptionStreamChunk.emit({blob:e,chunkIndex:r,isFinal:i,mimeType:s,respondWithTranscript:o=>{n=o}}),n}_resolveMode(){return this.mode==="disabled"?"disabled":this.mode==="web-speech"&&_.isSupported()?"web-speech":c.isSupported()?"media-recorder":"disabled"}async _cancelActiveSession(){this._speechController&&this._resolvedMode!=="disabled"&&this._speechController.cancel()}render(){return S`<calcite-button appearance=transparent class="assistant-chat-entry-speech-input__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=${()=>void this._handleToggle()}></calcite-button>`}};y("arcgis-assistant-chat-entry-speech-input",b);return b},"core/reactiveUtils","core/Accessor","core/accessorSupport/decorators")
@@ -0,0 +1,2 @@
1
+ /* COPYRIGHT Esri - https://js.arcgis.com/5.1/LICENSE.txt */
2
+ import{a as _}from"./H3DVSYQV.js";import"./YGW7TUNX.js";import{g as d,h as c,n as o,t as v,u as g,v as f,x as y,z as m}from"./WRENCTR3.js";import"./CFDTXKJ6.js";export default $arcgis.t(([{watch:b},w])=>{var V=d`.assistant-chat-entry__input-container{display:flex;flex-direction:column}.assistant-chat-entry__footer-start{display:flex;gap:var(--calcite-spacing-md);flex-wrap:wrap;align-items:center}.assistant-chat-entry__footer-end{display:flex;gap:var(--calcite-spacing-md);align-items:center}.assistant-chat-entry__status-indicator{width:9px;height:9px;border-radius:100%;background-color:var(--calcite-color-status-success)}.assistant-chat-entry__status-indicator[data-status=working]{background-color:var(--calcite-color-status-warning)}.assistant-chat-entry__status-indicator[data-status=error]{background-color:var(--calcite-color-status-danger)}.assistant-chat-entry__status-text{text-transform:capitalize}`;function l(u){let{baseValue:t,transcript:s}=u;if(!s)return t;let e=t.trim();return e?`${e} ${s}`:s}var h=class extends f{constructor(){super(...arguments),this.#t=v(),this.#s=-1,this.#a="",this.#e=null,this.#i=t=>{let s=t.detail;this._applyVoiceInputTranscript(s?.transcript)},this.#n=()=>{this._startVoiceInputSession()},this.#r=()=>{this._finishVoiceInputSession()},this.#c=t=>{let s=t.detail;this._applyVoiceInputTranscript(s?.transcript,{final:!0})},this.#o=t=>{},this._messages=_({blocking:!0}),this.keyboardShortcutsDisabled=!1,this.awaitingResponse=!1,this.inputValue="",this.voiceInputEnabled=!1,this.messages=new w([]),this.arcgisCancel=o(),this.arcgisSubmit=o()}static{this.properties={_userMessages:16,keyboardShortcutsDisabled:5,entryPlaceholder:1,awaitingResponse:5,inputValue:1,status:1,voiceInputEnabled:5,messages:0}}static{this.styles=V}#t;#s;#a;#e;#i;#n;#r;#c;#o;get _userMessages(){return this.messages.toArray().filter(t=>t.role==="user").map(({content:t})=>t)}loaded(){this.manager.onLifecycle(()=>{let t=[{eventType:"arcgisVoiceInputInterimTranscription",callback:this.#i},{eventType:"arcgisVoiceInputStart",callback:this.#n},{eventType:"arcgisVoiceInputStop",callback:this.#r},{eventType:"arcgisVoiceInputTranscription",callback:this.#c},{eventType:"arcgisVoiceInputTranscriptionStreamChunk",callback:this.#o}];for(let{eventType:s,callback:e}of t)this.el.addEventListener(s,e);return[b(()=>this.inputValue,s=>{this.#t.value&&(this.#t.value.value=s)},{initial:!0}),{remove:()=>{for(let{eventType:s,callback:e}of t)this.el.removeEventListener(s,e)}}]})}async _submitMessage(){if(this.awaitingResponse){this.arcgisCancel.emit();return}let t=this.#t.value?.value.trim();t&&(this.arcgisSubmit.emit(t),this.#s=-1,this.#a="",this._clearVoiceInputSession(),this.#t.value&&(this.#t.value.value="",await this.#t.value.setFocus()))}async _navigateHistory(t,s){let e=this.#t.value;if(!e)return;let a=this._userMessages;if(a.length===0)return;let i=e.value??"",r=e.shadowRoot?.querySelector("textarea"),n=r?.selectionStart,p=r?.selectionEnd;if(!(n==null||p==null)&&!(n!==p||t==="up"&&n!==0||t==="down"&&n!==i.length)){if(t==="up"){this.#s===-1?(this.#a=i,this.#s=a.length-1):this.#s=Math.max(0,this.#s-1),e.value=a[this.#s]??"",s.preventDefault();return}this.#s!==-1&&(this.#s<a.length-1?(this.#s+=1,e.value=a[this.#s]??""):(this.#s=-1,e.value=this.#a),s.preventDefault())}}_startVoiceInputSession(){this.#e={baseValue:this.#t.value?.value?.trim()??"",phase:"listening",transcript:""}}_finishVoiceInputSession(){let t=this.#t.value,s=this.#e;if(!t){this._clearVoiceInputSession();return}if(!s){this._setDraftValue(t.value?.trim()??"");return}let e={...s,phase:"stopped"},a=l(e);this.#e=e,this._setDraftValue(a)}async _applyVoiceInputTranscript(t,s){let e=this.#t.value,a=this.#e;if(!e||!t||!a)return;if(a.phase==="stopped"){let n=l(a);if((e.value?.trim()??"")!==n){this._clearVoiceInputSession();return}}let i={...a,transcript:t},r=l(i);this.#e=i,this._setDraftValue(r),s?.final&&i.phase==="stopped"&&await e.setFocus()}_setDraftValue(t){this.#t.value&&(this.#t.value.value=t),this.#s=-1,this.#a=t}_clearVoiceInputSession(){this.#e=null}render(){return c`<div class="assistant-chat-entry__input-container"><calcite-text-area .value=${this.#t.value?.value} .placeholder=${this.entryPlaceholder??this._messages.entryPlaceholder} resize=vertical @keydown=${async t=>{t.altKey||t.ctrlKey||t.metaKey||t.shiftKey||this.keyboardShortcutsDisabled||(t.key==="Enter"?(t.preventDefault(),await this._submitMessage()):t.key==="ArrowUp"?await this._navigateHistory("up",t):t.key==="ArrowDown"&&await this._navigateHistory("down",t))}} ${g(this.#t)}><div slot=footer-start class="assistant-chat-entry__footer-start"><slot name=entry-actions-start></slot></div><div slot=footer-end class="assistant-chat-entry__footer-end">${this.status?c`<div id=tooltip-status class="assistant-chat-entry__status-indicator" data-status=${this.status??y}></div><calcite-tooltip reference-element=tooltip-status offset-distance=12><span class="assistant-chat-entry__status-text">${this.status}</span></calcite-tooltip>`:null}${this.voiceInputEnabled?c`<arcgis-assistant-chat-entry-speech-input .awaitingResponse=${this.awaitingResponse}></arcgis-assistant-chat-entry-speech-input>`:null}<calcite-button .iconStart=${this.awaitingResponse?"circle-stop":"send"} slot=footer-end round @click=${()=>void this._submitMessage()}>${this.awaitingResponse?this._messages.stopButtonLabel:this._messages.askButtonLabel}</calcite-button></div></calcite-text-area></div>`}};m("arcgis-assistant-chat-entry",h);return h},"core/reactiveUtils","core/Collection")
@@ -1 +1 @@
1
- {"thumbsUpLabel":"Thumbs Up","thumbsDownLabel":"Thumbs Down","copyButtonLabel":"Copy","logButtonLabel":"Log"}
1
+ {"thumbsUpLabel":"Thumbs Up","thumbsDownLabel":"Thumbs Down","copyButtonLabel":"Copy","logButtonLabel":"Log","readAloudButtonLabel":"Read Aloud","stopReadingButtonLabel":"Stop Reading"}
package/dist/cdn/index.js CHANGED
@@ -1,2 +1,2 @@
1
1
  /* COPYRIGHT Esri - https://js.arcgis.com/5.1/LICENSE.txt */
2
- import{p as e,y as s}from"./WRENCTR3.js";import"./CFDTXKJ6.js";var t=e(s,{"arcgis-assistant":[()=>import("./ETKNVWKV.js"),"_messages:,copyEnabled,description,entryMessage,feedbackEnabled,heading,keepSuggestedPrompts,logEnabled,messages:,orchestrator:,referenceElement,suggestedPrompts:;clearChatHistory,submitMessage;register"],"arcgis-assistant-agent":[()=>import("./O5QYUL5C.js"),"agent:,context:;getContext"],"arcgis-assistant-data-exploration-agent":[()=>import("./DLTK3ENO.js"),"referenceElement;;getContext"],"arcgis-assistant-help-agent":[()=>import("./NXIQDF7N.js"),"referenceElement;;getContext"],"arcgis-assistant-layer-styling-agent":[()=>import("./TTLSUI5H.js"),"referenceElement;;getContext"],"arcgis-assistant-navigation-agent":[()=>import("./UX7NRZPV.js"),"referenceElement;;getContext"],"arcgis-assistant-chat":[()=>import("./ZLYDPB4L.js"),"copyEnabled,feedbackEnabled,loading,loadingMessage,logEnabled,messages:,user"],"arcgis-assistant-chat-card":[()=>import("./WO6WO3SH.js"),"_messages:,content,copyEnabled,error,feedbackEnabled,loading,loadingMessage,log:,logEnabled,message:,messageRole,user"],"arcgis-assistant-chat-card-content":[()=>import("./4ZJM5GT4.js"),"content,loading,loadingMessage,type"],"arcgis-assistant-chat-entry":[()=>import("./NN7QKIMP.js"),"_messages:,awaitingResponse,entryPlaceholder,inputValue,keyboardShortcutsDisabled,messages:,status"],"arcgis-assistant-interrupt":[()=>import("./IUMTWQJI.js"),"_messages:,message,options:,type"],"arcgis-assistant-shell":[()=>import("./JPYSTYTV.js"),"_messages:,awaitingResponse,description,entryMessage,entryMessageClosed,heading,inputValue,loading,messages:,status,suggestedPrompts:"]});t({resourcesUrl:import.meta.url});var a=new CSSStyleSheet;a.replaceSync("@layer{:not([hydrated]):is(arcgis-assistant,arcgis-assistant-agent,arcgis-assistant-data-exploration-agent,arcgis-assistant-help-agent,arcgis-assistant-layer-styling-agent,arcgis-assistant-navigation-agent,arcgis-assistant-chat,arcgis-assistant-chat-card,arcgis-assistant-chat-card-content,arcgis-assistant-chat-entry,arcgis-assistant-interrupt,arcgis-assistant-shell){visibility:hidden}}");document.adoptedStyleSheets=[...document.adoptedStyleSheets,a];window.$arcgis||Object.defineProperty(window,"$arcgis",{configurable:!1,enumerable:!0,writable:!1,value:{}}),((a,r)=>{a.t=(c,...x)=>Promise.all(x.map(x=>x.then?x:(!a?.forceESM&&a?.import||(x=>import(x+".js").then(m=>m.default??m)))("@arcgis/core/"+x))).then(c);r.p=a.t(([m])=>{r.t=m.trackAccess;r.o=m.createObservable;r.c=m.createTrackingTarget;r.r=m.runTracked},"applications/Components/reactiveUtils")})($arcgis,s)
2
+ import{p as e,y as s}from"./WRENCTR3.js";import"./CFDTXKJ6.js";var t=e(s,{"arcgis-assistant":[()=>import("./6IDESYBP.js"),"_messages:,copyEnabled,description,entryMessage,feedbackEnabled,heading,keepSuggestedPrompts,logEnabled,messages:,orchestrator:,readAloudEnabled,referenceElement,suggestedPrompts:,voiceInputEnabled;clearChatHistory,submitMessage;register"],"arcgis-assistant-agent":[()=>import("./O5QYUL5C.js"),"agent:,context:;getContext"],"arcgis-assistant-data-exploration-agent":[()=>import("./DLTK3ENO.js"),"referenceElement;;getContext"],"arcgis-assistant-help-agent":[()=>import("./NXIQDF7N.js"),"referenceElement;;getContext"],"arcgis-assistant-layer-styling-agent":[()=>import("./TTLSUI5H.js"),"referenceElement;;getContext"],"arcgis-assistant-navigation-agent":[()=>import("./UX7NRZPV.js"),"referenceElement;;getContext"],"arcgis-assistant-chat":[()=>import("./MP7AEALE.js"),"copyEnabled,feedbackEnabled,loading,loadingMessage,logEnabled,messages:,readAloudEnabled,user"],"arcgis-assistant-chat-card":[()=>import("./5RA2JKQ5.js"),"_messages:,content,copyEnabled,error,feedbackEnabled,loading,loadingMessage,log:,logEnabled,message:,messageRole,readAloudEnabled,user"],"arcgis-assistant-chat-card-content":[()=>import("./4ZJM5GT4.js"),"content,loading,loadingMessage,type"],"arcgis-assistant-chat-entry":[()=>import("./VJGA26MX.js"),"_messages:,awaitingResponse,entryPlaceholder,inputValue,keyboardShortcutsDisabled,messages:,status,voiceInputEnabled"],"arcgis-assistant-chat-entry-speech-input":[()=>import("./SOPNKXO5.js"),"awaitingResponse,language,mode"],"arcgis-assistant-interrupt":[()=>import("./IUMTWQJI.js"),"_messages:,message,options:,type"],"arcgis-assistant-shell":[()=>import("./E4J4SWHB.js"),"_messages:,awaitingResponse,description,entryMessage,entryMessageClosed,heading,inputValue,loading,messages:,status,suggestedPrompts:,voiceInputEnabled"]});t({resourcesUrl:import.meta.url});var a=new CSSStyleSheet;a.replaceSync("@layer{:not([hydrated]):is(arcgis-assistant,arcgis-assistant-agent,arcgis-assistant-data-exploration-agent,arcgis-assistant-help-agent,arcgis-assistant-layer-styling-agent,arcgis-assistant-navigation-agent,arcgis-assistant-chat,arcgis-assistant-chat-card,arcgis-assistant-chat-card-content,arcgis-assistant-chat-entry,arcgis-assistant-chat-entry-speech-input,arcgis-assistant-interrupt,arcgis-assistant-shell){visibility:hidden}}");document.adoptedStyleSheets=[...document.adoptedStyleSheets,a];window.$arcgis||Object.defineProperty(window,"$arcgis",{configurable:!1,enumerable:!0,writable:!1,value:{}}),((a,r)=>{a.t=(c,...x)=>Promise.all(x.map(x=>x.then?x:(!a?.forceESM&&a?.import||(x=>import(x+".js").then(m=>m.default??m)))("@arcgis/core/"+x))).then(c);r.p=a.t(([m])=>{r.t=m.trackAccess;r.o=m.createObservable;r.c=m.createTrackingTarget;r.r=m.runTracked},"applications/Components/reactiveUtils")})($arcgis,s)
package/dist/cdn/main.css CHANGED
@@ -1 +1 @@
1
- @layer{:not([hydrated]):is(arcgis-assistant,arcgis-assistant-agent,arcgis-assistant-data-exploration-agent,arcgis-assistant-help-agent,arcgis-assistant-layer-styling-agent,arcgis-assistant-navigation-agent,arcgis-assistant-chat,arcgis-assistant-chat-card,arcgis-assistant-chat-card-content,arcgis-assistant-chat-entry,arcgis-assistant-interrupt,arcgis-assistant-shell){visibility:hidden}}
1
+ @layer{:not([hydrated]):is(arcgis-assistant,arcgis-assistant-agent,arcgis-assistant-data-exploration-agent,arcgis-assistant-help-agent,arcgis-assistant-layer-styling-agent,arcgis-assistant-navigation-agent,arcgis-assistant-chat,arcgis-assistant-chat-card,arcgis-assistant-chat-card-content,arcgis-assistant-chat-entry,arcgis-assistant-chat-entry-speech-input,arcgis-assistant-interrupt,arcgis-assistant-shell){visibility:hidden}}
@@ -210,6 +210,8 @@ export abstract class ArcgisAssistant extends LitElement {
210
210
  * with the role of "assistant", along with any logs or errors that occurred during processing.
211
211
  */
212
212
  accessor messages: Collection<ChatMessage>;
213
+ /** @default false */
214
+ accessor readAloudEnabled: boolean;
213
215
  /**
214
216
  * The reference element to the map that provides context for the assistant and its agents. Currently,
215
217
  * this is only scoped to `arcgis-map` elements. This is required when ArcGIS agents are registered to the assistant.
@@ -243,6 +245,8 @@ export abstract class ArcgisAssistant extends LitElement {
243
245
  * ```
244
246
  */
245
247
  accessor suggestedPrompts: string[];
248
+ /** @default false */
249
+ accessor voiceInputEnabled: boolean;
246
250
  /**
247
251
  * Clears the chat history between the user and the assistant. This method can be used to programmatically reset the conversation,
248
252
  * removing all messages from the chat interface.
@@ -1,24 +1,24 @@
1
1
  /* COPYRIGHT Esri - https://js.arcgis.com/5.1/LICENSE.txt */
2
- import { c as _ } from "../../chunks/runtime.js";
3
- import { css as b, html as p } from "lit";
2
+ import { c as f } from "../../chunks/runtime.js";
3
+ import { css as _, html as p } from "lit";
4
4
  import v from "@arcgis/core/core/Collection.js";
5
- import { whenOnce as w, watch as E, when as C } from "@arcgis/core/core/reactiveUtils.js";
6
- import k from "@arcgis/core/portal/Portal.js";
7
- import { LitElement as $, createEvent as n } from "@arcgis/lumina";
5
+ import { whenOnce as E, watch as w, when as C } from "@arcgis/core/core/reactiveUtils.js";
6
+ import $ from "@arcgis/core/portal/Portal.js";
7
+ import { LitElement as k, createEvent as n } from "@arcgis/lumina";
8
8
  import { createRef as m, ref as y } from "lit/directives/ref.js";
9
9
  import { Orchestrator as S } from "@arcgis/ai-orchestrator";
10
- import L from "@arcgis/core/core/Accessor.js";
11
- import { property as h, subclass as P } from "@arcgis/core/core/accessorSupport/decorators.js";
12
- import { g as I } from "../../chunks/utils2.js";
10
+ import I from "@arcgis/core/core/Accessor.js";
11
+ import { property as h, subclass as L } from "@arcgis/core/core/accessorSupport/decorators.js";
12
+ import { g as P } from "../../chunks/utils2.js";
13
13
  import { u as M } from "../../chunks/useT9n.js";
14
14
  import { rethrowError as O } from "@arcgis/toolkit/log";
15
- const R = b`:host{display:block;width:var(--arcgis-internal-panel-width, 100%);height:var(--arcgis-internal-expand-max-height, 100%)}`;
16
- var x = Object.defineProperty, A = Object.getOwnPropertyDescriptor, l = (c, e, t, i) => {
17
- for (var s = i > 1 ? void 0 : i ? A(e, t) : e, r = c.length - 1, o; r >= 0; r--)
15
+ const A = _`:host{display:block;width:var(--arcgis-internal-panel-width, 100%);height:var(--arcgis-internal-expand-max-height, 100%)}`;
16
+ var R = Object.defineProperty, x = Object.getOwnPropertyDescriptor, l = (c, e, t, i) => {
17
+ for (var s = i > 1 ? void 0 : i ? x(e, t) : e, r = c.length - 1, o; r >= 0; r--)
18
18
  (o = c[r]) && (s = (i ? o(e, t, s) : o(s)) || s);
19
- return i && s && x(e, t, s), s;
19
+ return i && s && R(e, t, s), s;
20
20
  };
21
- let a = class extends L {
21
+ let a = class extends I {
22
22
  constructor(c) {
23
23
  super(c), this.view = null, this.loading = !1, this.processing = !1, this.processingStep = "";
24
24
  }
@@ -34,14 +34,14 @@ let a = class extends L {
34
34
  this.orchestrator?.dispose(), super.destroy();
35
35
  }
36
36
  async _initialize() {
37
- this.removeHandles(), await Promise.all([this.portal.load(), this.view?.when()]), this.view && await w(() => !this.view.updating), this._set(
37
+ this.removeHandles(), await Promise.all([this.portal.load(), this.view?.when()]), this.view && await E(() => !this.view.updating), this._set(
38
38
  "orchestrator",
39
39
  await S.init({
40
40
  agents: [...this.agents],
41
41
  view: this.view ?? void 0
42
42
  })
43
43
  ), this.addHandles([
44
- E(
44
+ w(
45
45
  () => [this.view, this.agents],
46
46
  () => void this._initialize()
47
47
  )
@@ -78,21 +78,21 @@ let a = class extends L {
78
78
  return;
79
79
  }
80
80
  case "interrupt": {
81
- const { kind: o, message: g, metadata: d } = s.interrupt, u = Array.isArray(d) ? [...d] : [], f = (() => {
81
+ const { kind: o, message: g, metadata: u } = s.interrupt, d = Array.isArray(u) ? [...u] : [], b = (() => {
82
82
  switch (o) {
83
83
  case "booleanChoice":
84
- return { type: "boolean-choice", message: g, options: u };
84
+ return { type: "boolean-choice", message: g, options: d };
85
85
  case "singleSelection":
86
- return { type: "single-select", message: g, options: u };
86
+ return { type: "single-select", message: g, options: d };
87
87
  case "multipleSelection":
88
- return { type: "multi-select", message: g, options: u };
88
+ return { type: "multi-select", message: g, options: d };
89
89
  case "textInput":
90
90
  return { type: "text-input", message: g };
91
91
  default:
92
- return { type: o, message: g, options: u };
92
+ return { type: o, message: g, options: d };
93
93
  }
94
94
  })();
95
- this._set("processingStep", "Waiting for user input..."), yield { type: "interrupt", payload: f, runId: r };
95
+ this._set("processingStep", "Waiting for user input..."), yield { type: "interrupt", payload: b, runId: r };
96
96
  break;
97
97
  }
98
98
  case "cancelled": {
@@ -139,12 +139,12 @@ l([
139
139
  h({ readOnly: !0 })
140
140
  ], a.prototype, "processingStep", 2);
141
141
  a = l([
142
- P("OrchestratorController")
142
+ L("OrchestratorController")
143
143
  ], a);
144
144
  const z = "Embeddings resource 'embeddings-v01.json' not found in the webmap portal item.", H = "Embeddings not found for this web map.", j = "https://developers.arcgis.com/javascript/latest/agentic-apps/ai-webmap-setup/#embeddings";
145
- class D extends $ {
145
+ class D extends k {
146
146
  constructor() {
147
- super(...arguments), this._messages = M({ blocking: !0 }), this.#e = m(), this.#t = m(), this.#s = null, this.#o = /* @__PURE__ */ new Map(), this.#r = k.getDefault(), this.#i = (e) => {
147
+ super(...arguments), this._messages = M({ blocking: !0 }), this.#e = m(), this.#t = m(), this.#s = null, this.#o = /* @__PURE__ */ new Map(), this.#r = $.getDefault(), this.#i = (e) => {
148
148
  e.stopPropagation(), this.arcgisInterruptCancel.emit(), this.orchestrator?.cancelInterrupt(), this._interrupt = null;
149
149
  }, this.#a = (e) => {
150
150
  e.stopPropagation();
@@ -164,13 +164,13 @@ class D extends $ {
164
164
  e.stopPropagation();
165
165
  const t = e.detail;
166
166
  this.arcgisFeedback.emit(t);
167
- }, this._orchestratorController = null, this._interrupt = null, this._error = null, this.messages = new v([]), this.referenceElement = null, this.suggestedPrompts = [], this.feedbackEnabled = !1, this.keepSuggestedPrompts = !1, this.logEnabled = !1, this.copyEnabled = !1, this.arcgisCancel = n(), this.arcgisError = n(), this.arcgisFeedback = n(), this.arcgisInterrupt = n(), this.arcgisInterruptCancel = n(), this.arcgisInterruptSubmit = n(), this.arcgisReady = n(), this.arcgisSubmit = n();
167
+ }, this._orchestratorController = null, this._interrupt = null, this._error = null, this.messages = new v([]), this.referenceElement = null, this.suggestedPrompts = [], this.feedbackEnabled = !1, this.keepSuggestedPrompts = !1, this.logEnabled = !1, this.copyEnabled = !1, this.voiceInputEnabled = !1, this.readAloudEnabled = !1, this.arcgisCancel = n(), this.arcgisError = n(), this.arcgisFeedback = n(), this.arcgisInterrupt = n(), this.arcgisInterruptCancel = n(), this.arcgisInterruptSubmit = n(), this.arcgisReady = n(), this.arcgisSubmit = n();
168
168
  }
169
169
  static {
170
- this.properties = { _orchestratorController: 16, _interrupt: 16, _error: 16, _user: 16, messages: 0, orchestrator: 32, entryMessage: 1, heading: 1, description: 1, referenceElement: 1, suggestedPrompts: 0, feedbackEnabled: 5, keepSuggestedPrompts: 5, logEnabled: 5, copyEnabled: 5 };
170
+ this.properties = { _orchestratorController: 16, _interrupt: 16, _error: 16, _user: 16, messages: 0, orchestrator: 32, entryMessage: 1, heading: 1, description: 1, referenceElement: 1, suggestedPrompts: 0, feedbackEnabled: 5, keepSuggestedPrompts: 5, logEnabled: 5, copyEnabled: 5, voiceInputEnabled: 5, readAloudEnabled: 5 };
171
171
  }
172
172
  static {
173
- this.styles = R;
173
+ this.styles = A;
174
174
  }
175
175
  #e;
176
176
  #t;
@@ -184,7 +184,7 @@ class D extends $ {
184
184
  #c;
185
185
  async #h() {
186
186
  try {
187
- const e = I(this.el, this.referenceElement);
187
+ const e = P(this.el, this.referenceElement);
188
188
  await e?.componentOnReady();
189
189
  const t = [...this.#o.values()];
190
190
  return t.length ? (this._orchestratorController = new a({
@@ -269,10 +269,10 @@ class D extends $ {
269
269
  return this._error ? p`<calcite-notice closable slot=entry-message open kind=danger icon width=full>${this._error === z ? p`<div slot=message>${H}</div><calcite-link slot=link .href=${j} target=_blank title="Learn about web map embeddings">Read more</calcite-link>` : p`<div slot=message>${this._error}</div>`}</calcite-notice>` : null;
270
270
  }
271
271
  render() {
272
- return p`<arcgis-assistant-shell .loading=${!this._orchestratorController && !this._error || this._orchestratorController?.loading} .heading=${this.heading ?? this._messages.assistantLabel} .description=${this.description} .entryMessage=${this.entryMessage} .entryMessageClosed=${this.messages.length > 0} .awaitingResponse=${this._orchestratorController?.processing} .suggestedPrompts=${this.suggestedPrompts} .messages=${this.messages} ${y(this.#e)}>${this._renderErrorNotice()}${this._interrupt ? p`<arcgis-assistant-interrupt slot=entry-message .type=${this._interrupt.type} .message=${this._interrupt.message} .options=${this._interrupt.options} ${y(this.#t)}></arcgis-assistant-interrupt>` : null}<arcgis-assistant-chat .loading=${this._orchestratorController?.processing} .loadingMessage=${this._orchestratorController?.processingStep || ""} .messages=${this.messages} .user=${this._user} .feedbackEnabled=${this.feedbackEnabled} .logEnabled=${this.logEnabled} .copyEnabled=${this.copyEnabled}><slot></slot></arcgis-assistant-chat><slot name=header-actions-end slot=header-actions-end></slot>${this.entryMessage ? null : p`<slot name=entry-message slot=entry-message></slot>`}<slot name=entry-actions-start slot=entry-actions-start></slot><slot name=footer-content slot=footer-content></slot></arcgis-assistant-shell>`;
272
+ return p`<arcgis-assistant-shell .loading=${!this._orchestratorController && !this._error || this._orchestratorController?.loading} .heading=${this.heading ?? this._messages.assistantLabel} .description=${this.description} .entryMessage=${this.entryMessage} .entryMessageClosed=${this.messages.length > 0} .awaitingResponse=${this._orchestratorController?.processing} .suggestedPrompts=${this.suggestedPrompts} .messages=${this.messages} .voiceInputEnabled=${this.voiceInputEnabled} ${y(this.#e)}>${this._renderErrorNotice()}${this._interrupt ? p`<arcgis-assistant-interrupt slot=entry-message .type=${this._interrupt.type} .message=${this._interrupt.message} .options=${this._interrupt.options} ${y(this.#t)}></arcgis-assistant-interrupt>` : null}<arcgis-assistant-chat .loading=${this._orchestratorController?.processing} .loadingMessage=${this._orchestratorController?.processingStep || ""} .messages=${this.messages} .user=${this._user} .feedbackEnabled=${this.feedbackEnabled} .logEnabled=${this.logEnabled} .copyEnabled=${this.copyEnabled} .readAloudEnabled=${this.readAloudEnabled}><slot></slot></arcgis-assistant-chat><slot name=header-actions-end slot=header-actions-end></slot>${this.entryMessage ? null : p`<slot name=entry-message slot=entry-message></slot>`}<slot name=entry-actions-start slot=entry-actions-start></slot><slot name=footer-content slot=footer-content></slot></arcgis-assistant-shell>`;
273
273
  }
274
274
  }
275
- _("arcgis-assistant", D);
275
+ f("arcgis-assistant", D);
276
276
  export {
277
277
  D as ArcgisAssistant
278
278
  };
@@ -16,5 +16,7 @@ export abstract class ArcgisAssistantChat extends LitElement {
16
16
  /** @default false */
17
17
  accessor logEnabled: boolean;
18
18
  accessor messages: Collection<ChatMessage>;
19
+ /** @default false */
20
+ accessor readAloudEnabled: boolean;
19
21
  accessor user: string | undefined;
20
22
  }
@@ -4,17 +4,17 @@ import { css as t, html as s } from "lit";
4
4
  import { LitElement as i } from "@arcgis/lumina";
5
5
  import { createRef as l, ref as n } from "lit/directives/ref.js";
6
6
  import o from "@arcgis/core/core/Collection.js";
7
- import { watch as c } from "@arcgis/core/core/reactiveUtils.js";
8
- const d = t`.assistant-chat__messages-container{display:flex;flex:1;flex-direction:column}.assistant-chat__messages-list{padding:var(--calcite-spacing-lg);display:flex;flex-direction:column;gap:var(--calcite-spacing-md);flex:1 1 auto;min-height:0;justify-content:flex-end;overflow:auto}`;
7
+ import { watch as d } from "@arcgis/core/core/reactiveUtils.js";
8
+ const c = t`.assistant-chat__messages-container{display:flex;flex:1;flex-direction:column}.assistant-chat__messages-list{padding:var(--calcite-spacing-lg);display:flex;flex-direction:column;gap:var(--calcite-spacing-md);flex:1 1 auto;min-height:0;justify-content:flex-end;overflow:auto}`;
9
9
  class r extends i {
10
10
  constructor() {
11
- super(...arguments), this.#s = l(), this.feedbackEnabled = !1, this.logEnabled = !1, this.copyEnabled = !1, this.loading = !1, this.loadingMessage = "", this.messages = new o([]);
11
+ super(...arguments), this.#s = l(), this.feedbackEnabled = !1, this.logEnabled = !1, this.copyEnabled = !1, this.readAloudEnabled = !1, this.loading = !1, this.loadingMessage = "", this.messages = new o([]);
12
12
  }
13
13
  static {
14
- this.properties = { feedbackEnabled: 5, logEnabled: 5, copyEnabled: 5, loading: 5, loadingMessage: 1, user: 1, messages: 0 };
14
+ this.properties = { feedbackEnabled: 5, logEnabled: 5, copyEnabled: 5, readAloudEnabled: 5, loading: 5, loadingMessage: 1, user: 1, messages: 0 };
15
15
  }
16
16
  static {
17
- this.styles = d;
17
+ this.styles = c;
18
18
  }
19
19
  #s;
20
20
  firstUpdated() {
@@ -25,7 +25,7 @@ class r extends i {
25
25
  this.messages.on("change", () => {
26
26
  this.requestUpdate(), this._scrollToEnd();
27
27
  }),
28
- c(() => this.loading, () => {
28
+ d(() => this.loading, () => {
29
29
  this._scrollToEnd();
30
30
  })
31
31
  ]);
@@ -36,7 +36,7 @@ class r extends i {
36
36
  });
37
37
  }
38
38
  render() {
39
- return s`<div class="assistant-chat__messages-container"><div class="assistant-chat__messages-list"><slot></slot>${this.messages.map((a) => s`<arcgis-assistant-chat-card .message=${a} .user=${this.user} .feedbackEnabled=${this.feedbackEnabled} .logEnabled=${this.logEnabled} .copyEnabled=${this.copyEnabled}></arcgis-assistant-chat-card>`)}${this.loading ? s`<arcgis-assistant-chat-card .loading=${this.loading} .loadingMessage=${this.loadingMessage} .message=${{ id: "loading", role: "assistant", content: this.loadingMessage }}></arcgis-assistant-chat-card>` : null}</div><div ${n(this.#s)}></div></div>`;
39
+ return s`<div class="assistant-chat__messages-container"><div class="assistant-chat__messages-list"><slot></slot>${this.messages.map((a) => s`<arcgis-assistant-chat-card .message=${a} .user=${this.user} .feedbackEnabled=${this.feedbackEnabled} .logEnabled=${this.logEnabled} .copyEnabled=${this.copyEnabled} .readAloudEnabled=${this.readAloudEnabled}></arcgis-assistant-chat-card>`)}${this.loading ? s`<arcgis-assistant-chat-card .loading=${this.loading} .loadingMessage=${this.loadingMessage} .message=${{ id: "loading", role: "assistant", content: this.loadingMessage }}></arcgis-assistant-chat-card>` : null}</div><div ${n(this.#s)}></div></div>`;
40
40
  }
41
41
  }
42
42
  e("arcgis-assistant-chat", r);
@@ -11,11 +11,15 @@ export abstract class ArcgisAssistantChatCard extends LitElement {
11
11
  thumbsDownLabel: string;
12
12
  copyButtonLabel: string;
13
13
  logButtonLabel: string;
14
+ readAloudButtonLabel: string;
15
+ stopReadingButtonLabel: string;
14
16
  } & T9nMeta<{
15
17
  thumbsUpLabel: string;
16
18
  thumbsDownLabel: string;
17
19
  copyButtonLabel: string;
18
20
  logButtonLabel: string;
21
+ readAloudButtonLabel: string;
22
+ stopReadingButtonLabel: string;
19
23
  }>;
20
24
  accessor content: string | undefined;
21
25
  /** @default false */
@@ -31,6 +35,8 @@ export abstract class ArcgisAssistantChatCard extends LitElement {
31
35
  accessor logEnabled: boolean;
32
36
  accessor message: ChatMessage | undefined;
33
37
  accessor messageRole: ChatMessage["role"] | undefined;
38
+ /** @default false */
39
+ accessor readAloudEnabled: boolean;
34
40
  accessor user: string | undefined;
35
41
  readonly arcgisFeedback: import("@arcgis/lumina").TargetedEvent<this, AssistantMessage>;
36
42
  readonly "@eventTypes": {
@@ -1,22 +1,88 @@
1
1
  /* COPYRIGHT Esri - https://js.arcgis.com/5.1/LICENSE.txt */
2
- import { c as s } from "../../chunks/runtime.js";
3
- import { css as i, html as e } from "lit";
4
- import { LitElement as c, createEvent as o } from "@arcgis/lumina";
5
- import { u as n } from "../../chunks/useT9n.js";
6
- import { unsafeHTML as r } from "lit/directives/unsafe-html.js";
7
- import { createRef as l, ref as d } from "lit/directives/ref.js";
8
- import { p as h } from "../../chunks/converterUtils.js";
9
- import { watch as g } from "@arcgis/core/core/reactiveUtils.js";
10
- const p = i`:host{display:block;container-type:inline-size}.assistant-chat-card__prompt-container{display:flex;align-items:center;gap:var(--calcite-spacing-md);background:color-mix(in srgb,var(--calcite-color-brand) 25%,transparent);color:var(--calcite-color-text-1);padding:var(--calcite-spacing-md);border-radius:var(--calcite-border-radius);width:fit-content;margin-left:auto;justify-content:flex-end}.assistant-chat-card__prompt-avatar{display:flex;align-items:center;justify-content:center}.assistant-chat-card__content-container{display:flex;flex:1;flex-direction:column;width:100%}.assistant-chat-card__response-container{display:flex;flex-direction:column;align-items:flex-start;gap:var(--calcite-spacing-sm);width:100%;text-align:left}.assistant-chat-card__response-icon{padding:var(--calcite-spacing-sm);border-radius:var(--calcite-spacing-xl);background:var(--calcite-color-brand);color:var(--calcite-color-foreground-1)}.assistant-chat-card__footer{display:flex;width:100%;justify-content:space-between;padding:0 var(--calcite-spacing-xxs)}.assistant-chat-card__feedback-actions{display:flex;flex-direction:row;gap:var(--calcite-spacing-xxs)}.assistant-chat-card__log-container{padding:0 var(--calcite-spacing-sm);border-radius:var(--calcite-border-radius);margin-bottom:var(--calcite-spacing-sm)}.assistant-chat-card__log{margin:0;background-color:var(--calcite-color-foreground-1);width:100%;max-height:300px;overflow:auto}.assistant-chat-card__log-entry{margin-left:var(--calcite-spacing-sm);padding:var(--calcite-spacing-xxs) var(--calcite-spacing-lg);border-left:1px solid var(--calcite-color-border-1)}.assistant-chat-card__footer-start,.assistant-chat-card__footer-end{display:flex;gap:var(--calcite-spacing-xxs)}@container (min-width: 480px){.assistant-chat-card__prompt-container,.assistant-chat-card__response-container{max-width:80%}}`;
11
- class _ extends c {
2
+ import { c as u } from "../../chunks/runtime.js";
3
+ import { css as _, html as i } from "lit";
4
+ import { LitElement as g, createEvent as m } from "@arcgis/lumina";
5
+ import { u as f } from "../../chunks/useT9n.js";
6
+ import { unsafeHTML as b } from "lit/directives/unsafe-html.js";
7
+ import { createRef as v, ref as y } from "lit/directives/ref.js";
8
+ import { p as x } from "../../chunks/converterUtils.js";
9
+ import { watch as h } from "@arcgis/core/core/reactiveUtils.js";
10
+ import w from "@arcgis/core/core/Accessor.js";
11
+ import { property as p, subclass as $ } from "@arcgis/core/core/accessorSupport/decorators.js";
12
+ const k = _`:host{display:block;container-type:inline-size}.assistant-chat-card__prompt-container{display:flex;align-items:center;gap:var(--calcite-spacing-md);background:color-mix(in srgb,var(--calcite-color-brand) 25%,transparent);color:var(--calcite-color-text-1);padding:var(--calcite-spacing-md);border-radius:var(--calcite-border-radius);width:fit-content;margin-left:auto;justify-content:flex-end}.assistant-chat-card__prompt-avatar{display:flex;align-items:center;justify-content:center}.assistant-chat-card__content-container{display:flex;flex:1;flex-direction:column;width:100%}.assistant-chat-card__response-container{display:flex;flex-direction:column;align-items:flex-start;gap:var(--calcite-spacing-sm);width:100%;text-align:left}.assistant-chat-card__response-icon{padding:var(--calcite-spacing-sm);border-radius:var(--calcite-spacing-xl);background:var(--calcite-color-brand);color:var(--calcite-color-foreground-1)}.assistant-chat-card__footer{display:flex;width:100%;justify-content:space-between;padding:0 var(--calcite-spacing-xxs)}.assistant-chat-card__feedback-actions{display:flex;flex-direction:row;gap:var(--calcite-spacing-xxs)}.assistant-chat-card__log-container{padding:0 var(--calcite-spacing-sm);border-radius:var(--calcite-border-radius);margin-bottom:var(--calcite-spacing-sm)}.assistant-chat-card__log{margin:0;background-color:var(--calcite-color-foreground-1);width:100%;max-height:300px;overflow:auto}.assistant-chat-card__log-entry{margin-left:var(--calcite-spacing-sm);padding:var(--calcite-spacing-xxs) var(--calcite-spacing-lg);border-left:1px solid var(--calcite-color-border-1)}.assistant-chat-card__footer-start,.assistant-chat-card__footer-end{display:flex;gap:var(--calcite-spacing-xxs)}@container (min-width: 480px){.assistant-chat-card__prompt-container,.assistant-chat-card__response-container{max-width:80%}}`;
13
+ var A = Object.defineProperty, L = Object.getOwnPropertyDescriptor, d = (s, t, a, n) => {
14
+ for (var o = n > 1 ? void 0 : n ? L(t, a) : t, e = s.length - 1, c; e >= 0; e--)
15
+ (c = s[e]) && (o = (n ? c(t, a, o) : c(o)) || o);
16
+ return n && o && A(t, a, o), o;
17
+ };
18
+ function l() {
19
+ return typeof window > "u" ? null : window;
20
+ }
21
+ let r = class extends w {
12
22
  constructor() {
13
- super(...arguments), this._messages = n({ blocking: !0 }), this._endRef = l(), this._showLog = !1, this.loading = !1, this.feedbackEnabled = !1, this.logEnabled = !1, this.copyEnabled = !1, this.arcgisFeedback = o();
23
+ super(...arguments), this._utterance = null, this.state = "idle", this.supported = r.isSupported();
24
+ }
25
+ destroy() {
26
+ this.stop(), super.destroy();
27
+ }
28
+ start(s) {
29
+ const t = s.trim(), a = l(), n = a?.SpeechSynthesisUtterance, o = a?.speechSynthesis;
30
+ if (this._set("supported", r.isSupported(a)), !t || !n || !o)
31
+ return;
32
+ this.stop();
33
+ const e = new n(t);
34
+ e.rate = 0.9, e.pitch = 1.1, e.volume = 1, e.onend = () => {
35
+ this._utterance === e && this._reset();
36
+ }, e.onerror = () => {
37
+ this._utterance === e && this._reset();
38
+ };
39
+ try {
40
+ o.speak(e), this._utterance = e, this._set("state", "playing");
41
+ } catch {
42
+ e.onend = null, e.onerror = null, this._reset();
43
+ }
44
+ }
45
+ stop() {
46
+ const s = l(), t = s?.speechSynthesis;
47
+ if (this._set("supported", r.isSupported(s)), t)
48
+ try {
49
+ (t.speaking || t.pending) && t.cancel();
50
+ } catch {
51
+ }
52
+ this._reset();
53
+ }
54
+ toggle(s) {
55
+ if (this.state === "playing") {
56
+ this.stop();
57
+ return;
58
+ }
59
+ this.start(s);
60
+ }
61
+ static isSupported(s = l()) {
62
+ return !!s?.speechSynthesis && typeof s.SpeechSynthesisUtterance == "function";
63
+ }
64
+ _reset() {
65
+ this._utterance && (this._utterance.onend = null, this._utterance.onerror = null), this._utterance = null, this._set("state", "idle");
66
+ }
67
+ };
68
+ d([
69
+ p({ readOnly: !0 })
70
+ ], r.prototype, "state", 2);
71
+ d([
72
+ p({ readOnly: !0 })
73
+ ], r.prototype, "supported", 2);
74
+ r = d([
75
+ $("ReadAloudController")
76
+ ], r);
77
+ class C extends g {
78
+ constructor() {
79
+ super(...arguments), this._messages = f({ blocking: !0 }), this._endRef = v(), this._readAloudController = new r(), this._showLog = !1, this.loading = !1, this.feedbackEnabled = !1, this.logEnabled = !1, this.copyEnabled = !1, this.readAloudEnabled = !1, this.arcgisFeedback = m();
14
80
  }
15
81
  static {
16
- this.properties = { _showLog: 16, _role: 16, _content: 16, _log: 16, _error: 16, _feedback: 16, loading: 5, messageRole: 1, feedbackEnabled: 5, logEnabled: 5, copyEnabled: 5, content: 1, loadingMessage: 1, log: 0, error: 1, user: 1, message: 0 };
82
+ this.properties = { _showLog: 16, _role: 16, _content: 16, _log: 16, _error: 16, _feedback: 16, loading: 5, messageRole: 1, feedbackEnabled: 5, logEnabled: 5, copyEnabled: 5, readAloudEnabled: 5, content: 1, loadingMessage: 1, log: 0, error: 1, user: 1, message: 0 };
17
83
  }
18
84
  static {
19
- this.styles = p;
85
+ this.styles = k;
20
86
  }
21
87
  get _role() {
22
88
  return this.message?.role ?? this.messageRole;
@@ -35,9 +101,13 @@ class _ extends c {
35
101
  }
36
102
  loaded() {
37
103
  this.manager.onLifecycle(() => [
38
- g(() => this._showLog, () => this._scrollToEnd())
104
+ h(() => this._showLog, () => this._scrollToEnd()),
105
+ h(() => this._readAloudController.state, () => this.requestUpdate(), { initial: !0 })
39
106
  ]);
40
107
  }
108
+ disconnectedCallback() {
109
+ super.disconnectedCallback(), this._readAloudController.destroy();
110
+ }
41
111
  _scrollToEnd() {
42
112
  requestAnimationFrame(() => {
43
113
  this._endRef.value?.scrollIntoView({ behavior: "smooth", block: "end" });
@@ -46,24 +116,27 @@ class _ extends c {
46
116
  _handleFeedback(t) {
47
117
  this.message?.role === "assistant" && (this.message.feedback = this.message.feedback?.positive === t ? void 0 : { positive: t }, this.arcgisFeedback.emit(this.message), this.requestUpdate());
48
118
  }
119
+ _toggleReadAloud() {
120
+ this._readAloudController.toggle(this._content ?? "");
121
+ }
49
122
  _renderLog() {
50
- return this._log && this._showLog && this.logEnabled ? e`<div class="assistant-chat-card__log-container"><div class="assistant-chat-card__log"><calcite-accordion appearance=transparent icon-position=start icon-type=chevron scale=s>${this._log.map((t) => {
123
+ return this._log && this._showLog && this.logEnabled ? i`<div class="assistant-chat-card__log-container"><div class="assistant-chat-card__log"><calcite-accordion appearance=transparent icon-position=start icon-type=chevron scale=s>${this._log.map((t) => {
51
124
  const a = t.includes(`
52
125
  `) || t.length > 70;
53
- return e`<calcite-accordion-item .heading=${a ? `${t.substring(0, 70)}...` : t} .expanded=${a}><div class="assistant-chat-card__log-entry">${a ? r(h(t)) : null}</div></calcite-accordion-item>`;
126
+ return i`<calcite-accordion-item .heading=${a ? `${t.substring(0, 70)}...` : t} .expanded=${a}><div class="assistant-chat-card__log-entry">${a ? b(x(t)) : null}</div></calcite-accordion-item>`;
54
127
  })}</calcite-accordion></div></div>` : null;
55
128
  }
56
129
  _renderThumbsUpButton() {
57
- return e`<calcite-action id=action-thumbs-up icon=thumbs-up scale=s .active=${this._feedback === !0} @click=${() => this._handleFeedback(!0)} text></calcite-action><calcite-tooltip reference-element=action-thumbs-up overlay-positioning=fixed placement=bottom><span>${this._messages.thumbsUpLabel}</span></calcite-tooltip>`;
130
+ return i`<calcite-action id=action-thumbs-up icon=thumbs-up scale=s .active=${this._feedback === !0} @click=${() => this._handleFeedback(!0)} text></calcite-action><calcite-tooltip reference-element=action-thumbs-up overlay-positioning=fixed placement=bottom><span>${this._messages.thumbsUpLabel}</span></calcite-tooltip>`;
58
131
  }
59
132
  _renderThumbsDownButton() {
60
- return e`<calcite-action id=action-thumbs-down icon=thumbs-down scale=s .active=${this._feedback === !1} @click=${() => this._handleFeedback(!1)} text></calcite-action><calcite-tooltip reference-element=action-thumbs-down overlay-positioning=fixed placement=bottom><span>${this._messages.thumbsDownLabel}</span></calcite-tooltip>`;
133
+ return i`<calcite-action id=action-thumbs-down icon=thumbs-down scale=s .active=${this._feedback === !1} @click=${() => this._handleFeedback(!1)} text></calcite-action><calcite-tooltip reference-element=action-thumbs-down overlay-positioning=fixed placement=bottom><span>${this._messages.thumbsDownLabel}</span></calcite-tooltip>`;
61
134
  }
62
135
  _renderFeedback() {
63
- return this.feedbackEnabled && !this._error ? e`<div class="assistant-chat-card__feedback-actions">${this._renderThumbsUpButton()}${this._renderThumbsDownButton()}</div>` : null;
136
+ return this.feedbackEnabled && !this._error ? i`<div class="assistant-chat-card__feedback-actions">${this._renderThumbsUpButton()}${this._renderThumbsDownButton()}</div>` : null;
64
137
  }
65
138
  _renderCopyButton() {
66
- return !this._error && this.copyEnabled ? e`<calcite-action id=action-copy icon=copy-to-clipboard scale=s @click=${async () => {
139
+ return !this._error && this.copyEnabled ? i`<calcite-action id=action-copy icon=copy-to-clipboard scale=s @click=${async () => {
67
140
  try {
68
141
  this._content && await navigator.clipboard.writeText(this._content);
69
142
  } catch (t) {
@@ -72,16 +145,19 @@ class _ extends c {
72
145
  }} text></calcite-action><calcite-tooltip reference-element=action-copy overlay-positioning=fixed placement=bottom><span>${this._messages.copyButtonLabel}</span></calcite-tooltip>` : null;
73
146
  }
74
147
  _renderLogButton() {
75
- return this._log && this.logEnabled ? e`<calcite-action id=action-log icon=access-string-results scale=s @click=${() => this._showLog = !this._showLog} .text=${this._messages.logButtonLabel} .active=${this._showLog}></calcite-action><calcite-tooltip reference-element=action-log overlay-positioning=fixed placement=bottom><span>${this._messages.logButtonLabel}</span></calcite-tooltip>` : null;
148
+ return this._log && this.logEnabled ? i`<calcite-action id=action-log icon=access-string-results scale=s @click=${() => this._showLog = !this._showLog} .text=${this._messages.logButtonLabel} .active=${this._showLog}></calcite-action><calcite-tooltip reference-element=action-log overlay-positioning=fixed placement=bottom><span>${this._messages.logButtonLabel}</span></calcite-tooltip>` : null;
149
+ }
150
+ _renderReadAloudButton() {
151
+ return this.readAloudEnabled && !this._error && this._content?.trim() && this._readAloudController.supported ? i`<calcite-action id=action-read-aloud .icon=${this._readAloudController.state === "playing" ? "sound-off" : "sound"} scale=s .active=${this._readAloudController.state === "playing"} @click=${() => this._toggleReadAloud()} text></calcite-action><calcite-tooltip reference-element=action-read-aloud overlay-positioning=fixed placement=bottom><span>${this._readAloudController.state === "playing" ? this._messages.stopReadingButtonLabel : this._messages.readAloudButtonLabel}</span></calcite-tooltip>` : null;
76
152
  }
77
153
  _renderFooter() {
78
- return this.loading ? null : e`<div class="assistant-chat-card__footer"><div class="assistant-chat-card__footer-start">${this._renderCopyButton()}${this._renderLogButton()}<slot name=footer-actions-start></slot></div><div class="assistant-chat-card__footer-end"><slot name=footer-actions-end></slot>${this._renderFeedback()}</div></div>`;
154
+ return this.loading ? null : i`<div class="assistant-chat-card__footer"><div class="assistant-chat-card__footer-start">${this._renderCopyButton()}${this._renderLogButton()}${this._renderReadAloudButton()}<slot name=footer-actions-start></slot></div><div class="assistant-chat-card__footer-end"><slot name=footer-actions-end></slot>${this._renderFeedback()}</div></div>`;
79
155
  }
80
156
  render() {
81
- return this._role === "user" ? e`<div class="assistant-chat-card__prompt-container"><div>${this._content}</div><div class="assistant-chat-card__prompt-avatar"><calcite-avatar .fullName=${this.user} scale=s></calcite-avatar></div></div>` : e`<div class="assistant-chat-card__response-container"><calcite-icon icon=effects class="assistant-chat-card__response-icon" scale=s></calcite-icon><div class="assistant-chat-card__content-container"><arcgis-assistant-chat-card-content .loading=${this.loading} .loadingMessage=${this.loadingMessage} .type=${this._error ? "error" : "text"} .content=${this._error ?? this._content}></arcgis-assistant-chat-card-content>${this._renderLog()}${this._renderFooter()}</div><div ${d(this._endRef)}></div></div>`;
157
+ return this._role === "user" ? i`<div class="assistant-chat-card__prompt-container"><div>${this._content}</div><div class="assistant-chat-card__prompt-avatar"><calcite-avatar .fullName=${this.user} scale=s></calcite-avatar></div></div>` : i`<div class="assistant-chat-card__response-container"><calcite-icon icon=effects class="assistant-chat-card__response-icon" scale=s></calcite-icon><div class="assistant-chat-card__content-container"><arcgis-assistant-chat-card-content .loading=${this.loading} .loadingMessage=${this.loadingMessage} .type=${this._error ? "error" : "text"} .content=${this._error ?? this._content}></arcgis-assistant-chat-card-content>${this._renderLog()}${this._renderFooter()}</div><div ${y(this._endRef)}></div></div>`;
82
158
  }
83
159
  }
84
- s("arcgis-assistant-chat-card", _);
160
+ u("arcgis-assistant-chat-card", C);
85
161
  export {
86
- _ as ArcgisAssistantChatCard
162
+ C as ArcgisAssistantChatCard
87
163
  };
@@ -25,6 +25,8 @@ export abstract class ArcgisAssistantChatEntry extends LitElement {
25
25
  accessor keyboardShortcutsDisabled: boolean;
26
26
  accessor messages: Collection<ChatMessage>;
27
27
  accessor status: "error" | "ready" | "working" | undefined;
28
+ /** @default false */
29
+ accessor voiceInputEnabled: boolean;
28
30
  readonly arcgisCancel: import("@arcgis/lumina").TargetedEvent<this, void>;
29
31
  readonly arcgisSubmit: import("@arcgis/lumina").TargetedEvent<this, string>;
30
32
  readonly "@eventTypes": {