@arcgis/coding-components 5.1.0-next.94 → 5.1.0-next.96
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/{ODCW355N.js → 363GMMQ6.js} +1 -1
- package/dist/cdn/{NZDJGAT2.js → 64X4ILDM.js} +1 -1
- package/dist/cdn/{6BS5M2LA.js → 7NI24N24.js} +1 -1
- package/dist/cdn/{XDBYQYMN.js → 7Z4V2ZOD.js} +1 -1
- package/dist/cdn/{27MWFBRL.js → CHTL74L2.js} +1 -1
- package/dist/cdn/GHTOL7NB.js +2 -0
- package/dist/cdn/{PNIRJAMR.js → GPIFJKPY.js} +1 -1
- package/dist/cdn/{MTIHPCIF.js → GS2ISVXJ.js} +1 -1
- package/dist/cdn/{C2NTBAZK.js → GVMVHGSK.js} +1 -1
- package/dist/cdn/{QVWSOD3N.js → GZ6HZKQZ.js} +1 -1
- package/dist/cdn/{OI3DH7N2.js → JLF32ABD.js} +1 -1
- package/dist/cdn/JQQBQXPD.js +2 -0
- package/dist/cdn/{MJ7MJPGA.js → KCU2C44H.js} +1 -1
- package/dist/cdn/{NK5J27LM.js → N33AALGQ.js} +1 -1
- package/dist/cdn/{VUZOZLS3.js → NOHSS7JG.js} +1 -1
- package/dist/cdn/{EOGGHL44.js → NWLOXWV6.js} +1 -1
- package/dist/cdn/{UQ6UIXTY.js → OGS4AWC2.js} +1 -1
- package/dist/cdn/{AHFU2DJA.js → P7I5ATMN.js} +1 -1
- package/dist/cdn/{SM3MA3KP.js → REL6OK2I.js} +1 -1
- package/dist/cdn/{MR5ZGLNC.js → SATQDL5P.js} +1 -1
- package/dist/cdn/{BA546EMZ.js → SB3MM5EM.js} +1 -1
- package/dist/cdn/{G3BWRHPC.js → SKTKTWIV.js} +1 -1
- package/dist/cdn/{TQNCGG32.js → TCLNQ7Z6.js} +1 -1
- package/dist/cdn/{CMZFQA5X.js → TNA5F36E.js} +1 -1
- package/dist/cdn/{UFDDEHND.js → TSZHSRGH.js} +1 -1
- package/dist/cdn/{FEYQMPLI.js → UCX6WHKQ.js} +1 -1
- package/dist/cdn/{R5QVN7GZ.js → WL2QW4SI.js} +1 -1
- package/dist/cdn/{Q376WIX4.js → WN4UL6U4.js} +1 -1
- package/dist/cdn/WP6BSOSW.js +2 -0
- package/dist/cdn/{UB7TEPYB.js → XN56YGFQ.js} +1 -1
- package/dist/cdn/Y3KOWWO5.js +2 -0
- package/dist/cdn/{KLNTCPWU.js → YE7HDVYS.js} +1 -1
- package/dist/cdn/{FZHOCYLK.js → YJW6NUWX.js} +1 -1
- package/dist/cdn/{VJG7CIFY.js → YTQ4K7PQ.js} +1 -1
- package/dist/cdn/assets/code-editor/sql-expr.worker.js +1 -1
- package/dist/cdn/assets/code-editor/sql-layer.worker.js +619 -602
- package/dist/cdn/index.js +1 -1
- package/dist/components/arcgis-arcade-editor/customElement.js +15 -17
- package/dist/components/arcgis-code-editor/customElement.js +88 -97
- package/dist/components/arcgis-sql-layer-editor/customElement.js +2 -2
- 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 +6 -6
- package/dist/cdn/BCUUVBXH.js +0 -2
- package/dist/cdn/JHCVXLYB.js +0 -2
- package/dist/cdn/W7UVGDPL.js +0 -2
- package/dist/cdn/XSXXLPXK.js +0 -2
|
@@ -1,2 +1,2 @@
|
|
|
1
1
|
/* COPYRIGHT Esri - https://js.arcgis.com/5.1/LICENSE.txt */
|
|
2
|
-
import{b,c as r,d as _}from"./SMAQD57G.js";import{a as v}from"./6TBGTZVD.js";import{a as f}from"./
|
|
2
|
+
import{b,c as r,d as _}from"./SMAQD57G.js";import{a as v}from"./6TBGTZVD.js";import{a as f}from"./P7I5ATMN.js";import"./G56LJGLK.js";import"./ER2MKLVA.js";import{a as p}from"./SB3MM5EM.js";import"./KCU2C44H.js";import"./GS2ISVXJ.js";import{g as h,h as m}from"./6G5URSC7.js";import"./6C52UOYL.js";import{F as c,G as d,K as u,h as g,j as s,l,n as a}from"./REL6OK2I.js";import"./Y3KOWWO5.js";import"./B3UMUBOI.js";import"./CF3TERM3.js";import"./Z5ZZ36DQ.js";import"./LLPQEURF.js";import"./3TTFCHAA.js";function S(o){return!Array.isArray(o)||!o.length?!1:Array.isArray(o[0].suggestions)}var $=g`:host{background-color:var(--calcite-color-foreground-1);.notice-container{margin:var(--calcite-spacing-xxs);padding:var(--calcite-spacing-sm);background-color:var(--calcite-color-foreground-1)}.sticky{position:sticky;top:0;z-index:10}calcite-flow{height:100%}calcite-block{p:first-of-type{margin-top:0}code{font-family:var(--calcite-code-family)}pre{direction:ltr;overflow-x:auto;background-color:var(--calcite-color-foreground-2);padding:var(--calcite-spacing-sm);code{font-size:var(--calcite-font-size--2)}}}calcite-list-item-group{background-color:var(--calcite-color-foreground-2)}calcite-flow{[slot=footer]{word-break:break-word}}}`,n=class extends d{constructor(){super(...arguments),this._beforeBack=async()=>{this._selectedSuggestion=void 0},this.messages=p(),this._colorizeStyle="",this._filterValue="",this.closed=!1,this.arcgisInternalClosePanel=a({bubbles:!1,composed:!1}),this.arcgisInternalItemSelected=a({bubbles:!1,composed:!1})}static{this.properties={_colorizeStyle:16,_filterValue:16,_selectedSuggestion:16,suggestions:0,closed:5}}static{this.styles=$}load(){this._colorizeStyle=r(),this._themeChangedListener=_(()=>this._colorizeStyle=r())}willUpdate(e){e.has("suggestions")&&this.suggestionsPropChanged()}disconnectedCallback(){super.disconnectedCallback(),this._flowObserver?.disconnect(),this._themeChangedListener?.dispose()}suggestionsPropChanged(){this._selectedSuggestion=void 0}flowFocusHandler(e){if(!e){this._flowObserver?.disconnect(),this._flowObserver=void 0;return}this._flowObserver||(this._flowObserver=new MutationObserver(()=>{m(e.querySelector("calcite-flow-item:last-child"),"calcite-input")}),this._flowObserver.observe(e,{attributes:!0,attributeFilter:["id"],childList:!0}))}_updateFilterValue(e){this._filterValue=e.currentTarget?.value??""}_emitItemSelected(e,t){let i=e;(!i.key||i.key==="Enter")&&(e.preventDefault(),this.arcgisInternalItemSelected.emit(t.code))}_showSuggestionDetail(e,t){e.stopPropagation(),this._selectedSuggestion=t}_emitClose(){this.arcgisInternalClosePanel.emit()}_colorizeCode(e){e!==void 0&&b(e,this._selectedSuggestion.code,"arcade")}renderSuggestionGroups(){return this.suggestions===void 0?null:S(this.suggestions)?this.suggestions.map(e=>s`<calcite-list-item-group .heading=${e.label}>${this.renderSuggestionListItems(e.suggestions)}</calcite-list-item-group>`):this.renderSuggestionListItems(this.suggestions)}renderSuggestionListItems(e){return e=f(e,"label",this._filterValue),e.length?e.map(t=>s`<calcite-list-item .label=${t.label} .description=${t.description} @calciteListItemSelect=${i=>this._emitItemSelected(i,t)} @keydown=${i=>this._emitItemSelected(i,t)} data-item=${t??l}><calcite-action slot=actions-end .text=${this.messages.expand??""} scale=s icon=chevron-right icon-flip-rtl @click=${i=>this._showSuggestionDetail(i,t)} data-item=${t??l}></calcite-action></calcite-list-item>`):s`<div class="notice-container">${this.messages.noitems}</div>`}renderSuggestionFlowItem(){let e=this._selectedSuggestion;return e?s`<calcite-flow-item heading-level=2 .heading=${this.messages.suggestions} closable @calciteFlowItemClose=${this._emitClose} .beforeBack=${this._beforeBack} selected><calcite-button width=half slot=footer appearance=outline kind=brand icon-start=code scale=s @click=${t=>this._emitItemSelected(t,e)} data-item=${e??l} ${c(h)}>${this.messages.insert}</calcite-button><calcite-block open .heading=${e.label} .description=${e.description}><div .innerHTML=${v(e.documentation)??""}></div><pre><code ${c(this._colorizeCode)}></code></pre></calcite-block></calcite-flow-item>`:null}render(){return this.closed?null:s`<style>${this._colorizeStyle}</style><calcite-flow ${c(this.flowFocusHandler)}><calcite-flow-item heading-level=2 .heading=${this.messages.suggestions} closable @calciteFlowItemClose=${this._emitClose} .selected=${!this._selectedSuggestion}><calcite-input .value=${this._filterValue} icon=magnifying-glass clearable @calciteInputInput=${this._updateFilterValue} class="sticky" scale=m></calcite-input><calcite-list .label=${this.messages.suggestions??"Suggestions"}>${this.renderSuggestionGroups()}</calcite-list></calcite-flow-item>${this.renderSuggestionFlowItem()}</calcite-flow>`}};u("arcgis-arcade-suggestions",n);export{n as ArcgisArcadeSuggestions};
|
|
@@ -1,2 +1,2 @@
|
|
|
1
1
|
/* COPYRIGHT Esri - https://js.arcgis.com/5.1/LICENSE.txt */
|
|
2
|
-
import{a as v}from"./6G5URSC7.js";import{E as l,F as c,G as p,K as g,h as m,j as b}from"./
|
|
2
|
+
import{a as v}from"./6G5URSC7.js";import{E as l,F as c,G as p,K as g,h as m,j as b}from"./REL6OK2I.js";import"./Y3KOWWO5.js";import"./3TTFCHAA.js";var z=m`:host{--internal-border: var(--arcgis-coding-components-border, 1px solid var(--calcite-color-border-3));--internal-background-color: var(--arcgis-coding-components-background-color, var(--calcite-color-foreground-1));--internal-side-action-bar-max-w: var(--arcgis-coding-components-side-action-bar-max-w, 25%);--internal-code-editor-side-panel-w: var(--arcgis-coding-components-code-editor-side-panel-w, 600px);--internal-code-editor-side-panel-max-w: var(--arcgis-coding-components-code-editor-side-panel-max-w, 45%);--internal-code-editor-results-panel-max-h: var(--arcgis-coding-components-code-editor-results-panel-max-h, 50%);--internal-code-editor-results-panel-h: var(--arcgis-coding-components-code-editor-results-panel-h, 50%);--internal-code-editor-results-panel-bottom-drawer-controls-h: 0px;display:flex;flex-direction:column;position:relative;overflow:hidden;border:var(--internal-border);box-sizing:border-box;background-color:var(--internal-background-color);height:100%;.flex-adjustable{flex:1 1 auto;overflow:hidden}.flex-row{display:flex;flex-direction:row;overflow:hidden}.flex-column{display:flex;flex-direction:column;overflow:hidden}.bottom-drawer{display:flex;flex:0 0 auto;flex-direction:column;overflow:hidden;position:relative;box-sizing:border-box;min-height:0}.bottom-drawer-resize-handle{display:none;position:absolute;inset-inline:0;inset-block-start:calc((var(--calcite-size-fixed-xxl) - var(--calcite-size-fixed-sm-plus)) / 2 * -1);align-items:center;justify-content:center;block-size:var(--calcite-size-fixed-xxl);cursor:ns-resize;touch-action:none;user-select:none;z-index:var(--calcite-z-index-header);border-block-start:var(--calcite-border-width-sm) solid var(--calcite-color-border-3);outline:none}.bottom-drawer-resize-handle-bar{display:flex;align-items:center;justify-content:center;inline-size:100%;block-size:var(--calcite-size-fixed-sm-plus);color:var(--calcite-color-border-input);background-color:var(--calcite-color-background);border-block-start:var(--calcite-border-width-sm) solid var(--calcite-color-border-3);border-block-end:var(--calcite-border-width-sm) solid var(--calcite-color-border-3);transition:box-shadow .12s ease,color .12s ease,background-color .12s ease}.bottom-drawer-resize-handle-bar calcite-icon{color:inherit}}:host(:state(results-has-content)) .bottom-drawer{padding-block-start:var(--calcite-size-fixed-sm-plus);height:calc(var(--internal-code-editor-results-panel-h) + var(--internal-code-editor-results-panel-bottom-drawer-controls-h));max-height:calc(var(--internal-code-editor-results-panel-max-h) + var(--internal-code-editor-results-panel-bottom-drawer-controls-h))}:host(:state(results-has-content)) .bottom-drawer-resize-handle{display:flex}:host(:state(results-has-content)) .bottom-drawer-resize-handle:focus .bottom-drawer-resize-handle-bar{box-shadow:inset 0 0 0 2px var(--calcite-color-brand)}:host(:state(results-has-content)) .bottom-drawer-resize-handle:hover .bottom-drawer-resize-handle-bar,:host(:state(results-has-content)) .bottom-drawer-resize-handle .bottom-drawer-resize-handle-bar,:host(:state(is-resizing)) .bottom-drawer-resize-handle-bar{color:var(--calcite-shell-panel-resize-icon-color, var(--calcite-color-text-1));background-color:var(--calcite-shell-panel-resize-background-color, var(--calcite-color-foreground-3))}:host(:state(results-has-content)) slot[name=bottom-action-bar]::slotted(*){border-top:0}slot[name=top-action-bar]{flex:0 0 auto}slot[name=top-action-bar]::slotted(*){border-bottom:var(--internal-border)}slot[name=bottom-action-bar]{flex:0 0 auto}slot[name=bottom-action-bar]::slotted(*){border-top:var(--internal-border)}slot[name=side-panel]::slotted(*){max-width:var(--internal-code-editor-side-panel-max-w);width:var(--internal-code-editor-side-panel-w);border-inline-start:var(--internal-border);box-sizing:border-box;flex:1 0 auto}slot[name=side-panel]::slotted(.hidden){display:none}slot[name=editor]::slotted(*){flex:auto;min-height:0}slot[name=results-panel]{display:flex;flex:1 1 auto;overflow:hidden;min-height:0}slot[name=results-panel]::slotted(*){border-top:var(--internal-border);box-sizing:border-box;flex:1 1 auto;min-height:0}slot[name=side-action-bar]::slotted(*){max-width:var(--internal-side-action-bar-max-w);border-inline-start:var(--internal-border)}`,P=10,k=25,x=100,i="results-has-content",f="is-resizing",$="--arcgis-coding-components-code-editor-results-panel-max-h",s="--internal-code-editor-results-panel-h",n="--internal-code-editor-results-panel-max-h",a="--internal-code-editor-results-panel-bottom-drawer-controls-h",h=class extends p{static{this.styles=[z]}#e=void 0;#i=!1;#a=l();#d=l();#n=l();#t;#h(e){this.#e===e.pointerId&&this.#r()}#g=e=>{this.#e===e.pointerId&&this.#r()};load(){this.manager.onLifecycle(()=>(this.#t=new ResizeObserver(()=>{this.elementInternals.states.has(i)&&this.#s()}),this.updateComplete.then(()=>this.#p()),()=>{this.#r(),this.#t?.disconnect(),this.#t=void 0}))}#v(){this.elementInternals.states.has(i)&&this.#s(),this.#p()}#x(e){e.button!==0||!this.elementInternals.states.has(i)||(e.preventDefault(),e.currentTarget instanceof HTMLElement&&(e.currentTarget.focus(),e.currentTarget.setPointerCapture(e.pointerId)),this.#e=e.pointerId,this.#i=!0,this.elementInternals.states.add(f),this.#u(e))}#f(e){if(!this.elementInternals.states.has(i))return;this.#s();let t=this.#P(e);t!=null&&(e.preventDefault(),e.stopPropagation(),this.#i=!0,this.#c(t))}#y(e){if(!e.target)return;let t=v(e);t||(this.#r(),this.#i||this.#$()),t?(this.elementInternals.states.add(i),this.#s()):this.elementInternals.states.delete(i)}#r(){let e=this.#e;if(!e)return;this.#e=void 0;let t=this.#d.value;t?.hasPointerCapture(e)&&t.releasePointerCapture(e),this.elementInternals.states.delete(f)}#u(e){if(this.#e!==e.pointerId)return;let t=this.#o(),r=this.el.getBoundingClientRect().bottom-e.clientY-t;this.#c(r,t)}#w(){let e=Number.parseFloat(this.el.style.getPropertyValue(s));if(Number.isFinite(e))return e;let t=Number.parseFloat(getComputedStyle(this.#a.value??this.el).height);return Number.isFinite(t)?Math.max(0,t-this.#o()):x}#m(){return this.el.querySelector(':scope > [slot="bottom-action-bar"]')}#o(){let e=this.#m()?.getBoundingClientRect().height??0,t=this.#n.value?.getBoundingClientRect().height??0;return e+t}#b(){return getComputedStyle(this.el).getPropertyValue($).trim()||null}#l(e,t){t?this.el.style.setProperty(e,t):this.el.style.removeProperty(e)}#z(e){let t=this.#b();if(!t)return null;let r=Number.parseFloat(t);if(t.endsWith("px")&&Number.isFinite(r))return r;if(t.endsWith("%")&&Number.isFinite(r))return this.el.getBoundingClientRect().height*r/100;let o=this.#a.value;if(!o)return null;let d=this.el.style.getPropertyValue(a),y=this.el.style.getPropertyValue(s),w=this.el.style.getPropertyValue(n);this.el.style.setProperty(a,`${e}px`),this.el.style.setProperty(s,`${this.el.getBoundingClientRect().height}px`),this.el.style.setProperty(n,t);let u=Number.parseFloat(getComputedStyle(o).height);return this.#l(a,d),this.#l(s,y),this.#l(n,w),Number.isFinite(u)?Math.max(0,u-e):null}#p(){let e=this.#t;if(!e)return;e.disconnect(),e.observe(this.el);let t=this.#n.value;t&&e.observe(t);let r=this.#m();r&&e.observe(r)}#P(e){let t=e.shiftKey?k:P,r=this.#w();switch(e.key){case"ArrowUp":return r+t;case"ArrowDown":return r-t;default:return}}#k(e,t){let r=Math.max(0,this.el.getBoundingClientRect().height-t),o=this.#z(t),d=o==null?r:Math.min(r,o);return Math.min(Math.max(e,x),d)}#c(e,t=this.#o()){let r=this.#k(e,t),o=this.#b();this.el.style.setProperty(a,`${t}px`),this.el.style.setProperty(s,`${r}px`),this.el.style.setProperty(n,o??`calc(100% - ${t}px)`)}#$(){this.el.style.removeProperty(a),this.el.style.removeProperty(s),this.el.style.removeProperty(n)}#s(){let e=this.#o(),t=Number.parseFloat(this.el.style.getPropertyValue(s));return Number.isFinite(t)?this.#c(t,e):this.el.style.setProperty(a,`${e}px`),e}render(){return b`<slot name=top-action-bar></slot><div class="flex-row flex-adjustable"><div class="flex-column flex-adjustable"><slot name=editor></slot><div class="bottom-drawer" ${c(this.#a)}><div aria-label="Resize results panel" aria-orientation=horizontal class="bottom-drawer-resize-handle" role=separator tabindex=0 @pointercancel=${this.#h} @pointerdown=${this.#x} @pointermove=${this.#u} @pointerup=${this.#h} @lostpointercapture=${this.#g} @keydown=${this.#f} ${c(this.#d)}><div class="bottom-drawer-resize-handle-bar" ${c(this.#n)}><calcite-icon icon=drag-resize-vertical scale=s></calcite-icon></div></div><slot name=bottom-action-bar @slotchange=${this.#v}></slot><slot name=results-panel @slotchange=${this.#y}></slot></div></div><slot name=side-panel></slot><slot name=side-action-bar></slot></div>`}};g("arcgis-code-editor-shell",h);export{h as CodeEditorShell};
|
|
@@ -0,0 +1,2 @@
|
|
|
1
|
+
/* COPYRIGHT Esri - https://js.arcgis.com/5.1/LICENSE.txt */
|
|
2
|
+
import f from"./NOHSS7JG.js";import e from"./GPIFJKPY.js";import d from"./GZ6HZKQZ.js";import c from"./ZHZFKZA7.js";import{e as J}from"./P7I5ATMN.js";import b from"./4B64NBIM.js";import"./G56LJGLK.js";import{a as ee}from"./ER2MKLVA.js";import"./IFNCCZ7O.js";import a from"./GLJQQLP2.js";import{a as Y}from"./SB3MM5EM.js";import{a as K}from"./KCU2C44H.js";import"./GS2ISVXJ.js";import"./6G5URSC7.js";import"./6C52UOYL.js";import{E as V,F as H,G as Q,H as x,K as W,L as X,h as j,j as l,l as I,n as L,t as G}from"./REL6OK2I.js";import{a as q,b as u}from"./Y3KOWWO5.js";import"./B3UMUBOI.js";import"./CF3TERM3.js";import"./Z5ZZ36DQ.js";import{Rk as Z,Uk as T}from"./LLPQEURF.js";import"./3TTFCHAA.js";export default $arcgis.t(([ne,{watch:F},m,{property:o,subclass:S},{a:te,h:y,i:B},{b:M},,,P,{a:se,b:ie}])=>{var ce=j`:host{height:100%}calcite-tooltip:not([calcite-hydrated])>*{display:none}.main-action-bar{calcite-action-group{padding-inline-end:var(--calcite-spacing-sm)}calcite-action-group calcite-action{padding-inline-end:var(--calcite-spacing-sm)}calcite-action-group calcite-action:not(:first-child){padding-inline-start:var(--calcite-spacing-sm)}calcite-action-group:last-child{border-inline-end-width:0px}calcite-action-group:not(:first-child){padding-inline-start:var(--calcite-spacing-sm)}}.bottom-action-bar.is-collapsed{border-bottom:0}`,ae="https://services6.arcgis.com/HXHga6CfMLMBOlBX/ArcGIS/rest/services/survey123_6e349a50b4504ca6b6107216d568db5f_form/FeatureServer/0",p=(t,e)=>q(t,"Arcade Assistant",e),le=t=>{let{aiAssistantsEnabled:e}=t;return e===void 0?(p("warn","`areAiAssistantsEnabled` is not defined in the organizations settings."),!1):e},de=t=>!(!t||!("id"in t)),ue=async t=>(await ne.getCredential(t,{oAuthPopupConfirmation:!1})).token,he=async t=>{try{return!!await ne.checkSignInStatus(t)}catch{return p("warn","User is not signed in."),!1}};async function ge({portalUrl:t,profile:e}){if(!de(e))return p("warn","Addon initialization failed. Reason: unsupported profile."),{shouldRender:!1};let s=t.replace(/\/sharing\/rest(\/.*)?$/iu,"").replace(/\/$/u,"");if(!await he(s))return{shouldRender:!1};let i=await ue(t),a=`${s}/sharing/rest/portals/self?f=json&token=${i}`,r=`${s}/sharing/rest/portals/self/settings?f=json&token=${i}`,n=`${s}/sharing/rest/portals/self/signinSettings?f=json&token=${i}`,d=await Promise.allSettled([fetch(a,{credentials:"include"}).then($=>$.json()),fetch(r,{credentials:"include"}).then($=>$.json()),fetch(n,{credentials:"include"}).then($=>$.json())]),[f,R,C]=d,A=f.status==="fulfilled"?f.value:(p("warn",`Failed to fetch selfUrl. Reason: ${f.reason}.`),{}),O=R.status==="fulfilled"?R.value:(p("warn",`Failed to fetch settingsUrl. Reason: ${R.reason}.`),{}),re=C.status==="fulfilled"?C.value:(p("warn",`Failed to fetch signinSettingsUrl. Reason: ${C.reason}.`),{});if(A.isPortal)return{shouldRender:!1};let U=A.helpBase||"";if(!O)return p("warn","Settings response is not available."),{shouldRender:!1};let k=le(O);re.blockBetaApps===!0&&(p("warn","Arcade Assistant is blocked by the organization settings. To enable it, do not block beta apps in the organization settings."),k=!1),A?.user?.privileges?.includes("portal:user:useAIAssistants")||(p("warn","User does not have the required privileges to use AI Assistants."),k=!1);let z=A?.helperServices?.aiAssistantServices?.url;return z?{shouldRender:!0,serviceUrl:z,helpBase:U,assistantsEnabled:k,feedbackServiceUrl:ae}:{shouldRender:!0,assistantsEnabled:!1,helpBase:U,feedbackServiceUrl:ae}}var pe=Object.defineProperty,be=Object.getOwnPropertyDescriptor,_=(t,e,s,i)=>{for(var a=i>1?void 0:i?be(e,s):e,r=t.length-1,n;r>=0;r--)(n=t[r])&&(a=(i?n(e,s,a):n(a))||a);return i&&a&&pe(e,s,a),a},oe=100,h=class extends m{constructor(t){super(t),this.collectionItems=[],this.errorMessage="",this.expanded=!1,this.requestId=0,this.status="idle",this.visibleChildCount=oe}};_([o()],h.prototype,"collectionItems",2);_([o()],h.prototype,"errorMessage",2);_([o()],h.prototype,"expanded",2);_([o()],h.prototype,"requestId",2);_([o()],h.prototype,"schemaValue",2);_([o()],h.prototype,"status",2);_([o()],h.prototype,"visibleChildCount",2);h=_([S("ArcadeDebuggerLazyTreeNodeState")],h);var w=class extends m{constructor(t){super(t),this.generation=0,this.nodes=new Map}reset(){this.generation+=1,this.destroyNodes()}ensureNode(t,e=!1,s){let i=this.nodes.get(t);if(i)return i;let a=new h;return a.expanded=e,this.nodes.set(t,a),e&&s&&this.loadNode(t,s),a}setExpanded(t,e,s){let i=this.ensureNode(t,e,s);if(i.expanded===e){e&&s&&this.loadNode(t,s);return}i.expanded=e,e&&s&&this.loadNode(t,s)}showMore(t,e){let s=this.ensureNode(t);s.visibleChildCount>=e||(s.visibleChildCount=Math.min(e,s.visibleChildCount+oe))}loadNode(t,e){switch(e.kind){case"collection":this.runLoad(t,e.load,(s,i)=>{s.collectionItems=i});return;case"schema":this.runLoad(t,e.load,(s,i)=>{s.schemaValue=i});return}}runLoad(t,e,s){let i=this.nodes.get(t);if(!i||i.status==="loading"||i.status==="loaded")return;let a=this.generation,r=i.requestId+1;i.requestId=r,i.status="loading",i.errorMessage="",i.schemaValue=void 0,i.collectionItems=[],e().then(n=>{let d=this.nodes.get(t);!d||this.generation!==a||d.requestId!==r||(s(d,n),d.status="loaded")}).catch(()=>{let n=this.nodes.get(t);!n||this.generation!==a||n.requestId!==r||(n.status="error")})}destroyNodes(){for(let t of this.nodes.values())t.destroy();this.nodes.clear()}};w=_([S("ArcadeDebuggerLazyTreeState")],w);var _e=Object.defineProperty,me=Object.getOwnPropertyDescriptor,c=(t,e,s,i)=>{for(var a=i>1?void 0:i?me(e,s):e,r=t.length-1,n;r>=0;r--)(n=t[r])&&(a=(i?n(e,s,a):n(a))||a);return i&&a&&_e(e,s,a),a},b=class extends m{constructor(t){super(t),this.phase="idle",this.sessionId=0,this.consoleLogs=[],this.hasExecuted=!1}get isExecuting(){return this.phase==="running"||this.phase==="debug-running"||this.phase==="debug-paused"}get isDebugging(){return this.phase==="debug-running"||this.phase==="debug-paused"}get isPaused(){return this.phase==="debug-paused"}get runResult(){return this.result?.resultType==="run"?this.result.result:void 0}get debugResult(){return this.result?.resultType==="debug"?this.result.result:void 0}addConsoleLog(t){this.consoleLogs=[...this.consoleLogs,t]}};c([o()],b.prototype,"phase",2);c([o()],b.prototype,"mode",2);c([o()],b.prototype,"sessionId",2);c([o()],b.prototype,"result",2);c([o()],b.prototype,"consoleLogs",2);c([o()],b.prototype,"hasExecuted",2);b=c([S("ArcadeDebuggerExecutionModel")],b);var E=class extends m{constructor(t){super(t),this.breakpoints=[]}setBreakpoints(t){this.breakpoints=Array.from(new Set(t)).sort((e,s)=>e-s)}toggleBreakpoint(t){let e=new Set(this.breakpoints);e.has(t)?e.delete(t):e.add(t),this.setBreakpoints(e)}clearBreakpoints(){this.breakpoints=[]}};c([o()],E.prototype,"breakpoints",2);E=c([S("ArcadeDebuggerSessionModel")],E);var v=class extends m{constructor(t){super(t),this.openedPanel="output",this.showPanel=!1}};c([o()],v.prototype,"openedPanel",2);c([o()],v.prototype,"showPanel",2);v=c([S("ArcadeDebuggerUiModel")],v);var D=class extends m{constructor(t){super(t)}get line(){return this.pausedState?.line}clearPausedState(){this.lastPausedState=this.pausedState,this.pausedState=void 0}reset(){this.pausedState=void 0,this.lastPausedState=void 0}setPausedState(t){this.pausedState=t,this.lastPausedState=t}};c([o()],D.prototype,"pausedState",2);c([o()],D.prototype,"lastPausedState",2);D=c([S("ArcadeDebuggerPausedFrameModel")],D);var g=class extends m{constructor(t){super(t),this.execution=new b,this.lazyTreeState=new w,this.pausedFrame=new D,this.previewTabsState=new M,this.session=new E,this.ui=new v}get breakpoints(){return this.session.breakpoints}get debuggerBreakpoints(){return this.session.breakpoints.map(t=>({line:t}))}get consoleLogs(){return this.execution.consoleLogs}get debug(){if(!(!this.pausedFrame.pausedState&&!this.pausedFrame.lastPausedState))return{pausedState:this.pausedFrame.pausedState,lastPausedState:this.pausedFrame.lastPausedState}}get debugResult(){return this.execution.debugResult}get debuggerLine(){return this.pausedFrame.pausedState?.line}get executionState(){return this.pausedFrame.pausedState}get hasExecuted(){return this.execution.hasExecuted}get isDebugging(){return this.execution.isDebugging}get isExecuting(){return this.execution.isExecuting}get isPaused(){return this.execution.isPaused}get mode(){return this.execution.mode}get openedPanel(){return this.ui.openedPanel}get outputRenderer(){if(this.execution.result)return this.execution.result.resultType==="debug"?"debugger":"legacy"}get phase(){return this.execution.phase}get result(){return this.execution.result}get runResult(){return this.execution.runResult}get sessionId(){return this.execution.sessionId}get showPanel(){return this.ui.showPanel}addConsoleLog(t){this.execution.addConsoleLog(t)}clearBreakpoints(){this.session.clearBreakpoints()}clearForMissingTestData(){this.stopDebug({hidePanel:!0}),this.execution.hasExecuted=!1,this.execution.result=void 0}closePanel(){this.ui.showPanel=!1}completeDebug(t){this.execution.mode="debug",this.execution.result={resultType:"debug",result:t},this.execution.phase="completed",this.ui.openedPanel="output",this.pausedFrame.reset(),this.resetTransientDebuggerState()}completeRun(t){this.execution.mode="run",this.execution.result={resultType:"run",result:t},this.execution.phase="completed",this.pausedFrame.reset(),this.resetTransientDebuggerState()}continueDebug(){let t=this.pausedFrame.pausedState?.continue;t&&(this.execution.phase="debug-running",this.pausedFrame.clearPausedState(),t.resolve())}disableDebugger(){this.stopDebug({hidePanel:!0}),this.clearBreakpoints()}fail(t){this.completeRun(t)}pauseDebug(t){let e=this.pausedFrame.pausedState??this.pausedFrame.lastPausedState;this.syncPausedState(e,t),this.pausedFrame.setPausedState(t),this.execution.phase="debug-paused"}reset(){this.execution.phase="idle",this.execution.mode=void 0,this.execution.result=void 0,this.execution.consoleLogs=[],this.execution.hasExecuted=!1,this.execution.sessionId=0,this.ui.openedPanel="output",this.ui.showPanel=!1,this.pausedFrame.reset(),this.session.clearBreakpoints(),this.replaceTransientDebuggerState()}resetDebug(){this.stopDebug({hidePanel:!1}),this.execution.result=void 0,this.execution.consoleLogs=[],this.ui.openedPanel="debug-console"}disconnect(){this.stopDebug({hidePanel:!0})}setBreakpoints(t){this.session.setBreakpoints(t)}setPanel(t){this.execution.hasExecuted&&(this.ui.openedPanel=t,this.ui.showPanel=!0)}startDebug(){return this.execution.mode="debug",this.execution.phase="debug-running",this.execution.hasExecuted=!0,this.execution.result=void 0,this.execution.consoleLogs=[],this.ui.openedPanel="debug-console",this.ui.showPanel=!0,this.execution.sessionId+=1,this.pausedFrame.reset(),this.replaceTransientDebuggerState(),this.execution.sessionId}startRun(){return this.execution.mode="run",this.execution.phase="running",this.execution.hasExecuted=!0,this.execution.result=void 0,this.execution.consoleLogs=[],this.ui.openedPanel="output",this.ui.showPanel=!0,this.execution.sessionId+=1,this.pausedFrame.reset(),this.replaceTransientDebuggerState(),this.execution.sessionId}stopDebug({hidePanel:t=!0,invalidateSession:e=!0}={}){let s=this.pausedFrame.pausedState?.continue;e&&(this.execution.sessionId+=1),this.execution.phase=this.execution.hasExecuted?"completed":"idle",this.pausedFrame.reset(),this.resetTransientDebuggerState(),t&&(this.ui.showPanel=!1),this.ui.openedPanel==="debug-console"&&(this.ui.openedPanel="output"),s?.resolve()}syncPausedState(t,e){this.lazyTreeState.reset(),t&&e&&t!==e&&this.previewTabsState.invalidateAll(),this.pausedLine=e?.line}toggleBreakpoint(t){this.session.toggleBreakpoint(t)}togglePanel(t){if(this.execution.hasExecuted){if(t==null){this.ui.showPanel=!this.ui.showPanel;return}if(this.ui.openedPanel===t&&this.ui.showPanel){this.ui.showPanel=!1;return}this.setPanel(t)}}resetTransientDebuggerState(){this.pausedLine=void 0,this.lazyTreeState.reset(),this.previewTabsState.clear()}replaceTransientDebuggerState(){this.pausedLine=void 0,this.lazyTreeState=new w,this.previewTabsState=new M}};c([o()],g.prototype,"execution",2);c([o()],g.prototype,"lazyTreeState",2);c([o()],g.prototype,"pausedLine",2);c([o()],g.prototype,"pausedFrame",2);c([o()],g.prototype,"previewTabsState",2);c([o()],g.prototype,"session",2);c([o()],g.prototype,"ui",2);g=c([S("ArcadeDebuggerStore")],g);var Se={glyphMargin:!0,lineNumbersMinChars:1},N=class extends Q{constructor(){super(...arguments),this._codeEditorElt=V(),this._componentReadyDefer=Promise.withResolvers(),this._disposables=[],this._editorProfilePromise=Promise.resolve(void 0),this._debuggerState=new g,this.messages=Y(),this._modelId=G(),this._openArcadeHelp=()=>{window.open(te,"Arcade Help")},this._decorations=void 0,this._monacoEditor=K(ee),this._editorOptions={},this._toggleSidePanel=e=>{e.currentTarget instanceof HTMLElement&&this._setOpenedSidePanel(e.currentTarget.dataset.panelName??"none")},this._closeSidePanel=()=>{this._setOpenedSidePanel("none")},this._updateBreakpointsDecorations=()=>{let e=this.editorInstance;if(!e)return;let s=this._debuggerState.breakpoints.map(i=>({range:new T(i,1,i,1),options:{isWholeLine:!0,glyphMarginClassName:"arcgis-code-editor__breakpoint-glyph"}}));this._decorations?.clear(),this._decorations=e.createDecorationsCollection(s)},this._clearDebuggerDecorations=()=>{this._decorations?.clear(),this._decorations=void 0,this._debuggerPausedLineDecoration?.clear(),this._debuggerPausedLineDecoration=void 0},this._debuggerPausedLineDecoration=void 0,this._preparingArcade=!1,this._arcadeAssistantRemoteState={shouldRender:!1},this.enableDebugger=!1,this.hideDocumentationActions=!1,this.hideSideBar=!1,this.openedSidePanel="none",this.script="",this.sideActionBarExpanded=!1,this.arcgisDiagnosticsChange=L({bubbles:!1}),this.arcgisScriptChange=L({bubbles:!1})}static{this.properties={_apiLibrary:16,_editorProfile:16,_preparingArcade:16,_arcadeAssistantRemoteState:16,editorInstance:32,editorOptions:0,enableDebugger:5,hideDocumentationActions:5,hideSideBar:5,messageOverrides:0,openedSidePanel:3,profile:0,script:1,sideActionBarExpanded:7,snippets:0,suggestions:0,testData:0,customPanels:0,arcadeAssistant:0}}static{this.styles=[ce]}get _usesBottomExecutionDrawer(){return this.enableDebugger&&!!this.testData}get editorInstance(){return this._codeEditorElt.value?.editorInstance}get editorOptions(){return{...Se,...this._editorOptions}}set editorOptions(e){this._editorOptions=e??{}}async getTestResult(){if(!this.testData)return{type:"error",value:"Missing test data",error:null};let e=await this._editorProfilePromise;if(!e)return{type:"error",value:"Missing editor profile",error:null};await this._componentReadyDefer.promise;let s=this._codeEditorElt.value?.value,i=await B(e.definition,s,this.testData,{mode:"run"});return y(i)?i:{type:"error",value:"Unexpected debug result",error:null}}async setFocus(){await this._componentReadyDefer.promise,await this._codeEditorElt.value?.setFocus()}async load(){let e=X("./assets");se(e),await this._updateDataModelDeps(),await this._updateArcadeAssistantRemoteState(),this.manager.onLifecycle(()=>(this.hasUpdated&&this._connectMonacoCustomizations().catch(u(this)),()=>{for(;this._disposables.length;)this._disposables.pop()?.dispose();this._connectMonacoCustomizationsPromise=void 0,this._executeScriptAction=void 0,this._clearDebuggerDecorations(),this._debuggerState.disconnect()}))}willUpdate(e){(e.has("messages")||e.has("profile"))&&this._updateDataModelDeps(),e.has("testData")&&this._testDataChanged(),e.has("enableDebugger")&&!this.enableDebugger&&this._debuggerState.disableDebugger(),e.has("snippets")&&P.updateApiContextForModel(this._modelId,{snippets:this.snippets}),e.has("arcadeAssistant")&&this._updateArcadeAssistantRemoteState()}async loaded(){await this._connectMonacoCustomizations(),this._componentReadyDefer.resolve(),await this._codeEditorElt.value?.setFocus()}_setOpenedSidePanel(e){this.openedSidePanel=e===this.openedSidePanel?"none":e}async _connectMonacoCustomizations(){if(this._connectMonacoCustomizationsPromise)return await this._connectMonacoCustomizationsPromise;this._connectMonacoCustomizationsPromise=(async()=>{if(!this.isConnected)return;let e=await ie();this._disposables.push(e.onDiagnosticsChange(d=>!this._preparingArcade&&this.arcgisDiagnosticsChange.emit(d.diagnostics))),this.testData&&!this._executeScriptAction&&this._addExecuteScriptAction();let s=F(()=>this._debuggerState.breakpoints,()=>this._updateBreakpointsDecorations(),{sync:!0}),i=F(()=>this._debuggerState.debuggerLine,()=>this._updateDebuggerPausedLineDecoration(),{sync:!0}),a=F(()=>this._debuggerState.consoleLogs.length,()=>this.requestUpdate(),{sync:!0});this._disposables.push({dispose:()=>s.remove()},{dispose:()=>i.remove()},{dispose:()=>a.remove()});let r=this.editorInstance?.onMouseDown(d=>this._onEditorMouseDown(d));r&&this._disposables.push(r);let n=this.editorInstance?.onDidChangeModelContent(d=>this._onEditorModelContentChange(d));n&&this._disposables.push(n),this._updateBreakpointsDecorations(),this._updateDebuggerPausedLineDecoration()})();try{await this._connectMonacoCustomizationsPromise}finally{this._connectMonacoCustomizationsPromise=void 0}}_onEditorMouseDown(e){if(!this.enableDebugger||![this._monacoEditor.MouseTargetType.GUTTER_GLYPH_MARGIN,this._monacoEditor.MouseTargetType.GUTTER_LINE_NUMBERS,this._monacoEditor.MouseTargetType.GUTTER_LINE_DECORATIONS].includes(e.target.type))return;let s=e.target.position?.lineNumber;s&&this._debuggerState.toggleBreakpoint(s)}_onEditorModelContentChange(e){if(!this.enableDebugger||!this._debuggerState.breakpoints.length||e.isFlush)return;let s=J(this._debuggerState.breakpoints,e.changes);s.length===this._debuggerState.breakpoints.length&&s.every((i,a)=>i===this._debuggerState.breakpoints[a])||this._debuggerState.setBreakpoints(s)}_updateDebuggerPausedLineDecoration(){let e=this.editorInstance;if(!e)return;this._debuggerPausedLineDecoration?.clear();let s=this._debuggerState.debuggerLine;s!=null?this._debuggerPausedLineDecoration=e.createDecorationsCollection([{range:new T(s,1,s,1),options:{isWholeLine:!0,className:"arcgis-code-editor__debugger-paused-line",glyphMarginClassName:"arcgis-code-editor__debugger-paused-glyph",marginClassName:"arcgis-code-editor__debugger-paused-line arcgis-code-editor__debugger-paused-margin"}}]):this._debuggerPausedLineDecoration=void 0}_continueDebugSession(){this._debuggerState.continueDebug()}_stopDebugSession({hideExecutionPanel:e=!0}={}){this._debuggerState.stopDebug({hidePanel:e})}_resetDebugSession(){this._debuggerState.resetDebug(),this._executeScript("debug").catch(u(this))}async _handleDebugPause(e,s,i){if(!this._debuggerState.isDebugging||e!==this._debuggerState.sessionId)return;let a=Promise.withResolvers();return this._debuggerState.pauseDebug({line:s.line,result:i,continue:a}),await a.promise}async _updateDataModelDeps(){await this._updateEditorProfile(),await this._updateApiLibrary()}_testDataChanged(){!this.testData&&this._executeScriptAction&&(this._disposeSafely(this._executeScriptAction),this._executeScriptAction=void 0),this.testData&&!this._executeScriptAction&&this._addExecuteScriptAction(),!this.testData&&this.enableDebugger&&this._debuggerState.clearForMissingTestData(),this._debuggerState.showPanel&&this._executeScript("run").catch(u(this))}async _updateEditorProfile(){this._preparingArcade=!0;try{await P.setProfileForModel(this._modelId,this.profile,{locale:this.messages._t9nLocale,snippets:this.snippets}),this._editorProfile=P.getEditorProfileForModel(this._modelId)}catch{this._editorProfile=void 0}finally{this._editorProfilePromise=Promise.resolve(this._editorProfile),this._preparingArcade=!1}}async _updateApiLibrary(){this._apiLibrary=await P.getApiLibraryForModel(this._modelId)}_setExecutionPanel(e){this._debuggerState.togglePanel(e)}async _executeScript(e){let s=this.testData;if(!this._codeEditorElt.value||!s)return;let i=e==="debug"?this._debuggerState.startDebug():this._debuggerState.startRun(),a=await this._editorProfilePromise;if(!a){this._debuggerState.fail({type:"error",value:"Missing editor profile",error:null});return}setTimeout(()=>{(async()=>{let r=this._codeEditorElt.value?.value,n={mode:e,console:f=>this._debuggerState.addConsoleLog(f),breakpoints:e==="debug"?this._debuggerState.debuggerBreakpoints:void 0};e==="debug"&&(n.onDebugPause=this._handleDebugPause.bind(this,i));let d=await B(a.definition,r,s,n);if(i===this._debuggerState.sessionId){if(e==="debug"){if(y(d)){this._debuggerState.fail(d);return}this._debuggerState.completeDebug(d);return}y(d)?this._debuggerState.completeRun(d):this._debuggerState.fail({type:"error",value:"Unexpected debug result",error:null})}})()},0)}_toggleShowExecutionPanel(){this._debuggerState.togglePanel()}_toggleSideActionBarExpanded(){this.sideActionBarExpanded=!this.sideActionBarExpanded}_onCodeEditorValueChange(e){e.stopPropagation(),this.script=e.detail,this.arcgisScriptChange.emit(e.detail)}_insertAsSnippet(e){this._codeEditorElt.value?.insertSnippet(e.detail).catch(u(this))}_insertAsText(e){this._insertText(e.detail)}_insertText(e){this._codeEditorElt.value?.insertText(e).catch(u(this))}_onResultPanelChange(e){let s=e.currentTarget;this._debuggerState.setPanel(s.openedResultPanel)}_onExecutionPanelClose(){this._debuggerState.closePanel()}_addExecuteScriptAction(){let e=this.editorInstance?.addAction({id:"run-script",label:"Run Arcade Expression",keybindings:[Z.F5],contextMenuGroupId:"code",contextMenuOrder:1,run:()=>{this.testData&&this._executeScript("run").catch(u(this))}});e&&(this._executeScriptAction=e,this._disposables.push(e))}_disposeSafely(e){let s=this._disposables.indexOf(e);s!==-1&&this._disposables.splice(s,1),e.dispose()}async _updateArcadeAssistantRemoteState(){this.arcadeAssistant&&(this._arcadeAssistantRemoteState=await ge({...this.arcadeAssistant,profile:this.profile}))}renderMainActionBar(){return this.enableDebugger||!this.testData?null:l`<calcite-action-bar class="main-action-bar" layout=horizontal scale=s expanded expand-disabled slot=top-action-bar><calcite-action-group scale=s><calcite-action .text=${this.messages.run??""} text-enabled icon=play scale=s .loading=${this._preparingArcade} @click=${()=>{this._executeScript("run").catch(u(this))}}></calcite-action>${this._debuggerState.result?l`<calcite-action .text=${this.messages.lastresults??""} .active=${this._debuggerState.showPanel} text-enabled icon=access-string-results icon-flip-rtl scale=s @click=${this._toggleShowExecutionPanel}></calcite-action>`:null}</calcite-action-group></calcite-action-bar>`}renderMainPanel(){return l`<arcgis-code-editor slot=editor .editorOptions=${this.editorOptions} .language=${P.languageId} .value=${this.script??""} .modelId=${this._modelId} @arcgisValueChange=${this._onCodeEditorValueChange} ${H(this._codeEditorElt)}></arcgis-code-editor>`}renderAction({id:e,label:s,icon:i,active:a,panelName:r,iconFlipRtl:n=!1,onClick:d=this._toggleSidePanel}){return l`<calcite-action id=${e??I} .text=${s} .textEnabled=${this.sideActionBarExpanded} .icon=${i} .active=${a} @click=${d} data-panel-name=${r??I} .iconFlipRtl=${n}></calcite-action>${!this.sideActionBarExpanded&&l`<calcite-tooltip .referenceElement=${e}><span>${s}</span></calcite-tooltip>`||""}`}renderSideActionBar(){return this.hideSideBar?null:l`<calcite-action-bar slot=side-action-bar class="side-action-bar" .expanded=${this.sideActionBarExpanded} position=end @calciteActionBarToggle=${this._toggleSideActionBarExpanded}><calcite-action-group>${this.renderAction({id:"profile-variables-action",label:this.messages.profilevariables??"",icon:"profile-variables",active:this.openedSidePanel==="variables",panelName:"variables"})}${this.renderAction({id:"function-action",label:this.messages.constantsandfunctions??"",icon:"function",active:this.openedSidePanel==="api",panelName:"api"})}${this.suggestions?.length?this.renderAction({id:"suggestions-action",label:this.messages.suggestions??"",icon:"lightbulb",active:this.openedSidePanel==="suggestions",panelName:"suggestions"}):null}${this._arcadeAssistantRemoteState.shouldRender&&this.renderAction({id:"arcade-assistant-action",label:this.messages.arcadeassistant??"Arcade assistant",icon:"effects",active:this.openedSidePanel==="arcade-assistant",panelName:"arcade-assistant"})||""}${this.customPanels?.map(e=>e.enabled===!1?null:this.renderAction({id:e.id,label:e.name,icon:e.icon,active:this.openedSidePanel===e.id,panelName:e.id}))}${this.hideDocumentationActions?null:this.renderAction({id:"developer-website-action",label:this.messages.help??"",icon:"question",active:!1,panelName:"none",iconFlipRtl:this.messages._lang==="ar",onClick:this._openArcadeHelp})}</calcite-action-group></calcite-action-bar>`}renderSidePanel(){if(this.hideSideBar)return null;let{openedSidePanel:e}=this;return l`<arcgis-language-api-panel slot=side-panel class=${x(e==="api"?"":"hidden")} .loading=${this._preparingArcade} .apiLibrary=${this._apiLibrary} .hideDocumentationActions=${this.hideDocumentationActions} @arcgisInternalItemSelected=${this._insertAsSnippet} @arcgisInternalClosePanel=${this._closeSidePanel} data-panel-name=none .closed=${e!=="api"}></arcgis-language-api-panel><arcgis-editor-variables slot=side-panel class=${x(e==="variables"?"":"hidden")} .loading=${this._preparingArcade} .modelId=${this._modelId} @arcgisInternalItemSelected=${this._insertAsText} @arcgisInternalClosePanel=${this._closeSidePanel} data-panel-name=none .variable=${this._editorProfile} .closed=${e!=="variables"} .messageOverrides=${{profileempty:this.messages.profileempty}}></arcgis-editor-variables>${this.suggestions?.length&&l`<arcgis-arcade-suggestions slot=side-panel class=${x(e==="suggestions"?"":"hidden")} .closed=${e!=="suggestions"} .suggestions=${this.suggestions} @arcgisInternalItemSelected=${this._insertAsText} @arcgisInternalClosePanel=${this._closeSidePanel} data-panel-name=none></arcgis-arcade-suggestions>`||""}${this.arcadeAssistant&&this._arcadeAssistantRemoteState.shouldRender&&l`<arcgis-arcade-coding-assistant slot=side-panel class=${x(e==="arcade-assistant"?"":"hidden")} .closed=${e!=="arcade-assistant"} .insertText=${this._insertText.bind(this)} .closePanel=${this._closeSidePanel} .portalUrl=${this.arcadeAssistant.portalUrl} .serviceUrl=${"serviceUrl"in this._arcadeAssistantRemoteState?this._arcadeAssistantRemoteState.serviceUrl:void 0} .helpBase=${this._arcadeAssistantRemoteState.helpBase} .assistantsEnabled=${this._arcadeAssistantRemoteState.assistantsEnabled} .feedbackServiceUrl=${this._arcadeAssistantRemoteState.feedbackServiceUrl} .editorRef=${this.el} .appVersion=${this.arcadeAssistant.appVersion} .disableQuestionAnswerLogging=${this.arcadeAssistant.disableQuestionAnswerLogging}></arcgis-arcade-coding-assistant>`||""}${this.customPanels?.map(s=>l`<calcite-flow slot=side-panel class=${x(e===s.id?"":"hidden")}>${s?.useFlows?s.renderer?.({closePanel:this._toggleSidePanel,insertText:this._insertText.bind(this),closed:e!==s.id,editorRef:this.el}):l`<calcite-flow-item .heading=${s.name} heading-level=2 closable .closed=${e!==s.id} @calciteFlowItemClose=${this._toggleSidePanel} .description=${s.description}>${s.renderer?.({closePanel:this._toggleSidePanel,insertText:this._insertText.bind(this),closed:e!==s.id,editorRef:this.el})}</calcite-flow-item>`}</calcite-flow>`)}`}renderResultsPanel(){if(this._usesBottomExecutionDrawer)return this.renderBottomExecutionBody();if(!this._debuggerState.showPanel)return null;let e=this._debuggerState.openedPanel==="debug-console"?"output":this._debuggerState.openedPanel;return l`<arcgis-arcade-results slot=results-panel .openedResultPanel=${e} .loading=${this._debuggerState.isExecuting} .result=${this._debuggerState.runResult} .consoleLogs=${this._debuggerState.consoleLogs} @arcgisInternalOpenedResultPanelChange=${this._onResultPanelChange} @arcgisInternalClosePanel=${this._onExecutionPanelClose}></arcgis-arcade-results>`}renderBottomExecutionBody(){let{showPanel:e,openedPanel:s,debugResult:i,isExecuting:a,mode:r}=this._debuggerState;return e?s==="debug-console"?l`<arcgis-arcade-debugger-console slot=results-panel .modelId=${this._modelId} .debuggerStore=${this._debuggerState}></arcgis-arcade-debugger-console>`:s==="output"&&r==="debug"?l`<arcgis-arcade-debugger-output slot=results-panel .debuggerStore=${this._debuggerState} .result=${i}></arcgis-arcade-debugger-output>`:l`<arcgis-arcade-results slot=results-panel class="bottom-results" .openedResultPanel=${s} .loading=${s==="console"&&this._debuggerState.isPaused?!1:a} .result=${this._debuggerState.runResult} .consoleLogs=${this._debuggerState.consoleLogs} hide-header @arcgisInternalOpenedResultPanelChange=${this._onResultPanelChange}></arcgis-arcade-results>`:null}renderBottomActionBar(){if(!this._usesBottomExecutionDrawer)return null;let{showPanel:e,hasExecuted:s,openedPanel:i,isDebugging:a,isPaused:r,isExecuting:n}=this._debuggerState;return l`<calcite-action-bar slot=bottom-action-bar class=${`main-action-bar bottom-action-bar ${e?"":"is-collapsed"}`} layout=horizontal scale=s expand-disabled><calcite-action-group scale=s>${a?l`<calcite-action .text=${this.messages.continue??"Continue"} icon=forward scale=s .disabled=${!r} @click=${this._continueDebugSession}></calcite-action><calcite-action .text=${this.messages.reset??"Reset"} icon=reset scale=s @click=${this._resetDebugSession}></calcite-action><calcite-action .text=${this.messages.stop??"Stop"} icon=circle-stop scale=s @click=${()=>this._stopDebugSession()}></calcite-action>`:l`<calcite-action .text=${this.messages.run??""} text-enabled icon=play scale=s .loading=${this._preparingArcade||n} @click=${()=>{this._executeScript("run").catch(u(this))}}></calcite-action><calcite-action .text=${this.messages.runanddebug??"Run and Debug"} text-enabled icon=debug-script scale=s .loading=${this._preparingArcade||n} @click=${()=>{this._executeScript("debug").catch(u(this))}}></calcite-action>`}</calcite-action-group>${s?l`<calcite-action-group scale=s><calcite-action .active=${i==="output"&&e} .text=${this.messages.output??"Output"} text-enabled scale=s icon=list-show-all icon-flip-rtl @click=${()=>this._setExecutionPanel("output")}></calcite-action><calcite-action .active=${i==="console"&&e} .text=${this.messages.console??"Console"} text-enabled scale=s icon=console icon-flip-rtl @click=${()=>this._setExecutionPanel("console")}></calcite-action><calcite-action .active=${i==="log"&&e} .text=${this.messages.log??"Log"} text-enabled scale=s icon=list icon-flip-rtl @click=${()=>this._setExecutionPanel("log")}></calcite-action><calcite-action .active=${i==="debug-console"&&e} .text=${this.messages.debugconsole??"Debug Console"} text-enabled scale=s icon=debug-script icon-flip-rtl .disabled=${this._debuggerState.mode!=="debug"} @click=${()=>this._setExecutionPanel("debug-console")}></calcite-action></calcite-action-group>`:null}${e?l`<calcite-action-group scale=s><calcite-action .text=${this.messages.close??"Close"} scale=s icon=x icon-flip-rtl @click=${this._onExecutionPanelClose}></calcite-action></calcite-action-group>`:null}</calcite-action-bar>`}render(){return l`<arcgis-code-editor-shell>${this.renderMainActionBar()}${this.renderMainPanel()}${this.renderBottomActionBar()}${this.renderResultsPanel()}${this.renderSidePanel()}${this.renderSideActionBar()}</arcgis-code-editor-shell>`}};W("arcgis-arcade-editor",N);return N},"identity/IdentityManager","core/reactiveUtils","core/Accessor","core/accessorSupport/decorators",a,b,c,d,e,f)
|
|
@@ -1,2 +1,2 @@
|
|
|
1
1
|
/* COPYRIGHT Esri - https://js.arcgis.com/5.1/LICENSE.txt */
|
|
2
|
-
import{a as g}from"./NZDJGAT2.js";import e from"./KLNTCPWU.js";import d from"./4B64NBIM.js";import{a as P}from"./ER2MKLVA.js";import c from"./XDBYQYMN.js";import b from"./CMZFQA5X.js";import"./HPZZVB4X.js";import"./MP6Z45SA.js";import"./IFNCCZ7O.js";import a from"./GLJQQLP2.js";import{a as y}from"./BA546EMZ.js";import{a as S}from"./MJ7MJPGA.js";import"./MTIHPCIF.js";import{c as $,e as k}from"./6G5URSC7.js";import"./6C52UOYL.js";import{G as f,H as w,I as p,K as x,h as m,j as r,t as u}from"./SM3MA3KP.js";import"./BCUUVBXH.js";import"./B3UMUBOI.js";import"./CF3TERM3.js";import"./Z5ZZ36DQ.js";import{Zk as T}from"./LLPQEURF.js";import"./3TTFCHAA.js";export default $arcgis.t(([,{h:b,i:L,j:z},{a:l},{a:n},{a:E,b:C,c:v,d:M,e:B,f:I,g:A,h:N,i:D}])=>{var V=m`: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)}}`,h=class extends f{constructor(){super(...arguments),this.messages=y(),this._monacoEditor=S(P),this._breakpointPopoverId=`arcade-debugger-console-breakpoints-${u()}`,this.modelId=""}static{this.properties={debuggerStore:0,modelId:1}}static{this.styles=[V,z,L()]}get breakpoints(){return this.debuggerStore?.debuggerBreakpoints??[]}get previewTabsState(){return this.debuggerStore.previewTabsState}get lazyTreeState(){return this.debuggerStore?.lazyTreeState}load(){this.manager.onLifecycle(()=>{let e=$(this.el,["class"],this.updateTheme.bind(this));return this.updateTheme(),()=>e()})}getContentAtLine(e){if(!this.modelId)return"";let t=this._monacoEditor.getModel(T.parse(this.modelId));return t?t.getLineContent(e):""}updateTheme(){k(this.el)==="dark"?this.elementInternals.states.add(b):this.elementInternals.states.delete(b)}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||!v(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||!v(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,s;if(A(e)){let o=await e.load();s=this.findCollectionItemByPreviewSegment(o,i)}else s=this.getExpandedDebuggerChild(e,i);return await this.resolvePreviewValueFromSegments(s,a)}async resolvePreviewValue(e){let t=this.debuggerStore?.executionState?.result;if(!t)return;let i=C(e);if(!i)return;let{scopeName:a,rootName:s,pathSegments:o}=i,c=a==="globals"?t.globals:a==="locals"?t.locals:null;if(c)return await this.resolvePreviewValueFromSegments(c.get(s),o)}async loadPreview({label:e,sourcePath:t,value:i}){let a=this.previewTabsState,{snapshot:s}=a.startLoad(e,t),o=i;if(o==null)try{o=await this.resolvePreviewValue(t)}catch{a.setError(s,this.getPreviewLoadErrorMessage());return}if(o==null||!I(o)||typeof o.querySample!="function"||typeof o.schema!="function"){a.setUnavailable(s,this.messages.previewunavailable??"This preview is no longer available in the current paused state.");return}try{let{fields:c,features:d}=await o.querySample(),F=this.getPreviewRows(d);a.setLoaded(s,c,F)}catch{a.setError(s,this.getPreviewLoadErrorMessage())}}activateTab(e){if(e===n){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"})})}renderPreviewLabel(e){return r`<bdi>${e}</bdi>`}renderPreviewCell(e){return e?B(e)||M(e)?D({value:e}):r`<span class="xs"></span>`:r`<span class="xs"></span>`}renderScopeEntryForScope(e,t,i){let[a,s]=i,o=`${t}.${a}`,c=this.lazyTreeState;return c?N({name:a,value:s,messages:this.messages,path:`${e}.${a}`,lazyTreeState:c,previewLabel:o,previewSourcePath:E(e,a),previewLoading:this.previewTabsState.isTabLoading(o),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=${w(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.debuggerStore?.executionState?.result,t=!!(e?.locals&&e.locals.size>0),i=Array.from(e?.globals??[]),a=Array.from(e?.locals??[]);return e?r`<calcite-tree .scale=${l.scale} @calciteTreeSelect=${l.oncalciteTreeSelect} .lines=${l.lines} .selectionMode=${l.selectionMode}><calcite-tree-item expanded>${this.messages.global??"Global"}<calcite-tree slot=children .lines=${l.lines} .selectionMode=${l.selectionMode} .scale=${l.scale} @calciteTreeSelect=${l.oncalciteTreeSelect}>${i.map(s=>this.renderScopeEntryForScope("globals",this.messages.global??"Global",s))}</calcite-tree></calcite-tree-item><calcite-tree-item expanded .disabled=${!t}>${this.messages.local??"Local"}<calcite-tree slot=children .lines=${l.lines} .selectionMode=${l.selectionMode} .scale=${l.scale} @calciteTreeSelect=${l.oncalciteTreeSelect}>${t?a.map(s=>this.renderScopeEntryForScope("locals",this.messages.local??"Local",s)):r`<span><i>${this.messages.nolocalscope??"No local scope"}</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(s=>r`<th><bdi>${s}</bdi></th>`)}</tr></thead><tbody>${a.map(s=>r`<tr>${t.map(o=>r`<td>${this.renderPreviewCell(s.get(o))}</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=${n} .selected=${e===n} @calciteTabsActivate=${t=>this.activateTab(t.target.tab)}>${this.messages.scope??"Scope"}</calcite-tab-title>${g(this.previewTabsState.tabs,t=>`title-${t.id}`,t=>r`<calcite-tab-title .tab=${t.id} title=${t.label??p} 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=${n} .selected=${e===n}><div class="tab-panel">${this.renderScopePanel()}</div></calcite-tab>${g(this.previewTabsState.tabs,t=>`panel-${t.id}`,t=>r`<calcite-tab .tab=${t.id} .selected=${e===t.id}><div class="tab-panel preview-panel">${this.renderPreviewPanel(t)}</div></calcite-tab>`)}</calcite-tabs>`}render(){let{line:e}=this.debuggerStore?.executionState??{},t=this.breakpoints.find(a=>a.line===e),i=this.breakpoints.findIndex(a=>a.line===e);return r`<div class="console-shell"><div class="breakpoint-header"><arcgis-code-viewer language=arcade class="breakpoint-code-viewer" .lineNumbers=${a=>String(a+(t?.line??e??1)-1)}>${this.getBreakpointCode(t?.line??this.breakpoints[0]?.line??e??1)}</arcgis-code-viewer>${this.breakpoints.length?r`<calcite-action id=${this._breakpointPopoverId??p} 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>`}};x("arcgis-arcade-debugger-console",h);return h},a,b,c,d,e)
|
|
2
|
+
import{a as g}from"./64X4ILDM.js";import e from"./YE7HDVYS.js";import d from"./4B64NBIM.js";import{a as P}from"./ER2MKLVA.js";import c from"./7Z4V2ZOD.js";import b from"./TNA5F36E.js";import"./HPZZVB4X.js";import"./MP6Z45SA.js";import"./IFNCCZ7O.js";import a from"./GLJQQLP2.js";import{a as y}from"./SB3MM5EM.js";import{a as S}from"./KCU2C44H.js";import"./GS2ISVXJ.js";import{c as $,e as k}from"./6G5URSC7.js";import"./6C52UOYL.js";import{G as f,H as w,I as p,K as x,h as m,j as r,t as u}from"./REL6OK2I.js";import"./Y3KOWWO5.js";import"./B3UMUBOI.js";import"./CF3TERM3.js";import"./Z5ZZ36DQ.js";import{Zk as T}from"./LLPQEURF.js";import"./3TTFCHAA.js";export default $arcgis.t(([,{h:b,i:L,j:z},{a:l},{a:n},{a:E,b:C,c:v,d:M,e:B,f:I,g:A,h:N,i:D}])=>{var V=m`: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)}}`,h=class extends f{constructor(){super(...arguments),this.messages=y(),this._monacoEditor=S(P),this._breakpointPopoverId=`arcade-debugger-console-breakpoints-${u()}`,this.modelId=""}static{this.properties={debuggerStore:0,modelId:1}}static{this.styles=[V,z,L()]}get breakpoints(){return this.debuggerStore?.debuggerBreakpoints??[]}get previewTabsState(){return this.debuggerStore.previewTabsState}get lazyTreeState(){return this.debuggerStore?.lazyTreeState}load(){this.manager.onLifecycle(()=>{let e=$(this.el,["class"],this.updateTheme.bind(this));return this.updateTheme(),()=>e()})}getContentAtLine(e){if(!this.modelId)return"";let t=this._monacoEditor.getModel(T.parse(this.modelId));return t?t.getLineContent(e):""}updateTheme(){k(this.el)==="dark"?this.elementInternals.states.add(b):this.elementInternals.states.delete(b)}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||!v(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||!v(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,s;if(A(e)){let o=await e.load();s=this.findCollectionItemByPreviewSegment(o,i)}else s=this.getExpandedDebuggerChild(e,i);return await this.resolvePreviewValueFromSegments(s,a)}async resolvePreviewValue(e){let t=this.debuggerStore?.executionState?.result;if(!t)return;let i=C(e);if(!i)return;let{scopeName:a,rootName:s,pathSegments:o}=i,c=a==="globals"?t.globals:a==="locals"?t.locals:null;if(c)return await this.resolvePreviewValueFromSegments(c.get(s),o)}async loadPreview({label:e,sourcePath:t,value:i}){let a=this.previewTabsState,{snapshot:s}=a.startLoad(e,t),o=i;if(o==null)try{o=await this.resolvePreviewValue(t)}catch{a.setError(s,this.getPreviewLoadErrorMessage());return}if(o==null||!I(o)||typeof o.querySample!="function"||typeof o.schema!="function"){a.setUnavailable(s,this.messages.previewunavailable??"This preview is no longer available in the current paused state.");return}try{let{fields:c,features:d}=await o.querySample(),F=this.getPreviewRows(d);a.setLoaded(s,c,F)}catch{a.setError(s,this.getPreviewLoadErrorMessage())}}activateTab(e){if(e===n){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"})})}renderPreviewLabel(e){return r`<bdi>${e}</bdi>`}renderPreviewCell(e){return e?B(e)||M(e)?D({value:e}):r`<span class="xs"></span>`:r`<span class="xs"></span>`}renderScopeEntryForScope(e,t,i){let[a,s]=i,o=`${t}.${a}`,c=this.lazyTreeState;return c?N({name:a,value:s,messages:this.messages,path:`${e}.${a}`,lazyTreeState:c,previewLabel:o,previewSourcePath:E(e,a),previewLoading:this.previewTabsState.isTabLoading(o),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=${w(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.debuggerStore?.executionState?.result,t=!!(e?.locals&&e.locals.size>0),i=Array.from(e?.globals??[]),a=Array.from(e?.locals??[]);return e?r`<calcite-tree .scale=${l.scale} @calciteTreeSelect=${l.oncalciteTreeSelect} .lines=${l.lines} .selectionMode=${l.selectionMode}><calcite-tree-item expanded>${this.messages.global??"Global"}<calcite-tree slot=children .lines=${l.lines} .selectionMode=${l.selectionMode} .scale=${l.scale} @calciteTreeSelect=${l.oncalciteTreeSelect}>${i.map(s=>this.renderScopeEntryForScope("globals",this.messages.global??"Global",s))}</calcite-tree></calcite-tree-item><calcite-tree-item expanded .disabled=${!t}>${this.messages.local??"Local"}<calcite-tree slot=children .lines=${l.lines} .selectionMode=${l.selectionMode} .scale=${l.scale} @calciteTreeSelect=${l.oncalciteTreeSelect}>${t?a.map(s=>this.renderScopeEntryForScope("locals",this.messages.local??"Local",s)):r`<span><i>${this.messages.nolocalscope??"No local scope"}</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(s=>r`<th><bdi>${s}</bdi></th>`)}</tr></thead><tbody>${a.map(s=>r`<tr>${t.map(o=>r`<td>${this.renderPreviewCell(s.get(o))}</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=${n} .selected=${e===n} @calciteTabsActivate=${t=>this.activateTab(t.target.tab)}>${this.messages.scope??"Scope"}</calcite-tab-title>${g(this.previewTabsState.tabs,t=>`title-${t.id}`,t=>r`<calcite-tab-title .tab=${t.id} title=${t.label??p} 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=${n} .selected=${e===n}><div class="tab-panel">${this.renderScopePanel()}</div></calcite-tab>${g(this.previewTabsState.tabs,t=>`panel-${t.id}`,t=>r`<calcite-tab .tab=${t.id} .selected=${e===t.id}><div class="tab-panel preview-panel">${this.renderPreviewPanel(t)}</div></calcite-tab>`)}</calcite-tabs>`}render(){let{line:e}=this.debuggerStore?.executionState??{},t=this.breakpoints.find(a=>a.line===e),i=this.breakpoints.findIndex(a=>a.line===e);return r`<div class="console-shell"><div class="breakpoint-header"><arcgis-code-viewer language=arcade class="breakpoint-code-viewer" .lineNumbers=${a=>String(a+(t?.line??e??1)-1)}>${this.getBreakpointCode(t?.line??this.breakpoints[0]?.line??e??1)}</arcgis-code-viewer>${this.breakpoints.length?r`<calcite-action id=${this._breakpointPopoverId??p} 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>`}};x("arcgis-arcade-debugger-console",h);return h},a,b,c,d,e)
|
|
@@ -0,0 +1,2 @@
|
|
|
1
|
+
/* COPYRIGHT Esri - https://js.arcgis.com/5.1/LICENSE.txt */
|
|
2
|
+
var c=new Set,f;var l=e=>typeof e=="string"?e:"el"in e?e.el.localName:"localName"in e?e.localName:e.declaredClass,p=(e,a,t,o)=>{let n=l(a);if(o?.once){let r=`${e}${n}${t}`;if(c.has(r))return;c.add(r)}let s;if(o?.detail){s={};for(let[r,i]of Object.entries(o.detail))if((typeof i=="object"||typeof i=="function")&&i!==null){let g=new WeakRef(i);Object.defineProperty(s,r,{enumerable:!0,get(){return g.deref()}})}else s[r]=i;f?.log.interceptors?.forEach(r=>r(e,n,t,s)),console[e](`[${n}]: ${t}`,s)}else f?.log.interceptors?.forEach(r=>r(e,n,t)),console[e](`[${n}]: ${t}`)},u=e=>{let a=`[${l(e)}] `;return t=>{let o=t instanceof Error&&t.message?t:new Error(String(t));o.message=`${a}${o.message}`,setTimeout(()=>{throw t})}};export{p as a,u as b};
|
|
@@ -1,2 +1,2 @@
|
|
|
1
1
|
/* COPYRIGHT Esri - https://js.arcgis.com/5.1/LICENSE.txt */
|
|
2
|
-
import a from"./
|
|
2
|
+
import a from"./TNA5F36E.js";import{H as z,j as l,p as V,q as E}from"./REL6OK2I.js";export default $arcgis.t(([{a:y}])=>{var U=/^[$A-Z_a-z][$\w]*$/u;function q(e){return e.replaceAll("\\","\\\\").replaceAll('"','\\"')}function H(e){return U.test(e)}function B(e){return typeof e=="number"?`[${e}]`:e.startsWith("name:")?`[name="${q(e.slice(5))}"]`:e.startsWith("id:")?`[id="${q(e.slice(3))}"]`:H(e)?`.${e}`:`["${q(e)}"]`}function R(e,t){if(e[t]!=='"')return;let i="",a=t+1;for(;a<e.length;){let m=e[a];if(m==="\\"){if(a+=1,a>=e.length)return;i+=e[a],a+=1;continue}if(m==='"')return{value:i,nextIndex:a+1};i+=m,a+=1}}function J(e){if(!e)return;let t=0,i=[];for(;t<e.length&&/[$A-Z_a-z0-9]/u.test(e[t]);)t+=1;let a=e.slice(0,t);if(!a)return;for(;t<e.length;){let p=e[t];if(p==="."){t+=1;let c=t;for(;t<e.length&&/[$\w]/u.test(e[t]);)t+=1;if(c===t)return;i.push(e.slice(c,t));continue}if(p!=="[")return;if(t+=1,/\d/u.test(e[t]??"")){let c=t;for(;t<e.length&&/\d/u.test(e[t]);)t+=1;if(e[t]!=="]")return;i.push(e.slice(c,t)),t+=1;continue}let f=e.startsWith("name=",t)?"name":e.startsWith("id=",t)?"id":void 0;if(f){let c=R(e,t+f.length+1);if(!c||e[c.nextIndex]!=="]")return;i.push(`${f}:${c.value}`),t=c.nextIndex+1;continue}let u=R(e,t);if(!u||e[u.nextIndex]!=="]")return;i.push(u.value),t=u.nextIndex+1}let[m,...s]=i;if(m)return{scopeName:a,rootName:m,pathSegments:s}}function de(e,t){return`${e}${B(t)}`}function M(e,t){return e?`${e}.${t}`:String(t)}function k(e,t){if(e)return`${e}${B(t)}`}function pe(e){return J(e)}function N(e,t){return typeof t=="number"?`${e}[${t}]`:`${e}.${t}`}function K(e){return e.name?`name:${e.name}`:`id:${e.id}`}function Q(e){return Object.entries(e).filter(([t])=>t!=="featureSet")}function X(e,t){if(t){let i=t.featureSet;return{kind:"feature-set",displayValue:i.arcadeType,featureSetValue:i,loadRequest:{kind:"schema",load:()=>i.schema()},mergedCollectionItem:t}}return e.type==="feature-set"?{kind:"feature-set",displayValue:e.arcadeType,featureSetValue:e,loadRequest:{kind:"schema",load:()=>e.schema()}}:e.type==="feature-set-collection"?{kind:"collection",collectionValue:e,displayValue:e.arcadeType,loadRequest:{kind:"collection",load:()=>e.load()}}:null}function x(e){return l`<calcite-tree slot=children .lines=${y.lines} .selectionMode=${y.selectionMode} .scale=${y.scale} @calciteTreeSelect=${y.oncalciteTreeSelect}>${e}</calcite-tree>`}function D({lazyTreeState:e,nodePath:t,mergedCollectionItem:i,expanded:a=!1,isMetadata:m=!1,messages:s,name:p,value:f,loadPreview:u,previewLabel:c,previewSourcePath:b,previewLoading:g=!1}){let o=X(f,i);if(!o)return null;let n=e.ensureNode(t,a,o.loadRequest),$=o.kind==="feature-set"?o.featureSetValue:void 0,S=c??String(p),v=b??t,C=!!(u&&S&&$&&typeof $.querySample=="function"),d=r=>{r.target===r.currentTarget&&e.setExpanded(t,!0,o.loadRequest)},h=r=>{r.target===r.currentTarget&&e.setExpanded(t,!1,o.loadRequest)},I=r=>{r.stopPropagation(),!(!u||!S||!$)&&u({label:S,sourcePath:v,value:$})},w=()=>l`<calcite-tree-item disabled><div class="tree-item-label"><span class="constant-value">${n.errorMessage||(s.loaderror??"Unable to load data.")}</span></div></calcite-tree-item>`,G=()=>o.kind!=="feature-set"||!n.schemaValue?null:T({name:"schema",value:n.schemaValue,messages:s,path:N(t,"schema"),lazyTreeState:e}),Z=()=>o.kind!=="feature-set"||!o.mergedCollectionItem?[]:Q(o.mergedCollectionItem).map(([r,P])=>T({name:r,value:Y(P),messages:s,path:N(t,r),lazyTreeState:e})),_=()=>{if(o.kind!=="feature-set")return null;if(!n.expanded||n.status==="loading")return x();let r=[];if(n.status==="error")r.push(w());else{r.push(...Z());let P=G();P&&r.push(P)}return r.length?x(r):x()},j=()=>o.kind!=="collection"?null:!n.expanded||n.status==="loading"?x():x(l`${n.status==="error"?w():null}${n.status==="loaded"?n.collectionItems.map(r=>D({name:r.name||r.id,mergedCollectionItem:r,messages:s,nodePath:N(t,r.id),lazyTreeState:e,value:r.featureSet,loadPreview:u,previewLabel:M(c,r.name||r.id),previewSourcePath:k(v,K(r)),previewLoading:g})):null}`),O=()=>o.kind==="collection"?j():_();return l`<calcite-tree-item .expanded=${n.expanded} @calciteTreeItemExpand=${d} @calciteTreeItemCollapse=${h}><div class="tree-item-label">${L({name:p,isMetadata:m})}<bdi>${o.displayValue}</bdi></div>${n.status==="loading"?l`<calcite-loader slot=actions-end scale=s inline type=indeterminate .label=${s.loading??"Loading"} .text=${s.loading??"Loading"}></calcite-loader>`:null}${C?l`<calcite-action slot=actions-end scale=s class="load-action" .text=${s.loadpreview??"Load preview"} text-enabled icon=play icon-flip-rtl .disabled=${g} @click=${I}></calcite-action>`:null}${O()}</calcite-tree-item>`}function Y(e){if(e==null)return{type:"primitive",arcadeType:"",value:null};switch(typeof e){case"boolean":return{type:"primitive",arcadeType:"Boolean",value:e};case"number":return{type:"primitive",arcadeType:"Number",value:e};case"string":return{type:"primitive",arcadeType:"String",value:e};default:return{type:"primitive",arcadeType:"String",value:String(e)}}}var A="tree-item-metadata";function L({name:e,isMetadata:t=!1}){let i=t?`dictionary-property ${A}`:"dictionary-property",a=t?A:void 0;return l`<bdi class=${z(i)}>${e}</bdi><bdi class=${z(a)}>: </bdi>`}function ee({lazyTreeState:e,path:t,expanded:i=!1,value:a,subtree:m,messages:s,onLoadPreview:p,previewLabel:f,previewSourcePath:u,previewLoading:c=!1}){let b=d=>l`<calcite-tree slot=${"children"} .lines=${y.lines} .selectionMode=${y.selectionMode} .scale=${y.scale} @calciteTreeSelect=${y.oncalciteTreeSelect}>${d}</calcite-tree>`;if(!i)return b();let g=e.ensureNode(t,i),o=d=>g.visibleChildCount>=d?null:l`<calcite-tree-item @click=${h=>{h.stopPropagation(),e.showMore(t,d)}}><div class="tree-item-label"><span class=${z(A)}>${s.showmore??"Show more"}</span></div></calcite-tree-item>`,n=a.expand();if(Array.isArray(n)){let d=n.slice(0,g.visibleChildCount),h=F(a)?a.length:n.length;return b(l`${d.map((I,w)=>T({name:w,value:I,messages:s,path:`${t}[${w}]`,lazyTreeState:e,onLoadPreview:p,previewLabel:M(f,w),previewSourcePath:k(u,w),previewLoading:c}))}${o(n.length)}${T({name:"length",value:{arcadeType:"Number",type:"primitive",value:h},isMetadata:!0,messages:s,path:`${t}.length`,lazyTreeState:e})}`)}let $=a.arcadeType==="Feature"?n.get("Geometry()"):void 0,S=Math.min(g.visibleChildCount,$?n.size-1:n.size),v=[];for(let[d,h]of n.entries())if(!(d==="Geometry()"&&a.arcadeType==="Feature")){if(v.length>=S)break;v.push([d,h])}let C=!!($&&g.visibleChildCount>v.length);return b(l`${v.map(([d,h])=>T({name:d,value:h,messages:s,path:`${t}.${d}`,lazyTreeState:e,onLoadPreview:p,previewLabel:M(f,d),previewSourcePath:k(u,d),previewLoading:c}))}${C?T({name:"geometry",value:$,messages:s,path:`${t}.geometry`,lazyTreeState:e,onLoadPreview:p,previewLabel:M(f,"geometry"),previewSourcePath:k(u,"geometry"),previewLoading:c}):null}${o(n.size)}`)}function te(e){return"expand"in e}function ae(e){return e.type==="simple"}function ie(e){return e.type==="primitive"}function F(e){return e.type==="sequence-container"}function ne(e){return e.type==="feature-set"}function re(e){return e.type==="feature-set-collection"}function le(e){return ne(e)||re(e)}function T({lazyTreeState:e,path:t,name:i,value:a,messages:m,expanded:s,isMetadata:p=!1,onLoadPreview:f,previewLabel:u,previewSourcePath:c,previewLoading:b=!1}){if(a===void 0)return null;if(a===null)return l`<calcite-tree-item .expanded=${s}><div class="tree-item-label">${L({name:i,isMetadata:p})}<bdi class="uninitialized-value tree-item-metadata">${m.uninitialized??"uninitialized"}</bdi></div></calcite-tree-item>`;if(te(a)){let g=e.ensureNode(t,s),o=v=>{v.target===v.currentTarget&&e.setExpanded(t,!0)},n=v=>{v.target===v.currentTarget&&e.setExpanded(t,!1)},$=typeof a.arcadeType=="string"?a.arcadeType:"unknown",S=F(a)?`${V($)}(${a.length})`:V($);return l`<calcite-tree-item .expanded=${g.expanded} @calciteTreeItemExpand=${o} @calciteTreeItemCollapse=${n}><div class="tree-item-label">${L({name:i,isMetadata:p})}<bdi>${S}</bdi></div>${ee({expanded:g.expanded,value:a,subtree:!0,messages:m,path:t,lazyTreeState:e,onLoadPreview:f,previewLabel:u,previewSourcePath:c,previewLoading:b})}</calcite-tree-item>`}return le(a)?D({name:i,value:a,nodePath:t,lazyTreeState:e,messages:m,expanded:s,isMetadata:p,loadPreview:f,previewLabel:u,previewSourcePath:c,previewLoading:b}):ae(a)?l`<calcite-tree-item .expanded=${s}><div class="tree-item-label">${L({name:i,isMetadata:p})}${W({value:a})}</div></calcite-tree-item>`:ie(a)?l`<calcite-tree-item .expanded=${s}><div class="tree-item-label">${L({name:i,isMetadata:p})}${W({value:a})}</div></calcite-tree-item>`:null}var W=({value:e})=>{switch(e.type){case"primitive":if(e.value===null)return l`<bdi class="constant-value">null</bdi>`;switch(e.arcadeType){case"String":return l`<bdi class="string-value">${E(String(e.value))}</bdi>`;case"Number":return l`<bdi class="number-value">${String(e.value)}</bdi>`;case"Boolean":return l`<bdi class="constant-value">${String(e.value)}</bdi>`;default:return null}case"simple":return l`<bdi class="date-value">${e.render()}</bdi>`;case"minimal":return l`<bdi class="constant-value">${e.arcadeType}</bdi>`;default:return null}};return{a:de,b:pe,c:te,d:ae,e:ie,f:ne,g:re,h:T,i:W}},a)
|
|
@@ -1,2 +1,2 @@
|
|
|
1
1
|
/* COPYRIGHT Esri - https://js.arcgis.com/5.1/LICENSE.txt */
|
|
2
|
-
import c from"./
|
|
2
|
+
import c from"./GZ6HZKQZ.js";import a from"./ZHZFKZA7.js";import{b as y,c as h,d as b}from"./G56LJGLK.js";import{b as u}from"./GS2ISVXJ.js";import{L as f}from"./REL6OK2I.js";export default $arcgis.t(([{i:m,n:d},{l:g,o:F,p:M}])=>{var A=o=>{let t=o.variables[0],i=t?.type==="featureSet"?w(t):void 0,{apiVersion:e,bundles:a,hiddenApiItems:r}=o.toEditorProfileDefinition();return{apiVersion:e,bundles:a,variables:i?[i]:[],hiddenApiItems:r?.map(s=>s.toLowerCase())}};function w(o){let{name:t}=o,i=o.getDescription(),{definition:e}=o.toProfileVariableDefinition(),a={label:t,detail:t,insertText:t,insertTextMode:b.asIs,insertTextFormat:h.PlainText,kind:y.Field},r={name:t,description:i,type:"dictionary",properties:[],completion:a};if(!e||!("fields"in e))return r;let[s,l]=g(e.fields,i);return r.properties=s,a.documentation={kind:"markdown",value:l},r}var I={id:"field-calculation",variables:[{name:"$layer",type:"featureSet",description:"The layer being calculated."}]};function P(){return I}function T(o){if(!d(o))return;let t=P();if(!t)return;let i={variables:[],hiddenApiItems:o.hiddenApiItems?.map(e=>e.toLowerCase())};return t.variables.forEach(e=>{if(o.disabledVariables?.includes(e.name))return;let a=o.definitions[e.name];if(e.type==="featureSet")return m(a)?i.variables.push({...e,type:e.type,definition:a}):void 0;throw Error(`sdkVariable type not supported (yet) type: ${e.type}`)}),i}var x="arcgis-sql-expression",p=class extends M{constructor(){super(x,{apiPath:"./assets/sql-language/api",apiPrefix:"sql-api.t9n."}),this._languageId=x,this._layerMap=new Map}updateFeatureLayerForModel(t,i){let e=this._getApiKey(t);this._layerMap.set(e,i)}getFeatureLayerForModel(t){let i=this._getApiKey(t);return this._layerMap.get(i)}async setProfileForModel(t,i,e={locale:"en"}){d(i)&&(i=T(i));let a=await u(e.locale,f("./assets/editor-profile/t9n"),"messages.");if(!a)throw new Error(`Failed to load the language bundle for ${e.locale}`);this.disposeForModel(t);let r=this._getApiKey(t),s=new F(i,a);this._modelToProfileMap.set(r,s);let l=A(s);this.updateApiContextForModel(t,{locale:e.locale,profile:l});let c=i?.variables?.find(v=>v.name==="$layer");c&&this.updateFeatureLayerForModel(t,c.definition)}},n=new p,C={setProfileForModel:n.setProfileForModel.bind(n),getApiLibraryForModel:n.getApiLibraryForModel.bind(n)};async function S(){return await import("./JQQBQXPD.js").then(m=>m.default)}return{a:n,b:S}},a,c)
|
|
@@ -1,4 +1,4 @@
|
|
|
1
1
|
/* COPYRIGHT Esri - https://js.arcgis.com/5.1/LICENSE.txt */
|
|
2
|
-
import{a as F}from"./NZDJGAT2.js";import c from"./PNIRJAMR.js";import b from"./QVWSOD3N.js";import a from"./ZHZFKZA7.js";import{c as ie,d as se}from"./AHFU2DJA.js";import"./G56LJGLK.js";import"./ER2MKLVA.js";import"./MP6Z45SA.js";import{d as oe}from"./IFNCCZ7O.js";import{a as te}from"./BA546EMZ.js";import"./MJ7MJPGA.js";import"./MTIHPCIF.js";import"./6G5URSC7.js";import"./6C52UOYL.js";import{E as W,F as K,G as X,H as Z,I,K as ee,h as Q,j as l,k as j,l as R,t as H,w as G,x as J,y as Y}from"./SM3MA3KP.js";import{a as w}from"./BCUUVBXH.js";import"./B3UMUBOI.js";import"./CF3TERM3.js";import"./Z5ZZ36DQ.js";import"./LLPQEURF.js";import"./3TTFCHAA.js";export default $arcgis.t(([xe,ne,Se,re,ce,{getDeclaredVoxelMembers:Te,getDeclaredPixelMembers:Ae},Ce,{property:g,subclass:Ie},{G:q,w:ae,x:V},,N])=>{var A=class extends Y{constructor(e){if(super(e),this.it=R,e.type!==G.CHILD)throw Error(this.constructor.directiveName+"() can only be used in child bindings")}render(e){if(e===R||e==null)return this._t=void 0,this.it=e;if(e===j)return e;if(typeof e!="string")throw Error(this.constructor.directiveName+"() called with a non-string value");if(e===this.it)return this._t;this.it=e;let t=[e];return t.raw=t,this._t={_$litType$:this.constructor.resultType,strings:t,values:[]}}};A.directiveName="unsafeHTML",A.resultType=1;var C=J(A);var Me=Q`:host(:not([closed])){container-type:size;--calcite-block-border-color: var(--calcite-color-transparent);box-sizing:border-box;.submission-actions-wrapper{display:flex;flex-direction:column;width:100%;gap:.75rem}.submission-actions{display:flex;flex-direction:row;gap:.5rem;justify-content:space-between}@container (max-width: 380px){.hidden-below-380{display:none}}@container (min-width: 380px){.hidden-above-380{display:none}}.gaps{display:flex;gap:.25rem}.align-inline-end{margin-inline-start:auto}.context-popover p{padding:0 .5rem;font-size:var(--calcite-font-size-sm)}.feedback-content{padding:var(--calcite-spacing-sm);display:flex;flex-direction:column;max-height:75cqb;overflow-y:auto;>*{margin-block-end:.5rem}>*:last-child,.terms-label{margin-block-end:0}calcite-text-area{--calcite-text-area-min-height: 4rem}calcite-notice{margin-block-start:0}}.feedback-sheet{--calcite-sheet-height: auto;--calcite-sheet-max-height: 100%;--calcite-sheet-min-height: auto}.feedback-footer{display:flex;justify-content:flex-end;gap:.5rem;width:100%}calcite-chip[slot=header-actions-end]{align-self:center;margin-inline-end:.5rem}calcite-flow-item calcite-shell{background:transparent}calcite-block{width:100%;max-width:100%;align-self:flex-end;background-color:transparent;margin-block:0}calcite-sheet{--calcite-sheet-scrim-background: rgba(200, 200, 200, .5)}calcite-list-item calcite-button{margin-inline-end:.25rem}calcite-flow-item calcite-shell calcite-notice{margin-block:1rem}calcite-block[open]:last-of-type{border-block-end:0}.text-area-wrapper{display:flex;border-radius:var(--calcite-corner-radius-round);margin:.75rem;overflow:hidden;--calcite-color-border-input: transparent;position:sticky;box-shadow:var(--calcite-shadow-sm);flex:none;flex-direction:column}calcite-text-area{height:auto;overflow:hidden;--calcite-font-weight-normal: 500;font-weight:500;line-height:1.2}calcite-flow{height:100%}calcite-popover calcite-list{--calcite-list-background-color: transparent;--calcite-input-border-color: transparent}calcite-popover calcite-list calcite-filter{--calcite-spacing-sm: 0}.contained-popover-or-tooltip{--calcite-popover-max-size-x: 100%;--calcite-tooltip-max-size-x: 100%}.info-heading{font-size:var(--calcite-font-size-0);color:var(--calcite-color-text-1);margin:0}.info-heading-row{display:flex;align-items:center;gap:var(--calcite-spacing-sm);flex-wrap:wrap}.unstyled-h3{margin:unset;font-size:var(--calcite-font-size-md)}.unstyled-shell{position:unset;inset:unset;display:unset;block-size:unset;inline-size:unset}.suggestion-button{font-weight:var(--calcite-font-weight-medium)}.suggestions{display:flex;flex-direction:row;gap:var(--calcite-spacing-xs);flex-wrap:wrap}.info-block{max-width:450px}#result-block{calcite-card-group{--calcite-card-group-gap: 1.25rem}calcite-card{--calcite-card-corner-radius: var(--calcite-corner-radius-round);--calcite-card-border-color: transparent;width:100%}.positioned-code-content{display:flex;flex-direction:row;gap:.5rem;padding:.5rem}calcite-card [slot=heading] calcite-chip{margin-block-start:.25rem}.code-response-wrapper{position:relative;background:var(--calcite-color-foreground-2);border-radius:var(--calcite-corner-radius-round);margin-top:-1.5rem}.prior-prompt{display:flex;flex-direction:row;padding:0;overflow-y:hidden;overflow-x:auto;margin:.25rem 0 .75rem;align-items:center;max-width:100%;span{overflow-x:auto;overflow-y:hidden}}.copy-feedback{display:none}.copy-prompt-button{align-self:flex-start;margin-inline-start:auto}.response-secondary-action-button[data-copied]+.copy-feedback,.copy-prompt-button[data-copied]+.copy-feedback{display:block;span{padding:.75rem 1rem;font-size:var(--calcite-font-size--2);line-height:1.375;color:var(--calcite-color-text--2);font-weight:var(--calcite-font-weight-medium)}}.copy-prompt-button[data-copied]~.copy-tooltip,.response-secondary-action-button[data-copied]~.copy-tooltip{display:none}code{white-space:pre;font-size:12px;margin:0;overflow-x:auto;font-family:Fira Mono,Consolas,Menlo,monospace;display:block;max-height:12rem;position:relative;padding:.5rem}.response-secondary-action-button{margin-left:.5rem}.add-to-editor-button{--calcite-internal-button-border-color: unset}}.collapsible-code{padding:.5rem}.collapsible-code summary{cursor:pointer;font-weight:500;color:var(--calcite-color-brand);outline:none;padding:.25rem 0}.collapsible-code[open] summary{color:var(--calcite-color-text-2)}.response-error-container{padding:.5rem;background:color-mix(in srgb,var(--calcite-color-status-warning) 10%,transparent);border-radius:var(--calcite-corner-radius-round);margin:1rem 0;font-size:var(--calcite-font-size--2);--calcite-input-message-icon-color: var(--calcite-color-status-warning)}.response-error-chip{--calcite-internal-chip-background-color: var(--calcite-color-status-warning);--calcite-chip-icon-color: var(--calcite-color-foreground-1);--calcite-chip-border-color: var(--calcite-color-transparent)}.feedback-actions{gap:unset}.contained{max-width:100%;max-height:100%;max-width:100cqi;max-height:75cqb;overflow-y:auto}.submission-notice{--calcite-notice-border-color: transparent;margin-block:0;width:100%;--calcite-font-size-relative-base: var(--calcite-font-size--2)}.border-block-end{border-block-end:1px solid var(--calcite-color-border-3)}.round-top{border-radius:var(--calcite-corner-radius-round) var(--calcite-corner-radius-round) 0 0}}:host([closed]){display:none}`,$=class extends Error{constructor({message:e,code:t,subCode:i,details:o,source:n}){super(e),this.name="ArcadeAssistantError",this.code=t,this.subCode=i,this.details=o,this.source=n}};function le(a){if(!a)return;let e=a.indexOf('{"error":');if(e!==-1)try{let t=a.slice(e),i=JSON.parse(t);if(i&&typeof i=="object"&&i.error)return i.error}catch{return}}async function Ee(a){let{baseUrl:e,skillId:t,message:i,authToken:o,previousConversationId:n,context:c}=a,p=t?`${e}/skills/${t}/chat`:`${e}/chat`,r=[],s={message:i,context:c};n&&(s.conversation_id=n);let u;try{u=await ne(p,{method:"post",headers:{"Content-Type":"application/json",token:o},body:JSON.stringify(s),responseType:"json"})}catch(b){let f=b,x=f.details?.rawResponse||f.message||String(b),S=le(x);throw S?new $(S):b}let d=u.data;r.push(d);let v=d.conversationId,z=d.inquiryId,k=d.sequenceNumber;async function M(){let b=0,f=100;for(;b<f;){await new Promise(T=>setTimeout(T,1e3));let x=Re(v,k,z),S;try{S=await ne(p,{method:"post",headers:{"Content-Type":"application/json",token:o},body:JSON.stringify(x),responseType:"json"})}catch(T){let L=T,ke=L.details?.rawResponse||L.message||String(T),B=le(ke);throw B?new $(B):T}let y=S.data;if(y.context?.kind==="ArcgisErrorAsContext"&&y.context.error)throw new $({message:y.context.error.message||"ArcGIS Assistant error",code:y.context.error.code,subCode:y.context.error.subCode,details:y.context.error.details,source:"polling-response"});if(r.push(y),k=y.sequenceNumber,b++,!y.hasMore)break}if(b===f)throw new $({message:"Request timed out",code:"TIMEOUT",source:"polling"})}let E=120*1e3;return await Promise.race([M(),new Promise((b,f)=>setTimeout(()=>f(new $({message:"Request timed out",code:"TIMEOUT",source:"hard-timeout"})),E))]),r}function Re(a,e,t){return{conversationId:a,inquiryId:t,ackSequenceNumber:e}}function Ve(a){return a.message.match(/Error in prompt shield/u)?"I'm having trouble with this request. Try again by rephrasing the question.":a.code==="TIMEOUT"?"Request timed out. Try again by re-asking the same question or rephrasing it.":a.message}var qe=({notices:a})=>a.length?l`<div class="border-block-end">${F(a,e=>e.id??e.title,e=>l`<calcite-notice class="submission-notice" .icon=${e.icon} .kind=${e.kind} scale=s open .closable=${e.closable} @calciteNoticeClose=${()=>e.onClose?.()}><div slot=title>${e.title}</div>${e.message&&l`<div slot=message>${e.message}</div>`||""}${e.actionLinkMessage&&e.onAction&&l`<calcite-link slot=link @click=${()=>e.onAction?.()}>${e.actionLinkMessage}</calcite-link>`||""}</calcite-notice>`)}</div>`:null,Ne=a=>{let e=a.value.length,t=72,i=180,o=a.offsetWidth,n=Math.max(1,Math.floor(o/8)),c=Math.ceil(e/n),p=t+(c-2)*24;a.style.setProperty("--calcite-text-area-min-height",`${Math.min(p,i)}px`)},Fe=({promptValidationMessage:a,errorMessage:e,contextTooBig:t,contextReducedNoticeDismissed:i,setContextReducedNoticeDismissed:o,setErrorMessage:n,messages:c})=>{let p=[];if(a&&p.push({id:"prompt-validation",kind:"danger",icon:"exclamation-mark-triangle",title:a,closable:!0}),e&&p.push({id:"assistant-error",kind:"danger",icon:"exclamation-mark-triangle",title:e,closable:!0,onClose:()=>n(void 0)}),t&&!i){let r=c.contextreduced??"Context reduced",s=c.contextreducedmessage??"The editor profile is too large for the assistant. It has been reduced in the assistant in order to ensure a successful request.";p.push({id:"context-reduced",kind:"warning",icon:"exclamation-mark-triangle",title:r,message:s,closable:!0,onClose:()=>o(!0)})}return p};function Pe({messages:a}){return l`<calcite-chip slot=header-actions-end scale=s appearance=outline-fill .label=${a.beta??"Beta"}>${a.beta??"Beta"}</calcite-chip>`}function De({popoverContent:a,messages:e}){return l`<calcite-action icon=information slot=header-actions-end id=legal-disclaimer text></calcite-action><calcite-popover reference-element=legal-disclaimer .label=${e.legaldisclaimer??"Legal disclaimer"} placement=bottom auto-close focus-trap-disabled><div class="contained">${a}</div></calcite-popover>`}function _e({errorMessage:a,slot:e}){return l`<div class="error-display"><calcite-input-message id=error-message status=invalid icon=exclamation-mark-triangle scale=m slot=${e??I}>${a}</calcite-input-message></div>`}function Ue({active:a,setActive:e,messages:t}){return l`<calcite-alert slot=alerts .open=${a} placement=bottom kind=success icon=check-circle-f auto-close @calciteAlertClose=${()=>e(!1)} .label=${t.expressionapplied??"Expression applied"}><div slot=message>${t.expressionapplied??"Expression applied to editor."}</div></calcite-alert>`}function Oe({context:a,messages:e}){return a?l`<div class="gaps">${a.profileId&&l`<calcite-popover auto-close placement=top .label=${(e.profilecontextlabel??"Profile context: {profileId}").replace("{profileId}",a.profileId)} reference-element=profile-context-button class="context-popover contained-popover-or-tooltip"><p>${(e.profilecontextlabel??"Profile context: {profileId}").replace("{profileId}",a.profileId)}</p></calcite-popover><calcite-button round kind=neutral icon-start=map-information id=profile-context-button scale=s></calcite-button>`||""}</div>`:null}function ze({isDisabled:a,isReadOnly:e,setQuestion:t,setIsViewingResult:i,textAreaRef:o,question:n,errorMessage:c,setErrorMessage:p,promptValidationMessage:r,setPromptValidationMessage:s,submitQuestion:u,messages:d,mode:v,assistantRef:z,context:k,contextReducedNoticeDismissed:M,setContextReducedNoticeDismissed:E}){let b=k?.contextTooLarge??!1,f=Fe({promptValidationMessage:r,errorMessage:c,contextTooBig:b,contextReducedNoticeDismissed:M,setContextReducedNoticeDismissed:E,setErrorMessage:p,messages:d});return l`<div class="text-area-wrapper">${qe({notices:f})}<calcite-text-area scale=s resize=vertical .readOnly=${a||e} class=${Z(f.length?"submission-text-area":"submission-text-area round-top")} .placeholder=${d.askaquestion??`Specify the calculation or logic you need in an Arcade expression. (e.g., 'Return "Yes" if value > 10')`} .value=${n} @calciteTextAreaInput=${x=>{Ne(x.target),t(x.target.value)}} ${K(o)}><div class="submission-actions-wrapper" slot=footer-start><div class="submission-actions">${k&&Oe({context:k,messages:d})||""}<div class="align-inline-end gaps"><calcite-button round kind=neutral .hidden=${v!=="refine"} icon-start=arrow-left icon-flip-rtl=both appearance=solid scale=s .disabled=${a} @click=${async()=>{i(!1),t("")}} .label=${d.startover??"Start Over"} class="hidden-above-380" id=small-start-over-button></calcite-button><calcite-tooltip reference-element=small-start-over-button placement=top-start class="hidden-above-380">${d.startover??"Start Over"}</calcite-tooltip><calcite-button round kind=neutral .hidden=${v!=="refine"} icon-start=arrow-left icon-flip-rtl=both appearance=solid .disabled=${a} @click=${async()=>{i(!1),t("")}} class="hidden-below-380" scale=s>${d.startover??"Start Over"}</calcite-button><calcite-button round scale=s icon-end=effects appearance=solid .loading=${a} .disabled=${a} @click=${async()=>{if(p(""),!n){s(d.enteraprompt??"Please enter a prompt");return}s(void 0),await u()}} class="hidden-below-380">${v==="prompt"?d.ask??"Generate":d.refine??"Refine"}</calcite-button><calcite-button round scale=s icon-end=effects appearance=solid .loading=${a} .disabled=${a} id=small-submit-button @click=${async()=>{if(p(""),!n){s(d.enteraprompt??"Please enter a prompt");return}s(void 0),await u()}} class="hidden-above-380" .label=${v==="prompt"?d.ask??"Generate":d.refine??"Refine"}></calcite-button><calcite-tooltip reference-element=small-submit-button placement=top-start class="hidden-above-380">${v==="prompt"?d.ask??"Generate":d.refine??"Refine"}</calcite-tooltip></div></div></div></calcite-text-area></div>`}var Le="https://www.esri.com/en-us/privacy/privacy-statements/privacy-supplement",Be="https://www.esri.com/en-us/privacy/privacy-statements";function Qe({setOpen:a,messages:e,feedback:t,learnMoreUrl:i,setFeedback:o,onSubmit:n}){return t.active?l`<calcite-sheet class="feedback-sheet" .label=${e.feedback??"Feedback"} slot=sheets display-mode=float position=block-end .open=${t.active} @calciteSheetClose=${()=>a(!1)}><calcite-panel .heading=${e.submitfeedback??"Submit feedback to Esri"} scale=s><div class="feedback-content"><calcite-text-area scale=s resize=vertical .value=${t.text} @calciteTextAreaInput=${c=>o({...t,text:c.target.value})} .disabled=${t.submitting} .placeholder=${e.donotincludepersonalinfo??"Do not include personal or sensitive information"} rows=3></calcite-text-area><calcite-label layout=inline scale=s class="terms-label"><calcite-checkbox scale=l .checked=${t.termsAccepted} @calciteCheckboxChange=${c=>{o({...t,termsAccepted:c.target.checked})}} .disabled=${t.submitting}></calcite-checkbox><span>${C((e.agreement??"I agree to the {EsriPrivacyStatement} (and {Supplement}).").replace("{EsriPrivacyStatement}",`<calcite-link href=${Be} target="_blank">${e.esriprivacystatement??"Esri Privacy Statement"}</calcite-link>`).replace("{Supplement}",`<calcite-link href=${Le} target="_blank">${e.supplement??"Supplement"}</calcite-link>`))}</span></calcite-label><calcite-notice scale=s open closable><span slot=message>${C((e.feedbackhelps??"Your feedback will be used to improve Esri products and services. {LearnMore} about how this data is used.").replace("{LearnMore}",`<calcite-link href=${i} target="_blank">${e.learnmore??"Learn more"}</calcite-link>`))}</span></calcite-notice></div><div slot=footer class="feedback-footer"><calcite-button kind=neutral appearance=outline @click=${()=>a(!1)} .disabled=${t.submitting}>${e.cancel??"Cancel"}</calcite-button><calcite-button @click=${n} .disabled=${!t.termsAccepted||t.submitting} .loading=${t.submitting} data-testid=submit-feedback-button>${e.submit??"Submit"}</calcite-button></div></calcite-panel></calcite-sheet>`:null}function de({assistantsEnabled:a,messages:e,slot:t,helpTopicUrl:i}){return l`<calcite-block .label=${e.assistantinformation??"Assistant information"} slot=${t??I} expanded class="info-block" scale=s><div class="info-heading-row"><h1 class="info-heading">${e.introducing??"Introducing Arcade Assistant (beta)"}</h1><calcite-chip .label=${e.new??"New"} kind=brand scale=s>${e.new??"New"}</calcite-chip></div>${a?l`<p>${e.capabilities??"The assistant uses artificial intelligence to generate Arcade expressions."}</p><p>${e.keepinmind??"Keep in mind the following:"}<ul><li>${e.beconsise??"Be concise, but also clear in your request"}</li><li>${e.avoidambiguity??"Avoid ambiguity and vagueness"}</li><li>${e.moredetails??"you do not need to use exact field names in your instructions, but more detail is generally better"}</li></ul>${C((e.seedocumentation??"Please see the {documentation} for more information, including limitations and additional resources.").replace("{documentation}",`<calcite-link href=${i} target="_blank">${e.documentation??"documentation"}</calcite-link>`))}</p>`:l`<p>${e.useofassistant??"The assistant uses artificial intelligence to generate Arcade expressions. To enable Arcade Assistant (beta), the following must be true:"}</p><ul><li>${e.enabledinorg??"AI assistants are enabled in the organization settings"}</li><li>${e.enabledbetaapps??"Beta apps and capabilities are not blocked"}</li><li>${e.enabledroleprivilege??"Your role privilege allows you to use AI assistants"}</li></ul>`}</calcite-block>`}function je({messages:a,onProceed:e,onExit:t,helpTopicUrl:i}){return l`<calcite-dialog close-disabled placement=top .heading=${a.welcome??"Welcome to the new assistant experience"} slot=dialogs open width-scale=m id=welcome-dialog><h3 class="unstyled-h3">${a.beforeyougetstarted??"Before you get started be aware:"}</h3><ul><li>${a.maybeincorrect??"AI generated code may occasionally be incorrect or biased. Review carefully."}</li><li>${C((a.pleasereadhelp??"Read the Arcade Assistant (beta) {helpTopic} to get started and learn details on security, privacy and limitations.").replace("{helpTopic}",`<calcite-link href=${i} target="_blank">${a.helptopic??"help topic"}</calcite-link>`))}</li></ul><calcite-button id=welcome-proceed slot=footer-end @click=${e}>${a.proceed??"Proceed"}</calcite-button><calcite-button id=welcome-decline slot=footer-start @click=${t} kind=neutral>${a.exit??"Exit"}</calcite-button></calcite-dialog>`}function He({messages:a,suggestions:e,onSuggestionClick:t}){return l`<calcite-block .heading=${a.promptsuggestions} expanded collapsible id=suggestion-block scale=s><div class="suggestions">${e.map(i=>l`<calcite-button round scale=s appearance=outline-fill kind=neutral .label=${a.promptsuggestion} class="suggestion-button" @click=${()=>t?.(i)}>${i}</calcite-button>`)}</div></calcite-block>`}var pe=200;function ue({hidden:a=!1,expanded:e=!1,messages:t,cards:i,heading:o,collapsible:n=!1,showEffectsIcon:c=!1,onCopyCode:p,standalone:r}){return l`<calcite-block .hidden=${a} id=result-block .heading=${o??t.besteffort??"Here is the assistant's best effort"} .expanded=${e} .collapsible=${n}>${c&&l`<calcite-chip .label=${t.assistantresponses??"Assistant responses"} slot=content-start icon=effects scale=m class="suggestion-chips"></calcite-chip>`||""}<calcite-card-group .label=${t.assistantresponses??"Assistant responses"}>${F(i,s=>s.conversationId,s=>l`<calcite-card><div slot=heading><div class="prior-prompt"><span>${s.priorPrompt.length>pe?`${s.priorPrompt.slice(0,pe)}...`:s.priorPrompt}</span><calcite-action icon=duplicate scale=s slot=actions-end class="copy-prompt-button" text .id=${`copy-prompt-${s.conversationId}-${r?"standalone":"list"}`} @click=${u=>{let d=u.currentTarget;navigator.clipboard.writeText(s.priorPrompt).then(()=>{d.setAttribute("data-copied","true"),setTimeout(()=>d.removeAttribute("data-copied"),1500)})}}></calcite-action><calcite-popover .referenceElement=${`copy-prompt-${s.conversationId}-${r?"standalone":"list"}`} placement=top-start class="copy-feedback" .label=${t.copiedsuccessfully??"copied successfully"} open trigger-disabled><span>${t.copiedsuccessfully??"copied successfully"}</span></calcite-popover><calcite-tooltip .referenceElement=${`copy-prompt-${s.conversationId}-${r?"standalone":"list"}`} placement=top-start class="copy-tooltip">${t.copyprompttoclipboard??"Copy prompt to clipboard"}</calcite-tooltip></div>${s.message&&r&&l`<div class="response-error-container">${_e({errorMessage:s.message})}</div>`||""}</div><div><div class="code-response-wrapper"><div class="positioned-code-content"><calcite-chip-group .label=${t.responsecontext??"Response Context"} scale=s>${s.message&&!r&&l`<calcite-tooltip .referenceElement=${`response-chip-${s.conversationId}-error`} placement=top-start>${s.message}</calcite-tooltip><calcite-chip .id=${`response-chip-${s.conversationId}-error`} .label=${t.error??"Error"} scale=s appearance=outline icon=exclamation-mark-triangle-f class="response-error-chip"></calcite-chip>`||""}${Ge({card:s,messages:t})}</calcite-chip-group></div><details class="collapsible-code" open><summary>Code response</summary><arcgis-code-viewer language=arcade round>${s.code}</arcgis-code-viewer></details></div></div><div slot=footer-start class="feedback-actions"><calcite-button class="add-to-editor-button hidden-above-380" @click=${()=>s.onAddToEditor("add")} scale=s icon-start=plus round .label=${t.addtoeditor??"Add to editor"} .id=${`add-to-editor-button-${s.conversationId}-${r?"standalone":"list"}`}></calcite-button><calcite-tooltip class="hidden-above-380" .referenceElement=${`add-to-editor-button-${s.conversationId}-${r?"standalone":"list"}`} placement=top-start>${t.addtoeditor??"Add to editor"}</calcite-tooltip><calcite-button class="add-to-editor-button hidden-below-380" @click=${()=>s.onAddToEditor("add")} scale=s icon-start=plus round>${t.addtoeditor??"Add to editor"}</calcite-button><calcite-button round icon-start=file-code kind=neutral scale=s @click=${()=>s.onAddToEditor("replace")} class="response-secondary-action-button" .id=${`replace-${s.conversationId}-${r?"standalone":"list"}`}></calcite-button><calcite-tooltip .referenceElement=${`replace-${s.conversationId}-${r?"standalone":"list"}`} placement=top-start><span>${t.replaceineditor??"Replace all code in editor"}</span></calcite-tooltip><calcite-button round icon-start=copy-to-clipboard kind=neutral scale=s @click=${u=>{let d=u.currentTarget;p(s.code).then(()=>{d.setAttribute("data-copied","true"),setTimeout(()=>d.removeAttribute("data-copied"),1500)})}} class="response-secondary-action-button" .id=${`copy-response-${s.conversationId}-${r?"standalone":"list"}`}></calcite-button><calcite-popover .referenceElement=${`copy-response-${s.conversationId}-${r?"standalone":"list"}`} placement=top-start class="copy-feedback" .label=${t.copiedsuccessfully??"copied successfully"} open trigger-disabled><span>${t.copiedsuccessfully??"copied successfully"}</span></calcite-popover><calcite-tooltip .referenceElement=${`copy-response-${s.conversationId}-${r?"standalone":"list"}`} placement=top-start class="copy-tooltip">${t.copytoclipboard??"Copy code to clipboard"}</calcite-tooltip></div><div slot=footer-end class="feedback-actions"><calcite-action .text=${t.thumbsup??"Thumbs up"} scale=s icon=thumbs-up @click=${s.onThumbsUp} .id=${`thumbs-up-${s.conversationId}-${r?"standalone":"list"}`}></calcite-action><calcite-tooltip .referenceElement=${`thumbs-up-${s.conversationId}-${r?"standalone":"list"}`} placement=top-start><span>${t.helpful??"Helpful"}</span></calcite-tooltip><calcite-action .text=${t.thumbsdown??"Thumbs down"} scale=s icon=thumbs-down @click=${s.onThumbsDown} .id=${`thumbs-down-${s.conversationId}-${r?"standalone":"list"}`}></calcite-action><calcite-tooltip .referenceElement=${`thumbs-down-${s.conversationId}-${r?"standalone":"list"}`} placement=top-start><span>${t.unhelpful??"Unhelpful"}</span></calcite-tooltip></div></calcite-card>`)}</calcite-card-group></calcite-block>`}var Ge=({card:a,messages:e})=>{let t=H(),i=`response-chip-profile-${a.conversationId}-${t}`,o=(e.profilecontextlabel??"Profile context: {profileId}").replace("{profileId}",a.profileId);return l`<calcite-tooltip .referenceElement=${i} placement=top-start class="contained-popover-or-tooltip">${o}</calcite-tooltip><calcite-chip .label=${a.profileId} scale=s appearance=outline icon=map-information id=${i??I}>${a.profileId}</calcite-chip>`},me=a=>a.type==="featureSet";function we(a){return a&&a!=="dataCatalogDatastore"?a:void 0}var P=a=>{if(!ae(a))return[];let e=[];return a.relationships?.forEach(t=>{e.push(t.toJSON())}),e},D=a=>a.length>0?{relationships:a}:{},Je=a=>oe(a).map(e=>({alias:e.alias,name:e.name,type:e.type,...e.domain?{domain:e.domain}:{}})),_=a=>a?{fields:Je(a)}:{fields:[]};async function he(a){let e=await a.loadSource(),t=V(e)&&e.isTable,i=P(e);return{name:a.name,type:"featureSet",isTable:t,..._(e?.fields),...D(i)}}async function $e(a){switch(a.type){case"feature":{let t=await a.loadSource(),i=P(t);return{name:a.name,type:a.type,..._(t?.fields),...D(i)}}case"featureSet":{let t=await a.loadSource(),i=V(t)&&t.isTable;return{name:a.name,type:"featureSet",...i?{isTable:i}:{},..._(t?.fields),...D(P(t))}}case"featureSetCollection":{let t=await a.loadSource(),i=t?.layers.filter(me)??[],o=t?.tables.filter(me)??[],n=await Promise.all(i.map(he)),c=await Promise.all(o.map(he));return{name:a.name,type:"featureSetCollection",layers:n,tables:c}}case"dictionary":{let t=await Promise.all(a.dictionaryVariables.filter(q).map($e));return{name:a.name,type:"dictionary",attributes:t}}case"pixel":{let t=await a.loadSource();if(!t)return{name:a.name,type:"pixel"};let i=await Ae(t);return{name:a.name,type:"pixel",members:i.map(ge)}}case"voxel":{let t=await a.loadSource();if(!t)return{name:a.name,type:"voxel"};let i=await Te(t);return{name:a.name,type:"voxel",members:i.map(ge)}}case"array":let e=we(a.elementType.type);return{name:a.name,type:"array",...e?{elementType:e}:{}};case"number":case"text":case"boolean":case"date":case"knowledgeGraph":case"dateOnly":case"geometry":case"time":return{name:a.name,type:a.type}}}function ge(a){if(a.type==="array"){let e=we(a.elementType.type);return{name:a.name,type:"array",...e?{elementType:e}:{}}}return{name:a.name,type:a.type}}async function Ye(a){return{variables:await Promise.all(a.variables.filter(q).map($e))}}var We=1e5;function Ke(a){let e=new TextEncoder().encode(a).length;return Math.ceil(e/3.5)}function U(a){return Ke(JSON.stringify(a))}function Xe(a){let e=i=>({name:i.name,type:i.type,...i.isTable?{isTable:i.isTable}:{},...i.relationships?{relationships:i.relationships}:{}}),t=i=>{switch(i.type){case"feature":case"featureSet":case"knowledgeGraph":return{name:i.name,type:i.type,..."isTable"in i&&i.isTable?{isTable:i.isTable}:{},..."relationships"in i?{relationships:i.relationships}:{}};case"featureSetCollection":return{name:i.name,type:"featureSetCollection",layers:i.layers.map(e),tables:i.tables.map(e)};case"dictionary":return{name:i.name,type:"dictionary",attributes:i.attributes.map(t)};case"pixel":case"voxel":return{name:i.name,type:i.type};case"array":return{name:i.name,type:"array",...i.elementType?{elementType:i.elementType}:{}};default:return i}};return{variables:a.variables.map(t)}}function Ze(a){let e=a.variables,t=e.length,i=e.find(n=>n.name==="$feature")??e.find(n=>n.type==="feature")??e[0],o=i?[i]:[];return{context:{variables:o},wasReduced:t!==o.length,reducedToVariableName:i?.name}}function et(a){return U(a)>We}var tt=Object.defineProperty,at=Object.getOwnPropertyDescriptor,h=(a,e,t,i)=>{for(var o=i>1?void 0:i?at(e,t):e,n=a.length-1,c;n>=0;n--)(c=a[n])&&(o=(i?c(e,t,o):c(o))||o);return i&&o&&tt(e,t,o),o},m=class extends Ce{constructor(a){super(a),this.viewMode="prompt",this.confirmationActive=!1,this.contextReducedNoticeDismissed=!1,this.splashActive=!0,this.isSubmitting=!1,this.question="",this.history=[],this.feedback={active:!1}}};h([g()],m.prototype,"viewMode",2);h([g()],m.prototype,"confirmationActive",2);h([g()],m.prototype,"contextReducedNoticeDismissed",2);h([g()],m.prototype,"splashActive",2);h([g()],m.prototype,"isSubmitting",2);h([g()],m.prototype,"errorMessage",2);h([g()],m.prototype,"promptValidationMessage",2);h([g()],m.prototype,"question",2);h([g()],m.prototype,"history",2);h([g()],m.prototype,"feedback",2);h([g()],m.prototype,"context",2);m=h([Ie("ArcadeAssistantViewState")],m);var it="arcade_generation",st="ArcadeCodeRequest",be="visualization",fe="ArcadeAssistant",ot=["your_comments","user_evaluation","question","answer","useragent","_source","version","context","extras","conversation_id","privacy_statement"],ve=[],ye=!0,O=class extends X{constructor(){super(...arguments),this.textAreaRef=W(),this.messages=te(),this._feedbackService=void 0,this.viewState=new m,this.handleFeedbackButton=(e,t)=>{this.updateViewState({feedback:{active:!0,value:e,item:t,termsAccepted:!1,text:"",submitting:!1}})},this.handleFeedbackSheetClose=()=>{this.updateViewState({feedback:{active:!1}})},this.handleFeedbackSubmit=async()=>{if(!this.viewState.feedback.active)return;this.updateViewState({feedback:{...this.viewState.feedback,submitting:!0}});let e=await this.ensureFeedbackService();if(!e){this.handleFeedbackSheetClose();return}let t=!1,i;this.viewState.feedback.item.conversationId===this.viewState.history[0]?.conversationId&&this.viewState.viewMode==="result"?(i=this.viewState.context,t=!0):i=this.viewState.feedback.item.contextSnapshot;let o=re.applicationName;!o&&!this.appVersion&&w("warn",this,"esriConfig.applicationName is not set. Consider setting it to help identify the application version in feedback.");let{value:n,text:c,termsAccepted:p,item:{question:r,formattedScript:s,conversationId:u}}=this.viewState.feedback,d={user_evaluation:n,your_comments:c||void 0,question:r??"",answer:this.encodeAnswerForFeedback(s),useragent:navigator.userAgent,_source:fe,version:this.appVersion||o||"NOT_SET",context:i?JSON.stringify({...i,isSnapshot:!t}):"",extras:i?.profileId??"",conversation_id:u??"",privacy_statement:p?"I_agree":""};try{await e.applyEdits({addFeatures:[new ce({attributes:d})]})}catch(v){w("error",this,"Error submitting feedback.",{detail:{error:v}})}this.handleFeedbackSheetClose()},this.handleClose=e=>{this.closed=!0,this.closePanel?.(e)},this.setQuestionState=e=>{this.updateViewState({question:e,promptValidationMessage:void 0})},this.setFeedbackState=e=>{this.updateViewState({feedback:e})},this.onSuggestionClick=e=>{this.textAreaRef.value&&(this.textAreaRef.value.value=e,this.textAreaRef.value.setFocus(),this.setQuestionState(e))},this.helpBase="",this.assistantsEnabled=!1,this.closed=!1,this.disableQuestionAnswerLogging=!1}static{this.properties={closePanel:0,insertText:0,helpBase:1,assistantsEnabled:5,portalUrl:1,serviceUrl:1,closed:7,editorRef:0,feedbackServiceUrl:1,appVersion:1,disableQuestionAnswerLogging:5}}static{this.styles=Me}get disclaimerComment(){return`// ${this.messages.disclaimercomment}
|
|
2
|
+
import{a as F}from"./64X4ILDM.js";import c from"./GPIFJKPY.js";import b from"./GZ6HZKQZ.js";import a from"./ZHZFKZA7.js";import{c as ie,d as se}from"./P7I5ATMN.js";import"./G56LJGLK.js";import"./ER2MKLVA.js";import"./MP6Z45SA.js";import{d as oe}from"./IFNCCZ7O.js";import{a as te}from"./SB3MM5EM.js";import"./KCU2C44H.js";import"./GS2ISVXJ.js";import"./6G5URSC7.js";import"./6C52UOYL.js";import{E as W,F as K,G as X,H as Z,I,K as ee,h as Q,j as l,k as j,l as R,t as H,w as G,x as J,y as Y}from"./REL6OK2I.js";import{a as w}from"./Y3KOWWO5.js";import"./B3UMUBOI.js";import"./CF3TERM3.js";import"./Z5ZZ36DQ.js";import"./LLPQEURF.js";import"./3TTFCHAA.js";export default $arcgis.t(([xe,ne,Se,re,ce,{getDeclaredVoxelMembers:Te,getDeclaredPixelMembers:Ae},Ce,{property:g,subclass:Ie},{G:q,w:ae,x:V},,N])=>{var A=class extends Y{constructor(e){if(super(e),this.it=R,e.type!==G.CHILD)throw Error(this.constructor.directiveName+"() can only be used in child bindings")}render(e){if(e===R||e==null)return this._t=void 0,this.it=e;if(e===j)return e;if(typeof e!="string")throw Error(this.constructor.directiveName+"() called with a non-string value");if(e===this.it)return this._t;this.it=e;let t=[e];return t.raw=t,this._t={_$litType$:this.constructor.resultType,strings:t,values:[]}}};A.directiveName="unsafeHTML",A.resultType=1;var C=J(A);var Me=Q`:host(:not([closed])){container-type:size;--calcite-block-border-color: var(--calcite-color-transparent);box-sizing:border-box;.submission-actions-wrapper{display:flex;flex-direction:column;width:100%;gap:.75rem}.submission-actions{display:flex;flex-direction:row;gap:.5rem;justify-content:space-between}@container (max-width: 380px){.hidden-below-380{display:none}}@container (min-width: 380px){.hidden-above-380{display:none}}.gaps{display:flex;gap:.25rem}.align-inline-end{margin-inline-start:auto}.context-popover p{padding:0 .5rem;font-size:var(--calcite-font-size-sm)}.feedback-content{padding:var(--calcite-spacing-sm);display:flex;flex-direction:column;max-height:75cqb;overflow-y:auto;>*{margin-block-end:.5rem}>*:last-child,.terms-label{margin-block-end:0}calcite-text-area{--calcite-text-area-min-height: 4rem}calcite-notice{margin-block-start:0}}.feedback-sheet{--calcite-sheet-height: auto;--calcite-sheet-max-height: 100%;--calcite-sheet-min-height: auto}.feedback-footer{display:flex;justify-content:flex-end;gap:.5rem;width:100%}calcite-chip[slot=header-actions-end]{align-self:center;margin-inline-end:.5rem}calcite-flow-item calcite-shell{background:transparent}calcite-block{width:100%;max-width:100%;align-self:flex-end;background-color:transparent;margin-block:0}calcite-sheet{--calcite-sheet-scrim-background: rgba(200, 200, 200, .5)}calcite-list-item calcite-button{margin-inline-end:.25rem}calcite-flow-item calcite-shell calcite-notice{margin-block:1rem}calcite-block[open]:last-of-type{border-block-end:0}.text-area-wrapper{display:flex;border-radius:var(--calcite-corner-radius-round);margin:.75rem;overflow:hidden;--calcite-color-border-input: transparent;position:sticky;box-shadow:var(--calcite-shadow-sm);flex:none;flex-direction:column}calcite-text-area{height:auto;overflow:hidden;--calcite-font-weight-normal: 500;font-weight:500;line-height:1.2}calcite-flow{height:100%}calcite-popover calcite-list{--calcite-list-background-color: transparent;--calcite-input-border-color: transparent}calcite-popover calcite-list calcite-filter{--calcite-spacing-sm: 0}.contained-popover-or-tooltip{--calcite-popover-max-size-x: 100%;--calcite-tooltip-max-size-x: 100%}.info-heading{font-size:var(--calcite-font-size-0);color:var(--calcite-color-text-1);margin:0}.info-heading-row{display:flex;align-items:center;gap:var(--calcite-spacing-sm);flex-wrap:wrap}.unstyled-h3{margin:unset;font-size:var(--calcite-font-size-md)}.unstyled-shell{position:unset;inset:unset;display:unset;block-size:unset;inline-size:unset}.suggestion-button{font-weight:var(--calcite-font-weight-medium)}.suggestions{display:flex;flex-direction:row;gap:var(--calcite-spacing-xs);flex-wrap:wrap}.info-block{max-width:450px}#result-block{calcite-card-group{--calcite-card-group-gap: 1.25rem}calcite-card{--calcite-card-corner-radius: var(--calcite-corner-radius-round);--calcite-card-border-color: transparent;width:100%}.positioned-code-content{display:flex;flex-direction:row;gap:.5rem;padding:.5rem}calcite-card [slot=heading] calcite-chip{margin-block-start:.25rem}.code-response-wrapper{position:relative;background:var(--calcite-color-foreground-2);border-radius:var(--calcite-corner-radius-round);margin-top:-1.5rem}.prior-prompt{display:flex;flex-direction:row;padding:0;overflow-y:hidden;overflow-x:auto;margin:.25rem 0 .75rem;align-items:center;max-width:100%;span{overflow-x:auto;overflow-y:hidden}}.copy-feedback{display:none}.copy-prompt-button{align-self:flex-start;margin-inline-start:auto}.response-secondary-action-button[data-copied]+.copy-feedback,.copy-prompt-button[data-copied]+.copy-feedback{display:block;span{padding:.75rem 1rem;font-size:var(--calcite-font-size--2);line-height:1.375;color:var(--calcite-color-text--2);font-weight:var(--calcite-font-weight-medium)}}.copy-prompt-button[data-copied]~.copy-tooltip,.response-secondary-action-button[data-copied]~.copy-tooltip{display:none}code{white-space:pre;font-size:12px;margin:0;overflow-x:auto;font-family:Fira Mono,Consolas,Menlo,monospace;display:block;max-height:12rem;position:relative;padding:.5rem}.response-secondary-action-button{margin-left:.5rem}.add-to-editor-button{--calcite-internal-button-border-color: unset}}.collapsible-code{padding:.5rem}.collapsible-code summary{cursor:pointer;font-weight:500;color:var(--calcite-color-brand);outline:none;padding:.25rem 0}.collapsible-code[open] summary{color:var(--calcite-color-text-2)}.response-error-container{padding:.5rem;background:color-mix(in srgb,var(--calcite-color-status-warning) 10%,transparent);border-radius:var(--calcite-corner-radius-round);margin:1rem 0;font-size:var(--calcite-font-size--2);--calcite-input-message-icon-color: var(--calcite-color-status-warning)}.response-error-chip{--calcite-internal-chip-background-color: var(--calcite-color-status-warning);--calcite-chip-icon-color: var(--calcite-color-foreground-1);--calcite-chip-border-color: var(--calcite-color-transparent)}.feedback-actions{gap:unset}.contained{max-width:100%;max-height:100%;max-width:100cqi;max-height:75cqb;overflow-y:auto}.submission-notice{--calcite-notice-border-color: transparent;margin-block:0;width:100%;--calcite-font-size-relative-base: var(--calcite-font-size--2)}.border-block-end{border-block-end:1px solid var(--calcite-color-border-3)}.round-top{border-radius:var(--calcite-corner-radius-round) var(--calcite-corner-radius-round) 0 0}}:host([closed]){display:none}`,$=class extends Error{constructor({message:e,code:t,subCode:i,details:o,source:n}){super(e),this.name="ArcadeAssistantError",this.code=t,this.subCode=i,this.details=o,this.source=n}};function le(a){if(!a)return;let e=a.indexOf('{"error":');if(e!==-1)try{let t=a.slice(e),i=JSON.parse(t);if(i&&typeof i=="object"&&i.error)return i.error}catch{return}}async function Ee(a){let{baseUrl:e,skillId:t,message:i,authToken:o,previousConversationId:n,context:c}=a,p=t?`${e}/skills/${t}/chat`:`${e}/chat`,r=[],s={message:i,context:c};n&&(s.conversation_id=n);let u;try{u=await ne(p,{method:"post",headers:{"Content-Type":"application/json",token:o},body:JSON.stringify(s),responseType:"json"})}catch(b){let f=b,x=f.details?.rawResponse||f.message||String(b),S=le(x);throw S?new $(S):b}let d=u.data;r.push(d);let v=d.conversationId,z=d.inquiryId,k=d.sequenceNumber;async function M(){let b=0,f=100;for(;b<f;){await new Promise(T=>setTimeout(T,1e3));let x=Re(v,k,z),S;try{S=await ne(p,{method:"post",headers:{"Content-Type":"application/json",token:o},body:JSON.stringify(x),responseType:"json"})}catch(T){let L=T,ke=L.details?.rawResponse||L.message||String(T),B=le(ke);throw B?new $(B):T}let y=S.data;if(y.context?.kind==="ArcgisErrorAsContext"&&y.context.error)throw new $({message:y.context.error.message||"ArcGIS Assistant error",code:y.context.error.code,subCode:y.context.error.subCode,details:y.context.error.details,source:"polling-response"});if(r.push(y),k=y.sequenceNumber,b++,!y.hasMore)break}if(b===f)throw new $({message:"Request timed out",code:"TIMEOUT",source:"polling"})}let E=120*1e3;return await Promise.race([M(),new Promise((b,f)=>setTimeout(()=>f(new $({message:"Request timed out",code:"TIMEOUT",source:"hard-timeout"})),E))]),r}function Re(a,e,t){return{conversationId:a,inquiryId:t,ackSequenceNumber:e}}function Ve(a){return a.message.match(/Error in prompt shield/u)?"I'm having trouble with this request. Try again by rephrasing the question.":a.code==="TIMEOUT"?"Request timed out. Try again by re-asking the same question or rephrasing it.":a.message}var qe=({notices:a})=>a.length?l`<div class="border-block-end">${F(a,e=>e.id??e.title,e=>l`<calcite-notice class="submission-notice" .icon=${e.icon} .kind=${e.kind} scale=s open .closable=${e.closable} @calciteNoticeClose=${()=>e.onClose?.()}><div slot=title>${e.title}</div>${e.message&&l`<div slot=message>${e.message}</div>`||""}${e.actionLinkMessage&&e.onAction&&l`<calcite-link slot=link @click=${()=>e.onAction?.()}>${e.actionLinkMessage}</calcite-link>`||""}</calcite-notice>`)}</div>`:null,Ne=a=>{let e=a.value.length,t=72,i=180,o=a.offsetWidth,n=Math.max(1,Math.floor(o/8)),c=Math.ceil(e/n),p=t+(c-2)*24;a.style.setProperty("--calcite-text-area-min-height",`${Math.min(p,i)}px`)},Fe=({promptValidationMessage:a,errorMessage:e,contextTooBig:t,contextReducedNoticeDismissed:i,setContextReducedNoticeDismissed:o,setErrorMessage:n,messages:c})=>{let p=[];if(a&&p.push({id:"prompt-validation",kind:"danger",icon:"exclamation-mark-triangle",title:a,closable:!0}),e&&p.push({id:"assistant-error",kind:"danger",icon:"exclamation-mark-triangle",title:e,closable:!0,onClose:()=>n(void 0)}),t&&!i){let r=c.contextreduced??"Context reduced",s=c.contextreducedmessage??"The editor profile is too large for the assistant. It has been reduced in the assistant in order to ensure a successful request.";p.push({id:"context-reduced",kind:"warning",icon:"exclamation-mark-triangle",title:r,message:s,closable:!0,onClose:()=>o(!0)})}return p};function Pe({messages:a}){return l`<calcite-chip slot=header-actions-end scale=s appearance=outline-fill .label=${a.beta??"Beta"}>${a.beta??"Beta"}</calcite-chip>`}function De({popoverContent:a,messages:e}){return l`<calcite-action icon=information slot=header-actions-end id=legal-disclaimer text></calcite-action><calcite-popover reference-element=legal-disclaimer .label=${e.legaldisclaimer??"Legal disclaimer"} placement=bottom auto-close focus-trap-disabled><div class="contained">${a}</div></calcite-popover>`}function _e({errorMessage:a,slot:e}){return l`<div class="error-display"><calcite-input-message id=error-message status=invalid icon=exclamation-mark-triangle scale=m slot=${e??I}>${a}</calcite-input-message></div>`}function Ue({active:a,setActive:e,messages:t}){return l`<calcite-alert slot=alerts .open=${a} placement=bottom kind=success icon=check-circle-f auto-close @calciteAlertClose=${()=>e(!1)} .label=${t.expressionapplied??"Expression applied"}><div slot=message>${t.expressionapplied??"Expression applied to editor."}</div></calcite-alert>`}function Oe({context:a,messages:e}){return a?l`<div class="gaps">${a.profileId&&l`<calcite-popover auto-close placement=top .label=${(e.profilecontextlabel??"Profile context: {profileId}").replace("{profileId}",a.profileId)} reference-element=profile-context-button class="context-popover contained-popover-or-tooltip"><p>${(e.profilecontextlabel??"Profile context: {profileId}").replace("{profileId}",a.profileId)}</p></calcite-popover><calcite-button round kind=neutral icon-start=map-information id=profile-context-button scale=s></calcite-button>`||""}</div>`:null}function ze({isDisabled:a,isReadOnly:e,setQuestion:t,setIsViewingResult:i,textAreaRef:o,question:n,errorMessage:c,setErrorMessage:p,promptValidationMessage:r,setPromptValidationMessage:s,submitQuestion:u,messages:d,mode:v,assistantRef:z,context:k,contextReducedNoticeDismissed:M,setContextReducedNoticeDismissed:E}){let b=k?.contextTooLarge??!1,f=Fe({promptValidationMessage:r,errorMessage:c,contextTooBig:b,contextReducedNoticeDismissed:M,setContextReducedNoticeDismissed:E,setErrorMessage:p,messages:d});return l`<div class="text-area-wrapper">${qe({notices:f})}<calcite-text-area scale=s resize=vertical .readOnly=${a||e} class=${Z(f.length?"submission-text-area":"submission-text-area round-top")} .placeholder=${d.askaquestion??`Specify the calculation or logic you need in an Arcade expression. (e.g., 'Return "Yes" if value > 10')`} .value=${n} @calciteTextAreaInput=${x=>{Ne(x.target),t(x.target.value)}} ${K(o)}><div class="submission-actions-wrapper" slot=footer-start><div class="submission-actions">${k&&Oe({context:k,messages:d})||""}<div class="align-inline-end gaps"><calcite-button round kind=neutral .hidden=${v!=="refine"} icon-start=arrow-left icon-flip-rtl=both appearance=solid scale=s .disabled=${a} @click=${async()=>{i(!1),t("")}} .label=${d.startover??"Start Over"} class="hidden-above-380" id=small-start-over-button></calcite-button><calcite-tooltip reference-element=small-start-over-button placement=top-start class="hidden-above-380">${d.startover??"Start Over"}</calcite-tooltip><calcite-button round kind=neutral .hidden=${v!=="refine"} icon-start=arrow-left icon-flip-rtl=both appearance=solid .disabled=${a} @click=${async()=>{i(!1),t("")}} class="hidden-below-380" scale=s>${d.startover??"Start Over"}</calcite-button><calcite-button round scale=s icon-end=effects appearance=solid .loading=${a} .disabled=${a} @click=${async()=>{if(p(""),!n){s(d.enteraprompt??"Please enter a prompt");return}s(void 0),await u()}} class="hidden-below-380">${v==="prompt"?d.ask??"Generate":d.refine??"Refine"}</calcite-button><calcite-button round scale=s icon-end=effects appearance=solid .loading=${a} .disabled=${a} id=small-submit-button @click=${async()=>{if(p(""),!n){s(d.enteraprompt??"Please enter a prompt");return}s(void 0),await u()}} class="hidden-above-380" .label=${v==="prompt"?d.ask??"Generate":d.refine??"Refine"}></calcite-button><calcite-tooltip reference-element=small-submit-button placement=top-start class="hidden-above-380">${v==="prompt"?d.ask??"Generate":d.refine??"Refine"}</calcite-tooltip></div></div></div></calcite-text-area></div>`}var Le="https://www.esri.com/en-us/privacy/privacy-statements/privacy-supplement",Be="https://www.esri.com/en-us/privacy/privacy-statements";function Qe({setOpen:a,messages:e,feedback:t,learnMoreUrl:i,setFeedback:o,onSubmit:n}){return t.active?l`<calcite-sheet class="feedback-sheet" .label=${e.feedback??"Feedback"} slot=sheets display-mode=float position=block-end .open=${t.active} @calciteSheetClose=${()=>a(!1)}><calcite-panel .heading=${e.submitfeedback??"Submit feedback to Esri"} scale=s><div class="feedback-content"><calcite-text-area scale=s resize=vertical .value=${t.text} @calciteTextAreaInput=${c=>o({...t,text:c.target.value})} .disabled=${t.submitting} .placeholder=${e.donotincludepersonalinfo??"Do not include personal or sensitive information"} rows=3></calcite-text-area><calcite-label layout=inline scale=s class="terms-label"><calcite-checkbox scale=l .checked=${t.termsAccepted} @calciteCheckboxChange=${c=>{o({...t,termsAccepted:c.target.checked})}} .disabled=${t.submitting}></calcite-checkbox><span>${C((e.agreement??"I agree to the {EsriPrivacyStatement} (and {Supplement}).").replace("{EsriPrivacyStatement}",`<calcite-link href=${Be} target="_blank">${e.esriprivacystatement??"Esri Privacy Statement"}</calcite-link>`).replace("{Supplement}",`<calcite-link href=${Le} target="_blank">${e.supplement??"Supplement"}</calcite-link>`))}</span></calcite-label><calcite-notice scale=s open closable><span slot=message>${C((e.feedbackhelps??"Your feedback will be used to improve Esri products and services. {LearnMore} about how this data is used.").replace("{LearnMore}",`<calcite-link href=${i} target="_blank">${e.learnmore??"Learn more"}</calcite-link>`))}</span></calcite-notice></div><div slot=footer class="feedback-footer"><calcite-button kind=neutral appearance=outline @click=${()=>a(!1)} .disabled=${t.submitting}>${e.cancel??"Cancel"}</calcite-button><calcite-button @click=${n} .disabled=${!t.termsAccepted||t.submitting} .loading=${t.submitting} data-testid=submit-feedback-button>${e.submit??"Submit"}</calcite-button></div></calcite-panel></calcite-sheet>`:null}function de({assistantsEnabled:a,messages:e,slot:t,helpTopicUrl:i}){return l`<calcite-block .label=${e.assistantinformation??"Assistant information"} slot=${t??I} expanded class="info-block" scale=s><div class="info-heading-row"><h1 class="info-heading">${e.introducing??"Introducing Arcade Assistant (beta)"}</h1><calcite-chip .label=${e.new??"New"} kind=brand scale=s>${e.new??"New"}</calcite-chip></div>${a?l`<p>${e.capabilities??"The assistant uses artificial intelligence to generate Arcade expressions."}</p><p>${e.keepinmind??"Keep in mind the following:"}<ul><li>${e.beconsise??"Be concise, but also clear in your request"}</li><li>${e.avoidambiguity??"Avoid ambiguity and vagueness"}</li><li>${e.moredetails??"you do not need to use exact field names in your instructions, but more detail is generally better"}</li></ul>${C((e.seedocumentation??"Please see the {documentation} for more information, including limitations and additional resources.").replace("{documentation}",`<calcite-link href=${i} target="_blank">${e.documentation??"documentation"}</calcite-link>`))}</p>`:l`<p>${e.useofassistant??"The assistant uses artificial intelligence to generate Arcade expressions. To enable Arcade Assistant (beta), the following must be true:"}</p><ul><li>${e.enabledinorg??"AI assistants are enabled in the organization settings"}</li><li>${e.enabledbetaapps??"Beta apps and capabilities are not blocked"}</li><li>${e.enabledroleprivilege??"Your role privilege allows you to use AI assistants"}</li></ul>`}</calcite-block>`}function je({messages:a,onProceed:e,onExit:t,helpTopicUrl:i}){return l`<calcite-dialog close-disabled placement=top .heading=${a.welcome??"Welcome to the new assistant experience"} slot=dialogs open width-scale=m id=welcome-dialog><h3 class="unstyled-h3">${a.beforeyougetstarted??"Before you get started be aware:"}</h3><ul><li>${a.maybeincorrect??"AI generated code may occasionally be incorrect or biased. Review carefully."}</li><li>${C((a.pleasereadhelp??"Read the Arcade Assistant (beta) {helpTopic} to get started and learn details on security, privacy and limitations.").replace("{helpTopic}",`<calcite-link href=${i} target="_blank">${a.helptopic??"help topic"}</calcite-link>`))}</li></ul><calcite-button id=welcome-proceed slot=footer-end @click=${e}>${a.proceed??"Proceed"}</calcite-button><calcite-button id=welcome-decline slot=footer-start @click=${t} kind=neutral>${a.exit??"Exit"}</calcite-button></calcite-dialog>`}function He({messages:a,suggestions:e,onSuggestionClick:t}){return l`<calcite-block .heading=${a.promptsuggestions} expanded collapsible id=suggestion-block scale=s><div class="suggestions">${e.map(i=>l`<calcite-button round scale=s appearance=outline-fill kind=neutral .label=${a.promptsuggestion} class="suggestion-button" @click=${()=>t?.(i)}>${i}</calcite-button>`)}</div></calcite-block>`}var pe=200;function ue({hidden:a=!1,expanded:e=!1,messages:t,cards:i,heading:o,collapsible:n=!1,showEffectsIcon:c=!1,onCopyCode:p,standalone:r}){return l`<calcite-block .hidden=${a} id=result-block .heading=${o??t.besteffort??"Here is the assistant's best effort"} .expanded=${e} .collapsible=${n}>${c&&l`<calcite-chip .label=${t.assistantresponses??"Assistant responses"} slot=content-start icon=effects scale=m class="suggestion-chips"></calcite-chip>`||""}<calcite-card-group .label=${t.assistantresponses??"Assistant responses"}>${F(i,s=>s.conversationId,s=>l`<calcite-card><div slot=heading><div class="prior-prompt"><span>${s.priorPrompt.length>pe?`${s.priorPrompt.slice(0,pe)}...`:s.priorPrompt}</span><calcite-action icon=duplicate scale=s slot=actions-end class="copy-prompt-button" text .id=${`copy-prompt-${s.conversationId}-${r?"standalone":"list"}`} @click=${u=>{let d=u.currentTarget;navigator.clipboard.writeText(s.priorPrompt).then(()=>{d.setAttribute("data-copied","true"),setTimeout(()=>d.removeAttribute("data-copied"),1500)})}}></calcite-action><calcite-popover .referenceElement=${`copy-prompt-${s.conversationId}-${r?"standalone":"list"}`} placement=top-start class="copy-feedback" .label=${t.copiedsuccessfully??"copied successfully"} open trigger-disabled><span>${t.copiedsuccessfully??"copied successfully"}</span></calcite-popover><calcite-tooltip .referenceElement=${`copy-prompt-${s.conversationId}-${r?"standalone":"list"}`} placement=top-start class="copy-tooltip">${t.copyprompttoclipboard??"Copy prompt to clipboard"}</calcite-tooltip></div>${s.message&&r&&l`<div class="response-error-container">${_e({errorMessage:s.message})}</div>`||""}</div><div><div class="code-response-wrapper"><div class="positioned-code-content"><calcite-chip-group .label=${t.responsecontext??"Response Context"} scale=s>${s.message&&!r&&l`<calcite-tooltip .referenceElement=${`response-chip-${s.conversationId}-error`} placement=top-start>${s.message}</calcite-tooltip><calcite-chip .id=${`response-chip-${s.conversationId}-error`} .label=${t.error??"Error"} scale=s appearance=outline icon=exclamation-mark-triangle-f class="response-error-chip"></calcite-chip>`||""}${Ge({card:s,messages:t})}</calcite-chip-group></div><details class="collapsible-code" open><summary>Code response</summary><arcgis-code-viewer language=arcade round>${s.code}</arcgis-code-viewer></details></div></div><div slot=footer-start class="feedback-actions"><calcite-button class="add-to-editor-button hidden-above-380" @click=${()=>s.onAddToEditor("add")} scale=s icon-start=plus round .label=${t.addtoeditor??"Add to editor"} .id=${`add-to-editor-button-${s.conversationId}-${r?"standalone":"list"}`}></calcite-button><calcite-tooltip class="hidden-above-380" .referenceElement=${`add-to-editor-button-${s.conversationId}-${r?"standalone":"list"}`} placement=top-start>${t.addtoeditor??"Add to editor"}</calcite-tooltip><calcite-button class="add-to-editor-button hidden-below-380" @click=${()=>s.onAddToEditor("add")} scale=s icon-start=plus round>${t.addtoeditor??"Add to editor"}</calcite-button><calcite-button round icon-start=file-code kind=neutral scale=s @click=${()=>s.onAddToEditor("replace")} class="response-secondary-action-button" .id=${`replace-${s.conversationId}-${r?"standalone":"list"}`}></calcite-button><calcite-tooltip .referenceElement=${`replace-${s.conversationId}-${r?"standalone":"list"}`} placement=top-start><span>${t.replaceineditor??"Replace all code in editor"}</span></calcite-tooltip><calcite-button round icon-start=copy-to-clipboard kind=neutral scale=s @click=${u=>{let d=u.currentTarget;p(s.code).then(()=>{d.setAttribute("data-copied","true"),setTimeout(()=>d.removeAttribute("data-copied"),1500)})}} class="response-secondary-action-button" .id=${`copy-response-${s.conversationId}-${r?"standalone":"list"}`}></calcite-button><calcite-popover .referenceElement=${`copy-response-${s.conversationId}-${r?"standalone":"list"}`} placement=top-start class="copy-feedback" .label=${t.copiedsuccessfully??"copied successfully"} open trigger-disabled><span>${t.copiedsuccessfully??"copied successfully"}</span></calcite-popover><calcite-tooltip .referenceElement=${`copy-response-${s.conversationId}-${r?"standalone":"list"}`} placement=top-start class="copy-tooltip">${t.copytoclipboard??"Copy code to clipboard"}</calcite-tooltip></div><div slot=footer-end class="feedback-actions"><calcite-action .text=${t.thumbsup??"Thumbs up"} scale=s icon=thumbs-up @click=${s.onThumbsUp} .id=${`thumbs-up-${s.conversationId}-${r?"standalone":"list"}`}></calcite-action><calcite-tooltip .referenceElement=${`thumbs-up-${s.conversationId}-${r?"standalone":"list"}`} placement=top-start><span>${t.helpful??"Helpful"}</span></calcite-tooltip><calcite-action .text=${t.thumbsdown??"Thumbs down"} scale=s icon=thumbs-down @click=${s.onThumbsDown} .id=${`thumbs-down-${s.conversationId}-${r?"standalone":"list"}`}></calcite-action><calcite-tooltip .referenceElement=${`thumbs-down-${s.conversationId}-${r?"standalone":"list"}`} placement=top-start><span>${t.unhelpful??"Unhelpful"}</span></calcite-tooltip></div></calcite-card>`)}</calcite-card-group></calcite-block>`}var Ge=({card:a,messages:e})=>{let t=H(),i=`response-chip-profile-${a.conversationId}-${t}`,o=(e.profilecontextlabel??"Profile context: {profileId}").replace("{profileId}",a.profileId);return l`<calcite-tooltip .referenceElement=${i} placement=top-start class="contained-popover-or-tooltip">${o}</calcite-tooltip><calcite-chip .label=${a.profileId} scale=s appearance=outline icon=map-information id=${i??I}>${a.profileId}</calcite-chip>`},me=a=>a.type==="featureSet";function we(a){return a&&a!=="dataCatalogDatastore"?a:void 0}var P=a=>{if(!ae(a))return[];let e=[];return a.relationships?.forEach(t=>{e.push(t.toJSON())}),e},D=a=>a.length>0?{relationships:a}:{},Je=a=>oe(a).map(e=>({alias:e.alias,name:e.name,type:e.type,...e.domain?{domain:e.domain}:{}})),_=a=>a?{fields:Je(a)}:{fields:[]};async function he(a){let e=await a.loadSource(),t=V(e)&&e.isTable,i=P(e);return{name:a.name,type:"featureSet",isTable:t,..._(e?.fields),...D(i)}}async function $e(a){switch(a.type){case"feature":{let t=await a.loadSource(),i=P(t);return{name:a.name,type:a.type,..._(t?.fields),...D(i)}}case"featureSet":{let t=await a.loadSource(),i=V(t)&&t.isTable;return{name:a.name,type:"featureSet",...i?{isTable:i}:{},..._(t?.fields),...D(P(t))}}case"featureSetCollection":{let t=await a.loadSource(),i=t?.layers.filter(me)??[],o=t?.tables.filter(me)??[],n=await Promise.all(i.map(he)),c=await Promise.all(o.map(he));return{name:a.name,type:"featureSetCollection",layers:n,tables:c}}case"dictionary":{let t=await Promise.all(a.dictionaryVariables.filter(q).map($e));return{name:a.name,type:"dictionary",attributes:t}}case"pixel":{let t=await a.loadSource();if(!t)return{name:a.name,type:"pixel"};let i=await Ae(t);return{name:a.name,type:"pixel",members:i.map(ge)}}case"voxel":{let t=await a.loadSource();if(!t)return{name:a.name,type:"voxel"};let i=await Te(t);return{name:a.name,type:"voxel",members:i.map(ge)}}case"array":let e=we(a.elementType.type);return{name:a.name,type:"array",...e?{elementType:e}:{}};case"number":case"text":case"boolean":case"date":case"knowledgeGraph":case"dateOnly":case"geometry":case"time":return{name:a.name,type:a.type}}}function ge(a){if(a.type==="array"){let e=we(a.elementType.type);return{name:a.name,type:"array",...e?{elementType:e}:{}}}return{name:a.name,type:a.type}}async function Ye(a){return{variables:await Promise.all(a.variables.filter(q).map($e))}}var We=1e5;function Ke(a){let e=new TextEncoder().encode(a).length;return Math.ceil(e/3.5)}function U(a){return Ke(JSON.stringify(a))}function Xe(a){let e=i=>({name:i.name,type:i.type,...i.isTable?{isTable:i.isTable}:{},...i.relationships?{relationships:i.relationships}:{}}),t=i=>{switch(i.type){case"feature":case"featureSet":case"knowledgeGraph":return{name:i.name,type:i.type,..."isTable"in i&&i.isTable?{isTable:i.isTable}:{},..."relationships"in i?{relationships:i.relationships}:{}};case"featureSetCollection":return{name:i.name,type:"featureSetCollection",layers:i.layers.map(e),tables:i.tables.map(e)};case"dictionary":return{name:i.name,type:"dictionary",attributes:i.attributes.map(t)};case"pixel":case"voxel":return{name:i.name,type:i.type};case"array":return{name:i.name,type:"array",...i.elementType?{elementType:i.elementType}:{}};default:return i}};return{variables:a.variables.map(t)}}function Ze(a){let e=a.variables,t=e.length,i=e.find(n=>n.name==="$feature")??e.find(n=>n.type==="feature")??e[0],o=i?[i]:[];return{context:{variables:o},wasReduced:t!==o.length,reducedToVariableName:i?.name}}function et(a){return U(a)>We}var tt=Object.defineProperty,at=Object.getOwnPropertyDescriptor,h=(a,e,t,i)=>{for(var o=i>1?void 0:i?at(e,t):e,n=a.length-1,c;n>=0;n--)(c=a[n])&&(o=(i?c(e,t,o):c(o))||o);return i&&o&&tt(e,t,o),o},m=class extends Ce{constructor(a){super(a),this.viewMode="prompt",this.confirmationActive=!1,this.contextReducedNoticeDismissed=!1,this.splashActive=!0,this.isSubmitting=!1,this.question="",this.history=[],this.feedback={active:!1}}};h([g()],m.prototype,"viewMode",2);h([g()],m.prototype,"confirmationActive",2);h([g()],m.prototype,"contextReducedNoticeDismissed",2);h([g()],m.prototype,"splashActive",2);h([g()],m.prototype,"isSubmitting",2);h([g()],m.prototype,"errorMessage",2);h([g()],m.prototype,"promptValidationMessage",2);h([g()],m.prototype,"question",2);h([g()],m.prototype,"history",2);h([g()],m.prototype,"feedback",2);h([g()],m.prototype,"context",2);m=h([Ie("ArcadeAssistantViewState")],m);var it="arcade_generation",st="ArcadeCodeRequest",be="visualization",fe="ArcadeAssistant",ot=["your_comments","user_evaluation","question","answer","useragent","_source","version","context","extras","conversation_id","privacy_statement"],ve=[],ye=!0,O=class extends X{constructor(){super(...arguments),this.textAreaRef=W(),this.messages=te(),this._feedbackService=void 0,this.viewState=new m,this.handleFeedbackButton=(e,t)=>{this.updateViewState({feedback:{active:!0,value:e,item:t,termsAccepted:!1,text:"",submitting:!1}})},this.handleFeedbackSheetClose=()=>{this.updateViewState({feedback:{active:!1}})},this.handleFeedbackSubmit=async()=>{if(!this.viewState.feedback.active)return;this.updateViewState({feedback:{...this.viewState.feedback,submitting:!0}});let e=await this.ensureFeedbackService();if(!e){this.handleFeedbackSheetClose();return}let t=!1,i;this.viewState.feedback.item.conversationId===this.viewState.history[0]?.conversationId&&this.viewState.viewMode==="result"?(i=this.viewState.context,t=!0):i=this.viewState.feedback.item.contextSnapshot;let o=re.applicationName;!o&&!this.appVersion&&w("warn",this,"esriConfig.applicationName is not set. Consider setting it to help identify the application version in feedback.");let{value:n,text:c,termsAccepted:p,item:{question:r,formattedScript:s,conversationId:u}}=this.viewState.feedback,d={user_evaluation:n,your_comments:c||void 0,question:r??"",answer:this.encodeAnswerForFeedback(s),useragent:navigator.userAgent,_source:fe,version:this.appVersion||o||"NOT_SET",context:i?JSON.stringify({...i,isSnapshot:!t}):"",extras:i?.profileId??"",conversation_id:u??"",privacy_statement:p?"I_agree":""};try{await e.applyEdits({addFeatures:[new ce({attributes:d})]})}catch(v){w("error",this,"Error submitting feedback.",{detail:{error:v}})}this.handleFeedbackSheetClose()},this.handleClose=e=>{this.closed=!0,this.closePanel?.(e)},this.setQuestionState=e=>{this.updateViewState({question:e,promptValidationMessage:void 0})},this.setFeedbackState=e=>{this.updateViewState({feedback:e})},this.onSuggestionClick=e=>{this.textAreaRef.value&&(this.textAreaRef.value.value=e,this.textAreaRef.value.setFocus(),this.setQuestionState(e))},this.helpBase="",this.assistantsEnabled=!1,this.closed=!1,this.disableQuestionAnswerLogging=!1}static{this.properties={closePanel:0,insertText:0,helpBase:1,assistantsEnabled:5,portalUrl:1,serviceUrl:1,closed:7,editorRef:0,feedbackServiceUrl:1,appVersion:1,disableQuestionAnswerLogging:5}}static{this.styles=Me}get disclaimerComment(){return`// ${this.messages.disclaimercomment}
|
|
3
3
|
// ${this.messages.disclaimerpt2??"AI-generated content may be inaccurate. Review before using."}`}get assistantOverviewDocUrl(){return`${this.helpBase??"https://doc.arcgis.com/en/arcgis-online/"}create-maps/understand-arcade-assistant.htm`}get usingTheAssitantDocUrl(){return`${this.helpBase??"https://doc.arcgis.com/en/arcgis-online/"}create-maps/understand-arcade-assistant.htm`}async destroy(){}connectedCallback(){super.connectedCallback(),this.updateViewState({history:ve,splashActive:ye})}load(){let e=async()=>{let t=this.getModel();if(!t){this.updateViewState({context:void 0});return}let i=await this.getProfileAndMetadata(t.uri);this.updateViewState({context:i,contextReducedNoticeDismissed:i.contextTooLarge?!1:this.viewState.contextReducedNoticeDismissed})};e().catch(t=>{w("error",this,"Error setting initial context.",{detail:{error:t}})}),this.manager.onLifecycle(()=>{let t=N.onModelContextDidChange(async()=>{e().catch(i=>{w("error",this,"Error setting context.",{detail:{error:i}})})});return{remove:()=>{t.dispose()}}})}disconnectedCallback(){super.disconnectedCallback(),ve=this.viewState.history,ye=this.viewState.splashActive,this.copySuccessTimer&&(clearTimeout(this.copySuccessTimer),this.copySuccessTimer=void 0)}createFeedbackContextSnapshot(e){let t=Xe(e.metadata);return{...e,metadata:t,estimatedTokens:U(t)}}encodeAnswerForFeedback(e){return encodeURIComponent(e??"")}updateViewState(e){this.viewState.set(e)}getHistoryCards(){return this.viewState.history.reduce((e,t)=>(!t.script||(e.push({priorPrompt:t.question,code:t.formattedScript||t.error||"",profileId:t.profile??be,onAddToEditor:i=>{ie(this.editorRef.editorInstance,t.formattedScript??"",i,this.disclaimerComment)},onThumbsUp:()=>this.handleFeedbackButton("good",t),onThumbsDown:()=>this.handleFeedbackButton("bad",t),conversationId:t.conversationId??"",message:t.message}),this.viewState.viewMode),e),[])}async ensureFeedbackService(){if(this._feedbackService)return this._feedbackService;if(!this.feedbackServiceUrl)return;let e=new Se({url:this.feedbackServiceUrl});await e.load();let t=ot.filter(i=>!e.fields.some(o=>o.name===i));if(t.length>0){w("error",this,`Missing the following fields in feedback service: ${t.join(", ")}. Feedback will not be logged.`);return}return this._feedbackService=e,e}async logInteractionToFeedbackService(e){if(this.disableQuestionAnswerLogging||!e.question)return;let t;try{t=await this.ensureFeedbackService()}catch(c){w("error",this,"Error initializing feedback service for interaction logging.",{detail:{error:c}});return}if(!t)return;let i=re.applicationName,o=e.contextSnapshot,n={question:e.question,answer:this.encodeAnswerForFeedback(e.answer),useragent:navigator.userAgent,_source:fe,version:this.appVersion||i||"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(c){w("error",this,"Error logging arcade assistant question/answer interaction.",{detail:{error:c}})}}getModel(){return this.editorRef.editorInstance?.getModel()}async submitQuestion(){if(!this.viewState.question)return;let e=this.viewState.question;this.updateViewState({isSubmitting:!0,errorMessage:void 0});let t,i;try{let o=this.getModel();if(!o||!this.serviceUrl)return;let n=this.viewState.context??await this.getProfileAndMetadata(o.uri);t=this.createFeedbackContextSnapshot(n);let c=await this.getToken(),p=await Ee({baseUrl:this.serviceUrl,skillId:it,message:e,authToken:c,context:{kind:st,context:{profile_id:n.profileId,metadata:[n.metadata]}}});i=p?.[0]?.conversationId;let r=p.find(s=>s.context?.kind==="ArcadeCodeResponse");if(!r){await this.logInteractionToFeedbackService({question:e,answer:"No ArcadeCodeResponse returned.",contextSnapshot:t,conversationId:i});return}if(r.context?.kind==="ArcadeCodeResponse"){let s=this.createFeedbackContextSnapshot(n),u=se(r?.context?.arcadeCode?.code??"");this.updateViewState({history:[{script:r?.context?.arcadeCode?.code,formattedScript:u,error:void 0,question:e,profile:n.profileId,conversationId:r.conversationId,contextSnapshot:s,...r.message?{message:r.message}:{}},...this.viewState.history],viewMode:"result",errorMessage:void 0}),await this.logInteractionToFeedbackService({question:e,answer:u,contextSnapshot:t,conversationId:r.conversationId})}}catch(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:i}),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,i=N.getEditorProfileForModel(e);i?.loaded||await i?.loadSource();let o=this.editorRef.profile;o&&"id"in o&&(t=o.id);let n=i?await Ye(i):{variables:[]},c=et(n),p=c?Ze(n):void 0,r=p?p.context:n,s=U(r);return{profileId:t,metadata:r,contextTooLarge:c,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.assistantsEnabled?l`<calcite-flow><calcite-flow-item closable heading-level=2 .heading=${this.messages.arcadeassistant??"Arcade assistant"} @calciteFlowItemClose=${this.handleClose}>${this.viewState.splashActive&&l`<calcite-scrim></calcite-scrim>`||""}${Pe({messages:this.messages})}${De({messages:this.messages,popoverContent:de({assistantsEnabled:this.assistantsEnabled,messages:this.messages,helpTopicUrl:this.usingTheAssitantDocUrl})})}<calcite-shell class="unstyled-shell">${this.viewState.splashActive&&je({messages:this.messages,onProceed:()=>{this.updateViewState({splashActive:!1})},helpTopicUrl:this.assistantOverviewDocUrl,onExit:i=>this.closePanel?.(i)})||""}${Ue({active:this.viewState.confirmationActive,setActive:i=>this.updateViewState({confirmationActive:i}),messages:this.messages})}${ze({isDisabled:this.viewState.isSubmitting,isReadOnly:!1,setQuestion:this.setQuestionState,setIsViewingResult:i=>this.updateViewState({viewMode:i?"result":"prompt"}),mode:e?"refine":"prompt",textAreaRef:this.textAreaRef,question:this.viewState.question,errorMessage:this.viewState.errorMessage,setErrorMessage:i=>this.updateViewState({errorMessage:i}),promptValidationMessage:this.viewState.promptValidationMessage,setPromptValidationMessage:i=>this.updateViewState({promptValidationMessage:i}),submitQuestion:this.submitQuestion.bind(this),assistantRef:this.el,messages:this.messages,context:this.viewState.context,contextReducedNoticeDismissed:this.viewState.contextReducedNoticeDismissed,setContextReducedNoticeDismissed:i=>this.updateViewState({contextReducedNoticeDismissed:i})})}<calcite-block-group .label=${this.messages.interactiveblocks??"interactive blocks"}>${!e&&!this.viewState.isSubmitting&&He({messages:this.messages,suggestions:[this.messages.prompsuggestion1??"",this.messages.prompsuggestion2??""],onSuggestionClick:this.onSuggestionClick})||""}<calcite-block .hidden=${!this.viewState.isSubmitting} .heading=${this.messages.generatingresponse??"Generating response..."}></calcite-block>${ue({expanded:e,messages:this.messages,collapsible:!0,showEffectsIcon:!0,cards:t.length?[t[0]]:[],heading:this.messages.besteffort??"Here's the assistant's best effort",hidden:this.viewState.isSubmitting||!e,onCopyCode:this.onCopyCode.bind(this),standalone:!0})}${ue({expanded:!e,messages:this.messages,collapsible:!0,cards:e?t.slice(1):t,heading:this.messages.recentprompts??"Recent prompts",hidden:this.viewState.isSubmitting||this.viewState.history.length===0,onCopyCode:this.onCopyCode.bind(this)})}</calcite-block-group>${this.viewState.feedback.active?Qe({setOpen:this.handleFeedbackSheetClose,messages:this.messages,onSubmit:this.handleFeedbackSubmit,feedback:this.viewState.feedback,setFeedback:this.setFeedbackState,learnMoreUrl:this.assistantOverviewDocUrl}):null}</calcite-shell></calcite-flow-item></calcite-flow>`:l`<calcite-flow><calcite-flow-item .selected=${!e} closable heading-level=2 .heading=${this.messages.arcadeassistant??"Arcade assistant"} @calciteFlowItemClose=${this.handleClose}>${de({slot:"content-top",messages:this.messages,assistantsEnabled:this.assistantsEnabled,helpTopicUrl:this.usingTheAssitantDocUrl})}</calcite-flow-item></calcite-flow>`}};ee("arcgis-arcade-coding-assistant",O);return O},"identity/IdentityManager","request","layers/FeatureLayer","config","Graphic","applications/Components/arcadeEditorUtils","core/Accessor","core/accessorSupport/decorators",a,b,c)
|
|
@@ -18248,7 +18248,7 @@ function se(t, e, r, n) {
|
|
|
18248
18248
|
const cr = { apiKey: void 0, apiKeys: { scopes: [] }, applicationName: "", applicationUrl: globalThis.location?.href, assetsPath: "", fontsUrl: "https://static.arcgis.com/fonts", geometryServiceUrl: "https://utility.arcgisonline.com/arcgis/rest/services/Geometry/GeometryServer", geoRSSServiceUrl: "https://utility.arcgis.com/sharing/rss", kmlServiceUrl: "https://utility.arcgis.com/sharing/kml", userPrivilegesApplied: !0, portalUrl: "https://www.arcgis.com", respectPrefersReducedMotion: !0, routeServiceUrl: "https://route-api.arcgis.com/arcgis/rest/services/World/Route/NAServer/Route_World", workers: { loaderConfig: { has: {}, paths: {}, map: {}, packages: [] } }, request: { crossOriginNoCorsDomains: null, httpsDomains: ["arcgis.com", "arcgisonline.com", "esrikr.com", "premiumservices.blackbridge.com", "esripremium.accuweather.com", "gbm.digitalglobe.com", "firstlook.digitalglobe.com", "msi.digitalglobe.com"], interceptors: [], internalInterceptors: [], maxUrlLength: 2e3, priority: "high", proxyRules: [], proxyUrl: null, timeout: 62e3, trustedServers: [], useIdentity: !0 }, log: { interceptors: [], level: null } };
|
|
18249
18249
|
if (globalThis.esriConfig && (H4(cr, globalThis.esriConfig, !0), delete cr.has), !cr.assetsPath) {
|
|
18250
18250
|
{
|
|
18251
|
-
const t = "5.1.0-next.
|
|
18251
|
+
const t = "5.1.0-next.93";
|
|
18252
18252
|
cr.assetsPath = `https://cdn.jsdelivr.net/npm/@arcgis/core@${t}/assets`;
|
|
18253
18253
|
}
|
|
18254
18254
|
cr.defaultAssetsPath = cr.assetsPath;
|