@arcgis/coding-components 5.1.0-next.21 → 5.1.0-next.22

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.
@@ -1,2 +1,2 @@
1
1
  /* COPYRIGHT Esri - https://js.arcgis.com/5.1/LICENSE.txt */
2
- import a from"./7LS3R4TH.js";import{b as m,c as y,d as h}from"./BQLG62QR.js";import{g as f}from"./WMLTLTIE.js";import{K as u}from"./EMMNZESW.js";export default $arcgis.t(([{d:b,f:d,j:g,l:F,m:M}])=>{var w=o=>{let t=o.variables[0],i=t?.type==="featureSet"?A(t):void 0,{apiVersion:e,bundles:a,hiddenApiItems:r}=o.toEditorProfileDefinition();return{apiVersion:e,bundles:a,variables:i?[i]:[],hiddenApiItems:r?.map(s=>s.toLowerCase())}};function A(o){let{name:t}=o,i=o.getDescription(),{definition:e}=o.toProfileVariableDefinition(),a={label:t,detail:t,insertText:t,insertTextMode:h.asIs,insertTextFormat:y.PlainText,kind:m.Field},r={name:t,description:i,type:"dictionary",properties:[],completion:a};if(!e||!("fields"in e))return r;let[s,l]=g(e.fields,i);return r.properties=s,a.documentation={kind:"markdown",value:l},r}var P={id:"field-calculation",variables:[{name:"$layer",type:"featureSet",description:"The layer being calculated."}]};function T(){return P}function I(o){if(!d(o))return;let t=T();if(!t)return;let i={variables:[],hiddenApiItems:o.hiddenApiItems?.map(e=>e.toLowerCase())};return t.variables.forEach(e=>{if(o.disabledVariables?.includes(e.name))return;let a=o.definitions[e.name];switch(e.type){case"featureSet":return b(a)?i.variables.push({...e,type:e.type,definition:a}):void 0;default:throw Error(`sdkVariable type not supported (yet) type: ${e.type}`)}}),i}var x="arcgis-sql-expression",p=class extends M{constructor(){super(x,{apiPath:"./assets/sql-language/api",apiPrefix:"sql-api.t9n."}),this._languageId=x,this._layerMap=new Map}updateFeatureLayerForModel(t,i){let e=this._getApiKey(t);this._layerMap.set(e,i)}getFeatureLayerForModel(t){let i=this._getApiKey(t);return this._layerMap.get(i)}async setProfileForModel(t,i,e={locale:"en"}){d(i)&&(i=I(i));let a=await f(e.locale,u("./assets/editor-profile/t9n"),"messages.");if(!a)throw new Error(`Failed to load the language bundle for ${e.locale}`);this.disposeForModel(t);let r=this._getApiKey(t),s=new F(i,a);this._modelToProfileMap.set(r,s);let l=w(s);this.updateApiContextForModel(t,{locale:e.locale,profile:l});let c=i?.variables?.find(v=>v.name==="$layer");c&&this.updateFeatureLayerForModel(t,c.definition)}},n=new p,k={setProfileForModel:n.setProfileForModel.bind(n),getApiLibraryForModel:n.getApiLibraryForModel.bind(n)};async function C(){return await import("./OSU57IUK.js").then(m=>m.default)}return{a:n,b:C}},a)
2
+ import a from"./NQVNVOQR.js";import{b as m,c as y,d as h}from"./BQLG62QR.js";import{g as f}from"./WMLTLTIE.js";import{K as u}from"./Q5SGN46H.js";export default $arcgis.t(([{d:b,f:d,j:g,l:F,m:M}])=>{var w=o=>{let t=o.variables[0],i=t?.type==="featureSet"?A(t):void 0,{apiVersion:e,bundles:a,hiddenApiItems:r}=o.toEditorProfileDefinition();return{apiVersion:e,bundles:a,variables:i?[i]:[],hiddenApiItems:r?.map(s=>s.toLowerCase())}};function A(o){let{name:t}=o,i=o.getDescription(),{definition:e}=o.toProfileVariableDefinition(),a={label:t,detail:t,insertText:t,insertTextMode:h.asIs,insertTextFormat:y.PlainText,kind:m.Field},r={name:t,description:i,type:"dictionary",properties:[],completion:a};if(!e||!("fields"in e))return r;let[s,l]=g(e.fields,i);return r.properties=s,a.documentation={kind:"markdown",value:l},r}var P={id:"field-calculation",variables:[{name:"$layer",type:"featureSet",description:"The layer being calculated."}]};function T(){return P}function I(o){if(!d(o))return;let t=T();if(!t)return;let i={variables:[],hiddenApiItems:o.hiddenApiItems?.map(e=>e.toLowerCase())};return t.variables.forEach(e=>{if(o.disabledVariables?.includes(e.name))return;let a=o.definitions[e.name];switch(e.type){case"featureSet":return b(a)?i.variables.push({...e,type:e.type,definition:a}):void 0;default:throw Error(`sdkVariable type not supported (yet) type: ${e.type}`)}}),i}var x="arcgis-sql-expression",p=class extends M{constructor(){super(x,{apiPath:"./assets/sql-language/api",apiPrefix:"sql-api.t9n."}),this._languageId=x,this._layerMap=new Map}updateFeatureLayerForModel(t,i){let e=this._getApiKey(t);this._layerMap.set(e,i)}getFeatureLayerForModel(t){let i=this._getApiKey(t);return this._layerMap.get(i)}async setProfileForModel(t,i,e={locale:"en"}){d(i)&&(i=I(i));let a=await f(e.locale,u("./assets/editor-profile/t9n"),"messages.");if(!a)throw new Error(`Failed to load the language bundle for ${e.locale}`);this.disposeForModel(t);let r=this._getApiKey(t),s=new F(i,a);this._modelToProfileMap.set(r,s);let l=w(s);this.updateApiContextForModel(t,{locale:e.locale,profile:l});let c=i?.variables?.find(v=>v.name==="$layer");c&&this.updateFeatureLayerForModel(t,c.definition)}},n=new p,k={setProfileForModel:n.setProfileForModel.bind(n),getApiLibraryForModel:n.getApiLibraryForModel.bind(n)};async function C(){return await import("./ILTZ7D4H.js").then(m=>m.default)}return{a:n,b:C}},a)
@@ -1,2 +1,2 @@
1
1
  /* COPYRIGHT Esri - https://js.arcgis.com/5.1/LICENSE.txt */
2
- import{a as v}from"./77GSSZOD.js";import{b,c as r,d as _}from"./WTNM2NCZ.js";import{a as p}from"./ZYS253RG.js";import"./P5D2YYFD.js";import{a as f}from"./QWLPT7LO.js";import"./NKCYMRE4.js";import"./BQLG62QR.js";import{d as h,e as m}from"./WMLTLTIE.js";import"./UYBZWFE5.js";import{E as c,F as d,J as u,h as g,j as s,l,n as a}from"./EMMNZESW.js";import"./BCUUVBXH.js";import"./YLN7EMJC.js";import"./GHSEU7VA.js";import"./4OSKRQ5X.js";import"./NG7S6FUK.js";import"./3TTFCHAA.js";function S(o){return!Array.isArray(o)||!o.length?!1:Array.isArray(o[0].suggestions)}var $=g`:host{background-color:var(--calcite-color-foreground-1);.notice-container{margin:var(--calcite-spacing-xxs);padding:var(--calcite-spacing-sm);background-color:var(--calcite-color-foreground-1)}.sticky{position:sticky;top:0;z-index:10}calcite-flow{height:100%}calcite-block{p:first-of-type{margin-top:0}code{font-family:var(--calcite-code-family)}pre{direction:ltr;overflow-x:auto;background-color:var(--calcite-color-foreground-2);padding:var(--calcite-spacing-sm);code{font-size:var(--calcite-font-size--2)}}}calcite-list-item-group{background-color:var(--calcite-color-foreground-2)}calcite-flow{[slot=footer]{word-break:break-word}}}`,n=class extends d{constructor(){super(...arguments),this._beforeBack=async()=>{this._selectedSuggestion=void 0},this.messages=p(),this._colorizeStyle="",this._filterValue="",this.closed=!1,this.arcgisInternalClosePanel=a({bubbles:!1,composed:!1}),this.arcgisInternalItemSelected=a({bubbles:!1,composed:!1})}static{this.properties={_colorizeStyle:16,_filterValue:16,_selectedSuggestion:16,suggestions:0,closed:5}}static{this.styles=$}load(){this._colorizeStyle=r(),this._themeChangedListener=_(()=>this._colorizeStyle=r())}willUpdate(e){e.has("suggestions")&&this.suggestionsPropChanged()}disconnectedCallback(){super.disconnectedCallback(),this._flowObserver?.disconnect(),this._themeChangedListener?.dispose()}suggestionsPropChanged(){this._selectedSuggestion=void 0}flowFocusHandler(e){if(!e){this._flowObserver?.disconnect(),this._flowObserver=void 0;return}this._flowObserver||(this._flowObserver=new MutationObserver(()=>{m(e.querySelector("calcite-flow-item:last-child"),"calcite-input")}),this._flowObserver.observe(e,{attributes:!0,attributeFilter:["id"],childList:!0}))}_updateFilterValue(e){this._filterValue=e.currentTarget?.value??""}_emitItemSelected(e,t){let i=e;(!i.key||i.key==="Enter")&&(e.preventDefault(),this.arcgisInternalItemSelected.emit(t.code))}_showSuggestionDetail(e,t){e.stopPropagation(),this._selectedSuggestion=t}_emitClose(){this.arcgisInternalClosePanel.emit()}_colorizeCode(e){e!==void 0&&b(e,this._selectedSuggestion.code,"arcade")}renderSuggestionGroups(){return this.suggestions===void 0?null:S(this.suggestions)?this.suggestions.map(e=>s`<calcite-list-item-group .heading=${e.label}>${this.renderSuggestionListItems(e.suggestions)}</calcite-list-item-group>`):this.renderSuggestionListItems(this.suggestions)}renderSuggestionListItems(e){return e=f(e,"label",this._filterValue),e.length?e.map(t=>s`<calcite-list-item .label=${t.label} .description=${t.description} @calciteListItemSelect=${i=>this._emitItemSelected(i,t)} @keydown=${i=>this._emitItemSelected(i,t)} data-item=${t??l}><calcite-action slot=actions-end .text=${this.messages.expand??""} scale=s icon=chevron-right icon-flip-rtl @click=${i=>this._showSuggestionDetail(i,t)} data-item=${t??l}></calcite-action></calcite-list-item>`):s`<div class="notice-container">${this.messages.noitems}</div>`}renderSuggestionFlowItem(){let e=this._selectedSuggestion;return e?s`<calcite-flow-item heading-level=2 .heading=${this.messages.suggestions} closable @calciteFlowItemClose=${this._emitClose} .beforeBack=${this._beforeBack} selected><calcite-button width=half slot=footer appearance=outline kind=brand icon-start=code scale=s @click=${t=>this._emitItemSelected(t,e)} data-item=${e??l} ${c(h)}>${this.messages.insert}</calcite-button><calcite-block open .heading=${e.label} .description=${e.description}><div .innerHTML=${v(e.documentation)??""}></div><pre><code ${c(this._colorizeCode)}></code></pre></calcite-block></calcite-flow-item>`:null}render(){return this.closed?null:s`<style>${this._colorizeStyle}</style><calcite-flow ${c(this.flowFocusHandler)}><calcite-flow-item heading-level=2 .heading=${this.messages.suggestions} closable @calciteFlowItemClose=${this._emitClose} .selected=${!this._selectedSuggestion}><calcite-input .value=${this._filterValue} icon=magnifying-glass clearable @calciteInputInput=${this._updateFilterValue} class="sticky" scale=m></calcite-input><calcite-list .label=${this.messages.suggestions??"Suggestions"}>${this.renderSuggestionGroups()}</calcite-list></calcite-flow-item>${this.renderSuggestionFlowItem()}</calcite-flow>`}};u("arcgis-arcade-suggestions",n);export{n as ArcgisArcadeSuggestions};
2
+ import{a as v}from"./77GSSZOD.js";import{b,c as r,d as _}from"./WTNM2NCZ.js";import{a as p}from"./QNAUGPWS.js";import"./PWVGWGF5.js";import{a as f}from"./PJHAQGOB.js";import"./NKCYMRE4.js";import"./BQLG62QR.js";import{d as h,e as m}from"./WMLTLTIE.js";import"./UYBZWFE5.js";import{E as c,F as d,J as u,h as g,j as s,l,n as a}from"./Q5SGN46H.js";import"./BCUUVBXH.js";import"./YLN7EMJC.js";import"./GHSEU7VA.js";import"./4OSKRQ5X.js";import"./NG7S6FUK.js";import"./3TTFCHAA.js";function S(o){return!Array.isArray(o)||!o.length?!1:Array.isArray(o[0].suggestions)}var $=g`:host{background-color:var(--calcite-color-foreground-1);.notice-container{margin:var(--calcite-spacing-xxs);padding:var(--calcite-spacing-sm);background-color:var(--calcite-color-foreground-1)}.sticky{position:sticky;top:0;z-index:10}calcite-flow{height:100%}calcite-block{p:first-of-type{margin-top:0}code{font-family:var(--calcite-code-family)}pre{direction:ltr;overflow-x:auto;background-color:var(--calcite-color-foreground-2);padding:var(--calcite-spacing-sm);code{font-size:var(--calcite-font-size--2)}}}calcite-list-item-group{background-color:var(--calcite-color-foreground-2)}calcite-flow{[slot=footer]{word-break:break-word}}}`,n=class extends d{constructor(){super(...arguments),this._beforeBack=async()=>{this._selectedSuggestion=void 0},this.messages=p(),this._colorizeStyle="",this._filterValue="",this.closed=!1,this.arcgisInternalClosePanel=a({bubbles:!1,composed:!1}),this.arcgisInternalItemSelected=a({bubbles:!1,composed:!1})}static{this.properties={_colorizeStyle:16,_filterValue:16,_selectedSuggestion:16,suggestions:0,closed:5}}static{this.styles=$}load(){this._colorizeStyle=r(),this._themeChangedListener=_(()=>this._colorizeStyle=r())}willUpdate(e){e.has("suggestions")&&this.suggestionsPropChanged()}disconnectedCallback(){super.disconnectedCallback(),this._flowObserver?.disconnect(),this._themeChangedListener?.dispose()}suggestionsPropChanged(){this._selectedSuggestion=void 0}flowFocusHandler(e){if(!e){this._flowObserver?.disconnect(),this._flowObserver=void 0;return}this._flowObserver||(this._flowObserver=new MutationObserver(()=>{m(e.querySelector("calcite-flow-item:last-child"),"calcite-input")}),this._flowObserver.observe(e,{attributes:!0,attributeFilter:["id"],childList:!0}))}_updateFilterValue(e){this._filterValue=e.currentTarget?.value??""}_emitItemSelected(e,t){let i=e;(!i.key||i.key==="Enter")&&(e.preventDefault(),this.arcgisInternalItemSelected.emit(t.code))}_showSuggestionDetail(e,t){e.stopPropagation(),this._selectedSuggestion=t}_emitClose(){this.arcgisInternalClosePanel.emit()}_colorizeCode(e){e!==void 0&&b(e,this._selectedSuggestion.code,"arcade")}renderSuggestionGroups(){return this.suggestions===void 0?null:S(this.suggestions)?this.suggestions.map(e=>s`<calcite-list-item-group .heading=${e.label}>${this.renderSuggestionListItems(e.suggestions)}</calcite-list-item-group>`):this.renderSuggestionListItems(this.suggestions)}renderSuggestionListItems(e){return e=f(e,"label",this._filterValue),e.length?e.map(t=>s`<calcite-list-item .label=${t.label} .description=${t.description} @calciteListItemSelect=${i=>this._emitItemSelected(i,t)} @keydown=${i=>this._emitItemSelected(i,t)} data-item=${t??l}><calcite-action slot=actions-end .text=${this.messages.expand??""} scale=s icon=chevron-right icon-flip-rtl @click=${i=>this._showSuggestionDetail(i,t)} data-item=${t??l}></calcite-action></calcite-list-item>`):s`<div class="notice-container">${this.messages.noitems}</div>`}renderSuggestionFlowItem(){let e=this._selectedSuggestion;return e?s`<calcite-flow-item heading-level=2 .heading=${this.messages.suggestions} closable @calciteFlowItemClose=${this._emitClose} .beforeBack=${this._beforeBack} selected><calcite-button width=half slot=footer appearance=outline kind=brand icon-start=code scale=s @click=${t=>this._emitItemSelected(t,e)} data-item=${e??l} ${c(h)}>${this.messages.insert}</calcite-button><calcite-block open .heading=${e.label} .description=${e.description}><div .innerHTML=${v(e.documentation)??""}></div><pre><code ${c(this._colorizeCode)}></code></pre></calcite-block></calcite-flow-item>`:null}render(){return this.closed?null:s`<style>${this._colorizeStyle}</style><calcite-flow ${c(this.flowFocusHandler)}><calcite-flow-item heading-level=2 .heading=${this.messages.suggestions} closable @calciteFlowItemClose=${this._emitClose} .selected=${!this._selectedSuggestion}><calcite-input .value=${this._filterValue} icon=magnifying-glass clearable @calciteInputInput=${this._updateFilterValue} class="sticky" scale=m></calcite-input><calcite-list .label=${this.messages.suggestions??"Suggestions"}>${this.renderSuggestionGroups()}</calcite-list></calcite-flow-item>${this.renderSuggestionFlowItem()}</calcite-flow>`}};u("arcgis-arcade-suggestions",n);export{n as ArcgisArcadeSuggestions};
@@ -1,5 +1,5 @@
1
1
  /* COPYRIGHT Esri - https://js.arcgis.com/5.1/LICENSE.txt */
2
- import{a as X,b as Y,c as Z,d as f,e as y}from"./IFNCCZ7O.js";import{b as Q}from"./QWLPT7LO.js";import{a as ee}from"./NKCYMRE4.js";import{b as S,c as v,d as F,e as J}from"./BQLG62QR.js";import{i as H}from"./WMLTLTIE.js";import{K as z,r as B,t as $}from"./EMMNZESW.js";import{a as u}from"./BCUUVBXH.js";import{Qk as A,Zk as L}from"./NG7S6FUK.js";export default $arcgis.t(([T,me,be,ge,we,{getDeclaredVoxelMembers:Ce,getDeclaredPixelMembers:De}])=>{var j=t=>t!==void 0,x=t=>t!==null;function pe(t){return!!t&&typeof t=="object"&&"declaredClass"in t&&typeof t.declaredClass=="string"&&t.declaredClass.startsWith("esri.layers.")&&M(t)&&"queryFeatures"in t&&typeof t.queryFeatures=="function"}function ce(t){return!!t&&typeof t=="object"&&"declaredClass"in t&&typeof t.declaredClass=="string"&&(t.declaredClass==="esri.Map"||t.declaredClass==="esri.WebMap"||t.declaredClass==="esri.WebScene")}function Se(t){return!!t&&typeof t=="object"&&"loadAll"in t&&typeof t.loadAll=="function"}function ue(t){return!!t&&typeof t=="object"&&"portalItem"in t&&t.portalItem!=null}function he(t){return!!t&&typeof t=="object"&&"portalItem"in t&&t.portalItem!=null}function M(t){return!!t&&typeof t=="object"&&"fields"in t&&Array.isArray(t.fields)}function V(t){return!!t&&typeof t=="object"&&"url"in t&&typeof t.url=="string"}function ve(t){return V(t)&&/\/(?:featureserver|mapserver)(?:\/|$)/iu.test(t.url??"")}function de(t){return V(t)||M(t)||he(t)}function rt(t){return de(t)&&"type"in t&&t.type==="voxel"}function st(t){return de(t)&&"type"in t&&(t.type==="imagery"||t.type==="imagery-tile")}function nt(t){return V(t)||M(t)||he(t)}function ot(t){return ue(t)||ce(t)||ve(t)}function te(t){return!!t&&typeof t=="object"&&"declaredClass"in t&&t.declaredClass==="esri.layers.support.Subtype"}function E(t){return!!t&&typeof t=="object"&&"declaredClass"in t&&t.declaredClass==="esri.layers.support.CodedValueDomain"}function Fe(t){return!!t&&typeof t=="object"&&"declaredClass"in t&&t.declaredClass==="esri.layers.support.InheritedDomain"}function at(t){return!!t&&typeof t=="object"&&"id"in t&&typeof t.id=="string"&&"definitions"in t&&typeof t.definitions=="object"&&!Array.isArray(t.definitions)}function d(t){return!!t&&typeof t=="object"&&"title"in t&&typeof t.title=="string"}function xe(t){return!!t&&typeof t=="object"&&"url"in t&&typeof t.url=="string"}function fe(t){return!!t&&typeof t=="object"&&"layerId"in t&&typeof t.layerId=="number"}function N(t){return!!t&&typeof t=="object"&&"typeIdField"in t&&"types"in t}function ie(t){return!!t&&typeof t=="object"&&"getFieldDomain"in t&&typeof t.getFieldDomain=="function"}function _(t){return!!t&&typeof t=="object"&&"subtypeField"in t}function Te(t){return _(t)&&"subtypes"in t}function Ie(t){return!!t&&typeof t=="object"&&"portalItem"in t}function Pe(t){return fe(t)&&"relationships"in t&&"url"in t&&Array.isArray(t.relationships)&&typeof t.url=="string"}function Me(t){return!!t&&typeof t=="object"&&"isTable"in t&&typeof t.isTable=="boolean"}function Ve(t){if(t&&typeof t=="object"){if(Me(t))return t.isTable||"type"in t&&t.type==="table";if("geometryType"in t)return t.geometryType===""||t.geometryType==="esriGeometryNull"||t.geometryType===null}return!1}function $e(t){return!Ve(t)}function Ae(t){return!!t&&typeof t=="object"&&"load"in t&&typeof t.load=="function"}function Le(t){return!!t&&typeof t=="object"&&"type"in t&&t.type==="voxel"}function re(t){return!!t&&typeof t=="object"&&"type"in t&&typeof t.type=="string"&&["imagery","imagery-tile"].includes(t.type)}async function ye(t){if(!t)return null;let e;return M(t)?e=t:e=new T(t),Ae(e)&&await e.load(),e}async function je(t){t+="/layers";let e=await me(t,{responseType:"json",query:{f:"json"}}),i=t.endsWith("MapServer/layers")?"data":"query",r=se(e.data?.layers,i),s=se(e.data?.tables,i);return{layers:r,tables:s}}function se(t,e){return t?t.filter(i=>{switch(i.type){case"Feature Layer":case"Oriented Imagery Layer":case"Catalog Layer":case"Table":return(i.capabilities?i.capabilities.toLowerCase().split(",").map(r=>r.trim()):[]).includes(e);default:return!1}}):[]}async function Ee(t,e){let i=new T({url:`${t.url}/${e.relatedTableId}`});return await i.load(),i}function O(t){return(e,i)=>{if(e.type==="oid")return-1;if(i.type==="oid")return 1;if(_(t)){if(e.name===t.subtypeField)return-1;if(i.name===t.subtypeField)return 1}if(N(t)){if(e.name===t.typeIdField)return-1;if(i.name===t.typeIdField)return 1}return e.name.localeCompare(i.name,"en",{sensitivity:"base"})}}function ne(t,e){return t?.every(i=>i.domains?.[e.name]?.type==="inherited")??!1}var Ne=/^[a-z_$][a-z0-9_$]*$/giu;function K(t,e=!0){return t.match(Ne)?`${e?".":""}${t}`:`["${t}"]`}function _e(t,e){return t?`${t}${K(e)}`:e}function oe(t){return Ie(t)?t.portalItem:null}function lt(t,e,i=!1){let r=e,s=[],o=[];return f(t).forEach(n=>{r&&(r+=`
2
+ import{a as X,b as Y,c as Z,d as f,e as y}from"./IFNCCZ7O.js";import{b as Q}from"./PJHAQGOB.js";import{a as ee}from"./NKCYMRE4.js";import{b as S,c as v,d as F,e as J}from"./BQLG62QR.js";import{i as H}from"./WMLTLTIE.js";import{K as z,r as B,t as $}from"./Q5SGN46H.js";import{a as u}from"./BCUUVBXH.js";import{Qk as A,Zk as L}from"./NG7S6FUK.js";export default $arcgis.t(([T,me,be,ge,we,{getDeclaredVoxelMembers:Ce,getDeclaredPixelMembers:De}])=>{var j=t=>t!==void 0,x=t=>t!==null;function pe(t){return!!t&&typeof t=="object"&&"declaredClass"in t&&typeof t.declaredClass=="string"&&t.declaredClass.startsWith("esri.layers.")&&M(t)&&"queryFeatures"in t&&typeof t.queryFeatures=="function"}function ce(t){return!!t&&typeof t=="object"&&"declaredClass"in t&&typeof t.declaredClass=="string"&&(t.declaredClass==="esri.Map"||t.declaredClass==="esri.WebMap"||t.declaredClass==="esri.WebScene")}function Se(t){return!!t&&typeof t=="object"&&"loadAll"in t&&typeof t.loadAll=="function"}function ue(t){return!!t&&typeof t=="object"&&"portalItem"in t&&t.portalItem!=null}function he(t){return!!t&&typeof t=="object"&&"portalItem"in t&&t.portalItem!=null}function M(t){return!!t&&typeof t=="object"&&"fields"in t&&Array.isArray(t.fields)}function V(t){return!!t&&typeof t=="object"&&"url"in t&&typeof t.url=="string"}function ve(t){return V(t)&&/\/(?:featureserver|mapserver)(?:\/|$)/iu.test(t.url??"")}function de(t){return V(t)||M(t)||he(t)}function rt(t){return de(t)&&"type"in t&&t.type==="voxel"}function st(t){return de(t)&&"type"in t&&(t.type==="imagery"||t.type==="imagery-tile")}function nt(t){return V(t)||M(t)||he(t)}function ot(t){return ue(t)||ce(t)||ve(t)}function te(t){return!!t&&typeof t=="object"&&"declaredClass"in t&&t.declaredClass==="esri.layers.support.Subtype"}function E(t){return!!t&&typeof t=="object"&&"declaredClass"in t&&t.declaredClass==="esri.layers.support.CodedValueDomain"}function Fe(t){return!!t&&typeof t=="object"&&"declaredClass"in t&&t.declaredClass==="esri.layers.support.InheritedDomain"}function at(t){return!!t&&typeof t=="object"&&"id"in t&&typeof t.id=="string"&&"definitions"in t&&typeof t.definitions=="object"&&!Array.isArray(t.definitions)}function d(t){return!!t&&typeof t=="object"&&"title"in t&&typeof t.title=="string"}function xe(t){return!!t&&typeof t=="object"&&"url"in t&&typeof t.url=="string"}function fe(t){return!!t&&typeof t=="object"&&"layerId"in t&&typeof t.layerId=="number"}function N(t){return!!t&&typeof t=="object"&&"typeIdField"in t&&"types"in t}function ie(t){return!!t&&typeof t=="object"&&"getFieldDomain"in t&&typeof t.getFieldDomain=="function"}function _(t){return!!t&&typeof t=="object"&&"subtypeField"in t}function Te(t){return _(t)&&"subtypes"in t}function Ie(t){return!!t&&typeof t=="object"&&"portalItem"in t}function Pe(t){return fe(t)&&"relationships"in t&&"url"in t&&Array.isArray(t.relationships)&&typeof t.url=="string"}function Me(t){return!!t&&typeof t=="object"&&"isTable"in t&&typeof t.isTable=="boolean"}function Ve(t){if(t&&typeof t=="object"){if(Me(t))return t.isTable||"type"in t&&t.type==="table";if("geometryType"in t)return t.geometryType===""||t.geometryType==="esriGeometryNull"||t.geometryType===null}return!1}function $e(t){return!Ve(t)}function Ae(t){return!!t&&typeof t=="object"&&"load"in t&&typeof t.load=="function"}function Le(t){return!!t&&typeof t=="object"&&"type"in t&&t.type==="voxel"}function re(t){return!!t&&typeof t=="object"&&"type"in t&&typeof t.type=="string"&&["imagery","imagery-tile"].includes(t.type)}async function ye(t){if(!t)return null;let e;return M(t)?e=t:e=new T(t),Ae(e)&&await e.load(),e}async function je(t){t+="/layers";let e=await me(t,{responseType:"json",query:{f:"json"}}),i=t.endsWith("MapServer/layers")?"data":"query",r=se(e.data?.layers,i),s=se(e.data?.tables,i);return{layers:r,tables:s}}function se(t,e){return t?t.filter(i=>{switch(i.type){case"Feature Layer":case"Oriented Imagery Layer":case"Catalog Layer":case"Table":return(i.capabilities?i.capabilities.toLowerCase().split(",").map(r=>r.trim()):[]).includes(e);default:return!1}}):[]}async function Ee(t,e){let i=new T({url:`${t.url}/${e.relatedTableId}`});return await i.load(),i}function O(t){return(e,i)=>{if(e.type==="oid")return-1;if(i.type==="oid")return 1;if(_(t)){if(e.name===t.subtypeField)return-1;if(i.name===t.subtypeField)return 1}if(N(t)){if(e.name===t.typeIdField)return-1;if(i.name===t.typeIdField)return 1}return e.name.localeCompare(i.name,"en",{sensitivity:"base"})}}function ne(t,e){return t?.every(i=>i.domains?.[e.name]?.type==="inherited")??!1}var Ne=/^[a-z_$][a-z0-9_$]*$/giu;function K(t,e=!0){return t.match(Ne)?`${e?".":""}${t}`:`["${t}"]`}function _e(t,e){return t?`${t}${K(e)}`:e}function oe(t){return Ie(t)?t.portalItem:null}function lt(t,e,i=!1){let r=e,s=[],o=[];return f(t).forEach(n=>{r&&(r+=`
3
3
 
4
4
  `),r+=`**${n.name}** (${n.alias})
5
5
  ${n.type}`,n.description&&(r+=`
@@ -1,2 +1,2 @@
1
1
  /* COPYRIGHT Esri - https://js.arcgis.com/5.1/LICENSE.txt */
2
- import{a as n}from"./77GSSZOD.js";import{a as f}from"./ZYS253RG.js";import"./P5D2YYFD.js";import{a as g}from"./QWLPT7LO.js";import"./BQLG62QR.js";import{d as p,e as u}from"./WMLTLTIE.js";import{E as a,F as d,J as h,h as m,j as s,n as c,r as o}from"./EMMNZESW.js";import"./BCUUVBXH.js";import"./3TTFCHAA.js";var b=m`: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}}calcite-list-item-group{background-color:var(--calcite-color-foreground-2)}calcite-flow{[slot=footer]{word-break:break-word}}}`,r=class extends d{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?s`<calcite-list-item-group .heading=${e.title}>${i.map(t=>s`<calcite-list-item .label=${o(t.completion.detail)} @calciteListItemSelect=${l=>this._emitItemSelected(l,t)} @keydown=${l=>this._emitItemSelected(l,t)}><calcite-action slot=actions-end .text=${this.messages.expand??""} icon=chevron-right icon-flip-rtl scale=s @click=${l=>this._selectItem(l,t)}></calcite-action></calcite-list-item>`)}</calcite-list-item-group>`:null}renderApiItemFlowItem(){let e=this._selectedApiItem;return e?s`<calcite-flow-item heading-level=2 .heading=${this.messages.constantsandfunctions} .beforeBack=${this._unselectItem} closable @calciteFlowItemClose=${this._emitClose} selected>${this.hideDocumentationActions?null:s`<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?s`<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 s`<calcite-flow ${a(this.flowFocusHandler)}><calcite-flow-item heading-level=2 .heading=${this.messages.constantsandfunctions} closable @calciteFlowItemClose=${this._emitClose} .selected=${!this._selectedApiItem}><calcite-input .value=${this._filterValue} icon=magnifying-glass clearable @calciteInputInput=${this._updateFilterValue} class="sticky" scale=m></calcite-input>${this.loading?s`<calcite-loader scale=s type=indeterminate .label=${this.messages.loading??"Loading"}></calcite-loader>`:s`<calcite-list .label=${this.messages.api??"API"}>${i?s`<div class="notice-container">${this.messages.noitems}</div>`:e}</calcite-list>`}</calcite-flow-item>${this.renderApiItemFlowItem()}</calcite-flow>`}};h("arcgis-language-api-panel",r);export{r as ArcgisLanguageApiPanel};
2
+ import{a as n}from"./77GSSZOD.js";import{a as f}from"./QNAUGPWS.js";import"./PWVGWGF5.js";import{a as g}from"./PJHAQGOB.js";import"./BQLG62QR.js";import{d as p,e as u}from"./WMLTLTIE.js";import{E as a,F as d,J as h,h as m,j as s,n as c,r as o}from"./Q5SGN46H.js";import"./BCUUVBXH.js";import"./3TTFCHAA.js";var b=m`: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}}calcite-list-item-group{background-color:var(--calcite-color-foreground-2)}calcite-flow{[slot=footer]{word-break:break-word}}}`,r=class extends d{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?s`<calcite-list-item-group .heading=${e.title}>${i.map(t=>s`<calcite-list-item .label=${o(t.completion.detail)} @calciteListItemSelect=${l=>this._emitItemSelected(l,t)} @keydown=${l=>this._emitItemSelected(l,t)}><calcite-action slot=actions-end .text=${this.messages.expand??""} icon=chevron-right icon-flip-rtl scale=s @click=${l=>this._selectItem(l,t)}></calcite-action></calcite-list-item>`)}</calcite-list-item-group>`:null}renderApiItemFlowItem(){let e=this._selectedApiItem;return e?s`<calcite-flow-item heading-level=2 .heading=${this.messages.constantsandfunctions} .beforeBack=${this._unselectItem} closable @calciteFlowItemClose=${this._emitClose} selected>${this.hideDocumentationActions?null:s`<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?s`<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 s`<calcite-flow ${a(this.flowFocusHandler)}><calcite-flow-item heading-level=2 .heading=${this.messages.constantsandfunctions} closable @calciteFlowItemClose=${this._emitClose} .selected=${!this._selectedApiItem}><calcite-input .value=${this._filterValue} icon=magnifying-glass clearable @calciteInputInput=${this._updateFilterValue} class="sticky" scale=m></calcite-input>${this.loading?s`<calcite-loader scale=s type=indeterminate .label=${this.messages.loading??"Loading"}></calcite-loader>`:s`<calcite-list .label=${this.messages.api??"API"}>${i?s`<div class="notice-container">${this.messages.noitems}</div>`:e}</calcite-list>`}</calcite-flow-item>${this.renderApiItemFlowItem()}</calcite-flow>`}};h("arcgis-language-api-panel",r);export{r as ArcgisLanguageApiPanel};
@@ -1,4 +1,4 @@
1
1
  /* COPYRIGHT Esri - https://js.arcgis.com/5.1/LICENSE.txt */
2
- import{f as d}from"./BQLG62QR.js";import{q as c}from"./EMMNZESW.js";function L(t,r,m,u){if(!r)return[];let e=Array.isArray(r)?r:[r];if(!e.length)return[];let l=c(m);return t.filter(o=>e.some(a=>l.test(String(o[a]??""))))}function N(t){return t?`${t.portal.url}/home/item.html?id=${t.id}`:""}function C(t,r,m="add",u){if(!t)return;let e=t.getSelection(),l=e&&(e.startLineNumber!==e.endLineNumber||e.startColumn!==e.endColumn),o=[],a=t.getValue()??"";if(m==="replace"){let i=`${u}
2
+ import{f as d}from"./BQLG62QR.js";import{q as c}from"./Q5SGN46H.js";function L(t,r,m,u){if(!r)return[];let e=Array.isArray(r)?r:[r];if(!e.length)return[];let l=c(m);return t.filter(o=>e.some(a=>l.test(String(o[a]??""))))}function N(t){return t?`${t.portal.url}/home/item.html?id=${t.id}`:""}function C(t,r,m="add",u){if(!t)return;let e=t.getSelection(),l=e&&(e.startLineNumber!==e.endLineNumber||e.startColumn!==e.endColumn),o=[],a=t.getValue()??"";if(m==="replace"){let i=`${u}
3
3
  ${r}`,s=t.getModel(),n=s?.getLineCount()??1,f=s?.getLineMaxColumn(n)??1;o=[{range:{startLineNumber:1,startColumn:1,endLineNumber:n,endColumn:f},text:i}]}else{let i=l?{startLineNumber:e.startLineNumber,startColumn:e.startColumn,endLineNumber:e.endLineNumber,endColumn:e.endColumn}:(()=>{let n=t.getPosition();return{startLineNumber:n?.lineNumber??1,startColumn:n?.column??1,endLineNumber:n?.lineNumber??1,endColumn:n?.column??1}})(),s=!1;if(u){let n=u.replace(/[.*+?^${}()|[\]\\]/gu,"\\$&");s=!new RegExp(`^\\s*${n}\\s*$`,"mu").test(a)}s&&o.push({range:{startLineNumber:1,startColumn:1,endLineNumber:1,endColumn:1},text:`${u}
4
4
  `}),o.push({range:i,text:r})}try{t.pushUndoStop(),t.executeEdits("insertText",o),t.pushUndoStop(),t.focus()}catch(i){console.error("Failed to edit model:",i)}}function g(t){try{return d(t)}catch{return t}}export{L as a,N as b,C as c,g as d};
@@ -1,2 +1,2 @@
1
1
  /* COPYRIGHT Esri - https://js.arcgis.com/5.1/LICENSE.txt */
2
- import f from"./HZ5MCXUU.js";import b from"./FWVG6H2C.js";import{a as _}from"./ZYS253RG.js";import"./MP6Z45SA.js";import"./P5D2YYFD.js";import a from"./7LS3R4TH.js";import"./IFNCCZ7O.js";import"./QWLPT7LO.js";import"./NKCYMRE4.js";import"./BQLG62QR.js";import"./WMLTLTIE.js";import"./UYBZWFE5.js";import{D as l,E as h,F as p,G as r,J as g,h as c,j as e,n as o,s as d}from"./EMMNZESW.js";import{b as s}from"./BCUUVBXH.js";import"./YLN7EMJC.js";import"./GHSEU7VA.js";import"./4OSKRQ5X.js";import"./NG7S6FUK.js";import"./3TTFCHAA.js";export default $arcgis.t(([,{a:a},{b:f}])=>{var m=c`:host{height:100%}calcite-tooltip:not([calcite-hydrated])>*{display:none}`,n=class extends p{constructor(){super(...arguments),this._codeEditorElt=l(),this._disposables=[],this.messages=_(),this._modelId=d(),this._preparing=!1,this.sideActionBarExpanded=!1,this.script="",this.hideSideBar=!1,this.arcgisDiagnosticsChange=o({bubbles:!1}),this.arcgisScriptChange=o({bubbles:!1})}static{this.properties={_activeAction:16,_apiLibrary:16,_editorProfile:16,_preparing:16,sideActionBarExpanded:16,profile:0,script:1,hideSideBar:5}}static{this.styles=[m]}async setFocus(){await this._codeEditorElt.value?.setFocus()}async load(){await this._updateEditorProfile().catch(s(this))}willUpdate(i){(i.has("messages")||i.has("profile"))&&this._updateDataModelDeps()}async loaded(){let i=await f();this._disposables.push(i.onDiagnosticsChange(t=>!this._preparing&&this.arcgisDiagnosticsChange.emit(t.diagnostics)))}disconnectedCallback(){for(super.disconnectedCallback();this._disposables.length;)this._disposables.pop()?.dispose()}async _updateDataModelDeps(){await this._updateEditorProfile(),await this._updateApiLibrary()}async _updateEditorProfile(){this._preparing=!0;try{await a.setProfileForModel(this._modelId,this.profile,{locale:this.messages._t9nLocale}),this._editorProfile=a.getEditorProfileForModel(this._modelId)}catch{this._editorProfile=void 0}finally{this._preparing=!1}}_setActiveAction(i){if(this._activeAction===i){this._activeAction=void 0;return}this._activeAction=i}_handleActionClick(i){let t=i.target;this._setActiveAction(t.dataset.panelName)}_insertAsSnippet(i){this._codeEditorElt.value?.insertSnippet(i.detail).catch(s(this))}_insertAsText(i){this._codeEditorElt.value?.insertText(i.detail.replaceAll('"',"'")).catch(s(this))}async _updateApiLibrary(){this._apiLibrary=await a.getApiLibraryForModel(this._modelId)}_onCodeEditorValueChange(i){i.stopPropagation(),this.script=i.detail,this.arcgisScriptChange.emit(i.detail)}_getFeatureSetVariable(){let i,t=a.getEditorProfileForModel(this._modelId);return t?.variables?.length&&t?.variables?.[0]?.type!=="featureSet"?s(this)("Encountered unexpected editor profile"):i=t?.variables?.[0],i}_toggleSideActionBarExpanded(){this.sideActionBarExpanded=!this.sideActionBarExpanded}render(){let i=this._getFeatureSetVariable();return e`<arcgis-code-editor-shell><arcgis-code-editor slot=editor language=arcgis-sql-expression .modelId=${this._modelId} .value=${this.script??""} @arcgisValueChange=${this._onCodeEditorValueChange} ${h(this._codeEditorElt)}></arcgis-code-editor>${!this.hideSideBar&&i&&e`<arcgis-editor-variables slot=side-panel .variable=${i} .closed=${this._activeAction!=="fields"} class=${r(this._activeAction==="fields"?"":"hidden")} .loading=${this._preparing} .modelId=${this._modelId} @arcgisInternalItemSelected=${this._insertAsText} @arcgisInternalClosePanel=${()=>this._setActiveAction(void 0)} data-panel-name=none></arcgis-editor-variables>`||""}${!this.hideSideBar&&e`<arcgis-language-api-panel slot=side-panel class=${r(this._activeAction==="functions"?"":"hidden")} .closed=${this._activeAction!=="functions"} @arcgisInternalItemSelected=${this._insertAsSnippet} @arcgisInternalClosePanel=${()=>this._setActiveAction(void 0)} .loading=${this._preparing} .apiLibrary=${this._apiLibrary} data-panel-name=none hide-documentation-actions .languageId=${a.languageId}></arcgis-language-api-panel>`||""}${!this.hideSideBar&&e`<calcite-action-bar slot=side-action-bar .expanded=${this.sideActionBarExpanded} position=end @calciteActionBarToggle=${this._toggleSideActionBarExpanded}>${i&&e`<calcite-action id=fields-action .text=${this.messages.fields??"Fields"} icon=profile-variables .active=${this._activeAction==="fields"} data-panel-name=fields @click=${this._handleActionClick}></calcite-action>`||""}${i&&!this.sideActionBarExpanded&&e`<calcite-tooltip reference-element=fields-action><span>${this.messages.fields??"Fields"}</span></calcite-tooltip>`||""}<calcite-action id=functions-action .text=${this.messages.functions??"Functions"} icon=function .active=${this._activeAction==="functions"} data-panel-name=functions @click=${this._handleActionClick}></calcite-action>${!this.sideActionBarExpanded&&e`<calcite-tooltip reference-element=functions-action><span>${this.messages.functions??"Functions"}</span></calcite-tooltip>`||""}</calcite-action-bar>`||""}</arcgis-code-editor-shell>`}};g("arcgis-sql-expression-editor",n);return n},a,b,f)
2
+ import f from"./W2J3OYT2.js";import b from"./LNSZ6J33.js";import{a as _}from"./QNAUGPWS.js";import"./MP6Z45SA.js";import"./PWVGWGF5.js";import a from"./NQVNVOQR.js";import"./IFNCCZ7O.js";import"./PJHAQGOB.js";import"./NKCYMRE4.js";import"./BQLG62QR.js";import"./WMLTLTIE.js";import"./UYBZWFE5.js";import{D as l,E as h,F as p,G as r,J as g,h as c,j as e,n as o,s as d}from"./Q5SGN46H.js";import{b as s}from"./BCUUVBXH.js";import"./YLN7EMJC.js";import"./GHSEU7VA.js";import"./4OSKRQ5X.js";import"./NG7S6FUK.js";import"./3TTFCHAA.js";export default $arcgis.t(([,{a:a},{b:f}])=>{var m=c`:host{height:100%}calcite-tooltip:not([calcite-hydrated])>*{display:none}`,n=class extends p{constructor(){super(...arguments),this._codeEditorElt=l(),this._disposables=[],this.messages=_(),this._modelId=d(),this._preparing=!1,this.sideActionBarExpanded=!1,this.script="",this.hideSideBar=!1,this.arcgisDiagnosticsChange=o({bubbles:!1}),this.arcgisScriptChange=o({bubbles:!1})}static{this.properties={_activeAction:16,_apiLibrary:16,_editorProfile:16,_preparing:16,sideActionBarExpanded:16,profile:0,script:1,hideSideBar:5}}static{this.styles=[m]}async setFocus(){await this._codeEditorElt.value?.setFocus()}async load(){await this._updateEditorProfile().catch(s(this))}willUpdate(i){(i.has("messages")||i.has("profile"))&&this._updateDataModelDeps()}async loaded(){let i=await f();this._disposables.push(i.onDiagnosticsChange(t=>!this._preparing&&this.arcgisDiagnosticsChange.emit(t.diagnostics)))}disconnectedCallback(){for(super.disconnectedCallback();this._disposables.length;)this._disposables.pop()?.dispose()}async _updateDataModelDeps(){await this._updateEditorProfile(),await this._updateApiLibrary()}async _updateEditorProfile(){this._preparing=!0;try{await a.setProfileForModel(this._modelId,this.profile,{locale:this.messages._t9nLocale}),this._editorProfile=a.getEditorProfileForModel(this._modelId)}catch{this._editorProfile=void 0}finally{this._preparing=!1}}_setActiveAction(i){if(this._activeAction===i){this._activeAction=void 0;return}this._activeAction=i}_handleActionClick(i){let t=i.target;this._setActiveAction(t.dataset.panelName)}_insertAsSnippet(i){this._codeEditorElt.value?.insertSnippet(i.detail).catch(s(this))}_insertAsText(i){this._codeEditorElt.value?.insertText(i.detail.replaceAll('"',"'")).catch(s(this))}async _updateApiLibrary(){this._apiLibrary=await a.getApiLibraryForModel(this._modelId)}_onCodeEditorValueChange(i){i.stopPropagation(),this.script=i.detail,this.arcgisScriptChange.emit(i.detail)}_getFeatureSetVariable(){let i,t=a.getEditorProfileForModel(this._modelId);return t?.variables?.length&&t?.variables?.[0]?.type!=="featureSet"?s(this)("Encountered unexpected editor profile"):i=t?.variables?.[0],i}_toggleSideActionBarExpanded(){this.sideActionBarExpanded=!this.sideActionBarExpanded}render(){let i=this._getFeatureSetVariable();return e`<arcgis-code-editor-shell><arcgis-code-editor slot=editor language=arcgis-sql-expression .modelId=${this._modelId} .value=${this.script??""} @arcgisValueChange=${this._onCodeEditorValueChange} ${h(this._codeEditorElt)}></arcgis-code-editor>${!this.hideSideBar&&i&&e`<arcgis-editor-variables slot=side-panel .variable=${i} .closed=${this._activeAction!=="fields"} class=${r(this._activeAction==="fields"?"":"hidden")} .loading=${this._preparing} .modelId=${this._modelId} @arcgisInternalItemSelected=${this._insertAsText} @arcgisInternalClosePanel=${()=>this._setActiveAction(void 0)} data-panel-name=none></arcgis-editor-variables>`||""}${!this.hideSideBar&&e`<arcgis-language-api-panel slot=side-panel class=${r(this._activeAction==="functions"?"":"hidden")} .closed=${this._activeAction!=="functions"} @arcgisInternalItemSelected=${this._insertAsSnippet} @arcgisInternalClosePanel=${()=>this._setActiveAction(void 0)} .loading=${this._preparing} .apiLibrary=${this._apiLibrary} data-panel-name=none hide-documentation-actions .languageId=${a.languageId}></arcgis-language-api-panel>`||""}${!this.hideSideBar&&e`<calcite-action-bar slot=side-action-bar .expanded=${this.sideActionBarExpanded} position=end @calciteActionBarToggle=${this._toggleSideActionBarExpanded}>${i&&e`<calcite-action id=fields-action .text=${this.messages.fields??"Fields"} icon=profile-variables .active=${this._activeAction==="fields"} data-panel-name=fields @click=${this._handleActionClick}></calcite-action>`||""}${i&&!this.sideActionBarExpanded&&e`<calcite-tooltip reference-element=fields-action><span>${this.messages.fields??"Fields"}</span></calcite-tooltip>`||""}<calcite-action id=functions-action .text=${this.messages.functions??"Functions"} icon=function .active=${this._activeAction==="functions"} data-panel-name=functions @click=${this._handleActionClick}></calcite-action>${!this.sideActionBarExpanded&&e`<calcite-tooltip reference-element=functions-action><span>${this.messages.functions??"Functions"}</span></calcite-tooltip>`||""}</calcite-action-bar>`||""}</arcgis-code-editor-shell>`}};g("arcgis-sql-expression-editor",n);return n},a,b,f)
@@ -1,2 +1,2 @@
1
1
  /* COPYRIGHT Esri - https://js.arcgis.com/5.1/LICENSE.txt */
2
- import{h as P,j as O}from"./WMLTLTIE.js";import{a as y,b,c as h,d as u,e as x,f as E,m as f,o as C}from"./EMMNZESW.js";var w=e=>(...n)=>{let t=u(),o=new e(...n),s=o.exports;h(t.at(-1));let r=o.component.manager;r.W(o,s),o.watchExports(r.W.bind(r,o)),x(o);let a=[o.component,...t].reverse();return f(a,i=>i===void 0?void 0:N(o,i,s),s)},N=(e,{host:n,key:t,isReactive:o},s)=>{let r=n,a=r[t]!==e.exports,i=r[t]!==s,c=s!==e.exports;if(a&&!i&&c&&(r[t]=e.exports),n===e.component){if(o){let p=e.component.manager;i&&p.W(e,r[t]),e.onUpdate(m=>{if(m.has(t)){let g=r[t];g!==e.exports&&p.W(e,g)}})}e.O=o?void 0:t}let d=e.component.constructor.elementProperties.get(t)?.readOnly;e.watchExports(()=>{r[t]!==e.exports&&(d?E(()=>{r[t]=e.exports}):r[t]=e.exports)})};var L=e=>D(void 0,e);var v=class extends C{constructor(n,t){super(n);let o=this.exports;try{b(this.component);let s=t(this.component,this),r=this.exports!==o;if(y(s)){r||this.setProvisionalExports(s);let a=s.then(i=>{this.exports=i,super.catchUpLifecycle()}).catch(i=>{this.P.reject(i)});this.onLoad(async()=>await a)}else(!r||s!==void 0)&&(this.exports=s),queueMicrotask(()=>super.catchUpLifecycle())}catch(s){this.P.reject(s)}}catchUpLifecycle(){}},D=w(v);var G=L;var $=e=>(n={})=>L((t,o)=>{let s=P(t.el),r={_lang:s.lang,_t9nLocale:s.t9nLocale,_loading:!0},a=t;o.onLifecycle(()=>O(t.el,()=>e("./assets"),({t9nLocale:c,t9nStrings:l,lang:d})=>{let p={...l,_lang:d,_t9nLocale:c,_loading:!1};o.exports=p;let m=l.componentLabel;typeof m=="string"&&"label"in t&&t.label==null&&(t.label??=m),i(a.messageOverrides)},n.name));let i=c=>{let l=o.exports,d=l._original??l,p=_(d,c);c&&(p._original=d),o.exports=p};return"messageOverrides"in a&&o.onUpdate(c=>{c.has("messageOverrides")&&i(a.messageOverrides)}),n.blocking?(o.setProvisionalExports(r,!1),o.ready):r}),_=(e,n)=>{if(!n)return e;let t={...e};return Object.entries(n).forEach(([o,s])=>{e[o]!==void 0&&(typeof s=="object"?t[o]=_(e[o],s):t[o]=s??e[o])}),t};export{G as a,$ as b};
2
+ import{h as P,j as O}from"./WMLTLTIE.js";import{a as y,b,c as h,d as u,e as x,f as E,m as f,o as C}from"./Q5SGN46H.js";var w=e=>(...n)=>{let t=u(),o=new e(...n),s=o.exports;h(t.at(-1));let r=o.component.manager;r.W(o,s),o.watchExports(r.W.bind(r,o)),x(o);let a=[o.component,...t].reverse();return f(a,i=>i===void 0?void 0:N(o,i,s),s)},N=(e,{host:n,key:t,isReactive:o},s)=>{let r=n,a=r[t]!==e.exports,i=r[t]!==s,c=s!==e.exports;if(a&&!i&&c&&(r[t]=e.exports),n===e.component){if(o){let p=e.component.manager;i&&p.W(e,r[t]),e.onUpdate(m=>{if(m.has(t)){let g=r[t];g!==e.exports&&p.W(e,g)}})}e.O=o?void 0:t}let d=e.component.constructor.elementProperties.get(t)?.readOnly;e.watchExports(()=>{r[t]!==e.exports&&(d?E(()=>{r[t]=e.exports}):r[t]=e.exports)})};var L=e=>D(void 0,e);var v=class extends C{constructor(n,t){super(n);let o=this.exports;try{b(this.component);let s=t(this.component,this),r=this.exports!==o;if(y(s)){r||this.setProvisionalExports(s);let a=s.then(i=>{this.exports=i,super.catchUpLifecycle()}).catch(i=>{this.P.reject(i)});this.onLoad(async()=>await a)}else(!r||s!==void 0)&&(this.exports=s),queueMicrotask(()=>super.catchUpLifecycle())}catch(s){this.P.reject(s)}}catchUpLifecycle(){}},D=w(v);var G=L;var $=e=>(n={})=>L((t,o)=>{let s=P(t.el),r={_lang:s.lang,_t9nLocale:s.t9nLocale,_loading:!0},a=t;o.onLifecycle(()=>O(t.el,()=>e("./assets"),({t9nLocale:c,t9nStrings:l,lang:d})=>{let p={...l,_lang:d,_t9nLocale:c,_loading:!1};o.exports=p;let m=l.componentLabel;typeof m=="string"&&"label"in t&&t.label==null&&(t.label??=m),i(a.messageOverrides)},n.name));let i=c=>{let l=o.exports,d=l._original??l,p=_(d,c);c&&(p._original=d),o.exports=p};return"messageOverrides"in a&&o.onUpdate(c=>{c.has("messageOverrides")&&i(a.messageOverrides)}),n.blocking?(o.setProvisionalExports(r,!1),o.ready):r}),_=(e,n)=>{if(!n)return e;let t={...e};return Object.entries(n).forEach(([o,s])=>{e[o]!==void 0&&(typeof s=="object"?t[o]=_(e[o],s):t[o]=s??e[o])}),t};export{G as a,$ as b};
@@ -0,0 +1,4 @@
1
+ /* COPYRIGHT Esri - https://js.arcgis.com/5.1/LICENSE.txt */
2
+ import{b as Mt}from"./BCUUVBXH.js";var Y=globalThis,Z=Y.ShadowRoot&&(Y.ShadyCSS===void 0||Y.ShadyCSS.nativeShadow)&&"adoptedStyleSheets"in Document.prototype&&"replace"in CSSStyleSheet.prototype,gt=Symbol(),kt=new WeakMap,M=class{constructor(t,e,s){if(this._$cssResult$=!0,s!==gt)throw Error("CSSResult is not constructable. Use `unsafeCSS` or `css` instead.");this.cssText=t,this.t=e}get styleSheet(){let t=this.o,e=this.t;if(Z&&t===void 0){let s=e!==void 0&&e.length===1;s&&(t=kt.get(e)),t===void 0&&((this.o=t=new CSSStyleSheet).replaceSync(this.cssText),s&&kt.set(e,t))}return t}toString(){return this.cssText}},jt=o=>new M(typeof o=="string"?o:o+"",void 0,gt),$e=(o,...t)=>{let e=o.length===1?o[0]:t.reduce((s,r,n)=>s+(i=>{if(i._$cssResult$===!0)return i.cssText;if(typeof i=="number")return i;throw Error("Value passed to 'css' function must be a 'css' function result: "+i+". Use 'unsafeCSS' to pass non-literal values, but take care to ensure page security.")})(r)+o[n+1],o[0]);return new M(e,o,gt)},Ht=(o,t)=>{if(Z)o.adoptedStyleSheets=t.map(e=>e instanceof CSSStyleSheet?e:e.styleSheet);else for(let e of t){let s=document.createElement("style"),r=Y.litNonce;r!==void 0&&s.setAttribute("nonce",r),s.textContent=e.cssText,o.appendChild(s)}},vt=Z?o=>o:o=>o instanceof CSSStyleSheet?(t=>{let e="";for(let s of t.cssRules)e+=s.cssText;return jt(e)})(o):o;var{is:be,defineProperty:_e,getOwnPropertyDescriptor:Ae,getOwnPropertyNames:Ce,getOwnPropertySymbols:we,getPrototypeOf:Oe}=Object,tt=globalThis,zt=tt.trustedTypes,Te=zt?zt.emptyScript:"",Se=tt.reactiveElementPolyfillSupport,k=(o,t)=>o,X={toAttribute(o,t){switch(t){case Boolean:o=o?Te:null;break;case Object:case Array:o=o==null?o:JSON.stringify(o)}return o},fromAttribute(o,t){let e=o;switch(t){case Boolean:e=o!==null;break;case Number:e=o===null?null:Number(o);break;case Object:case Array:try{e=JSON.parse(o)}catch{e=null}}return e}},j=(o,t)=>!be(o,t),Vt={attribute:!0,type:String,converter:X,reflect:!1,useDefault:!1,hasChanged:j};Symbol.metadata??=Symbol("metadata"),tt.litPropertyMetadata??=new WeakMap;var _=class extends HTMLElement{static addInitializer(t){this._$Ei(),(this.l??=[]).push(t)}static get observedAttributes(){return this.finalize(),this._$Eh&&[...this._$Eh.keys()]}static createProperty(t,e=Vt){if(e.state&&(e.attribute=!1),this._$Ei(),this.prototype.hasOwnProperty(t)&&((e=Object.create(e)).wrapped=!0),this.elementProperties.set(t,e),!e.noAccessor){let s=Symbol(),r=this.getPropertyDescriptor(t,s,e);r!==void 0&&_e(this.prototype,t,r)}}static getPropertyDescriptor(t,e,s){let{get:r,set:n}=Ae(this.prototype,t)??{get(){return this[e]},set(i){this[e]=i}};return{get:r,set(i){let a=r?.call(this);n?.call(this,i),this.requestUpdate(t,a,s)},configurable:!0,enumerable:!0}}static getPropertyOptions(t){return this.elementProperties.get(t)??Vt}static _$Ei(){if(this.hasOwnProperty(k("elementProperties")))return;let t=Oe(this);t.finalize(),t.l!==void 0&&(this.l=[...t.l]),this.elementProperties=new Map(t.elementProperties)}static finalize(){if(this.hasOwnProperty(k("finalized")))return;if(this.finalized=!0,this._$Ei(),this.hasOwnProperty(k("properties"))){let e=this.properties,s=[...Ce(e),...we(e)];for(let r of s)this.createProperty(r,e[r])}let t=this[Symbol.metadata];if(t!==null){let e=litPropertyMetadata.get(t);if(e!==void 0)for(let[s,r]of e)this.elementProperties.set(s,r)}this._$Eh=new Map;for(let[e,s]of this.elementProperties){let r=this._$Eu(e,s);r!==void 0&&this._$Eh.set(r,e)}this.elementStyles=this.finalizeStyles(this.styles)}static finalizeStyles(t){let e=[];if(Array.isArray(t)){let s=new Set(t.flat(1/0).reverse());for(let r of s)e.unshift(vt(r))}else t!==void 0&&e.push(vt(t));return e}static _$Eu(t,e){let s=e.attribute;return s===!1?void 0:typeof s=="string"?s:typeof t=="string"?t.toLowerCase():void 0}constructor(){super(),this._$Ep=void 0,this.isUpdatePending=!1,this.hasUpdated=!1,this._$Em=null,this._$Ev()}_$Ev(){this._$ES=new Promise(t=>this.enableUpdating=t),this._$AL=new Map,this._$E_(),this.requestUpdate(),this.constructor.l?.forEach(t=>t(this))}addController(t){(this._$EO??=new Set).add(t),this.renderRoot!==void 0&&this.isConnected&&t.hostConnected?.()}removeController(t){this._$EO?.delete(t)}_$E_(){let t=new Map,e=this.constructor.elementProperties;for(let s of e.keys())this.hasOwnProperty(s)&&(t.set(s,this[s]),delete this[s]);t.size>0&&(this._$Ep=t)}createRenderRoot(){let t=this.shadowRoot??this.attachShadow(this.constructor.shadowRootOptions);return Ht(t,this.constructor.elementStyles),t}connectedCallback(){this.renderRoot??=this.createRenderRoot(),this.enableUpdating(!0),this._$EO?.forEach(t=>t.hostConnected?.())}enableUpdating(t){}disconnectedCallback(){this._$EO?.forEach(t=>t.hostDisconnected?.())}attributeChangedCallback(t,e,s){this._$AK(t,s)}_$ET(t,e){let s=this.constructor.elementProperties.get(t),r=this.constructor._$Eu(t,s);if(r!==void 0&&s.reflect===!0){let n=(s.converter?.toAttribute!==void 0?s.converter:X).toAttribute(e,s.type);this._$Em=t,n==null?this.removeAttribute(r):this.setAttribute(r,n),this._$Em=null}}_$AK(t,e){let s=this.constructor,r=s._$Eh.get(t);if(r!==void 0&&this._$Em!==r){let n=s.getPropertyOptions(r),i=typeof n.converter=="function"?{fromAttribute:n.converter}:n.converter?.fromAttribute!==void 0?n.converter:X;this._$Em=r;let a=i.fromAttribute(e,n.type);this[r]=a??this._$Ej?.get(r)??a,this._$Em=null}}requestUpdate(t,e,s,r=!1,n){if(t!==void 0){let i=this.constructor;if(r===!1&&(n=this[t]),s??=i.getPropertyOptions(t),!((s.hasChanged??j)(n,e)||s.useDefault&&s.reflect&&n===this._$Ej?.get(t)&&!this.hasAttribute(i._$Eu(t,s))))return;this.C(t,e,s)}this.isUpdatePending===!1&&(this._$ES=this._$EP())}C(t,e,{useDefault:s,reflect:r,wrapped:n},i){s&&!(this._$Ej??=new Map).has(t)&&(this._$Ej.set(t,i??e??this[t]),n!==!0||i!==void 0)||(this._$AL.has(t)||(this.hasUpdated||s||(e=void 0),this._$AL.set(t,e)),r===!0&&this._$Em!==t&&(this._$Eq??=new Set).add(t))}async _$EP(){this.isUpdatePending=!0;try{await this._$ES}catch(e){Promise.reject(e)}let t=this.scheduleUpdate();return t!=null&&await t,!this.isUpdatePending}scheduleUpdate(){return this.performUpdate()}performUpdate(){if(!this.isUpdatePending)return;if(!this.hasUpdated){if(this.renderRoot??=this.createRenderRoot(),this._$Ep){for(let[r,n]of this._$Ep)this[r]=n;this._$Ep=void 0}let s=this.constructor.elementProperties;if(s.size>0)for(let[r,n]of s){let{wrapped:i}=n,a=this[r];i!==!0||this._$AL.has(r)||a===void 0||this.C(r,void 0,n,a)}}let t=!1,e=this._$AL;try{t=this.shouldUpdate(e),t?(this.willUpdate(e),this._$EO?.forEach(s=>s.hostUpdate?.()),this.update(e)):this._$EM()}catch(s){throw t=!1,this._$EM(),s}t&&this._$AE(e)}willUpdate(t){}_$AE(t){this._$EO?.forEach(e=>e.hostUpdated?.()),this.hasUpdated||(this.hasUpdated=!0,this.firstUpdated(t)),this.updated(t)}_$EM(){this._$AL=new Map,this.isUpdatePending=!1}get updateComplete(){return this.getUpdateComplete()}getUpdateComplete(){return this._$ES}shouldUpdate(t){return!0}update(t){this._$Eq&&=this._$Eq.forEach(e=>this._$ET(e,this[e])),this._$EM()}updated(t){}firstUpdated(t){}};_.elementStyles=[],_.shadowRootOptions={mode:"open"},_[k("elementProperties")]=new Map,_[k("finalized")]=new Map,Se?.({ReactiveElement:_}),(tt.reactiveElementVersions??=[]).push("2.1.2");var $t=globalThis,Bt=o=>o,et=$t.trustedTypes,Wt=et?et.createPolicy("lit-html",{createHTML:o=>o}):void 0,bt="$lit$",A=`lit$${Math.random().toFixed(9).slice(2)}$`,_t="?"+A,Pe=`<${_t}>`,T=document,z=()=>T.createComment(""),V=o=>o===null||typeof o!="object"&&typeof o!="function",At=Array.isArray,Jt=o=>At(o)||typeof o?.[Symbol.iterator]=="function",Et=`[
3
+ \f\r]`,H=/<(?:(!--|\/[^a-zA-Z])|(\/?[a-zA-Z][^>\s]*)|(\/?$))/g,Ft=/-->/g,qt=/>/g,w=RegExp(`>|${Et}(?:([^\\s"'>=/]+)(${Et}*=${Et}*(?:[^
4
+ \f\r"'\`<>=]|("|')|))|$)`,"g"),Gt=/'/g,Kt=/"/g,Yt=/^(?:script|style|textarea|title)$/i,Ct=o=>(t,...e)=>({_$litType$:o,strings:t,values:e}),fs=Ct(1),ms=Ct(2),ys=Ct(3),f=Symbol.for("lit-noChange"),d=Symbol.for("lit-nothing"),Qt=new WeakMap,O=T.createTreeWalker(T,129);function Zt(o,t){if(!At(o)||!o.hasOwnProperty("raw"))throw Error("invalid template strings array");return Wt!==void 0?Wt.createHTML(t):t}var Xt=(o,t)=>{let e=o.length-1,s=[],r,n=t===2?"<svg>":t===3?"<math>":"",i=H;for(let a=0;a<e;a++){let c=o[a],l,u,h=-1,m=0;for(;m<c.length&&(i.lastIndex=m,u=i.exec(c),u!==null);)m=i.lastIndex,i===H?u[1]==="!--"?i=Ft:u[1]!==void 0?i=qt:u[2]!==void 0?(Yt.test(u[2])&&(r=RegExp("</"+u[2],"g")),i=w):u[3]!==void 0&&(i=w):i===w?u[0]===">"?(i=r??H,h=-1):u[1]===void 0?h=-2:(h=i.lastIndex-u[2].length,l=u[1],i=u[3]===void 0?w:u[3]==='"'?Kt:Gt):i===Kt||i===Gt?i=w:i===Ft||i===qt?i=H:(i=w,r=void 0);let v=i===w&&o[a+1].startsWith("/>")?" ":"";n+=i===H?c+Pe:h>=0?(s.push(l),c.slice(0,h)+bt+c.slice(h)+A+v):c+A+(h===-2?a:v)}return[Zt(o,n+(o[e]||"<?>")+(t===2?"</svg>":t===3?"</math>":"")),s]},B=class o{constructor({strings:t,_$litType$:e},s){let r;this.parts=[];let n=0,i=0,a=t.length-1,c=this.parts,[l,u]=Xt(t,e);if(this.el=o.createElement(l,s),O.currentNode=this.el.content,e===2||e===3){let h=this.el.content.firstChild;h.replaceWith(...h.childNodes)}for(;(r=O.nextNode())!==null&&c.length<a;){if(r.nodeType===1){if(r.hasAttributes())for(let h of r.getAttributeNames())if(h.endsWith(bt)){let m=u[i++],v=r.getAttribute(h).split(A),C=/([.?@])?(.*)/.exec(m);c.push({type:1,index:n,name:C[2],strings:v,ctor:C[1]==="."?ot:C[1]==="?"?rt:C[1]==="@"?nt:P}),r.removeAttribute(h)}else h.startsWith(A)&&(c.push({type:6,index:n}),r.removeAttribute(h));if(Yt.test(r.tagName)){let h=r.textContent.split(A),m=h.length-1;if(m>0){r.textContent=et?et.emptyScript:"";for(let v=0;v<m;v++)r.append(h[v],z()),O.nextNode(),c.push({type:2,index:++n});r.append(h[m],z())}}}else if(r.nodeType===8)if(r.data===_t)c.push({type:2,index:n});else{let h=-1;for(;(h=r.data.indexOf(A,h+1))!==-1;)c.push({type:7,index:n}),h+=A.length-1}n++}}static createElement(t,e){let s=T.createElement("template");return s.innerHTML=t,s}};function S(o,t,e=o,s){if(t===f)return t;let r=s!==void 0?e._$Co?.[s]:e._$Cl,n=V(t)?void 0:t._$litDirective$;return r?.constructor!==n&&(r?._$AO?.(!1),n===void 0?r=void 0:(r=new n(o),r._$AT(o,e,s)),s!==void 0?(e._$Co??=[])[s]=r:e._$Cl=r),r!==void 0&&(t=S(o,r._$AS(o,t.values),r,s)),t}var st=class{constructor(t,e){this._$AV=[],this._$AN=void 0,this._$AD=t,this._$AM=e}get parentNode(){return this._$AM.parentNode}get _$AU(){return this._$AM._$AU}u(t){let{el:{content:e},parts:s}=this._$AD,r=(t?.creationScope??T).importNode(e,!0);O.currentNode=r;let n=O.nextNode(),i=0,a=0,c=s[0];for(;c!==void 0;){if(i===c.index){let l;c.type===2?l=new L(n,n.nextSibling,this,t):c.type===1?l=new c.ctor(n,c.name,c.strings,this,t):c.type===6&&(l=new it(n,this,t)),this._$AV.push(l),c=s[++a]}i!==c?.index&&(n=O.nextNode(),i++)}return O.currentNode=T,r}p(t){let e=0;for(let s of this._$AV)s!==void 0&&(s.strings!==void 0?(s._$AI(t,s,e),e+=s.strings.length-2):s._$AI(t[e])),e++}},L=class o{get _$AU(){return this._$AM?._$AU??this._$Cv}constructor(t,e,s,r){this.type=2,this._$AH=d,this._$AN=void 0,this._$AA=t,this._$AB=e,this._$AM=s,this.options=r,this._$Cv=r?.isConnected??!0}get parentNode(){let t=this._$AA.parentNode,e=this._$AM;return e!==void 0&&t?.nodeType===11&&(t=e.parentNode),t}get startNode(){return this._$AA}get endNode(){return this._$AB}_$AI(t,e=this){t=S(this,t,e),V(t)?t===d||t==null||t===""?(this._$AH!==d&&this._$AR(),this._$AH=d):t!==this._$AH&&t!==f&&this._(t):t._$litType$!==void 0?this.$(t):t.nodeType!==void 0?this.T(t):Jt(t)?this.k(t):this._(t)}O(t){return this._$AA.parentNode.insertBefore(t,this._$AB)}T(t){this._$AH!==t&&(this._$AR(),this._$AH=this.O(t))}_(t){this._$AH!==d&&V(this._$AH)?this._$AA.nextSibling.data=t:this.T(T.createTextNode(t)),this._$AH=t}$(t){let{values:e,_$litType$:s}=t,r=typeof s=="number"?this._$AC(t):(s.el===void 0&&(s.el=B.createElement(Zt(s.h,s.h[0]),this.options)),s);if(this._$AH?._$AD===r)this._$AH.p(e);else{let n=new st(r,this),i=n.u(this.options);n.p(e),this.T(i),this._$AH=n}}_$AC(t){let e=Qt.get(t.strings);return e===void 0&&Qt.set(t.strings,e=new B(t)),e}k(t){At(this._$AH)||(this._$AH=[],this._$AR());let e=this._$AH,s,r=0;for(let n of t)r===e.length?e.push(s=new o(this.O(z()),this.O(z()),this,this.options)):s=e[r],s._$AI(n),r++;r<e.length&&(this._$AR(s&&s._$AB.nextSibling,r),e.length=r)}_$AR(t=this._$AA.nextSibling,e){for(this._$AP?.(!1,!0,e);t!==this._$AB;){let s=Bt(t).nextSibling;Bt(t).remove(),t=s}}setConnected(t){this._$AM===void 0&&(this._$Cv=t,this._$AP?.(t))}},P=class{get tagName(){return this.element.tagName}get _$AU(){return this._$AM._$AU}constructor(t,e,s,r,n){this.type=1,this._$AH=d,this._$AN=void 0,this.element=t,this.name=e,this._$AM=r,this.options=n,s.length>2||s[0]!==""||s[1]!==""?(this._$AH=Array(s.length-1).fill(new String),this.strings=s):this._$AH=d}_$AI(t,e=this,s,r){let n=this.strings,i=!1;if(n===void 0)t=S(this,t,e,0),i=!V(t)||t!==this._$AH&&t!==f,i&&(this._$AH=t);else{let a=t,c,l;for(t=n[0],c=0;c<n.length-1;c++)l=S(this,a[s+c],e,c),l===f&&(l=this._$AH[c]),i||=!V(l)||l!==this._$AH[c],l===d?t=d:t!==d&&(t+=(l??"")+n[c+1]),this._$AH[c]=l}i&&!r&&this.j(t)}j(t){t===d?this.element.removeAttribute(this.name):this.element.setAttribute(this.name,t??"")}},ot=class extends P{constructor(){super(...arguments),this.type=3}j(t){this.element[this.name]=t===d?void 0:t}},rt=class extends P{constructor(){super(...arguments),this.type=4}j(t){this.element.toggleAttribute(this.name,!!t&&t!==d)}},nt=class extends P{constructor(t,e,s,r,n){super(t,e,s,r,n),this.type=5}_$AI(t,e=this){if((t=S(this,t,e,0)??d)===f)return;let s=this._$AH,r=t===d&&s!==d||t.capture!==s.capture||t.once!==s.once||t.passive!==s.passive,n=t!==d&&(s===d||r);r&&this.element.removeEventListener(this.name,this,s),n&&this.element.addEventListener(this.name,this,t),this._$AH=t}handleEvent(t){typeof this._$AH=="function"?this._$AH.call(this.options?.host??this.element,t):this._$AH.handleEvent(t)}},it=class{constructor(t,e,s){this.element=t,this.type=6,this._$AN=void 0,this._$AM=e,this.options=s}get _$AU(){return this._$AM._$AU}_$AI(t){S(this,t)}},te={M:bt,P:A,A:_t,C:1,L:Xt,R:st,D:Jt,V:S,I:L,H:P,N:rt,U:nt,B:ot,F:it},Ne=$t.litHtmlPolyfillSupport;Ne?.(B,L),($t.litHtmlVersions??=[]).push("3.3.2");var wt=(o,t,e)=>{let s=e?.renderBefore??t,r=s._$litPart$;if(r===void 0){let n=e?.renderBefore??null;s._$litPart$=r=new L(t.insertBefore(z(),n),n,void 0,e??{})}return r._$AI(o),r};var Ot=globalThis,$=class extends _{constructor(){super(...arguments),this.renderOptions={host:this},this._$Do=void 0}createRenderRoot(){let t=super.createRenderRoot();return this.renderOptions.renderBefore??=t.firstChild,t}update(t){let e=this.render();this.hasUpdated||(this.renderOptions.isConnected=this.isConnected),super.update(t),this._$Do=wt(e,this.renderRoot,this.renderOptions)}connectedCallback(){super.connectedCallback(),this._$Do?.setConnected(!0)}disconnectedCallback(){super.disconnectedCallback(),this._$Do?.setConnected(!1)}render(){return f}};$._$litElement$=!0,$.finalized=!0,Ot.litElementHydrateSupport?.({LitElement:$});var xe=Ot.litElementPolyfillSupport;xe?.({LitElement:$});(Ot.litElementVersions??=[]).push("4.2.2");var p=(o,t,...e)=>{try{return o?.call(t,...e)}catch(s){console.error(s,o)}},W=async(o,t,...e)=>{try{return await o?.call(t,...e)}catch(s){console.error(s,o)}};var q=Symbol.for("controller"),De=o=>typeof o=="object"&&o!==null&&(q in o||"hostConnected"in o||"hostDisconnected"in o||"hostUpdate"in o||"hostUpdated"in o),Ns=o=>typeof o?.then=="function";var F,x=o=>{F!==o&&(F=o,queueMicrotask(()=>F===o?F=void 0:0))},G=o=>F,N=[],ee=o=>{if(o===void 0){N=[];return}let t=N.indexOf(o);N=t===-1?[...N,o]:N.slice(0,t+1),queueMicrotask(()=>N=[])},se=()=>N,U,xs=o=>{U!==o&&(U=o,queueMicrotask(()=>U===o?U=void 0:0))},Le=()=>{let o=U;return U=void 0,o},oe=async(o,t)=>{let e=ct(o);if(e===void 0)return o;if(await e.ready,typeof t=="function"){let s=e.watchExports(r=>t(r,s))}return e.exports},re=async o=>{let t=ct(o);return await t.ready,t},ct=o=>{let e=G().manager.X(o);if(e!==void 0)return e;if(De(o))return o;let s=Le();if(s!==void 0)return s},at=!1,Ds=o=>{at=!0;try{return o()}finally{at=!1}};var b=class{constructor(){this.promise=new Promise((t,e)=>{this.resolve=t,this.reject=e})}},ne=(o,t)=>{let e=t>Ue?Re:t/Ie,s=0,r=setInterval(()=>{s+=e,s>=t&&(clearInterval(r),o())},e);return r},Ue=4e3,Re=2e3,Ie=4;var Me=(o,t,e)=>{let s=Object.keys(o),r=s.length;R===void 0&&queueMicrotask(I),R??=new Map;let n=R.get(o);return n===void 0&&(n={callbacks:[],keyCount:r},R.set(o,n)),n.keyCount!==r&&(n.callbacks.forEach(i=>i(s)),n.callbacks=[],n.keyCount=r),n.callbacks.push(i=>{let a=l=>p(t,null,l),c=i[r];c===void 0?a(void 0):o[c]===e?a(c):a(void 0)}),e},R,I=()=>{R?.forEach(({callbacks:o},t)=>{let e=Object.keys(t);o.forEach(s=>s(e))}),R=void 0},ke=(o,t,e)=>{let s=o.manager;return s.V!==d&&s.V!==e&&s.S(void 0,void 0),s.T.length===0&&queueMicrotask(()=>s.S(void 0,void 0)),s.V=e,s.T.push((r,n)=>p(t,void 0,e===n?r:void 0)),e},je=(o=[G(),...se()],t,e)=>{let s=Array.isArray(o)?o:[o],r=s.length+1,n=i=>{r-=1,i!==void 0&&(r=Math.min(r,0)),r===0&&t(i)};s.forEach(i=>Me(i,a=>n(a===void 0?void 0:{key:a,host:i,isReactive:!1}),e));for(let i of s)if("manager"in i&&i.manager.component===i){ke(i,a=>n(a===void 0?void 0:{key:a,host:i,isReactive:!0}),e);break}return e},He=(o="",t={},e=G())=>{let s={emit:r=>{o===""&&I();let n=new CustomEvent(o,{detail:r,cancelable:!0,bubbles:!0,composed:!0,...t});return e.el.dispatchEvent(n),n}};return o===""&&je(void 0,r=>o=r.key,s),s},ze=He.bind(null,""),ce;ce=q;var Tt=class{constructor(t){this.#t=[],this.#e=[],this.#s=[],this.#r=[],this.#n=[],this.#a=[],this.#l=[],this.#h=[],this.#d=[],this.#p=!1,this.P=new b,this.connectedCalled=!1,this.loadedCalled=!1,this[ce]=!0,this.#c=[];let e=this,s=t??G(new.target.name);e.#o=s,e.ready=e.P.promise,e.#i=ae(e),e.component=s,e.#o.addController(e),e.#o.manager===void 0||(ee(e),queueMicrotask(()=>e.catchUpLifecycle()))}#t;#e;#s;#r;#n;#a;#l;#h;#d;#p;#o;catchUpLifecycle(){let{manager:t}=this.#o;t.connectedCalled&&!this.connectedCalled&&this.triggerConnected(),t.#p&&this.triggerLoad().then(()=>t.loadedCalled&&this.triggerLoaded()).catch(Mt(this.#o))}#i;get exports(){return this.#i}set exports(t){let e=this.#i;e!==t&&(this.#i=t,this.#c.forEach(p),this.connectedCalled&&this.O!==!1&&this.#o.requestUpdate(this.O,e)),this.P.resolve(t)}setProvisionalExports(t,e=!0){this.#i=e?ae(t):t,this.#c.forEach(p)}#c;watchExports(t){let e=()=>t(this.#i);return this.#c.push(e),()=>void this.#c.splice(this.#c.indexOf(e),1)}get use(){return x(this.#o),oe}get useRef(){return x(this.#o),re}get useRefSync(){return x(this.#o),ct}controllerRemoved(){this.#o.el.isConnected&&this.triggerDisconnected(),this.triggerDestroy()}onConnected(t){this.#t.push(t)}onDisconnected(t){this.#e.push(t)}onLoad(t){this.#s.push(t)}onLoaded(t){this.#r.push(t)}onUpdate(t){this.#n.push(t)}onUpdated(t){this.#a.push(t)}onDestroy(t){this.#l.push(t)}onLifecycle(t){this.#h.push(t),this.connectedCalled&&this.#o.el.isConnected&&this.#u(t)}triggerConnected(){let t=this;t.hostConnected&&p(t.hostConnected,t),t.#t.forEach(p),t.triggerLifecycle(),t.connectedCalled=!0}triggerDisconnected(){let t=this;t.hostDisconnected&&p(t.hostDisconnected,t),t.#e.forEach(p),t.#d.forEach(p),t.#d=[]}async triggerLoad(){if(this.#p)return;this.#p=!0;let t=this;t.hostLoad&&await W(t.hostLoad,t),this.#s.length>0&&await Promise.allSettled(this.#s.map(W)),this.P.resolve(this.#i)}triggerLoaded(){this.loadedCalled||(this.hostLoaded&&p(this.hostLoaded,this),this.#r.forEach(p),this.loadedCalled=!0)}triggerUpdate(t){this.hostUpdate&&p(this.hostUpdate,this,t),this.#n.forEach(ie,t)}triggerUpdated(t){this.hostUpdated&&p(this.hostUpdated,this,t),this.#a.forEach(ie,t)}triggerDestroy(){this.hostDestroy&&p(this.hostDestroy,this),this.#l.forEach(p)}triggerLifecycle(){this.hostLifecycle&&this.#u(()=>this.hostLifecycle()),this.#h.forEach(this.#u,this)}#u(t){x(this.#o);let e=p(t);(Array.isArray(e)?e:[e]).forEach(r=>{typeof r=="function"?this.#d.push(r):typeof r=="object"&&typeof r.remove=="function"&&this.#d.push(r.remove)})}};function ie(o){p(o,void 0,this)}var le=Tt,ae=o=>{if(typeof o!="object"&&typeof o!="function"||o===null)return o;let t={get(s,r,n){if(!((r==="exports"||r==="_exports")&&r in s&&s[r]===e)&&(r in s||r in Promise.prototype||typeof r=="symbol"))return typeof s=="function"?s[r]:Reflect.get(s,r,n)}},e=new Proxy(o,t);return e};var lt=o=>o.replace(Ve,(t,e)=>`${e===0?"":"-"}${t.toLowerCase()}`),Ve=/[A-Z]+(?![a-z])|[A-Z]/gu;var he=(o,t)=>new Array(t+1).join(o),Vs=o=>{let t='"',e="'";o.includes(t)&&!o.includes(e)&&(e='"',t="'");let r=new RegExp(`(^|[^\\\\])((?:\\\\{2})*)((?:\\\\${e})+)`,"gu");o=o.replace(r,(i,a,c,l)=>a+c+he(e,l.length/2));let n=new RegExp(`(^|[^\\\\])((?:\\\\{2})*)(${t}+)`,"gu");return o=o.replace(n,(i,a,c,l)=>a+c+he(`\\${t}`,l.length)),t+o+t},Bs=o=>{let t=o?o.replaceAll(/[-[\]/{}()*+?.\\^$|]/gu,"\\$&"):"^.*$";return new RegExp(t,"i")},Ws=o=>`\u200E${o??""}\u200E`,Be="randomUUID"in crypto,Fs=()=>{if(Be)return crypto.randomUUID();let o=crypto.getRandomValues(new Uint16Array(8));o[3]=o[3]&4095|16384,o[4]=o[4]&16383|32768;let t=e=>o[e].toString(16).padStart(4,"0");return`${t(0)+t(1)}-${t(2)}-${t(3)}-${t(4)}-${t(5)}${t(6)}${t(7)}`};var qs=(o,t={})=>(o??"").replace(/\{(?<valueName>.*?)\}/gu,(e,s)=>t[s]??e);var{I:We}=te,de=o=>o;var ht=o=>o.strings===void 0,pe=()=>document.createComment(""),Qs=(o,t,e)=>{let s=o._$AA.parentNode,r=t===void 0?o._$AB:t._$AA;if(e===void 0){let n=s.insertBefore(pe(),r),i=s.insertBefore(pe(),r);e=new We(n,i,o,o.options)}else{let n=e._$AB.nextSibling,i=e._$AM,a=i!==o;if(a){let c;e._$AQ?.(o),e._$AM=o,e._$AP!==void 0&&(c=o._$AU)!==i._$AU&&e._$AP(c)}if(n!==r||a){let c=e._$AA;for(;c!==n;){let l=de(c).nextSibling;de(s).insertBefore(c,r),c=l}}}return e},Js=(o,t,e=o)=>(o._$AI(t,e),o),Fe={},ue=(o,t=Fe)=>o._$AH=t,Ys=o=>o._$AH,Zs=o=>{o._$AR(),o._$AA.remove()};var y={ATTRIBUTE:1,CHILD:2,PROPERTY:3,BOOLEAN_ATTRIBUTE:4,EVENT:5,ELEMENT:6},E=o=>(...t)=>({_$litDirective$:o,values:t}),g=class{constructor(t){}get _$AU(){return this._$AM._$AU}_$AT(t,e,s){this._$Ct=t,this._$AM=e,this._$Ci=s}_$AS(t,e){return this.update(t,e)}update(t,e){return this.render(...e)}};var K=(o,t)=>{let e=o._$AN;if(e===void 0)return!1;for(let s of e)s._$AO?.(t,!1),K(s,t);return!0},dt=o=>{let t,e;do{if((t=o._$AM)===void 0)break;e=t._$AN,e.delete(o),o=t}while(e?.size===0)},fe=o=>{for(let t;t=o._$AM;o=t){let e=t._$AN;if(e===void 0)t._$AN=e=new Set;else if(e.has(o))break;e.add(o),Ke(t)}};function qe(o){this._$AN!==void 0?(dt(this),this._$AM=o,fe(this)):this._$AM=o}function Ge(o,t=!1,e=0){let s=this._$AH,r=this._$AN;if(r!==void 0&&r.size!==0)if(t)if(Array.isArray(s))for(let n=e;n<s.length;n++)K(s[n],!1),dt(s[n]);else s!=null&&(K(s,!1),dt(s));else K(this,o)}var Ke=o=>{o.type==y.CHILD&&(o._$AP??=Ge,o._$AQ??=qe)},pt=class extends g{constructor(){super(...arguments),this._$AN=void 0}_$AT(t,e,s){super._$AT(t,e,s),fe(this),this.isConnected=t._$AU}_$AO(t,e=!0){t!==this.isConnected&&(this.isConnected=t,t?this.reconnected?.():this.disconnected?.()),e&&(K(this,t),dt(this))}setValue(t){if(ht(this._$Ct))this._$Ct._$AI(t,this);else{let e=[...this._$Ct._$AH];e[this._$Ci]=t,this._$Ct._$AI(e,this,0)}}disconnected(){}reconnected(){}};var co=()=>new Pt,Pt=class{},St=new WeakMap,Nt=E(class extends pt{render(o){return d}update(o,[t]){let e=t!==this.G;return e&&this.G!==void 0&&this.rt(void 0),(e||this.lt!==this.ct)&&(this.G=t,this.ht=o.options?.host,this.rt(this.ct=o.element)),d}rt(o){if(this.isConnected||(o=void 0),typeof this.G=="function"){let t=this.ht??globalThis,e=St.get(t);e===void 0&&(e=new WeakMap,St.set(t,e)),e.get(this.G)!==void 0&&this.G.call(this.ht,void 0),e.set(this.G,o),o!==void 0&&this.G.call(this.ht,o)}else this.G.value=o}get lt(){return typeof this.G=="function"?St.get(this.ht??globalThis)?.get(this.G):this.G?.value}disconnected(){this.lt===this.ct&&this.rt(void 0)}reconnected(){this.rt(this.ct)}});var Dt=o=>{let t=o;for(;t=t.parentNode??t.host;)if(t?.constructor?.lumina){let e=t;return e.manager?.loadedCalled||(e.J??e._offspring).push(o),(e.I??e._postLoad).promise}return!1},Lt={};function Ut(){}function Rt(o){for(let e of["Associated","Disabled","Reset","StateRestore"]){let s=`orm${e}Callback`;o.prototype["f"+s]=function(...r){this.manager===void 0?this.constructor.B.then(()=>t(this,s,...r)):t(this,s,...r)}}let t=(e,s,...r)=>(e.el??e).dispatchEvent(new CustomEvent(`luminaF${s}`,{detail:r}))}var Je=(o,t)=>function(s,r){if(!globalThis.customElements)return;let i=(r??s??{}).resourcesUrl;i&&o.setAssetPath(i);for(let[a,[c,l="",u=0]]of Object.entries(t)){if(customElements.get(a))continue;let[h,m,v]=l.split(";"),C=h?h?.split(",").map(Ye):void 0,yt=C?.map(([D])=>D),J=class extends xt{static{this.formAssociated=u===1}static{this.observedAttributes=C?.map(([,D])=>D).filter(D=>D!=="")}static{this.C=yt}static{this.E=m?m?.split(","):void 0}static{this.D=v?.split(",")}static{this.L=a}static{this.K=o}constructor(){!J.B&&(J.B=c(),J.F()),super()}};customElements.define(a,J)}},ut=Object.defineProperty,Ye=o=>{let t=o.split(":");return t.length===1?[t[0],lt(t[0])]:t},Ze=globalThis.HTMLElement??Ut,xt=class extends Ze{constructor(){super(),this.#e={},this.#s=[],this.I=new b,this.H=new b,this.J=[];let t=this,e=t.constructor;t._offspring=t.J,t._postLoad=t.I,e.C?.forEach(s=>{Object.hasOwn(t,s)&&(t.#e[s]=t[s],delete t[s])}),e.A?t.#r({a:e.A}):e.B.then(async s=>{await e.K.p,t.#r(await(s.default?.then(r=>typeof r=="function"?{a:r}:r)??s))}).catch(s=>{t.H.reject(s),setTimeout(()=>{throw s})})}static{this.lumina=!0}static F(){for(let t of this.C??[])ut(this.prototype,t,{configurable:!0,enumerable:!0,get(){return this.#e[t]},set(e){this.#e[t]=e}});for(let t of this.E??[])ut(this.prototype,t,{async value(...e){return this.#t||await this.H.promise,await this.#t[t](...e)},configurable:!0});for(let t of this.D??[])ut(this.prototype,t,{value(...e){return this.#t[t](...e)},configurable:!0})}static{Rt(this)}#t;#e;#s;get manager(){return this.#t?.manager}attributeChangedCallback(t,e,s){this.#t?.attributeChangedCallback(t,e,s),this.#t||this.#s.push(t)}connectedCallback(){this.#t?this.#t.connectedCallback?.():queueMicrotask(()=>this.G=Dt(this))}disconnectedCallback(){this.#t?.disconnectedCallback?.()}async componentOnReady(){return await this.H.promise,this}#r(t){let e=this.constructor,s=e.L,r=this.#e,n=Object.values(t).find(h=>h.L===s),i=`${s}--lazy`,a=n;for(;a&&!Object.hasOwn(a,"lumina");)a=Object.getPrototypeOf(a);ts(a),!e.A&&(e.A=n,customElements.define(i,n)),n.N=this;let l=document.createElement(i);n.N=void 0,this.#t=l,this.#e=l,this.#s.forEach(h=>l.attributeChangedCallback(h,null,this.getAttribute(h))),Object.entries(r).forEach(Xe,l);let u=this.isConnected;(u||this.G)&&(l.connectedCallback?.(),u||l.disconnectedCallback())}addController(){}requestUpdate(){this.#t?.requestUpdate()}};function Xe([o,t]){this[o]=t}var ts=o=>{let t=o.prototype,e=Element.prototype;Object.hasOwn(t,"isConnected")||(t.setAttribute=function(r,n){e.setAttribute.call(this.el,r,n)},t.removeAttribute=function(r){e.removeAttribute.call(this.el,r)},ut(t,"isConnected",{get(){return Reflect.get(e,"isConnected",this.el)}}))};var ft=class extends le{constructor(t){super(t),this.destroyed=!1,this.R=!1,this.V=d,this.T=[],this.#s=new WeakMap,this.#e=t,this.exports=void 0,this.hasDestroy=mt in t&&typeof t.destroy=="function",$.prototype.addController.call(t,{hostConnected:()=>{if(this.destroyed){let e=t.el.localName;throw t.el.remove(),new Error(`The ${e} component has already been destroyed. It cannot be used again. If you meant to disconnect and reconnect a component without automatic destroy, set the ${mt} prop.`)}this.#t!==void 0&&clearTimeout(this.#t),I();for(let e of t.M)"triggerConnected"in e?e.triggerConnected():p(e.hostConnected,e)},hostDisconnected:()=>{for(let e of t.M)"triggerDisconnected"in e?e.triggerDisconnected():p(e.hostDisconnected,e);this.hasDestroy&&!this.destroyed&&this.U()},hostUpdate:()=>{for(let e of t.M)"triggerUpdate"in e?e.triggerUpdate(this.Q):p(e.hostUpdate,e,this.Q)},hostUpdated:()=>{for(let e of t.M)"triggerUpdated"in e?e.triggerUpdated(this.Q):p(e.hostUpdated,e,this.Q);this.Q=void 0}}),queueMicrotask(()=>this.R=!0),x(t)}#t;#e;async destroy(){if(!this.destroyed){this.#e.el.isConnected&&(this.hasDestroy=!1,this.#e.el.remove()),this.#t=void 0,this.destroyed=!0;for(let t of this.#e.M)"triggerDestroy"in t?t.triggerDestroy():p(t.hostDestroy,t);this.#e.M.splice(0)}}U(){if(this.#t!==void 0&&clearTimeout(this.#t),!this.#e.el.isConnected&&!this.#e.autoDestroyDisabled){let t=()=>void this.#e.destroy();this.#t=ne(t,es)}}S(t,e){let s=this.T;this.V=d,this.T=[],s.forEach(r=>r(t,e))}#s;W(t,e){(typeof e=="object"&&e!==null||typeof e=="function")&&this.#s.set(e,t)}X(t){if(typeof t=="object"&&t!==null||typeof t=="function")return this.#s.get(t)}},es=1e3,mt="autoDestroyDisabled";var ye=E(class extends g{constructor(o){if(super(o),o.type!==y.ATTRIBUTE||o.name!=="class"||o.strings?.length>2)throw Error("`classMap()` can only be used in the `class` attribute and must be the only part in the attribute.")}render(o){return" "+Object.keys(o).filter(t=>o[t]).join(" ")+" "}update(o,[t]){if(this.st===void 0){this.st=new Set,o.strings!==void 0&&(this.nt=new Set(o.strings.join(" ").split(/\s/).filter(s=>s!=="")));for(let s in t)t[s]&&!this.nt?.has(s)&&this.st.add(s);return this.render(t)}let e=o.element.classList;for(let s of this.st)s in t||(e.remove(s),this.st.delete(s));for(let s in t){let r=!!t[s];r===this.st.has(s)||this.nt?.has(s)||(r?(e.add(s),this.st.add(s)):(e.remove(s),this.st.delete(s)))}return f}});var ge="important",ss=" !"+ge,os=E(class extends g{constructor(o){if(super(o),o.type!==y.ATTRIBUTE||o.name!=="style"||o.strings?.length>2)throw Error("The `styleMap` directive must be used in the `style` attribute and must be the only part in the attribute.")}render(o){return Object.keys(o).reduce((t,e)=>{let s=o[e];return s==null?t:t+`${e=e.includes("-")?e:e.replace(/(?:^(webkit|moz|ms|o)|)(?=[A-Z])/g,"-$&").toLowerCase()}:${s};`},"")}update(o,[t]){let{style:e}=o.element;if(this.ft===void 0)return this.ft=new Set(Object.keys(t)),this.render(t);for(let s of this.ft)t[s]==null&&(this.ft.delete(s),s.includes("-")?e.removeProperty(s):e[s]=null);for(let s in t){let r=t[s];if(r!=null){this.ft.add(s);let n=typeof r=="string"&&r.endsWith(ss);s.includes("-")||n?e.setProperty(s,n?r.slice(0,-11):r,n?ge:""):e[s]=r}}return f}});var rs=E(class extends g{constructor(o){if(super(o),o.type!==y.PROPERTY&&o.type!==y.ATTRIBUTE&&o.type!==y.BOOLEAN_ATTRIBUTE)throw Error("The `live` directive is not allowed on child or event bindings");if(!ht(o))throw Error("`live` bindings can only contain a single expression")}render(o){return o}update(o,[t]){if(t===f||t===d)return t;let e=o.element,s=o.name;if(o.type===y.PROPERTY){if(t===e[s])return f}else if(o.type===y.BOOLEAN_ATTRIBUTE){if(!!t===e.hasAttribute(s))return f}else if(o.type===y.ATTRIBUTE&&e.getAttribute(s)===t+"")return f;return ue(o),t}});var ve=class o extends ${constructor(){super(),this.M=[],this.manager=new ft(this);let t=this,e=t.constructor,s=e.N,r=e.K.o,n=o.prototype.shouldUpdate;t.#r=s?.H??new b,t.I=s?.I??new b,t.J=s?.J??[],t._offspring=t.J,t._postLoad=t.I,t.el=s??t,t.#s=t.enableUpdating,t.enableUpdating=Ut,t.shouldUpdate!==n&&(t.#e=t.shouldUpdate,t.shouldUpdate=n),r&&(t.#t=new Map,e.elementProperties.forEach((i,a)=>t.#t.set(a,r()))),!1}static finalizeStyles(t){let e=super.finalizeStyles(t),s=this.shadowRootOptions===Lt;return this.K?.commonStyles===void 0||s?e:[this.K.commonStyles,...e]}static createProperty(t,e){let s=typeof e=="number"?e:Array.isArray(e)?e[0]:0,r=Array.isArray(e)?e[1]:void 0,n=r?.hasChanged??j,i={attribute:s&1&&typeof t=="string"?lt(t):!1,reflect:!!(s&2),type:s&4?Boolean:s&8?Number:void 0,state:!!(s&16),readOnly:!!(s&32),noAccessor:!!(s&64),c:!1,...r,hasChanged(a,c){let l=n(a,c);return i.c=l,l}};super.createProperty(t,i)}static getPropertyDescriptor(t,e,s){let r=this.K,n=super.getPropertyDescriptor(t,e,s);return s.d=n,{...n,get(){return r.t?.(this.#t.get(t)),n.get?.call(this)},set(i){let a=this.manager;if(s.readOnly&&!at&&(a.R||a.connectedCalled))throw Error(`Cannot assign to read-only property "${t}" of ${this.el.localName}. Trying to assign "${i}"`);n.set.call(this,i??void 0),s.c&&this.#t?.get(t)?.notify(),a.T.length>0&&(I(),a?.S(t,i))}}}static{this.lumina=!0}static{Rt(this)}#t;#e;#s;#r;#n;#a;get elementInternals(){return this.#a??=this.el.attachInternals(),this.#a}connectedCallback(){if(this.el.hasAttribute("defer-hydration"))return;let t=this.constructor.K.c?.(()=>this.requestUpdate());this.#n=t;let e=!this.manager.connectedCalled;super.connectedCallback(),e?queueMicrotask(()=>this.#h().catch(s=>{this.#r.reject(s),setTimeout(()=>{throw s})})):t&&this.requestUpdate()}#l(t){try{this.#n.clear(),this.constructor.K.r(this.#n,()=>super.update(t))}catch(e){throw this.#n.clear(),e}}disconnectedCallback(){super.disconnectedCallback(),this.#n?.destroy(),this.#n=void 0}createRenderRoot(){let t=this.el.shadowRoot,e=this.constructor,s=e.shadowRootOptions,n=t??(s===Lt?this.el:this.el.attachShadow(s));if(this.isConnected){let i=n.getRootNode();i.adoptedStyleSheets=[...i.adoptedStyleSheets,...e.elementStyles.map(a=>"styleSheet"in a?a.styleSheet:a)]}return n}async#h(){let t=this.el.G??Dt(this.el);t&&await t;let e=[];for(let r of this.M)"triggerLoad"in r?e.push(r.triggerLoad()):e.push(W(r.hostLoad,r));await Promise.all(e),await this.load?.(),this.manager.hasDestroy&&this.manager.onUpdate(r=>r.has(mt)&&this.manager.U()),this.#s(!0),this.performUpdate(),this.I.resolve(),await Promise.resolve();let s=this.J.filter(r=>!r.manager?.loadedCalled);s.length&&await Promise.allSettled(s.map(async r=>await r.componentOnReady())),this.J.length=0,this.el.setAttribute(this.constructor.K.hydratedAttribute,"");for(let r of this.M)"triggerLoaded"in r?r.triggerLoaded():p(r.hostLoaded,r);this.loaded?.(),this.#r.resolve()}shouldUpdate(t){return this.manager.Q=t,this.#e?.(t)??!0}update(t){this.#n?this.#l(t):super.update(t)}listen(t,e,s){let r=e?.bind(this)??e;this.manager.onLifecycle(()=>(this.el.addEventListener(t,r,s),()=>this.el.removeEventListener(t,r,s)))}listenOn(t,e,s,r){let n=s?.bind(this)??s;this.manager.onLifecycle(()=>(t.addEventListener(e,n,r),()=>t.removeEventListener(e,n,r)))}async componentOnReady(){return await this.#r.promise,this}addController(t){this.M.push(t),!(q in t)&&this.renderRoot&&this.el.isConnected&&t.hostConnected?.()}removeController(t){this.M.splice(this.M.indexOf(t),1),t.controllerRemoved?.()}};var Ee=o=>{let t,e=r=>{t=new URL(r,globalThis.location?.href||void 0).href},s={...o,getAssetPath(r){let n=new URL(r,t);return n.origin!==globalThis.location?.origin?n.href:n.pathname},setAssetPath:e,customElement(r,n){n.K=s,n.L=r,customElements.get(r)||customElements.define(r,n)}};return e(o.defaultAssetPath),s};var Pr=o=>typeof o=="object"&&o!=null?ye(o):o;var It=class extends g{#t;#e;constructor(t){super(t);let e=this;this.#e=function(r){return e.#t.call(this,r)}}render(t){return typeof t=="function"?(this.#t=t,Nt(this.#e)):Nt(t)}},Nr=E(It);var xr=d;var Q=Ee({defaultAssetPath:"https://jsdev.arcgis.com/5.1.0-next/coding-components/",hydratedAttribute:"hydrated"}),{customElement:Ir,getAssetPath:Mr,setAssetPath:kr}=Q;Q.t=void 0;Q.o=void 0;Q.c=void 0;Q.r=void 0;export{Ns as a,x as b,ee as c,se as d,xs as e,Ds as f,jt as g,$e as h,j as i,fs as j,f as k,d as l,je as m,ze as n,Tt as o,Vs as p,Bs as q,Ws as r,Fs as s,qs as t,Je as u,y as v,E as w,g as x,Qs as y,Js as z,ue as A,Ys as B,Zs as C,co as D,Nt as E,ve as F,Pr as G,xr as H,Q as I,Ir as J,Mr as K};
@@ -1,2 +1,2 @@
1
1
  /* COPYRIGHT Esri - https://js.arcgis.com/5.1/LICENSE.txt */
2
- import{b as r}from"./P5D2YYFD.js";import{K as o}from"./EMMNZESW.js";var s=r(o);export{s as a};
2
+ import{b as r}from"./PWVGWGF5.js";import{K as o}from"./Q5SGN46H.js";var s=r(o);export{s as a};
@@ -1,2 +1,2 @@
1
1
  /* COPYRIGHT Esri - https://js.arcgis.com/5.1/LICENSE.txt */
2
- import{a as k,c as u,d as L}from"./WTNM2NCZ.js";import h from"./SXHJ77MK.js";import e from"./T7GEIGWF.js";import"./HPZZVB4X.js";import d from"./FWVG6H2C.js";import{a as N}from"./MP6Z45SA.js";import c from"./F75C3HE6.js";import{a as w}from"./P5D2YYFD.js";import a from"./7LS3R4TH.js";import"./IFNCCZ7O.js";import"./QWLPT7LO.js";import{a as C}from"./NKCYMRE4.js";import"./BQLG62QR.js";import{a as E,b as y,c as b}from"./WMLTLTIE.js";import"./UYBZWFE5.js";import{F as v,J as S,K as T,h as g,i as _,j as l}from"./EMMNZESW.js";import{b as f}from"./BCUUVBXH.js";import"./YLN7EMJC.js";import"./GHSEU7VA.js";import"./4OSKRQ5X.js";import"./NG7S6FUK.js";import"./3TTFCHAA.js";export default $arcgis.t(([,,,{a:O},{a:c,b:p}])=>{var M=Symbol(),h=class{get taskComplete(){return this.t||(this.i===1?this.t=new Promise(((t,e)=>{this.o=t,this.h=e})):this.i===3?this.t=Promise.reject(this.l):this.t=Promise.resolve(this.u)),this.t}constructor(t,e,s){this.p=0,this.i=0,(this._=t).addController(this);let i=typeof e=="object"?e:{task:e,args:s};this.v=i.task,this.j=i.args,this.m=i.argsEqual??A,this.k=i.onComplete,this.A=i.onError,this.autoRun=i.autoRun??!0,"initialValue"in i&&(this.u=i.initialValue,this.i=2,this.O=this.T?.())}hostUpdate(){this.autoRun===!0&&this.S()}hostUpdated(){this.autoRun==="afterUpdate"&&this.S()}T(){if(this.j===void 0)return;let t=this.j();if(!Array.isArray(t))throw Error("The args function must return an array");return t}async S(){let t=this.T(),e=this.O;this.O=t,t===e||t===void 0||e!==void 0&&this.m(e,t)||await this.run(t)}async run(t){let e,s;t??=this.T(),this.O=t,this.i===1?this.q?.abort():(this.t=void 0,this.o=void 0,this.h=void 0),this.i=1,this.autoRun==="afterUpdate"?queueMicrotask((()=>this._.requestUpdate())):this._.requestUpdate();let i=++this.p;this.q=new AbortController;let o=!1;try{e=await this.v(t,{signal:this.q.signal})}catch(d){o=!0,s=d}if(this.p===i){if(e===M)this.i=0;else{if(o===!1){try{this.k?.(e)}catch{}this.i=2,this.o?.(e)}else{try{this.A?.(s)}catch{}this.i=3,this.h?.(s)}this.u=e,this.l=s}this._.requestUpdate()}}abort(t){this.i===1&&this.q?.abort(t)}get value(){return this.u}get error(){return this.l}get status(){return this.i}render(t){switch(this.i){case 0:return t.initial?.();case 1:return t.pending?.();case 2:return t.complete?.(this.value);case 3:return t.error?.(this.error);default:throw Error("Unexpected status: "+this.i)}}},A=(n,t)=>n===t||n.length===t.length&&n.every(((e,s)=>!_(e,t[s])));var q=g`pre{direction:ltr;overflow-x:auto;background-color:var(--calcite-color-foreground-2);padding:var(--calcite-spacing-sm);white-space:pre-line;code{font-size:var(--calcite-font-size--2);font-family:var(--calcite-font-family-code)}}:host([round]){pre{border-radius:var(--calcite-corner-radius-round)}}`,m=class extends v{constructor(){super(...arguments),this._monacoEditor=w(C),this.#e=Promise.withResolvers(),this.#t="",this._slotContentObservers=[],this._onDefaultSlotChange=async t=>{E(t)||(this._codeFromSlot="");let e=t.target instanceof HTMLSlotElement?t.target:null,s=e?this._computeSlotText(e):"";e&&this._observeAssignedSlotNodes(e),s!==this._codeFromSlot&&(this._codeFromSlot=s),this.#e.resolve()},this._colorizeTask=new h(this,{task:async([t,e],{signal:s})=>{if(await this.#e.promise,s.aborted)return this.#t;if(await c(e),s.aborted)return this.#t;let i=await k(t,e);return s.aborted?this.#t:(this.#t=i,i)},args:()=>[this._codeFromSlot,this.language]}),this._codeFromSlot="",this.language="arcade",this.round=!1}static{this.properties={_codeFromSlot:16,language:1,round:7}}static{this.styles=q}#e;#t;async load(){O(T("./assets")),await p(this.language),await c(this.language),this._applyColorizeStyles(u()),this.manager.onLifecycle(()=>(this._themeObserver=y(this.el,["class"],()=>this.updateTheme()),this._themeChangedListener=L(()=>{this._applyColorizeStyles(u())}),this.updateTheme(),()=>{this._themeObserver?.(),this._themeObserver=void 0,this._themeChangedListener?.dispose(),this._themeChangedListener=void 0}))}loaded(){this.el.hasChildNodes()||this.#e.resolve()}willUpdate(t){t.has("language")&&p(this.language).then(()=>c(this.language)).catch(f(this))}disconnectedCallback(){super.disconnectedCallback(),this._disposeSlotObservers()}_disposeSlotObservers(){this._slotContentObservers.length&&(this._slotContentObservers.forEach(t=>t.disconnect()),this._slotContentObservers=[])}_observeAssignedSlotNodes(t){this._disposeSlotObservers();let e=t.assignedNodes({flatten:!0});if(!e.length)return;let s=new Set;for(let r of e)r.nodeType===Node.ELEMENT_NODE?s.add(r):r.nodeType===Node.TEXT_NODE&&r.parentElement&&s.add(r.parentElement);let i={characterData:!0,childList:!0,subtree:!0},o=N(()=>{let r=this._computeSlotText(t);r!==this._codeFromSlot&&(this._codeFromSlot=r)},100),d=r=>{if(r.some(a=>a.type==="childList")){let a=this._computeSlotText(t);a!==this._codeFromSlot&&(this._codeFromSlot=a);return}o()};s.forEach(r=>{let a=new MutationObserver(d);a.observe(r,i),this._slotContentObservers.push(a)})}_computeSlotText(t){let e=t.assignedNodes({flatten:!0}).filter(s=>s.nodeType!==Node.COMMENT_NODE);if(this.language==="html"&&e.length){let s=e.find(o=>o.nodeType===Node.ELEMENT_NODE&&o.tagName==="TEMPLATE");if(s)return(s.innerHTML??"").trim();let i=e.map(o=>o.nodeType===Node.ELEMENT_NODE?o.outerHTML:o.nodeType===Node.TEXT_NODE?o.textContent??"":"").join("").trim();return i}return e.map(s=>s.textContent??"").join("").trim()}updateTheme(){let t=b(this.el)==="light"?"vs":"vs-dark";t!==this._currentTheme&&(this._currentTheme=t,this._monacoEditor.setTheme(t))}_applyColorizeStyles(t){if(!this._colorizeSheet){this._colorizeSheet=new CSSStyleSheet;let e=this.renderRoot;e.adoptedStyleSheets=[...e.adoptedStyleSheets,this._colorizeSheet]}this._colorizeSheet.replaceSync(t)}render(){return l`<div><slot @slotchange=${this._onDefaultSlotChange} style="display:none" aria-hidden=true></slot><pre class="arcgis-code-viewer" aria-label=${`${this.language} code snippet`}>${this._colorizeTask.render({error:()=>null,pending:()=>l`<code class=${`language-${this.language}`}></code>`,complete:t=>l`<code class=${`language-${this.language}`} .innerHTML=${t??""}></code>`})}</pre></div>`}};S("arcgis-code-viewer",m);return m},a,c,d,e,h)
2
+ import{a as k,c as u,d as L}from"./WTNM2NCZ.js";import h from"./TR2ADMZL.js";import e from"./T7GEIGWF.js";import"./HPZZVB4X.js";import d from"./LNSZ6J33.js";import{a as N}from"./MP6Z45SA.js";import c from"./6SEUQ6EB.js";import{a as w}from"./PWVGWGF5.js";import a from"./NQVNVOQR.js";import"./IFNCCZ7O.js";import"./PJHAQGOB.js";import{a as C}from"./NKCYMRE4.js";import"./BQLG62QR.js";import{a as E,b as y,c as b}from"./WMLTLTIE.js";import"./UYBZWFE5.js";import{F as v,J as S,K as T,h as g,i as _,j as l}from"./Q5SGN46H.js";import{b as f}from"./BCUUVBXH.js";import"./YLN7EMJC.js";import"./GHSEU7VA.js";import"./4OSKRQ5X.js";import"./NG7S6FUK.js";import"./3TTFCHAA.js";export default $arcgis.t(([,,,{a:O},{a:c,b:p}])=>{var M=Symbol(),h=class{get taskComplete(){return this.t||(this.i===1?this.t=new Promise(((t,e)=>{this.o=t,this.h=e})):this.i===3?this.t=Promise.reject(this.l):this.t=Promise.resolve(this.u)),this.t}constructor(t,e,s){this.p=0,this.i=0,(this._=t).addController(this);let i=typeof e=="object"?e:{task:e,args:s};this.v=i.task,this.j=i.args,this.m=i.argsEqual??A,this.k=i.onComplete,this.A=i.onError,this.autoRun=i.autoRun??!0,"initialValue"in i&&(this.u=i.initialValue,this.i=2,this.O=this.T?.())}hostUpdate(){this.autoRun===!0&&this.S()}hostUpdated(){this.autoRun==="afterUpdate"&&this.S()}T(){if(this.j===void 0)return;let t=this.j();if(!Array.isArray(t))throw Error("The args function must return an array");return t}async S(){let t=this.T(),e=this.O;this.O=t,t===e||t===void 0||e!==void 0&&this.m(e,t)||await this.run(t)}async run(t){let e,s;t??=this.T(),this.O=t,this.i===1?this.q?.abort():(this.t=void 0,this.o=void 0,this.h=void 0),this.i=1,this.autoRun==="afterUpdate"?queueMicrotask((()=>this._.requestUpdate())):this._.requestUpdate();let i=++this.p;this.q=new AbortController;let o=!1;try{e=await this.v(t,{signal:this.q.signal})}catch(d){o=!0,s=d}if(this.p===i){if(e===M)this.i=0;else{if(o===!1){try{this.k?.(e)}catch{}this.i=2,this.o?.(e)}else{try{this.A?.(s)}catch{}this.i=3,this.h?.(s)}this.u=e,this.l=s}this._.requestUpdate()}}abort(t){this.i===1&&this.q?.abort(t)}get value(){return this.u}get error(){return this.l}get status(){return this.i}render(t){switch(this.i){case 0:return t.initial?.();case 1:return t.pending?.();case 2:return t.complete?.(this.value);case 3:return t.error?.(this.error);default:throw Error("Unexpected status: "+this.i)}}},A=(n,t)=>n===t||n.length===t.length&&n.every(((e,s)=>!_(e,t[s])));var q=g`pre{direction:ltr;overflow-x:auto;background-color:var(--calcite-color-foreground-2);padding:var(--calcite-spacing-sm);white-space:pre-line;code{font-size:var(--calcite-font-size--2);font-family:var(--calcite-font-family-code)}}:host([round]){pre{border-radius:var(--calcite-corner-radius-round)}}`,m=class extends v{constructor(){super(...arguments),this._monacoEditor=w(C),this.#e=Promise.withResolvers(),this.#t="",this._slotContentObservers=[],this._onDefaultSlotChange=async t=>{E(t)||(this._codeFromSlot="");let e=t.target instanceof HTMLSlotElement?t.target:null,s=e?this._computeSlotText(e):"";e&&this._observeAssignedSlotNodes(e),s!==this._codeFromSlot&&(this._codeFromSlot=s),this.#e.resolve()},this._colorizeTask=new h(this,{task:async([t,e],{signal:s})=>{if(await this.#e.promise,s.aborted)return this.#t;if(await c(e),s.aborted)return this.#t;let i=await k(t,e);return s.aborted?this.#t:(this.#t=i,i)},args:()=>[this._codeFromSlot,this.language]}),this._codeFromSlot="",this.language="arcade",this.round=!1}static{this.properties={_codeFromSlot:16,language:1,round:7}}static{this.styles=q}#e;#t;async load(){O(T("./assets")),await p(this.language),await c(this.language),this._applyColorizeStyles(u()),this.manager.onLifecycle(()=>(this._themeObserver=y(this.el,["class"],()=>this.updateTheme()),this._themeChangedListener=L(()=>{this._applyColorizeStyles(u())}),this.updateTheme(),()=>{this._themeObserver?.(),this._themeObserver=void 0,this._themeChangedListener?.dispose(),this._themeChangedListener=void 0}))}loaded(){this.el.hasChildNodes()||this.#e.resolve()}willUpdate(t){t.has("language")&&p(this.language).then(()=>c(this.language)).catch(f(this))}disconnectedCallback(){super.disconnectedCallback(),this._disposeSlotObservers()}_disposeSlotObservers(){this._slotContentObservers.length&&(this._slotContentObservers.forEach(t=>t.disconnect()),this._slotContentObservers=[])}_observeAssignedSlotNodes(t){this._disposeSlotObservers();let e=t.assignedNodes({flatten:!0});if(!e.length)return;let s=new Set;for(let r of e)r.nodeType===Node.ELEMENT_NODE?s.add(r):r.nodeType===Node.TEXT_NODE&&r.parentElement&&s.add(r.parentElement);let i={characterData:!0,childList:!0,subtree:!0},o=N(()=>{let r=this._computeSlotText(t);r!==this._codeFromSlot&&(this._codeFromSlot=r)},100),d=r=>{if(r.some(a=>a.type==="childList")){let a=this._computeSlotText(t);a!==this._codeFromSlot&&(this._codeFromSlot=a);return}o()};s.forEach(r=>{let a=new MutationObserver(d);a.observe(r,i),this._slotContentObservers.push(a)})}_computeSlotText(t){let e=t.assignedNodes({flatten:!0}).filter(s=>s.nodeType!==Node.COMMENT_NODE);if(this.language==="html"&&e.length){let s=e.find(o=>o.nodeType===Node.ELEMENT_NODE&&o.tagName==="TEMPLATE");if(s)return(s.innerHTML??"").trim();let i=e.map(o=>o.nodeType===Node.ELEMENT_NODE?o.outerHTML:o.nodeType===Node.TEXT_NODE?o.textContent??"":"").join("").trim();return i}return e.map(s=>s.textContent??"").join("").trim()}updateTheme(){let t=b(this.el)==="light"?"vs":"vs-dark";t!==this._currentTheme&&(this._currentTheme=t,this._monacoEditor.setTheme(t))}_applyColorizeStyles(t){if(!this._colorizeSheet){this._colorizeSheet=new CSSStyleSheet;let e=this.renderRoot;e.adoptedStyleSheets=[...e.adoptedStyleSheets,this._colorizeSheet]}this._colorizeSheet.replaceSync(t)}render(){return l`<div><slot @slotchange=${this._onDefaultSlotChange} style="display:none" aria-hidden=true></slot><pre class="arcgis-code-viewer" aria-label=${`${this.language} code snippet`}>${this._colorizeTask.render({error:()=>null,pending:()=>l`<code class=${`language-${this.language}`}></code>`,complete:t=>l`<code class=${`language-${this.language}`} .innerHTML=${t??""}></code>`})}</pre></div>`}};S("arcgis-code-viewer",m);return m},a,c,d,e,h)
@@ -1,2 +1,2 @@
1
1
  /* COPYRIGHT Esri - https://js.arcgis.com/5.1/LICENSE.txt */
2
- import c from"./T7GEIGWF.js";import{a as m}from"./HPZZVB4X.js";import b from"./FWVG6H2C.js";import a from"./F75C3HE6.js";import{a as s}from"./NKCYMRE4.js";import{Zk as d,al as t}from"./NG7S6FUK.js";export default $arcgis.t(([n,{a:a,b:p},{c:c}])=>{var k=["arcade","arcgis-sql-expression"],i=new Set,u=new Map;function f(e){let r=u.get(e);return r||(r=Promise.withResolvers(),u.set(e,r)),r}function l(e){f(e).resolve()}function T(e){return k.includes(e)?f(e).promise:Promise.resolve()}function h(e,r){return()=>{i.has(e)||i.add(e),r()}}async function U(e){i.has(e)||(await s()).createModel("",e,d.parse("")).dispose()}t.register({id:n.languageId,aliases:["Arcade","arcade"],extensions:[".arc"],mimetypes:["application/arcade"]});t.onLanguage(n.languageId,h(n.languageId,()=>{c().then(e=>{e.setupMode(n),l(n.languageId)}).catch(e=>{throw e})}));t.register({id:a.languageId,aliases:["EsiSqlExpression","sql-expression"],extensions:[".sql-expression"],mimetypes:["application/sql-expression"]});t.onLanguage(a.languageId,h(a.languageId,()=>{p().then(e=>{e.setupMode(a),l(a.languageId)}).catch(e=>{throw e})}));w();function w(){s().then(e=>{["light","dark"].forEach(r=>{let g=r==="light"?"vs":"vs-dark",o=m[`${r}-theme`];e.defineTheme(g,{base:g,inherit:!0,rules:[{token:"comment.arcgis",foreground:o.comment},{token:"constant.arcgis",foreground:o.constant},{token:"keyword.arcgis",foreground:o.keyword},{token:"identifier.arcgis",foreground:o.identifier},{token:"number.arcgis",foreground:o.number},{token:"string.arcgis",foreground:o.string},{token:"operator.arcgis",foreground:o.operator},{token:"predefined.arcgis",foreground:o.predefined},{token:"date.arcgis",foreground:o.date}],colors:{}})})})}return{a:T,b:U}},a,b,c)
2
+ import c from"./T7GEIGWF.js";import{a as m}from"./HPZZVB4X.js";import b from"./LNSZ6J33.js";import a from"./6SEUQ6EB.js";import{a as s}from"./NKCYMRE4.js";import{Zk as d,al as t}from"./NG7S6FUK.js";export default $arcgis.t(([n,{a:a,b:p},{c:c}])=>{var k=["arcade","arcgis-sql-expression"],i=new Set,u=new Map;function f(e){let r=u.get(e);return r||(r=Promise.withResolvers(),u.set(e,r)),r}function l(e){f(e).resolve()}function T(e){return k.includes(e)?f(e).promise:Promise.resolve()}function h(e,r){return()=>{i.has(e)||i.add(e),r()}}async function U(e){i.has(e)||(await s()).createModel("",e,d.parse("")).dispose()}t.register({id:n.languageId,aliases:["Arcade","arcade"],extensions:[".arc"],mimetypes:["application/arcade"]});t.onLanguage(n.languageId,h(n.languageId,()=>{c().then(e=>{e.setupMode(n),l(n.languageId)}).catch(e=>{throw e})}));t.register({id:a.languageId,aliases:["EsiSqlExpression","sql-expression"],extensions:[".sql-expression"],mimetypes:["application/sql-expression"]});t.onLanguage(a.languageId,h(a.languageId,()=>{p().then(e=>{e.setupMode(a),l(a.languageId)}).catch(e=>{throw e})}));w();function w(){s().then(e=>{["light","dark"].forEach(r=>{let g=r==="light"?"vs":"vs-dark",o=m[`${r}-theme`];e.defineTheme(g,{base:g,inherit:!0,rules:[{token:"comment.arcgis",foreground:o.comment},{token:"constant.arcgis",foreground:o.constant},{token:"keyword.arcgis",foreground:o.keyword},{token:"identifier.arcgis",foreground:o.identifier},{token:"number.arcgis",foreground:o.number},{token:"string.arcgis",foreground:o.string},{token:"operator.arcgis",foreground:o.operator},{token:"predefined.arcgis",foreground:o.predefined},{token:"date.arcgis",foreground:o.date}],colors:{}})})})}return{a:T,b:U}},a,b,c)
@@ -1,2 +1,2 @@
1
1
  /* COPYRIGHT Esri - https://js.arcgis.com/5.1/LICENSE.txt */
2
- import a from"./FWVG6H2C.js";import{a as I}from"./MP6Z45SA.js";import{a as h}from"./NKCYMRE4.js";import{b as l}from"./BCUUVBXH.js";import{Qk as T,al as u}from"./NG7S6FUK.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"./LNSZ6J33.js";import{a as I}from"./MP6Z45SA.js";import{a as h}from"./NKCYMRE4.js";import{b as l}from"./BCUUVBXH.js";import{Qk as T,al as u}from"./NG7S6FUK.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,4 +1,4 @@
1
1
  /* COPYRIGHT Esri - https://js.arcgis.com/5.1/LICENSE.txt */
2
- import{a as oe}from"./ZYS253RG.js";import"./MP6Z45SA.js";import b from"./F75C3HE6.js";import"./P5D2YYFD.js";import a from"./7LS3R4TH.js";import{d as ce}from"./IFNCCZ7O.js";import{c as ne,d as re}from"./QWLPT7LO.js";import"./NKCYMRE4.js";import"./BQLG62QR.js";import"./WMLTLTIE.js";import"./UYBZWFE5.js";import{A as X,B as Z,C as D,D as ee,E as te,F as ae,G as se,H as _,J as ie,h as W,j as p,k as P,l as U,s as K,v as q,w as N,x as F,y as I,z as S}from"./EMMNZESW.js";import{a as k}from"./BCUUVBXH.js";import"./YLN7EMJC.js";import"./GHSEU7VA.js";import"./4OSKRQ5X.js";import"./NG7S6FUK.js";import"./3TTFCHAA.js";export default $arcgis.t(([Ce,pe,Ie,ue,me,{getDeclaredVoxelMembers:Me,getDeclaredPixelMembers:Ee},Re,{property:w,subclass:Ve},{g:le,h:O},z])=>{var de=(a,e,t)=>{let s=new Map;for(let i=e;i<=t;i++)s.set(a[i],i);return s},L=N(class extends F{constructor(a){if(super(a),a.type!==q.CHILD)throw Error("repeat() can only be used in text expressions")}dt(a,e,t){let s;t===void 0?t=e:e!==void 0&&(s=e);let i=[],n=[],l=0;for(let d of a)i[l]=s?s(d,l):l,n[l]=t(d,l),l++;return{values:n,keys:i}}render(a,e,t){return this.dt(a,e,t).values}update(a,[e,t,s]){let i=Z(a),{values:n,keys:l}=this.dt(e,t,s);if(!Array.isArray(i))return this.ut=l,n;let d=this.ut??=[],r=[],o,g,c=0,u=i.length-1,m=0,h=n.length-1;for(;c<=u&&m<=h;)if(i[c]===null)c++;else if(i[u]===null)u--;else if(d[c]===l[m])r[m]=S(i[c],n[m]),c++,m++;else if(d[u]===l[h])r[h]=S(i[u],n[h]),u--,h--;else if(d[c]===l[h])r[h]=S(i[c],n[h]),I(a,r[h+1],i[c]),c++,h--;else if(d[u]===l[m])r[m]=S(i[u],n[m]),I(a,i[c],i[u]),u--,m++;else if(o===void 0&&(o=de(l,m,h),g=de(d,c,u)),o.has(d[c]))if(o.has(d[u])){let f=g.get(l[m]),T=f!==void 0?i[f]:null;if(T===null){let v=I(a,i[c]);S(v,n[m]),r[m]=v}else r[m]=S(T,n[m]),I(a,i[c],T),i[f]=null;m++}else D(i[u]),u--;else D(i[c]),c++;for(;m<=h;){let f=I(a,r[h+1]);S(f,n[m]),r[m++]=f}for(;c<=u;){let f=i[c++];f!==null&&D(f)}return this.ut=l,X(a,r),P}});var R=class extends F{constructor(e){if(super(e),this.it=U,e.type!==q.CHILD)throw Error(this.constructor.directiveName+"() can only be used in child bindings")}render(e){if(e===U||e==null)return this._t=void 0,this.it=e;if(e===P)return e;if(typeof e!="string")throw Error(this.constructor.directiveName+"() called with a non-string value");if(e===this.it)return this._t;this.it=e;let t=[e];return t.raw=t,this._t={_$litType$:this.constructor.resultType,strings:t,values:[]}}};R.directiveName="unsafeHTML",R.resultType=1;var V=N(R);var Pe=W`:host(:not([closed])){container-type:size;--calcite-block-border-color: var(--calcite-color-transparent);box-sizing:border-box;.submission-actions-wrapper{display:flex;flex-direction:column;width:100%;gap:.75rem}.submission-actions{display:flex;flex-direction:row;gap:.5rem;justify-content:space-between}@container (max-width: 380px){.hidden-below-380{display:none}}@container (min-width: 380px){.hidden-above-380{display:none}}.gaps{display:flex;gap:.25rem}.align-inline-end{margin-inline-start:auto}.context-popover p{padding:0 .5rem;font-size:var(--calcite-font-size-sm)}.feedback-content{padding:var(--calcite-spacing-sm);display:flex;flex-direction:column;max-height:75cqb;overflow-y:auto;>*{margin-block-end:.5rem}>*:last-child,.terms-label{margin-block-end:0}calcite-text-area{--calcite-text-area-min-height: 4rem}calcite-notice{margin-block-start:0}}.feedback-sheet{--calcite-sheet-height: auto;--calcite-sheet-max-height: 100%;--calcite-sheet-min-height: auto}.feedback-footer{display:flex;justify-content:flex-end;gap:.5rem;width:100%}calcite-chip[slot=header-actions-end]{align-self:center;margin-inline-end:.5rem}calcite-flow-item calcite-shell{background:transparent}calcite-block{width:100%;max-width:100%;align-self:flex-end;background-color:transparent;margin-block:0}calcite-sheet{--calcite-sheet-scrim-background: rgba(200, 200, 200, .5)}calcite-list-item calcite-button{margin-inline-end:.25rem}calcite-flow-item calcite-shell calcite-notice{margin-block:1rem}calcite-block[open]:last-of-type{border-block-end:0}.text-area-wrapper{display:flex;border-radius:var(--calcite-corner-radius-round);margin:.75rem;overflow:hidden;--calcite-color-border-input: transparent;position:sticky;box-shadow:var(--calcite-shadow-sm);flex:none;flex-direction:column}calcite-text-area{height:auto;overflow:hidden;--calcite-font-weight-normal: 500;font-weight:500;line-height:1.2}calcite-flow{height:100%}calcite-popover calcite-list{--calcite-list-background-color: transparent;--calcite-input-border-color: transparent}calcite-popover calcite-list calcite-filter{--calcite-spacing-sm: 0}.contained-popover-or-tooltip{--calcite-popover-max-size-x: 100%;--calcite-tooltip-max-size-x: 100%}.info-heading{font-size:var(--calcite-font-size-0);color:var(--calcite-color-text-1);margin:0}.info-heading-row{display:flex;align-items:center;gap:var(--calcite-spacing-sm);flex-wrap:wrap}.unstyled-h3{margin:unset;font-size:var(--calcite-font-size-md)}.unstyled-shell{position:unset;inset:unset;display:unset;block-size:unset;inline-size:unset}.suggestion-button{font-weight:var(--calcite-font-weight-medium)}.suggestions{display:flex;flex-direction:row;gap:var(--calcite-spacing-xs);flex-wrap:wrap}.info-block{max-width:450px}#result-block{calcite-card-group{--calcite-card-group-gap: 1.25rem}calcite-card{--calcite-card-corner-radius: var(--calcite-corner-radius-round);--calcite-card-border-color: transparent;width:100%}.positioned-code-content{display:flex;flex-direction:row;gap:.5rem;padding:.5rem}calcite-card [slot=heading] calcite-chip{margin-block-start:.25rem}.code-response-wrapper{position:relative;background:var(--calcite-color-foreground-2);border-radius:var(--calcite-corner-radius-round);margin-top:-1.5rem}.prior-prompt{display:flex;flex-direction:row;padding:0;overflow-y:hidden;overflow-x:auto;margin:.25rem 0 .75rem;align-items:center;max-width:100%;span{overflow-x:auto;overflow-y:hidden}}.copy-feedback{display:none}.copy-prompt-button{align-self:flex-start;margin-inline-start:auto}.response-secondary-action-button[data-copied]+.copy-feedback,.copy-prompt-button[data-copied]+.copy-feedback{display:block;span{padding:.75rem 1rem;font-size:var(--calcite-font-size--2);line-height:1.375;color:var(--calcite-color-text--2);font-weight:var(--calcite-font-weight-medium)}}.copy-prompt-button[data-copied]~.copy-tooltip,.response-secondary-action-button[data-copied]~.copy-tooltip{display:none}code{white-space:pre;font-size:12px;margin:0;overflow-x:auto;font-family:Fira Mono,Consolas,Menlo,monospace;display:block;max-height:12rem;position:relative;padding:.5rem}.response-secondary-action-button{margin-left:.5rem}.add-to-editor-button{--calcite-internal-button-border-color: unset}}.collapsible-code{padding:.5rem}.collapsible-code summary{cursor:pointer;font-weight:500;color:var(--calcite-color-brand);outline:none;padding:.25rem 0}.collapsible-code[open] summary{color:var(--calcite-color-text-2)}.response-error-container{padding:.5rem;background:color-mix(in srgb,var(--calcite-color-status-warning) 10%,transparent);border-radius:var(--calcite-corner-radius-round);margin:1rem 0;font-size:var(--calcite-font-size--2);--calcite-input-message-icon-color: var(--calcite-color-status-warning)}.response-error-chip{--calcite-internal-chip-background-color: var(--calcite-color-status-warning);--calcite-chip-icon-color: var(--calcite-color-foreground-1);--calcite-chip-border-color: var(--calcite-color-transparent)}.feedback-actions{gap:unset}.contained{max-width:100%;max-height:100%;max-width:100cqi;max-height:75cqb;overflow-y:auto}.submission-notice{--calcite-notice-border-color: transparent;margin-block:0;width:100%;--calcite-font-size-relative-base: var(--calcite-font-size--2)}.border-block-end{border-block-end:1px solid var(--calcite-color-border-3)}.round-top{border-radius:var(--calcite-corner-radius-round) var(--calcite-corner-radius-round) 0 0}}:host([closed]){display:none}`,A=class extends Error{constructor({message:e,code:t,subCode:s,details:i,source:n}){super(e),this.name="ArcadeAssistantError",this.code=t,this.subCode=s,this.details=i,this.source=n}};function he(a){if(!a)return;let e=a.indexOf('{"error":');if(e!==-1)try{let t=a.slice(e),s=JSON.parse(t);if(s&&typeof s=="object"&&s.error)return s.error}catch{return}}async function qe(a){let{baseUrl:e,skillId:t,message:s,authToken:i,previousConversationId:n,context:l}=a,d=t?`${e}/skills/${t}/chat`:`${e}/chat`,r=[],o={message:s,context:l};n&&(o.conversation_id=n);let g;try{g=await pe(d,{method:"post",headers:{"Content-Type":"application/json",token:i},body:JSON.stringify(o),responseType:"json"})}catch(v){let $=v,C=$.details?.rawResponse||$.message||String(v),M=he(C);throw M?new A(M):v}let c=g.data;r.push(c);let u=c.conversationId,m=c.inquiryId,h=c.sequenceNumber;async function f(){let v=0,$=100;for(;v<$;){await new Promise(E=>setTimeout(E,1e3));let C=Ne(u,h,m),M;try{M=await pe(d,{method:"post",headers:{"Content-Type":"application/json",token:i},body:JSON.stringify(C),responseType:"json"})}catch(E){let J=E,Ae=J.details?.rawResponse||J.message||String(E),Y=he(Ae);throw Y?new A(Y):E}let x=M.data;if(x.context?.kind==="ArcgisErrorAsContext"&&x.context.error)throw new A({message:x.context.error.message||"ArcGIS Assistant error",code:x.context.error.code,subCode:x.context.error.subCode,details:x.context.error.details,source:"polling-response"});if(r.push(x),h=x.sequenceNumber,v++,!x.hasMore)break}if(v===$)throw new A({message:"Request timed out",code:"TIMEOUT",source:"polling"})}let T=120*1e3;return await Promise.race([f(),new Promise((v,$)=>setTimeout(()=>$(new A({message:"Request timed out",code:"TIMEOUT",source:"hard-timeout"})),T))]),r}function Ne(a,e,t){return{conversationId:a,inquiryId:t,ackSequenceNumber:e}}function Fe(a){return a.message.match(/Error in prompt shield/u)?"I'm having trouble with this request. Try again by rephrasing the question.":a.code==="TIMEOUT"?"Request timed out. Try again by re-asking the same question or rephrasing it.":a.message}var De=({notices:a})=>a.length?p`<div class="border-block-end">${L(a,e=>e.id??e.title,e=>p`<calcite-notice class="submission-notice" .icon=${e.icon} .kind=${e.kind} scale=s open .closable=${e.closable} @calciteNoticeClose=${()=>e.onClose?.()}><div slot=title>${e.title}</div>${e.message&&p`<div slot=message>${e.message}</div>`||""}${e.actionLinkMessage&&e.onAction&&p`<calcite-link slot=link @click=${()=>e.onAction?.()}>${e.actionLinkMessage}</calcite-link>`||""}</calcite-notice>`)}</div>`:null,_e=a=>{let e=a.value.length,t=72,s=180,i=a.offsetWidth,n=Math.max(1,Math.floor(i/8)),l=Math.ceil(e/n),d=t+(l-2)*24;a.style.setProperty("--calcite-text-area-min-height",`${Math.min(d,s)}px`)},Ue=({promptValidationMessage:a,errorMessage:e,contextTooBig:t,contextReducedNoticeDismissed:s,setContextReducedNoticeDismissed:i,setErrorMessage:n,messages:l})=>{let d=[];if(a&&d.push({id:"prompt-validation",kind:"danger",icon:"exclamation-mark-triangle",title:a,closable:!0}),e&&d.push({id:"assistant-error",kind:"danger",icon:"exclamation-mark-triangle",title:e,closable:!0,onClose:()=>n(void 0)}),t&&!s){let r=l.contextreduced??"Context reduced",o=l.contextreducedmessage??"The editor profile is too large for the assistant. It has been reduced in the assistant in order to ensure a successful request.";d.push({id:"context-reduced",kind:"warning",icon:"exclamation-mark-triangle",title:r,message:o,closable:!0,onClose:()=>i(!0)})}return d};function Oe({messages:a}){return p`<calcite-chip slot=header-actions-end scale=s appearance=outline-fill .label=${a.beta??"Beta"}>${a.beta??"Beta"}</calcite-chip>`}function ze({popoverContent:a,messages:e}){return p`<calcite-action icon=information slot=header-actions-end id=legal-disclaimer text></calcite-action><calcite-popover reference-element=legal-disclaimer .label=${e.legaldisclaimer??"Legal disclaimer"} placement=bottom auto-close focus-trap-disabled><div class="contained">${a}</div></calcite-popover>`}function Le({errorMessage:a,slot:e}){return p`<div class="error-display"><calcite-input-message id=error-message status=invalid icon=exclamation-mark-triangle scale=m slot=${e??_}>${a}</calcite-input-message></div>`}function Be({active:a,setActive:e,messages:t}){return p`<calcite-alert slot=alerts .open=${a} placement=bottom kind=success icon=check-circle-f auto-close @calciteAlertClose=${()=>e(!1)} .label=${t.expressionapplied??"Expression applied"}><div slot=message>${t.expressionapplied??"Expression applied to editor."}</div></calcite-alert>`}function je({context:a,messages:e}){return a?p`<div class="gaps">${a.profileId&&p`<calcite-popover auto-close placement=top .label=${(e.profilecontextlabel??"Profile context: {profileId}").replace("{profileId}",a.profileId)} reference-element=profile-context-button class="context-popover contained-popover-or-tooltip"><p>${(e.profilecontextlabel??"Profile context: {profileId}").replace("{profileId}",a.profileId)}</p></calcite-popover><calcite-button round kind=neutral icon-start=map-information id=profile-context-button scale=s></calcite-button>`||""}</div>`:null}function Qe({isDisabled:a,isReadOnly:e,setQuestion:t,setIsViewingResult:s,textAreaRef:i,question:n,errorMessage:l,setErrorMessage:d,promptValidationMessage:r,setPromptValidationMessage:o,submitQuestion:g,messages:c,mode:u,assistantRef:m,context:h,contextReducedNoticeDismissed:f,setContextReducedNoticeDismissed:T}){let v=h?.contextTooLarge??!1,$=Ue({promptValidationMessage:r,errorMessage:l,contextTooBig:v,contextReducedNoticeDismissed:f,setContextReducedNoticeDismissed:T,setErrorMessage:d,messages:c});return p`<div class="text-area-wrapper">${De({notices:$})}<calcite-text-area scale=s resize=vertical .readOnly=${a||e} class=${se($.length?"submission-text-area":"submission-text-area round-top")} .placeholder=${c.askaquestion??`Specify the calculation or logic you need in an Arcade expression. (e.g., 'Return "Yes" if value > 10')`} .value=${n} @calciteTextAreaInput=${C=>{_e(C.target),t(C.target.value)}} ${te(i)}><div class="submission-actions-wrapper" slot=footer-start><div class="submission-actions">${h&&je({context:h,messages:c})||""}<div class="align-inline-end gaps"><calcite-button round kind=neutral .hidden=${u!=="refine"} icon-start=arrow-left icon-flip-rtl=both appearance=solid scale=s .disabled=${a} @click=${async()=>{s(!1),t("")}} .label=${c.startover??"Start Over"} class="hidden-above-380" id=small-start-over-button></calcite-button><calcite-tooltip reference-element=small-start-over-button placement=top-start class="hidden-above-380">${c.startover??"Start Over"}</calcite-tooltip><calcite-button round kind=neutral .hidden=${u!=="refine"} icon-start=arrow-left icon-flip-rtl=both appearance=solid .disabled=${a} @click=${async()=>{s(!1),t("")}} class="hidden-below-380" scale=s>${c.startover??"Start Over"}</calcite-button><calcite-button round scale=s icon-end=effects appearance=solid .loading=${a} .disabled=${a} @click=${async()=>{if(d(""),!n){o(c.enteraprompt??"Please enter a prompt");return}o(void 0),await g()}} class="hidden-below-380">${u==="prompt"?c.ask??"Generate":c.refine??"Refine"}</calcite-button><calcite-button round scale=s icon-end=effects appearance=solid .loading=${a} .disabled=${a} id=small-submit-button @click=${async()=>{if(d(""),!n){o(c.enteraprompt??"Please enter a prompt");return}o(void 0),await g()}} class="hidden-above-380" .label=${u==="prompt"?c.ask??"Generate":c.refine??"Refine"}></calcite-button><calcite-tooltip reference-element=small-submit-button placement=top-start class="hidden-above-380">${u==="prompt"?c.ask??"Generate":c.refine??"Refine"}</calcite-tooltip></div></div></div></calcite-text-area></div>`}var He="https://www.esri.com/en-us/privacy/privacy-statements/privacy-supplement",Ge="https://www.esri.com/en-us/privacy/privacy-statements";function Je({setOpen:a,messages:e,feedback:t,learnMoreUrl:s,setFeedback:i,onSubmit:n}){return t.active?p`<calcite-sheet class="feedback-sheet" .label=${e.feedback??"Feedback"} slot=sheets display-mode=float position=block-end .open=${t.active} @calciteSheetClose=${()=>a(!1)}><calcite-panel .heading=${e.submitfeedback??"Submit feedback to Esri"} scale=s><div class="feedback-content"><calcite-text-area scale=s resize=vertical .value=${t.text} @calciteTextAreaInput=${l=>i({...t,text:l.target.value})} .disabled=${t.submitting} .placeholder=${e.donotincludepersonalinfo??"Do not include personal or sensitive information"} rows=3></calcite-text-area><calcite-label layout=inline scale=s class="terms-label"><calcite-checkbox scale=l .checked=${t.termsAccepted} @calciteCheckboxChange=${l=>{i({...t,termsAccepted:l.target.checked})}} .disabled=${t.submitting}></calcite-checkbox><span>${V((e.agreement??"I agree to the {EsriPrivacyStatement} (and {Supplement}).").replace("{EsriPrivacyStatement}",`<calcite-link href=${Ge} target="_blank">${e.esriprivacystatement??"Esri Privacy Statement"}</calcite-link>`).replace("{Supplement}",`<calcite-link href=${He} target="_blank">${e.supplement??"Supplement"}</calcite-link>`))}</span></calcite-label><calcite-notice scale=s open closable><span slot=message>${V((e.feedbackhelps??"Your feedback will be used to improve Esri products and services. {LearnMore} about how this data is used.").replace("{LearnMore}",`<calcite-link href=${s} target="_blank">${e.learnmore??"Learn more"}</calcite-link>`))}</span></calcite-notice></div><div slot=footer class="feedback-footer"><calcite-button kind=neutral appearance=outline @click=${()=>a(!1)} .disabled=${t.submitting}>${e.cancel??"Cancel"}</calcite-button><calcite-button @click=${n} .disabled=${!t.termsAccepted||t.submitting} .loading=${t.submitting} data-testid=submit-feedback-button>${e.submit??"Submit"}</calcite-button></div></calcite-panel></calcite-sheet>`:null}function ge({assistantsEnabled:a,messages:e,slot:t,helpTopicUrl:s}){return p`<calcite-block .label=${e.assistantinformation??"Assistant information"} slot=${t??_} expanded class="info-block" scale=s><div class="info-heading-row"><h1 class="info-heading">${e.introducing??"Introducing Arcade Assistant (beta)"}</h1><calcite-chip .label=${e.new??"New"} kind=brand scale=s>${e.new??"New"}</calcite-chip></div>${a?p`<p>${e.capabilities??"The assistant uses artificial intelligence to generate Arcade expressions."}</p><p>${e.keepinmind??"Keep in mind the following:"}<ul><li>${e.beconsise??"Be concise, but also clear in your request"}</li><li>${e.avoidambiguity??"Avoid ambiguity and vagueness"}</li><li>${e.moredetails??"you do not need to use exact field names in your instructions, but more detail is generally better"}</li></ul>${V((e.seedocumentation??"Please see the {documentation} for more information, including limitations and additional resources.").replace("{documentation}",`<calcite-link href=${s} target="_blank">${e.documentation??"documentation"}</calcite-link>`))}</p>`:p`<p>${e.useofassistant??"The assistant uses artificial intelligence to generate Arcade expressions. To enable Arcade Assistant (beta), the following must be true:"}</p><ul><li>${e.enabledinorg??"AI assistants are enabled in the organization settings"}</li><li>${e.enabledbetaapps??"Beta apps and capabilities are not blocked"}</li><li>${e.enabledroleprivilege??"Your role privilege allows you to use AI assistants"}</li></ul>`}</calcite-block>`}function Ye({messages:a,onProceed:e,onExit:t,helpTopicUrl:s}){return p`<calcite-dialog close-disabled placement=top .heading=${a.welcome??"Welcome to the new assistant experience"} slot=dialogs open width-scale=m id=welcome-dialog><h3 class="unstyled-h3">${a.beforeyougetstarted??"Before you get started be aware:"}</h3><ul><li>${a.maybeincorrect??"AI generated code may occasionally be incorrect or biased. Review carefully."}</li><li>${V((a.pleasereadhelp??"Read the Arcade Assistant (beta) {helpTopic} to get started and learn details on security, privacy and limitations.").replace("{helpTopic}",`<calcite-link href=${s} target="_blank">${a.helptopic??"help topic"}</calcite-link>`))}</li></ul><calcite-button id=welcome-proceed slot=footer-end @click=${e}>${a.proceed??"Proceed"}</calcite-button><calcite-button id=welcome-decline slot=footer-start @click=${t} kind=neutral>${a.exit??"Exit"}</calcite-button></calcite-dialog>`}function We({messages:a,suggestions:e,onSuggestionClick:t}){return p`<calcite-block .heading=${a.promptsuggestions} expanded collapsible id=suggestion-block scale=s><div class="suggestions">${e.map(s=>p`<calcite-button round scale=s appearance=outline-fill kind=neutral .label=${a.promptsuggestion} class="suggestion-button" @click=${()=>t?.(s)}>${s}</calcite-button>`)}</div></calcite-block>`}var be=200;function fe({hidden:a=!1,expanded:e=!1,messages:t,cards:s,heading:i,collapsible:n=!1,showEffectsIcon:l=!1,onCopyCode:d,standalone:r}){return p`<calcite-block .hidden=${a} id=result-block .heading=${i??t.besteffort??"Here is the assistant's best effort"} .expanded=${e} .collapsible=${n}>${l&&p`<calcite-chip .label=${t.assistantresponses??"Assistant responses"} slot=content-start icon=effects scale=m class="suggestion-chips"></calcite-chip>`||""}<calcite-card-group .label=${t.assistantresponses??"Assistant responses"}>${L(s,o=>o.conversationId,o=>p`<calcite-card><div slot=heading><div class="prior-prompt"><span>${o.priorPrompt.length>be?`${o.priorPrompt.slice(0,be)}...`:o.priorPrompt}</span><calcite-action icon=duplicate scale=s slot=actions-end class="copy-prompt-button" text .id=${`copy-prompt-${o.conversationId}-${r?"standalone":"list"}`} @click=${g=>{let c=g.currentTarget;navigator.clipboard.writeText(o.priorPrompt).then(()=>{c.setAttribute("data-copied","true"),setTimeout(()=>c.removeAttribute("data-copied"),1500)})}}></calcite-action><calcite-popover .referenceElement=${`copy-prompt-${o.conversationId}-${r?"standalone":"list"}`} placement=top-start class="copy-feedback" .label=${t.copiedsuccessfully??"copied successfully"} open trigger-disabled><span>${t.copiedsuccessfully??"copied successfully"}</span></calcite-popover><calcite-tooltip .referenceElement=${`copy-prompt-${o.conversationId}-${r?"standalone":"list"}`} placement=top-start class="copy-tooltip">${t.copyprompttoclipboard??"Copy prompt to clipboard"}</calcite-tooltip></div>${o.message&&r&&p`<div class="response-error-container">${Le({errorMessage:o.message})}</div>`||""}</div><div><div class="code-response-wrapper"><div class="positioned-code-content"><calcite-chip-group .label=${t.responsecontext??"Response Context"} scale=s>${o.message&&!r&&p`<calcite-tooltip .referenceElement=${`response-chip-${o.conversationId}-error`} placement=top-start>${o.message}</calcite-tooltip><calcite-chip .id=${`response-chip-${o.conversationId}-error`} .label=${t.error??"Error"} scale=s appearance=outline icon=exclamation-mark-triangle-f class="response-error-chip"></calcite-chip>`||""}${Ke({card:o,messages:t})}</calcite-chip-group></div><details class="collapsible-code" open><summary>Code response</summary><arcgis-code-viewer language=arcade round>${o.code}</arcgis-code-viewer></details></div></div><div slot=footer-start class="feedback-actions"><calcite-button class="add-to-editor-button hidden-above-380" @click=${()=>o.onAddToEditor("add")} scale=s icon-start=plus round .label=${t.addtoeditor??"Add to editor"} .id=${`add-to-editor-button-${o.conversationId}-${r?"standalone":"list"}`}></calcite-button><calcite-tooltip class="hidden-above-380" .referenceElement=${`add-to-editor-button-${o.conversationId}-${r?"standalone":"list"}`} placement=top-start>${t.addtoeditor??"Add to editor"}</calcite-tooltip><calcite-button class="add-to-editor-button hidden-below-380" @click=${()=>o.onAddToEditor("add")} scale=s icon-start=plus round>${t.addtoeditor??"Add to editor"}</calcite-button><calcite-button round icon-start=file-code kind=neutral scale=s @click=${()=>o.onAddToEditor("replace")} class="response-secondary-action-button" .id=${`replace-${o.conversationId}-${r?"standalone":"list"}`}></calcite-button><calcite-tooltip .referenceElement=${`replace-${o.conversationId}-${r?"standalone":"list"}`} placement=top-start><span>${t.replaceineditor??"Replace all code in editor"}</span></calcite-tooltip><calcite-button round icon-start=copy-to-clipboard kind=neutral scale=s @click=${g=>{let c=g.currentTarget;d(o.code).then(()=>{c.setAttribute("data-copied","true"),setTimeout(()=>c.removeAttribute("data-copied"),1500)})}} class="response-secondary-action-button" .id=${`copy-response-${o.conversationId}-${r?"standalone":"list"}`}></calcite-button><calcite-popover .referenceElement=${`copy-response-${o.conversationId}-${r?"standalone":"list"}`} placement=top-start class="copy-feedback" .label=${t.copiedsuccessfully??"copied successfully"} open trigger-disabled><span>${t.copiedsuccessfully??"copied successfully"}</span></calcite-popover><calcite-tooltip .referenceElement=${`copy-response-${o.conversationId}-${r?"standalone":"list"}`} placement=top-start class="copy-tooltip">${t.copytoclipboard??"Copy code to clipboard"}</calcite-tooltip></div><div slot=footer-end class="feedback-actions"><calcite-action .text=${t.thumbsup??"Thumbs up"} scale=s icon=thumbs-up @click=${o.onThumbsUp} .id=${`thumbs-up-${o.conversationId}-${r?"standalone":"list"}`}></calcite-action><calcite-tooltip .referenceElement=${`thumbs-up-${o.conversationId}-${r?"standalone":"list"}`} placement=top-start><span>${t.helpful??"Helpful"}</span></calcite-tooltip><calcite-action .text=${t.thumbsdown??"Thumbs down"} scale=s icon=thumbs-down @click=${o.onThumbsDown} .id=${`thumbs-down-${o.conversationId}-${r?"standalone":"list"}`}></calcite-action><calcite-tooltip .referenceElement=${`thumbs-down-${o.conversationId}-${r?"standalone":"list"}`} placement=top-start><span>${t.unhelpful??"Unhelpful"}</span></calcite-tooltip></div></calcite-card>`)}</calcite-card-group></calcite-block>`}var Ke=({card:a,messages:e})=>{let t=K(),s=`response-chip-profile-${a.conversationId}-${t}`,i=(e.profilecontextlabel??"Profile context: {profileId}").replace("{profileId}",a.profileId);return p`<calcite-tooltip .referenceElement=${s} placement=top-start class="contained-popover-or-tooltip">${i}</calcite-tooltip><calcite-chip .label=${a.profileId} scale=s appearance=outline icon=map-information id=${s??_}>${a.profileId}</calcite-chip>`},ve=a=>a.type==="featureSet",B=a=>{if(!le(a))return[];let e=[];return a.relationships?.forEach(t=>{e.push(t.toJSON())}),e},j=a=>a.length>0?{relationships:a}:{},Xe=a=>ce(a).map(e=>({alias:e.alias,name:e.name,type:e.type,...e.domain?{domain:e.domain}:{}})),Q=a=>a?{fields:Xe(a)}:{fields:[]};async function ye(a){let e=await a.loadSource(),t=O(e)&&e.isTable,s=B(e);return{name:a.name,type:"featureSet",isTable:t,...Q(e?.fields),...j(s)}}async function Te(a){switch(a.type){case"feature":{let e=await a.loadSource(),t=B(e);return{name:a.name,type:a.type,...Q(e?.fields),...j(t)}}case"featureSet":{let e=await a.loadSource(),t=O(e)&&e.isTable;return{name:a.name,type:"featureSet",...t?{isTable:t}:{},...Q(e?.fields),...j(B(e))}}case"featureSetCollection":{let e=await a.loadSource(),t=e?.layers.filter(ve)??[],s=e?.tables.filter(ve)??[],i=await Promise.all(t.map(ye)),n=await Promise.all(s.map(ye));return{name:a.name,type:"featureSetCollection",layers:i,tables:n}}case"dictionary":{let e=await Promise.all(a.dictionaryVariables.map(Te));return{name:a.name,type:"dictionary",attributes:e}}case"pixel":{let e=await a.loadSource();if(!e)return{name:a.name,type:"pixel"};let t=await Ee(e);return{name:a.name,type:"pixel",members:t.map(we)}}case"voxel":{let e=await a.loadSource();if(!e)return{name:a.name,type:"voxel"};let t=await Me(e);return{name:a.name,type:"voxel",members:t.map(we)}}case"array":return{name:a.name,type:"array",elementType:a.elementType.type};case"number":case"text":case"boolean":case"date":case"knowledgeGraph":case"dateOnly":case"geometry":case"time":return{name:a.name,type:a.type}}}function we(a){return a.type==="array"?{name:a.name,type:"array",elementType:a.elementType.type}:{name:a.name,type:a.type}}async function Ze(a){return{variables:await Promise.all(a.variables.map(Te))}}var et=1e5;function tt(a){let e=new TextEncoder().encode(a).length;return Math.ceil(e/3.5)}function H(a){return tt(JSON.stringify(a))}function at(a){let e=s=>({name:s.name,type:s.type,...s.isTable?{isTable:s.isTable}:{},...s.relationships?{relationships:s.relationships}:{}}),t=s=>{switch(s.type){case"feature":case"featureSet":case"knowledgeGraph":return{name:s.name,type:s.type,..."isTable"in s&&s.isTable?{isTable:s.isTable}:{},..."relationships"in s?{relationships:s.relationships}:{}};case"featureSetCollection":return{name:s.name,type:"featureSetCollection",layers:s.layers.map(e),tables:s.tables.map(e)};case"dictionary":return{name:s.name,type:"dictionary",attributes:s.attributes.map(t)};case"pixel":case"voxel":return{name:s.name,type:s.type};case"array":return{name:s.name,type:"array",...s.elementType?{elementType:s.elementType}:{}};default:return s}};return{variables:a.variables.map(t)}}function st(a){let e=a.variables,t=e.length,s=e.find(n=>n.name==="$feature")??e.find(n=>n.type==="feature")??e[0],i=s?[s]:[];return{context:{variables:i},wasReduced:t!==i.length,reducedToVariableName:s?.name}}function it(a){return H(a)>et}var ot=Object.defineProperty,nt=Object.getOwnPropertyDescriptor,y=(a,e,t,s)=>{for(var i=s>1?void 0:s?nt(e,t):e,n=a.length-1,l;n>=0;n--)(l=a[n])&&(i=(s?l(e,t,i):l(i))||i);return s&&i&&ot(e,t,i),i},b=class extends Re{constructor(a){super(a),this.viewMode="prompt",this.confirmationActive=!1,this.contextReducedNoticeDismissed=!1,this.splashActive=!0,this.isSubmitting=!1,this.question="",this.history=[],this.feedback={active:!1}}};y([w()],b.prototype,"viewMode",2);y([w()],b.prototype,"confirmationActive",2);y([w()],b.prototype,"contextReducedNoticeDismissed",2);y([w()],b.prototype,"splashActive",2);y([w()],b.prototype,"isSubmitting",2);y([w()],b.prototype,"errorMessage",2);y([w()],b.prototype,"promptValidationMessage",2);y([w()],b.prototype,"question",2);y([w()],b.prototype,"history",2);y([w()],b.prototype,"feedback",2);y([w()],b.prototype,"context",2);b=y([Ve("ArcadeAssistantViewState")],b);var rt="arcade_generation",ct="ArcadeCodeRequest",$e="visualization",xe="ArcadeAssistant",lt=["your_comments","user_evaluation","question","answer","useragent","_source","version","context","extras","conversation_id","privacy_statement"],ke=[],Se=!0,G=class extends ae{constructor(){super(...arguments),this.textAreaRef=ee(),this.messages=oe(),this._feedbackService=void 0,this.viewState=new b,this.handleFeedbackButton=(e,t)=>{this.updateViewState({feedback:{active:!0,value:e,item:t,termsAccepted:!1,text:"",submitting:!1}})},this.handleFeedbackSheetClose=()=>{this.updateViewState({feedback:{active:!1}})},this.handleFeedbackSubmit=async()=>{if(!this.viewState.feedback.active)return;this.updateViewState({feedback:{...this.viewState.feedback,submitting:!0}});let e=await this.ensureFeedbackService();if(!e){this.handleFeedbackSheetClose();return}let t=this.viewState.feedback.item.contextSnapshot,s=ue.applicationName;!s&&!this.appVersion&&k("warn",this,"esriConfig.applicationName is not set. Consider setting it to help identify the application version in feedback.");let{value:i,text:n,termsAccepted:l,item:{question:d,formattedScript:r,conversationId:o}}=this.viewState.feedback,g={user_evaluation:i,your_comments:n||void 0,question:d??"",answer:this.encodeAnswerForFeedback(r),useragent:navigator.userAgent,_source:xe,version:this.appVersion||s||"NOT_SET",context:t?JSON.stringify(t):"",extras:t?.profileId??"",conversation_id:o??"",privacy_statement:l?"I_agree":""};try{await e.applyEdits({addFeatures:[new me({attributes:g})]})}catch(c){k("error",this,"Error submitting feedback.",{detail:{error:c}})}this.handleFeedbackSheetClose()},this.handleClose=e=>{this.closed=!0,this.closePanel?.(e)},this.setQuestionState=e=>{this.updateViewState({question:e,promptValidationMessage:void 0})},this.setFeedbackState=e=>{this.updateViewState({feedback:e})},this.onSuggestionClick=e=>{this.textAreaRef.value&&(this.textAreaRef.value.value=e,this.textAreaRef.value.setFocus(),this.setQuestionState(e))},this.helpBase="",this.assistantsEnabled=!1,this.closed=!1,this.disableQuestionAnswerLogging=!1}static{this.properties={closePanel:0,insertText:0,helpBase:1,assistantsEnabled:5,portalUrl:1,serviceUrl:1,closed:7,editorRef:0,feedbackServiceUrl:1,appVersion:1,disableQuestionAnswerLogging:5}}static{this.styles=Pe}get disclaimerComment(){return`// ${this.messages.disclaimercomment}
2
+ import{a as oe}from"./QNAUGPWS.js";import"./MP6Z45SA.js";import b from"./6SEUQ6EB.js";import"./PWVGWGF5.js";import a from"./NQVNVOQR.js";import{d as ce}from"./IFNCCZ7O.js";import{c as ne,d as re}from"./PJHAQGOB.js";import"./NKCYMRE4.js";import"./BQLG62QR.js";import"./WMLTLTIE.js";import"./UYBZWFE5.js";import{A as X,B as Z,C as D,D as ee,E as te,F as ae,G as se,H as _,J as ie,h as W,j as p,k as P,l as U,s as K,v as q,w as N,x as F,y as I,z as S}from"./Q5SGN46H.js";import{a as k}from"./BCUUVBXH.js";import"./YLN7EMJC.js";import"./GHSEU7VA.js";import"./4OSKRQ5X.js";import"./NG7S6FUK.js";import"./3TTFCHAA.js";export default $arcgis.t(([Ce,pe,Ie,ue,me,{getDeclaredVoxelMembers:Me,getDeclaredPixelMembers:Ee},Re,{property:w,subclass:Ve},{g:le,h:O},z])=>{var de=(a,e,t)=>{let s=new Map;for(let i=e;i<=t;i++)s.set(a[i],i);return s},L=N(class extends F{constructor(a){if(super(a),a.type!==q.CHILD)throw Error("repeat() can only be used in text expressions")}dt(a,e,t){let s;t===void 0?t=e:e!==void 0&&(s=e);let i=[],n=[],l=0;for(let d of a)i[l]=s?s(d,l):l,n[l]=t(d,l),l++;return{values:n,keys:i}}render(a,e,t){return this.dt(a,e,t).values}update(a,[e,t,s]){let i=Z(a),{values:n,keys:l}=this.dt(e,t,s);if(!Array.isArray(i))return this.ut=l,n;let d=this.ut??=[],r=[],o,g,c=0,u=i.length-1,m=0,h=n.length-1;for(;c<=u&&m<=h;)if(i[c]===null)c++;else if(i[u]===null)u--;else if(d[c]===l[m])r[m]=S(i[c],n[m]),c++,m++;else if(d[u]===l[h])r[h]=S(i[u],n[h]),u--,h--;else if(d[c]===l[h])r[h]=S(i[c],n[h]),I(a,r[h+1],i[c]),c++,h--;else if(d[u]===l[m])r[m]=S(i[u],n[m]),I(a,i[c],i[u]),u--,m++;else if(o===void 0&&(o=de(l,m,h),g=de(d,c,u)),o.has(d[c]))if(o.has(d[u])){let f=g.get(l[m]),T=f!==void 0?i[f]:null;if(T===null){let v=I(a,i[c]);S(v,n[m]),r[m]=v}else r[m]=S(T,n[m]),I(a,i[c],T),i[f]=null;m++}else D(i[u]),u--;else D(i[c]),c++;for(;m<=h;){let f=I(a,r[h+1]);S(f,n[m]),r[m++]=f}for(;c<=u;){let f=i[c++];f!==null&&D(f)}return this.ut=l,X(a,r),P}});var R=class extends F{constructor(e){if(super(e),this.it=U,e.type!==q.CHILD)throw Error(this.constructor.directiveName+"() can only be used in child bindings")}render(e){if(e===U||e==null)return this._t=void 0,this.it=e;if(e===P)return e;if(typeof e!="string")throw Error(this.constructor.directiveName+"() called with a non-string value");if(e===this.it)return this._t;this.it=e;let t=[e];return t.raw=t,this._t={_$litType$:this.constructor.resultType,strings:t,values:[]}}};R.directiveName="unsafeHTML",R.resultType=1;var V=N(R);var Pe=W`:host(:not([closed])){container-type:size;--calcite-block-border-color: var(--calcite-color-transparent);box-sizing:border-box;.submission-actions-wrapper{display:flex;flex-direction:column;width:100%;gap:.75rem}.submission-actions{display:flex;flex-direction:row;gap:.5rem;justify-content:space-between}@container (max-width: 380px){.hidden-below-380{display:none}}@container (min-width: 380px){.hidden-above-380{display:none}}.gaps{display:flex;gap:.25rem}.align-inline-end{margin-inline-start:auto}.context-popover p{padding:0 .5rem;font-size:var(--calcite-font-size-sm)}.feedback-content{padding:var(--calcite-spacing-sm);display:flex;flex-direction:column;max-height:75cqb;overflow-y:auto;>*{margin-block-end:.5rem}>*:last-child,.terms-label{margin-block-end:0}calcite-text-area{--calcite-text-area-min-height: 4rem}calcite-notice{margin-block-start:0}}.feedback-sheet{--calcite-sheet-height: auto;--calcite-sheet-max-height: 100%;--calcite-sheet-min-height: auto}.feedback-footer{display:flex;justify-content:flex-end;gap:.5rem;width:100%}calcite-chip[slot=header-actions-end]{align-self:center;margin-inline-end:.5rem}calcite-flow-item calcite-shell{background:transparent}calcite-block{width:100%;max-width:100%;align-self:flex-end;background-color:transparent;margin-block:0}calcite-sheet{--calcite-sheet-scrim-background: rgba(200, 200, 200, .5)}calcite-list-item calcite-button{margin-inline-end:.25rem}calcite-flow-item calcite-shell calcite-notice{margin-block:1rem}calcite-block[open]:last-of-type{border-block-end:0}.text-area-wrapper{display:flex;border-radius:var(--calcite-corner-radius-round);margin:.75rem;overflow:hidden;--calcite-color-border-input: transparent;position:sticky;box-shadow:var(--calcite-shadow-sm);flex:none;flex-direction:column}calcite-text-area{height:auto;overflow:hidden;--calcite-font-weight-normal: 500;font-weight:500;line-height:1.2}calcite-flow{height:100%}calcite-popover calcite-list{--calcite-list-background-color: transparent;--calcite-input-border-color: transparent}calcite-popover calcite-list calcite-filter{--calcite-spacing-sm: 0}.contained-popover-or-tooltip{--calcite-popover-max-size-x: 100%;--calcite-tooltip-max-size-x: 100%}.info-heading{font-size:var(--calcite-font-size-0);color:var(--calcite-color-text-1);margin:0}.info-heading-row{display:flex;align-items:center;gap:var(--calcite-spacing-sm);flex-wrap:wrap}.unstyled-h3{margin:unset;font-size:var(--calcite-font-size-md)}.unstyled-shell{position:unset;inset:unset;display:unset;block-size:unset;inline-size:unset}.suggestion-button{font-weight:var(--calcite-font-weight-medium)}.suggestions{display:flex;flex-direction:row;gap:var(--calcite-spacing-xs);flex-wrap:wrap}.info-block{max-width:450px}#result-block{calcite-card-group{--calcite-card-group-gap: 1.25rem}calcite-card{--calcite-card-corner-radius: var(--calcite-corner-radius-round);--calcite-card-border-color: transparent;width:100%}.positioned-code-content{display:flex;flex-direction:row;gap:.5rem;padding:.5rem}calcite-card [slot=heading] calcite-chip{margin-block-start:.25rem}.code-response-wrapper{position:relative;background:var(--calcite-color-foreground-2);border-radius:var(--calcite-corner-radius-round);margin-top:-1.5rem}.prior-prompt{display:flex;flex-direction:row;padding:0;overflow-y:hidden;overflow-x:auto;margin:.25rem 0 .75rem;align-items:center;max-width:100%;span{overflow-x:auto;overflow-y:hidden}}.copy-feedback{display:none}.copy-prompt-button{align-self:flex-start;margin-inline-start:auto}.response-secondary-action-button[data-copied]+.copy-feedback,.copy-prompt-button[data-copied]+.copy-feedback{display:block;span{padding:.75rem 1rem;font-size:var(--calcite-font-size--2);line-height:1.375;color:var(--calcite-color-text--2);font-weight:var(--calcite-font-weight-medium)}}.copy-prompt-button[data-copied]~.copy-tooltip,.response-secondary-action-button[data-copied]~.copy-tooltip{display:none}code{white-space:pre;font-size:12px;margin:0;overflow-x:auto;font-family:Fira Mono,Consolas,Menlo,monospace;display:block;max-height:12rem;position:relative;padding:.5rem}.response-secondary-action-button{margin-left:.5rem}.add-to-editor-button{--calcite-internal-button-border-color: unset}}.collapsible-code{padding:.5rem}.collapsible-code summary{cursor:pointer;font-weight:500;color:var(--calcite-color-brand);outline:none;padding:.25rem 0}.collapsible-code[open] summary{color:var(--calcite-color-text-2)}.response-error-container{padding:.5rem;background:color-mix(in srgb,var(--calcite-color-status-warning) 10%,transparent);border-radius:var(--calcite-corner-radius-round);margin:1rem 0;font-size:var(--calcite-font-size--2);--calcite-input-message-icon-color: var(--calcite-color-status-warning)}.response-error-chip{--calcite-internal-chip-background-color: var(--calcite-color-status-warning);--calcite-chip-icon-color: var(--calcite-color-foreground-1);--calcite-chip-border-color: var(--calcite-color-transparent)}.feedback-actions{gap:unset}.contained{max-width:100%;max-height:100%;max-width:100cqi;max-height:75cqb;overflow-y:auto}.submission-notice{--calcite-notice-border-color: transparent;margin-block:0;width:100%;--calcite-font-size-relative-base: var(--calcite-font-size--2)}.border-block-end{border-block-end:1px solid var(--calcite-color-border-3)}.round-top{border-radius:var(--calcite-corner-radius-round) var(--calcite-corner-radius-round) 0 0}}:host([closed]){display:none}`,A=class extends Error{constructor({message:e,code:t,subCode:s,details:i,source:n}){super(e),this.name="ArcadeAssistantError",this.code=t,this.subCode=s,this.details=i,this.source=n}};function he(a){if(!a)return;let e=a.indexOf('{"error":');if(e!==-1)try{let t=a.slice(e),s=JSON.parse(t);if(s&&typeof s=="object"&&s.error)return s.error}catch{return}}async function qe(a){let{baseUrl:e,skillId:t,message:s,authToken:i,previousConversationId:n,context:l}=a,d=t?`${e}/skills/${t}/chat`:`${e}/chat`,r=[],o={message:s,context:l};n&&(o.conversation_id=n);let g;try{g=await pe(d,{method:"post",headers:{"Content-Type":"application/json",token:i},body:JSON.stringify(o),responseType:"json"})}catch(v){let $=v,C=$.details?.rawResponse||$.message||String(v),M=he(C);throw M?new A(M):v}let c=g.data;r.push(c);let u=c.conversationId,m=c.inquiryId,h=c.sequenceNumber;async function f(){let v=0,$=100;for(;v<$;){await new Promise(E=>setTimeout(E,1e3));let C=Ne(u,h,m),M;try{M=await pe(d,{method:"post",headers:{"Content-Type":"application/json",token:i},body:JSON.stringify(C),responseType:"json"})}catch(E){let J=E,Ae=J.details?.rawResponse||J.message||String(E),Y=he(Ae);throw Y?new A(Y):E}let x=M.data;if(x.context?.kind==="ArcgisErrorAsContext"&&x.context.error)throw new A({message:x.context.error.message||"ArcGIS Assistant error",code:x.context.error.code,subCode:x.context.error.subCode,details:x.context.error.details,source:"polling-response"});if(r.push(x),h=x.sequenceNumber,v++,!x.hasMore)break}if(v===$)throw new A({message:"Request timed out",code:"TIMEOUT",source:"polling"})}let T=120*1e3;return await Promise.race([f(),new Promise((v,$)=>setTimeout(()=>$(new A({message:"Request timed out",code:"TIMEOUT",source:"hard-timeout"})),T))]),r}function Ne(a,e,t){return{conversationId:a,inquiryId:t,ackSequenceNumber:e}}function Fe(a){return a.message.match(/Error in prompt shield/u)?"I'm having trouble with this request. Try again by rephrasing the question.":a.code==="TIMEOUT"?"Request timed out. Try again by re-asking the same question or rephrasing it.":a.message}var De=({notices:a})=>a.length?p`<div class="border-block-end">${L(a,e=>e.id??e.title,e=>p`<calcite-notice class="submission-notice" .icon=${e.icon} .kind=${e.kind} scale=s open .closable=${e.closable} @calciteNoticeClose=${()=>e.onClose?.()}><div slot=title>${e.title}</div>${e.message&&p`<div slot=message>${e.message}</div>`||""}${e.actionLinkMessage&&e.onAction&&p`<calcite-link slot=link @click=${()=>e.onAction?.()}>${e.actionLinkMessage}</calcite-link>`||""}</calcite-notice>`)}</div>`:null,_e=a=>{let e=a.value.length,t=72,s=180,i=a.offsetWidth,n=Math.max(1,Math.floor(i/8)),l=Math.ceil(e/n),d=t+(l-2)*24;a.style.setProperty("--calcite-text-area-min-height",`${Math.min(d,s)}px`)},Ue=({promptValidationMessage:a,errorMessage:e,contextTooBig:t,contextReducedNoticeDismissed:s,setContextReducedNoticeDismissed:i,setErrorMessage:n,messages:l})=>{let d=[];if(a&&d.push({id:"prompt-validation",kind:"danger",icon:"exclamation-mark-triangle",title:a,closable:!0}),e&&d.push({id:"assistant-error",kind:"danger",icon:"exclamation-mark-triangle",title:e,closable:!0,onClose:()=>n(void 0)}),t&&!s){let r=l.contextreduced??"Context reduced",o=l.contextreducedmessage??"The editor profile is too large for the assistant. It has been reduced in the assistant in order to ensure a successful request.";d.push({id:"context-reduced",kind:"warning",icon:"exclamation-mark-triangle",title:r,message:o,closable:!0,onClose:()=>i(!0)})}return d};function Oe({messages:a}){return p`<calcite-chip slot=header-actions-end scale=s appearance=outline-fill .label=${a.beta??"Beta"}>${a.beta??"Beta"}</calcite-chip>`}function ze({popoverContent:a,messages:e}){return p`<calcite-action icon=information slot=header-actions-end id=legal-disclaimer text></calcite-action><calcite-popover reference-element=legal-disclaimer .label=${e.legaldisclaimer??"Legal disclaimer"} placement=bottom auto-close focus-trap-disabled><div class="contained">${a}</div></calcite-popover>`}function Le({errorMessage:a,slot:e}){return p`<div class="error-display"><calcite-input-message id=error-message status=invalid icon=exclamation-mark-triangle scale=m slot=${e??_}>${a}</calcite-input-message></div>`}function Be({active:a,setActive:e,messages:t}){return p`<calcite-alert slot=alerts .open=${a} placement=bottom kind=success icon=check-circle-f auto-close @calciteAlertClose=${()=>e(!1)} .label=${t.expressionapplied??"Expression applied"}><div slot=message>${t.expressionapplied??"Expression applied to editor."}</div></calcite-alert>`}function je({context:a,messages:e}){return a?p`<div class="gaps">${a.profileId&&p`<calcite-popover auto-close placement=top .label=${(e.profilecontextlabel??"Profile context: {profileId}").replace("{profileId}",a.profileId)} reference-element=profile-context-button class="context-popover contained-popover-or-tooltip"><p>${(e.profilecontextlabel??"Profile context: {profileId}").replace("{profileId}",a.profileId)}</p></calcite-popover><calcite-button round kind=neutral icon-start=map-information id=profile-context-button scale=s></calcite-button>`||""}</div>`:null}function Qe({isDisabled:a,isReadOnly:e,setQuestion:t,setIsViewingResult:s,textAreaRef:i,question:n,errorMessage:l,setErrorMessage:d,promptValidationMessage:r,setPromptValidationMessage:o,submitQuestion:g,messages:c,mode:u,assistantRef:m,context:h,contextReducedNoticeDismissed:f,setContextReducedNoticeDismissed:T}){let v=h?.contextTooLarge??!1,$=Ue({promptValidationMessage:r,errorMessage:l,contextTooBig:v,contextReducedNoticeDismissed:f,setContextReducedNoticeDismissed:T,setErrorMessage:d,messages:c});return p`<div class="text-area-wrapper">${De({notices:$})}<calcite-text-area scale=s resize=vertical .readOnly=${a||e} class=${se($.length?"submission-text-area":"submission-text-area round-top")} .placeholder=${c.askaquestion??`Specify the calculation or logic you need in an Arcade expression. (e.g., 'Return "Yes" if value > 10')`} .value=${n} @calciteTextAreaInput=${C=>{_e(C.target),t(C.target.value)}} ${te(i)}><div class="submission-actions-wrapper" slot=footer-start><div class="submission-actions">${h&&je({context:h,messages:c})||""}<div class="align-inline-end gaps"><calcite-button round kind=neutral .hidden=${u!=="refine"} icon-start=arrow-left icon-flip-rtl=both appearance=solid scale=s .disabled=${a} @click=${async()=>{s(!1),t("")}} .label=${c.startover??"Start Over"} class="hidden-above-380" id=small-start-over-button></calcite-button><calcite-tooltip reference-element=small-start-over-button placement=top-start class="hidden-above-380">${c.startover??"Start Over"}</calcite-tooltip><calcite-button round kind=neutral .hidden=${u!=="refine"} icon-start=arrow-left icon-flip-rtl=both appearance=solid .disabled=${a} @click=${async()=>{s(!1),t("")}} class="hidden-below-380" scale=s>${c.startover??"Start Over"}</calcite-button><calcite-button round scale=s icon-end=effects appearance=solid .loading=${a} .disabled=${a} @click=${async()=>{if(d(""),!n){o(c.enteraprompt??"Please enter a prompt");return}o(void 0),await g()}} class="hidden-below-380">${u==="prompt"?c.ask??"Generate":c.refine??"Refine"}</calcite-button><calcite-button round scale=s icon-end=effects appearance=solid .loading=${a} .disabled=${a} id=small-submit-button @click=${async()=>{if(d(""),!n){o(c.enteraprompt??"Please enter a prompt");return}o(void 0),await g()}} class="hidden-above-380" .label=${u==="prompt"?c.ask??"Generate":c.refine??"Refine"}></calcite-button><calcite-tooltip reference-element=small-submit-button placement=top-start class="hidden-above-380">${u==="prompt"?c.ask??"Generate":c.refine??"Refine"}</calcite-tooltip></div></div></div></calcite-text-area></div>`}var He="https://www.esri.com/en-us/privacy/privacy-statements/privacy-supplement",Ge="https://www.esri.com/en-us/privacy/privacy-statements";function Je({setOpen:a,messages:e,feedback:t,learnMoreUrl:s,setFeedback:i,onSubmit:n}){return t.active?p`<calcite-sheet class="feedback-sheet" .label=${e.feedback??"Feedback"} slot=sheets display-mode=float position=block-end .open=${t.active} @calciteSheetClose=${()=>a(!1)}><calcite-panel .heading=${e.submitfeedback??"Submit feedback to Esri"} scale=s><div class="feedback-content"><calcite-text-area scale=s resize=vertical .value=${t.text} @calciteTextAreaInput=${l=>i({...t,text:l.target.value})} .disabled=${t.submitting} .placeholder=${e.donotincludepersonalinfo??"Do not include personal or sensitive information"} rows=3></calcite-text-area><calcite-label layout=inline scale=s class="terms-label"><calcite-checkbox scale=l .checked=${t.termsAccepted} @calciteCheckboxChange=${l=>{i({...t,termsAccepted:l.target.checked})}} .disabled=${t.submitting}></calcite-checkbox><span>${V((e.agreement??"I agree to the {EsriPrivacyStatement} (and {Supplement}).").replace("{EsriPrivacyStatement}",`<calcite-link href=${Ge} target="_blank">${e.esriprivacystatement??"Esri Privacy Statement"}</calcite-link>`).replace("{Supplement}",`<calcite-link href=${He} target="_blank">${e.supplement??"Supplement"}</calcite-link>`))}</span></calcite-label><calcite-notice scale=s open closable><span slot=message>${V((e.feedbackhelps??"Your feedback will be used to improve Esri products and services. {LearnMore} about how this data is used.").replace("{LearnMore}",`<calcite-link href=${s} target="_blank">${e.learnmore??"Learn more"}</calcite-link>`))}</span></calcite-notice></div><div slot=footer class="feedback-footer"><calcite-button kind=neutral appearance=outline @click=${()=>a(!1)} .disabled=${t.submitting}>${e.cancel??"Cancel"}</calcite-button><calcite-button @click=${n} .disabled=${!t.termsAccepted||t.submitting} .loading=${t.submitting} data-testid=submit-feedback-button>${e.submit??"Submit"}</calcite-button></div></calcite-panel></calcite-sheet>`:null}function ge({assistantsEnabled:a,messages:e,slot:t,helpTopicUrl:s}){return p`<calcite-block .label=${e.assistantinformation??"Assistant information"} slot=${t??_} expanded class="info-block" scale=s><div class="info-heading-row"><h1 class="info-heading">${e.introducing??"Introducing Arcade Assistant (beta)"}</h1><calcite-chip .label=${e.new??"New"} kind=brand scale=s>${e.new??"New"}</calcite-chip></div>${a?p`<p>${e.capabilities??"The assistant uses artificial intelligence to generate Arcade expressions."}</p><p>${e.keepinmind??"Keep in mind the following:"}<ul><li>${e.beconsise??"Be concise, but also clear in your request"}</li><li>${e.avoidambiguity??"Avoid ambiguity and vagueness"}</li><li>${e.moredetails??"you do not need to use exact field names in your instructions, but more detail is generally better"}</li></ul>${V((e.seedocumentation??"Please see the {documentation} for more information, including limitations and additional resources.").replace("{documentation}",`<calcite-link href=${s} target="_blank">${e.documentation??"documentation"}</calcite-link>`))}</p>`:p`<p>${e.useofassistant??"The assistant uses artificial intelligence to generate Arcade expressions. To enable Arcade Assistant (beta), the following must be true:"}</p><ul><li>${e.enabledinorg??"AI assistants are enabled in the organization settings"}</li><li>${e.enabledbetaapps??"Beta apps and capabilities are not blocked"}</li><li>${e.enabledroleprivilege??"Your role privilege allows you to use AI assistants"}</li></ul>`}</calcite-block>`}function Ye({messages:a,onProceed:e,onExit:t,helpTopicUrl:s}){return p`<calcite-dialog close-disabled placement=top .heading=${a.welcome??"Welcome to the new assistant experience"} slot=dialogs open width-scale=m id=welcome-dialog><h3 class="unstyled-h3">${a.beforeyougetstarted??"Before you get started be aware:"}</h3><ul><li>${a.maybeincorrect??"AI generated code may occasionally be incorrect or biased. Review carefully."}</li><li>${V((a.pleasereadhelp??"Read the Arcade Assistant (beta) {helpTopic} to get started and learn details on security, privacy and limitations.").replace("{helpTopic}",`<calcite-link href=${s} target="_blank">${a.helptopic??"help topic"}</calcite-link>`))}</li></ul><calcite-button id=welcome-proceed slot=footer-end @click=${e}>${a.proceed??"Proceed"}</calcite-button><calcite-button id=welcome-decline slot=footer-start @click=${t} kind=neutral>${a.exit??"Exit"}</calcite-button></calcite-dialog>`}function We({messages:a,suggestions:e,onSuggestionClick:t}){return p`<calcite-block .heading=${a.promptsuggestions} expanded collapsible id=suggestion-block scale=s><div class="suggestions">${e.map(s=>p`<calcite-button round scale=s appearance=outline-fill kind=neutral .label=${a.promptsuggestion} class="suggestion-button" @click=${()=>t?.(s)}>${s}</calcite-button>`)}</div></calcite-block>`}var be=200;function fe({hidden:a=!1,expanded:e=!1,messages:t,cards:s,heading:i,collapsible:n=!1,showEffectsIcon:l=!1,onCopyCode:d,standalone:r}){return p`<calcite-block .hidden=${a} id=result-block .heading=${i??t.besteffort??"Here is the assistant's best effort"} .expanded=${e} .collapsible=${n}>${l&&p`<calcite-chip .label=${t.assistantresponses??"Assistant responses"} slot=content-start icon=effects scale=m class="suggestion-chips"></calcite-chip>`||""}<calcite-card-group .label=${t.assistantresponses??"Assistant responses"}>${L(s,o=>o.conversationId,o=>p`<calcite-card><div slot=heading><div class="prior-prompt"><span>${o.priorPrompt.length>be?`${o.priorPrompt.slice(0,be)}...`:o.priorPrompt}</span><calcite-action icon=duplicate scale=s slot=actions-end class="copy-prompt-button" text .id=${`copy-prompt-${o.conversationId}-${r?"standalone":"list"}`} @click=${g=>{let c=g.currentTarget;navigator.clipboard.writeText(o.priorPrompt).then(()=>{c.setAttribute("data-copied","true"),setTimeout(()=>c.removeAttribute("data-copied"),1500)})}}></calcite-action><calcite-popover .referenceElement=${`copy-prompt-${o.conversationId}-${r?"standalone":"list"}`} placement=top-start class="copy-feedback" .label=${t.copiedsuccessfully??"copied successfully"} open trigger-disabled><span>${t.copiedsuccessfully??"copied successfully"}</span></calcite-popover><calcite-tooltip .referenceElement=${`copy-prompt-${o.conversationId}-${r?"standalone":"list"}`} placement=top-start class="copy-tooltip">${t.copyprompttoclipboard??"Copy prompt to clipboard"}</calcite-tooltip></div>${o.message&&r&&p`<div class="response-error-container">${Le({errorMessage:o.message})}</div>`||""}</div><div><div class="code-response-wrapper"><div class="positioned-code-content"><calcite-chip-group .label=${t.responsecontext??"Response Context"} scale=s>${o.message&&!r&&p`<calcite-tooltip .referenceElement=${`response-chip-${o.conversationId}-error`} placement=top-start>${o.message}</calcite-tooltip><calcite-chip .id=${`response-chip-${o.conversationId}-error`} .label=${t.error??"Error"} scale=s appearance=outline icon=exclamation-mark-triangle-f class="response-error-chip"></calcite-chip>`||""}${Ke({card:o,messages:t})}</calcite-chip-group></div><details class="collapsible-code" open><summary>Code response</summary><arcgis-code-viewer language=arcade round>${o.code}</arcgis-code-viewer></details></div></div><div slot=footer-start class="feedback-actions"><calcite-button class="add-to-editor-button hidden-above-380" @click=${()=>o.onAddToEditor("add")} scale=s icon-start=plus round .label=${t.addtoeditor??"Add to editor"} .id=${`add-to-editor-button-${o.conversationId}-${r?"standalone":"list"}`}></calcite-button><calcite-tooltip class="hidden-above-380" .referenceElement=${`add-to-editor-button-${o.conversationId}-${r?"standalone":"list"}`} placement=top-start>${t.addtoeditor??"Add to editor"}</calcite-tooltip><calcite-button class="add-to-editor-button hidden-below-380" @click=${()=>o.onAddToEditor("add")} scale=s icon-start=plus round>${t.addtoeditor??"Add to editor"}</calcite-button><calcite-button round icon-start=file-code kind=neutral scale=s @click=${()=>o.onAddToEditor("replace")} class="response-secondary-action-button" .id=${`replace-${o.conversationId}-${r?"standalone":"list"}`}></calcite-button><calcite-tooltip .referenceElement=${`replace-${o.conversationId}-${r?"standalone":"list"}`} placement=top-start><span>${t.replaceineditor??"Replace all code in editor"}</span></calcite-tooltip><calcite-button round icon-start=copy-to-clipboard kind=neutral scale=s @click=${g=>{let c=g.currentTarget;d(o.code).then(()=>{c.setAttribute("data-copied","true"),setTimeout(()=>c.removeAttribute("data-copied"),1500)})}} class="response-secondary-action-button" .id=${`copy-response-${o.conversationId}-${r?"standalone":"list"}`}></calcite-button><calcite-popover .referenceElement=${`copy-response-${o.conversationId}-${r?"standalone":"list"}`} placement=top-start class="copy-feedback" .label=${t.copiedsuccessfully??"copied successfully"} open trigger-disabled><span>${t.copiedsuccessfully??"copied successfully"}</span></calcite-popover><calcite-tooltip .referenceElement=${`copy-response-${o.conversationId}-${r?"standalone":"list"}`} placement=top-start class="copy-tooltip">${t.copytoclipboard??"Copy code to clipboard"}</calcite-tooltip></div><div slot=footer-end class="feedback-actions"><calcite-action .text=${t.thumbsup??"Thumbs up"} scale=s icon=thumbs-up @click=${o.onThumbsUp} .id=${`thumbs-up-${o.conversationId}-${r?"standalone":"list"}`}></calcite-action><calcite-tooltip .referenceElement=${`thumbs-up-${o.conversationId}-${r?"standalone":"list"}`} placement=top-start><span>${t.helpful??"Helpful"}</span></calcite-tooltip><calcite-action .text=${t.thumbsdown??"Thumbs down"} scale=s icon=thumbs-down @click=${o.onThumbsDown} .id=${`thumbs-down-${o.conversationId}-${r?"standalone":"list"}`}></calcite-action><calcite-tooltip .referenceElement=${`thumbs-down-${o.conversationId}-${r?"standalone":"list"}`} placement=top-start><span>${t.unhelpful??"Unhelpful"}</span></calcite-tooltip></div></calcite-card>`)}</calcite-card-group></calcite-block>`}var Ke=({card:a,messages:e})=>{let t=K(),s=`response-chip-profile-${a.conversationId}-${t}`,i=(e.profilecontextlabel??"Profile context: {profileId}").replace("{profileId}",a.profileId);return p`<calcite-tooltip .referenceElement=${s} placement=top-start class="contained-popover-or-tooltip">${i}</calcite-tooltip><calcite-chip .label=${a.profileId} scale=s appearance=outline icon=map-information id=${s??_}>${a.profileId}</calcite-chip>`},ve=a=>a.type==="featureSet",B=a=>{if(!le(a))return[];let e=[];return a.relationships?.forEach(t=>{e.push(t.toJSON())}),e},j=a=>a.length>0?{relationships:a}:{},Xe=a=>ce(a).map(e=>({alias:e.alias,name:e.name,type:e.type,...e.domain?{domain:e.domain}:{}})),Q=a=>a?{fields:Xe(a)}:{fields:[]};async function ye(a){let e=await a.loadSource(),t=O(e)&&e.isTable,s=B(e);return{name:a.name,type:"featureSet",isTable:t,...Q(e?.fields),...j(s)}}async function Te(a){switch(a.type){case"feature":{let e=await a.loadSource(),t=B(e);return{name:a.name,type:a.type,...Q(e?.fields),...j(t)}}case"featureSet":{let e=await a.loadSource(),t=O(e)&&e.isTable;return{name:a.name,type:"featureSet",...t?{isTable:t}:{},...Q(e?.fields),...j(B(e))}}case"featureSetCollection":{let e=await a.loadSource(),t=e?.layers.filter(ve)??[],s=e?.tables.filter(ve)??[],i=await Promise.all(t.map(ye)),n=await Promise.all(s.map(ye));return{name:a.name,type:"featureSetCollection",layers:i,tables:n}}case"dictionary":{let e=await Promise.all(a.dictionaryVariables.map(Te));return{name:a.name,type:"dictionary",attributes:e}}case"pixel":{let e=await a.loadSource();if(!e)return{name:a.name,type:"pixel"};let t=await Ee(e);return{name:a.name,type:"pixel",members:t.map(we)}}case"voxel":{let e=await a.loadSource();if(!e)return{name:a.name,type:"voxel"};let t=await Me(e);return{name:a.name,type:"voxel",members:t.map(we)}}case"array":return{name:a.name,type:"array",elementType:a.elementType.type};case"number":case"text":case"boolean":case"date":case"knowledgeGraph":case"dateOnly":case"geometry":case"time":return{name:a.name,type:a.type}}}function we(a){return a.type==="array"?{name:a.name,type:"array",elementType:a.elementType.type}:{name:a.name,type:a.type}}async function Ze(a){return{variables:await Promise.all(a.variables.map(Te))}}var et=1e5;function tt(a){let e=new TextEncoder().encode(a).length;return Math.ceil(e/3.5)}function H(a){return tt(JSON.stringify(a))}function at(a){let e=s=>({name:s.name,type:s.type,...s.isTable?{isTable:s.isTable}:{},...s.relationships?{relationships:s.relationships}:{}}),t=s=>{switch(s.type){case"feature":case"featureSet":case"knowledgeGraph":return{name:s.name,type:s.type,..."isTable"in s&&s.isTable?{isTable:s.isTable}:{},..."relationships"in s?{relationships:s.relationships}:{}};case"featureSetCollection":return{name:s.name,type:"featureSetCollection",layers:s.layers.map(e),tables:s.tables.map(e)};case"dictionary":return{name:s.name,type:"dictionary",attributes:s.attributes.map(t)};case"pixel":case"voxel":return{name:s.name,type:s.type};case"array":return{name:s.name,type:"array",...s.elementType?{elementType:s.elementType}:{}};default:return s}};return{variables:a.variables.map(t)}}function st(a){let e=a.variables,t=e.length,s=e.find(n=>n.name==="$feature")??e.find(n=>n.type==="feature")??e[0],i=s?[s]:[];return{context:{variables:i},wasReduced:t!==i.length,reducedToVariableName:s?.name}}function it(a){return H(a)>et}var ot=Object.defineProperty,nt=Object.getOwnPropertyDescriptor,y=(a,e,t,s)=>{for(var i=s>1?void 0:s?nt(e,t):e,n=a.length-1,l;n>=0;n--)(l=a[n])&&(i=(s?l(e,t,i):l(i))||i);return s&&i&&ot(e,t,i),i},b=class extends Re{constructor(a){super(a),this.viewMode="prompt",this.confirmationActive=!1,this.contextReducedNoticeDismissed=!1,this.splashActive=!0,this.isSubmitting=!1,this.question="",this.history=[],this.feedback={active:!1}}};y([w()],b.prototype,"viewMode",2);y([w()],b.prototype,"confirmationActive",2);y([w()],b.prototype,"contextReducedNoticeDismissed",2);y([w()],b.prototype,"splashActive",2);y([w()],b.prototype,"isSubmitting",2);y([w()],b.prototype,"errorMessage",2);y([w()],b.prototype,"promptValidationMessage",2);y([w()],b.prototype,"question",2);y([w()],b.prototype,"history",2);y([w()],b.prototype,"feedback",2);y([w()],b.prototype,"context",2);b=y([Ve("ArcadeAssistantViewState")],b);var rt="arcade_generation",ct="ArcadeCodeRequest",$e="visualization",xe="ArcadeAssistant",lt=["your_comments","user_evaluation","question","answer","useragent","_source","version","context","extras","conversation_id","privacy_statement"],ke=[],Se=!0,G=class extends ae{constructor(){super(...arguments),this.textAreaRef=ee(),this.messages=oe(),this._feedbackService=void 0,this.viewState=new b,this.handleFeedbackButton=(e,t)=>{this.updateViewState({feedback:{active:!0,value:e,item:t,termsAccepted:!1,text:"",submitting:!1}})},this.handleFeedbackSheetClose=()=>{this.updateViewState({feedback:{active:!1}})},this.handleFeedbackSubmit=async()=>{if(!this.viewState.feedback.active)return;this.updateViewState({feedback:{...this.viewState.feedback,submitting:!0}});let e=await this.ensureFeedbackService();if(!e){this.handleFeedbackSheetClose();return}let t=this.viewState.feedback.item.contextSnapshot,s=ue.applicationName;!s&&!this.appVersion&&k("warn",this,"esriConfig.applicationName is not set. Consider setting it to help identify the application version in feedback.");let{value:i,text:n,termsAccepted:l,item:{question:d,formattedScript:r,conversationId:o}}=this.viewState.feedback,g={user_evaluation:i,your_comments:n||void 0,question:d??"",answer:this.encodeAnswerForFeedback(r),useragent:navigator.userAgent,_source:xe,version:this.appVersion||s||"NOT_SET",context:t?JSON.stringify(t):"",extras:t?.profileId??"",conversation_id:o??"",privacy_statement:l?"I_agree":""};try{await e.applyEdits({addFeatures:[new me({attributes:g})]})}catch(c){k("error",this,"Error submitting feedback.",{detail:{error:c}})}this.handleFeedbackSheetClose()},this.handleClose=e=>{this.closed=!0,this.closePanel?.(e)},this.setQuestionState=e=>{this.updateViewState({question:e,promptValidationMessage:void 0})},this.setFeedbackState=e=>{this.updateViewState({feedback:e})},this.onSuggestionClick=e=>{this.textAreaRef.value&&(this.textAreaRef.value.value=e,this.textAreaRef.value.setFocus(),this.setQuestionState(e))},this.helpBase="",this.assistantsEnabled=!1,this.closed=!1,this.disableQuestionAnswerLogging=!1}static{this.properties={closePanel:0,insertText:0,helpBase:1,assistantsEnabled:5,portalUrl:1,serviceUrl:1,closed:7,editorRef:0,feedbackServiceUrl:1,appVersion:1,disableQuestionAnswerLogging:5}}static{this.styles=Pe}get disclaimerComment(){return`// ${this.messages.disclaimercomment}
3
3
  // ${this.messages.disclaimerpt2??"AI-generated content may be inaccurate. Review before using."}`}get assistantOverviewDocUrl(){return`${this.helpBase??"https://doc.arcgis.com/en/arcgis-online/"}create-maps/understand-arcade-assistant.htm`}get usingTheAssitantDocUrl(){return`${this.helpBase??"https://doc.arcgis.com/en/arcgis-online/"}create-maps/understand-arcade-assistant.htm`}async destroy(){}connectedCallback(){super.connectedCallback(),this.updateViewState({history:ke,splashActive:Se})}load(){let e=async()=>{let t=this.getModel();if(!t){this.updateViewState({context:void 0});return}let s=await this.getProfileAndMetadata(t.uri);this.updateViewState({context:s,contextReducedNoticeDismissed:s.contextTooLarge?!1:this.viewState.contextReducedNoticeDismissed})};e().catch(t=>{k("error",this,"Error setting initial context.",{detail:{error:t}})}),this.manager.onLifecycle(()=>{let t=z.onModelContextDidChange(async()=>{e().catch(s=>{k("error",this,"Error setting context.",{detail:{error:s}})})});return{remove:()=>{t.dispose()}}})}disconnectedCallback(){super.disconnectedCallback(),ke=this.viewState.history,Se=this.viewState.splashActive,this.copySuccessTimer&&(clearTimeout(this.copySuccessTimer),this.copySuccessTimer=void 0)}createFeedbackContextSnapshot(e){let t=at(e.metadata);return{...e,metadata:t,estimatedTokens:H(t)}}encodeAnswerForFeedback(e){return encodeURIComponent(e??"")}updateViewState(e){this.viewState.set(e)}getHistoryCards(){return this.viewState.history.reduce((e,t)=>(!t.script||(e.push({priorPrompt:t.question,code:t.formattedScript||t.error||"",profileId:t.profile??$e,onAddToEditor:s=>{ne(this.editorRef.editorInstance,t.formattedScript??"",s,this.disclaimerComment)},onThumbsUp:()=>this.handleFeedbackButton("good",t),onThumbsDown:()=>this.handleFeedbackButton("bad",t),conversationId:t.conversationId??"",message:t.message}),this.viewState.viewMode),e),[])}async ensureFeedbackService(){if(this._feedbackService)return this._feedbackService;if(!this.feedbackServiceUrl)return;let e=new Ie({url:this.feedbackServiceUrl});await e.load();let t=lt.filter(s=>!e.fields.some(i=>i.name===s));if(t.length>0){k("error",this,`Missing the following fields in feedback service: ${t.join(", ")}. Feedback will not be logged.`);return}return this._feedbackService=e,e}async logInteractionToFeedbackService(e){if(this.disableQuestionAnswerLogging||!e.question)return;let t;try{t=await this.ensureFeedbackService()}catch(l){k("error",this,"Error initializing feedback service for interaction logging.",{detail:{error:l}});return}if(!t)return;let s=ue.applicationName,i=e.contextSnapshot,n={question:e.question,answer:this.encodeAnswerForFeedback(e.answer),useragent:navigator.userAgent,_source:xe,version:this.appVersion||s||"NOT_SET",context:i?JSON.stringify(i):"",extras:i?.profileId??"",conversation_id:e.conversationId??"",privacy_statement:""};try{await t.applyEdits({addFeatures:[new me({attributes:n})]})}catch(l){k("error",this,"Error logging arcade assistant question/answer interaction.",{detail:{error:l}})}}getModel(){return this.editorRef.editorInstance?.getModel()}async submitQuestion(){if(!this.viewState.question)return;let e=this.viewState.question;this.updateViewState({isSubmitting:!0,errorMessage:void 0});let t,s;try{let i=this.getModel();if(!i||!this.serviceUrl)return;let n=this.viewState.context??await this.getProfileAndMetadata(i.uri);t=this.createFeedbackContextSnapshot(n);let l=await this.getToken(),d=await qe({baseUrl:this.serviceUrl,skillId:rt,message:e,authToken:l,context:{kind:ct,context:{profile_id:n.profileId,metadata:[n.metadata]}}});s=d?.[0]?.conversationId;let r=d.find(o=>o.context?.kind==="ArcadeCodeResponse");if(!r){await this.logInteractionToFeedbackService({question:e,answer:"No ArcadeCodeResponse returned.",contextSnapshot:t,conversationId:s});return}if(r.context?.kind==="ArcadeCodeResponse"){let o=this.createFeedbackContextSnapshot(n),g=re(r?.context?.arcadeCode?.code??"");this.updateViewState({history:[{script:r?.context?.arcadeCode?.code,formattedScript:g,error:void 0,question:e,profile:n.profileId,conversationId:r.conversationId,contextSnapshot:o,...r.message?{message:r.message}:{}},...this.viewState.history],viewMode:"result",errorMessage:void 0}),await this.logInteractionToFeedbackService({question:e,answer:g,contextSnapshot:t,conversationId:r.conversationId})}}catch(i){let n=i instanceof Error&&i.name==="ArcadeAssistantError"?Fe(i)||this.messages.erroroccurred||"An error occurred.":this.messages.erroroccurred||"An error occurred.";this.updateViewState({errorMessage:n}),await this.logInteractionToFeedbackService({question:e,answer:n,contextSnapshot:t,conversationId:s}),k("error",this,"Error submitting question",{detail:{error:i}})}finally{this.updateViewState({isSubmitting:!1})}}async getToken(){let{token:e}=await Ce.getCredential(this.portalUrl);return e}async getProfileAndMetadata(e){let t=$e,s=z.getEditorProfileForModel(e);s?.loaded||await s?.loadSource();let i=this.editorRef.profile;i&&"id"in i&&(t=i.id);let n=s?await Ze(s):{variables:[]},l=it(n),d=l?st(n):void 0,r=d?d.context:n,o=H(r);return{profileId:t,metadata:r,contextTooLarge:l,reducedToVariableName:d?.reducedToVariableName,estimatedTokens:o}}onCopyCode(e){let t=e?`${this.disclaimerComment}
4
4
  ${e}`:"";return navigator.clipboard.writeText(t)}render(){if(this.closed)return null;let e=this.viewState.viewMode==="result",t=this.getHistoryCards();return this.assistantsEnabled?p`<calcite-flow><calcite-flow-item closable heading-level=2 .heading=${this.messages.arcadeassistant??"Arcade assistant"} @calciteFlowItemClose=${this.handleClose}>${this.viewState.splashActive&&p`<calcite-scrim></calcite-scrim>`||""}${Oe({messages:this.messages})}${ze({messages:this.messages,popoverContent:ge({assistantsEnabled:this.assistantsEnabled,messages:this.messages,helpTopicUrl:this.usingTheAssitantDocUrl})})}<calcite-shell class="unstyled-shell">${this.viewState.splashActive&&Ye({messages:this.messages,onProceed:()=>{this.updateViewState({splashActive:!1})},helpTopicUrl:this.assistantOverviewDocUrl,onExit:s=>this.closePanel?.(s)})||""}${Be({active:this.viewState.confirmationActive,setActive:s=>this.updateViewState({confirmationActive:s}),messages:this.messages})}${Qe({isDisabled:this.viewState.isSubmitting,isReadOnly:!1,setQuestion:this.setQuestionState,setIsViewingResult:s=>this.updateViewState({viewMode:s?"result":"prompt"}),mode:e?"refine":"prompt",textAreaRef:this.textAreaRef,question:this.viewState.question,errorMessage:this.viewState.errorMessage,setErrorMessage:s=>this.updateViewState({errorMessage:s}),promptValidationMessage:this.viewState.promptValidationMessage,setPromptValidationMessage:s=>this.updateViewState({promptValidationMessage:s}),submitQuestion:this.submitQuestion.bind(this),assistantRef:this.el,messages:this.messages,context:this.viewState.context,contextReducedNoticeDismissed:this.viewState.contextReducedNoticeDismissed,setContextReducedNoticeDismissed:s=>this.updateViewState({contextReducedNoticeDismissed:s})})}<calcite-block-group .label=${this.messages.interactiveblocks??"interactive blocks"}>${!e&&!this.viewState.isSubmitting&&We({messages:this.messages,suggestions:[this.messages.prompsuggestion1??"",this.messages.prompsuggestion2??""],onSuggestionClick:this.onSuggestionClick})||""}<calcite-block .hidden=${!this.viewState.isSubmitting} .heading=${this.messages.generatingresponse??"Generating response..."}></calcite-block>${fe({expanded:e,messages:this.messages,collapsible:!0,showEffectsIcon:!0,cards:t.length?[t[0]]:[],heading:this.messages.besteffort??"Here's the assistant's best effort",hidden:this.viewState.isSubmitting||!e,onCopyCode:this.onCopyCode.bind(this),standalone:!0})}${fe({expanded:!e,messages:this.messages,collapsible:!0,cards:e?t.slice(1):t,heading:this.messages.recentprompts??"Recent prompts",hidden:this.viewState.isSubmitting||this.viewState.history.length===0,onCopyCode:this.onCopyCode.bind(this)})}</calcite-block-group>${this.viewState.feedback.active?Je({setOpen:this.handleFeedbackSheetClose,messages:this.messages,onSubmit:this.handleFeedbackSubmit,feedback:this.viewState.feedback,setFeedback:this.setFeedbackState,learnMoreUrl:this.assistantOverviewDocUrl}):null}</calcite-shell></calcite-flow-item></calcite-flow>`:p`<calcite-flow><calcite-flow-item .selected=${!e} closable heading-level=2 .heading=${this.messages.arcadeassistant??"Arcade assistant"} @calciteFlowItemClose=${this.handleClose}>${ge({slot:"content-top",messages:this.messages,assistantsEnabled:this.assistantsEnabled,helpTopicUrl:this.usingTheAssitantDocUrl})}</calcite-flow-item></calcite-flow>`}};ie("arcgis-arcade-coding-assistant",G);return G},"identity/IdentityManager","request","layers/FeatureLayer","config","Graphic","applications/Components/arcadeEditorUtils","core/Accessor","core/accessorSupport/decorators",a,b)