@arcgis/coding-components 5.2.0-next.79 → 5.2.0-next.84

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (44) hide show
  1. package/dist/cdn/{VJVVEOIA.js → 327RBVAC.js} +2 -2
  2. package/dist/cdn/{UM4DUHEA.js → 4OW3EH74.js} +1 -1
  3. package/dist/cdn/{KUL43ADE.js → 56P6FTYQ.js} +1 -1
  4. package/dist/cdn/{JTB3WQOI.js → 5MCVDNVO.js} +1 -1
  5. package/dist/cdn/{ILVYWJS4.js → 6YLBGWGQ.js} +1 -1
  6. package/dist/cdn/{GATL6PSW.js → AQHAEA62.js} +1 -1
  7. package/dist/cdn/{6EN2C75J.js → BGUYF4JI.js} +1 -1
  8. package/dist/cdn/{IVUY4N4B.js → BPPFZDPH.js} +1 -1
  9. package/dist/cdn/{CKDIUAF7.js → CMZI6WXP.js} +1 -1
  10. package/dist/cdn/{MM63IOR3.js → DUB4GMXG.js} +1 -1
  11. package/dist/cdn/{LJQ7Y6HB.js → DYLBKSGK.js} +1 -1
  12. package/dist/cdn/{3OR3WFUJ.js → JSZLCNQX.js} +1 -1
  13. package/dist/cdn/{46SGP3IQ.js → MIIHORYJ.js} +1 -1
  14. package/dist/cdn/{VBQBE2ZZ.js → NLVKEWNR.js} +1 -1
  15. package/dist/cdn/{4CIH3GTH.js → NNZO447D.js} +1 -1
  16. package/dist/cdn/{E57Q2B63.js → OLMW3NCS.js} +1 -1
  17. package/dist/cdn/{RDHNSTZG.js → OY7QVXY5.js} +1 -1
  18. package/dist/cdn/{6BBVTMSM.js → P6UAZRSN.js} +1 -1
  19. package/dist/cdn/{BMH6Y42N.js → RBDGSMHN.js} +1 -1
  20. package/dist/cdn/{CPRY6A4M.js → RG7XCMPX.js} +1 -1
  21. package/dist/cdn/{VYEWIX5W.js → SKBHZ7VS.js} +1 -1
  22. package/dist/cdn/{VK7LOSQ5.js → SSVSZDRA.js} +1 -1
  23. package/dist/cdn/{CRHXEUUE.js → VQB7J2LU.js} +1 -1
  24. package/dist/cdn/{M5FGCA7R.js → W2NC7KQQ.js} +1 -1
  25. package/dist/cdn/{VVCAEHDP.js → W77Z4EY4.js} +1 -1
  26. package/dist/cdn/{DGQ3XT5J.js → XQ24DDUO.js} +1 -1
  27. package/dist/cdn/{SUFCEUFA.js → XVYE4IMG.js} +1 -1
  28. package/dist/cdn/assets/code-editor/sql-expr.worker.js +1 -1
  29. package/dist/cdn/index.js +1 -1
  30. package/dist/chunks/arcade-defaults.js +2 -2
  31. package/dist/chunks/language-defaults-base.js +10 -10
  32. package/dist/chunks/sql-expr-defaults.js +2 -2
  33. package/dist/chunks/sql-expr-mode.js +1 -1
  34. package/dist/chunks/sql-layer-defaults.js +15 -15
  35. package/dist/chunks/sql-layer-mode.js +1 -1
  36. package/dist/chunks/utils.js +12 -12
  37. package/dist/components/arcgis-arcade-coding-assistant/customElement.js +1 -1
  38. package/dist/components/arcgis-editor-variables/customElement.js +1 -1
  39. package/dist/components/arcgis-sql-layer-editor/customElement.js +1 -1
  40. package/dist/docs/api.json +1 -1
  41. package/dist/docs/docs.json +1 -1
  42. package/dist/docs/web-types.json +1 -1
  43. package/package.json +7 -7
  44. /package/dist/cdn/{SMZ3LNZE.js → A77A54OM.js} +0 -0
@@ -1,6 +1,6 @@
1
1
  /* COPYRIGHT Esri - https://js.arcgis.com/5.2/LICENSE.txt */
2
- import b from"./GATL6PSW.js";import a from"./STN3LSQR.js";import{i as v,j as T}from"./BHSILWSL.js";import{b as f,c as p,d as c}from"./BZWB7A55.js";import{M as m}from"./SMZ3LNZE.js";export default $arcgis.t(([{getDeclaredPixelMembers:$},{G:w,f:M,g:F,h:A,i:P,j:k,n:b},{k:I,l:L,m:V,o:C,p:D}])=>{async function K(e){let{apiVersion:i,bundles:t,hiddenApiItems:n}=e.toEditorProfileDefinition(),s=await E(e.dictionaryVariables.filter(w));return{apiVersion:i,bundles:t,variables:s,hiddenApiItems:n?.map(o=>o.toLowerCase())}}async function E(e,i=f.Variable){return await Promise.all(e.map(async t=>{switch(t.type){case"dictionary":return await B(t,i);case"pixel":return await q(t,i);case"voxel":case"feature":return await _(t,i);default:return U(t,i)}}))}function U(e,i){let{name:t,type:n}=e,s=e.getDescription(),o=i===f.Field?I(t,!1):t;return{name:t,description:s,type:n,completion:{label:t,detail:t,insertText:o,insertTextMode:c.asIs,insertTextFormat:p.PlainText,kind:i,documentation:{kind:"markdown",value:s}}}}async function _(e,i){let t=await e.loadSource(),{name:n}=e,s=e.getDescription(),o={label:n,detail:n,insertText:n,insertTextMode:c.asIs,insertTextFormat:p.PlainText,kind:i},a={name:n,description:s,type:"dictionary",properties:[],completion:o};if(!t)return a;let[r,l]=L(t.fields,s,{includeAliases:!0});return a.properties=r,o.documentation={kind:"markdown",value:l},a}async function q(e,i){let t=await e.loadSource(),n=e.toProfileVariableDefinition();if(n.type!=="pixel")throw new Error("Incorrect definition passed to pixel variable");let{name:s}=e,o=e.getDescription(),a={label:s,detail:s,insertText:s,insertTextMode:c.asIs,insertTextFormat:p.PlainText,kind:i},r={name:s,description:o,type:"dictionary",properties:[],completion:a};if(!t||!n.definition)return r;let l=await $(t),[d,u]=V(l,o);return r.properties=d,a.documentation={kind:"markdown",value:u},r}async function B(e,i){let{name:t,dictionaryVariables:n}=e,s=e.getDescription(),o=n.reduce((a,r)=>{a!==""&&(a+=`
2
+ import b from"./AQHAEA62.js";import a from"./STN3LSQR.js";import{i as v,j as T}from"./BHSILWSL.js";import{b as f,c as p,d as c}from"./BZWB7A55.js";import{M as m}from"./A77A54OM.js";export default $arcgis.t(([{getDeclaredPixelMembers:$},{G:w,f:M,g:F,h:k,i:A,j:P,n:b},{k:I,l:L,m:V,o:C,p:D}])=>{async function K(e){let{apiVersion:i,bundles:t,hiddenApiItems:n}=e.toEditorProfileDefinition(),s=await E(e.dictionaryVariables.filter(w));return{apiVersion:i,bundles:t,variables:s,hiddenApiItems:n?.map(o=>o.toLowerCase())}}async function E(e,i=f.Variable){return await Promise.all(e.map(async t=>{switch(t.type){case"dictionary":return await B(t,i);case"pixel":return await q(t,i);case"voxel":case"feature":return await _(t,i);default:return U(t,i)}}))}function U(e,i){let{name:t,type:n}=e,s=e.getDescription(),o=i===f.Field?I(t,!1):t;return{name:t,description:s,type:n,completion:{label:t,detail:t,insertText:o,insertTextMode:c.asIs,insertTextFormat:p.PlainText,kind:i,documentation:{kind:"markdown",value:s}}}}async function _(e,i){let t=await e.loadSource(),{name:n}=e,s=e.getDescription(),o={label:n,detail:n,insertText:n,insertTextMode:c.asIs,insertTextFormat:p.PlainText,kind:i},a={name:n,description:s,type:"dictionary",properties:[],completion:o};if(!t)return a;let[r,l]=L(t.fields,s,{includeAliases:!0});return a.properties=r,o.documentation={kind:"markdown",value:l},a}async function q(e,i){let t=await e.loadSource(),n=e.toProfileVariableDefinition();if(n.type!=="pixel")throw new Error("Incorrect definition passed to pixel variable");let{name:s}=e,o=e.getDescription(),a={label:s,detail:s,insertText:s,insertTextMode:c.asIs,insertTextFormat:p.PlainText,kind:i},r={name:s,description:o,type:"dictionary",properties:[],completion:a};if(!t||!n.definition)return r;let l=await $(t),[d,u]=V(l,o);return r.properties=d,a.documentation={kind:"markdown",value:u},r}async function B(e,i){let{name:t,dictionaryVariables:n}=e,s=e.getDescription(),o=n.reduce((a,r)=>{a!==""&&(a+=`
3
3
 
4
4
  `),a+=`**${r.name}**
5
5
  ${r.type}`;let l=r.getDescription();return l&&(a+=`
6
- ${l}`),a},s);return{name:t,description:s,type:"dictionary",properties:await E(n.filter(w),f.Field),completion:{label:t,detail:t,insertText:t,insertTextMode:c.asIs,insertTextFormat:p.PlainText,kind:i,documentation:{kind:"markdown",value:o}}}}async function h(e="en"){let i=j.get(e);if(i)return i;if(!v.has(e))return await h("en");try{let t=await fetch(m(`./assets/arcade-language/profiles/arcade-profiles.t9n.${e}.json`));return t.ok?O(e,await t.json()):e==="en"?null:await h("en")}catch{return null}}var j=new Map;function O(e,i){let t=new Map;return i.forEach(n=>{t.set(n.id,n)}),j.set(e,t),t}async function z(e,i="en"){return(await h(i))?.get(e)??null}function G(e){return!!e&&typeof e=="object"&&"additionalVariables"in e&&Array.isArray(e.additionalVariables)}function H(e,i){return e?.map(t=>g(t,i))}function g(e,i){switch(e.type){case"dictionary":return{...e,type:e.type,properties:H(e.properties,i)};case"array":return{...e,type:e.type,...i?.allowUserArrayElementTypes?{}:{elementType:{type:"number",name:"number"}}};default:return{...e,type:e.type}}}async function J(e,i="en"){if(!b(e))return;let t=await z(e.id,i);if(!t)return;let n=e.definitions,s=new Map(Object.entries(n).map(([a,r])=>[a.toLowerCase(),r])),o={bundles:[...t.bundles],variables:[],hiddenApiItems:e.hiddenApiItems?.map(a=>a.toLowerCase())};return t.variables.forEach(a=>{if(e.disabledVariables?.includes(a.name))return;let r=s.get(a.name.toLowerCase());switch(a.type){case"dictionary":return o.variables.push(g({...a,type:a.type,properties:Array.isArray(r)?[...r]:a.properties},{allowUserArrayElementTypes:e.id==="data-pipelines"}));case"feature":return M(r)?o.variables.push({...a,type:"feature",definition:r}):void 0;case"pixel":return A(r)?o.variables.push({...a,type:a.type,definition:r}):void 0;case"voxel":return F(r)?o.variables.push({...a,type:a.type,definition:r}):void 0;case"featureSet":return P(r)?o.variables.push({...a,type:a.type,definition:r}):void 0;case"featureSetCollection":return k(r)?o.variables.push({...a,type:a.type,definition:r}):void 0;default:return o.variables.push(g(a))}}),G(e)&&o.variables.push(...e.additionalVariables??[]),o}var N=["catalog-footprint","catalog","csv","feature","geojson","knowledge-graph-sublayer","oriented-imagery","subtype-group","subtype-sublayer","wfs","parquet"];function Q(e){return!!e&&typeof e=="object"&&"type"in e&&typeof e.type=="string"&&N.includes(e.type)}var R={filterFsCollectionLayersFromMap:e=>Q(e)},x=class extends D{#e=new Map;constructor(){super("arcade",{apiPath:"./assets/arcade-language/api",apiPrefix:"arcade-api.t9n."})}async setProfileForModel(i,t,n={locale:"en"}){let s=this._getApiKey(i),o=(this.#e.get(s)||Promise.resolve()).then(async()=>{let r=t,l=b(r)?await J(r,n.locale):r,d=await T(n.locale,m("./assets/editor-profile/t9n"),"messages.");if(!d)throw new Error(`Failed to load the language bundle for ${n.locale}`);this.disposeForModel(i);let u=new C(l,d,n.locale,R);this._modelToProfileMap.set(s,u);let S=await K(u);this.updateApiContextForModel(i,{locale:n.locale,profile:S,snippets:n.snippets})}),a=o.finally(()=>{this.#e.get(s)===a&&this.#e.delete(s)});return this.#e.set(s,a),await o}},y=new x,ae={setProfileForModel:y.setProfileForModel.bind(y),getApiLibraryForModel:y.getApiLibraryForModel.bind(y)};return y},"applications/Components/arcadeEditorUtils",a,b)
6
+ ${l}`),a},s);return{name:t,description:s,type:"dictionary",properties:await E(n.filter(w),f.Field),completion:{label:t,detail:t,insertText:t,insertTextMode:c.asIs,insertTextFormat:p.PlainText,kind:i,documentation:{kind:"markdown",value:o}}}}async function h(e="en"){let i=j.get(e);if(i)return i;if(!v.has(e))return await h("en");try{let t=await fetch(m(`./assets/arcade-language/profiles/arcade-profiles.t9n.${e}.json`));return t.ok?O(e,await t.json()):e==="en"?null:await h("en")}catch{return null}}var j=new Map;function O(e,i){let t=new Map;return i.forEach(n=>{t.set(n.id,n)}),j.set(e,t),t}async function z(e,i="en"){return(await h(i))?.get(e)??null}function G(e){return!!e&&typeof e=="object"&&"additionalVariables"in e&&Array.isArray(e.additionalVariables)}function H(e,i){return e?.map(t=>g(t,i))}function g(e,i){switch(e.type){case"dictionary":return{...e,type:e.type,properties:H(e.properties,i)};case"array":return{...e,type:e.type,...i?.allowUserArrayElementTypes?{}:{elementType:{type:"number",name:"number"}}};default:return{...e,type:e.type}}}async function J(e,i="en"){if(!b(e))return;let t=await z(e.id,i);if(!t)return;let n=e.definitions,s=new Map(Object.entries(n).map(([a,r])=>[a.toLowerCase(),r])),o={bundles:[...t.bundles],variables:[],hiddenApiItems:e.hiddenApiItems?.map(a=>a.toLowerCase())};return t.variables.forEach(a=>{if(e.disabledVariables?.includes(a.name))return;let r=s.get(a.name.toLowerCase());switch(a.type){case"dictionary":return o.variables.push(g({...a,type:a.type,properties:Array.isArray(r)?[...r]:a.properties},{allowUserArrayElementTypes:e.id==="data-pipelines"}));case"feature":return M(r)?o.variables.push({...a,type:"feature",definition:r}):void 0;case"pixel":return k(r)?o.variables.push({...a,type:a.type,definition:r}):void 0;case"voxel":return F(r)?o.variables.push({...a,type:a.type,definition:r}):void 0;case"featureSet":return A(r)?o.variables.push({...a,type:a.type,definition:r}):void 0;case"featureSetCollection":return P(r)?o.variables.push({...a,type:a.type,definition:r}):void 0;default:return o.variables.push(g(a))}}),G(e)&&o.variables.push(...e.additionalVariables??[]),o}var N=["catalog-footprint","catalog","csv","feature","geojson","knowledge-graph-sublayer","oriented-imagery","subtype-group","subtype-sublayer","wfs","parquet"];function Q(e){return!!e&&typeof e=="object"&&"type"in e&&typeof e.type=="string"&&N.includes(e.type)}var R={filterFsCollectionLayersFromMap:e=>Q(e)},x=class extends D{#e=new Map;constructor(){super("arcade",{apiPath:"./assets/arcade-language/api",apiPrefix:"arcade-api.t9n."})}async setProfileForModel(i,t,n={locale:"en"}){let s=this._getApiKey(i),o=(this.#e.get(s)||Promise.resolve()).then(async()=>{let r=t,l=b(r)?await J(r,n.locale):r,d=await T(n.locale,m("./assets/editor-profile/t9n"),"messages.");if(!d)throw new Error(`Failed to load the language bundle for ${n.locale}`);this.disposeForModel(i);let u=new C(l,d,n.locale,R);this._modelToProfileMap.set(s,u);let S=await K(u);this.updateApiContextForModel(i,{locale:n.locale,profile:S,snippets:n.snippets})}),a=o.finally(()=>{this.#e.get(s)===a&&this.#e.delete(s)});return this.#e.set(s,a),await o}},y=new x,ae={setProfileForModel:y.setProfileForModel.bind(y),getApiLibraryForModel:y.getApiLibraryForModel.bind(y)};return y},"applications/Components/arcadeEditorUtils",a,b)
@@ -1,2 +1,2 @@
1
1
  /* COPYRIGHT Esri - https://js.arcgis.com/5.2/LICENSE.txt */
2
- import{a as v}from"./4L2GLNTS.js";import{b,c as r,d as _}from"./O5VTBJWD.js";import{a as f}from"./VYEWIX5W.js";import{a as p}from"./E57Q2B63.js";import"./VK7LOSQ5.js";import{e as h,f as m}from"./BHSILWSL.js";import"./J4I4EROF.js";import"./BZWB7A55.js";import"./CMRUQ3BN.js";import"./UFF53OEH.js";import"./NHREAORV.js";import{G as c,H as d,L as u,h as g,j as s,l,n as a}from"./SMZ3LNZE.js";import"./BFPEJYVB.js";import"./DSQ2DQQL.js";import"./H6RQVSYM.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};
2
+ import{a as v}from"./4L2GLNTS.js";import{b,c as r,d as _}from"./O5VTBJWD.js";import{a as f}from"./SKBHZ7VS.js";import{a as p}from"./OLMW3NCS.js";import"./SSVSZDRA.js";import{e as h,f as m}from"./BHSILWSL.js";import"./J4I4EROF.js";import"./BZWB7A55.js";import"./CMRUQ3BN.js";import"./UFF53OEH.js";import"./NHREAORV.js";import{G as c,H as d,L as u,h as g,j as s,l,n as a}from"./A77A54OM.js";import"./BFPEJYVB.js";import"./DSQ2DQQL.js";import"./H6RQVSYM.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.2/LICENSE.txt */
2
- import c from"./GATL6PSW.js";import a from"./STN3LSQR.js";import{j as f}from"./BHSILWSL.js";import{b as y,c as h,d as b}from"./BZWB7A55.js";import{M as u}from"./SMZ3LNZE.js";export default $arcgis.t(([{i:m,n:l},{l:g,o:F,p:w}])=>{var T={allowAllRootBinaryOperators:!1,requiresPredicateRootNode:!1},M={"field-calculation":T,"where-clause":{allowAllRootBinaryOperators:!0,requiresPredicateRootNode:!0,allowGeometryFields:!0}};function I(i){return i&&i in M?M[i]:void 0}var L=i=>{let r=i.variables[0],t=r?.type==="featureSet"?_(r):void 0,{apiVersion:e,bundles:a,hiddenApiItems:o}=i.toEditorProfileDefinition();return{apiVersion:e,bundles:a,variables:t?[t]:[],hiddenApiItems:o?.map(s=>s.toLowerCase())}};function _(i){let{name:r}=i,t=i.getDescription(),{definition:e}=i.toProfileVariableDefinition(),a={label:r,detail:r,insertText:r,insertTextMode:b.asIs,insertTextFormat:h.PlainText,kind:y.Field},o={name:r,description:t,type:"dictionary",properties:[],completion:a};if(!e||!("fields"in e))return o;let[s,n]=g(e.fields,t,{includeAliases:!1,supportGeometryFields:!0});return o.properties=s,a.documentation={kind:"markdown",value:n},o}var v=[{name:"$layer",type:"featureSet",description:"The layer being calculated."}],q={"field-calculation":{id:"field-calculation",variables:v},"where-clause":{id:"where-clause",variables:v}};function E(i){return q[i]??null}function S(i){if(!l(i))return;let r=E(i.id);if(!r)return;let t={variables:[],hiddenApiItems:i.hiddenApiItems?.map(e=>e.toLowerCase())};return r.variables.forEach(e=>{if(i.disabledVariables?.includes(e.name))return;let a=i.definitions[e.name];if(e.type==="featureSet")return m(a)?t.variables.push({...e,type:e.type,definition:a}):void 0;throw Error(`sdkVariable type not supported (yet) type: ${e.type}`)}),t}var A="arcgis-sql-expression",p=class extends w{constructor(){super(A,{apiPath:"./assets/sql-language/api",apiPrefix:"sql-api.t9n."}),this._languageId=A,this._layerMap=new Map}updateFeatureLayerForModel(r,t){let e=this._getApiKey(r);this._layerMap.set(e,t)}getFeatureLayerForModel(r){let t=this._getApiKey(r);return this._layerMap.get(t)}async setProfileForModel(r,t,e={locale:"en"}){let a=l(t)?I(t.id):void 0;l(t)&&(t=S(t));let o=await f(e.locale,u("./assets/editor-profile/t9n"),"messages.");if(!o)throw new Error(`Failed to load the language bundle for ${e.locale}`);this.disposeForModel(r);let s=this._getApiKey(r),n=new F(t,o,e.locale,a);this._modelToProfileMap.set(s,n);let x=L(n);this.updateApiContextForModel(r,{locale:e.locale,profile:x,...a?{profilePolicy:a}:{}});let c=t?.variables?.find(P=>P.name==="$layer");c&&this.updateFeatureLayerForModel(r,c.definition)}},d=new p,K={setProfileForModel:d.setProfileForModel.bind(d),getApiLibraryForModel:d.getApiLibraryForModel.bind(d)};async function B(){return await import("./LJQ7Y6HB.js").then(m=>m.default)}return{a:d,b:B}},a,c)
2
+ import c from"./AQHAEA62.js";import a from"./STN3LSQR.js";import{j as f}from"./BHSILWSL.js";import{b as y,c as h,d as b}from"./BZWB7A55.js";import{M as u}from"./A77A54OM.js";export default $arcgis.t(([{i:m,n:l},{l:g,o:F,p:w}])=>{var T={allowAllRootBinaryOperators:!1,requiresPredicateRootNode:!1},M={"field-calculation":T,"where-clause":{allowAllRootBinaryOperators:!0,requiresPredicateRootNode:!0,allowGeometryFields:!0}};function I(i){return i&&i in M?M[i]:void 0}var L=i=>{let r=i.variables[0],t=r?.type==="featureSet"?_(r):void 0,{apiVersion:e,bundles:a,hiddenApiItems:o}=i.toEditorProfileDefinition();return{apiVersion:e,bundles:a,variables:t?[t]:[],hiddenApiItems:o?.map(s=>s.toLowerCase())}};function _(i){let{name:r}=i,t=i.getDescription(),{definition:e}=i.toProfileVariableDefinition(),a={label:r,detail:r,insertText:r,insertTextMode:b.asIs,insertTextFormat:h.PlainText,kind:y.Field},o={name:r,description:t,type:"dictionary",properties:[],completion:a};if(!e||!("fields"in e))return o;let[s,n]=g(e.fields,t,{includeAliases:!1,supportGeometryFields:!0});return o.properties=s,a.documentation={kind:"markdown",value:n},o}var v=[{name:"$layer",type:"featureSet",description:"The layer being calculated."}],q={"field-calculation":{id:"field-calculation",variables:v},"where-clause":{id:"where-clause",variables:v}};function E(i){return q[i]??null}function S(i){if(!l(i))return;let r=E(i.id);if(!r)return;let t={variables:[],hiddenApiItems:i.hiddenApiItems?.map(e=>e.toLowerCase())};return r.variables.forEach(e=>{if(i.disabledVariables?.includes(e.name))return;let a=i.definitions[e.name];if(e.type==="featureSet")return m(a)?t.variables.push({...e,type:e.type,definition:a}):void 0;throw Error(`sdkVariable type not supported (yet) type: ${e.type}`)}),t}var A="arcgis-sql-expression",p=class extends w{constructor(){super(A,{apiPath:"./assets/sql-language/api",apiPrefix:"sql-api.t9n."}),this._languageId=A,this._layerMap=new Map}updateFeatureLayerForModel(r,t){let e=this._getApiKey(r);this._layerMap.set(e,t)}getFeatureLayerForModel(r){let t=this._getApiKey(r);return this._layerMap.get(t)}async setProfileForModel(r,t,e={locale:"en"}){let a=l(t)?I(t.id):void 0;l(t)&&(t=S(t));let o=await f(e.locale,u("./assets/editor-profile/t9n"),"messages.");if(!o)throw new Error(`Failed to load the language bundle for ${e.locale}`);this.disposeForModel(r);let s=this._getApiKey(r),n=new F(t,o,e.locale,a);this._modelToProfileMap.set(s,n);let x=L(n);this.updateApiContextForModel(r,{locale:e.locale,profile:x,...a?{profilePolicy:a}:{}});let c=t?.variables?.find(P=>P.name==="$layer");c&&this.updateFeatureLayerForModel(r,c.definition)}},d=new p,K={setProfileForModel:d.setProfileForModel.bind(d),getApiLibraryForModel:d.getApiLibraryForModel.bind(d)};async function B(){return await import("./DYLBKSGK.js").then(m=>m.default)}return{a:d,b:B}},a,c)
@@ -1,5 +1,5 @@
1
1
  /* COPYRIGHT Esri - https://js.arcgis.com/5.2/LICENSE.txt */
2
- import{a as u}from"./5HKDO4SX.js";import a from"./2WB7S5TQ.js";import{a as o}from"./BHSILWSL.js";import{I as i,J as v,g as p,h as n,j as t,p as d,q as r}from"./SMZ3LNZE.js";export default $arcgis.t(([{e:m,f:y,g:b}])=>{var s={lines:!0,selectionMode:"none",scale:"s",oncalciteTreeSelect:e=>e.currentTarget.selectedItems.forEach(a=>a.selected=!1)},g="tree-item-metadata",f=({name:e,isMetadata:a=!1})=>t`<bdi class=${i(o("dictionary-property",a&&g))}>${e}</bdi><bdi class=${i(o(a&&g))}>:&nbsp;</bdi>`,M=({obj:e,subtree:a})=>t`<calcite-tree slot=${"children"} .lines=${s.lines} .selectionMode=${s.selectionMode} .scale=${s.scale} @calciteTreeSelect=${s.oncalciteTreeSelect}><calcite-tree-item class="string-value">${JSON.stringify(e,void 0,2)}</calcite-tree-item></calcite-tree>`,N=({value:e,subtree:a=!1})=>t`<calcite-tree slot=${(a?"children":void 0)??v} .lines=${s.lines} .selectionMode=${s.selectionMode} .scale=${s.scale} @calciteTreeSelect=${s.oncalciteTreeSelect}><calcite-tree-item><div class="tree-item-label">${f({name:"type"})}<bdi>${d(e.type)}</bdi></div></calcite-tree-item><calcite-tree-item><div class="tree-item-label">${f({name:"value"})}<span class="string-value">${JSON.stringify(e,void 0,2)}</span></div></calcite-tree-item></calcite-tree>`,D=({type:e,value:a})=>{switch(e){case"unknown":case"Unknown":return t`<span class="constant-value">${e}</span>`;case"null":case"Null":return t`<span class="constant-value">null</span>`;case"text":case"String":case"Text":return t`<span class="string-value">${r(a)}</span>`;case"number":case"Number":return t`<span class="number-value">${a}</span>`;case"boolean":case"Boolean":return t`<span class="constant-value">${a}</span>`;case"date":case"Date":return t`<span class="date-value">${a}</span>`;case"dateOnly":case"DateOnly":return t`<span class="string-value">${r(a)}</span>`;case"time":case"Time":return t`<span class="string-value">${r(a)}</span>`;case"":return t`<span class="string-value">null</span>`;default:return null}},h=["boolean","date","dateOnly","null","number","text","time","unknown","Boolean","Date","DateOnly","Null","Number","Text","Time","Unknown","String",""],E=e=>h.includes(e.type);function j(e){switch(e.type){case"null":case"unknown":return{type:e.type,value:e.type};case"number":return{type:e.type,value:String(e.value)};case"boolean":return{type:e.type,value:String(e.value)};case"text":return{type:e.type,value:e.value};case"date":return{type:e.type,value:m(e)};case"dateOnly":return{type:e.type,value:y(e)};case"time":return{type:e.type,value:b(e)}}}var S="calcite-mode-dark";function C(){let e=`:host {
2
+ import{a as u}from"./5HKDO4SX.js";import a from"./2WB7S5TQ.js";import{a as o}from"./BHSILWSL.js";import{I as i,J as v,g as p,h as n,j as t,p as d,q as r}from"./A77A54OM.js";export default $arcgis.t(([{e:m,f:y,g:b}])=>{var s={lines:!0,selectionMode:"none",scale:"s",oncalciteTreeSelect:e=>e.currentTarget.selectedItems.forEach(a=>a.selected=!1)},g="tree-item-metadata",f=({name:e,isMetadata:a=!1})=>t`<bdi class=${i(o("dictionary-property",a&&g))}>${e}</bdi><bdi class=${i(o(a&&g))}>:&nbsp;</bdi>`,M=({obj:e,subtree:a})=>t`<calcite-tree slot=${"children"} .lines=${s.lines} .selectionMode=${s.selectionMode} .scale=${s.scale} @calciteTreeSelect=${s.oncalciteTreeSelect}><calcite-tree-item class="string-value">${JSON.stringify(e,void 0,2)}</calcite-tree-item></calcite-tree>`,N=({value:e,subtree:a=!1})=>t`<calcite-tree slot=${(a?"children":void 0)??v} .lines=${s.lines} .selectionMode=${s.selectionMode} .scale=${s.scale} @calciteTreeSelect=${s.oncalciteTreeSelect}><calcite-tree-item><div class="tree-item-label">${f({name:"type"})}<bdi>${d(e.type)}</bdi></div></calcite-tree-item><calcite-tree-item><div class="tree-item-label">${f({name:"value"})}<span class="string-value">${JSON.stringify(e,void 0,2)}</span></div></calcite-tree-item></calcite-tree>`,D=({type:e,value:a})=>{switch(e){case"unknown":case"Unknown":return t`<span class="constant-value">${e}</span>`;case"null":case"Null":return t`<span class="constant-value">null</span>`;case"text":case"String":case"Text":return t`<span class="string-value">${r(a)}</span>`;case"number":case"Number":return t`<span class="number-value">${a}</span>`;case"boolean":case"Boolean":return t`<span class="constant-value">${a}</span>`;case"date":case"Date":return t`<span class="date-value">${a}</span>`;case"dateOnly":case"DateOnly":return t`<span class="string-value">${r(a)}</span>`;case"time":case"Time":return t`<span class="string-value">${r(a)}</span>`;case"":return t`<span class="string-value">null</span>`;default:return null}},h=["boolean","date","dateOnly","null","number","text","time","unknown","Boolean","Date","DateOnly","Null","Number","Text","Time","Unknown","String",""],E=e=>h.includes(e.type);function j(e){switch(e.type){case"null":case"unknown":return{type:e.type,value:e.type};case"number":return{type:e.type,value:String(e.value)};case"boolean":return{type:e.type,value:String(e.value)};case"text":return{type:e.type,value:e.value};case"date":return{type:e.type,value:m(e)};case"dateOnly":return{type:e.type,value:y(e)};case"time":return{type:e.type,value:b(e)}}}var S="calcite-mode-dark";function C(){let e=`:host {
3
3
  `,a=u["light-theme"];Object.entries(a).forEach(([c,l])=>{e+=` --arcgis-editor-${c}: ${l};
4
4
  `}),e+=`}
5
5
  `,e+=`:host(:state(${S})),
@@ -1,2 +1,2 @@
1
1
  /* COPYRIGHT Esri - https://js.arcgis.com/5.2/LICENSE.txt */
2
- import a from"./STN3LSQR.js";import{a as _}from"./E57Q2B63.js";import"./VK7LOSQ5.js";import{c as u,e as p}from"./BHSILWSL.js";import"./J4I4EROF.js";import{G as f,H as g,L as b,h as d,j as i,n as o,r as m}from"./SMZ3LNZE.js";import{a as h}from"./BFPEJYVB.js";import"./H6RQVSYM.js";export default $arcgis.t(([{C:r,D:n,E:v,F:w}])=>{var $=d`: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-list-item-group{background-color:var(--calcite-color-foreground-2);word-break:break-word}.container{block-size:100%;display:grid;grid-template-rows:auto 1fr;overflow:hidden}.scrollable{min-block-size:0;overflow:auto}}`;function R(l){l.key==="Enter"&&l.stopPropagation()}var c=class extends g{constructor(){super(...arguments),this._beforeBack=async()=>{this.removeLastPanelRenderer(),this._filterValue=""},this.messages=_(),this._filterValue="",this._flowItemRenderers=[],this._rootPresentation="profile",this._mutationCounter=1,this.loading=!1,this.closed=!1,this.hideDescriptions=!1,this.arcgisInternalClosePanel=o({bubbles:!1,composed:!1}),this.arcgisInternalItemSelected=o({bubbles:!1})}static{this.properties={_filterValue:16,_flowItemRenderers:16,_rootPresentation:16,_mutationCounter:16,loading:5,modelId:1,closed:5,variable:0,heading:1,hideDescriptions:5,messageOverrides:0}}static{this.styles=$}load(){this._variableChanged()}willUpdate(e){e.has("modelId")&&(this._flowItemRenderers=[]),e.has("variable")&&this._variableChanged()}disconnectedCallback(){super.disconnectedCallback(),this._flowObserver?.disconnect()}_variableChanged(){if(!this.variable||r(this.variable)){this._rootPresentation="profile";return}this._rootPresentation=this.variable.type==="featureSet"?"featureSetRoot":"collectionRoot"}addPanelRenderer(e){this._flowItemRenderers=[...this._flowItemRenderers,e]}removeLastPanelRenderer(){this._flowItemRenderers=this._flowItemRenderers.slice(0,-1)}_isRootPresentation(e){return this._rootPresentation===e}flowFocusHandler(e){if(!e){this._flowObserver?.disconnect(),this._flowObserver=void 0;return}this._flowObserver||(this._flowObserver=new MutationObserver(()=>{p(u(e.querySelector("calcite-flow-item:last-child")??e,"calcite-input"))}),this._flowObserver.observe(e,{attributes:!0,attributeFilter:["id"],childList:!0}))}_updateFilterValue(e){this._filterValue=e.currentTarget.value}_emitClose(){this.arcgisInternalClosePanel.emit()}_backToTop(){this._flowItemRenderers=[]}_emitItemSelected(e,t){if(t.nonInteractive)return;let s=e;(!s.key||s.key==="Enter")&&(e.preventDefault(),this.arcgisInternalItemSelected.emit(t.snippet))}_showCollectionPanel(e,t){e.stopPropagation(),this.addPanelRenderer(s=>this.renderCollectionBasedVariable(t,!1,s))}_getHeadingForCollection(e,t=!1){if(!e)return"";if(t){if(this.heading)return this.heading;if(r(this.variable))return this.variable.definition?.label??this.messages.profilevariables??"Profile variables";if(this._isRootPresentation("featureSetRoot"))return this.messages.fields??"Fields";if(this._isRootPresentation("collectionRoot"))return this.messages.tables??"Tables"}return(n(e)||w(e))&&(this._isRootPresentation("featureSetRoot")||this._isRootPresentation("collectionRoot"))?this.messages.fields??"Fields":this.messages.profilevariables??"Profile variables"}_getDescriptionForCollection(e){return e?n(e)&&this._isRootPresentation("featureSetRoot")?e.variables[0]?.getLabel()??"":v(e)&&this._isRootPresentation("collectionRoot")?e.datastoreInfo?.name??e.getDescription()??"":e.breadcrumb:""}_getItemLabel(e){return e.getLabel()}_getItemDescription(e){return this.hideDescriptions?"":e.getDescription()}renderCollectionBasedVariable(e,t=!1,s=!1){if(!e)return null;let a=this.loading;return!a&&!e.loaded&&(e.loadSource().then(()=>setTimeout(()=>{this._mutationCounter+=1})).catch(()=>{h("error",this,"Error loading collection"),a=!1}),a=!0),i`<calcite-flow-item heading-level=2 .heading=${this._getHeadingForCollection(e,t)} .description=${this._getDescriptionForCollection(e)} .beforeBack=${this._beforeBack} closable @calciteFlowItemClose=${this._emitClose} .selected=${s}><calcite-action slot=header-actions-end .text=${this.messages.backtotop??""} scale=m .hidden=${t||this._isRootPresentation("featureSetRoot")} icon=chevrons-left icon-flip-rtl @click=${this._backToTop}></calcite-action><div class="container"><calcite-input .value=${this._filterValue} icon=magnifying-glass clearable @calciteInputInput=${this._updateFilterValue} class="sticky" scale=m .label=${this.messages.filterthevariablesbyname??""} name=variable-filter></calcite-input><div class="scrollable">${a?i`<calcite-loader scale=s type=indeterminate .label=${this.messages.loading??""}></calcite-loader>`:i`<calcite-list .label=${this.messages.profilevariables??"Profile variables"}>${this.renderEditorVariables(e)}</calcite-list>`}</div></div></calcite-flow-item>`}renderEditorVariables(e){let t=m(this._filterValue),s=e.variables.filter(a=>a.passFilter(t));return s.length?s.map(a=>this.renderEditorVariable(a)):i`<div class="notice-container">${this.messages.noitems}</div>`}renderEditorVariable(e){return e.type==="group"?this._isRootPresentation("featureSetRoot")&&e.isHeader?i`<calcite-list-item-group .heading=${this._getItemLabel(e)}></calcite-list-item-group>`:this._isRootPresentation("featureSetRoot")&&e._label?.code==="fields"?this.renderEditorVariables(e):i`<calcite-list-item-group .heading=${this._getItemLabel(e)}>${this.renderEditorVariables(e)}</calcite-list-item-group>`:i`<calcite-list-item .label=${this._getItemLabel(e)} .description=${this._getItemDescription(e)} @calciteListItemSelect=${t=>this._emitItemSelected(t,e)} @keydown=${t=>this._emitItemSelected(t,e)}>${e.isCollection?i`<calcite-action slot=actions-end .text=${this.messages.expand??""} scale=s icon=chevron-right icon-flip-rtl @click=${t=>this._showCollectionPanel(t,e)} @keydown=${R}></calcite-action>`:null}${e.icon?i`<calcite-icon .icon=${e.icon} scale=s slot=content-start></calcite-icon>`:null}</calcite-list-item>`}render(){return this.closed?null:this.loading&&!this.variable?i`<calcite-flow><calcite-flow-item heading-level=2 .heading=${this.heading??this.messages.profilevariables} closable @calciteFlowItemClose=${this._emitClose}><calcite-loader scale=s type=indeterminate .label=${this.messages.loading??""}></calcite-loader></calcite-flow-item></calcite-flow>`:!this.loading&&(!this.variable||this.variable?.loaded&&!this.variable?.variables.length)?i`<calcite-flow><calcite-flow-item heading-level=2 .heading=${this.heading??this.messages.profilevariables} closable @calciteFlowItemClose=${this._emitClose}><div class="notice-container">${this.messages.profileempty}</div></calcite-flow-item></calcite-flow>`:i`<calcite-flow ${f(this.flowFocusHandler)}>${this.renderCollectionBasedVariable(this.variable,!0,this._flowItemRenderers.length===0)}${this._flowItemRenderers.map((e,t,s)=>e(t===s.length-1))}</calcite-flow>`}};b("arcgis-editor-variables",c);return c},a)
2
+ import a from"./STN3LSQR.js";import{a as _}from"./OLMW3NCS.js";import"./SSVSZDRA.js";import{c as u,e as p}from"./BHSILWSL.js";import"./J4I4EROF.js";import{G as f,H as g,L as b,h as d,j as i,n as o,r as m}from"./A77A54OM.js";import{a as h}from"./BFPEJYVB.js";import"./H6RQVSYM.js";export default $arcgis.t(([{C:r,D:n,E:v,F:w}])=>{var $=d`: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-list-item-group{background-color:var(--calcite-color-foreground-2);word-break:break-word}.container{block-size:100%;display:grid;grid-template-rows:auto 1fr;overflow:hidden}.scrollable{min-block-size:0;overflow:auto}}`;function R(l){l.key==="Enter"&&l.stopPropagation()}var c=class extends g{constructor(){super(...arguments),this._beforeBack=async()=>{this.removeLastPanelRenderer(),this._filterValue=""},this.messages=_(),this._filterValue="",this._flowItemRenderers=[],this._rootPresentation="profile",this._mutationCounter=1,this.loading=!1,this.closed=!1,this.hideDescriptions=!1,this.arcgisInternalClosePanel=o({bubbles:!1,composed:!1}),this.arcgisInternalItemSelected=o({bubbles:!1})}static{this.properties={_filterValue:16,_flowItemRenderers:16,_rootPresentation:16,_mutationCounter:16,loading:5,modelId:1,closed:5,variable:0,heading:1,hideDescriptions:5,messageOverrides:0}}static{this.styles=$}load(){this._variableChanged()}willUpdate(e){e.has("modelId")&&(this._flowItemRenderers=[]),e.has("variable")&&this._variableChanged()}disconnectedCallback(){super.disconnectedCallback(),this._flowObserver?.disconnect()}_variableChanged(){if(!this.variable||r(this.variable)){this._rootPresentation="profile";return}this._rootPresentation=this.variable.type==="featureSet"?"featureSetRoot":"collectionRoot"}addPanelRenderer(e){this._flowItemRenderers=[...this._flowItemRenderers,e]}removeLastPanelRenderer(){this._flowItemRenderers=this._flowItemRenderers.slice(0,-1)}_isRootPresentation(e){return this._rootPresentation===e}flowFocusHandler(e){if(!e){this._flowObserver?.disconnect(),this._flowObserver=void 0;return}this._flowObserver||(this._flowObserver=new MutationObserver(()=>{p(u(e.querySelector("calcite-flow-item:last-child")??e,"calcite-input"))}),this._flowObserver.observe(e,{attributes:!0,attributeFilter:["id"],childList:!0}))}_updateFilterValue(e){this._filterValue=e.currentTarget.value}_emitClose(){this.arcgisInternalClosePanel.emit()}_backToTop(){this._flowItemRenderers=[]}_emitItemSelected(e,t){if(t.nonInteractive)return;let s=e;(!s.key||s.key==="Enter")&&(e.preventDefault(),this.arcgisInternalItemSelected.emit(t.snippet))}_showCollectionPanel(e,t){e.stopPropagation(),this.addPanelRenderer(s=>this.renderCollectionBasedVariable(t,!1,s))}_getHeadingForCollection(e,t=!1){if(!e)return"";if(t){if(this.heading)return this.heading;if(r(this.variable))return this.variable.definition?.label??this.messages.profilevariables??"Profile variables";if(this._isRootPresentation("featureSetRoot"))return this.messages.fields??"Fields";if(this._isRootPresentation("collectionRoot"))return this.messages.tables??"Tables"}return(n(e)||w(e))&&(this._isRootPresentation("featureSetRoot")||this._isRootPresentation("collectionRoot"))?this.messages.fields??"Fields":this.messages.profilevariables??"Profile variables"}_getDescriptionForCollection(e){return e?n(e)&&this._isRootPresentation("featureSetRoot")?e.variables[0]?.getLabel()??"":v(e)&&this._isRootPresentation("collectionRoot")?e.datastoreInfo?.name??e.getDescription()??"":e.breadcrumb:""}_getItemLabel(e){return e.getLabel()}_getItemDescription(e){return this.hideDescriptions?"":e.getDescription()}renderCollectionBasedVariable(e,t=!1,s=!1){if(!e)return null;let a=this.loading;return!a&&!e.loaded&&(e.loadSource().then(()=>setTimeout(()=>{this._mutationCounter+=1})).catch(()=>{h("error",this,"Error loading collection"),a=!1}),a=!0),i`<calcite-flow-item heading-level=2 .heading=${this._getHeadingForCollection(e,t)} .description=${this._getDescriptionForCollection(e)} .beforeBack=${this._beforeBack} closable @calciteFlowItemClose=${this._emitClose} .selected=${s}><calcite-action slot=header-actions-end .text=${this.messages.backtotop??""} scale=m .hidden=${t||this._isRootPresentation("featureSetRoot")} icon=chevrons-left icon-flip-rtl @click=${this._backToTop}></calcite-action><div class="container"><calcite-input .value=${this._filterValue} icon=magnifying-glass clearable @calciteInputInput=${this._updateFilterValue} class="sticky" scale=m .label=${this.messages.filterthevariablesbyname??""} name=variable-filter></calcite-input><div class="scrollable">${a?i`<calcite-loader scale=s type=indeterminate .label=${this.messages.loading??""}></calcite-loader>`:i`<calcite-list .label=${this.messages.profilevariables??"Profile variables"}>${this.renderEditorVariables(e)}</calcite-list>`}</div></div></calcite-flow-item>`}renderEditorVariables(e){let t=m(this._filterValue),s=e.variables.filter(a=>a.passFilter(t));return s.length?s.map(a=>this.renderEditorVariable(a)):i`<div class="notice-container">${this.messages.noitems}</div>`}renderEditorVariable(e){return e.type==="group"?this._isRootPresentation("featureSetRoot")&&e.isHeader?i`<calcite-list-item-group .heading=${this._getItemLabel(e)}></calcite-list-item-group>`:this._isRootPresentation("featureSetRoot")&&e._label?.code==="fields"?this.renderEditorVariables(e):i`<calcite-list-item-group .heading=${this._getItemLabel(e)}>${this.renderEditorVariables(e)}</calcite-list-item-group>`:i`<calcite-list-item .label=${this._getItemLabel(e)} .description=${this._getItemDescription(e)} @calciteListItemSelect=${t=>this._emitItemSelected(t,e)} @keydown=${t=>this._emitItemSelected(t,e)}>${e.isCollection?i`<calcite-action slot=actions-end .text=${this.messages.expand??""} scale=s icon=chevron-right icon-flip-rtl @click=${t=>this._showCollectionPanel(t,e)} @keydown=${R}></calcite-action>`:null}${e.icon?i`<calcite-icon .icon=${e.icon} scale=s slot=content-start></calcite-icon>`:null}</calcite-list-item>`}render(){return this.closed?null:this.loading&&!this.variable?i`<calcite-flow><calcite-flow-item heading-level=2 .heading=${this.heading??this.messages.profilevariables} closable @calciteFlowItemClose=${this._emitClose}><calcite-loader scale=s type=indeterminate .label=${this.messages.loading??""}></calcite-loader></calcite-flow-item></calcite-flow>`:!this.loading&&(!this.variable||this.variable?.loaded&&!this.variable?.variables.length)?i`<calcite-flow><calcite-flow-item heading-level=2 .heading=${this.heading??this.messages.profilevariables} closable @calciteFlowItemClose=${this._emitClose}><div class="notice-container">${this.messages.profileempty}</div></calcite-flow-item></calcite-flow>`:i`<calcite-flow ${f(this.flowFocusHandler)}>${this.renderCollectionBasedVariable(this.variable,!0,this._flowItemRenderers.length===0)}${this._flowItemRenderers.map((e,t,s)=>e(t===s.length-1))}</calcite-flow>`}};b("arcgis-editor-variables",c);return c},a)
@@ -1,5 +1,5 @@
1
1
  /* COPYRIGHT Esri - https://js.arcgis.com/5.2/LICENSE.txt */
2
- import{b as Se}from"./VYEWIX5W.js";import a from"./STN3LSQR.js";import{a as k,b as Fe,c as W,d as w,e as D}from"./MZMKV7FA.js";import{k as N}from"./BHSILWSL.js";import{b as M,c as E,d as $,e as De}from"./BZWB7A55.js";import{a as Ce}from"./CMRUQ3BN.js";import{M as oe,s as ae,v as A}from"./SMZ3LNZE.js";import{a as h}from"./BFPEJYVB.js";import{ll as B,ul as H}from"./DSQ2DQQL.js";export default $arcgis.t(([Ve,Ae,Ne,K,{getDeclaredVoxelMembers:Oe,getDeclaredPixelMembers:qe},Ue,Re,{A:R,B:g,F:ge,H:G,I:we,a:O,b:ne,c:le,d:pe,e:ce,k:q,l:x,m:he,o:d,p:ue,q:de,r:P,s:U,t:b,u:fe,v:_e,w:me,y:ye,z:be}])=>{var S=s=>s!==void 0,m=s=>s!==null;function Ge(s){switch(s){case"esriFieldTypeOID":return"oid";case"esriFieldTypeSmallInteger":return"small-integer";case"esriFieldTypeInteger":return"integer";case"esriFieldTypeBigInteger":return"big-integer";case"esriFieldTypeSingle":return"single";case"esriFieldTypeDouble":return"double";case"esriFieldTypeDate":return"date";case"esriFieldTypeDateOnly":return"date-only";case"esriFieldTypeTimeOnly":return"time-only";case"esriFieldTypeTimestampOffset":return"timestamp-offset";case"esriFieldTypeGUID":return"guid";case"esriFieldTypeGlobalID":return"global-id";case"esriFieldTypeString":return"string";case"esriFieldTypeGeometry":return"geometry";case"esriFieldTypeBlob":return"blob";case"esriFieldTypeRaster":return"raster";case"esriFieldTypeXML":return"xml";default:return"string"}}function ke(s){return{fields:s.fields.map(e=>({name:e.name,type:Ge(e.type),serverType:e.type,nullable:e.nullable}))}}function ve(s){return typeof s?.query=="object"&&s.query?s.query:{}}var j=class{constructor(e){this.itemId=e.itemId,this.portal=e.portal,this.serviceUrl=e.serviceUrl,this._requestOptions=e.requestOptions}fetchInfo(e){return this.portal.request(this._datastoreUrl,this._createRequestOptions(e))}async fetchDatasets(e){return(await this.portal.request(z(this._datastoreUrl,"datasets"),this._createRequestOptions(e))).datasets}async fetchTableDescription(e,t){if(!e)throw new Ue("portal:invalid-parameter",'The "tableName" parameter must be provided.');let i=await this.portal.request(z(this._datastoreUrl,"tableDescription"),{...this._createRequestOptions(t),query:{...ve(this._requestOptions),...ve(t),tableName:e}});return ke(i)}get _datastoreUrl(){return z(this.serviceUrl,"datastores",encodeURIComponent(this.itemId))}_createRequestOptions(e){return{...this._requestOptions,...e}}};function z(s,...e){let t=s.replaceAll(/\/+$/gu,""),i=e.filter(r=>!!r).map(r=>r.replaceAll(/^\/+|\/+$/gu,""));return[t,...i].join("/")}var We={id:"ansi",keywords:[],functions:[],operators:[],specialChars:{likeWildcardAny:"%",likeWildcardOne:"_",identifierQuote:{start:'"',end:'"'},escapeKey:{start:null,end:null},escapeClause:{keyword:"ESCAPE",suffix:null}}},Ie=new Map,Be={ansi:async()=>await Promise.resolve(We),bigquery:async()=>(await import("./XG3S7JQW.js")).bigqueryDialect,postgres:async()=>(await import("./U2T7AGOO.js")).postgresDialect,sqlServer:async()=>(await import("./UZD32YRD.js")).sqlServerDialect,oracle:async()=>(await import("./TUQPDQ74.js")).oracleDialect};async function He(s){let e=Ie.get(s);if(e)return await e;let t=Be[s]();return Ie.set(s,t),await t}var ze=["WITH","SELECT","FROM","WHERE","GROUP","BY","HAVING","ORDER","OFFSET","FETCH","FIRST","NEXT","ROW","ROWS","ONLY","LIMIT","DISTINCT","AS","JOIN","LEFT","RIGHT","FULL","INNER","OUTER","CROSS","ON","USING","AND","OR","NOT","IN","IS","LIKE","ESCAPE","BETWEEN","NULL","TRUE","FALSE","DATE","TIMESTAMP","CASE","WHEN","THEN","ELSE","END","ASC","DESC"],Ke=["<=",">=","<>","!=","=","<",">","+","-","*","/","%","||"],je=(s,e={})=>{let t=new Set(e.baseKeywords??ze);for(let r of s.keywords)t.add(r.toUpperCase());let i=new Set(e.baseOperators??Ke);for(let r of s.operators)i.add(r);return{keywords:Array.from(t),functions:s.functions,operators:Array.from(i),specialChars:s.specialChars}},u={sqlServer:"sql-layer-sql-server",postgres:"sql-layer-postgres",bigquery:"sql-layer-bigquery",oracle:"sql-layer-oracle"},Te=u.postgres,Qe={[u.sqlServer]:"sqlServer",[u.postgres]:"postgres",[u.bigquery]:"bigquery",[u.oracle]:"oracle"};function Je(s){return Qe[s]}async function Xe(s){return je(await He(Je(s)))}var Ye=/^[A-Za-z_][A-Za-z0-9_$]*$/u;function Ze(s){return s==="esriDBMS_PostgreSQL"?Te:s==="esriDBMS_SQLServer"?u.sqlServer:s==="esriDBMS_BigQuery"?u.bigquery:s==="esriDBMS_Oracle"?u.oracle:Te}function At(s){return s.trim().toLowerCase()}function et(s){return s.specialChars.identifierQuote}function tt(s,e){let t=s.trim();return t?Ye.test(t)?e.keywords.includes(t.toUpperCase()):!0:!1}function $e(s,e){let t=s.trim();if(!t||!tt(t,e))return t;let i=et(e),r=t.replaceAll(i.end,`${i.end}${i.end}`);return`${i.start}${r}${i.end}`}function it(s,e){return s.split(".").map(t=>$e(t,e)).join(".")}function Nt(s){return s.split(".").at(-1)??s}function rt(s){return Xe(Ze(s))}async function st(s,e){let t=new K({url:`${s.url}/${e.relatedTableId}`});return await t.load(),t}function ie(s){return(e,t)=>{if(e.type==="oid")return-1;if(t.type==="oid")return 1;if(b(s)){if(e.name===s.subtypeField)return-1;if(t.name===s.subtypeField)return 1}if(P(s)){if(e.name===s.typeIdField)return-1;if(t.name===s.typeIdField)return 1}return e.name.localeCompare(t.name,"en",{sensitivity:"base"})}}function xe(s,e){return s?.every(t=>t.domains?.[e.name]?.type==="inherited")??!1}var at=/^[a-z_$][a-z0-9_$]*$/giu;function re(s,e=!0){return s.match(at)?`${e?".":""}${s}`:`["${s}"]`}function Le(s,e){return s?`${s}${re(e)}`:e}function Pe(s){return _e(s)?s.portalItem:null}function ot(s,e){return e?s?.nullable??"nullable":s?.notnull??"not nullable"}function Ot(s,e,t){let{includeAliases:i=!1,supportGeometryFields:r=!1}=t??{},a=e,n=[],_=[];return w(s,{supportGeometry:r}).forEach(o=>{a&&(a+=`
2
+ import{b as Se}from"./SKBHZ7VS.js";import a from"./STN3LSQR.js";import{a as k,b as Fe,c as W,d as w,e as D}from"./MZMKV7FA.js";import{k as N}from"./BHSILWSL.js";import{b as M,c as E,d as $,e as De}from"./BZWB7A55.js";import{a as Ce}from"./CMRUQ3BN.js";import{M as oe,s as ae,v as A}from"./A77A54OM.js";import{a as h}from"./BFPEJYVB.js";import{ll as B,ul as H}from"./DSQ2DQQL.js";export default $arcgis.t(([Ve,Ae,Ne,K,{getDeclaredVoxelMembers:Oe,getDeclaredPixelMembers:qe},Ue,Re,{A:R,B:g,F:ge,H:G,I:we,a:O,b:ne,c:le,d:pe,e:ce,k:q,l:x,m:he,o:d,p:ue,q:de,r:P,s:U,t:b,u:fe,v:_e,w:me,y:ye,z:be}])=>{var S=s=>s!==void 0,m=s=>s!==null;function Ge(s){switch(s){case"esriFieldTypeOID":return"oid";case"esriFieldTypeSmallInteger":return"small-integer";case"esriFieldTypeInteger":return"integer";case"esriFieldTypeBigInteger":return"big-integer";case"esriFieldTypeSingle":return"single";case"esriFieldTypeDouble":return"double";case"esriFieldTypeDate":return"date";case"esriFieldTypeDateOnly":return"date-only";case"esriFieldTypeTimeOnly":return"time-only";case"esriFieldTypeTimestampOffset":return"timestamp-offset";case"esriFieldTypeGUID":return"guid";case"esriFieldTypeGlobalID":return"global-id";case"esriFieldTypeString":return"string";case"esriFieldTypeGeometry":return"geometry";case"esriFieldTypeBlob":return"blob";case"esriFieldTypeRaster":return"raster";case"esriFieldTypeXML":return"xml";default:return"string"}}function ke(s){return{fields:s.fields.map(e=>({name:e.name,type:Ge(e.type),serverType:e.type,nullable:e.nullable}))}}function ve(s){return typeof s?.query=="object"&&s.query?s.query:{}}var j=class{constructor(e){this.itemId=e.itemId,this.portal=e.portal,this.serviceUrl=e.serviceUrl,this._requestOptions=e.requestOptions}fetchInfo(e){return this.portal.request(this._datastoreUrl,this._createRequestOptions(e))}async fetchDatasets(e){return(await this.portal.request(z(this._datastoreUrl,"datasets"),this._createRequestOptions(e))).datasets}async fetchTableDescription(e,t){if(!e)throw new Ue("portal:invalid-parameter",'The "tableName" parameter must be provided.');let i=await this.portal.request(z(this._datastoreUrl,"tableDescription"),{...this._createRequestOptions(t),query:{...ve(this._requestOptions),...ve(t),tableName:e}});return ke(i)}get _datastoreUrl(){return z(this.serviceUrl,"datastores",encodeURIComponent(this.itemId))}_createRequestOptions(e){return{...this._requestOptions,...e}}};function z(s,...e){let t=s.replaceAll(/\/+$/gu,""),i=e.filter(r=>!!r).map(r=>r.replaceAll(/^\/+|\/+$/gu,""));return[t,...i].join("/")}var We={id:"ansi",keywords:[],functions:[],operators:[],specialChars:{likeWildcardAny:"%",likeWildcardOne:"_",identifierQuote:{start:'"',end:'"'},escapeKey:{start:null,end:null},escapeClause:{keyword:"ESCAPE",suffix:null}}},Ie=new Map,Be={ansi:async()=>await Promise.resolve(We),bigquery:async()=>(await import("./XG3S7JQW.js")).bigqueryDialect,postgres:async()=>(await import("./U2T7AGOO.js")).postgresDialect,sqlServer:async()=>(await import("./UZD32YRD.js")).sqlServerDialect,oracle:async()=>(await import("./TUQPDQ74.js")).oracleDialect};async function He(s){let e=Ie.get(s);if(e)return await e;let t=Be[s]();return Ie.set(s,t),await t}var ze=["WITH","SELECT","FROM","WHERE","GROUP","BY","HAVING","ORDER","OFFSET","FETCH","FIRST","NEXT","ROW","ROWS","ONLY","LIMIT","DISTINCT","AS","JOIN","LEFT","RIGHT","FULL","INNER","OUTER","CROSS","ON","USING","AND","OR","NOT","IN","IS","LIKE","ESCAPE","BETWEEN","NULL","TRUE","FALSE","DATE","TIMESTAMP","CASE","WHEN","THEN","ELSE","END","ASC","DESC"],Ke=["<=",">=","<>","!=","=","<",">","+","-","*","/","%","||"],je=(s,e={})=>{let t=new Set(e.baseKeywords??ze);for(let r of s.keywords)t.add(r.toUpperCase());let i=new Set(e.baseOperators??Ke);for(let r of s.operators)i.add(r);return{keywords:Array.from(t),functions:s.functions,operators:Array.from(i),specialChars:s.specialChars}},u={sqlServer:"sql-layer-sql-server",postgres:"sql-layer-postgres",bigquery:"sql-layer-bigquery",oracle:"sql-layer-oracle"},Te=u.postgres,Qe={[u.sqlServer]:"sqlServer",[u.postgres]:"postgres",[u.bigquery]:"bigquery",[u.oracle]:"oracle"};function Je(s){return Qe[s]}async function Xe(s){return je(await He(Je(s)))}var Ye=/^[A-Za-z_][A-Za-z0-9_$]*$/u;function Ze(s){return s==="esriDBMS_PostgreSQL"?Te:s==="esriDBMS_SQLServer"?u.sqlServer:s==="esriDBMS_BigQuery"?u.bigquery:s==="esriDBMS_Oracle"?u.oracle:Te}function At(s){return s.trim().toLowerCase()}function et(s){return s.specialChars.identifierQuote}function tt(s,e){let t=s.trim();return t?Ye.test(t)?e.keywords.includes(t.toUpperCase()):!0:!1}function $e(s,e){let t=s.trim();if(!t||!tt(t,e))return t;let i=et(e),r=t.replaceAll(i.end,`${i.end}${i.end}`);return`${i.start}${r}${i.end}`}function it(s,e){return s.split(".").map(t=>$e(t,e)).join(".")}function Nt(s){return s.split(".").at(-1)??s}function rt(s){return Xe(Ze(s))}async function st(s,e){let t=new K({url:`${s.url}/${e.relatedTableId}`});return await t.load(),t}function ie(s){return(e,t)=>{if(e.type==="oid")return-1;if(t.type==="oid")return 1;if(b(s)){if(e.name===s.subtypeField)return-1;if(t.name===s.subtypeField)return 1}if(P(s)){if(e.name===s.typeIdField)return-1;if(t.name===s.typeIdField)return 1}return e.name.localeCompare(t.name,"en",{sensitivity:"base"})}}function xe(s,e){return s?.every(t=>t.domains?.[e.name]?.type==="inherited")??!1}var at=/^[a-z_$][a-z0-9_$]*$/giu;function re(s,e=!0){return s.match(at)?`${e?".":""}${s}`:`["${s}"]`}function Le(s,e){return s?`${s}${re(e)}`:e}function Pe(s){return _e(s)?s.portalItem:null}function ot(s,e){return e?s?.nullable??"nullable":s?.notnull??"not nullable"}function Ot(s,e,t){let{includeAliases:i=!1,supportGeometryFields:r=!1}=t??{},a=e,n=[],_=[];return w(s,{supportGeometry:r}).forEach(o=>{a&&(a+=`
3
3
 
4
4
  `),a+=`**${o.name}** (${o.alias})
5
5
  ${o.type}`,o.description&&(a+=`
@@ -1,2 +1,2 @@
1
1
  /* COPYRIGHT Esri - https://js.arcgis.com/5.2/LICENSE.txt */
2
- import a from"./KUL43ADE.js";import{a as I}from"./XEK22IDA.js";import{a as h}from"./CMRUQ3BN.js";import{b as l}from"./BFPEJYVB.js";import{ll as T,xl as u}from"./DSQ2DQQL.js";export default $arcgis.t(([{a:g,b:f}])=>{var m=Promise.withResolvers(),p=class{constructor(e){this._defaults=e,this._worker=null,this._client=null,this._configChangeListener=this._defaults.onDidChange(()=>this.stopWorker())}dispose(){this._configChangeListener.dispose(),this.stopWorker()}stopWorker(){this._worker&&(this._worker.dispose(),this._worker=null,m=Promise.withResolvers()),this._client=null}static async waitForWorker(){return await m.promise}async _getClientProxy(){let e=await h();if(!this._client){let{languageId:t}=this._defaults,o=window.MonacoEnvironment?.getWorker;if(!o)throw new Error("MonacoEnvironment.getWorker is not configured. Call setupMonacoEnvironment(...) before creating SQL Expression workers.");this._worker=e.createWebWorker({worker:o("SqlExprWorker",t),host:this._defaults.workerHost}),m.resolve(this._worker),this._client=this._worker.getProxy()}return await this._client}async getLanguageServiceWorker(...e){let t=await this._getClientProxy();return await this._worker?.withSyncedResources(e),t}},L=["AND","AS","BOTH","CASE","CAST","CURRENT_DATE","CURRENT_TIME","CURRENT_TIMESTAMP","DATE","DAY","DOY","DOW","ELSE","END","ESCAPE","FALSE","FLOAT","FOR","FROM","HOUR","IN","INT","INTEGER","INTERVAL","LEADING","LIKE","MINUTE","MONTH","POSITION","REAL","SECOND","SMALLINT","THEN","TIME","TIMESTAMP","TIMEZONE_HOUR","TIMEZONE_MINUTE","TO","TRAILING","TRIM","TRUE","VARCHAR","WEEK","WHEN","WITH","YEAR","ZONE"],M=["AND","BETWEEN","LIKE","NOT","OR","IS","NULL"],b=["CAST","EXTRACT","CURRENT_DATE","CURRENT_TIME","CURRENT_TIMESTAMP","CURRENT_USER","ABS","ACOS","ASIN","ATAN","CEILING","COS","FLOOR","LOG","LOG10","MOD","NULLIF","POWER","ROUND","SIGN","SIN","TAN","TRUNCATE","CHAR_LENGTH","COALESCE","CONCAT","LOWER","POSITION","SUBSTRING","TRIM","UPPER"],O={comments:{lineComment:"--",blockComment:["/*","*/"]},brackets:[["{","}"],["[","]"],["(",")"]],autoClosingPairs:[{open:"{",close:"}"},{open:"[",close:"]"},{open:"(",close:")"},{open:'"',close:'"'},{open:"'",close:"'"}],surroundingPairs:[{open:"{",close:"}"},{open:"[",close:"]"},{open:"(",close:")"},{open:'"',close:'"'},{open:"'",close:"'"}]},D={defaultToken:"",tokenPostfix:".arcgis",ignoreCase:!0,brackets:[{open:"[",close:"]",token:"delimiter.square"},{open:"(",close:")",token:"delimiter.parenthesis"}],keywords:L,operators:M,builtinFunctions:b,builtinVariables:[],tokenizer:{root:[{include:"@comments"},{include:"@whitespace"},{include:"@numbers"},{include:"@strings"},{include:"@complexIdentifiers"},{include:"@scopes"},[/[;,.]/,"delimiter"],[/[()]/,"@brackets"],[/[\w@#$]+/,{cases:{"@operators":"operator","@builtinVariables":"predefined","@builtinFunctions":"predefined","@keywords":"keyword","@default":"identifier"}}],[/[<>=!%&+\-*/|~^]/,"operator"]],whitespace:[[/\s+/,"white"]],comments:[[/--+.*/,"comment"],[/\/\*/,{token:"comment.quote",next:"@comment"}]],comment:[[/[^*/]+/,"comment"],[/\*\//,{token:"comment.quote",next:"@pop"}],[/./,"comment"]],numbers:[[/0[xX][0-9a-fA-F]*/,"number"],[/[$][+-]*\d*(\.\d*)?/,"number"],[/((\d+(\.\d*)?)|(\.\d+))([eE][\-+]?\d+)?/,"number"]],strings:[[/N'/,{token:"string",next:"@string"}],[/'/,{token:"string",next:"@string"}]],string:[[/[^']+/,"string"],[/''/,"string"],[/'/,{token:"string",next:"@pop"}]],complexIdentifiers:[[/"/,{token:"identifier.quote",next:"@quotedIdentifier"}]],quotedIdentifier:[[/[^"]+/,"identifier"],[/""/,"identifier"],[/"/,{token:"identifier.quote",next:"@pop"}]],scopes:[[/(BEGIN|CASE)\b/i,{token:"keyword.block"}],[/END\b/i,{token:"keyword.block"}],[/WHEN\b/i,{token:"keyword.choice"}],[/THEN\b/i,{token:"keyword.choice"}]]}},_=class{constructor(e,t){this._worker=e,this._defaults=t}async provideCompletionItems(e,t){try{let o=await this._worker(e.uri),r=e.getWordUntilPosition(t),n={startLineNumber:t.lineNumber,endLineNumber:t.lineNumber,startColumn:r.startColumn,endColumn:r.endColumn},c=this._defaults.getApiContextForModel(e.uri);return await o.doComplete(e.uri.toString(),n,t,c)}catch(o){return l("SqlExprCompletionProvider")(o),{suggestions:[]}}}},k=class{constructor(e,t,{defaults:o,diagnosticService:r}){this._languageId=e,this._worker=t,this._disposables=[],this._modelListeners=new Map,this._diagnosticsService=r,this._defaults=o,h().then(n=>{let c=i=>{let s=i.getLanguageId();if(s!==this._languageId)return;let d=I(()=>{this._doValidate(i,s).catch(R=>{throw R})}),S=i.onDidChangeContent(d),A=i.onDidChangeAttached(d);this._modelListeners.set(i.uri.toString(),[S,A]),this._doValidate(i,s).catch(l("SqlExprDiagnosticsAdapter"))},E=i=>{let s=i.uri.toString();n.setModelMarkers(i,this._languageId,[]);let d=this._modelListeners.get(s);if(d){for(;d.length;)d.pop()?.dispose();this._modelListeners.delete(s)}};this._disposables.push(n.onDidCreateModel(c)),this._disposables.push(n.onWillDisposeModel(i=>E(i))),this._disposables.push(n.onDidChangeModelLanguage(i=>{E(i.model),c(i.model)})),this._disposables.push(o.onDidChange(()=>{n.getModels().forEach(i=>{i.getLanguageId()===this._languageId&&(E(i),c(i))})})),this._disposables.push(o.onModelContextDidChange(i=>{n.getModels().forEach(s=>{s.getLanguageId()===this._languageId&&s.uri.toString()===i&&this._doValidate(s,this._languageId).catch(l("SqlExprDiagnosticsAdapter"))})})),this._disposables.push({dispose:()=>{this._modelListeners.forEach(i=>i.forEach(s=>s.dispose())),this._modelListeners.clear()}}),n.getModels().forEach(c)})}async _doValidate(e,t){let o=await h();if(e.isAttachedToEditor())try{let r=await this._worker(e.uri),n=this._defaults.getApiContextForModel(e.uri),c=await r.doValidation(e.uri.toString(),n);this._diagnosticsService.fireDiagnosticsChange(e.uri,c),o.setModelMarkers(e,t,c)}catch(r){l("SqlExprDiagnosticsAdapter")(r)}}},w;async function Z(...a){return await p.waitForWorker(),await new Promise((e,t)=>{if(!w){t(new Error("sql expression worker not registered!"));return}e(w(...a))})}var C=class{constructor(){this._onDiagnosticsChange=new T}get onDiagnosticsChange(){return this._onDiagnosticsChange.event}fireDiagnosticsChange(e,t){this._onDiagnosticsChange.fire({uri:e,diagnostics:t})}},N=new C;async function K(){return await f(),N}function X(a){let e=new p(a),t=async(...r)=>await e.getLanguageServiceWorker(...r);w=t,u.setMonarchTokensProvider(g.languageId,D),u.setLanguageConfiguration(g.languageId,O);let o=new _(t,g);u.registerCompletionItemProvider(g.languageId,o),new k(a.languageId,t,{defaults:a,diagnosticService:N})}return{a:Z,b:K,c:X}},a)
2
+ import a from"./56P6FTYQ.js";import{a as I}from"./XEK22IDA.js";import{a as h}from"./CMRUQ3BN.js";import{b as l}from"./BFPEJYVB.js";import{ll as T,xl as u}from"./DSQ2DQQL.js";export default $arcgis.t(([{a:g,b:f}])=>{var m=Promise.withResolvers(),p=class{constructor(e){this._defaults=e,this._worker=null,this._client=null,this._configChangeListener=this._defaults.onDidChange(()=>this.stopWorker())}dispose(){this._configChangeListener.dispose(),this.stopWorker()}stopWorker(){this._worker&&(this._worker.dispose(),this._worker=null,m=Promise.withResolvers()),this._client=null}static async waitForWorker(){return await m.promise}async _getClientProxy(){let e=await h();if(!this._client){let{languageId:t}=this._defaults,o=window.MonacoEnvironment?.getWorker;if(!o)throw new Error("MonacoEnvironment.getWorker is not configured. Call setupMonacoEnvironment(...) before creating SQL Expression workers.");this._worker=e.createWebWorker({worker:o("SqlExprWorker",t),host:this._defaults.workerHost}),m.resolve(this._worker),this._client=this._worker.getProxy()}return await this._client}async getLanguageServiceWorker(...e){let t=await this._getClientProxy();return await this._worker?.withSyncedResources(e),t}},L=["AND","AS","BOTH","CASE","CAST","CURRENT_DATE","CURRENT_TIME","CURRENT_TIMESTAMP","DATE","DAY","DOY","DOW","ELSE","END","ESCAPE","FALSE","FLOAT","FOR","FROM","HOUR","IN","INT","INTEGER","INTERVAL","LEADING","LIKE","MINUTE","MONTH","POSITION","REAL","SECOND","SMALLINT","THEN","TIME","TIMESTAMP","TIMEZONE_HOUR","TIMEZONE_MINUTE","TO","TRAILING","TRIM","TRUE","VARCHAR","WEEK","WHEN","WITH","YEAR","ZONE"],M=["AND","BETWEEN","LIKE","NOT","OR","IS","NULL"],b=["CAST","EXTRACT","CURRENT_DATE","CURRENT_TIME","CURRENT_TIMESTAMP","CURRENT_USER","ABS","ACOS","ASIN","ATAN","CEILING","COS","FLOOR","LOG","LOG10","MOD","NULLIF","POWER","ROUND","SIGN","SIN","TAN","TRUNCATE","CHAR_LENGTH","COALESCE","CONCAT","LOWER","POSITION","SUBSTRING","TRIM","UPPER"],O={comments:{lineComment:"--",blockComment:["/*","*/"]},brackets:[["{","}"],["[","]"],["(",")"]],autoClosingPairs:[{open:"{",close:"}"},{open:"[",close:"]"},{open:"(",close:")"},{open:'"',close:'"'},{open:"'",close:"'"}],surroundingPairs:[{open:"{",close:"}"},{open:"[",close:"]"},{open:"(",close:")"},{open:'"',close:'"'},{open:"'",close:"'"}]},D={defaultToken:"",tokenPostfix:".arcgis",ignoreCase:!0,brackets:[{open:"[",close:"]",token:"delimiter.square"},{open:"(",close:")",token:"delimiter.parenthesis"}],keywords:L,operators:M,builtinFunctions:b,builtinVariables:[],tokenizer:{root:[{include:"@comments"},{include:"@whitespace"},{include:"@numbers"},{include:"@strings"},{include:"@complexIdentifiers"},{include:"@scopes"},[/[;,.]/,"delimiter"],[/[()]/,"@brackets"],[/[\w@#$]+/,{cases:{"@operators":"operator","@builtinVariables":"predefined","@builtinFunctions":"predefined","@keywords":"keyword","@default":"identifier"}}],[/[<>=!%&+\-*/|~^]/,"operator"]],whitespace:[[/\s+/,"white"]],comments:[[/--+.*/,"comment"],[/\/\*/,{token:"comment.quote",next:"@comment"}]],comment:[[/[^*/]+/,"comment"],[/\*\//,{token:"comment.quote",next:"@pop"}],[/./,"comment"]],numbers:[[/0[xX][0-9a-fA-F]*/,"number"],[/[$][+-]*\d*(\.\d*)?/,"number"],[/((\d+(\.\d*)?)|(\.\d+))([eE][\-+]?\d+)?/,"number"]],strings:[[/N'/,{token:"string",next:"@string"}],[/'/,{token:"string",next:"@string"}]],string:[[/[^']+/,"string"],[/''/,"string"],[/'/,{token:"string",next:"@pop"}]],complexIdentifiers:[[/"/,{token:"identifier.quote",next:"@quotedIdentifier"}]],quotedIdentifier:[[/[^"]+/,"identifier"],[/""/,"identifier"],[/"/,{token:"identifier.quote",next:"@pop"}]],scopes:[[/(BEGIN|CASE)\b/i,{token:"keyword.block"}],[/END\b/i,{token:"keyword.block"}],[/WHEN\b/i,{token:"keyword.choice"}],[/THEN\b/i,{token:"keyword.choice"}]]}},_=class{constructor(e,t){this._worker=e,this._defaults=t}async provideCompletionItems(e,t){try{let o=await this._worker(e.uri),r=e.getWordUntilPosition(t),n={startLineNumber:t.lineNumber,endLineNumber:t.lineNumber,startColumn:r.startColumn,endColumn:r.endColumn},c=this._defaults.getApiContextForModel(e.uri);return await o.doComplete(e.uri.toString(),n,t,c)}catch(o){return l("SqlExprCompletionProvider")(o),{suggestions:[]}}}},k=class{constructor(e,t,{defaults:o,diagnosticService:r}){this._languageId=e,this._worker=t,this._disposables=[],this._modelListeners=new Map,this._diagnosticsService=r,this._defaults=o,h().then(n=>{let c=i=>{let s=i.getLanguageId();if(s!==this._languageId)return;let d=I(()=>{this._doValidate(i,s).catch(R=>{throw R})}),S=i.onDidChangeContent(d),A=i.onDidChangeAttached(d);this._modelListeners.set(i.uri.toString(),[S,A]),this._doValidate(i,s).catch(l("SqlExprDiagnosticsAdapter"))},E=i=>{let s=i.uri.toString();n.setModelMarkers(i,this._languageId,[]);let d=this._modelListeners.get(s);if(d){for(;d.length;)d.pop()?.dispose();this._modelListeners.delete(s)}};this._disposables.push(n.onDidCreateModel(c)),this._disposables.push(n.onWillDisposeModel(i=>E(i))),this._disposables.push(n.onDidChangeModelLanguage(i=>{E(i.model),c(i.model)})),this._disposables.push(o.onDidChange(()=>{n.getModels().forEach(i=>{i.getLanguageId()===this._languageId&&(E(i),c(i))})})),this._disposables.push(o.onModelContextDidChange(i=>{n.getModels().forEach(s=>{s.getLanguageId()===this._languageId&&s.uri.toString()===i&&this._doValidate(s,this._languageId).catch(l("SqlExprDiagnosticsAdapter"))})})),this._disposables.push({dispose:()=>{this._modelListeners.forEach(i=>i.forEach(s=>s.dispose())),this._modelListeners.clear()}}),n.getModels().forEach(c)})}async _doValidate(e,t){let o=await h();if(e.isAttachedToEditor())try{let r=await this._worker(e.uri),n=this._defaults.getApiContextForModel(e.uri),c=await r.doValidation(e.uri.toString(),n);this._diagnosticsService.fireDiagnosticsChange(e.uri,c),o.setModelMarkers(e,t,c)}catch(r){l("SqlExprDiagnosticsAdapter")(r)}}},w;async function Z(...a){return await p.waitForWorker(),await new Promise((e,t)=>{if(!w){t(new Error("sql expression worker not registered!"));return}e(w(...a))})}var C=class{constructor(){this._onDiagnosticsChange=new T}get onDiagnosticsChange(){return this._onDiagnosticsChange.event}fireDiagnosticsChange(e,t){this._onDiagnosticsChange.fire({uri:e,diagnostics:t})}},N=new C;async function K(){return await f(),N}function X(a){let e=new p(a),t=async(...r)=>await e.getLanguageServiceWorker(...r);w=t,u.setMonarchTokensProvider(g.languageId,D),u.setLanguageConfiguration(g.languageId,O);let o=new _(t,g);u.registerCompletionItemProvider(g.languageId,o),new k(a.languageId,t,{defaults:a,diagnosticService:N})}return{a:Z,b:K,c:X}},a)
@@ -1,2 +1,2 @@
1
1
  /* COPYRIGHT Esri - https://js.arcgis.com/5.2/LICENSE.txt */
2
- import{a as g}from"./J4I4EROF.js";import{F as n,G as l,H as b,L as p,h as u,j as m}from"./SMZ3LNZE.js";import"./BFPEJYVB.js";import"./H6RQVSYM.js";var z=u`: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:0;align-items:center;justify-content:center;block-size:var(--calcite-size-fixed-sm-plus);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,v=100,x="results-has-content",f="is-resizing",C="--arcgis-coding-components-code-editor-results-panel-max-h",s="--internal-code-editor-results-panel-h",a="--internal-code-editor-results-panel-max-h",i="--internal-code-editor-results-panel-bottom-drawer-controls-h",c=class extends b{static{this.styles=[z]}#e=void 0;#t=!1;#a=!1;#n=n();#h=n();#l=n();#r;#u(e){this.#e===e.pointerId&&this.#o()}#v=e=>{this.#e===e.pointerId&&this.#o()};load(){this.manager.onLifecycle(()=>(this.#r=new ResizeObserver(()=>{this.#t&&this.#i()}),this.updateComplete.then(()=>this.#g()),()=>{this.#o(),this.#r?.disconnect(),this.#r=void 0}))}#x(){this.#t&&this.#i(),this.#g()}#f(e){e.button!==0||!this.#t||(e.preventDefault(),e.currentTarget instanceof HTMLElement&&(e.currentTarget.focus(),e.currentTarget.setPointerCapture(e.pointerId)),this.#e=e.pointerId,this.#a=!0,this.elementInternals.states.add(f),this.#m(e))}#y(e){if(!this.#t)return;this.#i();let t=this.#k(e);t!=null&&(e.preventDefault(),e.stopPropagation(),this.#a=!0,this.#c(t))}#w(e){if(!e.target)return;let t=g(e);if(this.#t=t,t){this.elementInternals.states.add(x),this.#i();return}this.#o(),this.#a||this.#$(),this.elementInternals.states.delete(x)}#o(){let e=this.#e;if(!e)return;this.#e=void 0;let t=this.#h.value;t?.hasPointerCapture(e)&&t.releasePointerCapture(e),this.elementInternals.states.delete(f)}#m(e){if(this.#e!==e.pointerId)return;let t=this.#s(),r=this.el.getBoundingClientRect().bottom-e.clientY-t;this.#c(r,t)}#z(){let e=Number.parseFloat(this.el.style.getPropertyValue(s));if(Number.isFinite(e))return e;let t=Number.parseFloat(getComputedStyle(this.#n.value??this.el).height);return Number.isFinite(t)?Math.max(0,t-this.#s()):v}#b(){return this.el.querySelector(':scope > [slot="bottom-action-bar"]')}#s(){let e=this.#b()?.getBoundingClientRect().height??0,t=this.#l.value?.getBoundingClientRect().height??0;return e+t}#p(){return getComputedStyle(this.el).getPropertyValue(C).trim()||null}#d(e,t){t?this.el.style.setProperty(e,t):this.el.style.removeProperty(e)}#P(e){let t=this.#p();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.#n.value;if(!o)return null;let d=this.el.style.getPropertyValue(i),y=this.el.style.getPropertyValue(s),w=this.el.style.getPropertyValue(a);this.el.style.setProperty(i,`${e}px`),this.el.style.setProperty(s,`${this.el.getBoundingClientRect().height}px`),this.el.style.setProperty(a,t);let h=Number.parseFloat(getComputedStyle(o).height);return this.#d(i,d),this.#d(s,y),this.#d(a,w),Number.isFinite(h)?Math.max(0,h-e):null}#g(){let e=this.#r;if(!e)return;e.disconnect(),e.observe(this.el);let t=this.#l.value;t&&e.observe(t);let r=this.#b();r&&e.observe(r)}#k(e){let t=e.shiftKey?k:P,r=this.#z();switch(e.key){case"ArrowUp":return r+t;case"ArrowDown":return r-t;default:return}}#C(e,t){let r=Math.max(0,this.el.getBoundingClientRect().height-t),o=this.#P(t),d=o==null?r:Math.min(r,o);return Math.min(Math.max(e,v),d)}#c(e,t=this.#s()){let r=this.#C(e,t),o=this.#p();this.el.style.setProperty(i,`${t}px`),this.el.style.setProperty(s,`${r}px`),this.el.style.setProperty(a,o??`calc(100% - ${t}px)`)}#$(){this.el.style.removeProperty(i),this.el.style.removeProperty(s),this.el.style.removeProperty(a)}#i(){let e=this.#s(),t=Number.parseFloat(this.el.style.getPropertyValue(s));return Number.isFinite(t)?this.#c(t,e):this.el.style.setProperty(i,`${e}px`),e}render(){return m`<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" ${l(this.#n)}><div aria-label="Resize results panel" aria-orientation=horizontal class="bottom-drawer-resize-handle" role=separator tabindex=0 @pointercancel=${this.#u} @pointerdown=${this.#f} @pointermove=${this.#m} @pointerup=${this.#u} @lostpointercapture=${this.#v} @keydown=${this.#y} ${l(this.#h)}><div class="bottom-drawer-resize-handle-bar" ${l(this.#l)}><calcite-icon icon=drag-resize-vertical scale=s></calcite-icon></div></div><slot name=bottom-action-bar @slotchange=${this.#x}></slot><slot name=results-panel @slotchange=${this.#w}></slot></div></div><slot name=side-panel></slot><slot name=side-action-bar></slot></div>`}};p("arcgis-code-editor-shell",c);export{c as CodeEditorShell};
2
+ import{a as g}from"./J4I4EROF.js";import{F as n,G as l,H as b,L as p,h as u,j as m}from"./A77A54OM.js";import"./BFPEJYVB.js";import"./H6RQVSYM.js";var z=u`: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:0;align-items:center;justify-content:center;block-size:var(--calcite-size-fixed-sm-plus);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,v=100,x="results-has-content",f="is-resizing",C="--arcgis-coding-components-code-editor-results-panel-max-h",s="--internal-code-editor-results-panel-h",a="--internal-code-editor-results-panel-max-h",i="--internal-code-editor-results-panel-bottom-drawer-controls-h",c=class extends b{static{this.styles=[z]}#e=void 0;#t=!1;#a=!1;#n=n();#h=n();#l=n();#r;#u(e){this.#e===e.pointerId&&this.#o()}#v=e=>{this.#e===e.pointerId&&this.#o()};load(){this.manager.onLifecycle(()=>(this.#r=new ResizeObserver(()=>{this.#t&&this.#i()}),this.updateComplete.then(()=>this.#g()),()=>{this.#o(),this.#r?.disconnect(),this.#r=void 0}))}#x(){this.#t&&this.#i(),this.#g()}#f(e){e.button!==0||!this.#t||(e.preventDefault(),e.currentTarget instanceof HTMLElement&&(e.currentTarget.focus(),e.currentTarget.setPointerCapture(e.pointerId)),this.#e=e.pointerId,this.#a=!0,this.elementInternals.states.add(f),this.#m(e))}#y(e){if(!this.#t)return;this.#i();let t=this.#k(e);t!=null&&(e.preventDefault(),e.stopPropagation(),this.#a=!0,this.#c(t))}#w(e){if(!e.target)return;let t=g(e);if(this.#t=t,t){this.elementInternals.states.add(x),this.#i();return}this.#o(),this.#a||this.#$(),this.elementInternals.states.delete(x)}#o(){let e=this.#e;if(!e)return;this.#e=void 0;let t=this.#h.value;t?.hasPointerCapture(e)&&t.releasePointerCapture(e),this.elementInternals.states.delete(f)}#m(e){if(this.#e!==e.pointerId)return;let t=this.#s(),r=this.el.getBoundingClientRect().bottom-e.clientY-t;this.#c(r,t)}#z(){let e=Number.parseFloat(this.el.style.getPropertyValue(s));if(Number.isFinite(e))return e;let t=Number.parseFloat(getComputedStyle(this.#n.value??this.el).height);return Number.isFinite(t)?Math.max(0,t-this.#s()):v}#b(){return this.el.querySelector(':scope > [slot="bottom-action-bar"]')}#s(){let e=this.#b()?.getBoundingClientRect().height??0,t=this.#l.value?.getBoundingClientRect().height??0;return e+t}#p(){return getComputedStyle(this.el).getPropertyValue(C).trim()||null}#d(e,t){t?this.el.style.setProperty(e,t):this.el.style.removeProperty(e)}#P(e){let t=this.#p();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.#n.value;if(!o)return null;let d=this.el.style.getPropertyValue(i),y=this.el.style.getPropertyValue(s),w=this.el.style.getPropertyValue(a);this.el.style.setProperty(i,`${e}px`),this.el.style.setProperty(s,`${this.el.getBoundingClientRect().height}px`),this.el.style.setProperty(a,t);let h=Number.parseFloat(getComputedStyle(o).height);return this.#d(i,d),this.#d(s,y),this.#d(a,w),Number.isFinite(h)?Math.max(0,h-e):null}#g(){let e=this.#r;if(!e)return;e.disconnect(),e.observe(this.el);let t=this.#l.value;t&&e.observe(t);let r=this.#b();r&&e.observe(r)}#k(e){let t=e.shiftKey?k:P,r=this.#z();switch(e.key){case"ArrowUp":return r+t;case"ArrowDown":return r-t;default:return}}#C(e,t){let r=Math.max(0,this.el.getBoundingClientRect().height-t),o=this.#P(t),d=o==null?r:Math.min(r,o);return Math.min(Math.max(e,v),d)}#c(e,t=this.#s()){let r=this.#C(e,t),o=this.#p();this.el.style.setProperty(i,`${t}px`),this.el.style.setProperty(s,`${r}px`),this.el.style.setProperty(a,o??`calc(100% - ${t}px)`)}#$(){this.el.style.removeProperty(i),this.el.style.removeProperty(s),this.el.style.removeProperty(a)}#i(){let e=this.#s(),t=Number.parseFloat(this.el.style.getPropertyValue(s));return Number.isFinite(t)?this.#c(t,e):this.el.style.setProperty(i,`${e}px`),e}render(){return m`<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" ${l(this.#n)}><div aria-label="Resize results panel" aria-orientation=horizontal class="bottom-drawer-resize-handle" role=separator tabindex=0 @pointercancel=${this.#u} @pointerdown=${this.#f} @pointermove=${this.#m} @pointerup=${this.#u} @lostpointercapture=${this.#v} @keydown=${this.#y} ${l(this.#h)}><div class="bottom-drawer-resize-handle-bar" ${l(this.#l)}><calcite-icon icon=drag-resize-vertical scale=s></calcite-icon></div></div><slot name=bottom-action-bar @slotchange=${this.#x}></slot><slot name=results-panel @slotchange=${this.#w}></slot></div></div><slot name=side-panel></slot><slot name=side-action-bar></slot></div>`}};p("arcgis-code-editor-shell",c);export{c as CodeEditorShell};
@@ -1,2 +1,2 @@
1
1
  /* COPYRIGHT Esri - https://js.arcgis.com/5.2/LICENSE.txt */
2
- import e from"./JTB3WQOI.js";import{d as S}from"./MZMKV7FA.js";import d from"./2WB7S5TQ.js";import{j as a,p as c,v as b}from"./SMZ3LNZE.js";export default $arcgis.t(([{b:u,c:g,d:m},{b:d,c:f,d:M,e:v,f:k,g:y}])=>{var l={lines:!0,selectionMode:"none",scale:"s",oncalciteTreeSelect:e=>e.currentTarget.selectedItems.forEach(t=>t.selected=!1)},$={onClick:e=>{let t=e.currentTarget;t.expanded=!t.expanded}},R=({arcadeResult:e,t9nStrings:t})=>{let s=e.value??[],n=Math.max(s.length-u,0);return a`<bdi>${`${c(e.type)}(${s.length??0})`}</bdi>${n>0?a`<span>&nbsp;${b(t.showingfirstitemsformat,{count:u.toString()})}</span>`:null}`},T=({value:e,subtree:t,t9nStrings:s})=>{let n=e.geometry?.();return a`<calcite-tree slot=${"children"} .lines=${l.lines} .selectionMode=${l.selectionMode} .scale=${l.scale} @calciteTreeSelect=${l.oncalciteTreeSelect}>${e.keys().map(r=>{let i=m(e.field(r));return e.arcadeDeclaredClass==="esri.arcade.Feature"&&i.type==="geometry"?null:p({arcadeResult:i,name:r,t9nStrings:s})})}${n?p({arcadeResult:{type:"geometry",value:n},name:"geometry",t9nStrings:s}):null}</calcite-tree>`},G=({arcadeResult:e,t9nStrings:t})=>a`<div class="value-type"><bdi>${c(e.type)}:</bdi>${e.features.length>=g?a`<span>&nbsp;${b(t.showingfirstitemsformat,{count:g.toString()})}</span>`:null}</div>`,C=({items:e,subtree:t,arrayLength:s=e.length,t9nStrings:n})=>a`<calcite-tree slot=${"children"} .lines=${l.lines} .selectionMode=${l.selectionMode} .scale=${l.scale} @calciteTreeSelect=${l.oncalciteTreeSelect}>${e.map((r,i)=>{let o=m(r);return p({arcadeResult:o,name:i,expanded:!t,t9nStrings:n})})}${p({arcadeResult:{type:"number",value:s},name:"length",isMetadata:!0,t9nStrings:n})}</calcite-tree>`,p=({arcadeResult:e,name:t,isMetadata:s=!1,expanded:n,t9nStrings:r})=>{switch(e.type){case"null":case"unknown":case"text":case"number":case"date":case"dateOnly":case"time":case"boolean":let{type:i,value:o}=y(e);return a`<calcite-tree-item><div class="tree-item-label">${d({name:t,isMetadata:s})}${v({type:i,value:o})}</div></calcite-tree-item>`;case"array":{let h=e.value??[],x=h.slice(0,u);return a`<calcite-tree-item .expanded=${n} @click=${$.onClick}><div class="tree-item-label">${d({name:t,isMetadata:s})}${R({arcadeResult:e,t9nStrings:r})}</div>${C({items:x,arrayLength:h.length,subtree:!0,t9nStrings:r})}</calcite-tree-item>`}case"geometry":return a`<calcite-tree-item .expanded=${n} @click=${$.onClick}><div class="tree-item-label">${d({name:t,isMetadata:s})}<bdi>${c(e.type)}</bdi></div>${M({value:e.value,subtree:!0})}</calcite-tree-item>`;case"attachment":return a`<calcite-tree-item .expanded=${n} @click=${$.onClick}><div class="tree-item-label">${d({name:t,isMetadata:s})}<bdi>${c(e.type)}</bdi></div>${f({obj:e.value.castAsJson(),subtree:!0})}</calcite-tree-item>`;case"feature":case"dictionary":case"portal":return a`<calcite-tree-item .expanded=${n} @click=${$.onClick}><div class="tree-item-label">${d({name:t,isMetadata:s})}<bdi>${c(e.type)}</bdi></div>${T({value:e.value,subtree:!0,t9nStrings:r})}</calcite-tree-item>`;default:return null}},I=({arcadeResult:e})=>{let t=S(e.value.fields);return a`<div class="table-scroll"><table><thead><tr>${t.map(s=>a`<th>${s.name}</th>`)}</tr></thead><tbody>${e.features.map(s=>a`<tr>${t.map(n=>{let r=m(s.field(n.name));if(!k(r))return a`<td></td>`;try{let{type:i,value:o}=y(r);return a`<td>${v({type:i,value:o})}</td>`}catch{return a`<td></td>`}})}</tr>`)}</tbody></table></div>`};return{a:l,b:R,c:T,d:G,e:C,f:I}},d,e)
2
+ import e from"./5MCVDNVO.js";import{d as S}from"./MZMKV7FA.js";import d from"./2WB7S5TQ.js";import{j as a,p as c,v as b}from"./A77A54OM.js";export default $arcgis.t(([{b:u,c:g,d:m},{b:d,c:f,d:M,e:v,f:k,g:y}])=>{var l={lines:!0,selectionMode:"none",scale:"s",oncalciteTreeSelect:e=>e.currentTarget.selectedItems.forEach(t=>t.selected=!1)},$={onClick:e=>{let t=e.currentTarget;t.expanded=!t.expanded}},R=({arcadeResult:e,t9nStrings:t})=>{let s=e.value??[],n=Math.max(s.length-u,0);return a`<bdi>${`${c(e.type)}(${s.length??0})`}</bdi>${n>0?a`<span>&nbsp;${b(t.showingfirstitemsformat,{count:u.toString()})}</span>`:null}`},T=({value:e,subtree:t,t9nStrings:s})=>{let n=e.geometry?.();return a`<calcite-tree slot=${"children"} .lines=${l.lines} .selectionMode=${l.selectionMode} .scale=${l.scale} @calciteTreeSelect=${l.oncalciteTreeSelect}>${e.keys().map(r=>{let i=m(e.field(r));return e.arcadeDeclaredClass==="esri.arcade.Feature"&&i.type==="geometry"?null:p({arcadeResult:i,name:r,t9nStrings:s})})}${n?p({arcadeResult:{type:"geometry",value:n},name:"geometry",t9nStrings:s}):null}</calcite-tree>`},G=({arcadeResult:e,t9nStrings:t})=>a`<div class="value-type"><bdi>${c(e.type)}:</bdi>${e.features.length>=g?a`<span>&nbsp;${b(t.showingfirstitemsformat,{count:g.toString()})}</span>`:null}</div>`,C=({items:e,subtree:t,arrayLength:s=e.length,t9nStrings:n})=>a`<calcite-tree slot=${"children"} .lines=${l.lines} .selectionMode=${l.selectionMode} .scale=${l.scale} @calciteTreeSelect=${l.oncalciteTreeSelect}>${e.map((r,i)=>{let o=m(r);return p({arcadeResult:o,name:i,expanded:!t,t9nStrings:n})})}${p({arcadeResult:{type:"number",value:s},name:"length",isMetadata:!0,t9nStrings:n})}</calcite-tree>`,p=({arcadeResult:e,name:t,isMetadata:s=!1,expanded:n,t9nStrings:r})=>{switch(e.type){case"null":case"unknown":case"text":case"number":case"date":case"dateOnly":case"time":case"boolean":let{type:i,value:o}=y(e);return a`<calcite-tree-item><div class="tree-item-label">${d({name:t,isMetadata:s})}${v({type:i,value:o})}</div></calcite-tree-item>`;case"array":{let h=e.value??[],x=h.slice(0,u);return a`<calcite-tree-item .expanded=${n} @click=${$.onClick}><div class="tree-item-label">${d({name:t,isMetadata:s})}${R({arcadeResult:e,t9nStrings:r})}</div>${C({items:x,arrayLength:h.length,subtree:!0,t9nStrings:r})}</calcite-tree-item>`}case"geometry":return a`<calcite-tree-item .expanded=${n} @click=${$.onClick}><div class="tree-item-label">${d({name:t,isMetadata:s})}<bdi>${c(e.type)}</bdi></div>${M({value:e.value,subtree:!0})}</calcite-tree-item>`;case"attachment":return a`<calcite-tree-item .expanded=${n} @click=${$.onClick}><div class="tree-item-label">${d({name:t,isMetadata:s})}<bdi>${c(e.type)}</bdi></div>${f({obj:e.value.castAsJson(),subtree:!0})}</calcite-tree-item>`;case"feature":case"dictionary":case"portal":return a`<calcite-tree-item .expanded=${n} @click=${$.onClick}><div class="tree-item-label">${d({name:t,isMetadata:s})}<bdi>${c(e.type)}</bdi></div>${T({value:e.value,subtree:!0,t9nStrings:r})}</calcite-tree-item>`;default:return null}},I=({arcadeResult:e})=>{let t=S(e.value.fields);return a`<div class="table-scroll"><table><thead><tr>${t.map(s=>a`<th>${s.name}</th>`)}</tr></thead><tbody>${e.features.map(s=>a`<tr>${t.map(n=>{let r=m(s.field(n.name));if(!k(r))return a`<td></td>`;try{let{type:i,value:o}=y(r);return a`<td>${v({type:i,value:o})}</td>`}catch{return a`<td></td>`}})}</tr>`)}</tbody></table></div>`};return{a:l,b:R,c:T,d:G,e:C,f:I}},d,e)
@@ -1,2 +1,2 @@
1
1
  /* COPYRIGHT Esri - https://js.arcgis.com/5.2/LICENSE.txt */
2
- import h from"./O5LFPM4K.js";import e from"./VJVVEOIA.js";import d from"./GATL6PSW.js";import{e as se}from"./VYEWIX5W.js";import c from"./STN3LSQR.js";import b from"./7Z6G332Z.js";import"./MZMKV7FA.js";import a from"./2WB7S5TQ.js";import{a as te}from"./E57Q2B63.js";import{a as ee}from"./VK7LOSQ5.js";import"./BHSILWSL.js";import"./J4I4EROF.js";import{a as re,b as ce,c as E}from"./VZ6DLSKR.js";import"./BZWB7A55.js";import"./XEK22IDA.js";import{a as ne}from"./CMRUQ3BN.js";import"./UFF53OEH.js";import"./NHREAORV.js";import{F as L,G as M,H as Y,I as f,L as J,M as Z,h as W,j as l,l as I,n as T,t as Q,u as X}from"./SMZ3LNZE.js";import{a as G,b as g}from"./BFPEJYVB.js";import{ml as ie,pl as F,ul as ae}from"./DSQ2DQQL.js";import"./H6RQVSYM.js";export default $arcgis.t(([_e,ge,{watch:O},S,{property:c,subclass:A},{a:oe,h:$,i:N},{b:U},,,v,{a:le,b:de}])=>{var xe=W`: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}.bottom-action-bar{display:flex;.bottom-action-bar__actions{flex:1 1 auto;min-inline-size:0}}`,ue="https://services6.arcgis.com/HXHga6CfMLMBOlBX/ArcGIS/rest/services/survey123_6e349a50b4504ca6b6107216d568db5f_form/FeatureServer/0",p=(t,e)=>{G(t,"Arcade Assistant",e)},pe=["orgAiAssistantsEnabled","betaAppsAllowed","serviceUrlAvailable","userHasUseAiAssistantsPrivilege"],Se=pe,he=(t,e)=>e.every(s=>t[s]===!0),Ae=t=>{let{aiAssistantsEnabled:e}=t;return e===void 0?(p("warn","`areAiAssistantsEnabled` is not defined in the organizations settings."),!1):e},Pe=async t=>(await ge.getCredential(t,{oAuthPopupConfirmation:!1})).token,fe=async t=>{try{return!!await ge.checkSignInStatus(t)}catch{return p("warn","User is not signed in."),!1}};async function ve({portalUrl:t}){t&&p("warn","The arcadeAssistant property is deprecated. Set esriConfig.portalUrl instead of arcadeAssistant.portalUrl.");let e=t||_e.portalUrl;if(!e)return p("warn","Arcade Assistant initialization failed. Reason: missing portal url."),{shouldRender:!1};let s=e.replace(/\/sharing\/rest(\/.*)?$/iu,"").replace(/\/$/u,"");if(!await fe(s))return{shouldRender:!1};let i=await Pe(e),a=`${s}/sharing/rest/portals/self?f=json&token=${i}`,o=`${s}/sharing/rest/portals/self/settings?f=json&token=${i}`,n=`${s}/sharing/rest/portals/self/signinSettings?f=json&token=${i}`,r=await Promise.allSettled([fetch(a,{credentials:"include"}).then(y=>y.json()),fetch(o,{credentials:"include"}).then(y=>y.json()),fetch(n,{credentials:"include"}).then(y=>y.json())]),[h,u,R]=r,P=h.status==="fulfilled"?h.value:(p("warn",`Failed to fetch selfUrl. Reason: ${h.reason}.`),{}),K=u.status==="fulfilled"?u.value:(p("warn",`Failed to fetch settingsUrl. Reason: ${u.reason}.`),{}),me=R.status==="fulfilled"?R.value:(p("warn",`Failed to fetch signinSettingsUrl. Reason: ${R.reason}.`),{});if(P.isPortal&&!$e(P.enterpriseVersion))return{shouldRender:!1};let j=P.helpBase||"";if(!K)return p("warn","Settings response is not available."),{shouldRender:!1};let B={orgAiAssistantsEnabled:Ae(K),betaAppsAllowed:me.blockBetaApps!==!0,serviceUrlAvailable:!!P?.helperServices?.aiAssistantServices?.url,userHasUseAiAssistantsPrivilege:P?.user?.privileges?.includes("portal:user:useAIAssistants")===!0};B.betaAppsAllowed||p("warn","Arcade Assistant is blocked by the organization settings. To enable it, do not block beta apps in the organization settings."),B.userHasUseAiAssistantsPrivilege||p("warn","User does not have the required privileges to use AI Assistants.");let H=he(B,Se),V=he(B,pe),q=P?.helperServices?.aiAssistantServices?.url;return q?{shouldRender:!0,portalUrl:e,availableFeatures:{codeActions:H,prompting:V},serviceUrl:q,helpBase:j,feedbackServiceUrl:ue}:{shouldRender:!0,portalUrl:e,availableFeatures:{codeActions:H,prompting:V},helpBase:j,feedbackServiceUrl:ue}}function $e(t){let e=X(t),[s,i="0"]=e.split("."),a=Number.parseInt(s,10),o=Number.parseInt(i,10);return Number.isNaN(a)||Number.isNaN(o)?!1:a>12||a===12&&o>=2}var ye=Object.defineProperty,Ee=Object.getOwnPropertyDescriptor,x=(t,e,s,i)=>{for(var a=i>1?void 0:i?Ee(e,s):e,o=t.length-1,n;o>=0;o--)(n=t[o])&&(a=(i?n(e,s,a):n(a))||a);return i&&a&&ye(e,s,a),a},be=100,b=class extends S{constructor(t){super(t),this.collectionItems=[],this.errorMessage="",this.expanded=!1,this.requestId=0,this.status="idle",this.visibleChildCount=be}};x([c()],b.prototype,"collectionItems",2);x([c()],b.prototype,"errorMessage",2);x([c()],b.prototype,"expanded",2);x([c()],b.prototype,"requestId",2);x([c()],b.prototype,"schemaValue",2);x([c()],b.prototype,"status",2);x([c()],b.prototype,"visibleChildCount",2);b=x([A("ArcadeDebuggerLazyTreeNodeState")],b);var C=class extends S{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 b;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+be))}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,o=i.requestId+1;i.requestId=o,i.status="loading",i.errorMessage="",i.schemaValue=void 0,i.collectionItems=[],e().then(n=>{let r=this.nodes.get(t);!r||this.generation!==a||r.requestId!==o||(s(r,n),r.status="loaded")}).catch(()=>{let n=this.nodes.get(t);!n||this.generation!==a||n.requestId!==o||(n.status="error")})}destroyNodes(){for(let t of this.nodes.values())t.destroy();this.nodes.clear()}};C=x([A("ArcadeDebuggerLazyTreeState")],C);var De=Object.defineProperty,we=Object.getOwnPropertyDescriptor,d=(t,e,s,i)=>{for(var a=i>1?void 0:i?we(e,s):e,o=t.length-1,n;o>=0;o--)(n=t[o])&&(a=(i?n(e,s,a):n(a))||a);return i&&a&&De(e,s,a),a},_=class extends S{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}get executionTiming(){return this.result?.timing}addConsoleLog(t){this.consoleLogs=[...this.consoleLogs,t]}};d([c()],_.prototype,"phase",2);d([c()],_.prototype,"mode",2);d([c()],_.prototype,"sessionId",2);d([c()],_.prototype,"result",2);d([c()],_.prototype,"consoleLogs",2);d([c()],_.prototype,"hasExecuted",2);_=d([A("ArcadeDebuggerExecutionModel")],_);var D=class extends S{constructor(t){super(t),this.editorBreakpoints=[],this.executionBreakpoints=[]}setBreakpoints(t,e){t==="editor"?this.editorBreakpoints=Array.from(new Set(e)).sort((s,i)=>s-i):this.executionBreakpoints=Array.from(new Set(e)).sort((s,i)=>s-i)}toggleBreakpoint(t,e){let s=new Set(t==="editor"?this.editorBreakpoints:this.executionBreakpoints);s.has(e)?s.delete(e):s.add(e),this.setBreakpoints(t,s)}clearBreakpoints(t){t==="editor"?this.editorBreakpoints=[]:this.executionBreakpoints=[]}syncExecutionBreakpointsFromEditor(){this.executionBreakpoints=this.editorBreakpoints}};d([c()],D.prototype,"editorBreakpoints",2);d([c()],D.prototype,"executionBreakpoints",2);D=d([A("ArcadeDebuggerSessionModel")],D);var w=class extends S{constructor(t){super(t),this.openedPanel="output",this.showPanel=!1}};d([c()],w.prototype,"openedPanel",2);d([c()],w.prototype,"showPanel",2);w=d([A("ArcadeDebuggerUiModel")],w);var k=class extends S{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}};d([c()],k.prototype,"pausedState",2);d([c()],k.prototype,"lastPausedState",2);k=d([A("ArcadeDebuggerPausedFrameModel")],k);var m=class extends S{constructor(t){super(t),this.execution=new _,this.lazyTreeState=new C,this.pausedFrame=new k,this.previewTabsState=new U,this.session=new D,this.ui=new w}get editorBreakpoints(){return this.session.editorBreakpoints}get debuggerBreakpoints(){return this.isPaused?this.session.executionBreakpoints.map(t=>({line:t})):this.session.editorBreakpoints.map(t=>({line:t}))}get executionBreakpoints(){return this.session.executionBreakpoints}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 executionTiming(){return this.execution.executionTiming}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(t){this.session.clearBreakpoints(t)}clearForMissingTestData(){this.stopDebug({hidePanel:!0}),this.execution.hasExecuted=!1,this.execution.result=void 0}closePanel(){this.ui.showPanel=!1}completeDebug(t,e){this.execution.mode="debug",this.execution.result={resultType:"debug",result:t,...e?{timing:e}:{}},this.execution.phase="completed",this.ui.openedPanel="output",this.pausedFrame.reset(),this.resetTransientDebuggerState()}completeRun(t,e={}){this.execution.mode="run",!e.useDebugRenderer&&$(t)?this.execution.result={resultType:"run",result:t}:e.useDebugRenderer&&!$(t)&&(this.execution.result={resultType:"debug",result:t,...e.timing?{timing:e.timing}:{}}),this.execution.phase="completed",this.pausedFrame.reset(),this.ui.openedPanel="output",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("execution"),this.clearBreakpoints("editor")}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.clearBreakpoints("execution"),this.clearBreakpoints("editor"),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("editor",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.session.syncExecutionBreakpointsFromEditor(),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("editor",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 C,this.previewTabsState=new U}};d([c()],m.prototype,"execution",2);d([c()],m.prototype,"lazyTreeState",2);d([c()],m.prototype,"pausedLine",2);d([c()],m.prototype,"pausedFrame",2);d([c()],m.prototype,"previewTabsState",2);d([c()],m.prototype,"session",2);d([c()],m.prototype,"ui",2);m=d([A("ArcadeDebuggerStore")],m);var ke={glyphMargin:!0,lineNumbersMinChars:1},z=class extends Y{constructor(){super(...arguments),this._codeEditorElt=L(),this._arcadeAssistantElt=L(),this._componentReadyDefer=Promise.withResolvers(),this._disposables=[],this._editorProfilePromise=Promise.resolve(void 0),this._debuggerState=new m,this.messages=te(),this._modelId=Q(),this._openArcadeHelp=()=>{window.open(oe,"Arcade Help")},this._decorations=void 0,this._monacoEditor=ee(ne),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.editorBreakpoints.map(i=>({range:new F(i,1,i,1),options:{isWholeLine:!0,glyphMarginClassName:"arcgis-code-editor__breakpoint-glyph",stickiness:this._monacoEditor.TrackedRangeStickiness.NeverGrowsWhenTypingAtEdges}}));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._diagnostics=[],this.enableDebugger=!1,this.hideDocumentationActions=!1,this.hideSideBar=!1,this.openedSidePanel="none",this.script="",this.sideActionBarExpanded=!1,this.disableAssistant=!1,this.arcgisDiagnosticsChange=T({bubbles:!1}),this.arcgisScriptChange=T({bubbles:!1})}static{this.properties={_apiLibrary:16,_editorProfile:16,_preparingArcade:16,_arcadeAssistantRemoteState:16,_diagnostics: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,disableAssistant:5,arcadeAssistant:0,externalExecutor:0}}static{this.styles=[xe]}get _canExecute(){return!!(this.testData||this.externalExecutor)}get _usesBottomExecutionDrawer(){return this._canExecute&&(this.enableDebugger||!!this.externalExecutor)}get editorInstance(){return this._codeEditorElt.value?.editorInstance}get editorOptions(){return{...ke,...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 N(e.definition,s,this.testData,{mode:"run"});return $(i)?i:{type:"error",value:"Unexpected debug result",error:null}}async setFocus(){await this._componentReadyDefer.promise,await this._codeEditorElt.value?.setFocus()}async openArcadeAssistant(e){if(!this._arcadeAssistantRemoteState.shouldRender)return!1;if(this.openedSidePanel="arcade-assistant",await this.updateComplete,!this._canPromptWithArcadeAssistant())return!0;let s=this._arcadeAssistantElt.value;return e?.prompt&&await s?.openPrompt(e.prompt),!0}async load(){let e=Z("./assets");le(e),await this._updateDataModelDeps(),this.manager.onLifecycle(()=>(this.hasUpdated&&this._connectMonacoCustomizations().catch(g(this)),()=>{for(this._askAiBindingKey&&(E(this._askAiBindingKey,void 0),this._askAiBindingKey=void 0);this._disposables.length;)this._disposables.pop()?.dispose();this._abortExternalExecution(),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")||e.has("externalExecutor"))&&this._executionContextChanged(),e.has("enableDebugger")&&!this.enableDebugger&&this._debuggerState.disableDebugger(),e.has("snippets")&&v.updateApiContextForModel(this._modelId,{snippets:this.snippets}),(e.has("arcadeAssistant")||e.has("disableAssistant"))&&this._updateArcadeAssistantRemoteState()}async loaded(){await this._connectMonacoCustomizations(),this._componentReadyDefer.resolve()}_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 de();this._disposables.push(e.onDiagnosticsChange(r=>{this._preparingArcade||(this._diagnostics=r.diagnostics,this.arcgisDiagnosticsChange.emit(r.diagnostics))})),this._canExecute&&!this._executeScriptAction&&this._addExecuteScriptAction(),this._syncAskAiAction();let s=O(()=>this._debuggerState.editorBreakpoints,()=>this._updateBreakpointsDecorations(),{sync:!0}),i=O(()=>this._debuggerState.debuggerLine,()=>this._updateDebuggerPausedLineDecoration(),{sync:!0}),a=O(()=>this._debuggerState.consoleLogs.length,()=>this.requestUpdate(),{sync:!0});this._disposables.push({dispose:()=>s.remove()},{dispose:()=>i.remove()},{dispose:()=>a.remove()});let o=this.editorInstance?.onMouseDown(r=>this._onEditorMouseDown(r));o&&this._disposables.push(o);let n=this.editorInstance?.onDidChangeModelContent(r=>this._onEditorModelContentChange(r));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].includes(e.target.type)||e.target.element?.classList.contains("codicon-gutter-lightbulb"))return;let s=e.target.position?.lineNumber;s&&this._debuggerState.toggleBreakpoint(s)}_onEditorModelContentChange(e){if(!this.enableDebugger||!this._debuggerState.editorBreakpoints.length||e.isFlush)return;let s=se(this._debuggerState.editorBreakpoints,e.changes);s.length===this._debuggerState.editorBreakpoints.length&&s.every((i,a)=>i===this._debuggerState.editorBreakpoints[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 F(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",stickiness:this._monacoEditor.TrackedRangeStickiness.NeverGrowsWhenTypingAtEdges}}]):this._debuggerPausedLineDecoration=void 0}_continueDebugSession(){this._debuggerState.continueDebug()}_abortExternalExecution(){this._externalExecutionAbortController?.abort(),this._externalExecutionAbortController=void 0}_stopDebugSession(){this._abortExternalExecution(),this._debuggerState.stopDebug({hidePanel:!1})}_resetDebugSession(){this._abortExternalExecution(),this._debuggerState.resetDebug(),this._executeScript("debug").catch(g(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()}async _executeWithExternalExecutor(e,s,i){if(!this.externalExecutor)return{type:"error",value:"Missing external executor",error:null};let a=new AbortController;this._abortExternalExecution(),this._externalExecutionAbortController=a;let o=i.console??(()=>{});try{if(e==="debug"){let{breakpoints:n,onDebugPause:r}=i;if(!n||!r)throw new Error("Missing debug execution options");return await this.externalExecutor.execute({mode:"debug",script:s,console:o,signal:a.signal,breakpoints:n,onDebugPause:r})}return await this.externalExecutor.execute({mode:"run",script:s,console:o,signal:a.signal})}catch(n){return{type:"error",value:(n instanceof Error?n:new Error(String(n))).message??"Execution failed",error:n instanceof Error?n:new Error(String(n)),compilationTime:0,executionTime:0,timeStamp:new Date}}finally{this._externalExecutionAbortController===a&&(this._externalExecutionAbortController=void 0)}}_executionContextChanged(){!this._canExecute&&this._executeScriptAction&&(this._disposeSafely(this._executeScriptAction),this._executeScriptAction=void 0),this._canExecute&&!this._executeScriptAction&&this._addExecuteScriptAction(),!this.testData&&this.enableDebugger&&this._debuggerState.clearForMissingTestData(),this._debuggerState.openedPanel==="debug-console"&&!this.enableDebugger&&this._debuggerState.closePanel(),this._debuggerState.showPanel&&this._executeScript("run").catch(g(this))}async _updateEditorProfile(){this._preparingArcade=!0;try{await v.setProfileForModel(this._modelId,this.profile,{locale:this.messages._t9nLocale,snippets:this.snippets}),this._editorProfile=v.getEditorProfileForModel(this._modelId)}catch{this._editorProfile=void 0}finally{this._editorProfilePromise=Promise.resolve(this._editorProfile),this._preparingArcade=!1}}async _updateApiLibrary(){this._apiLibrary=await v.getApiLibraryForModel(this._modelId)}_setExecutionPanel(e){this._debuggerState.setPanel(e)}async _executeScript(e){let s=this.testData,i=this.externalExecutor;if(!this._codeEditorElt.value||!s&&!i)return;let a=e==="debug"?this._debuggerState.startDebug():this._debuggerState.startRun();setTimeout(()=>{(async()=>{let o=this._codeEditorElt.value?.value??this.script,n={mode:e,console:u=>this._debuggerState.addConsoleLog(u),breakpoints:e==="debug"?this._debuggerState.debuggerBreakpoints:void 0};e==="debug"&&(n.onDebugPause=this._handleDebugPause.bind(this,a));let r,h;if(i){let u=await this._executeWithExternalExecutor(e,o,n);"result"in u?(r=u.result,h=u.timing):r=u}else if(s){let u=await this._editorProfilePromise;if(!u){this._debuggerState.fail({type:"error",value:"Missing editor profile",error:null});return}r=await N(u.definition,o,s,n)}else return;if(a===this._debuggerState.sessionId){if(e==="debug"){if($(r)){this._debuggerState.fail(r);return}this._debuggerState.completeDebug(r,h);return}if($(r))this._debuggerState.completeRun(r);else if(i){if(!h){this._debuggerState.fail({type:"error",value:"Missing execution timing",error:null});return}this._debuggerState.completeRun(r,{useDebugRenderer:!0,timing:h})}else 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(g(this))}_insertAsText(e){this._insertText(e.detail)}_insertText(e){this._codeEditorElt.value?.insertText(e).catch(g(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:[ie.F5],contextMenuGroupId:"code",contextMenuOrder:1,run:()=>{this._canExecute&&this._executeScript("run").catch(g(this))}});e&&(this._executeScriptAction=e,this._disposables.push(e))}_getAskAiBindingKey(){return ae.parse(this._modelId).toString()}_canRenderAskAiCodeActions(){let e=this._arcadeAssistantRemoteState;return e.shouldRender?e.availableFeatures.codeActions:!1}_canPromptWithArcadeAssistant(){let e=this._arcadeAssistantRemoteState;return e.shouldRender?e.availableFeatures.prompting:!1}_getAskAiCodeActions(e){if(!this._canRenderAskAiCodeActions())return[];if(!e.markers.length)return[];let s=this.messages.askarcadeassistant??"Ask Arcade Assistant",i=this._getAskAiBindingKey();return[{title:s,kind:re,diagnostics:e.markers,isPreferred:!1,isAI:!1,command:{id:ce,title:s,arguments:[i,this.messages.askarcadeassistantprompt??"Fix the errors in my script"]}}]}_syncAskAiAction(){if(!this.editorInstance)return;let e=this._getAskAiBindingKey();if(!this._arcadeAssistantRemoteState.shouldRender){this._askAiBindingKey&&(E(this._askAiBindingKey,void 0),this._askAiBindingKey=void 0);return}this._askAiBindingKey&&this._askAiBindingKey!==e&&E(this._askAiBindingKey,void 0),E(e,{provideCodeActions:({context:s})=>this._getAskAiCodeActions(s),run:s=>{this.openArcadeAssistant({prompt:s??this.messages.askarcadeassistantprompt??"Fix the errors in my script"}).catch(g(this))}}),this._askAiBindingKey=e}_disposeSafely(e){let s=this._disposables.indexOf(e);s!==-1&&this._disposables.splice(s,1),e.dispose()}async _updateArcadeAssistantRemoteState(){let e=this.arcadeAssistant;this.disableAssistant?this._arcadeAssistantRemoteState={shouldRender:!1}:this._arcadeAssistantRemoteState=await ve(e??{}),this._syncAskAiAction()}renderMainActionBar(){return this._usesBottomExecutionDrawer||!this._canExecute?null:l`<calcite-action-bar class="main-action-bar" layout=horizontal scale=s expanded expand-toggle-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(g(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=${v.languageId} .value=${this.script??""} .modelId=${this._modelId} @arcgisValueChange=${this._onCodeEditorValueChange} ${M(this._codeEditorElt)}></arcgis-code-editor>`}renderAction({id:e,label:s,icon:i,active:a,panelName:o,iconFlipRtl:n=!1,onClick:r=this._toggleSidePanel}){return l`<calcite-action id=${e??I} .text=${s} .textEnabled=${this.sideActionBarExpanded} .icon=${i} .active=${a} @click=${r} data-panel-name=${o??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,_arcadeAssistantRemoteState:s}=this;return l`<arcgis-language-api-panel slot=side-panel class=${f(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=${f(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,profilevariables:this.messages.profilevariables}}></arcgis-editor-variables>${this.suggestions?.length&&l`<arcgis-arcade-suggestions slot=side-panel class=${f(e==="suggestions"?"":"hidden")} .closed=${e!=="suggestions"} .suggestions=${this.suggestions} @arcgisInternalItemSelected=${this._insertAsText} @arcgisInternalClosePanel=${this._closeSidePanel} data-panel-name=none></arcgis-arcade-suggestions>`||""}${s?.shouldRender&&l`<arcgis-arcade-coding-assistant slot=side-panel class=${f(e==="arcade-assistant"?"":"hidden")} .closed=${e!=="arcade-assistant"} .insertText=${this._insertText.bind(this)} .closePanel=${this._closeSidePanel} .portalUrl=${s.portalUrl} .serviceUrl=${"serviceUrl"in s?s.serviceUrl:void 0} .helpBase=${s.helpBase} .promptingEnabled=${this._canPromptWithArcadeAssistant()} .feedbackServiceUrl=${s.feedbackServiceUrl} .editorRef=${this.el} .appVersion=${this.arcadeAssistant?.appVersion} .disableQuestionAnswerLogging=${this.arcadeAssistant?.disableQuestionAnswerLogging} .diagnostics=${this._diagnostics} ${M(this._arcadeAssistantElt)}></arcgis-arcade-coding-assistant>`||""}${this.customPanels?.map(i=>l`<calcite-flow slot=side-panel class=${f(e===i.id?"":"hidden")}>${i?.useFlows?i.renderer?.({closePanel:this._toggleSidePanel,insertText:this._insertText.bind(this),closed:e!==i.id,editorRef:this.el}):l`<calcite-flow-item .heading=${i.name} heading-level=2 closable .closed=${e!==i.id} @calciteFlowItemClose=${this._toggleSidePanel} .description=${i.description}>${i.renderer?.({closePanel:this._toggleSidePanel,insertText:this._insertText.bind(this),closed:e!==i.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} .executionTiming=${this._debuggerState.executionTiming} .consoleLogs=${this._debuggerState.consoleLogs} @arcgisInternalOpenedResultPanelChange=${this._onResultPanelChange} @arcgisInternalClosePanel=${this._onExecutionPanelClose}></arcgis-arcade-results>`}renderBottomExecutionBody(){let{showPanel:e,openedPanel:s,debugResult:i,isExecuting:a,mode:o}=this._debuggerState;if(!e)return null;let n=s==="debug-console"?"output":s;return this.enableDebugger&&s==="debug-console"?l`<arcgis-arcade-debugger-console slot=results-panel .modelId=${this._modelId} .debuggerStore=${this._debuggerState}></arcgis-arcade-debugger-console>`:s==="output"&&(o==="debug"||i)?l`<arcgis-arcade-debugger-output .outputTitle=${this.messages.output} slot=results-panel .debuggerStore=${this._debuggerState} .result=${i}></arcgis-arcade-debugger-output>`:l`<arcgis-arcade-results slot=results-panel class="bottom-results" .openedResultPanel=${n} .loading=${s==="console"&&this._debuggerState.isPaused?!1:a} .result=${this._debuggerState.runResult} .executionTiming=${this._debuggerState.executionTiming} .consoleLogs=${this._debuggerState.consoleLogs} hide-header @arcgisInternalOpenedResultPanelChange=${this._onResultPanelChange}></arcgis-arcade-results>`}renderBottomActionBar(){if(!this._usesBottomExecutionDrawer)return null;let{showPanel:e,hasExecuted:s,openedPanel:i,isDebugging:a,isPaused:o,isExecuting:n}=this._debuggerState,r=this.messages.continue??"Continue",h=this.messages.reset??"Reset",u=this.messages.stop??"Stop";return l`<div slot=bottom-action-bar class=${`main-action-bar bottom-action-bar ${e?"":"is-collapsed"}`}><calcite-action-bar class="bottom-action-bar__actions" layout=horizontal scale=s expand-toggle-disabled expanded><calcite-action-group scale=s>${this.enableDebugger&&a?l`<calcite-action id=debugger-continue-action .text=${r} icon=forward scale=s .disabled=${!o} @click=${this._continueDebugSession}></calcite-action><calcite-tooltip reference-element=debugger-continue-action placement=top><span>${r}</span></calcite-tooltip><calcite-action id=debugger-reset-action .text=${h} icon=reset scale=s @click=${this._resetDebugSession}></calcite-action><calcite-tooltip reference-element=debugger-reset-action placement=top><span>${h}</span></calcite-tooltip><calcite-action id=debugger-stop-action .text=${u} icon=circle-stop scale=s @click=${this._stopDebugSession}></calcite-action><calcite-tooltip reference-element=debugger-stop-action placement=top><span>${u}</span></calcite-tooltip>`:l`<calcite-action .text=${this.messages.run??""} text-enabled icon=play scale=s .loading=${this._preparingArcade||n} @click=${()=>{this._executeScript("run").catch(g(this))}}></calcite-action>${this.enableDebugger&&l`<calcite-action .disabled=${this._debuggerState.editorBreakpoints.length===0} .text=${this.messages.runanddebug??"Run and Debug"} text-enabled icon=debug-script scale=s .loading=${this._preparingArcade||n} @click=${()=>{this._executeScript("debug").catch(g(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")} .disabled=${this.enableDebugger&&this._debuggerState.mode==="debug"}></calcite-action>${this.enableDebugger&&l`<calcite-action .active=${i==="debug-console"&&e} .text=${this.messages.debugconsole??"Debug Console"} text-enabled scale=s icon=debug-script .disabled=${this._debuggerState.mode!=="debug"} @click=${()=>this._setExecutionPanel("debug-console")}></calcite-action>`||""}</calcite-action-group>`:null}</calcite-action-bar>${e?l`<calcite-action .text=${this.messages.close??"Close"} scale=s icon=x icon-flip-rtl @click=${this._onExecutionPanelClose} slot=actions-end></calcite-action>`:null}</div>`}render(){return l`<arcgis-code-editor-shell>${this.renderMainActionBar()}${this.renderMainPanel()}${this.renderBottomActionBar()}${this.renderResultsPanel()}${this.renderSidePanel()}${this.renderSideActionBar()}</arcgis-code-editor-shell>`}};J("arcgis-arcade-editor",z);return z},"config","identity/IdentityManager","core/reactiveUtils","core/Accessor","core/accessorSupport/decorators",a,b,c,d,e,h)
2
+ import h from"./O5LFPM4K.js";import e from"./327RBVAC.js";import d from"./AQHAEA62.js";import{e as se}from"./SKBHZ7VS.js";import c from"./STN3LSQR.js";import b from"./7Z6G332Z.js";import"./MZMKV7FA.js";import a from"./2WB7S5TQ.js";import{a as te}from"./OLMW3NCS.js";import{a as ee}from"./SSVSZDRA.js";import"./BHSILWSL.js";import"./J4I4EROF.js";import{a as re,b as ce,c as E}from"./VZ6DLSKR.js";import"./BZWB7A55.js";import"./XEK22IDA.js";import{a as ne}from"./CMRUQ3BN.js";import"./UFF53OEH.js";import"./NHREAORV.js";import{F as L,G as M,H as Y,I as f,L as J,M as Z,h as W,j as l,l as I,n as T,t as Q,u as X}from"./A77A54OM.js";import{a as G,b as g}from"./BFPEJYVB.js";import{ml as ie,pl as F,ul as ae}from"./DSQ2DQQL.js";import"./H6RQVSYM.js";export default $arcgis.t(([_e,ge,{watch:O},S,{property:c,subclass:A},{a:oe,h:$,i:N},{b:U},,,v,{a:le,b:de}])=>{var xe=W`: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}.bottom-action-bar{display:flex;.bottom-action-bar__actions{flex:1 1 auto;min-inline-size:0}}`,ue="https://services6.arcgis.com/HXHga6CfMLMBOlBX/ArcGIS/rest/services/survey123_6e349a50b4504ca6b6107216d568db5f_form/FeatureServer/0",p=(t,e)=>{G(t,"Arcade Assistant",e)},pe=["orgAiAssistantsEnabled","betaAppsAllowed","serviceUrlAvailable","userHasUseAiAssistantsPrivilege"],Se=pe,he=(t,e)=>e.every(s=>t[s]===!0),Ae=t=>{let{aiAssistantsEnabled:e}=t;return e===void 0?(p("warn","`areAiAssistantsEnabled` is not defined in the organizations settings."),!1):e},Pe=async t=>(await ge.getCredential(t,{oAuthPopupConfirmation:!1})).token,fe=async t=>{try{return!!await ge.checkSignInStatus(t)}catch{return p("warn","User is not signed in."),!1}};async function ve({portalUrl:t}){t&&p("warn","The arcadeAssistant property is deprecated. Set esriConfig.portalUrl instead of arcadeAssistant.portalUrl.");let e=t||_e.portalUrl;if(!e)return p("warn","Arcade Assistant initialization failed. Reason: missing portal url."),{shouldRender:!1};let s=e.replace(/\/sharing\/rest(\/.*)?$/iu,"").replace(/\/$/u,"");if(!await fe(s))return{shouldRender:!1};let i=await Pe(e),a=`${s}/sharing/rest/portals/self?f=json&token=${i}`,o=`${s}/sharing/rest/portals/self/settings?f=json&token=${i}`,n=`${s}/sharing/rest/portals/self/signinSettings?f=json&token=${i}`,r=await Promise.allSettled([fetch(a,{credentials:"include"}).then(y=>y.json()),fetch(o,{credentials:"include"}).then(y=>y.json()),fetch(n,{credentials:"include"}).then(y=>y.json())]),[h,u,R]=r,P=h.status==="fulfilled"?h.value:(p("warn",`Failed to fetch selfUrl. Reason: ${h.reason}.`),{}),K=u.status==="fulfilled"?u.value:(p("warn",`Failed to fetch settingsUrl. Reason: ${u.reason}.`),{}),me=R.status==="fulfilled"?R.value:(p("warn",`Failed to fetch signinSettingsUrl. Reason: ${R.reason}.`),{});if(P.isPortal&&!$e(P.enterpriseVersion))return{shouldRender:!1};let j=P.helpBase||"";if(!K)return p("warn","Settings response is not available."),{shouldRender:!1};let B={orgAiAssistantsEnabled:Ae(K),betaAppsAllowed:me.blockBetaApps!==!0,serviceUrlAvailable:!!P?.helperServices?.aiAssistantServices?.url,userHasUseAiAssistantsPrivilege:P?.user?.privileges?.includes("portal:user:useAIAssistants")===!0};B.betaAppsAllowed||p("warn","Arcade Assistant is blocked by the organization settings. To enable it, do not block beta apps in the organization settings."),B.userHasUseAiAssistantsPrivilege||p("warn","User does not have the required privileges to use AI Assistants.");let H=he(B,Se),V=he(B,pe),q=P?.helperServices?.aiAssistantServices?.url;return q?{shouldRender:!0,portalUrl:e,availableFeatures:{codeActions:H,prompting:V},serviceUrl:q,helpBase:j,feedbackServiceUrl:ue}:{shouldRender:!0,portalUrl:e,availableFeatures:{codeActions:H,prompting:V},helpBase:j,feedbackServiceUrl:ue}}function $e(t){let e=X(t),[s,i="0"]=e.split("."),a=Number.parseInt(s,10),o=Number.parseInt(i,10);return Number.isNaN(a)||Number.isNaN(o)?!1:a>12||a===12&&o>=2}var ye=Object.defineProperty,Ee=Object.getOwnPropertyDescriptor,x=(t,e,s,i)=>{for(var a=i>1?void 0:i?Ee(e,s):e,o=t.length-1,n;o>=0;o--)(n=t[o])&&(a=(i?n(e,s,a):n(a))||a);return i&&a&&ye(e,s,a),a},be=100,b=class extends S{constructor(t){super(t),this.collectionItems=[],this.errorMessage="",this.expanded=!1,this.requestId=0,this.status="idle",this.visibleChildCount=be}};x([c()],b.prototype,"collectionItems",2);x([c()],b.prototype,"errorMessage",2);x([c()],b.prototype,"expanded",2);x([c()],b.prototype,"requestId",2);x([c()],b.prototype,"schemaValue",2);x([c()],b.prototype,"status",2);x([c()],b.prototype,"visibleChildCount",2);b=x([A("ArcadeDebuggerLazyTreeNodeState")],b);var C=class extends S{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 b;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+be))}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,o=i.requestId+1;i.requestId=o,i.status="loading",i.errorMessage="",i.schemaValue=void 0,i.collectionItems=[],e().then(n=>{let r=this.nodes.get(t);!r||this.generation!==a||r.requestId!==o||(s(r,n),r.status="loaded")}).catch(()=>{let n=this.nodes.get(t);!n||this.generation!==a||n.requestId!==o||(n.status="error")})}destroyNodes(){for(let t of this.nodes.values())t.destroy();this.nodes.clear()}};C=x([A("ArcadeDebuggerLazyTreeState")],C);var De=Object.defineProperty,we=Object.getOwnPropertyDescriptor,d=(t,e,s,i)=>{for(var a=i>1?void 0:i?we(e,s):e,o=t.length-1,n;o>=0;o--)(n=t[o])&&(a=(i?n(e,s,a):n(a))||a);return i&&a&&De(e,s,a),a},_=class extends S{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}get executionTiming(){return this.result?.timing}addConsoleLog(t){this.consoleLogs=[...this.consoleLogs,t]}};d([c()],_.prototype,"phase",2);d([c()],_.prototype,"mode",2);d([c()],_.prototype,"sessionId",2);d([c()],_.prototype,"result",2);d([c()],_.prototype,"consoleLogs",2);d([c()],_.prototype,"hasExecuted",2);_=d([A("ArcadeDebuggerExecutionModel")],_);var D=class extends S{constructor(t){super(t),this.editorBreakpoints=[],this.executionBreakpoints=[]}setBreakpoints(t,e){t==="editor"?this.editorBreakpoints=Array.from(new Set(e)).sort((s,i)=>s-i):this.executionBreakpoints=Array.from(new Set(e)).sort((s,i)=>s-i)}toggleBreakpoint(t,e){let s=new Set(t==="editor"?this.editorBreakpoints:this.executionBreakpoints);s.has(e)?s.delete(e):s.add(e),this.setBreakpoints(t,s)}clearBreakpoints(t){t==="editor"?this.editorBreakpoints=[]:this.executionBreakpoints=[]}syncExecutionBreakpointsFromEditor(){this.executionBreakpoints=this.editorBreakpoints}};d([c()],D.prototype,"editorBreakpoints",2);d([c()],D.prototype,"executionBreakpoints",2);D=d([A("ArcadeDebuggerSessionModel")],D);var w=class extends S{constructor(t){super(t),this.openedPanel="output",this.showPanel=!1}};d([c()],w.prototype,"openedPanel",2);d([c()],w.prototype,"showPanel",2);w=d([A("ArcadeDebuggerUiModel")],w);var k=class extends S{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}};d([c()],k.prototype,"pausedState",2);d([c()],k.prototype,"lastPausedState",2);k=d([A("ArcadeDebuggerPausedFrameModel")],k);var m=class extends S{constructor(t){super(t),this.execution=new _,this.lazyTreeState=new C,this.pausedFrame=new k,this.previewTabsState=new U,this.session=new D,this.ui=new w}get editorBreakpoints(){return this.session.editorBreakpoints}get debuggerBreakpoints(){return this.isPaused?this.session.executionBreakpoints.map(t=>({line:t})):this.session.editorBreakpoints.map(t=>({line:t}))}get executionBreakpoints(){return this.session.executionBreakpoints}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 executionTiming(){return this.execution.executionTiming}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(t){this.session.clearBreakpoints(t)}clearForMissingTestData(){this.stopDebug({hidePanel:!0}),this.execution.hasExecuted=!1,this.execution.result=void 0}closePanel(){this.ui.showPanel=!1}completeDebug(t,e){this.execution.mode="debug",this.execution.result={resultType:"debug",result:t,...e?{timing:e}:{}},this.execution.phase="completed",this.ui.openedPanel="output",this.pausedFrame.reset(),this.resetTransientDebuggerState()}completeRun(t,e={}){this.execution.mode="run",!e.useDebugRenderer&&$(t)?this.execution.result={resultType:"run",result:t}:e.useDebugRenderer&&!$(t)&&(this.execution.result={resultType:"debug",result:t,...e.timing?{timing:e.timing}:{}}),this.execution.phase="completed",this.pausedFrame.reset(),this.ui.openedPanel="output",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("execution"),this.clearBreakpoints("editor")}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.clearBreakpoints("execution"),this.clearBreakpoints("editor"),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("editor",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.session.syncExecutionBreakpointsFromEditor(),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("editor",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 C,this.previewTabsState=new U}};d([c()],m.prototype,"execution",2);d([c()],m.prototype,"lazyTreeState",2);d([c()],m.prototype,"pausedLine",2);d([c()],m.prototype,"pausedFrame",2);d([c()],m.prototype,"previewTabsState",2);d([c()],m.prototype,"session",2);d([c()],m.prototype,"ui",2);m=d([A("ArcadeDebuggerStore")],m);var ke={glyphMargin:!0,lineNumbersMinChars:1},z=class extends Y{constructor(){super(...arguments),this._codeEditorElt=L(),this._arcadeAssistantElt=L(),this._componentReadyDefer=Promise.withResolvers(),this._disposables=[],this._editorProfilePromise=Promise.resolve(void 0),this._debuggerState=new m,this.messages=te(),this._modelId=Q(),this._openArcadeHelp=()=>{window.open(oe,"Arcade Help")},this._decorations=void 0,this._monacoEditor=ee(ne),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.editorBreakpoints.map(i=>({range:new F(i,1,i,1),options:{isWholeLine:!0,glyphMarginClassName:"arcgis-code-editor__breakpoint-glyph",stickiness:this._monacoEditor.TrackedRangeStickiness.NeverGrowsWhenTypingAtEdges}}));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._diagnostics=[],this.enableDebugger=!1,this.hideDocumentationActions=!1,this.hideSideBar=!1,this.openedSidePanel="none",this.script="",this.sideActionBarExpanded=!1,this.disableAssistant=!1,this.arcgisDiagnosticsChange=T({bubbles:!1}),this.arcgisScriptChange=T({bubbles:!1})}static{this.properties={_apiLibrary:16,_editorProfile:16,_preparingArcade:16,_arcadeAssistantRemoteState:16,_diagnostics: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,disableAssistant:5,arcadeAssistant:0,externalExecutor:0}}static{this.styles=[xe]}get _canExecute(){return!!(this.testData||this.externalExecutor)}get _usesBottomExecutionDrawer(){return this._canExecute&&(this.enableDebugger||!!this.externalExecutor)}get editorInstance(){return this._codeEditorElt.value?.editorInstance}get editorOptions(){return{...ke,...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 N(e.definition,s,this.testData,{mode:"run"});return $(i)?i:{type:"error",value:"Unexpected debug result",error:null}}async setFocus(){await this._componentReadyDefer.promise,await this._codeEditorElt.value?.setFocus()}async openArcadeAssistant(e){if(!this._arcadeAssistantRemoteState.shouldRender)return!1;if(this.openedSidePanel="arcade-assistant",await this.updateComplete,!this._canPromptWithArcadeAssistant())return!0;let s=this._arcadeAssistantElt.value;return e?.prompt&&await s?.openPrompt(e.prompt),!0}async load(){let e=Z("./assets");le(e),await this._updateDataModelDeps(),this.manager.onLifecycle(()=>(this.hasUpdated&&this._connectMonacoCustomizations().catch(g(this)),()=>{for(this._askAiBindingKey&&(E(this._askAiBindingKey,void 0),this._askAiBindingKey=void 0);this._disposables.length;)this._disposables.pop()?.dispose();this._abortExternalExecution(),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")||e.has("externalExecutor"))&&this._executionContextChanged(),e.has("enableDebugger")&&!this.enableDebugger&&this._debuggerState.disableDebugger(),e.has("snippets")&&v.updateApiContextForModel(this._modelId,{snippets:this.snippets}),(e.has("arcadeAssistant")||e.has("disableAssistant"))&&this._updateArcadeAssistantRemoteState()}async loaded(){await this._connectMonacoCustomizations(),this._componentReadyDefer.resolve()}_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 de();this._disposables.push(e.onDiagnosticsChange(r=>{this._preparingArcade||(this._diagnostics=r.diagnostics,this.arcgisDiagnosticsChange.emit(r.diagnostics))})),this._canExecute&&!this._executeScriptAction&&this._addExecuteScriptAction(),this._syncAskAiAction();let s=O(()=>this._debuggerState.editorBreakpoints,()=>this._updateBreakpointsDecorations(),{sync:!0}),i=O(()=>this._debuggerState.debuggerLine,()=>this._updateDebuggerPausedLineDecoration(),{sync:!0}),a=O(()=>this._debuggerState.consoleLogs.length,()=>this.requestUpdate(),{sync:!0});this._disposables.push({dispose:()=>s.remove()},{dispose:()=>i.remove()},{dispose:()=>a.remove()});let o=this.editorInstance?.onMouseDown(r=>this._onEditorMouseDown(r));o&&this._disposables.push(o);let n=this.editorInstance?.onDidChangeModelContent(r=>this._onEditorModelContentChange(r));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].includes(e.target.type)||e.target.element?.classList.contains("codicon-gutter-lightbulb"))return;let s=e.target.position?.lineNumber;s&&this._debuggerState.toggleBreakpoint(s)}_onEditorModelContentChange(e){if(!this.enableDebugger||!this._debuggerState.editorBreakpoints.length||e.isFlush)return;let s=se(this._debuggerState.editorBreakpoints,e.changes);s.length===this._debuggerState.editorBreakpoints.length&&s.every((i,a)=>i===this._debuggerState.editorBreakpoints[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 F(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",stickiness:this._monacoEditor.TrackedRangeStickiness.NeverGrowsWhenTypingAtEdges}}]):this._debuggerPausedLineDecoration=void 0}_continueDebugSession(){this._debuggerState.continueDebug()}_abortExternalExecution(){this._externalExecutionAbortController?.abort(),this._externalExecutionAbortController=void 0}_stopDebugSession(){this._abortExternalExecution(),this._debuggerState.stopDebug({hidePanel:!1})}_resetDebugSession(){this._abortExternalExecution(),this._debuggerState.resetDebug(),this._executeScript("debug").catch(g(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()}async _executeWithExternalExecutor(e,s,i){if(!this.externalExecutor)return{type:"error",value:"Missing external executor",error:null};let a=new AbortController;this._abortExternalExecution(),this._externalExecutionAbortController=a;let o=i.console??(()=>{});try{if(e==="debug"){let{breakpoints:n,onDebugPause:r}=i;if(!n||!r)throw new Error("Missing debug execution options");return await this.externalExecutor.execute({mode:"debug",script:s,console:o,signal:a.signal,breakpoints:n,onDebugPause:r})}return await this.externalExecutor.execute({mode:"run",script:s,console:o,signal:a.signal})}catch(n){return{type:"error",value:(n instanceof Error?n:new Error(String(n))).message??"Execution failed",error:n instanceof Error?n:new Error(String(n)),compilationTime:0,executionTime:0,timeStamp:new Date}}finally{this._externalExecutionAbortController===a&&(this._externalExecutionAbortController=void 0)}}_executionContextChanged(){!this._canExecute&&this._executeScriptAction&&(this._disposeSafely(this._executeScriptAction),this._executeScriptAction=void 0),this._canExecute&&!this._executeScriptAction&&this._addExecuteScriptAction(),!this.testData&&this.enableDebugger&&this._debuggerState.clearForMissingTestData(),this._debuggerState.openedPanel==="debug-console"&&!this.enableDebugger&&this._debuggerState.closePanel(),this._debuggerState.showPanel&&this._executeScript("run").catch(g(this))}async _updateEditorProfile(){this._preparingArcade=!0;try{await v.setProfileForModel(this._modelId,this.profile,{locale:this.messages._t9nLocale,snippets:this.snippets}),this._editorProfile=v.getEditorProfileForModel(this._modelId)}catch{this._editorProfile=void 0}finally{this._editorProfilePromise=Promise.resolve(this._editorProfile),this._preparingArcade=!1}}async _updateApiLibrary(){this._apiLibrary=await v.getApiLibraryForModel(this._modelId)}_setExecutionPanel(e){this._debuggerState.setPanel(e)}async _executeScript(e){let s=this.testData,i=this.externalExecutor;if(!this._codeEditorElt.value||!s&&!i)return;let a=e==="debug"?this._debuggerState.startDebug():this._debuggerState.startRun();setTimeout(()=>{(async()=>{let o=this._codeEditorElt.value?.value??this.script,n={mode:e,console:u=>this._debuggerState.addConsoleLog(u),breakpoints:e==="debug"?this._debuggerState.debuggerBreakpoints:void 0};e==="debug"&&(n.onDebugPause=this._handleDebugPause.bind(this,a));let r,h;if(i){let u=await this._executeWithExternalExecutor(e,o,n);"result"in u?(r=u.result,h=u.timing):r=u}else if(s){let u=await this._editorProfilePromise;if(!u){this._debuggerState.fail({type:"error",value:"Missing editor profile",error:null});return}r=await N(u.definition,o,s,n)}else return;if(a===this._debuggerState.sessionId){if(e==="debug"){if($(r)){this._debuggerState.fail(r);return}this._debuggerState.completeDebug(r,h);return}if($(r))this._debuggerState.completeRun(r);else if(i){if(!h){this._debuggerState.fail({type:"error",value:"Missing execution timing",error:null});return}this._debuggerState.completeRun(r,{useDebugRenderer:!0,timing:h})}else 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(g(this))}_insertAsText(e){this._insertText(e.detail)}_insertText(e){this._codeEditorElt.value?.insertText(e).catch(g(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:[ie.F5],contextMenuGroupId:"code",contextMenuOrder:1,run:()=>{this._canExecute&&this._executeScript("run").catch(g(this))}});e&&(this._executeScriptAction=e,this._disposables.push(e))}_getAskAiBindingKey(){return ae.parse(this._modelId).toString()}_canRenderAskAiCodeActions(){let e=this._arcadeAssistantRemoteState;return e.shouldRender?e.availableFeatures.codeActions:!1}_canPromptWithArcadeAssistant(){let e=this._arcadeAssistantRemoteState;return e.shouldRender?e.availableFeatures.prompting:!1}_getAskAiCodeActions(e){if(!this._canRenderAskAiCodeActions())return[];if(!e.markers.length)return[];let s=this.messages.askarcadeassistant??"Ask Arcade Assistant",i=this._getAskAiBindingKey();return[{title:s,kind:re,diagnostics:e.markers,isPreferred:!1,isAI:!1,command:{id:ce,title:s,arguments:[i,this.messages.askarcadeassistantprompt??"Fix the errors in my script"]}}]}_syncAskAiAction(){if(!this.editorInstance)return;let e=this._getAskAiBindingKey();if(!this._arcadeAssistantRemoteState.shouldRender){this._askAiBindingKey&&(E(this._askAiBindingKey,void 0),this._askAiBindingKey=void 0);return}this._askAiBindingKey&&this._askAiBindingKey!==e&&E(this._askAiBindingKey,void 0),E(e,{provideCodeActions:({context:s})=>this._getAskAiCodeActions(s),run:s=>{this.openArcadeAssistant({prompt:s??this.messages.askarcadeassistantprompt??"Fix the errors in my script"}).catch(g(this))}}),this._askAiBindingKey=e}_disposeSafely(e){let s=this._disposables.indexOf(e);s!==-1&&this._disposables.splice(s,1),e.dispose()}async _updateArcadeAssistantRemoteState(){let e=this.arcadeAssistant;this.disableAssistant?this._arcadeAssistantRemoteState={shouldRender:!1}:this._arcadeAssistantRemoteState=await ve(e??{}),this._syncAskAiAction()}renderMainActionBar(){return this._usesBottomExecutionDrawer||!this._canExecute?null:l`<calcite-action-bar class="main-action-bar" layout=horizontal scale=s expanded expand-toggle-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(g(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=${v.languageId} .value=${this.script??""} .modelId=${this._modelId} @arcgisValueChange=${this._onCodeEditorValueChange} ${M(this._codeEditorElt)}></arcgis-code-editor>`}renderAction({id:e,label:s,icon:i,active:a,panelName:o,iconFlipRtl:n=!1,onClick:r=this._toggleSidePanel}){return l`<calcite-action id=${e??I} .text=${s} .textEnabled=${this.sideActionBarExpanded} .icon=${i} .active=${a} @click=${r} data-panel-name=${o??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,_arcadeAssistantRemoteState:s}=this;return l`<arcgis-language-api-panel slot=side-panel class=${f(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=${f(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,profilevariables:this.messages.profilevariables}}></arcgis-editor-variables>${this.suggestions?.length&&l`<arcgis-arcade-suggestions slot=side-panel class=${f(e==="suggestions"?"":"hidden")} .closed=${e!=="suggestions"} .suggestions=${this.suggestions} @arcgisInternalItemSelected=${this._insertAsText} @arcgisInternalClosePanel=${this._closeSidePanel} data-panel-name=none></arcgis-arcade-suggestions>`||""}${s?.shouldRender&&l`<arcgis-arcade-coding-assistant slot=side-panel class=${f(e==="arcade-assistant"?"":"hidden")} .closed=${e!=="arcade-assistant"} .insertText=${this._insertText.bind(this)} .closePanel=${this._closeSidePanel} .portalUrl=${s.portalUrl} .serviceUrl=${"serviceUrl"in s?s.serviceUrl:void 0} .helpBase=${s.helpBase} .promptingEnabled=${this._canPromptWithArcadeAssistant()} .feedbackServiceUrl=${s.feedbackServiceUrl} .editorRef=${this.el} .appVersion=${this.arcadeAssistant?.appVersion} .disableQuestionAnswerLogging=${this.arcadeAssistant?.disableQuestionAnswerLogging} .diagnostics=${this._diagnostics} ${M(this._arcadeAssistantElt)}></arcgis-arcade-coding-assistant>`||""}${this.customPanels?.map(i=>l`<calcite-flow slot=side-panel class=${f(e===i.id?"":"hidden")}>${i?.useFlows?i.renderer?.({closePanel:this._toggleSidePanel,insertText:this._insertText.bind(this),closed:e!==i.id,editorRef:this.el}):l`<calcite-flow-item .heading=${i.name} heading-level=2 closable .closed=${e!==i.id} @calciteFlowItemClose=${this._toggleSidePanel} .description=${i.description}>${i.renderer?.({closePanel:this._toggleSidePanel,insertText:this._insertText.bind(this),closed:e!==i.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} .executionTiming=${this._debuggerState.executionTiming} .consoleLogs=${this._debuggerState.consoleLogs} @arcgisInternalOpenedResultPanelChange=${this._onResultPanelChange} @arcgisInternalClosePanel=${this._onExecutionPanelClose}></arcgis-arcade-results>`}renderBottomExecutionBody(){let{showPanel:e,openedPanel:s,debugResult:i,isExecuting:a,mode:o}=this._debuggerState;if(!e)return null;let n=s==="debug-console"?"output":s;return this.enableDebugger&&s==="debug-console"?l`<arcgis-arcade-debugger-console slot=results-panel .modelId=${this._modelId} .debuggerStore=${this._debuggerState}></arcgis-arcade-debugger-console>`:s==="output"&&(o==="debug"||i)?l`<arcgis-arcade-debugger-output .outputTitle=${this.messages.output} slot=results-panel .debuggerStore=${this._debuggerState} .result=${i}></arcgis-arcade-debugger-output>`:l`<arcgis-arcade-results slot=results-panel class="bottom-results" .openedResultPanel=${n} .loading=${s==="console"&&this._debuggerState.isPaused?!1:a} .result=${this._debuggerState.runResult} .executionTiming=${this._debuggerState.executionTiming} .consoleLogs=${this._debuggerState.consoleLogs} hide-header @arcgisInternalOpenedResultPanelChange=${this._onResultPanelChange}></arcgis-arcade-results>`}renderBottomActionBar(){if(!this._usesBottomExecutionDrawer)return null;let{showPanel:e,hasExecuted:s,openedPanel:i,isDebugging:a,isPaused:o,isExecuting:n}=this._debuggerState,r=this.messages.continue??"Continue",h=this.messages.reset??"Reset",u=this.messages.stop??"Stop";return l`<div slot=bottom-action-bar class=${`main-action-bar bottom-action-bar ${e?"":"is-collapsed"}`}><calcite-action-bar class="bottom-action-bar__actions" layout=horizontal scale=s expand-toggle-disabled expanded><calcite-action-group scale=s>${this.enableDebugger&&a?l`<calcite-action id=debugger-continue-action .text=${r} icon=forward scale=s .disabled=${!o} @click=${this._continueDebugSession}></calcite-action><calcite-tooltip reference-element=debugger-continue-action placement=top><span>${r}</span></calcite-tooltip><calcite-action id=debugger-reset-action .text=${h} icon=reset scale=s @click=${this._resetDebugSession}></calcite-action><calcite-tooltip reference-element=debugger-reset-action placement=top><span>${h}</span></calcite-tooltip><calcite-action id=debugger-stop-action .text=${u} icon=circle-stop scale=s @click=${this._stopDebugSession}></calcite-action><calcite-tooltip reference-element=debugger-stop-action placement=top><span>${u}</span></calcite-tooltip>`:l`<calcite-action .text=${this.messages.run??""} text-enabled icon=play scale=s .loading=${this._preparingArcade||n} @click=${()=>{this._executeScript("run").catch(g(this))}}></calcite-action>${this.enableDebugger&&l`<calcite-action .disabled=${this._debuggerState.editorBreakpoints.length===0} .text=${this.messages.runanddebug??"Run and Debug"} text-enabled icon=debug-script scale=s .loading=${this._preparingArcade||n} @click=${()=>{this._executeScript("debug").catch(g(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")} .disabled=${this.enableDebugger&&this._debuggerState.mode==="debug"}></calcite-action>${this.enableDebugger&&l`<calcite-action .active=${i==="debug-console"&&e} .text=${this.messages.debugconsole??"Debug Console"} text-enabled scale=s icon=debug-script .disabled=${this._debuggerState.mode!=="debug"} @click=${()=>this._setExecutionPanel("debug-console")}></calcite-action>`||""}</calcite-action-group>`:null}</calcite-action-bar>${e?l`<calcite-action .text=${this.messages.close??"Close"} scale=s icon=x icon-flip-rtl @click=${this._onExecutionPanelClose} slot=actions-end></calcite-action>`:null}</div>`}render(){return l`<arcgis-code-editor-shell>${this.renderMainActionBar()}${this.renderMainPanel()}${this.renderBottomActionBar()}${this.renderResultsPanel()}${this.renderSidePanel()}${this.renderSideActionBar()}</arcgis-code-editor-shell>`}};J("arcgis-arcade-editor",z);return z},"config","identity/IdentityManager","core/reactiveUtils","core/Accessor","core/accessorSupport/decorators",a,b,c,d,e,h)
@@ -1,2 +1,2 @@
1
1
  /* COPYRIGHT Esri - https://js.arcgis.com/5.2/LICENSE.txt */
2
- import d from"./6EN2C75J.js";import c from"./KUL43ADE.js";import b from"./GATL6PSW.js";import"./VYEWIX5W.js";import a from"./STN3LSQR.js";import"./MZMKV7FA.js";import"./BHSILWSL.js";import"./J4I4EROF.js";import"./BZWB7A55.js";import"./XEK22IDA.js";import"./CMRUQ3BN.js";import"./UFF53OEH.js";import"./NHREAORV.js";import"./SMZ3LNZE.js";import"./BFPEJYVB.js";import"./DSQ2DQQL.js";import"./H6RQVSYM.js";export default $arcgis.t(([,,,{a:a,b:b,c:c}])=>{return{getSqlExprDiagnosticService:b,getSqlExprWorker:a,setupMode:c}},a,b,c,d)
2
+ import d from"./BGUYF4JI.js";import c from"./56P6FTYQ.js";import b from"./AQHAEA62.js";import"./SKBHZ7VS.js";import a from"./STN3LSQR.js";import"./MZMKV7FA.js";import"./BHSILWSL.js";import"./J4I4EROF.js";import"./BZWB7A55.js";import"./XEK22IDA.js";import"./CMRUQ3BN.js";import"./UFF53OEH.js";import"./NHREAORV.js";import"./A77A54OM.js";import"./BFPEJYVB.js";import"./DSQ2DQQL.js";import"./H6RQVSYM.js";export default $arcgis.t(([,,,{a:a,b:b,c:c}])=>{return{getSqlExprDiagnosticService:b,getSqlExprWorker:a,setupMode:c}},a,b,c,d)
@@ -1,2 +1,2 @@
1
1
  /* COPYRIGHT Esri - https://js.arcgis.com/5.2/LICENSE.txt */
2
- import{a as n}from"./4L2GLNTS.js";import{a as g}from"./VYEWIX5W.js";import{a as f}from"./E57Q2B63.js";import"./VK7LOSQ5.js";import{e as p,f as u}from"./BHSILWSL.js";import"./J4I4EROF.js";import"./BZWB7A55.js";import{G as a,H as m,L as h,h as d,j as l,n as c,s as o}from"./SMZ3LNZE.js";import"./BFPEJYVB.js";import"./H6RQVSYM.js";var b=d`: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)}calcite-flow{height:100%}calcite-block{p:first-of-type{margin-top:0}}calcite-list-item-group{background-color:var(--calcite-color-foreground-2)}calcite-flow{[slot=footer]{word-break:break-word}}.container{block-size:100%;display:grid;grid-template-rows:auto 1fr;overflow:hidden}.scrollable{min-block-size:0;overflow:auto}}`,r=class extends m{constructor(){super(...arguments),this.messages=f(),this._unselectItem=async()=>{this._selectedApiItem=void 0},this._filterValue="",this.languageId="arcade",this.hideDocumentationActions=!1,this.loading=!1,this.closed=!1,this.arcgisInternalClosePanel=c({bubbles:!1,composed:!1}),this.arcgisInternalItemSelected=c({bubbles:!1,composed:!1})}static{this.properties={_filterValue:16,_selectedApiItem:16,languageId:1,apiLibrary:0,hideDocumentationActions:5,loading:5,closed:5}}static{this.styles=b}willUpdate(e){if(e.has("apiLibrary")){if(!this._selectedApiItem)return;for(let i of this.apiLibrary??[])for(let t of i.items)if(t.name===this._selectedApiItem.name){this._selectedApiItem=t;return}this._selectedApiItem=void 0}}disconnectedCallback(){super.disconnectedCallback(),this._flowObserver?.disconnect()}flowFocusHandler(e){if(!e){this._flowObserver?.disconnect(),this._flowObserver=void 0;return}this._flowObserver||(this._flowObserver=new MutationObserver(()=>{u(e.querySelector("calcite-flow-item:last-child"),"calcite-input")}),this._flowObserver.observe(e,{attributes:!0,attributeFilter:["id"],childList:!0}))}_emitItemSelected(e,i){if(!i)return;let t=e;(!t.key||t.key==="Enter")&&(e.preventDefault(),this.arcgisInternalItemSelected.emit(i.completion.insertText??""))}_emitClose(){this.arcgisInternalClosePanel.emit()}_emitItemSelectedAndClose(e,i){let t=e;(!t.key||t.key==="Enter")&&(e.preventDefault(),this.arcgisInternalItemSelected.emit(i.completion.insertText??""))}_selectItem(e,i){e.stopPropagation(),this._selectedApiItem=i}_updateFilterValue(e){this._filterValue=e.currentTarget.value??""}_elementToMarkdown(e){e!==void 0&&(e.innerHTML=n(this._selectedApiItem.examples))}renderApiCategory(e){let i=g(e.items,"name",this._filterValue);return i.length?l`<calcite-list-item-group .heading=${e.title}>${i.map(t=>l`<calcite-list-item .label=${o(t.completion.detail)} @calciteListItemSelect=${s=>this._emitItemSelected(s,t)} @keydown=${s=>this._emitItemSelected(s,t)}><calcite-action slot=actions-end .text=${this.messages.expand??""} icon=chevron-right icon-flip-rtl scale=s @click=${s=>this._selectItem(s,t)}></calcite-action></calcite-list-item>`)}</calcite-list-item-group>`:null}renderApiItemFlowItem(){let e=this._selectedApiItem;return e?l`<calcite-flow-item heading-level=2 .heading=${this.messages.constantsandfunctions} .beforeBack=${this._unselectItem} closable @calciteFlowItemClose=${this._emitClose} selected>${this.hideDocumentationActions?null:l`<calcite-button width=half slot=footer appearance=outline kind=brand scale=s .href=${e.link} target=Help icon-start=information>${this.messages.moreinformation}</calcite-button>`}<calcite-button .width=${this.hideDocumentationActions?"full":"half"} slot=footer appearance=outline kind=brand icon-start=code scale=s @click=${i=>this._emitItemSelectedAndClose(i,e)} ${a(p)}>${this.messages.insert}</calcite-button><calcite-block expanded .heading=${o(e.completion.detail)}><div .innerHTML=${n(e.completion.documentation)??""}></div>${e.examples?l`<div ${a(this._elementToMarkdown)}></div>`:null}</calcite-block></calcite-flow-item>`:null}render(){if(this.closed)return null;let e=(this.apiLibrary??[]).map(t=>this.renderApiCategory(t)),i=e.every(t=>!t);return l`<calcite-flow ${a(this.flowFocusHandler)}><calcite-flow-item heading-level=2 .heading=${this.messages.constantsandfunctions} closable @calciteFlowItemClose=${this._emitClose} .selected=${!this._selectedApiItem}><div class="container"><calcite-input .value=${this._filterValue} icon=magnifying-glass clearable @calciteInputInput=${this._updateFilterValue} scale=m></calcite-input><div class="scrollable">${this.loading?l`<calcite-loader scale=s type=indeterminate .label=${this.messages.loading??"Loading"}></calcite-loader>`:l`<calcite-list .label=${this.messages.api??"API"}>${i?l`<div class="notice-container">${this.messages.noitems}</div>`:e}</calcite-list>`}</div></div></calcite-flow-item>${this.renderApiItemFlowItem()}</calcite-flow>`}};h("arcgis-language-api-panel",r);export{r as ArcgisLanguageApiPanel};
2
+ import{a as n}from"./4L2GLNTS.js";import{a as g}from"./SKBHZ7VS.js";import{a as f}from"./OLMW3NCS.js";import"./SSVSZDRA.js";import{e as p,f as u}from"./BHSILWSL.js";import"./J4I4EROF.js";import"./BZWB7A55.js";import{G as a,H as m,L as h,h as d,j as l,n as c,s as o}from"./A77A54OM.js";import"./BFPEJYVB.js";import"./H6RQVSYM.js";var b=d`: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)}calcite-flow{height:100%}calcite-block{p:first-of-type{margin-top:0}}calcite-list-item-group{background-color:var(--calcite-color-foreground-2)}calcite-flow{[slot=footer]{word-break:break-word}}.container{block-size:100%;display:grid;grid-template-rows:auto 1fr;overflow:hidden}.scrollable{min-block-size:0;overflow:auto}}`,r=class extends m{constructor(){super(...arguments),this.messages=f(),this._unselectItem=async()=>{this._selectedApiItem=void 0},this._filterValue="",this.languageId="arcade",this.hideDocumentationActions=!1,this.loading=!1,this.closed=!1,this.arcgisInternalClosePanel=c({bubbles:!1,composed:!1}),this.arcgisInternalItemSelected=c({bubbles:!1,composed:!1})}static{this.properties={_filterValue:16,_selectedApiItem:16,languageId:1,apiLibrary:0,hideDocumentationActions:5,loading:5,closed:5}}static{this.styles=b}willUpdate(e){if(e.has("apiLibrary")){if(!this._selectedApiItem)return;for(let i of this.apiLibrary??[])for(let t of i.items)if(t.name===this._selectedApiItem.name){this._selectedApiItem=t;return}this._selectedApiItem=void 0}}disconnectedCallback(){super.disconnectedCallback(),this._flowObserver?.disconnect()}flowFocusHandler(e){if(!e){this._flowObserver?.disconnect(),this._flowObserver=void 0;return}this._flowObserver||(this._flowObserver=new MutationObserver(()=>{u(e.querySelector("calcite-flow-item:last-child"),"calcite-input")}),this._flowObserver.observe(e,{attributes:!0,attributeFilter:["id"],childList:!0}))}_emitItemSelected(e,i){if(!i)return;let t=e;(!t.key||t.key==="Enter")&&(e.preventDefault(),this.arcgisInternalItemSelected.emit(i.completion.insertText??""))}_emitClose(){this.arcgisInternalClosePanel.emit()}_emitItemSelectedAndClose(e,i){let t=e;(!t.key||t.key==="Enter")&&(e.preventDefault(),this.arcgisInternalItemSelected.emit(i.completion.insertText??""))}_selectItem(e,i){e.stopPropagation(),this._selectedApiItem=i}_updateFilterValue(e){this._filterValue=e.currentTarget.value??""}_elementToMarkdown(e){e!==void 0&&(e.innerHTML=n(this._selectedApiItem.examples))}renderApiCategory(e){let i=g(e.items,"name",this._filterValue);return i.length?l`<calcite-list-item-group .heading=${e.title}>${i.map(t=>l`<calcite-list-item .label=${o(t.completion.detail)} @calciteListItemSelect=${s=>this._emitItemSelected(s,t)} @keydown=${s=>this._emitItemSelected(s,t)}><calcite-action slot=actions-end .text=${this.messages.expand??""} icon=chevron-right icon-flip-rtl scale=s @click=${s=>this._selectItem(s,t)}></calcite-action></calcite-list-item>`)}</calcite-list-item-group>`:null}renderApiItemFlowItem(){let e=this._selectedApiItem;return e?l`<calcite-flow-item heading-level=2 .heading=${this.messages.constantsandfunctions} .beforeBack=${this._unselectItem} closable @calciteFlowItemClose=${this._emitClose} selected>${this.hideDocumentationActions?null:l`<calcite-button width=half slot=footer appearance=outline kind=brand scale=s .href=${e.link} target=Help icon-start=information>${this.messages.moreinformation}</calcite-button>`}<calcite-button .width=${this.hideDocumentationActions?"full":"half"} slot=footer appearance=outline kind=brand icon-start=code scale=s @click=${i=>this._emitItemSelectedAndClose(i,e)} ${a(p)}>${this.messages.insert}</calcite-button><calcite-block expanded .heading=${o(e.completion.detail)}><div .innerHTML=${n(e.completion.documentation)??""}></div>${e.examples?l`<div ${a(this._elementToMarkdown)}></div>`:null}</calcite-block></calcite-flow-item>`:null}render(){if(this.closed)return null;let e=(this.apiLibrary??[]).map(t=>this.renderApiCategory(t)),i=e.every(t=>!t);return l`<calcite-flow ${a(this.flowFocusHandler)}><calcite-flow-item heading-level=2 .heading=${this.messages.constantsandfunctions} closable @calciteFlowItemClose=${this._emitClose} .selected=${!this._selectedApiItem}><div class="container"><calcite-input .value=${this._filterValue} icon=magnifying-glass clearable @calciteInputInput=${this._updateFilterValue} scale=m></calcite-input><div class="scrollable">${this.loading?l`<calcite-loader scale=s type=indeterminate .label=${this.messages.loading??"Loading"}></calcite-loader>`:l`<calcite-list .label=${this.messages.api??"API"}>${i?l`<div class="notice-container">${this.messages.noitems}</div>`:e}</calcite-list>`}</div></div></calcite-flow-item>${this.renderApiItemFlowItem()}</calcite-flow>`}};h("arcgis-language-api-panel",r);export{r as ArcgisLanguageApiPanel};