@arcgis/core 5.0.0-next.124 → 5.0.0-next.126

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 (181) hide show
  1. package/applications/Components/applySetUtils.d.ts +1 -1
  2. package/assets/esri/core/workers/RemoteClient.js +1 -1
  3. package/assets/esri/core/workers/chunks/{a327f36561f093dc0fab.js → 19fcc74d34cbbaa56a41.js} +1 -1
  4. package/assets/esri/core/workers/chunks/1ce46085095679386580.js +1 -0
  5. package/assets/esri/core/workers/chunks/{a2f38e86acf45272dbc2.js → 214323c62d6d3b603a00.js} +1 -1
  6. package/assets/esri/core/workers/chunks/215c54520d0da638fe57.js +1 -0
  7. package/assets/esri/core/workers/chunks/249630af2fb01257eb75.js +1 -0
  8. package/assets/esri/core/workers/chunks/3214763f268622f09986.js +1 -0
  9. package/assets/esri/core/workers/chunks/{18c05353d6d8950d1491.js → 36215b2c0b1020743458.js} +1 -1
  10. package/assets/esri/core/workers/chunks/{2badadf8032e166b34ec.js → 3f3c63420644f9522ab1.js} +1 -1
  11. package/assets/esri/core/workers/chunks/{7f70a41258b2a0157aa5.js → 3fa59195286af30932d9.js} +1 -1
  12. package/assets/esri/core/workers/chunks/41108f58f0f439ebba3f.js +1 -0
  13. package/assets/esri/core/workers/chunks/4fe210314813ea1f7a26.js +1 -0
  14. package/assets/esri/core/workers/chunks/52705ccbb452a3edb064.js +1 -0
  15. package/assets/esri/core/workers/chunks/54c545f44b7ce21fb604.js +1 -0
  16. package/assets/esri/core/workers/chunks/{cfdb17522112c52f81ad.js → 558e9fed2e58cbbf9947.js} +1 -1
  17. package/assets/esri/core/workers/chunks/56e3c34ebdee61ff4b33.js +1 -0
  18. package/assets/esri/core/workers/chunks/{b50d2d3379654de1f2f3.js → 58134617fb7530836b81.js} +1 -1
  19. package/assets/esri/core/workers/chunks/58c4be467a922fe37f01.js +1 -0
  20. package/assets/esri/core/workers/chunks/{f0582d8111ec825e1f9a.js → 651b46aeabf22ff53a38.js} +1 -1
  21. package/assets/esri/core/workers/chunks/{90316fb569389d48920f.js → 666f201d222c50ab8428.js} +1 -1
  22. package/assets/esri/core/workers/chunks/6988517cb09928fed0f8.js +1 -0
  23. package/assets/esri/core/workers/chunks/6bf7d8de86b9eb76f920.js +1 -0
  24. package/assets/esri/core/workers/chunks/6c0b7890c8eec7febe28.js +1 -0
  25. package/assets/esri/core/workers/chunks/{25267253ba578eba38cf.js → 754e4d0b8c1ad392bd83.js} +1 -1
  26. package/assets/esri/core/workers/chunks/7ec83fc059325e207825.js +1 -0
  27. package/assets/esri/core/workers/chunks/7f385e9c88df3395e678.js +1 -0
  28. package/assets/esri/core/workers/chunks/{66ed527cd8ad11d008be.js → 80d51d58db09b9f96cb5.js} +1 -1
  29. package/assets/esri/core/workers/chunks/81c758bdc07ed9d9a132.js +1 -0
  30. package/assets/esri/core/workers/chunks/{8670d9d11950f3c61b79.js → 83711695e16912e9b9c5.js} +1 -1
  31. package/assets/esri/core/workers/chunks/a143a6f8e2f21548b244.js +1 -0
  32. package/assets/esri/core/workers/chunks/a4947d5d2fa6b7bd399b.js +1 -0
  33. package/assets/esri/core/workers/chunks/{1f30558e3ad6ac68bdb8.js → b4203e488bb928ff8032.js} +1 -1
  34. package/assets/esri/core/workers/chunks/b4b16914950792c46bd3.js +1 -0
  35. package/assets/esri/core/workers/chunks/{360b3499e2a671c309ce.js → b6969a42602517a6ef1c.js} +1 -1
  36. package/assets/esri/core/workers/chunks/{1aa2187597f7c4adb67f.js → bcb254cb7297fec88679.js} +1 -1
  37. package/assets/esri/core/workers/chunks/{2d1a772abd730b61854f.js → bd2125e0a68378533641.js} +1 -1
  38. package/assets/esri/core/workers/chunks/{d76dfac06299cbd4f00e.js → c0b6706f86665cec85f8.js} +1 -1
  39. package/assets/esri/core/workers/chunks/{f114da7ef2b891184e77.js → c3c6d337ff53e5d921e8.js} +1 -1
  40. package/assets/esri/core/workers/chunks/{b5f68e1fdbaca3cd9c8d.js → c941b716ea3c13cabc80.js} +1 -1
  41. package/assets/esri/core/workers/chunks/c99f36159b5ed6f9267e.js +1 -0
  42. package/assets/esri/core/workers/chunks/cf4202ad468501ef24cf.js +1 -0
  43. package/assets/esri/core/workers/chunks/{e2dc7e6b84e9b38ef9fe.js → d2017b0b27b9e4ada922.js} +1 -1
  44. package/assets/esri/core/workers/chunks/{4742a8c19b86a5f859f0.js → d47ca631e109144b6ba9.js} +1 -1
  45. package/assets/esri/core/workers/chunks/{38124ee5119e614645c9.js → d78b2f85ec9212a973e8.js} +1 -1
  46. package/assets/esri/core/workers/chunks/{7cd4280d24b24045bd7e.js → d8adab2d55b39241b232.js} +1 -1
  47. package/assets/esri/core/workers/chunks/e0519f24430fecead87b.js +1 -0
  48. package/assets/esri/core/workers/chunks/e33f5780fb45ac7ca889.js +1 -0
  49. package/assets/esri/core/workers/chunks/{eb9e913fe0dfcc71cf92.js → e4611ebd7dba7692a914.js} +1 -1
  50. package/assets/esri/core/workers/chunks/{86f2ec2692363abc97d1.js → e52793690dff1a199647.js} +1 -1
  51. package/assets/esri/core/workers/chunks/{c13efb74aa4602f6a1ee.js → e56a10a475ce128b5fce.js} +1 -1
  52. package/assets/esri/core/workers/chunks/ea633a6a3b9ea8ce965d.js +1 -0
  53. package/assets/esri/core/workers/chunks/eae1c098c16e2faaf90d.js +1 -0
  54. package/assets/esri/core/workers/chunks/{8650fbe1db55b7280c00.js → ef4237dc7b67c9039826.js} +1 -1
  55. package/assets/esri/core/workers/chunks/f5f513997cde0ce0f2a2.js +1 -0
  56. package/assets/esri/core/workers/chunks/fcc8d0b60f7c2397e550.js +1 -0
  57. package/assets/esri/themes/base/widgets/_BasemapGallery.scss +1 -0
  58. package/assets/esri/themes/dark/main.css +1 -1
  59. package/assets/esri/themes/light/main.css +1 -1
  60. package/assets/esri/themes/light/view.css +1 -1
  61. package/chunks/OperatorProximityGeodesic.js +1 -1
  62. package/chunks/OperatorShapePreservingLength.js +1 -1
  63. package/chunks/OperatorShapePreservingProject.js +1 -1
  64. package/chunks/SpatialReference.js +1 -1
  65. package/chunks/containsOperator.js +1 -1
  66. package/chunks/disjointOperator.js +1 -1
  67. package/config.js +1 -1
  68. package/core/has.js +1 -1
  69. package/editing/sharedTemplates/SharedTemplateMetadata.d.ts +0 -31
  70. package/{layers/graphics/editingSupport.d.ts → editing/types.d.ts} +8 -8
  71. package/editing/types.js +2 -0
  72. package/geometry/operators/gx/operatorIntersection.js +1 -1
  73. package/geometry/operators/json/containsOperator.js +1 -1
  74. package/geometry/operators/json/disjointOperator.js +1 -1
  75. package/geometry/support/zscale.js +1 -1
  76. package/graphic/KnowledgeGraphGraphicOrigin.d.ts +0 -1
  77. package/graphic/LinkChartGraphicOrigin.js +1 -1
  78. package/interfaces.d.ts +60 -60
  79. package/kernel.js +1 -1
  80. package/layers/CSVLayer.d.ts +317 -540
  81. package/layers/CSVLayer.js +1 -1
  82. package/layers/FeatureLayer.d.ts +13 -13
  83. package/layers/FeatureLayer.js +1 -1
  84. package/layers/GeoJSONLayer.d.ts +4 -4
  85. package/layers/OrientedImageryLayer.d.ts +6 -6
  86. package/layers/SceneLayer.d.ts +2 -2
  87. package/layers/SubtypeGroupLayer.d.ts +5 -5
  88. package/layers/graphics/applyEditsUtils.js +1 -1
  89. package/layers/graphics/data/QueryEngineCapabilities.js +1 -1
  90. package/layers/graphics/editingSupport.js +1 -1
  91. package/layers/graphics/sources/FeatureLayerSource.js +1 -1
  92. package/layers/graphics/sources/OGCFeatureSource.js +1 -1
  93. package/layers/graphics/sources/support/CSVSourceWorker.js +1 -1
  94. package/layers/graphics/sources/support/ParquetSourceWorker.js +1 -1
  95. package/layers/graphics/sources/support/QueryTask.js +1 -1
  96. package/layers/mixins/ArcGISImageService.js +1 -1
  97. package/layers/mixins/EditBusLayer.d.ts +1 -1
  98. package/layers/raster/functions/ExtractBandFunction.js +1 -1
  99. package/layers/support/SubtypeSublayer.d.ts +5 -5
  100. package/layers/support/capabilities.js +1 -1
  101. package/layers/support/serviceCapabilitiesUtils.js +1 -1
  102. package/networks/support/Circuit.d.ts +11 -2
  103. package/networks/support/CircuitSection.d.ts +3 -2
  104. package/package.json +1 -1
  105. package/rest/featureService/FeatureService.js +1 -1
  106. package/rest/featureService/types.d.ts +7 -1
  107. package/rest/query/operations/editsZScale.js +1 -1
  108. package/support/revision.js +1 -1
  109. package/symbols/cim/CIMCursor.js +1 -1
  110. package/symbols/cim/CIMSymbolHelper.js +1 -1
  111. package/symbols/cim/placements/PlacementAlongLineSameSize.js +1 -1
  112. package/symbols/cim/placements/PlacementAtExtremities.js +1 -1
  113. package/symbols/cim/placements/PlacementAtMeasuredUnits.js +1 -1
  114. package/symbols/cim/placements/PlacementAtRatioPositions.js +1 -1
  115. package/symbols/cim/placements/PlacementOnLine.js +1 -1
  116. package/symbols/cim/placements/PlacementOnVertices.js +1 -1
  117. package/symbols/cim/types.d.ts +7 -0
  118. package/versionManagement/VersionManagementService.d.ts +3 -2
  119. package/views/2d/analysis/DistanceMeasurement/utils.js +1 -1
  120. package/views/2d/engine/webgl/shaders/sources/shaderRepository.js +1 -1
  121. package/views/3d/support/MemoryController.js +1 -1
  122. package/views/3d/support/orientedBoundingBox.js +1 -1
  123. package/views/3d/webgl-engine/collections/Component/Material/ComponentMaterial.js +1 -1
  124. package/views/3d/webgl-engine/lib/Viewshed.js +1 -1
  125. package/views/DOMContainer.js +1 -1
  126. package/views/draw/DrawOperation.js +1 -1
  127. package/views/draw/DrawTool.js +1 -1
  128. package/views/draw/plugins/BezierSegmentPlugin.js +1 -1
  129. package/views/draw/plugins/CircularArcSegmentPlugin.js +1 -1
  130. package/views/draw/plugins/FreehandSegmentPlugin.js +1 -1
  131. package/views/draw/plugins/MultipointPlugin.js +1 -1
  132. package/views/draw/plugins/PointPlugin.js +1 -1
  133. package/views/draw/plugins/PolygonPlugin.js +1 -1
  134. package/views/draw/plugins/PolylinePlugin.js +1 -1
  135. package/views/draw/plugins/ShapePlugin.js +1 -1
  136. package/views/draw/support/managers/TooltipManager.js +1 -1
  137. package/views/interactive/snapping/featureSources/featureServiceSource/FeatureServiceTiledFetcher.js +1 -1
  138. package/views/interactive/tooltip/content/TooltipContentDynamic.js +1 -1
  139. package/views/interactive/tooltip/infos/DynamicTooltipInfo.js +1 -1
  140. package/webscene/Glow.d.ts +10 -2
  141. package/widgets/Directions.js +1 -1
  142. package/widgets/Editor/CreateFeaturesWorkflow.js +1 -1
  143. package/widgets/Editor/SplitFeatureWorkflow.js +1 -1
  144. package/widgets/Home/HomeViewModel.d.ts +2 -1
  145. package/widgets/Home/HomeViewModel.js +1 -1
  146. package/widgets/Home.js +1 -1
  147. package/widgets/OrientedImageryViewer/OrientedImageryViewerViewModel.js +1 -1
  148. package/widgets/OrientedImageryViewer/components/OrientedImageryVideoViewModel.js +1 -1
  149. package/widgets/OrientedImageryViewer/constants.js +1 -1
  150. package/widgets/OrientedImageryViewer/types.js +1 -1
  151. package/widgets/OrientedImageryViewer/videoViewerUtils.js +1 -1
  152. package/widgets/OrientedImageryViewer.js +1 -1
  153. package/widgets/Sketch/SketchViewModel.js +1 -1
  154. package/widgets/Sketch/support/PluginManager.js +1 -1
  155. package/assets/esri/core/workers/chunks/0184b4c0c92c76c60ab2.js +0 -1
  156. package/assets/esri/core/workers/chunks/0bf742d48f434c4c575f.js +0 -1
  157. package/assets/esri/core/workers/chunks/15ba0296403dd4152b88.js +0 -1
  158. package/assets/esri/core/workers/chunks/1701d9c50610f0b2dd38.js +0 -1
  159. package/assets/esri/core/workers/chunks/231602adad900fc024f0.js +0 -1
  160. package/assets/esri/core/workers/chunks/27aa21da934ecaca381a.js +0 -1
  161. package/assets/esri/core/workers/chunks/2907e9a7216b5a29729b.js +0 -1
  162. package/assets/esri/core/workers/chunks/2b0891ba57ba66b913ce.js +0 -1
  163. package/assets/esri/core/workers/chunks/2cd56b7ab70f908bbbd4.js +0 -1
  164. package/assets/esri/core/workers/chunks/2e1fe0dd357eb7a6f47f.js +0 -1
  165. package/assets/esri/core/workers/chunks/2e9d280f51ab43e6f102.js +0 -1
  166. package/assets/esri/core/workers/chunks/2eb7df99170b7bb2a914.js +0 -1
  167. package/assets/esri/core/workers/chunks/36b8dd092697ef544f40.js +0 -1
  168. package/assets/esri/core/workers/chunks/394aa478c29599b08bf5.js +0 -1
  169. package/assets/esri/core/workers/chunks/4ba4aa6c75e3f8950e65.js +0 -1
  170. package/assets/esri/core/workers/chunks/4d45c51ff32dd75299ac.js +0 -1
  171. package/assets/esri/core/workers/chunks/4fdc838f4c3efab6cd61.js +0 -1
  172. package/assets/esri/core/workers/chunks/6321680c8070dffa3b6c.js +0 -1
  173. package/assets/esri/core/workers/chunks/6b02919373bd4da7ff73.js +0 -1
  174. package/assets/esri/core/workers/chunks/a03196e6579d738251fc.js +0 -1
  175. package/assets/esri/core/workers/chunks/a0b715cf03895082b773.js +0 -1
  176. package/assets/esri/core/workers/chunks/aec827b50df6edc54808.js +0 -1
  177. package/assets/esri/core/workers/chunks/c80c82acec04ee0ade04.js +0 -1
  178. package/assets/esri/core/workers/chunks/d27a542a406ac3fe2ad9.js +0 -1
  179. package/assets/esri/core/workers/chunks/d9c1e1ec5c56f09fb82f.js +0 -1
  180. package/assets/esri/core/workers/chunks/ec2dfd89e4ce6fda4971.js +0 -1
  181. package/assets/esri/core/workers/chunks/ffb73b4e8f2f7ffd2db4.js +0 -1
@@ -1,2 +1,2 @@
1
1
  /* COPYRIGHT Esri - https://js.arcgis.com/5.0/LICENSE.txt */
2
- import{__decorate as e}from"tslib";import t from"../core/Error.js";import{throwIfAbortError as r}from"../core/promiseUtils.js";import{urlToObject as i}from"../core/urlUtils.js";import{property as o,subclass as s}from"../core/accessorSupport/decorators.js";import a from"../geometry/SpatialReference.js";import l from"../graphic/CSVGraphicOrigin.js";import n from"./FeatureLayer.js";import{CSVSource as p}from"./graphics/sources/CSVSource.js";import{createCapabilities as u}from"./graphics/sources/support/clientSideDefaults.js";import{attributeTableTemplate as d}from"./support/commonProperties.js";import c from"./support/Field.js";import y from"../rest/support/Query.js";import{w as h,r as m}from"../chunks/persistableUrlUtils.js";import f from"../symbols/support/ElevationInfo.js";import{reader as g}from"../core/accessorSupport/decorators/reader.js";import{writer as v}from"../core/accessorSupport/decorators/writer.js";function w(e,r){throw new t(r,`CSVLayer (title: ${e.title}, id: ${e.id}) cannot be saved to a portal item`)}let b=class extends n{constructor(...e){super(...e),this.geometryType="point",this.capabilities=u(!1,!1),this.delimiter=null,this.editingEnabled=!1,this.fields=null,this.graphicOrigin=new l(this),this.latitudeField=null,this.locationType="coordinates",this.longitudeField=null,this.operationalLayerType="CSV",this.outFields=["*"],this.path=null,this.spatialReference=a.WGS84,this.source=null,this.type="csv"}normalizeCtorArgs(e,t){return"string"==typeof e?{url:e,...t}:e}load(e){const t=null!=e?e.signal:null,i=this.loadFromPortal({supportedTypes:["CSV"],supportsData:!1},e).catch(r).then(async()=>this.initLayerProperties(await this.createGraphicsSource(t)));return this.addResolvingPromise(i),Promise.resolve(this)}get portalItem(){return super.portalItem}set portalItem(e){super.portalItem=e}set fieldConfigurations(e){}get fieldConfigurations(){}get isTable(){return this.loaded&&null==this.geometryType}readWebMapLabelsVisible(e,t){return null!=t.showLabels?t.showLabels:!!t.layerDefinition?.drawingInfo?.labelingInfo}writePopupTemplate(e,t,r,i){e&&(t[r]=e.toJSON(i))}set url(e){if(!e)return void this._set("url",e);const t=i(e);this._set("url",t.path),t.query&&(this.customParameters={...this.customParameters,...t.query})}async createGraphicsSource(e){const t=new p({loadOptions:{delimiter:this.delimiter,fields:this.fields,latitudeField:this.latitudeField??void 0,longitudeField:this.longitudeField??void 0,spatialReference:this.spatialReference??void 0,timeInfo:this.timeInfo??void 0,url:this.url},customParameters:this.customParameters??void 0});return this._set("source",t),await t.load({signal:e}),this.read({locationInfo:t.locationInfo,columnDelimiter:t.delimiter},{origin:"service",url:this.parsedUrl}),t}queryFeatures(e,t){return this.load().then(()=>this.source.queryFeatures(y.from(e)||this.createQuery())).then(e=>{if(e?.features)for(const t of e.features)t.layer=t.sourceLayer=this,t.origin=this.graphicOrigin;return e})}async queryObjectIds(e,t){return await this.load(),this.source.queryObjectIds(y.from(e)||this.createQuery())}queryFeatureCount(e,t){return this.load().then(()=>this.source.queryFeatureCount(y.from(e)||this.createQuery()))}queryExtent(e,t){return this.load().then(()=>this.source.queryExtent(y.from(e)||this.createQuery()))}read(e,t){super.read(e,t),"service"===t?.origin&&["latitudeField","longitudeField"].forEach(e=>this.revertToOrigin(e,"service"))}write(e,t){return super.write(e,{...t,writeLayerSchema:!0})}clone(){throw new t("csv-layer:clone",`CSVLayer (title: ${this.title}, id: ${this.id}) cannot be cloned`)}async save(e){return w(this,"csv-layer:save")}async saveAs(e,t){return w(this,"csv-layer:save-as")}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}_verifyFields(){}_verifySource(){}_hasMemorySource(){return!1}};e([o(d)],b.prototype,"attributeTableTemplate",void 0),e([o({type:f})],b.prototype,"elevationInfo",void 0),e([o({readOnly:!0,json:{read:!1,write:!1}})],b.prototype,"capabilities",void 0),e([o({type:[","," ",";","|","\t"],json:{read:{source:"columnDelimiter"},write:{target:"columnDelimiter",ignoreOrigin:!0}}})],b.prototype,"delimiter",void 0),e([o({readOnly:!0,type:Boolean,json:{origins:{"web-scene":{read:!1,write:!1}}}})],b.prototype,"editingEnabled",void 0),e([o({json:{write:!1}})],b.prototype,"fieldConfigurations",null),e([o({type:[c],json:{read:{source:"layerDefinition.fields"},write:{target:"layerDefinition.fields"}}})],b.prototype,"fields",void 0),e([o({readOnly:!0})],b.prototype,"graphicOrigin",void 0),e([o({type:Boolean,readOnly:!0})],b.prototype,"isTable",null),e([g("web-map","labelsVisible",["layerDefinition.drawingInfo.labelingInfo","showLabels"])],b.prototype,"readWebMapLabelsVisible",null),e([o({type:String,json:{read:{source:"locationInfo.latitudeFieldName"},write:{target:"locationInfo.latitudeFieldName",ignoreOrigin:!0}}})],b.prototype,"latitudeField",void 0),e([o({type:["show","hide"]})],b.prototype,"listMode",void 0),e([o({type:["coordinates"],json:{read:{source:"locationInfo.locationType"},write:{target:"locationInfo.locationType",ignoreOrigin:!0,isRequired:!0}}})],b.prototype,"locationType",void 0),e([o({type:String,json:{read:{source:"locationInfo.longitudeFieldName"},write:{target:"locationInfo.longitudeFieldName",ignoreOrigin:!0}}})],b.prototype,"longitudeField",void 0),e([o({type:["CSV"]})],b.prototype,"operationalLayerType",void 0),e([o()],b.prototype,"outFields",void 0),e([o({type:String,json:{origins:{"web-scene":{read:!1,write:!1}},read:!1,write:!1}})],b.prototype,"path",void 0),e([v("popupTemplate")],b.prototype,"writePopupTemplate",null),e([o({type:a})],b.prototype,"spatialReference",void 0),e([o({json:{read:!1},cast:null,type:p,readOnly:!0})],b.prototype,"source",void 0),e([o({json:{read:!1},value:"csv",readOnly:!0})],b.prototype,"type",void 0),e([o({json:{read:m,write:{isRequired:!0,ignoreOrigin:!0,writer:h}}})],b.prototype,"url",null),b=e([s("esri.layers.CSVLayer")],b);const j=b;export{j as default};
2
+ import{__decorate as e}from"tslib";import t from"../PopupTemplate.js";import i from"../core/Error.js";import{MultiOriginJSONSupportMixin as r}from"../core/MultiOriginJSONSupport.js";import{throwIfAbortError as o}from"../core/promiseUtils.js";import{urlToObject as s}from"../core/urlUtils.js";import{property as n,subclass as a}from"../core/accessorSupport/decorators.js";import{excludeTables as p}from"../core/accessorSupport/layerContainerType.js";import l from"../geometry/SpatialReference.js";import d from"../graphic/CSVGraphicOrigin.js";import m from"./Layer.js";import{CSVSource as u}from"./graphics/sources/CSVSource.js";import{createCapabilities as y}from"./graphics/sources/support/clientSideDefaults.js";import{BlendLayer as c}from"./mixins/BlendLayer.js";import{CustomParametersMixin as f}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 b}from"./mixins/OrderedLayer.js";import{PortalLayer as I}from"./mixins/PortalLayer.js";import{RefreshableLayer as w}from"./mixins/RefreshableLayer.js";import{ScaleRangeLayer as x}from"./mixins/ScaleRangeLayer.js";import{TemporalLayer as F}from"./mixins/TemporalLayer.js";import{TrackableLayer as T}from"./mixins/TrackableLayer.js";import{attributeTableTemplate as O,elevationInfo as S,labelsVisible as L,legendEnabled as D,maxScale as P,minScale as E,opacityDrawingInfo as C,popupEnabled as q,screenSizePerspectiveEnabled as V,url as R}from"./support/commonProperties.js";import{validateBinsQuery as Q}from"./support/featureLayerUtils.js";import U from"./support/Field.js";import{defineFieldProperties as N}from"./support/fieldProperties.js";import{fixRendererFields as B,fixTimeInfoFields as A}from"./support/fieldUtils.js";import M from"./support/LabelClass.js";import{reader as Z}from"./support/labelingInfo.js";import _ from"./support/LayerFloorInfo.js";import G from"./support/TimeInfo.js";import{webSceneRendererTypes as W,rendererTypes as z}from"../renderers/support/typeUtils.js";import J from"../rest/support/Query.js";import{createPopupTemplate as k}from"../support/popupUtils.js";import{fromTimeReference as H}from"../time/timeZoneUtils.js";import{reader as K}from"../core/accessorSupport/decorators/reader.js";const X=N();let Y=class extends(b(h(f(j(g(c(F(T(x(w(v(I(r(m)))))))))))))){constructor(e){super(e),this.attributeTableTemplate=null,this.capabilities=y(!1,!1),this.copyright=null,this.definitionExpression=null,this.delimiter=null,this.displayField=null,this.elevationInfo=null,this.fields=null,this.fieldsIndex=null,this.floorInfo=null,this.fullExtent=null,this.geometryType="point",this.graphicOrigin=new d(this),this.labelingInfo=null,this.labelsVisible=!0,this.latitudeField=null,this.legendEnabled=!0,this.locationType="coordinates",this.longitudeField=null,this.maxScale=0,this.minScale=0,this.objectIdField=null,this.opacity=1,this.operationalLayerType="CSV",this.outFields=null,this.popupEnabled=!0,this.popupTemplate=null,this.screenSizePerspectiveEnabled=!0,this.source=new u,this.spatialReference=l.WGS84,this.timeInfo=null,this.type="csv"}load(e){const t=this.loadFromPortal({supportedTypes:["CSV"],supportsData:!1},e).catch(o).then(()=>(this.source.loadOptions={delimiter:this.delimiter,fields:this.fields,latitudeField:this.latitudeField??void 0,longitudeField:this.longitudeField??void 0,spatialReference:this.spatialReference??void 0,timeInfo:this.timeInfo??void 0,url:this.url},this.source.customParameters=this.customParameters??void 0,this.source.load(e))).then(()=>{this.read({layerDefinition:this.source.sourceJSON,locationInfo:this.source.locationInfo,columnDelimiter:this.source.delimiter},{origin:"service",portalItem:this.portalItem,portal:this.portalItem?.portal,url:this.parsedUrl}),B(this.renderer,this.fieldsIndex),A(this.timeInfo,this.fieldsIndex)});return this.addResolvingPromise(t),Promise.resolve(this)}destroy(){this.source?.destroy()}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}readWebMapLabelsVisible(e,t){return t.showLabels??!!t.layerDefinition?.drawingInfo?.labelingInfo}get portalItem(){return super.portalItem}set portalItem(e){super.portalItem=e}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})}createPopupTemplate(e){return k(this,e)}createQuery(){const e=new J,t=this.capabilities?.data;e.returnGeometry=!0,t?.supportsZ&&(e.returnZ=!0),e.outFields=["*"],e.where=this.definitionExpression||"1=1";const{timeOffset:i,timeExtent:r}=this;return e.timeExtent=i&&r?r.offset(-i.value,i.unit):r??null,e}getFieldDomain(e,t){return this.getField(e)?.domain}getField(e){return this.fieldsIndex.get(e)}async queryAttributeBins(e,t){const{source:r,capabilities:o}=await this.load();if(!r.queryAttributeBins)throw new i("CSVLayer","Layer source does not support queryAttributeBins capability");Q(e,o,"CSVLayer");const{default:s}=await import("../rest/support/AttributeBinsQuery.js"),n=await r.queryAttributeBins(s.from(e),t),a=this.graphicOrigin;if(n.features)for(const i of n.features)i.layer=i.sourceLayer=this,i.origin=a;return n}queryFeatures(e,t){return this.load().then(()=>this.source.queryFeatures(J.from(e)||this.createQuery())).then(e=>{const t=this.graphicOrigin;if(e.features)for(const i of e.features)i.layer=i.sourceLayer=this,i.origin=t;return e})}async queryObjectIds(e,t){return await this.load(),this.source.queryObjectIds(J.from(e)||this.createQuery())}queryFeatureCount(e,t){return this.load().then(()=>this.source.queryFeatureCount(J.from(e)||this.createQuery()))}queryExtent(e,t){return this.load().then(()=>this.source.queryExtent(J.from(e)||this.createQuery()))}read(e,t){super.read(e,t),"service"===t?.origin&&(["objectIdField","fields","timeInfo","dateFieldsTimeZone","latitudeField","longitudeField"].forEach(e=>this.revertToOrigin(e,"service")),this.spatialReference||this.revertToOrigin("spatialReference","service"))}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([n(O)],Y.prototype,"attributeTableTemplate",void 0),e([n({readOnly:!0,json:{read:!1,write:!1}})],Y.prototype,"capabilities",void 0),e([n({type:String,json:{origins:{service:{read:{source:"copyrightText"}}}}})],Y.prototype,"copyright",void 0),e([n({readOnly:!0})],Y.prototype,"createQueryVersion",null),e([n({json:{name:"layerDefinition.dateFieldsTimeReference",read:{reader:H}}})],Y.prototype,"dateFieldsTimeZone",void 0),e([n({readOnly:!0})],Y.prototype,"defaultPopupTemplate",null),e([n({type:String,json:{name:"layerDefinition.definitionExpression",write:{enabled:!0,allowNull:!0}}})],Y.prototype,"definitionExpression",void 0),e([n({type:[","," ",";","|","\t"],json:{name:"columnDelimiter",write:{ignoreOrigin:!0}}})],Y.prototype,"delimiter",void 0),e([n({type:String})],Y.prototype,"displayField",void 0),e([n(S)],Y.prototype,"elevationInfo",void 0),e([n({type:[U],json:{name:"layerDefinition.fields",write:{ignoreOrigin:!0}}})],Y.prototype,"fields",void 0),e([n(X.fieldsIndex)],Y.prototype,"fieldsIndex",void 0),e([n({type:_,json:{name:"layerDefinition.floorInfo",write:{layerContainerTypes:p}}})],Y.prototype,"floorInfo",void 0),e([n({json:{origins:{service:{name:"layerDefinition.extent"}}}})],Y.prototype,"fullExtent",void 0),e([n({readOnly:!0,json:{read:!1}})],Y.prototype,"geometryType",void 0),e([n({readOnly:!0})],Y.prototype,"graphicOrigin",void 0),e([n({readOnly:!0})],Y.prototype,"isTable",null),e([n({type:[M],json:{name:"layerDefinition.drawingInfo.labelingInfo",read:{reader:Z},write:!0}})],Y.prototype,"labelingInfo",void 0),e([n(L)],Y.prototype,"labelsVisible",void 0),e([K("web-map","labelsVisible",["layerDefinition.drawingInfo.labelingInfo","showLabels"])],Y.prototype,"readWebMapLabelsVisible",null),e([n({type:String,json:{name:"locationInfo.latitudeFieldName",write:{ignoreOrigin:!0}}})],Y.prototype,"latitudeField",void 0),e([n(D)],Y.prototype,"legendEnabled",void 0),e([n({type:["show","hide"]})],Y.prototype,"listMode",void 0),e([n({type:["coordinates"],json:{name:"locationInfo.locationType",write:{ignoreOrigin:!0,isRequired:!0}}})],Y.prototype,"locationType",void 0),e([n({type:String,json:{name:"locationInfo.longitudeFieldName",write:{ignoreOrigin:!0}}})],Y.prototype,"longitudeField",void 0),e([n(P)],Y.prototype,"maxScale",void 0),e([n(E)],Y.prototype,"minScale",void 0),e([n({type:String,json:{name:"layerDefinition.objectIdField",origins:{"web-map":{write:{target:"layerDefinition.objectIdField",ignoreOrigin:!0}}}}})],Y.prototype,"objectIdField",void 0),e([n(C)],Y.prototype,"opacity",void 0),e([n({type:["CSV"]})],Y.prototype,"operationalLayerType",void 0),e([n()],Y.prototype,"outFields",void 0),e([n(q)],Y.prototype,"popupEnabled",void 0),e([n({type:t,json:{name:"popupInfo",write:!0}})],Y.prototype,"popupTemplate",void 0),e([n({types:z,json:{name:"layerDefinition.drawingInfo.renderer",origins:{"web-scene":{types:W,name:"layerDefinition.drawingInfo.renderer",write:!0}},write:{ignoreOrigin:!0,layerContainerTypes:p}}})],Y.prototype,"renderer",null),e([n(V)],Y.prototype,"screenSizePerspectiveEnabled",void 0),e([n({readOnly:!0})],Y.prototype,"source",void 0),e([n({type:l,json:{origins:{service:{name:"layerDefinition.extent.spatialReference"}}}})],Y.prototype,"spatialReference",void 0),e([n({type:G,json:{name:"layerDefinition.timeInfo"}})],Y.prototype,"timeInfo",void 0),e([n({type:String,json:{origins:{service:{name:"layerDefinition.name"},"web-document":{name:"title",write:{isRequired:!0,ignoreOrigin:!0,writerEnsuresNonNull:!0}}}}})],Y.prototype,"title",void 0),e([n({json:{read:!1},value:"csv",readOnly:!0})],Y.prototype,"type",void 0),e([n(R)],Y.prototype,"url",null),Y=e([a("esri.layers.CSVLayer")],Y);const $=Y;export{$ as default};
@@ -19,9 +19,9 @@ import type AttributeTableTemplate from "../tables/AttributeTableTemplate.js";
19
19
  import type { ClonableMixin } from "../core/Clonable.js";
20
20
  import type { ReadonlyArrayOrCollection } from "../core/Collection.js";
21
21
  import type { MultiOriginJSONSupportMixin } from "../core/MultiOriginJSONSupport.js";
22
+ import type { EditOptions, Edits, EditsResult, FeatureEditResult } from "../editing/types.js";
22
23
  import type { LayerEvents, LayerProperties } from "./Layer.js";
23
24
  import type { LayerSaveAsOptions, LayerSaveOptions, FeatureTitleOptions } from "./types.js";
24
- import type { EditOptions, Edits, EditsResult, FeatureEditResult } from "./graphics/editingSupport.js";
25
25
  import type { APIKeyMixin, APIKeyMixinProperties } from "./mixins/APIKeyMixin.js";
26
26
  import type { BlendLayer, BlendLayerProperties } from "./mixins/BlendLayer.js";
27
27
  import type { CustomParametersMixin, CustomParametersMixinProperties } from "./mixins/CustomParametersMixin.js";
@@ -215,8 +215,8 @@ export interface FeatureLayerProperties extends LayerProperties, APIKeyMixinProp
215
215
  * should be set in the constructor along with the [source](https://developers.arcgis.com/javascript/latest/references/core/layers/FeatureLayer/#source) property. The `objectId`
216
216
  * field also must be set either in this array or in the [objectIdField](https://developers.arcgis.com/javascript/latest/references/core/layers/FeatureLayer/#objectIdField) property.
217
217
  *
218
- * @see [FeatureLayer.source](https://developers.arcgis.com/javascript/latest/references/core/layers/FeatureLayer/#source)
219
- * @see [FeatureLayer.objectIdField](https://developers.arcgis.com/javascript/latest/references/core/layers/FeatureLayer/#objectIdField)
218
+ * @see [source](https://developers.arcgis.com/javascript/latest/references/core/layers/FeatureLayer/#source)
219
+ * @see [objectIdField](https://developers.arcgis.com/javascript/latest/references/core/layers/FeatureLayer/#objectIdField)
220
220
  * @see [Add an array of client-side features](https://developers.arcgis.com/javascript/latest/references/core/layers/FeatureLayer/#client-side)
221
221
  * @example
222
222
  * // define each field's schema
@@ -342,7 +342,7 @@ export interface FeatureLayerProperties extends LayerProperties, APIKeyMixinProp
342
342
  *
343
343
  * @default 0
344
344
  * @since 4.6
345
- * @see [FeatureLayer.refresh()](https://developers.arcgis.com/javascript/latest/references/core/layers/FeatureLayer/#refresh)
345
+ * @see [refresh()](https://developers.arcgis.com/javascript/latest/references/core/layers/FeatureLayer/#refresh)
346
346
  * @see [refresh event](https://developers.arcgis.com/javascript/latest/references/core/layers/FeatureLayer/#event-refresh)
347
347
  * @example
348
348
  * // the layer will be refreshed every 1 minute.
@@ -964,8 +964,8 @@ export abstract class __FeatureLayerSansType extends FeatureLayerSuperclass {
964
964
  * should be set in the constructor along with the [source](https://developers.arcgis.com/javascript/latest/references/core/layers/FeatureLayer/#source) property. The `objectId`
965
965
  * field also must be set either in this array or in the [objectIdField](https://developers.arcgis.com/javascript/latest/references/core/layers/FeatureLayer/#objectIdField) property.
966
966
  *
967
- * @see [FeatureLayer.source](https://developers.arcgis.com/javascript/latest/references/core/layers/FeatureLayer/#source)
968
- * @see [FeatureLayer.objectIdField](https://developers.arcgis.com/javascript/latest/references/core/layers/FeatureLayer/#objectIdField)
967
+ * @see [source](https://developers.arcgis.com/javascript/latest/references/core/layers/FeatureLayer/#source)
968
+ * @see [objectIdField](https://developers.arcgis.com/javascript/latest/references/core/layers/FeatureLayer/#objectIdField)
969
969
  * @see [Add an array of client-side features](https://developers.arcgis.com/javascript/latest/references/core/layers/FeatureLayer/#client-side)
970
970
  * @example
971
971
  * // define each field's schema
@@ -1125,7 +1125,7 @@ export abstract class __FeatureLayerSansType extends FeatureLayerSuperclass {
1125
1125
  * [Popup.defaultPopupTemplateEnabled](https://developers.arcgis.com/javascript/latest/references/core/widgets/Popup/#defaultPopupTemplateEnabled) is set to `true`.
1126
1126
  *
1127
1127
  * @default true
1128
- * @see [FeatureLayer.createPopupTemplate()](https://developers.arcgis.com/javascript/latest/references/core/layers/FeatureLayer/#createPopupTemplate)
1128
+ * @see [createPopupTemplate()](https://developers.arcgis.com/javascript/latest/references/core/layers/FeatureLayer/#createPopupTemplate)
1129
1129
  * @see [SceneView.popup](https://developers.arcgis.com/javascript/latest/references/core/views/SceneView/#popup)
1130
1130
  * @see [View2D.popup](https://developers.arcgis.com/javascript/latest/references/core/views/View2D/#popup)
1131
1131
  */
@@ -1155,7 +1155,7 @@ export abstract class __FeatureLayerSansType extends FeatureLayerSuperclass {
1155
1155
  *
1156
1156
  * @default 0
1157
1157
  * @since 4.6
1158
- * @see [FeatureLayer.refresh()](https://developers.arcgis.com/javascript/latest/references/core/layers/FeatureLayer/#refresh)
1158
+ * @see [refresh()](https://developers.arcgis.com/javascript/latest/references/core/layers/FeatureLayer/#refresh)
1159
1159
  * @see [refresh event](https://developers.arcgis.com/javascript/latest/references/core/layers/FeatureLayer/#event-refresh)
1160
1160
  * @example
1161
1161
  * // the layer will be refreshed every 1 minute.
@@ -1319,7 +1319,7 @@ export abstract class __FeatureLayerSansType extends FeatureLayerSuperclass {
1319
1319
  *
1320
1320
  * @param feature - Feature to which the attachment is to be added.
1321
1321
  * @param attachment - HTML form that contains a file upload field pointing to the file to be added as an attachment.
1322
- * @returns When resolved, a [FeatureEditResult](https://developers.arcgis.com/javascript/latest/references/core/layers/graphics/editingSupport/#FeatureEditResult)
1322
+ * @returns When resolved, a [FeatureEditResult](https://developers.arcgis.com/javascript/latest/references/core/editing/types/#FeatureEditResult)
1323
1323
  * object is returned. FeatureEditResult indicates whether or not the edit was successful. If successful, the `objectId` of the result is the Id of
1324
1324
  * the new attachment. If unsuccessful, it also includes an error `name` and error `message`.
1325
1325
  * @since 4.9
@@ -1384,7 +1384,7 @@ export abstract class __FeatureLayerSansType extends FeatureLayerSuperclass {
1384
1384
  *
1385
1385
  * @param edits - Object containing features and attachments to be added, updated or deleted.
1386
1386
  * @param options - Additional edit options to specify when editing features or attachments.
1387
- * @returns When resolved, an [EditsResult](https://developers.arcgis.com/javascript/latest/references/core/layers/graphics/editingSupport/#EditsResult)
1387
+ * @returns When resolved, an [EditsResult](https://developers.arcgis.com/javascript/latest/references/core/editing/types/#EditsResult)
1388
1388
  * object is returned.
1389
1389
  * @see [Sample - Edit features](https://developers.arcgis.com/javascript/latest/sample-code/editing-applyedits/)
1390
1390
  * @example
@@ -1501,7 +1501,7 @@ export abstract class __FeatureLayerSansType extends FeatureLayerSuperclass {
1501
1501
  *
1502
1502
  * @param feature - Feature containing attachments to be deleted.
1503
1503
  * @param attachmentIds - Ids of the attachments to be deleted.
1504
- * @returns When resolved, an array of [FeatureEditResults](https://developers.arcgis.com/javascript/latest/references/core/layers/graphics/editingSupport/#FeatureEditResult)
1504
+ * @returns When resolved, an array of [FeatureEditResults](https://developers.arcgis.com/javascript/latest/references/core/editing/types/#FeatureEditResult)
1505
1505
  * is returned. FeatureEditResult indicates whether or not the edit was successful. If successful, the `objectId` of the result is the Id of
1506
1506
  * the new attachment. If unsuccessful, it also includes an error `name` and error `message`.
1507
1507
  * @since 4.9
@@ -2131,7 +2131,7 @@ export abstract class __FeatureLayerSansType extends FeatureLayerSuperclass {
2131
2131
  * the `lastEditDate` field. If the `lastEditDate` metadata info is not available, the FeatureLayer refreshes unconditionally.
2132
2132
  *
2133
2133
  * @since 4.6
2134
- * @see [FeatureLayer.refreshInterval](https://developers.arcgis.com/javascript/latest/references/core/layers/FeatureLayer/#refreshInterval)
2134
+ * @see [refreshInterval](https://developers.arcgis.com/javascript/latest/references/core/layers/FeatureLayer/#refreshInterval)
2135
2135
  * @see [refresh event](https://developers.arcgis.com/javascript/latest/references/core/layers/FeatureLayer/#event-refresh)
2136
2136
  * @see [RefreshableLayer.refreshInterval](https://developers.arcgis.com/javascript/latest/references/core/layers/mixins/RefreshableLayer/#refreshInterval)
2137
2137
  * @see [refresh event](https://developers.arcgis.com/javascript/latest/references/core/layers/mixins/RefreshableLayer/#event-refresh)
@@ -2180,7 +2180,7 @@ export abstract class __FeatureLayerSansType extends FeatureLayerSuperclass {
2180
2180
  * @param feature - The feature containing the attachment to be updated.
2181
2181
  * @param attachmentId - Id of the attachment to be updated.
2182
2182
  * @param attachment - HTML form that contains a file upload field pointing to the file to be added as an attachment.
2183
- * @returns When resolved, a [FeatureEditResult](https://developers.arcgis.com/javascript/latest/references/core/layers/graphics/editingSupport/#FeatureEditResult)
2183
+ * @returns When resolved, a [FeatureEditResult](https://developers.arcgis.com/javascript/latest/references/core/editing/types/#FeatureEditResult)
2184
2184
  * object is returned. FeatureEditResult indicates whether or not the edit was successful. If successful, the `objectId` of the result is the Id of
2185
2185
  * the new attachment. If unsuccessful, it also includes an error `name` and error `message`.
2186
2186
  * @since 4.9
@@ -1,2 +1,2 @@
1
1
  /* COPYRIGHT Esri - https://js.arcgis.com/5.0/LICENSE.txt */
2
- import{__decorate as e}from"tslib";import t from"../PopupTemplate.js";import r from"../request.js";import{ClonableMixin as 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{MultiOriginJSONSupportMixin 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{property as f,subclass as h}from"../core/accessorSupport/decorators.js";import{excludeTables as b}from"../core/accessorSupport/layerContainerType.js";import g from"../form/FormTemplate.js";import w from"../geometry/SpatialReference.js";import v from"../graphic/FeatureGraphicOrigin.js";import T from"./Layer.js";import{MemorySource as F}from"./graphics/sources/MemorySource.js";import{APIKeyMixin as j}from"./mixins/APIKeyMixin.js";import{ArcGISService as S}from"./mixins/ArcGISService.js";import{BlendLayer as I}from"./mixins/BlendLayer.js";import{CustomParametersMixin as E}from"./mixins/CustomParametersMixin.js";import{DisplayFilteredLayer as L}from"./mixins/DisplayFilteredLayer.js";import{EditBusLayer as D}from"./mixins/EditBusLayer.js";import{FeatureEffectLayer as _}from"./mixins/FeatureEffectLayer.js";import{FeatureLayerBase as C}from"./mixins/FeatureLayerBase.js";import{FeatureReductionLayer as P}from"./mixins/FeatureReductionLayer.js";import{OperationalLayer as x}from"./mixins/OperationalLayer.js";import{OrderedLayer as O}from"./mixins/OrderedLayer.js";import{PortalLayer as q}from"./mixins/PortalLayer.js";import{PublishableLayer as M}from"./mixins/PublishableLayer.js";import{RefreshableLayer as A}from"./mixins/RefreshableLayer.js";import{ScaleRangeLayer as Q}from"./mixins/ScaleRangeLayer.js";import{TemporalLayer as R}from"./mixins/TemporalLayer.js";import{TrackableLayer as U}from"./mixins/TrackableLayer.js";import{titleFromUrlAndName as V,parse as N,cleanTitle as B}from"./support/arcgisLayerUrl.js";import{attributeTableTemplate as G,id as J,labelsVisible as W,opacityDrawingInfo as Z,legendEnabled as $,listMode as H,popupEnabled as z,screenSizePerspectiveEnabled as k}from"./support/commonProperties.js";import{ensureLayerCredential as K,computeEffectiveEditingEnabled as X,readGlobalIdField as Y,readObjectIdField as ee,createDefaultRenderer as te,addAttachment as re,updateAttachment as ie,applyEdits as oe,uploadAssets as se,createQuery as ae,deleteAttachments as ne,fetchRecomputedExtents as le,getFeatureType as pe,getFieldDomain as ue,queryAttachments as de,queryObjectIds as ye,queryFeatureCount as ce,queryExtent as me,queryRelatedFeatures as fe,queryRelatedFeaturesCount as he,validateBinsQuery as be,hasDataChanged as ge,geometryTypeKebabDict as we}from"./support/featureLayerUtils.js";import ve from"./support/FeatureTemplate.js";import Te from"./support/FeatureType.js";import Fe from"./support/FieldConfiguration.js";import{popupTemplateWithFieldConfigurations as je,fieldConfigurationsFromPopupTemplate as Se,fieldConfigurationsFromFields as Ie}from"./support/fieldConfigUtils.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 Ce}from"./support/labelingInfo.js";import{getFeatureLayerCapabilities as Pe}from"./support/serviceCapabilitiesUtils.js";import xe from"./support/TimeInfo.js";import Oe from"./support/TitleCreator.js";import{serviceSupportsSpatialReference as qe}from"./support/versionUtils.js";import{read as Me}from"../renderers/support/jsonUtils.js";import{loadStyleRenderer as Ae}from"../renderers/support/styleUtils.js";import{webSceneRendererTypes as Qe,rendererTypes as Re}from"../renderers/support/typeUtils.js";import Ue from"../rest/layerSources/DynamicDataLayer.js";import Ve from"../rest/support/FeatureSet.js";import Ne from"../rest/support/Query.js";import{isNumber as Be}from"../support/guards.js";import{createPopupTemplate as Ge}from"../support/popupUtils.js";import{symbolTypes as Je}from"../symbols/support/typeUtils.js";import{opacityToTransparency as We}from"../webdoc/support/opacityUtils.js";import{addLayerUnsupportedError as Ze}from"../webdoc/support/unsupportedErrors.js";import{reader as $e}from"../core/accessorSupport/decorators/reader.js";import{writer as He}from"../core/accessorSupport/decorators/writer.js";const ze="FeatureLayer";function ke(e){return e&&e instanceof o}const Ke=Ee();function Xe(e,t,r){const i=!!r?.writeLayerSchema;return{enabled:i,ignoreOrigin:i}}let Ye=class extends(C(P(_(M(D(L(I(O(R(U(Q(A(S(x(q(p(E(j(i(T)))))))))))))))))))){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.graphicOrigin=new v(this),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=w.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 0:return i(this,t);case 1: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(()=>K(this,"load",e));return this.addResolvingPromise(r),Promise.resolve(this)}get _titleCreator(){const e=this._get("_titleCreator");return l(e),new Oe({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,Pe(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 X(this)}get featureTitleFields(){return[...this._titleCreator.requiredFields]}set fieldConfigurations(e){if(this._hasMemorySource())return;if(this._override("fieldConfigurations",e),!this.loaded)return;const t=je(this,e);t&&this._set("popupTemplate",t)}get fieldConfigurations(){if(!this._hasMemorySource())return this._isOverridden("fieldConfigurations")?this._get("fieldConfigurations"):Se(this)||null}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 Y(t.layerDefinition||t)}readObjectIdField(e,t){return ee(t.layerDefinition||t)}writePopupTemplate(e,t,r,i){e&&(t[r]=e.toJSON({...i,writeFieldFormat:!i?.writeLayerSchema}))}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=Me(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 te(t,r)}get source(){return this._get("source")}set source(e){e||(e=null);const t=this._get("source");t!==e&&((Array.isArray(e)||e instanceof o)&&(e=new F({layer:this,items:e})),ke(t)&&this._resetMemorySource(t),ke(e)&&this._initMemorySource(e),this._set("source",e))}readSource(e,t){const r=Ve.fromJSON(t.featureSet);return new F({layer:this,items:r?.features??[]})}readTemplates(e,t){const r=t.editFieldsInfo,i=r?.creatorField,o=r?.editorField;return e=e?.map(e=>ve.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){if("item-title"===this.sublayerTitleMode)return this.url?V(this.url,r):r;let e=r;if(!e&&this.url){const t=N(this.url);null!=t&&(e=t.title)}if(!e)return;const t=this.portalItem?.title;return"item-title-and-service-name"===this.sublayerTitleMode&&t&&t!==e&&(e=t+" - "+e),B(e)}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=Te.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 re(this,e,t,ze);return this.lastEditsEventDate=new Date,r}async updateAttachment(e,t,r){const i=await ie(this,e,t,r,ze);return this.lastEditsEventDate=new Date,i}async applyEdits(e,t){return oe(this,e,t)}async uploadAssets(e,t){return se(this,e,t)}createFieldConfigurations(){return Ie(this)}createPopupTemplate(e){return Ge(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=ae(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 ne(this,e,t,ze);return this.lastEditsEventDate=new Date,r}async fetchRecomputedExtents(e){return le(this,e,ze)}async getFeatureTitle(e,t){return this._titleCreator.getTitle(this,e,t)}async getFeatureTitles(e,t){return this._titleCreator.getTitles(this,e,t)}getFeatureType(e){return pe(this.types,this.typeIdField,e)}getFieldAlias(e){const t=this.getField(e);if(t)return this.getFieldConfiguration(t.name)?.alias||t.alias}getFieldConfiguration(e){return e=e.toLowerCase(),this.fieldConfigurations?.find(t=>t.name.toLowerCase()===e)}getFieldDomain(e,t){return ue(this,e,t,this.getField(e)?.domain??null)}async queryAttachments(e,t){return de(this,e,t,ze)}async queryFeatures(e,t){const r=await this.load(),i=await r.source.queryFeatures(Ne.from(e)??r.createQuery(),t),o=this.graphicOrigin;if(i?.features)for(const s of i.features)s.layer=s.sourceLayer=r,s.origin=o;return i}async queryObjectIds(e,t){return await ye(this,e,t,ze)}async queryFeatureCount(e,t){return ce(this,e,t,ze)}async queryExtent(e,t){return me(this,e,t,ze)}async queryRelatedFeatures(e,t){return fe(this,e,t,ze)}async queryRelatedFeaturesCount(e,t){return he(this,e,t,ze)}async queryPivot(e,t){const{source:r,capabilities:i}=await this.load();if(!r.queryPivot||!i?.operations?.supportsQueryPivot)throw new s(ze,"Layer source does not support queryPivot capability");const o=await import("../rest/support/PivotQuery.js"),a=await r.queryPivot(o.default.from(e),t);if(a?.features)for(const s of a.features)s.layer=s.sourceLayer=this;return a}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");be(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(Be)}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),"service"===t?.origin&&(["objectIdField","fields","timeInfo","dateFieldsTimeZone"].forEach(e=>this.revertToOrigin(e,"service")),this.spatialReference||this.revertToOrigin("spatialReference","service"))}write(e,t){t={...t,origin:t?.origin??void 0,writeLayerSchema:t?.writeLayerSchema??this._hasMemorySource()};const{origin:r,layerContainerType:i}=t;if(this.dynamicDataSource)return Ze(t,this,"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 Ze(t,this,"a table source can only be written to tables"),null;if(this._hasMemorySource())return Ze(t,this,"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 Ze(t,this,"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(0,e)}async saveAs(e,t){return this._debouncedSaveOperations(1,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),Ae(this,{origin:"service"})}async hasDataChanged(){return ge(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){const t=[...e.layers||[],...e.tables||[]];return t.find(({type:e})=>!e||this.supportedSourceTypes.has(e))?.id}};e([f({clonable:!1,readOnly:!0})],Ye.prototype,"_titleCreator",null),e([f(G)],Ye.prototype,"attributeTableTemplate",void 0),e([$e("service","capabilities")],Ye.prototype,"readCapabilities",null),e([f({json:{origins:{"web-scene":{write:!1}},write:!0}})],Ye.prototype,"charts",void 0),e([f({readOnly:!0})],Ye.prototype,"createQueryVersion",null),e([f({json:{read:{source:"layerDefinition.copyrightText"}}})],Ye.prototype,"copyright",void 0),e([f({json:{read:{source:"layerDefinition.displayField"}}})],Ye.prototype,"displayField",void 0),e([f({types:Je,readOnly:!0})],Ye.prototype,"defaultSymbol",void 0),e([f({type:Ue})],Ye.prototype,"dynamicDataSource",void 0),e([f({type:Boolean})],Ye.prototype,"editingEnabled",null),e([$e(["portal-item","web-scene"],"editingEnabled",["layerDefinition.capabilities"])],Ye.prototype,"readEditingEnabled",null),e([$e("web-map","editingEnabled",["capabilities","layerDefinition.capabilities"])],Ye.prototype,"readEditingEnabledFromWebMap",null),e([He(["portal-item","web-scene"],"editingEnabled",{"layerDefinition.capabilities":{type:String}})],Ye.prototype,"writeEditingEnabled",null),e([He("web-map","editingEnabled",{capabilities:{type:String},"layerDefinition.capabilities":{type:String}})],Ye.prototype,"writeEditingEnabledToWebMap",null),e([f({readOnly:!0})],Ye.prototype,"effectiveEditingEnabled",null),e([f({clonable:!1,readOnly:!0})],Ye.prototype,"featureTitleFields",null),e([f({type:[Fe],json:{name:"layerDefinition.fieldConfigurations",write:{overridePolicy(e,t,r){return{enabled:!r?.writeLayerSchema,ignoreOrigin:1===this.originIdOf(t)}}}}})],Ye.prototype,"fieldConfigurations",null),e([f({...Ke.fields,json:{read:{source:"layerDefinition.fields"},origins:{service:{name:"fields"},"web-map":{write:{target:"layerDefinition.fields",overridePolicy:Xe}}}}})],Ye.prototype,"fields",void 0),e([f(Ke.fieldsIndex)],Ye.prototype,"fieldsIndex",void 0),e([f({type:g,json:{name:"formInfo",write:!0,origins:{"web-scene":{read:!1,write:!1}}}})],Ye.prototype,"formTemplate",void 0),e([f({json:{read:{source:"layerDefinition.extent"}}})],Ye.prototype,"fullExtent",void 0),e([f({json:{origins:{"web-map":{write:{target:"layerDefinition.geometryType",overridePolicy:Xe,writer(e,t,r){const i=e?we.toJSON(e):null;i&&u(r,i,t)}}}},read:{source:"layerDefinition.geometryType",reader:we.read}}})],Ye.prototype,"geometryType",void 0),e([f({readOnly:!0,clonable:!1})],Ye.prototype,"graphicOrigin",void 0),e([f({json:{read:{source:"layerDefinition.hasM"}}})],Ye.prototype,"hasM",void 0),e([f({json:{read:{source:"layerDefinition.hasZ"}}})],Ye.prototype,"hasZ",void 0),e([f(J)],Ye.prototype,"id",void 0),e([f({readOnly:!0,json:{origins:{service:{read:!0}},read:!1}})],Ye.prototype,"infoFor3D",void 0),e([f({json:{origins:{"web-map":{write:{target:"layerDefinition.type"}}}}})],Ye.prototype,"isTable",void 0),e([$e("service","isTable",["type","geometryType"]),$e("isTable",["layerDefinition.type","layerDefinition.geometryType"])],Ye.prototype,"readIsTable",null),e([He("web-map","isTable")],Ye.prototype,"writeIsTable",null),e([f(W)],Ye.prototype,"labelsVisible",void 0),e([f({type:[_e],json:{origins:{service:{name:"drawingInfo.labelingInfo",read:Ce,write:!1}},name:"layerDefinition.drawingInfo.labelingInfo",read:Ce,write:{layerContainerTypes:b}}})],Ye.prototype,"labelingInfo",void 0),e([f((()=>{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})())],Ye.prototype,"opacity",void 0),e([f($)],Ye.prototype,"legendEnabled",void 0),e([f({type:["show","hide"],json:(()=>{const e=a(H.json);return e.origins["portal-item"]={read:!1,write:!1},e})()})],Ye.prototype,"listMode",void 0),e([$e("globalIdField",["layerDefinition.globalIdField","layerDefinition.fields"])],Ye.prototype,"readGlobalIdField",null),e([f({json:{origins:{"web-map":{write:{target:"layerDefinition.objectIdField",overridePolicy:Xe}}}}})],Ye.prototype,"objectIdField",void 0),e([$e("objectIdField",["layerDefinition.objectIdField","layerDefinition.fields"])],Ye.prototype,"readObjectIdField",null),e([f({type:["ArcGISFeatureLayer"],json:{write:{target:"layerType",ignoreOrigin:!0,layerContainerTypes:b}}})],Ye.prototype,"operationalLayerType",void 0),e([f(Ke.outFields)],Ye.prototype,"outFields",void 0),e([f({type:String,json:{origins:{"web-scene":{read:!0,write:!0}},read:!1}})],Ye.prototype,"path",void 0),e([f(z)],Ye.prototype,"popupEnabled",void 0),e([f({type:t,json:{name:"popupInfo",write:!0}})],Ye.prototype,"popupTemplate",void 0),e([He("popupTemplate")],Ye.prototype,"writePopupTemplate",null),e([f({readOnly:!0})],Ye.prototype,"defaultPopupTemplate",null),e([f({types:Re,json:{origins:{service:{write:{target:"drawingInfo.renderer",enabled:!1}},"web-scene":{types:Qe,name:"layerDefinition.drawingInfo.renderer",write:{layerContainerTypes:b,overridePolicy:(e,t,r)=>({ignoreOrigin:r?.writeLayerSchema,layerContainerTypes:b})}}},write:{target:"layerDefinition.drawingInfo.renderer",overridePolicy:(e,t,r)=>({ignoreOrigin:r?.writeLayerSchema,layerContainerTypes:b})}}})],Ye.prototype,"renderer",null),e([$e("service","renderer",["drawingInfo.renderer","defaultSymbol"]),$e("renderer",["layerDefinition.drawingInfo.renderer","layerDefinition.defaultSymbol"])],Ye.prototype,"readRenderer",null),e([f()],Ye.prototype,"resourceInfo",void 0),e([f((()=>{const e=a(k);return e.json.origins["portal-item"]={read:!1,write:!1},e})())],Ye.prototype,"screenSizePerspectiveEnabled",void 0),e([f({clonable:!1})],Ye.prototype,"source",null),e([$e("portal-item","source",["featureSet"]),$e("web-map","source",["featureSet"])],Ye.prototype,"readSource",null),e([f({json:{read:{source:"layerDefinition.extent.spatialReference"}}})],Ye.prototype,"spatialReference",void 0),e([f({type:Number})],Ye.prototype,"subtypeCode",void 0),e([f({type:[ve]})],Ye.prototype,"templates",void 0),e([$e("templates",["editFieldsInfo","creatorField","editorField","templates"])],Ye.prototype,"readTemplates",null),e([f({type:xe})],Ye.prototype,"timeInfo",void 0),e([f()],Ye.prototype,"title",void 0),e([$e("service","title",["name"]),$e("portal-item","title",["layerDefinition.title","layerDefinition.name","title"])],Ye.prototype,"readTitle",null),e([$e("web-map","title",["layerDefinition.name","title"])],Ye.prototype,"readTitleFromWebMap",null),e([f({type:String})],Ye.prototype,"sublayerTitleMode",void 0),e([f({json:{read:!1}})],Ye.prototype,"type",void 0),e([f({type:String})],Ye.prototype,"typeIdField",void 0),e([$e("service","typeIdField"),$e("typeIdField",["layerDefinition.typeIdField"])],Ye.prototype,"readTypeIdField",null),e([f({type:[Te]})],Ye.prototype,"types",void 0),e([$e("service","types",["types"]),$e("types",["layerDefinition.types"])],Ye.prototype,"readTypes",null),e([f({type:Boolean,json:{origins:{"portal-item":{write:{target:"layerDefinition.defaultVisibility",layerContainerTypes:b}}}}})],Ye.prototype,"visible",void 0),e([$e("portal-item","visible",["visibility","layerDefinition.defaultVisibility"])],Ye.prototype,"readVisible",null),Ye=e([h("esri.layers.FeatureLayer")],Ye);export{Ye as default};
2
+ import{__decorate as e}from"tslib";import t from"../PopupTemplate.js";import r from"../request.js";import{ClonableMixin as 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{MultiOriginJSONSupportMixin 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{property as f,subclass as h}from"../core/accessorSupport/decorators.js";import{excludeTables as b}from"../core/accessorSupport/layerContainerType.js";import g from"../form/FormTemplate.js";import w from"../geometry/SpatialReference.js";import v from"../graphic/FeatureGraphicOrigin.js";import T from"./Layer.js";import{MemorySource as F}from"./graphics/sources/MemorySource.js";import{APIKeyMixin as j}from"./mixins/APIKeyMixin.js";import{ArcGISService as S}from"./mixins/ArcGISService.js";import{BlendLayer as I}from"./mixins/BlendLayer.js";import{CustomParametersMixin as E}from"./mixins/CustomParametersMixin.js";import{DisplayFilteredLayer as L}from"./mixins/DisplayFilteredLayer.js";import{EditBusLayer as D}from"./mixins/EditBusLayer.js";import{FeatureEffectLayer as _}from"./mixins/FeatureEffectLayer.js";import{FeatureLayerBase as C}from"./mixins/FeatureLayerBase.js";import{FeatureReductionLayer as P}from"./mixins/FeatureReductionLayer.js";import{OperationalLayer as x}from"./mixins/OperationalLayer.js";import{OrderedLayer as O}from"./mixins/OrderedLayer.js";import{PortalLayer as q}from"./mixins/PortalLayer.js";import{PublishableLayer as M}from"./mixins/PublishableLayer.js";import{RefreshableLayer as A}from"./mixins/RefreshableLayer.js";import{ScaleRangeLayer as Q}from"./mixins/ScaleRangeLayer.js";import{TemporalLayer as R}from"./mixins/TemporalLayer.js";import{TrackableLayer as U}from"./mixins/TrackableLayer.js";import{titleFromUrlAndName as V,parse as N,cleanTitle as B}from"./support/arcgisLayerUrl.js";import{attributeTableTemplate as G,id as J,labelsVisible as W,opacityDrawingInfo as Z,legendEnabled as $,listMode as H,popupEnabled as z,screenSizePerspectiveEnabled as k}from"./support/commonProperties.js";import{ensureLayerCredential as K,computeEffectiveEditingEnabled as X,readGlobalIdField as Y,readObjectIdField as ee,createDefaultRenderer as te,addAttachment as re,updateAttachment as ie,applyEdits as oe,uploadAssets as se,createQuery as ae,deleteAttachments as ne,fetchRecomputedExtents as le,getFeatureType as pe,getFieldDomain as ue,queryAttachments as de,queryObjectIds as ye,queryFeatureCount as ce,queryExtent as me,queryRelatedFeatures as fe,queryRelatedFeaturesCount as he,validateBinsQuery as be,hasDataChanged as ge,geometryTypeKebabDict as we}from"./support/featureLayerUtils.js";import ve from"./support/FeatureTemplate.js";import Te from"./support/FeatureType.js";import Fe from"./support/FieldConfiguration.js";import{popupTemplateWithFieldConfigurations as je,fieldConfigurationsFromPopupTemplate as Se,fieldConfigurationsFromFields as Ie}from"./support/fieldConfigUtils.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 Ce}from"./support/labelingInfo.js";import{getFeatureLayerCapabilities as Pe}from"./support/serviceCapabilitiesUtils.js";import xe from"./support/TimeInfo.js";import Oe from"./support/TitleCreator.js";import{serviceSupportsSpatialReference as qe}from"./support/versionUtils.js";import{read as Me}from"../renderers/support/jsonUtils.js";import{loadStyleRenderer as Ae}from"../renderers/support/styleUtils.js";import{webSceneRendererTypes as Qe,rendererTypes as Re}from"../renderers/support/typeUtils.js";import Ue from"../rest/layerSources/DynamicDataLayer.js";import Ve from"../rest/support/FeatureSet.js";import Ne from"../rest/support/Query.js";import{isNumber as Be}from"../support/guards.js";import{createPopupTemplate as Ge}from"../support/popupUtils.js";import{symbolTypes as Je}from"../symbols/support/typeUtils.js";import{opacityToTransparency as We}from"../webdoc/support/opacityUtils.js";import{addLayerUnsupportedError as Ze}from"../webdoc/support/unsupportedErrors.js";import{reader as $e}from"../core/accessorSupport/decorators/reader.js";import{writer as He}from"../core/accessorSupport/decorators/writer.js";const ze="FeatureLayer";function ke(e){return e&&e instanceof o}const Ke=Ee();function Xe(e,t,r){const i=!!r?.writeLayerSchema;return{enabled:i,ignoreOrigin:i}}let Ye=class extends(C(P(_(M(D(L(I(O(R(U(Q(A(S(x(q(p(E(j(i(T)))))))))))))))))))){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.graphicOrigin=new v(this),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=w.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 0:return i(this,t);case 1: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(()=>K(this,"load",e));return this.addResolvingPromise(r),Promise.resolve(this)}get _titleCreator(){const e=this._get("_titleCreator");return l(e),new Oe({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,Pe(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 X(this)}get featureTitleFields(){return[...this._titleCreator.requiredFields]}set fieldConfigurations(e){if(this._hasMemorySource())return;if(this._override("fieldConfigurations",e),!this.loaded)return;const t=je(this,e);t&&this._set("popupTemplate",t)}get fieldConfigurations(){if(!this._hasMemorySource())return this._isOverridden("fieldConfigurations")?this._get("fieldConfigurations"):Se(this)||null}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 Y(t.layerDefinition||t)}readObjectIdField(e,t){return ee(t.layerDefinition||t)}writePopupTemplate(e,t,r,i){e&&(t[r]=e.toJSON({...i,writeFieldFormat:!i?.writeLayerSchema}))}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=Me(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 te(t,r)}get source(){return this._get("source")}set source(e){e||(e=null);const t=this._get("source");t!==e&&((Array.isArray(e)||e instanceof o)&&(e=new F({layer:this,items:e})),ke(t)&&this._resetMemorySource(t),ke(e)&&this._initMemorySource(e),this._set("source",e))}readSource(e,t){const r=Ve.fromJSON(t.featureSet);return new F({layer:this,items:r?.features??[]})}readTemplates(e,t){const r=t.editFieldsInfo,i=r?.creatorField,o=r?.editorField;return e=e?.map(e=>ve.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){if("item-title"===this.sublayerTitleMode)return this.url?V(this.url,r):r;let e=r;if(!e&&this.url){const t=N(this.url);null!=t&&(e=t.title)}if(!e)return;const t=this.portalItem?.title;return"item-title-and-service-name"===this.sublayerTitleMode&&t&&t!==e&&(e=t+" - "+e),B(e)}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=Te.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 re(this,e,t,ze);return this.lastEditsEventDate=new Date,r}async updateAttachment(e,t,r){const i=await ie(this,e,t,r,ze);return this.lastEditsEventDate=new Date,i}async applyEdits(e,t){return oe(this,e,t)}async uploadAssets(e,t){return se(this,e,t)}createFieldConfigurations(){return Ie(this)}createPopupTemplate(e){return Ge(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=ae(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 ne(this,e,t,ze);return this.lastEditsEventDate=new Date,r}async fetchRecomputedExtents(e){return le(this,e,ze)}async getFeatureTitle(e,t){return this._titleCreator.getTitle(this,e,t)}async getFeatureTitles(e,t){return this._titleCreator.getTitles(this,e,t)}getFeatureType(e){return pe(this.types,this.typeIdField,e)}getFieldAlias(e){const t=this.getField(e);if(t)return this.getFieldConfiguration(t.name)?.alias||t.alias}getFieldConfiguration(e){return e=e.toLowerCase(),this.fieldConfigurations?.find(t=>t.name.toLowerCase()===e)}getFieldDomain(e,t){return ue(this,e,t,this.getField(e)?.domain??null)}async queryAttachments(e,t){return de(this,e,t,ze)}async queryFeatures(e,t){const r=await this.load(),i=await r.source.queryFeatures(Ne.from(e)??r.createQuery(),t),o=this.graphicOrigin;if(i?.features)for(const s of i.features)s.layer=s.sourceLayer=r,s.origin=o;return i}async queryObjectIds(e,t){return await ye(this,e,t,ze)}async queryFeatureCount(e,t){return ce(this,e,t,ze)}async queryExtent(e,t){return me(this,e,t,ze)}async queryRelatedFeatures(e,t){return fe(this,e,t,ze)}async queryRelatedFeaturesCount(e,t){return he(this,e,t,ze)}async queryPivot(e,t){const{source:r,capabilities:i}=await this.load();if(!r.queryPivot||!i?.operations?.supportsQueryPivot)throw new s(ze,"Layer source does not support queryPivot capability");const o=await import("../rest/support/PivotQuery.js"),a=await r.queryPivot(o.default.from(e),t),n=this.graphicOrigin;if(a?.features)for(const s of a.features)s.layer=s.sourceLayer=this,s.origin=n;return a}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),n=this.graphicOrigin;if(a?.features)for(const s of a.features)s.layer=s.sourceLayer=this,s.origin=n;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");be(e,i,ze);const o=await import("../rest/support/AttributeBinsQuery.js"),a=await r.queryAttributeBins(o.default.from(e),t),n=this.graphicOrigin;if(a.features)for(const s of a.features)s.layer=s.sourceLayer=this,s.origin=n;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(Be)}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),"service"===t?.origin&&(["objectIdField","fields","timeInfo","dateFieldsTimeZone"].forEach(e=>this.revertToOrigin(e,"service")),this.spatialReference||this.revertToOrigin("spatialReference","service"))}write(e,t){t={...t,origin:t?.origin??void 0,writeLayerSchema:t?.writeLayerSchema??this._hasMemorySource()};const{origin:r,layerContainerType:i}=t;if(this.dynamicDataSource)return Ze(t,this,"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 Ze(t,this,"a table source can only be written to tables"),null;if(this._hasMemorySource())return Ze(t,this,"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 Ze(t,this,"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(0,e)}async saveAs(e,t){return this._debouncedSaveOperations(1,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),Ae(this,{origin:"service"})}async hasDataChanged(){return ge(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){const t=[...e.layers||[],...e.tables||[]];return t.find(({type:e})=>!e||this.supportedSourceTypes.has(e))?.id}};e([f({clonable:!1,readOnly:!0})],Ye.prototype,"_titleCreator",null),e([f(G)],Ye.prototype,"attributeTableTemplate",void 0),e([$e("service","capabilities")],Ye.prototype,"readCapabilities",null),e([f({json:{origins:{"web-scene":{write:!1}},write:!0}})],Ye.prototype,"charts",void 0),e([f({readOnly:!0})],Ye.prototype,"createQueryVersion",null),e([f({json:{read:{source:"layerDefinition.copyrightText"}}})],Ye.prototype,"copyright",void 0),e([f({json:{read:{source:"layerDefinition.displayField"}}})],Ye.prototype,"displayField",void 0),e([f({types:Je,readOnly:!0})],Ye.prototype,"defaultSymbol",void 0),e([f({type:Ue})],Ye.prototype,"dynamicDataSource",void 0),e([f({type:Boolean})],Ye.prototype,"editingEnabled",null),e([$e(["portal-item","web-scene"],"editingEnabled",["layerDefinition.capabilities"])],Ye.prototype,"readEditingEnabled",null),e([$e("web-map","editingEnabled",["capabilities","layerDefinition.capabilities"])],Ye.prototype,"readEditingEnabledFromWebMap",null),e([He(["portal-item","web-scene"],"editingEnabled",{"layerDefinition.capabilities":{type:String}})],Ye.prototype,"writeEditingEnabled",null),e([He("web-map","editingEnabled",{capabilities:{type:String},"layerDefinition.capabilities":{type:String}})],Ye.prototype,"writeEditingEnabledToWebMap",null),e([f({readOnly:!0})],Ye.prototype,"effectiveEditingEnabled",null),e([f({clonable:!1,readOnly:!0})],Ye.prototype,"featureTitleFields",null),e([f({type:[Fe],json:{name:"layerDefinition.fieldConfigurations",write:{overridePolicy(e,t,r){return{enabled:!r?.writeLayerSchema,ignoreOrigin:1===this.originIdOf(t)}}}}})],Ye.prototype,"fieldConfigurations",null),e([f({...Ke.fields,json:{read:{source:"layerDefinition.fields"},origins:{service:{name:"fields"},"web-map":{write:{target:"layerDefinition.fields",overridePolicy:Xe}}}}})],Ye.prototype,"fields",void 0),e([f(Ke.fieldsIndex)],Ye.prototype,"fieldsIndex",void 0),e([f({type:g,json:{name:"formInfo",write:!0,origins:{"web-scene":{read:!1,write:!1}}}})],Ye.prototype,"formTemplate",void 0),e([f({json:{read:{source:"layerDefinition.extent"}}})],Ye.prototype,"fullExtent",void 0),e([f({json:{origins:{"web-map":{write:{target:"layerDefinition.geometryType",overridePolicy:Xe,writer(e,t,r){const i=e?we.toJSON(e):null;i&&u(r,i,t)}}}},read:{source:"layerDefinition.geometryType",reader:we.read}}})],Ye.prototype,"geometryType",void 0),e([f({readOnly:!0,clonable:!1})],Ye.prototype,"graphicOrigin",void 0),e([f({json:{read:{source:"layerDefinition.hasM"}}})],Ye.prototype,"hasM",void 0),e([f({json:{read:{source:"layerDefinition.hasZ"}}})],Ye.prototype,"hasZ",void 0),e([f(J)],Ye.prototype,"id",void 0),e([f({readOnly:!0,json:{origins:{service:{read:!0}},read:!1}})],Ye.prototype,"infoFor3D",void 0),e([f({json:{origins:{"web-map":{write:{target:"layerDefinition.type"}}}}})],Ye.prototype,"isTable",void 0),e([$e("service","isTable",["type","geometryType"]),$e("isTable",["layerDefinition.type","layerDefinition.geometryType"])],Ye.prototype,"readIsTable",null),e([He("web-map","isTable")],Ye.prototype,"writeIsTable",null),e([f(W)],Ye.prototype,"labelsVisible",void 0),e([f({type:[_e],json:{origins:{service:{name:"drawingInfo.labelingInfo",read:Ce,write:!1}},name:"layerDefinition.drawingInfo.labelingInfo",read:Ce,write:{layerContainerTypes:b}}})],Ye.prototype,"labelingInfo",void 0),e([f((()=>{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})())],Ye.prototype,"opacity",void 0),e([f($)],Ye.prototype,"legendEnabled",void 0),e([f({type:["show","hide"],json:(()=>{const e=a(H.json);return e.origins["portal-item"]={read:!1,write:!1},e})()})],Ye.prototype,"listMode",void 0),e([$e("globalIdField",["layerDefinition.globalIdField","layerDefinition.fields"])],Ye.prototype,"readGlobalIdField",null),e([f({json:{origins:{"web-map":{write:{target:"layerDefinition.objectIdField",overridePolicy:Xe}}}}})],Ye.prototype,"objectIdField",void 0),e([$e("objectIdField",["layerDefinition.objectIdField","layerDefinition.fields"])],Ye.prototype,"readObjectIdField",null),e([f({type:["ArcGISFeatureLayer"],json:{write:{target:"layerType",ignoreOrigin:!0,layerContainerTypes:b}}})],Ye.prototype,"operationalLayerType",void 0),e([f(Ke.outFields)],Ye.prototype,"outFields",void 0),e([f({type:String,json:{origins:{"web-scene":{read:!0,write:!0}},read:!1}})],Ye.prototype,"path",void 0),e([f(z)],Ye.prototype,"popupEnabled",void 0),e([f({type:t,json:{name:"popupInfo",write:!0}})],Ye.prototype,"popupTemplate",void 0),e([He("popupTemplate")],Ye.prototype,"writePopupTemplate",null),e([f({readOnly:!0})],Ye.prototype,"defaultPopupTemplate",null),e([f({types:Re,json:{origins:{service:{write:{target:"drawingInfo.renderer",enabled:!1}},"web-scene":{types:Qe,name:"layerDefinition.drawingInfo.renderer",write:{layerContainerTypes:b,overridePolicy:(e,t,r)=>({ignoreOrigin:r?.writeLayerSchema,layerContainerTypes:b})}}},write:{target:"layerDefinition.drawingInfo.renderer",overridePolicy:(e,t,r)=>({ignoreOrigin:r?.writeLayerSchema,layerContainerTypes:b})}}})],Ye.prototype,"renderer",null),e([$e("service","renderer",["drawingInfo.renderer","defaultSymbol"]),$e("renderer",["layerDefinition.drawingInfo.renderer","layerDefinition.defaultSymbol"])],Ye.prototype,"readRenderer",null),e([f()],Ye.prototype,"resourceInfo",void 0),e([f((()=>{const e=a(k);return e.json.origins["portal-item"]={read:!1,write:!1},e})())],Ye.prototype,"screenSizePerspectiveEnabled",void 0),e([f({clonable:!1})],Ye.prototype,"source",null),e([$e("portal-item","source",["featureSet"]),$e("web-map","source",["featureSet"])],Ye.prototype,"readSource",null),e([f({json:{read:{source:"layerDefinition.extent.spatialReference"}}})],Ye.prototype,"spatialReference",void 0),e([f({type:Number})],Ye.prototype,"subtypeCode",void 0),e([f({type:[ve]})],Ye.prototype,"templates",void 0),e([$e("templates",["editFieldsInfo","creatorField","editorField","templates"])],Ye.prototype,"readTemplates",null),e([f({type:xe})],Ye.prototype,"timeInfo",void 0),e([f()],Ye.prototype,"title",void 0),e([$e("service","title",["name"]),$e("portal-item","title",["layerDefinition.title","layerDefinition.name","title"])],Ye.prototype,"readTitle",null),e([$e("web-map","title",["layerDefinition.name","title"])],Ye.prototype,"readTitleFromWebMap",null),e([f({type:String})],Ye.prototype,"sublayerTitleMode",void 0),e([f({json:{read:!1}})],Ye.prototype,"type",void 0),e([f({type:String})],Ye.prototype,"typeIdField",void 0),e([$e("service","typeIdField"),$e("typeIdField",["layerDefinition.typeIdField"])],Ye.prototype,"readTypeIdField",null),e([f({type:[Te]})],Ye.prototype,"types",void 0),e([$e("service","types",["types"]),$e("types",["layerDefinition.types"])],Ye.prototype,"readTypes",null),e([f({type:Boolean,json:{origins:{"portal-item":{write:{target:"layerDefinition.defaultVisibility",layerContainerTypes:b}}}}})],Ye.prototype,"visible",void 0),e([$e("portal-item","visible",["visibility","layerDefinition.defaultVisibility"])],Ye.prototype,"readVisible",null),Ye=e([h("esri.layers.FeatureLayer")],Ye);export{Ye as default};
@@ -16,9 +16,9 @@ import type AttributeTableTemplate from "../tables/AttributeTableTemplate.js";
16
16
  import type TimeExtent from "../time/TimeExtent.js";
17
17
  import type TimeInterval from "../time/TimeInterval.js";
18
18
  import type { MultiOriginJSONSupportMixin } from "../core/MultiOriginJSONSupport.js";
19
+ import type { Edits, EditsResult } from "../editing/types.js";
19
20
  import type { LayerEvents, LayerProperties } from "./Layer.js";
20
21
  import type { FeatureLayerCapabilities, FieldDomainOptions } from "./types.js";
21
- import type { Edits, EditsResult } from "./graphics/editingSupport.js";
22
22
  import type { BlendLayer, BlendLayerProperties } from "./mixins/BlendLayer.js";
23
23
  import type { CustomParameters, CustomParametersMixin, CustomParametersMixinProperties } from "./mixins/CustomParametersMixin.js";
24
24
  import type { DisplayFilteredLayer, DisplayFilteredLayerProperties } from "./mixins/DisplayFilteredLayer.js";
@@ -1453,9 +1453,9 @@ export default class GeoJSONLayer extends GeoJSONLayerSuperclass {
1453
1453
  *
1454
1454
  * Property | Type | Description
1455
1455
  * ---------|------|-------------
1456
- * addFeatureResults | [FeatureEditResult[]](https://developers.arcgis.com/javascript/latest/references/core/layers/graphics/editingSupport/#FeatureEditResult) | Result of adding features.
1457
- * deleteFeatureResults | [FeatureEditResult[]](https://developers.arcgis.com/javascript/latest/references/core/layers/graphics/editingSupport/#FeatureEditResult) | Result of deleting features.
1458
- * updateFeatureResults | [FeatureEditResult[]](https://developers.arcgis.com/javascript/latest/references/core/layers/graphics/editingSupport/#FeatureEditResult) | Result of updating features.
1456
+ * addFeatureResults | [FeatureEditResult[]](https://developers.arcgis.com/javascript/latest/references/core/editing/types/#FeatureEditResult) | Result of adding features.
1457
+ * deleteFeatureResults | [FeatureEditResult[]](https://developers.arcgis.com/javascript/latest/references/core/editing/types/#FeatureEditResult) | Result of deleting features.
1458
+ * updateFeatureResults | [FeatureEditResult[]](https://developers.arcgis.com/javascript/latest/references/core/editing/types/#FeatureEditResult) | Result of updating features.
1459
1459
  * @see [Sample - Edit features](https://developers.arcgis.com/javascript/latest/sample-code/editing-applyedits/)
1460
1460
  * @example
1461
1461
  * function addFeature(geometry) {
@@ -58,8 +58,8 @@ export interface OrientedImageryLayerProperties extends FeatureLayerProperties,
58
58
  * @see [source](https://developers.arcgis.com/javascript/latest/references/core/layers/OrientedImageryLayer/#source)
59
59
  * @see [objectIdField](https://developers.arcgis.com/javascript/latest/references/core/layers/OrientedImageryLayer/#objectIdField)
60
60
  * @see [Add an array of client-side features](https://developers.arcgis.com/javascript/latest/references/core/layers/OrientedImageryLayer/#client-side)
61
- * @see [FeatureLayer.source](https://developers.arcgis.com/javascript/latest/references/core/layers/FeatureLayer/#source)
62
- * @see [FeatureLayer.objectIdField](https://developers.arcgis.com/javascript/latest/references/core/layers/FeatureLayer/#objectIdField)
61
+ * @see [source](https://developers.arcgis.com/javascript/latest/references/core/layers/FeatureLayer/#source)
62
+ * @see [objectIdField](https://developers.arcgis.com/javascript/latest/references/core/layers/FeatureLayer/#objectIdField)
63
63
  * @see [Add an array of client-side features](https://developers.arcgis.com/javascript/latest/references/core/layers/FeatureLayer/#client-side)
64
64
  * @example
65
65
  * // define each field's schema
@@ -156,7 +156,7 @@ export interface OrientedImageryLayerProperties extends FeatureLayerProperties,
156
156
  * @since 4.29
157
157
  * @see [SceneView.popup](https://developers.arcgis.com/javascript/latest/references/core/views/SceneView/#popup)
158
158
  * @see [View2D.popup](https://developers.arcgis.com/javascript/latest/references/core/views/View2D/#popup)
159
- * @see [FeatureLayer.createPopupTemplate()](https://developers.arcgis.com/javascript/latest/references/core/layers/FeatureLayer/#createPopupTemplate)
159
+ * @see [createPopupTemplate()](https://developers.arcgis.com/javascript/latest/references/core/layers/FeatureLayer/#createPopupTemplate)
160
160
  * @see [SceneView.popup](https://developers.arcgis.com/javascript/latest/references/core/views/SceneView/#popup)
161
161
  * @see [View2D.popup](https://developers.arcgis.com/javascript/latest/references/core/views/View2D/#popup)
162
162
  */
@@ -499,8 +499,8 @@ export default class OrientedImageryLayer extends __FeatureLayerSansType {
499
499
  * @see [source](https://developers.arcgis.com/javascript/latest/references/core/layers/OrientedImageryLayer/#source)
500
500
  * @see [objectIdField](https://developers.arcgis.com/javascript/latest/references/core/layers/OrientedImageryLayer/#objectIdField)
501
501
  * @see [Add an array of client-side features](https://developers.arcgis.com/javascript/latest/references/core/layers/OrientedImageryLayer/#client-side)
502
- * @see [FeatureLayer.source](https://developers.arcgis.com/javascript/latest/references/core/layers/FeatureLayer/#source)
503
- * @see [FeatureLayer.objectIdField](https://developers.arcgis.com/javascript/latest/references/core/layers/FeatureLayer/#objectIdField)
502
+ * @see [source](https://developers.arcgis.com/javascript/latest/references/core/layers/FeatureLayer/#source)
503
+ * @see [objectIdField](https://developers.arcgis.com/javascript/latest/references/core/layers/FeatureLayer/#objectIdField)
504
504
  * @see [Add an array of client-side features](https://developers.arcgis.com/javascript/latest/references/core/layers/FeatureLayer/#client-side)
505
505
  * @example
506
506
  * // define each field's schema
@@ -675,7 +675,7 @@ export default class OrientedImageryLayer extends __FeatureLayerSansType {
675
675
  * @since 4.29
676
676
  * @see [SceneView.popup](https://developers.arcgis.com/javascript/latest/references/core/views/SceneView/#popup)
677
677
  * @see [View2D.popup](https://developers.arcgis.com/javascript/latest/references/core/views/View2D/#popup)
678
- * @see [FeatureLayer.createPopupTemplate()](https://developers.arcgis.com/javascript/latest/references/core/layers/FeatureLayer/#createPopupTemplate)
678
+ * @see [createPopupTemplate()](https://developers.arcgis.com/javascript/latest/references/core/layers/FeatureLayer/#createPopupTemplate)
679
679
  * @see [SceneView.popup](https://developers.arcgis.com/javascript/latest/references/core/views/SceneView/#popup)
680
680
  * @see [View2D.popup](https://developers.arcgis.com/javascript/latest/references/core/views/View2D/#popup)
681
681
  */
@@ -23,9 +23,9 @@ import type TimeInterval from "../time/TimeInterval.js";
23
23
  import type { ClonableMixin } from "../core/Clonable.js";
24
24
  import type { MultiOriginJSONSupportMixin } from "../core/MultiOriginJSONSupport.js";
25
25
  import type { AbortOptions } from "../core/promiseUtils.js";
26
+ import type { EditOptions, Edits, EditsResult } from "../editing/types.js";
26
27
  import type { LayerEvents, LayerProperties } from "./Layer.js";
27
28
  import type { FieldDomainOptions, SceneLayerCapabilities } from "./types.js";
28
- import type { EditOptions, Edits, EditsResult } from "./graphics/editingSupport.js";
29
29
  import type { APIKeyMixin, APIKeyMixinProperties } from "./mixins/APIKeyMixin.js";
30
30
  import type { CustomParametersMixin, CustomParametersMixinProperties } from "./mixins/CustomParametersMixin.js";
31
31
  import type { EditBusLayerEvents, EditBusLayer } from "./mixins/EditBusLayer.js";
@@ -1096,7 +1096,7 @@ export default class SceneLayer extends SceneLayerSuperclass {
1096
1096
  *
1097
1097
  * @param edits - Object containing features to be updated.
1098
1098
  * @param options - Additional edit options to specify when editing features.
1099
- * @returns When resolved, an [EditsResult](https://developers.arcgis.com/javascript/latest/references/core/layers/graphics/editingSupport/#EditsResult)
1099
+ * @returns When resolved, an [EditsResult](https://developers.arcgis.com/javascript/latest/references/core/editing/types/#EditsResult)
1100
1100
  * object is returned.
1101
1101
  */
1102
1102
  applyEdits(edits: Edits, options?: EditOptions): Promise<EditsResult>;
@@ -10,9 +10,9 @@ import type FeatureSet from "../rest/support/FeatureSet.js";
10
10
  import type Query from "../rest/support/Query.js";
11
11
  import type { ClonableMixin } from "../core/Clonable.js";
12
12
  import type { MultiOriginJSONSupportMixin } from "../core/MultiOriginJSONSupport.js";
13
+ import type { EditOptions, Edits, EditsResult, FeatureEditResult } from "../editing/types.js";
13
14
  import type { LayerEvents, LayerProperties } from "./Layer.js";
14
15
  import type { LayerSaveAsOptions, LayerSaveOptions } from "./types.js";
15
- import type { EditOptions, Edits, EditsResult, FeatureEditResult } from "./graphics/editingSupport.js";
16
16
  import type { APIKeyMixin, APIKeyMixinProperties } from "./mixins/APIKeyMixin.js";
17
17
  import type { BlendLayer, BlendLayerProperties } from "./mixins/BlendLayer.js";
18
18
  import type { CustomParametersMixin, CustomParametersMixinProperties } from "./mixins/CustomParametersMixin.js";
@@ -294,7 +294,7 @@ export default class SubtypeGroupLayer extends SubtypeGroupLayerSuperclass {
294
294
  *
295
295
  * @param feature - Feature to which the attachment is to be added.
296
296
  * @param attachment - HTML form that contains a file upload field pointing to the file to be added as an attachment.
297
- * @returns When resolved, a [FeatureEditResult](https://developers.arcgis.com/javascript/latest/references/core/layers/graphics/editingSupport/#FeatureEditResult)
297
+ * @returns When resolved, a [FeatureEditResult](https://developers.arcgis.com/javascript/latest/references/core/editing/types/#FeatureEditResult)
298
298
  * object is returned. FeatureEditResult indicates whether or not the edit was successful. If successful, the `objectId` of the result is the Id of
299
299
  * the new attachment. If unsuccessful, it also includes an error `name` and error `message`.
300
300
  * @see [capabilities.data.supportsAttachment](https://developers.arcgis.com/javascript/latest/references/core/layers/SubtypeGroupLayer/#capabilities)
@@ -358,7 +358,7 @@ export default class SubtypeGroupLayer extends SubtypeGroupLayerSuperclass {
358
358
  *
359
359
  * @param edits - Object containing features and attachments to be added, updated or deleted.
360
360
  * @param options - Additional edit options to specify when editing features or attachments.
361
- * @returns When resolved, an [EditsResult](https://developers.arcgis.com/javascript/latest/references/core/layers/graphics/editingSupport/#EditsResult)
361
+ * @returns When resolved, an [EditsResult](https://developers.arcgis.com/javascript/latest/references/core/editing/types/#EditsResult)
362
362
  * object is returned.
363
363
  * @see [Sample - Edit features](https://developers.arcgis.com/javascript/latest/sample-code/editing-applyedits/)
364
364
  * @example
@@ -453,7 +453,7 @@ export default class SubtypeGroupLayer extends SubtypeGroupLayerSuperclass {
453
453
  *
454
454
  * @param feature - Feature containing attachments to be deleted.
455
455
  * @param attachmentIds - Ids of the attachments to be deleted.
456
- * @returns When resolved, an array of [FeatureEditResults](https://developers.arcgis.com/javascript/latest/references/core/layers/graphics/editingSupport/#FeatureEditResult)
456
+ * @returns When resolved, an array of [FeatureEditResults](https://developers.arcgis.com/javascript/latest/references/core/editing/types/#FeatureEditResult)
457
457
  * is returned. FeatureEditResult indicates whether or not the edit was successful. If successful, the `objectId` of the result is the Id of
458
458
  * the new attachment. If unsuccessful, it also includes an error `name` and error `message`.
459
459
  * @see [capabilities.data.supportsAttachment](https://developers.arcgis.com/javascript/latest/references/core/layers/SubtypeGroupLayer/#capabilities)
@@ -887,7 +887,7 @@ export default class SubtypeGroupLayer extends SubtypeGroupLayerSuperclass {
887
887
  * @param feature - The feature containing the attachment to be updated.
888
888
  * @param attachmentId - Id of the attachment to be updated.
889
889
  * @param attachment - HTML form that contains a file upload field pointing to the file to be added as an attachment.
890
- * @returns When resolved, a [FeatureEditResult](https://developers.arcgis.com/javascript/latest/references/core/layers/graphics/editingSupport/#FeatureEditResult)
890
+ * @returns When resolved, a [FeatureEditResult](https://developers.arcgis.com/javascript/latest/references/core/editing/types/#FeatureEditResult)
891
891
  * object is returned. FeatureEditResult indicates whether or not the edit was successful. If successful, the `objectId` of the result is the Id of
892
892
  * the new attachment. If unsuccessful, it also includes an error `name` and error `message`.
893
893
  * @see [capabilities.data.supportsAttachment](https://developers.arcgis.com/javascript/latest/references/core/layers/SubtypeGroupLayer/#capabilities)
@@ -1,2 +1,2 @@
1
1
  /* COPYRIGHT Esri - https://js.arcgis.com/5.0/LICENSE.txt */
2
- import e from"../../Graphic.js";import t from"../../core/Error.js";import r from"../../core/Logger.js";import{getMetersPerCartesianUnitForSR as a}from"../../core/units.js";import{parseData as s}from"../../core/urlUtils.js";import{isEqualBaseGCS as o,canProjectWithoutEngine as n,projectWithoutEngine as l}from"../../geometry/projectionUtils.js";import{fromJSON as i}from"../../geometry/support/jsonUtils.js";import u from"../../geometry/support/MeshTransform.js";import{equals as d}from"../../geometry/support/spatialReferenceUtils.js";import{isFeatureIdentifierArrayWithGlobalId as c,isFeatureIdentifierArrayWithObjectId as p}from"./editingSupport.js";async function m(e,t,r){const{geometry:s}=t,i={...t.attributes};if(null!=r&&"mesh"===s?.type){const{transformFieldRoles:t}=r,{origin:c,spatialReference:p,vertexSpace:m}=s,f=s.transform??new u,g="local"===m.type,b=e.spatialReference,y=b.isGeographic,R=d(b,p),h=o(p,b)&&n(p,b);if(!(g&&y&&h||!g&&!y&&R))return null;const I=l(c,p,b);if(null==I)return null;if(i[t.originX]=I.x,i[t.originY]=I.y,i[t.originZ]=I.z??0,null!=f){const{translation:e,scale:r,rotation:s}=f,o=g?1:a(p)/a(b);i[t.translationX]=e[0]*o,i[t.translationY]=e[2]*o,i[t.translationZ]=-e[1]*o,i[t.scaleX]=r[0],i[t.scaleY]=r[2],i[t.scaleZ]=r[1],i[t.rotationX]=s[0],i[t.rotationY]=s[2],i[t.rotationZ]=-s[1],i[t.rotationDeg]=s[3]}return{attributes:i}}return null==s?{attributes:i}:"mesh"===s.type||"extent"===s.type?null:{geometry:s.toJSON(),attributes:i}}async function f(e,t){const r=await Promise.all((t.addAttachments??[]).map(t=>g(e,t))),a=await Promise.all((t.updateAttachments??[]).map(t=>g(e,t))),s=t.deleteAttachments??[];return r.length||a.length||s.length?{adds:r,updates:a,deletes:[...s]}:null}async function g(e,t){const{feature:r,attachment:a}=t,{globalId:o,name:n,contentType:l,data:i,uploadId:u}=a,d={globalId:o};if(r&&("attributes"in r?d.parentGlobalId=r.attributes?.[e.globalIdField]:r.globalId&&(d.parentGlobalId=r.globalId)),u)d.uploadId=u;else if(i){const e=await s(i);e&&(d.contentType=e.mediaType,d.data=e.data),i instanceof File&&(d.name=i.name)}return n&&(d.name=n),l&&(d.contentType=l),d}function b(e,t,r){if(!t||0===t.length)return[];if(r&&c(t))return t.map(e=>e.globalId);if(p(t))return t.map(e=>e.objectId);const a=r?e.globalIdField:e.objectIdField;return a?t.map(e=>e.getAttribute(a)):[]}function y(e){const t=e?.assetMaps;if(t){for(const e of t.addResults)e.success||r.getLogger("esri.layers.graphics.sources.support.sourceUtils").error(`Failed to map asset to feature with globalId ${e.globalId}.`);for(const e of t.updateResults)e.success||r.getLogger("esri.layers.graphics.sources.support.sourceUtils").error(`Failed to map asset to feature with globalId ${e.globalId}.`)}const a=e?.attachments,s={addFeatureResults:e?.addResults?.map(R)??[],updateFeatureResults:e?.updateResults?.map(R)??[],deleteFeatureResults:e?.deleteResults?.map(R)??[],addAttachmentResults:a?.addResults?a.addResults.map(R):[],updateAttachmentResults:a?.updateResults?a.updateResults.map(R):[],deleteAttachmentResults:a?.deleteResults?a.deleteResults.map(R):[]};return e?.editMoment&&(s.editMoment=e.editMoment),s}function R(e){const r=!0===e.success?null:e.error||{code:void 0,description:"Feature edit failed"};return{objectId:e.objectId,globalId:e.globalId,error:r?new t("feature-layer-source:edit-failure",r.description,{code:r.code}):null}}function h(t,r){return new e({attributes:t.attributes,geometry:i({...t.geometry,spatialReference:r})})}function I(e,t){return{adds:e?.adds?.map(e=>h(e,t))||[],updates:e?.updates?.map(e=>({original:h(e[0],t),current:h(e[1],t)}))||[],deletes:e?.deletes?.map(e=>h(e,t))||[],spatialReference:t}}function j(e){const t=e.details.raw,r=+t.code,a=+t.extendedCode;return 500===r&&(-2147217144===a||-2147467261===a)}export{I as createEditedFeatures,R as createFeatureEditResult,f as getAttachmentEditsJSON,b as getFeatureIds,m as getFeatureJSON,j as isProtectedOrPrivateVersionError,y as unpackEditResultData};
2
+ import e from"../../Graphic.js";import t from"../../core/Error.js";import r from"../../core/Logger.js";import{getMetersPerCartesianUnitForSR as a}from"../../core/units.js";import{parseData as s}from"../../core/urlUtils.js";import{isFeatureIdentifierArrayWithGlobalId as o,isFeatureIdentifierArrayWithObjectId as n}from"../../editing/types.js";import{isEqualBaseGCS as l,canProjectWithoutEngine as i,projectWithoutEngine as u}from"../../geometry/projectionUtils.js";import{fromJSON as d}from"../../geometry/support/jsonUtils.js";import c from"../../geometry/support/MeshTransform.js";import{equals as p}from"../../geometry/support/spatialReferenceUtils.js";async function m(e,t,r){const{geometry:s}=t,o={...t.attributes};if(null!=r&&"mesh"===s?.type){const{transformFieldRoles:t}=r,{origin:n,spatialReference:d,vertexSpace:m}=s,f=s.transform??new c,g="local"===m.type,b=e.spatialReference,y=b.isGeographic,R=p(b,d),h=l(d,b)&&i(d,b);if(!(g&&y&&h||!g&&!y&&R))return null;const I=u(n,d,b);if(null==I)return null;if(o[t.originX]=I.x,o[t.originY]=I.y,o[t.originZ]=I.z??0,null!=f){const{translation:e,scale:r,rotation:s}=f,n=g?1:a(d)/a(b);o[t.translationX]=e[0]*n,o[t.translationY]=e[2]*n,o[t.translationZ]=-e[1]*n,o[t.scaleX]=r[0],o[t.scaleY]=r[2],o[t.scaleZ]=r[1],o[t.rotationX]=s[0],o[t.rotationY]=s[2],o[t.rotationZ]=-s[1],o[t.rotationDeg]=s[3]}return{attributes:o}}return null==s?{attributes:o}:"mesh"===s.type||"extent"===s.type?null:{geometry:s.toJSON(),attributes:o}}async function f(e,t){const r=await Promise.all((t.addAttachments??[]).map(t=>g(e,t))),a=await Promise.all((t.updateAttachments??[]).map(t=>g(e,t))),s=t.deleteAttachments??[];return r.length||a.length||s.length?{adds:r,updates:a,deletes:[...s]}:null}async function g(e,t){const{feature:r,attachment:a}=t,{globalId:o,name:n,contentType:l,data:i,uploadId:u}=a,d={globalId:o};if(r&&("attributes"in r?d.parentGlobalId=r.attributes?.[e.globalIdField]:r.globalId&&(d.parentGlobalId=r.globalId)),u)d.uploadId=u;else if(i){const e=await s(i);e&&(d.contentType=e.mediaType,d.data=e.data),i instanceof File&&(d.name=i.name)}return n&&(d.name=n),l&&(d.contentType=l),d}function b(e,t,r){if(!t||0===t.length)return[];if(r&&o(t))return t.map(e=>e.globalId);if(n(t))return t.map(e=>e.objectId);const a=r?e.globalIdField:e.objectIdField;return a?t.map(e=>e.getAttribute(a)):[]}function y(e){const t=e?.assetMaps;if(t){for(const e of t.addResults)e.success||r.getLogger("esri.layers.graphics.sources.support.sourceUtils").error(`Failed to map asset to feature with globalId ${e.globalId}.`);for(const e of t.updateResults)e.success||r.getLogger("esri.layers.graphics.sources.support.sourceUtils").error(`Failed to map asset to feature with globalId ${e.globalId}.`)}const a=e?.attachments,s={addFeatureResults:e?.addResults?.map(R)??[],updateFeatureResults:e?.updateResults?.map(R)??[],deleteFeatureResults:e?.deleteResults?.map(R)??[],addAttachmentResults:a?.addResults?a.addResults.map(R):[],updateAttachmentResults:a?.updateResults?a.updateResults.map(R):[],deleteAttachmentResults:a?.deleteResults?a.deleteResults.map(R):[]};return e?.editMoment&&(s.editMoment=e.editMoment),s}function R(e){const r=!0===e.success?null:e.error||{code:void 0,description:"Feature edit failed"};return{objectId:e.objectId,globalId:e.globalId,error:r?new t("feature-layer-source:edit-failure",r.description,{code:r.code}):null}}function h(t,r){return new e({attributes:t.attributes,geometry:d({...t.geometry,spatialReference:r})})}function I(e,t){return{adds:e?.adds?.map(e=>h(e,t))||[],updates:e?.updates?.map(e=>({original:h(e[0],t),current:h(e[1],t)}))||[],deletes:e?.deletes?.map(e=>h(e,t))||[],spatialReference:t}}function j(e){const t=e.details.raw,r=+t.code,a=+t.extendedCode;return 500===r&&(-2147217144===a||-2147467261===a)}export{I as createEditedFeatures,R as createFeatureEditResult,f as getAttachmentEditsJSON,b as getFeatureIds,m as getFeatureJSON,j as isProtectedOrPrivateVersionError,y as unpackEditResultData};
@@ -1,2 +1,2 @@
1
1
  /* COPYRIGHT Esri - https://js.arcgis.com/5.0/LICENSE.txt */
2
- const t={supportsStatistics:!0,supportsPercentileStatistics:!0,supportsSpatialAggregationStatistics:!1,supportedSpatialAggregationStatistics:{envelope:!1,centroid:!1,convexHull:!1},supportsCentroid:!0,supportsCentroidOnDegeneratedQuantizedGeometry:!0,supportsCacheHint:!0,supportsCurrentUser:!1,supportsDegeneratedQuantizedGeometry:!1,supportsDistance:!0,supportsDistinct:!0,supportsExtent:!0,supportsGeometryProperties:!1,supportsHavingClause:!0,supportsOrderBy:!0,supportsPagination:!0,supportsPaginationOnAggregatedQueries:!1,supportsQuantization:!0,supportsQuantizationEditMode:!1,supportsQueryGeometry:!0,supportsResultType:!0,supportsReturnMesh:!1,supportsSqlExpression:!0,supportsMaxRecordCountFactor:!1,supportsStandardizedQueriesOnly:!0,supportsTopFeaturesQuery:!1,supportsQueryByAnonymous:!0,supportsQueryByOthers:!0,supportsHistoricMoment:!1,supportsFormatPBF:!1,supportsDisjointSpatialRelationship:!0,supportsDefaultSpatialReference:!1,supportsFullTextSearch:!1,supportsCompactGeometry:!1,maxRecordCountFactor:void 0,maxRecordCount:void 0,maxUniqueIDCount:void 0,relativeTimeBinWindow:0,standardMaxRecordCount:void 0,tileMaxRecordCount:void 0,supportsTrueCurve:!1},s={supportsDate:!0,supportsFixedInterval:!0,supportsAutoInterval:!0,supportsFixedBoundaries:!0,supportsStackBy:!0,supportsSplitBy:!0,supportsSnapToData:!1,supportsReturnFullIntervalBin:!1,supportsFirstDayOfWeek:!1,supportsNormalization:!0,supportedStatistics:{count:!0,sum:!0,avg:!0,var:!0,stddev:!0,min:!0,max:!0,percentileContinuous:!0,percentileDiscrete:!0,envelope:!0,centroid:!0,convexHull:!0},supportedNormalizationTypes:{field:!0,log:!0,naturalLog:!0,percentOfTotal:!0,squareRoot:!0}};export{s as queryBinsCapabilities,t as queryCapabilities};
2
+ const t={supportsStatistics:!0,supportsPercentileStatistics:!0,supportsSpatialAggregationStatistics:!1,supportedSpatialAggregationStatistics:{envelope:!1,centroid:!1,convexHull:!1},supportsCentroid:!0,supportsCentroidOnDegeneratedQuantizedGeometry:!0,supportsCacheHint:!0,supportsCurrentUser:!1,supportsDegeneratedQuantizedGeometry:!1,supportsDistance:!0,supportsDistinct:!0,supportsExtent:!0,supportsGeometryProperties:!1,supportsHavingClause:!0,supportsOrderBy:!0,supportsPagination:!0,supportsPaginationOnAggregatedQueries:!1,supportsQuantization:!0,supportsQuantizationEditMode:!1,supportsQueryGeometry:!0,supportsResultType:!0,supportsReturnMesh:!1,supportsSqlExpression:!0,supportsMaxRecordCountFactor:!1,supportsStandardizedQueriesOnly:!0,supportsTopFeaturesQuery:!1,supportsQueryByAnonymous:!0,supportsQueryByOthers:!0,supportsHistoricMoment:!1,supportsFormatPBF:!1,supportsFormatPBFWithCurves:!1,supportsDisjointSpatialRelationship:!0,supportsDefaultSpatialReference:!1,supportsFullTextSearch:!1,supportsCompactGeometry:!1,maxRecordCountFactor:void 0,maxRecordCount:void 0,maxUniqueIDCount:void 0,relativeTimeBinWindow:0,standardMaxRecordCount:void 0,tileMaxRecordCount:void 0,supportsTrueCurve:!1},s={supportsDate:!0,supportsFixedInterval:!0,supportsAutoInterval:!0,supportsFixedBoundaries:!0,supportsStackBy:!0,supportsSplitBy:!0,supportsSnapToData:!1,supportsReturnFullIntervalBin:!1,supportsFirstDayOfWeek:!1,supportsNormalization:!0,supportedStatistics:{count:!0,sum:!0,avg:!0,var:!0,stddev:!0,min:!0,max:!0,percentileContinuous:!0,percentileDiscrete:!0,envelope:!0,centroid:!0,convexHull:!0},supportedNormalizationTypes:{field:!0,log:!0,naturalLog:!0,percentOfTotal:!0,squareRoot:!0}};export{s as queryBinsCapabilities,t as queryCapabilities};
@@ -1,2 +1,2 @@
1
1
  /* COPYRIGHT Esri - https://js.arcgis.com/5.0/LICENSE.txt */
2
- import e from"../../Graphic.js";import t from"../../core/Collection.js";import a from"../../core/Error.js";import{clone as r}from"../../core/lang.js";import s from"../../core/Logger.js";import{getOrCreateMapValue as i}from"../../core/MapUtils.js";import{createResolver as o}from"../../core/promiseUtils.js";import{dataComponents as n}from"../../core/urlUtils.js";import{generateBracedUUID as l}from"../../core/uuid.js";import{normalizeCentralMeridian as d}from"../../geometry/support/normalizeUtils.js";import{isGeographic as u,equals as p,isWGS84 as c,isWebMercator as m}from"../../geometry/support/spatialReferenceUtils.js";import{densifyUnsupportedCurves as h}from"../../geometry/support/curves/densifyCurvedGeometry.js";import{isEditBusLayer as f,emitApplyEditsEvent as y}from"../mixins/EditBusLayer.js";import{isHostedAgolService as g}from"../support/arcgisLayerUrl.js";import{isValidFieldValue as b}from"../support/fieldUtils.js";import{isGlbSupportedEditFormat as w}from"../support/infoFor3D.js";import{getEffectiveEditingEnabled as F,getEffectiveLayerCapabilities as v}from"../support/layerUtils.js";function A(e){return null!=e?.applyEdits}const I=()=>s.getLogger("esri.layers.graphics.editingSupport"),$=new WeakMap;function E(e){return"object"==typeof e&&null!=e&&"objectId"in e&&!!e.objectId}function S(e){return e.every(E)}function R(e){return"object"==typeof e&&null!=e&&"globalId"in e&&!!e.globalId}function j(e){return e.every(R)}async function O(e,t,a,s={}){let i;const n="gdbVersion"in e?e.gdbVersion:null,l=s.gdbVersion??n;if(f(e)&&e.url)i=y(e.url,e.layerId,l,"original-and-current-features"===s.returnServiceEditsOption);else{i=o(),i.promise.then(t=>{(t.addedFeatures.length||t.updatedFeatures.length||t.deletedFeatures.length||t.addedAttachments.length||t.updatedAttachments.length||t.deletedAttachments.length)&&e.emit("edits",t)});const t={result:i.promise};e.emit("apply-edits",t)}try{const{results:o,edits:n}=await U(e,t,a,s),l=e=>e.filter(e=>!e.error).map(r),d={edits:n,addedFeatures:l(o.addFeatureResults),updatedFeatures:l(o.updateFeatureResults),deletedFeatures:l(o.deleteFeatureResults),addedAttachments:l(o.addAttachmentResults),updatedAttachments:l(o.updateAttachmentResults),deletedAttachments:l(o.deleteAttachmentResults),exceededTransferLimit:!1,historicMoment:o.editMoment?new Date(o.editMoment):null,globalIdToObjectId:s.globalIdToObjectId};return o.editedFeatureResults?.length&&(d.editedFeatures=o.editedFeatureResults),i.resolve(d),o}catch(d){throw i.reject(d),d}}async function U(e,t,r,s){if(await e.load(),!A(t))throw new a(`${e.type}-layer:no-editing-support`,"Layer source does not support applyEdits capability",{layer:e});if(!F(e))throw new a(`${e.type}-layer:editing-disabled`,"Editing is disabled for layer",{layer:e});const{edits:i,options:o}=await k(e,r,s);return i.addFeatures?.length||i.updateFeatures?.length||i.deleteFeatures?.length||i.addAttachments?.length||i.updateAttachments?.length||i.deleteAttachments?.length?{edits:i,results:await t.applyEdits(i,o)}:{edits:i,results:{addFeatureResults:[],updateFeatureResults:[],deleteFeatureResults:[],addAttachmentResults:[],updateAttachmentResults:[],deleteAttachmentResults:[]}}}async function k(e,t,r){const s=v(e),o=t&&(t.addFeatures||t.updateFeatures||t.deleteFeatures),n=t&&(t.addAttachments||t.updateAttachments||t.deleteAttachments),l=null!=e.infoFor3D;if(W(t,s,r,!!o,!!n,`${e.type}-layer`),!s.data.isVersioned&&r?.gdbVersion)throw new a(`${e.type}-layer:invalid-parameter`,"'gdbVersion' is applicable only if the layer supports versioned data. See: 'capabilities.data.isVersioned'");if(!s.editing.supportsRollbackOnFailure&&r?.rollbackOnFailureEnabled)throw new a(`${e.type}-layer:invalid-parameter`,"This layer does not support 'rollbackOnFailureEnabled' parameter. See: 'capabilities.editing.supportsRollbackOnFailure'");const d={...r};if(null!=d.rollbackOnFailureEnabled||s.editing.supportsRollbackOnFailure||(d.rollbackOnFailureEnabled=!0),d.rollbackOnFailureEnabled||"original-and-current-features"!==d.returnServiceEditsOption||(!1===d.rollbackOnFailureEnabled&&I().warn(`${e.type}-layer:invalid-parameter`,"'original-and-current-features' is valid for 'returnServiceEditsOption' only when 'rollBackOnFailure' is true, but 'rollBackOnFailure' was set to false. 'rollBackOnFailure' has been overwritten and set to true."),d.rollbackOnFailureEnabled=!0),!s.editing.supportsReturnServiceEditsInSourceSpatialReference&&d.returnServiceEditsInSourceSR)throw new a(`${e.type}-layer:invalid-parameter`,"This layer does not support 'returnServiceEditsInSourceSR' parameter. See: 'capabilities.editing.supportsReturnServiceEditsInSourceSpatialReference'");if(d.returnServiceEditsInSourceSR&&"original-and-current-features"!==d.returnServiceEditsOption)throw new a(`${e.type}-layer:invalid-parameter`,"'returnServiceEditsInSourceSR' is valid only when 'returnServiceEditsOption' is set to 'original-and-current-features'");const u=C(t,s,`${e.type}-layer`),p=r?.globalIdUsed||l,c=e.fields.filter(e=>"big-integer"===e.type||"oid"===e.type&&(e.length||0)>=8);if(p){const{globalIdField:t}=e;if(null==t)throw new a(`${e.type}-layer:invalid-parameter`,"Layer does not specify a global id field.");u.addFeatures.forEach(e=>V(e,t))}u.addFeatures.forEach(t=>B(t,e,p,c)),u.updateFeatures.forEach(t=>G(t,e,p,c)),u.deleteFeatures.forEach(t=>M(t,e,p,c)),u.addAttachments.forEach(t=>D(t,e)),u.updateAttachments.forEach(t=>D(t,e)),l&&await N(u,e);const m=i($,e,()=>new Map),h=!g(e.url);return{edits:await x(u,s.data.supportedCurveTypes??[],h,m),options:d}}function L(e,t,r,s){if(r){if("attributes"in e&&!e.attributes[t.globalIdField])throw new a(`${t.type}-layer:invalid-parameter`,`Feature should have '${t.globalIdField}' when 'globalIdUsed' is true`);if(!("attributes"in e)&&!e.globalId)throw new a(`${t.type}-layer:invalid-parameter`,"`'globalId' of the feature should be passed when 'globalIdUsed' is true")}if(s.length&&"attributes"in e)for(const i of s){const r=e.attributes[i.name];if(void 0!==r&&!b(i,r))throw new a(`${t.type}-layer:invalid-parameter`,`Big-integer field '${i.name}' of the feature must be less than ${Number.MAX_SAFE_INTEGER}`,{feature:e})}if("geometry"in e&&null!=e.geometry){if(e.geometry.hasZ&&!1===t.capabilities?.data.supportsZ)throw new a(`${t.type}-layer:z-unsupported`,"Layer does not support z values while feature has z values.");if(e.geometry.hasM&&!1===t.capabilities?.data.supportsM)throw new a(`${t.type}-layer:m-unsupported`,"Layer does not support m values while feature has m values.")}}function T(e,t){if("geometry"in e&&"mesh"===e.geometry?.type&&null!=t.infoFor3D&&null!=t.spatialReference){const{geometry:r}=e,{spatialReference:s,vertexSpace:i}=r,o=t.spatialReference,n="local"===i.type,l=u(o),d=p(o,s),h=d||c(o)&&(c(s)||m(s));if(!(n&&l&&h||!n&&!l&&d))throw new a(`${t.type}-layer:mesh-unsupported`,`Uploading a mesh with a ${i.type} vertex space and a spatial reference wkid:${s.wkid} to a layer with a spatial reference wkid:${o.wkid} is not supported.`)}}function B(e,t,a,r){L(e,t,a,r),T(e,t)}function M(e,t,a,r){L(e,t,a,r)}function G(e,t,r,s){L(e,t,r,s),T(e,t);const i=v(t);if("geometry"in e&&null!=e.geometry&&!i?.editing.supportsGeometryUpdate)throw new a(`${t.type}-layer:unsupported-operation`,"Layer does not support geometry updates.")}function D(e,t){const{feature:r,attachment:s}=e;if(!r||"attributes"in r&&!r.attributes[t.globalIdField])throw new a(`${t.type}-layer:invalid-parameter`,"Attachment should have reference to a feature with 'globalId'");if(!("attributes"in r)&&!r.globalId)throw new a(`${t.type}-layer:invalid-parameter`,"Attachment should have reference to 'globalId' of the parent feature");if(!s.globalId)throw new a(`${t.type}-layer:invalid-parameter`,"Attachment should have 'globalId'");if(!s.data&&!s.uploadId)throw new a(`${t.type}-layer:invalid-parameter`,"Attachment should have 'data' or 'uploadId'");if(!(s.data instanceof File&&!!s.data.name)&&!s.name)throw new a(`${t.type}-layer:invalid-parameter`,"'name' is required when attachment is specified as Base64 encoded string using 'data'");if(!t.capabilities?.editing.supportsUploadWithItemId&&s.uploadId)throw new a(`${t.type}-layer:invalid-parameter`,"This layer does not support 'uploadId' parameter. See: 'capabilities.editing.supportsUploadWithItemId'");if("string"==typeof s.data){const e=n(s.data);if(e&&!e.isBase64)throw new a(`${t.type}-layer:invalid-parameter`,"Attachment 'data' should be a Blob, File or Base64 encoded string")}}function V(e,t){const{attributes:a}=e;null==a[t]&&(a[t]=l())}async function x(e,t,a,r){const s=e.addFeatures??[],i=e.updateFeatures??[],o=s.concat(i).map(e=>e.geometry),n=await h(o,t,a,r),l=await d(n),u=s.length,p=i.length;return l.slice(0,u).forEach((e,t)=>s[t].geometry=e),l.slice(u,u+p).forEach((e,t)=>i[t].geometry=e),e}function z(e){return{addFeatures:Array.from(e?.addFeatures??[]),updateFeatures:Array.from(e?.updateFeatures??[]),deleteFeatures:e&&t.isCollection(e.deleteFeatures)?e.deleteFeatures.toArray():e.deleteFeatures||[],addAttachments:e.addAttachments||[],updateAttachments:e.updateAttachments||[],deleteAttachments:e.deleteAttachments||[]}}function C(e,t,r){const s=z(e);if(s.addFeatures?.length&&!t.operations.supportsAdd)throw new a(`${r}:unsupported-operation`,"Layer does not support adding features.");if(s.updateFeatures?.length&&!t.operations.supportsUpdate)throw new a(`${r}:unsupported-operation`,"Layer does not support updating features.");if(s.deleteFeatures?.length&&!t.operations.supportsDelete)throw new a(`${r}:unsupported-operation`,"Layer does not support deleting features.");return s.addFeatures=s.addFeatures.map(q),s.updateFeatures=s.updateFeatures.map(q),s.addAssetFeatures=[],s}function W(e,t,r,s,i,o){if(!(e&&(s||i)||r?.usingTelecomOperations))throw new a(`${o}:missing-parameters`,"'addFeatures', 'updateFeatures', 'deleteFeatures', 'addAttachments', 'updateAttachments' or 'deleteAttachments' parameter is required");if(!t.editing.supportsGlobalId&&r?.globalIdUsed&&!r.usingFeatureServiceEndpoint)throw new a(`${o}:invalid-parameter`,"This layer does not support 'globalIdUsed' parameter. See: 'capabilities.editing.supportsGlobalId'");if(!t.editing.supportsGlobalId&&i)throw new a(`${o}:invalid-parameter`,"'addAttachments', 'updateAttachments' and 'deleteAttachments' are applicable only if the layer supports global ids. See: 'capabilities.editing.supportsGlobalId'");if(!r?.globalIdUsed&&i)throw new a(`${o}:invalid-parameter`,"When 'addAttachments', 'updateAttachments' or 'deleteAttachments' is specified, globalIdUsed should be set to true")}function q(t){const a=new e;return t.attributes||(t.attributes={}),a.geometry=t.geometry,a.attributes=t.attributes,a}async function N(e,t){const{infoFor3D:r}=t;if(null==r)return;if(!w(r))throw new a(`${t.type}-layer:binary-gltf-asset-not-supported`,"3DObjectFeatureLayer requires binary glTF (.glb) support for updating mesh geometry.");e.addAssetFeatures??=[];const{addAssetFeatures:s}=e;for(const a of e.addFeatures??[])Z(a)&&s.push(a);for(const a of e.updateFeatures??[])Z(a)&&s.push(a)}function Z(e){return"mesh"===e?.geometry?.type}function _(e,t,r,s){if(!A(t))throw new a(`${e.type}-layer:no-editing-support`,"Layer source does not support applyEdits capability",{layer:e});if(!t.uploadAssets)throw new a(`${e.type}-layer:no-asset-upload-support`,"Layer source does not support uploadAssets capability",{layer:e});return t.uploadAssets(r,s)}export{O as applyEdits,W as checkEditingCapabilities,j as isFeatureIdentifierArrayWithGlobalId,S as isFeatureIdentifierArrayWithObjectId,R as isFeatureIdentifierWithGlobalId,E as isFeatureIdentifierWithObjectId,z as normalizeCollections,C as normalizeEdits,x as processGeometries,q as shallowCloneFeature,_ as uploadAssets};
2
+ import e from"../../Graphic.js";import t from"../../core/Collection.js";import a from"../../core/Error.js";import{clone as r}from"../../core/lang.js";import s from"../../core/Logger.js";import{getOrCreateMapValue as i}from"../../core/MapUtils.js";import{createResolver as o}from"../../core/promiseUtils.js";import{dataComponents as n}from"../../core/urlUtils.js";import{generateBracedUUID as d}from"../../core/uuid.js";import{normalizeCentralMeridian as l}from"../../geometry/support/normalizeUtils.js";import{isGeographic as u,equals as p,isWGS84 as c,isWebMercator as m}from"../../geometry/support/spatialReferenceUtils.js";import{densifyUnsupportedCurves as h}from"../../geometry/support/curves/densifyCurvedGeometry.js";import{isEditBusLayer as f,emitApplyEditsEvent as y}from"../mixins/EditBusLayer.js";import{isHostedAgolService as g}from"../support/arcgisLayerUrl.js";import{isValidFieldValue as b}from"../support/fieldUtils.js";import{isGlbSupportedEditFormat as w}from"../support/infoFor3D.js";import{getEffectiveEditingEnabled as F,getEffectiveLayerCapabilities as A}from"../support/layerUtils.js";function v(e){return null!=e?.applyEdits}const I=()=>s.getLogger("esri.layers.graphics.editingSupport"),$=new WeakMap;async function E(e,t,a,s={}){let i;const n="gdbVersion"in e?e.gdbVersion:null,d=s.gdbVersion??n;if(f(e)&&e.url)i=y(e.url,e.layerId,d,"original-and-current-features"===s.returnServiceEditsOption);else{i=o(),i.promise.then(t=>{(t.addedFeatures.length||t.updatedFeatures.length||t.deletedFeatures.length||t.addedAttachments.length||t.updatedAttachments.length||t.deletedAttachments.length)&&e.emit("edits",t)});const t={result:i.promise};e.emit("apply-edits",t)}try{const{results:o,edits:n}=await S(e,t,a,s),d=e=>e.filter(e=>!e.error).map(r),l={edits:n,addedFeatures:d(o.addFeatureResults),updatedFeatures:d(o.updateFeatureResults),deletedFeatures:d(o.deleteFeatureResults),addedAttachments:d(o.addAttachmentResults),updatedAttachments:d(o.updateAttachmentResults),deletedAttachments:d(o.deleteAttachmentResults),exceededTransferLimit:!1,historicMoment:o.editMoment?new Date(o.editMoment):null,globalIdToObjectId:s.globalIdToObjectId};return o.editedFeatureResults?.length&&(l.editedFeatures=o.editedFeatureResults),i.resolve(l),o}catch(l){throw i.reject(l),l}}async function S(e,t,r,s){if(await e.load(),!v(t))throw new a(`${e.type}-layer:no-editing-support`,"Layer source does not support applyEdits capability",{layer:e});if(!F(e))throw new a(`${e.type}-layer:editing-disabled`,"Editing is disabled for layer",{layer:e});const{edits:i,options:o}=await R(e,r,s);return i.addFeatures?.length||i.updateFeatures?.length||i.deleteFeatures?.length||i.addAttachments?.length||i.updateAttachments?.length||i.deleteAttachments?.length?{edits:i,results:await t.applyEdits(i,o)}:{edits:i,results:{addFeatureResults:[],updateFeatureResults:[],deleteFeatureResults:[],addAttachmentResults:[],updateAttachmentResults:[],deleteAttachmentResults:[]}}}async function R(e,t,r){const s=A(e),o=t&&(t.addFeatures||t.updateFeatures||t.deleteFeatures),n=t&&(t.addAttachments||t.updateAttachments||t.deleteAttachments),d=null!=e.infoFor3D;if(V(t,s,r,!!o,!!n,`${e.type}-layer`),!s.data.isVersioned&&r?.gdbVersion)throw new a(`${e.type}-layer:invalid-parameter`,"'gdbVersion' is applicable only if the layer supports versioned data. See: 'capabilities.data.isVersioned'");if(!s.editing.supportsRollbackOnFailure&&r?.rollbackOnFailureEnabled)throw new a(`${e.type}-layer:invalid-parameter`,"This layer does not support 'rollbackOnFailureEnabled' parameter. See: 'capabilities.editing.supportsRollbackOnFailure'");const l={...r};if(null!=l.rollbackOnFailureEnabled||s.editing.supportsRollbackOnFailure||(l.rollbackOnFailureEnabled=!0),l.rollbackOnFailureEnabled||"original-and-current-features"!==l.returnServiceEditsOption||(!1===l.rollbackOnFailureEnabled&&I().warn(`${e.type}-layer:invalid-parameter`,"'original-and-current-features' is valid for 'returnServiceEditsOption' only when 'rollBackOnFailure' is true, but 'rollBackOnFailure' was set to false. 'rollBackOnFailure' has been overwritten and set to true."),l.rollbackOnFailureEnabled=!0),!s.editing.supportsReturnServiceEditsInSourceSpatialReference&&l.returnServiceEditsInSourceSR)throw new a(`${e.type}-layer:invalid-parameter`,"This layer does not support 'returnServiceEditsInSourceSR' parameter. See: 'capabilities.editing.supportsReturnServiceEditsInSourceSpatialReference'");if(l.returnServiceEditsInSourceSR&&"original-and-current-features"!==l.returnServiceEditsOption)throw new a(`${e.type}-layer:invalid-parameter`,"'returnServiceEditsInSourceSR' is valid only when 'returnServiceEditsOption' is set to 'original-and-current-features'");const u=D(t,s,`${e.type}-layer`),p=r?.globalIdUsed||d,c=e.fields.filter(e=>"big-integer"===e.type||"oid"===e.type&&(e.length||0)>=8);if(p){const{globalIdField:t}=e;if(null==t)throw new a(`${e.type}-layer:invalid-parameter`,"Layer does not specify a global id field.");u.addFeatures.forEach(e=>B(e,t))}u.addFeatures.forEach(t=>U(t,e,p,c)),u.updateFeatures.forEach(t=>L(t,e,p,c)),u.deleteFeatures.forEach(t=>k(t,e,p,c)),u.addAttachments.forEach(t=>T(t,e)),u.updateAttachments.forEach(t=>T(t,e)),d&&await z(u,e);const m=i($,e,()=>new Map),h=!g(e.url);return{edits:await M(u,s.data.supportedCurveTypes??[],h,m),options:l}}function O(e,t,r,s){if(r){if("attributes"in e&&!e.attributes[t.globalIdField])throw new a(`${t.type}-layer:invalid-parameter`,`Feature should have '${t.globalIdField}' when 'globalIdUsed' is true`);if(!("attributes"in e)&&!e.globalId)throw new a(`${t.type}-layer:invalid-parameter`,"`'globalId' of the feature should be passed when 'globalIdUsed' is true")}if(s.length&&"attributes"in e)for(const i of s){const r=e.attributes[i.name];if(void 0!==r&&!b(i,r))throw new a(`${t.type}-layer:invalid-parameter`,`Big-integer field '${i.name}' of the feature must be less than ${Number.MAX_SAFE_INTEGER}`,{feature:e})}if("geometry"in e&&null!=e.geometry){if(e.geometry.hasZ&&!1===t.capabilities?.data.supportsZ)throw new a(`${t.type}-layer:z-unsupported`,"Layer does not support z values while feature has z values.");if(e.geometry.hasM&&!1===t.capabilities?.data.supportsM)throw new a(`${t.type}-layer:m-unsupported`,"Layer does not support m values while feature has m values.")}}function j(e,t){if("geometry"in e&&"mesh"===e.geometry?.type&&null!=t.infoFor3D&&null!=t.spatialReference){const{geometry:r}=e,{spatialReference:s,vertexSpace:i}=r,o=t.spatialReference,n="local"===i.type,d=u(o),l=p(o,s),h=l||c(o)&&(c(s)||m(s));if(!(n&&d&&h||!n&&!d&&l))throw new a(`${t.type}-layer:mesh-unsupported`,`Uploading a mesh with a ${i.type} vertex space and a spatial reference wkid:${s.wkid} to a layer with a spatial reference wkid:${o.wkid} is not supported.`)}}function U(e,t,a,r){O(e,t,a,r),j(e,t)}function k(e,t,a,r){O(e,t,a,r)}function L(e,t,r,s){O(e,t,r,s),j(e,t);const i=A(t);if("geometry"in e&&null!=e.geometry&&!i?.editing.supportsGeometryUpdate)throw new a(`${t.type}-layer:unsupported-operation`,"Layer does not support geometry updates.")}function T(e,t){const{feature:r,attachment:s}=e;if(!r||"attributes"in r&&!r.attributes[t.globalIdField])throw new a(`${t.type}-layer:invalid-parameter`,"Attachment should have reference to a feature with 'globalId'");if(!("attributes"in r)&&!r.globalId)throw new a(`${t.type}-layer:invalid-parameter`,"Attachment should have reference to 'globalId' of the parent feature");if(!s.globalId)throw new a(`${t.type}-layer:invalid-parameter`,"Attachment should have 'globalId'");if(!s.data&&!s.uploadId)throw new a(`${t.type}-layer:invalid-parameter`,"Attachment should have 'data' or 'uploadId'");if(!(s.data instanceof File&&!!s.data.name)&&!s.name)throw new a(`${t.type}-layer:invalid-parameter`,"'name' is required when attachment is specified as Base64 encoded string using 'data'");if(!t.capabilities?.editing.supportsUploadWithItemId&&s.uploadId)throw new a(`${t.type}-layer:invalid-parameter`,"This layer does not support 'uploadId' parameter. See: 'capabilities.editing.supportsUploadWithItemId'");if("string"==typeof s.data){const e=n(s.data);if(e&&!e.isBase64)throw new a(`${t.type}-layer:invalid-parameter`,"Attachment 'data' should be a Blob, File or Base64 encoded string")}}function B(e,t){const{attributes:a}=e;null==a[t]&&(a[t]=d())}async function M(e,t,a,r){const s=e.addFeatures??[],i=e.updateFeatures??[],o=s.concat(i).map(e=>e.geometry),n=await h(o,t,a,r),d=await l(n),u=s.length,p=i.length;return d.slice(0,u).forEach((e,t)=>s[t].geometry=e),d.slice(u,u+p).forEach((e,t)=>i[t].geometry=e),e}function G(e){return{addFeatures:Array.from(e?.addFeatures??[]),updateFeatures:Array.from(e?.updateFeatures??[]),deleteFeatures:e&&t.isCollection(e.deleteFeatures)?e.deleteFeatures.toArray():e.deleteFeatures||[],addAttachments:e.addAttachments||[],updateAttachments:e.updateAttachments||[],deleteAttachments:e.deleteAttachments||[]}}function D(e,t,r){const s=G(e);if(s.addFeatures?.length&&!t.operations.supportsAdd)throw new a(`${r}:unsupported-operation`,"Layer does not support adding features.");if(s.updateFeatures?.length&&!t.operations.supportsUpdate)throw new a(`${r}:unsupported-operation`,"Layer does not support updating features.");if(s.deleteFeatures?.length&&!t.operations.supportsDelete)throw new a(`${r}:unsupported-operation`,"Layer does not support deleting features.");return s.addFeatures=s.addFeatures.map(x),s.updateFeatures=s.updateFeatures.map(x),s.addAssetFeatures=[],s}function V(e,t,r,s,i,o){if(!(e&&(s||i)||r?.usingTelecomOperations))throw new a(`${o}:missing-parameters`,"'addFeatures', 'updateFeatures', 'deleteFeatures', 'addAttachments', 'updateAttachments' or 'deleteAttachments' parameter is required");if(!t.editing.supportsGlobalId&&r?.globalIdUsed&&!r.usingFeatureServiceEndpoint)throw new a(`${o}:invalid-parameter`,"This layer does not support 'globalIdUsed' parameter. See: 'capabilities.editing.supportsGlobalId'");if(!t.editing.supportsGlobalId&&i)throw new a(`${o}:invalid-parameter`,"'addAttachments', 'updateAttachments' and 'deleteAttachments' are applicable only if the layer supports global ids. See: 'capabilities.editing.supportsGlobalId'");if(!r?.globalIdUsed&&i)throw new a(`${o}:invalid-parameter`,"When 'addAttachments', 'updateAttachments' or 'deleteAttachments' is specified, globalIdUsed should be set to true")}function x(t){const a=new e;return t.attributes||(t.attributes={}),a.geometry=t.geometry,a.attributes=t.attributes,a}async function z(e,t){const{infoFor3D:r}=t;if(null==r)return;if(!w(r))throw new a(`${t.type}-layer:binary-gltf-asset-not-supported`,"3DObjectFeatureLayer requires binary glTF (.glb) support for updating mesh geometry.");e.addAssetFeatures??=[];const{addAssetFeatures:s}=e;for(const a of e.addFeatures??[])C(a)&&s.push(a);for(const a of e.updateFeatures??[])C(a)&&s.push(a)}function C(e){return"mesh"===e?.geometry?.type}function W(e,t,r,s){if(!v(t))throw new a(`${e.type}-layer:no-editing-support`,"Layer source does not support applyEdits capability",{layer:e});if(!t.uploadAssets)throw new a(`${e.type}-layer:no-asset-upload-support`,"Layer source does not support uploadAssets capability",{layer:e});return t.uploadAssets(r,s)}export{E as applyEdits,V as checkEditingCapabilities,G as normalizeCollections,D as normalizeEdits,M as processGeometries,x as shallowCloneFeature,W as uploadAssets};