@arcgis/coding-components 5.1.0-next.96 → 5.1.0-next.98
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/{YTQ4K7PQ.js → BWQEBSSL.js} +2 -2
- package/dist/cdn/PPV6RAZ3.js +2 -0
- package/dist/cdn/assets/arcade-debugger-console/t9n/messages.en.json +1 -1
- package/dist/cdn/assets/code-editor/sql-expr.worker.js +2 -2
- package/dist/cdn/index.js +1 -1
- package/dist/components/arcgis-arcade-coding-assistant/customElement.js +21 -20
- package/dist/components/arcgis-arcade-debugger-console/customElement.js +85 -69
- package/dist/docs/api.json +1 -1
- package/dist/docs/docs.json +1 -1
- package/dist/docs/vscode.html-custom-data.json +1 -1
- package/dist/docs/web-types.json +1 -1
- package/package.json +5 -5
- package/dist/cdn/XN56YGFQ.js +0 -2
|
@@ -1,4 +1,4 @@
|
|
|
1
1
|
/* COPYRIGHT Esri - https://js.arcgis.com/5.1/LICENSE.txt */
|
|
2
|
-
import{a as F}from"./64X4ILDM.js";import c from"./GPIFJKPY.js";import b from"./GZ6HZKQZ.js";import a from"./ZHZFKZA7.js";import{c as ie,d as se}from"./P7I5ATMN.js";import"./G56LJGLK.js";import"./ER2MKLVA.js";import"./MP6Z45SA.js";import{d as oe}from"./IFNCCZ7O.js";import{a as te}from"./SB3MM5EM.js";import"./KCU2C44H.js";import"./GS2ISVXJ.js";import"./6G5URSC7.js";import"./6C52UOYL.js";import{E as W,F as K,G as X,H as Z,I,K as ee,h as Q,j as l,k as j,l as R,t as H,w as G,x as J,y as Y}from"./REL6OK2I.js";import{a as w}from"./Y3KOWWO5.js";import"./B3UMUBOI.js";import"./CF3TERM3.js";import"./Z5ZZ36DQ.js";import"./LLPQEURF.js";import"./3TTFCHAA.js";export default $arcgis.t(([xe,ne,Se,re,ce,{getDeclaredVoxelMembers:Te,getDeclaredPixelMembers:Ae},Ce,{property:g,subclass:Ie},{G:q,w:ae,x:V},,N])=>{var A=class extends Y{constructor(e){if(super(e),this.it=R,e.type!==G.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===j)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:[]}}};A.directiveName="unsafeHTML",A.resultType=1;var C=J(A);var Me=Q`:host(:not([closed])){container-type:size;--calcite-block-border-color: var(--calcite-color-transparent);box-sizing:border-box;.submission-actions-wrapper{display:flex;flex-direction:column;width:100%;gap:.75rem}.submission-actions{display:flex;flex-direction:row;gap:.5rem;justify-content:space-between}@container (max-width: 380px){.hidden-below-380{display:none}}@container (min-width: 380px){.hidden-above-380{display:none}}.gaps{display:flex;gap:.25rem}.align-inline-end{margin-inline-start:auto}.context-popover p{padding:0 .5rem;font-size:var(--calcite-font-size-sm)}.feedback-content{padding:var(--calcite-spacing-sm);display:flex;flex-direction:column;max-height:75cqb;overflow-y:auto;>*{margin-block-end:.5rem}>*:last-child,.terms-label{margin-block-end:0}calcite-text-area{--calcite-text-area-min-height: 4rem}calcite-notice{margin-block-start:0}}.feedback-sheet{--calcite-sheet-height: auto;--calcite-sheet-max-height: 100%;--calcite-sheet-min-height: auto}.feedback-footer{display:flex;justify-content:flex-end;gap:.5rem;width:100%}calcite-chip[slot=header-actions-end]{align-self:center;margin-inline-end:.5rem}calcite-flow-item calcite-shell{background:transparent}calcite-block{width:100%;max-width:100%;align-self:flex-end;background-color:transparent;margin-block:0}calcite-sheet{--calcite-sheet-scrim-background: rgba(200, 200, 200, .5)}calcite-list-item calcite-button{margin-inline-end:.25rem}calcite-flow-item calcite-shell calcite-notice{margin-block:1rem}calcite-block[open]:last-of-type{border-block-end:0}.text-area-wrapper{display:flex;border-radius:var(--calcite-corner-radius-round);margin:.75rem;overflow:hidden;--calcite-color-border-input: transparent;position:sticky;box-shadow:var(--calcite-shadow-sm);flex:none;flex-direction:column}calcite-text-area{height:auto;overflow:hidden;--calcite-font-weight-normal: 500;font-weight:500;line-height:1.2}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}.contained-popover-or-tooltip{--calcite-popover-max-size-x: 100%;--calcite-tooltip-max-size-x: 100%}.info-heading{font-size:var(--calcite-font-size-0);color:var(--calcite-color-text-1);margin:0}.info-heading-row{display:flex;align-items:center;gap:var(--calcite-spacing-sm);flex-wrap:wrap}.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-button{font-weight:var(--calcite-font-weight-medium)}.suggestions{display:flex;flex-direction:row;gap:var(--calcite-spacing-xs);flex-wrap:wrap}.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-border-color: transparent;width:100%}.positioned-code-content{display:flex;flex-direction:row;gap:.5rem;padding:.5rem}calcite-card [slot=heading] 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{display:flex;flex-direction:row;padding:0;overflow-y:hidden;overflow-x:auto;margin:.25rem 0 .75rem;align-items:center;max-width:100%;span{overflow-x:auto;overflow-y:hidden}}.copy-feedback{display:none}.copy-prompt-button{align-self:flex-start;margin-inline-start:auto}.response-secondary-action-button[data-copied]+.copy-feedback,.copy-prompt-button[data-copied]+.copy-feedback{display:block;span{padding:.75rem 1rem;font-size:var(--calcite-font-size--2);line-height:1.375;color:var(--calcite-color-text--2);font-weight:var(--calcite-font-weight-medium)}}.copy-prompt-button[data-copied]~.copy-tooltip,.response-secondary-action-button[data-copied]~.copy-tooltip{display:none}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}.response-secondary-action-button{margin-left:.5rem}.add-to-editor-button{--calcite-internal-button-border-color: unset}}.collapsible-code{padding:.5rem}.collapsible-code summary{cursor:pointer;font-weight:500;color:var(--calcite-color-brand);outline:none;padding:.25rem 0}.collapsible-code[open] summary{color:var(--calcite-color-text-2)}.response-error-container{padding:.5rem;background:color-mix(in srgb,var(--calcite-color-status-warning) 10%,transparent);border-radius:var(--calcite-corner-radius-round);margin:1rem 0;font-size:var(--calcite-font-size--2);--calcite-input-message-icon-color: var(--calcite-color-status-warning)}.response-error-chip{--calcite-internal-chip-background-color: var(--calcite-color-status-warning);--calcite-chip-icon-color: var(--calcite-color-foreground-1);--calcite-chip-border-color: var(--calcite-color-transparent)}.feedback-actions{gap:unset}.contained{max-width:100%;max-height:100%;max-width:100cqi;max-height:75cqb;overflow-y:auto}.submission-notice{--calcite-notice-border-color: transparent;margin-block:0;width:100%;--calcite-font-size-relative-base: var(--calcite-font-size--2)}.border-block-end{border-block-end:1px solid var(--calcite-color-border-3)}.round-top{border-radius:var(--calcite-corner-radius-round) var(--calcite-corner-radius-round) 0 0}}:host([closed]){display:none}`,$=class extends Error{constructor({message:e,code:t,subCode:i,details:o,source:n}){super(e),this.name="ArcadeAssistantError",this.code=t,this.subCode=i,this.details=o,this.source=n}};function le(a){if(!a)return;let e=a.indexOf('{"error":');if(e!==-1)try{let t=a.slice(e),i=JSON.parse(t);if(i&&typeof i=="object"&&i.error)return i.error}catch{return}}async function Ee(a){let{baseUrl:e,skillId:t,message:i,authToken:o,previousConversationId:n,context:c}=a,p=t?`${e}/skills/${t}/chat`:`${e}/chat`,r=[],s={message:i,context:c};n&&(s.conversation_id=n);let u;try{u=await ne(p,{method:"post",headers:{"Content-Type":"application/json",token:o},body:JSON.stringify(s),responseType:"json"})}catch(b){let f=b,x=f.details?.rawResponse||f.message||String(b),S=le(x);throw S?new $(S):b}let d=u.data;r.push(d);let v=d.conversationId,z=d.inquiryId,k=d.sequenceNumber;async function M(){let b=0,f=100;for(;b<f;){await new Promise(T=>setTimeout(T,1e3));let x=Re(v,k,z),S;try{S=await ne(p,{method:"post",headers:{"Content-Type":"application/json",token:o},body:JSON.stringify(x),responseType:"json"})}catch(T){let L=T,ke=L.details?.rawResponse||L.message||String(T),B=le(ke);throw B?new $(B):T}let y=S.data;if(y.context?.kind==="ArcgisErrorAsContext"&&y.context.error)throw new $({message:y.context.error.message||"ArcGIS Assistant error",code:y.context.error.code,subCode:y.context.error.subCode,details:y.context.error.details,source:"polling-response"});if(r.push(y),k=y.sequenceNumber,b++,!y.hasMore)break}if(b===f)throw new $({message:"Request timed out",code:"TIMEOUT",source:"polling"})}let E=120*1e3;return await Promise.race([M(),new Promise((b,f)=>setTimeout(()=>f(new $({message:"Request timed out",code:"TIMEOUT",source:"hard-timeout"})),E))]),r}function Re(a,e,t){return{conversationId:a,inquiryId:t,ackSequenceNumber:e}}function Ve(a){return a.message.match(/Error in prompt shield/u)?"I'm having trouble with this request. Try again by rephrasing the question.":a.code==="TIMEOUT"?"Request timed out. Try again by re-asking the same question or rephrasing it.":a.message}var qe=({notices:a})=>a.length?l`<div class="border-block-end">${F(a,e=>e.id??e.title,e=>l`<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&&l`<div slot=message>${e.message}</div>`||""}${e.actionLinkMessage&&e.onAction&&l`<calcite-link slot=link @click=${()=>e.onAction?.()}>${e.actionLinkMessage}</calcite-link>`||""}</calcite-notice>`)}</div>`:null,Ne=a=>{let e=a.value.length,t=72,i=180,o=a.offsetWidth,n=Math.max(1,Math.floor(o/8)),c=Math.ceil(e/n),p=t+(c-2)*24;a.style.setProperty("--calcite-text-area-min-height",`${Math.min(p,i)}px`)},Fe=({promptValidationMessage:a,errorMessage:e,contextTooBig:t,contextReducedNoticeDismissed:i,setContextReducedNoticeDismissed:o,setErrorMessage:n,messages:c})=>{let p=[];if(a&&p.push({id:"prompt-validation",kind:"danger",icon:"exclamation-mark-triangle",title:a,closable:!0}),e&&p.push({id:"assistant-error",kind:"danger",icon:"exclamation-mark-triangle",title:e,closable:!0,onClose:()=>n(void 0)}),t&&!i){let 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.";p.push({id:"context-reduced",kind:"warning",icon:"exclamation-mark-triangle",title:r,message:s,closable:!0,onClose:()=>o(!0)})}return p};function Pe({messages:a}){return l`<calcite-chip slot=header-actions-end scale=s appearance=outline-fill .label=${a.beta??"Beta"}>${a.beta??"Beta"}</calcite-chip>`}function De({popoverContent:a,messages:e}){return l`<calcite-action icon=information slot=header-actions-end id=legal-disclaimer text></calcite-action><calcite-popover reference-element=legal-disclaimer .label=${e.legaldisclaimer??"Legal disclaimer"} placement=bottom auto-close focus-trap-disabled><div class="contained">${a}</div></calcite-popover>`}function _e({errorMessage:a,slot:e}){return l`<div class="error-display"><calcite-input-message id=error-message status=invalid icon=exclamation-mark-triangle scale=m slot=${e??I}>${a}</calcite-input-message></div>`}function Ue({active:a,setActive:e,messages:t}){return l`<calcite-alert slot=alerts .open=${a} 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 Oe({context:a,messages:e}){return a?l`<div class="gaps">${a.profileId&&l`<calcite-popover auto-close placement=top .label=${(e.profilecontextlabel??"Profile context: {profileId}").replace("{profileId}",a.profileId)} reference-element=profile-context-button class="context-popover contained-popover-or-tooltip"><p>${(e.profilecontextlabel??"Profile context: {profileId}").replace("{profileId}",a.profileId)}</p></calcite-popover><calcite-button round kind=neutral icon-start=map-information id=profile-context-button scale=s></calcite-button>`||""}</div>`:null}function ze({isDisabled:a,isReadOnly:e,setQuestion:t,setIsViewingResult:i,textAreaRef:o,question:n,errorMessage:c,setErrorMessage:p,promptValidationMessage:r,setPromptValidationMessage:s,submitQuestion:u,messages:d,mode:v,assistantRef:z,context:k,contextReducedNoticeDismissed:M,setContextReducedNoticeDismissed:E}){let b=k?.contextTooLarge??!1,f=Fe({promptValidationMessage:r,errorMessage:c,contextTooBig:b,contextReducedNoticeDismissed:M,setContextReducedNoticeDismissed:E,setErrorMessage:p,messages:d});return l`<div class="text-area-wrapper">${qe({notices:f})}<calcite-text-area scale=s resize=vertical .readOnly=${a||e} class=${Z(f.length?"submission-text-area":"submission-text-area round-top")} .placeholder=${d.askaquestion??`Specify the calculation or logic you need in an Arcade expression. (e.g., 'Return "Yes" if value > 10')`} .value=${n} @calciteTextAreaInput=${x=>{Ne(x.target),t(x.target.value)}} ${K(o)}><div class="submission-actions-wrapper" slot=footer-start><div class="submission-actions">${k&&Oe({context:k,messages:d})||""}<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=${a} @click=${async()=>{i(!1),t("")}} .label=${d.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">${d.startover??"Start Over"}</calcite-tooltip><calcite-button round kind=neutral .hidden=${v!=="refine"} icon-start=arrow-left icon-flip-rtl=both appearance=solid .disabled=${a} @click=${async()=>{i(!1),t("")}} class="hidden-below-380" scale=s>${d.startover??"Start Over"}</calcite-button><calcite-button round scale=s icon-end=effects appearance=solid .loading=${a} .disabled=${a} @click=${async()=>{if(p(""),!n){s(d.enteraprompt??"Please enter a prompt");return}s(void 0),await u()}} class="hidden-below-380">${v==="prompt"?d.ask??"Generate":d.refine??"Refine"}</calcite-button><calcite-button round scale=s icon-end=effects appearance=solid .loading=${a} .disabled=${a} id=small-submit-button @click=${async()=>{if(p(""),!n){s(d.enteraprompt??"Please enter a prompt");return}s(void 0),await u()}} class="hidden-above-380" .label=${v==="prompt"?d.ask??"Generate":d.refine??"Refine"}></calcite-button><calcite-tooltip reference-element=small-submit-button placement=top-start class="hidden-above-380">${v==="prompt"?d.ask??"Generate":d.refine??"Refine"}</calcite-tooltip></div></div></div></calcite-text-area></div>`}var Le="https://www.esri.com/en-us/privacy/privacy-statements/privacy-supplement",Be="https://www.esri.com/en-us/privacy/privacy-statements";function Qe({setOpen:a,messages:e,feedback:t,learnMoreUrl:i,setFeedback:o,onSubmit:n}){return t.active?l`<calcite-sheet class="feedback-sheet" .label=${e.feedback??"Feedback"} slot=sheets display-mode=float position=block-end .open=${t.active} @calciteSheetClose=${()=>a(!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=>o({...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=>{o({...t,termsAccepted:c.target.checked})}} .disabled=${t.submitting}></calcite-checkbox><span>${C((e.agreement??"I agree to the {EsriPrivacyStatement} (and {Supplement}).").replace("{EsriPrivacyStatement}",`<calcite-link href=${Be} target="_blank">${e.esriprivacystatement??"Esri Privacy Statement"}</calcite-link>`).replace("{Supplement}",`<calcite-link href=${Le} target="_blank">${e.supplement??"Supplement"}</calcite-link>`))}</span></calcite-label><calcite-notice scale=s open closable><span slot=message>${C((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=${i} 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=${()=>a(!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}function de({assistantsEnabled:a,messages:e,slot:t,helpTopicUrl:i}){return l`<calcite-block .label=${e.assistantinformation??"Assistant information"} slot=${t??I} expanded class="info-block" scale=s><div class="info-heading-row"><h1 class="info-heading">${e.introducing??"Introducing Arcade Assistant (beta)"}</h1><calcite-chip .label=${e.new??"New"} kind=brand scale=s>${e.new??"New"}</calcite-chip></div>${a?l`<p>${e.capabilities??"The assistant uses artificial intelligence to generate Arcade expressions."}</p><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>${C((e.seedocumentation??"Please see the {documentation} for more information, including limitations and additional resources.").replace("{documentation}",`<calcite-link href=${i} target="_blank">${e.documentation??"documentation"}</calcite-link>`))}</p>`:l`<p>${e.useofassistant??"The assistant uses artificial intelligence to generate Arcade expressions. To enable Arcade Assistant (beta), the following must be true:"}</p><ul><li>${e.enabledinorg??"AI assistants are enabled in the organization settings"}</li><li>${e.enabledbetaapps??"Beta apps and capabilities are not blocked"}</li><li>${e.enabledroleprivilege??"Your role privilege allows you to use AI assistants"}</li></ul>`}</calcite-block>`}function je({messages:a,onProceed:e,onExit:t,helpTopicUrl:i}){return l`<calcite-dialog close-disabled placement=top .heading=${a.welcome??"Welcome to the new assistant experience"} slot=dialogs open width-scale=m id=welcome-dialog><h3 class="unstyled-h3">${a.beforeyougetstarted??"Before you get started be aware:"}</h3><ul><li>${a.maybeincorrect??"AI generated code may occasionally be incorrect or biased. Review carefully."}</li><li>${C((a.pleasereadhelp??"Read the Arcade Assistant (beta) {helpTopic} to get started and learn details on security, privacy and limitations.").replace("{helpTopic}",`<calcite-link href=${i} target="_blank">${a.helptopic??"help topic"}</calcite-link>`))}</li></ul><calcite-button id=welcome-proceed slot=footer-end @click=${e}>${a.proceed??"Proceed"}</calcite-button><calcite-button id=welcome-decline slot=footer-start @click=${t} kind=neutral>${a.exit??"Exit"}</calcite-button></calcite-dialog>`}function He({messages:a,suggestions:e,onSuggestionClick:t}){return l`<calcite-block .heading=${a.promptsuggestions} expanded collapsible id=suggestion-block scale=s><div class="suggestions">${e.map(i=>l`<calcite-button round scale=s appearance=outline-fill kind=neutral .label=${a.promptsuggestion} class="suggestion-button" @click=${()=>t?.(i)}>${i}</calcite-button>`)}</div></calcite-block>`}var pe=200;function ue({hidden:a=!1,expanded:e=!1,messages:t,cards:i,heading:o,collapsible:n=!1,showEffectsIcon:c=!1,onCopyCode:p,standalone:r}){return l`<calcite-block .hidden=${a} id=result-block .heading=${o??t.besteffort??"Here is the assistant's best effort"} .expanded=${e} .collapsible=${n}>${c&&l`<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"}>${F(i,s=>s.conversationId,s=>l`<calcite-card><div slot=heading><div class="prior-prompt"><span>${s.priorPrompt.length>pe?`${s.priorPrompt.slice(0,pe)}...`: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=>{let d=u.currentTarget;navigator.clipboard.writeText(s.priorPrompt).then(()=>{d.setAttribute("data-copied","true"),setTimeout(()=>d.removeAttribute("data-copied"),1500)})}}></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&&l`<div class="response-error-container">${_e({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&&l`<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>`||""}${Ge({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=>{let d=u.currentTarget;p(s.code).then(()=>{d.setAttribute("data-copied","true"),setTimeout(()=>d.removeAttribute("data-copied"),1500)})}} 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>`}var Ge=({card:a,messages:e})=>{let t=H(),i=`response-chip-profile-${a.conversationId}-${t}`,o=(e.profilecontextlabel??"Profile context: {profileId}").replace("{profileId}",a.profileId);return l`<calcite-tooltip .referenceElement=${i} placement=top-start class="contained-popover-or-tooltip">${o}</calcite-tooltip><calcite-chip .label=${a.profileId} scale=s appearance=outline icon=map-information id=${i??I}>${a.profileId}</calcite-chip>`},me=a=>a.type==="featureSet";function we(a){return a&&a!=="dataCatalogDatastore"?a:void 0}var P=a=>{if(!ae(a))return[];let e=[];return a.relationships?.forEach(t=>{e.push(t.toJSON())}),e},D=a=>a.length>0?{relationships:a}:{},Je=a=>oe(a).map(e=>({alias:e.alias,name:e.name,type:e.type,...e.domain?{domain:e.domain}:{}})),_=a=>a?{fields:Je(a)}:{fields:[]};async function he(a){let e=await a.loadSource(),t=V(e)&&e.isTable,i=P(e);return{name:a.name,type:"featureSet",isTable:t,..._(e?.fields),...D(i)}}async function $e(a){switch(a.type){case"feature":{let t=await a.loadSource(),i=P(t);return{name:a.name,type:a.type,..._(t?.fields),...D(i)}}case"featureSet":{let t=await a.loadSource(),i=V(t)&&t.isTable;return{name:a.name,type:"featureSet",...i?{isTable:i}:{},..._(t?.fields),...D(P(t))}}case"featureSetCollection":{let t=await a.loadSource(),i=t?.layers.filter(me)??[],o=t?.tables.filter(me)??[],n=await Promise.all(i.map(he)),c=await Promise.all(o.map(he));return{name:a.name,type:"featureSetCollection",layers:n,tables:c}}case"dictionary":{let t=await Promise.all(a.dictionaryVariables.filter(q).map($e));return{name:a.name,type:"dictionary",attributes:t}}case"pixel":{let t=await a.loadSource();if(!t)return{name:a.name,type:"pixel"};let i=await Ae(t);return{name:a.name,type:"pixel",members:i.map(ge)}}case"voxel":{let t=await a.loadSource();if(!t)return{name:a.name,type:"voxel"};let i=await Te(t);return{name:a.name,type:"voxel",members:i.map(ge)}}case"array":let e=we(a.elementType.type);return{name:a.name,type:"array",...e?{elementType:e}:{}};case"number":case"text":case"boolean":case"date":case"knowledgeGraph":case"dateOnly":case"geometry":case"time":return{name:a.name,type:a.type}}}function ge(a){if(a.type==="array"){let e=we(a.elementType.type);return{name:a.name,type:"array",...e?{elementType:e}:{}}}return{name:a.name,type:a.type}}async function Ye(a){return{variables:await Promise.all(a.variables.filter(q).map($e))}}var We=1e5;function Ke(a){let e=new TextEncoder().encode(a).length;return Math.ceil(e/3.5)}function U(a){return Ke(JSON.stringify(a))}function Xe(a){let e=i=>({name:i.name,type:i.type,...i.isTable?{isTable:i.isTable}:{},...i.relationships?{relationships:i.relationships}:{}}),t=i=>{switch(i.type){case"feature":case"featureSet":case"knowledgeGraph":return{name:i.name,type:i.type,..."isTable"in i&&i.isTable?{isTable:i.isTable}:{},..."relationships"in i?{relationships:i.relationships}:{}};case"featureSetCollection":return{name:i.name,type:"featureSetCollection",layers:i.layers.map(e),tables:i.tables.map(e)};case"dictionary":return{name:i.name,type:"dictionary",attributes:i.attributes.map(t)};case"pixel":case"voxel":return{name:i.name,type:i.type};case"array":return{name:i.name,type:"array",...i.elementType?{elementType:i.elementType}:{}};default:return i}};return{variables:a.variables.map(t)}}function Ze(a){let e=a.variables,t=e.length,i=e.find(n=>n.name==="$feature")??e.find(n=>n.type==="feature")??e[0],o=i?[i]:[];return{context:{variables:o},wasReduced:t!==o.length,reducedToVariableName:i?.name}}function et(a){return U(a)>We}var tt=Object.defineProperty,at=Object.getOwnPropertyDescriptor,h=(a,e,t,i)=>{for(var o=i>1?void 0:i?at(e,t):e,n=a.length-1,c;n>=0;n--)(c=a[n])&&(o=(i?c(e,t,o):c(o))||o);return i&&o&&tt(e,t,o),o},m=class extends Ce{constructor(a){super(a),this.viewMode="prompt",this.confirmationActive=!1,this.contextReducedNoticeDismissed=!1,this.splashActive=!0,this.isSubmitting=!1,this.question="",this.history=[],this.feedback={active:!1}}};h([g()],m.prototype,"viewMode",2);h([g()],m.prototype,"confirmationActive",2);h([g()],m.prototype,"contextReducedNoticeDismissed",2);h([g()],m.prototype,"splashActive",2);h([g()],m.prototype,"isSubmitting",2);h([g()],m.prototype,"errorMessage",2);h([g()],m.prototype,"promptValidationMessage",2);h([g()],m.prototype,"question",2);h([g()],m.prototype,"history",2);h([g()],m.prototype,"feedback",2);h([g()],m.prototype,"context",2);m=h([Ie("ArcadeAssistantViewState")],m);var it="arcade_generation",st="ArcadeCodeRequest",be="visualization",fe="ArcadeAssistant",ot=["your_comments","user_evaluation","question","answer","useragent","_source","version","context","extras","conversation_id","privacy_statement"],ve=[],ye=!0,O=class extends X{constructor(){super(...arguments),this.textAreaRef=W(),this.messages=te(),this._feedbackService=void 0,this.viewState=new m,this.handleFeedbackButton=(e,t)=>{this.updateViewState({feedback:{active:!0,value:e,item:t,termsAccepted:!1,text:"",submitting:!1}})},this.handleFeedbackSheetClose=()=>{this.updateViewState({feedback:{active:!1}})},this.handleFeedbackSubmit=async()=>{if(!this.viewState.feedback.active)return;this.updateViewState({feedback:{...this.viewState.feedback,submitting:!0}});let e=await this.ensureFeedbackService();if(!e){this.handleFeedbackSheetClose();return}let t=!1,i;this.viewState.feedback.item.conversationId===this.viewState.history[0]?.conversationId&&this.viewState.viewMode==="result"?(i=this.viewState.context,t=!0):i=this.viewState.feedback.item.contextSnapshot;let o=re.applicationName;!o&&!this.appVersion&&w("warn",this,"esriConfig.applicationName is not set. Consider setting it to help identify the application version in feedback.");let{value:n,text:c,termsAccepted:p,item:{question:r,formattedScript:s,conversationId:u}}=this.viewState.feedback,d={user_evaluation:n,your_comments:c||void 0,question:r??"",answer:this.encodeAnswerForFeedback(s),useragent:navigator.userAgent,_source:fe,version:this.appVersion||o||"NOT_SET",context:i?JSON.stringify({...i,isSnapshot:!t}):"",extras:i?.profileId??"",conversation_id:u??"",privacy_statement:p?"I_agree":""};try{await e.applyEdits({addFeatures:[new ce({attributes:d})]})}catch(v){w("error",this,"Error submitting feedback.",{detail:{error:v}})}this.handleFeedbackSheetClose()},this.handleClose=e=>{this.closed=!0,this.closePanel?.(e)},this.setQuestionState=e=>{this.updateViewState({question:e,promptValidationMessage:void 0})},this.setFeedbackState=e=>{this.updateViewState({feedback:e})},this.onSuggestionClick=e=>{this.textAreaRef.value&&(this.textAreaRef.value.value=e,this.textAreaRef.value.setFocus(),this.setQuestionState(e))},this.helpBase="",this.assistantsEnabled=!1,this.closed=!1,this.disableQuestionAnswerLogging=!1}static{this.properties={closePanel:0,insertText:0,helpBase:1,assistantsEnabled:5,portalUrl:1,serviceUrl:1,closed:7,editorRef:0,feedbackServiceUrl:1,appVersion:1,disableQuestionAnswerLogging:5}}static{this.styles=Me}get disclaimerComment(){return`// ${this.messages.disclaimercomment}
|
|
3
|
-
// ${this.messages.disclaimerpt2??"AI-generated content may be inaccurate. Review before using."}`}get assistantOverviewDocUrl(){return`${this.helpBase??"https://doc.arcgis.com/en/arcgis-online/"}create-maps/understand-arcade-assistant.htm`}get usingTheAssitantDocUrl(){return`${this.helpBase??"https://doc.arcgis.com/en/arcgis-online/"}create-maps/understand-arcade-assistant.htm`}async destroy(){}connectedCallback(){super.connectedCallback(),this.updateViewState({history:ve,splashActive:ye})}load(){let e=async()=>{let t=this.getModel();if(!t){this.updateViewState({context:void 0});return}let i=await this.getProfileAndMetadata(t.uri);this.updateViewState({context:i,contextReducedNoticeDismissed:i.contextTooLarge?!1:this.viewState.contextReducedNoticeDismissed})};e().catch(t=>{w("error",this,"Error setting initial context.",{detail:{error:t}})}),this.manager.onLifecycle(()=>{let t=N.onModelContextDidChange(async()=>{e().catch(i=>{w("error",this,"Error setting context.",{detail:{error:i}})})});return{remove:()=>{t.dispose()}}})}disconnectedCallback(){super.disconnectedCallback(),ve=this.viewState.history,ye=this.viewState.splashActive,this.copySuccessTimer&&(clearTimeout(this.copySuccessTimer),this.copySuccessTimer=void 0)}createFeedbackContextSnapshot(e){let t=Xe(e.metadata);return{...e,metadata:t,estimatedTokens:U(t)}}encodeAnswerForFeedback(e){return encodeURIComponent(e??"")}updateViewState(e){this.viewState.set(e)}getHistoryCards(){return this.viewState.history.reduce((e,t)=>(!t.script||(e.push({priorPrompt:t.question,code:t.formattedScript||t.error||"",profileId:t.profile??be,onAddToEditor:i=>{ie(this.editorRef.editorInstance,t.formattedScript??"",i,this.disclaimerComment)},onThumbsUp:()=>this.handleFeedbackButton("good",t),onThumbsDown:()=>this.handleFeedbackButton("bad",t),conversationId:t.conversationId??"",message:t.message}),this.viewState.viewMode),e),[])}async ensureFeedbackService(){if(this._feedbackService)return this._feedbackService;if(!this.feedbackServiceUrl)return;let e=new Se({url:this.feedbackServiceUrl});await e.load();let t=ot.filter(i=>!e.fields.some(
|
|
2
|
+
import{a as F}from"./64X4ILDM.js";import c from"./GPIFJKPY.js";import b from"./GZ6HZKQZ.js";import a from"./ZHZFKZA7.js";import{c as ie,d as se}from"./P7I5ATMN.js";import"./G56LJGLK.js";import"./ER2MKLVA.js";import"./MP6Z45SA.js";import{d as oe}from"./IFNCCZ7O.js";import{a as te}from"./SB3MM5EM.js";import"./KCU2C44H.js";import"./GS2ISVXJ.js";import"./6G5URSC7.js";import"./6C52UOYL.js";import{E as W,F as K,G as X,H as Z,I,K as ee,h as Q,j as l,k as j,l as R,t as H,w as G,x as J,y as Y}from"./REL6OK2I.js";import{a as w}from"./Y3KOWWO5.js";import"./B3UMUBOI.js";import"./CF3TERM3.js";import"./Z5ZZ36DQ.js";import"./LLPQEURF.js";import"./3TTFCHAA.js";export default $arcgis.t(([xe,ne,Se,re,ce,{getDeclaredVoxelMembers:Te,getDeclaredPixelMembers:Ae},Ce,{property:g,subclass:Ie},{G:q,w:ae,x:V},,N])=>{var A=class extends Y{constructor(e){if(super(e),this.it=R,e.type!==G.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===j)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:[]}}};A.directiveName="unsafeHTML",A.resultType=1;var C=J(A);var Me=Q`:host(:not([closed])){container-type:size;--calcite-block-border-color: var(--calcite-color-transparent);box-sizing:border-box;.submission-actions-wrapper{display:flex;flex-direction:column;width:100%;gap:.75rem}.submission-actions{display:flex;flex-direction:row;gap:.5rem;justify-content:space-between}@container (max-width: 380px){.hidden-below-380{display:none}}@container (min-width: 380px){.hidden-above-380{display:none}}.gaps{display:flex;gap:.25rem}.align-inline-end{margin-inline-start:auto}.context-popover p{padding:0 .5rem;font-size:var(--calcite-font-size-sm)}.feedback-content{padding:var(--calcite-spacing-sm);display:flex;flex-direction:column;max-height:75cqb;overflow-y:auto;>*{margin-block-end:.5rem}>*:last-child,.terms-label{margin-block-end:0}calcite-text-area{--calcite-text-area-min-height: 4rem}calcite-notice{margin-block-start:0}}.feedback-sheet{--calcite-sheet-height: auto;--calcite-sheet-max-height: 100%;--calcite-sheet-min-height: auto}.feedback-footer{display:flex;justify-content:flex-end;gap:.5rem;width:100%}calcite-chip[slot=header-actions-end]{align-self:center;margin-inline-end:.5rem}calcite-flow-item calcite-shell{background:transparent}calcite-block{width:100%;max-width:100%;align-self:flex-end;background-color:transparent;margin-block:0}calcite-sheet{--calcite-sheet-scrim-background: rgba(200, 200, 200, .5)}calcite-list-item calcite-button{margin-inline-end:.25rem}calcite-flow-item calcite-shell calcite-notice{margin-block:1rem}calcite-block[open]:last-of-type{border-block-end:0}.text-area-wrapper{display:flex;border-radius:var(--calcite-corner-radius-round);margin:.75rem;overflow:hidden;--calcite-color-border-input: transparent;position:sticky;box-shadow:var(--calcite-shadow-sm);flex:none;flex-direction:column}calcite-text-area{height:auto;overflow:hidden;--calcite-font-weight-normal: 500;font-weight:500;line-height:1.2}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}.contained-popover-or-tooltip{--calcite-popover-max-size-x: 100%;--calcite-tooltip-max-size-x: 100%}.info-heading{font-size:var(--calcite-font-size-0);color:var(--calcite-color-text-1);margin:0}.info-heading-row{display:flex;align-items:center;gap:var(--calcite-spacing-sm);flex-wrap:wrap}.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-button{font-weight:var(--calcite-font-weight-medium)}.suggestions{display:flex;flex-direction:row;gap:var(--calcite-spacing-xs);flex-wrap:wrap}.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-border-color: transparent;width:100%}.positioned-code-content{display:flex;flex-direction:row;gap:.5rem;padding:.5rem}calcite-card [slot=heading] 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{display:flex;flex-direction:row;padding:0;overflow-y:hidden;overflow-x:auto;margin:.25rem 0 .75rem;align-items:center;max-width:100%;span{overflow-x:auto;overflow-y:hidden}}.copy-feedback{display:none}.copy-prompt-button{align-self:flex-start;margin-inline-start:auto}.response-secondary-action-button[data-copied]+.copy-feedback,.copy-prompt-button[data-copied]+.copy-feedback{display:block;span{padding:.75rem 1rem;font-size:var(--calcite-font-size--2);line-height:1.375;color:var(--calcite-color-text--2);font-weight:var(--calcite-font-weight-medium)}}.copy-prompt-button[data-copied]~.copy-tooltip,.response-secondary-action-button[data-copied]~.copy-tooltip{display:none}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}.response-secondary-action-button{margin-left:.5rem}.add-to-editor-button{--calcite-internal-button-border-color: unset}}.collapsible-code{padding:.5rem}.collapsible-code summary{cursor:pointer;font-weight:500;color:var(--calcite-color-brand);outline:none;padding:.25rem 0}.collapsible-code[open] summary{color:var(--calcite-color-text-2)}.response-error-container{padding:.5rem;background:color-mix(in srgb,var(--calcite-color-status-warning) 10%,transparent);border-radius:var(--calcite-corner-radius-round);margin:1rem 0;font-size:var(--calcite-font-size--2);--calcite-input-message-icon-color: var(--calcite-color-status-warning)}.response-error-chip{--calcite-internal-chip-background-color: var(--calcite-color-status-warning);--calcite-chip-icon-color: var(--calcite-color-foreground-1);--calcite-chip-border-color: var(--calcite-color-transparent)}.feedback-actions{gap:unset}.contained{max-width:100%;max-height:100%;max-width:100cqi;max-height:75cqb;overflow-y:auto}.submission-notice{--calcite-notice-border-color: transparent;margin-block:0;width:100%;--calcite-font-size-relative-base: var(--calcite-font-size--2)}.border-block-end{border-block-end:1px solid var(--calcite-color-border-3)}.round-top{border-radius:var(--calcite-corner-radius-round) var(--calcite-corner-radius-round) 0 0}}:host([closed]){display:none}`,$=class extends Error{constructor({message:e,code:t,subCode:i,details:s,source:n}){super(e),this.name="ArcadeAssistantError",this.code=t,this.subCode=i,this.details=s,this.source=n}};function le(a){if(!a)return;let e=a.indexOf('{"error":');if(e!==-1)try{let t=a.slice(e),i=JSON.parse(t);if(i&&typeof i=="object"&&i.error)return i.error}catch{return}}async function Ee(a){let{baseUrl:e,skillId:t,message:i,authToken:s,previousConversationId:n,context:c}=a,p=t?`${e}/skills/${t}/chat`:`${e}/chat`,r=[],o={message:i,context:c};n&&(o.conversation_id=n);let u;try{u=await ne(p,{method:"post",headers:{"Content-Type":"application/json",token:s},body:JSON.stringify(o),responseType:"json"})}catch(b){let f=b,x=f.details?.rawResponse||f.message||String(b),S=le(x);throw S?new $(S):b}let d=u.data;r.push(d);let v=d.conversationId,z=d.inquiryId,k=d.sequenceNumber;async function M(){let b=0,f=100;for(;b<f;){await new Promise(T=>setTimeout(T,1e3));let x=Re(v,k,z),S;try{S=await ne(p,{method:"post",headers:{"Content-Type":"application/json",token:s},body:JSON.stringify(x),responseType:"json"})}catch(T){let L=T,ke=L.details?.rawResponse||L.message||String(T),B=le(ke);throw B?new $(B):T}let y=S.data;if(y.context?.kind==="ArcgisErrorAsContext"&&y.context.error)throw new $({message:y.context.error.message||"ArcGIS Assistant error",code:y.context.error.code,subCode:y.context.error.subCode,details:y.context.error.details,source:"polling-response"});if(r.push(y),k=y.sequenceNumber,b++,!y.hasMore)break}if(b===f)throw new $({message:"Request timed out",code:"TIMEOUT",source:"polling"})}let E=120*1e3;return await Promise.race([M(),new Promise((b,f)=>setTimeout(()=>f(new $({message:"Request timed out",code:"TIMEOUT",source:"hard-timeout"})),E))]),r}function Re(a,e,t){return{conversationId:a,inquiryId:t,ackSequenceNumber:e}}function Ve(a){return a.message.match(/Error in prompt shield/u)?"I'm having trouble with this request. Try again by rephrasing the question.":a.code==="TIMEOUT"?"Request timed out. Try again by re-asking the same question or rephrasing it.":a.message}var qe=({notices:a})=>a.length?l`<div class="border-block-end">${F(a,e=>e.id??e.title,e=>l`<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&&l`<div slot=message>${e.message}</div>`||""}${e.actionLinkMessage&&e.onAction&&l`<calcite-link slot=link @click=${()=>e.onAction?.()}>${e.actionLinkMessage}</calcite-link>`||""}</calcite-notice>`)}</div>`:null,Ne=a=>{let e=a.value.length,t=72,i=180,s=a.offsetWidth,n=Math.max(1,Math.floor(s/8)),c=Math.ceil(e/n),p=t+(c-2)*24;a.style.setProperty("--calcite-text-area-min-height",`${Math.min(p,i)}px`)},Fe=({promptValidationMessage:a,errorMessage:e,contextTooBig:t,contextReducedNoticeDismissed:i,setContextReducedNoticeDismissed:s,setErrorMessage:n,messages:c})=>{let p=[];if(a&&p.push({id:"prompt-validation",kind:"danger",icon:"exclamation-mark-triangle",title:a,closable:!0}),e&&p.push({id:"assistant-error",kind:"danger",icon:"exclamation-mark-triangle",title:e,closable:!0,onClose:()=>n(void 0)}),t&&!i){let r=c.contextreduced??"Context reduced",o=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.";p.push({id:"context-reduced",kind:"warning",icon:"exclamation-mark-triangle",title:r,message:o,closable:!0,onClose:()=>s(!0)})}return p};function Pe({messages:a}){return l`<calcite-chip slot=header-actions-end scale=s appearance=outline-fill .label=${a.beta??"Beta"}>${a.beta??"Beta"}</calcite-chip>`}function De({popoverContent:a,messages:e}){return l`<calcite-action icon=information slot=header-actions-end id=legal-disclaimer text></calcite-action><calcite-popover reference-element=legal-disclaimer .label=${e.legaldisclaimer??"Legal disclaimer"} placement=bottom auto-close focus-trap-disabled><div class="contained">${a}</div></calcite-popover>`}function _e({errorMessage:a,slot:e}){return l`<div class="error-display"><calcite-input-message id=error-message status=invalid icon=exclamation-mark-triangle scale=m slot=${e??I}>${a}</calcite-input-message></div>`}function Ue({active:a,setActive:e,messages:t}){return l`<calcite-alert slot=alerts .open=${a} 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 Oe({context:a,messages:e}){return a?l`<div class="gaps">${a.profileId&&l`<calcite-popover auto-close placement=top .label=${(e.profilecontextlabel??"Profile context: {profileId}").replace("{profileId}",a.profileId)} reference-element=profile-context-button class="context-popover contained-popover-or-tooltip"><p>${(e.profilecontextlabel??"Profile context: {profileId}").replace("{profileId}",a.profileId)}</p></calcite-popover><calcite-button round kind=neutral icon-start=map-information id=profile-context-button scale=s></calcite-button>`||""}</div>`:null}function ze({isDisabled:a,isReadOnly:e,setQuestion:t,setIsViewingResult:i,textAreaRef:s,question:n,errorMessage:c,setErrorMessage:p,promptValidationMessage:r,setPromptValidationMessage:o,submitQuestion:u,messages:d,mode:v,assistantRef:z,context:k,contextReducedNoticeDismissed:M,setContextReducedNoticeDismissed:E}){let b=k?.contextTooLarge??!1,f=Fe({promptValidationMessage:r,errorMessage:c,contextTooBig:b,contextReducedNoticeDismissed:M,setContextReducedNoticeDismissed:E,setErrorMessage:p,messages:d});return l`<div class="text-area-wrapper">${qe({notices:f})}<calcite-text-area scale=s resize=vertical .readOnly=${a||e} class=${Z(f.length?"submission-text-area":"submission-text-area round-top")} .placeholder=${d.askaquestion??`Specify the calculation or logic you need in an Arcade expression. (e.g., 'Return "Yes" if value > 10')`} .value=${n} @calciteTextAreaInput=${x=>{Ne(x.target),t(x.target.value)}} ${K(s)}><div class="submission-actions-wrapper" slot=footer-start><div class="submission-actions">${k&&Oe({context:k,messages:d})||""}<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=${a} @click=${async()=>{i(!1),t("")}} .label=${d.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">${d.startover??"Start Over"}</calcite-tooltip><calcite-button round kind=neutral .hidden=${v!=="refine"} icon-start=arrow-left icon-flip-rtl=both appearance=solid .disabled=${a} @click=${async()=>{i(!1),t("")}} class="hidden-below-380" scale=s>${d.startover??"Start Over"}</calcite-button><calcite-button round scale=s icon-end=effects appearance=solid .loading=${a} .disabled=${a} @click=${async()=>{if(p(""),!n){o(d.enteraprompt??"Please enter a prompt");return}o(void 0),await u()}} class="hidden-below-380">${v==="prompt"?d.ask??"Generate":d.refine??"Refine"}</calcite-button><calcite-button round scale=s icon-end=effects appearance=solid .loading=${a} .disabled=${a} id=small-submit-button @click=${async()=>{if(p(""),!n){o(d.enteraprompt??"Please enter a prompt");return}o(void 0),await u()}} class="hidden-above-380" .label=${v==="prompt"?d.ask??"Generate":d.refine??"Refine"}></calcite-button><calcite-tooltip reference-element=small-submit-button placement=top-start class="hidden-above-380">${v==="prompt"?d.ask??"Generate":d.refine??"Refine"}</calcite-tooltip></div></div></div></calcite-text-area></div>`}var Le="https://www.esri.com/en-us/privacy/privacy-statements/privacy-supplement",Be="https://www.esri.com/en-us/privacy/privacy-statements";function Qe({setOpen:a,messages:e,feedback:t,learnMoreUrl:i,setFeedback:s,onSubmit:n}){return t.active?l`<calcite-sheet class="feedback-sheet" .label=${e.feedback??"Feedback"} slot=sheets display-mode=float position=block-end .open=${t.active} @calciteSheetClose=${()=>a(!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=>s({...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=>{s({...t,termsAccepted:c.target.checked})}} .disabled=${t.submitting}></calcite-checkbox><span>${C((e.agreement??"I agree to the {EsriPrivacyStatement} (and {Supplement}).").replace("{EsriPrivacyStatement}",`<calcite-link href=${Be} target="_blank">${e.esriprivacystatement??"Esri Privacy Statement"}</calcite-link>`).replace("{Supplement}",`<calcite-link href=${Le} target="_blank">${e.supplement??"Supplement"}</calcite-link>`))}</span></calcite-label><calcite-notice scale=s open closable><span slot=message>${C((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=${i} 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=${()=>a(!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}function de({assistantsEnabled:a,messages:e,slot:t,helpTopicUrl:i}){return l`<calcite-block .label=${e.assistantinformation??"Assistant information"} slot=${t??I} expanded class="info-block" scale=s><div class="info-heading-row"><h1 class="info-heading">${e.introducing??"Introducing Arcade Assistant (beta)"}</h1><calcite-chip .label=${e.new??"New"} kind=brand scale=s>${e.new??"New"}</calcite-chip></div>${a?l`<p>${e.capabilities??"The assistant uses artificial intelligence to generate Arcade expressions."}</p><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>${C((e.seedocumentation??"Please see the {documentation} for more information, including limitations and additional resources.").replace("{documentation}",`<calcite-link href=${i} target="_blank">${e.documentation??"documentation"}</calcite-link>`))}</p>`:l`<p>${e.useofassistant??"The assistant uses artificial intelligence to generate Arcade expressions. To enable Arcade Assistant (beta), the following must be true:"}</p><ul><li>${e.enabledinorg??"AI assistants are enabled in the organization settings"}</li><li>${e.enabledbetaapps??"Beta apps and capabilities are not blocked"}</li><li>${e.enabledroleprivilege??"Your role privilege allows you to use AI assistants"}</li></ul>`}</calcite-block>`}function je({messages:a,onProceed:e,onExit:t,helpTopicUrl:i}){return l`<calcite-dialog close-disabled placement=top .heading=${a.welcome??"Welcome to the new assistant experience"} slot=dialogs open width-scale=m id=welcome-dialog><h3 class="unstyled-h3">${a.beforeyougetstarted??"Before you get started be aware:"}</h3><ul><li>${a.maybeincorrect??"AI generated code may occasionally be incorrect or biased. Review carefully."}</li><li>${C((a.pleasereadhelp??"Read the Arcade Assistant (beta) {helpTopic} to get started and learn details on security, privacy and limitations.").replace("{helpTopic}",`<calcite-link href=${i} target="_blank">${a.helptopic??"help topic"}</calcite-link>`))}</li></ul><calcite-button id=welcome-proceed slot=footer-end @click=${e}>${a.proceed??"Proceed"}</calcite-button><calcite-button id=welcome-decline slot=footer-start @click=${t} kind=neutral>${a.exit??"Exit"}</calcite-button></calcite-dialog>`}function He({messages:a,suggestions:e,onSuggestionClick:t}){return l`<calcite-block .heading=${a.promptsuggestions} expanded collapsible id=suggestion-block scale=s><div class="suggestions">${e.map(i=>l`<calcite-button round scale=s appearance=outline-fill kind=neutral .label=${a.promptsuggestion} class="suggestion-button" @click=${()=>t?.(i)}>${i}</calcite-button>`)}</div></calcite-block>`}var pe=200;function ue({hidden:a=!1,expanded:e=!1,messages:t,cards:i,heading:s,collapsible:n=!1,showEffectsIcon:c=!1,onCopyCode:p,standalone:r}){return l`<calcite-block .hidden=${a} id=result-block .heading=${s??t.besteffort??"Here is the assistant's best effort"} .expanded=${e} .collapsible=${n}>${c&&l`<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"}>${F(i,o=>o.conversationId,o=>l`<calcite-card><div slot=heading><div class="prior-prompt"><span>${o.priorPrompt.length>pe?`${o.priorPrompt.slice(0,pe)}...`:o.priorPrompt}</span><calcite-action icon=duplicate scale=s slot=actions-end class="copy-prompt-button" text .id=${`copy-prompt-${o.conversationId}-${r?"standalone":"list"}`} @click=${u=>{let d=u.currentTarget;navigator.clipboard.writeText(o.priorPrompt).then(()=>{d.setAttribute("data-copied","true"),setTimeout(()=>d.removeAttribute("data-copied"),1500)})}}></calcite-action><calcite-popover .referenceElement=${`copy-prompt-${o.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-${o.conversationId}-${r?"standalone":"list"}`} placement=top-start class="copy-tooltip">${t.copyprompttoclipboard??"Copy prompt to clipboard"}</calcite-tooltip></div>${o.message&&r&&l`<div class="response-error-container">${_e({errorMessage:o.message})}</div>`||""}</div><div><div class="code-response-wrapper"><div class="positioned-code-content"><calcite-chip-group .label=${t.responsecontext??"Response Context"} scale=s>${o.message&&!r&&l`<calcite-tooltip .referenceElement=${`response-chip-${o.conversationId}-error`} placement=top-start>${o.message}</calcite-tooltip><calcite-chip .id=${`response-chip-${o.conversationId}-error`} .label=${t.error??"Error"} scale=s appearance=outline icon=exclamation-mark-triangle-f class="response-error-chip"></calcite-chip>`||""}${Ge({card:o,messages:t})}</calcite-chip-group></div><details class="collapsible-code" open><summary>Code response</summary><arcgis-code-viewer language=arcade round>${o.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=${()=>o.onAddToEditor("add")} scale=s icon-start=plus round .label=${t.addtoeditor??"Add to editor"} .id=${`add-to-editor-button-${o.conversationId}-${r?"standalone":"list"}`}></calcite-button><calcite-tooltip class="hidden-above-380" .referenceElement=${`add-to-editor-button-${o.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=${()=>o.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=${()=>o.onAddToEditor("replace")} class="response-secondary-action-button" .id=${`replace-${o.conversationId}-${r?"standalone":"list"}`}></calcite-button><calcite-tooltip .referenceElement=${`replace-${o.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=>{let d=u.currentTarget;p(o.code).then(()=>{d.setAttribute("data-copied","true"),setTimeout(()=>d.removeAttribute("data-copied"),1500)})}} class="response-secondary-action-button" .id=${`copy-response-${o.conversationId}-${r?"standalone":"list"}`}></calcite-button><calcite-popover .referenceElement=${`copy-response-${o.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-${o.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=${o.onThumbsUp} .id=${`thumbs-up-${o.conversationId}-${r?"standalone":"list"}`}></calcite-action><calcite-tooltip .referenceElement=${`thumbs-up-${o.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=${o.onThumbsDown} .id=${`thumbs-down-${o.conversationId}-${r?"standalone":"list"}`}></calcite-action><calcite-tooltip .referenceElement=${`thumbs-down-${o.conversationId}-${r?"standalone":"list"}`} placement=top-start><span>${t.unhelpful??"Unhelpful"}</span></calcite-tooltip></div></calcite-card>`)}</calcite-card-group></calcite-block>`}var Ge=({card:a,messages:e})=>{let t=H(),i=`response-chip-profile-${a.conversationId}-${t}`,s=(e.profilecontextlabel??"Profile context: {profileId}").replace("{profileId}",a.profileId);return l`<calcite-tooltip .referenceElement=${i} placement=top-start class="contained-popover-or-tooltip">${s}</calcite-tooltip><calcite-chip .label=${a.profileId} scale=s appearance=outline icon=map-information id=${i??I}>${a.profileId}</calcite-chip>`},me=a=>a.type==="featureSet";function we(a){return a&&a!=="dataCatalogDatastore"?a:void 0}var P=a=>{if(!ae(a))return[];let e=[];return a.relationships?.forEach(t=>{e.push(t.toJSON())}),e},D=a=>a.length>0?{relationships:a}:{},Je=a=>oe(a).map(e=>({alias:e.alias,name:e.name,type:e.type,...e.domain?{domain:e.domain}:{}})),_=a=>a?{fields:Je(a)}:{fields:[]};async function he(a){let e=await a.loadSource(),t=V(e)&&e.isTable,i=P(e);return{name:a.name,type:"featureSet",isTable:t,..._(e?.fields),...D(i)}}async function $e(a){switch(a.type){case"feature":{let t=await a.loadSource(),i=P(t);return{name:a.name,type:a.type,..._(t?.fields),...D(i)}}case"featureSet":{let t=await a.loadSource(),i=V(t)&&t.isTable;return{name:a.name,type:"featureSet",...i?{isTable:i}:{},..._(t?.fields),...D(P(t))}}case"featureSetCollection":{let t=await a.loadSource(),i=t?.layers.filter(me)??[],s=t?.tables.filter(me)??[],n=await Promise.all(i.map(he)),c=await Promise.all(s.map(he));return{name:a.name,type:"featureSetCollection",layers:n,tables:c}}case"dictionary":{let t=await Promise.all(a.dictionaryVariables.filter(q).map($e));return{name:a.name,type:"dictionary",attributes:t}}case"pixel":{let t=await a.loadSource();if(!t)return{name:a.name,type:"pixel"};let i=await Ae(t);return{name:a.name,type:"pixel",members:i.map(ge)}}case"voxel":{let t=await a.loadSource();if(!t)return{name:a.name,type:"voxel"};let i=await Te(t);return{name:a.name,type:"voxel",members:i.map(ge)}}case"array":let e=we(a.elementType.type);return{name:a.name,type:"array",...e?{elementType:e}:{}};case"number":case"text":case"boolean":case"date":case"knowledgeGraph":case"dateOnly":case"geometry":case"time":return{name:a.name,type:a.type}}}function ge(a){if(a.type==="array"){let e=we(a.elementType.type);return{name:a.name,type:"array",...e?{elementType:e}:{}}}return{name:a.name,type:a.type}}async function Ye(a){return{variables:await Promise.all(a.variables.filter(q).map($e))}}var We=1e5;function Ke(a){let e=new TextEncoder().encode(a).length;return Math.ceil(e/3.5)}function U(a){return Ke(JSON.stringify(a))}function Xe(a){let e=i=>({name:i.name,type:i.type,...i.isTable?{isTable:i.isTable}:{},...i.relationships?{relationships:i.relationships}:{}}),t=i=>{switch(i.type){case"feature":case"featureSet":case"knowledgeGraph":return{name:i.name,type:i.type,..."isTable"in i&&i.isTable?{isTable:i.isTable}:{},..."relationships"in i?{relationships:i.relationships}:{}};case"featureSetCollection":return{name:i.name,type:"featureSetCollection",layers:i.layers.map(e),tables:i.tables.map(e)};case"dictionary":return{name:i.name,type:"dictionary",attributes:i.attributes.map(t)};case"pixel":case"voxel":return{name:i.name,type:i.type};case"array":return{name:i.name,type:"array",...i.elementType?{elementType:i.elementType}:{}};default:return i}};return{variables:a.variables.map(t)}}function Ze(a){let e=a.variables,t=e.length,i=e.find(n=>n.name==="$feature")??e.find(n=>n.type==="feature")??e[0],s=i?[i]:[];return{context:{variables:s},wasReduced:t!==s.length,reducedToVariableName:i?.name}}function et(a){return U(a)>We}var tt=Object.defineProperty,at=Object.getOwnPropertyDescriptor,h=(a,e,t,i)=>{for(var s=i>1?void 0:i?at(e,t):e,n=a.length-1,c;n>=0;n--)(c=a[n])&&(s=(i?c(e,t,s):c(s))||s);return i&&s&&tt(e,t,s),s},m=class extends Ce{constructor(a){super(a),this.viewMode="prompt",this.confirmationActive=!1,this.contextReducedNoticeDismissed=!1,this.splashActive=!0,this.isSubmitting=!1,this.question="",this.history=[],this.feedback={active:!1}}};h([g()],m.prototype,"viewMode",2);h([g()],m.prototype,"confirmationActive",2);h([g()],m.prototype,"contextReducedNoticeDismissed",2);h([g()],m.prototype,"splashActive",2);h([g()],m.prototype,"isSubmitting",2);h([g()],m.prototype,"errorMessage",2);h([g()],m.prototype,"promptValidationMessage",2);h([g()],m.prototype,"question",2);h([g()],m.prototype,"history",2);h([g()],m.prototype,"feedback",2);h([g()],m.prototype,"context",2);m=h([Ie("ArcadeAssistantViewState")],m);var it="arcade_generation",st="ArcadeCodeRequest",be="visualization",fe="ArcadeAssistant",ot=["your_comments","user_evaluation","question","answer","useragent","_source","version","context","extras","conversation_id","privacy_statement"],ve=[],ye=!0,O=class extends X{constructor(){super(...arguments),this.textAreaRef=W(),this.messages=te(),this._feedbackService=void 0,this.viewState=new m,this.handleFeedbackButton=(e,t)=>{this.updateViewState({feedback:{active:!0,value:e,item:t,termsAccepted:!1,text:"",submitting:!1}})},this.handleFeedbackSheetClose=()=>{this.updateViewState({feedback:{active:!1}})},this.handleFeedbackSubmit=async()=>{if(!this.viewState.feedback.active)return;this.updateViewState({feedback:{...this.viewState.feedback,submitting:!0}});let e=await this.ensureFeedbackService();if(!e){this.handleFeedbackSheetClose();return}let t=!1,i;this.viewState.feedback.item.conversationId===this.viewState.history[0]?.conversationId&&this.viewState.viewMode==="result"?(i=this.viewState.context,t=!0):i=this.viewState.feedback.item.contextSnapshot;let s=re.applicationName;!s&&!this.appVersion&&w("warn",this,"esriConfig.applicationName is not set. Consider setting it to help identify the application version in feedback.");let{value:n,text:c,termsAccepted:p,item:{question:r,formattedScript:o,conversationId:u}}=this.viewState.feedback,d={user_evaluation:n,your_comments:c||void 0,question:r??"",answer:this.encodeAnswerForFeedback(o),useragent:navigator.userAgent,_source:fe,version:this.appVersion||s||"NOT_SET",context:i?JSON.stringify({...i,isSnapshot:!t}):"",extras:i?.profileId??"",conversation_id:u??"",privacy_statement:p?"I_agree":""};try{await e.applyEdits({addFeatures:[new ce({attributes:d})]})}catch(v){w("error",this,"Error submitting feedback.",{detail:{error:v}})}this.handleFeedbackSheetClose()},this.handleClose=e=>{this.closed=!0,this.closePanel?.(e)},this.setQuestionState=e=>{this.updateViewState({question:e,promptValidationMessage:void 0})},this.setFeedbackState=e=>{this.updateViewState({feedback:e})},this.onSuggestionClick=e=>{this.textAreaRef.value&&(this.textAreaRef.value.value=e,this.textAreaRef.value.setFocus(),this.setQuestionState(e))},this.helpBase="",this.assistantsEnabled=!1,this.closed=!1,this.disableQuestionAnswerLogging=!1}static{this.properties={closePanel:0,insertText:0,helpBase:1,assistantsEnabled:5,portalUrl:1,serviceUrl:1,closed:7,editorRef:0,feedbackServiceUrl:1,appVersion:1,disableQuestionAnswerLogging:5}}static{this.styles=Me}get disclaimerComment(){return`// ${this.messages.disclaimercomment}
|
|
3
|
+
// ${this.messages.disclaimerpt2??"AI-generated content may be inaccurate. Review before using."}`}get assistantOverviewDocUrl(){return`${this.helpBase??"https://doc.arcgis.com/en/arcgis-online/"}create-maps/understand-arcade-assistant.htm`}get usingTheAssitantDocUrl(){return`${this.helpBase??"https://doc.arcgis.com/en/arcgis-online/"}create-maps/understand-arcade-assistant.htm`}async destroy(){}connectedCallback(){super.connectedCallback(),this.updateViewState({history:ve,splashActive:ye})}load(){let e=async()=>{let t=this.getModel();if(!t){this.updateViewState({context:void 0});return}let i=await this.getProfileAndMetadata(t.uri);this.updateViewState({context:i,contextReducedNoticeDismissed:i.contextTooLarge?!1:this.viewState.contextReducedNoticeDismissed})};e().catch(t=>{w("error",this,"Error setting initial context.",{detail:{error:t}})}),this.manager.onLifecycle(()=>{let t=N.onModelContextDidChange(async()=>{e().catch(i=>{w("error",this,"Error setting context.",{detail:{error:i}})})});return{remove:()=>{t.dispose()}}})}disconnectedCallback(){super.disconnectedCallback(),ve=this.viewState.history,ye=this.viewState.splashActive,this.copySuccessTimer&&(clearTimeout(this.copySuccessTimer),this.copySuccessTimer=void 0)}createFeedbackContextSnapshot(e){let t=Xe(e.metadata);return{...e,metadata:t,estimatedTokens:U(t)}}encodeAnswerForFeedback(e){return encodeURIComponent(e??"")}updateViewState(e){this.viewState.set(e)}getHistoryCards(){return this.viewState.history.reduce((e,t)=>(!t.script||(e.push({priorPrompt:t.question,code:t.formattedScript||t.error||"",profileId:t.profile??be,onAddToEditor:i=>{ie(this.editorRef.editorInstance,t.formattedScript??"",i,this.disclaimerComment)},onThumbsUp:()=>this.handleFeedbackButton("good",t),onThumbsDown:()=>this.handleFeedbackButton("bad",t),conversationId:t.conversationId??"",message:t.message}),this.viewState.viewMode),e),[])}async ensureFeedbackService(){if(this._feedbackService)return this._feedbackService;if(!this.feedbackServiceUrl)return;let e=new Se({url:this.feedbackServiceUrl});await e.load();let t=ot.filter(i=>!e.fields.some(s=>s.name===i));if(t.length>0){w("error",this,`Missing the following fields in feedback service: ${t.join(", ")}. Feedback will not be logged.`);return}return this._feedbackService=e,e}async logInteractionToFeedbackService(e){if(this.disableQuestionAnswerLogging||!e.question)return;let t;try{t=await this.ensureFeedbackService()}catch(c){w("error",this,"Error initializing feedback service for interaction logging.",{detail:{error:c}});return}if(!t)return;let i=re.applicationName,s=e.contextSnapshot,n={question:e.question,answer:this.encodeAnswerForFeedback(e.answer),useragent:navigator.userAgent,_source:fe,version:this.appVersion||i||"NOT_SET",context:s?JSON.stringify({...s,isSnapshot:!0}):"",extras:s?.profileId??"",conversation_id:e.conversationId??"",privacy_statement:""};try{await t.applyEdits({addFeatures:[new ce({attributes:n})]})}catch(c){w("error",this,"Error logging arcade assistant question/answer interaction.",{detail:{error:c}})}}getModel(){return this.editorRef.editorInstance?.getModel()}async submitQuestion(){if(!this.viewState.question)return;let e=this.viewState.question;this.updateViewState({isSubmitting:!0,errorMessage:void 0});let t,i;try{let s=this.getModel();if(!s||!this.serviceUrl)return;let n=this.viewState.context??await this.getProfileAndMetadata(s.uri);t=this.createFeedbackContextSnapshot(n);let c=await this.getToken(),p=await Ee({baseUrl:this.serviceUrl,skillId:it,message:e,authToken:c,context:{kind:st,context:{profile_id:n.profileId,metadata:[n.metadata],editor_code:s.getValue()}}});i=p?.[0]?.conversationId;let r=p.find(o=>o.context?.kind==="ArcadeCodeResponse");if(!r){await this.logInteractionToFeedbackService({question:e,answer:"No ArcadeCodeResponse returned.",contextSnapshot:t,conversationId:i});return}if(r.context?.kind==="ArcadeCodeResponse"){let o=this.createFeedbackContextSnapshot(n),u=se(r?.context?.arcadeCode?.code??"");this.updateViewState({history:[{script:r?.context?.arcadeCode?.code,formattedScript:u,error:void 0,question:e,profile:n.profileId,conversationId:r.conversationId,contextSnapshot:o,...r.message?{message:r.message}:{}},...this.viewState.history],viewMode:"result",errorMessage:void 0}),await this.logInteractionToFeedbackService({question:e,answer:u,contextSnapshot:t,conversationId:r.conversationId})}}catch(s){let n=s instanceof Error&&s.name==="ArcadeAssistantError"?Ve(s)||this.messages.erroroccurred||"An error occurred.":this.messages.erroroccurred||"An error occurred.";this.updateViewState({errorMessage:n}),await this.logInteractionToFeedbackService({question:e,answer:n,contextSnapshot:t,conversationId:i}),w("error",this,"Error submitting question",{detail:{error:s}})}finally{this.updateViewState({isSubmitting:!1})}}async getToken(){let{token:e}=await xe.getCredential(this.portalUrl);return e}async getProfileAndMetadata(e){let t=be,i=N.getEditorProfileForModel(e);i?.loaded||await i?.loadSource();let s=this.editorRef.profile;s&&"id"in s&&(t=s.id);let n=i?await Ye(i):{variables:[]},c=et(n),p=c?Ze(n):void 0,r=p?p.context:n,o=U(r);return{profileId:t,metadata:r,contextTooLarge:c,reducedToVariableName:p?.reducedToVariableName,estimatedTokens:o}}onCopyCode(e){let t=e?`${this.disclaimerComment}
|
|
4
4
|
${e}`:"";return navigator.clipboard.writeText(t)}render(){if(this.closed)return null;let e=this.viewState.viewMode==="result",t=this.getHistoryCards();return this.assistantsEnabled?l`<calcite-flow><calcite-flow-item closable heading-level=2 .heading=${this.messages.arcadeassistant??"Arcade assistant"} @calciteFlowItemClose=${this.handleClose}>${this.viewState.splashActive&&l`<calcite-scrim></calcite-scrim>`||""}${Pe({messages:this.messages})}${De({messages:this.messages,popoverContent:de({assistantsEnabled:this.assistantsEnabled,messages:this.messages,helpTopicUrl:this.usingTheAssitantDocUrl})})}<calcite-shell class="unstyled-shell">${this.viewState.splashActive&&je({messages:this.messages,onProceed:()=>{this.updateViewState({splashActive:!1})},helpTopicUrl:this.assistantOverviewDocUrl,onExit:i=>this.closePanel?.(i)})||""}${Ue({active:this.viewState.confirmationActive,setActive:i=>this.updateViewState({confirmationActive:i}),messages:this.messages})}${ze({isDisabled:this.viewState.isSubmitting,isReadOnly:!1,setQuestion:this.setQuestionState,setIsViewingResult:i=>this.updateViewState({viewMode:i?"result":"prompt"}),mode:e?"refine":"prompt",textAreaRef:this.textAreaRef,question:this.viewState.question,errorMessage:this.viewState.errorMessage,setErrorMessage:i=>this.updateViewState({errorMessage:i}),promptValidationMessage:this.viewState.promptValidationMessage,setPromptValidationMessage:i=>this.updateViewState({promptValidationMessage:i}),submitQuestion:this.submitQuestion.bind(this),assistantRef:this.el,messages:this.messages,context:this.viewState.context,contextReducedNoticeDismissed:this.viewState.contextReducedNoticeDismissed,setContextReducedNoticeDismissed:i=>this.updateViewState({contextReducedNoticeDismissed:i})})}<calcite-block-group .label=${this.messages.interactiveblocks??"interactive blocks"}>${!e&&!this.viewState.isSubmitting&&He({messages:this.messages,suggestions:[this.messages.prompsuggestion1??"",this.messages.prompsuggestion2??""],onSuggestionClick:this.onSuggestionClick})||""}<calcite-block .hidden=${!this.viewState.isSubmitting} .heading=${this.messages.generatingresponse??"Generating response..."}></calcite-block>${ue({expanded:e,messages:this.messages,collapsible:!0,showEffectsIcon:!0,cards:t.length?[t[0]]:[],heading:this.messages.besteffort??"Here's the assistant's best effort",hidden:this.viewState.isSubmitting||!e,onCopyCode:this.onCopyCode.bind(this),standalone:!0})}${ue({expanded:!e,messages:this.messages,collapsible:!0,cards:e?t.slice(1):t,heading:this.messages.recentprompts??"Recent prompts",hidden:this.viewState.isSubmitting||this.viewState.history.length===0,onCopyCode:this.onCopyCode.bind(this)})}</calcite-block-group>${this.viewState.feedback.active?Qe({setOpen:this.handleFeedbackSheetClose,messages:this.messages,onSubmit:this.handleFeedbackSubmit,feedback:this.viewState.feedback,setFeedback:this.setFeedbackState,learnMoreUrl:this.assistantOverviewDocUrl}):null}</calcite-shell></calcite-flow-item></calcite-flow>`:l`<calcite-flow><calcite-flow-item .selected=${!e} closable heading-level=2 .heading=${this.messages.arcadeassistant??"Arcade assistant"} @calciteFlowItemClose=${this.handleClose}>${de({slot:"content-top",messages:this.messages,assistantsEnabled:this.assistantsEnabled,helpTopicUrl:this.usingTheAssitantDocUrl})}</calcite-flow-item></calcite-flow>`}};ee("arcgis-arcade-coding-assistant",O);return O},"identity/IdentityManager","request","layers/FeatureLayer","config","Graphic","applications/Components/arcadeEditorUtils","core/Accessor","core/accessorSupport/decorators",a,b,c)
|
|
@@ -0,0 +1,2 @@
|
|
|
1
|
+
/* COPYRIGHT Esri - https://js.arcgis.com/5.1/LICENSE.txt */
|
|
2
|
+
import{a as b}from"./64X4ILDM.js";import h from"./YE7HDVYS.js";import e from"./4B64NBIM.js";import{a as E}from"./ER2MKLVA.js";import d from"./7Z4V2ZOD.js";import c from"./TNA5F36E.js";import"./HPZZVB4X.js";import"./MP6Z45SA.js";import"./IFNCCZ7O.js";import a from"./GLJQQLP2.js";import{a as T}from"./SB3MM5EM.js";import{a as y}from"./KCU2C44H.js";import"./GS2ISVXJ.js";import{c as S,e as k}from"./6G5URSC7.js";import"./6C52UOYL.js";import{G as w,H as x,I as g,K as $,h as u,j as r,t as f}from"./REL6OK2I.js";import"./Y3KOWWO5.js";import"./B3UMUBOI.js";import"./CF3TERM3.js";import"./Z5ZZ36DQ.js";import{Zk as P}from"./LLPQEURF.js";import"./3TTFCHAA.js";export default $arcgis.t(([,{h:m,i:L,j:M},{a:l},{a:p},{a:z,b:C,c:h,d:A,e:B,f:I,g:N,h:F,i:D}])=>{var V=u`:host{--calcite-block-padding: var(--calcite-spacing-sm);--breakpoints-popover-max-height: min(14rem, 20vh);display:block;background-color:var(--calcite-color-foreground-1);color:var(--calcite-color-text-2);overflow:hidden;height:100%;.console-shell,.tabs-container,calcite-tabs{height:100%}.tabs-container{flex:1 1 auto;min-height:0;overflow:hidden}.console-shell,calcite-tabs{display:flex;flex-direction:column;min-height:0}.console-shell{container-type:size;container-name:debugger-console}calcite-tab-nav{--calcite-size-2xl: var(--calcite-space-md);justify-content:flex-start;padding-inline:var(--calcite-spacing-sm)}calcite-tab-title{font-size:var(--calcite-font-size-sm)}calcite-tab{--calcite-tab-content-block-padding: 0;--calcite-tab-content-space-y: 0;display:flex;flex-direction:column;min-height:0}calcite-tab:not([selected]){display:none}.disabled-state-text{font-size:var(--calcite-font-size-sm);color:var(--calcite-color-text-3);font-style:italic;text-align:center;display:block;padding:var(--calcite-spacing-md)}.breakpoint-header{display:flex;align-items:flex-start;gap:var(--calcite-spacing-sm);padding:var(--calcite-spacing-sm);border-bottom:1px solid var(--calcite-color-border-3);background-color:var(--calcite-color-foreground-1)}.load-action{--calcite-action-background-color: var(--calcite-color-foreground-2);--calcite-internal-action-height: 1.25rem;--calcite-internal-action-padding-block: 0;--calcite-internal-action-padding-inline: var(--calcite-spacing-xs);margin-block:var(--calcite-spacing-xxs)}.breakpoint-code-viewer{margin-block:0;width:100%}.tab-panel{display:flex;flex:1 1 auto;min-height:0;overflow:hidden}.tab-panel>*{flex:1 1 auto;min-height:0}.tab-panel>calcite-tree{margin-inline-end:var(--calcite-space-sm)}.preview-panel{display:flex;flex:1 1 auto;min-height:0}.preview-empty-state{display:flex;align-items:center;justify-content:center;width:100%;height:100%;padding:var(--calcite-spacing-md)}.preview-table-shell{display:flex;flex-direction:column;flex:1 1 auto;width:100%;min-height:0;overflow:hidden}.preview-table-summary{padding:var(--calcite-spacing-sm);border-bottom:1px solid var(--calcite-color-border-3);color:var(--calcite-color-text-2);font-family:var(--calcite-code-family);background-color:var(--calcite-color-foreground-1)}.table-scroll{overflow:auto;flex:1 1 auto;min-height:0;max-width:100%;background-color:var(--calcite-color-foreground-1);margin:var(--calcite-spacing-sm)}table{min-width:max-content;border-spacing:0;border-collapse:collapse;text-align:start;white-space:nowrap;thead{background-color:var(--calcite-color-foreground-2)}tr{border-top:1px solid var(--calcite-color-border-3);border-bottom:1px solid var(--calcite-color-border-3)}th,td{border-inline-start:1px solid var(--calcite-color-border-3);border-inline-end:1px solid var(--calcite-color-border-3);text-align:start;padding:var(--calcite-spacing-xxs);.string-value{white-space:pre}}th{font-weight:var(--calcite-font-weight-medium)}}.breakpoints-popover{--calcite-popover-max-size-x: min(22rem, 68vw)}.breakpoints-popover-content{max-block-size:var(--breakpoints-popover-max-height);overflow:hidden}.breakpoints-list{display:flex;flex-direction:column;gap:var(--calcite-spacing-xs);padding:var(--calcite-spacing-xs);min-width:min(18rem,58vw);max-block-size:var(--breakpoints-popover-max-height);overflow:auto}.breakpoints-popover .breakpoint-code-viewer{--calcite-font-size--2: var(--calcite-font-size--3);--calcite-spacing-md: var(--calcite-spacing-sm);--calcite-spacing-sm: var(--calcite-spacing-xs);--calcite-spacing-xs: var(--calcite-spacing-xxs)}.breakpoint-list-item{border:1px solid var(--calcite-color-border-3);border-radius:var(--calcite-corner-radius-sharp);background-color:var(--calcite-color-foreground-1);padding:var(--calcite-spacing-xxs)}.breakpoint-list-item--current{border-color:var(--calcite-color-brand)}.breakpoint-list-item-meta{color:var(--calcite-color-text-2);font-size:var(--calcite-font-size-xs);margin-bottom:var(--calcite-spacing-xxs)}}`,v=class extends w{constructor(){super(...arguments),this.messages=T(),this._monacoEditor=y(E),this._breakpointPopoverId=`arcade-debugger-console-breakpoints-${f()}`,this.modelId=""}static{this.properties={debuggerStore:0,modelId:1}}static{this.styles=[V,M,L()]}get breakpoints(){return this.debuggerStore?.debuggerBreakpoints??[]}get previewTabsState(){return this.debuggerStore.previewTabsState}get lazyTreeState(){return this.debuggerStore?.lazyTreeState}get executionProgramState(){return this.debuggerStore?.executionState?.result}load(){this.manager.onLifecycle(()=>{let e=S(this.el,["class"],this.updateTheme.bind(this));return this.updateTheme(),()=>e()})}getContentAtLine(e){if(!this.modelId)return"";let t=this._monacoEditor.getModel(P.parse(this.modelId));return t?t.getLineContent(e):""}updateTheme(){k(this.el)==="dark"?this.elementInternals.states.add(m):this.elementInternals.states.delete(m)}getBreakpointCode(e){return e==null?this.messages.nocontent??"No content":this.getContentAtLine(e)||(this.messages.nocontent??"No content")}getPreviewLoadErrorMessage(){return this.messages.previewloaderror??"Unable to load preview."}getBreakpointPositionText(e){return(this.messages.breakpointposition??"{position} of {count}"??"{position} of {count}").replace("{position}",String(e)).replace("{count}",String(this.breakpoints.length))}findCollectionItemByPreviewSegment(e,t){if(t.startsWith("name:")){let i=t.slice(5);return e.find(a=>a.name===i)?.featureSet}if(t.startsWith("id:")){let i=t.slice(3);return e.find(a=>String(a.id)===i)?.featureSet}}getExpandedDebuggerMap(e){if(e==null||!h(e))return null;let t=e.expand();return Array.isArray(t)?null:t}getPreviewRows(e){return e.map(t=>this.getExpandedDebuggerMap(t)||new Map)}getExpandedDebuggerChild(e,t){if(!e||!h(e))return;let i=e.expand();if(Array.isArray(i)){let a=Number(t);return!Number.isInteger(a)||String(a)!==t?void 0:i[a]}return i.get(t)}async resolvePreviewValueFromSegments(e,t){if(!t.length)return e;if(!e)return;let[i,...a]=t,o;if(N(e)){let s=await e.load();o=this.findCollectionItemByPreviewSegment(s,i)}else o=this.getExpandedDebuggerChild(e,i);return await this.resolvePreviewValueFromSegments(o,a)}getScope(e,t){switch(t){case"profile":return e.profile;case"globals":return e.globals;case"locals":return e.locals}}async resolvePreviewValue(e){let t=this.executionProgramState;if(!t)return;let i=C(e);if(!i)return;let{scopeName:a,rootName:o,pathSegments:s}=i,c=this.getScope(t,a);if(c)return await this.resolvePreviewValueFromSegments(c.get(o),s)}async loadPreview({label:e,sourcePath:t,value:i}){let a=this.previewTabsState,{snapshot:o}=a.startLoad(e,t),s=i;if(s==null)try{s=await this.resolvePreviewValue(t)}catch{a.setError(o,this.getPreviewLoadErrorMessage());return}if(s==null||!I(s)||typeof s.querySample!="function"||typeof s.schema!="function"){a.setUnavailable(o,this.messages.previewunavailable??"This preview is no longer available in the current paused state.");return}try{let{fields:c,features:d}=await s.querySample(),n=this.getPreviewRows(d);a.setLoaded(o,c,n)}catch{a.setError(o,this.getPreviewLoadErrorMessage())}}activateTab(e){if(e===p){this.previewTabsState.selectScope();return}this.previewTabsState.selectTab(e);let t=this.previewTabsState.getTab(e);t?.invalidated&&this.loadPreview({label:t.label,sourcePath:t.sourcePath})}closePreviewTab(e){e.closed=!1,this.previewTabsState.closeTab(e.tab)}scrollToSelectedBreakpoint(e){let t=e.currentTarget;requestAnimationFrame(()=>{t?.querySelector(".breakpoint-list-item--current")?.scrollIntoView({block:"center"})})}sortScopeEntries(e){return e.sort(([t],[i])=>t.localeCompare(i))}renderPreviewLabel(e){return r`<bdi>${e}</bdi>`}renderPreviewCell(e){return e?B(e)||A(e)?D({value:e}):r`<span class="xs"></span>`:r`<span class="xs"></span>`}renderScopeEntryForScope(e,t,i){let[a,o]=i,s=`${t}.${a}`,c=this.lazyTreeState;return c?F({name:a,value:o,messages:this.messages,path:`${e}.${a}`,lazyTreeState:c,previewLabel:s,previewSourcePath:z(e,a),previewLoading:this.previewTabsState.isTabLoading(s),onLoadPreview:d=>{this.loadPreview(d)}}):null}renderBreakpointPopover(e){return this.breakpoints.length?r`<calcite-popover .referenceElement=${this._breakpointPopoverId} placement=bottom-end scale=s auto-close focus-trap-disabled @calcitePopoverOpen=${t=>this.scrollToSelectedBreakpoint(t)} .label=${this.messages.breakpoints??"Breakpoints"} class="breakpoints-popover" .heading=${this.messages.breakpoints??"Breakpoints"} heading-level=2><div class="breakpoints-popover-content"><div class="breakpoints-list">${this.breakpoints.map((t,i)=>r`<div class=${x(t.line===e?"breakpoint-list-item breakpoint-list-item--current":"breakpoint-list-item")}><div class="breakpoint-list-item-meta"><bdi>${this.getBreakpointPositionText(i+1)}</bdi></div><arcgis-code-viewer language=arcade class="breakpoint-code-viewer" .lineNumbers=${a=>String(a+t.line-1)}>${this.getBreakpointCode(t.line)}</arcgis-code-viewer></div>`)}</div></div></calcite-popover>`:null}renderScopePanel(){let e=this.executionProgramState,t=this.sortScopeEntries(Array.from(e?.profile??[])),i=this.sortScopeEntries(Array.from(e?.globals??[])),a=e?.locals?this.sortScopeEntries(Array.from(e?.locals??[])):void 0,o=!!e?.locals,s=a&&a.length>0,c=t.length>0,d=i.length>0;return e?r`<calcite-tree .scale=${l.scale} @calciteTreeSelect=${l.oncalciteTreeSelect} .lines=${l.lines} .selectionMode=${l.selectionMode}><calcite-tree-item expanded .disabled=${!s}>${this.messages.local??"Local"}<calcite-tree slot=children .lines=${l.lines} .selectionMode=${l.selectionMode} .scale=${l.scale} @calciteTreeSelect=${l.oncalciteTreeSelect}>${o?s?a.map(n=>this.renderScopeEntryForScope("locals",this.messages.local??"Local",n)):r`<span><i>${this.messages.empty??"Empty"}</i></span>`:r`<span><i>${this.messages.nolocalscope??"No local scope"}</i></span>`}</calcite-tree></calcite-tree-item><calcite-tree-item expanded .disabled=${!d}>${this.messages.global??"Global"}<calcite-tree slot=children .lines=${l.lines} .selectionMode=${l.selectionMode} .scale=${l.scale} @calciteTreeSelect=${l.oncalciteTreeSelect}>${d?i.map(n=>this.renderScopeEntryForScope("globals",this.messages.global??"Global",n)):r`<span><i>${this.messages.empty??"Empty"}</i></span>`}</calcite-tree></calcite-tree-item><calcite-tree-item expanded .disabled=${!c}>${this.messages.profile??"Profile"}<calcite-tree slot=children .lines=${l.lines} .selectionMode=${l.selectionMode} .scale=${l.scale} @calciteTreeSelect=${l.oncalciteTreeSelect}>${c?t.map(n=>this.renderScopeEntryForScope("profile",this.messages.profile??"Profile",n)):r`<span><i>${this.messages.empty??"Empty"}</i></span>`}</calcite-tree></calcite-tree-item></calcite-tree>`:this.debuggerStore?.isExecuting?r`<div class="preview-empty-state"><calcite-loader scale=s type=indeterminate .label=${this.messages.loading??"Loading"} .text=${this.messages.loading??"Loading"}></calcite-loader></div>`:r`<span class="disabled-state-text">${this.messages.notpaused??"Not paused"}</span>`}renderPreviewPanel(e){switch(e.status){case"loading":return r`<div class="preview-empty-state"><calcite-loader scale=s type=indeterminate .label=${this.messages.loadingpreview??"Loading preview"} .text=${this.messages.loadingpreview??"Loading preview"}></calcite-loader></div>`;case"unavailable":case"error":return r`<span class="disabled-state-text">${e.message}</span>`;case"loaded":let{fields:t,label:i,rows:a}=e;return!a.length||!t.length?r`<span class="disabled-state-text">${this.messages.nopreviewrows??"No preview rows available."}</span>`:r`<div class="preview-table-shell"><div class="preview-table-summary">${this.renderPreviewLabel(i)}</div><div class="table-scroll"><table><thead><tr>${t.map(o=>r`<th><bdi>${o}</bdi></th>`)}</tr></thead><tbody>${a.map(o=>r`<tr>${t.map(s=>r`<td>${this.renderPreviewCell(o.get(s))}</td>`)}</tr>`)}</tbody></table></div></div>`;default:return r`<span class="disabled-state-text">${this.messages.nopreviewloaded??"Select a FeatureSet variable and load a preview."}</span>`}}renderTabs(){let e=this.previewTabsState.activeTabId;return r`<calcite-tabs><calcite-tab-nav slot=title-group><calcite-tab-title .tab=${p} .selected=${e===p} @calciteTabsActivate=${t=>this.activateTab(t.target.tab)}>${this.messages.scope??"Scope"}</calcite-tab-title>${b(this.previewTabsState.tabs,t=>`title-${t.id}`,t=>r`<calcite-tab-title .tab=${t.id} title=${t.label??g} closable .selected=${e===t.id} @calciteTabsActivate=${i=>this.activateTab(i.target.tab)} @calciteTabsClose=${i=>this.closePreviewTab(i.target)}><bdi>${t.title}</bdi></calcite-tab-title>`)}</calcite-tab-nav><calcite-tab .tab=${p} .selected=${e===p}><div class="tab-panel">${this.renderScopePanel()}</div></calcite-tab>${b(this.previewTabsState.tabs,t=>`panel-${t.id}`,t=>r`<calcite-tab .tab=${t.id} .selected=${e===t.id}><div class="tab-panel preview-panel">${this.renderPreviewPanel(t)}</div></calcite-tab>`)}</calcite-tabs>`}render(){let{line:e}=this.debuggerStore?.executionState??{},t=this.breakpoints.find(a=>a.line===e),i=this.breakpoints.findIndex(a=>a.line===e);return r`<div class="console-shell"><div class="breakpoint-header"><arcgis-code-viewer language=arcade class="breakpoint-code-viewer" .lineNumbers=${a=>String(a+(t?.line??e??1)-1)}>${this.getBreakpointCode(t?.line??this.breakpoints[0]?.line??e??1)}</arcgis-code-viewer>${this.breakpoints.length?r`<calcite-action id=${this._breakpointPopoverId??g} scale=s .text=${this.getBreakpointPositionText(i>=0?i+1:1)} text-enabled icon=chevron-down></calcite-action>`:null}${this.renderBreakpointPopover(t?.line??e)}</div><div class="tabs-container">${this.renderTabs()}</div></div>`}};$("arcgis-arcade-debugger-console",v);return v},a,c,d,e,h)
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"breakpoints":"Breakpoints","breakpointposition":"{position} of {count}","nocontent":"No content","scope":"Scope","notpaused":"Not paused","global":"Global","local":"Local","nolocalscope":"No local scope","loadpreview":"Load preview","loading":"Loading","loaderror":"Unable to load data.","nopreviewloaded":"Select a FeatureSet variable in the Scope tab and choose 'Load preview' to inspect sample rows.","loadingpreview":"Loading preview","nopreviewrows":"No preview rows available.","previewloaderror":"Unable to load preview.","previewunavailable":"This preview is no longer available in the current paused state.","showmore":"Show more","uninitialized":"uninitialized"}
|
|
1
|
+
{"breakpoints":"Breakpoints","breakpointposition":"{position} of {count}","nocontent":"No content","scope":"Scope","notpaused":"Not paused","profile":"Profile","global":"Global","local":"Local","nolocalscope":"No local scope","empty":"Empty","loadpreview":"Load preview","loading":"Loading","loaderror":"Unable to load data.","nopreviewloaded":"Select a FeatureSet variable in the Scope tab and choose 'Load preview' to inspect sample rows.","loadingpreview":"Loading preview","nopreviewrows":"No preview rows available.","previewloaderror":"Unable to load preview.","previewunavailable":"This preview is no longer available in the current paused state.","showmore":"Show more","uninitialized":"uninitialized"}
|
|
@@ -17381,7 +17381,7 @@ $.add = (t, e, r, n) => {
|
|
|
17381
17381
|
}), $.add("wasm-simd", () => {
|
|
17382
17382
|
const t = [0, 97, 115, 109, 1, 0, 0, 0, 1, 5, 1, 96, 0, 1, 123, 3, 2, 1, 0, 10, 10, 1, 8, 0, 65, 0, 253, 15, 253, 98, 11];
|
|
17383
17383
|
return WebAssembly.validate(new Uint8Array(t));
|
|
17384
|
-
}), $.add("esri-atomics", "Atomics" in er), $.add("esri-workers", "Worker" in er), $.add("web-feat:cache", "caches" in er), $.add("esri-workers-arraybuffer-transfer", !$("safari") || Number($("safari")) >= 12), $.add("min-workers-pool-size", 2), $.add("max-workers-pool-size", $("esri-mobile") ? 3 : 8), $.add("featurelayer-simplify-thresholds", [0.5, 0.5, 0.5, 0.5]), $.add("featurelayer-simplify-payload-size-factors", [1, 1, 4]), $.add("featurelayer-animation-enabled", !0), $.add("featurelayer-snapshot-enabled", !0), $.add("featurelayer-snapshot-initial-tolerance", 0), $.add("featurelayer-snapshot-point-min-threshold", 8e4), $.add("featurelayer-snapshot-point-max-threshold", 4e5), $.add("featurelayer-snapshot-multipoint-min-threshold", 2e4), $.add("featurelayer-snapshot-multipoint-max-threshold", 1e5), $.add("featurelayer-snapshot-polygon-min-threshold", 2e3), $.add("featurelayer-snapshot-polygon-max-threshold", 2e3), $.add("featurelayer-snapshot-polyline-min-threshold", 2e3), $.add("featurelayer-snapshot-polyline-max-threshold", 2e3), $.add("featurelayer-snapshot-max-vertex-count", 25e4), $.add("featurelayer-snapshot-non-hosted-exceedslimit-enabled", !0), $.add("featurelayer-snapshot-concurrency", 4), $.add("featurelayer-snapshot-allow-editable", !1), $.add("featurelayer-snapshot-coverage", 0.1), $.add("featurelayer-query-max-depth", 4), $.add("featurelayer-query-max-page-size", 8e3), $.add("featurelayer-query-pausing-enabled", !1), $.add("featurelayer-query-tile-concurrency", 4), $.add("featurelayer-query-tile-max-features", 6e5), $.add("featurelayer-advanced-symbols", !1), $.add("featurelayer-pbf", !0), $.add("featurelayer-pbf-statistics", !1), $.add("featurelayer-pbf-true-curves", !0), $.add("feature-layers-workers", !0), $.add("feature-polyline-generalization-factor", 1), $.add("featurelayer-relative-time-queries-enabled", !0), $.add("featurelayer-relative-time-queries-bin-window-public", 1), $.add("featurelayer-relative-time-queries-bin-window-private", 60), $.add("parquetlayer-full-query-feature-count", 2e4), $.add("parquetlayer-hittest-max-feature-count", 1), $.add("parquetlayer-persistence-enabled", !1), $.add("parquetlayer-cache-enabled", !0), $.add("mapview-transitions-duration", 200), $.add("mapview-essential-goto-duration", 200), $.add("mapview-srswitch-adjust-rotation-scale-threshold", 24e6), $.add("mapserver-pbf-version-support", 10.81), $.add("mapservice-popup-identify-max-tolerance", 20), $.add("request-queue-concurrency-global", 50), $.add("request-queue-concurrency-hosted", 16), $.add("request-queue-concurrency-non-hosted", 10), $.add("curve-densification-coarse-segments", 128), $.add("curve-densification-max-segments", 2e3), $.add("curve-densification-min-segments", 3), $.add("curve-densification-pixel-deviation", 0.5), $.add("view-readyState-waiting-delay", 1e3), $.add("gradient-depth-bias", 0.01), $.add("gradient-depth-epsilon", 1e-8), $.add("enable-feature:analysis-drawtool-line-of-sight", !1), $.add("enable-feature:analysis-drawtool-line-of-sight-placement-visuals", !1), $.add("enable-feature:esri-compress-textures", !0), $.add("enable-feature:analysis-new-viewshed-tool", !1), $.add("enable-feature:basemap-groundlayers", !0), $.add("enable-feature:im-shading", !0), $.add("enable-feature:im-vertex-normals", !0), !$("host-webworker") && $("host-browser") && ($.add("esri-csp-restrictions", () => {
|
|
17384
|
+
}), $.add("esri-atomics", "Atomics" in er), $.add("esri-workers", "Worker" in er), $.add("web-feat:cache", "caches" in er), $.add("esri-workers-arraybuffer-transfer", !$("safari") || Number($("safari")) >= 12), $.add("min-workers-pool-size", 2), $.add("max-workers-pool-size", $("esri-mobile") ? 3 : 8), $.add("featurelayer-simplify-thresholds", [0.5, 0.5, 0.5, 0.5]), $.add("featurelayer-simplify-payload-size-factors", [1, 1, 4]), $.add("featurelayer-animation-enabled", !0), $.add("featurelayer-hybrid-tile-enabled", !0), $.add("featurelayer-snapshot-enabled", !0), $.add("featurelayer-snapshot-initial-tolerance", 0), $.add("featurelayer-snapshot-point-min-threshold", 8e4), $.add("featurelayer-snapshot-point-max-threshold", 4e5), $.add("featurelayer-snapshot-multipoint-min-threshold", 2e4), $.add("featurelayer-snapshot-multipoint-max-threshold", 1e5), $.add("featurelayer-snapshot-polygon-min-threshold", 2e3), $.add("featurelayer-snapshot-polygon-max-threshold", 2e3), $.add("featurelayer-snapshot-polyline-min-threshold", 2e3), $.add("featurelayer-snapshot-polyline-max-threshold", 2e3), $.add("featurelayer-snapshot-max-vertex-count", 25e4), $.add("featurelayer-snapshot-non-hosted-exceedslimit-enabled", !0), $.add("featurelayer-snapshot-concurrency", 4), $.add("featurelayer-snapshot-allow-editable", !1), $.add("featurelayer-snapshot-coverage", 0.1), $.add("featurelayer-query-max-depth", 4), $.add("featurelayer-query-max-page-size", 8e3), $.add("featurelayer-query-pausing-enabled", !1), $.add("featurelayer-query-tile-concurrency", 4), $.add("featurelayer-query-tile-max-features", 6e5), $.add("featurelayer-advanced-symbols", !1), $.add("featurelayer-pbf", !0), $.add("featurelayer-pbf-statistics", !1), $.add("featurelayer-pbf-true-curves", !0), $.add("feature-layers-workers", !0), $.add("feature-polyline-generalization-factor", 1), $.add("featurelayer-relative-time-queries-enabled", !0), $.add("featurelayer-relative-time-queries-bin-window-public", 1), $.add("featurelayer-relative-time-queries-bin-window-private", 60), $.add("parquetlayer-full-query-feature-count", 2e4), $.add("parquetlayer-hittest-max-feature-count", 1), $.add("parquetlayer-persistence-enabled", !1), $.add("parquetlayer-cache-enabled", !0), $.add("mapview-transitions-duration", 200), $.add("mapview-essential-goto-duration", 200), $.add("mapview-srswitch-adjust-rotation-scale-threshold", 24e6), $.add("mapserver-pbf-version-support", 10.81), $.add("mapservice-popup-identify-max-tolerance", 20), $.add("request-queue-concurrency-global", 50), $.add("request-queue-concurrency-hosted", 16), $.add("request-queue-concurrency-non-hosted", 10), $.add("curve-densification-coarse-segments", 128), $.add("curve-densification-max-segments", 2e3), $.add("curve-densification-min-segments", 3), $.add("curve-densification-pixel-deviation", 0.5), $.add("view-readyState-waiting-delay", 1e3), $.add("gradient-depth-bias", 0.01), $.add("gradient-depth-epsilon", 1e-8), $.add("enable-feature:analysis-drawtool-line-of-sight", !1), $.add("enable-feature:analysis-drawtool-line-of-sight-placement-visuals", !1), $.add("enable-feature:esri-compress-textures", !0), $.add("enable-feature:analysis-new-viewshed-tool", !1), $.add("enable-feature:basemap-groundlayers", !0), $.add("enable-feature:im-shading", !0), $.add("enable-feature:im-vertex-normals", !0), !$("host-webworker") && $("host-browser") && ($.add("esri-csp-restrictions", () => {
|
|
17385
17385
|
try {
|
|
17386
17386
|
new Function();
|
|
17387
17387
|
} catch {
|
|
@@ -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.95";
|
|
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{J as s,v as e}from"./REL6OK2I.js";import"./Y3KOWWO5.js";import"./3TTFCHAA.js";var r=e(s,{"arcgis-arcade-coding-assistant":[()=>import("./
|
|
2
|
+
import{J as s,v as e}from"./REL6OK2I.js";import"./Y3KOWWO5.js";import"./3TTFCHAA.js";var r=e(s,{"arcgis-arcade-coding-assistant":[()=>import("./BWQEBSSL.js"),"appVersion,assistantsEnabled,closed,closePanel:,disableQuestionAnswerLogging,editorRef:,feedbackServiceUrl,helpBase,insertText:,portalUrl,serviceUrl;destroy"],"arcgis-arcade-debugger-console":[()=>import("./PPV6RAZ3.js"),"debuggerStore:,modelId"],"arcgis-arcade-debugger-output":[()=>import("./7NI24N24.js"),"debuggerStore:,result:"],"arcgis-arcade-editor":[()=>import("./WP6BSOSW.js"),"arcadeAssistant:,customPanels:,editorInstance:,editorOptions:,enableDebugger,hideDocumentationActions,hideSideBar,messageOverrides:,messages:,openedSidePanel,profile:,script,sideActionBarExpanded,snippets:,suggestions:,testData:;getTestResult,setFocus"],"arcgis-arcade-results":[()=>import("./363GMMQ6.js"),"consoleLogs:,hideHeader,loading,openedResultPanel,result:"],"arcgis-arcade-suggestions":[()=>import("./WL2QW4SI.js"),"closed,suggestions:"],"arcgis-code-editor":[()=>import("./GHTOL7NB.js"),"editorInstance:,editorOptions:,language,modelId,value;insertSnippet,insertText,setFocus"],"arcgis-code-editor-shell":[()=>import("./WN4UL6U4.js")],"arcgis-code-viewer":[()=>import("./TSZHSRGH.js"),"language,lineNumbers,round"],"arcgis-editor-variables":[()=>import("./UCX6WHKQ.js"),"closed,heading,loading,messageOverrides:,modelId,variable:"],"arcgis-language-api-panel":[()=>import("./NWLOXWV6.js"),"apiLibrary:,closed,hideDocumentationActions,languageId,loading"],"arcgis-sql-expression-editor":[()=>import("./SATQDL5P.js"),"hideSideBar,messageOverrides:,messages:,profile:,script;setFocus"],"arcgis-sql-layer-editor":[()=>import("./GVMVHGSK.js"),"editorInstance:,editorOptions:,hideSideBar,messageOverrides:,messages:,openedSidePanel,profile:,script;setFocus"]});r({resourcesUrl:import.meta.url});var i=new CSSStyleSheet;i.replaceSync("@layer{:not([hydrated]):is(arcgis-arcade-editor,arcgis-code-editor,arcgis-code-editor-shell,arcgis-code-viewer,arcgis-sql-expression-editor,arcgis-sql-layer-editor){visibility:hidden}}");document.adoptedStyleSheets=[...document.adoptedStyleSheets,i];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)
|
|
@@ -1,11 +1,11 @@
|
|
|
1
1
|
/* COPYRIGHT Esri - https://js.arcgis.com/5.1/LICENSE.txt */
|
|
2
2
|
import { c as ae } from "../../chunks/runtime.js";
|
|
3
3
|
import { css as se, html as d } from "lit";
|
|
4
|
-
import { nothing as
|
|
4
|
+
import { nothing as V, safeClassMap as ne, LitElement as re } from "@arcgis/lumina";
|
|
5
5
|
import { ref as ce, createRef as le } from "lit/directives/ref.js";
|
|
6
6
|
import de from "@arcgis/core/identity/IdentityManager.js";
|
|
7
7
|
import { u as pe } from "../../chunks/useT9n.js";
|
|
8
|
-
import { b as
|
|
8
|
+
import { b as D } from "../../chunks/arcade-defaults.js";
|
|
9
9
|
import N from "@arcgis/core/request.js";
|
|
10
10
|
import { e as ue, a as he } from "../../chunks/utilities.js";
|
|
11
11
|
import { repeat as X } from "lit/directives/repeat.js";
|
|
@@ -69,14 +69,14 @@ async function ke(i) {
|
|
|
69
69
|
}
|
|
70
70
|
const l = u.data;
|
|
71
71
|
r.push(l);
|
|
72
|
-
const v = l.conversationId,
|
|
72
|
+
const v = l.conversationId, q = 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 = Se(v, $,
|
|
79
|
+
const x = Se(v, $, q);
|
|
80
80
|
let k;
|
|
81
81
|
try {
|
|
82
82
|
k = await N(p, {
|
|
@@ -89,8 +89,8 @@ async function ke(i) {
|
|
|
89
89
|
responseType: "json"
|
|
90
90
|
});
|
|
91
91
|
} catch (S) {
|
|
92
|
-
const P = S, oe = P.details?.rawResponse || P.message || String(S),
|
|
93
|
-
throw
|
|
92
|
+
const P = S, oe = P.details?.rawResponse || P.message || String(S), _ = O(oe);
|
|
93
|
+
throw _ ? new A(_) : S;
|
|
94
94
|
}
|
|
95
95
|
const y = k.data;
|
|
96
96
|
if (y.context?.kind === "ArcgisErrorAsContext" && y.context.error)
|
|
@@ -177,15 +177,15 @@ function Re({ popoverContent: i, messages: e }) {
|
|
|
177
177
|
return d`<calcite-action icon=information slot=header-actions-end id=legal-disclaimer text></calcite-action><calcite-popover reference-element=legal-disclaimer .label=${e.legaldisclaimer ?? "Legal disclaimer"} placement=bottom auto-close focus-trap-disabled><div class="contained">${i}</div></calcite-popover>`;
|
|
178
178
|
}
|
|
179
179
|
function Fe({ errorMessage: i, slot: e }) {
|
|
180
|
-
return d`<div class="error-display"><calcite-input-message id=error-message status=invalid icon=exclamation-mark-triangle scale=m slot=${e ??
|
|
180
|
+
return d`<div class="error-display"><calcite-input-message id=error-message status=invalid icon=exclamation-mark-triangle scale=m slot=${e ?? V}>${i}</calcite-input-message></div>`;
|
|
181
181
|
}
|
|
182
182
|
function Me({ active: i, setActive: e, messages: t }) {
|
|
183
183
|
return d`<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>`;
|
|
184
184
|
}
|
|
185
|
-
function
|
|
185
|
+
function Ve({ 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
|
|
188
|
+
function qe({ 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: q, context: $, contextReducedNoticeDismissed: T, setContextReducedNoticeDismissed: I }) {
|
|
189
189
|
const b = $?.contextTooLarge ?? !1, g = Ie({
|
|
190
190
|
promptValidationMessage: r,
|
|
191
191
|
errorMessage: c,
|
|
@@ -197,7 +197,7 @@ function Ve({ isDisabled: i, isReadOnly: e, setQuestion: t, setIsViewingResult:
|
|
|
197
197
|
});
|
|
198
198
|
return d`<div class="text-area-wrapper">${Ce({ notices: g })}<calcite-text-area scale=s resize=vertical .readOnly=${i || e} class=${ne(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
|
Te(x.target), t(x.target.value);
|
|
200
|
-
}} ${ce(a)}><div class="submission-actions-wrapper" slot=footer-start><div class="submission-actions">${$ &&
|
|
200
|
+
}} ${ce(a)}><div class="submission-actions-wrapper" slot=footer-start><div class="submission-actions">${$ && Ve({ 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
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("");
|
|
@@ -215,14 +215,14 @@ function Ve({ isDisabled: i, isReadOnly: e, setQuestion: t, setIsViewingResult:
|
|
|
215
215
|
s(void 0), await u();
|
|
216
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
|
-
const Pe = "https://www.esri.com/en-us/privacy/privacy-statements/privacy-supplement",
|
|
219
|
-
function
|
|
218
|
+
const Pe = "https://www.esri.com/en-us/privacy/privacy-statements/privacy-supplement", _e = "https://www.esri.com/en-us/privacy/privacy-statements";
|
|
219
|
+
function De({ setOpen: i, messages: e, feedback: t, learnMoreUrl: o, setFeedback: a, onSubmit: n }) {
|
|
220
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
221
|
a({ ...t, termsAccepted: c.target.checked });
|
|
222
|
-
}} .disabled=${t.submitting}></calcite-checkbox><span>${C((e.agreement ?? "I agree to the {EsriPrivacyStatement} (and {Supplement}).").replace("{EsriPrivacyStatement}", `<calcite-link href=${
|
|
222
|
+
}} .disabled=${t.submitting}></calcite-checkbox><span>${C((e.agreement ?? "I agree to the {EsriPrivacyStatement} (and {Supplement}).").replace("{EsriPrivacyStatement}", `<calcite-link href=${_e} target="_blank">${e.esriprivacystatement ?? "Esri Privacy Statement"}</calcite-link>`).replace("{Supplement}", `<calcite-link href=${Pe} target="_blank">${e.supplement ?? "Supplement"}</calcite-link>`))}</span></calcite-label><calcite-notice scale=s open closable><span slot=message>${C((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 }) {
|
|
225
|
-
return d`<calcite-block .label=${e.assistantinformation ?? "Assistant information"} slot=${t ??
|
|
225
|
+
return d`<calcite-block .label=${e.assistantinformation ?? "Assistant information"} slot=${t ?? V} expanded class="info-block" scale=s><div class="info-heading-row"><h1 class="info-heading">${e.introducing ?? "Introducing Arcade Assistant (beta)"}</h1><calcite-chip .label=${e.new ?? "New"} kind=brand scale=s>${e.new ?? "New"}</calcite-chip></div>${i ? d`<p>${e.capabilities ?? "The assistant uses artificial intelligence to generate Arcade expressions."}</p><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>${C((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>` : d`<p>${e.useofassistant ?? "The assistant uses artificial intelligence to generate Arcade expressions. To enable Arcade Assistant (beta), the following must be true:"}</p><ul><li>${e.enabledinorg ?? "AI assistants are enabled in the organization settings"}</li><li>${e.enabledbetaapps ?? "Beta apps and capabilities are not blocked"}</li><li>${e.enabledroleprivilege ?? "Your role privilege allows you to use AI assistants"}</li></ul>`}</calcite-block>`;
|
|
226
226
|
}
|
|
227
227
|
function Ne({ messages: i, onProceed: e, onExit: t, helpTopicUrl: o }) {
|
|
228
228
|
return d`<calcite-dialog close-disabled placement=top .heading=${i.welcome ?? "Welcome to the new assistant experience"} slot=dialogs open width-scale=m id=welcome-dialog><h3 class="unstyled-h3">${i.beforeyougetstarted ?? "Before you get started be aware:"}</h3><ul><li>${i.maybeincorrect ?? "AI generated code may occasionally be incorrect or biased. Review carefully."}</li><li>${C((i.pleasereadhelp ?? "Read the Arcade Assistant (beta) {helpTopic} to get started and learn details on security, privacy and limitations.").replace("{helpTopic}", `<calcite-link href=${o} target="_blank">${i.helptopic ?? "help topic"}</calcite-link>`))}</li></ul><calcite-button id=welcome-proceed slot=footer-end @click=${e}>${i.proceed ?? "Proceed"}</calcite-button><calcite-button id=welcome-decline slot=footer-start @click=${t} kind=neutral>${i.exit ?? "Exit"}</calcite-button></calcite-dialog>`;
|
|
@@ -246,7 +246,7 @@ function j({ hidden: i = !1, expanded: e = !1, messages: t, cards: o, heading: a
|
|
|
246
246
|
}
|
|
247
247
|
const Le = ({ card: i, messages: e }) => {
|
|
248
248
|
const t = me(), 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 ??
|
|
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 ?? V}>${i.profileId}</calcite-chip>`;
|
|
250
250
|
}, H = (i) => i.type === "featureSet";
|
|
251
251
|
function te(i) {
|
|
252
252
|
return i && i !== "dataCatalogDatastore" ? i : void 0;
|
|
@@ -603,7 +603,7 @@ class Ze extends re {
|
|
|
603
603
|
e().catch((t) => {
|
|
604
604
|
w("error", this, "Error setting initial context.", { detail: { error: t } });
|
|
605
605
|
}), this.manager.onLifecycle(() => {
|
|
606
|
-
const t =
|
|
606
|
+
const t = D.onModelContextDidChange(async () => {
|
|
607
607
|
e().catch((a) => {
|
|
608
608
|
w("error", this, "Error setting context.", { detail: { error: a } });
|
|
609
609
|
});
|
|
@@ -712,7 +712,8 @@ class Ze extends re {
|
|
|
712
712
|
kind: Ke,
|
|
713
713
|
context: {
|
|
714
714
|
profile_id: n.profileId,
|
|
715
|
-
metadata: [n.metadata]
|
|
715
|
+
metadata: [n.metadata],
|
|
716
|
+
editor_code: a.getValue()
|
|
716
717
|
}
|
|
717
718
|
}
|
|
718
719
|
});
|
|
@@ -770,7 +771,7 @@ class Ze extends re {
|
|
|
770
771
|
}
|
|
771
772
|
async getProfileAndMetadata(e) {
|
|
772
773
|
let t = Q;
|
|
773
|
-
const o =
|
|
774
|
+
const o = D.getEditorProfileForModel(e);
|
|
774
775
|
o?.loaded || await o?.loadSource();
|
|
775
776
|
const a = this.editorRef.profile;
|
|
776
777
|
a && "id" in a && (t = a.id);
|
|
@@ -794,7 +795,7 @@ ${e}` : "";
|
|
|
794
795
|
const e = this.viewState.viewMode === "result", t = this.getHistoryCards();
|
|
795
796
|
return this.assistantsEnabled ? d`<calcite-flow><calcite-flow-item closable heading-level=2 .heading=${this.messages.arcadeassistant ?? "Arcade assistant"} @calciteFlowItemClose=${this.handleClose}>${this.viewState.splashActive && d`<calcite-scrim></calcite-scrim>` || ""}${Ee({ messages: this.messages })}${Re({ messages: this.messages, popoverContent: z({ assistantsEnabled: this.assistantsEnabled, messages: this.messages, helpTopicUrl: this.usingTheAssitantDocUrl }) })}<calcite-shell class="unstyled-shell">${this.viewState.splashActive && Ne({ messages: this.messages, onProceed: () => {
|
|
796
797
|
this.updateViewState({ splashActive: !1 });
|
|
797
|
-
}, helpTopicUrl: this.assistantOverviewDocUrl, onExit: (o) => this.closePanel?.(o) }) || ""}${Me({ active: this.viewState.confirmationActive, setActive: (o) => this.updateViewState({ confirmationActive: o }), messages: this.messages })}${
|
|
798
|
+
}, helpTopicUrl: this.assistantOverviewDocUrl, onExit: (o) => this.closePanel?.(o) }) || ""}${Me({ active: this.viewState.confirmationActive, setActive: (o) => this.updateViewState({ confirmationActive: o }), messages: this.messages })}${qe({ isDisabled: this.viewState.isSubmitting, isReadOnly: !1, setQuestion: this.setQuestionState, setIsViewingResult: (o) => this.updateViewState({ viewMode: o ? "result" : "prompt" }), mode: e ? "refine" : "prompt", textAreaRef: this.textAreaRef, question: this.viewState.question, errorMessage: this.viewState.errorMessage, setErrorMessage: (o) => this.updateViewState({ errorMessage: o }), promptValidationMessage: this.viewState.promptValidationMessage, setPromptValidationMessage: (o) => this.updateViewState({ promptValidationMessage: o }), submitQuestion: this.submitQuestion.bind(this), assistantRef: this.el, messages: this.messages, context: this.viewState.context, contextReducedNoticeDismissed: this.viewState.contextReducedNoticeDismissed, setContextReducedNoticeDismissed: (o) => this.updateViewState({ contextReducedNoticeDismissed: o }) })}<calcite-block-group .label=${this.messages.interactiveblocks ?? "interactive blocks"}>${!e && !this.viewState.isSubmitting && Ue({ messages: this.messages, suggestions: [this.messages.prompsuggestion1 ?? "", this.messages.prompsuggestion2 ?? ""], onSuggestionClick: this.onSuggestionClick }) || ""}<calcite-block .hidden=${!this.viewState.isSubmitting} .heading=${this.messages.generatingresponse ?? "Generating response..."}></calcite-block>${j({
|
|
798
799
|
expanded: e,
|
|
799
800
|
messages: this.messages,
|
|
800
801
|
collapsible: !0,
|
|
@@ -819,7 +820,7 @@ ${e}` : "";
|
|
|
819
820
|
heading: this.messages.recentprompts ?? "Recent prompts",
|
|
820
821
|
hidden: this.viewState.isSubmitting || this.viewState.history.length === 0,
|
|
821
822
|
onCopyCode: this.onCopyCode.bind(this)
|
|
822
|
-
})}</calcite-block-group>${this.viewState.feedback.active ?
|
|
823
|
+
})}</calcite-block-group>${this.viewState.feedback.active ? De({ setOpen: this.handleFeedbackSheetClose, messages: this.messages, onSubmit: this.handleFeedbackSubmit, feedback: this.viewState.feedback, setFeedback: this.setFeedbackState, learnMoreUrl: this.assistantOverviewDocUrl }) : null}</calcite-shell></calcite-flow-item></calcite-flow>` : d`<calcite-flow><calcite-flow-item .selected=${!e} closable heading-level=2 .heading=${this.messages.arcadeassistant ?? "Arcade assistant"} @calciteFlowItemClose=${this.handleClose}>${z({ slot: "content-top", messages: this.messages, assistantsEnabled: this.assistantsEnabled, helpTopicUrl: this.usingTheAssitantDocUrl })}</calcite-flow-item></calcite-flow>`;
|
|
823
824
|
}
|
|
824
825
|
}
|
|
825
826
|
ae("arcgis-arcade-coding-assistant", Ze);
|