@arcgis/coding-components 5.2.0-next.79 → 5.2.0-next.84
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/{VJVVEOIA.js → 327RBVAC.js} +2 -2
- package/dist/cdn/{UM4DUHEA.js → 4OW3EH74.js} +1 -1
- package/dist/cdn/{KUL43ADE.js → 56P6FTYQ.js} +1 -1
- package/dist/cdn/{JTB3WQOI.js → 5MCVDNVO.js} +1 -1
- package/dist/cdn/{ILVYWJS4.js → 6YLBGWGQ.js} +1 -1
- package/dist/cdn/{GATL6PSW.js → AQHAEA62.js} +1 -1
- package/dist/cdn/{6EN2C75J.js → BGUYF4JI.js} +1 -1
- package/dist/cdn/{IVUY4N4B.js → BPPFZDPH.js} +1 -1
- package/dist/cdn/{CKDIUAF7.js → CMZI6WXP.js} +1 -1
- package/dist/cdn/{MM63IOR3.js → DUB4GMXG.js} +1 -1
- package/dist/cdn/{LJQ7Y6HB.js → DYLBKSGK.js} +1 -1
- package/dist/cdn/{3OR3WFUJ.js → JSZLCNQX.js} +1 -1
- package/dist/cdn/{46SGP3IQ.js → MIIHORYJ.js} +1 -1
- package/dist/cdn/{VBQBE2ZZ.js → NLVKEWNR.js} +1 -1
- package/dist/cdn/{4CIH3GTH.js → NNZO447D.js} +1 -1
- package/dist/cdn/{E57Q2B63.js → OLMW3NCS.js} +1 -1
- package/dist/cdn/{RDHNSTZG.js → OY7QVXY5.js} +1 -1
- package/dist/cdn/{6BBVTMSM.js → P6UAZRSN.js} +1 -1
- package/dist/cdn/{BMH6Y42N.js → RBDGSMHN.js} +1 -1
- package/dist/cdn/{CPRY6A4M.js → RG7XCMPX.js} +1 -1
- package/dist/cdn/{VYEWIX5W.js → SKBHZ7VS.js} +1 -1
- package/dist/cdn/{VK7LOSQ5.js → SSVSZDRA.js} +1 -1
- package/dist/cdn/{CRHXEUUE.js → VQB7J2LU.js} +1 -1
- package/dist/cdn/{M5FGCA7R.js → W2NC7KQQ.js} +1 -1
- package/dist/cdn/{VVCAEHDP.js → W77Z4EY4.js} +1 -1
- package/dist/cdn/{DGQ3XT5J.js → XQ24DDUO.js} +1 -1
- package/dist/cdn/{SUFCEUFA.js → XVYE4IMG.js} +1 -1
- package/dist/cdn/assets/code-editor/sql-expr.worker.js +1 -1
- package/dist/cdn/index.js +1 -1
- package/dist/chunks/arcade-defaults.js +2 -2
- package/dist/chunks/language-defaults-base.js +10 -10
- package/dist/chunks/sql-expr-defaults.js +2 -2
- package/dist/chunks/sql-expr-mode.js +1 -1
- package/dist/chunks/sql-layer-defaults.js +15 -15
- package/dist/chunks/sql-layer-mode.js +1 -1
- package/dist/chunks/utils.js +12 -12
- package/dist/components/arcgis-arcade-coding-assistant/customElement.js +1 -1
- package/dist/components/arcgis-editor-variables/customElement.js +1 -1
- package/dist/components/arcgis-sql-layer-editor/customElement.js +1 -1
- package/dist/docs/api.json +1 -1
- package/dist/docs/docs.json +1 -1
- package/dist/docs/web-types.json +1 -1
- package/package.json +7 -7
- /package/dist/cdn/{SMZ3LNZE.js → A77A54OM.js} +0 -0
|
@@ -1,2 +1,2 @@
|
|
|
1
1
|
/* COPYRIGHT Esri - https://js.arcgis.com/5.2/LICENSE.txt */
|
|
2
|
-
import f from"./
|
|
2
|
+
import f from"./NNZO447D.js";import e from"./5MCVDNVO.js";import"./5HKDO4SX.js";import b from"./2WB7S5TQ.js";import{a as d}from"./OLMW3NCS.js";import"./SSVSZDRA.js";import{b as n,d as u}from"./BHSILWSL.js";import"./J4I4EROF.js";import{H as o,L as c,h as l,j as a}from"./A77A54OM.js";import"./BFPEJYVB.js";import"./H6RQVSYM.js";export default $arcgis.t(([,{a:s,h:r,i:p,j:m},{c:h,f:g,g:f,h:b,i:v}])=>{var T=l`:host{display:flex;flex-direction:column;width:100%;background-color:var(--calcite-color-foreground-1);color:var(--calcite-color-text-2);--calcite-block-padding: var(--calcite-spacing-sm);overflow:auto;calcite-flow{height:100%}.disabled-state-text{font-size:var(--calcite-font-size-sm);color:var(--calcite-color-text-3);font-style:italic;display:block;margin:var(--calcite-spacing-md)}[class*=result-value-]{line-height:1.25rem}}`;function x(t,e){return h(t)||b(t)||f(t)||g(t)?e??"Output":t.arcadeType}var i=class extends o{constructor(){super(...arguments),this.messages=d()}static{this.properties={debuggerStore:0,result:0,outputTitle:1}}static{this.styles=[T,m,p()]}load(){this.manager.onLifecycle(()=>{let e=n(this.el,["class"],this.updateTheme.bind(this));return this.updateTheme(),()=>e()})}willUpdate(e){e.has("result")&&this.result&&this.debuggerStore?.lazyTreeState.reset()}updateTheme(){u(this.el)==="dark"?this.elementInternals.states.add(r):this.elementInternals.states.delete(r)}render(){if(!this.result)return a`<span class="disabled-state-text">${this.messages.nooutput??"No output available."}</span>`;let e=this.debuggerStore?.lazyTreeState;return e?a`<calcite-tree .scale=${s.scale} @calciteTreeSelect=${s.oncalciteTreeSelect} .lines=${s.lines} .selectionMode=${s.selectionMode}>${v({expanded:!0,name:x(this.result,this.outputTitle),value:this.result,messages:this.messages,path:this.result.arcadeType,lazyTreeState:e})}</calcite-tree>`:a`<span class="disabled-state-text">${this.messages.nooutput??"No output available."}</span>`}};c("arcgis-arcade-debugger-output",i);return i},b,e,f)
|
|
@@ -1,4 +1,4 @@
|
|
|
1
1
|
/* COPYRIGHT Esri - https://js.arcgis.com/5.2/LICENSE.txt */
|
|
2
|
-
import{f as d}from"./BZWB7A55.js";import{r as c}from"./
|
|
2
|
+
import{f as d}from"./BZWB7A55.js";import{r as c}from"./A77A54OM.js";function p(t,u,a,r){if(!u)return[];let e=Array.isArray(u)?u:[u];if(!e.length)return[];let m=c(a);return t.filter(s=>e.some(i=>m.test(String(s[i]??""))))}function f(t){return t?`${t.portal.url}/home/item.html?id=${t.id}`:""}function C(t,u,a="add",r){if(!t)return;let e=t.getSelection(),m=e&&(e.startLineNumber!==e.endLineNumber||e.startColumn!==e.endColumn),s=[],i=t.getValue()??"";if(a==="replace"){let n=r?`${r}
|
|
3
3
|
${u}`:u,l=t.getModel(),o=l?.getLineCount()??1,g=l?.getLineMaxColumn(o)??1;s=[{range:{startLineNumber:1,startColumn:1,endLineNumber:o,endColumn:g},text:n}]}else{let n=m?{startLineNumber:e.startLineNumber,startColumn:e.startColumn,endLineNumber:e.endLineNumber,endColumn:e.endColumn}:(()=>{let o=t.getPosition();return{startLineNumber:o?.lineNumber??1,startColumn:o?.column??1,endLineNumber:o?.lineNumber??1,endColumn:o?.column??1}})(),l=!1;if(r){let o=r.replace(/[.*+?^${}()|[\]\\]/gu,"\\$&");l=!new RegExp(`^\\s*${o}\\s*$`,"mu").test(i)}l&&s.push({range:{startLineNumber:1,startColumn:1,endLineNumber:1,endColumn:1},text:`${r}
|
|
4
4
|
`}),s.push({range:n,text:u})}try{t.pushUndoStop(),t.executeEdits("insertText",s),t.pushUndoStop(),t.focus()}catch(n){console.error("Failed to edit model:",n)}}function x(t){try{return d(t)}catch{return t}}var L=t=>t.split(/\r\n|\r|\n/u).length-1,h=(t,u)=>[...u].sort((a,r)=>r.range.startLineNumber-a.range.startLineNumber||r.range.startColumn-a.range.startColumn).reduce((a,r)=>{let e=r.range.startLineNumber,m=r.range.endLineNumber,s=m-e,i=L(r.text)-s;return a.flatMap(n=>n<e?[n]:s===0?[n>=e?n+i:n]:n>m?[n+i]:n===e?[n]:[])},[...t]);export{p as a,f as b,C as c,x as d,h as e};
|
|
@@ -1,2 +1,2 @@
|
|
|
1
1
|
/* COPYRIGHT Esri - https://js.arcgis.com/5.2/LICENSE.txt */
|
|
2
|
-
import{g as P,h as O}from"./BHSILWSL.js";import{a as E,b,c as h,d as u,e as C,f as y,m as f,o as x}from"./
|
|
2
|
+
import{g as P,h as O}from"./BHSILWSL.js";import{a as E,b,c as h,d as u,e as C,f as y,m as f,o as x}from"./A77A54OM.js";var A=e=>(...n)=>{let t=u(),s=new e(...n),o=s.exports;h(t.at(-1));let r=s.component.manager;r.W(s,o),s.watchExports(r.W.bind(r,s)),C(s);let i=[s.component,...t].reverse();return f(i,a=>a===void 0?void 0:N(s,a,o),o)},N=(e,{host:n,key:t,isReactive:s},o)=>{let r=n,i=r[t]!==e.exports,a=r[t]!==o,c=o!==e.exports;if(i&&!a&&c&&(r[t]=e.exports),n===e.component){if(s){let p=e.component.manager;a&&p.W(e,r[t]),e.onUpdate(m=>{if(m.has(t)){let v=r[t];v!==e.exports&&p.W(e,v)}})}e.O=s?void 0:t}let d=e.component.constructor.elementProperties.get(t)?.readOnly;e.watchExports(()=>{r[t]!==e.exports&&(d?y(()=>{r[t]=e.exports}):r[t]=e.exports)})};var w=e=>_(void 0,e);var g=class extends x{constructor(n,t){super(n);let s=this.exports;try{b(this.component);let o=t(this.component,this),r=this.exports!==s;if(E(o)){r||this.setProvisionalExports(o);let i=o.then(a=>{this.exports=a,super.catchUpLifecycle()}).catch(a=>{this.P.reject(a)});this.onLoad(async()=>await i)}else(!r||o!==void 0)&&(this.exports=o),queueMicrotask(()=>super.catchUpLifecycle())}catch(o){this.P.reject(o)}}catchUpLifecycle(){}},_=A(g);var ie=w;var ce=e=>(n={})=>w((t,s)=>{let o=P(t.el),r={_lang:o.lang,_t9nLocale:o.t9nLocale,_loading:!0},i=t;s.onLifecycle(()=>O(t.el,()=>e("./assets"),({t9nLocale:c,t9nStrings:l,lang:d})=>{let p={...l,_lang:d,_t9nLocale:c,_loading:!1};s.exports=p;let m=l.componentLabel;typeof m=="string"&&"label"in t&&t.label==null&&(t.label??=m),a(i.messageOverrides)},n.name));let a=c=>{let l=s.exports,d=l._original??l,p=L(d,c);c&&(p._original=d),s.exports=p};return"messageOverrides"in i&&s.onUpdate(c=>{c.has("messageOverrides")&&a(i.messageOverrides)}),n.blocking?(s.setProvisionalExports(r,!1),s.ready):r}),L=(e,n)=>{if(!n)return e;let t={...e};return Object.entries(n).forEach(([s,o])=>{e[s]!==void 0&&(typeof o=="object"?t[s]=L(e[s],o):t[s]=o??e[s])}),t};export{ie as a,ce as b};
|
|
@@ -1,2 +1,2 @@
|
|
|
1
1
|
/* COPYRIGHT Esri - https://js.arcgis.com/5.2/LICENSE.txt */
|
|
2
|
-
import h from"./CKDIUAF7.js";import{a as b}from"./6BBVTMSM.js";import e from"./4CIH3GTH.js";import d from"./JTB3WQOI.js";import"./5HKDO4SX.js";import c from"./7Z6G332Z.js";import"./MZMKV7FA.js";import a from"./2WB7S5TQ.js";import{a as T}from"./E57Q2B63.js";import{a as y}from"./VK7LOSQ5.js";import{b as S,d as k}from"./BHSILWSL.js";import"./J4I4EROF.js";import"./XEK22IDA.js";import{a as E}from"./CMRUQ3BN.js";import"./UFF53OEH.js";import"./NHREAORV.js";import{H as w,I as x,J as g,L as $,h as u,j as r,t as f}from"./SMZ3LNZE.js";import"./BFPEJYVB.js";import{ul as P}from"./DSQ2DQQL.js";import"./H6RQVSYM.js";export default $arcgis.t(([,{a:p},{h:h,i:L,j:M},{a:z,b:C,c:m,d:A,e:B,f:I,g:N,i:F,j:D},{a:l}])=>{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(h):this.elementInternals.states.delete(h)}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||!m(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||!m(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=e?this.breakpoints.find(a=>a.line===e):this.breakpoints[0],i=e?this.breakpoints.findIndex(a=>a.line===e):0;return r`<div class="console-shell">${this.breakpoints.length&&r`<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)
|
|
2
|
+
import h from"./CMZI6WXP.js";import{a as b}from"./P6UAZRSN.js";import e from"./NNZO447D.js";import d from"./5MCVDNVO.js";import"./5HKDO4SX.js";import c from"./7Z6G332Z.js";import"./MZMKV7FA.js";import a from"./2WB7S5TQ.js";import{a as T}from"./OLMW3NCS.js";import{a as y}from"./SSVSZDRA.js";import{b as S,d as k}from"./BHSILWSL.js";import"./J4I4EROF.js";import"./XEK22IDA.js";import{a as E}from"./CMRUQ3BN.js";import"./UFF53OEH.js";import"./NHREAORV.js";import{H as w,I as x,J as g,L as $,h as u,j as r,t as f}from"./A77A54OM.js";import"./BFPEJYVB.js";import{ul as P}from"./DSQ2DQQL.js";import"./H6RQVSYM.js";export default $arcgis.t(([,{a:p},{h:h,i:L,j:M},{a:z,b:C,c:m,d:A,e:B,f:I,g:N,i:F,j:D},{a:l}])=>{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(h):this.elementInternals.states.delete(h)}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||!m(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||!m(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=e?this.breakpoints.find(a=>a.line===e):this.breakpoints[0],i=e?this.breakpoints.findIndex(a=>a.line===e):0;return r`<div class="console-shell">${this.breakpoints.length&&r`<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,3 +1,3 @@
|
|
|
1
1
|
/* COPYRIGHT Esri - https://js.arcgis.com/5.2/LICENSE.txt */
|
|
2
|
-
import{b as x}from"./43C5J4GE.js";import e from"./
|
|
2
|
+
import{b as x}from"./43C5J4GE.js";import e from"./XVYE4IMG.js";import c from"./AQHAEA62.js";import{c as v}from"./SKBHZ7VS.js";import a from"./STN3LSQR.js";import"./MZMKV7FA.js";import{a as S}from"./OLMW3NCS.js";import"./SSVSZDRA.js";import"./BHSILWSL.js";import"./J4I4EROF.js";import"./BZWB7A55.js";import"./XEK22IDA.js";import"./CMRUQ3BN.js";import"./UFF53OEH.js";import"./NHREAORV.js";import{F as _,G as b,H as u,I as f,L as E,h as g,j as o,n as d,t as m}from"./A77A54OM.js";import{b as r}from"./BFPEJYVB.js";import"./DSQ2DQQL.js";import"./H6RQVSYM.js";export default $arcgis.t(([,,,,,,,{E:n},{c:c},{a:$,b:y,c:I,d:P}])=>{var B=g`:host{height:100%}calcite-tooltip:not([calcite-hydrated])>*{display:none}`,p=class extends u{constructor(){super(...arguments),this._codeEditorElt=_(),this._disposables=[],this._modelId=m(),this.messages=S(),this._preparing=!1,this._resolvedLanguage=c,this.sideActionBarExpanded=!1,this.script="",this.hideSideBar=!1,this.openedSidePanel="none",this.arcgisDiagnosticsChange=d({bubbles:!1}),this.arcgisScriptChange=d({bubbles:!1})}static{this.properties={_editorProfile:16,_preparing:16,_resolvedLanguage:16,sideActionBarExpanded:16,profile:0,script:1,hideSideBar:5,messageOverrides:0,openedSidePanel:3,editorOptions:0,editorInstance:32}}static{this.styles=[B]}get editorInstance(){return this._codeEditorElt.value?.editorInstance}async setFocus(){await this._codeEditorElt.value?.setFocus()}async load(){await this._updateDataModelDeps().catch(r(this))}willUpdate(e){e.has("profile")&&this._updateDataModelDeps().catch(r(this))}async loaded(){let e=x();this._disposables.push(e.onDiagnosticsChange(t=>{t.uri.toString()===this._modelId&&!this._preparing&&this.arcgisDiagnosticsChange.emit(t.diagnostics)}))}disconnectedCallback(){for(super.disconnectedCallback();this._disposables.length;)this._disposables.pop()?.dispose();P().forEach(e=>e.disposeForModel(this._modelId))}async _updateDataModelDeps(){this._preparing=!0;try{let e=await $(this.profile);e!==this._resolvedLanguage&&(I(this._resolvedLanguage)?.disposeForModel(this._modelId),this._resolvedLanguage=e);let t=y(this._resolvedLanguage);await t.setProfileForModel(this._modelId,this.profile,{locale:this.messages._t9nLocale}),this._editorProfile=t.getEditorProfileForModel(this._modelId)}catch{this._editorProfile=void 0,this._resolvedLanguage=c}finally{this._preparing=!1}}_toggleSideActionBarExpanded(){this.sideActionBarExpanded=!this.sideActionBarExpanded}_toggleSidePanel(e){this.openedSidePanel=this.openedSidePanel===e?"none":e}_onCodeEditorValueChange(e){e.stopPropagation(),this.script=e.detail,this.arcgisScriptChange.emit(e.detail)}async _onItemSelected(e){e.stopPropagation();let t=this._getSelectedTableVariable(e.detail);if(!t){this._codeEditorElt.value?.insertText(e.detail).catch(r(this));return}await t.loadSource();let a,h=t.fieldInfos.filter(i=>i.type==="geometry"&&!a?(a=i.name,!0):i.type!=="geometry").map(i=>i.name).filter(Boolean),C=`select ${h.length?h.join(", "):"*"} from ${t.snippet}`,s=this._codeEditorElt.value?.editorInstance;v(s,C,"replace",""),s?.getAction("editor.action.formatDocument")?.run();let l=s?.getModel();if(l){let i=l.getLineCount(),L=l.getLineMaxColumn(i);s?.setPosition({lineNumber:i,column:L})}}_getTablesVariable(){return this._editorProfile?.variables.find(n)}_getSelectedTableVariable(e){let t=this._getTablesVariable();if(n(t))return t.tableVariables.find(a=>a.snippet===e)}render(){let e=this._getTablesVariable(),t=String(this.messages.placeholderexample??"Example: {sqlQueryExample}").replace("{sqlQueryExample}","select field1, field2 from db.dataset"),a=`${this.messages.placeholder??"Start filtering data using SQL query syntax"}
|
|
3
3
|
${t}`;return o`<arcgis-code-editor-shell><arcgis-code-editor slot=editor .language=${this._resolvedLanguage} .modelId=${this._modelId} .value=${this.script??""} @arcgisValueChange=${this._onCodeEditorValueChange} .editorOptions=${{placeholder:a,...this.editorOptions}} ${b(this._codeEditorElt)}></arcgis-code-editor>${!this.hideSideBar&&o`<arcgis-editor-variables slot=side-panel .variable=${e} .heading=${this.messages.tables??"Tables"} .messageOverrides=${{profileempty:this.messages.profileempty}} .closed=${this.openedSidePanel!=="variables"} class=${f(this.openedSidePanel==="variables"?"":"hidden")} .loading=${this._preparing} .modelId=${this._modelId} @arcgisInternalItemSelected=${this._onItemSelected} @arcgisInternalClosePanel=${()=>{this.openedSidePanel="none"}} data-panel-name=none></arcgis-editor-variables><calcite-action-bar slot=side-action-bar .expanded=${this.sideActionBarExpanded} position=end @calciteActionBarToggle=${this._toggleSideActionBarExpanded}><calcite-action id=tables-action .text=${this.messages.tables??"Tables"} icon=table .active=${this.openedSidePanel==="variables"} data-panel-name=variables @click=${()=>this._toggleSidePanel("variables")}></calcite-action>${!this.sideActionBarExpanded&&o`<calcite-tooltip reference-element=tables-action><span>${this.messages.tables??"Tables"}</span></calcite-tooltip>`||""}</calcite-action-bar>`||""}</arcgis-code-editor-shell>`}};E("arcgis-sql-layer-editor",p);return p},"portal/PortalItem","WebMap","WebScene","layers/FeatureLayer","applications/Components/arcadeEditorUtils","core/Error","portal/Portal",a,c,e)
|
|
@@ -1,4 +1,4 @@
|
|
|
1
1
|
/* COPYRIGHT Esri - https://js.arcgis.com/5.2/LICENSE.txt */
|
|
2
|
-
import{a as N}from"./6BBVTMSM.js";import c from"./VJVVEOIA.js";import b from"./GATL6PSW.js";import{c as ae,d as se}from"./VYEWIX5W.js";import a from"./STN3LSQR.js";import{d as oe}from"./MZMKV7FA.js";import{a as te}from"./E57Q2B63.js";import"./VK7LOSQ5.js";import"./BHSILWSL.js";import"./J4I4EROF.js";import"./BZWB7A55.js";import"./XEK22IDA.js";import"./CMRUQ3BN.js";import"./UFF53OEH.js";import"./NHREAORV.js";import{F as W,G as K,H as X,I as Z,J as M,L as ee,h as Q,j as d,k as j,l as V,t as H,x as G,y as J,z as Y}from"./SMZ3LNZE.js";import{a as w}from"./BFPEJYVB.js";import"./DSQ2DQQL.js";import"./H6RQVSYM.js";export default $arcgis.t(([xe,ne,Se,re,ce,{getDeclaredVoxelMembers:Te,getDeclaredPixelMembers:Ae},Ce,{property:b,subclass:Ie},{G:q,w:ie,x:F},,P])=>{var C=class extends Y{constructor(e){if(super(e),this.it=V,e.type!==G.CHILD)throw Error(this.constructor.directiveName+"() can only be used in child bindings")}render(e){if(e===V||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:[]}}};C.directiveName="unsafeHTML",C.resultType=1;var I=J(C);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-dialog{--calcite-dialog-content-space: initial;--calcite-dialog-size-y: initial}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:a,details:o,source:n}){super(e),this.name="ArcadeAssistantError",this.code=t,this.subCode=a,this.details=o,this.source=n}};function le(i){if(!i)return;let e=i.indexOf('{"error":');if(e!==-1)try{let t=i.slice(e),a=JSON.parse(t);if(a&&typeof a=="object"&&a.error)return a.error}catch{return}}async function Ee(i){let{baseUrl:e,skillId:t,message:a,authToken:o,previousConversationId:n,context:r}=i,p=t?`${e}/skills/${t}/chat`:`${e}/chat`,c=[],s={message:a,context:r};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(f){let v=f,x=v.details?.rawResponse||v.message||String(f),T=le(x);throw T?new $(T):f}let l=u.data;c.push(l);let h=l.conversationId,S=l.inquiryId,k=l.sequenceNumber;async function E(){let f=0,v=100;for(;f<v;){await new Promise(A=>setTimeout(A,1e3));let x=Re(h,k,S),T;try{T=await ne(p,{method:"post",headers:{"Content-Type":"application/json",token:o},body:JSON.stringify(x),responseType:"json"})}catch(A){let L=A,ke=L.details?.rawResponse||L.message||String(A),B=le(ke);throw B?new $(B):A}let y=T.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(c.push(y),k=y.sequenceNumber,f++,!y.hasMore)break}if(f===v)throw new $({message:"Request timed out",code:"TIMEOUT",source:"polling"})}let R=120*1e3;return await Promise.race([E(),new Promise((f,v)=>setTimeout(()=>v(new $({message:"Request timed out",code:"TIMEOUT",source:"hard-timeout"})),R))]),c}function Re(i,e,t){return{conversationId:i,inquiryId:t,ackSequenceNumber:e}}function Ve(i){return i.message.match(/Error in prompt shield/u)?"I'm having trouble with this request. Try again by rephrasing the question.":i.code==="TIMEOUT"?"Request timed out. Try again by re-asking the same question or rephrasing it.":i.message}var Fe=({notices:i})=>i.length?d`<div class="border-block-end">${N(i,e=>e.id??e.title,e=>d`<calcite-notice class="submission-notice" .icon=${e.icon} .kind=${e.kind} scale=s open .closable=${e.closable} @calciteNoticeClose=${()=>e.onClose?.()}><div slot=title>${e.title}</div>${e.message&&d`<div slot=message>${e.message}</div>`||""}${e.actionLinkMessage&&e.onAction&&d`<calcite-link slot=link @click=${()=>e.onAction?.()}>${e.actionLinkMessage}</calcite-link>`||""}</calcite-notice>`)}</div>`:null,qe=i=>{let e=i.value.length,t=72,a=180,o=i.offsetWidth,n=Math.max(1,Math.floor(o/8)),r=Math.ceil(e/n),p=t+(r-2)*24;i.style.setProperty("--calcite-text-area-min-height",`${Math.min(p,a)}px`)},Pe=({promptValidationMessage:i,errorMessage:e,contextTooBig:t,contextReducedNoticeDismissed:a,setContextReducedNoticeDismissed:o,setErrorMessage:n,messages:r})=>{let p=[];if(i&&p.push({id:"prompt-validation",kind:"danger",icon:"exclamation-mark-triangle",title:i,closable:!0}),e&&p.push({id:"assistant-error",kind:"danger",icon:"exclamation-mark-triangle",title:e,closable:!0,onClose:()=>n(void 0)}),t&&!a){let c=r.contextreduced??"Context reduced",s=r.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:c,message:s,closable:!0,onClose:()=>o(!0)})}return p};function Ne({messages:i}){return d`<calcite-chip slot=header-actions-end scale=s appearance=outline-fill .label=${i.beta??"Beta"}>${i.beta??"Beta"}</calcite-chip>`}function _e({popoverContent:i,messages:e}){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>`}function De({errorMessage:i,slot:e}){return d`<div class="error-display"><calcite-input-message id=error-message status=invalid icon=exclamation-mark-triangle scale=m slot=${e??M}>${i}</calcite-input-message></div>`}function Ue({active:i,setActive:e,messages:t}){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>`}function Oe({context:i,messages:e}){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}function ze({isDisabled:i,isReadOnly:e,setQuestion:t,setIsViewingResult:a,textAreaRef:o,question:n,errorMessage:r,setErrorMessage:p,promptValidationMessage:c,setPromptValidationMessage:s,submitQuestion:u,messages:l,mode:h,assistantRef:S,context:k,contextReducedNoticeDismissed:E,setContextReducedNoticeDismissed:R}){let f=k?.contextTooLarge??!1,v=Pe({promptValidationMessage:c,errorMessage:r,contextTooBig:f,contextReducedNoticeDismissed:E,setContextReducedNoticeDismissed:R,setErrorMessage:p,messages:l});return d`<div class="text-area-wrapper">${Fe({notices:v})}<calcite-text-area scale=s resize=vertical .readOnly=${i||e} class=${Z(v.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=>{qe(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:l})||""}<div class="align-inline-end gaps"><calcite-button round kind=neutral .hidden=${h!=="refine"} icon-start=arrow-left icon-flip-rtl=both appearance=solid scale=s .disabled=${i} @click=${async()=>{a(!1),t("")}} .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=${h!=="refine"} icon-start=arrow-left icon-flip-rtl=both appearance=solid .disabled=${i} @click=${async()=>{a(!1),t("")}} class="hidden-below-380" scale=s>${l.startover??"Start Over"}</calcite-button><calcite-button round scale=s icon-end=effects appearance=solid .loading=${i} .disabled=${i} @click=${async()=>{if(p(""),!n){s(l.enteraprompt??"Please enter a prompt");return}s(void 0),await u()}} class="hidden-below-380">${h==="prompt"?l.ask??"Generate":l.refine??"Refine"}</calcite-button><calcite-button round scale=s icon-end=effects appearance=solid .loading=${i} .disabled=${i} id=small-submit-button @click=${async()=>{if(p(""),!n){s(l.enteraprompt??"Please enter a prompt");return}s(void 0),await u()}} class="hidden-above-380" .label=${h==="prompt"?l.ask??"Generate":l.refine??"Refine"}></calcite-button><calcite-tooltip reference-element=small-submit-button placement=top-start class="hidden-above-380">${h==="prompt"?l.ask??"Generate":l.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:i,messages:e,feedback:t,learnMoreUrl:a,setFeedback:o,onSubmit:n}){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=${r=>o({...t,text:r.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=${r=>{o({...t,termsAccepted:r.target.checked})}} .disabled=${t.submitting}></calcite-checkbox><span>${I((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>${I((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=${a} 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}function de({promptingEnabled:i,messages:e,slot:t,helpTopicUrl:a}){return d`<calcite-block .label=${e.assistantinformation??"Assistant information"} slot=${t??M} 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>${I((e.seedocumentation??"Please see the {documentation} for more information, including limitations and additional resources.").replace("{documentation}",`<calcite-link href=${a} 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>`}function je({messages:i,onProceed:e,onExit:t,helpTopicUrl:a}){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>${I((i.pleasereadhelp??"Read the Arcade Assistant (beta) {helpTopic} to get started and learn details on security, privacy and limitations.").replace("{helpTopic}",`<calcite-link href=${a} 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>`}function He({messages:i,suggestions:e,onSuggestionClick:t}){return d`<calcite-block .heading=${i.promptsuggestions} expanded collapsible id=suggestion-block scale=s><div class="suggestions">${e.map(a=>d`<calcite-button round scale=s appearance=outline-fill kind=neutral .label=${i.promptsuggestion} class="suggestion-button" @click=${()=>t?.(a)}>${a}</calcite-button>`)}</div></calcite-block>`}var pe=200;function ue({hidden:i=!1,expanded:e=!1,messages:t,cards:a,heading:o,collapsible:n=!1,showEffectsIcon:r=!1,onCopyCode:p,standalone:c}){return d`<calcite-block .hidden=${i} id=result-block .heading=${o??t.besteffort??"Here is the assistant's best effort"} .expanded=${e} .collapsible=${n}>${r&&d`<calcite-chip .label=${t.assistantresponses??"Assistant responses"} slot=content-start icon=effects scale=m class="suggestion-chips"></calcite-chip>`||""}<calcite-card-group .label=${t.assistantresponses??"Assistant responses"}>${N(a,s=>s.conversationId,s=>d`<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}-${c?"standalone":"list"}`} @click=${u=>{let l=u.currentTarget;navigator.clipboard.writeText(s.priorPrompt).then(()=>{l.setAttribute("data-copied","true"),setTimeout(()=>l.removeAttribute("data-copied"),1500)})}}></calcite-action><calcite-popover .referenceElement=${`copy-prompt-${s.conversationId}-${c?"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}-${c?"standalone":"list"}`} placement=top-start class="copy-tooltip">${t.copyprompttoclipboard??"Copy prompt to clipboard"}</calcite-tooltip></div>${s.message&&c&&d`<div class="response-error-container">${De({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&&!c&&d`<calcite-tooltip .referenceElement=${`response-chip-${s.conversationId}-error`} placement=top-start>${s.message}</calcite-tooltip><calcite-chip .id=${`response-chip-${s.conversationId}-error`} .label=${t.error??"Error"} scale=s appearance=outline icon=exclamation-mark-triangle-f class="response-error-chip"></calcite-chip>`||""}${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}-${c?"standalone":"list"}`}></calcite-button><calcite-tooltip class="hidden-above-380" .referenceElement=${`add-to-editor-button-${s.conversationId}-${c?"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}-${c?"standalone":"list"}`}></calcite-button><calcite-tooltip .referenceElement=${`replace-${s.conversationId}-${c?"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 l=u.currentTarget;p(s.code).then(()=>{l.setAttribute("data-copied","true"),setTimeout(()=>l.removeAttribute("data-copied"),1500)})}} class="response-secondary-action-button" .id=${`copy-response-${s.conversationId}-${c?"standalone":"list"}`}></calcite-button><calcite-popover .referenceElement=${`copy-response-${s.conversationId}-${c?"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}-${c?"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}-${c?"standalone":"list"}`}></calcite-action><calcite-tooltip .referenceElement=${`thumbs-up-${s.conversationId}-${c?"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}-${c?"standalone":"list"}`}></calcite-action><calcite-tooltip .referenceElement=${`thumbs-down-${s.conversationId}-${c?"standalone":"list"}`} placement=top-start><span>${t.unhelpful??"Unhelpful"}</span></calcite-tooltip></div></calcite-card>`)}</calcite-card-group></calcite-block>`}var Ge=({card:i,messages:e})=>{let t=H(),a=`response-chip-profile-${i.conversationId}-${t}`,o=(e.profilecontextlabel??"Profile context: {profileId}").replace("{profileId}",i.profileId);return d`<calcite-tooltip .referenceElement=${a} placement=top-start class="contained-popover-or-tooltip">${o}</calcite-tooltip><calcite-chip .label=${i.profileId} scale=s appearance=outline icon=map-information id=${a??M}>${i.profileId}</calcite-chip>`},me=i=>i.type==="featureSet";function we(i){return i&&i!=="dataCatalogDatastore"?i:void 0}var _=i=>{if(!ie(i))return[];let e=[];return i.relationships?.forEach(t=>{e.push(t.toJSON())}),e},D=i=>i.length>0?{relationships:i}:{},Je=i=>oe(i).map(e=>({alias:e.alias,name:e.name,type:e.type,...e.domain?{domain:e.domain}:{}})),U=i=>i?{fields:Je(i)}:{fields:[]};async function he(i){let e=await i.loadSource(),t=F(e)&&e.isTable,a=_(e);return{name:i.name,type:"featureSet",isTable:t,...U(e?.fields),...D(a)}}async function $e(i){switch(i.type){case"feature":{let t=await i.loadSource(),a=_(t);return{name:i.name,type:i.type,...U(t?.fields),...D(a)}}case"featureSet":{let t=await i.loadSource(),a=F(t)&&t.isTable;return{name:i.name,type:"featureSet",...a?{isTable:a}:{},...U(t?.fields),...D(_(t))}}case"featureSetCollection":{let t=await i.loadSource(),a=t?.layers.filter(me)??[],o=t?.tables.filter(me)??[],n=await Promise.all(a.map(he)),r=await Promise.all(o.map(he));return{name:i.name,type:"featureSetCollection",layers:n,tables:r}}case"dictionary":{let t=await Promise.all(i.dictionaryVariables.filter(q).map($e));return{name:i.name,type:"dictionary",attributes:t}}case"pixel":{let t=await i.loadSource();if(!t)return{name:i.name,type:"pixel"};let a=await Ae(t);return{name:i.name,type:"pixel",members:a.map(ge)}}case"voxel":{let t=await i.loadSource();if(!t)return{name:i.name,type:"voxel"};let a=await Te(t);return{name:i.name,type:"voxel",members:a.map(ge)}}case"array":let e=we(i.elementType.type);return{name:i.name,type:"array",...e?{elementType:e}:{}};case"number":case"text":case"boolean":case"date":case"knowledgeGraph":case"dateOnly":case"geometry":case"time":return{name:i.name,type:i.type}}}function ge(i){if(i.type==="array"){let e=we(i.elementType.type);return{name:i.name,type:"array",...e?{elementType:e}:{}}}return{name:i.name,type:i.type}}async function Ye(i){return{variables:await Promise.all(i.variables.filter(q).map($e))}}var We=1e5;function Ke(i){let e=new TextEncoder().encode(i).length;return Math.ceil(e/3.5)}function O(i){return Ke(JSON.stringify(i))}function Xe(i){let e=a=>({name:a.name,type:a.type,...a.isTable?{isTable:a.isTable}:{},...a.relationships?{relationships:a.relationships}:{}}),t=a=>{switch(a.type){case"feature":case"featureSet":case"knowledgeGraph":return{name:a.name,type:a.type,..."isTable"in a&&a.isTable?{isTable:a.isTable}:{},..."relationships"in a?{relationships:a.relationships}:{}};case"featureSetCollection":return{name:a.name,type:"featureSetCollection",layers:a.layers.map(e),tables:a.tables.map(e)};case"dictionary":return{name:a.name,type:"dictionary",attributes:a.attributes.map(t)};case"pixel":case"voxel":return{name:a.name,type:a.type};case"array":return{name:a.name,type:"array",...a.elementType?{elementType:a.elementType}:{}};default:return a}};return{variables:i.variables.map(t)}}function Ze(i){let e=i.variables,t=e.length,a=e.find(n=>n.name==="$feature")??e.find(n=>n.type==="feature")??e[0],o=a?[a]:[];return{context:{variables:o},wasReduced:t!==o.length,reducedToVariableName:a?.name}}function et(i){return O(i)>We}var tt=Object.defineProperty,it=Object.getOwnPropertyDescriptor,g=(i,e,t,a)=>{for(var o=a>1?void 0:a?it(e,t):e,n=i.length-1,r;n>=0;n--)(r=i[n])&&(o=(a?r(e,t,o):r(o))||o);return a&&o&&tt(e,t,o),o},m=class extends Ce{constructor(i){super(i),this.viewMode="prompt",this.confirmationActive=!1,this.contextReducedNoticeDismissed=!1,this.splashActive=!0,this.isSubmitting=!1,this.question="",this.history=[],this.feedback={active:!1}}};g([b()],m.prototype,"viewMode",2);g([b()],m.prototype,"confirmationActive",2);g([b()],m.prototype,"contextReducedNoticeDismissed",2);g([b()],m.prototype,"splashActive",2);g([b()],m.prototype,"isSubmitting",2);g([b()],m.prototype,"errorMessage",2);g([b()],m.prototype,"promptValidationMessage",2);g([b()],m.prototype,"question",2);g([b()],m.prototype,"history",2);g([b()],m.prototype,"feedback",2);g([b()],m.prototype,"context",2);m=g([Ie("ArcadeAssistantViewState")],m);var at="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,z=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,a;if(this.viewState.feedback.item.isCurrentResult&&this.viewState.viewMode==="result"){let h=this.viewState.context??await this.getProfileAndMetadata(this.getModel()?.uri??""),S=this.viewState.feedback.item.contextSnapshot;a={...h,editor_code:S?.editor_code??"",diagnostics:S?.diagnostics},t=!0}else a=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:r,termsAccepted:p,item:{question:c,formattedScript:s,conversationId:u}}=this.viewState.feedback,l={user_evaluation:n,your_comments:r||void 0,question:c??"",answer:this.encodeForFeedback(s),useragent:navigator.userAgent,_source:fe,version:this.appVersion||o||"NOT_SET",context:a?JSON.stringify({...a,editor_code:this.encodeForFeedback(a.editor_code),isSnapshot:!t}):"",extras:a?.profileId??"",conversation_id:u??"",privacy_statement:p?"I_agree":""};try{await e.applyEdits({addFeatures:[new ce({attributes:l})]})}catch(h){w("error",this,"Error submitting feedback.",{detail:{error:h}})}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.promptingEnabled=!1,this.closed=!1,this.disableQuestionAnswerLogging=!1}static{this.properties={closePanel:0,insertText:0,helpBase:1,promptingEnabled:5,portalUrl:1,serviceUrl:1,closed:7,editorRef:0,feedbackServiceUrl:1,appVersion:1,diagnostics:0,disableQuestionAnswerLogging:5}}static{this.styles=Me}get disclaimerComment(){return`// ${this.messages.disclaimercomment}
|
|
2
|
+
import{a as N}from"./P6UAZRSN.js";import c from"./327RBVAC.js";import b from"./AQHAEA62.js";import{c as ae,d as se}from"./SKBHZ7VS.js";import a from"./STN3LSQR.js";import{d as oe}from"./MZMKV7FA.js";import{a as te}from"./OLMW3NCS.js";import"./SSVSZDRA.js";import"./BHSILWSL.js";import"./J4I4EROF.js";import"./BZWB7A55.js";import"./XEK22IDA.js";import"./CMRUQ3BN.js";import"./UFF53OEH.js";import"./NHREAORV.js";import{F as W,G as K,H as X,I as Z,J as M,L as ee,h as Q,j as d,k as j,l as V,t as H,x as G,y as J,z as Y}from"./A77A54OM.js";import{a as w}from"./BFPEJYVB.js";import"./DSQ2DQQL.js";import"./H6RQVSYM.js";export default $arcgis.t(([xe,ne,Se,re,ce,{getDeclaredVoxelMembers:Te,getDeclaredPixelMembers:Ae},Ce,{property:b,subclass:Ie},{G:q,w:ie,x:F},,P])=>{var C=class extends Y{constructor(e){if(super(e),this.it=V,e.type!==G.CHILD)throw Error(this.constructor.directiveName+"() can only be used in child bindings")}render(e){if(e===V||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:[]}}};C.directiveName="unsafeHTML",C.resultType=1;var I=J(C);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-dialog{--calcite-dialog-content-space: initial;--calcite-dialog-size-y: initial}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:a,details:o,source:n}){super(e),this.name="ArcadeAssistantError",this.code=t,this.subCode=a,this.details=o,this.source=n}};function le(i){if(!i)return;let e=i.indexOf('{"error":');if(e!==-1)try{let t=i.slice(e),a=JSON.parse(t);if(a&&typeof a=="object"&&a.error)return a.error}catch{return}}async function Ee(i){let{baseUrl:e,skillId:t,message:a,authToken:o,previousConversationId:n,context:r}=i,p=t?`${e}/skills/${t}/chat`:`${e}/chat`,c=[],s={message:a,context:r};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(f){let v=f,x=v.details?.rawResponse||v.message||String(f),T=le(x);throw T?new $(T):f}let l=u.data;c.push(l);let h=l.conversationId,S=l.inquiryId,k=l.sequenceNumber;async function E(){let f=0,v=100;for(;f<v;){await new Promise(A=>setTimeout(A,1e3));let x=Re(h,k,S),T;try{T=await ne(p,{method:"post",headers:{"Content-Type":"application/json",token:o},body:JSON.stringify(x),responseType:"json"})}catch(A){let L=A,ke=L.details?.rawResponse||L.message||String(A),B=le(ke);throw B?new $(B):A}let y=T.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(c.push(y),k=y.sequenceNumber,f++,!y.hasMore)break}if(f===v)throw new $({message:"Request timed out",code:"TIMEOUT",source:"polling"})}let R=120*1e3;return await Promise.race([E(),new Promise((f,v)=>setTimeout(()=>v(new $({message:"Request timed out",code:"TIMEOUT",source:"hard-timeout"})),R))]),c}function Re(i,e,t){return{conversationId:i,inquiryId:t,ackSequenceNumber:e}}function Ve(i){return i.message.match(/Error in prompt shield/u)?"I'm having trouble with this request. Try again by rephrasing the question.":i.code==="TIMEOUT"?"Request timed out. Try again by re-asking the same question or rephrasing it.":i.message}var Fe=({notices:i})=>i.length?d`<div class="border-block-end">${N(i,e=>e.id??e.title,e=>d`<calcite-notice class="submission-notice" .icon=${e.icon} .kind=${e.kind} scale=s open .closable=${e.closable} @calciteNoticeClose=${()=>e.onClose?.()}><div slot=title>${e.title}</div>${e.message&&d`<div slot=message>${e.message}</div>`||""}${e.actionLinkMessage&&e.onAction&&d`<calcite-link slot=link @click=${()=>e.onAction?.()}>${e.actionLinkMessage}</calcite-link>`||""}</calcite-notice>`)}</div>`:null,qe=i=>{let e=i.value.length,t=72,a=180,o=i.offsetWidth,n=Math.max(1,Math.floor(o/8)),r=Math.ceil(e/n),p=t+(r-2)*24;i.style.setProperty("--calcite-text-area-min-height",`${Math.min(p,a)}px`)},Pe=({promptValidationMessage:i,errorMessage:e,contextTooBig:t,contextReducedNoticeDismissed:a,setContextReducedNoticeDismissed:o,setErrorMessage:n,messages:r})=>{let p=[];if(i&&p.push({id:"prompt-validation",kind:"danger",icon:"exclamation-mark-triangle",title:i,closable:!0}),e&&p.push({id:"assistant-error",kind:"danger",icon:"exclamation-mark-triangle",title:e,closable:!0,onClose:()=>n(void 0)}),t&&!a){let c=r.contextreduced??"Context reduced",s=r.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:c,message:s,closable:!0,onClose:()=>o(!0)})}return p};function Ne({messages:i}){return d`<calcite-chip slot=header-actions-end scale=s appearance=outline-fill .label=${i.beta??"Beta"}>${i.beta??"Beta"}</calcite-chip>`}function _e({popoverContent:i,messages:e}){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>`}function De({errorMessage:i,slot:e}){return d`<div class="error-display"><calcite-input-message id=error-message status=invalid icon=exclamation-mark-triangle scale=m slot=${e??M}>${i}</calcite-input-message></div>`}function Ue({active:i,setActive:e,messages:t}){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>`}function Oe({context:i,messages:e}){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}function ze({isDisabled:i,isReadOnly:e,setQuestion:t,setIsViewingResult:a,textAreaRef:o,question:n,errorMessage:r,setErrorMessage:p,promptValidationMessage:c,setPromptValidationMessage:s,submitQuestion:u,messages:l,mode:h,assistantRef:S,context:k,contextReducedNoticeDismissed:E,setContextReducedNoticeDismissed:R}){let f=k?.contextTooLarge??!1,v=Pe({promptValidationMessage:c,errorMessage:r,contextTooBig:f,contextReducedNoticeDismissed:E,setContextReducedNoticeDismissed:R,setErrorMessage:p,messages:l});return d`<div class="text-area-wrapper">${Fe({notices:v})}<calcite-text-area scale=s resize=vertical .readOnly=${i||e} class=${Z(v.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=>{qe(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:l})||""}<div class="align-inline-end gaps"><calcite-button round kind=neutral .hidden=${h!=="refine"} icon-start=arrow-left icon-flip-rtl=both appearance=solid scale=s .disabled=${i} @click=${async()=>{a(!1),t("")}} .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=${h!=="refine"} icon-start=arrow-left icon-flip-rtl=both appearance=solid .disabled=${i} @click=${async()=>{a(!1),t("")}} class="hidden-below-380" scale=s>${l.startover??"Start Over"}</calcite-button><calcite-button round scale=s icon-end=effects appearance=solid .loading=${i} .disabled=${i} @click=${async()=>{if(p(""),!n){s(l.enteraprompt??"Please enter a prompt");return}s(void 0),await u()}} class="hidden-below-380">${h==="prompt"?l.ask??"Generate":l.refine??"Refine"}</calcite-button><calcite-button round scale=s icon-end=effects appearance=solid .loading=${i} .disabled=${i} id=small-submit-button @click=${async()=>{if(p(""),!n){s(l.enteraprompt??"Please enter a prompt");return}s(void 0),await u()}} class="hidden-above-380" .label=${h==="prompt"?l.ask??"Generate":l.refine??"Refine"}></calcite-button><calcite-tooltip reference-element=small-submit-button placement=top-start class="hidden-above-380">${h==="prompt"?l.ask??"Generate":l.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:i,messages:e,feedback:t,learnMoreUrl:a,setFeedback:o,onSubmit:n}){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=${r=>o({...t,text:r.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=${r=>{o({...t,termsAccepted:r.target.checked})}} .disabled=${t.submitting}></calcite-checkbox><span>${I((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>${I((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=${a} 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}function de({promptingEnabled:i,messages:e,slot:t,helpTopicUrl:a}){return d`<calcite-block .label=${e.assistantinformation??"Assistant information"} slot=${t??M} 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>${I((e.seedocumentation??"Please see the {documentation} for more information, including limitations and additional resources.").replace("{documentation}",`<calcite-link href=${a} 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>`}function je({messages:i,onProceed:e,onExit:t,helpTopicUrl:a}){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>${I((i.pleasereadhelp??"Read the Arcade Assistant (beta) {helpTopic} to get started and learn details on security, privacy and limitations.").replace("{helpTopic}",`<calcite-link href=${a} 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>`}function He({messages:i,suggestions:e,onSuggestionClick:t}){return d`<calcite-block .heading=${i.promptsuggestions} expanded collapsible id=suggestion-block scale=s><div class="suggestions">${e.map(a=>d`<calcite-button round scale=s appearance=outline-fill kind=neutral .label=${i.promptsuggestion} class="suggestion-button" @click=${()=>t?.(a)}>${a}</calcite-button>`)}</div></calcite-block>`}var pe=200;function ue({hidden:i=!1,expanded:e=!1,messages:t,cards:a,heading:o,collapsible:n=!1,showEffectsIcon:r=!1,onCopyCode:p,standalone:c}){return d`<calcite-block .hidden=${i} id=result-block .heading=${o??t.besteffort??"Here is the assistant's best effort"} .expanded=${e} .collapsible=${n}>${r&&d`<calcite-chip .label=${t.assistantresponses??"Assistant responses"} slot=content-start icon=effects scale=m class="suggestion-chips"></calcite-chip>`||""}<calcite-card-group .label=${t.assistantresponses??"Assistant responses"}>${N(a,s=>s.conversationId,s=>d`<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}-${c?"standalone":"list"}`} @click=${u=>{let l=u.currentTarget;navigator.clipboard.writeText(s.priorPrompt).then(()=>{l.setAttribute("data-copied","true"),setTimeout(()=>l.removeAttribute("data-copied"),1500)})}}></calcite-action><calcite-popover .referenceElement=${`copy-prompt-${s.conversationId}-${c?"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}-${c?"standalone":"list"}`} placement=top-start class="copy-tooltip">${t.copyprompttoclipboard??"Copy prompt to clipboard"}</calcite-tooltip></div>${s.message&&c&&d`<div class="response-error-container">${De({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&&!c&&d`<calcite-tooltip .referenceElement=${`response-chip-${s.conversationId}-error`} placement=top-start>${s.message}</calcite-tooltip><calcite-chip .id=${`response-chip-${s.conversationId}-error`} .label=${t.error??"Error"} scale=s appearance=outline icon=exclamation-mark-triangle-f class="response-error-chip"></calcite-chip>`||""}${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}-${c?"standalone":"list"}`}></calcite-button><calcite-tooltip class="hidden-above-380" .referenceElement=${`add-to-editor-button-${s.conversationId}-${c?"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}-${c?"standalone":"list"}`}></calcite-button><calcite-tooltip .referenceElement=${`replace-${s.conversationId}-${c?"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 l=u.currentTarget;p(s.code).then(()=>{l.setAttribute("data-copied","true"),setTimeout(()=>l.removeAttribute("data-copied"),1500)})}} class="response-secondary-action-button" .id=${`copy-response-${s.conversationId}-${c?"standalone":"list"}`}></calcite-button><calcite-popover .referenceElement=${`copy-response-${s.conversationId}-${c?"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}-${c?"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}-${c?"standalone":"list"}`}></calcite-action><calcite-tooltip .referenceElement=${`thumbs-up-${s.conversationId}-${c?"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}-${c?"standalone":"list"}`}></calcite-action><calcite-tooltip .referenceElement=${`thumbs-down-${s.conversationId}-${c?"standalone":"list"}`} placement=top-start><span>${t.unhelpful??"Unhelpful"}</span></calcite-tooltip></div></calcite-card>`)}</calcite-card-group></calcite-block>`}var Ge=({card:i,messages:e})=>{let t=H(),a=`response-chip-profile-${i.conversationId}-${t}`,o=(e.profilecontextlabel??"Profile context: {profileId}").replace("{profileId}",i.profileId);return d`<calcite-tooltip .referenceElement=${a} placement=top-start class="contained-popover-or-tooltip">${o}</calcite-tooltip><calcite-chip .label=${i.profileId} scale=s appearance=outline icon=map-information id=${a??M}>${i.profileId}</calcite-chip>`},me=i=>i.type==="featureSet";function we(i){return i&&i!=="dataCatalogDatastore"?i:void 0}var _=i=>{if(!ie(i))return[];let e=[];return i.relationships?.forEach(t=>{e.push(t.toJSON())}),e},D=i=>i.length>0?{relationships:i}:{},Je=i=>oe(i).map(e=>({alias:e.alias,name:e.name,type:e.type,...e.domain?{domain:e.domain}:{}})),U=i=>i?{fields:Je(i)}:{fields:[]};async function he(i){let e=await i.loadSource(),t=F(e)&&e.isTable,a=_(e);return{name:i.name,type:"featureSet",isTable:t,...U(e?.fields),...D(a)}}async function $e(i){switch(i.type){case"feature":{let t=await i.loadSource(),a=_(t);return{name:i.name,type:i.type,...U(t?.fields),...D(a)}}case"featureSet":{let t=await i.loadSource(),a=F(t)&&t.isTable;return{name:i.name,type:"featureSet",...a?{isTable:a}:{},...U(t?.fields),...D(_(t))}}case"featureSetCollection":{let t=await i.loadSource(),a=t?.layers.filter(me)??[],o=t?.tables.filter(me)??[],n=await Promise.all(a.map(he)),r=await Promise.all(o.map(he));return{name:i.name,type:"featureSetCollection",layers:n,tables:r}}case"dictionary":{let t=await Promise.all(i.dictionaryVariables.filter(q).map($e));return{name:i.name,type:"dictionary",attributes:t}}case"pixel":{let t=await i.loadSource();if(!t)return{name:i.name,type:"pixel"};let a=await Ae(t);return{name:i.name,type:"pixel",members:a.map(ge)}}case"voxel":{let t=await i.loadSource();if(!t)return{name:i.name,type:"voxel"};let a=await Te(t);return{name:i.name,type:"voxel",members:a.map(ge)}}case"array":let e=we(i.elementType.type);return{name:i.name,type:"array",...e?{elementType:e}:{}};case"number":case"text":case"boolean":case"date":case"knowledgeGraph":case"dateOnly":case"geometry":case"time":return{name:i.name,type:i.type}}}function ge(i){if(i.type==="array"){let e=we(i.elementType.type);return{name:i.name,type:"array",...e?{elementType:e}:{}}}return{name:i.name,type:i.type}}async function Ye(i){return{variables:await Promise.all(i.variables.filter(q).map($e))}}var We=1e5;function Ke(i){let e=new TextEncoder().encode(i).length;return Math.ceil(e/3.5)}function O(i){return Ke(JSON.stringify(i))}function Xe(i){let e=a=>({name:a.name,type:a.type,...a.isTable?{isTable:a.isTable}:{},...a.relationships?{relationships:a.relationships}:{}}),t=a=>{switch(a.type){case"feature":case"featureSet":case"knowledgeGraph":return{name:a.name,type:a.type,..."isTable"in a&&a.isTable?{isTable:a.isTable}:{},..."relationships"in a?{relationships:a.relationships}:{}};case"featureSetCollection":return{name:a.name,type:"featureSetCollection",layers:a.layers.map(e),tables:a.tables.map(e)};case"dictionary":return{name:a.name,type:"dictionary",attributes:a.attributes.map(t)};case"pixel":case"voxel":return{name:a.name,type:a.type};case"array":return{name:a.name,type:"array",...a.elementType?{elementType:a.elementType}:{}};default:return a}};return{variables:i.variables.map(t)}}function Ze(i){let e=i.variables,t=e.length,a=e.find(n=>n.name==="$feature")??e.find(n=>n.type==="feature")??e[0],o=a?[a]:[];return{context:{variables:o},wasReduced:t!==o.length,reducedToVariableName:a?.name}}function et(i){return O(i)>We}var tt=Object.defineProperty,it=Object.getOwnPropertyDescriptor,g=(i,e,t,a)=>{for(var o=a>1?void 0:a?it(e,t):e,n=i.length-1,r;n>=0;n--)(r=i[n])&&(o=(a?r(e,t,o):r(o))||o);return a&&o&&tt(e,t,o),o},m=class extends Ce{constructor(i){super(i),this.viewMode="prompt",this.confirmationActive=!1,this.contextReducedNoticeDismissed=!1,this.splashActive=!0,this.isSubmitting=!1,this.question="",this.history=[],this.feedback={active:!1}}};g([b()],m.prototype,"viewMode",2);g([b()],m.prototype,"confirmationActive",2);g([b()],m.prototype,"contextReducedNoticeDismissed",2);g([b()],m.prototype,"splashActive",2);g([b()],m.prototype,"isSubmitting",2);g([b()],m.prototype,"errorMessage",2);g([b()],m.prototype,"promptValidationMessage",2);g([b()],m.prototype,"question",2);g([b()],m.prototype,"history",2);g([b()],m.prototype,"feedback",2);g([b()],m.prototype,"context",2);m=g([Ie("ArcadeAssistantViewState")],m);var at="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,z=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,a;if(this.viewState.feedback.item.isCurrentResult&&this.viewState.viewMode==="result"){let h=this.viewState.context??await this.getProfileAndMetadata(this.getModel()?.uri??""),S=this.viewState.feedback.item.contextSnapshot;a={...h,editor_code:S?.editor_code??"",diagnostics:S?.diagnostics},t=!0}else a=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:r,termsAccepted:p,item:{question:c,formattedScript:s,conversationId:u}}=this.viewState.feedback,l={user_evaluation:n,your_comments:r||void 0,question:c??"",answer:this.encodeForFeedback(s),useragent:navigator.userAgent,_source:fe,version:this.appVersion||o||"NOT_SET",context:a?JSON.stringify({...a,editor_code:this.encodeForFeedback(a.editor_code),isSnapshot:!t}):"",extras:a?.profileId??"",conversation_id:u??"",privacy_statement:p?"I_agree":""};try{await e.applyEdits({addFeatures:[new ce({attributes:l})]})}catch(h){w("error",this,"Error submitting feedback.",{detail:{error:h}})}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.promptingEnabled=!1,this.closed=!1,this.disableQuestionAnswerLogging=!1}static{this.properties={closePanel:0,insertText:0,helpBase:1,promptingEnabled:5,portalUrl:1,serviceUrl:1,closed:7,editorRef:0,feedbackServiceUrl:1,appVersion:1,diagnostics:0,disableQuestionAnswerLogging:5}}static{this.styles=Me}get disclaimerComment(){return`// ${this.messages.disclaimercomment}
|
|
3
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 openPrompt(e){if(this.closed=!1,!this.promptingEnabled)return;e&&this.updateViewState({question:e,viewMode:"prompt"});let t=this.textAreaRef.value;t&&t.setFocus()}async destroy(){}connectedCallback(){super.connectedCallback(),this.updateViewState({history:ve,splashActive:ye})}loaded(){let e=async()=>{let t=this.getModel();if(!t){this.updateViewState({context:void 0});return}let a=await this.getProfileAndMetadata(t.uri);this.updateViewState({context:a,contextReducedNoticeDismissed:a.contextTooLarge?!1:this.viewState.contextReducedNoticeDismissed})};this.manager.onLifecycle(()=>{e();let t=P.onModelContextDidChange(async()=>{e().catch(a=>{w("error",this,"Error setting context.",{detail:{error:a}})})});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:O(t)}}withEditorState(e,t){return{...e,editor_code:t?.getValue()??this.getModel()?.getValue()??"",diagnostics:this.diagnostics}}encodeForFeedback(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:a=>{ae(this.editorRef.editorInstance,t.formattedScript??"",a,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(a=>!e.fields.some(o=>o.name===a));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(r){w("error",this,"Error initializing feedback service for interaction logging.",{detail:{error:r}});return}if(!t)return;let a=re.applicationName,o=e.contextSnapshot,n={question:e.question,answer:this.encodeForFeedback(e.answer),useragent:navigator.userAgent,_source:fe,version:this.appVersion||a||"NOT_SET",context:o?JSON.stringify({...o,isSnapshot:!0}):"",extras:o?.profileId??"",conversation_id:e.conversationId??"",privacy_statement:""};try{await t.applyEdits({addFeatures:[new ce({attributes:n})]})}catch(r){w("error",this,"Error logging arcade assistant question/answer interaction.",{detail:{error:r}})}}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,a;try{let o=this.getModel();if(!o||!this.serviceUrl)return;let n=this.viewState.context??await this.getProfileAndMetadata(o.uri),r=this.withEditorState(n,o);t=this.createFeedbackContextSnapshot(r);let p=await this.getToken(),c=await Ee({baseUrl:this.serviceUrl,skillId:at,message:e,authToken:p,context:{kind:st,context:{profile_id:r.profileId,metadata:[r.metadata],editor_code:r.editor_code,...r.diagnostics?.length?{diagnostics:r.diagnostics}:{}}}});a=c?.[0]?.conversationId;let s=c.find(u=>u.context?.kind==="ArcadeCodeResponse");if(!s){await this.logInteractionToFeedbackService({question:e,answer:"No ArcadeCodeResponse returned.",contextSnapshot:t,conversationId:a});return}if(s.context?.kind==="ArcadeCodeResponse"){let u=this.createFeedbackContextSnapshot(r),l=se(s?.context?.arcadeCode?.code??"");this.updateViewState({history:[{script:s?.context?.arcadeCode?.code,formattedScript:l,error:void 0,question:e,profile:n.profileId,conversationId:s.conversationId,isCurrentResult:!0,contextSnapshot:u,...s.message?{message:s.message}:{}},...this.viewState.history.map(h=>({...h,isCurrentResult:!1}))],viewMode:"result",errorMessage:void 0}),await this.logInteractionToFeedbackService({question:e,answer:l,contextSnapshot:t,conversationId:s.conversationId})}}catch(o){let n=o instanceof Error&&o.name==="ArcadeAssistantError"?Ve(o)||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:a}),w("error",this,"Error submitting question",{detail:{error:o}})}finally{this.updateViewState({isSubmitting:!1})}}async getToken(){let{token:e}=await xe.getCredential(this.portalUrl);return e}async getProfileAndMetadata(e){let t=be,a=P.getEditorProfileForModel(e);a?.loaded||await a?.loadSource();let o=this.editorRef.profile;o&&"id"in o&&(t=o.id);let n=a?await Ye(a):{variables:[]},r=et(n),p=r?Ze(n):void 0,c=p?p.context:n,s=O(c);return{profileId:t,metadata:c,contextTooLarge:r,reducedToVariableName:p?.reducedToVariableName,estimatedTokens:s}}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.promptingEnabled?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>`||""}${Ne({messages:this.messages})}${_e({messages:this.messages,popoverContent:de({promptingEnabled:this.promptingEnabled,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:a=>this.closePanel?.(a)})||""}${Ue({active:this.viewState.confirmationActive,setActive:a=>this.updateViewState({confirmationActive:a}),messages:this.messages})}${ze({isDisabled:this.viewState.isSubmitting,isReadOnly:!1,setQuestion:this.setQuestionState,setIsViewingResult:a=>this.updateViewState({viewMode:a?"result":"prompt"}),mode:e?"refine":"prompt",textAreaRef:this.textAreaRef,question:this.viewState.question,errorMessage:this.viewState.errorMessage,setErrorMessage:a=>this.updateViewState({errorMessage:a}),promptValidationMessage:this.viewState.promptValidationMessage,setPromptValidationMessage:a=>this.updateViewState({promptValidationMessage:a}),submitQuestion:this.submitQuestion.bind(this),assistantRef:this.el,messages:this.messages,context:this.viewState.context,contextReducedNoticeDismissed:this.viewState.contextReducedNoticeDismissed,setContextReducedNoticeDismissed:a=>this.updateViewState({contextReducedNoticeDismissed:a})})}<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>`:d`<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,promptingEnabled:this.promptingEnabled,helpTopicUrl:this.usingTheAssitantDocUrl})}</calcite-flow-item></calcite-flow>`}};ee("arcgis-arcade-coding-assistant",z);return z},"identity/IdentityManager","request","layers/FeatureLayer","config","Graphic","applications/Components/arcadeEditorUtils","core/Accessor","core/accessorSupport/decorators",a,b,c)
|
|
@@ -1,2 +1,2 @@
|
|
|
1
1
|
/* COPYRIGHT Esri - https://js.arcgis.com/5.2/LICENSE.txt */
|
|
2
|
-
import e from"./
|
|
2
|
+
import e from"./56P6FTYQ.js";import{a as c}from"./5HKDO4SX.js";import b from"./O5LFPM4K.js";import a from"./327RBVAC.js";import{a as t}from"./CMRUQ3BN.js";import{ul as d,xl as n}from"./DSQ2DQQL.js";export default $arcgis.t(([s,{c:m},{a:a,b:p}])=>{var k=["arcade","arcgis-sql-expression","sql-layer-sql-server","sql-layer-postgres","sql-layer-bigquery"],i=new Set,u=new Map;function l(e){let r=u.get(e);return r||(r=Promise.withResolvers(),u.set(e,r)),r}function f(e){l(e).resolve()}function T(e){return k.includes(e)?l(e).promise:Promise.resolve()}function h(e,r){return()=>{i.has(e)||i.add(e),r()}}async function U(e){i.has(e)||(await t()).createModel("",e,d.parse("")).dispose()}n.register({id:s.languageId,aliases:["Arcade","arcade"],extensions:[".arc"],mimetypes:["application/arcade"]});n.onLanguage(s.languageId,h(s.languageId,()=>{m().then(e=>{e.setupMode(s),f(s.languageId)}).catch(e=>{throw e})}));n.register({id:a.languageId,aliases:["EsiSqlExpression","sql-expression"],extensions:[".sql-expression"],mimetypes:["application/sql-expression"]});n.onLanguage(a.languageId,h(a.languageId,()=>{p().then(e=>{e.setupMode(a),f(a.languageId)}).catch(e=>{throw e})}));q();function q(){t().then(e=>{["light","dark"].forEach(r=>{let g=r==="light"?"vs":"vs-dark",o=c[`${r}-theme`];e.defineTheme(g,{base:g,inherit:!0,rules:[{token:"comment.arcgis",foreground:o.comment},{token:"constant.arcgis",foreground:o.constant},{token:"keyword.arcgis",foreground:o.keyword},{token:"identifier.arcgis",foreground:o.identifier},{token:"number.arcgis",foreground:o.number},{token:"string.arcgis",foreground:o.string},{token:"operator.arcgis",foreground:o.operator},{token:"predefined.arcgis",foreground:o.predefined},{token:"date.arcgis",foreground:o.date}],colors:{}})})})}return{a:f,b:T,c:h,d:U}},a,b,e)
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
/* COPYRIGHT Esri - https://js.arcgis.com/5.2/LICENSE.txt */
|
|
2
|
-
import b from"./
|
|
2
|
+
import b from"./AQHAEA62.js";import a from"./STN3LSQR.js";import{j as q}from"./BHSILWSL.js";import{M as P}from"./A77A54OM.js";export default $arcgis.t(([B,{substitute:E},{B:F},{a:T,d:C,e:N,f:b,g:g,h:$,i:x,j:L,n:_,o:D,p:A}])=>{function w(t,e,a){return t?.[e]??a}function h(t,e,a,n){return E(w(t,e,a),n)}function K(t,e){return w(t,e?"nullable":"notnull",e?"nullable":"not nullable")}function j(t,e){return w(t,e?"yes":"no",e?"yes":"no")}function v(t){for(let e of t){if(e instanceof _)return e;if(e.isCollection&&"variables"in e){let a=v(e.variables.filter(n=>n.type!=="group"));if(a)return a}}}function V(t,e){return`${t}:${e}`}function z(t){if(t){for(let e of t)if(e.type==="dataCatalogDatastore")return e.definition}}async function U(t){let e=new B({url:t.portal.url});return await e.load(),new T({itemId:t.id,serviceUrl:t.serviceUrl,portal:e})}async function k(t){return F(t)?await U(t):t}function H(t,e,a,n){let o=`**${t}**`;return e.type&&(o+=`
|
|
3
3
|
${e.type}`),a&&(o+=`
|
|
4
4
|
${h(n,"datastoreformat","Datastore: {datastoreName}",{datastoreName:a})}`),{value:o}}function W(t,e,a){let n=`**${t.name}**`;return t.serverType&&(n+=`
|
|
5
5
|
${t.serverType}`),n+=`
|
|
@@ -19031,7 +19031,7 @@ function ie(t, e, r, n) {
|
|
|
19031
19031
|
const gr = { 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 } };
|
|
19032
19032
|
if (globalThis.esriConfig && (zv(gr, globalThis.esriConfig, !0), delete gr.has), !gr.assetsPath) {
|
|
19033
19033
|
{
|
|
19034
|
-
const t = "5.2.0-next.
|
|
19034
|
+
const t = "5.2.0-next.84";
|
|
19035
19035
|
gr.assetsPath = `https://cdn.jsdelivr.net/npm/@arcgis/core@${t}/assets`;
|
|
19036
19036
|
}
|
|
19037
19037
|
gr.defaultAssetsPath = gr.assetsPath;
|
package/dist/cdn/index.js
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
1
|
/* COPYRIGHT Esri - https://js.arcgis.com/5.2/LICENSE.txt */
|
|
2
|
-
import{K as s,w as e}from"./
|
|
2
|
+
import{K as s,w as e}from"./A77A54OM.js";import"./BFPEJYVB.js";import"./H6RQVSYM.js";var i=e(s,{"arcgis-arcade-coding-assistant":[()=>import("./W77Z4EY4.js"),"appVersion,closed,closePanel:,diagnostics:,disableQuestionAnswerLogging,editorRef:,feedbackServiceUrl,helpBase,insertText:,portalUrl,promptingEnabled,serviceUrl;destroy,openPrompt"],"arcgis-arcade-debugger-console":[()=>import("./VQB7J2LU.js"),"debuggerStore:,modelId"],"arcgis-arcade-debugger-output":[()=>import("./RG7XCMPX.js"),"debuggerStore:,outputTitle,result:"],"arcgis-arcade-editor":[()=>import("./DUB4GMXG.js"),"arcadeAssistant:,customPanels:,disableAssistant,editorInstance:,editorOptions:,enableDebugger,externalExecutor:,hideDocumentationActions,hideSideBar,messageOverrides:,messages:,openedSidePanel,profile:,script,sideActionBarExpanded,snippets:,suggestions:,testData:;getTestResult,openArcadeAssistant,setFocus"],"arcgis-arcade-results":[()=>import("./MIIHORYJ.js"),"consoleLogs:,executionTiming:,hideHeader,loading,openedResultPanel,result:"],"arcgis-arcade-suggestions":[()=>import("./4OW3EH74.js"),"closed,suggestions:"],"arcgis-code-editor":[()=>import("./RBDGSMHN.js"),"editorInstance:,editorOptions:,language,modelId,value;insertSnippet,insertText,setFocus"],"arcgis-code-editor-shell":[()=>import("./BPPFZDPH.js")],"arcgis-code-viewer":[()=>import("./NLVKEWNR.js"),"language,lineNumbers,round"],"arcgis-editor-variables":[()=>import("./6YLBGWGQ.js"),"closed,heading,hideDescriptions,loading,messageOverrides:,modelId,variable:"],"arcgis-language-api-panel":[()=>import("./JSZLCNQX.js"),"apiLibrary:,closed,hideDocumentationActions,languageId,loading"],"arcgis-sql-expression-editor":[()=>import("./OY7QVXY5.js"),"hideDescriptionsInFieldsPanel,hideSideBar,messageOverrides:,messages:,profile:,script;setFocus"],"arcgis-sql-layer-editor":[()=>import("./W2NC7KQQ.js"),"editorInstance:,editorOptions:,hideSideBar,messageOverrides:,messages:,openedSidePanel,profile:,script;setFocus"]});i({resourcesUrl:import.meta.url});var r=new CSSStyleSheet;r.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,r];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,6 +1,6 @@
|
|
|
1
1
|
/* COPYRIGHT Esri - https://js.arcgis.com/5.2/LICENSE.txt */
|
|
2
|
-
import {
|
|
3
|
-
import {
|
|
2
|
+
import { h as v, i as A, m as F, L as M, E as S } from "./language-defaults-base.js";
|
|
3
|
+
import { e as h, f as L, g as k, h as E, j as I, k as C, l as T } from "./utils.js";
|
|
4
4
|
import { supportedLocales as j, fetchT9nStringsBundle as $ } from "@arcgis/toolkit/intl";
|
|
5
5
|
import { g as P } from "./runtime.js";
|
|
6
6
|
import { CompletionItemKind as w, InsertTextFormat as u, InsertTextMode as f } from "vscode-languageserver-types";
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
/* COPYRIGHT Esri - https://js.arcgis.com/5.2/LICENSE.txt */
|
|
2
|
-
import {
|
|
2
|
+
import { d as D, b as se, o as ae, p as oe, q as ne, r as le, s as ue, t as J, u as f, v as X, w as ce, x as pe, y as U, z as he, A as de, B as fe, C as w, D as N, E as T, F as _e, G as F, H as R, I as me, n as ye } from "./utils.js";
|
|
3
3
|
import { p as be } from "./utilities.js";
|
|
4
4
|
import ge from "@arcgis/core/portal/PortalItem.js";
|
|
5
5
|
import De from "@arcgis/core/WebMap.js";
|
|
@@ -1320,18 +1320,18 @@ class Mt {
|
|
|
1320
1320
|
// #endregion
|
|
1321
1321
|
}
|
|
1322
1322
|
export {
|
|
1323
|
-
|
|
1323
|
+
st as D,
|
|
1324
1324
|
Vt as E,
|
|
1325
1325
|
Mt as L,
|
|
1326
|
-
|
|
1327
|
-
|
|
1328
|
-
|
|
1326
|
+
Qe as a,
|
|
1327
|
+
ze as b,
|
|
1328
|
+
$e as c,
|
|
1329
1329
|
K as d,
|
|
1330
|
-
|
|
1331
|
-
|
|
1332
|
-
|
|
1333
|
-
|
|
1334
|
-
|
|
1330
|
+
ke as e,
|
|
1331
|
+
Be as f,
|
|
1332
|
+
Tt as g,
|
|
1333
|
+
L as h,
|
|
1334
|
+
Pt as i,
|
|
1335
1335
|
xt as m,
|
|
1336
1336
|
vt as n,
|
|
1337
1337
|
ee as q,
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
/* COPYRIGHT Esri - https://js.arcgis.com/5.2/LICENSE.txt */
|
|
2
|
-
import {
|
|
2
|
+
import { e as c, g as P } from "./utils.js";
|
|
3
3
|
import { CompletionItemKind as h, InsertTextFormat as g, InsertTextMode as F } from "vscode-languageserver-types";
|
|
4
|
-
import {
|
|
4
|
+
import { i as b, L as w, E as x } from "./language-defaults-base.js";
|
|
5
5
|
import { fetchT9nStringsBundle as E } from "@arcgis/toolkit/intl";
|
|
6
6
|
import { g as M } from "./runtime.js";
|
|
7
7
|
const A = {
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
/* COPYRIGHT Esri - https://js.arcgis.com/5.2/LICENSE.txt */
|
|
2
|
-
import {
|
|
2
|
+
import { languages as h, Emitter as T } from "monaco-editor";
|
|
3
3
|
import "monaco-editor/editor/standalone/browser/standaloneServices.js";
|
|
4
4
|
import "monaco-editor/editor/standalone/common/standaloneTheme.js";
|
|
5
5
|
import "monaco-editor/platform/hover/browser/hover.js";
|
|
@@ -1,9 +1,9 @@
|
|
|
1
1
|
/* COPYRIGHT Esri - https://js.arcgis.com/5.2/LICENSE.txt */
|
|
2
2
|
import { fetchT9nStringsBundle as v } from "@arcgis/toolkit/intl";
|
|
3
3
|
import { g as C } from "./runtime.js";
|
|
4
|
-
import {
|
|
4
|
+
import { D as T, q as M, n as L, a as F, g as V, b as w, c as N, L as $, e as k, E as _, f as x } from "./language-defaults-base.js";
|
|
5
5
|
import A from "@arcgis/core/portal/Portal.js";
|
|
6
|
-
import {
|
|
6
|
+
import { d as B } from "./utils.js";
|
|
7
7
|
import { substitute as E } from "@arcgis/core/intl.js";
|
|
8
8
|
function b(t, e, a) {
|
|
9
9
|
return t?.[e] ?? a;
|
|
@@ -19,7 +19,7 @@ function I(t, e) {
|
|
|
19
19
|
}
|
|
20
20
|
function h(t) {
|
|
21
21
|
for (const e of t) {
|
|
22
|
-
if (e instanceof
|
|
22
|
+
if (e instanceof T)
|
|
23
23
|
return e;
|
|
24
24
|
if (e.isCollection && "variables" in e) {
|
|
25
25
|
const a = h(
|
|
@@ -44,7 +44,7 @@ function W(t) {
|
|
|
44
44
|
}
|
|
45
45
|
async function U(t) {
|
|
46
46
|
const e = new A({ url: t.portal.url });
|
|
47
|
-
return await e.load(), new
|
|
47
|
+
return await e.load(), new N({
|
|
48
48
|
itemId: t.id,
|
|
49
49
|
serviceUrl: t.serviceUrl,
|
|
50
50
|
portal: e
|
|
@@ -72,7 +72,7 @@ ${y(a, "tableformat", "Table: {tableName}", { tableName: e })}`, { value: o };
|
|
|
72
72
|
}
|
|
73
73
|
function H(t, e, a, o) {
|
|
74
74
|
return t.map((r) => {
|
|
75
|
-
const i =
|
|
75
|
+
const i = M(r.name, a);
|
|
76
76
|
return {
|
|
77
77
|
name: r.name,
|
|
78
78
|
normalizedName: L(r.name),
|
|
@@ -87,7 +87,7 @@ function H(t, e, a, o) {
|
|
|
87
87
|
});
|
|
88
88
|
}
|
|
89
89
|
function O(t, e, a, o, r) {
|
|
90
|
-
const i =
|
|
90
|
+
const i = F(t.name, o), n = t.name.split("."), s = V(t.name);
|
|
91
91
|
return {
|
|
92
92
|
id: P(e, t.name),
|
|
93
93
|
name: t.name,
|
|
@@ -178,11 +178,11 @@ class J extends $ {
|
|
|
178
178
|
this.disposeForModel(e);
|
|
179
179
|
const c = new _(a, d, o.locale);
|
|
180
180
|
this._modelToProfileMap.set(r, c);
|
|
181
|
-
const
|
|
181
|
+
const p = await G(c, await this.getDialectSpec());
|
|
182
182
|
this.updateApiContextForModel(e, {
|
|
183
183
|
locale: o.locale,
|
|
184
184
|
snippets: o.snippets,
|
|
185
|
-
sqlProfile:
|
|
185
|
+
sqlProfile: p
|
|
186
186
|
});
|
|
187
187
|
}), s = n.finally(() => {
|
|
188
188
|
this.#e.get(r) === s && this.#e.delete(r);
|
|
@@ -199,7 +199,7 @@ class J extends $ {
|
|
|
199
199
|
const c = s.datastoreInfo?.datastoreId;
|
|
200
200
|
if (!c)
|
|
201
201
|
return [];
|
|
202
|
-
const
|
|
202
|
+
const p = new Map(
|
|
203
203
|
s.tableVariables.map((l) => [
|
|
204
204
|
P(c, l.datasetInfo.name),
|
|
205
205
|
l
|
|
@@ -214,7 +214,7 @@ class J extends $ {
|
|
|
214
214
|
return { tableId: l, columns: S.columns };
|
|
215
215
|
let m = f.get(l);
|
|
216
216
|
return m || (m = (async () => {
|
|
217
|
-
const u =
|
|
217
|
+
const u = p.get(l);
|
|
218
218
|
return u ? (await u.loadSource(), H(
|
|
219
219
|
u.fieldInfos,
|
|
220
220
|
u.datasetInfo.name,
|
|
@@ -236,16 +236,16 @@ class J extends $ {
|
|
|
236
236
|
return r ? { ...e, tables: i } : e;
|
|
237
237
|
}
|
|
238
238
|
}
|
|
239
|
-
const
|
|
239
|
+
const g = /* @__PURE__ */ new Map();
|
|
240
240
|
function oe(t) {
|
|
241
|
-
let e =
|
|
242
|
-
return e || (e = new J(t),
|
|
241
|
+
let e = g.get(t);
|
|
242
|
+
return e || (e = new J(t), g.set(t, e)), e;
|
|
243
243
|
}
|
|
244
244
|
function re(t) {
|
|
245
|
-
return
|
|
245
|
+
return g.get(t);
|
|
246
246
|
}
|
|
247
247
|
function ne() {
|
|
248
|
-
return [...
|
|
248
|
+
return [...g.values()];
|
|
249
249
|
}
|
|
250
250
|
export {
|
|
251
251
|
ae as a,
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
/* COPYRIGHT Esri - https://js.arcgis.com/5.2/LICENSE.txt */
|
|
2
|
-
import {
|
|
2
|
+
import { languages as l, Emitter as C } from "monaco-editor";
|
|
3
3
|
import "monaco-editor/editor/standalone/browser/standaloneServices.js";
|
|
4
4
|
import "monaco-editor/editor/standalone/common/standaloneTheme.js";
|
|
5
5
|
import "monaco-editor/platform/hover/browser/hover.js";
|