/*! All material copyright Esri, All Rights Reserved, unless otherwise specified.
See https://js.arcgis.com/5.0/esri/copyright.txt for details.
v5.0.0-next.24 */
import{a as Q,b as Y,c as Z,d,e as f}from"./JITJKBZ3.js";import{b as D,c as S,d as v,e as H,h as J,k as X}from"./XUH4VSI3.js";import{h as z}from"./2TBF7JVQ.js";import{E as B}from"./MAY23F2W.js";import{f as q,h as V}from"./XVOGV3WA.js";import{Gl as $,Pl as A}from"./5JU7IWUX.js";export default $arcgis.t(([x,_e,me,be,ge,{getDeclaredVoxelMembers:we,getDeclaredPixelMembers:Ce}])=>{var L=t=>t!==void 0,F=t=>t!==null;function le(t){return!!t&&typeof t=="object"&&"declaredClass"in t&&typeof t.declaredClass=="string"&&t.declaredClass.startsWith("esri.layers.")&&P(t)&&"queryFeatures"in t&&typeof t.queryFeatures=="function"}function pe(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 De(t){return!!t&&typeof t=="object"&&"loadAll"in t&&typeof t.loadAll=="function"}function ce(t){return!!t&&typeof t=="object"&&"portalItem"in t&&t.portalItem!=null}function ue(t){return!!t&&typeof t=="object"&&"portalItem"in t&&t.portalItem!=null}function P(t){return!!t&&typeof t=="object"&&"fields"in t&&Array.isArray(t.fields)}function M(t){return!!t&&typeof t=="object"&&"url"in t&&typeof t.url=="string"}function Se(t){return M(t)&&/\/(?:featureserver|mapserver)(?:\/|$)/iu.test(t.url??"")}function he(t){return M(t)||P(t)||ue(t)}function et(t){return he(t)&&"type"in t&&t.type==="voxel"}function tt(t){return he(t)&&"type"in t&&t.type==="pixel"}function it(t){return M(t)||P(t)||ue(t)}function rt(t){return ce(t)||pe(t)||Se(t)}function ee(t){return!!t&&typeof t=="object"&&"declaredClass"in t&&t.declaredClass==="esri.layers.support.Subtype"}function j(t){return!!t&&typeof t=="object"&&"declaredClass"in t&&t.declaredClass==="esri.layers.support.CodedValueDomain"}function ve(t){return!!t&&typeof t=="object"&&"declaredClass"in t&&t.declaredClass==="esri.layers.support.InheritedDomain"}function st(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 h(t){return!!t&&typeof t=="object"&&"title"in t&&typeof t.title=="string"}function Fe(t){return!!t&&typeof t=="object"&&"url"in t&&typeof t.url=="string"}function de(t){return!!t&&typeof t=="object"&&"layerId"in t&&typeof t.layerId=="number"}function E(t){return!!t&&typeof t=="object"&&"typeIdField"in t&&"types"in t}function te(t){return!!t&&typeof t=="object"&&"getFieldDomain"in t&&typeof t.getFieldDomain=="function"}function y(t){return!!t&&typeof t=="object"&&"subtypeField"in t}function xe(t){return y(t)&&"subtypes"in t}function Te(t){return!!t&&typeof t=="object"&&"portalItem"in t}function Ie(t){return de(t)&&"relationships"in t&&"url"in t&&Array.isArray(t.relationships)&&typeof t.url=="string"}function Pe(t){return!!t&&typeof t=="object"&&"isTable"in t&&typeof t.isTable=="boolean"}function Me(t){if(t&&typeof t=="object"){if(Pe(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 Ve(t){return!Me(t)}function $e(t){return!!t&&typeof t=="object"&&"load"in t&&typeof t.load=="function"}function Ae(t){return!!t&&typeof t=="object"&&"type"in t&&t.type==="voxel"}function ie(t){return!!t&&typeof t=="object"&&"type"in t&&typeof t.type=="string"&&["imagery","imagery-tile"].includes(t.type)}async function fe(t){if(!t)return null;let e;return P(t)?e=t:e=new x(t),$e(e)&&await e.load(),e}async function Le(t){t+="/layers";let e=await _e(t,{responseType:"json",query:{f:"json"}}),i=t.endsWith("MapServer/layers")?"data":"query",r=re(e.data?.layers,i),s=re(e.data?.tables,i);return{layers:r,tables:s}}function re(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 je(t,e){let i=new x({url:`${t.url}/${e.relatedTableId}`});return await i.load(),i}function R(t){return(e,i)=>{if(e.type==="oid")return-1;if(i.type==="oid")return 1;if(y(t)){if(e.name===t.subtypeField)return-1;if(i.name===t.subtypeField)return 1}if(E(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 se(t,e){return t?.every(i=>i.domains?.[e.name]?.type==="inherited")??!1}var Ee=/^[a-z_$][a-z0-9_$]*$/giu;function O(t,e=!0){return t.match(Ee)?`${e?".":""}${t}`:`["${t}"]`}function ye(t,e){return t?`${t}${O(e)}`:e}function ne(t){return Te(t)?t.portalItem:null}function nt(t,e,i=!1){let r=e,s=[],o=[];return d(t).forEach(n=>{r&&(r+=`  
  
`),r+=`**${n.name}** (${n.alias})  
${n.type}`,n.description&&(r+=`  
'${n.description}`);let u=Z(n),c=O(n.name,!1),p=f(n);if(s.push({name:n.name,description:p,type:u,completion:{label:n.name,detail:p,insertText:c,insertTextMode:v.asIs,insertTextFormat:S.PlainText,kind:D.Field}}),i){if(!n.alias||n.alias.toLowerCase()===n.name.toLowerCase())return;let C=`**${n.alias}**  
${n.type}`;n.description&&(C+=`  
'${n.description}`),o.push({name:n.alias,description:n.name,type:u,completion:{label:n.alias,detail:n.name,insertText:c,insertTextMode:v.asIs,insertTextFormat:S.PlainText,kind:D.Field,documentation:{kind:"markdown",value:C}}})}}),[[...s,...o],r]}function ot(t,e){let i=e,r=[];return t.forEach(s=>{i&&(i+=`  
  
`),i+=`**${s.name}**  
${s.type}`,s.name&&(i+=`  
'${s.name}`),r.push({name:s.name,description:s.name,type:"array",completion:{label:s.name,detail:s.name,insertText:O(s.name,!1),insertTextMode:v.asIs,insertTextFormat:S.PlainText,kind:D.Field}})}),[r,i]}var T=class{constructor(e,i,r){this._profile=e,this._label=i,this.description=r,this.filterDescription=!1}getLabel(){return this._label==null?"":typeof this._label=="string"?q(this._label):V(this._profile?.intlStrings[this._label.code],this._label.formatValues)}getDescription(){return this.description==null?"":typeof this.description=="string"?this.description:V(this._profile?.intlStrings[this.description.code],this.description.formatValues)}passFilter(e){return!e||e.test(this.getLabel())?!0:this.filterDescription&&e.test(this.getDescription())}},_=class extends T{constructor(e){super(e.profile,e.label,e.description??e.declaration?.description),this.declaration=e.declaration??{},this.name=e.declaration?.name??"",this.snippet=e.snippet??"",this.nonInteractive=e.nonInteractive??!1,this.filterDescription=e.filterDescription??!1,this.icon=e.icon}},a=class extends _{constructor(e){super(e),this.type="text",this.isCollection=!1,this.type=e.declaration?.type??"text"}getDescription(){return this.description==null?this._profile?.intlStrings[this.type.toLowerCase()]??"":super.getDescription()}toProfileVariableDefinition(){return{type:this.type,name:"",...this.declaration}}},N=class extends _{constructor(e){super(e),this.type="array",this.isCollection=!1,this.elementType=e.declaration?.elementType??{type:"number",name:"number"}}getDescription(){return this.description==null?this._profile?.intlStrings[this.type.toLowerCase()]??"":super.getDescription()}toProfileVariableDefinition(){return{type:this.type,elementType:this.elementType,name:"",...this.declaration}}},m=class extends _{constructor(e,i){super(i),this.owner=e,this.isCollection=!0,this._loaded=!0,this.variables=[]}get breadcrumb(){if(this.owner){let e=this.owner.breadcrumb;return e?`${e} / ${this.name}`:this.name}return this.name}get loaded(){return this._loaded}get informationUrl(){return null}get informationType(){return""}},l=class extends T{constructor(e,i,r=[],s=!1){super(e,i),this.variables=r,this.isHeader=s,this.type="group",this.isCollection=!0}passFilter(){return!0}},b=class t extends m{constructor(e,i){super(e,i),this.type="dictionary",this.dictionaryVariables=[],this.loadPropertyDeclarations(i.declaration?.properties),this.snippet&&this.dictionaryVariables.length&&(this.variables=[new l(this._profile,this.snippet,this.dictionaryVariables)])}async loadSource(){}loadPropertyDeclarations(e){this.dictionaryVariables=this.createVariableInstances(e),this.variables=this.dictionaryVariables}createVariableInstances(e){if(!Array.isArray(e))return[];let i=[];return e.forEach(r=>{let s=this.createVariableInstance(r);s&&i.push(s)}),i}createVariableInstance(e){let i=ye(this.snippet,e.name);switch(e.type){case"number":case"text":case"boolean":case"date":case"dateOnly":case"time":case"geometry":case"knowledgeGraph":return new a({profile:this._profile,declaration:e,label:i,snippet:i});case"pixel":return new U(this,{profile:this._profile,declaration:e,label:i,snippet:i});case"voxel":return new W(this,{profile:this._profile,declaration:e,label:i,snippet:i});case"feature":return new G(this,{profile:this._profile,declaration:e,label:i,snippet:i});case"featureSet":return new w(this,{profile:this._profile,declaration:e,label:i,snippet:i},[new a({profile:this._profile,label:i,description:"",snippet:i})]);case"featureSetCollection":return new k(this,{profile:this._profile,declaration:e,label:i,snippet:i});case"dictionary":return new t(this,{profile:this._profile,declaration:e,label:i,snippet:i});case"array":return new N({profile:this._profile,declaration:e,label:i,snippet:i});default:return console.error("Editor profile: Invalid profile variable",e),null}}toProfileVariableDefinition(){return{type:this.type,name:"",...this.declaration,properties:this.dictionaryVariables.map(e=>e.toProfileVariableDefinition())}}},I=class extends m{constructor(e,i,r){super(e,i),this.relationshipsProperties=r,this._source=null,this._loaded=!1,this._definition=i.declaration?.definition}get title(){return h(this._source)?this._source.title??"":""}get url(){return Fe(this._source)?this._source.url??"":""}get informationUrl(){return!this.loaded||!this.url?null:de(this._source)?`${this.url}/${this._source.layerId}`:this.url}get informationType(){return this._profile?.intlStrings.layer??"layer"}async loadSource(){return F(this._loadPromise)&&L(this._loadPromise)?await this._loadPromise:(this._loadPromise=this._loadSource(),await this._loadPromise)}_getValueSnippet(e){return["feature","voxel","pixel"].includes(this.type)?ye(this.snippet,e.name):e.name}_getSubtypeOrDomainNameSnippet(e){return this.type!=="feature"?null:y(this._source)&&e.name===this._source.subtypeField?`SubtypeName(${this.snippet})`:`DomainName(${this.snippet}, "${e.name}")`}_getFieldProperty(e,i){let r=this._getDomainDictionary(e);if(r)return r;let s=this._getValueSnippet(e);return new a({profile:this._profile,label:s,description:f(e),snippet:s,icon:Q(e,i),filterDescription:!0})}_getMemberProperty(e){let i=this._getValueSnippet(e);return new a({profile:this._profile,label:i,description:e.name,snippet:i,icon:Y(e),filterDescription:!0})}_getDomainDictionary(e){return te(this._source)?y(this._source)&&this._source.subtypeField?this._getSubtypeDomainDictionary(e):E(this._source)&&this._source.typeIdField?this._getFeatureTypeDomainDictionary(e):this._getFieldDomainDictionary(e):null}_getSubtypeDomainDictionary(e){if(!y(this._source))return null;if(!xe(this._source))return e.name===this._source.subtypeField?null:this._getFieldDomainDictionary(e);if(e.name===this._source.subtypeField){let s=this._createDomainDictionary(e);return s.icon="subtype",s.variables.push(this._getTypeOrSubtypeDomainGroup(this._source.subtypes,e)),s}if(se(this._source.subtypes,e))return this._getFieldDomainDictionary(e);let i=this._getDomainValuesGroup(this._source.subtypes,e);if(!i)return null;let r=this._createDomainDictionary(e);return r.variables.push(i),r}_getFeatureTypeDomainDictionary(e){if(!E(this._source))return null;if(e.name===this._source.typeIdField){let s=this._createDomainDictionary(e);return s.variables.push(this._getTypeOrSubtypeDomainGroup(this._source.types,e)),s}if(se(this._source.types,e))return this._getFieldDomainDictionary(e);let i=this._getDomainValuesGroup(this._source.types,e);if(!i)return null;let r=this._createDomainDictionary(e);return r.variables.push(i),r}_getFieldDomainDictionary(e){if(!te(this._source))return null;let i=this._source.getFieldDomain(e.name);if(!j(i))return null;let r=this._getCodedValueDomainGroup(i,{code:"domainvalues"}),s=this._createDomainDictionary(e);return s.variables.push(r),s}_getTypeOrSubtypeDomainGroup(e,i){if(j(i.domain))return this._getCodedValueDomainGroup(i.domain,{code:"subtypes"});let r=e?.map(s=>{let o=ee(s)?s.code:s.id;return new a({profile:this._profile,label:`${o}`,description:s.name,snippet:`"${o}"`})})??[];return new l(this._profile,{code:"subtypes"},r)}_getCodedValueDomainGroup(e,i){let r=e.codedValues.map(s=>new a({profile:this._profile,label:`${s.code}`,description:s.name,snippet:`"${s.code}"`,filterDescription:!0}));return new l(this._profile,i,r)}_getDomainValuesGroup(e,i){let r=[];return!e||e.length===0||(e.forEach(s=>{let o=s.domains?.[i.name];if(!o||ve(o)||!j(o))return;let n=f(i),u=this._getCodedValueDomainGroup(o,{code:"domainvaluesfortypeformat",formatValues:{fieldName:n,typeName:s.name}}),c=ee(s)?s.code:s.id,p=`${c}`,C=`"${c}""`,K=new b(this,{profile:this._profile,label:p,snippet:C,description:s.name,declaration:{name:n}});K.variables=[u],r.push(K)}),!r.length)?null:new l(this._profile,{code:"domainvaluesbysubtypes"},r)}_createDomainDictionary(e){let i=this._getValueSnippet(e),r=f(e),s=new b(this,{profile:this._profile,label:i,description:r,snippet:i,icon:"form-dropdown",declaration:{name:e.name}}),o=new l(this._profile,r,[new a({profile:this._profile,label:i,description:"",snippet:i})]);s.variables=[o];let n=this._getSubtypeOrDomainNameSnippet(e);return n&&o.variables.push(new a({profile:this._profile,label:n,description:"",snippet:n})),s}async _getRelationshipsProperty(){if(!this.relationshipsProperties?.exposeRelationships||!this._profile?.supportFeatureSetFunctions)return null;let e=this._source;if(!Ie(e))return null;let i=new l(this._profile,{code:"relationships"}),r=await Promise.all(e.relationships?.map(async s=>{let o=await je(e,s);if(!le(o)||s.relatedTableId===this.relationshipsProperties?.sourceTableId)return null;let n=`FeatureSetByRelationshipName(${this.snippet}, "${s.name}")`;return new w(this,{profile:this._profile,declaration:{definition:o},label:o.title,description:"",nonInteractive:!0},[new a({profile:this._profile,label:n,description:"",snippet:n})],{exposeRelationships:!0,sourceTableId:e.layerId})})??[]);return i.variables=r.filter(F),i.variables.length?i:null}},g=class extends I{constructor(e,i,r,s={exposeRelationships:!0}){super(e,i,s),this.type=r}get title(){return h(this._source)?this._source.title??"":{code:this.type}}toProfileVariableDefinition(){return{type:this.type,name:"",...this.declaration}}},G=class extends g{constructor(e,i){super(e,i,"feature",{exposeRelationships:!0}),this.type="feature"}async _loadSource(){if(this.loaded)return this._source;try{if(this._source=await fe(this._definition),!this._source)throw new Error("Invalid definition");let e=h(this._source)?this._source.title??"":"";this.variables.push(new l(this._profile,e,[new a({profile:this._profile,label:this.snippet,description:"",snippet:this.snippet})]));let i=new l(this._profile,{code:"values"});if(this.variables.push(i),Ve(this._source)){let o=`Geometry(${this.snippet})`,n=new a({profile:this._profile,declaration:{name:o},label:o,description:"Geometry",snippet:o,icon:"shapes",filterDescription:!0});i.variables.push(n)}let r=this._source;d(this._source.fields).map(o=>r.fields.find(n=>n.name===o.name)).sort(R(r)).forEach(o=>{i.variables.push(this._getFieldProperty(o))});let s=await this._getRelationshipsProperty();s&&this.variables.push(s)}catch(e){console.error("Error with definition",e,this._definition),this._source=null}finally{this._loaded=!0}return this._source}},W=class extends g{constructor(e,i){super(e,i,"voxel",{exposeRelationships:!1}),this.type="voxel",this._source=null}async _loadSource(){if(this.loaded)return this._source;try{if(!Ae(this._definition))throw new Error("Invalid definition - not a VoxelLayer");if(await this._definition.load(),this._source=this._definition,!this._source)throw new Error("Invalid definition");let e=h(this._source)?this._source.title??"":"";this.variables.push(new l(this._profile,e,[new a({profile:this._profile,label:this.snippet,description:"",snippet:this.snippet})]));let i=new l(this._profile,{code:"values"});this.variables.push(i);let r=await we(this._source),s=this._source;d(this._source.fields).map(o=>s.fields.find(n=>n.name===o.name)).sort(R(s)).forEach(o=>{i.variables.push(this._getFieldProperty(o,r))})}catch(e){console.error("Error with definition",e,this._definition),this._source=null}finally{this._loaded=!0}return this._source}},U=class extends g{constructor(e,i){super(e,i,"pixel",{exposeRelationships:!1}),this.type="pixel",this._source=null}async _loadSource(){if(this.loaded)return this._source;try{if(!ie(this._definition))throw new Error("Invalid definition - not an ImageryLayer");if(await this._definition.load(),this._source=this._definition,!this._source)throw new Error("Invalid definition");let e=h(this._source)?this._source.title??"":"";this.variables.push(new l(this._profile,e,[new a({profile:this._profile,label:this.snippet,description:"",snippet:this.snippet})]));let i=new l(this._profile,{code:"values"});if(this.variables.push(i),!ie(this._source))throw new Error("Invalid definition - not an ImageryLayer");(await Ce(this._source)).forEach(r=>{i.variables.push(this._getMemberProperty(r))})}catch(e){console.error("Error with definition",e,this._definition),this._source=null}finally{this._loaded=!0}return this._source}},w=class extends I{constructor(e,i,r=[],s){super(e,i,s),this.featureSetSnippets=r,this.type="featureSet"}get title(){return h(this._source)?this._source.title??"":{code:"featureset"}}async _loadSource(){if(this.loaded)return this._source;try{if(this._source=await fe(this._definition),!this._source)throw new Error("Invalid definition");this.variables.push(new l(this._profile,this.title,this.featureSetSnippets,!0));let e=new l(this._profile,{code:"fields"});this.variables.push(e),e.variables=d(this._source.fields).sort(R(this._source)).map(r=>this._getFieldProperty(r));let i=await this._getRelationshipsProperty();i&&this.variables.push(i)}catch(e){console.error("Error with definition",e,this._definition),this._source=null}finally{this._loaded=!0}return this._source}toProfileVariableDefinition(){return{type:this.type,name:"",...this.declaration,definition:this._definition}}},k=class extends m{constructor(e,i){super(e,i),this.type="featureSetCollection",this._featureSetCollections=null,this._loaded=!1,this._definition=i.declaration?.definition}get informationUrl(){return!this.loaded||!this._featureSetCollections?null:typeof this._featureSetCollections.source!="string"?J(ne(this._featureSetCollections.source)):null}get informationType(){if(!this.loaded||!this._featureSetCollections)return"";if(typeof this._featureSetCollections.source=="string")return this._profile?.intlStrings.featureservice??"featureservice";switch(this._featureSetCollections.source.declaredClass){case"esri.WebMap":return this._profile?.intlStrings.webmap??"webmap";case"esri.WebScene":return this._profile?.intlStrings.webscene??"webscene";default:return this._profile?.intlStrings.map??"map"}}async loadSource(){return F(this._loadPromise)&&L(this._loadPromise)?await this._loadPromise:(this._loadPromise=this._loadSource(),await this._loadPromise)}async _loadSource(){if(this.loaded)return this._featureSetCollections;try{if(this._featureSetCollections=await this._featureSetCollectionsFromDefinition(),!this._featureSetCollections)throw new Error("Invalid definition");let e=typeof this._featureSetCollections.source=="string"?{code:this._featureSetCollections.source.endsWith("FeatureServer")?"featureservice":"mapservice"}:{code:"webmapformat",formatValues:{webMapTitle:ne(this._featureSetCollections.source)?.title||"Untitled map"}},i=new l(this._profile,e,[new a({profile:this._profile,label:this.snippet,description:"",snippet:this.snippet})]),r=new l(this._profile,{code:"layers"},this._featureSetCollections.layers),s=new l(this._profile,{code:"tables"},this._featureSetCollections.tables);this.variables.push(i,r,s)}catch(e){console.error("Error with definition",e,this._definition),this._featureSetCollections=null}finally{this._loaded=!0}return this._featureSetCollections}async _featureSetCollectionsFromDefinition(){return this._definition?pe(this._definition)?await this._featureSetCollectionFromMap(this._definition):M(this._definition)?await this._featureSetCollectionFromUrl(this._definition.url):ce(this._definition)?await this._featureSetCollectionFromPortalItem(this._definition.portalItem):null:null}async _featureSetCollectionFromMap(e){return De(e)&&await e.loadAll(),await Promise.all(e.allTables.map(async i=>await i.load())),{layers:this._convertWebMapLayersToVariables(e.allLayers),tables:this._convertWebMapLayersToVariables(e.allTables),source:e}}async _featureSetCollectionFromPortalItem(e){let i=new me(e);switch(await i.load(),i.type){case"Web Map":{let r=new be({portalItem:i});return await this._featureSetCollectionFromMap(r)}case"Web Scene":{let r=new ge({portalItem:i});return await this._featureSetCollectionFromMap(r)}case"Feature Service":return await this._featureSetCollectionFromUrl(i.url);default:return console.error("Unsupported portal item",e),null}}async _featureSetCollectionFromUrl(e){let i=e?.replace(/\/featureserver\/[0-9]*/iu,"/FeatureServer");if(i=i?.replace(/\/mapserver\/[0-9]*/iu,"/MapServer"),i=i?.split("?")[0],!i)return null;let r=await Le(i),s=Promise.all(r.layers.map(async c=>{let p=new x({url:`${i}/${c.id}`});return await p.load(),this._createFeatureSetVariable(p)})),o=Promise.all(r.tables.map(async c=>{let p=new x({url:`${i}/${c.id}`});return await p.load(),this._createFeatureSetVariable(p)})),[n,u]=await Promise.all([s,o]);return{layers:n,tables:u,source:i}}_convertWebMapLayersToVariables(e){let i=[];return e.toArray().reverse().forEach(r=>{if(le(r)){i.push(this._createFeatureSetVariable(r,!0));return}}),i}_createFeatureSetVariable(e,i=!1){return new w(this,{profile:this._profile,declaration:{name:e.title??"",definition:e},label:i?e.title:e.sourceJSON.name??e.title,description:"",nonInteractive:!0},this._makeFeatureSetSnippets(e,i))}_makeFeatureSetSnippets(e,i=!1){if(!this._profile?.supportFeatureSetFunctions)return[];if(i){let r=`FeatureSetById(${this.snippet}, "${e.id}")`,s=`FeatureSetByName(${this.snippet}, "${e.title}")`;return[new a({profile:this._profile,label:r,description:"",snippet:r}),new a({profile:this._profile,label:s,description:"",snippet:s})]}else{let r=`FeatureSetById(${this.snippet}, "${e.layerId}")`;return[new a({profile:this._profile,label:r,description:"",snippet:r})]}}toProfileVariableDefinition(){return{type:this.type,name:"",...this.declaration,definition:this._definition}}},oe=class extends b{constructor(e,i,r="en"){super(void 0,{profile:null,declaration:{properties:[]}}),this.definition=e,this.intlStrings=i,this.locale=r,this.variables=[],this._profile=this,this.loadPropertyDeclarations(e?.variables)}get supportFeatureSetFunctions(){return this.definition?.bundles?.includes("data-access")??!1}toEditorProfileDefinition(){return{...this.definition,variables:this.dictionaryVariables.map(e=>e.toProfileVariableDefinition())}}},Ne={locale:"en"},ae=class{constructor(e,i){this.languageId=e,this._apiConfig=i,this._onDidChange=new $,this._modelToProfileMap=new Map,this._modelToApiContextMap=new Map,this._localeToApiLibraryPromiseMap=new Map,this._onModelContextDidChange=new $,this._onDidModelContextChangeTimeout=-1,this.workerHost={getApiLibrary:async r=>await this.getApiLibrary(r)},X().then(r=>{r.onWillDisposeModel(s=>{this.disposeForModel(s.uri)})})}_fireModelContextDidChange(e){this._onDidModelContextChangeTimeout===-1&&(this._onDidModelContextChangeTimeout=window.setTimeout(()=>{this._onDidModelContextChangeTimeout=-1,this._onModelContextDidChange.fire(e)},0))}_getApiKey(e){return A.isUri(e)||(e=A.parse(e)),e.toString()}get onDidChange(){return this._onDidChange.event}disposeForModel(e){let i=this._getApiKey(e);this._modelToProfileMap.delete(i),this._modelToApiContextMap.delete(i)&&this._fireModelContextDidChange(i)}getEditorProfileForModel(e){return this._modelToProfileMap.get(this._getApiKey(e))}getApiContextForModel(e){return this._modelToApiContextMap.get(this._getApiKey(e))??Ne}updateApiContextForModel(e,i){let r=this._getApiKey(e),s=this._modelToApiContextMap.get(r)??{};this._modelToApiContextMap.set(r,{...s,...i}),this._fireModelContextDidChange(r)}get onModelContextDidChange(){return this._onModelContextDidChange.event}async getApiLibraryForModel(e){let i=this.getApiContextForModel(e),r=this.getApiLibrary(i.locale??"en");return(await H(r,i)).categories}async fetchApiLibrary(e){try{let{apiPath:i,apiPrefix:r}=this._apiConfig,s=B(`${i}/${r}${e}.json`),o=await fetch(s);return o.ok?await o.json():[]}catch{return[]}}async getApiLibrary(e){let i=z(e);return this._localeToApiLibraryPromiseMap.has(i)||this._localeToApiLibraryPromiseMap.set(i,this.fetchApiLibrary(i)),await this._localeToApiLibraryPromiseMap.get(i)??[]}};return{a:le,b:he,c:et,d:tt,e:it,f:rt,g:st,h:nt,i:ot,j:oe,k:ae}},"layers/FeatureLayer","request","portal/PortalItem","WebMap","WebScene","applications/Components/arcadeEditorUtils")