@arcgis/core 4.33.0-next.20250610 → 4.33.0-next.20250611

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (42) hide show
  1. package/assets/esri/core/workers/RemoteClient.js +1 -1
  2. package/assets/esri/core/workers/chunks/1c7eda72ecc2880034b9.js +1 -0
  3. package/assets/esri/core/workers/chunks/{63852887b3f07d50f7c9.js → 2ad538440cfb3ab94787.js} +1 -1
  4. package/assets/esri/core/workers/chunks/3cfc0a5f8a9cb9dc3b8f.js +1 -0
  5. package/assets/esri/core/workers/chunks/{3cbc498388fb1931a9f8.js → 40111357b99235a4cb0f.js} +1 -1
  6. package/assets/esri/core/workers/chunks/{4079e307a0fce4516aa4.js → 4a1f0587a1cc1138faa3.js} +1 -1
  7. package/assets/esri/core/workers/chunks/7716a9fb380d66ba7292.js +1 -0
  8. package/assets/esri/core/workers/chunks/aeac889d95f34b6d3b72.js +1 -0
  9. package/assets/esri/core/workers/chunks/{998819aade3898f52414.js → ec49e2849766402ad5c7.js} +1 -1
  10. package/assets/esri/themes/base/widgets/_BuildingPhasePicker.scss +7 -1
  11. package/assets/esri/themes/dark/main.css +1 -1
  12. package/assets/esri/themes/light/main.css +1 -1
  13. package/assets/esri/themes/light/view.css +1 -1
  14. package/chunks/PointRenderer.glsl.js +2 -2
  15. package/interfaces.d.ts +5 -5
  16. package/layers/CatalogLayer.js +1 -1
  17. package/layers/FeatureLayer.js +1 -1
  18. package/layers/GeoJSONLayer.js +1 -1
  19. package/layers/WFSLayer.js +1 -1
  20. package/layers/graphics/data/QueryEngineResult.js +1 -1
  21. package/layers/graphics/data/queryValidationUtils.js +1 -1
  22. package/layers/support/featureLayerUtils.js +1 -1
  23. package/package.json +1 -1
  24. package/rest/support/DateBinTimeInterval.js +1 -1
  25. package/rest/support/DateBinUtils.js +5 -0
  26. package/support/revision.js +1 -1
  27. package/views/2d/layers/features/support/FeatureSetReaderIndirect.js +1 -1
  28. package/views/3d/FocusAreasView.js +1 -1
  29. package/views/3d/interactive/measurementTools/directLineMeasurement3D/DirectLineMeasurement3DTool.js +1 -1
  30. package/widgets/Editor/EditorViewModel.js +1 -1
  31. package/widgets/Editor/UpdateFeaturesWorkflow.js +1 -1
  32. package/widgets/Editor/workflowUtils.js +1 -1
  33. package/widgets/OrientedImageryViewer/OrientedImageryViewerViewModel.js +1 -1
  34. package/widgets/OrientedImageryViewer/components/OrientedImageryVideoViewModel.js +1 -1
  35. package/widgets/OrientedImageryViewer/imageMeasurementUtils.js +1 -1
  36. package/widgets/OrientedImageryViewer.js +1 -1
  37. package/widgets/Print/PrintViewModel.js +1 -1
  38. package/widgets/Print.js +1 -1
  39. package/assets/esri/core/workers/chunks/18011c691e0aca4144dd.js +0 -1
  40. package/assets/esri/core/workers/chunks/3916879b9ca8c6979011.js +0 -1
  41. package/assets/esri/core/workers/chunks/5df4f2315fae82030e87.js +0 -1
  42. package/assets/esri/core/workers/chunks/a693cd3af2e995972252.js +0 -1
@@ -6,13 +6,13 @@ import{numberMaxFloat32 as e}from"../core/mathUtils.js";import{multiply as i,fro
6
6
  // Move clipped points outside of clipspace
7
7
  if (position.x < clipMin.x || position.y < clipMin.y || position.z < clipMin.z ||
8
8
  position.x > clipMax.x || position.y > clipMax.y || position.z > clipMax.z) {
9
- gl_Position = vec4(0.0,0.0,0.0,2.0);
9
+ gl_Position = vec4(1e038, 1e038, 1e038, 1.0);
10
10
  gl_PointSize = 0.0;
11
11
  return;
12
12
  }
13
13
 
14
14
  if (rejectBySlice(position)) {
15
- gl_Position = vec4(0.0, 0.0, 0.0, 2.0);
15
+ gl_Position = vec4(1e038, 1e038, 1e038, 1.0);
16
16
  gl_PointSize = 0.0;
17
17
  return;
18
18
  }
package/interfaces.d.ts CHANGED
@@ -14565,7 +14565,7 @@ declare namespace __esri {
14565
14565
  */
14566
14566
  registerMessageBundleLoader(loader: MessageBundleLoader): any;
14567
14567
  /**
14568
- * Sets the locale used by the API.
14568
+ * Sets the locale used by the SDK.
14569
14569
  *
14570
14570
  * @param locale The new Unicode locale identifier string, similar to the Intl APIs. If this is `undefined`, the locale is reset to its default value described in {@link https://developers.arcgis.com/javascript/latest/api-reference/esri-intl.html#getLocale `getLocale()`}.
14571
14571
  *
@@ -125601,7 +125601,7 @@ declare namespace __esri {
125601
125601
  */
125602
125602
  readonly id: string;
125603
125603
  /**
125604
- * The text that appears inside the {@link https://developers.arcgis.com/javascript/latest/api-reference/esri-widgets-Print.html Print Widget's} `Select template` button.
125604
+ * The text that appears inside the `Select template` button.
125605
125605
  *
125606
125606
  * {@link https://developers.arcgis.com/javascript/latest/api-reference/esri-widgets-Print-CustomTemplate.html#label Read more...}
125607
125607
  */
@@ -125664,8 +125664,8 @@ declare namespace __esri {
125664
125664
  */
125665
125665
  readonly type: "browse-template" | "default-template" | "print-service-template" | nullish;
125666
125666
  /**
125667
- * Defines the custom layout template options used by the {@link https://developers.arcgis.com/javascript/latest/api-reference/esri-widgets-Print.html Print} widget
125668
- * to generate the print page.
125667
+ * Defines the custom layout template options used by the {@link https://developers.arcgis.com/javascript/latest/api-reference/esri-widgets-Print.html Print widget} and
125668
+ * {@link https://developers.arcgis.com/javascript/latest/references/map-components/arcgis-print/ Print component} to generate the print page.
125669
125669
  *
125670
125670
  * {@link https://developers.arcgis.com/javascript/latest/api-reference/esri-widgets-Print-CustomTemplate.html Read more...}
125671
125671
  */
@@ -126212,7 +126212,7 @@ declare namespace __esri {
126212
126212
  */
126213
126213
  width: number | nullish;
126214
126214
  /**
126215
- * Defines the layout template options used by the {@link https://developers.arcgis.com/javascript/latest/api-reference/esri-widgets-Print.html Print} widget to generate printed output.
126215
+ * Defines the layout template options used by the {@link https://developers.arcgis.com/javascript/latest/api-reference/esri-widgets-Print.html Print widget} and {@link https://developers.arcgis.com/javascript/latest/references/map-components/arcgis-print/ Print component} to generate printed output.
126216
126216
  *
126217
126217
  * {@link https://developers.arcgis.com/javascript/latest/api-reference/esri-widgets-Print-TemplateOptions.html Read more...}
126218
126218
  */
@@ -2,4 +2,4 @@
2
2
  All material copyright ESRI, All Rights Reserved, unless otherwise specified.
3
3
  See https://js.arcgis.com/4.33/esri/copyright.txt for details.
4
4
  */
5
- import{_ as e}from"../chunks/tslib.es6.js";import t from"../request.js";import r from"../core/Collection.js";import i from"../core/Error.js";import{getOrCreateMapValue as o}from"../core/MapUtils.js";import{MultiOriginJSONMixin as s}from"../core/MultiOriginJSONSupport.js";import{throwIfAbortError as a}from"../core/promiseUtils.js";import{urlToObject as n,join as l,hasSamePortal as p}from"../core/urlUtils.js";import{property as y}from"../core/accessorSupport/decorators/property.js";import"../core/has.js";import"../core/Logger.js";import"../core/RandomLCG.js";import{subclass as d}from"../core/accessorSupport/decorators/subclass.js";import u from"./Layer.js";import m from"./catalog/CatalogDynamicGroupLayer.js";import c from"./catalog/CatalogFootprintLayer.js";import f from"./graphics/sources/FeatureLayerSource.js";import{APIKeyMixin as h}from"./mixins/APIKeyMixin.js";import{ArcGISService as g}from"./mixins/ArcGISService.js";import{BlendLayer as j}from"./mixins/BlendLayer.js";import{CustomParametersMixin as w}from"./mixins/CustomParametersMixin.js";import{DisplayFilteredLayer as F}from"./mixins/DisplayFilteredLayer.js";import{EditBusLayer as L}from"./mixins/EditBusLayer.js";import{FeatureLayerBase as v}from"./mixins/FeatureLayerBase.js";import{OperationalLayer as S}from"./mixins/OperationalLayer.js";import{OrderedLayer as b}from"./mixins/OrderedLayer.js";import{PortalLayer as x}from"./mixins/PortalLayer.js";import{RefreshableLayer as I}from"./mixins/RefreshableLayer.js";import{ScaleRangeLayer as O}from"./mixins/ScaleRangeLayer.js";import{TemporalLayer as E}from"./mixins/TemporalLayer.js";import{legendEnabled as T,id as _}from"./support/commonProperties.js";import{ensureLayerCredential as P,applyEdits as q,getFeatureType as C,hasDataChanged as A,validateBinsQuery as G}from"./support/featureLayerUtils.js";import U from"./support/FeatureType.js";import{defineFieldProperties as B}from"./support/fieldProperties.js";import{serviceSupportsSpatialReference as Q}from"./support/versionUtils.js";import D from"../portal/Portal.js";import N from"../portal/PortalItem.js";import{normalizeArcGISOnlineOrgDomain as M}from"../portal/support/urlUtils.js";import R from"../rest/support/Query.js";const V=B();function k(e){return"object"==typeof e&&null!=e&&"itemId"in e&&"portalUrl"in e}function J(e){return"object"==typeof e&&null!=e&&"url"in e}function H(e){if(null==e)return!0;const t=Object.keys(e);return!t.length||1===t.length&&"id"===t[0]}function K(e,t,r,i){const o=e.write({},i);H(o)||(t[r]=o)}let W=class extends(F(v(L(j(b(E(O(I(g(S(x(s(w(h(u))))))))))))))){constructor(e){super(e),this.legendEnabled=!0,this._portals=new Map,this._layerToFootprint=new WeakMap,this.drawOrderField="cd_draworder",this.dynamicGroupLayer=new m({parent:this}),this.elevationInfo=null,this.fields=null,this.fieldsIndex=null,this.floorInfo=null,this.footprintLayer=new c({parent:this}),this.itemNameField="cd_itemname",this.itemSourceField="cd_itemsource",this.itemTypeField="cd_itemtype",this.layers=new r([this.dynamicGroupLayer,this.footprintLayer]),this.maxScaleField="cd_maxscale",this.minScaleField="cd_minscale",this.orderBy=null,this.outFields=null,this.supportedSourceTypes=new Set(["Catalog Layer"]),this.source=new f({layer:this,supportedSourceTypes:this.supportedSourceTypes}),this.type="catalog",this.typeIdField=null,this.types=null}load(e){const t=null!=e?e.signal:null,r=this.loadFromPortal({supportedTypes:["Feature Service"]},e).catch(a).then((async()=>{const{url:e,source:r,portalItem:o}=this;if(!e)throw new i("catalog-layer:missing-url","Catalog layer must be created with a url");if(null==this.layerId){const r=await this._fetchFirstValidLayerId(t);if(null==r)throw new i("catalog-layer:missing-layerId","There is no Catalog Layer in the service",{service:e});this.layerId=r}await r.load({signal:t});const{sourceJSON:s}=r;s&&(this.sourceJSON=s,this.read(s,{origin:"service",portalItem:o,portal:o?.portal,url:this.parsedUrl}))})).then((()=>{const e=[this.itemNameField,this.itemSourceField,this.itemTypeField,this.minScaleField,this.maxScaleField],t=e.filter((e=>!this.fieldsIndex.has(e)));if(t.length)throw new i("catalog-layer:missing-fields","There are missing fields to operate properly",{requiredFields:e,missingFields:t})})).then((()=>P(this,"load",e)));return this.addResolvingPromise(r),Promise.resolve(this)}destroy(){this.footprintLayer.destroy(),this.dynamicGroupLayer.destroy();for(const e of this._portals.values())e.destroy();this._portals.clear()}get createQueryVersion(){return this.commitProperty("definitionExpression"),this.commitProperty("timeExtent"),this.commitProperty("timeOffset"),this.commitProperty("geometryType"),this.commitProperty("capabilities"),(this._get("createQueryVersion")??0)+1}get editingEnabled(){return this.loaded&&null!=this.capabilities&&this.capabilities.operations.supportsEditing&&this.userHasEditingPrivileges}get effectiveEditingEnabled(){return!1}get parsedUrl(){const e=n(this.url);return null!=e&&null!=this.layerId&&(e.path=l(e.path,this.layerId.toString())),e}async applyEdits(e,t){return q(this,e,t)}on(e,t){return super.on(e,t)}async createLayerFromFootprint(e){const t=await this._createLayer(e);return this._configureLayer(t,e),this._layerToFootprint.set(t,e),t}createFootprintFromLayer(e){return this._layerToFootprint.get(e)?.clone()}createQuery(){const e=new R,t=this.capabilities?.query;e.returnGeometry=!0,t&&(e.compactGeometryEnabled=t.supportsCompactGeometry,e.defaultSpatialReferenceEnabled=t.supportsDefaultSpatialReference),e.outFields=["*"];const{timeOffset:r,timeExtent:i}=this;return e.timeExtent=null!=r&&null!=i?i.offset(-r.value,r.unit):i||null,e.where=this.definitionExpression||"1=1",e}getFeatureType(e){return C(this.types,this.typeIdField,e)}getFieldDomain(e,t){const r=t?.feature,i=this.getFeatureType(r);if(i){const t=i.domains&&i.domains[e];if(t&&"inherited"!==t.type)return t}return this.getField(e)?.domain}async hasDataChanged(){return A(this)}async queryFeatures(e,t){const r=await this.load(),i=await r.source.queryFeatures(R.from(e)??r.createQuery(),t);if(i?.features)for(const o of i.features)o.layer=o.sourceLayer=r.footprintLayer;return i}async queryObjectIds(e,t){return(await this.load()).source.queryObjectIds(R.from(e)??this.createQuery(),t)}async queryFeatureCount(e,t){return(await this.load()).source.queryFeatureCount(R.from(e)??this.createQuery(),t)}async queryExtent(e,t){return(await this.load()).source.queryExtent(R.from(e)??this.createQuery(),t)}serviceSupportsSpatialReference(e){return this.loaded&&Q(this,e)}read(e,t){if(super.read(e,t),e){const{footprintLayer:r,dynamicGroupLayer:i}=e;r&&this.footprintLayer.read(r,t),i&&this.dynamicGroupLayer.read(i,t)}}async queryAttributeBins(e,t){const{source:r,capabilities:o}=await this.load(),s="CatalogLayer";if(!r.queryAttributeBins||!o?.operations?.supportsQueryBins)throw new i(s,"The layer does not support queryAttributeBins");G(e,o,s);const a=await import("../rest/support/AttributeBinsQuery.js"),n=await r.queryAttributeBins(a.default.from(e),t);if(n.features)for(const i of n.features)i.layer=i.sourceLayer=this.footprintLayer;return n}async _fetchFirstValidLayerId(e){const{data:r}=await t(this.url,{query:{f:"json",...this.customParameters,token:this.apiKey},responseType:"json",signal:e});if(this.applyPreferredHost(r),Array.isArray(r?.layers))return r.layers.find((({type:e})=>this.supportedSourceTypes.has(e)))?.id}async _createLayer(e){const t=e.getAttribute(this.itemSourceField);if(!t)throw new i("catalog-layer:item-source-missing",`The footprint is missing the "${this.itemSourceField}" attribute`);const r=JSON.parse(t);if(k(r)){const{itemId:e,portalUrl:t}=r,i=M(t),s=this.portalItem?.portal,a=D.getDefault();let n,l=!0;s&&p(t,s.url)?n=s:p(t,a.url)?n=a:(n=o(this._portals,i,(()=>new D({url:i}))),l=!1);const y=await u.fromPortalItem(new N({id:e,portal:n}));return l||await $(y),y}if(J(r))return u.fromArcGISServerUrl({url:r.url});const{default:s}=await import("./UnsupportedLayer.js");return new s}_configureLayer(e,t){const r=t.getAttribute(this.itemNameField);r&&(e.title=r);const i=t.getAttribute(this.maxScaleField);null!=i&&"maxScale"in e&&(e.maxScale=i);const o=t.getAttribute(this.minScaleField);null!=o&&"minScale"in e&&(e.minScale=o)}};async function $(e){if("portalItem"in e&&e.portalItem){try{await e.load()}catch{}e.portalItem=null,"group"===e.type&&await Promise.allSettled([...e.layers.map((e=>$(e))),...e.tables.map((e=>$(e)))])}}e([y(T)],W.prototype,"legendEnabled",void 0),e([y({readOnly:!0})],W.prototype,"createQueryVersion",null),e([y({readOnly:!0})],W.prototype,"drawOrderField",void 0),e([y({type:m,readOnly:!0,json:{read:!1,write:{ignoreOrigin:!0,writer:K}}})],W.prototype,"dynamicGroupLayer",void 0),e([y({readOnly:!0})],W.prototype,"editingEnabled",null),e([y({readOnly:!0})],W.prototype,"effectiveEditingEnabled",null),e([y({json:{origins:{"web-scene":{name:"layerDefinition.elevationInfo",read:!1,write:!1}}}})],W.prototype,"elevationInfo",void 0),e([y({...V.fields,readOnly:!0,json:{origins:{service:{read:!0}},read:!1}})],W.prototype,"fields",void 0),e([y(V.fieldsIndex)],W.prototype,"fieldsIndex",void 0),e([y({json:{origins:{"web-scene":{name:"layerDefinition.floorInfo",read:!1,write:!1}}}})],W.prototype,"floorInfo",void 0),e([y({type:c,readOnly:!0,json:{read:!1,write:{ignoreOrigin:!0,writer:K}}})],W.prototype,"footprintLayer",void 0),e([y(_)],W.prototype,"id",void 0),e([y({readOnly:!0})],W.prototype,"itemNameField",void 0),e([y({readOnly:!0})],W.prototype,"itemSourceField",void 0),e([y({readOnly:!0})],W.prototype,"itemTypeField",void 0),e([y({readOnly:!0})],W.prototype,"layers",void 0),e([y({type:["show","hide","hide-children"]})],W.prototype,"listMode",void 0),e([y({readOnly:!0})],W.prototype,"maxScaleField",void 0),e([y({readOnly:!0})],W.prototype,"minScaleField",void 0),e([y({value:"CatalogLayer",type:["CatalogLayer"]})],W.prototype,"operationalLayerType",void 0),e([y({json:{origins:{"web-scene":{name:"layerDefinition.orderBy",write:!0,read:!0}}}})],W.prototype,"orderBy",void 0),e([y(V.outFields)],W.prototype,"outFields",void 0),e([y({readOnly:!0})],W.prototype,"parsedUrl",null),e([y({readOnly:!0})],W.prototype,"source",void 0),e([y({json:{read:!1}})],W.prototype,"type",void 0),e([y({type:String})],W.prototype,"typeIdField",void 0),e([y({type:[U]})],W.prototype,"types",void 0),W=e([d("esri.layers.CatalogLayer")],W);const z=W;export{z as default};
5
+ import{_ as e}from"../chunks/tslib.es6.js";import t from"../request.js";import r from"../core/Collection.js";import i from"../core/Error.js";import{getOrCreateMapValue as o}from"../core/MapUtils.js";import{MultiOriginJSONMixin as s}from"../core/MultiOriginJSONSupport.js";import{throwIfAbortError as a}from"../core/promiseUtils.js";import{urlToObject as n,join as l,hasSamePortal as p}from"../core/urlUtils.js";import{property as y}from"../core/accessorSupport/decorators/property.js";import"../core/has.js";import"../core/Logger.js";import"../core/RandomLCG.js";import{subclass as d}from"../core/accessorSupport/decorators/subclass.js";import u from"./Layer.js";import m from"./catalog/CatalogDynamicGroupLayer.js";import c from"./catalog/CatalogFootprintLayer.js";import f from"./graphics/sources/FeatureLayerSource.js";import{APIKeyMixin as h}from"./mixins/APIKeyMixin.js";import{ArcGISService as g}from"./mixins/ArcGISService.js";import{BlendLayer as j}from"./mixins/BlendLayer.js";import{CustomParametersMixin as F}from"./mixins/CustomParametersMixin.js";import{DisplayFilteredLayer as w}from"./mixins/DisplayFilteredLayer.js";import{EditBusLayer as L}from"./mixins/EditBusLayer.js";import{FeatureLayerBase as v}from"./mixins/FeatureLayerBase.js";import{OperationalLayer as S}from"./mixins/OperationalLayer.js";import{OrderedLayer as x}from"./mixins/OrderedLayer.js";import{PortalLayer as I}from"./mixins/PortalLayer.js";import{RefreshableLayer as b}from"./mixins/RefreshableLayer.js";import{ScaleRangeLayer as O}from"./mixins/ScaleRangeLayer.js";import{TemporalLayer as E}from"./mixins/TemporalLayer.js";import{legendEnabled as T,id as _}from"./support/commonProperties.js";import{ensureLayerCredential as P,applyEdits as C,getFeatureType as q,hasDataChanged as G,validateBinsQuery as U}from"./support/featureLayerUtils.js";import A from"./support/FeatureType.js";import{defineFieldProperties as Q}from"./support/fieldProperties.js";import{serviceSupportsSpatialReference as B}from"./support/versionUtils.js";import D from"../portal/Portal.js";import N from"../portal/PortalItem.js";import{normalizeArcGISOnlineOrgDomain as M}from"../portal/support/urlUtils.js";import R from"../rest/support/Query.js";const V=Q();function k(e){return"object"==typeof e&&null!=e&&"itemId"in e&&"portalUrl"in e}function J(e){return"object"==typeof e&&null!=e&&"url"in e}function H(e){if(null==e)return!0;const t=Object.keys(e);return!t.length||1===t.length&&"id"===t[0]}function K(e,t,r,i){const o=e.write({},i);H(o)||(t[r]=o)}let W=class extends(w(v(L(j(x(E(O(b(g(S(I(s(F(h(u))))))))))))))){constructor(e){super(e),this.legendEnabled=!0,this._portals=new Map,this._layerToFootprint=new WeakMap,this.drawOrderField="cd_draworder",this.dynamicGroupLayer=new m({parent:this}),this.elevationInfo=null,this.fields=null,this.fieldsIndex=null,this.floorInfo=null,this.footprintLayer=new c({parent:this}),this.itemNameField="cd_itemname",this.itemSourceField="cd_itemsource",this.itemTypeField="cd_itemtype",this.layers=new r([this.dynamicGroupLayer,this.footprintLayer]),this.maxScaleField="cd_maxscale",this.minScaleField="cd_minscale",this.orderBy=null,this.outFields=null,this.supportedSourceTypes=new Set(["Catalog Layer"]),this.source=new f({layer:this,supportedSourceTypes:this.supportedSourceTypes}),this.type="catalog",this.typeIdField=null,this.types=null}load(e){const t=null!=e?e.signal:null,r=this.loadFromPortal({supportedTypes:["Feature Service"]},e).catch(a).then((async()=>{const{url:e,source:r,portalItem:o}=this;if(!e)throw new i("catalog-layer:missing-url","Catalog layer must be created with a url");if(null==this.layerId){const r=await this._fetchFirstValidLayerId(t);if(null==r)throw new i("catalog-layer:missing-layerId","There is no Catalog Layer in the service",{service:e});this.layerId=r}await r.load({signal:t});const{sourceJSON:s}=r;s&&(this.sourceJSON=s,this.read(s,{origin:"service",portalItem:o,portal:o?.portal,url:this.parsedUrl}))})).then((()=>{const e=[this.itemNameField,this.itemSourceField,this.itemTypeField,this.minScaleField,this.maxScaleField],t=e.filter((e=>!this.fieldsIndex.has(e)));if(t.length)throw new i("catalog-layer:missing-fields","There are missing fields to operate properly",{requiredFields:e,missingFields:t})})).then((()=>P(this,"load",e)));return this.addResolvingPromise(r),Promise.resolve(this)}destroy(){this.footprintLayer.destroy(),this.dynamicGroupLayer.destroy();for(const e of this._portals.values())e.destroy();this._portals.clear()}get createQueryVersion(){return this.commitProperty("definitionExpression"),this.commitProperty("timeExtent"),this.commitProperty("timeOffset"),this.commitProperty("geometryType"),this.commitProperty("capabilities"),(this._get("createQueryVersion")??0)+1}get editingEnabled(){return this.loaded&&null!=this.capabilities&&this.capabilities.operations.supportsEditing&&this.userHasEditingPrivileges}get effectiveEditingEnabled(){return!1}get parsedUrl(){const e=n(this.url);return null!=e&&null!=this.layerId&&(e.path=l(e.path,this.layerId.toString())),e}async applyEdits(e,t){return C(this,e,t)}on(e,t){return super.on(e,t)}async createLayerFromFootprint(e){const t=await this._createLayer(e);return this._configureLayer(t,e),this._layerToFootprint.set(t,e),t}createFootprintFromLayer(e){return this._layerToFootprint.get(e)?.clone()}createQuery(){const e=new R,t=this.capabilities?.query;e.returnGeometry=!0,t&&(e.compactGeometryEnabled=t.supportsCompactGeometry,e.defaultSpatialReferenceEnabled=t.supportsDefaultSpatialReference),e.outFields=["*"];const{timeOffset:r,timeExtent:i}=this;return e.timeExtent=null!=r&&null!=i?i.offset(-r.value,r.unit):i||null,e.where=this.definitionExpression||"1=1",e}getFeatureType(e){return q(this.types,this.typeIdField,e)}getFieldDomain(e,t){const r=t?.feature,i=this.getFeatureType(r);if(i){const t=i.domains&&i.domains[e];if(t&&"inherited"!==t.type)return t}return this.getField(e)?.domain}async hasDataChanged(){return G(this)}async queryFeatures(e,t){const r=await this.load(),i=await r.source.queryFeatures(R.from(e)??r.createQuery(),t);if(i?.features)for(const o of i.features)o.layer=o.sourceLayer=r.footprintLayer;return i}async queryObjectIds(e,t){return(await this.load()).source.queryObjectIds(R.from(e)??this.createQuery(),t)}async queryFeatureCount(e,t){return(await this.load()).source.queryFeatureCount(R.from(e)??this.createQuery(),t)}async queryExtent(e,t){return(await this.load()).source.queryExtent(R.from(e)??this.createQuery(),t)}serviceSupportsSpatialReference(e){return this.loaded&&B(this,e)}read(e,t){if(super.read(e,t),e){const{footprintLayer:r,dynamicGroupLayer:i}=e;r&&this.footprintLayer.read(r,t),i&&this.dynamicGroupLayer.read(i,t)}}async queryAttributeBins(e,t){const{source:r,capabilities:i}=await this.load();U(e,i,"CatalogLayer");const o=await import("../rest/support/AttributeBinsQuery.js"),s=await r.queryAttributeBins(o.default.from(e),t);if(s.features)for(const a of s.features)a.layer=a.sourceLayer=this.footprintLayer;return s}async _fetchFirstValidLayerId(e){const{data:r}=await t(this.url,{query:{f:"json",...this.customParameters,token:this.apiKey},responseType:"json",signal:e});if(this.applyPreferredHost(r),Array.isArray(r?.layers))return r.layers.find((({type:e})=>this.supportedSourceTypes.has(e)))?.id}async _createLayer(e){const t=e.getAttribute(this.itemSourceField);if(!t)throw new i("catalog-layer:item-source-missing",`The footprint is missing the "${this.itemSourceField}" attribute`);const r=JSON.parse(t);if(k(r)){const{itemId:e,portalUrl:t}=r,i=M(t),s=this.portalItem?.portal,a=D.getDefault();let n,l=!0;s&&p(t,s.url)?n=s:p(t,a.url)?n=a:(n=o(this._portals,i,(()=>new D({url:i}))),l=!1);const y=await u.fromPortalItem(new N({id:e,portal:n}));return l||await $(y),y}if(J(r))return u.fromArcGISServerUrl({url:r.url});const{default:s}=await import("./UnsupportedLayer.js");return new s}_configureLayer(e,t){const r=t.getAttribute(this.itemNameField);r&&(e.title=r);const i=t.getAttribute(this.maxScaleField);null!=i&&"maxScale"in e&&(e.maxScale=i);const o=t.getAttribute(this.minScaleField);null!=o&&"minScale"in e&&(e.minScale=o)}};async function $(e){if("portalItem"in e&&e.portalItem){try{await e.load()}catch{}e.portalItem=null,"group"===e.type&&await Promise.allSettled([...e.layers.map((e=>$(e))),...e.tables.map((e=>$(e)))])}}e([y(T)],W.prototype,"legendEnabled",void 0),e([y({readOnly:!0})],W.prototype,"createQueryVersion",null),e([y({readOnly:!0})],W.prototype,"drawOrderField",void 0),e([y({type:m,readOnly:!0,json:{read:!1,write:{ignoreOrigin:!0,writer:K}}})],W.prototype,"dynamicGroupLayer",void 0),e([y({readOnly:!0})],W.prototype,"editingEnabled",null),e([y({readOnly:!0})],W.prototype,"effectiveEditingEnabled",null),e([y({json:{origins:{"web-scene":{name:"layerDefinition.elevationInfo",read:!1,write:!1}}}})],W.prototype,"elevationInfo",void 0),e([y({...V.fields,readOnly:!0,json:{origins:{service:{read:!0}},read:!1}})],W.prototype,"fields",void 0),e([y(V.fieldsIndex)],W.prototype,"fieldsIndex",void 0),e([y({json:{origins:{"web-scene":{name:"layerDefinition.floorInfo",read:!1,write:!1}}}})],W.prototype,"floorInfo",void 0),e([y({type:c,readOnly:!0,json:{read:!1,write:{ignoreOrigin:!0,writer:K}}})],W.prototype,"footprintLayer",void 0),e([y(_)],W.prototype,"id",void 0),e([y({readOnly:!0})],W.prototype,"itemNameField",void 0),e([y({readOnly:!0})],W.prototype,"itemSourceField",void 0),e([y({readOnly:!0})],W.prototype,"itemTypeField",void 0),e([y({readOnly:!0})],W.prototype,"layers",void 0),e([y({type:["show","hide","hide-children"]})],W.prototype,"listMode",void 0),e([y({readOnly:!0})],W.prototype,"maxScaleField",void 0),e([y({readOnly:!0})],W.prototype,"minScaleField",void 0),e([y({value:"CatalogLayer",type:["CatalogLayer"]})],W.prototype,"operationalLayerType",void 0),e([y({json:{origins:{"web-scene":{name:"layerDefinition.orderBy",write:!0,read:!0}}}})],W.prototype,"orderBy",void 0),e([y(V.outFields)],W.prototype,"outFields",void 0),e([y({readOnly:!0})],W.prototype,"parsedUrl",null),e([y({readOnly:!0})],W.prototype,"source",void 0),e([y({json:{read:!1}})],W.prototype,"type",void 0),e([y({type:String})],W.prototype,"typeIdField",void 0),e([y({type:[A]})],W.prototype,"types",void 0),W=e([d("esri.layers.CatalogLayer")],W);const z=W;export{z as default};
@@ -2,4 +2,4 @@
2
2
  All material copyright ESRI, All Rights Reserved, unless otherwise specified.
3
3
  See https://js.arcgis.com/4.33/esri/copyright.txt for details.
4
4
  */
5
- import{_ as e}from"../chunks/tslib.es6.js";import t from"../PopupTemplate.js";import r from"../request.js";import i from"../core/Clonable.js";import o from"../core/Collection.js";import s from"../core/Error.js";import{clone as a}from"../core/lang.js";import n from"../core/Logger.js";import{destroyMaybe as l}from"../core/maybe.js";import{MultiOriginJSONMixin as p}from"../core/MultiOriginJSONSupport.js";import{setDeepValue as u}from"../core/object.js";import{debounce as d,throwIfAbortError as y,whenOrAbort as c}from"../core/promiseUtils.js";import{sqlAnd as m}from"../core/sql.js";import{urlToObject as h,join as f}from"../core/urlUtils.js";import{property as b}from"../core/accessorSupport/decorators/property.js";import{cast as g}from"../core/accessorSupport/decorators/cast.js";import{reader as w}from"../core/accessorSupport/decorators/reader.js";import{subclass as v}from"../core/accessorSupport/decorators/subclass.js";import{writer as j}from"../core/accessorSupport/decorators/writer.js";import{excludeTables as T}from"../core/accessorSupport/layerContainerType.js";import F from"../form/FormTemplate.js";import S from"../geometry/SpatialReference.js";import I from"./Layer.js";import{MemorySource as E}from"./graphics/sources/MemorySource.js";import{APIKeyMixin as L}from"./mixins/APIKeyMixin.js";import{ArcGISService as D}from"./mixins/ArcGISService.js";import{BlendLayer as _}from"./mixins/BlendLayer.js";import{CustomParametersMixin as x}from"./mixins/CustomParametersMixin.js";import{DisplayFilteredLayer as C}from"./mixins/DisplayFilteredLayer.js";import{EditBusLayer as P}from"./mixins/EditBusLayer.js";import{FeatureEffectLayer as M}from"./mixins/FeatureEffectLayer.js";import{FeatureLayerBase as q}from"./mixins/FeatureLayerBase.js";import{FeatureReductionLayer as O}from"./mixins/FeatureReductionLayer.js";import{OperationalLayer as A}from"./mixins/OperationalLayer.js";import{OrderedLayer as V}from"./mixins/OrderedLayer.js";import{PortalLayer as Q}from"./mixins/PortalLayer.js";import{PublishableLayer as R}from"./mixins/PublishableLayer.js";import{RefreshableLayer as U}from"./mixins/RefreshableLayer.js";import{ScaleRangeLayer as B}from"./mixins/ScaleRangeLayer.js";import{TemporalLayer as N}from"./mixins/TemporalLayer.js";import{TrackableLayer as $}from"./mixins/TrackableLayer.js";import{titleFromUrlAndName as G,parse as J,cleanTitle as W}from"./support/arcgisLayerUrl.js";import{attributeTableTemplate as Z,id as H,labelsVisible as k,opacityDrawingInfo as z,legendEnabled as K,listMode as X,popupEnabled as Y,screenSizePerspectiveEnabled as ee}from"./support/commonProperties.js";import{ensureLayerCredential as te,computeEffectiveEditingEnabled as re,readGlobalIdField as ie,readObjectIdField as oe,createDefaultRenderer as se,addAttachment as ae,updateAttachment as ne,applyEdits as le,uploadAssets as pe,createQuery as ue,deleteAttachments as de,fetchRecomputedExtents as ye,getFeatureType as ce,getFieldDomain as me,queryAttachments as he,queryObjectIds as fe,queryFeatureCount as be,queryExtent as ge,queryRelatedFeatures as we,queryRelatedFeaturesCount as ve,validateBinsQuery as je,hasDataChanged as Te,geometryTypeKebabDict as Fe}from"./support/featureLayerUtils.js";import Se from"./support/FeatureTemplate.js";import Ie from"./support/FeatureType.js";import{defineFieldProperties as Ee}from"./support/fieldProperties.js";import{fixRendererFields as Le,fixTimeInfoFields as De}from"./support/fieldUtils.js";import _e from"./support/LabelClass.js";import{reader as xe}from"./support/labelingInfo.js";import{getFeatureLayerCapabilities as Ce}from"./support/serviceCapabilitiesUtils.js";import Pe from"./support/TimeInfo.js";import Me from"./support/TitleCreator.js";import{serviceSupportsSpatialReference as qe}from"./support/versionUtils.js";import{DataLayerSource as Oe}from"./support/source/DataLayerSource.js";import{read as Ae}from"../renderers/support/jsonUtils.js";import{loadStyleRenderer as Ve}from"../renderers/support/styleUtils.js";import{webSceneRendererTypes as Qe,rendererTypes as Re}from"../renderers/support/typeUtils.js";import Ue from"../rest/support/FeatureSet.js";import Be from"../rest/support/Query.js";import{isNumber as Ne}from"../support/guards.js";import{createPopupTemplate as $e}from"../support/popupUtils.js";import{symbolTypes as Ge}from"../symbols/support/typeUtils.js";import{SaveOperationType as Je}from"../webdoc/interfaces.js";import{opacityToTransparency as We}from"../webdoc/support/opacityUtils.js";const Ze="FeatureLayer";function He(e,t){return new s("layer:unsupported",`Layer (${e.title}, ${e.id}) of type '${e.declaredClass}' ${t}`,{layer:e})}function ke(e){return e&&e instanceof o}const ze=Ee();function Ke(e,t,r){const i=!!r?.writeLayerSchema;return{enabled:i,ignoreOrigin:i}}let Xe=class extends(q(O(M(R(P(C(_(V(N($(B(U(D(A(Q(p(x(L(i.ClonableMixin(I)))))))))))))))))))){constructor(...e){super(...e),this.attributeTableTemplate=null,this.charts=null,this.copyright=null,this.displayField=null,this.dynamicDataSource=null,this.fields=null,this.fieldsIndex=null,this.formTemplate=null,this.fullExtent=null,this.geometryType=null,this.hasM=void 0,this.hasZ=void 0,this.infoFor3D=null,this.isTable=!1,this.labelsVisible=!0,this.labelingInfo=null,this.legendEnabled=!0,this.objectIdField=null,this.operationalLayerType="ArcGISFeatureLayer",this.outFields=null,this.path=null,this.popupEnabled=!0,this.popupTemplate=null,this.resourceInfo=null,this.screenSizePerspectiveEnabled=!0,this.spatialReference=S.WGS84,this.subtypeCode=null,this.supportedSourceTypes=new Set(["Feature Layer","Oriented Imagery Layer","Table","Catalog Layer"]),this.templates=null,this.timeInfo=null,this.title=null,this.sublayerTitleMode="item-title",this.type="feature",this.typeIdField=null,this.types=null,this.visible=!0,this._debouncedSaveOperations=d((async(e,t,r)=>{const{save:i,saveAs:o}=await import("./save/featureLayerUtils.js");switch(e){case Je.SAVE:return i(this,t);case Je.SAVE_AS:return o(this,r,t)}}))}destroy(){this.source?.destroy()}normalizeCtorArgs(e,t){return"string"==typeof e?{url:e,...t}:e}load(e){const t=null!=e?e.signal:null;if(this.portalItem?.loaded&&this.source)return this.addResolvingPromise(this.createGraphicsSource(t).then((e=>this.initLayerProperties(e)))),Promise.resolve(this);const r=this.loadFromPortal({supportedTypes:["Feature Service","Feature Collection","Scene Service"]},e).catch(y).then((async()=>{if(this.url&&null==this.layerId&&/FeatureServer|MapServer\/*$/i.test(this.url)){const e=await this._fetchFirstValidLayerId(t);null!=e&&(this.layerId=e)}if(!this.url&&!this._hasMemorySource())throw new s("feature-layer:missing-url-or-source","Feature layer must be created with either a url or a source");return this.initLayerProperties(await this.createGraphicsSource(t))})).then((()=>te(this,"load",e)));return this.addResolvingPromise(r),Promise.resolve(this)}get _titleCreator(){const e=this._get("_titleCreator");return l(e),new Me({fieldsIndex:this.fieldsIndex,objectIdField:this.objectIdField,fields:this.fields,displayField:this.displayField,effectivePopupTemplate:this.popupTemplate??this.defaultPopupTemplate})}readCapabilities(e,t){return t=t.layerDefinition||t,Ce(t,this.url)}get createQueryVersion(){return this.commitProperty("definitionExpression"),this.commitProperty("dynamicDataSource"),this.commitProperty("timeExtent"),this.commitProperty("timeOffset"),this.commitProperty("geometryType"),this.commitProperty("gdbVersion"),this.commitProperty("historicMoment"),this.commitProperty("returnZ"),this.commitProperty("capabilities"),this.commitProperty("returnM"),(this._get("createQueryVersion")??0)+1}get editingEnabled(){return!(this.loaded&&!this.capabilities?.operations.supportsEditing)&&(this._isOverridden("editingEnabled")?this._get("editingEnabled"):this._hasMemorySource()||this.userHasEditingPrivileges)}set editingEnabled(e){this._overrideIfSome("editingEnabled",e)}readEditingEnabled(e,t){return this._readEditingEnabled(t,!1)}readEditingEnabledFromWebMap(e,t,r){return this._readEditingEnabled(t,!0,r)}writeEditingEnabled(e,t){this._writeEditingEnabled(e,t,!1)}writeEditingEnabledToWebMap(e,t,r,i){this._writeEditingEnabled(e,t,!0,i)}get effectiveEditingEnabled(){return re(this)}get featureTitleFields(){return[...this._titleCreator.requiredFields]}readIsTable(e,t){return"Table"===(t=t?.layerDefinition??t).type||!t.geometryType}writeIsTable(e,t,r,i){i?.writeLayerSchema&&u(r,e?"Table":"Feature Layer",t)}readGlobalIdField(e,t){return ie(t.layerDefinition||t)}readObjectIdField(e,t){return oe(t.layerDefinition||t)}get parsedUrl(){const e=h(this.url);return null!=e&&(null!=this.dynamicDataSource?e.path=f(e.path,"dynamicLayer"):null!=this.layerId&&(e.path=f(e.path,this.layerId.toString()))),e}get defaultPopupTemplate(){return this.createPopupTemplate()}set renderer(e){Le(e,this.fieldsIndex),this._set("renderer",e)}readRenderer(e,t,r){t=t.layerDefinition||t;const i=t.drawingInfo?.renderer;if(i){const e=Ae(i,t,r)??void 0;return e||n.getLogger(this).error("Failed to create renderer",{rendererDefinition:t.drawingInfo.renderer,layer:this,context:r}),e}return se(t,r)}set source(e){const t=this._get("source");t!==e&&(ke(t)&&this._resetMemorySource(t),ke(e)&&this._initMemorySource(e),this._set("source",e))}castSource(e){return e?Array.isArray(e)||e instanceof o?new E({layer:this,items:e}):e:null}readSource(e,t){const r=Ue.fromJSON(t.featureSet);return new E({layer:this,items:r?.features??[]})}readTemplates(e,t){const r=t.editFieldsInfo,i=r?.creatorField,o=r?.editorField;return e=e?.map((e=>Se.fromJSON(e))),this._fixTemplates(e,i),this._fixTemplates(e,o),e}readTitle(e,t){const r=t.layerDefinition?.name??t.name,i=t.title||t.layerDefinition?.title;if(r){const e=this.portalItem?.title;if("item-title"===this.sublayerTitleMode)return this.url?G(this.url,r):r;let t=r;if(!t&&this.url){const e=J(this.url);null!=e&&(t=e.title)}if(!t)return;return"item-title-and-service-name"===this.sublayerTitleMode&&e&&e!==t&&(t=e+" - "+t),W(t)}if("item-title"===this.sublayerTitleMode&&i)return i}readTitleFromWebMap(e,t){return t.title||t.layerDefinition?.name}readTypeIdField(e,t){let r=(t=t.layerDefinition||t).typeIdField;if(r&&t.fields){r=r.toLowerCase();const e=t.fields.find((e=>e.name.toLowerCase()===r));e&&(r=e.name)}return r}readTypes(e,t){e=(t=t.layerDefinition||t).types;const r=t.editFieldsInfo,i=r?.creatorField,o=r?.editorField;return e?.map((e=>(e=Ie.fromJSON(e),this._fixTemplates(e.templates,i),this._fixTemplates(e.templates,o),e)))}readVisible(e,t){return null!=t.layerDefinition?.defaultVisibility?!!t.layerDefinition.defaultVisibility:null!=t.visibility?!!t.visibility:void 0}async addAttachment(e,t){const r=await ae(this,e,t,Ze);return this.lastEditsEventDate=new Date,r}async updateAttachment(e,t,r){const i=await ne(this,e,t,r,Ze);return this.lastEditsEventDate=new Date,i}async applyEdits(e,t){return le(this,e,t)}async uploadAssets(e,t){return pe(this,e,t)}on(e,t){return super.on(e,t)}createPopupTemplate(e){return $e(this,e)}async createGraphicsSource(e){if(this._hasMemorySource()&&this.source)return this.source.load({signal:e});const{default:t}=await c(import("./graphics/sources/FeatureLayerSource.js"),e);return new t({layer:this,supportedSourceTypes:this.supportedSourceTypes}).load({signal:e})}createQuery(){const e=ue(this);e.dynamicDataSource=this.dynamicDataSource;const t=null!=this.subtypeCode?`${this.subtypeField} = ${this.subtypeCode}`:null,r=m(this.definitionExpression,t);return e.where=r||"1=1",e}async deleteAttachments(e,t){const r=await de(this,e,t,Ze);return this.lastEditsEventDate=new Date,r}async fetchRecomputedExtents(e){return ye(this,e,Ze)}getFeatureTitle(e,t={timeZone:"system",fetchMissingFields:!1}){return this._titleCreator.getTitle(this,e,t)}getFeatureType(e){return ce(this.types,this.typeIdField,e)}getFieldDomain(e,t){return me(this,e,t,this.getField(e)?.domain??null)}async queryAttachments(e,t){return he(this,e,t,Ze)}async queryFeatures(e,t){const r=await this.load(),i=await r.source.queryFeatures(Be.from(e)??r.createQuery(),t);if(i?.features)for(const o of i.features)o.layer=o.sourceLayer=r;return i}async queryObjectIds(e,t){return await fe(this,e,t,Ze)}async queryFeatureCount(e,t){return be(this,e,t,Ze)}async queryExtent(e,t){return ge(this,e,t,Ze)}async queryRelatedFeatures(e,t){return we(this,e,t,Ze)}async queryRelatedFeaturesCount(e,t){return ve(this,e,t,Ze)}async queryTopFeatures(e,t){const{source:r,capabilities:i}=await this.load();if(!r.queryTopFeatures||!i?.query?.supportsTopFeaturesQuery)throw new s(Ze,"Layer source does not support queryTopFeatures capability");const o=await import("../rest/support/TopFeaturesQuery.js"),a=await r.queryTopFeatures(o.default.from(e),t);if(a?.features)for(const s of a.features)s.layer=s.sourceLayer=this;return a}async queryAttributeBins(e,t){const{source:r,capabilities:i}=await this.load();if(!r.queryAttributeBins||!i?.operations?.supportsQueryBins)throw new s(Ze,"Layer source does not support queryAttributeBins capability");je(e,i,Ze);const o=await import("../rest/support/AttributeBinsQuery.js"),a=await r.queryAttributeBins(o.default.from(e),t);if(a.features)for(const s of a.features)s.layer=s.sourceLayer=this;return a}async queryTopObjectIds(e,t){const{source:r,capabilities:i}=await this.load();if(!r.queryTopObjectIds||!i?.query.supportsTopFeaturesQuery)throw new s(Ze,"Layer source does not support queryTopObjectIds capability");const o=await import("../rest/support/TopFeaturesQuery.js");return(await r.queryTopObjectIds(o.default.from(e),t)).filter(Ne)}async queryTopFeaturesExtent(e,t){const{source:r,capabilities:i}=await this.load();if(!r.queryTopExtents||!i?.query?.supportsTopFeaturesQuery)throw new s(Ze,"Layer source does not support queryTopExtents capability");const o=await import("../rest/support/TopFeaturesQuery.js");return r.queryTopExtents(o.default.from(e),t)}async queryTopFeatureCount(e,t){const{source:r,capabilities:i}=await this.load();if(!r.queryTopCount||!i?.query?.supportsTopFeaturesQuery)throw new s(Ze,"Layer source does not support queryFeatureCount capability");const o=await import("../rest/support/TopFeaturesQuery.js");return r.queryTopCount(o.default.from(e),t)}read(e,t){const r=e.featureCollection;if((r||"Feature Collection"===e.type)&&(this.resourceInfo=e),r){const{layers:e,showLegend:i}=r;1===e?.length&&(super.read(e[0],t),null!=i&&super.read({showLegend:i},t))}super.read(e,t),t&&"service"===t.origin&&(this.revert(["objectIdField","fields","timeInfo","dateFieldsTimeZone"],"service"),this.spatialReference||this.revert(["spatialReference"],"service"))}write(e,t){t={...t,origin:t?.origin??void 0,writeLayerSchema:t?.writeLayerSchema??this._hasMemorySource()};const{origin:r,layerContainerType:i,messages:o}=t;if(this.dynamicDataSource)return o?.push(He(this,"using a dynamic data source cannot be written to web scenes, web maps and feature service items")),null;if(this.isTable){if(("web-map"===r||"web-scene"===r)&&"tables"!==i)return o?.push(He(this,`a table source can only be written to tables, not ${i}`)),null;if(this._hasMemorySource())return o?.push(He(this,"using an in-memory table source cannot be written to web scenes and web maps")),null}else if(this.loaded&&("web-map"===r||"web-scene"===r)&&"tables"===i)return o?.push(He(this,"using a non-table source cannot be written to tables in web maps or web scenes")),null;return super.write(e,t)}clone(){if(this._hasMemorySource())throw new s(Ze,`FeatureLayer (title: ${this.title}, id: ${this.id}) created using in-memory source cannot be cloned`);return super.clone()}serviceSupportsSpatialReference(e){return!!this.loaded&&("memory"===this.source?.type||qe(this,e))}async save(e){return this._debouncedSaveOperations(Je.SAVE,e)}async saveAs(e,t){return this._debouncedSaveOperations(Je.SAVE_AS,t,e)}_readEditingEnabled(e,t,r){let i=e.layerDefinition?.capabilities;return i?this._hasEditingCapability(i):(i=e.capabilities,t&&"web-map"===r?.origin&&!this._hasMemorySource()&&i?this._hasEditingCapability(i):void 0)}_hasEditingCapability(e){return e.toLowerCase().split(",").map((e=>e.trim())).includes("editing")}_writeEditingEnabled(e,t,r,i){if(!e){const e=this.capabilities?.operations?.supportsSync?"Query,Sync":"Query";u("layerDefinition.capabilities",e,t),r&&!i?.writeLayerSchema&&(t.capabilities=e)}}_fetchFirstValidLayerId(e){return r(this.url??"",{query:{f:"json",...this.customParameters,token:this.apiKey},responseType:"json",signal:e}).then((e=>{const t=e.data;if(t)return this.applyPreferredHost(t),this.findFirstValidLayerId(t)}))}async initLayerProperties(e){return this._set("source",e),e.sourceJSON&&(this.sourceJSON=e.sourceJSON,this.read(e.sourceJSON,{origin:"service",portalItem:this.portalItem,portal:this.portalItem?.portal,url:this.parsedUrl})),this._verifySource(),this._verifyFields(),Le(this.renderer,this.fieldsIndex),De(this.timeInfo,this.fieldsIndex),this._hasMemorySource()&&"mesh"===this.geometryType&&(this.capabilities.query.supportsReturnMesh=!0),Ve(this,{origin:"service"})}async hasDataChanged(){return Te(this)}async fetchPublishingStatus(){const e=this.source;return e?.fetchPublishingStatus?e.fetchPublishingStatus():"unavailable"}_verifyFields(){const e=this.parsedUrl?.path??"undefined";this.objectIdField||console.log("FeatureLayer: 'objectIdField' property is not defined (url: "+e+")"),this.isTable||this._hasMemorySource()||-1!==e.search(/\/FeatureServer\//i)||this.fields?.some((e=>"geometry"===e.type))||console.log("FeatureLayer: unable to find field of type 'geometry' in the layer 'fields' list. If you are using a map service layer, features will not have geometry (url: "+e+")")}_fixTemplates(e,t){e&&e.forEach((e=>{const r=e.prototype?.attributes;r&&t&&delete r[t]}))}_verifySource(){if(this._hasMemorySource()){if(this.url)throw new s("feature-layer:mixed-source-and-url","FeatureLayer cannot be created with both an in-memory source and a url")}else if(!this.url)throw new s("feature-layer:source-or-url-required","FeatureLayer requires either a url, a valid portal item or a source")}_initMemorySource(e){e.forEach((e=>{e.layer=this,e.sourceLayer=this})),this.addHandles([e.on("after-add",(e=>{e.item.layer=this,e.item.sourceLayer=this})),e.on("after-remove",(e=>{e.item.layer=null,e.item.sourceLayer=null}))],"fl-source")}_resetMemorySource(e){e.forEach((e=>{e.layer=null,e.sourceLayer=null})),this.removeHandles("fl-source")}_hasMemorySource(){return!(this.url||!this.source)}findFirstValidLayerId(e){return Array.isArray(e.layers)&&e.layers.length>0?e.layers[0].id:Array.isArray(e.tables)&&e.tables.length>0?e.tables[0].id:void 0}};e([b({clonable:!1,readOnly:!0})],Xe.prototype,"_titleCreator",null),e([b(Z)],Xe.prototype,"attributeTableTemplate",void 0),e([w("service","capabilities")],Xe.prototype,"readCapabilities",null),e([b({json:{origins:{"web-scene":{write:!1}},write:!0}})],Xe.prototype,"charts",void 0),e([b({readOnly:!0})],Xe.prototype,"createQueryVersion",null),e([b({json:{read:{source:"layerDefinition.copyrightText"}}})],Xe.prototype,"copyright",void 0),e([b({json:{read:{source:"layerDefinition.displayField"}}})],Xe.prototype,"displayField",void 0),e([b({types:Ge,readOnly:!0})],Xe.prototype,"defaultSymbol",void 0),e([b({type:Oe})],Xe.prototype,"dynamicDataSource",void 0),e([b({type:Boolean})],Xe.prototype,"editingEnabled",null),e([w(["portal-item","web-scene"],"editingEnabled",["layerDefinition.capabilities"])],Xe.prototype,"readEditingEnabled",null),e([w("web-map","editingEnabled",["capabilities","layerDefinition.capabilities"])],Xe.prototype,"readEditingEnabledFromWebMap",null),e([j(["portal-item","web-scene"],"editingEnabled",{"layerDefinition.capabilities":{type:String}})],Xe.prototype,"writeEditingEnabled",null),e([j("web-map","editingEnabled",{capabilities:{type:String},"layerDefinition.capabilities":{type:String}})],Xe.prototype,"writeEditingEnabledToWebMap",null),e([b({readOnly:!0})],Xe.prototype,"effectiveEditingEnabled",null),e([b({clonable:!1,readOnly:!0})],Xe.prototype,"featureTitleFields",null),e([b({...ze.fields,json:{read:{source:"layerDefinition.fields"},origins:{service:{name:"fields"},"web-map":{write:{target:"layerDefinition.fields",overridePolicy:Ke}}}}})],Xe.prototype,"fields",void 0),e([b(ze.fieldsIndex)],Xe.prototype,"fieldsIndex",void 0),e([b({type:F,json:{name:"formInfo",write:!0,origins:{"web-scene":{read:!1,write:!1}}}})],Xe.prototype,"formTemplate",void 0),e([b({json:{read:{source:"layerDefinition.extent"}}})],Xe.prototype,"fullExtent",void 0),e([b({json:{origins:{"web-map":{write:{target:"layerDefinition.geometryType",overridePolicy:Ke,writer(e,t,r){const i=e?Fe.toJSON(e):null;i&&u(r,i,t)}}}},read:{source:"layerDefinition.geometryType",reader:Fe.read}}})],Xe.prototype,"geometryType",void 0),e([b({json:{read:{source:"layerDefinition.hasM"}}})],Xe.prototype,"hasM",void 0),e([b({json:{read:{source:"layerDefinition.hasZ"}}})],Xe.prototype,"hasZ",void 0),e([b(H)],Xe.prototype,"id",void 0),e([b({readOnly:!0,json:{origins:{service:{read:!0}},read:!1}})],Xe.prototype,"infoFor3D",void 0),e([b({json:{origins:{"web-map":{write:{target:"layerDefinition.type"}}}}})],Xe.prototype,"isTable",void 0),e([w("service","isTable",["type","geometryType"]),w("isTable",["layerDefinition.type","layerDefinition.geometryType"])],Xe.prototype,"readIsTable",null),e([j("web-map","isTable")],Xe.prototype,"writeIsTable",null),e([b(k)],Xe.prototype,"labelsVisible",void 0),e([b({type:[_e],json:{origins:{service:{name:"drawingInfo.labelingInfo",read:xe,write:!1}},name:"layerDefinition.drawingInfo.labelingInfo",read:xe,write:{layerContainerTypes:T}}})],Xe.prototype,"labelingInfo",void 0),e([b((()=>{const e=a(z);return e.json.origins["portal-item"]={write:{target:"layerDefinition.drawingInfo.transparency",writer(e,t,r){u(r,We(e),t)}}},e})())],Xe.prototype,"opacity",void 0),e([b(K)],Xe.prototype,"legendEnabled",void 0),e([b({type:["show","hide"],json:(()=>{const e=a(X.json);return e.origins["portal-item"]={read:!1,write:!1},e})()})],Xe.prototype,"listMode",void 0),e([w("globalIdField",["layerDefinition.globalIdField","layerDefinition.fields"])],Xe.prototype,"readGlobalIdField",null),e([b({json:{origins:{"web-map":{write:{target:"layerDefinition.objectIdField",overridePolicy:Ke}}}}})],Xe.prototype,"objectIdField",void 0),e([w("objectIdField",["layerDefinition.objectIdField","layerDefinition.fields"])],Xe.prototype,"readObjectIdField",null),e([b({type:["ArcGISFeatureLayer"],json:{write:{target:"layerType",ignoreOrigin:!0,layerContainerTypes:T}}})],Xe.prototype,"operationalLayerType",void 0),e([b(ze.outFields)],Xe.prototype,"outFields",void 0),e([b({readOnly:!0})],Xe.prototype,"parsedUrl",null),e([b({type:String,json:{origins:{"web-scene":{read:!0,write:!0}},read:!1}})],Xe.prototype,"path",void 0),e([b(Y)],Xe.prototype,"popupEnabled",void 0),e([b({type:t,json:{name:"popupInfo",write:!0}})],Xe.prototype,"popupTemplate",void 0),e([b({readOnly:!0})],Xe.prototype,"defaultPopupTemplate",null),e([b({types:Re,json:{origins:{service:{write:{target:"drawingInfo.renderer",enabled:!1}},"web-scene":{types:Qe,name:"layerDefinition.drawingInfo.renderer",write:{layerContainerTypes:T,overridePolicy:(e,t,r)=>({ignoreOrigin:r?.writeLayerSchema,layerContainerTypes:T})}}},write:{target:"layerDefinition.drawingInfo.renderer",overridePolicy:(e,t,r)=>({ignoreOrigin:r?.writeLayerSchema,layerContainerTypes:T})}}})],Xe.prototype,"renderer",null),e([w("service","renderer",["drawingInfo.renderer","defaultSymbol"]),w("renderer",["layerDefinition.drawingInfo.renderer","layerDefinition.defaultSymbol"])],Xe.prototype,"readRenderer",null),e([b()],Xe.prototype,"resourceInfo",void 0),e([b((()=>{const e=a(ee);return e.json.origins["portal-item"]={read:!1,write:!1},e})())],Xe.prototype,"screenSizePerspectiveEnabled",void 0),e([b({clonable:!1})],Xe.prototype,"source",null),e([g("source")],Xe.prototype,"castSource",null),e([w("portal-item","source",["featureSet"]),w("web-map","source",["featureSet"])],Xe.prototype,"readSource",null),e([b({json:{read:{source:"layerDefinition.extent.spatialReference"}}})],Xe.prototype,"spatialReference",void 0),e([b({type:Number})],Xe.prototype,"subtypeCode",void 0),e([b({type:[Se]})],Xe.prototype,"templates",void 0),e([w("templates",["editFieldsInfo","creatorField","editorField","templates"])],Xe.prototype,"readTemplates",null),e([b({type:Pe})],Xe.prototype,"timeInfo",void 0),e([b()],Xe.prototype,"title",void 0),e([w("service","title",["name"]),w("portal-item","title",["layerDefinition.title","layerDefinition.name","title"])],Xe.prototype,"readTitle",null),e([w("web-map","title",["layerDefinition.name","title"])],Xe.prototype,"readTitleFromWebMap",null),e([b({type:String})],Xe.prototype,"sublayerTitleMode",void 0),e([b({json:{read:!1}})],Xe.prototype,"type",void 0),e([b({type:String})],Xe.prototype,"typeIdField",void 0),e([w("service","typeIdField"),w("typeIdField",["layerDefinition.typeIdField"])],Xe.prototype,"readTypeIdField",null),e([b({type:[Ie]})],Xe.prototype,"types",void 0),e([w("service","types",["types"]),w("types",["layerDefinition.types"])],Xe.prototype,"readTypes",null),e([b({type:Boolean,json:{origins:{"portal-item":{write:{target:"layerDefinition.defaultVisibility",layerContainerTypes:T}}}}})],Xe.prototype,"visible",void 0),e([w("portal-item","visible",["visibility","layerDefinition.defaultVisibility"])],Xe.prototype,"readVisible",null),Xe=e([v("esri.layers.FeatureLayer")],Xe);export{Xe as default};
5
+ import{_ as e}from"../chunks/tslib.es6.js";import t from"../PopupTemplate.js";import r from"../request.js";import i from"../core/Clonable.js";import o from"../core/Collection.js";import s from"../core/Error.js";import{clone as a}from"../core/lang.js";import n from"../core/Logger.js";import{destroyMaybe as l}from"../core/maybe.js";import{MultiOriginJSONMixin as p}from"../core/MultiOriginJSONSupport.js";import{setDeepValue as u}from"../core/object.js";import{debounce as d,throwIfAbortError as y,whenOrAbort as c}from"../core/promiseUtils.js";import{sqlAnd as m}from"../core/sql.js";import{urlToObject as h,join as f}from"../core/urlUtils.js";import{property as b}from"../core/accessorSupport/decorators/property.js";import{cast as g}from"../core/accessorSupport/decorators/cast.js";import{reader as w}from"../core/accessorSupport/decorators/reader.js";import{subclass as v}from"../core/accessorSupport/decorators/subclass.js";import{writer as j}from"../core/accessorSupport/decorators/writer.js";import{excludeTables as T}from"../core/accessorSupport/layerContainerType.js";import F from"../form/FormTemplate.js";import S from"../geometry/SpatialReference.js";import I from"./Layer.js";import{MemorySource as E}from"./graphics/sources/MemorySource.js";import{APIKeyMixin as L}from"./mixins/APIKeyMixin.js";import{ArcGISService as D}from"./mixins/ArcGISService.js";import{BlendLayer as _}from"./mixins/BlendLayer.js";import{CustomParametersMixin as x}from"./mixins/CustomParametersMixin.js";import{DisplayFilteredLayer as C}from"./mixins/DisplayFilteredLayer.js";import{EditBusLayer as P}from"./mixins/EditBusLayer.js";import{FeatureEffectLayer as M}from"./mixins/FeatureEffectLayer.js";import{FeatureLayerBase as q}from"./mixins/FeatureLayerBase.js";import{FeatureReductionLayer as O}from"./mixins/FeatureReductionLayer.js";import{OperationalLayer as A}from"./mixins/OperationalLayer.js";import{OrderedLayer as V}from"./mixins/OrderedLayer.js";import{PortalLayer as R}from"./mixins/PortalLayer.js";import{PublishableLayer as U}from"./mixins/PublishableLayer.js";import{RefreshableLayer as Q}from"./mixins/RefreshableLayer.js";import{ScaleRangeLayer as B}from"./mixins/ScaleRangeLayer.js";import{TemporalLayer as N}from"./mixins/TemporalLayer.js";import{TrackableLayer as $}from"./mixins/TrackableLayer.js";import{titleFromUrlAndName as G,parse as J,cleanTitle as W}from"./support/arcgisLayerUrl.js";import{attributeTableTemplate as Z,id as H,labelsVisible as k,opacityDrawingInfo as z,legendEnabled as K,listMode as X,popupEnabled as Y,screenSizePerspectiveEnabled as ee}from"./support/commonProperties.js";import{ensureLayerCredential as te,computeEffectiveEditingEnabled as re,readGlobalIdField as ie,readObjectIdField as oe,createDefaultRenderer as se,addAttachment as ae,updateAttachment as ne,applyEdits as le,uploadAssets as pe,createQuery as ue,deleteAttachments as de,fetchRecomputedExtents as ye,getFeatureType as ce,getFieldDomain as me,queryAttachments as he,queryObjectIds as fe,queryFeatureCount as be,queryExtent as ge,queryRelatedFeatures as we,queryRelatedFeaturesCount as ve,validateBinsQuery as je,hasDataChanged as Te,geometryTypeKebabDict as Fe}from"./support/featureLayerUtils.js";import Se from"./support/FeatureTemplate.js";import Ie from"./support/FeatureType.js";import{defineFieldProperties as Ee}from"./support/fieldProperties.js";import{fixRendererFields as Le,fixTimeInfoFields as De}from"./support/fieldUtils.js";import _e from"./support/LabelClass.js";import{reader as xe}from"./support/labelingInfo.js";import{getFeatureLayerCapabilities as Ce}from"./support/serviceCapabilitiesUtils.js";import Pe from"./support/TimeInfo.js";import Me from"./support/TitleCreator.js";import{serviceSupportsSpatialReference as qe}from"./support/versionUtils.js";import{DataLayerSource as Oe}from"./support/source/DataLayerSource.js";import{read as Ae}from"../renderers/support/jsonUtils.js";import{loadStyleRenderer as Ve}from"../renderers/support/styleUtils.js";import{webSceneRendererTypes as Re,rendererTypes as Ue}from"../renderers/support/typeUtils.js";import Qe from"../rest/support/FeatureSet.js";import Be from"../rest/support/Query.js";import{isNumber as Ne}from"../support/guards.js";import{createPopupTemplate as $e}from"../support/popupUtils.js";import{symbolTypes as Ge}from"../symbols/support/typeUtils.js";import{SaveOperationType as Je}from"../webdoc/interfaces.js";import{opacityToTransparency as We}from"../webdoc/support/opacityUtils.js";const Ze="FeatureLayer";function He(e,t){return new s("layer:unsupported",`Layer (${e.title}, ${e.id}) of type '${e.declaredClass}' ${t}`,{layer:e})}function ke(e){return e&&e instanceof o}const ze=Ee();function Ke(e,t,r){const i=!!r?.writeLayerSchema;return{enabled:i,ignoreOrigin:i}}let Xe=class extends(q(O(M(U(P(C(_(V(N($(B(Q(D(A(R(p(x(L(i.ClonableMixin(I)))))))))))))))))))){constructor(...e){super(...e),this.attributeTableTemplate=null,this.charts=null,this.copyright=null,this.displayField=null,this.dynamicDataSource=null,this.fields=null,this.fieldsIndex=null,this.formTemplate=null,this.fullExtent=null,this.geometryType=null,this.hasM=void 0,this.hasZ=void 0,this.infoFor3D=null,this.isTable=!1,this.labelsVisible=!0,this.labelingInfo=null,this.legendEnabled=!0,this.objectIdField=null,this.operationalLayerType="ArcGISFeatureLayer",this.outFields=null,this.path=null,this.popupEnabled=!0,this.popupTemplate=null,this.resourceInfo=null,this.screenSizePerspectiveEnabled=!0,this.spatialReference=S.WGS84,this.subtypeCode=null,this.supportedSourceTypes=new Set(["Feature Layer","Oriented Imagery Layer","Table","Catalog Layer"]),this.templates=null,this.timeInfo=null,this.title=null,this.sublayerTitleMode="item-title",this.type="feature",this.typeIdField=null,this.types=null,this.visible=!0,this._debouncedSaveOperations=d((async(e,t,r)=>{const{save:i,saveAs:o}=await import("./save/featureLayerUtils.js");switch(e){case Je.SAVE:return i(this,t);case Je.SAVE_AS:return o(this,r,t)}}))}destroy(){this.source?.destroy()}normalizeCtorArgs(e,t){return"string"==typeof e?{url:e,...t}:e}load(e){const t=null!=e?e.signal:null;if(this.portalItem?.loaded&&this.source)return this.addResolvingPromise(this.createGraphicsSource(t).then((e=>this.initLayerProperties(e)))),Promise.resolve(this);const r=this.loadFromPortal({supportedTypes:["Feature Service","Feature Collection","Scene Service"]},e).catch(y).then((async()=>{if(this.url&&null==this.layerId&&/FeatureServer|MapServer\/*$/i.test(this.url)){const e=await this._fetchFirstValidLayerId(t);null!=e&&(this.layerId=e)}if(!this.url&&!this._hasMemorySource())throw new s("feature-layer:missing-url-or-source","Feature layer must be created with either a url or a source");return this.initLayerProperties(await this.createGraphicsSource(t))})).then((()=>te(this,"load",e)));return this.addResolvingPromise(r),Promise.resolve(this)}get _titleCreator(){const e=this._get("_titleCreator");return l(e),new Me({fieldsIndex:this.fieldsIndex,objectIdField:this.objectIdField,fields:this.fields,displayField:this.displayField,effectivePopupTemplate:this.popupTemplate??this.defaultPopupTemplate})}readCapabilities(e,t){return t=t.layerDefinition||t,Ce(t,this.url)}get createQueryVersion(){return this.commitProperty("definitionExpression"),this.commitProperty("dynamicDataSource"),this.commitProperty("timeExtent"),this.commitProperty("timeOffset"),this.commitProperty("geometryType"),this.commitProperty("gdbVersion"),this.commitProperty("historicMoment"),this.commitProperty("returnZ"),this.commitProperty("capabilities"),this.commitProperty("returnM"),(this._get("createQueryVersion")??0)+1}get editingEnabled(){return!(this.loaded&&!this.capabilities?.operations.supportsEditing)&&(this._isOverridden("editingEnabled")?this._get("editingEnabled"):this._hasMemorySource()||this.userHasEditingPrivileges)}set editingEnabled(e){this._overrideIfSome("editingEnabled",e)}readEditingEnabled(e,t){return this._readEditingEnabled(t,!1)}readEditingEnabledFromWebMap(e,t,r){return this._readEditingEnabled(t,!0,r)}writeEditingEnabled(e,t){this._writeEditingEnabled(e,t,!1)}writeEditingEnabledToWebMap(e,t,r,i){this._writeEditingEnabled(e,t,!0,i)}get effectiveEditingEnabled(){return re(this)}get featureTitleFields(){return[...this._titleCreator.requiredFields]}readIsTable(e,t){return"Table"===(t=t?.layerDefinition??t).type||!t.geometryType}writeIsTable(e,t,r,i){i?.writeLayerSchema&&u(r,e?"Table":"Feature Layer",t)}readGlobalIdField(e,t){return ie(t.layerDefinition||t)}readObjectIdField(e,t){return oe(t.layerDefinition||t)}get parsedUrl(){const e=h(this.url);return null!=e&&(null!=this.dynamicDataSource?e.path=f(e.path,"dynamicLayer"):null!=this.layerId&&(e.path=f(e.path,this.layerId.toString()))),e}get defaultPopupTemplate(){return this.createPopupTemplate()}set renderer(e){Le(e,this.fieldsIndex),this._set("renderer",e)}readRenderer(e,t,r){t=t.layerDefinition||t;const i=t.drawingInfo?.renderer;if(i){const e=Ae(i,t,r)??void 0;return e||n.getLogger(this).error("Failed to create renderer",{rendererDefinition:t.drawingInfo.renderer,layer:this,context:r}),e}return se(t,r)}set source(e){const t=this._get("source");t!==e&&(ke(t)&&this._resetMemorySource(t),ke(e)&&this._initMemorySource(e),this._set("source",e))}castSource(e){return e?Array.isArray(e)||e instanceof o?new E({layer:this,items:e}):e:null}readSource(e,t){const r=Qe.fromJSON(t.featureSet);return new E({layer:this,items:r?.features??[]})}readTemplates(e,t){const r=t.editFieldsInfo,i=r?.creatorField,o=r?.editorField;return e=e?.map((e=>Se.fromJSON(e))),this._fixTemplates(e,i),this._fixTemplates(e,o),e}readTitle(e,t){const r=t.layerDefinition?.name??t.name,i=t.title||t.layerDefinition?.title;if(r){const e=this.portalItem?.title;if("item-title"===this.sublayerTitleMode)return this.url?G(this.url,r):r;let t=r;if(!t&&this.url){const e=J(this.url);null!=e&&(t=e.title)}if(!t)return;return"item-title-and-service-name"===this.sublayerTitleMode&&e&&e!==t&&(t=e+" - "+t),W(t)}if("item-title"===this.sublayerTitleMode&&i)return i}readTitleFromWebMap(e,t){return t.title||t.layerDefinition?.name}readTypeIdField(e,t){let r=(t=t.layerDefinition||t).typeIdField;if(r&&t.fields){r=r.toLowerCase();const e=t.fields.find((e=>e.name.toLowerCase()===r));e&&(r=e.name)}return r}readTypes(e,t){e=(t=t.layerDefinition||t).types;const r=t.editFieldsInfo,i=r?.creatorField,o=r?.editorField;return e?.map((e=>(e=Ie.fromJSON(e),this._fixTemplates(e.templates,i),this._fixTemplates(e.templates,o),e)))}readVisible(e,t){return null!=t.layerDefinition?.defaultVisibility?!!t.layerDefinition.defaultVisibility:null!=t.visibility?!!t.visibility:void 0}async addAttachment(e,t){const r=await ae(this,e,t,Ze);return this.lastEditsEventDate=new Date,r}async updateAttachment(e,t,r){const i=await ne(this,e,t,r,Ze);return this.lastEditsEventDate=new Date,i}async applyEdits(e,t){return le(this,e,t)}async uploadAssets(e,t){return pe(this,e,t)}on(e,t){return super.on(e,t)}createPopupTemplate(e){return $e(this,e)}async createGraphicsSource(e){if(this._hasMemorySource()&&this.source)return this.source.load({signal:e});const{default:t}=await c(import("./graphics/sources/FeatureLayerSource.js"),e);return new t({layer:this,supportedSourceTypes:this.supportedSourceTypes}).load({signal:e})}createQuery(){const e=ue(this);e.dynamicDataSource=this.dynamicDataSource;const t=null!=this.subtypeCode?`${this.subtypeField} = ${this.subtypeCode}`:null,r=m(this.definitionExpression,t);return e.where=r||"1=1",e}async deleteAttachments(e,t){const r=await de(this,e,t,Ze);return this.lastEditsEventDate=new Date,r}async fetchRecomputedExtents(e){return ye(this,e,Ze)}getFeatureTitle(e,t={timeZone:"system",fetchMissingFields:!1}){return this._titleCreator.getTitle(this,e,t)}getFeatureType(e){return ce(this.types,this.typeIdField,e)}getFieldDomain(e,t){return me(this,e,t,this.getField(e)?.domain??null)}async queryAttachments(e,t){return he(this,e,t,Ze)}async queryFeatures(e,t){const r=await this.load(),i=await r.source.queryFeatures(Be.from(e)??r.createQuery(),t);if(i?.features)for(const o of i.features)o.layer=o.sourceLayer=r;return i}async queryObjectIds(e,t){return await fe(this,e,t,Ze)}async queryFeatureCount(e,t){return be(this,e,t,Ze)}async queryExtent(e,t){return ge(this,e,t,Ze)}async queryRelatedFeatures(e,t){return we(this,e,t,Ze)}async queryRelatedFeaturesCount(e,t){return ve(this,e,t,Ze)}async queryTopFeatures(e,t){const{source:r,capabilities:i}=await this.load();if(!r.queryTopFeatures||!i?.query?.supportsTopFeaturesQuery)throw new s(Ze,"Layer source does not support queryTopFeatures capability");const o=await import("../rest/support/TopFeaturesQuery.js"),a=await r.queryTopFeatures(o.default.from(e),t);if(a?.features)for(const s of a.features)s.layer=s.sourceLayer=this;return a}async queryAttributeBins(e,t){const{source:r,capabilities:i}=await this.load();if(!r.queryAttributeBins)throw new s(Ze,"Layer source does not support queryAttributeBins capability");je(e,i,Ze);const o=await import("../rest/support/AttributeBinsQuery.js"),a=await r.queryAttributeBins(o.default.from(e),t);if(a.features)for(const s of a.features)s.layer=s.sourceLayer=this;return a}async queryTopObjectIds(e,t){const{source:r,capabilities:i}=await this.load();if(!r.queryTopObjectIds||!i?.query.supportsTopFeaturesQuery)throw new s(Ze,"Layer source does not support queryTopObjectIds capability");const o=await import("../rest/support/TopFeaturesQuery.js");return(await r.queryTopObjectIds(o.default.from(e),t)).filter(Ne)}async queryTopFeaturesExtent(e,t){const{source:r,capabilities:i}=await this.load();if(!r.queryTopExtents||!i?.query?.supportsTopFeaturesQuery)throw new s(Ze,"Layer source does not support queryTopExtents capability");const o=await import("../rest/support/TopFeaturesQuery.js");return r.queryTopExtents(o.default.from(e),t)}async queryTopFeatureCount(e,t){const{source:r,capabilities:i}=await this.load();if(!r.queryTopCount||!i?.query?.supportsTopFeaturesQuery)throw new s(Ze,"Layer source does not support queryFeatureCount capability");const o=await import("../rest/support/TopFeaturesQuery.js");return r.queryTopCount(o.default.from(e),t)}read(e,t){const r=e.featureCollection;if((r||"Feature Collection"===e.type)&&(this.resourceInfo=e),r){const{layers:e,showLegend:i}=r;1===e?.length&&(super.read(e[0],t),null!=i&&super.read({showLegend:i},t))}super.read(e,t),t&&"service"===t.origin&&(this.revert(["objectIdField","fields","timeInfo","dateFieldsTimeZone"],"service"),this.spatialReference||this.revert(["spatialReference"],"service"))}write(e,t){t={...t,origin:t?.origin??void 0,writeLayerSchema:t?.writeLayerSchema??this._hasMemorySource()};const{origin:r,layerContainerType:i,messages:o}=t;if(this.dynamicDataSource)return o?.push(He(this,"using a dynamic data source cannot be written to web scenes, web maps and feature service items")),null;if(this.isTable){if(("web-map"===r||"web-scene"===r)&&"tables"!==i)return o?.push(He(this,`a table source can only be written to tables, not ${i}`)),null;if(this._hasMemorySource())return o?.push(He(this,"using an in-memory table source cannot be written to web scenes and web maps")),null}else if(this.loaded&&("web-map"===r||"web-scene"===r)&&"tables"===i)return o?.push(He(this,"using a non-table source cannot be written to tables in web maps or web scenes")),null;return super.write(e,t)}clone(){if(this._hasMemorySource())throw new s(Ze,`FeatureLayer (title: ${this.title}, id: ${this.id}) created using in-memory source cannot be cloned`);return super.clone()}serviceSupportsSpatialReference(e){return!!this.loaded&&("memory"===this.source?.type||qe(this,e))}async save(e){return this._debouncedSaveOperations(Je.SAVE,e)}async saveAs(e,t){return this._debouncedSaveOperations(Je.SAVE_AS,t,e)}_readEditingEnabled(e,t,r){let i=e.layerDefinition?.capabilities;return i?this._hasEditingCapability(i):(i=e.capabilities,t&&"web-map"===r?.origin&&!this._hasMemorySource()&&i?this._hasEditingCapability(i):void 0)}_hasEditingCapability(e){return e.toLowerCase().split(",").map((e=>e.trim())).includes("editing")}_writeEditingEnabled(e,t,r,i){if(!e){const e=this.capabilities?.operations?.supportsSync?"Query,Sync":"Query";u("layerDefinition.capabilities",e,t),r&&!i?.writeLayerSchema&&(t.capabilities=e)}}_fetchFirstValidLayerId(e){return r(this.url??"",{query:{f:"json",...this.customParameters,token:this.apiKey},responseType:"json",signal:e}).then((e=>{const t=e.data;if(t)return this.applyPreferredHost(t),this.findFirstValidLayerId(t)}))}async initLayerProperties(e){return this._set("source",e),e.sourceJSON&&(this.sourceJSON=e.sourceJSON,this.read(e.sourceJSON,{origin:"service",portalItem:this.portalItem,portal:this.portalItem?.portal,url:this.parsedUrl})),this._verifySource(),this._verifyFields(),Le(this.renderer,this.fieldsIndex),De(this.timeInfo,this.fieldsIndex),this._hasMemorySource()&&"mesh"===this.geometryType&&(this.capabilities.query.supportsReturnMesh=!0),Ve(this,{origin:"service"})}async hasDataChanged(){return Te(this)}async fetchPublishingStatus(){const e=this.source;return e?.fetchPublishingStatus?e.fetchPublishingStatus():"unavailable"}_verifyFields(){const e=this.parsedUrl?.path??"undefined";this.objectIdField||console.log("FeatureLayer: 'objectIdField' property is not defined (url: "+e+")"),this.isTable||this._hasMemorySource()||-1!==e.search(/\/FeatureServer\//i)||this.fields?.some((e=>"geometry"===e.type))||console.log("FeatureLayer: unable to find field of type 'geometry' in the layer 'fields' list. If you are using a map service layer, features will not have geometry (url: "+e+")")}_fixTemplates(e,t){e&&e.forEach((e=>{const r=e.prototype?.attributes;r&&t&&delete r[t]}))}_verifySource(){if(this._hasMemorySource()){if(this.url)throw new s("feature-layer:mixed-source-and-url","FeatureLayer cannot be created with both an in-memory source and a url")}else if(!this.url)throw new s("feature-layer:source-or-url-required","FeatureLayer requires either a url, a valid portal item or a source")}_initMemorySource(e){e.forEach((e=>{e.layer=this,e.sourceLayer=this})),this.addHandles([e.on("after-add",(e=>{e.item.layer=this,e.item.sourceLayer=this})),e.on("after-remove",(e=>{e.item.layer=null,e.item.sourceLayer=null}))],"fl-source")}_resetMemorySource(e){e.forEach((e=>{e.layer=null,e.sourceLayer=null})),this.removeHandles("fl-source")}_hasMemorySource(){return!(this.url||!this.source)}findFirstValidLayerId(e){return Array.isArray(e.layers)&&e.layers.length>0?e.layers[0].id:Array.isArray(e.tables)&&e.tables.length>0?e.tables[0].id:void 0}};e([b({clonable:!1,readOnly:!0})],Xe.prototype,"_titleCreator",null),e([b(Z)],Xe.prototype,"attributeTableTemplate",void 0),e([w("service","capabilities")],Xe.prototype,"readCapabilities",null),e([b({json:{origins:{"web-scene":{write:!1}},write:!0}})],Xe.prototype,"charts",void 0),e([b({readOnly:!0})],Xe.prototype,"createQueryVersion",null),e([b({json:{read:{source:"layerDefinition.copyrightText"}}})],Xe.prototype,"copyright",void 0),e([b({json:{read:{source:"layerDefinition.displayField"}}})],Xe.prototype,"displayField",void 0),e([b({types:Ge,readOnly:!0})],Xe.prototype,"defaultSymbol",void 0),e([b({type:Oe})],Xe.prototype,"dynamicDataSource",void 0),e([b({type:Boolean})],Xe.prototype,"editingEnabled",null),e([w(["portal-item","web-scene"],"editingEnabled",["layerDefinition.capabilities"])],Xe.prototype,"readEditingEnabled",null),e([w("web-map","editingEnabled",["capabilities","layerDefinition.capabilities"])],Xe.prototype,"readEditingEnabledFromWebMap",null),e([j(["portal-item","web-scene"],"editingEnabled",{"layerDefinition.capabilities":{type:String}})],Xe.prototype,"writeEditingEnabled",null),e([j("web-map","editingEnabled",{capabilities:{type:String},"layerDefinition.capabilities":{type:String}})],Xe.prototype,"writeEditingEnabledToWebMap",null),e([b({readOnly:!0})],Xe.prototype,"effectiveEditingEnabled",null),e([b({clonable:!1,readOnly:!0})],Xe.prototype,"featureTitleFields",null),e([b({...ze.fields,json:{read:{source:"layerDefinition.fields"},origins:{service:{name:"fields"},"web-map":{write:{target:"layerDefinition.fields",overridePolicy:Ke}}}}})],Xe.prototype,"fields",void 0),e([b(ze.fieldsIndex)],Xe.prototype,"fieldsIndex",void 0),e([b({type:F,json:{name:"formInfo",write:!0,origins:{"web-scene":{read:!1,write:!1}}}})],Xe.prototype,"formTemplate",void 0),e([b({json:{read:{source:"layerDefinition.extent"}}})],Xe.prototype,"fullExtent",void 0),e([b({json:{origins:{"web-map":{write:{target:"layerDefinition.geometryType",overridePolicy:Ke,writer(e,t,r){const i=e?Fe.toJSON(e):null;i&&u(r,i,t)}}}},read:{source:"layerDefinition.geometryType",reader:Fe.read}}})],Xe.prototype,"geometryType",void 0),e([b({json:{read:{source:"layerDefinition.hasM"}}})],Xe.prototype,"hasM",void 0),e([b({json:{read:{source:"layerDefinition.hasZ"}}})],Xe.prototype,"hasZ",void 0),e([b(H)],Xe.prototype,"id",void 0),e([b({readOnly:!0,json:{origins:{service:{read:!0}},read:!1}})],Xe.prototype,"infoFor3D",void 0),e([b({json:{origins:{"web-map":{write:{target:"layerDefinition.type"}}}}})],Xe.prototype,"isTable",void 0),e([w("service","isTable",["type","geometryType"]),w("isTable",["layerDefinition.type","layerDefinition.geometryType"])],Xe.prototype,"readIsTable",null),e([j("web-map","isTable")],Xe.prototype,"writeIsTable",null),e([b(k)],Xe.prototype,"labelsVisible",void 0),e([b({type:[_e],json:{origins:{service:{name:"drawingInfo.labelingInfo",read:xe,write:!1}},name:"layerDefinition.drawingInfo.labelingInfo",read:xe,write:{layerContainerTypes:T}}})],Xe.prototype,"labelingInfo",void 0),e([b((()=>{const e=a(z);return e.json.origins["portal-item"]={write:{target:"layerDefinition.drawingInfo.transparency",writer(e,t,r){u(r,We(e),t)}}},e})())],Xe.prototype,"opacity",void 0),e([b(K)],Xe.prototype,"legendEnabled",void 0),e([b({type:["show","hide"],json:(()=>{const e=a(X.json);return e.origins["portal-item"]={read:!1,write:!1},e})()})],Xe.prototype,"listMode",void 0),e([w("globalIdField",["layerDefinition.globalIdField","layerDefinition.fields"])],Xe.prototype,"readGlobalIdField",null),e([b({json:{origins:{"web-map":{write:{target:"layerDefinition.objectIdField",overridePolicy:Ke}}}}})],Xe.prototype,"objectIdField",void 0),e([w("objectIdField",["layerDefinition.objectIdField","layerDefinition.fields"])],Xe.prototype,"readObjectIdField",null),e([b({type:["ArcGISFeatureLayer"],json:{write:{target:"layerType",ignoreOrigin:!0,layerContainerTypes:T}}})],Xe.prototype,"operationalLayerType",void 0),e([b(ze.outFields)],Xe.prototype,"outFields",void 0),e([b({readOnly:!0})],Xe.prototype,"parsedUrl",null),e([b({type:String,json:{origins:{"web-scene":{read:!0,write:!0}},read:!1}})],Xe.prototype,"path",void 0),e([b(Y)],Xe.prototype,"popupEnabled",void 0),e([b({type:t,json:{name:"popupInfo",write:!0}})],Xe.prototype,"popupTemplate",void 0),e([b({readOnly:!0})],Xe.prototype,"defaultPopupTemplate",null),e([b({types:Ue,json:{origins:{service:{write:{target:"drawingInfo.renderer",enabled:!1}},"web-scene":{types:Re,name:"layerDefinition.drawingInfo.renderer",write:{layerContainerTypes:T,overridePolicy:(e,t,r)=>({ignoreOrigin:r?.writeLayerSchema,layerContainerTypes:T})}}},write:{target:"layerDefinition.drawingInfo.renderer",overridePolicy:(e,t,r)=>({ignoreOrigin:r?.writeLayerSchema,layerContainerTypes:T})}}})],Xe.prototype,"renderer",null),e([w("service","renderer",["drawingInfo.renderer","defaultSymbol"]),w("renderer",["layerDefinition.drawingInfo.renderer","layerDefinition.defaultSymbol"])],Xe.prototype,"readRenderer",null),e([b()],Xe.prototype,"resourceInfo",void 0),e([b((()=>{const e=a(ee);return e.json.origins["portal-item"]={read:!1,write:!1},e})())],Xe.prototype,"screenSizePerspectiveEnabled",void 0),e([b({clonable:!1})],Xe.prototype,"source",null),e([g("source")],Xe.prototype,"castSource",null),e([w("portal-item","source",["featureSet"]),w("web-map","source",["featureSet"])],Xe.prototype,"readSource",null),e([b({json:{read:{source:"layerDefinition.extent.spatialReference"}}})],Xe.prototype,"spatialReference",void 0),e([b({type:Number})],Xe.prototype,"subtypeCode",void 0),e([b({type:[Se]})],Xe.prototype,"templates",void 0),e([w("templates",["editFieldsInfo","creatorField","editorField","templates"])],Xe.prototype,"readTemplates",null),e([b({type:Pe})],Xe.prototype,"timeInfo",void 0),e([b()],Xe.prototype,"title",void 0),e([w("service","title",["name"]),w("portal-item","title",["layerDefinition.title","layerDefinition.name","title"])],Xe.prototype,"readTitle",null),e([w("web-map","title",["layerDefinition.name","title"])],Xe.prototype,"readTitleFromWebMap",null),e([b({type:String})],Xe.prototype,"sublayerTitleMode",void 0),e([b({json:{read:!1}})],Xe.prototype,"type",void 0),e([b({type:String})],Xe.prototype,"typeIdField",void 0),e([w("service","typeIdField"),w("typeIdField",["layerDefinition.typeIdField"])],Xe.prototype,"readTypeIdField",null),e([b({type:[Ie]})],Xe.prototype,"types",void 0),e([w("service","types",["types"]),w("types",["layerDefinition.types"])],Xe.prototype,"readTypes",null),e([b({type:Boolean,json:{origins:{"portal-item":{write:{target:"layerDefinition.defaultVisibility",layerContainerTypes:T}}}}})],Xe.prototype,"visible",void 0),e([w("portal-item","visible",["visibility","layerDefinition.defaultVisibility"])],Xe.prototype,"readVisible",null),Xe=e([v("esri.layers.FeatureLayer")],Xe);export{Xe as default};
@@ -2,4 +2,4 @@
2
2
  All material copyright ESRI, All Rights Reserved, unless otherwise specified.
3
3
  See https://js.arcgis.com/4.33/esri/copyright.txt for details.
4
4
  */
5
- import{_ as e}from"../chunks/tslib.es6.js";import t from"../PopupTemplate.js";import r from"../core/Error.js";import{MultiOriginJSONMixin as o}from"../core/MultiOriginJSONSupport.js";import{throwIfAbortError as i}from"../core/promiseUtils.js";import{urlToObject as s}from"../core/urlUtils.js";import{property as p}from"../core/accessorSupport/decorators/property.js";import"../core/has.js";import"../core/Logger.js";import"../core/RandomLCG.js";import{subclass as n}from"../core/accessorSupport/decorators/subclass.js";import a from"../geometry/Extent.js";import l from"../geometry/SpatialReference.js";import{featureGeometryTypeKebabDictionary as u}from"../geometry/support/typeUtils.js";import d from"./Layer.js";import{GeoJSONSource as m}from"./graphics/sources/GeoJSONSource.js";import{BlendLayer as y}from"./mixins/BlendLayer.js";import{CustomParametersMixin as c}from"./mixins/CustomParametersMixin.js";import{DisplayFilteredLayer as h}from"./mixins/DisplayFilteredLayer.js";import{FeatureEffectLayer as f}from"./mixins/FeatureEffectLayer.js";import{FeatureReductionLayer as j}from"./mixins/FeatureReductionLayer.js";import{OperationalLayer as g}from"./mixins/OperationalLayer.js";import{OrderedLayer as b}from"./mixins/OrderedLayer.js";import{PortalLayer as v}from"./mixins/PortalLayer.js";import{RefreshableLayer as x}from"./mixins/RefreshableLayer.js";import{ScaleRangeLayer as I}from"./mixins/ScaleRangeLayer.js";import{TemporalLayer as F}from"./mixins/TemporalLayer.js";import{TrackableLayer as O}from"./mixins/TrackableLayer.js";import{attributeTableTemplate as T,elevationInfo as w,id as E,labelsVisible as S,legendEnabled as L,opacity as P,popupEnabled as q,screenSizePerspectiveEnabled as U,url as D}from"./support/commonProperties.js";import{validateBinsQuery as J}from"./support/featureLayerUtils.js";import N from"./support/FeatureTemplate.js";import Q from"./support/Field.js";import{defineFieldProperties as R}from"./support/fieldProperties.js";import{fixRendererFields as B,fixTimeInfoFields as G}from"./support/fieldUtils.js";import C from"./support/LabelClass.js";import{reader as Z}from"./support/labelingInfo.js";import{webSceneRendererTypes as A,rendererTypes as V}from"../renderers/support/typeUtils.js";import _ from"../rest/support/Query.js";import{createPopupTemplate as M}from"../support/popupUtils.js";import{timeZoneProperty as k}from"../time/timeZoneUtils.js";const z=R();let W=class extends(b(h(c(j(f(y(F(O(I(x(g(v(o(d)))))))))))))){constructor(e){super(e),this.attributeTableTemplate=null,this.copyright=null,this.dateFieldsTimeZone=null,this.definitionExpression=null,this.displayField=null,this.editingEnabled=!1,this.elevationInfo=null,this.fields=null,this.fieldsIndex=null,this.fullExtent=null,this.geometryType=null,this.hasZ=void 0,this.labelsVisible=!0,this.labelingInfo=null,this.legendEnabled=!0,this.objectIdField=null,this.operationalLayerType="GeoJSON",this.outFields=null,this.popupEnabled=!0,this.popupTemplate=null,this.screenSizePerspectiveEnabled=!0,this.source=new m({layer:this}),this.spatialReference=l.WGS84,this.templates=null,this.title="GeoJSON",this.type="geojson"}destroy(){this.source?.destroy()}load(e){const t=this.loadFromPortal({supportedTypes:["GeoJson"],supportsData:!1},e).catch(i).then((()=>this.source.load(e))).then((()=>{this.read(this.source.sourceJSON,{origin:"service",url:this.parsedUrl}),this.revert(["objectIdField","fields","timeInfo"],"service"),B(this.renderer,this.fieldsIndex),G(this.timeInfo,this.fieldsIndex)}));return this.addResolvingPromise(t),Promise.resolve(this)}get capabilities(){return this.source?this.source.capabilities:null}get createQueryVersion(){return this.commitProperty("definitionExpression"),this.commitProperty("timeExtent"),this.commitProperty("timeOffset"),this.commitProperty("geometryType"),this.commitProperty("capabilities"),(this._get("createQueryVersion")||0)+1}get defaultPopupTemplate(){return this.createPopupTemplate()}get isTable(){return this.loaded&&null==this.geometryType}get parsedUrl(){return this.url?s(this.url):null}set renderer(e){B(e,this.fieldsIndex),this._set("renderer",e)}set url(e){if(!e)return void this._set("url",e);const t=s(e);this._set("url",t.path),t.query&&(this.customParameters={...this.customParameters,...t.query})}async applyEdits(e,t){const{applyEdits:r}=await import("./graphics/editingSupport.js");await this.load();const o=await r(this,this.source,e,t);return this.read({extent:this.source.sourceJSON.extent,timeInfo:this.source.sourceJSON.timeInfo},{origin:"service",ignoreDefaults:!0}),o}on(e,t){return super.on(e,t)}createPopupTemplate(e){return M(this,e)}createQuery(){const e=new _,t=this.capabilities?.data;e.returnGeometry=!0,t&&t.supportsZ&&(e.returnZ=!0),e.outFields=["*"],e.where=this.definitionExpression||"1=1";const{timeOffset:r,timeExtent:o}=this;return e.timeExtent=null!=r&&null!=o?o.offset(-r.value,r.unit):o||null,e}getFieldDomain(e,t){return this.getField(e)?.domain}getField(e){return this.fieldsIndex.get(e)}queryFeatures(e,t){return this.load().then((()=>this.source.queryFeatures(_.from(e)||this.createQuery(),t))).then((e=>{if(e?.features)for(const t of e.features)t.layer=t.sourceLayer=this;return e}))}queryObjectIds(e,t){return this.load().then((()=>this.source.queryObjectIds(_.from(e)||this.createQuery(),t)))}queryFeatureCount(e,t){return this.load().then((()=>this.source.queryFeatureCount(_.from(e)||this.createQuery(),t)))}queryExtent(e,t){return this.load().then((()=>this.source.queryExtent(_.from(e)||this.createQuery(),t)))}async queryAttributeBins(e,t){const{source:o,capabilities:i}=await this.load(),s="GeoJSONLayer";if(!o.queryAttributeBins||!i?.operations?.supportsQueryBins)throw new r(s,"Layer source does not support queryAttributeBins capability");J(e,i,s);const p=await import("../rest/support/AttributeBinsQuery.js"),n=await o.queryAttributeBins(p.default.from(e),t);if(n.features)for(const r of n.features)r.layer=r.sourceLayer=this;return n}async hasDataChanged(){try{const{dataChanged:e,updates:t}=await this.source.refresh(this.customParameters);return null!=t&&this.read(t,{origin:"service",url:this.parsedUrl,ignoreDefaults:!0}),e}catch{}return!1}};e([p(T)],W.prototype,"attributeTableTemplate",void 0),e([p({readOnly:!0,json:{read:!1,write:!1}})],W.prototype,"capabilities",null),e([p({type:String})],W.prototype,"copyright",void 0),e([p({readOnly:!0})],W.prototype,"createQueryVersion",null),e([p(k("dateFieldsTimeReference"))],W.prototype,"dateFieldsTimeZone",void 0),e([p({readOnly:!0})],W.prototype,"defaultPopupTemplate",null),e([p({type:String,json:{name:"layerDefinition.definitionExpression",write:{enabled:!0,allowNull:!0}}})],W.prototype,"definitionExpression",void 0),e([p({type:String})],W.prototype,"displayField",void 0),e([p({type:Boolean})],W.prototype,"editingEnabled",void 0),e([p(w)],W.prototype,"elevationInfo",void 0),e([p({type:[Q],json:{name:"layerDefinition.fields",write:{ignoreOrigin:!0,isRequired:!0},origins:{service:{name:"fields"}}}})],W.prototype,"fields",void 0),e([p(z.fieldsIndex)],W.prototype,"fieldsIndex",void 0),e([p({type:a,json:{name:"extent"}})],W.prototype,"fullExtent",void 0),e([p({type:["point","polygon","polyline","multipoint"],json:{read:{reader:u.read}}})],W.prototype,"geometryType",void 0),e([p({type:Boolean})],W.prototype,"hasZ",void 0),e([p(E)],W.prototype,"id",void 0),e([p({type:Boolean,readOnly:!0})],W.prototype,"isTable",null),e([p(S)],W.prototype,"labelsVisible",void 0),e([p({type:[C],json:{name:"layerDefinition.drawingInfo.labelingInfo",read:{reader:Z},write:!0}})],W.prototype,"labelingInfo",void 0),e([p(L)],W.prototype,"legendEnabled",void 0),e([p({type:["show","hide"]})],W.prototype,"listMode",void 0),e([p({type:String,json:{name:"layerDefinition.objectIdField",write:{ignoreOrigin:!0,isRequired:!0},origins:{service:{name:"objectIdField"}}}})],W.prototype,"objectIdField",void 0),e([p(P)],W.prototype,"opacity",void 0),e([p({type:["GeoJSON"]})],W.prototype,"operationalLayerType",void 0),e([p(z.outFields)],W.prototype,"outFields",void 0),e([p({readOnly:!0})],W.prototype,"parsedUrl",null),e([p(q)],W.prototype,"popupEnabled",void 0),e([p({type:t,json:{name:"popupInfo",write:!0}})],W.prototype,"popupTemplate",void 0),e([p({types:V,json:{name:"layerDefinition.drawingInfo.renderer",write:!0,origins:{service:{name:"drawingInfo.renderer"},"web-scene":{types:A}}}})],W.prototype,"renderer",null),e([p(U)],W.prototype,"screenSizePerspectiveEnabled",void 0),e([p({readOnly:!0})],W.prototype,"source",void 0),e([p({type:l})],W.prototype,"spatialReference",void 0),e([p({type:[N]})],W.prototype,"templates",void 0),e([p()],W.prototype,"title",void 0),e([p({json:{read:!1},readOnly:!0})],W.prototype,"type",void 0),e([p(D)],W.prototype,"url",null),W=e([n("esri.layers.GeoJSONLayer")],W);const H=W;export{H as default};
5
+ import{_ as e}from"../chunks/tslib.es6.js";import t from"../PopupTemplate.js";import{MultiOriginJSONMixin as r}from"../core/MultiOriginJSONSupport.js";import{throwIfAbortError as i}from"../core/promiseUtils.js";import{urlToObject as o}from"../core/urlUtils.js";import{property as s}from"../core/accessorSupport/decorators/property.js";import"../core/has.js";import"../core/Logger.js";import"../core/RandomLCG.js";import{subclass as p}from"../core/accessorSupport/decorators/subclass.js";import n from"../geometry/Extent.js";import a from"../geometry/SpatialReference.js";import{featureGeometryTypeKebabDictionary as l}from"../geometry/support/typeUtils.js";import u from"./Layer.js";import{GeoJSONSource as d}from"./graphics/sources/GeoJSONSource.js";import{BlendLayer as m}from"./mixins/BlendLayer.js";import{CustomParametersMixin as y}from"./mixins/CustomParametersMixin.js";import{DisplayFilteredLayer as c}from"./mixins/DisplayFilteredLayer.js";import{FeatureEffectLayer as h}from"./mixins/FeatureEffectLayer.js";import{FeatureReductionLayer as f}from"./mixins/FeatureReductionLayer.js";import{OperationalLayer as j}from"./mixins/OperationalLayer.js";import{OrderedLayer as g}from"./mixins/OrderedLayer.js";import{PortalLayer as v}from"./mixins/PortalLayer.js";import{RefreshableLayer as b}from"./mixins/RefreshableLayer.js";import{ScaleRangeLayer as x}from"./mixins/ScaleRangeLayer.js";import{TemporalLayer as I}from"./mixins/TemporalLayer.js";import{TrackableLayer as F}from"./mixins/TrackableLayer.js";import{attributeTableTemplate as O,elevationInfo as T,id as E,labelsVisible as S,legendEnabled as w,opacity as L,popupEnabled as P,screenSizePerspectiveEnabled as q,url as U}from"./support/commonProperties.js";import{validateBinsQuery as D}from"./support/featureLayerUtils.js";import J from"./support/FeatureTemplate.js";import N from"./support/Field.js";import{defineFieldProperties as R}from"./support/fieldProperties.js";import{fixRendererFields as G,fixTimeInfoFields as Q}from"./support/fieldUtils.js";import B from"./support/LabelClass.js";import{reader as C}from"./support/labelingInfo.js";import{webSceneRendererTypes as Z,rendererTypes as V}from"../renderers/support/typeUtils.js";import _ from"../rest/support/Query.js";import{createPopupTemplate as A}from"../support/popupUtils.js";import{timeZoneProperty as M}from"../time/timeZoneUtils.js";const k=R();let z=class extends(g(c(y(f(h(m(I(F(x(b(j(v(r(u)))))))))))))){constructor(e){super(e),this.attributeTableTemplate=null,this.copyright=null,this.dateFieldsTimeZone=null,this.definitionExpression=null,this.displayField=null,this.editingEnabled=!1,this.elevationInfo=null,this.fields=null,this.fieldsIndex=null,this.fullExtent=null,this.geometryType=null,this.hasZ=void 0,this.labelsVisible=!0,this.labelingInfo=null,this.legendEnabled=!0,this.objectIdField=null,this.operationalLayerType="GeoJSON",this.outFields=null,this.popupEnabled=!0,this.popupTemplate=null,this.screenSizePerspectiveEnabled=!0,this.source=new d({layer:this}),this.spatialReference=a.WGS84,this.templates=null,this.title="GeoJSON",this.type="geojson"}destroy(){this.source?.destroy()}load(e){const t=this.loadFromPortal({supportedTypes:["GeoJson"],supportsData:!1},e).catch(i).then((()=>this.source.load(e))).then((()=>{this.read(this.source.sourceJSON,{origin:"service",url:this.parsedUrl}),this.revert(["objectIdField","fields","timeInfo"],"service"),G(this.renderer,this.fieldsIndex),Q(this.timeInfo,this.fieldsIndex)}));return this.addResolvingPromise(t),Promise.resolve(this)}get capabilities(){return this.source?this.source.capabilities:null}get createQueryVersion(){return this.commitProperty("definitionExpression"),this.commitProperty("timeExtent"),this.commitProperty("timeOffset"),this.commitProperty("geometryType"),this.commitProperty("capabilities"),(this._get("createQueryVersion")||0)+1}get defaultPopupTemplate(){return this.createPopupTemplate()}get isTable(){return this.loaded&&null==this.geometryType}get parsedUrl(){return this.url?o(this.url):null}set renderer(e){G(e,this.fieldsIndex),this._set("renderer",e)}set url(e){if(!e)return void this._set("url",e);const t=o(e);this._set("url",t.path),t.query&&(this.customParameters={...this.customParameters,...t.query})}async applyEdits(e,t){const{applyEdits:r}=await import("./graphics/editingSupport.js");await this.load();const i=await r(this,this.source,e,t);return this.read({extent:this.source.sourceJSON.extent,timeInfo:this.source.sourceJSON.timeInfo},{origin:"service",ignoreDefaults:!0}),i}on(e,t){return super.on(e,t)}createPopupTemplate(e){return A(this,e)}createQuery(){const e=new _,t=this.capabilities?.data;e.returnGeometry=!0,t&&t.supportsZ&&(e.returnZ=!0),e.outFields=["*"],e.where=this.definitionExpression||"1=1";const{timeOffset:r,timeExtent:i}=this;return e.timeExtent=null!=r&&null!=i?i.offset(-r.value,r.unit):i||null,e}getFieldDomain(e,t){return this.getField(e)?.domain}getField(e){return this.fieldsIndex.get(e)}queryFeatures(e,t){return this.load().then((()=>this.source.queryFeatures(_.from(e)||this.createQuery(),t))).then((e=>{if(e?.features)for(const t of e.features)t.layer=t.sourceLayer=this;return e}))}queryObjectIds(e,t){return this.load().then((()=>this.source.queryObjectIds(_.from(e)||this.createQuery(),t)))}queryFeatureCount(e,t){return this.load().then((()=>this.source.queryFeatureCount(_.from(e)||this.createQuery(),t)))}queryExtent(e,t){return this.load().then((()=>this.source.queryExtent(_.from(e)||this.createQuery(),t)))}async queryAttributeBins(e,t){const{source:r,capabilities:i}=await this.load();D(e,i,"GeoJSONLayer");const o=await import("../rest/support/AttributeBinsQuery.js"),s=await r.queryAttributeBins(o.default.from(e),t);if(s.features)for(const p of s.features)p.layer=p.sourceLayer=this;return s}async hasDataChanged(){try{const{dataChanged:e,updates:t}=await this.source.refresh(this.customParameters);return null!=t&&this.read(t,{origin:"service",url:this.parsedUrl,ignoreDefaults:!0}),e}catch{}return!1}};e([s(O)],z.prototype,"attributeTableTemplate",void 0),e([s({readOnly:!0,json:{read:!1,write:!1}})],z.prototype,"capabilities",null),e([s({type:String})],z.prototype,"copyright",void 0),e([s({readOnly:!0})],z.prototype,"createQueryVersion",null),e([s(M("dateFieldsTimeReference"))],z.prototype,"dateFieldsTimeZone",void 0),e([s({readOnly:!0})],z.prototype,"defaultPopupTemplate",null),e([s({type:String,json:{name:"layerDefinition.definitionExpression",write:{enabled:!0,allowNull:!0}}})],z.prototype,"definitionExpression",void 0),e([s({type:String})],z.prototype,"displayField",void 0),e([s({type:Boolean})],z.prototype,"editingEnabled",void 0),e([s(T)],z.prototype,"elevationInfo",void 0),e([s({type:[N],json:{name:"layerDefinition.fields",write:{ignoreOrigin:!0,isRequired:!0},origins:{service:{name:"fields"}}}})],z.prototype,"fields",void 0),e([s(k.fieldsIndex)],z.prototype,"fieldsIndex",void 0),e([s({type:n,json:{name:"extent"}})],z.prototype,"fullExtent",void 0),e([s({type:["point","polygon","polyline","multipoint"],json:{read:{reader:l.read}}})],z.prototype,"geometryType",void 0),e([s({type:Boolean})],z.prototype,"hasZ",void 0),e([s(E)],z.prototype,"id",void 0),e([s({type:Boolean,readOnly:!0})],z.prototype,"isTable",null),e([s(S)],z.prototype,"labelsVisible",void 0),e([s({type:[B],json:{name:"layerDefinition.drawingInfo.labelingInfo",read:{reader:C},write:!0}})],z.prototype,"labelingInfo",void 0),e([s(w)],z.prototype,"legendEnabled",void 0),e([s({type:["show","hide"]})],z.prototype,"listMode",void 0),e([s({type:String,json:{name:"layerDefinition.objectIdField",write:{ignoreOrigin:!0,isRequired:!0},origins:{service:{name:"objectIdField"}}}})],z.prototype,"objectIdField",void 0),e([s(L)],z.prototype,"opacity",void 0),e([s({type:["GeoJSON"]})],z.prototype,"operationalLayerType",void 0),e([s(k.outFields)],z.prototype,"outFields",void 0),e([s({readOnly:!0})],z.prototype,"parsedUrl",null),e([s(P)],z.prototype,"popupEnabled",void 0),e([s({type:t,json:{name:"popupInfo",write:!0}})],z.prototype,"popupTemplate",void 0),e([s({types:V,json:{name:"layerDefinition.drawingInfo.renderer",write:!0,origins:{service:{name:"drawingInfo.renderer"},"web-scene":{types:Z}}}})],z.prototype,"renderer",null),e([s(q)],z.prototype,"screenSizePerspectiveEnabled",void 0),e([s({readOnly:!0})],z.prototype,"source",void 0),e([s({type:a})],z.prototype,"spatialReference",void 0),e([s({type:[J]})],z.prototype,"templates",void 0),e([s()],z.prototype,"title",void 0),e([s({json:{read:!1},readOnly:!0})],z.prototype,"type",void 0),e([s(U)],z.prototype,"url",null),z=e([p("esri.layers.GeoJSONLayer")],z);const W=z;export{W as default};
@@ -2,4 +2,4 @@
2
2
  All material copyright ESRI, All Rights Reserved, unless otherwise specified.
3
3
  See https://js.arcgis.com/4.33/esri/copyright.txt for details.
4
4
  */
5
- import{_ as e}from"../chunks/tslib.es6.js";import r from"../PopupTemplate.js";import t from"../core/Error.js";import{MultiOriginJSONMixin as i}from"../core/MultiOriginJSONSupport.js";import{setDeepValue as o}from"../core/object.js";import{urlToObject as s}from"../core/urlUtils.js";import{property as n}from"../core/accessorSupport/decorators/property.js";import{Integer as p}from"../core/accessorSupport/ensureType.js";import"../core/has.js";import"../core/RandomLCG.js";import{subclass as a}from"../core/accessorSupport/decorators/subclass.js";import{writer as l}from"../core/accessorSupport/decorators/writer.js";import m from"../geometry/Extent.js";import d from"../geometry/SpatialReference.js";import{featureGeometryTypeKebabDictionary as u}from"../geometry/support/typeUtils.js";import y from"./Layer.js";import{WFSSource as f}from"./graphics/sources/WFSSource.js";import{BlendLayer as c}from"./mixins/BlendLayer.js";import{CustomParametersMixin as h}from"./mixins/CustomParametersMixin.js";import{DisplayFilteredLayer as g}from"./mixins/DisplayFilteredLayer.js";import{FeatureEffectLayer as j}from"./mixins/FeatureEffectLayer.js";import{FeatureReductionLayer as w}from"./mixins/FeatureReductionLayer.js";import{OperationalLayer as v}from"./mixins/OperationalLayer.js";import{OrderedLayer as b}from"./mixins/OrderedLayer.js";import{PortalLayer as x}from"./mixins/PortalLayer.js";import{RefreshableLayer as F}from"./mixins/RefreshableLayer.js";import{ScaleRangeLayer as I}from"./mixins/ScaleRangeLayer.js";import{TemporalLayer as O}from"./mixins/TemporalLayer.js";import{TrackableLayer as S}from"./mixins/TrackableLayer.js";import{wfsOidFieldName as R}from"./ogc/wfsUtils.js";import{elevationInfo as P,labelsVisible as T,legendEnabled as q,opacityDrawingInfo as L,popupEnabled as E,screenSizePerspectiveEnabled as C,url as U}from"./support/commonProperties.js";import{validateBinsQuery as D}from"./support/featureLayerUtils.js";import Q from"./support/Field.js";import{defineFieldProperties as W}from"./support/fieldProperties.js";import{fixRendererFields as B,fixTimeInfoFields as A}from"./support/fieldUtils.js";import N from"./support/LabelClass.js";import{reader as V}from"./support/labelingInfo.js";import{webSceneRendererTypes as X,rendererTypes as Y}from"../renderers/support/typeUtils.js";import k from"../rest/support/Query.js";import{createPopupTemplate as G}from"../support/popupUtils.js";import{timeZoneProperty as J}from"../time/timeZoneUtils.js";var M;const Z=W();let _=M=class extends(b(g(h(w(j(c(O(S(F(I(v(x(i(y)))))))))))))){static fromWFSLayerInfo(e){const{customParameters:r,fields:t,geometryField:i,geometryType:o,name:s,namespaceUri:n,objectIdField:p,spatialReference:a,swapXY:l,url:m,wfsCapabilities:d}=e;return new M({customParameters:r,fields:t,geometryField:i,geometryType:o,name:s,namespaceUri:n,objectIdField:p,spatialReference:a,swapXY:l,url:m,wfsCapabilities:d})}constructor(e){super(e),this.copyright=null,this.customParameters=null,this.dateFieldsTimeZone=null,this.definitionExpression=null,this.displayField=null,this.elevationInfo=null,this.featureUrl=void 0,this.fields=null,this.fieldsIndex=null,this.fullExtent=null,this.geometryType=null,this.labelsVisible=!0,this.labelingInfo=null,this.legendEnabled=!0,this.objectIdField=null,this.operationalLayerType="WFS",this.maxRecordCount=3e3,this.maxPageCount=10,this.maxTotalRecordCount=2e5,this.mode=0,this.name=null,this.namespaceUri=null,this.outFields=null,this.popupEnabled=!0,this.popupTemplate=null,this.screenSizePerspectiveEnabled=!0,this.source=new f({layer:this}),this.spatialReference=d.WGS84,this.spatialReferences=[4326],this.swapXY=void 0,this.title="WFS",this.type="wfs",this.url=null,this.version=void 0}destroy(){this.source?.destroy()}load(e){return this.addResolvingPromise(this.loadFromPortal({supportedTypes:["WFS"]},e).then((()=>this.source.load(e))).then((()=>{this.read(this.source.sourceJSON,{origin:"service",url:this.parsedUrl}),this.revert(["objectIdField","fields","timeInfo","spatialReference","name","namespaceUri"],"service"),B(this.renderer,this.fieldsIndex),A(this.timeInfo,this.fieldsIndex)}))),Promise.resolve(this)}get capabilities(){return this.source?.capabilities}get createQueryVersion(){return this.commitProperty("definitionExpression"),this.commitProperty("timeExtent"),this.commitProperty("timeOffset"),this.commitProperty("geometryType"),this.commitProperty("capabilities"),(this._get("createQueryVersion")||0)+1}get defaultPopupTemplate(){return this.createPopupTemplate()}writeFields(e,r,t){const i=e.filter((e=>e.name!==R));this.geometryField&&i.unshift(new Q({name:this.geometryField,alias:this.geometryField,type:"geometry"})),o(t,i.map((e=>e.toJSON())),r)}get parsedUrl(){return s(this.url)}set renderer(e){B(e,this.fieldsIndex),this._set("renderer",e)}get wfsCapabilities(){return this.source?.wfsCapabilities}set wfsCapabilities(e){this.source&&(this.source.wfsCapabilities=e)}createPopupTemplate(e){return G(this,e)}createQuery(){const e=new k({returnGeometry:!0,outFields:["*"],where:this.definitionExpression||"1=1"}),{timeOffset:r,timeExtent:t}=this;return e.timeExtent=null!=r&&null!=t?t.offset(-r.value,r.unit):t||null,e}getFieldDomain(e,r){return this.getField(e)?.domain}getField(e){return this.fieldsIndex?.get(e)}queryFeatures(e,r){return this.load().then((()=>this.source.queryFeatures(k.from(e)||this.createQuery(),r))).then((e=>{if(e?.features)for(const r of e.features)r.layer=r.sourceLayer=this;return e}))}queryObjectIds(e,r){return this.load().then((()=>this.source.queryObjectIds(k.from(e)||this.createQuery(),r)))}queryFeatureCount(e,r){return this.load().then((()=>this.source.queryFeatureCount(k.from(e)||this.createQuery(),r)))}queryExtent(e,r){return this.load().then((()=>this.source.queryExtent(k.from(e)||this.createQuery(),r)))}async queryAttributeBins(e,r){const{source:i,capabilities:o}=await this.load(),s="WFSLayer";if(!i.queryAttributeBins||!o?.operations?.supportsQueryBins)throw new t(s,"Layer source does not support queryAttributeBins capability");D(e,o,s);const n=await import("../rest/support/AttributeBinsQuery.js"),p=await i.queryAttributeBins(n.default.from(e),r);if(p.features)for(const t of p.features)t.layer=t.sourceLayer=this;return p}async hasDataChanged(){try{const{dataChanged:e,updates:r}=await this.source.refresh();return null!=r&&this.read(r,{origin:"service",url:this.parsedUrl,ignoreDefaults:!0}),e}catch{}return!1}};e([n({readOnly:!0})],_.prototype,"capabilities",null),e([n({type:String})],_.prototype,"copyright",void 0),e([n({readOnly:!0})],_.prototype,"createQueryVersion",null),e([n({json:{name:"wfsInfo.customParameters",write:{overridePolicy:e=>({enabled:!!(e&&Object.keys(e).length>0),ignoreOrigin:!0})}}})],_.prototype,"customParameters",void 0),e([n(J("dateFieldsTimeReference"))],_.prototype,"dateFieldsTimeZone",void 0),e([n({readOnly:!0})],_.prototype,"defaultPopupTemplate",null),e([n({type:String,json:{name:"layerDefinition.definitionExpression",write:{enabled:!0,allowNull:!0}}})],_.prototype,"definitionExpression",void 0),e([n({type:String})],_.prototype,"displayField",void 0),e([n(P)],_.prototype,"elevationInfo",void 0),e([n({type:String,readOnly:!0,json:{name:"wfsInfo.featureUrl",write:{ignoreOrigin:!0,isRequired:!0}}})],_.prototype,"featureUrl",void 0),e([n({type:[Q],json:{name:"layerDefinition.fields",write:{ignoreOrigin:!0,isRequired:!0},origins:{service:{name:"fields"}}}})],_.prototype,"fields",void 0),e([l("fields")],_.prototype,"writeFields",null),e([n(Z.fieldsIndex)],_.prototype,"fieldsIndex",void 0),e([n({type:m,json:{name:"extent"}})],_.prototype,"fullExtent",void 0),e([n()],_.prototype,"geometryField",void 0),e([n({type:String,json:{read:{source:"layerDefinition.geometryType",reader:u.read},write:{target:"layerDefinition.geometryType",writer:u.write,ignoreOrigin:!0},origins:{service:{read:u.read}}}})],_.prototype,"geometryType",void 0),e([n({type:String})],_.prototype,"id",void 0),e([n(T)],_.prototype,"labelsVisible",void 0),e([n({type:[N],json:{name:"layerDefinition.drawingInfo.labelingInfo",read:{reader:V},write:!0}})],_.prototype,"labelingInfo",void 0),e([n(q)],_.prototype,"legendEnabled",void 0),e([n({type:["show","hide"]})],_.prototype,"listMode",void 0),e([n({type:String})],_.prototype,"objectIdField",void 0),e([n({type:["WFS"]})],_.prototype,"operationalLayerType",void 0),e([n({type:p,json:{name:"wfsInfo.maxFeatures",write:{ignoreOrigin:!0,isRequired:!0}}})],_.prototype,"maxRecordCount",void 0),e([n({type:p})],_.prototype,"maxPageCount",void 0),e([n({type:p})],_.prototype,"maxTotalRecordCount",void 0),e([n({type:[0],readOnly:!0,json:{origins:{"web-map":{write:{ignoreOrigin:!0,isRequired:!0}}}}})],_.prototype,"mode",void 0),e([n({type:String,json:{name:"wfsInfo.name",write:{ignoreOrigin:!0,isRequired:!0}}})],_.prototype,"name",void 0),e([n({type:String,json:{name:"wfsInfo.wfsNamespace",write:{ignoreOrigin:!0,isRequired:!0}}})],_.prototype,"namespaceUri",void 0),e([n(L)],_.prototype,"opacity",void 0),e([n(Z.outFields)],_.prototype,"outFields",void 0),e([n({readOnly:!0})],_.prototype,"parsedUrl",null),e([n(E)],_.prototype,"popupEnabled",void 0),e([n({type:r,json:{name:"popupInfo",write:!0}})],_.prototype,"popupTemplate",void 0),e([n({types:Y,json:{origins:{service:{name:"drawingInfo.renderer"},"web-scene":{types:X,name:"layerDefinition.drawingInfo.renderer",write:!0}},name:"layerDefinition.drawingInfo.renderer",write:{ignoreOrigin:!0}}})],_.prototype,"renderer",null),e([n(C)],_.prototype,"screenSizePerspectiveEnabled",void 0),e([n({readOnly:!0})],_.prototype,"source",void 0),e([n({type:d,json:{name:"layerDefinition.spatialReference",write:{ignoreOrigin:!0,isRequired:!0},origins:{service:{name:"extent.spatialReference"}}}})],_.prototype,"spatialReference",void 0),e([n({readOnly:!0,type:[p],json:{name:"wfsInfo.supportedSpatialReferences",write:{ignoreOrigin:!0,isRequired:!0}}})],_.prototype,"spatialReferences",void 0),e([n({type:Boolean,value:!1,json:{name:"wfsInfo.swapXY",write:{ignoreOrigin:!0,isRequired:!0}}})],_.prototype,"swapXY",void 0),e([n({json:{write:{ignoreOrigin:!0,isRequired:!0},origins:{service:{name:"name"}}}})],_.prototype,"title",void 0),e([n({json:{read:!1},readOnly:!0})],_.prototype,"type",void 0),e([n(U)],_.prototype,"url",void 0),e([n({type:String,readOnly:!0,json:{name:"wfsInfo.version",write:{ignoreOrigin:!0,isRequired:!0}}})],_.prototype,"version",void 0),e([n()],_.prototype,"wfsCapabilities",null),_=M=e([a("esri.layers.WFSLayer")],_);const z=_;export{z as default};
5
+ import{_ as e}from"../chunks/tslib.es6.js";import t from"../PopupTemplate.js";import{MultiOriginJSONMixin as r}from"../core/MultiOriginJSONSupport.js";import{setDeepValue as i}from"../core/object.js";import{urlToObject as o}from"../core/urlUtils.js";import{property as s}from"../core/accessorSupport/decorators/property.js";import{Integer as n}from"../core/accessorSupport/ensureType.js";import"../core/has.js";import"../core/RandomLCG.js";import{subclass as p}from"../core/accessorSupport/decorators/subclass.js";import{writer as a}from"../core/accessorSupport/decorators/writer.js";import l from"../geometry/Extent.js";import m from"../geometry/SpatialReference.js";import{featureGeometryTypeKebabDictionary as d}from"../geometry/support/typeUtils.js";import u from"./Layer.js";import{WFSSource as y}from"./graphics/sources/WFSSource.js";import{BlendLayer as f}from"./mixins/BlendLayer.js";import{CustomParametersMixin as c}from"./mixins/CustomParametersMixin.js";import{DisplayFilteredLayer as h}from"./mixins/DisplayFilteredLayer.js";import{FeatureEffectLayer as g}from"./mixins/FeatureEffectLayer.js";import{FeatureReductionLayer as j}from"./mixins/FeatureReductionLayer.js";import{OperationalLayer as v}from"./mixins/OperationalLayer.js";import{OrderedLayer as w}from"./mixins/OrderedLayer.js";import{PortalLayer as b}from"./mixins/PortalLayer.js";import{RefreshableLayer as x}from"./mixins/RefreshableLayer.js";import{ScaleRangeLayer as F}from"./mixins/ScaleRangeLayer.js";import{TemporalLayer as I}from"./mixins/TemporalLayer.js";import{TrackableLayer as O}from"./mixins/TrackableLayer.js";import{wfsOidFieldName as S}from"./ogc/wfsUtils.js";import{elevationInfo as R,labelsVisible as P,legendEnabled as T,opacityDrawingInfo as L,popupEnabled as q,screenSizePerspectiveEnabled as C,url as E}from"./support/commonProperties.js";import{validateBinsQuery as U}from"./support/featureLayerUtils.js";import D from"./support/Field.js";import{defineFieldProperties as Q}from"./support/fieldProperties.js";import{fixRendererFields as W,fixTimeInfoFields as B}from"./support/fieldUtils.js";import N from"./support/LabelClass.js";import{reader as V}from"./support/labelingInfo.js";import{webSceneRendererTypes as X,rendererTypes as Y}from"../renderers/support/typeUtils.js";import k from"../rest/support/Query.js";import{createPopupTemplate as A}from"../support/popupUtils.js";import{timeZoneProperty as G}from"../time/timeZoneUtils.js";var J;const M=Q();let Z=J=class extends(w(h(c(j(g(f(I(O(x(F(v(b(r(u)))))))))))))){static fromWFSLayerInfo(e){const{customParameters:t,fields:r,geometryField:i,geometryType:o,name:s,namespaceUri:n,objectIdField:p,spatialReference:a,swapXY:l,url:m,wfsCapabilities:d}=e;return new J({customParameters:t,fields:r,geometryField:i,geometryType:o,name:s,namespaceUri:n,objectIdField:p,spatialReference:a,swapXY:l,url:m,wfsCapabilities:d})}constructor(e){super(e),this.copyright=null,this.customParameters=null,this.dateFieldsTimeZone=null,this.definitionExpression=null,this.displayField=null,this.elevationInfo=null,this.featureUrl=void 0,this.fields=null,this.fieldsIndex=null,this.fullExtent=null,this.geometryType=null,this.labelsVisible=!0,this.labelingInfo=null,this.legendEnabled=!0,this.objectIdField=null,this.operationalLayerType="WFS",this.maxRecordCount=3e3,this.maxPageCount=10,this.maxTotalRecordCount=2e5,this.mode=0,this.name=null,this.namespaceUri=null,this.outFields=null,this.popupEnabled=!0,this.popupTemplate=null,this.screenSizePerspectiveEnabled=!0,this.source=new y({layer:this}),this.spatialReference=m.WGS84,this.spatialReferences=[4326],this.swapXY=void 0,this.title="WFS",this.type="wfs",this.url=null,this.version=void 0}destroy(){this.source?.destroy()}load(e){return this.addResolvingPromise(this.loadFromPortal({supportedTypes:["WFS"]},e).then((()=>this.source.load(e))).then((()=>{this.read(this.source.sourceJSON,{origin:"service",url:this.parsedUrl}),this.revert(["objectIdField","fields","timeInfo","spatialReference","name","namespaceUri"],"service"),W(this.renderer,this.fieldsIndex),B(this.timeInfo,this.fieldsIndex)}))),Promise.resolve(this)}get capabilities(){return this.source?.capabilities}get createQueryVersion(){return this.commitProperty("definitionExpression"),this.commitProperty("timeExtent"),this.commitProperty("timeOffset"),this.commitProperty("geometryType"),this.commitProperty("capabilities"),(this._get("createQueryVersion")||0)+1}get defaultPopupTemplate(){return this.createPopupTemplate()}writeFields(e,t,r){const o=e.filter((e=>e.name!==S));this.geometryField&&o.unshift(new D({name:this.geometryField,alias:this.geometryField,type:"geometry"})),i(r,o.map((e=>e.toJSON())),t)}get parsedUrl(){return o(this.url)}set renderer(e){W(e,this.fieldsIndex),this._set("renderer",e)}get wfsCapabilities(){return this.source?.wfsCapabilities}set wfsCapabilities(e){this.source&&(this.source.wfsCapabilities=e)}createPopupTemplate(e){return A(this,e)}createQuery(){const e=new k({returnGeometry:!0,outFields:["*"],where:this.definitionExpression||"1=1"}),{timeOffset:t,timeExtent:r}=this;return e.timeExtent=null!=t&&null!=r?r.offset(-t.value,t.unit):r||null,e}getFieldDomain(e,t){return this.getField(e)?.domain}getField(e){return this.fieldsIndex?.get(e)}queryFeatures(e,t){return this.load().then((()=>this.source.queryFeatures(k.from(e)||this.createQuery(),t))).then((e=>{if(e?.features)for(const t of e.features)t.layer=t.sourceLayer=this;return e}))}queryObjectIds(e,t){return this.load().then((()=>this.source.queryObjectIds(k.from(e)||this.createQuery(),t)))}queryFeatureCount(e,t){return this.load().then((()=>this.source.queryFeatureCount(k.from(e)||this.createQuery(),t)))}queryExtent(e,t){return this.load().then((()=>this.source.queryExtent(k.from(e)||this.createQuery(),t)))}async queryAttributeBins(e,t){const{source:r,capabilities:i}=await this.load();U(e,i,"WFSLayer");const o=await import("../rest/support/AttributeBinsQuery.js"),s=await r.queryAttributeBins(o.default.from(e),t);if(s.features)for(const n of s.features)n.layer=n.sourceLayer=this;return s}async hasDataChanged(){try{const{dataChanged:e,updates:t}=await this.source.refresh();return null!=t&&this.read(t,{origin:"service",url:this.parsedUrl,ignoreDefaults:!0}),e}catch{}return!1}};e([s({readOnly:!0})],Z.prototype,"capabilities",null),e([s({type:String})],Z.prototype,"copyright",void 0),e([s({readOnly:!0})],Z.prototype,"createQueryVersion",null),e([s({json:{name:"wfsInfo.customParameters",write:{overridePolicy:e=>({enabled:!!(e&&Object.keys(e).length>0),ignoreOrigin:!0})}}})],Z.prototype,"customParameters",void 0),e([s(G("dateFieldsTimeReference"))],Z.prototype,"dateFieldsTimeZone",void 0),e([s({readOnly:!0})],Z.prototype,"defaultPopupTemplate",null),e([s({type:String,json:{name:"layerDefinition.definitionExpression",write:{enabled:!0,allowNull:!0}}})],Z.prototype,"definitionExpression",void 0),e([s({type:String})],Z.prototype,"displayField",void 0),e([s(R)],Z.prototype,"elevationInfo",void 0),e([s({type:String,readOnly:!0,json:{name:"wfsInfo.featureUrl",write:{ignoreOrigin:!0,isRequired:!0}}})],Z.prototype,"featureUrl",void 0),e([s({type:[D],json:{name:"layerDefinition.fields",write:{ignoreOrigin:!0,isRequired:!0},origins:{service:{name:"fields"}}}})],Z.prototype,"fields",void 0),e([a("fields")],Z.prototype,"writeFields",null),e([s(M.fieldsIndex)],Z.prototype,"fieldsIndex",void 0),e([s({type:l,json:{name:"extent"}})],Z.prototype,"fullExtent",void 0),e([s()],Z.prototype,"geometryField",void 0),e([s({type:String,json:{read:{source:"layerDefinition.geometryType",reader:d.read},write:{target:"layerDefinition.geometryType",writer:d.write,ignoreOrigin:!0},origins:{service:{read:d.read}}}})],Z.prototype,"geometryType",void 0),e([s({type:String})],Z.prototype,"id",void 0),e([s(P)],Z.prototype,"labelsVisible",void 0),e([s({type:[N],json:{name:"layerDefinition.drawingInfo.labelingInfo",read:{reader:V},write:!0}})],Z.prototype,"labelingInfo",void 0),e([s(T)],Z.prototype,"legendEnabled",void 0),e([s({type:["show","hide"]})],Z.prototype,"listMode",void 0),e([s({type:String})],Z.prototype,"objectIdField",void 0),e([s({type:["WFS"]})],Z.prototype,"operationalLayerType",void 0),e([s({type:n,json:{name:"wfsInfo.maxFeatures",write:{ignoreOrigin:!0,isRequired:!0}}})],Z.prototype,"maxRecordCount",void 0),e([s({type:n})],Z.prototype,"maxPageCount",void 0),e([s({type:n})],Z.prototype,"maxTotalRecordCount",void 0),e([s({type:[0],readOnly:!0,json:{origins:{"web-map":{write:{ignoreOrigin:!0,isRequired:!0}}}}})],Z.prototype,"mode",void 0),e([s({type:String,json:{name:"wfsInfo.name",write:{ignoreOrigin:!0,isRequired:!0}}})],Z.prototype,"name",void 0),e([s({type:String,json:{name:"wfsInfo.wfsNamespace",write:{ignoreOrigin:!0,isRequired:!0}}})],Z.prototype,"namespaceUri",void 0),e([s(L)],Z.prototype,"opacity",void 0),e([s(M.outFields)],Z.prototype,"outFields",void 0),e([s({readOnly:!0})],Z.prototype,"parsedUrl",null),e([s(q)],Z.prototype,"popupEnabled",void 0),e([s({type:t,json:{name:"popupInfo",write:!0}})],Z.prototype,"popupTemplate",void 0),e([s({types:Y,json:{origins:{service:{name:"drawingInfo.renderer"},"web-scene":{types:X,name:"layerDefinition.drawingInfo.renderer",write:!0}},name:"layerDefinition.drawingInfo.renderer",write:{ignoreOrigin:!0}}})],Z.prototype,"renderer",null),e([s(C)],Z.prototype,"screenSizePerspectiveEnabled",void 0),e([s({readOnly:!0})],Z.prototype,"source",void 0),e([s({type:m,json:{name:"layerDefinition.spatialReference",write:{ignoreOrigin:!0,isRequired:!0},origins:{service:{name:"extent.spatialReference"}}}})],Z.prototype,"spatialReference",void 0),e([s({readOnly:!0,type:[n],json:{name:"wfsInfo.supportedSpatialReferences",write:{ignoreOrigin:!0,isRequired:!0}}})],Z.prototype,"spatialReferences",void 0),e([s({type:Boolean,value:!1,json:{name:"wfsInfo.swapXY",write:{ignoreOrigin:!0,isRequired:!0}}})],Z.prototype,"swapXY",void 0),e([s({json:{write:{ignoreOrigin:!0,isRequired:!0},origins:{service:{name:"name"}}}})],Z.prototype,"title",void 0),e([s({json:{read:!1},readOnly:!0})],Z.prototype,"type",void 0),e([s(E)],Z.prototype,"url",void 0),e([s({type:String,readOnly:!0,json:{name:"wfsInfo.version",write:{ignoreOrigin:!0,isRequired:!0}}})],Z.prototype,"version",void 0),e([s()],Z.prototype,"wfsCapabilities",null),Z=J=e([p("esri.layers.WFSLayer")],Z);const _=Z;export{_ as default};
@@ -2,4 +2,4 @@
2
2
  All material copyright ESRI, All Rights Reserved, unless otherwise specified.
3
3
  See https://js.arcgis.com/4.33/esri/copyright.txt for details.
4
4
  */
5
- import{clone as e}from"../../../core/lang.js";import{millisecondsPerTimeUnit as t}from"../../../core/timeUtils.js";import{polygonCentroid as i,extentCentroid as s}from"../../../geometry/support/centroid.js";import{getPolygonExtent as a,getGeometryExtent as r}from"../../../geometry/support/extentUtils.js";import{toQuantizationTransform as n}from"../../../geometry/support/quantizationUtils.js";import{isValid as o,equals as l}from"../../../geometry/support/spatialReferenceUtils.js";import u from"./AttributesBuilder.js";import{cleanFromGeometryEngine as c,getGeometry as m,transformCentroid as d}from"./geometryUtils.js";import{project as h}from"./projectionSupport.js";import{getDateInNumber as p}from"./queryUtils.js";import{makeEdgeCandidate as f,makeVertexCandidate as y}from"./SnappingCandidate.js";import{isDateField as g,isDateOnlyField as x,isTimestampOffsetField as T,isStringField as I,isTimeOnlyField as F}from"../../support/fieldUtils.js";import _ from"../../../rest/support/AutoIntervalBinParameters.js";import V from"../../../rest/support/DateBinParameters.js";import v from"../../../rest/support/FixedBoundariesBinParameters.js";import b from"../../../rest/support/FixedIntervalBinParameters.js";import{isNullCountSupported as S,calculateStringStatistics as R,calculateStatistics as B,processSummaryStatisticsResult as z,calculateUniqueValuesCount as A,createUVResult as w,calculateClassBreaks as M,resolveCBResult as P,calculateHistogram as D,getAttributeComparator as q,calculatePercentile as N,binIndex as Z,getBinParams as j}from"../../../statistics/utils.js";const G="bin";class C{constructor(e,t,i){this.items=e,this.query=t,this.geometryType=i.geometryType,this.hasM=i.hasM,this.hasZ=i.hasZ,this.fieldsIndex=i.fieldsIndex,this.objectIdField=i.objectIdField,this.spatialReference=i.spatialReference,this.featureAdapter=i.featureAdapter}get size(){return this.items.length}createQueryResponseForCount(){const e=new u(this.query,this.featureAdapter,this.fieldsIndex);if(!this.query.outStatistics)return e.countDistinctValues(this.items);const{groupByFieldsForStatistics:t,having:i,outStatistics:s}=this.query,a=t?.length;if(!!!a)return 1;const r=new Map,n=new Map,o=new Set;for(const l of s){const{statisticType:s}=l,a="exceedslimit"!==s?l.onStatisticField:void 0;if(!n.has(a)){const i=[];for(const s of t){const t=this._getAttributeValues(e,s,this.items,r);i.push(t)}n.set(a,this._calculateUniqueValues(i,this.items,e.returnDistinctValues))}const u=n.get(a);for(const t in u){const{data:s,items:a}=u[t],r=s.join(",");i&&!e.validateItems(a,i)||o.add(r)}}return o.size}async createQueryResponse(){let e;if(this.query.outStatistics){e=this.query.outStatistics.some((e=>"exceedslimit"===e.statisticType))?this._createExceedsLimitQueryResponse():await this._createStatisticsQueryResponse(this.query,this.items)}else e=this._createFeatureQueryResponse(this.query);if(this.query.returnQueryGeometry){const t=this.query.geometry;o(this.query.outSR)&&!l(t.spatialReference,this.query.outSR)?e.queryGeometry=c({spatialReference:this.query.outSR,...h(t,t.spatialReference,this.query.outSR)}):e.queryGeometry=c({spatialReference:this.query.outSR,...t})}return e}createSnappingResponse(e,t,i){const s=this.featureAdapter,a=O(this.hasZ,this.hasM),{point:r,mode:n}=e,o="number"==typeof e.distance?e.distance:e.distance.x,l="number"==typeof e.distance?e.distance:e.distance.y,u={candidates:[]},c="esriGeometryPolygon"===this.geometryType,m="esriGeometryPolyline"===this.geometryType||"esriGeometryPoint"===this.geometryType,d=this._getPointCreator(n,t,this.spatialReference,i),h=new H(null,0),p=new H(null,0),g={x:0,y:0,z:0};for(const x of this.items){const t=s.getGeometry(x);if(null==t)continue;const{coords:i}=t,n=t.isPoint?Q:t.lengths;if(h.coords=i,p.coords=i,e.returnEdge){let e=0;for(let t=0;t<n.length;t++){const i=n[t],m=e;for(let t=0;t<i;t++,e+=a){if(!c&&t===i-1)continue;const n=h;n.coordsIndex=e;const y=p;y.coordsIndex=t===i-1?m:e+a;const T=g;if(!E(g,r,n,y))continue;const I=(r.x-T.x)/o,F=(r.y-T.y)/l,_=I*I+F*F;_<=1&&u.candidates.push(f(s.getObjectId(x),d(T),Math.sqrt(_),d(n),d(y)))}}}if("all"===e.vertexMode){let e=0;for(let t=0;t<n.length;t++){const i=n[t],m=e,f=p;f.coordsIndex=m;for(let t=0;t<i;t++,e+=a){const a=h;if(a.coordsIndex=e,c&&t===i-1&&a.x===f.x&&a.y===f.y)continue;const n=(r.x-a.x)/o,m=(r.y-a.y)/l,p=n*n+m*m;p<=1&&u.candidates.push(y(s.getObjectId(x),d(a),Math.sqrt(p)))}}}else if(m&&"ends"===e.vertexMode){let e=0;const t=[];for(let i=0;i<n.length;i++){t.push(e);const s=n[i];e+=s*a,!c&&s>1&&t.push(e-a)}for(const i of t){const e=h;e.coordsIndex=i;const t=(r.x-e.x)/o,a=(r.y-e.y)/l,n=t*t+a*a;n<=1&&u.candidates.push(y(s.getObjectId(x),d(e),Math.sqrt(n)))}}}return u.candidates.sort(((e,t)=>e.distance-t.distance)),u}_getPointCreator(e,t,i,s){const a=null==s||l(i,s)?e=>e:e=>h(e,i,s),{hasZ:r}=this,n=0;return"3d"===e?r&&t?({x:e,y:t,z:i})=>a({x:e,y:t,z:i}):({x:e,y:t})=>a({x:e,y:t,z:n}):({x:e,y:t})=>a({x:e,y:t})}async createSummaryStatisticsResponse(e){const{field:t,valueExpression:i,normalizationField:s,normalizationType:a,normalizationTotal:r,minValue:n,maxValue:o,scale:l,timeZone:u,outStatisticTypes:c}=e,m=this.fieldsIndex.get(t),d=g(m)||x(m)||T(m),h=await this._getDataValues({field:t,valueExpression:i,normalizationField:s,normalizationType:a,normalizationTotal:r,scale:l,timeZone:u},this.items),p=S({normalizationType:a,normalizationField:s,minValue:n,maxValue:o}),f={value:.5,fieldType:m?.type},y=I(m)?R({values:h,supportsNullCount:p,percentileParams:f,outStatisticTypes:c}):B({values:h,minValue:n,maxValue:o,useSampleStdDev:!a,supportsNullCount:p,percentileParams:f,outStatisticTypes:c});return z(y,c,d)}async createUniqueValuesResponse(e){const{field:t,valueExpression:i,domains:s,returnAllCodedValues:a,scale:r,timeZone:n}=e,o=await this._getDataValues({field:t,field2:e.field2,field3:e.field3,fieldDelimiter:e.fieldDelimiter,valueExpression:i,scale:r,timeZone:n},this.items,!1),l=A(o);return w(l,s,a,e.fieldDelimiter)}async createClassBreaksResponse(e){const{field:t,valueExpression:i,normalizationField:s,normalizationType:a,normalizationTotal:r,classificationMethod:n,standardDeviationInterval:o,minValue:l,maxValue:u,numClasses:c,scale:m,timeZone:d}=e,h=await this._getDataValues({field:t,valueExpression:i,normalizationField:s,normalizationType:a,normalizationTotal:r,scale:m,timeZone:d},this.items),p=M(h,{field:t,normalizationField:s,normalizationType:a,normalizationTotal:r,classificationMethod:n,standardDeviationInterval:o,minValue:l,maxValue:u,numClasses:c});return P(p,n)}async createHistogramResponse(e){const{field:t,valueExpression:i,normalizationField:s,normalizationType:a,normalizationTotal:r,classificationMethod:n,standardDeviationInterval:o,minValue:l,maxValue:u,numBins:c,scale:m,timeZone:d}=e,h=await this._getDataValues({field:t,valueExpression:i,normalizationField:s,normalizationType:a,normalizationTotal:r,scale:m,timeZone:d},this.items);return D(h,{field:t,normalizationField:s,normalizationType:a,normalizationTotal:r,classificationMethod:n,standardDeviationInterval:o,minValue:l,maxValue:u,numBins:c})}_sortFeatures(e,t,i){if(e.length>1&&t?.length)for(const s of t.slice().reverse()){const t=s.split(" "),a=t[0],r=this.fieldsIndex.get(a),n=!!t[1]&&"desc"===t[1].toLowerCase(),o=q(r?.type,n);e.sort(((e,t)=>{const s=i(e,a,r),n=i(t,a,r);return o(s,n)}))}}_createFeatureQueryResponse(e){const{items:t,geometryType:i,hasM:s,hasZ:a,objectIdField:r,spatialReference:o}=this,{outFields:l,outSR:u,quantizationParameters:m,resultRecordCount:d,resultOffset:h,returnZ:p,returnM:f}=e,y=null!=d&&t.length>(h||0)+d,g=l&&(l.includes("*")?[...this.fieldsIndex.fields]:l.map((e=>this.fieldsIndex.get(e))));return{exceededTransferLimit:y,features:this._createFeatures(e,t),fields:g,geometryType:i,hasM:s&&f,hasZ:a&&p,objectIdFieldName:r,spatialReference:c(u||o),transform:m&&n(m)||null}}_createFeatures(e,t){const i=new u(e,this.featureAdapter,this.fieldsIndex),{hasM:s,hasZ:a}=this,{orderByFields:r,quantizationParameters:o,returnGeometry:l,returnCentroid:c,maxAllowableOffset:h,resultOffset:p,resultRecordCount:f,returnZ:y=!1,returnM:g=!1}=e,x=a&&y,T=s&&g;let I=[],F=0;const _=[...t];if(this._sortFeatures(_,r,((e,t,s)=>i.getFieldValue(e,t,s))),this.geometryType&&(l||c)){const e=n(o)??void 0,t="esriGeometryPolygon"===this.geometryType||"esriGeometryPolyline"===this.geometryType;if(l&&!c)for(const s of _){const a=this.featureAdapter.getGeometry(s),r={attributes:i.getAttributes(s),geometry:m(this.geometryType,this.hasZ,this.hasM,a,h,e,x,T),metadata:this.featureAdapter.getMetadata?.(s)};t&&a&&!r.geometry&&(r.centroid=d(this,this.featureAdapter.getCentroid(s,this),e)),I[F++]=r}else if(!l&&c)for(const s of _)I[F++]={attributes:i.getAttributes(s),centroid:d(this,this.featureAdapter.getCentroid(s,this),e)};else for(const s of _)I[F++]={attributes:i.getAttributes(s),centroid:d(this,this.featureAdapter.getCentroid(s,this),e),geometry:m(this.geometryType,this.hasZ,this.hasM,this.featureAdapter.getGeometry(s),h,e,x,T),metadata:this.featureAdapter.getMetadata?.(s)}}else for(const n of _){const e=i.getAttributes(n);e&&(I[F++]={attributes:e})}const V=p||0;if(null!=f){const e=V+f;I=I.slice(V,Math.min(I.length,e))}return I}_createExceedsLimitQueryResponse(){let e=!1,t=Number.POSITIVE_INFINITY,i=Number.POSITIVE_INFINITY,s=Number.POSITIVE_INFINITY;for(const a of this.query.outStatistics??[])if("exceedslimit"===a.statisticType){t=null!=a.maxPointCount?a.maxPointCount:Number.POSITIVE_INFINITY,i=null!=a.maxRecordCount?a.maxRecordCount:Number.POSITIVE_INFINITY,s=null!=a.maxVertexCount?a.maxVertexCount:Number.POSITIVE_INFINITY;break}if("esriGeometryPoint"===this.geometryType)e=this.items.length>t;else if(this.items.length>i)e=!0;else{const t=O(this.hasZ,this.hasM),i=this.featureAdapter;e=this.items.reduce(((e,t)=>{const s=i.getGeometry(t);return e+(null!=s&&s.coords.length||0)}),0)/t>s}return{fields:[{name:"exceedslimit",type:"esriFieldTypeInteger",alias:"exceedslimit",sqlType:"sqlTypeInteger",domain:null,defaultValue:null}],features:[{attributes:{exceedslimit:Number(e)}}]}}async _createStatisticsQueryResponse(e,t,i={attributes:{}}){const s=[],a=new Map,r=new Map,n=new Map,o=new Map,l=new u(e,this.featureAdapter,this.fieldsIndex),c=e.outStatistics,{groupByFieldsForStatistics:m,having:d,orderByFields:h,resultRecordCount:p}=e,f=m?.length,y=!!f,g=y?m[0]:null,x=y&&!this.fieldsIndex.get(g);for(const u of c??[]){const{outStatisticFieldName:e,statisticType:c}=u,h=u,p="exceedslimit"!==c?u.onStatisticField:void 0,T="percentile_disc"===c||"percentile_cont"===c,F="EnvelopeAggregate"===c||"CentroidAggregate"===c||"ConvexHullAggregate"===c,_=y&&1===f&&(p===g||x)&&"count"===c;if(y){if(!n.has(p)){const e=[];for(const i of m){const s=this._getAttributeValues(l,i,t,a);e.push(s)}n.set(p,this._calculateUniqueValues(e,t,!F&&l.returnDistinctValues))}const i=n.get(p);if(!i)continue;const s=Object.keys(i);for(const r of s){const{count:s,data:n,items:u,itemPositions:c}=i[r],f=n.join(",");if(!d||l.validateItems(u,d)){const i=o.get(f)||{attributes:{}};if(F){i.aggregateGeometries||(i.aggregateGeometries={});const{aggregateGeometries:e,outStatisticFieldName:t}=await this._getAggregateGeometry(h,u);i.aggregateGeometries[t]=e}else{let r=null;if(_)r=s;else{const e=this._getAttributeValues(l,p,t,a),i=c.map((t=>e[t]));r=T&&"statisticParameters"in h?this._getPercentileValue(h,i):this._getStatisticValue(h,i,null,l.returnDistinctValues)}i.attributes[e]=r}let r=0;m.forEach(((e,t)=>i.attributes[this.fieldsIndex.get(e)?e:"EXPR_"+ ++r]=n[t])),o.set(f,i)}}}else if(F){i.aggregateGeometries||(i.aggregateGeometries={});const{aggregateGeometries:e,outStatisticFieldName:s}=await this._getAggregateGeometry(h,t);i.aggregateGeometries[s]=e}else{const s=this._getAttributeValues(l,p,t,a);i.attributes[e]=T&&"statisticParameters"in h?this._getPercentileValue(h,s):this._getStatisticValue(h,s,r,l.returnDistinctValues)}const V="min"!==c&&"max"!==c||!I(this.fieldsIndex.get(p))&&!this._isAnyDateField(p)?null:this.fieldsIndex.get(p)?.type;s.push({name:e,alias:e,type:V||"esriFieldTypeDouble"})}const T=y?Array.from(o.values()):[i];return this._sortFeatures(T,h,((e,t)=>e.attributes[t])),p&&(T.length=Math.min(p,T.length)),{fields:s,features:T}}_isAnyDateField(e){const t=this.fieldsIndex.get(e);return g(t)||x(t)||T(t)||F(t)}async _getAggregateGeometry(e,t){const{convexHull:n,union:o}=await import("../../../geometry/geometryEngineJSON.js"),{statisticType:l,outStatisticFieldName:u}=e,{featureAdapter:c,spatialReference:d,geometryType:h,hasZ:p,hasM:f}=this,y=t.map((e=>m(h,p,f,c.getGeometry(e)))),g=n(d,y,!0)[0],x={aggregateGeometries:null,outStatisticFieldName:null};if("EnvelopeAggregate"===l){const e=g?a(g):r(o(d,y));x.aggregateGeometries={...e,spatialReference:d},x.outStatisticFieldName=u||"extent"}else if("CentroidAggregate"===l){const e=g?i(g):s(r(o(d,y)));x.aggregateGeometries={x:e[0],y:e[1],spatialReference:d},x.outStatisticFieldName=u||"centroid"}else"ConvexHullAggregate"===l&&(x.aggregateGeometries=g,x.outStatisticFieldName=u||"convexHull");return x}_getStatisticValue(e,t,i,s){const{onStatisticField:a,statisticType:r}=e;let n=null;n=i?.has(a)?i.get(a):I(this.fieldsIndex.get(a))||this._isAnyDateField(a)?R({values:t,returnDistinct:s}):B({values:s?[...new Set(t)]:t,minValue:null,maxValue:null,useSampleStdDev:!0}),i&&i.set(a,n);return n["var"===r?"variance":r]}_getPercentileValue(e,t){const{onStatisticField:i,statisticParameters:s,statisticType:a}=e,{value:r,orderBy:n}=s,o=this.fieldsIndex.get(i);return N(t,{value:r,orderBy:n,fieldType:o?.type,isDiscrete:"percentile_disc"===a})}_getAttributeValues(e,t,i,s){if(s.has(t))return s.get(t);const a=this.fieldsIndex.get(t),r=i.map((i=>e.getFieldValue(i,t,a)));return s.set(t,r),r}_calculateUniqueValues(e,t,i){const s={},a=t.length;for(let r=0;r<a;r++){const a=t[r],n=[];for(const t of e)n.push(t[r]);const o=n.join(",");null==s[o]?s[o]={count:1,data:n,items:[a],itemPositions:[r]}:(i||s[o].count++,s[o].items.push(a),s[o].itemPositions.push(r))}return s}async _getDataValues(t,i,s=!0){const a=new u(this.query,this.featureAdapter,this.fieldsIndex),{valueExpression:r,scale:n,timeZone:o}=t;return r?a.getExpressionValues(i,r,{viewingMode:"map",scale:n,spatialReference:this.query.outSR||this.spatialReference},{geometryType:this.geometryType,hasZ:this.hasZ,hasM:this.hasM},o):a.getDataValues(i,e(t),s)}async _calculateHistogramBins(e,t,i){if(null==t.min&&null==t.max)return[];const s=t.intervals,a=t.min??0,r=t.max??0,n=s.map((([e,t])=>({minValue:e,maxValue:t,count:0,items:[]})));for(let o=0;o<e.length;o++){const t=e[o],l=i[o];if(null!=t&&t>=a&&t<=r){const e=Z(s,t);e>-1&&(n[e].count++,n[e].items.push(l))}}return n}async createQueryBinsResponse(e){const t=e.bin?.splitBy;if(!t)return this._createBinsResponse(e);const{value:i,outAlias:s,valueType:a}=t,r=[],n=[{name:s??i,alias:s??i,type:a??"esriFieldTypeString"},{name:G,alias:G,type:"esriFieldTypeInteger"}],o=new u(e,this.featureAdapter,this.fieldsIndex),l=new Map,c=[...this.items];this._sortFeatures(c,[i],((e,t,i)=>o.getFieldValue(e,t,i)));const m=this._getAttributeValues(o,i,c,l),d=this._calculateUniqueValues([m],c,o.returnDistinctValues);for(const u in d){const{items:t}=d[u],a=await this._createBinsResponse(e,t);if(r.push(...a.features.map((e=>({...e,attributes:{...e.attributes,[s??i]:u}})))),a.fields)for(const e of a.fields)n.some((t=>t.name===e.name))||n.push(e)}return{fields:n,features:r}}async _createBinsResponse(e,t){const i=e.bin;switch(t=t??this.items,i.type){case"autoIntervalBin":return this._createAutoIntervalBinsResponse(_.fromJSON(i),e,t);case"dateBin":return this._createDateBinsResponse(V.fromJSON(i),e,t);case"fixedBoundariesBin":return this._createFixedBoundariesBinsResponse(v.fromJSON(i),e,t);case"fixedIntervalBin":return this._createFixedIntervalBinsResponse(b.fromJSON(i),e,t)}}async _createAutoIntervalBinsResponse(e,t,i){const{field:s,normalizationField:a,numBins:r,normalizationType:n,normalizationTotal:o,start:l,end:u}=e,c=await this._getDataValues({field:e.field,normalizationField:e.normalizationField,normalizationType:e.normalizationType,normalizationTotal:e.normalizationTotal,timeZone:t.outTimeReference?.ianaTimeZone},i),m=j(c,{field:s,normalizationField:a,normalizationType:n,normalizationTotal:o,numBins:r,minValue:p(l,!1),maxValue:p(u,!1)}),d=await this._calculateHistogramBins(c,m,i);return this._createFeaturesFromHistogramBins(d,t)}async _createDateBinsResponse(e,i,s){const{field:a,interval:r,start:n,end:o}=e,l=r.unit,u="quarters"===l?3*t.months:t[l],c=r.value*u/t.milliseconds,m=await this._getDataValues({field:e.field,timeZone:i.outTimeReference?.ianaTimeZone},s),d=F(this.fieldsIndex.get(a)),h=j(m,{field:a,classificationMethod:"defined-interval",definedInterval:c,minValue:p(n,d),maxValue:p(o,d)},!1),f=await this._calculateHistogramBins(m,h,s);return this._createFeaturesFromHistogramBins(f,i)}async _createFixedBoundariesBinsResponse(e,t,i){const{field:s}=e,a=await this._getDataValues({field:s,timeZone:t.outTimeReference?.ianaTimeZone},i),r=F(this.fieldsIndex.get(s)),n=e.boundaries.map((e=>p(e,r))).sort(((e,t)=>e-t)),o=[];for(let c=0;c<n.length-1;c++)o.push([n[c],n[c+1]]);const l={intervals:o,min:n.at(0),max:n.at(-1)},u=await this._calculateHistogramBins(a,l,i);return this._createFeaturesFromHistogramBins(u,t)}async _createFixedIntervalBinsResponse(e,t,i){const{field:s,interval:a,start:r,end:n}=e,o=await this._getDataValues({field:e.field,normalizationField:e.normalizationField,normalizationType:e.normalizationType,normalizationTotal:e.normalizationTotal,timeZone:t.outTimeReference?.ianaTimeZone},i),l=F(this.fieldsIndex.get(s)),u=j(o,{field:s,classificationMethod:"defined-interval",definedInterval:a,minValue:p(r,l),maxValue:p(n,l)},!0),c=await this._calculateHistogramBins(o,u,i);return this._createFeaturesFromHistogramBins(c,t)}async _createFeaturesFromHistogramBins(e,t){const{upperBoundaryAlias:i,lowerBoundaryAlias:s}=t,a=s||"lowerBoundary",r=i||"upperBoundary",n=[],o=[{name:a,alias:a,type:"esriFieldTypeDouble"},{name:r,alias:r,type:"esriFieldTypeDouble"}],l=t.bin?.stackBy?.value,u=t.bin?.stackBy?.outAlias;l&&o.push({name:G,alias:G,type:"esriFieldTypeInteger"},{name:u??l,alias:u??l,type:"esriFieldTypeString"});let c=0;for(const m of e){const{minValue:e,maxValue:i,items:s}=m,d={attributes:{}};let h;if(d.attributes[a]=e,d.attributes[r]=i,l?(h=await this._createStatisticsQueryResponse({...t,groupByFieldsForStatistics:[l],orderByFields:[l]},s),d.attributes[G]=++c,"flat"===t.bin.jsonStyle?n.push(...h.features.map((({attributes:{EXPR_1:e,...t},...i})=>({...i,attributes:u??e?{...t,[u??e]:e,...d.attributes}:{...t,...d.attributes}})))):(d.stackedAttributes=h.features.map((({attributes:{EXPR_1:e,...t}})=>u??e?{...t,[u??e]:e}:t)),n.push(d))):(t.bin?.splitBy&&(d.attributes[G]=++c),h=await this._createStatisticsQueryResponse(t,s,d),n.push(d)),h.fields)for(const t of h.fields)o.some((e=>e.name===t.name))||o.push(t)}return"desc"===t.binOrder&&n.reverse(),{fields:o,features:n}}}function E(e,t,i,s){const a=s.x-i.x,r=s.y-i.y,n=t.x-i.x,o=t.y-i.y,l=a*a+r*r;if(0===l)return!1;const u=n*a+o*r,c=Math.min(1,Math.max(0,u/l));return e.x=i.x+a*c,e.y=i.y+r*c,!0}function O(e,t){return e?t?4:3:t?3:2}class H{constructor(e,t){this.coords=e,this.coordsIndex=t}get x(){return this.coords[this.coordsIndex]}get y(){return this.coords[this.coordsIndex+1]}get z(){return this.coords[this.coordsIndex+2]}}const Q=[1];export{C as QueryEngineResult};
5
+ import{clone as e}from"../../../core/lang.js";import{polygonCentroid as t,extentCentroid as i}from"../../../geometry/support/centroid.js";import{getPolygonExtent as s,getGeometryExtent as a}from"../../../geometry/support/extentUtils.js";import{toQuantizationTransform as r}from"../../../geometry/support/quantizationUtils.js";import{isValid as n,equals as o}from"../../../geometry/support/spatialReferenceUtils.js";import l from"./AttributesBuilder.js";import{cleanFromGeometryEngine as u,getGeometry as c,transformCentroid as m}from"./geometryUtils.js";import{project as d}from"./projectionSupport.js";import{getDateInNumber as h}from"./queryUtils.js";import{makeEdgeCandidate as p,makeVertexCandidate as f}from"./SnappingCandidate.js";import{isDateField as y,isDateOnlyField as g,isTimestampOffsetField as x,isStringField as T,isTimeOnlyField as I}from"../../support/fieldUtils.js";import F from"../../../rest/support/AutoIntervalBinParameters.js";import _ from"../../../rest/support/DateBinParameters.js";import{unitsDict as V}from"../../../rest/support/DateBinUtils.js";import b from"../../../rest/support/FixedBoundariesBinParameters.js";import v from"../../../rest/support/FixedIntervalBinParameters.js";import{isNullCountSupported as S,calculateStringStatistics as R,calculateStatistics as B,processSummaryStatisticsResult as z,calculateUniqueValuesCount as A,createUVResult as M,calculateClassBreaks as w,resolveCBResult as D,calculateHistogram as P,getAttributeComparator as N,calculatePercentile as q,binIndex as Z,getBinParams as j}from"../../../statistics/utils.js";import{DateTime as G}from"luxon";const C="bin";class E{constructor(e,t,i){this.items=e,this.query=t,this.geometryType=i.geometryType,this.hasM=i.hasM,this.hasZ=i.hasZ,this.fieldsIndex=i.fieldsIndex,this.objectIdField=i.objectIdField,this.spatialReference=i.spatialReference,this.featureAdapter=i.featureAdapter}get size(){return this.items.length}createQueryResponseForCount(){const e=new l(this.query,this.featureAdapter,this.fieldsIndex);if(!this.query.outStatistics)return e.countDistinctValues(this.items);const{groupByFieldsForStatistics:t,having:i,outStatistics:s}=this.query,a=t?.length;if(!!!a)return 1;const r=new Map,n=new Map,o=new Set;for(const l of s){const{statisticType:s}=l,a="exceedslimit"!==s?l.onStatisticField:void 0;if(!n.has(a)){const i=[];for(const s of t){const t=this._getAttributeValues(e,s,this.items,r);i.push(t)}n.set(a,this._calculateUniqueValues(i,this.items,e.returnDistinctValues))}const u=n.get(a);for(const t in u){const{data:s,items:a}=u[t],r=s.join(",");i&&!e.validateItems(a,i)||o.add(r)}}return o.size}async createQueryResponse(){let e;if(this.query.outStatistics){e=this.query.outStatistics.some((e=>"exceedslimit"===e.statisticType))?this._createExceedsLimitQueryResponse():await this._createStatisticsQueryResponse(this.query,this.items)}else e=this._createFeatureQueryResponse(this.query);if(this.query.returnQueryGeometry){const t=this.query.geometry;n(this.query.outSR)&&!o(t.spatialReference,this.query.outSR)?e.queryGeometry=u({spatialReference:this.query.outSR,...d(t,t.spatialReference,this.query.outSR)}):e.queryGeometry=u({spatialReference:this.query.outSR,...t})}return e}createSnappingResponse(e,t,i){const s=this.featureAdapter,a=H(this.hasZ,this.hasM),{point:r,mode:n}=e,o="number"==typeof e.distance?e.distance:e.distance.x,l="number"==typeof e.distance?e.distance:e.distance.y,u={candidates:[]},c="esriGeometryPolygon"===this.geometryType,m="esriGeometryPolyline"===this.geometryType||"esriGeometryPoint"===this.geometryType,d=this._getPointCreator(n,t,this.spatialReference,i),h=new U(null,0),y=new U(null,0),g={x:0,y:0,z:0};for(const x of this.items){const t=s.getGeometry(x);if(null==t)continue;const{coords:i}=t,n=t.isPoint?Q:t.lengths;if(h.coords=i,y.coords=i,e.returnEdge){let e=0;for(let t=0;t<n.length;t++){const i=n[t],m=e;for(let t=0;t<i;t++,e+=a){if(!c&&t===i-1)continue;const n=h;n.coordsIndex=e;const f=y;f.coordsIndex=t===i-1?m:e+a;const T=g;if(!O(g,r,n,f))continue;const I=(r.x-T.x)/o,F=(r.y-T.y)/l,_=I*I+F*F;_<=1&&u.candidates.push(p(s.getObjectId(x),d(T),Math.sqrt(_),d(n),d(f)))}}}if("all"===e.vertexMode){let e=0;for(let t=0;t<n.length;t++){const i=n[t],m=e,p=y;p.coordsIndex=m;for(let t=0;t<i;t++,e+=a){const a=h;if(a.coordsIndex=e,c&&t===i-1&&a.x===p.x&&a.y===p.y)continue;const n=(r.x-a.x)/o,m=(r.y-a.y)/l,y=n*n+m*m;y<=1&&u.candidates.push(f(s.getObjectId(x),d(a),Math.sqrt(y)))}}}else if(m&&"ends"===e.vertexMode){let e=0;const t=[];for(let i=0;i<n.length;i++){t.push(e);const s=n[i];e+=s*a,!c&&s>1&&t.push(e-a)}for(const i of t){const e=h;e.coordsIndex=i;const t=(r.x-e.x)/o,a=(r.y-e.y)/l,n=t*t+a*a;n<=1&&u.candidates.push(f(s.getObjectId(x),d(e),Math.sqrt(n)))}}}return u.candidates.sort(((e,t)=>e.distance-t.distance)),u}_getPointCreator(e,t,i,s){const a=null==s||o(i,s)?e=>e:e=>d(e,i,s),{hasZ:r}=this,n=0;return"3d"===e?r&&t?({x:e,y:t,z:i})=>a({x:e,y:t,z:i}):({x:e,y:t})=>a({x:e,y:t,z:n}):({x:e,y:t})=>a({x:e,y:t})}async createSummaryStatisticsResponse(e){const{field:t,valueExpression:i,normalizationField:s,normalizationType:a,normalizationTotal:r,minValue:n,maxValue:o,scale:l,timeZone:u,outStatisticTypes:c}=e,m=this.fieldsIndex.get(t),d=y(m)||g(m)||x(m),h=await this._getDataValues({field:t,valueExpression:i,normalizationField:s,normalizationType:a,normalizationTotal:r,scale:l,timeZone:u},this.items),p=S({normalizationType:a,normalizationField:s,minValue:n,maxValue:o}),f={value:.5,fieldType:m?.type},I=T(m)?R({values:h,supportsNullCount:p,percentileParams:f,outStatisticTypes:c}):B({values:h,minValue:n,maxValue:o,useSampleStdDev:!a,supportsNullCount:p,percentileParams:f,outStatisticTypes:c});return z(I,c,d)}async createUniqueValuesResponse(e){const{field:t,valueExpression:i,domains:s,returnAllCodedValues:a,scale:r,timeZone:n}=e,o=await this._getDataValues({field:t,field2:e.field2,field3:e.field3,fieldDelimiter:e.fieldDelimiter,valueExpression:i,scale:r,timeZone:n},this.items,!1),l=A(o);return M(l,s,a,e.fieldDelimiter)}async createClassBreaksResponse(e){const{field:t,valueExpression:i,normalizationField:s,normalizationType:a,normalizationTotal:r,classificationMethod:n,standardDeviationInterval:o,minValue:l,maxValue:u,numClasses:c,scale:m,timeZone:d}=e,h=await this._getDataValues({field:t,valueExpression:i,normalizationField:s,normalizationType:a,normalizationTotal:r,scale:m,timeZone:d},this.items),p=w(h,{field:t,normalizationField:s,normalizationType:a,normalizationTotal:r,classificationMethod:n,standardDeviationInterval:o,minValue:l,maxValue:u,numClasses:c});return D(p,n)}async createHistogramResponse(e){const{field:t,valueExpression:i,normalizationField:s,normalizationType:a,normalizationTotal:r,classificationMethod:n,standardDeviationInterval:o,minValue:l,maxValue:u,numBins:c,scale:m,timeZone:d}=e,h=await this._getDataValues({field:t,valueExpression:i,normalizationField:s,normalizationType:a,normalizationTotal:r,scale:m,timeZone:d},this.items);return P(h,{field:t,normalizationField:s,normalizationType:a,normalizationTotal:r,classificationMethod:n,standardDeviationInterval:o,minValue:l,maxValue:u,numBins:c})}_sortFeatures(e,t,i){if(e.length>1&&t?.length)for(const s of t.slice().reverse()){const t=s.split(" "),a=t[0],r=this.fieldsIndex.get(a),n=!!t[1]&&"desc"===t[1].toLowerCase(),o=N(r?.type,n);e.sort(((e,t)=>{const s=i(e,a,r),n=i(t,a,r);return o(s,n)}))}}_createFeatureQueryResponse(e){const{items:t,geometryType:i,hasM:s,hasZ:a,objectIdField:n,spatialReference:o}=this,{outFields:l,outSR:c,quantizationParameters:m,resultRecordCount:d,resultOffset:h,returnZ:p,returnM:f}=e,y=null!=d&&t.length>(h||0)+d,g=l&&(l.includes("*")?[...this.fieldsIndex.fields]:l.map((e=>this.fieldsIndex.get(e))));return{exceededTransferLimit:y,features:this._createFeatures(e,t),fields:g,geometryType:i,hasM:s&&f,hasZ:a&&p,objectIdFieldName:n,spatialReference:u(c||o),transform:m&&r(m)||null}}_createFeatures(e,t){const i=new l(e,this.featureAdapter,this.fieldsIndex),{hasM:s,hasZ:a}=this,{orderByFields:n,quantizationParameters:o,returnGeometry:u,returnCentroid:d,maxAllowableOffset:h,resultOffset:p,resultRecordCount:f,returnZ:y=!1,returnM:g=!1}=e,x=a&&y,T=s&&g;let I=[],F=0;const _=[...t];if(this._sortFeatures(_,n,((e,t,s)=>i.getFieldValue(e,t,s))),this.geometryType&&(u||d)){const e=r(o)??void 0,t="esriGeometryPolygon"===this.geometryType||"esriGeometryPolyline"===this.geometryType;if(u&&!d)for(const s of _){const a=this.featureAdapter.getGeometry(s),r={attributes:i.getAttributes(s),geometry:c(this.geometryType,this.hasZ,this.hasM,a,h,e,x,T),metadata:this.featureAdapter.getMetadata?.(s)};t&&a&&!r.geometry&&(r.centroid=m(this,this.featureAdapter.getCentroid(s,this),e)),I[F++]=r}else if(!u&&d)for(const s of _)I[F++]={attributes:i.getAttributes(s),centroid:m(this,this.featureAdapter.getCentroid(s,this),e)};else for(const s of _)I[F++]={attributes:i.getAttributes(s),centroid:m(this,this.featureAdapter.getCentroid(s,this),e),geometry:c(this.geometryType,this.hasZ,this.hasM,this.featureAdapter.getGeometry(s),h,e,x,T),metadata:this.featureAdapter.getMetadata?.(s)}}else for(const r of _){const e=i.getAttributes(r);e&&(I[F++]={attributes:e})}const V=p||0;if(null!=f){const e=V+f;I=I.slice(V,Math.min(I.length,e))}return I}_createExceedsLimitQueryResponse(){let e=!1,t=Number.POSITIVE_INFINITY,i=Number.POSITIVE_INFINITY,s=Number.POSITIVE_INFINITY;for(const a of this.query.outStatistics??[])if("exceedslimit"===a.statisticType){t=null!=a.maxPointCount?a.maxPointCount:Number.POSITIVE_INFINITY,i=null!=a.maxRecordCount?a.maxRecordCount:Number.POSITIVE_INFINITY,s=null!=a.maxVertexCount?a.maxVertexCount:Number.POSITIVE_INFINITY;break}if("esriGeometryPoint"===this.geometryType)e=this.items.length>t;else if(this.items.length>i)e=!0;else{const t=H(this.hasZ,this.hasM),i=this.featureAdapter;e=this.items.reduce(((e,t)=>{const s=i.getGeometry(t);return e+(null!=s&&s.coords.length||0)}),0)/t>s}return{fields:[{name:"exceedslimit",type:"esriFieldTypeInteger",alias:"exceedslimit",sqlType:"sqlTypeInteger",domain:null,defaultValue:null}],features:[{attributes:{exceedslimit:Number(e)}}]}}async _createStatisticsQueryResponse(e,t,i={attributes:{}}){const s=[],a=new Map,r=new Map,n=new Map,o=new Map,u=new l(e,this.featureAdapter,this.fieldsIndex),c=e.outStatistics,{groupByFieldsForStatistics:m,having:d,orderByFields:h,resultRecordCount:p}=e,f=m?.length,y=!!f,g=y?m[0]:null,x=y&&!this.fieldsIndex.get(g);for(const l of c??[]){const{outStatisticFieldName:e,statisticType:c}=l,h=l,p="exceedslimit"!==c?l.onStatisticField:void 0,I="percentile_disc"===c||"percentile_cont"===c,F="EnvelopeAggregate"===c||"CentroidAggregate"===c||"ConvexHullAggregate"===c,_=y&&1===f&&(p===g||x)&&"count"===c;if(y){if(!n.has(p)){const e=[];for(const i of m){const s=this._getAttributeValues(u,i,t,a);e.push(s)}n.set(p,this._calculateUniqueValues(e,t,!F&&u.returnDistinctValues))}const i=n.get(p);if(!i)continue;const s=Object.keys(i);for(const r of s){const{count:s,data:n,items:l,itemPositions:c}=i[r],f=n.join(",");if(!d||u.validateItems(l,d)){const i=o.get(f)||{attributes:{}};if(F){i.aggregateGeometries||(i.aggregateGeometries={});const{aggregateGeometries:e,outStatisticFieldName:t}=await this._getAggregateGeometry(h,l);i.aggregateGeometries[t]=e}else{let r=null;if(_)r=s;else{const e=this._getAttributeValues(u,p,t,a),i=c.map((t=>e[t]));r=I&&"statisticParameters"in h?this._getPercentileValue(h,i):this._getStatisticValue(h,i,null,u.returnDistinctValues)}i.attributes[e]=r}let r=0;m.forEach(((e,t)=>i.attributes[this.fieldsIndex.get(e)?e:"EXPR_"+ ++r]=n[t])),o.set(f,i)}}}else if(F){i.aggregateGeometries||(i.aggregateGeometries={});const{aggregateGeometries:e,outStatisticFieldName:s}=await this._getAggregateGeometry(h,t);i.aggregateGeometries[s]=e}else{const s=this._getAttributeValues(u,p,t,a);i.attributes[e]=I&&"statisticParameters"in h?this._getPercentileValue(h,s):this._getStatisticValue(h,s,r,u.returnDistinctValues)}const V="min"!==c&&"max"!==c||!T(this.fieldsIndex.get(p))&&!this._isAnyDateField(p)?null:this.fieldsIndex.get(p)?.type;s.push({name:e,alias:e,type:V||"esriFieldTypeDouble"})}const I=y?Array.from(o.values()):[i];return this._sortFeatures(I,h,((e,t)=>e.attributes[t])),p&&(I.length=Math.min(p,I.length)),{fields:s,features:I}}_isAnyDateField(e){const t=this.fieldsIndex.get(e);return y(t)||g(t)||x(t)||I(t)}async _getAggregateGeometry(e,r){const{convexHull:n,union:o}=await import("../../../geometry/geometryEngineJSON.js"),{statisticType:l,outStatisticFieldName:u}=e,{featureAdapter:m,spatialReference:d,geometryType:h,hasZ:p,hasM:f}=this,y=r.map((e=>c(h,p,f,m.getGeometry(e)))),g=n(d,y,!0)[0],x={aggregateGeometries:null,outStatisticFieldName:null};if("EnvelopeAggregate"===l){const e=g?s(g):a(o(d,y));x.aggregateGeometries={...e,spatialReference:d},x.outStatisticFieldName=u||"extent"}else if("CentroidAggregate"===l){const e=g?t(g):i(a(o(d,y)));x.aggregateGeometries={x:e[0],y:e[1],spatialReference:d},x.outStatisticFieldName=u||"centroid"}else"ConvexHullAggregate"===l&&(x.aggregateGeometries=g,x.outStatisticFieldName=u||"convexHull");return x}_getStatisticValue(e,t,i,s){const{onStatisticField:a,statisticType:r}=e;let n=null;n=i?.has(a)?i.get(a):T(this.fieldsIndex.get(a))||this._isAnyDateField(a)?R({values:t,returnDistinct:s}):B({values:s?[...new Set(t)]:t,minValue:null,maxValue:null,useSampleStdDev:!0}),i&&i.set(a,n);return n["var"===r?"variance":r]}_getPercentileValue(e,t){const{onStatisticField:i,statisticParameters:s,statisticType:a}=e,{value:r,orderBy:n}=s,o=this.fieldsIndex.get(i);return q(t,{value:r,orderBy:n,fieldType:o?.type,isDiscrete:"percentile_disc"===a})}_getAttributeValues(e,t,i,s){if(s.has(t))return s.get(t);const a=this.fieldsIndex.get(t),r=i.map((i=>e.getFieldValue(i,t,a)));return s.set(t,r),r}_calculateUniqueValues(e,t,i){const s={},a=t.length;for(let r=0;r<a;r++){const a=t[r],n=[];for(const t of e)n.push(t[r]);const o=n.join(",");null==s[o]?s[o]={count:1,data:n,items:[a],itemPositions:[r]}:(i||s[o].count++,s[o].items.push(a),s[o].itemPositions.push(r))}return s}async _getDataValues(t,i,s=!0){const a=new l(this.query,this.featureAdapter,this.fieldsIndex),{valueExpression:r,scale:n,timeZone:o}=t;return r?a.getExpressionValues(i,r,{viewingMode:"map",scale:n,spatialReference:this.query.outSR||this.spatialReference},{geometryType:this.geometryType,hasZ:this.hasZ,hasM:this.hasM},o):a.getDataValues(i,e(t),s)}async _calculateHistogramBins(e,t,i){if(null==t.min&&null==t.max)return[];const s=t.intervals,a=t.min??0,r=t.max??0,n=s.map((([e,t])=>({minValue:e,maxValue:t,count:0,items:[]})));for(let o=0;o<e.length;o++){const t=e[o],l=i[o];if(null!=t&&t>=a&&t<=r){const e=Z(s,t);e>-1&&(n[e].count++,n[e].items.push(l))}}return n}async createQueryBinsResponse(e){const t=e.bin?.splitBy;if(!t)return this._createBinsResponse(e);const{value:i,outAlias:s,valueType:a}=t,r=[],n=[{name:s??i,alias:s??i,type:a??"esriFieldTypeString"},{name:C,alias:C,type:"esriFieldTypeInteger"}],o=new l(e,this.featureAdapter,this.fieldsIndex),u=new Map,c=[...this.items];this._sortFeatures(c,[i],((e,t,i)=>o.getFieldValue(e,t,i)));const m=this._getAttributeValues(o,i,c,u),d=this._calculateUniqueValues([m],c,o.returnDistinctValues);for(const l in d){const{items:t}=d[l],a=await this._createBinsResponse(e,t);if(r.push(...a.features.map((e=>({...e,attributes:{...e.attributes,[s??i]:l}})))),a.fields)for(const e of a.fields)n.some((t=>t.name===e.name))||n.push(e)}return{fields:n,features:r}}async _createBinsResponse(e,t){const i=e.bin;switch(t=t??this.items,i.type){case"autoIntervalBin":return this._createAutoIntervalBinsResponse(F.fromJSON(i),e,t);case"dateBin":return this._createDateBinsResponse(_.fromJSON(i),e,t);case"fixedBoundariesBin":return this._createFixedBoundariesBinsResponse(b.fromJSON(i),e,t);case"fixedIntervalBin":return this._createFixedIntervalBinsResponse(v.fromJSON(i),e,t)}}async _createAutoIntervalBinsResponse(e,t,i){const{field:s,normalizationField:a,numBins:r,normalizationType:n,normalizationTotal:o,start:l,end:u}=e,c=await this._getDataValues({field:e.field,normalizationField:e.normalizationField,normalizationType:e.normalizationType,normalizationTotal:e.normalizationTotal,timeZone:t.outTimeReference?.ianaTimeZone},i),m=j(c,{field:s,normalizationField:a,normalizationType:n,normalizationTotal:o,numBins:r,minValue:h(l,!1),maxValue:h(u,!1)}),d=await this._calculateHistogramBins(c,m,i);return this._createFeaturesFromHistogramBins(d,t)}async _createDateBinsResponse(e,t,i){const{field:s,interval:a,start:r,end:n}=e,o=a.unit,l=await this._getDataValues({field:e.field,timeZone:t.outTimeReference?.ianaTimeZone},i),u=I(this.fieldsIndex.get(s)),c=V.toJSON(o),m=l.filter(Boolean).sort(((e,t)=>e-t)),d=null!=r?h(r,u):m[0],p=null!=n?h(n,u):m[m.length-1],f=t.outTimeReference?.ianaTimeZone??"UTC";let y=G.fromMillis(d,{zone:f}).startOf(c);const g=G.fromMillis(p,{zone:f}),x=[];for(;y<g;){const e=y.plus({[c]:a.value});if(e>g){x.push([y.toMillis(),g.toMillis()]);break}x.push([y.toMillis(),e.toMillis()]),y=e}const T=await this._calculateHistogramBins(l,{intervals:x,min:d,max:p},i);return this._createFeaturesFromHistogramBins(T,t)}async _createFixedBoundariesBinsResponse(e,t,i){const{field:s}=e,a=await this._getDataValues({field:s,timeZone:t.outTimeReference?.ianaTimeZone},i),r=I(this.fieldsIndex.get(s)),n=e.boundaries.map((e=>h(e,r))).sort(((e,t)=>e-t)),o=[];for(let c=0;c<n.length-1;c++)o.push([n[c],n[c+1]]);const l={intervals:o,min:n.at(0),max:n.at(-1)},u=await this._calculateHistogramBins(a,l,i);return this._createFeaturesFromHistogramBins(u,t)}async _createFixedIntervalBinsResponse(e,t,i){const{field:s,interval:a,start:r,end:n}=e,o=await this._getDataValues({field:e.field,normalizationField:e.normalizationField,normalizationType:e.normalizationType,normalizationTotal:e.normalizationTotal,timeZone:t.outTimeReference?.ianaTimeZone},i),l=I(this.fieldsIndex.get(s)),u=j(o,{field:s,classificationMethod:"defined-interval",definedInterval:a,minValue:h(r,l),maxValue:h(n,l)},!0),c=await this._calculateHistogramBins(o,u,i);return this._createFeaturesFromHistogramBins(c,t)}async _createFeaturesFromHistogramBins(e,t){const{upperBoundaryAlias:i,lowerBoundaryAlias:s}=t,a=s||"lowerBoundary",r=i||"upperBoundary",n=[],o=[{name:a,alias:a,type:"esriFieldTypeDouble"},{name:r,alias:r,type:"esriFieldTypeDouble"}],l=t.bin?.stackBy?.value,u=t.bin?.stackBy?.outAlias;l&&o.push({name:C,alias:C,type:"esriFieldTypeInteger"},{name:u??l,alias:u??l,type:"esriFieldTypeString"});let c=0;const m="dateBin"===t.bin.type,d=t.outTimeReference?.ianaTimeZone;for(const h of e){const{minValue:e,maxValue:i,items:s}=h,p={attributes:{}};let f;if(p.attributes[a]=m&&d&&null!=e?G.fromMillis(e,{zone:d}).toISO():e,p.attributes[r]=m&&d&&null!=i?G.fromMillis(i,{zone:d}).toISO():i,l?(f=await this._createStatisticsQueryResponse({...t,groupByFieldsForStatistics:[l],orderByFields:[l]},s),p.attributes[C]=++c,"flat"===t.bin.jsonStyle?n.push(...f.features.map((({attributes:{EXPR_1:e,...t},...i})=>({...i,attributes:u??e?{...t,[u??e]:e,...p.attributes}:{...t,...p.attributes}})))):(p.stackedAttributes=f.features.map((({attributes:{EXPR_1:e,...t}})=>u??e?{...t,[u??e]:e}:t)),n.push(p))):(t.bin?.splitBy&&(p.attributes[C]=++c),f=await this._createStatisticsQueryResponse(t,s,p),n.push(p)),f.fields)for(const t of f.fields)o.some((e=>e.name===t.name))||o.push(t)}return"desc"===t.binOrder&&n.reverse(),{fields:o,features:n}}}function O(e,t,i,s){const a=s.x-i.x,r=s.y-i.y,n=t.x-i.x,o=t.y-i.y,l=a*a+r*r;if(0===l)return!1;const u=n*a+o*r,c=Math.min(1,Math.max(0,u/l));return e.x=i.x+a*c,e.y=i.y+r*c,!0}function H(e,t){return e?t?4:3:t?3:2}class U{constructor(e,t){this.coords=e,this.coordsIndex=t}get x(){return this.coords[this.coordsIndex]}get y(){return this.coords[this.coordsIndex+1]}get z(){return this.coords[this.coordsIndex+2]}}const Q=[1];export{E as QueryEngineResult};
@@ -2,4 +2,4 @@
2
2
  All material copyright ESRI, All Rights Reserved, unless otherwise specified.
3
3
  See https://js.arcgis.com/4.33/esri/copyright.txt for details.
4
4
  */
5
- import e from"../../../core/Error.js";import{validateFields as t,validateWhere as i,validateHaving as s,numericFieldTypes as r,allDateAndTimeFieldTypes as o}from"./attributeSupport.js";import{checkProjectionSupport as n}from"./projectionSupport.js";import{checkSpatialQuerySupport as a}from"./spatialQuerySupport.js";import{loadArcade as l}from"../../../support/loadArcade.js";const u="unsupported-query";async function p(t,i){const s=t.bin;if(!s.onField&&!s.onExpression?.value||"autoIntervalBin"===s.type&&null==s.parameters.numberOfBins||"dateBin"===s.type&&(null==s.parameters.number||null==s.parameters.unit)||"fixedBoundariesBin"===s.type&&null==s.parameters.boundaries||"fixedIntervalBin"===s.type&&null==s.parameters.interval)throw new e(u,"Unsupported query options",{query:t});return c(t,i)}async function c(t,{fieldsIndex:i,geometryType:s,spatialReference:r,availableFields:o}){if(null!=t.geometryPrecision||t.multipatchOption&&"xyFootprint"!==t.multipatchOption||t.pixelSize||t.relationParam||t.text)throw new e(u,"Unsupported query options",{query:t});return d(i,o,t),m(i,o,t),Promise.all([a(t,s,r),n(r,t.outSR)]).then((()=>t))}function d(s,r,o){const{outFields:n,orderByFields:a,returnDistinctValues:l,outStatistics:p}=o,c=p?p.map((e=>e.outStatisticFieldName&&e.outStatisticFieldName.toLowerCase())).filter(Boolean):[];if(a&&a.length>0){const e=" asc",i=" desc",n=a.map((t=>{const s=t.toLowerCase();return s.includes(e)?s.split(e)[0]:s.includes(i)?s.split(i)[0]:t})).filter((e=>!c.includes(e)));t(s,r,n,{expressionName:"orderByFields",query:o})}if(n&&n.length>0)t(s,r,n,{expressionName:"outFields",query:o,allowedFieldTypes:"all"});else if(l)throw new e(u,"outFields should be specified for returnDistinctValues",{query:o});i(s,r,o.where,o)}const f=new Set([...r,...o]);function m(i,r,o){const{outStatistics:n,groupByFieldsForStatistics:a,having:l}=o,p=a?.length,c=n?.length;if(l){if(!p||!c)throw new e(u,"outStatistics and groupByFieldsForStatistics should be specified with having",{query:o});s(i,r,l,n,o)}if(c){if(!F(n))return;const s=n.map((e=>e.onStatisticField)).filter(Boolean);t(i,r,s,{expressionName:"onStatisticFields",query:o}),p&&t(i,r,a,{expressionName:"groupByFieldsForStatistics",query:o});for(const a of n){const{onStatisticField:s,statisticType:n}=a;if(("percentile_disc"===n||"percentile_cont"===n)&&"statisticParameters"in a){const{statisticParameters:t}=a;if(!t)throw new e(u,"statisticParameters should be set for percentile type",{definition:a,query:o})}else i.get(s)&&"count"!==n&&"min"!==n&&"max"!==n&&t(i,r,[s],{expressionName:`outStatistics with '${n}' statistic type`,allowedFieldTypes:f,query:o})}}}async function y(t,i,{fieldsIndex:s,geometryType:r,spatialReference:o,availableFields:l}){if(null!=t.geometryPrecision||t.multipatchOption||t.pixelSize||t.relationParam||t.text||t.outStatistics||t.groupByFieldsForStatistics||t.having||t.orderByFields)throw new e(u,"Unsupported query options",{query:t});return d(s,l,t),Promise.all([h(s,l,i,t),a(t,r,o),n(o,t.outSR)]).then((()=>t))}async function h(i,s,r,o){let n=[];if(r.valueExpression){const{arcadeUtils:e}=await l();n=e.extractFieldNames(r.valueExpression)}if(r.field&&n.push(r.field),r.field2&&n.push(r.field2),r.field3&&n.push(r.field3),r.normalizationField&&n.push(r.normalizationField),!n.length&&!r.valueExpression)throw new e(u,"field or valueExpression is required",{params:r});t(i,s,n,{expressionName:"statistics",query:o})}function F(e){return null!=e&&e.every((e=>"exceedslimit"!==e.statisticType))}export{p as validateAttributeBinsQuery,c as validateQuery,y as validateStatisticsQuery};
5
+ import e from"../../../core/Error.js";import{validateFields as t,validateWhere as i,validateHaving as s,numericFieldTypes as r,allDateAndTimeFieldTypes as o}from"./attributeSupport.js";import{checkProjectionSupport as n}from"./projectionSupport.js";import{checkSpatialQuerySupport as a}from"./spatialQuerySupport.js";import{loadArcade as l}from"../../../support/loadArcade.js";const u="unsupported-query";async function p(t,i){const s=t.bin;if(!s.onField&&!s.onExpression?.value||"autoIntervalBin"===s.type&&null==s.parameters.numberOfBins||"dateBin"===s.type&&(null==s.parameters.number||null==s.parameters.unit)||"fixedBoundariesBin"===s.type&&null==s.parameters.boundaries||"fixedIntervalBin"===s.type&&null==s.parameters.interval)throw new e(u,"Unsupported query options",{query:t});return d(t,i)}async function d(t,{fieldsIndex:i,geometryType:s,spatialReference:r,availableFields:o}){if(null!=t.geometryPrecision||t.multipatchOption&&"xyFootprint"!==t.multipatchOption||t.pixelSize||t.relationParam||t.text)throw new e(u,"Unsupported query options",{query:t});return c(i,o,t),m(i,o,t),Promise.all([a(t,s,r),n(r,t.outSR)]).then((()=>t))}function c(s,r,o){const{returnDistinctValues:n,outStatistics:a}=o,l=a?a.map((e=>e.outStatisticFieldName&&e.outStatisticFieldName.toLowerCase())).filter(Boolean):[];if("orderByFields"in o&&o.orderByFields&&o.orderByFields.length>0){const e=" asc",i=" desc",n=o.orderByFields.map((t=>{const s=t.toLowerCase();return s.includes(e)?s.split(e)[0]:s.includes(i)?s.split(i)[0]:t})).filter((e=>!l.includes(e)));t(s,r,n,{expressionName:"orderByFields",query:o})}if("outFields"in o)if(o.outFields?.length)t(s,r,o.outFields,{expressionName:"outFields",query:o,allowedFieldTypes:"all"});else if(n)throw new e(u,"outFields should be specified for returnDistinctValues",{query:o});i(s,r,o.where,o)}const f=new Set([...r,...o]);function m(i,r,o){const{outStatistics:n,groupByFieldsForStatistics:a,having:l}=o,p=a?.length,d=n?.length;if(l){if(!p||!d)throw new e(u,"outStatistics and groupByFieldsForStatistics should be specified with having",{query:o});s(i,r,l,n,o)}if(d){if(!h(n))return;const s=n.map((e=>e.onStatisticField)).filter(Boolean);t(i,r,s,{expressionName:"onStatisticFields",query:o}),p&&t(i,r,a,{expressionName:"groupByFieldsForStatistics",query:o});for(const a of n){const{onStatisticField:s,statisticType:n}=a;if(("percentile_disc"===n||"percentile_cont"===n)&&"statisticParameters"in a){const{statisticParameters:t}=a;if(!t)throw new e(u,"statisticParameters should be set for percentile type",{definition:a,query:o})}else i.get(s)&&"count"!==n&&"min"!==n&&"max"!==n&&t(i,r,[s],{expressionName:`outStatistics with '${n}' statistic type`,allowedFieldTypes:f,query:o})}}}async function y(t,i,{fieldsIndex:s,geometryType:r,spatialReference:o,availableFields:l}){if(null!=t.geometryPrecision||t.multipatchOption||t.pixelSize||t.relationParam||t.text||t.outStatistics||t.groupByFieldsForStatistics||t.having||t.orderByFields)throw new e(u,"Unsupported query options",{query:t});return c(s,l,t),Promise.all([F(s,l,i,t),a(t,r,o),n(o,t.outSR)]).then((()=>t))}async function F(i,s,r,o){let n=[];if(r.valueExpression){const{arcadeUtils:e}=await l();n=e.extractFieldNames(r.valueExpression)}if(r.field&&n.push(r.field),r.field2&&n.push(r.field2),r.field3&&n.push(r.field3),r.normalizationField&&n.push(r.normalizationField),!n.length&&!r.valueExpression)throw new e(u,"field or valueExpression is required",{params:r});t(i,s,n,{expressionName:"statistics",query:o})}function h(e){return null!=e&&e.every((e=>"exceedslimit"!==e.statisticType))}export{p as validateAttributeBinsQuery,d as validateQuery,y as validateStatisticsQuery};
@@ -2,4 +2,4 @@
2
2
  All material copyright ESRI, All Rights Reserved, unless otherwise specified.
3
3
  See https://js.arcgis.com/4.33/esri/copyright.txt for details.
4
4
  */
5
- import{id as e}from"../../kernel.js";import{resultOrAbort as t}from"../../core/asyncUtils.js";import r from"../../core/Error.js";import{JSONMap as n}from"../../core/jsonMap.js";import{parseWhereClause as o}from"../../core/sql.js";import{normalizeGlobalID as i}from"../../core/uuid.js";import{createTypeReader as s}from"../../core/accessorSupport/extensions/serializableProperty/reader.js";import{CodedValue as a}from"./CodedValue.js";import u from"./CodedValueDomain.js";import{queryAllJSON as c}from"./featureQueryAll.js";import{isStringField as l,isIntegerField as p}from"./fieldUtils.js";import{getOwningPortalUrl as d,isLayerWithFeatureCapabilities as f}from"./layerUtils.js";import y from"../../renderers/SimpleRenderer.js";import m from"../../renderers/UniqueValueRenderer.js";import h from"../../rest/support/AttachmentQuery.js";import{normalizationTypeJsonMap as w}from"../../rest/support/NormalizationBinParametersMixin.js";import b from"../../rest/support/Query.js";import g from"../../rest/support/RelationshipQuery.js";import{symbolTypesRenderer as I}from"../../symbols/support/typeUtils.js";const j=new n({esriGeometryPoint:"point",esriGeometryMultipoint:"multipoint",esriGeometryPolyline:"polyline",esriGeometryPolygon:"polygon",esriGeometryMultiPatch:"multipatch"});async function F(e,t,n,o){const i=await $(e);if(await x(e,t,o),!i.addAttachment)throw new r(o,"Layer source does not support addAttachment capability");return i.addAttachment(t,n)}function x(e,t,n){const{attributes:o}=t,{objectIdField:i}=e;return e.capabilities?.data?.supportsAttachment?t?o?i&&o[i]?Promise.resolve():Promise.reject(new r(n,`feature is missing the identifying attribute ${i}`)):Promise.reject(new r(n,"'attributes' are required on a feature to query attachments")):Promise.reject(new r(n,"A feature is required to add/delete/update attachments")):Promise.reject(new r(n,"this layer doesn't support attachments"))}async function P(e,t,n,o,i){const s=await $(e);if(await x(e,t,i),!s.updateAttachment)throw new r(i,"Layer source does not support updateAttachment capability");return s.updateAttachment(t,n,o)}async function q(e,t,r){const{applyEdits:n}=await import("../graphics/editingSupport.js"),o=await e.load();let i=r;return"feature"===o.type&&o.infoFor3D&&null!=t.deleteFeatures&&null!=o.globalIdField&&(i={...i,globalIdToObjectId:await ne(o,t.deleteFeatures,o.globalIdField)}),n(o,o.source,t,r)}async function S(e,t,r){const{uploadAssets:n}=await import("../graphics/editingSupport.js"),o=await e.load();return n(o,o.source,t,r)}async function v(e,t,n,o){const i=await $(e);if(await x(e,t,o),!i.deleteAttachments)throw new r(o,"Layer source does not support deleteAttachments capability");return i.deleteAttachments(t,n)}async function O(e,t,n){const o=(await e.load({signal:t?.signal})).source;if(!o.fetchRecomputedExtents)throw new r(n,"Layer source does not support fetchUpdates capability");return o.fetchRecomputedExtents(t)}async function A(e,t,n,o){t=h.from(t),await e.load();const i=e.source,s=e.capabilities;if(!s?.data?.supportsAttachment)throw new r(o,"this layer doesn't support attachments");const{attachmentTypes:a,objectIds:u,globalIds:c,num:l,size:p,start:d,where:f}=t;if(!s?.operations?.supportsQueryAttachments){if(a?.length>0||c?.length>0||p?.length>0||l||d||f)throw new r(o,"when 'capabilities.operations.supportsQueryAttachments' is false, only objectIds is supported",t)}if(!(u?.length||c?.length||f))throw new r(o,"'objectIds', 'globalIds', or 'where' are required to perform attachment query",t);if(!i.queryAttachments)throw new r(o,"Layer source does not support queryAttachments capability",t);return!s?.attachment?.supportsOrderByFields&&t.orderByFields?.length&&((t=t.clone()).orderByFields=null),i.queryAttachments(t)}async function L(e,t,n,o){const i=await $(e);if(!i.queryObjectIds)throw new r(o,"Layer source does not support queryObjectIds capability");return i.queryObjectIds(b.from(t)??e.createQuery(),n)}async function E(e,t,n,o){const i=await $(e);if(!i.queryFeatureCount)throw new r(o,"Layer source does not support queryFeatureCount capability");return i.queryFeatureCount(b.from(t)??e.createQuery(),n)}async function D(e,t,n,o){const i=await $(e);if(!i.queryExtent)throw new r(o,"Layer source does not support queryExtent capability");return i.queryExtent(b.from(t)??e.createQuery(),n)}async function T(e,t,n,o){const i=await $(e);if(!i.queryRelatedFeatures)throw new r(o,"Layer source does not support queryRelatedFeatures capability");return i.queryRelatedFeatures(g.from(t),n)}async function C(e,t,n,o){const i=await $(e);if(!i.queryRelatedFeaturesCount)throw new r(o,"Layer source does not support queryRelatedFeaturesCount capability");return i.queryRelatedFeaturesCount(g.from(t),n)}async function B(e){const t=e.source;if(t?.refresh)try{const{dataChanged:r,updates:n}=await t.refresh();if(null!=n&&(e.sourceJSON={...e.sourceJSON,...n},e.read(n,{origin:"service",url:e.parsedUrl})),r)return!0}catch{}if(e.definitionExpression)try{return(await o(e.definitionExpression,e.fieldsIndex)).hasDateFunctions}catch{}return!1}function R(e){const t=new b;t.historicMoment=e.historicMoment,t.gdbVersion=e.gdbVersion,t.returnGeometry=!0,t.outFields=["*"],t.multipatchOption="multipatch"===e.geometryType?"xyFootprint":null;const r=e.capabilities?.query;r&&(t.compactGeometryEnabled=r.supportsCompactGeometry,t.defaultSpatialReferenceEnabled=r.supportsDefaultSpatialReference);const n=e.capabilities?.data;n?.supportsZ&&null!=e.returnZ&&(t.returnZ=e.returnZ),n?.supportsM&&null!=e.returnM&&(t.returnM=e.returnM);const{timeOffset:o,timeExtent:i}=e;return t.timeExtent=null!=o&&null!=i?i.offset(-o.value,o.unit):i||null,t}function M(e){const{globalIdField:t,fields:r}=e;if(t)return t;if(r)for(const n of r)if("esriFieldTypeGlobalID"===n.type)return n.name}function k(e){const{objectIdField:t,fields:r}=e;if(t)return t;if(r)for(const n of r)if("esriFieldTypeOID"===n.type)return n.name}function z(e){return e.currentVersion?e.currentVersion:e.hasOwnProperty("capabilities")||e.hasOwnProperty("drawingInfo")||e.hasOwnProperty("hasAttachments")||e.hasOwnProperty("htmlPopupType")||e.hasOwnProperty("relationships")||e.hasOwnProperty("timeInfo")||e.hasOwnProperty("typeIdField")||e.hasOwnProperty("types")?10:9.3}function N(e,t,r,n){const o=r?.feature,i=!!e.subtypes?.length;if(i&&!r?.excludeImpliedDomains){const r=V(e,t);if(r)return r}const s=i&&U(e,o);if(s){const e=s?.domains?.[t];return"inherited"===e?.type?n:e}const a=oe(e.types,e.typeIdField,o);if(a){const e=a.domains&&a.domains[t];if(e&&"inherited"!==e?.type)return e}if(n)return n;if(!r?.excludeImpliedDomains){const r=G(e,t);if(r)return r}return null}function U(e,t){const{subtypes:r,subtypeField:n}=e;if(!t?.attributes||!r?.length||!n)return null;const o=t.attributes[n];return null==o?null:r.find((e=>e.code===o))}function V(e,t){const{fieldsIndex:r,subtypeField:n}=e,{name:o,type:i}=r.get(t)??{};if(!o)return null;if((n&&r.get(n)?.name)===o&&e.subtypes?.length){const t=e.subtypes.map((e=>new a({code:Q(e.code,i),name:e.name})));if(t?.length)return new u({codedValues:t})}return null}function G(e,t){const{fieldsIndex:r}=e,{name:n,type:o}=r.get(t)??{};if(!n)return null;if(("typeIdField"in e?r.get(e.typeIdField)?.name:null)===n&&"types"in e&&e.types?.length){const t=e.types.map((e=>new a({code:Q(e.id,o),name:e.name})));return new u({codedValues:t})}return null}function Q(e,t){return t?l({type:t})&&"number"==typeof e?`${e}`:p({type:t})&&"string"==typeof e?Number.parseInt(e,10):e:e}async function $(e){return(await e.load()).source}async function J(t,r){if(!e)return;const n=e.findCredential(t);if(n)return n.userId;let o;try{const n=await d(t,r);n&&(o=await e.checkSignInStatus(`${n}/sharing`))}catch(i){}return o?o.userId:null}async function Z(t,r){if(!e)return;if(e.findCredential(t))return;let n;try{const o=await d(t,r);o&&(n=await e.checkSignInStatus(`${o}/sharing`))}catch(o){}if(n)try{const n=null!=r?r.signal:null;await e.getCredential(t,{signal:n})}catch(o){}}async function H(e,t,r){const n=e.parsedUrl?.path;n&&e.authenticationTriggerEvent===t&&await Z(n,r)}async function W(e){const t=e.parsedUrl?.path;t&&_(e)&&await Z(t)}function _(e){return K(e)&&("serviceDefinitionExpression"in e&&X(e.serviceDefinitionExpression)||"definitionExpression"in e&&X(e.definitionExpression))}function K(e){return!(!f(e)||!e.capabilities?.query.supportsCurrentUser)}function X(e){return!!e?.toLowerCase().includes("current_user")}function Y(e){return!ie(e)&&(e.userHasUpdateItemPrivileges||e.editingEnabled)}const ee=s({types:I});function te(e,t){if(e.defaultSymbol)return e.types?.length?new m({defaultSymbol:ee(e.defaultSymbol,e,t),field:e.typeIdField,uniqueValueInfos:e.types.map((e=>({id:e.id,symbol:ee(e.symbol,e,t)})))}):new y({symbol:ee(e.defaultSymbol,e,t)})}function re(e){let t=e.sourceJSON?.cacheMaxAge;if(!t)return!1;const r=e.editingInfo?.lastEditDate?.getTime();return null==r||(t*=1e3,Date.now()-r<t)}async function ne(e,r,n){if(null==r)return null;const o=[],{objectIdField:s}=e;if(r.forEach((e=>{let t=null;if("attributes"in e){const{attributes:r}=e;t={globalId:r[n],objectId:null!=r[s]&&-1!==r[s]?r[s]:null}}else t={globalId:e.globalId,objectId:null!=e.objectId&&-1!==e.objectId?e.objectId:null};null!=t.globalId&&(null!=t.objectId&&-1!==t.objectId||o.push(t.globalId))})),0===o.length)return null;const a=e.createQuery();a.where=o.map((e=>`${n}='${e}'`)).join(" OR "),a.returnGeometry=!1,a.outFields=[s,n],a.cacheHint=!1;const u=await t(c(e,a));if(!u.ok)return null;const l=new Map,p=u.value.features;for(const t of p){const e=t.attributes[n],r=t.attributes[s];null!=e&&null!=r&&-1!==r&&l.set(i(e),r)}return l}function oe(e,t,r){if(!t||!r||!e)return null;const n=r.getAttribute(t);return null==n?null:e.find((e=>{const{id:t}=e;return null!=t&&t.toString()===n.toString()}))??null}function ie(e){return e.sourceJSON?.isMultiServicesView||se(e)}function se(e){return!!e.sourceJSON?.capabilities?.toLowerCase().split(",").map((e=>e.trim())).includes("map")}function ae(e,t,n){const o=t?.queryAttributeBins;if(!o)throw new r(n,"Layer source does not support binning");switch(e.binParameters.type){case"auto-interval":if(!o.supportsAutoInterval)throw new r(n,"Layer source does not support auto-interval binning");if(e.binParameters.normalizationType&&(!o.supportsNormalization||!ue(e.binParameters.normalizationType,o.supportedNormalizationTypes)))throw new r(n,"Layer source does not support normalization binning");break;case"date":if(!o.supportsDate)throw new r(n,"Layer source does not support date binning");if(e.binParameters.snapToData&&!o.supportsSnapToData)throw new r(n,"Layer source does not support snapToData binning");if(e.binParameters.returnFullIntervalBin&&!o.supportsReturnFullIntervalBin)throw new r(n,"Layer source does not support returnFullIntervalBin binning");break;case"fixed-boundaries":if(!o.supportsFixedBoundaries)throw new r(n,"Layer source does not support fixed-boundaries binning");break;case"fixed-interval":if(!o.supportsFixedInterval)throw new r(n,"Layer source does not support fixed-interval binning");if(e.binParameters.normalizationType&&(!o.supportsNormalization||!ue(e.binParameters.normalizationType,o.supportedNormalizationTypes)))throw new r(n,"Layer source does not support normalization binning")}if(e.binParameters.stackBy&&!o.supportsStackBy)throw new r(n,"Layer source does not support stackBy binning");if(e.binParameters.splitBy&&!o.supportsSplitBy)throw new r(n,"Layer source does not support splitBy binning");if(e.binParameters.firstDayOfWeek&&!o.supportsFirstDayOfWeek)throw new r(n,"Layer source does not support firstDayOfWeek binning");const i=o?.supportedStatistics;if(e.outStatistics&&i){const t=new Map([["count","count"],["sum","sum"],["min","min"],["max","max"],["avg","avg"],["stddev","stddev"],["var","var"],["percentile-continuous","percentileContinuous"],["percentile-discrete","percentileDiscrete"],["centroid-aggregate","centroid"],["convex-hull-aggregate","convexHull"],["envelope-aggregate","envelope"]]);for(const{statisticType:o}of e.outStatistics){const e=t.get(o);if(e&&!i[e])throw new r(n,`Layer source does not support ${o} statistic type`)}}}function ue(e,t){return null!=e&&!!t?.[w.toJSON(e)]}export{F as addAttachment,q as applyEdits,W as checkServiceCurrentUserSupport,V as computeDomainFromSubtypes,G as computeDomainFromTypes,Y as computeEffectiveEditingEnabled,te as createDefaultRenderer,R as createQuery,v as deleteAttachments,Z as ensureCredentialIfSignedIn,H as ensureLayerCredential,O as fetchRecomputedExtents,j as geometryTypeKebabDict,U as getFeatureSubtype,oe as getFeatureType,N as getFieldDomain,ne as getGlobalIdToObjectIdMap,J as getSignedInUser,X as hasCurrentUser,B as hasDataChanged,re as isLayerCacheStale,A as queryAttachments,D as queryExtent,E as queryFeatureCount,L as queryObjectIds,T as queryRelatedFeatures,C as queryRelatedFeaturesCount,M as readGlobalIdField,k as readObjectIdField,z as readVersion,ie as supportsQueryOnly,P as updateAttachment,S as uploadAssets,ae as validateBinsQuery};
5
+ import{id as e}from"../../kernel.js";import{resultOrAbort as t}from"../../core/asyncUtils.js";import r from"../../core/Error.js";import{JSONMap as n}from"../../core/jsonMap.js";import{parseWhereClause as o}from"../../core/sql.js";import{normalizeGlobalID as i}from"../../core/uuid.js";import{createTypeReader as s}from"../../core/accessorSupport/extensions/serializableProperty/reader.js";import{CodedValue as a}from"./CodedValue.js";import u from"./CodedValueDomain.js";import{queryAllJSON as c}from"./featureQueryAll.js";import{isStringField as l,isIntegerField as p}from"./fieldUtils.js";import{getOwningPortalUrl as d,isLayerWithFeatureCapabilities as f}from"./layerUtils.js";import y from"../../renderers/SimpleRenderer.js";import m from"../../renderers/UniqueValueRenderer.js";import h from"../../rest/support/AttachmentQuery.js";import{normalizationTypeJsonMap as w}from"../../rest/support/NormalizationBinParametersMixin.js";import b from"../../rest/support/Query.js";import g from"../../rest/support/RelationshipQuery.js";import{symbolTypesRenderer as I}from"../../symbols/support/typeUtils.js";const j=new n({esriGeometryPoint:"point",esriGeometryMultipoint:"multipoint",esriGeometryPolyline:"polyline",esriGeometryPolygon:"polygon",esriGeometryMultiPatch:"multipatch"});async function F(e,t,n,o){const i=await $(e);if(await x(e,t,o),!i.addAttachment)throw new r(o,"Layer source does not support addAttachment capability");return i.addAttachment(t,n)}function x(e,t,n){const{attributes:o}=t,{objectIdField:i}=e;return e.capabilities?.data?.supportsAttachment?t?o?i&&o[i]?Promise.resolve():Promise.reject(new r(n,`feature is missing the identifying attribute ${i}`)):Promise.reject(new r(n,"'attributes' are required on a feature to query attachments")):Promise.reject(new r(n,"A feature is required to add/delete/update attachments")):Promise.reject(new r(n,"this layer doesn't support attachments"))}async function P(e,t,n,o,i){const s=await $(e);if(await x(e,t,i),!s.updateAttachment)throw new r(i,"Layer source does not support updateAttachment capability");return s.updateAttachment(t,n,o)}async function q(e,t,r){const{applyEdits:n}=await import("../graphics/editingSupport.js"),o=await e.load();let i=r;return"feature"===o.type&&o.infoFor3D&&null!=t.deleteFeatures&&null!=o.globalIdField&&(i={...i,globalIdToObjectId:await ne(o,t.deleteFeatures,o.globalIdField)}),n(o,o.source,t,r)}async function S(e,t,r){const{uploadAssets:n}=await import("../graphics/editingSupport.js"),o=await e.load();return n(o,o.source,t,r)}async function v(e,t,n,o){const i=await $(e);if(await x(e,t,o),!i.deleteAttachments)throw new r(o,"Layer source does not support deleteAttachments capability");return i.deleteAttachments(t,n)}async function O(e,t,n){const o=(await e.load({signal:t?.signal})).source;if(!o.fetchRecomputedExtents)throw new r(n,"Layer source does not support fetchUpdates capability");return o.fetchRecomputedExtents(t)}async function A(e,t,n,o){t=h.from(t),await e.load();const i=e.source,s=e.capabilities;if(!s?.data?.supportsAttachment)throw new r(o,"this layer doesn't support attachments");const{attachmentTypes:a,objectIds:u,globalIds:c,num:l,size:p,start:d,where:f}=t;if(!s?.operations?.supportsQueryAttachments){if(a?.length>0||c?.length>0||p?.length>0||l||d||f)throw new r(o,"when 'capabilities.operations.supportsQueryAttachments' is false, only objectIds is supported",t)}if(!(u?.length||c?.length||f))throw new r(o,"'objectIds', 'globalIds', or 'where' are required to perform attachment query",t);if(!i.queryAttachments)throw new r(o,"Layer source does not support queryAttachments capability",t);return!s?.attachment?.supportsOrderByFields&&t.orderByFields?.length&&((t=t.clone()).orderByFields=null),i.queryAttachments(t)}async function L(e,t,n,o){const i=await $(e);if(!i.queryObjectIds)throw new r(o,"Layer source does not support queryObjectIds capability");return i.queryObjectIds(b.from(t)??e.createQuery(),n)}async function E(e,t,n,o){const i=await $(e);if(!i.queryFeatureCount)throw new r(o,"Layer source does not support queryFeatureCount capability");return i.queryFeatureCount(b.from(t)??e.createQuery(),n)}async function D(e,t,n,o){const i=await $(e);if(!i.queryExtent)throw new r(o,"Layer source does not support queryExtent capability");return i.queryExtent(b.from(t)??e.createQuery(),n)}async function T(e,t,n,o){const i=await $(e);if(!i.queryRelatedFeatures)throw new r(o,"Layer source does not support queryRelatedFeatures capability");return i.queryRelatedFeatures(g.from(t),n)}async function C(e,t,n,o){const i=await $(e);if(!i.queryRelatedFeaturesCount)throw new r(o,"Layer source does not support queryRelatedFeaturesCount capability");return i.queryRelatedFeaturesCount(g.from(t),n)}async function B(e){const t=e.source;if(t?.refresh)try{const{dataChanged:r,updates:n}=await t.refresh();if(null!=n&&(e.sourceJSON={...e.sourceJSON,...n},e.read(n,{origin:"service",url:e.parsedUrl})),r)return!0}catch{}if(e.definitionExpression)try{return(await o(e.definitionExpression,e.fieldsIndex)).hasDateFunctions}catch{}return!1}function R(e){const t=new b;t.historicMoment=e.historicMoment,t.gdbVersion=e.gdbVersion,t.returnGeometry=!0,t.outFields=["*"],t.multipatchOption="multipatch"===e.geometryType?"xyFootprint":null;const r=e.capabilities?.query;r&&(t.compactGeometryEnabled=r.supportsCompactGeometry,t.defaultSpatialReferenceEnabled=r.supportsDefaultSpatialReference);const n=e.capabilities?.data;n?.supportsZ&&null!=e.returnZ&&(t.returnZ=e.returnZ),n?.supportsM&&null!=e.returnM&&(t.returnM=e.returnM);const{timeOffset:o,timeExtent:i}=e;return t.timeExtent=null!=o&&null!=i?i.offset(-o.value,o.unit):i||null,t}function M(e){const{globalIdField:t,fields:r}=e;if(t)return t;if(r)for(const n of r)if("esriFieldTypeGlobalID"===n.type)return n.name}function k(e){const{objectIdField:t,fields:r}=e;if(t)return t;if(r)for(const n of r)if("esriFieldTypeOID"===n.type)return n.name}function z(e){return e.currentVersion?e.currentVersion:e.hasOwnProperty("capabilities")||e.hasOwnProperty("drawingInfo")||e.hasOwnProperty("hasAttachments")||e.hasOwnProperty("htmlPopupType")||e.hasOwnProperty("relationships")||e.hasOwnProperty("timeInfo")||e.hasOwnProperty("typeIdField")||e.hasOwnProperty("types")?10:9.3}function N(e,t,r,n){const o=r?.feature,i=!!e.subtypes?.length;if(i&&!r?.excludeImpliedDomains){const r=U(e,t);if(r)return r}const s=i&&Q(e,o);if(s){const e=s?.domains?.[t];return"inherited"===e?.type?n:e}const a=oe(e.types,e.typeIdField,o);if(a){const e=a.domains&&a.domains[t];if(e&&"inherited"!==e?.type)return e}if(n)return n;if(!r?.excludeImpliedDomains){const r=V(e,t);if(r)return r}return null}function Q(e,t){const{subtypes:r,subtypeField:n}=e;if(!t?.attributes||!r?.length||!n)return null;const o=t.attributes[n];return null==o?null:r.find((e=>e.code===o))}function U(e,t){const{fieldsIndex:r,subtypeField:n}=e,{name:o,type:i}=r.get(t)??{};if(!o)return null;if((n&&r.get(n)?.name)===o&&e.subtypes?.length){const t=e.subtypes.map((e=>new a({code:G(e.code,i),name:e.name})));if(t?.length)return new u({codedValues:t})}return null}function V(e,t){const{fieldsIndex:r}=e,{name:n,type:o}=r.get(t)??{};if(!n)return null;if(("typeIdField"in e?r.get(e.typeIdField)?.name:null)===n&&"types"in e&&e.types?.length){const t=e.types.map((e=>new a({code:G(e.id,o),name:e.name})));return new u({codedValues:t})}return null}function G(e,t){return t?l({type:t})&&"number"==typeof e?`${e}`:p({type:t})&&"string"==typeof e?Number.parseInt(e,10):e:e}async function $(e){return(await e.load()).source}async function J(t,r){if(!e)return;const n=e.findCredential(t);if(n)return n.userId;let o;try{const n=await d(t,r);n&&(o=await e.checkSignInStatus(`${n}/sharing`))}catch(i){}return o?o.userId:null}async function Z(t,r){if(!e)return;if(e.findCredential(t))return;let n;try{const o=await d(t,r);o&&(n=await e.checkSignInStatus(`${o}/sharing`))}catch(o){}if(n)try{const n=null!=r?r.signal:null;await e.getCredential(t,{signal:n})}catch(o){}}async function H(e,t,r){const n=e.parsedUrl?.path;n&&e.authenticationTriggerEvent===t&&await Z(n,r)}async function W(e){const t=e.parsedUrl?.path;t&&_(e)&&await Z(t)}function _(e){return K(e)&&("serviceDefinitionExpression"in e&&X(e.serviceDefinitionExpression)||"definitionExpression"in e&&X(e.definitionExpression))}function K(e){return!(!f(e)||!e.capabilities?.query.supportsCurrentUser)}function X(e){return!!e?.toLowerCase().includes("current_user")}function Y(e){return!ie(e)&&(e.userHasUpdateItemPrivileges||e.editingEnabled)}const ee=s({types:I});function te(e,t){if(e.defaultSymbol)return e.types?.length?new m({defaultSymbol:ee(e.defaultSymbol,e,t),field:e.typeIdField,uniqueValueInfos:e.types.map((e=>({id:e.id,symbol:ee(e.symbol,e,t)})))}):new y({symbol:ee(e.defaultSymbol,e,t)})}function re(e){let t=e.sourceJSON?.cacheMaxAge;if(!t)return!1;const r=e.editingInfo?.lastEditDate?.getTime();return null==r||(t*=1e3,Date.now()-r<t)}async function ne(e,r,n){if(null==r)return null;const o=[],{objectIdField:s}=e;if(r.forEach((e=>{let t=null;if("attributes"in e){const{attributes:r}=e;t={globalId:r[n],objectId:null!=r[s]&&-1!==r[s]?r[s]:null}}else t={globalId:e.globalId,objectId:null!=e.objectId&&-1!==e.objectId?e.objectId:null};null!=t.globalId&&(null!=t.objectId&&-1!==t.objectId||o.push(t.globalId))})),0===o.length)return null;const a=e.createQuery();a.where=o.map((e=>`${n}='${e}'`)).join(" OR "),a.returnGeometry=!1,a.outFields=[s,n],a.cacheHint=!1;const u=await t(c(e,a));if(!u.ok)return null;const l=new Map,p=u.value.features;for(const t of p){const e=t.attributes[n],r=t.attributes[s];null!=e&&null!=r&&-1!==r&&l.set(i(e),r)}return l}function oe(e,t,r){if(!t||!r||!e)return null;const n=r.getAttribute(t);return null==n?null:e.find((e=>{const{id:t}=e;return null!=t&&t.toString()===n.toString()}))??null}function ie(e){return e.sourceJSON?.isMultiServicesView||se(e)}function se(e){return!!e.sourceJSON?.capabilities?.toLowerCase().split(",").map((e=>e.trim())).includes("map")}function ae(e,t,n){const o=t?.queryAttributeBins;if(!t?.operations?.supportsQueryBins||!o)throw new r(n,"Layer source does not support binning");switch(e.binParameters.type){case"auto-interval":if(!o.supportsAutoInterval)throw new r(n,"Layer source does not support auto-interval binning");if(e.binParameters.normalizationType&&(!o.supportsNormalization||!ue(e.binParameters.normalizationType,o.supportedNormalizationTypes)))throw new r(n,"Layer source does not support normalization binning");break;case"date":if(!o.supportsDate)throw new r(n,"Layer source does not support date binning");if(e.binParameters.snapToData&&!o.supportsSnapToData)throw new r(n,"Layer source does not support snapToData binning");if(e.binParameters.returnFullIntervalBin&&!o.supportsReturnFullIntervalBin)throw new r(n,"Layer source does not support returnFullIntervalBin binning");break;case"fixed-boundaries":if(!o.supportsFixedBoundaries)throw new r(n,"Layer source does not support fixed-boundaries binning");break;case"fixed-interval":if(!o.supportsFixedInterval)throw new r(n,"Layer source does not support fixed-interval binning");if(e.binParameters.normalizationType&&(!o.supportsNormalization||!ue(e.binParameters.normalizationType,o.supportedNormalizationTypes)))throw new r(n,"Layer source does not support normalization binning")}if(e.binParameters.stackBy&&!o.supportsStackBy)throw new r(n,"Layer source does not support stackBy binning");if(e.binParameters.splitBy&&!o.supportsSplitBy)throw new r(n,"Layer source does not support splitBy binning");if(e.binParameters.firstDayOfWeek&&!o.supportsFirstDayOfWeek)throw new r(n,"Layer source does not support firstDayOfWeek binning");const i=o?.supportedStatistics;if(e.outStatistics&&i){const t=new Map([["count","count"],["sum","sum"],["min","min"],["max","max"],["avg","avg"],["stddev","stddev"],["var","var"],["percentile-continuous","percentileContinuous"],["percentile-discrete","percentileDiscrete"],["centroid-aggregate","centroid"],["convex-hull-aggregate","convexHull"],["envelope-aggregate","envelope"]]);for(const{statisticType:o}of e.outStatistics){const e=t.get(o);if(e&&!i[e])throw new r(n,`Layer source does not support ${o} statistic type`)}}}function ue(e,t){return null!=e&&!!t?.[w.toJSON(e)]}export{F as addAttachment,q as applyEdits,W as checkServiceCurrentUserSupport,U as computeDomainFromSubtypes,V as computeDomainFromTypes,Y as computeEffectiveEditingEnabled,te as createDefaultRenderer,R as createQuery,v as deleteAttachments,Z as ensureCredentialIfSignedIn,H as ensureLayerCredential,O as fetchRecomputedExtents,j as geometryTypeKebabDict,Q as getFeatureSubtype,oe as getFeatureType,N as getFieldDomain,ne as getGlobalIdToObjectIdMap,J as getSignedInUser,X as hasCurrentUser,B as hasDataChanged,re as isLayerCacheStale,A as queryAttachments,D as queryExtent,E as queryFeatureCount,L as queryObjectIds,T as queryRelatedFeatures,C as queryRelatedFeaturesCount,M as readGlobalIdField,k as readObjectIdField,z as readVersion,ie as supportsQueryOnly,P as updateAttachment,S as uploadAssets,ae as validateBinsQuery};