@arcgis/coding-components 4.33.0-next.157 → 4.33.0-next.159
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/addons/arcade-coding-assistant/chat-helper.d.ts +24 -7
- package/dist/addons.js +1 -1
- package/dist/cdn/{AO6VJ7AR.js → 2N3K2DTA.js} +2 -2
- package/dist/cdn/{VIRZ237W.js → 2O5RPSXV.js} +2 -2
- package/dist/cdn/{L5ZMTXUX.js → 2S4UQAUQ.js} +2 -2
- package/dist/cdn/{JINJ3MOZ.js → 4SV5TVK4.js} +2 -2
- package/dist/cdn/{5A2W2JGQ.js → 5SNVZH4G.js} +1 -1
- package/dist/cdn/{NL4UMVSX.js → 6WWFCVZB.js} +2 -2
- package/dist/cdn/{NWCQS4RN.js → AFEL3H6J.js} +2 -2
- package/dist/cdn/{DCIK6GAB.js → AQGWSXEM.js} +1 -1
- package/dist/cdn/{INEDXYQ2.js → BKAX43XK.js} +2 -2
- package/dist/cdn/{VBSRSKAI.js → BYYHEISS.js} +2 -2
- package/dist/cdn/{UUKDOBDY.js → CKB7MPWZ.js} +2 -2
- package/dist/cdn/{OQZTMOH5.js → CQRTFEI4.js} +2 -2
- package/dist/cdn/{Q4MP4G7Q.js → DWHBPDYP.js} +2 -2
- package/dist/cdn/{B2DWB3RE.js → F2UFY3RX.js} +2 -2
- package/dist/cdn/{YJ4XQUAL.js → FPH6NDHK.js} +2 -2
- package/dist/cdn/{H2D2PSIU.js → G4BNUVHU.js} +2 -2
- package/dist/cdn/{CF6C7RH4.js → GP5ZRQRC.js} +2 -2
- package/dist/cdn/{JNFBWA7U.js → HNCYN2JT.js} +2 -2
- package/dist/cdn/{GJYOLQU6.js → ICD2DOTW.js} +2 -2
- package/dist/cdn/{3DBMUM2E.js → ILF5Q6DK.js} +2 -2
- package/dist/cdn/{5KKQKEM7.js → IPPUV6EE.js} +4 -4
- package/dist/cdn/{ICCAXRYM.js → IQBUSAE6.js} +2 -2
- package/dist/cdn/{RLCNPMAX.js → KRIIXM7I.js} +2 -2
- package/dist/cdn/LYA74LSW.js +6 -0
- package/dist/cdn/{LRRRFZEI.js → MROWFPLE.js} +2 -2
- package/dist/cdn/{VVNVW53D.js → OPJJALI4.js} +2 -2
- package/dist/cdn/{6T5Z42NQ.js → OUFLMSN5.js} +2 -2
- package/dist/cdn/{53BJLN5C.js → P3PNT4CY.js} +2 -2
- package/dist/cdn/{PEKLAPXM.js → PBM6WNXJ.js} +2 -2
- package/dist/cdn/{2EOMTXAM.js → PWL3LLFK.js} +2 -2
- package/dist/cdn/{AVRKPJBZ.js → QMCEWN5I.js} +2 -2
- package/dist/cdn/{ROOAZ3XS.js → TKXDIBWX.js} +1 -1
- package/dist/cdn/{KW5ZFYC6.js → V7SC4CIM.js} +2 -2
- package/dist/cdn/{7WJ7J7VC.js → VXOLFZKS.js} +2 -2
- package/dist/cdn/{GX7GR7GP.js → W4BTM2ZK.js} +2 -2
- package/dist/cdn/{DMVIP5KG.js → WAATIDDH.js} +1 -1
- package/dist/cdn/{63YGJX3Q.js → WYDZSWHV.js} +2 -2
- package/dist/cdn/{44ZQZJW7.js → X6FMPCMO.js} +2 -2
- package/dist/cdn/{REYPES3K.js → XGKSQ37I.js} +1 -1
- package/dist/cdn/{3IHAP57X.js → YQ57PCM5.js} +2 -2
- package/dist/cdn/{UXCNBPUL.js → ZQ3NYHSG.js} +2 -2
- package/dist/cdn/assets/arcade-coding-assistant/t9n/messages.ar.json +1 -1
- package/dist/cdn/assets/arcade-coding-assistant/t9n/messages.bg.json +1 -1
- package/dist/cdn/assets/arcade-coding-assistant/t9n/messages.bs.json +1 -1
- package/dist/cdn/assets/arcade-coding-assistant/t9n/messages.ca.json +1 -1
- package/dist/cdn/assets/arcade-coding-assistant/t9n/messages.cs.json +1 -1
- package/dist/cdn/assets/arcade-coding-assistant/t9n/messages.da.json +1 -1
- package/dist/cdn/assets/arcade-coding-assistant/t9n/messages.de.json +1 -1
- package/dist/cdn/assets/arcade-coding-assistant/t9n/messages.el.json +1 -1
- package/dist/cdn/assets/arcade-coding-assistant/t9n/messages.es.json +1 -1
- package/dist/cdn/assets/arcade-coding-assistant/t9n/messages.fi.json +1 -1
- package/dist/cdn/assets/arcade-coding-assistant/t9n/messages.fr.json +1 -1
- package/dist/cdn/assets/arcade-coding-assistant/t9n/messages.he.json +1 -1
- package/dist/cdn/assets/arcade-coding-assistant/t9n/messages.hr.json +1 -1
- package/dist/cdn/assets/arcade-coding-assistant/t9n/messages.hu.json +1 -1
- package/dist/cdn/assets/arcade-coding-assistant/t9n/messages.id.json +1 -1
- package/dist/cdn/assets/arcade-coding-assistant/t9n/messages.it.json +1 -1
- package/dist/cdn/assets/arcade-coding-assistant/t9n/messages.ja.json +1 -1
- package/dist/cdn/assets/arcade-coding-assistant/t9n/messages.ko.json +1 -1
- package/dist/cdn/assets/arcade-coding-assistant/t9n/messages.lt.json +1 -1
- package/dist/cdn/assets/arcade-coding-assistant/t9n/messages.lv.json +1 -1
- package/dist/cdn/assets/arcade-coding-assistant/t9n/messages.nl.json +1 -1
- package/dist/cdn/assets/arcade-coding-assistant/t9n/messages.no.json +1 -1
- package/dist/cdn/assets/arcade-coding-assistant/t9n/messages.pl.json +1 -1
- package/dist/cdn/assets/arcade-coding-assistant/t9n/messages.pt-BR.json +1 -1
- package/dist/cdn/assets/arcade-coding-assistant/t9n/messages.pt-PT.json +1 -1
- package/dist/cdn/assets/arcade-coding-assistant/t9n/messages.ro.json +1 -1
- package/dist/cdn/assets/arcade-coding-assistant/t9n/messages.ru.json +1 -1
- package/dist/cdn/assets/arcade-coding-assistant/t9n/messages.sk.json +1 -1
- package/dist/cdn/assets/arcade-coding-assistant/t9n/messages.sl.json +1 -1
- package/dist/cdn/assets/arcade-coding-assistant/t9n/messages.sr.json +1 -1
- package/dist/cdn/assets/arcade-coding-assistant/t9n/messages.sv.json +1 -1
- package/dist/cdn/assets/arcade-coding-assistant/t9n/messages.th.json +1 -1
- package/dist/cdn/assets/arcade-coding-assistant/t9n/messages.tr.json +1 -1
- package/dist/cdn/assets/arcade-coding-assistant/t9n/messages.uk.json +1 -1
- package/dist/cdn/assets/arcade-coding-assistant/t9n/messages.vi.json +1 -1
- package/dist/cdn/assets/arcade-coding-assistant/t9n/messages.zh-CN.json +1 -1
- package/dist/cdn/assets/arcade-coding-assistant/t9n/messages.zh-HK.json +1 -1
- package/dist/cdn/assets/arcade-coding-assistant/t9n/messages.zh-TW.json +1 -1
- package/dist/cdn/assets/code-editor/sql-expr.worker.js +39576 -39546
- package/dist/cdn/index.js +2 -2
- package/dist/chunks/arcade-defaults.js +1 -1
- package/dist/chunks/arcade-executor.js +1 -1
- package/dist/chunks/arcade-mode.js +1 -1
- package/dist/chunks/arcade-service-accessors.js +1 -1
- package/dist/chunks/editor.js +1 -1
- package/dist/chunks/fields.js +1 -1
- package/dist/chunks/language-defaults-base.js +1 -1
- package/dist/chunks/markdown.js +1 -1
- package/dist/chunks/monaco-importer.js +1 -1
- package/dist/chunks/runtime.js +1 -1
- package/dist/chunks/setup-monaco.js +1 -1
- package/dist/chunks/sql-expr-contribution.js +1 -1
- package/dist/chunks/sql-expr-defaults.js +1 -1
- package/dist/chunks/sql-expr-mode.js +1 -1
- package/dist/chunks/useT9n.js +1 -1
- package/dist/components/arcgis-arcade-coding-assistant/customElement.js +133 -104
- package/dist/components/arcgis-arcade-editor/customElement.js +1 -1
- package/dist/components/arcgis-arcade-results/customElement.js +1 -1
- package/dist/components/arcgis-arcade-suggestions/customElement.js +1 -1
- package/dist/components/arcgis-code-editor/customElement.js +1 -1
- package/dist/components/arcgis-editor-variables/customElement.js +1 -1
- package/dist/components/arcgis-language-api-panel/customElement.js +1 -1
- package/dist/components/arcgis-sql-expression-editor/customElement.js +1 -1
- package/dist/components/arcgis-sql-expression-fields/customElement.js +1 -1
- package/dist/docs/api.json +2 -2
- package/dist/docs/docs.json +2 -2
- package/dist/docs/web-types.json +1 -1
- package/dist/index.js +1 -1
- package/dist/loader.js +1 -1
- package/package.json +5 -5
- package/dist/cdn/62VVIVFO.js +0 -6
package/dist/loader.js
CHANGED
|
@@ -2,7 +2,7 @@ import { r as e } from "./chunks/runtime.js";
|
|
|
2
2
|
import { makeDefineCustomElements as s } from "@arcgis/lumina";
|
|
3
3
|
/*! All material copyright Esri, All Rights Reserved, unless otherwise specified.
|
|
4
4
|
See https://js.arcgis.com/4.33/esri/copyright.txt for details.
|
|
5
|
-
v4.33.0-next.
|
|
5
|
+
v4.33.0-next.159 */
|
|
6
6
|
const o = s(e, {
|
|
7
7
|
"arcgis-arcade-coding-assistant": [() => import("./components/arcgis-arcade-coding-assistant/customElement.js"), "appVersion,assistantsEnabled,closed,closePanel:,editorRef:,feedbackServiceUrl,helpBase,insertText:,layer,orgBaseUrl,serviceUrl;destroy"],
|
|
8
8
|
"arcgis-arcade-editor": [() => import("./components/arcgis-arcade-editor/customElement.js"), "customPanels:,editorInstance:,editorOptions:,hideDocumentationActions,hideSideBar,openedSidePanel:,profile:,script,sideActionBarExpanded,snippets:,suggestions:,testData:;getEditorInstance,getScript,getTestResult,setFocus"],
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@arcgis/coding-components",
|
|
3
|
-
"version": "4.33.0-next.
|
|
3
|
+
"version": "4.33.0-next.159",
|
|
4
4
|
"description": "Contains components for editing code in different languages. The currently supported languages are html, css, json, TypeScript, JavaScript, and Arcade.",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"ArcGIS",
|
|
@@ -39,10 +39,10 @@
|
|
|
39
39
|
],
|
|
40
40
|
"license": "SEE LICENSE IN LICENSE.md",
|
|
41
41
|
"dependencies": {
|
|
42
|
-
"@arcgis/arcade-languageservice": "4.33.0-next.
|
|
43
|
-
"@arcgis/components-utils": "4.33.0-next.
|
|
44
|
-
"@arcgis/languages-api-utils": "4.33.0-next.
|
|
45
|
-
"@arcgis/lumina": "4.33.0-next.
|
|
42
|
+
"@arcgis/arcade-languageservice": "4.33.0-next.159",
|
|
43
|
+
"@arcgis/components-utils": "4.33.0-next.159",
|
|
44
|
+
"@arcgis/languages-api-utils": "4.33.0-next.159",
|
|
45
|
+
"@arcgis/lumina": "4.33.0-next.159",
|
|
46
46
|
"monaco-editor": "^0.52.0",
|
|
47
47
|
"tslib": "^2.8.1",
|
|
48
48
|
"vscode-languageserver-types": "^3.17.5"
|
package/dist/cdn/62VVIVFO.js
DELETED
|
@@ -1,6 +0,0 @@
|
|
|
1
|
-
/*! All material copyright Esri, All Rights Reserved, unless otherwise specified.
|
|
2
|
-
See https://js.arcgis.com/4.33/esri/copyright.txt for details.
|
|
3
|
-
v4.33.0-next.157 */
|
|
4
|
-
import{a as G}from"./B2DWB3RE.js";import b from"./3IHAP57X.js";import{a as O,b as z}from"./ICCAXRYM.js";import{a as H}from"./JNFBWA7U.js";import"./44ZQZJW7.js";import a from"./RLCNPMAX.js";import"./REYPES3K.js";import{i as L,j as D}from"./5KKQKEM7.js";import"./AO6VJ7AR.js";import{A as I,C as B,a as U,b as c,c as q,d as R,p as F,q as _,r as N,y as V}from"./H2D2PSIU.js";import"./DCIK6GAB.js";import"./UXCNBPUL.js";import"./DMVIP5KG.js";export default $arcgis.t(([Z,J,ee,te,{a:Q},j])=>{var $=class extends N{constructor(e){if(super(e),this.it=R,e.type!==F.CHILD)throw Error(this.constructor.directiveName+"() can only be used in child bindings")}render(e){if(e===R||e==null)return this._t=void 0,this.it=e;if(e===q)return e;if(typeof e!="string")throw Error(this.constructor.directiveName+"() called with a non-string value");if(e===this.it)return this._t;this.it=e;let t=[e];return t.raw=t,this._t={_$litType$:this.constructor.resultType,strings:t,values:[]}}};$.directiveName="unsafeHTML",$.resultType=1;var x=_($);var ie=U`:host(:not([closed])){flex:1 0 auto;border-inline-start:var(--arcgis-coding-components-border);box-sizing:border-box;max-width:var(--arcgis-coding-components-side-panel-max-w);width:var(--arcgis-coding-components-side-panel-w);.response-actions{display:flex;align-items:center;padding:.5rem;gap:.5rem}.response-actions>div{display:flex;gap:.5rem}.prompt-list calcite-list-item{margin-block-end:.5rem;border-radius:var(--calcite-corner-radius-round);--calcite-color-border-3: transparent;overflow:hidden}.feedback-content{padding:1rem;display:flex;flex-direction:column;gap:.75rem}.feedback-sheet{--calcite-sheet-height: auto;--calcite-sheet-max-height: auto;--calcite-sheet-min-height: auto}calcite-chip[slot=header-actions-end]{align-self:center;margin-inline-end:.5rem}calcite-list-item:focus calcite-button{position:relative;top:-2px}.prompt-list calcite-list-item:last-of-type{margin-block-end:0}calcite-list{--calcite-color-foreground-1: transparent;background-color:transparent}calcite-list-item{--calcite-color-foreground-1: white}calcite-flow-item calcite-shell{background:transparent}calcite-block{width:100%;max-width:100%;align-self:flex-end;background-color:transparent}calcite-sheet{--calcite-sheet-scrim-background: rgba(200, 200, 200, .5)}.type-suggestion{--calcite-color-foreground-1: var(--calcite-color-foreground-current);--calcite-color-text-3: var(--calcite-color-text-2);--calcite-icon-color: var(--calcite-color-brand)}.type-history{--calcite-icon-color: var(--calcite-color-text-2)}.type-response{--calcite-icon-color: var(--calcite-color-brand);--calcite-font-family: monospace}.block-response{align-self:flex-start;margin-block-end:4rem;border-block-end:0;--calcite-block-text-color: var(--calcite-color-brand)}calcite-list-item calcite-button{margin-inline-end:.25rem}.type-docs{--calcite-color-foreground-1: var(--calcite-color-foreground-3);--calcite-icon-color: var(--calcite-color-text-1)}.type-error{--calcite-icon-color: var(--calcite-color-status-danger);--calcite-font-family: monospace;border:1px solid var(--calcite-color-status-danger)}#thumbs-up{margin-inline-start:auto;--calcite-icon-color: var(--calcite-color-border-input)}#thumbs-down{--calcite-icon-color: var(--calcite-color-border-input)}calcite-flow-item calcite-shell calcite-notice{margin-block:1rem}.no-space-block,.no-space-block[open]{margin:0}calcite-block[open]:last-of-type{border-block-end:0}.text-area-wrapper{display:flex;flex-direction:column;background:#fff;border-radius:var(--calcite-corner-radius-round);margin:.75rem;width:calc(100% - 1.5rem);overflow:hidden;max-width:calc(100% - 1.5rem);--calcite-color-border-input: transparent;--calcite-text-area-divider-color: transparent;position:sticky;align-self:flex-end;box-shadow:var(--calcite-shadow-sm);flex:none}.text-area-wrapper calcite-button:last-of-type{margin-inline-start:auto;align-self:flex-end}calcite-text-area{height:auto;min-height:5.75rem;overflow:hidden;border-radius:var(--calcite-corner-radius-round) var(--calcite-corner-radius-round) 0 0;--calcite-font-weight-normal: 500;font-weight:500;line-height:1.2}calcite-tooltip{--calcite-tooltip-z-index: 1000}.standalone-list{margin:1rem;width:calc(100% - 2rem)}.result-disclaimer{display:block;width:24rem;max-width:90%;margin:1rem auto;text-align:center;line-height:1.125rem;font-size:.875rem;font-style:italic}calcite-flow{height:100%}calcite-popover calcite-list{--calcite-list-background-color: transparent;--calcite-input-border-color: transparent}calcite-popover calcite-list calcite-filter{--calcite-spacing-sm: 0}.break-spaces{white-space:break-spaces}.feedback-button-container{margin-inline-start:auto;gap:0}.info-heading{font-size:var(--calcite-font-size-1);color:var(--calcite-color-text-1)}.unstyled-h3{margin:unset;font-size:var(--calcite-font-size-md)}.unstyled-shell{position:unset;inset:unset;display:unset;block-size:unset;inline-size:unset}.suggestion-chips{--calcite-chip-background-color: var(--calcite-color-foreground-current);--calcite-chip-text-color: var(--calcite-color-brand);calcite-chip{cursor:pointer}}.info-block{max-width:450px}#result-block{calcite-card-group{--calcite-card-group-gap: 1.25rem}calcite-card{--calcite-card-corner-radius: var(--calcite-corner-radius-round);--calcite-card-background-color: white;--calcite-card-border-color: transparent;width:100%}.positioned-code-content{flex-direction:row;gap:.5rem;display:flex;padding:.5rem}calcite-card [slot=title] calcite-chip{margin-block-start:.25rem}.code-response-wrapper{position:relative;background:var(--calcite-color-foreground-2);border-radius:var(--calcite-corner-radius-round);margin-top:-1.5rem}.prior-prompt{margin:.25rem 0 .75rem;max-width:95%;overflow-y:hidden;overflow-x:auto;padding:0}code{white-space:pre;font-size:12px;margin:0;overflow-x:auto;font-family:Fira Mono,Consolas,Menlo,monospace;display:block;max-height:12rem;position:relative;padding:.5rem}.code-collapse{margin-inline-start:auto}.copy-button{margin-left:.5rem}.add-to-editor-button{--calcite-internal-button-border-color: unset}}}:host([closed]){display:none}`;function Y(i){if(!i)return;let e=i.indexOf('{"error":');if(e!==-1)try{let t=i.slice(e),s=JSON.parse(t);if(s&&typeof s=="object"&&s.error)return s.error}catch{return}}async function se(i){let{baseUrl:e,skillId:t,message:s,authToken:o,previousConversationId:a,context:r}=i,n=t?`${e}/skills/${t}/chat`:`${e}/chat`,l=[],d={message:s,context:r};a&&(d.conversation_id=a);let b;try{b=await J(n,{method:"post",headers:{"Content-Type":"application/json",token:o},body:JSON.stringify(d),responseType:"json"})}catch(v){let y=v?.details?.rawResponse||v?.message||String(v),S=Y(y),k=new Error(`Failed to send message: ${s}. Response: ${y}`);throw S&&(k.arcadeAssistantError=S),k}let m=b.data;if(!m.hasMore)throw new Error("Expected hasMore to be true");l.push(m);let h=m.conversationId,w=m.inquiryId,p=m.sequenceNumber;async function A(){let v=0,y=25;for(;v<y;){await new Promise(f=>setTimeout(f,1e3));let S=ae(h,p,w),k;try{k=await J(n,{method:"post",headers:{"Content-Type":"application/json",token:o},body:JSON.stringify(S),responseType:"json"})}catch(f){let M=f?.details?.rawResponse||f?.message||String(f),C=Y(M),P=new Error(`Polling failed. Response: ${M}`);throw C&&(P.arcadeAssistantError=C),P}let g=k.data;if(g.context&&g.context.kind==="ArcgisErrorAsContext"&&g.context.error){let f=new Error(g.context.error.message||"ArcGIS Assistant error");throw f.arcadeAssistantError={message:g.context.error.message??"ArcGIS Assistant error"},f}if(l.push(g),p=g.sequenceNumber,v++,!g.hasMore)break}if(v===y)throw new Error("Request timed out")}return await A(),l}function ae(i,e,t){return{conversationId:i,inquiryId:t,ackSequenceNumber:e}}var oe=i=>{let e=i.value.length,t=72,s=180,o=i.offsetWidth,a=Math.max(1,Math.floor(o/8)),r=Math.ceil(e/a),n=t+(r-2)*24;i.style.setProperty("--calcite-text-area-min-height",`${Math.min(n,s)}px`)};function ce({messages:i}){return c`<calcite-chip slot=header-actions-end scale=s appearance=outline-fill .label=${i.beta??"Beta"}>${i.beta??"Beta"}</calcite-chip>`}function re({popoverContent:i}){return c`<calcite-action icon=information slot=header-actions-end id=legal-disclaimer text></calcite-action><calcite-popover reference-element=legal-disclaimer overlay-positioning=fixed label=legal-disclaimer placement=bottom auto-close>${i}</calcite-popover>`}function ne({errorMessage:i}){return c`<calcite-input-message id=error-message status=invalid slot=footer-start icon=exclamation-mark-triangle scale=m>${i}</calcite-input-message>`}function le({active:i,setActive:e,messages:t}){return c`<calcite-alert slot=alerts .open=${i} placement=bottom kind=success icon=check-circle-f auto-close @calciteAlertClose=${()=>e(!1)} .label=${t.expressionapplied??"Expression applied"}><div slot=message>${t.expressionapplied??"Expression applied to editor."}</div></calcite-alert>`}function de({isDisabled:i,isReadOnly:e,setQuestion:t,setIsViewingResult:s,textAreaRef:o,question:a,errorMessage:r,setErrorMessage:n,submitQuestion:l,messages:d,mode:b}){return c`<div class="text-area-wrapper"><calcite-text-area resize=vertical .readOnly=${i||e} class="styled-text-area" .placeholder=${d.askaquestion??`Specify the calculation or logic you need in an Arcade expression. (e.g., 'Return "Yes" if value > 10')`} .value=${a} @calciteTextAreaInput=${m=>{oe(m.target),t(m.target.value)}} ${z(o)}>${r&&ne({errorMessage:r})||""}</calcite-text-area><div class="response-actions" slot=footer-end><calcite-button round kind=neutral .hidden=${b!=="refine"} icon-start=arrow-left appearance=solid .disabled=${i} @click=${async()=>{s(!1),t("")}}>${d.startover??"Start Over"}</calcite-button><calcite-button round icon-end=effects appearance=solid .loading=${i} .disabled=${i} @click=${async()=>{n(a?"":d.enteraprompt??"Please enter a prompt"),await l()}}>${b==="prompt"?d.ask??"Generate":d.refine??"Refine"}</calcite-button></div></div>`}var pe="https://www.esri.com/en-us/privacy/privacy-statements/privacy-statement",ue="https://www.esri.com/en-us/privacy/privacy-statements/privacy-supplement";function me({setOpen:i,messages:e,feedback:t,setFeedback:s,onSubmit:o}){return c`<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.providefeedback??"Provide feedback"} .description=${e.experiencehelps??"Your experience helps guide future improvements"}><div class="feedback-content"><calcite-label>${e.experiencehelpful??"Was the assistant helpful?"}<calcite-segmented-control scale=l><calcite-segmented-control-item icon-start=thumbs-up .checked=${t.value==="good"} @click=${()=>s({...t,value:"good"})}></calcite-segmented-control-item><calcite-segmented-control-item icon-start=thumbs-down .checked=${t.value==="bad"} @click=${()=>s({...t,value:"bad"})}></calcite-segmented-control-item></calcite-segmented-control></calcite-label><calcite-label>${e.describeexperience??"Describe your experience"}<calcite-text-area resize=vertical .value=${t.text} @calciteTextAreaInput=${a=>s({...t,text:a.target.value})}></calcite-text-area></calcite-label><calcite-label layout=inline scale=s><calcite-checkbox scale=l .checked=${t.termsAccepted} @calciteCheckboxChange=${a=>{s({...t,termsAccepted:a.target.checked})}}></calcite-checkbox><span>${x(e.agreement?.replace("{EsriPrivacyStatement}",`<calcite-link href=${pe} target="_blank">${e.esriprivacystatement??"Esri Privacy Statement"}</calcite-link>`).replace("{Supplement}",`<calcite-link href=${ue} target="_blank">${e.supplement??"Supplement"}</calcite-link>`))}</span></calcite-label></div><calcite-button slot=footer width=full @click=${o} .disabled=${!t.termsAccepted||t.submitting} .loading=${t.submitting}>${e.submitfeedback??"Submit Feedback"}</calcite-button></calcite-panel></calcite-sheet>`}function W({assistantsEnabled:i,messages:e,slot:t,assistantHelpUrl:s,helpTopicUrl:o}){return c`<calcite-block .label=${e.assistantinformation??"Assistant information"} slot=${t??I} expanded class="info-block"><calcite-chip .label=${e.new??"new"} kind=brand>${e.new}</calcite-chip><h1 class="info-heading">${e.introducing}</h1><p>${e.capabilities}</p>${i?c`<p>${e.keepinmind??"Keep in mind the following:"}<ul><li>${e.beconsise??"Be concise, but also clear in your request"}</li><li>${e.avoidambiguity??"Avoid ambiguity and vagueness"}</li><li>${e.moredetails??"you do not need to use exact field names in your instructions, but more detail is generally better"}</li></ul>${x((e.seedocumentation??"Please see the {documentation} for more information, including limitations and additional resources.").replace("{documentation}",`<calcite-link href=${o} target="_blank">${e.documentation??"documentation"}</calcite-link>`))}</p>`:c`<p>${x(e.useofassistant?.replace("{aiassistants}",`<strong>${e.aiassistants??"Ai Assistants"}</strong>`))}<calcite-link .href=${s} target=_blank icon-end=launch-2>${e.opensettings??"Open Settings"}</calcite-link></p>`}</calcite-block>`}function he({messages:i,onProceed:e,onExit:t,helpTopicUrl:s}){return c`<calcite-dialog close-disabled placement=top .heading=${i.welcome} slot=dialogs open width-scale=m id=welcome-dialog><h3 class="unstyled-h3">${i.beforeyougetstarted}</h3><ul><li>${i.maybeincorrect}</li><li>${x(i.pleasereadhelp.replace("{helpTopic}",`<calcite-link href=${s} target="_blank">${i.helptopic}</calcite-link>`))}</li></ul><calcite-button id=welcome-proceed slot=footer-end @click=${e}>${i.proceed}</calcite-button><calcite-button id=welcome-decline slot=footer-start @click=${t} kind=neutral>${i.exit}</calcite-button></calcite-dialog>`}function ge({messages:i,suggestions:e,onSuggestionClick:t}){return c`<calcite-block .heading=${i.promptsuggestions} expanded collapsible id=suggestion-block><calcite-chip-group .label=${i.promptsuggestions} class="suggestion-chips">${G(e,s=>s,s=>c`<calcite-chip .label=${i.promptsuggestion} .value=${s} icon=effects @click=${()=>t?.(s)}>${s}</calcite-chip>`)}</calcite-chip-group></calcite-block>`}function fe({hidden:i=!1,expanded:e=!1,messages:t,cards:s,heading:o,collapsible:a=!1,showEffectsIcon:r=!1,editorInsertMode:n="add",setEditorInsertMode:l}){let d=n==="replace",b=d?t.replaceineditor??"Replace in editor":t.addtoeditor??"Add to editor",m=d?t.addtoeditor??"Add to editor":t.replaceineditor??"Replace in editor";return c`<calcite-block .hidden=${i} id=result-block .heading=${o??t.besteffort??"Here is the assistant's best effort"} .expanded=${e} .collapsible=${a}>${r&&c`<calcite-chip label slot=content-start icon=effects kind=brand></calcite-chip>`||""}<calcite-card-group .label=${t.assistantresponses}>${s.map((h,w)=>c`<calcite-card><div slot=heading><div class="prior-prompt">${h.priorPrompt}</div></div><div><div class="code-response-wrapper"><div class="positioned-code-content">${h.chips?.map((p,A)=>c`${p.tooltip&&c`<calcite-tooltip .referenceElement=${`response-chip-${p.conversationId}-${A}`}>${p.tooltip}</calcite-tooltip>`||""}<calcite-chip .label=${p.label} .scale=${p.scale??"s"} .appearance=${p.appearance??"outline"} .icon=${p.icon} .id=${`response-chip-${p.conversationId}-${A}`}>${p.label}</calcite-chip>`)}</div><code>${h.code}</code></div></div><div slot=footer-start><calcite-split-button primary-text=${b??I} appearance=outline-fill class="add-to-editor-button" @calciteSplitButtonPrimaryClick=${()=>h.onAddToEditor()} overlay-positioning=fixed><calcite-dropdown-item @calciteDropdownItemSelect=${()=>{l?.(d?"add":"replace")}}>${m}</calcite-dropdown-item></calcite-split-button><calcite-button round icon-start=copy-to-clipboard kind=neutral @click=${()=>h.onCopy(w)} class="copy-button">${h.copySuccessIndex===w?t.copied??"copied":""}</calcite-button></div><div slot=footer-end class="feedback-actions"><calcite-action .text=${t.thumbsup} scale=s icon=thumbs-up @click=${h.onThumbsUp}></calcite-action><calcite-action .text=${t.thumbsdown} scale=s icon=thumbs-down @click=${h.onThumbsDown}></calcite-action></div></calcite-card>`)}</calcite-card-group></calcite-block>`}var u={welcome:"Welcome to the new assistant experience",beforeyougetstarted:"Before you get started be aware:",maybeincorrect:"AI generated code may occasionally be incorrect or biased. Review carefully.",pleasereadhelp:"Read the Arcade Assistant (beta) {helpTopic} to get started and learn details on security, privacy and limitations.",proceed:"Proceed",exit:"Exit",promptsuggestions:"Prompt suggestions",promptsuggestion:"Prompt suggestion",assistantresponses:"Assistant responses",collapse:"Collapse",thumbsup:"Thumbs up",thumbsdown:"Thumbs down",refine:"Refine",startover:"Start over",helptopic:"help topic",agreement:"I agree to the {EsriPrivacyStatement} (and {Supplement}).",esriprivacystatement:"Esri Privacy Statement",supplement:"Supplement",disclaimerpt2:"AI-generated content may be inaccurate. Review before using.",replaceineditor:"Replace in editor",keepinmind:"Keep in mind the following:",beconsise:"Be concise, but also clear in your request",avoidambiguity:"Avoid ambiguity and vagueness",documentation:"documentation",useexamples:"Use examples to clarify your request",moredetails:"You do not need to use exact field names in your instructions, but more detail is generally better",seedocumentation:"Please see the {documentation} for more information, including limitations and additional resources.",assistantinformation:"Assistant information",profilecontextlabel:"Profile context: {profileName}",layercontextlabel:"Layer context: {layerName}",numlayers:"{numLayers} {layerOrLayers}",numlayersplural:"layers",numlayerssingular:"layer"},be="arcade_generation",ve="ArcadeCodeRequest",T="visualization",ye="ArcadeAssistant",ke=["your_comments","user_evaluation","question","answer","useragent","_source","version","context","extras"],K=[],X=!0,E=class extends V{constructor(){super(...arguments),this.textAreaRef=O(),this.messages=H(),this._feedbackService=void 0,this.handleFeedbackButton=(e,t)=>{this.feedback={...this.feedback,active:!0,value:e,item:t}},this.handleFeedbackSheetClose=()=>{this.feedback={active:!1,value:void 0,text:"",item:void 0,submitting:!1,termsAccepted:!1}},this.handleFeedbackSubmit=async()=>{this.feedback={...this.feedback,submitting:!0};let e=await this.ensureFeedbackService();if(!e){this.handleFeedbackSheetClose();return}let t=this.getModel(),s=t?await this.getProfileAndMetadata(t.uri):void 0,o={user_evaluation:this.feedback.value,your_comments:this.feedback.text||void 0,question:this.question,answer:this.feedback.item?.script??"",useragent:navigator.userAgent,_source:ye,version:this.appVersion??"",context:s?JSON.stringify(s):"",extras:s?.profileName??"",conversation_id:this.feedback.item?.conversationId??"",privacy_statement:this.feedback.termsAccepted?"I_agree":""};try{await e.applyEdits({addFeatures:[new te({attributes:o})]})}catch(a){console.error("Error submitting feedback:",a)}this.handleFeedbackSheetClose()},this.handleClose=e=>{this.closed=!0,this.closePanel?.(e)},this.setQuestion=e=>{this.question=e},this.onSuggestionClick=e=>{this.textAreaRef.value&&(this.textAreaRef.value.value=e,this.textAreaRef.value.setFocus(),this.setQuestion(e))},this.isViewingResult=!1,this.confirmationActive=!1,this.isSubmitting=!1,this.errorMessage=void 0,this.question="",this.history=[],this.feedback={active:!1,value:void 0,text:"",item:void 0,termsAccepted:!1,submitting:!1},this.copySuccessIndex=-1,this.splashActive=!0,this.editorInsertMode="add",this.helpBase="",this.assistantsEnabled=!1,this.closed=!1}static{this.properties={isViewingResult:16,confirmationActive:16,isSubmitting:16,errorMessage:16,question:16,history:16,feedback:16,copySuccessIndex:16,splashActive:16,editorInsertMode:16,closePanel:0,insertText:0,helpBase:1,assistantsEnabled:5,layer:[1,{type:Object}],orgBaseUrl:1,serviceUrl:1,closed:7,editorRef:0,feedbackServiceUrl:1,appVersion:1}}static{this.styles=ie}get disclaimerComment(){return`// ${this.messages.disclaimercomment}
|
|
5
|
-
// ${u.disclaimerpt2}`}get assistantHelpUrl(){return`${this.helpBase??"https://doc.arcgis.com/en/arcgis-online/"}administer/configure-assistants.htm`}get helpTopicUrl(){return`${this.helpBase??"https://doc.arcgis.com/en/arcgis-online/"}create-maps/arcade-assistant.htm`}async destroy(){}connectedCallback(){super.connectedCallback(),this.history=K,this.splashActive=X}disconnectedCallback(){super.disconnectedCallback(),K=this.history,X=this.splashActive,this.copySuccessTimer&&(clearTimeout(this.copySuccessTimer),this.copySuccessTimer=void 0)}setFeedbackState(e){this.feedback=e}async ensureFeedbackService(){if(this._feedbackService)return this._feedbackService;if(!this.feedbackServiceUrl)return;let e=new ee({url:this.feedbackServiceUrl});await e.load();let t=ke.filter(s=>!e.fields.some(o=>o.name===s));if(t.length>0){console.error(`Missing the following fields in feedback service: ${t.join(", ")}. Feedback will not be logged.`);return}return this._feedbackService=e,e}getModel(){return this.editorRef.editorInstance?.getModel()}async submitQuestion(){if(this.question){this.isSubmitting=!0;try{let e=await this.getToken(),t=this.getModel();if(!t)return;let{profileName:s,metadata:o,layerName:a}=await this.getProfileAndMetadata(t.uri),r=(await se({baseUrl:this.serviceUrl,skillId:be,message:this.question,authToken:e,context:{kind:ve,context:{profile_name:s,metadata:o}}})).find(n=>n.context?.kind==="ArcadeCodeResponse");if(!r)return;r.context?.kind==="ArcadeCodeResponse"&&(this.history.unshift({script:r?.context?.arcadeCode?.code,formattedScript:D(r?.context?.arcadeCode?.code??""),error:void 0,question:this.question,profile:s,conversationId:r.conversationId,layerName:a??void 0}),this.isViewingResult=!0,this.errorMessage=void 0)}catch(e){typeof e=="object"&&e&&"arcadeAssistantError"in e?this.errorMessage=e.arcadeAssistantError.message||this.messages.erroroccurred||"An error occurred.":e instanceof Error?this.errorMessage=this.messages.erroroccurred??"An error occurred.":this.errorMessage=this.messages.erroroccurred||"An error occurred.",console.error("Error in Arcade Assistant:",e)}finally{this.isSubmitting=!1}}}async getToken(){let{token:e}=await Z.getCredential(this.orgBaseUrl);return e}async getProfileAndMetadata(e){let t=T,s=j.getEditorProfileForModel(e);s?.loaded||await s?.loadSource();let o=this.editorRef.profile;o&&"id"in o&&(t=o.id);let a=s?.definition?.variables?.find(l=>l.type==="feature"),r=[],n;return a?.definition&&"fields"in a.definition&&(r=a.definition.fields.map(l=>({name:l.name,type:l.type,alias:l.alias})),Q(a?.definition)&&(n=a.definition.title)),{profileName:t,metadata:r,layerName:n}}render(){return this.closed?null:this.assistantsEnabled?c`<calcite-flow><calcite-flow-item .selected=${!this.isViewingResult} closable .heading=${this.messages.arcadeassistant??"Arcade assistant"} @calciteFlowItemClose=${this.handleClose}>${this.splashActive&&c`<calcite-scrim></calcite-scrim>`||""}${ce({messages:this.messages})}${re({popoverContent:W({assistantsEnabled:this.assistantsEnabled,messages:{...this.messages,...u},assistantHelpUrl:this.assistantHelpUrl,helpTopicUrl:this.helpTopicUrl})})}<calcite-shell class="unstyled-shell">${this.splashActive&&he({messages:{...u,...this.messages},onProceed:()=>{this.splashActive=!1},helpTopicUrl:this.helpTopicUrl,onExit:e=>this.closePanel&&this.closePanel(e)})||""}${le({active:this.confirmationActive,setActive:e=>this.confirmationActive=e,messages:this.messages})}${de({isDisabled:this.isSubmitting,isReadOnly:!1,setQuestion:this.setQuestion,setIsViewingResult:e=>this.isViewingResult=e,mode:this.isViewingResult?"refine":"prompt",textAreaRef:this.textAreaRef,question:this.question,errorMessage:this.errorMessage,setErrorMessage:e=>this.errorMessage=e,submitQuestion:this.submitQuestion.bind(this),messages:{...u,...this.messages}})}<calcite-block-group label="interactive blocks">${!this.isViewingResult&&!this.isSubmitting&&ge({messages:{...this.messages,...u},suggestions:["Round value to one decimal place",'Return "Yes" if value > 10'],onSuggestionClick:this.onSuggestionClick})||""}<calcite-block .hidden=${!this.isSubmitting} .heading=${this.messages.generatingresponse??"Generating response..."}></calcite-block>${fe({expanded:this.isViewingResult||this.history.length>0,messages:{...this.messages,...u},collapsible:!0,showEffectsIcon:this.isViewingResult,editorInsertMode:this.editorInsertMode,setEditorInsertMode:e=>this.editorInsertMode=e,cards:this.history.reduce((e,t,s)=>(!t.script||this.isViewingResult&&s>0||(e.push({priorPrompt:t.question,code:t.formattedScript||t.error||"",chips:[{label:t.profile??T,icon:"map-information",appearance:"outline",scale:"s",conversationId:t.conversationId??"",tooltip:u.profilecontextlabel.replace("{profileName}",t.profile??T)},...t.layerName?[{label:u.numlayers.replace("{numLayers}","1").replace("{layerOrLayers}",u.numlayerssingular),icon:"layer",appearance:"outline",scale:"s",conversationId:t.conversationId??"",tooltip:u.layercontextlabel.replace("{layerName}",t.layerName??"No layer")}]:[]],onAddToEditor:()=>{L(this.editorRef.editorInstance,t.formattedScript??"",this.editorInsertMode,this.disclaimerComment)},onCopy:o=>{let a=t.formattedScript?`${this.disclaimerComment}
|
|
6
|
-
${t.formattedScript}`:"";a&&navigator.clipboard.writeText(a).then(()=>{this.copySuccessIndex=o,this.copySuccessTimer&&clearTimeout(this.copySuccessTimer),this.copySuccessTimer=window.setTimeout(()=>{this.copySuccessIndex=-1,this.copySuccessTimer=void 0},1500)})},onThumbsUp:()=>this.handleFeedbackButton("good",t),onThumbsDown:()=>this.handleFeedbackButton("bad",t),copySuccessIndex:this.copySuccessIndex}),this.isViewingResult),e),[]),heading:this.isViewingResult?this.messages.besteffort??"Here's the assistant's best effort":this.messages.recentprompts??"Recent prompts",hidden:this.isViewingResult?!this.isViewingResult:!1})}</calcite-block-group>${this.feedback.active?me({setOpen:this.handleFeedbackSheetClose,messages:{...this.messages,...u},onSubmit:this.handleFeedbackSubmit,feedback:this.feedback,setFeedback:this.setFeedbackState.bind(this)}):null}</calcite-shell></calcite-flow-item></calcite-flow>`:c`<calcite-flow><calcite-flow-item .selected=${!this.isViewingResult} closable .heading=${this.messages.arcadeassistant??"Arcade assistant"} @calciteFlowItemClose=${this.handleClose}>${W({slot:"content-top",messages:{...this.messages,...u},assistantsEnabled:this.assistantsEnabled,assistantHelpUrl:this.assistantHelpUrl,helpTopicUrl:this.helpTopicUrl})}</calcite-flow-item></calcite-flow>`}};B("arcgis-arcade-coding-assistant",E);return E},"identity/IdentityManager","request","layers/FeatureLayer","Graphic",a,b)
|