@arcgis/coding-components 5.1.0-next.30 → 5.1.0-next.32
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/cdn/{NDZODDIP.js → 2EEFRTZX.js} +1 -1
- package/dist/cdn/{HLCJVNSY.js → 45WEPJEJ.js} +1 -1
- package/dist/cdn/{34G6AL4J.js → 5Q3OW4QF.js} +1 -1
- package/dist/cdn/{RQGL4HEX.js → 6G2FGLYL.js} +1 -1
- package/dist/cdn/{NLJRWI7K.js → 6X46NDHF.js} +1 -1
- package/dist/cdn/{WIXWRWMV.js → A3ON4WR7.js} +1 -1
- package/dist/cdn/BQA7IO4D.js +4 -0
- package/dist/cdn/{SH757OUS.js → E2ETQKW2.js} +1 -1
- package/dist/cdn/{6P6QBUIM.js → EJO5P3O7.js} +1 -1
- package/dist/cdn/{E2WMCC54.js → H37SG22O.js} +1 -1
- package/dist/cdn/{AIPIKH6B.js → JAEVU5R4.js} +1 -1
- package/dist/cdn/{57E2C3H4.js → KWKJARWB.js} +1 -1
- package/dist/cdn/{UJM26LCG.js → NAP3XRQZ.js} +1 -1
- package/dist/cdn/{P6JJUY3L.js → NY7MLPQO.js} +1 -1
- package/dist/cdn/{WCWYDXQK.js → RE6N3YEN.js} +1 -1
- package/dist/cdn/{Y5UMLHYI.js → T4Q7YEC5.js} +3 -3
- package/dist/cdn/TAF42V7X.js +2 -0
- package/dist/cdn/{J6H345FW.js → TIO734YC.js} +1 -1
- package/dist/cdn/{Q2O6TO3Q.js → TPFENF5U.js} +1 -1
- package/dist/cdn/{QWLDNSR7.js → XPROQCRY.js} +1 -1
- package/dist/cdn/assets/code-editor/sql-expr.worker.js +1 -1
- package/dist/cdn/index.js +1 -1
- package/dist/components/arcgis-arcade-coding-assistant/customElement.js +95 -88
- package/dist/docs/api.json +1 -1
- package/dist/docs/docs.json +1 -1
- package/dist/docs/web-types.json +1 -1
- package/package.json +5 -5
- package/dist/cdn/PKMCYFVN.js +0 -2
- package/dist/cdn/UPZB3YG3.js +0 -4
|
@@ -1,2 +1,2 @@
|
|
|
1
1
|
/* COPYRIGHT Esri - https://js.arcgis.com/5.1/LICENSE.txt */
|
|
2
|
-
import{a as v}from"./77GSSZOD.js";import{b,c as r,d as _}from"./WTNM2NCZ.js";import{a as p}from"./
|
|
2
|
+
import{a as v}from"./77GSSZOD.js";import{b,c as r,d as _}from"./WTNM2NCZ.js";import{a as p}from"./45WEPJEJ.js";import"./6X46NDHF.js";import{a as f}from"./6G2FGLYL.js";import"./NKCYMRE4.js";import"./BQLG62QR.js";import{d as h,e as m}from"./WMLTLTIE.js";import"./UYBZWFE5.js";import{E as c,F as d,J as u,h as g,j as s,l,n as a}from"./BQA7IO4D.js";import"./BCUUVBXH.js";import"./YLN7EMJC.js";import"./GHSEU7VA.js";import"./4OSKRQ5X.js";import"./NG7S6FUK.js";import"./3TTFCHAA.js";function S(o){return!Array.isArray(o)||!o.length?!1:Array.isArray(o[0].suggestions)}var $=g`:host{background-color:var(--calcite-color-foreground-1);.notice-container{margin:var(--calcite-spacing-xxs);padding:var(--calcite-spacing-sm);background-color:var(--calcite-color-foreground-1)}.sticky{position:sticky;top:0;z-index:10}calcite-flow{height:100%}calcite-block{p:first-of-type{margin-top:0}code{font-family:var(--calcite-code-family)}pre{direction:ltr;overflow-x:auto;background-color:var(--calcite-color-foreground-2);padding:var(--calcite-spacing-sm);code{font-size:var(--calcite-font-size--2)}}}calcite-list-item-group{background-color:var(--calcite-color-foreground-2)}calcite-flow{[slot=footer]{word-break:break-word}}}`,n=class extends d{constructor(){super(...arguments),this._beforeBack=async()=>{this._selectedSuggestion=void 0},this.messages=p(),this._colorizeStyle="",this._filterValue="",this.closed=!1,this.arcgisInternalClosePanel=a({bubbles:!1,composed:!1}),this.arcgisInternalItemSelected=a({bubbles:!1,composed:!1})}static{this.properties={_colorizeStyle:16,_filterValue:16,_selectedSuggestion:16,suggestions:0,closed:5}}static{this.styles=$}load(){this._colorizeStyle=r(),this._themeChangedListener=_(()=>this._colorizeStyle=r())}willUpdate(e){e.has("suggestions")&&this.suggestionsPropChanged()}disconnectedCallback(){super.disconnectedCallback(),this._flowObserver?.disconnect(),this._themeChangedListener?.dispose()}suggestionsPropChanged(){this._selectedSuggestion=void 0}flowFocusHandler(e){if(!e){this._flowObserver?.disconnect(),this._flowObserver=void 0;return}this._flowObserver||(this._flowObserver=new MutationObserver(()=>{m(e.querySelector("calcite-flow-item:last-child"),"calcite-input")}),this._flowObserver.observe(e,{attributes:!0,attributeFilter:["id"],childList:!0}))}_updateFilterValue(e){this._filterValue=e.currentTarget?.value??""}_emitItemSelected(e,t){let i=e;(!i.key||i.key==="Enter")&&(e.preventDefault(),this.arcgisInternalItemSelected.emit(t.code))}_showSuggestionDetail(e,t){e.stopPropagation(),this._selectedSuggestion=t}_emitClose(){this.arcgisInternalClosePanel.emit()}_colorizeCode(e){e!==void 0&&b(e,this._selectedSuggestion.code,"arcade")}renderSuggestionGroups(){return this.suggestions===void 0?null:S(this.suggestions)?this.suggestions.map(e=>s`<calcite-list-item-group .heading=${e.label}>${this.renderSuggestionListItems(e.suggestions)}</calcite-list-item-group>`):this.renderSuggestionListItems(this.suggestions)}renderSuggestionListItems(e){return e=f(e,"label",this._filterValue),e.length?e.map(t=>s`<calcite-list-item .label=${t.label} .description=${t.description} @calciteListItemSelect=${i=>this._emitItemSelected(i,t)} @keydown=${i=>this._emitItemSelected(i,t)} data-item=${t??l}><calcite-action slot=actions-end .text=${this.messages.expand??""} scale=s icon=chevron-right icon-flip-rtl @click=${i=>this._showSuggestionDetail(i,t)} data-item=${t??l}></calcite-action></calcite-list-item>`):s`<div class="notice-container">${this.messages.noitems}</div>`}renderSuggestionFlowItem(){let e=this._selectedSuggestion;return e?s`<calcite-flow-item heading-level=2 .heading=${this.messages.suggestions} closable @calciteFlowItemClose=${this._emitClose} .beforeBack=${this._beforeBack} selected><calcite-button width=half slot=footer appearance=outline kind=brand icon-start=code scale=s @click=${t=>this._emitItemSelected(t,e)} data-item=${e??l} ${c(h)}>${this.messages.insert}</calcite-button><calcite-block open .heading=${e.label} .description=${e.description}><div .innerHTML=${v(e.documentation)??""}></div><pre><code ${c(this._colorizeCode)}></code></pre></calcite-block></calcite-flow-item>`:null}render(){return this.closed?null:s`<style>${this._colorizeStyle}</style><calcite-flow ${c(this.flowFocusHandler)}><calcite-flow-item heading-level=2 .heading=${this.messages.suggestions} closable @calciteFlowItemClose=${this._emitClose} .selected=${!this._selectedSuggestion}><calcite-input .value=${this._filterValue} icon=magnifying-glass clearable @calciteInputInput=${this._updateFilterValue} class="sticky" scale=m></calcite-input><calcite-list .label=${this.messages.suggestions??"Suggestions"}>${this.renderSuggestionGroups()}</calcite-list></calcite-flow-item>${this.renderSuggestionFlowItem()}</calcite-flow>`}};u("arcgis-arcade-suggestions",n);export{n as ArcgisArcadeSuggestions};
|
|
@@ -1,2 +1,2 @@
|
|
|
1
1
|
/* COPYRIGHT Esri - https://js.arcgis.com/5.1/LICENSE.txt */
|
|
2
|
-
import{a as k,c as u,d as L}from"./WTNM2NCZ.js";import h from"./
|
|
2
|
+
import{a as k,c as u,d as L}from"./WTNM2NCZ.js";import h from"./NAP3XRQZ.js";import e from"./T7GEIGWF.js";import"./HPZZVB4X.js";import d from"./E2ETQKW2.js";import{a as N}from"./MP6Z45SA.js";import c from"./KWKJARWB.js";import{a as w}from"./6X46NDHF.js";import a from"./RE6N3YEN.js";import"./IFNCCZ7O.js";import"./6G2FGLYL.js";import{a as C}from"./NKCYMRE4.js";import"./BQLG62QR.js";import{a as E,b as y,c as b}from"./WMLTLTIE.js";import"./UYBZWFE5.js";import{F as v,J as S,K as T,h as g,i as _,j as l}from"./BQA7IO4D.js";import{b as f}from"./BCUUVBXH.js";import"./YLN7EMJC.js";import"./GHSEU7VA.js";import"./4OSKRQ5X.js";import"./NG7S6FUK.js";import"./3TTFCHAA.js";export default $arcgis.t(([,,,{a:O},{a:c,b:p}])=>{var M=Symbol(),h=class{get taskComplete(){return this.t||(this.i===1?this.t=new Promise(((t,e)=>{this.o=t,this.h=e})):this.i===3?this.t=Promise.reject(this.l):this.t=Promise.resolve(this.u)),this.t}constructor(t,e,s){this.p=0,this.i=0,(this._=t).addController(this);let i=typeof e=="object"?e:{task:e,args:s};this.v=i.task,this.j=i.args,this.m=i.argsEqual??A,this.k=i.onComplete,this.A=i.onError,this.autoRun=i.autoRun??!0,"initialValue"in i&&(this.u=i.initialValue,this.i=2,this.O=this.T?.())}hostUpdate(){this.autoRun===!0&&this.S()}hostUpdated(){this.autoRun==="afterUpdate"&&this.S()}T(){if(this.j===void 0)return;let t=this.j();if(!Array.isArray(t))throw Error("The args function must return an array");return t}async S(){let t=this.T(),e=this.O;this.O=t,t===e||t===void 0||e!==void 0&&this.m(e,t)||await this.run(t)}async run(t){let e,s;t??=this.T(),this.O=t,this.i===1?this.q?.abort():(this.t=void 0,this.o=void 0,this.h=void 0),this.i=1,this.autoRun==="afterUpdate"?queueMicrotask((()=>this._.requestUpdate())):this._.requestUpdate();let i=++this.p;this.q=new AbortController;let o=!1;try{e=await this.v(t,{signal:this.q.signal})}catch(d){o=!0,s=d}if(this.p===i){if(e===M)this.i=0;else{if(o===!1){try{this.k?.(e)}catch{}this.i=2,this.o?.(e)}else{try{this.A?.(s)}catch{}this.i=3,this.h?.(s)}this.u=e,this.l=s}this._.requestUpdate()}}abort(t){this.i===1&&this.q?.abort(t)}get value(){return this.u}get error(){return this.l}get status(){return this.i}render(t){switch(this.i){case 0:return t.initial?.();case 1:return t.pending?.();case 2:return t.complete?.(this.value);case 3:return t.error?.(this.error);default:throw Error("Unexpected status: "+this.i)}}},A=(n,t)=>n===t||n.length===t.length&&n.every(((e,s)=>!_(e,t[s])));var q=g`pre{direction:ltr;overflow-x:auto;background-color:var(--calcite-color-foreground-2);padding:var(--calcite-spacing-sm);white-space:pre-line;code{font-size:var(--calcite-font-size--2);font-family:var(--calcite-font-family-code)}}:host([round]){pre{border-radius:var(--calcite-corner-radius-round)}}`,m=class extends v{constructor(){super(...arguments),this._monacoEditor=w(C),this.#e=Promise.withResolvers(),this.#t="",this._slotContentObservers=[],this._onDefaultSlotChange=async t=>{E(t)||(this._codeFromSlot="");let e=t.target instanceof HTMLSlotElement?t.target:null,s=e?this._computeSlotText(e):"";e&&this._observeAssignedSlotNodes(e),s!==this._codeFromSlot&&(this._codeFromSlot=s),this.#e.resolve()},this._colorizeTask=new h(this,{task:async([t,e],{signal:s})=>{if(await this.#e.promise,s.aborted)return this.#t;if(await c(e),s.aborted)return this.#t;let i=await k(t,e);return s.aborted?this.#t:(this.#t=i,i)},args:()=>[this._codeFromSlot,this.language]}),this._codeFromSlot="",this.language="arcade",this.round=!1}static{this.properties={_codeFromSlot:16,language:1,round:7}}static{this.styles=q}#e;#t;async load(){O(T("./assets")),await p(this.language),await c(this.language),this._applyColorizeStyles(u()),this.manager.onLifecycle(()=>(this._themeObserver=y(this.el,["class"],()=>this.updateTheme()),this._themeChangedListener=L(()=>{this._applyColorizeStyles(u())}),this.updateTheme(),()=>{this._themeObserver?.(),this._themeObserver=void 0,this._themeChangedListener?.dispose(),this._themeChangedListener=void 0}))}loaded(){this.el.hasChildNodes()||this.#e.resolve()}willUpdate(t){t.has("language")&&p(this.language).then(()=>c(this.language)).catch(f(this))}disconnectedCallback(){super.disconnectedCallback(),this._disposeSlotObservers()}_disposeSlotObservers(){this._slotContentObservers.length&&(this._slotContentObservers.forEach(t=>t.disconnect()),this._slotContentObservers=[])}_observeAssignedSlotNodes(t){this._disposeSlotObservers();let e=t.assignedNodes({flatten:!0});if(!e.length)return;let s=new Set;for(let r of e)r.nodeType===Node.ELEMENT_NODE?s.add(r):r.nodeType===Node.TEXT_NODE&&r.parentElement&&s.add(r.parentElement);let i={characterData:!0,childList:!0,subtree:!0},o=N(()=>{let r=this._computeSlotText(t);r!==this._codeFromSlot&&(this._codeFromSlot=r)},100),d=r=>{if(r.some(a=>a.type==="childList")){let a=this._computeSlotText(t);a!==this._codeFromSlot&&(this._codeFromSlot=a);return}o()};s.forEach(r=>{let a=new MutationObserver(d);a.observe(r,i),this._slotContentObservers.push(a)})}_computeSlotText(t){let e=t.assignedNodes({flatten:!0}).filter(s=>s.nodeType!==Node.COMMENT_NODE);if(this.language==="html"&&e.length){let s=e.find(o=>o.nodeType===Node.ELEMENT_NODE&&o.tagName==="TEMPLATE");if(s)return(s.innerHTML??"").trim();let i=e.map(o=>o.nodeType===Node.ELEMENT_NODE?o.outerHTML:o.nodeType===Node.TEXT_NODE?o.textContent??"":"").join("").trim();return i}return e.map(s=>s.textContent??"").join("").trim()}updateTheme(){let t=b(this.el)==="light"?"vs":"vs-dark";t!==this._currentTheme&&(this._currentTheme=t,this._monacoEditor.setTheme(t))}_applyColorizeStyles(t){if(!this._colorizeSheet){this._colorizeSheet=new CSSStyleSheet;let e=this.renderRoot;e.adoptedStyleSheets=[...e.adoptedStyleSheets,this._colorizeSheet]}this._colorizeSheet.replaceSync(t)}render(){return l`<div><slot @slotchange=${this._onDefaultSlotChange} style="display:none" aria-hidden=true></slot><pre class="arcgis-code-viewer" aria-label=${`${this.language} code snippet`}>${this._colorizeTask.render({error:()=>null,pending:()=>l`<code class=${`language-${this.language}`}></code>`,complete:t=>l`<code class=${`language-${this.language}`} .innerHTML=${t??""}></code>`})}</pre></div>`}};S("arcgis-code-viewer",m);return m},a,c,d,e,h)
|
|
@@ -18248,7 +18248,7 @@ function se(t, e, r, n) {
|
|
|
18248
18248
|
const cr = { apiKey: void 0, apiKeys: { scopes: [] }, applicationName: "", applicationUrl: globalThis.location?.href, assetsPath: "", fontsUrl: "https://static.arcgis.com/fonts", geometryServiceUrl: "https://utility.arcgisonline.com/arcgis/rest/services/Geometry/GeometryServer", geoRSSServiceUrl: "https://utility.arcgis.com/sharing/rss", kmlServiceUrl: "https://utility.arcgis.com/sharing/kml", userPrivilegesApplied: !0, portalUrl: "https://www.arcgis.com", respectPrefersReducedMotion: !0, routeServiceUrl: "https://route-api.arcgis.com/arcgis/rest/services/World/Route/NAServer/Route_World", workers: { loaderConfig: { has: {}, paths: {}, map: {}, packages: [] } }, request: { crossOriginNoCorsDomains: null, httpsDomains: ["arcgis.com", "arcgisonline.com", "esrikr.com", "premiumservices.blackbridge.com", "esripremium.accuweather.com", "gbm.digitalglobe.com", "firstlook.digitalglobe.com", "msi.digitalglobe.com"], interceptors: [], internalInterceptors: [], maxUrlLength: 2e3, priority: "high", proxyRules: [], proxyUrl: null, timeout: 62e3, trustedServers: [], useIdentity: !0 }, log: { interceptors: [], level: null } };
|
|
18249
18249
|
if (globalThis.esriConfig && (H4(cr, globalThis.esriConfig, !0), delete cr.has), !cr.assetsPath) {
|
|
18250
18250
|
{
|
|
18251
|
-
const t = "5.1.0-next.
|
|
18251
|
+
const t = "5.1.0-next.32";
|
|
18252
18252
|
cr.assetsPath = `https://cdn.jsdelivr.net/npm/@arcgis/core@${t}/assets`;
|
|
18253
18253
|
}
|
|
18254
18254
|
cr.defaultAssetsPath = cr.assetsPath;
|
package/dist/cdn/index.js
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
1
|
/* COPYRIGHT Esri - https://js.arcgis.com/5.1/LICENSE.txt */
|
|
2
|
-
import{I as s,u as e}from"./
|
|
2
|
+
import{I as s,u as e}from"./BQA7IO4D.js";import"./BCUUVBXH.js";import"./3TTFCHAA.js";var i=e(s,{"arcgis-arcade-coding-assistant":[()=>import("./T4Q7YEC5.js"),"appVersion,assistantsEnabled,closed,closePanel:,disableQuestionAnswerLogging,editorRef:,feedbackServiceUrl,helpBase,insertText:,portalUrl,serviceUrl;destroy"],"arcgis-arcade-editor":[()=>import("./H37SG22O.js"),"arcadeAssistant:,customPanels:,editorInstance:,editorOptions:,hideDocumentationActions,hideSideBar,messages:,openedSidePanel,profile:,script,sideActionBarExpanded,snippets:,suggestions:,testData:;getTestResult,setFocus"],"arcgis-arcade-results":[()=>import("./A3ON4WR7.js"),"calciteModeDark,consoleLogs:,loading,openedResultPanel,result:"],"arcgis-arcade-suggestions":[()=>import("./TPFENF5U.js"),"closed,suggestions:"],"arcgis-code-editor":[()=>import("./TIO734YC.js"),"editorInstance:,editorOptions:,language,modelId,value;insertSnippet,insertText,setFocus"],"arcgis-code-editor-shell":[()=>import("./JAEVU5R4.js")],"arcgis-code-viewer":[()=>import("./XPROQCRY.js"),"language,round"],"arcgis-editor-variables":[()=>import("./EJO5P3O7.js"),"closed,loading,modelId,variable:"],"arcgis-language-api-panel":[()=>import("./2EEFRTZX.js"),"apiLibrary:,closed,hideDocumentationActions,languageId,loading"],"arcgis-sql-expression-editor":[()=>import("./NY7MLPQO.js"),"hideSideBar,messages:,profile:,script;setFocus"]});i({resourcesUrl:import.meta.url});var t=new CSSStyleSheet;t.replaceSync("@layer{:not([hydrated]):is(arcgis-arcade-editor,arcgis-code-editor,arcgis-code-editor-shell,arcgis-code-viewer,arcgis-sql-expression-editor){visibility:hidden}}");document.adoptedStyleSheets=[...document.adoptedStyleSheets,t];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)
|
|
@@ -15,7 +15,7 @@ import { unsafeHTML as A } from "lit/directives/unsafe-html.js";
|
|
|
15
15
|
import he from "@arcgis/core/layers/FeatureLayer.js";
|
|
16
16
|
import U from "@arcgis/core/config.js";
|
|
17
17
|
import L from "@arcgis/core/Graphic.js";
|
|
18
|
-
import { log as
|
|
18
|
+
import { log as w } from "@arcgis/toolkit/log";
|
|
19
19
|
import { getDeclaredVoxelMembers as me, getDeclaredPixelMembers as fe } from "@arcgis/core/applications/Components/arcadeEditorUtils.js";
|
|
20
20
|
import { s as be } from "../../chunks/fields.js";
|
|
21
21
|
import { h as Z, j as ge } from "../../chunks/language-defaults-base.js";
|
|
@@ -27,10 +27,10 @@ class C extends Error {
|
|
|
27
27
|
message: e,
|
|
28
28
|
code: t,
|
|
29
29
|
subCode: o,
|
|
30
|
-
details:
|
|
30
|
+
details: a,
|
|
31
31
|
source: n
|
|
32
32
|
}) {
|
|
33
|
-
super(e), this.name = "ArcadeAssistantError", this.code = t, this.subCode = o, this.details =
|
|
33
|
+
super(e), this.name = "ArcadeAssistantError", this.code = t, this.subCode = o, this.details = a, this.source = n;
|
|
34
34
|
}
|
|
35
35
|
}
|
|
36
36
|
function O(i) {
|
|
@@ -47,20 +47,20 @@ function O(i) {
|
|
|
47
47
|
}
|
|
48
48
|
}
|
|
49
49
|
async function $e(i) {
|
|
50
|
-
const { baseUrl: e, skillId: t, message: o, authToken:
|
|
50
|
+
const { baseUrl: e, skillId: t, message: o, authToken: a, previousConversationId: n, context: c } = i, p = t ? `${e}/skills/${t}/chat` : `${e}/chat`, r = [], s = {
|
|
51
51
|
message: o,
|
|
52
52
|
context: c
|
|
53
53
|
};
|
|
54
|
-
n && (
|
|
54
|
+
n && (s.conversation_id = n);
|
|
55
55
|
let u;
|
|
56
56
|
try {
|
|
57
57
|
u = await N(p, {
|
|
58
58
|
method: "post",
|
|
59
59
|
headers: {
|
|
60
60
|
"Content-Type": "application/json",
|
|
61
|
-
token:
|
|
61
|
+
token: a
|
|
62
62
|
},
|
|
63
|
-
body: JSON.stringify(
|
|
63
|
+
body: JSON.stringify(s),
|
|
64
64
|
responseType: "json"
|
|
65
65
|
});
|
|
66
66
|
} catch (b) {
|
|
@@ -69,21 +69,21 @@ async function $e(i) {
|
|
|
69
69
|
}
|
|
70
70
|
const l = u.data;
|
|
71
71
|
r.push(l);
|
|
72
|
-
const
|
|
72
|
+
const v = l.conversationId, P = l.inquiryId;
|
|
73
73
|
let $ = l.sequenceNumber;
|
|
74
74
|
async function T() {
|
|
75
75
|
let b = 0;
|
|
76
76
|
const g = 100;
|
|
77
77
|
for (; b < g; ) {
|
|
78
78
|
await new Promise((S) => setTimeout(S, 1e3));
|
|
79
|
-
const x = xe(
|
|
79
|
+
const x = xe(v, $, P);
|
|
80
80
|
let k;
|
|
81
81
|
try {
|
|
82
82
|
k = await N(p, {
|
|
83
83
|
method: "post",
|
|
84
84
|
headers: {
|
|
85
85
|
"Content-Type": "application/json",
|
|
86
|
-
token:
|
|
86
|
+
token: a
|
|
87
87
|
},
|
|
88
88
|
body: JSON.stringify(x),
|
|
89
89
|
responseType: "json"
|
|
@@ -92,16 +92,16 @@ async function $e(i) {
|
|
|
92
92
|
const V = S, te = V.details?.rawResponse || V.message || String(S), _ = O(te);
|
|
93
93
|
throw _ ? new C(_) : S;
|
|
94
94
|
}
|
|
95
|
-
const
|
|
96
|
-
if (
|
|
95
|
+
const y = k.data;
|
|
96
|
+
if (y.context?.kind === "ArcgisErrorAsContext" && y.context.error)
|
|
97
97
|
throw new C({
|
|
98
|
-
message:
|
|
99
|
-
code:
|
|
100
|
-
subCode:
|
|
101
|
-
details:
|
|
98
|
+
message: y.context.error.message || "ArcGIS Assistant error",
|
|
99
|
+
code: y.context.error.code,
|
|
100
|
+
subCode: y.context.error.subCode,
|
|
101
|
+
details: y.context.error.details,
|
|
102
102
|
source: "polling-response"
|
|
103
103
|
});
|
|
104
|
-
if (r.push(
|
|
104
|
+
if (r.push(y), $ = y.sequenceNumber, b++, !y.hasMore)
|
|
105
105
|
break;
|
|
106
106
|
}
|
|
107
107
|
if (b === g)
|
|
@@ -139,9 +139,9 @@ function ke(i) {
|
|
|
139
139
|
return i.message.match(/Error in prompt shield/u) ? "I'm having trouble with this request. Try again by rephrasing the question." : i.code === "TIMEOUT" ? "Request timed out. Try again by re-asking the same question or rephrasing it." : i.message;
|
|
140
140
|
}
|
|
141
141
|
const Se = ({ notices: i }) => i.length ? d`<div class="border-block-end">${X(i, (e) => e.id ?? e.title, (e) => d`<calcite-notice class="submission-notice" .icon=${e.icon} .kind=${e.kind} scale=s open .closable=${e.closable} @calciteNoticeClose=${() => e.onClose?.()}><div slot=title>${e.title}</div>${e.message && d`<div slot=message>${e.message}</div>` || ""}${e.actionLinkMessage && e.onAction && d`<calcite-link slot=link @click=${() => e.onAction?.()}>${e.actionLinkMessage}</calcite-link>` || ""}</calcite-notice>`)}</div>` : null, Ce = (i) => {
|
|
142
|
-
const e = i.value.length, t = 72, o = 180,
|
|
142
|
+
const e = i.value.length, t = 72, o = 180, a = i.offsetWidth, c = Math.max(1, Math.floor(a / 8)), p = Math.ceil(e / c), r = t + (p - 2) * 24;
|
|
143
143
|
i.style.setProperty("--calcite-text-area-min-height", `${Math.min(r, o)}px`);
|
|
144
|
-
}, Ae = ({ promptValidationMessage: i, errorMessage: e, contextTooBig: t, contextReducedNoticeDismissed: o, setContextReducedNoticeDismissed:
|
|
144
|
+
}, Ae = ({ promptValidationMessage: i, errorMessage: e, contextTooBig: t, contextReducedNoticeDismissed: o, setContextReducedNoticeDismissed: a, setErrorMessage: n, messages: c }) => {
|
|
145
145
|
const p = [];
|
|
146
146
|
if (i && p.push({
|
|
147
147
|
id: "prompt-validation",
|
|
@@ -157,15 +157,15 @@ const Se = ({ notices: i }) => i.length ? d`<div class="border-block-end">${X(i,
|
|
|
157
157
|
closable: !0,
|
|
158
158
|
onClose: () => n(void 0)
|
|
159
159
|
}), t && !o) {
|
|
160
|
-
const r = c.contextreduced ?? "Context reduced",
|
|
160
|
+
const r = c.contextreduced ?? "Context reduced", s = c.contextreducedmessage ?? "The editor profile is too large for the assistant. It has been reduced in the assistant in order to ensure a successful request.";
|
|
161
161
|
p.push({
|
|
162
162
|
id: "context-reduced",
|
|
163
163
|
kind: "warning",
|
|
164
164
|
icon: "exclamation-mark-triangle",
|
|
165
165
|
title: r,
|
|
166
|
-
message:
|
|
166
|
+
message: s,
|
|
167
167
|
closable: !0,
|
|
168
|
-
onClose: () =>
|
|
168
|
+
onClose: () => a(!0)
|
|
169
169
|
});
|
|
170
170
|
}
|
|
171
171
|
return p;
|
|
@@ -185,7 +185,7 @@ function Re({ active: i, setActive: e, messages: t }) {
|
|
|
185
185
|
function Fe({ context: i, messages: e }) {
|
|
186
186
|
return i ? d`<div class="gaps">${i.profileId && d`<calcite-popover auto-close placement=top .label=${(e.profilecontextlabel ?? "Profile context: {profileId}").replace("{profileId}", i.profileId)} reference-element=profile-context-button class="context-popover contained-popover-or-tooltip"><p>${(e.profilecontextlabel ?? "Profile context: {profileId}").replace("{profileId}", i.profileId)}</p></calcite-popover><calcite-button round kind=neutral icon-start=map-information id=profile-context-button scale=s></calcite-button>` || ""}</div>` : null;
|
|
187
187
|
}
|
|
188
|
-
function Me({ isDisabled: i, isReadOnly: e, setQuestion: t, setIsViewingResult: o, textAreaRef:
|
|
188
|
+
function Me({ isDisabled: i, isReadOnly: e, setQuestion: t, setIsViewingResult: o, textAreaRef: a, question: n, errorMessage: c, setErrorMessage: p, promptValidationMessage: r, setPromptValidationMessage: s, submitQuestion: u, messages: l, mode: v, assistantRef: P, context: $, contextReducedNoticeDismissed: T, setContextReducedNoticeDismissed: I }) {
|
|
189
189
|
const b = $?.contextTooLarge ?? !1, g = Ae({
|
|
190
190
|
promptValidationMessage: r,
|
|
191
191
|
errorMessage: c,
|
|
@@ -197,28 +197,28 @@ function Me({ isDisabled: i, isReadOnly: e, setQuestion: t, setIsViewingResult:
|
|
|
197
197
|
});
|
|
198
198
|
return d`<div class="text-area-wrapper">${Se({ notices: g })}<calcite-text-area scale=s resize=vertical .readOnly=${i || e} class=${ae(g.length ? "submission-text-area" : "submission-text-area round-top")} .placeholder=${l.askaquestion ?? `Specify the calculation or logic you need in an Arcade expression. (e.g., 'Return "Yes" if value > 10')`} .value=${n} @calciteTextAreaInput=${(x) => {
|
|
199
199
|
Ce(x.target), t(x.target.value);
|
|
200
|
-
}} ${ne(
|
|
200
|
+
}} ${ne(a)}><div class="submission-actions-wrapper" slot=footer-start><div class="submission-actions">${$ && Fe({ context: $, messages: l }) || ""}<div class="align-inline-end gaps"><calcite-button round kind=neutral .hidden=${v !== "refine"} icon-start=arrow-left icon-flip-rtl=both appearance=solid scale=s .disabled=${i} @click=${async () => {
|
|
201
201
|
o(!1), t("");
|
|
202
|
-
}} .label=${l.startover ?? "Start Over"} class="hidden-above-380" id=small-start-over-button></calcite-button><calcite-tooltip reference-element=small-start-over-button placement=top-start class="hidden-above-380">${l.startover ?? "Start Over"}</calcite-tooltip><calcite-button round kind=neutral .hidden=${
|
|
202
|
+
}} .label=${l.startover ?? "Start Over"} class="hidden-above-380" id=small-start-over-button></calcite-button><calcite-tooltip reference-element=small-start-over-button placement=top-start class="hidden-above-380">${l.startover ?? "Start Over"}</calcite-tooltip><calcite-button round kind=neutral .hidden=${v !== "refine"} icon-start=arrow-left icon-flip-rtl=both appearance=solid .disabled=${i} @click=${async () => {
|
|
203
203
|
o(!1), t("");
|
|
204
204
|
}} class="hidden-below-380" scale=s>${l.startover ?? "Start Over"}</calcite-button><calcite-button round scale=s icon-end=effects appearance=solid .loading=${i} .disabled=${i} @click=${async () => {
|
|
205
205
|
if (p(""), !n) {
|
|
206
|
-
|
|
206
|
+
s(l.enteraprompt ?? "Please enter a prompt");
|
|
207
207
|
return;
|
|
208
208
|
}
|
|
209
|
-
|
|
210
|
-
}} class="hidden-below-380">${
|
|
209
|
+
s(void 0), await u();
|
|
210
|
+
}} class="hidden-below-380">${v === "prompt" ? l.ask ?? "Generate" : l.refine ?? "Refine"}</calcite-button><calcite-button round scale=s icon-end=effects appearance=solid .loading=${i} .disabled=${i} id=small-submit-button @click=${async () => {
|
|
211
211
|
if (p(""), !n) {
|
|
212
|
-
|
|
212
|
+
s(l.enteraprompt ?? "Please enter a prompt");
|
|
213
213
|
return;
|
|
214
214
|
}
|
|
215
|
-
|
|
216
|
-
}} class="hidden-above-380" .label=${
|
|
215
|
+
s(void 0), await u();
|
|
216
|
+
}} class="hidden-above-380" .label=${v === "prompt" ? l.ask ?? "Generate" : l.refine ?? "Refine"}></calcite-button><calcite-tooltip reference-element=small-submit-button placement=top-start class="hidden-above-380">${v === "prompt" ? l.ask ?? "Generate" : l.refine ?? "Refine"}</calcite-tooltip></div></div></div></calcite-text-area></div>`;
|
|
217
217
|
}
|
|
218
218
|
const qe = "https://www.esri.com/en-us/privacy/privacy-statements/privacy-supplement", Pe = "https://www.esri.com/en-us/privacy/privacy-statements";
|
|
219
|
-
function Ve({ setOpen: i, messages: e, feedback: t, learnMoreUrl: o, setFeedback:
|
|
220
|
-
return t.active ? d`<calcite-sheet class="feedback-sheet" .label=${e.feedback ?? "Feedback"} slot=sheets display-mode=float position=block-end .open=${t.active} @calciteSheetClose=${() => i(!1)}><calcite-panel .heading=${e.submitfeedback ?? "Submit feedback to Esri"} scale=s><div class="feedback-content"><calcite-text-area scale=s resize=vertical .value=${t.text} @calciteTextAreaInput=${(c) =>
|
|
221
|
-
|
|
219
|
+
function Ve({ setOpen: i, messages: e, feedback: t, learnMoreUrl: o, setFeedback: a, onSubmit: n }) {
|
|
220
|
+
return t.active ? d`<calcite-sheet class="feedback-sheet" .label=${e.feedback ?? "Feedback"} slot=sheets display-mode=float position=block-end .open=${t.active} @calciteSheetClose=${() => i(!1)}><calcite-panel .heading=${e.submitfeedback ?? "Submit feedback to Esri"} scale=s><div class="feedback-content"><calcite-text-area scale=s resize=vertical .value=${t.text} @calciteTextAreaInput=${(c) => a({ ...t, text: c.target.value })} .disabled=${t.submitting} .placeholder=${e.donotincludepersonalinfo ?? "Do not include personal or sensitive information"} rows=3></calcite-text-area><calcite-label layout=inline scale=s class="terms-label"><calcite-checkbox scale=l .checked=${t.termsAccepted} @calciteCheckboxChange=${(c) => {
|
|
221
|
+
a({ ...t, termsAccepted: c.target.checked });
|
|
222
222
|
}} .disabled=${t.submitting}></calcite-checkbox><span>${A((e.agreement ?? "I agree to the {EsriPrivacyStatement} (and {Supplement}).").replace("{EsriPrivacyStatement}", `<calcite-link href=${Pe} target="_blank">${e.esriprivacystatement ?? "Esri Privacy Statement"}</calcite-link>`).replace("{Supplement}", `<calcite-link href=${qe} target="_blank">${e.supplement ?? "Supplement"}</calcite-link>`))}</span></calcite-label><calcite-notice scale=s open closable><span slot=message>${A((e.feedbackhelps ?? "Your feedback will be used to improve Esri products and services. {LearnMore} about how this data is used.").replace("{LearnMore}", `<calcite-link href=${o} target="_blank">${e.learnmore ?? "Learn more"}</calcite-link>`))}</span></calcite-notice></div><div slot=footer class="feedback-footer"><calcite-button kind=neutral appearance=outline @click=${() => i(!1)} .disabled=${t.submitting}>${e.cancel ?? "Cancel"}</calcite-button><calcite-button @click=${n} .disabled=${!t.termsAccepted || t.submitting} .loading=${t.submitting} data-testid=submit-feedback-button>${e.submit ?? "Submit"}</calcite-button></div></calcite-panel></calcite-sheet>` : null;
|
|
223
223
|
}
|
|
224
224
|
function z({ assistantsEnabled: i, messages: e, slot: t, helpTopicUrl: o }) {
|
|
@@ -231,22 +231,22 @@ function De({ messages: i, suggestions: e, onSuggestionClick: t }) {
|
|
|
231
231
|
return d`<calcite-block .heading=${i.promptsuggestions} expanded collapsible id=suggestion-block scale=s><div class="suggestions">${e.map((o) => d`<calcite-button round scale=s appearance=outline-fill kind=neutral .label=${i.promptsuggestion} class="suggestion-button" @click=${() => t?.(o)}>${o}</calcite-button>`)}</div></calcite-block>`;
|
|
232
232
|
}
|
|
233
233
|
const j = 200;
|
|
234
|
-
function B({ hidden: i = !1, expanded: e = !1, messages: t, cards: o, heading:
|
|
235
|
-
return d`<calcite-block .hidden=${i} id=result-block .heading=${
|
|
234
|
+
function B({ hidden: i = !1, expanded: e = !1, messages: t, cards: o, heading: a, collapsible: n = !1, showEffectsIcon: c = !1, onCopyCode: p, standalone: r }) {
|
|
235
|
+
return d`<calcite-block .hidden=${i} id=result-block .heading=${a ?? t.besteffort ?? "Here is the assistant's best effort"} .expanded=${e} .collapsible=${n}>${c && d`<calcite-chip .label=${t.assistantresponses ?? "Assistant responses"} slot=content-start icon=effects scale=m class="suggestion-chips"></calcite-chip>` || ""}<calcite-card-group .label=${t.assistantresponses ?? "Assistant responses"}>${X(o, (s) => s.conversationId, (s) => d`<calcite-card><div slot=heading><div class="prior-prompt"><span>${s.priorPrompt.length > j ? `${s.priorPrompt.slice(0, j)}...` : s.priorPrompt}</span><calcite-action icon=duplicate scale=s slot=actions-end class="copy-prompt-button" text .id=${`copy-prompt-${s.conversationId}-${r ? "standalone" : "list"}`} @click=${(u) => {
|
|
236
236
|
const l = u.currentTarget;
|
|
237
|
-
navigator.clipboard.writeText(
|
|
237
|
+
navigator.clipboard.writeText(s.priorPrompt).then(() => {
|
|
238
238
|
l.setAttribute("data-copied", "true"), setTimeout(() => l.removeAttribute("data-copied"), 1500);
|
|
239
239
|
});
|
|
240
|
-
}}></calcite-action><calcite-popover .referenceElement=${`copy-prompt-${
|
|
240
|
+
}}></calcite-action><calcite-popover .referenceElement=${`copy-prompt-${s.conversationId}-${r ? "standalone" : "list"}`} placement=top-start class="copy-feedback" .label=${t.copiedsuccessfully ?? "copied successfully"} open trigger-disabled><span>${t.copiedsuccessfully ?? "copied successfully"}</span></calcite-popover><calcite-tooltip .referenceElement=${`copy-prompt-${s.conversationId}-${r ? "standalone" : "list"}`} placement=top-start class="copy-tooltip">${t.copyprompttoclipboard ?? "Copy prompt to clipboard"}</calcite-tooltip></div>${s.message && r && d`<div class="response-error-container">${Ee({ errorMessage: s.message })}</div>` || ""}</div><div><div class="code-response-wrapper"><div class="positioned-code-content"><calcite-chip-group .label=${t.responsecontext ?? "Response Context"} scale=s>${s.message && !r && d`<calcite-tooltip .referenceElement=${`response-chip-${s.conversationId}-error`} placement=top-start>${s.message}</calcite-tooltip><calcite-chip .id=${`response-chip-${s.conversationId}-error`} .label=${t.error ?? "Error"} scale=s appearance=outline icon=exclamation-mark-triangle-f class="response-error-chip"></calcite-chip>` || ""}${Ne({ card: s, messages: t })}</calcite-chip-group></div><details class="collapsible-code" open><summary>Code response</summary><arcgis-code-viewer language=arcade round>${s.code}</arcgis-code-viewer></details></div></div><div slot=footer-start class="feedback-actions"><calcite-button class="add-to-editor-button hidden-above-380" @click=${() => s.onAddToEditor("add")} scale=s icon-start=plus round .label=${t.addtoeditor ?? "Add to editor"} .id=${`add-to-editor-button-${s.conversationId}-${r ? "standalone" : "list"}`}></calcite-button><calcite-tooltip class="hidden-above-380" .referenceElement=${`add-to-editor-button-${s.conversationId}-${r ? "standalone" : "list"}`} placement=top-start>${t.addtoeditor ?? "Add to editor"}</calcite-tooltip><calcite-button class="add-to-editor-button hidden-below-380" @click=${() => s.onAddToEditor("add")} scale=s icon-start=plus round>${t.addtoeditor ?? "Add to editor"}</calcite-button><calcite-button round icon-start=file-code kind=neutral scale=s @click=${() => s.onAddToEditor("replace")} class="response-secondary-action-button" .id=${`replace-${s.conversationId}-${r ? "standalone" : "list"}`}></calcite-button><calcite-tooltip .referenceElement=${`replace-${s.conversationId}-${r ? "standalone" : "list"}`} placement=top-start><span>${t.replaceineditor ?? "Replace all code in editor"}</span></calcite-tooltip><calcite-button round icon-start=copy-to-clipboard kind=neutral scale=s @click=${(u) => {
|
|
241
241
|
const l = u.currentTarget;
|
|
242
|
-
p(
|
|
242
|
+
p(s.code).then(() => {
|
|
243
243
|
l.setAttribute("data-copied", "true"), setTimeout(() => l.removeAttribute("data-copied"), 1500);
|
|
244
244
|
});
|
|
245
|
-
}} class="response-secondary-action-button" .id=${`copy-response-${
|
|
245
|
+
}} class="response-secondary-action-button" .id=${`copy-response-${s.conversationId}-${r ? "standalone" : "list"}`}></calcite-button><calcite-popover .referenceElement=${`copy-response-${s.conversationId}-${r ? "standalone" : "list"}`} placement=top-start class="copy-feedback" .label=${t.copiedsuccessfully ?? "copied successfully"} open trigger-disabled><span>${t.copiedsuccessfully ?? "copied successfully"}</span></calcite-popover><calcite-tooltip .referenceElement=${`copy-response-${s.conversationId}-${r ? "standalone" : "list"}`} placement=top-start class="copy-tooltip">${t.copytoclipboard ?? "Copy code to clipboard"}</calcite-tooltip></div><div slot=footer-end class="feedback-actions"><calcite-action .text=${t.thumbsup ?? "Thumbs up"} scale=s icon=thumbs-up @click=${s.onThumbsUp} .id=${`thumbs-up-${s.conversationId}-${r ? "standalone" : "list"}`}></calcite-action><calcite-tooltip .referenceElement=${`thumbs-up-${s.conversationId}-${r ? "standalone" : "list"}`} placement=top-start><span>${t.helpful ?? "Helpful"}</span></calcite-tooltip><calcite-action .text=${t.thumbsdown ?? "Thumbs down"} scale=s icon=thumbs-down @click=${s.onThumbsDown} .id=${`thumbs-down-${s.conversationId}-${r ? "standalone" : "list"}`}></calcite-action><calcite-tooltip .referenceElement=${`thumbs-down-${s.conversationId}-${r ? "standalone" : "list"}`} placement=top-start><span>${t.unhelpful ?? "Unhelpful"}</span></calcite-tooltip></div></calcite-card>`)}</calcite-card-group></calcite-block>`;
|
|
246
246
|
}
|
|
247
247
|
const Ne = ({ card: i, messages: e }) => {
|
|
248
|
-
const t = ue(), o = `response-chip-profile-${i.conversationId}-${t}`,
|
|
249
|
-
return d`<calcite-tooltip .referenceElement=${o} placement=top-start class="contained-popover-or-tooltip">${
|
|
248
|
+
const t = ue(), o = `response-chip-profile-${i.conversationId}-${t}`, a = (e.profilecontextlabel ?? "Profile context: {profileId}").replace("{profileId}", i.profileId);
|
|
249
|
+
return d`<calcite-tooltip .referenceElement=${o} placement=top-start class="contained-popover-or-tooltip">${a}</calcite-tooltip><calcite-chip .label=${i.profileId} scale=s appearance=outline icon=map-information id=${o ?? q}>${i.profileId}</calcite-chip>`;
|
|
250
250
|
}, H = (i) => i.type === "featureSet", E = (i) => {
|
|
251
251
|
if (!ge(i))
|
|
252
252
|
return [];
|
|
@@ -292,11 +292,11 @@ async function ee(i) {
|
|
|
292
292
|
};
|
|
293
293
|
}
|
|
294
294
|
case "featureSetCollection": {
|
|
295
|
-
const e = await i.loadSource(), t = e?.layers.filter(H) ?? [], o = e?.tables.filter(H) ?? [],
|
|
295
|
+
const e = await i.loadSource(), t = e?.layers.filter(H) ?? [], o = e?.tables.filter(H) ?? [], a = await Promise.all(t.map(G)), n = await Promise.all(o.map(G));
|
|
296
296
|
return {
|
|
297
297
|
name: i.name,
|
|
298
298
|
type: "featureSetCollection",
|
|
299
|
-
layers:
|
|
299
|
+
layers: a,
|
|
300
300
|
tables: n
|
|
301
301
|
};
|
|
302
302
|
}
|
|
@@ -431,10 +431,10 @@ function je(i) {
|
|
|
431
431
|
};
|
|
432
432
|
}
|
|
433
433
|
function Be(i) {
|
|
434
|
-
const e = i.variables, t = e.length, o = e.find((n) => n.name === "$feature") ?? e.find((n) => n.type === "feature") ?? e[0],
|
|
434
|
+
const e = i.variables, t = e.length, o = e.find((n) => n.name === "$feature") ?? e.find((n) => n.type === "feature") ?? e[0], a = o ? [o] : [];
|
|
435
435
|
return {
|
|
436
|
-
context: { variables:
|
|
437
|
-
wasReduced: t !==
|
|
436
|
+
context: { variables: a },
|
|
437
|
+
wasReduced: t !== a.length,
|
|
438
438
|
reducedToVariableName: o?.name
|
|
439
439
|
};
|
|
440
440
|
}
|
|
@@ -442,9 +442,9 @@ function He(i) {
|
|
|
442
442
|
return M(i) > Oe;
|
|
443
443
|
}
|
|
444
444
|
var Ge = Object.defineProperty, Je = Object.getOwnPropertyDescriptor, m = (i, e, t, o) => {
|
|
445
|
-
for (var
|
|
446
|
-
(c = i[n]) && (
|
|
447
|
-
return o &&
|
|
445
|
+
for (var a = o > 1 ? void 0 : o ? Je(e, t) : e, n = i.length - 1, c; n >= 0; n--)
|
|
446
|
+
(c = i[n]) && (a = (o ? c(e, t, a) : c(a)) || a);
|
|
447
|
+
return o && a && Ge(e, t, a), a;
|
|
448
448
|
};
|
|
449
449
|
let h = class extends ve {
|
|
450
450
|
constructor(i) {
|
|
@@ -518,25 +518,31 @@ class Ke extends se {
|
|
|
518
518
|
this.handleFeedbackSheetClose();
|
|
519
519
|
return;
|
|
520
520
|
}
|
|
521
|
-
|
|
522
|
-
|
|
523
|
-
const
|
|
524
|
-
|
|
525
|
-
|
|
526
|
-
|
|
527
|
-
|
|
521
|
+
let t = !1, o;
|
|
522
|
+
this.viewState.feedback.item.conversationId === this.viewState.history[0]?.conversationId && this.viewState.viewMode === "result" ? (o = this.viewState.context, t = !0) : o = this.viewState.feedback.item.contextSnapshot;
|
|
523
|
+
const a = U.applicationName;
|
|
524
|
+
!a && !this.appVersion && w("warn", this, "esriConfig.applicationName is not set. Consider setting it to help identify the application version in feedback.");
|
|
525
|
+
const { value: n, text: c, termsAccepted: p, item: { question: r, formattedScript: s, conversationId: u } } = this.viewState.feedback, l = {
|
|
526
|
+
user_evaluation: n,
|
|
527
|
+
your_comments: c || void 0,
|
|
528
|
+
question: r ?? "",
|
|
529
|
+
answer: this.encodeAnswerForFeedback(s),
|
|
528
530
|
useragent: navigator.userAgent,
|
|
529
531
|
_source: W,
|
|
530
|
-
version: this.appVersion ||
|
|
531
|
-
context:
|
|
532
|
-
|
|
533
|
-
|
|
534
|
-
|
|
532
|
+
version: this.appVersion || a || "NOT_SET",
|
|
533
|
+
context: o ? JSON.stringify({
|
|
534
|
+
...o,
|
|
535
|
+
/** Indicates whether the context is a snapshot or the full context */
|
|
536
|
+
isSnapshot: !t
|
|
537
|
+
}) : "",
|
|
538
|
+
extras: o?.profileId ?? "",
|
|
539
|
+
conversation_id: u ?? "",
|
|
540
|
+
privacy_statement: p ? "I_agree" : ""
|
|
535
541
|
};
|
|
536
542
|
try {
|
|
537
|
-
await e.applyEdits({ addFeatures: [new L({ attributes:
|
|
538
|
-
} catch (
|
|
539
|
-
|
|
543
|
+
await e.applyEdits({ addFeatures: [new L({ attributes: l })] });
|
|
544
|
+
} catch (v) {
|
|
545
|
+
w("error", this, "Error submitting feedback.", { detail: { error: v } });
|
|
540
546
|
}
|
|
541
547
|
this.handleFeedbackSheetClose();
|
|
542
548
|
}, this.handleClose = (e) => {
|
|
@@ -584,11 +590,11 @@ class Ke extends se {
|
|
|
584
590
|
});
|
|
585
591
|
};
|
|
586
592
|
e().catch((t) => {
|
|
587
|
-
|
|
593
|
+
w("error", this, "Error setting initial context.", { detail: { error: t } });
|
|
588
594
|
}), this.manager.onLifecycle(() => {
|
|
589
595
|
const t = D.onModelContextDidChange(async () => {
|
|
590
|
-
e().catch((
|
|
591
|
-
|
|
596
|
+
e().catch((a) => {
|
|
597
|
+
w("error", this, "Error setting context.", { detail: { error: a } });
|
|
592
598
|
});
|
|
593
599
|
});
|
|
594
600
|
return { remove: () => {
|
|
@@ -634,9 +640,9 @@ class Ke extends se {
|
|
|
634
640
|
return;
|
|
635
641
|
const e = new he({ url: this.feedbackServiceUrl });
|
|
636
642
|
await e.load();
|
|
637
|
-
const t = Ye.filter((o) => !e.fields.some((
|
|
643
|
+
const t = Ye.filter((o) => !e.fields.some((a) => a.name === o));
|
|
638
644
|
if (t.length > 0) {
|
|
639
|
-
|
|
645
|
+
w("error", this, `Missing the following fields in feedback service: ${t.join(", ")}. Feedback will not be logged.`);
|
|
640
646
|
return;
|
|
641
647
|
}
|
|
642
648
|
return this._feedbackService = e, e;
|
|
@@ -648,26 +654,27 @@ class Ke extends se {
|
|
|
648
654
|
try {
|
|
649
655
|
t = await this.ensureFeedbackService();
|
|
650
656
|
} catch (c) {
|
|
651
|
-
|
|
657
|
+
w("error", this, "Error initializing feedback service for interaction logging.", { detail: { error: c } });
|
|
652
658
|
return;
|
|
653
659
|
}
|
|
654
660
|
if (!t)
|
|
655
661
|
return;
|
|
656
|
-
const o = U.applicationName,
|
|
662
|
+
const o = U.applicationName, a = e.contextSnapshot, n = {
|
|
657
663
|
question: e.question,
|
|
658
664
|
answer: this.encodeAnswerForFeedback(e.answer),
|
|
659
665
|
useragent: navigator.userAgent,
|
|
660
666
|
_source: W,
|
|
661
667
|
version: this.appVersion || o || "NOT_SET",
|
|
662
|
-
context
|
|
663
|
-
|
|
668
|
+
// we send the snapshotted context in the automatic logging, rather than the full context, to avoid accidentally logging sensitive information that may be in the full context.
|
|
669
|
+
context: a ? JSON.stringify({ ...a, isSnapshot: !0 }) : "",
|
|
670
|
+
extras: a?.profileId ?? "",
|
|
664
671
|
conversation_id: e.conversationId ?? "",
|
|
665
672
|
privacy_statement: ""
|
|
666
673
|
};
|
|
667
674
|
try {
|
|
668
675
|
await t.applyEdits({ addFeatures: [new L({ attributes: n })] });
|
|
669
676
|
} catch (c) {
|
|
670
|
-
|
|
677
|
+
w("error", this, "Error logging arcade assistant question/answer interaction.", { detail: { error: c } });
|
|
671
678
|
}
|
|
672
679
|
}
|
|
673
680
|
getModel() {
|
|
@@ -680,10 +687,10 @@ class Ke extends se {
|
|
|
680
687
|
this.updateViewState({ isSubmitting: !0, errorMessage: void 0 });
|
|
681
688
|
let t, o;
|
|
682
689
|
try {
|
|
683
|
-
const
|
|
684
|
-
if (!
|
|
690
|
+
const a = this.getModel();
|
|
691
|
+
if (!a || !this.serviceUrl)
|
|
685
692
|
return;
|
|
686
|
-
const n = this.viewState.context ?? await this.getProfileAndMetadata(
|
|
693
|
+
const n = this.viewState.context ?? await this.getProfileAndMetadata(a.uri);
|
|
687
694
|
t = this.createFeedbackContextSnapshot(n);
|
|
688
695
|
const c = await this.getToken(), p = await $e({
|
|
689
696
|
baseUrl: this.serviceUrl,
|
|
@@ -699,7 +706,7 @@ class Ke extends se {
|
|
|
699
706
|
}
|
|
700
707
|
});
|
|
701
708
|
o = p?.[0]?.conversationId;
|
|
702
|
-
const r = p.find((
|
|
709
|
+
const r = p.find((s) => s.context?.kind === "ArcadeCodeResponse");
|
|
703
710
|
if (!r) {
|
|
704
711
|
await this.logInteractionToFeedbackService({
|
|
705
712
|
question: e,
|
|
@@ -710,7 +717,7 @@ class Ke extends se {
|
|
|
710
717
|
return;
|
|
711
718
|
}
|
|
712
719
|
if (r.context?.kind === "ArcadeCodeResponse") {
|
|
713
|
-
const
|
|
720
|
+
const s = this.createFeedbackContextSnapshot(n), u = pe(r?.context?.arcadeCode?.code ?? "");
|
|
714
721
|
this.updateViewState({
|
|
715
722
|
history: [
|
|
716
723
|
{
|
|
@@ -720,7 +727,7 @@ class Ke extends se {
|
|
|
720
727
|
question: e,
|
|
721
728
|
profile: n.profileId,
|
|
722
729
|
conversationId: r.conversationId,
|
|
723
|
-
contextSnapshot:
|
|
730
|
+
contextSnapshot: s,
|
|
724
731
|
...r.message ? { message: r.message } : {}
|
|
725
732
|
},
|
|
726
733
|
...this.viewState.history
|
|
@@ -734,14 +741,14 @@ class Ke extends se {
|
|
|
734
741
|
conversationId: r.conversationId
|
|
735
742
|
});
|
|
736
743
|
}
|
|
737
|
-
} catch (
|
|
738
|
-
const n =
|
|
744
|
+
} catch (a) {
|
|
745
|
+
const n = a instanceof Error && a.name === "ArcadeAssistantError" ? ke(a) || this.messages.erroroccurred || "An error occurred." : this.messages.erroroccurred || "An error occurred.";
|
|
739
746
|
this.updateViewState({ errorMessage: n }), await this.logInteractionToFeedbackService({
|
|
740
747
|
question: e,
|
|
741
748
|
answer: n,
|
|
742
749
|
contextSnapshot: t,
|
|
743
750
|
conversationId: o
|
|
744
|
-
}),
|
|
751
|
+
}), w("error", this, "Error submitting question", { detail: { error: a } });
|
|
745
752
|
} finally {
|
|
746
753
|
this.updateViewState({ isSubmitting: !1 });
|
|
747
754
|
}
|
|
@@ -754,12 +761,12 @@ class Ke extends se {
|
|
|
754
761
|
let t = Q;
|
|
755
762
|
const o = D.getEditorProfileForModel(e);
|
|
756
763
|
o?.loaded || await o?.loadSource();
|
|
757
|
-
const
|
|
758
|
-
|
|
759
|
-
const n = o ? await Le(o) : { variables: [] }, c = He(n), p = c ? Be(n) : void 0,
|
|
764
|
+
const a = this.editorRef.profile;
|
|
765
|
+
a && "id" in a && (t = a.id);
|
|
766
|
+
const n = o ? await Le(o) : { variables: [] }, c = He(n), p = c ? Be(n) : void 0, s = p ? p.context : n, u = M(s);
|
|
760
767
|
return {
|
|
761
768
|
profileId: t,
|
|
762
|
-
metadata:
|
|
769
|
+
metadata: s,
|
|
763
770
|
contextTooLarge: c,
|
|
764
771
|
reducedToVariableName: p?.reducedToVariableName,
|
|
765
772
|
estimatedTokens: u
|