@arcgis/core 4.34.0-next.74 → 4.34.0-next.75

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 (149) hide show
  1. package/PopupTemplate.js +1 -1
  2. package/applications/Components/QuantityFormatter.js +1 -1
  3. package/arcade/Pixel.js +5 -0
  4. package/arcade/featureSetUtils.js +1 -1
  5. package/arcade/featureset/actions/GroupBy.js +1 -1
  6. package/arcade/featureset/actions/OrderBy.js +1 -1
  7. package/arcade/functions/featuresetbase.js +1 -1
  8. package/arcade/functions/featuresetstring.js +1 -1
  9. package/arcade/functions/fieldStats.js +1 -1
  10. package/arcade/functions/geometry.js +1 -1
  11. package/arcade/functions/maths.js +1 -1
  12. package/arcade/functions/string.js +1 -1
  13. package/arcade/languageUtils.js +1 -1
  14. package/arcade.js +1 -1
  15. package/assets/esri/core/workers/RemoteClient.js +1 -1
  16. package/assets/esri/core/workers/chunks/009556f323e58271bc7a.js +1 -0
  17. package/assets/esri/core/workers/chunks/{11acefc48c0354e675df.js → 0309d008e50e55c7ff1d.js} +1 -1
  18. package/assets/esri/core/workers/chunks/{dd447dfc50ee7f511b84.js → 19c1f1431c0b2f4525a2.js} +1 -1
  19. package/assets/esri/core/workers/chunks/{7219ceab0b6fae2e69b6.js → 280af3640f8e93c1024e.js} +2 -2
  20. package/assets/esri/core/workers/chunks/{5a476e6743902e35f81a.js.LICENSE.txt → 280af3640f8e93c1024e.js.LICENSE.txt} +1 -1
  21. package/assets/esri/core/workers/chunks/{e3ad0a390387c5847aca.js → 356c96fad88558be9054.js} +1 -1
  22. package/assets/esri/core/workers/chunks/{ada8e07ff12bc5d4a1d9.js → 37ff19a9c5c99bd4e7c7.js} +1 -1
  23. package/assets/esri/core/workers/chunks/{d12f373fcf5848ddcd8a.js → 3f523bc8551e712c9bd4.js} +1 -1
  24. package/assets/esri/core/workers/chunks/{5b7e5ec6aea1f7f9b005.js → 3fecfe4f8ca2a5fd7360.js} +1 -1
  25. package/assets/esri/core/workers/chunks/{78b33c6d73824085c6d1.js → 48449abe795cb7a831eb.js} +1 -1
  26. package/assets/esri/core/workers/chunks/541bffd61006d0e36166.js +1 -0
  27. package/assets/esri/core/workers/chunks/{f4e9640306f64b1af7a3.js → 65ec21d29e8563fdbc55.js} +1 -1
  28. package/assets/esri/core/workers/chunks/67d9cfe02613cb73ee37.js.LICENSE.txt +1 -1
  29. package/assets/esri/core/workers/chunks/{fb669a2e50ca7aacac25.js → 71fef0a33b7ed9456e47.js} +1 -1
  30. package/assets/esri/core/workers/chunks/7430c462c350fdd26349.js +1 -0
  31. package/assets/esri/core/workers/chunks/{ff3fe5c97a98c8cab4ac.js → 7a23b127f551bf13ef54.js} +2 -2
  32. package/assets/esri/core/workers/chunks/{ff3fe5c97a98c8cab4ac.js.LICENSE.txt → 7a23b127f551bf13ef54.js.LICENSE.txt} +1 -1
  33. package/assets/esri/core/workers/chunks/{9c00c2263e52ad51c2a2.js → 8e428b0f33ef4688415e.js} +1 -1
  34. package/assets/esri/core/workers/chunks/{d682dd49bb9ee7f48f93.js → 9304c3cdf732745577fd.js} +1 -1
  35. package/assets/esri/core/workers/chunks/93b2e0a300b2758a1ca4.js +1 -0
  36. package/assets/esri/core/workers/chunks/{8d642b34d40edfe02d8e.js → 9c64b78c5c9b35b31d98.js} +2 -2
  37. package/assets/esri/core/workers/chunks/{8d642b34d40edfe02d8e.js.LICENSE.txt → 9c64b78c5c9b35b31d98.js.LICENSE.txt} +1 -1
  38. package/assets/esri/core/workers/chunks/{6dc62c170e9583222df2.js → a25b75de1bca1dd21941.js} +1 -1
  39. package/assets/esri/core/workers/chunks/a6533bab3b2fbc1e2a47.js +1 -0
  40. package/assets/esri/core/workers/chunks/{5c53deb45bc142219c76.js → b15ff6c9ef2de8a49853.js} +2 -2
  41. package/assets/esri/core/workers/chunks/{5c53deb45bc142219c76.js.LICENSE.txt → b15ff6c9ef2de8a49853.js.LICENSE.txt} +1 -1
  42. package/assets/esri/core/workers/chunks/bccecd678faff927ac76.js +1 -0
  43. package/assets/esri/core/workers/chunks/{ce1f4508487298ab57b6.js → bd2dc1282c49125ede89.js} +1 -1
  44. package/assets/esri/core/workers/chunks/{f542bdc994a5ea3aa9d1.js → c38360d912f256519e06.js} +1 -1
  45. package/assets/esri/core/workers/chunks/cd1869e183001266c4c1.js +2 -0
  46. package/assets/esri/core/workers/chunks/{626c18c1bbc50b3b16b2.js.LICENSE.txt → cd1869e183001266c4c1.js.LICENSE.txt} +1 -1
  47. package/assets/esri/core/workers/chunks/{90321feb56f3a84f6e58.js → d153b29c542c37ae1636.js} +2 -2
  48. package/assets/esri/core/workers/chunks/{90321feb56f3a84f6e58.js.LICENSE.txt → d153b29c542c37ae1636.js.LICENSE.txt} +1 -1
  49. package/assets/esri/core/workers/chunks/d55c55d39a253630d228.js +1 -0
  50. package/assets/esri/core/workers/chunks/{49f7a5523462aebf90fc.js → d66cdb9bb494da19696b.js} +2 -2
  51. package/assets/esri/core/workers/chunks/{49f7a5523462aebf90fc.js.LICENSE.txt → d66cdb9bb494da19696b.js.LICENSE.txt} +1 -1
  52. package/assets/esri/core/workers/chunks/ed773dab5965e42a2879.js +2 -0
  53. package/assets/esri/core/workers/chunks/{7219ceab0b6fae2e69b6.js.LICENSE.txt → ed773dab5965e42a2879.js.LICENSE.txt} +1 -1
  54. package/assets/esri/images/portal/xrexperience16.png +0 -0
  55. package/chunks/Fog.glsl.js +6 -6
  56. package/chunks/GlowComposition.glsl.js +31 -12
  57. package/chunks/LineMarker.glsl.js +37 -36
  58. package/chunks/RibbonLine.glsl.js +83 -83
  59. package/chunks/array.js +1 -1
  60. package/chunks/languageUtils.js +1 -1
  61. package/config.js +1 -1
  62. package/core/quantityFormatUtils.js +1 -1
  63. package/core/unitFormatUtils.js +1 -1
  64. package/core/unitUtils.js +1 -1
  65. package/form/FormTemplate.js +1 -1
  66. package/geometry/support/curves/circleUtils.js +1 -1
  67. package/geometry/support/curves/circularArcUtils.js +1 -1
  68. package/geometry/support/curves/closestPointOnCurve.js +1 -1
  69. package/geometry/support/curves/curveExtent.js +1 -1
  70. package/geometry/support/curves/lineUtils.js +5 -0
  71. package/interfaces.d.ts +270 -18
  72. package/kernel.js +1 -1
  73. package/layers/ImageryLayer.js +1 -1
  74. package/layers/ImageryTileLayer.js +1 -1
  75. package/layers/graphics/controllers/I3SOnDemandController.js +1 -1
  76. package/layers/support/fieldUtils.js +1 -1
  77. package/package.json +2 -2
  78. package/portal/PortalItem.js +1 -1
  79. package/renderers/ClassBreaksRenderer.js +1 -1
  80. package/renderers/DictionaryRenderer.js +1 -1
  81. package/renderers/DotDensityRenderer.js +1 -1
  82. package/renderers/HeatmapRenderer.js +1 -1
  83. package/renderers/PieChartRenderer.js +1 -1
  84. package/renderers/UniqueValueRenderer.js +1 -1
  85. package/renderers/mixins/VisualVariablesMixin.js +1 -1
  86. package/support/arcadeUtils.js +1 -1
  87. package/support/loadArcade.js +1 -1
  88. package/support/revision.js +1 -1
  89. package/symbols/CIMSymbol.js +1 -1
  90. package/symbols/support/FeatureExpressionInfo.js +1 -1
  91. package/views/2d/layers/LayerView2D.js +1 -1
  92. package/views/3d/analysis/Dimension/DimensionVisualization.js +1 -1
  93. package/views/3d/analysis/Dimension/LengthDimensionSubTool.js +1 -1
  94. package/views/3d/analysis/Dimension/lengthDimensionManipulatorUtils.js +1 -1
  95. package/views/3d/analysis/Slice/ResizeManipulator.js +1 -1
  96. package/views/3d/analysis/Slice/RotateManipulator.js +1 -1
  97. package/views/3d/analysis/Slice/ShiftManipulator.js +1 -1
  98. package/views/3d/analysis/Viewshed/ViewshedFieldOfViewManipulation.js +1 -1
  99. package/views/3d/analysis/VolumeMeasurement/VolumeMeasurementTool.js +1 -1
  100. package/views/3d/environment/Fog.js +1 -1
  101. package/views/3d/interactive/visualElements/ExtendedLineVisualElement.js +1 -1
  102. package/views/3d/interactive/visualElements/LineVisualElement.js +1 -1
  103. package/views/3d/interactive/visualElements/MarkerVisualElement.js +1 -1
  104. package/views/3d/interactive/visualElements/OutlineVisualElement.js +1 -1
  105. package/views/3d/interactive/visualElements/ParallelLineVisualElement.js +1 -1
  106. package/views/3d/interactive/visualElements/RightAngleQuadVisualElement.js +1 -1
  107. package/views/3d/layers/FlowSubView3D.js +1 -1
  108. package/views/3d/layers/IntegratedMesh3DTilesLayerView3D.js +1 -1
  109. package/views/3d/layers/graphics/Graphics3DLineSymbolLayer.js +1 -1
  110. package/views/3d/layers/graphics/Graphics3DPolygonFillSymbolLayer.js +1 -1
  111. package/views/3d/layers/support/Tiles3DIntersectionHandler.js +1 -1
  112. package/views/3d/state/SurfaceCollisionConstraint.js +1 -1
  113. package/views/3d/state/ViewStateManager.js +1 -1
  114. package/views/3d/state/controllers/SurfaceCollisionCorrectionController.js +1 -1
  115. package/views/3d/support/flow/FlowSubViewExtent3D.js +1 -1
  116. package/views/3d/support/flow/FlowSubViewTiles3D.js +1 -1
  117. package/views/3d/support/flow/FlowWorker.js +1 -1
  118. package/views/3d/support/flow/geometryUtils.js +1 -1
  119. package/views/3d/support/flow/loadUtils.js +1 -1
  120. package/views/3d/webgl-engine/core/shaderLibrary/attributes/RibbonVertexPosition.glsl.js +23 -13
  121. package/views/3d/webgl-engine/core/shaderLibrary/shading/LineStipple.glsl.js +36 -23
  122. package/views/3d/webgl-engine/core/shaderLibrary/shading/MarkerSizing.glsl.js +11 -11
  123. package/views/3d/webgl-engine/core/shaderLibrary/util/NoPerspective.glsl.js +5 -0
  124. package/views/3d/webgl-engine/effects/glow/GlowComposition.glsl.js +1 -1
  125. package/views/3d/webgl-engine/effects/glow/GlowPresets.glsl.js +1 -1
  126. package/views/3d/webgl-engine/effects/glow/GlowRenderNode.js +1 -1
  127. package/views/3d/webgl-engine/lib/GridLocalOriginFactory.js +1 -1
  128. package/views/3d/webgl-engine/materials/LineMarkerMaterial.js +1 -1
  129. package/views/3d/webgl-engine/materials/RibbonLineMaterial.js +1 -1
  130. package/views/3d/webgl-engine/parts/RenderView.js +1 -1
  131. package/views/3d/webgl-engine/shaders/LineMarker.glsl.js +1 -1
  132. package/views/3d/webgl-engine/shaders/LineMarkerTechniqueConfiguration.js +1 -1
  133. package/views/3d/webgl-engine/shaders/RibbonLine.glsl.js +1 -1
  134. package/views/3d/webgl-engine/shaders/RibbonLineTechniqueConfiguration.js +1 -1
  135. package/views/GroundView.js +1 -1
  136. package/views/interactive/snapping/allLayerSnapping.js +1 -1
  137. package/views/layers/ImageryLayerView.js +1 -1
  138. package/views/support/LayerViewManager.js +1 -1
  139. package/widgets/Feature/support/arcadeFeatureUtils.js +1 -1
  140. package/widgets/Legend/support/ActiveLayerInfo.js +1 -1
  141. package/assets/esri/core/workers/chunks/5a476e6743902e35f81a.js +0 -2
  142. package/assets/esri/core/workers/chunks/5a95688651d7e8b7101d.js +0 -1
  143. package/assets/esri/core/workers/chunks/626c18c1bbc50b3b16b2.js +0 -2
  144. package/assets/esri/core/workers/chunks/6da298da2ec09cced0b5.js +0 -1
  145. package/assets/esri/core/workers/chunks/8b1d2bbb2b2eb1830921.js +0 -1
  146. package/assets/esri/core/workers/chunks/a2f4b6d8da93f106852c.js +0 -1
  147. package/assets/esri/core/workers/chunks/d305ca524837c5dc81c8.js +0 -1
  148. package/assets/esri/core/workers/chunks/e6f2ac738df16fb5e13a.js +0 -1
  149. package/assets/esri/core/workers/chunks/e8d25d4ca9b335883f34.js +0 -1
@@ -2,4 +2,4 @@
2
2
  All material copyright ESRI, All Rights Reserved, unless otherwise specified.
3
3
  See https://js.arcgis.com/4.34/esri/copyright.txt for details.
4
4
  */
5
- import{__decorate as e}from"tslib";import t from"../PopupTemplate.js";import{ClonableMixin as r}from"../core/Clonable.js";import s from"../core/Error.js";import i from"../core/Logger.js";import{MultiOriginJSONMixin as o}from"../core/MultiOriginJSONSupport.js";import{debounce as a,throwIfAbortError as n}from"../core/promiseUtils.js";import{watch as p}from"../core/reactiveUtils.js";import{property as l}from"../core/accessorSupport/decorators/property.js";import{ensureClass as m}from"../core/accessorSupport/ensureType.js";import"../core/has.js";import"../core/RandomLCG.js";import{subclass as c}from"../core/accessorSupport/decorators/subclass.js";import u from"../graphic/ImageryTileGraphicOrigin.js";import h from"./Layer.js";import{ArcGISService as d}from"./mixins/ArcGISService.js";import{BlendLayer as y}from"./mixins/BlendLayer.js";import{CustomParametersMixin as f}from"./mixins/CustomParametersMixin.js";import{ImageryTileMixin as g}from"./mixins/ImageryTileMixin.js";import{OperationalLayer as v}from"./mixins/OperationalLayer.js";import{PortalLayer as w}from"./mixins/PortalLayer.js";import{RasterJobHandlerMixin as R}from"./mixins/RasterJobHandlerMixin.js";import{RasterPresetRendererMixin as j}from"./mixins/RasterPresetRendererMixin.js";import{RefreshableLayer as F}from"./mixins/RefreshableLayer.js";import{ScaleRangeLayer as S}from"./mixins/ScaleRangeLayer.js";import{TemporalLayer as _}from"./mixins/TemporalLayer.js";import{legendEnabled as I}from"./support/commonProperties.js";import O from"./support/Field.js";import{getServicePixelValueField as b,getRawServicePixelValueField as P,getRasterAttributeTableFields as x,getMagnitudeField as T,getDirectionField as N,getMultidimensionalFields as L,commonRasterFieldNames as J,setDefaultRasterFieldFormats as C}from"./support/rasterFieldUtils.js";import M from"./support/RasterFunction.js";import{isFunctionRaster as E,getPrimaryRasters as U}from"./support/rasterDatasets/datasetUtils.js";import $ from"./support/rasterDatasets/FunctionRaster.js";import D from"./support/rasterDatasets/RasterFactory.js";import{getPrimaryRasterUrls as B,create as A}from"./support/rasterFunctions/rasterFunctionHelper.js";import{logInvalidElevationInfoWarning as W,elevationModeUnsupportedMessage as z,featureExpressionUnsupportedMessage as G}from"../support/elevationInfoUtils.js";import{createPopupTemplate as k}from"../support/popupUtils.js";import V from"../symbols/support/ElevationInfo.js";let H=class extends(y(S(v(w(j(f(g(R(_(d(F(o(r(h)))))))))))))){constructor(...e){super(...e),this._primaryRasters=[],this.graphicOrigin=new u(this),this.legendEnabled=!0,this.isReference=null,this.listMode="show",this.sourceJSON=null,this.version=null,this.type="imagery-tile",this.operationalLayerType="ArcGISTiledImageServiceLayer",this.popupEnabled=!0,this.popupTemplate=null,this.fields=null,this.source=void 0,this._debouncedSaveOperations=a(async(e,t,r)=>{const{save:s,saveAs:i}=await import("./save/imageryUtils.js");switch(e){case 0:return s(this,t);case 1:return i(this,r,t)}})}normalizeCtorArgs(e,t){return"string"==typeof e?{url:e,...t}:e}load(e){const t=null!=e?e.signal:null;return this.addResolvingPromise(this.loadFromPortal({supportedTypes:["Image Service"]},e).catch(n).then(()=>this._openRaster(t))),Promise.resolve(this)}set elevationInfo(e){"relative-to-scene"!==e?.mode&&this._set("elevationInfo",e),this._validateElevationInfo(e)}get defaultPopupTemplate(){return this.createPopupTemplate()}get rasterFields(){const e=[b("Pixel Value"),P("Raw Pixel Value")],t=this.raster?.rasterInfo??this.serviceRasterInfo,r=t?.attributeTable;if(r){const t=x(r);e.push(...t)}const s=t?.dataType,i=t?.multidimensionalInfo;if(("vector-magdir"===s||"vector-uv"===s)&&null!=i){const t=i.variables[0].unit?.trim(),r=T(t),s=N();e.push(r,s)}if(i){const t=L(i);e.push(...t)}return e}get renderer(){return super.renderer}set renderer(e){super.renderer=e}createPopupTemplate(e){const{rasterFields:t}=this,r=e?.visibleFieldNames??new Set(t.map(({name:e})=>e).filter(e=>e!==J.rawServicePixelValue)),s=k({fields:t,title:this.title},{...e,visibleFieldNames:r}),{rasterInfo:i}=this.raster;return s?.fieldInfos&&i&&C(s.fieldInfos,i),s}async generateRasterInfo(e,t){if(e=m(M,e),await this.load(),!e||"none"===e.functionName?.toLowerCase())return this.serviceRasterInfo;try{const{rasterInfo:r}=await this._openFunctionRaster(e,t);return r}catch(r){if(r instanceof s)throw r;throw new s("imagery-tile-layer","the given raster function is not supported")}}async save(e){return this._debouncedSaveOperations(0,e)}async saveAs(e,t){return this._debouncedSaveOperations(1,t,e)}write(e,t){const r=this._primaryRasters[0]??this.raster;if(this.loaded?"RasterTileServer"===r.datasetFormat&&("Raster"===r.tileType||"Map"===r.tileType):this.url&&/\/ImageServer(\/|\/?$)/i.test(this.url))return super.write(e,t);if(t?.messages){const e=`${t.origin}/${t.layerContainerType||"operational-layers"}`;t.messages.push(new s("layer:unsupported",`Layers (${this.title}, ${this.id}) of type '${this.declaredClass}' are not supported in the context of '${e}'`,{layer:this}))}return null}async _openRaster(e){let t=!1;if(this.raster)await this._openFromRaster(this.raster,e),t=E(this.raster),!t&&this.rasterFunction&&(this._primaryRasters=[this.raster],await this._initializeWithFunctionRaster(this.rasterFunction));else{const{url:t,rasterFunction:r,source:i}=this;if(!t&&!i)throw new s("imagery-tile-layer:open","missing url or source parameter");i?await this._openFromSource(i,e):r?await this._openFromUrlWithRasterFunction(t,r,e):await this._openFromUrl(t,e)}const r=this.raster.rasterInfo;if(!r)throw new s("imagery-tile-layer:load","cannot load resources on "+this.url);if(this._set("serviceRasterInfo",t?r:this._primaryRasters[0].rasterInfo),this._set("spatialReference",r.spatialReference),this.sourceJSON=this.sourceJSON||this.raster.sourceJSON,null!=this.sourceJSON){const e="Map"===this.raster.tileType&&null!=this.sourceJSON.minLOD&&null!=this.sourceJSON.maxLOD?this.sourceJSON:{...this.sourceJSON,minScale:0,maxScale:0};this.read(e,{origin:"service"})}else this.read({tileInfo:this.serviceRasterInfo?.storageInfo.tileInfo.toJSON()},{origin:"service"});this.title||(this.title=this.raster.datasetName),"Map"===this.raster.tileType&&(this.popupEnabled=!1),this._configDefaultSettings(),this.addHandles(p(()=>this.customParameters,e=>{this.raster&&(this.raster.ioConfig.customFetchParameters=e)}))}async _openFromRaster(e,t){e.rasterInfo||await e.open({signal:t}),this._primaryRasters=U(e),this.url||(this.url=this._primaryRasters[0].url)}async _openFromUrlWithRasterFunction(e,t,r){const i=[e];t&&B(t.toJSON(),i);const o=await Promise.all(i.map(e=>D.open({url:e,sourceJSON:this.sourceJSON,ioConfig:{sampling:"closest",...this.ioConfig,customFetchParameters:this.customParameters},signal:r}))),a=o.findIndex(e=>null==e);if(a>-1)throw new s("imagery-tile-layer:open",`cannot open raster: ${i[a]}`);return this._primaryRasters=o,this._initializeWithFunctionRaster(t)}async _openFromUrl(e,t){const r=await D.open({url:e,sourceJSON:this.sourceJSON,ioConfig:{sampling:"closest",...this.ioConfig,customFetchParameters:this.customParameters},signal:t});if(null==r)throw new s("imagery-tile-layer:open",`cannot open raster: ${e}`);this._primaryRasters=[r],this.raster=r}async _openFromSource(e,t){const r="the tiled imagery data source is not supported",i="coverage"===e.type?.toLowerCase()?"CovJSON":e.extent&&e.pixelBlock?"MEMORY":null;if(!i)throw new s("imagery-tile-layer:open",r);"MEMORY"===i&&(e={...e,pixelBlock:void 0,pixelBlocks:[e.pixelBlock]});const o=await D.open({url:"",source:e,datasetFormat:i,ioConfig:{sampling:"closest",...this.ioConfig,customFetchParameters:this.customParameters},signal:t});if(null==o)throw new s("imagery-tile-layer:open",r);this._primaryRasters=[o],this.rasterFunction?await this._initializeWithFunctionRaster(this.rasterFunction):this.raster=o}async _openFunctionRaster(e,t){const r={raster:this._primaryRasters[0]};this._primaryRasters.length>1&&this._primaryRasters.forEach(e=>r[e.url]=e);const s=A(e.functionDefinition?.toJSON()??e.toJSON(),r),i=new $({rasterFunction:s});return await i.open(t),i}async _initializeWithFunctionRaster(e,t){try{this.raster=await this._openFunctionRaster(e,t)}catch(r){r instanceof s&&i.getLogger(this).error("imagery-tile-layer:open",r.message),i.getLogger(this).warn("imagery-tile-layer:open","the raster function cannot be applied and is removed"),this._set("rasterFunction",null),this.raster=this._primaryRasters[0]}}_validateElevationInfo(e){W(i.getLogger(this),z("ImageryTile layers","relative-to-scene",e)),W(i.getLogger(this),G("ImageryTile layers",e))}};e([l({clonable:!1})],H.prototype,"_primaryRasters",void 0),e([l({type:V,value:null,json:{name:"layerDefinition.elevationInfo",write:!0,origins:{"portal-item":{read:!1,write:!1},"web-map":{read:!1,write:!1}}}})],H.prototype,"elevationInfo",null),e([l({readOnly:!0,clonable:!1})],H.prototype,"graphicOrigin",void 0),e([l(I)],H.prototype,"legendEnabled",void 0),e([l({type:Boolean,json:{read:!1,write:{enabled:!0,overridePolicy:()=>({enabled:!1})}}})],H.prototype,"isReference",void 0),e([l({type:["show","hide"]})],H.prototype,"listMode",void 0),e([l({json:{read:!0,write:!0}})],H.prototype,"blendMode",void 0),e([l({type:M,json:{name:"renderingRule",write:!0}})],H.prototype,"rasterFunction",void 0),e([l()],H.prototype,"sourceJSON",void 0),e([l({readOnly:!0,json:{origins:{service:{read:{source:"currentVersion"}}}}})],H.prototype,"version",void 0),e([l({readOnly:!0,json:{read:!1}})],H.prototype,"type",void 0),e([l({type:["ArcGISTiledImageServiceLayer"]})],H.prototype,"operationalLayerType",void 0),e([l({type:Boolean,value:!0,json:{read:{source:"disablePopup",reader:(e,t)=>!t.disablePopup},write:{target:"disablePopup",overridePolicy(){return{enabled:!this.loaded||"Raster"===this.raster.tileType}},writer(e,t,r){t[r]=!e}}}})],H.prototype,"popupEnabled",void 0),e([l({type:t,json:{read:{source:"popupInfo"},write:{target:"popupInfo",overridePolicy(){return{enabled:!this.loaded||"Raster"===this.raster.tileType}}}}})],H.prototype,"popupTemplate",void 0),e([l({readOnly:!0})],H.prototype,"defaultPopupTemplate",null),e([l({readOnly:!0,type:[O]})],H.prototype,"fields",void 0),e([l({readOnly:!0,type:[O]})],H.prototype,"rasterFields",null),e([l({constructOnly:!0})],H.prototype,"source",void 0),H=e([c("esri.layers.ImageryTileLayer")],H);const Y=H;export{Y as default};
5
+ import{__decorate as e}from"tslib";import t from"../PopupTemplate.js";import{ClonableMixin as r}from"../core/Clonable.js";import s from"../core/Error.js";import i from"../core/Logger.js";import{MultiOriginJSONMixin as o}from"../core/MultiOriginJSONSupport.js";import{debounce as a,throwIfAbortError as n}from"../core/promiseUtils.js";import{watch as p}from"../core/reactiveUtils.js";import{property as l}from"../core/accessorSupport/decorators/property.js";import{ensureClass as c}from"../core/accessorSupport/ensureType.js";import"../core/has.js";import"../core/RandomLCG.js";import{subclass as m}from"../core/accessorSupport/decorators/subclass.js";import u from"../graphic/ImageryTileGraphicOrigin.js";import h from"./Layer.js";import{ArcGISService as d}from"./mixins/ArcGISService.js";import{BlendLayer as y}from"./mixins/BlendLayer.js";import{CustomParametersMixin as f}from"./mixins/CustomParametersMixin.js";import{ImageryTileMixin as g}from"./mixins/ImageryTileMixin.js";import{OperationalLayer as v}from"./mixins/OperationalLayer.js";import{PortalLayer as w}from"./mixins/PortalLayer.js";import{RasterJobHandlerMixin as R}from"./mixins/RasterJobHandlerMixin.js";import{RasterPresetRendererMixin as j}from"./mixins/RasterPresetRendererMixin.js";import{RefreshableLayer as S}from"./mixins/RefreshableLayer.js";import{ScaleRangeLayer as F}from"./mixins/ScaleRangeLayer.js";import{TemporalLayer as _}from"./mixins/TemporalLayer.js";import{legendEnabled as I,screenSizePerspectiveEnabled as O}from"./support/commonProperties.js";import b from"./support/Field.js";import{getServicePixelValueField as P,getRawServicePixelValueField as x,getRasterAttributeTableFields as T,getMagnitudeField as N,getDirectionField as L,getMultidimensionalFields as J,commonRasterFieldNames as C,setDefaultRasterFieldFormats as M}from"./support/rasterFieldUtils.js";import E from"./support/RasterFunction.js";import{isFunctionRaster as U,getPrimaryRasters as $}from"./support/rasterDatasets/datasetUtils.js";import D from"./support/rasterDatasets/FunctionRaster.js";import z from"./support/rasterDatasets/RasterFactory.js";import{getPrimaryRasterUrls as B,create as A}from"./support/rasterFunctions/rasterFunctionHelper.js";import{logInvalidElevationInfoWarning as W,elevationModeUnsupportedMessage as G,featureExpressionUnsupportedMessage as k}from"../support/elevationInfoUtils.js";import{createPopupTemplate as V}from"../support/popupUtils.js";import H from"../symbols/support/ElevationInfo.js";let Y=class extends(y(F(v(w(j(f(g(R(_(d(S(o(r(h)))))))))))))){constructor(...e){super(...e),this._primaryRasters=[],this.graphicOrigin=new u(this),this.legendEnabled=!0,this.isReference=null,this.listMode="show",this.sourceJSON=null,this.version=null,this.type="imagery-tile",this.operationalLayerType="ArcGISTiledImageServiceLayer",this.popupEnabled=!0,this.popupTemplate=null,this.screenSizePerspectiveEnabled=!0,this.fields=null,this.source=void 0,this._debouncedSaveOperations=a(async(e,t,r)=>{const{save:s,saveAs:i}=await import("./save/imageryUtils.js");switch(e){case 0:return s(this,t);case 1:return i(this,r,t)}})}normalizeCtorArgs(e,t){return"string"==typeof e?{url:e,...t}:e}load(e){const t=null!=e?e.signal:null;return this.addResolvingPromise(this.loadFromPortal({supportedTypes:["Image Service"]},e).catch(n).then(()=>this._openRaster(t))),Promise.resolve(this)}set elevationInfo(e){"relative-to-scene"!==e?.mode&&this._set("elevationInfo",e),this._validateElevationInfo(e)}get defaultPopupTemplate(){return this.createPopupTemplate()}get rasterFields(){const e=[P("Pixel Value"),x("Raw Pixel Value")],t=this.raster?.rasterInfo??this.serviceRasterInfo,r=t?.attributeTable;if(r){const t=T(r);e.push(...t)}const s=t?.dataType,i=t?.multidimensionalInfo;if(("vector-magdir"===s||"vector-uv"===s)&&null!=i){const t=i.variables[0].unit?.trim(),r=N(t),s=L();e.push(r,s)}if(i){const t=J(i);e.push(...t)}return e}get renderer(){return super.renderer}set renderer(e){super.renderer=e}createPopupTemplate(e){const{rasterFields:t}=this,r=e?.visibleFieldNames??new Set(t.map(({name:e})=>e).filter(e=>e!==C.rawServicePixelValue)),s=V({fields:t,title:this.title},{...e,visibleFieldNames:r}),{rasterInfo:i}=this.raster;return s?.fieldInfos&&i&&M(s.fieldInfos,i),s}async generateRasterInfo(e,t){if(e=c(E,e),await this.load(),!e||"none"===e.functionName?.toLowerCase())return this.serviceRasterInfo;try{const{rasterInfo:r}=await this._openFunctionRaster(e,t);return r}catch(r){if(r instanceof s)throw r;throw new s("imagery-tile-layer","the given raster function is not supported")}}async save(e){return this._debouncedSaveOperations(0,e)}async saveAs(e,t){return this._debouncedSaveOperations(1,t,e)}write(e,t){const r=this._primaryRasters[0]??this.raster;if(this.loaded?"RasterTileServer"===r.datasetFormat&&("Raster"===r.tileType||"Map"===r.tileType):this.url&&/\/ImageServer(\/|\/?$)/i.test(this.url))return super.write(e,t);if(t?.messages){const e=`${t.origin}/${t.layerContainerType||"operational-layers"}`;t.messages.push(new s("layer:unsupported",`Layers (${this.title}, ${this.id}) of type '${this.declaredClass}' are not supported in the context of '${e}'`,{layer:this}))}return null}async _openRaster(e){let t=!1;if(this.raster)await this._openFromRaster(this.raster,e),t=U(this.raster),!t&&this.rasterFunction&&(this._primaryRasters=[this.raster],await this._initializeWithFunctionRaster(this.rasterFunction));else{const{url:t,rasterFunction:r,source:i}=this;if(!t&&!i)throw new s("imagery-tile-layer:open","missing url or source parameter");i?await this._openFromSource(i,e):r?await this._openFromUrlWithRasterFunction(t,r,e):await this._openFromUrl(t,e)}const r=this.raster.rasterInfo;if(!r)throw new s("imagery-tile-layer:load","cannot load resources on "+this.url);if(this._set("serviceRasterInfo",t?r:this._primaryRasters[0].rasterInfo),this._set("spatialReference",r.spatialReference),this.sourceJSON=this.sourceJSON||this.raster.sourceJSON,null!=this.sourceJSON){const e="Map"===this.raster.tileType&&null!=this.sourceJSON.minLOD&&null!=this.sourceJSON.maxLOD?this.sourceJSON:{...this.sourceJSON,minScale:0,maxScale:0};this.read(e,{origin:"service"})}else this.read({tileInfo:this.serviceRasterInfo?.storageInfo.tileInfo.toJSON()},{origin:"service"});this.title||(this.title=this.raster.datasetName),"Map"===this.raster.tileType&&(this.popupEnabled=!1),this._configDefaultSettings(),this.addHandles(p(()=>this.customParameters,e=>{this.raster&&(this.raster.ioConfig.customFetchParameters=e)}))}async _openFromRaster(e,t){e.rasterInfo||await e.open({signal:t}),this._primaryRasters=$(e),this.url||(this.url=this._primaryRasters[0].url)}async _openFromUrlWithRasterFunction(e,t,r){const i=[e];t&&B(t.toJSON(),i);const o=await Promise.all(i.map(e=>z.open({url:e,sourceJSON:this.sourceJSON,ioConfig:{sampling:"closest",...this.ioConfig,customFetchParameters:this.customParameters},signal:r}))),a=o.findIndex(e=>null==e);if(a>-1)throw new s("imagery-tile-layer:open",`cannot open raster: ${i[a]}`);return this._primaryRasters=o,this._initializeWithFunctionRaster(t)}async _openFromUrl(e,t){const r=await z.open({url:e,sourceJSON:this.sourceJSON,ioConfig:{sampling:"closest",...this.ioConfig,customFetchParameters:this.customParameters},signal:t});if(null==r)throw new s("imagery-tile-layer:open",`cannot open raster: ${e}`);this._primaryRasters=[r],this.raster=r}async _openFromSource(e,t){const r="the tiled imagery data source is not supported",i="coverage"===e.type?.toLowerCase()?"CovJSON":e.extent&&e.pixelBlock?"MEMORY":null;if(!i)throw new s("imagery-tile-layer:open",r);"MEMORY"===i&&(e={...e,pixelBlock:void 0,pixelBlocks:[e.pixelBlock]});const o=await z.open({url:"",source:e,datasetFormat:i,ioConfig:{sampling:"closest",...this.ioConfig,customFetchParameters:this.customParameters},signal:t});if(null==o)throw new s("imagery-tile-layer:open",r);this._primaryRasters=[o],this.rasterFunction?await this._initializeWithFunctionRaster(this.rasterFunction):this.raster=o}async _openFunctionRaster(e,t){const r={raster:this._primaryRasters[0]};this._primaryRasters.length>1&&this._primaryRasters.forEach(e=>r[e.url]=e);const s=A(e.functionDefinition?.toJSON()??e.toJSON(),r),i=new D({rasterFunction:s});return await i.open(t),i}async _initializeWithFunctionRaster(e,t){try{this.raster=await this._openFunctionRaster(e,t)}catch(r){r instanceof s&&i.getLogger(this).error("imagery-tile-layer:open",r.message),i.getLogger(this).warn("imagery-tile-layer:open","the raster function cannot be applied and is removed"),this._set("rasterFunction",null),this.raster=this._primaryRasters[0]}}_validateElevationInfo(e){W(i.getLogger(this),G("ImageryTile layers","relative-to-scene",e)),W(i.getLogger(this),k("ImageryTile layers",e))}};e([l({clonable:!1})],Y.prototype,"_primaryRasters",void 0),e([l({type:H,value:null,json:{name:"layerDefinition.elevationInfo",write:!0,origins:{"portal-item":{read:!1,write:!1},"web-map":{read:!1,write:!1}}}})],Y.prototype,"elevationInfo",null),e([l({readOnly:!0,clonable:!1})],Y.prototype,"graphicOrigin",void 0),e([l(I)],Y.prototype,"legendEnabled",void 0),e([l({type:Boolean,json:{read:!1,write:{enabled:!0,overridePolicy:()=>({enabled:!1})}}})],Y.prototype,"isReference",void 0),e([l({type:["show","hide"]})],Y.prototype,"listMode",void 0),e([l({json:{read:!0,write:!0}})],Y.prototype,"blendMode",void 0),e([l({type:E,json:{name:"renderingRule",write:!0}})],Y.prototype,"rasterFunction",void 0),e([l()],Y.prototype,"sourceJSON",void 0),e([l({readOnly:!0,json:{origins:{service:{read:{source:"currentVersion"}}}}})],Y.prototype,"version",void 0),e([l({readOnly:!0,json:{read:!1}})],Y.prototype,"type",void 0),e([l({type:["ArcGISTiledImageServiceLayer"]})],Y.prototype,"operationalLayerType",void 0),e([l({type:Boolean,value:!0,json:{read:{source:"disablePopup",reader:(e,t)=>!t.disablePopup},write:{target:"disablePopup",overridePolicy(){return{enabled:!this.loaded||"Raster"===this.raster.tileType}},writer(e,t,r){t[r]=!e}}}})],Y.prototype,"popupEnabled",void 0),e([l({type:t,json:{read:{source:"popupInfo"},write:{target:"popupInfo",overridePolicy(){return{enabled:!this.loaded||"Raster"===this.raster.tileType}}}}})],Y.prototype,"popupTemplate",void 0),e([l({readOnly:!0})],Y.prototype,"defaultPopupTemplate",null),e([l({json:{read:!1,write:!1}}),l(O)],Y.prototype,"screenSizePerspectiveEnabled",void 0),e([l({readOnly:!0,type:[b]})],Y.prototype,"fields",void 0),e([l({readOnly:!0,type:[b]})],Y.prototype,"rasterFields",null),e([l({constructOnly:!0})],Y.prototype,"source",void 0),Y=e([m("esri.layers.ImageryTileLayer")],Y);const q=Y;export{q as default};
@@ -2,4 +2,4 @@
2
2
  All material copyright ESRI, All Rights Reserved, unless otherwise specified.
3
3
  See https://js.arcgis.com/4.34/esri/copyright.txt for details.
4
4
  */
5
- import{__decorate as e}from"tslib";import t from"../../../core/Accessor.js";import has from"../../../core/has.js";import i from"../../../core/Logger.js";import{destroyMaybe as s}from"../../../core/maybe.js";import r from"../../../core/PooledArray.js";import{EsriPromiseMixin as a}from"../../../core/Promise.js";import{isAbortError as d}from"../../../core/promiseUtils.js";import{watch as n,sync as o,initial as l}from"../../../core/reactiveUtils.js";import{property as h}from"../../../core/accessorSupport/decorators/property.js";import"../../../core/RandomLCG.js";import{subclass as u}from"../../../core/accessorSupport/decorators/subclass.js";import{q as _}from"../../../chunks/vec32.js";import{UpdatingHandles as c}from"../../../core/support/UpdatingHandles.js";import{projectBoundingRect as p}from"../../../geometry/projection/projectBoundingRect.js";import{create as g}from"../../../geometry/support/aaBoundingRect.js";import{viewingModeFromString as m}from"../../../views/ViewingMode.js";import{I3SClientNodeLoader as y}from"../../../views/3d/layers/i3s/I3SClientNodeLoader.js";import{addCallback as f}from"../../../views/3d/layers/i3s/I3SFrameTask.js";import{I3SIndex as x}from"../../../views/3d/layers/i3s/I3SIndex.js";import b from"../../../views/3d/layers/i3s/I3SLodHandling.js";import N from"../../../views/3d/layers/i3s/I3SNodeLoader.js";import{I3SStreamDataController as w}from"../../../views/3d/layers/i3s/I3SStreamDataController.js";import{getVertexCrs as v,getIndexCrs as C,findIntersectingNodes as L}from"../../../views/3d/layers/i3s/I3SUtil.js";import D from"../../../views/3d/layers/i3s/I3SViewportQueries.js";import{maxDownloadSlots as V}from"../../../views/3d/support/downloadSlots.js";import{toBoundingRect as A}from"../../../views/3d/support/extentUtils.js";import{minQuality as I}from"../../../views/3d/support/MemoryController.js";import{PromiseQueue as S}from"../../../views/support/PromiseQueue.js";import{noBudget as M}from"../../../views/support/Scheduler.js";const F=100,P=2,O=1e4,q=1e-4,R=1.2,G=500,U=1.5;let H=class extends(a(t)){get isMeshPyramid(){return"mesh-pyramids"===this.layer.profile||"MeshPyramid"===this.layer.store?.lodType}get isGraphics3D(){return"points"===this.layer.profile}get useMaximumNumberOfFeatures(){return!this.isMeshPyramid&&(null==this.layer.priority||"High"===this.layer.priority)}get indexStreamController(){const e=this.layerView.view.resourceController.createStreamDataRequester(2);return new w(e,this.layer.customParameters,this.layer.apiKey)}get dataStreamController(){const e=this.layerView.view.resourceController.createStreamDataRequester(3);return new w(e,this.layer.customParameters,this.layer.apiKey)}get crsVertex(){return v(this.layer)}get crsIndex(){return C(this.layer)}get layer(){return this.layerView.i3slayer}get updating(){return this.running||this._updatingHandles.updating}get rootNodeVisible(){if(this._index){const e=this._index.rootNode;if(e)return this._updateViewData(),this._index.isNodeVisible(e.index)}return!0}get index(){return this._index}get requiredAttributes(){return this._requiredAttributes}constructor(e){super(e),this.featureTarget=5e4,this.fixedFeatureTarget=!1,this._updatingHandles=new c,this.running=!0,this.updatingProgress=1,this.leavesReached=!1,this.worker=null,this._featureLOD=1,this._stableFeatureLOD=!1,this._isIdle=!1,this._cameraDirty=!0,this._invisibleDirty=!1,this._idleStateCallbacks=null,this._newLoadingNodes=new r({deallocator:null}),this._modificationsNodeFilteringArray=new r,this._downloadingCount=0,this._loadingNodes=new Map,this._updatingNodes=new Map,this._progressMaxNumNodes=1,this._requiredAttributes=new Array,this._requiredAttributesDirty=!0,this._updatesDisabled=!1,this.disableIDBCache=!1,this._disableMemCache=!1,this._restartNodeLoading=!1,this._fields=null,this._attributeStorageInfo=null,this._idleQueue=new S,this._elevationUpdateNodes=new r({deallocator:null}),this._errorCount=0}initialize(){const{layerView:e,layer:t}=this;this._disableMemCache=!e.loadCachedGPUData||!e.addCachedGPUData,this._lodHandling=new b(e),this._defaultGeometrySchema=t.store.defaultGeometrySchema,this.disableIDBCache=!!has("disable-feature:idb-cache"),"fields"in t&&(this._fields=t.fields,this._attributeStorageInfo=t.attributeStorageInfo),this.addResolvingPromise(Promise.all([t.indexInfo,t.when(),e.when()]).then(([s])=>{if(this.destroyed||!e||e.destroyed||!s)return;const{view:r,clientGeometry:a}=e,{resourceController:d}=r;if(this._setClippingArea(r.clippingArea),this.addHandles([this._updatingHandles.add(()=>r?.pointsOfInterest?.focus?.renderLocation,e=>this._pointOfInterestChanged(e),{initial:!0,equals:_}),n(()=>r.quality,()=>this._setCameraDirty(),o),this._updatingHandles.add(()=>e.contentVisible,e=>{const t=e?()=>this._updateIdleState(!0):()=>this._updateViewData(),i=e?()=>this._updateIdleState(!1):()=>{};e&&null!=this._index&&this._index.invalidateAllElevationRanges(),this._idleStateCallbacks?(e||this.cancelNodeLoading(),this.restartNodeLoading(),this._idleStateCallbacks.idleBegin=t,this._idleStateCallbacks.idleEnd=i):this._idleStateCallbacks=d.scheduler.registerIdleStateCallbacks(t,i)},l),f(e.view.resourceController.scheduler,this),this._updatingHandles.add(()=>[this.featureTarget,this.fixedFeatureTarget],()=>{this._setCameraDirty(),this._stableFeatureLOD=!1}),this._updatingHandles.add(()=>r.state?.contentCamera,()=>this._setCameraDirty()),this._updatingHandles.add(()=>t.elevationInfo,e=>this._elevationInfoChanged(e)),this._updatingHandles.add(()=>e.lodFactor,()=>this._setCameraDirty()),this._updatingHandles.add(()=>e.availableFields,()=>this._requiredFieldsChange()),this._updatingHandles.add(()=>e.availableFields,()=>console.log("available fields changed",(new Error).stack),{sync:!0}),this._updatingHandles.add(()=>e.holeFilling,e=>null!=this._index&&(this._index.holeFilling=e))]),this._viewportQueries=new D(this.crsIndex,r.renderCoordsHelper,r.state.contentCamera,!r.state.fixedContentCamera||this.isGraphics3D,this._clippingArea,this.isMeshPyramid?r.basemapTerrain:r.elevationProvider,m(r.viewingMode),this.layer.elevationInfo,{progressiveLoadFactor:this._getProgressiveLoadFactor(),screenspaceErrorBias:this._lod,angleDependentLoD:this._lod<.5}),this._clientNodeLoader=new y(this.layer.uid,{indexSR:this.crsIndex,vertexSR:this.crsVertex,renderSR:r.renderCoordsHelper.spatialReference},r.resourceController.memoryController,this.worker),this._index=new x(m(r.viewingMode),t,s,this.indexStreamController,this._clientNodeLoader,this._viewportQueries,i.getLogger(this),e.holeFilling,t=>e.isNodeLoaded(t),t=>e.isNodeReloading(t),e=>this._shouldLoadNode(e),e=>this._enableFromGPUCache(e,1),e=>this._needsUpdate(e),()=>!this.indexStreamController.busy,t=>e.computeVisibilityObb?.(t)??null,e?.computeNodeFiltering?t=>e.computeNodeFiltering(t):void 0),this._index.updateElevationInfo(this.layer.elevationInfo,this.isMeshPyramid||this.isGraphics3D),this._index.imModificationsChanged(!!e.hasModifications),this._index.layerFilterChanged(!!e.hasGeometryFilter),null!=a){for(const e of a)this._addMesh(e.mesh,e.oid);this.addHandles(a.on("change",e=>{for(const t of e.removed)this._removeMesh(t.oid);for(const t of e.added)this._addMesh(t.mesh,t.oid)}))}this._startNodeLoading()}))}updateNodeModificationStatus(e){const t=this._index,i=this.layerView;null!=t&&i?.updateNodeModificationStatus&&(this._modificationsNodeFilteringArray.clear(),e.forAll(e=>{const i=t.getNode(e);null!=i&&this._modificationsNodeFilteringArray.push(i)}),i.updateNodeModificationStatus(this._modificationsNodeFilteringArray),this._invisibleDirty=!0)}destroy(){this.cancelNodeLoading(),this._idleStateCallbacks&&(this._isIdle=!1,this._idleStateCallbacks.remove(),this._idleStateCallbacks=null),this._updatingHandles.destroy(),this._nodeLoader=null,Q.prune(),this._newLoadingNodes.prune(),this._modificationsNodeFilteringArray.prune(),this._elevationUpdateNodes.prune(),this._index=null,this._lodHandling=s(this._lodHandling),this._nodeLoader=null,this._clientNodeLoader=null,this._viewportQueries=null,this._set("worker",null)}get viewportQueries(){return this._viewportQueries}_getRequiredAttributes(){if(null==this._attributeStorageInfo||!this._fields||!this.layerView.availableFields)return[];const e=this._attributeStorageInfo,t=this._fields,i=this.layer.objectIdField;return this.layerView.availableFields.map(i=>{const s=k(e,i),r=k(t,i);return s>=0&&r>=0?{index:s,name:t[r].name,field:t[r],attributeStorageInfo:e[s]}:null}).filter(e=>null!=e&&e.name!==i)}_requiredFieldsChange(){const e=this._getRequiredAttributes();j(this._requiredAttributes,e)||(this._requiredAttributes=e,this._requiredAttributesDirty=!1,this.restartNodeLoading())}requestUpdate(){this._requiredAttributesDirty=!0,this.restartNodeLoading()}_setClippingArea(e){const t=g();A(e,t,this.layerView.view.renderSpatialReference)?this._clippingArea=t:this._clippingArea=null}_pointOfInterestChanged(e){null!=this._viewportQueries&&(this._viewportQueries.setPointOfInterest(e),null!=this._index&&(this._index.progressiveLoadPenalty=T.distancePenalty*this._viewportQueries.distCameraToPOI(),this._index.requestUpdate()))}updateClippingArea(e){this._setClippingArea(e),null!=this._viewportQueries&&null!=this._index&&(this._viewportQueries.updateClippingArea(this._clippingArea),this._index.invalidateVisibilityCache()),this._setCameraDirty()}_setCameraDirty(){this._cameraDirty=!0,this._lodHandling.setLodGlobalDirty(),this._evaluateRunning()}_addMesh(e,t){if(null==this._index)return;const i=this._clientNodeLoader.createMeshNodeInfo(e,t),s=this._index.addClientNodeToIndex(i.id,i.mbs);this._clientNodeLoader.addMeshNode(s,i),this._evaluateRunning(),this.notifyChange("rootNodeVisible")}_removeMesh(e){const t=this._clientNodeLoader.getMeshNodeIndex(e);if(null!=t){if(null==this._index)throw new Error("delayed removal of client side i3s node geometry not supported yet.");{const e=(e,t)=>{this.layerView.removeNode(t),this._clientNodeLoader.removeNode(e),this.layerView.deleteCachedNodeData&&null!=e&&this.layerView.deleteCachedNodeData(e),this.layerView.deleteCachedGPUData?.(this.layerView.loadCachedGPUData?.(t))},i=(e,t,i)=>{this._clientNodeLoader.updateNodeIndex(e,t,i),this.layerView.updateNodeIndex&&this.layerView.updateNodeIndex(t,i)};this._index.removeClientNodeFromIndex(t,e,i),this.notifyChange("rootNodeVisible")}}}updateElevationChanged(e,t){const i=this._index;if(null==i?.rootNode||null==t)return null;this.crsIndex.equals(t)||(p(e,t,E,this.crsIndex),e=E);const s=this._elevationUpdateNodes;return s.clear(),L(e,i.rootNode,i,e=>s.push(e.index)),s.length&&(s.forAll(e=>i.updateElevationChanged(e)),this._setCameraDirty()),s}removeAllGeometryObbs(){null!=this._index&&this._index.removeAllGeometryObbs()}getRenderMbs(e){return null!=this._viewportQueries?this._viewportQueries.getServiceMbsInRenderSR(e):null}_elevationInfoChanged(e){null!=this._index&&(this._index.updateElevationInfo(e,this.isMeshPyramid||this.isGraphics3D),this._setCameraDirty())}restartNodeLoading(){this._restartNodeLoading=!0,this.cancelNodeLoading(),this._evaluateRunning()}schedule(e,t){const i=this._idleQueue.push(e,t);return this._evaluateRunning(),i}reschedule(e,t){const i=this._idleQueue.unshift(e,t);return this._evaluateRunning(),i}get _isIntegratedMesh(){return"integrated-mesh"===this.layer.type}get unloadedMemoryEstimate(){return null!=this._index&&this.layerView.contentVisible?this._index.unloadedMemoryEstimate*this._lodDropFactor:0}async _loadNodeData(e,t){return e.index<0?this._clientNodeLoader.loadNodeData(e.id,t):this._nodeLoader.loadNodeData(e,t)}async _loadAttributes(e,t,i){return(e.index<0?this._clientNodeLoader:this._nodeLoader).loadAttributes(e,t,i)}get indexDepth(){return null!=this._index?this._index.maxLevel:0}set disableMemCache(e){this.layerView.loadCachedGPUData&&this.layerView.addCachedGPUData?this._disableMemCache=e:this._disableMemCache=!0}runTask(e,t){return this.layerView.contentVisible?this.layerView.visible&&null!=this._index?(this._processWithErrorLogging(e,t),this._index.maxPriority):-1/0:(this._updateViewData(),this._evaluateRunning(),-1/0)}_processWithErrorLogging(e,t){try{this._process(e,t)}catch(s){this._errorCount<50?i.getLogger(this).error(`Error during processing: ${s} at ${s.stack}`):50===this._errorCount&&i.getLogger(this).error("Too many errors for this layer. Further errors will not be displayed."),this._errorCount++}}_process(e,t){this._restartNodeLoading&&this._startNodeLoading(),null!=this._nodeLoader&&null!=this._index&&(this._updateViewData(),this._invisibleDirty&&this._removeInvisibleNodes(e)&&(this._invisibleDirty=!1),this._isIntegratedMesh&&(e.enabled=!1),e.run(()=>this._processIndex(e)),this._updateFeatureLOD(),e.run(()=>this._processCache(e)),this._isIntegratedMesh&&(e.enabled=!0),e.run(()=>this._processNodes(e,t)),this._idleQueue.runTask(e),e.run(()=>this._prefetchIndex()),t.numIndexLoading+=this._index.indexLoading,t.numNodesLoading+=this._downloadingCount,e.run(()=>this._lodHandling.lodGlobalHandling(e)),this._evaluateRunning())}_processIndex(e){if(null==this._index)return!1;if(this._index.dirty){this._newLoadingNodes.clear(),this._index.update(Array.from(this._loadingNodes.keys()),e,e=>this.updateNodeModificationStatus(e)),this._disableMemCache||(this._newLoadingNodes.pushArray(this._index.updates.add.data,this._index.updates.add.length),this._newLoadingNodes.pushArray(this._index.updates.missing.data,this._index.updates.missing.length));const t=this._index.featureEstimate.leavesReached;this._index.isLoading||t===this._get("leavesReached")||this._set("leavesReached",t)}return this._index.load()}_prefetchIndex(){return!(null==this._index||this._loadingNodes.size>0||this._index.updates.add.length>0)&&this._index.prefetch()}_updateFeatureLOD(){if(!this.useMaximumNumberOfFeatures||null==this._index||null==this._viewportQueries)return;const e=!this._index.isLoading,t=this.featureTarget*this._baseLOD,i=this._index.featureEstimate;if(i.estimate=i.estimate||t/2,this._index.indexMissing>G){if(this._featureLOD<=q)return;this._featureLOD/=U,this._stableFeatureLOD=!1}else if(e&&i.estimate<t){if(i.leavesReached||this._featureLOD>=O||this._stableFeatureLOD)return;const e=Math.min(10,Math.max(t/i.estimate,1.001));this._featureLOD*=e;const s=this._lod,r=this._index.checkFeatureTarget(t,s);r!==s&&(this._featureLOD=r/this._baseLOD,this._stableFeatureLOD=!0)}else{if(!(i.estimate>t*R||e&&i.estimate>t))return;if(this._featureLOD<=q)return;this._featureLOD/=1+.25*(i.estimate/t-1),this._stableFeatureLOD=!1}this._featureLOD=Math.min(O,Math.max(q,this._featureLOD)),this._viewportQueries.updateScreenSpaceErrorBias(this._lod),this._index.requestUpdate()}_processCache(e){const t=this._index;if(null==t)return!1;for(;this._newLoadingNodes.length>0&&!e.done;){const i=this._newLoadingNodes.pop();for(let s=t.getParent(i);null!=s&&!this.layerView.isNodeLoaded(s.index);s=t.getParent(s.index))if(this._enableFromGPUCache(s,0)){e.madeProgress();break}}return e.hasProgressed}_processNodes(e,t){if(null==this._index)return!1;let i=(this._isIdle?F:P)-this._loadingNodes.size;const s=this._index.updates;for(s.cancel.forEach(this._cancelNode,this),s.cancel=[];s.remove.length>0&&!e.done;)this.layerView.removeNode(s.remove.pop()),e.madeProgress();for(;s.update.length>0&&!e.done;){const t=this._index.getNode(s.update.pop());null!=t&&(this._updateLoadedNode(t),e.madeProgress())}for(;s.add.length>0&&!e.done&&i>0;){--i;const r=this._index.getNode(s.add.back());if(null==r||2!==r.cacheState&&!this._hasNodeLoadToken(t))break;s.add.pop(),this._loadNode(r),e.madeProgress()}return e.hasProgressed}_cancelAllNodes(){this._loadingNodes.forEach(e=>e.abort()),this._loadingNodes.clear(),this._updatingNodes.forEach(e=>e.abort()),this._updatingNodes.clear()}_cancelNode(e){const t=this._loadingNodes.get(e);t&&(t.abort(),this._loadingNodes.delete(e))}_hasNodeLoadToken(e){return!(!this._isIdle&&e.numNodesLoading+this._loadingNodes.size>=P)&&(this._downloadingCount<V&&!this.dataStreamController.busy)}_evaluateRunning(){let e=!1,t=0;if(this.layerView){if(this.layerView.contentVisible){const i=(this._index?.indexMissing??0)+3*(this._index?.updates.add.length??0)+2*this._loadingNodes.size;e=!!(i>0||this._updatingNodes.size>0||this._restartNodeLoading||this._cameraDirty||this._idleQueue.updating||this._lodHandling&&this._lodHandling.requiresLODGlobalHandling||null!=this._index&&this._index.isPrefetching),0===i&&(this._progressMaxNumNodes=1),this._progressMaxNumNodes=Math.max(i,this._progressMaxNumNodes),t=1-i/this._progressMaxNumNodes}else e=this._cameraDirty,t=e?0:1;this.running=e,this.updatingProgress=t}}_updateViewData(){if(!this._cameraDirty||null==this._index||null==this._viewportQueries)return;const e=this.layerView.view,{contentCamera:t,fixedContentCamera:i}=e.state;this._viewportQueries.updateCamera(t,!i||this.isGraphics3D),this._viewportQueries.setPointOfInterest(e.pointsOfInterest.focus.renderLocation),this._viewportQueries.updateScreenSpaceErrorBias(this._lod),this._index.invalidateVisibilityCache(),this._index.progressiveLoadPenalty=T.distancePenalty*this._viewportQueries.distCameraToPOI(),this._index.requestUpdate(),this._stableFeatureLOD=!1,this._invisibleDirty=!0,this._cameraDirty=!1,this.notifyChange("rootNodeVisible")}_getProgressiveLoadFactor(){return this.layerView.view.quality<1?1:this.layerView.progressiveLoadFactor}get _lod(){return this._featureLOD*this._baseLOD}get _baseLOD(){const e=this.layerView.lodFactor;return this.fixedFeatureTarget?1:(e>0?e:1)*this.layerView.view.quality}get _lodDropFactor(){if(this.fixedFeatureTarget)return 1;return(Math.min(this.layerView.view.quality,.5)-I)/(.5-I)}isGeometryVisible(e){return!!this._index?.isGeometryVisible(e.index)}updateVisibility(e){this._index?.invalidateNodeVisibilityCache(e)}invalidateGeometryVisibility(e){this._index?.invalidateGeometryVisibility(e)}invalidateVisibilityObbs(){this._index?.invalidateVisibilityObbs()}modificationsChanged(){this._index?.imModificationsChanged(!!this.layerView.hasModifications),this._invisibleDirty=!0}_shouldLoadNode(e){return!(!this._lodHandling.shouldLoadNode(e)||this._shouldDropNode(e))&&!(null==this._index||!this._index.isGeometryVisible(e.index))}_shouldDropNode(e){if(null==this._viewportQueries)return!1;const t=this._lodDropFactor;if(t>=1||!this._lodHandling.hasNoVisibleChildren(e))return!1;return Math.abs(this._viewportQueries.calcCameraDistanceToCenter(e))-this._viewportQueries.minDistance>(this._viewportQueries.maxDistance-this._viewportQueries.minDistance)*t}_startNodeLoading(){this._restartNodeLoading=!1;const e=this._index;if(this._updatesDisabled||null==e||null==this._viewportQueries)return;this._updateViewData(),this._requiredAttributesDirty&&(this._requiredAttributes=this._getRequiredAttributes(),this._requiredAttributesDirty=!1);const t={textureEncodings:this.layerView.supportedTextureEncodings,textureUsageMask:this.layerView.rendererTextureUsage,loadFeatureData:this.useMaximumNumberOfFeatures};this._nodeLoader=new N(this.layer,this.dataStreamController,i.getLogger(this),this._defaultGeometrySchema,this._requiredAttributes,t),e.requestUpdate(),this._lodHandling.startNodeLoading((e,t)=>this._removeNodes(e,t,1),e,{maxLodLevel:this._viewportQueries.maxLodLevel}),this._evaluateRunning()}isNodeLoading(){return null!=this._nodeLoader&&null!=this._index}cancelNodeLoading(){this.isNodeLoading()&&(this.indexStreamController.cancelAll(),this.dataStreamController.cancelAll(),this._idleQueue.cancelAll(),this._cancelAllNodes(),this._nodeLoader=null,this._evaluateRunning())}_removeInvisibleNodes(e){const t=this._index;if(null==t||null==this._viewportQueries)return!1;Q.clear(),this.layerView.getLoadedNodeIndices(Q);const i=0===this._viewportQueries.maxDistance,s=i?()=>!1:e=>this._shouldDropNode(e);return Q.filterInPlace(e=>{const i=t.getNode(e);return null==i||!t.isGeometryVisible(e)||s(i)}),Q.length>0&&this._lodHandling.setLodGlobalDirty(),this._removeNodes(Q,e,0),!(i&&this._lodDropFactor<1)&&(0===Q.length||(Q.clear(),!1))}markNodeToRemove(e){Q.push(e)}removeMarkedNodes(){this._removeNodes(Q,M,0)}_removeNodes(e,t,i){if(0!==e.length&&!t.done)for(null!=this._index&&this._index.requestUpdate();e.length>0&&!t.done;){const s=e.pop(),r=this._index;1===i&&this.layerView.nodeFadeoutEnabled&&null!=r&&r.isGeometryVisible(s)?this.layerView.fadeNode(s,1,!0):this.layerView.removeNode(s),t.madeProgress()}}_needsUpdate(e){if(e.resources.isEmpty||this._updatingNodes.has(e.index))return!1;const t=this.layerView.getLoadedAttributes(e.index);return null!=t&&t!==this._requiredAttributes}async _updateLoadedNode(e){const t=new AbortController;this._updatingNodes.set(e.index,t),this._evaluateRunning();try{const i=this.layerView.getLoadedAttributes(e.index),s=j(i,this._requiredAttributes)?this.layerView.getAttributeData(e.index):await this._loadAttributes(e,this._requiredAttributes,t.signal);await this.schedule(()=>this.layerView.updateAttributes(e.index,{loadedAttributes:this._requiredAttributes,attributeData:s},t.signal),t.signal)}catch(i){if(!d(i))return this.layerView.updateAttributes(e.index,{loadedAttributes:this._requiredAttributes,attributeData:{}},t.signal)}this._updatingNodes.delete(e.index),this._evaluateRunning()}_loadNode(e){if(this._loadingNodes.has(e.index))return void i.getLogger(this).error("already loading node "+e.index);const t=new AbortController;this._loadingNodes.set(e.index,t),this._evaluateRunning(),this._loadAndAddNode(e,t.signal).then(i=>{i&&null!=this._index&&this._loadingNodes.get(e.index)===t&&(this._loadingNodes.delete(e.index),this._index.requestUpdate())}).catch(e=>{if(!d(e))throw e}).finally(()=>{this._loadingNodes.get(e.index)===t&&this._loadingNodes.delete(e.index),this._evaluateRunning()})}_loadAndAddNode(e,t){return 1===e.cacheState?this._loadUncached(e,t).then(()=>!1):this._loadCached(e,t).then(t=>!t&&(e.cacheState=1,!0)).catch(t=>!d(t)&&(e.cacheState=1,!0))}_enableFromGPUCache(e,t){if(this._disableMemCache||null==this._index)return!1;if(0===t&&!this._index.useNodeAsHole(e.index))return!0;const i=this._loadCachedGPUData(e);return!!i&&(this.layerView.addCachedGPUData(e,i,t),this._nodeAdded(),!0)}_loadCachedGPUData(e){const t=this.layerView.loadCachedGPUData(e.index);return null!=t?.attributeInfo&&j(t.attributeInfo.loadedAttributes,this._requiredAttributes)?t:(this.layerView.deleteCachedGPUData(t),null)}_nodeAdded(){null!=this._index&&this._index.requestUpdate(),this._lodHandling.setLodGlobalDirty(),this._evaluateRunning()}updateLoadStatus(e,t){const i=this._index;null!=i&&i.updateChildrenLoaded(e,t?1:-1)}async _loadCached(e,t){if(this._enableFromGPUCache(e,1))return!0;const i=this.layerView;if(this.disableIDBCache||!i.loadCachedNodeData||!i.addCachedNodeData)return!1;const s=(t,i)=>this._nodeLoader.loadTextures(e,t,i),r=(t,i)=>this._clientNodeLoader.loadTextures(e,t,i),a=e.index>=0?s:r,d=await this.schedule(()=>i.loadCachedNodeData(e,t,a),t);if(null==d)return!1;const n=this._requiredAttributes,o=await this.reschedule(()=>this._loadAttributes(e,n,t),t);return await this.reschedule(()=>i.addCachedNodeData(e,d,{loadedAttributes:n,attributeData:o},t),t),this._nodeAdded(),!0}_loadUncached(e,t){return this._downloadingCount++,this._loadNodeData(e,t).catch(e=>{throw this._downloadingCount--,e}).then(i=>(this._downloadingCount--,this.schedule(()=>this.layerView.addNode(e,i,t),t))).then(()=>{this._nodeAdded(),e.cacheState=2}).catch(t=>{if(!d(t))throw i.getLogger(this).error("#loadNodeData()",this.layer,`Failed to load node '${e.id}'`,t),e.failed=!0,null!=this._index&&this._index.requestUpdate(),t})}_updateIdleState(e){e!==this._isIdle&&(this._isIdle=e,this._evaluateRunning(),e&&this._index&&null!=this._index&&this._index.resetFailedNodes())}get test(){}notifyLODUpdate(){this._lodHandling.setLodGlobalDirty(),this._evaluateRunning(),null!=this._index&&this._index.requestUpdate()}geometryFilterChanged(e){const t=this._index;null!=t&&t.layerFilterChanged(e),this._setCameraDirty()}};e([h({readOnly:!0})],H.prototype,"isMeshPyramid",null),e([h({readOnly:!0})],H.prototype,"isGraphics3D",null),e([h({readOnly:!0})],H.prototype,"useMaximumNumberOfFeatures",null),e([h({readOnly:!0})],H.prototype,"indexStreamController",null),e([h({readOnly:!0})],H.prototype,"dataStreamController",null),e([h({readOnly:!0})],H.prototype,"crsVertex",null),e([h({readOnly:!0})],H.prototype,"crsIndex",null),e([h()],H.prototype,"featureTarget",void 0),e([h()],H.prototype,"fixedFeatureTarget",void 0),e([h()],H.prototype,"layerView",void 0),e([h()],H.prototype,"layer",null),e([h()],H.prototype,"_updatingHandles",void 0),e([h()],H.prototype,"updating",null),e([h()],H.prototype,"running",void 0),e([h()],H.prototype,"updatingProgress",void 0),e([h({readOnly:!0})],H.prototype,"leavesReached",void 0),e([h({constructOnly:!0})],H.prototype,"worker",void 0),e([h({readOnly:!0,dependsOn:[]})],H.prototype,"rootNodeVisible",null),H=e([u("esri.layers.graphics.controllers.I3SOnDemandController")],H);const Q=new r({deallocator:null});function j(e,t){return null!=e&&e.length===t.length&&e.every(e=>k(t,e.name)>=0)}function k(e,t){const i=t.toLowerCase();for(let s=0;s<e.length;s++)if(e[s].name.toLowerCase()===i)return s;return-1}const T={distancePenalty:10},E=g();export{H as default};
5
+ import{__decorate as e}from"tslib";import t from"../../../core/Accessor.js";import has from"../../../core/has.js";import i from"../../../core/Logger.js";import{destroyMaybe as s}from"../../../core/maybe.js";import r from"../../../core/PooledArray.js";import{EsriPromiseMixin as a}from"../../../core/Promise.js";import{isAbortError as d}from"../../../core/promiseUtils.js";import{watch as o,sync as n,initial as l}from"../../../core/reactiveUtils.js";import{property as h}from"../../../core/accessorSupport/decorators/property.js";import"../../../core/RandomLCG.js";import{subclass as u}from"../../../core/accessorSupport/decorators/subclass.js";import{q as _}from"../../../chunks/vec32.js";import{UpdatingHandles as c}from"../../../core/support/UpdatingHandles.js";import{projectBoundingRect as p}from"../../../geometry/projection/projectBoundingRect.js";import{create as g}from"../../../geometry/support/aaBoundingRect.js";import{viewingModeFromString as m}from"../../../views/ViewingMode.js";import{I3SClientNodeLoader as y}from"../../../views/3d/layers/i3s/I3SClientNodeLoader.js";import{addCallback as f}from"../../../views/3d/layers/i3s/I3SFrameTask.js";import{I3SIndex as x}from"../../../views/3d/layers/i3s/I3SIndex.js";import N from"../../../views/3d/layers/i3s/I3SLodHandling.js";import b from"../../../views/3d/layers/i3s/I3SNodeLoader.js";import{I3SStreamDataController as w}from"../../../views/3d/layers/i3s/I3SStreamDataController.js";import{getVertexCrs as v,getIndexCrs as C,findIntersectingNodes as L}from"../../../views/3d/layers/i3s/I3SUtil.js";import D from"../../../views/3d/layers/i3s/I3SViewportQueries.js";import{maxDownloadSlots as V}from"../../../views/3d/support/downloadSlots.js";import{toBoundingRect as A}from"../../../views/3d/support/extentUtils.js";import{minQuality as I}from"../../../views/3d/support/MemoryController.js";import{PromiseQueue as S}from"../../../views/support/PromiseQueue.js";import{noBudget as M}from"../../../views/support/Scheduler.js";const F=100,P=2,O=1e4,q=1e-4,R=1.2,G=500,U=1.5;let Q=class extends(a(t)){get isMeshPyramid(){return"mesh-pyramids"===this.layer.profile||"MeshPyramid"===this.layer.store?.lodType}get isGraphics3D(){return"points"===this.layer.profile}get useMaximumNumberOfFeatures(){return!this.isMeshPyramid&&(null==this.layer.priority||"High"===this.layer.priority)}get indexStreamController(){const e=this.layerView.view.resourceController.createStreamDataRequester(2);return new w(e,this.layer.customParameters,this.layer.apiKey)}get dataStreamController(){const e=this.layerView.view.resourceController.createStreamDataRequester(3);return new w(e,this.layer.customParameters,this.layer.apiKey)}get crsVertex(){return v(this.layer)}get crsIndex(){return C(this.layer)}get layer(){return this.layerView.i3slayer}get updating(){return this.running||this._updatingHandles.updating}get rootNodeVisible(){if(this._index){const e=this._index.rootNode;if(e)return this._updateViewData(),this._index.isNodeVisible(e.index)}return!0}get index(){return this._index}get requiredAttributes(){return this._requiredAttributes}constructor(e){super(e),this.featureTarget=5e4,this.fixedFeatureTarget=!1,this._updatingHandles=new c,this.running=!0,this.updatingProgress=1,this.leavesReached=!1,this.worker=null,this._featureLOD=1,this._stableFeatureLOD=!1,this._isIdle=!1,this._cameraDirty=!0,this._invisibleDirty=!1,this._idleStateCallbacks=null,this._newLoadingNodes=new r({deallocator:null}),this._modificationsNodeFilteringArray=new r,this._downloadingCount=0,this._loadingNodes=new Map,this._updatingNodes=new Map,this._progressMaxNumNodes=1,this._requiredAttributes=new Array,this._requiredAttributesDirty=!0,this._updatesDisabled=!1,this.disableIDBCache=!1,this._disableMemCache=!1,this._restartNodeLoading=!1,this._fields=null,this._attributeStorageInfo=null,this._idleQueue=new S,this._elevationUpdateNodes=new r({deallocator:null}),this._errorCount=0}initialize(){const{layerView:e,layer:t}=this;this._disableMemCache=!e.loadCachedGPUData||!e.addCachedGPUData,this._lodHandling=new N(e),this._defaultGeometrySchema=t.store.defaultGeometrySchema,this.disableIDBCache=!!has("disable-feature:idb-cache"),"fields"in t&&(this._fields=t.fields,this._attributeStorageInfo=t.attributeStorageInfo),this.addResolvingPromise(Promise.all([t.indexInfo,t.when(),e.when()]).then(([s])=>{if(this.destroyed||!e||e.destroyed||!s)return;const{view:r,clientGeometry:a}=e,{resourceController:d}=r;if(this._setClippingArea(r.clippingArea),this.addHandles([this._updatingHandles.add(()=>r?.pointsOfInterest?.focus?.renderLocation,e=>this._pointOfInterestChanged(e),{initial:!0,equals:_}),o(()=>r.quality,()=>this._setCameraDirty(),n),this._updatingHandles.add(()=>e.contentVisible,e=>{const t=e?()=>this._updateIdleState(!0):()=>this._updateViewData(),i=e?()=>this._updateIdleState(!1):()=>{};e&&null!=this._index&&this._index.invalidateAllElevationRanges(),this._idleStateCallbacks?(e||this.cancelNodeLoading(),this.restartNodeLoading(),this._idleStateCallbacks.idleBegin=t,this._idleStateCallbacks.idleEnd=i):this._idleStateCallbacks=d.scheduler.registerIdleStateCallbacks(t,i)},l),f(e.view.resourceController.scheduler,this),this._updatingHandles.add(()=>[this.featureTarget,this.fixedFeatureTarget],()=>{this._setCameraDirty(),this._stableFeatureLOD=!1}),this._updatingHandles.add(()=>r.state?.contentCamera,()=>this._setCameraDirty()),this._updatingHandles.add(()=>t.elevationInfo,e=>this._elevationInfoChanged(e)),this._updatingHandles.add(()=>e.lodFactor,()=>this._setCameraDirty()),this._updatingHandles.add(()=>e.availableFields,()=>this._requiredFieldsChange()),this._updatingHandles.add(()=>e.holeFilling,e=>null!=this._index&&(this._index.holeFilling=e))]),this._viewportQueries=new D(this.crsIndex,r.renderCoordsHelper,r.state.contentCamera,!r.state.fixedContentCamera||this.isGraphics3D,this._clippingArea,this.isMeshPyramid?r.basemapTerrain:r.elevationProvider,m(r.viewingMode),this.layer.elevationInfo,{progressiveLoadFactor:this._getProgressiveLoadFactor(),screenspaceErrorBias:this._lod,angleDependentLoD:this._lod<.5}),this._clientNodeLoader=new y(this.layer.uid,{indexSR:this.crsIndex,vertexSR:this.crsVertex,renderSR:r.renderCoordsHelper.spatialReference},r.resourceController.memoryController,this.worker),this._index=new x(m(r.viewingMode),t,s,this.indexStreamController,this._clientNodeLoader,this._viewportQueries,i.getLogger(this),e.holeFilling,t=>e.isNodeLoaded(t),t=>e.isNodeReloading(t),e=>this._shouldLoadNode(e),e=>this._enableFromGPUCache(e,1),e=>this._needsUpdate(e),()=>!this.indexStreamController.busy,t=>e.computeVisibilityObb?.(t)??null,e?.computeNodeFiltering?t=>e.computeNodeFiltering(t):void 0),this._index.updateElevationInfo(this.layer.elevationInfo,this.isMeshPyramid||this.isGraphics3D),this._index.imModificationsChanged(!!e.hasModifications),this._index.layerFilterChanged(!!e.hasGeometryFilter),null!=a){for(const e of a)this._addMesh(e.mesh,e.oid);this.addHandles(a.on("change",e=>{for(const t of e.removed)this._removeMesh(t.oid);for(const t of e.added)this._addMesh(t.mesh,t.oid)}))}this._startNodeLoading()}))}updateNodeModificationStatus(e){const t=this._index,i=this.layerView;null!=t&&i?.updateNodeModificationStatus&&(this._modificationsNodeFilteringArray.clear(),e.forAll(e=>{const i=t.getNode(e);null!=i&&this._modificationsNodeFilteringArray.push(i)}),i.updateNodeModificationStatus(this._modificationsNodeFilteringArray),this._invisibleDirty=!0)}destroy(){this.cancelNodeLoading(),this._idleStateCallbacks&&(this._isIdle=!1,this._idleStateCallbacks.remove(),this._idleStateCallbacks=null),this._updatingHandles.destroy(),this._nodeLoader=null,H.prune(),this._newLoadingNodes.prune(),this._modificationsNodeFilteringArray.prune(),this._elevationUpdateNodes.prune(),this._index=null,this._lodHandling=s(this._lodHandling),this._nodeLoader=null,this._clientNodeLoader=null,this._viewportQueries=null,this._set("worker",null)}get viewportQueries(){return this._viewportQueries}_getRequiredAttributes(){if(null==this._attributeStorageInfo||!this._fields||!this.layerView.availableFields)return[];const e=this._attributeStorageInfo,t=this._fields,i=this.layer.objectIdField;return this.layerView.availableFields.map(i=>{const s=k(e,i),r=k(t,i);return s>=0&&r>=0?{index:s,name:t[r].name,field:t[r],attributeStorageInfo:e[s]}:null}).filter(e=>null!=e&&e.name!==i)}_requiredFieldsChange(){const e=this._getRequiredAttributes();j(this._requiredAttributes,e)||(this._requiredAttributes=e,this._requiredAttributesDirty=!1,this.restartNodeLoading())}requestUpdate(){this._requiredAttributesDirty=!0,this.restartNodeLoading()}_setClippingArea(e){const t=g();A(e,t,this.layerView.view.renderSpatialReference)?this._clippingArea=t:this._clippingArea=null}_pointOfInterestChanged(e){null!=this._viewportQueries&&(this._viewportQueries.setPointOfInterest(e),null!=this._index&&(this._index.progressiveLoadPenalty=T.distancePenalty*this._viewportQueries.distCameraToPOI(),this._index.requestUpdate()))}updateClippingArea(e){this._setClippingArea(e),null!=this._viewportQueries&&null!=this._index&&(this._viewportQueries.updateClippingArea(this._clippingArea),this._index.invalidateVisibilityCache()),this._setCameraDirty()}_setCameraDirty(){this._cameraDirty=!0,this._lodHandling.setLodGlobalDirty(),this._evaluateRunning()}_addMesh(e,t){if(null==this._index)return;const i=this._clientNodeLoader.createMeshNodeInfo(e,t),s=this._index.addClientNodeToIndex(i.id,i.mbs);this._clientNodeLoader.addMeshNode(s,i),this._evaluateRunning(),this.notifyChange("rootNodeVisible")}_removeMesh(e){const t=this._clientNodeLoader.getMeshNodeIndex(e);if(null!=t){if(null==this._index)throw new Error("delayed removal of client side i3s node geometry not supported yet.");{const e=(e,t)=>{this.layerView.removeNode(t),this._clientNodeLoader.removeNode(e),this.layerView.deleteCachedNodeData&&null!=e&&this.layerView.deleteCachedNodeData(e),this.layerView.deleteCachedGPUData?.(this.layerView.loadCachedGPUData?.(t))},i=(e,t,i)=>{this._clientNodeLoader.updateNodeIndex(e,t,i),this.layerView.updateNodeIndex&&this.layerView.updateNodeIndex(t,i)};this._index.removeClientNodeFromIndex(t,e,i),this.notifyChange("rootNodeVisible")}}}updateElevationChanged(e,t){const i=this._index;if(null==i?.rootNode||null==t)return null;this.crsIndex.equals(t)||(p(e,t,E,this.crsIndex),e=E);const s=this._elevationUpdateNodes;return s.clear(),L(e,i.rootNode,i,e=>s.push(e.index)),s.length&&(s.forAll(e=>i.updateElevationChanged(e)),this._setCameraDirty()),s}removeAllGeometryObbs(){null!=this._index&&this._index.removeAllGeometryObbs()}getRenderMbs(e){return null!=this._viewportQueries?this._viewportQueries.getServiceMbsInRenderSR(e):null}_elevationInfoChanged(e){null!=this._index&&(this._index.updateElevationInfo(e,this.isMeshPyramid||this.isGraphics3D),this._setCameraDirty())}restartNodeLoading(){this._restartNodeLoading=!0,this.cancelNodeLoading(),this._evaluateRunning()}schedule(e,t){const i=this._idleQueue.push(e,t);return this._evaluateRunning(),i}reschedule(e,t){const i=this._idleQueue.unshift(e,t);return this._evaluateRunning(),i}get _isIntegratedMesh(){return"integrated-mesh"===this.layer.type}get unloadedMemoryEstimate(){return null!=this._index&&this.layerView.contentVisible?this._index.unloadedMemoryEstimate*this._lodDropFactor:0}async _loadNodeData(e,t){return e.index<0?this._clientNodeLoader.loadNodeData(e.id,t):this._nodeLoader.loadNodeData(e,t)}async _loadAttributes(e,t,i){return(e.index<0?this._clientNodeLoader:this._nodeLoader).loadAttributes(e,t,i)}get indexDepth(){return null!=this._index?this._index.maxLevel:0}set disableMemCache(e){this.layerView.loadCachedGPUData&&this.layerView.addCachedGPUData?this._disableMemCache=e:this._disableMemCache=!0}runTask(e,t){return this.layerView.contentVisible?this.layerView.visible&&null!=this._index?(this._processWithErrorLogging(e,t),this._index.maxPriority):-1/0:(this._updateViewData(),this._evaluateRunning(),-1/0)}_processWithErrorLogging(e,t){try{this._process(e,t)}catch(s){this._errorCount<50?i.getLogger(this).error(`Error during processing: ${s} at ${s.stack}`):50===this._errorCount&&i.getLogger(this).error("Too many errors for this layer. Further errors will not be displayed."),this._errorCount++}}_process(e,t){this._restartNodeLoading&&this._startNodeLoading(),null!=this._nodeLoader&&null!=this._index&&(this._updateViewData(),this._invisibleDirty&&this._removeInvisibleNodes(e)&&(this._invisibleDirty=!1),this._isIntegratedMesh&&(e.enabled=!1),e.run(()=>this._processIndex(e)),this._updateFeatureLOD(),e.run(()=>this._processCache(e)),this._isIntegratedMesh&&(e.enabled=!0),e.run(()=>this._processNodes(e,t)),this._idleQueue.runTask(e),e.run(()=>this._prefetchIndex()),t.numIndexLoading+=this._index.indexLoading,t.numNodesLoading+=this._downloadingCount,e.run(()=>this._lodHandling.lodGlobalHandling(e)),this._evaluateRunning())}_processIndex(e){if(null==this._index)return!1;if(this._index.dirty){this._newLoadingNodes.clear(),this._index.update(Array.from(this._loadingNodes.keys()),e,e=>this.updateNodeModificationStatus(e)),this._disableMemCache||(this._newLoadingNodes.pushArray(this._index.updates.add.data,this._index.updates.add.length),this._newLoadingNodes.pushArray(this._index.updates.missing.data,this._index.updates.missing.length));const t=this._index.featureEstimate.leavesReached;this._index.isLoading||t===this._get("leavesReached")||this._set("leavesReached",t)}return this._index.load()}_prefetchIndex(){return!(null==this._index||this._loadingNodes.size>0||this._index.updates.add.length>0)&&this._index.prefetch()}_updateFeatureLOD(){if(!this.useMaximumNumberOfFeatures||null==this._index||null==this._viewportQueries)return;const e=!this._index.isLoading,t=this.featureTarget*this._baseLOD,i=this._index.featureEstimate;if(i.estimate=i.estimate||t/2,this._index.indexMissing>G){if(this._featureLOD<=q)return;this._featureLOD/=U,this._stableFeatureLOD=!1}else if(e&&i.estimate<t){if(i.leavesReached||this._featureLOD>=O||this._stableFeatureLOD)return;const e=Math.min(10,Math.max(t/i.estimate,1.001));this._featureLOD*=e;const s=this._lod,r=this._index.checkFeatureTarget(t,s);r!==s&&(this._featureLOD=r/this._baseLOD,this._stableFeatureLOD=!0)}else{if(!(i.estimate>t*R||e&&i.estimate>t))return;if(this._featureLOD<=q)return;this._featureLOD/=1+.25*(i.estimate/t-1),this._stableFeatureLOD=!1}this._featureLOD=Math.min(O,Math.max(q,this._featureLOD)),this._viewportQueries.updateScreenSpaceErrorBias(this._lod),this._index.requestUpdate()}_processCache(e){const t=this._index;if(null==t)return!1;for(;this._newLoadingNodes.length>0&&!e.done;){const i=this._newLoadingNodes.pop();for(let s=t.getParent(i);null!=s&&!this.layerView.isNodeLoaded(s.index);s=t.getParent(s.index))if(this._enableFromGPUCache(s,0)){e.madeProgress();break}}return e.hasProgressed}_processNodes(e,t){if(null==this._index)return!1;let i=(this._isIdle?F:P)-this._loadingNodes.size;const s=this._index.updates;for(s.cancel.forEach(this._cancelNode,this),s.cancel=[];s.remove.length>0&&!e.done;)this.layerView.removeNode(s.remove.pop()),e.madeProgress();for(;s.update.length>0&&!e.done;){const t=this._index.getNode(s.update.pop());null!=t&&(this._updateLoadedNode(t),e.madeProgress())}for(;s.add.length>0&&!e.done&&i>0;){--i;const r=this._index.getNode(s.add.back());if(null==r||2!==r.cacheState&&!this._hasNodeLoadToken(t))break;s.add.pop(),this._loadNode(r),e.madeProgress()}return e.hasProgressed}_cancelAllNodes(){this._loadingNodes.forEach(e=>e.abort()),this._loadingNodes.clear(),this._updatingNodes.forEach(e=>e.abort()),this._updatingNodes.clear()}_cancelNode(e){const t=this._loadingNodes.get(e);t&&(t.abort(),this._loadingNodes.delete(e))}_hasNodeLoadToken(e){return!(!this._isIdle&&e.numNodesLoading+this._loadingNodes.size>=P)&&(this._downloadingCount<V&&!this.dataStreamController.busy)}_evaluateRunning(){let e=!1,t=0;if(this.layerView){if(this.layerView.contentVisible){const i=(this._index?.indexMissing??0)+3*(this._index?.updates.add.length??0)+2*this._loadingNodes.size;e=!!(i>0||this._updatingNodes.size>0||this._restartNodeLoading||this._cameraDirty||this._idleQueue.updating||this._lodHandling&&this._lodHandling.requiresLODGlobalHandling||null!=this._index&&this._index.isPrefetching),0===i&&(this._progressMaxNumNodes=1),this._progressMaxNumNodes=Math.max(i,this._progressMaxNumNodes),t=1-i/this._progressMaxNumNodes}else e=this._cameraDirty,t=e?0:1;this.running=e,this.updatingProgress=t}}_updateViewData(){if(!this._cameraDirty||null==this._index||null==this._viewportQueries)return;const e=this.layerView.view,{contentCamera:t,fixedContentCamera:i}=e.state;this._viewportQueries.updateCamera(t,!i||this.isGraphics3D),this._viewportQueries.setPointOfInterest(e.pointsOfInterest.focus.renderLocation),this._viewportQueries.updateScreenSpaceErrorBias(this._lod),this._index.invalidateVisibilityCache(),this._index.progressiveLoadPenalty=T.distancePenalty*this._viewportQueries.distCameraToPOI(),this._index.requestUpdate(),this._stableFeatureLOD=!1,this._invisibleDirty=!0,this._cameraDirty=!1,this.notifyChange("rootNodeVisible")}_getProgressiveLoadFactor(){return this.layerView.view.quality<1?1:this.layerView.progressiveLoadFactor}get _lod(){return this._featureLOD*this._baseLOD}get _baseLOD(){const e=this.layerView.lodFactor;return this.fixedFeatureTarget?1:(e>0?e:1)*this.layerView.view.quality}get _lodDropFactor(){if(this.fixedFeatureTarget)return 1;return(Math.min(this.layerView.view.quality,.5)-I)/(.5-I)}isGeometryVisible(e){return!!this._index?.isGeometryVisible(e.index)}updateVisibility(e){this._index?.invalidateNodeVisibilityCache(e)}invalidateGeometryVisibility(e){this._index?.invalidateGeometryVisibility(e)}invalidateVisibilityObbs(){this._index?.invalidateVisibilityObbs()}modificationsChanged(){this._index?.imModificationsChanged(!!this.layerView.hasModifications),this._invisibleDirty=!0}_shouldLoadNode(e){return!(!this._lodHandling.shouldLoadNode(e)||this._shouldDropNode(e))&&!(null==this._index||!this._index.isGeometryVisible(e.index))}_shouldDropNode(e){if(null==this._viewportQueries)return!1;const t=this._lodDropFactor;if(t>=1||!this._lodHandling.hasNoVisibleChildren(e))return!1;return Math.abs(this._viewportQueries.calcCameraDistanceToCenter(e))-this._viewportQueries.minDistance>(this._viewportQueries.maxDistance-this._viewportQueries.minDistance)*t}_startNodeLoading(){this._restartNodeLoading=!1;const e=this._index;if(this._updatesDisabled||null==e||null==this._viewportQueries)return;this._updateViewData(),this._requiredAttributesDirty&&(this._requiredAttributes=this._getRequiredAttributes(),this._requiredAttributesDirty=!1);const t={textureEncodings:this.layerView.supportedTextureEncodings,textureUsageMask:this.layerView.rendererTextureUsage,loadFeatureData:this.useMaximumNumberOfFeatures};this._nodeLoader=new b(this.layer,this.dataStreamController,i.getLogger(this),this._defaultGeometrySchema,this._requiredAttributes,t),e.requestUpdate(),this._lodHandling.startNodeLoading((e,t)=>this._removeNodes(e,t,1),e,{maxLodLevel:this._viewportQueries.maxLodLevel}),this._evaluateRunning()}isNodeLoading(){return null!=this._nodeLoader&&null!=this._index}cancelNodeLoading(){this.isNodeLoading()&&(this.indexStreamController.cancelAll(),this.dataStreamController.cancelAll(),this._idleQueue.cancelAll(),this._cancelAllNodes(),this._nodeLoader=null,this._evaluateRunning())}_removeInvisibleNodes(e){const t=this._index;if(null==t||null==this._viewportQueries)return!1;H.clear(),this.layerView.getLoadedNodeIndices(H);const i=0===this._viewportQueries.maxDistance,s=i?()=>!1:e=>this._shouldDropNode(e);return H.filterInPlace(e=>{const i=t.getNode(e);return null==i||!t.isGeometryVisible(e)||s(i)}),H.length>0&&this._lodHandling.setLodGlobalDirty(),this._removeNodes(H,e,0),!(i&&this._lodDropFactor<1)&&(0===H.length||(H.clear(),!1))}markNodeToRemove(e){H.push(e)}removeMarkedNodes(){this._removeNodes(H,M,0)}_removeNodes(e,t,i){if(0!==e.length&&!t.done)for(null!=this._index&&this._index.requestUpdate();e.length>0&&!t.done;){const s=e.pop(),r=this._index;1===i&&this.layerView.nodeFadeoutEnabled&&null!=r&&r.isGeometryVisible(s)?this.layerView.fadeNode(s,1,!0):this.layerView.removeNode(s),t.madeProgress()}}_needsUpdate(e){if(e.resources.isEmpty||this._updatingNodes.has(e.index))return!1;const t=this.layerView.getLoadedAttributes(e.index);return null!=t&&t!==this._requiredAttributes}async _updateLoadedNode(e){const t=new AbortController;this._updatingNodes.set(e.index,t),this._evaluateRunning();try{const i=this.layerView.getLoadedAttributes(e.index),s=j(i,this._requiredAttributes)?this.layerView.getAttributeData(e.index):await this._loadAttributes(e,this._requiredAttributes,t.signal);await this.schedule(()=>this.layerView.updateAttributes(e.index,{loadedAttributes:this._requiredAttributes,attributeData:s},t.signal),t.signal)}catch(i){if(!d(i))return this.layerView.updateAttributes(e.index,{loadedAttributes:this._requiredAttributes,attributeData:{}},t.signal)}this._updatingNodes.delete(e.index),this._evaluateRunning()}_loadNode(e){if(this._loadingNodes.has(e.index))return void i.getLogger(this).error("already loading node "+e.index);const t=new AbortController;this._loadingNodes.set(e.index,t),this._evaluateRunning(),this._loadAndAddNode(e,t.signal).then(i=>{i&&null!=this._index&&this._loadingNodes.get(e.index)===t&&(this._loadingNodes.delete(e.index),this._index.requestUpdate())}).catch(e=>{if(!d(e))throw e}).finally(()=>{this._loadingNodes.get(e.index)===t&&this._loadingNodes.delete(e.index),this._evaluateRunning()})}_loadAndAddNode(e,t){return 1===e.cacheState?this._loadUncached(e,t).then(()=>!1):this._loadCached(e,t).then(t=>!t&&(e.cacheState=1,!0)).catch(t=>!d(t)&&(e.cacheState=1,!0))}_enableFromGPUCache(e,t){if(this._disableMemCache||null==this._index)return!1;if(0===t&&!this._index.useNodeAsHole(e.index))return!0;const i=this._loadCachedGPUData(e);return!!i&&(this.layerView.addCachedGPUData(e,i,t),this._nodeAdded(),!0)}_loadCachedGPUData(e){const t=this.layerView.loadCachedGPUData(e.index);return null!=t?.attributeInfo&&j(t.attributeInfo.loadedAttributes,this._requiredAttributes)?t:(this.layerView.deleteCachedGPUData(t),null)}_nodeAdded(){null!=this._index&&this._index.requestUpdate(),this._lodHandling.setLodGlobalDirty(),this._evaluateRunning()}updateLoadStatus(e,t){const i=this._index;null!=i&&i.updateChildrenLoaded(e,t?1:-1)}async _loadCached(e,t){if(this._enableFromGPUCache(e,1))return!0;const i=this.layerView;if(this.disableIDBCache||!i.loadCachedNodeData||!i.addCachedNodeData)return!1;const s=(t,i)=>this._nodeLoader.loadTextures(e,t,i),r=(t,i)=>this._clientNodeLoader.loadTextures(e,t,i),a=e.index>=0?s:r,d=await this.schedule(()=>i.loadCachedNodeData(e,t,a),t);if(null==d)return!1;const o=this._requiredAttributes,n=await this.reschedule(()=>this._loadAttributes(e,o,t),t);return await this.reschedule(()=>i.addCachedNodeData(e,d,{loadedAttributes:o,attributeData:n},t),t),this._nodeAdded(),!0}_loadUncached(e,t){return this._downloadingCount++,this._loadNodeData(e,t).catch(e=>{throw this._downloadingCount--,e}).then(i=>(this._downloadingCount--,this.schedule(()=>this.layerView.addNode(e,i,t),t))).then(()=>{this._nodeAdded(),e.cacheState=2}).catch(t=>{if(!d(t))throw i.getLogger(this).error("#loadNodeData()",this.layer,`Failed to load node '${e.id}'`,t),e.failed=!0,null!=this._index&&this._index.requestUpdate(),t})}_updateIdleState(e){e!==this._isIdle&&(this._isIdle=e,this._evaluateRunning(),e&&this._index&&null!=this._index&&this._index.resetFailedNodes())}get test(){}notifyLODUpdate(){this._lodHandling.setLodGlobalDirty(),this._evaluateRunning(),null!=this._index&&this._index.requestUpdate()}geometryFilterChanged(e){const t=this._index;null!=t&&t.layerFilterChanged(e),this._setCameraDirty()}};e([h({readOnly:!0})],Q.prototype,"isMeshPyramid",null),e([h({readOnly:!0})],Q.prototype,"isGraphics3D",null),e([h({readOnly:!0})],Q.prototype,"useMaximumNumberOfFeatures",null),e([h({readOnly:!0})],Q.prototype,"indexStreamController",null),e([h({readOnly:!0})],Q.prototype,"dataStreamController",null),e([h({readOnly:!0})],Q.prototype,"crsVertex",null),e([h({readOnly:!0})],Q.prototype,"crsIndex",null),e([h()],Q.prototype,"featureTarget",void 0),e([h()],Q.prototype,"fixedFeatureTarget",void 0),e([h()],Q.prototype,"layerView",void 0),e([h()],Q.prototype,"layer",null),e([h()],Q.prototype,"_updatingHandles",void 0),e([h()],Q.prototype,"updating",null),e([h()],Q.prototype,"running",void 0),e([h()],Q.prototype,"updatingProgress",void 0),e([h({readOnly:!0})],Q.prototype,"leavesReached",void 0),e([h({constructOnly:!0})],Q.prototype,"worker",void 0),e([h({readOnly:!0,dependsOn:[]})],Q.prototype,"rootNodeVisible",null),Q=e([u("esri.layers.graphics.controllers.I3SOnDemandController")],Q);const H=new r({deallocator:null});function j(e,t){return null!=e&&e.length===t.length&&e.every(e=>k(t,e.name)>=0)}function k(e,t){const i=t.toLowerCase();for(let s=0;s<e.length;s++)if(e[s].name.toLowerCase()===i)return s;return-1}const T={distancePenalty:10},E=g();export{Q as default};
@@ -2,4 +2,4 @@
2
2
  All material copyright ESRI, All Rights Reserved, unless otherwise specified.
3
3
  See https://js.arcgis.com/4.34/esri/copyright.txt for details.
4
4
  */
5
- import e from"../../core/Error.js";import{getDeepValue as n,setDeepValue as i}from"../../core/object.js";import{union as t}from"../../core/SetUtils.js";import{parseWhereClause as r}from"../../core/sql.js";import{getDomainRange as o}from"./domainUtils.js";import{getFieldNameFromSimpleExpression as l}from"../../support/arcadeExpressionUtils.js";import{isStringOrNull as s,isString as a}from"../../support/guards.js";import{loadArcade as u}from"../../support/loadArcade.js";const f=/^([0-9_])/,d=/[^a-z0-9_\u0080-\uffff]+/gi;function c(e){if(null==e)return null;return e.trim().replaceAll(d,"_").replace(f,"F$1")||null}const p=["field","field2","field3","normalizationField","rotationInfo.field","proportionalSymbolInfo.field","proportionalSymbolInfo.normalizationField","colorInfo.field","colorInfo.normalizationField"],m=["field","normalizationField"];function y(e,n){if(null!=e&&null!=n)for(const i of Array.isArray(e)?e:[e])if(g(p,i,n),"visualVariables"in i&&i.visualVariables)for(const e of i.visualVariables)g(m,e,n)}function g(e,t,r){if(e)for(const o of e){const e=n(o,t),l=e&&"function"!=typeof e&&r.get(e);l&&i(o,l.name,t)}}function F(e,n){if(null!=e&&n?.fields?.length)if("startField"in e){const i=n.get(e.startField),t=n.get(e.endField);e.startField=i?.name??null,e.endField=t?.name??null}else{const i=n.get(e.startTimeField),t=n.get(e.endTimeField);e.startTimeField=i?.name??null,e.endTimeField=t?.name??null}}const I=new Set;function b(e,n){return e&&n?(I.clear(),w(I,e,n),Array.from(I).sort()):[]}function w(e,n,i){if(i)if(n?.fields?.length)if(i.includes("*"))for(const{name:t}of n.fields)e.add(t);else for(const t of i)x(e,n,t);else{if(i.includes("*"))return e.clear(),void e.add("*");for(const n of i)null!=n&&e.add(n)}}function x(e,n,i){if("string"==typeof i)if(n){const t=n.get(i);t&&e.add(t.name)}else e.add(i)}function T(e,n){return null==n||null==e?[]:n.includes("*")?(e.fields??[]).map(e=>e.name):n}function h(e,n,i=1){if(!n||!e)return[];if(n.includes("*"))return["*"];const t=b(e,n);return t.length/e.fields.length>=i?["*"]:t}async function v(e,n,i){if(!i)return;let t;const r=l(i);if(r)t=[r];else{const{arcadeUtils:e}=await u();t=e.extractFieldNames(i,n?.fields?.map(e=>e.name))}for(const o of t)x(e,n,o)}async function S(n,i,t){if(t&&"1=1"!==t){const o=await r(t,i);if(!o.isStandardized)throw new e("fieldUtils:collectFilterFields","Where clause is not standardized",{where:t});w(n,i,o.fieldNames)}}function E({displayField:e,fields:n}){return e||(n?.length?$(n,"name-or-title")||$(n,"unique-identifier")||$(n,"type-or-category")||A(n):null)}function A(e){for(const n of e){if(!n?.name)continue;const e=n.name.toLowerCase();if(e.includes("name")||e.includes("title"))return n.name}return null}function $(e,n){for(const i of e)if(i?.valueType&&i.valueType===n)return i.name;return null}async function _(e){if(!e)return[];const n=new Set;return await N(n,e),Array.from(n).sort()}async function N(e,n){if(!n)return;const i=n.elevationInfo?.featureExpressionInfo;return i?i.collectRequiredFields(e,n.fieldsIndex):void 0}function L(e,n,i){i.onStatisticExpression?v(e,n,i.onStatisticExpression.expression):e.add(i.onStatisticField)}async function M(e,n,i){if(!n||!i||!("fields"in i))return;const t=[],r=i.popupTemplate;t.push(D(e,n,r)),i.fields&&t.push(...i.fields.map(async i=>L(e,n.fieldsIndex,i))),await Promise.all(t)}async function j(e,n){const{fieldsIndex:i,trackInfo:t}=n;if(!n||!t||!i)return;const r=[t.latestObservations.renderer?.collectRequiredFields(e,i),t.previousObservations.renderer?.collectRequiredFields(e,i),t.trackLines.renderer?.collectRequiredFields(e,i)];t.popupTemplate&&r.push(D(e,n,t.popupTemplate));for(const o of[t.latestObservations.labelingInfo,t.previousObservations.labelingInfo,t.trackLines.labelingInfo])if(o)for(const n of o)r.push(Y(e,i,n));await Promise.all(r)}async function D(e,n,i){const t=[];i?.expressionInfos&&t.push(...i.expressionInfos.map(i=>v(e,n.fieldsIndex,i.expression)));const r=i?.content;if(Array.isArray(r))for(const o of r)"expression"===o.type&&o.expressionInfo&&t.push(v(e,n.fieldsIndex,o.expressionInfo.expression));await Promise.all(t)}async function O(e,n,i){n&&(n.timeInfo&&i?.timeExtent&&w(e,n.fieldsIndex,[n.timeInfo.startField,n.timeInfo.endField]),n.floorInfo&&w(e,n.fieldsIndex,[n.floorInfo.floorField]),null!=i?.where&&await S(e,n.fieldsIndex,i.where))}async function R(e,n,i){n&&i&&await Promise.all(i.map(i=>V(e,n,i)))}async function V(e,n,i){n&&i&&(i.valueExpression?await v(e,n.fieldsIndex,i.valueExpression):i.field&&x(e,n.fieldsIndex,i.field))}async function k(e){if(!e)return[];const n="timeInfo"in e&&e.timeInfo;return n?b(e.fieldsIndex,[e.trackIdField,n.startField,n.endField]):[]}function C(e){return e?b(e.fieldsIndex,G(e)):[]}function U(e){if(!e)return[];const n=e.geometryFieldsInfo;return n?b(e.fieldsIndex,[n.shapeAreaField,n.shapeLengthField]):[]}async function q(e,n,i){if(!n||!i)return;const t=n.fieldsIndex;await Promise.all(i.filters.map(n=>S(e,t,n.where)))}const X=new Set(["oid","global-id","guid"]),z=new Set(["oid","global-id"]),P=[/^fnode_$/i,/^tnode_$/i,/^lpoly_$/i,/^rpoly_$/i,/^poly_$/i,/^shape$/i,/^shape_$/i,/^subclass$/i,/^subclass_$/i,/^rings_ok$/i,/^rings_nok$/i,/objectid/i,/^perimeter_/i,/_perimeter$/i,/_i$/i];function B(e){const n=new Set;J(e).forEach(e=>n.add(e)),U(e).forEach(e=>n.add(e.toLowerCase()));const i=e&&"infoFor3D"in e?e.infoFor3D:void 0;return i&&(Object.values(i.assetMapFieldRoles).forEach(e=>n.add(e.toLowerCase())),Object.values(i.transformFieldRoles).forEach(e=>n.add(e.toLowerCase()))),Array.from(n)}function G(e){if(!e)return[];const n="editFieldsInfo"in e&&e.editFieldsInfo;if(!n)return[];const{creationDateField:i,creatorField:t,editDateField:r,editorField:o}=n;return[i,t,r,o].filter(Boolean)}function J(e){return G(e).map(e=>e.toLowerCase())}function W(e,n){return e.editable&&!X.has(e.type)&&!J(n).includes(e.name?.toLowerCase()??"")}function H(e,n){const i=e.name?.toLowerCase()??"";return!(null!=n?.objectIdField&&i===n.objectIdField.toLowerCase()||null!=n?.globalIdField&&i===n.globalIdField.toLowerCase()||B(n).includes(i)||z.has(e.type)||P.some(e=>e.test(i)))}async function K(e){if(!e)return[];const n=new Set;return await Q(n,e),Array.from(n).sort()}async function Q(e,n){const{labelingInfo:i,fieldsIndex:t}=n;i?.length&&await Promise.all(i.map(n=>Y(e,t,n)))}async function Y(e,n,i){if(!i)return;const t=i.getLabelExpression(),r=i.where;if("arcade"===t.type)await v(e,n,t.expression);else{const i=t.expression.match(/{[^}]*}/g);i&&i.forEach(i=>{x(e,n,i.slice(1,-1))})}await S(e,n,r)}function Z(e){const n=e.defaultValue;return void 0!==n&&oe(e,n)?n:e.nullable?null:void 0}function ee(e){const n="string"==typeof e?{type:e}:e;return ge(n)?255:"esriFieldTypeDate"===n.type||"date"===n.type?8:void 0}function ne(e){return"number"==typeof e&&!isNaN(e)&&isFinite(e)}function ie(e){return null===e||ne(e)}function te(e){return null===e||Number.isInteger(e)}function re(){return!0}function oe(e,n){let i;switch(e.type){case"date":case"integer":case"long":case"small-integer":case"big-integer":case"esriFieldTypeDate":case"esriFieldTypeInteger":case"esriFieldTypeLong":case"esriFieldTypeSmallInteger":case"esriFieldTypeBigInteger":i=e.nullable?te:Number.isInteger;break;case"double":case"single":case"esriFieldTypeSingle":case"esriFieldTypeDouble":i=e.nullable?ie:ne;break;case"string":case"esriFieldTypeString":i=e.nullable?s:a;break;default:i=re}return 1===arguments.length?i:i(n)}const le=["integer","small-integer","big-integer","long"],se=["single","double"],ae=[...le,...se],ue=["esriFieldTypeInteger","esriFieldTypeSmallInteger","esriFieldTypeLong","esriFieldTypeBigInteger"],fe=["esriFieldTypeSingle","esriFieldTypeDouble"],de=new Set([...le,...ue]),ce=new Set([...se,...fe]),pe=t(de,ce);function me(e){return null!=e&&de.has(e.type)}function ye(e){return null!=e&&pe.has(e.type)}function ge(e){return null!=e&&("string"===e.type||"esriFieldTypeString"===e.type)}function Fe(e){return null!=e&&("date"===e.type||"esriFieldTypeDate"===e.type)}function Ie(e){return null!=e&&("date-only"===e.type||"esriFieldTypeDateOnly"===e.type)}function be(e){return null!=e&&("timestamp-offset"===e.type||"esriFieldTypeTimestampOffset"===e.type)}function we(e){return null!=e&&("time-only"===e.type||"esriFieldTypeTimeOnly"===e.type)}function xe(e){return null!=e&&("oid"===e.type||"esriFieldTypeOID"===e.type)}function Te(e){return null!=e&&("global-id"===e.type||"esriFieldTypeGlobalID"===e.type)}function he(e,n){return null===Se(e,n)}function ve(e){return null==e||"number"==typeof e&&isNaN(e)?null:e}function Se(e,n){return null==e||e.nullable&&null===n?null:oe(e,n)?ye(e)&&!Ee(e.type,Number(n))?"numeric-range-validation-error::out-of-range":null:"type-validation-error::invalid-type"}function Ee(e,n){const i="string"==typeof e?$e(e):e;if(!i)return!1;const t=i.min,r=i.max;return i.isInteger?Number.isInteger(n)&&n>=t&&n<=r:n>=t&&n<=r}function Ae(e,n){const i=o(e,n);return i||(ye(e)?$e(e.type):void 0)}function $e(e){switch(e){case"esriFieldTypeSmallInteger":case"small-integer":return Ne;case"esriFieldTypeInteger":case"esriFieldTypeLong":case"integer":case"long":return Le;case"esriFieldTypeBigInteger":case"big-integer":return Me;case"esriFieldTypeSingle":case"single":return je;case"esriFieldTypeDouble":case"double":return De}}function _e(e){if(!ne(e))return null;if(Number.isInteger(e)){if(e>=Ne.min&&e<=Ne.max)return"esriFieldTypeSmallInteger";if(e>=Le.min&&e<=Le.max)return"esriFieldTypeInteger";if(e>=Me.min&&e<=Me.max)return"esriFieldTypeBigInteger"}return e>=je.min&&e<=je.max?"esriFieldTypeSingle":"esriFieldTypeDouble"}const Ne={min:-32768,max:32767,isInteger:!0,rawMin:-32768,rawMax:32767},Le={min:-2147483648,max:2147483647,isInteger:!0,rawMin:-2147483648,rawMax:2147483647},Me={min:-Number.MAX_SAFE_INTEGER,max:Number.MAX_SAFE_INTEGER,isInteger:!0,rawMin:-Number.MAX_SAFE_INTEGER,rawMax:Number.MAX_SAFE_INTEGER},je={min:-34e37,max:12e37,isInteger:!1,rawMin:-34e37,rawMax:12e37},De={min:-Number.MAX_VALUE,max:Number.MAX_VALUE,isInteger:!1,rawMin:-Number.MAX_VALUE,rawMax:Number.MAX_VALUE};function Oe(e,n,i){switch(e){case"domain-validation-error::invalid-coded-value":return`Value ${i} is not in the coded domain - field: ${n.name}, domain: ${JSON.stringify(n.domain)}`;case"domain-validation-error::value-out-of-range":return`Value ${i} is out of the range of valid values - field: ${n.name}, domain: ${JSON.stringify(n.domain)}`;case"type-validation-error::invalid-type":return`Value ${i} is not a valid value for the field type - field: ${n.name}, type: ${n.type}, nullable: ${n.nullable}`;case"numeric-range-validation-error::out-of-range":{const{min:e,max:t}=$e(n.type);return`Value ${i} is out of range for the number type - field: ${n.name}, type: ${n.type}, value range is ${e} to ${t}`}}}function Re(e,n){return!Ve(e,n,null)}function Ve(e,n,i){if(!e?.attributes||!n){if(null!=i)for(const e of n??[])i.add(e);return!0}const t=new Set(Object.keys(e.attributes));let r=!1;for(const o of n)if(!t.has(o)){if(r=!0,null==i)break;i.add(o)}return r}async function ke(e,n){const i=new Set;for(const t of n)await v(i,e.fieldsIndex,t);return Array.from(i).sort()}function Ce(e){return!!e&&["raster.itempixelvalue","raster.servicepixelvalue"].some(n=>e.toLowerCase().startsWith(n))}async function Ue(e,n){const i=new Set;return e?.collectRequiredFields&&await e.collectRequiredFields(i,n),Array.from(i).sort()}function qe(e){const n=e?.match(/{[^}]+}/g);return n?n.map(e=>e.slice(1,-1).split(":")[0].trim()):[]}export{Me as bigIntegerRange,v as collectArcadeFieldNames,q as collectDisplayFilterFields,N as collectElevationFields,M as collectFeatureReductionFields,x as collectField,w as collectFields,O as collectFilterFields,Q as collectLabelingFields,R as collectOrderByInfos,D as collectPopupTemplateFields,S as collectSQLFieldNames,j as collectTrackInfoFields,De as doubleRange,qe as extractSubstitutionTemplatesFromString,Re as featureHasFields,b as fixFields,y as fixRendererFields,F as fixTimeInfoFields,fe as floatJSONTypes,se as floatTypes,E as getDisplayFieldName,G as getEditTrackingFields,_ as getElevationFields,ke as getExpressionFields,C as getFeatureEditFields,U as getFeatureGeometryFields,ee as getFieldDefaultLength,Z as getFieldDefaultValue,Ae as getFieldRange,K as getLabelingFields,B as getLowerCaseDefaultHiddenFields,J as getLowerCaseEditTrackingFields,_e as getNumericTypeForValue,Ue as getRendererFields,k as getTimeFields,ue as integerJSONTypes,Le as integerRange,le as integerTypes,Fe as isDateField,Ie as isDateOnlyField,W as isFieldEditable,H as isFieldVisibleByDefault,Te as isGlobalIDField,me as isIntegerField,Ee as isNumberInRange,ye as isNumericField,xe as isObjectIDField,Ce as isRasterPixelValueField,ge as isStringField,we as isTimeOnlyField,be as isTimestampOffsetField,he as isValidFieldValue,oe as isValueMatchingFieldType,c as normalizeFieldName,ae as numericTypes,h as packFields,Ve as populateMissingFields,p as rendererFields,ve as sanitizeNullFieldValue,je as singleRange,Ne as smallIntegerRange,T as unpackFieldNames,Se as validateFieldValue,Oe as validationErrorToString,m as visualVariableFields};
5
+ import e from"../../core/Error.js";import{getDeepValue as n,setDeepValue as i}from"../../core/object.js";import{union as t}from"../../core/SetUtils.js";import{parseWhereClause as r}from"../../core/sql.js";import{getDomainRange as l}from"./domainUtils.js";import{getFieldNameFromSimpleExpression as o}from"../../support/arcadeExpressionUtils.js";import{isStringOrNull as s,isString as a}from"../../support/guards.js";import{loadArcade as u}from"../../support/loadArcade.js";const f=/^([0-9_])/,d=/[^a-z0-9_\u0080-\uffff]+/gi;function c(e){if(null==e)return null;return e.trim().replaceAll(d,"_").replace(f,"F$1")||null}const p=["field","field2","field3","normalizationField","rotationInfo.field","proportionalSymbolInfo.field","proportionalSymbolInfo.normalizationField","colorInfo.field","colorInfo.normalizationField"],m=["field","normalizationField"];function y(e,n){if(null!=e&&null!=n)for(const i of Array.isArray(e)?e:[e])if(g(p,i,n),"visualVariables"in i&&i.visualVariables)for(const e of i.visualVariables)g(m,e,n)}function g(e,t,r){if(e)for(const l of e){const e=n(l,t),o=e&&"function"!=typeof e&&r.get(e);o&&i(l,o.name,t)}}function F(e,n){if(null!=e&&n?.fields?.length)if("startField"in e){const i=n.get(e.startField),t=n.get(e.endField);e.startField=i?.name??null,e.endField=t?.name??null}else{const i=n.get(e.startTimeField),t=n.get(e.endTimeField);e.startTimeField=i?.name??null,e.endTimeField=t?.name??null}}const I=new Set;function b(e,n){return e&&n?(I.clear(),w(I,e,n),Array.from(I).sort()):[]}function w(e,n,i){if(i)if(n?.fields?.length)if(i.includes("*"))for(const{name:t}of n.fields)e.add(t);else for(const t of i)x(e,n,t);else{if(i.includes("*"))return e.clear(),void e.add("*");for(const n of i)null!=n&&e.add(n)}}function x(e,n,i){if("string"==typeof i)if(n){const t=n.get(i);t&&e.add(t.name)}else e.add(i)}function T(e,n){return null==n||null==e?[]:n.includes("*")?(e.fields??[]).map(e=>e.name):n}function h(e,n,i=1){if(!n||!e)return[];if(n.includes("*"))return["*"];const t=b(e,n);return t.length/e.fields.length>=i?["*"]:t}async function v(e,n,i,t){if(!t)return;const r=o(t);if(r)x(e,n,r);else{const{arcadeUtils:r}=await u(),l=r.extractFieldNames(t,i?.partitions??n?.fields?.map(e=>e.name));for(const t of l)x(e,i?.index??n,t)}}async function S(n,i,t){if(t&&"1=1"!==t){const l=await r(t,i);if(!l.isStandardized)throw new e("fieldUtils:collectFilterFields","Where clause is not standardized",{where:t});w(n,i,l.fieldNames)}}function E({displayField:e,fields:n}){return e||(n?.length?$(n,"name-or-title")||$(n,"unique-identifier")||$(n,"type-or-category")||A(n):null)}function A(e){for(const n of e){if(!n?.name)continue;const e=n.name.toLowerCase();if(e.includes("name")||e.includes("title"))return n.name}return null}function $(e,n){for(const i of e)if(i?.valueType&&i.valueType===n)return i.name;return null}async function _(e){if(!e)return[];const n=new Set;return await N(n,e),Array.from(n).sort()}async function N(e,n){if(!n)return;const i=n.elevationInfo?.featureExpressionInfo;return i?i.collectRequiredFields(e,n.fieldsIndex):void 0}function L(e,n,i){i.onStatisticExpression?v(e,n,null,i.onStatisticExpression.expression):e.add(i.onStatisticField)}async function M(e,n,i){if(!n||!i||!("fields"in i))return;const t=[],r=i.popupTemplate;t.push(D(e,n,r)),i.fields&&t.push(...i.fields.map(async i=>L(e,n.fieldsIndex,i))),await Promise.all(t)}async function j(e,n){const{fieldsIndex:i,trackInfo:t}=n;if(!n||!t||!i)return;const r=[t.latestObservations.renderer?.collectRequiredFields(e,i),t.previousObservations.renderer?.collectRequiredFields(e,i),t.trackLines.renderer?.collectRequiredFields(e,i)];t.popupTemplate&&r.push(D(e,n,t.popupTemplate));for(const l of[t.latestObservations.labelingInfo,t.previousObservations.labelingInfo,t.trackLines.labelingInfo])if(l)for(const n of l)r.push(Y(e,i,n));await Promise.all(r)}async function D(e,n,i){const t=[];i?.expressionInfos&&t.push(...i.expressionInfos.map(i=>v(e,n.fieldsIndex,null,i.expression)));const r=i?.content;if(Array.isArray(r))for(const l of r)"expression"===l.type&&l.expressionInfo&&t.push(v(e,n.fieldsIndex,null,l.expressionInfo.expression));await Promise.all(t)}async function O(e,n,i){n&&(n.timeInfo&&i?.timeExtent&&w(e,n.fieldsIndex,[n.timeInfo.startField,n.timeInfo.endField]),n.floorInfo&&w(e,n.fieldsIndex,[n.floorInfo.floorField]),null!=i?.where&&await S(e,n.fieldsIndex,i.where))}async function R(e,n,i){n&&i&&await Promise.all(i.map(i=>V(e,n,i)))}async function V(e,n,i){n&&i&&(i.valueExpression?await v(e,n.fieldsIndex,null,i.valueExpression):i.field&&x(e,n.fieldsIndex,i.field))}async function k(e){if(!e)return[];const n="timeInfo"in e&&e.timeInfo;return n?b(e.fieldsIndex,[e.trackIdField,n.startField,n.endField]):[]}function C(e){return e?b(e.fieldsIndex,G(e)):[]}function U(e){if(!e)return[];const n=e.geometryFieldsInfo;return n?b(e.fieldsIndex,[n.shapeAreaField,n.shapeLengthField]):[]}async function q(e,n,i){if(!n||!i)return;const t=n.fieldsIndex;await Promise.all(i.filters.map(n=>S(e,t,n.where)))}const X=new Set(["oid","global-id","guid"]),z=new Set(["oid","global-id"]),P=[/^fnode_$/i,/^tnode_$/i,/^lpoly_$/i,/^rpoly_$/i,/^poly_$/i,/^shape$/i,/^shape_$/i,/^subclass$/i,/^subclass_$/i,/^rings_ok$/i,/^rings_nok$/i,/objectid/i,/^perimeter_/i,/_perimeter$/i,/_i$/i];function B(e){const n=new Set;J(e).forEach(e=>n.add(e)),U(e).forEach(e=>n.add(e.toLowerCase()));const i=e&&"infoFor3D"in e?e.infoFor3D:void 0;return i&&(Object.values(i.assetMapFieldRoles).forEach(e=>n.add(e.toLowerCase())),Object.values(i.transformFieldRoles).forEach(e=>n.add(e.toLowerCase()))),Array.from(n)}function G(e){if(!e)return[];const n="editFieldsInfo"in e&&e.editFieldsInfo;if(!n)return[];const{creationDateField:i,creatorField:t,editDateField:r,editorField:l}=n;return[i,t,r,l].filter(Boolean)}function J(e){return G(e).map(e=>e.toLowerCase())}function W(e,n){return e.editable&&!X.has(e.type)&&!J(n).includes(e.name?.toLowerCase()??"")}function H(e,n){const i=e.name?.toLowerCase()??"";return!(null!=n?.objectIdField&&i===n.objectIdField.toLowerCase()||null!=n?.globalIdField&&i===n.globalIdField.toLowerCase()||B(n).includes(i)||z.has(e.type)||P.some(e=>e.test(i)))}async function K(e){if(!e)return[];const n=new Set;return await Q(n,e),Array.from(n).sort()}async function Q(e,n){const{labelingInfo:i,fieldsIndex:t}=n;i?.length&&await Promise.all(i.map(n=>Y(e,t,n)))}async function Y(e,n,i){if(!i)return;const t=i.getLabelExpression(),r=i.where;if("arcade"===t.type)await v(e,n,null,t.expression);else{const i=t.expression.match(/{[^}]*}/g);i&&i.forEach(i=>{x(e,n,i.slice(1,-1))})}await S(e,n,r)}function Z(e){const n=e.defaultValue;return void 0!==n&&le(e,n)?n:e.nullable?null:void 0}function ee(e){const n="string"==typeof e?{type:e}:e;return ge(n)?255:"esriFieldTypeDate"===n.type||"date"===n.type?8:void 0}function ne(e){return"number"==typeof e&&!isNaN(e)&&isFinite(e)}function ie(e){return null===e||ne(e)}function te(e){return null===e||Number.isInteger(e)}function re(){return!0}function le(e,n){let i;switch(e.type){case"date":case"integer":case"long":case"small-integer":case"big-integer":case"esriFieldTypeDate":case"esriFieldTypeInteger":case"esriFieldTypeLong":case"esriFieldTypeSmallInteger":case"esriFieldTypeBigInteger":i=e.nullable?te:Number.isInteger;break;case"double":case"single":case"esriFieldTypeSingle":case"esriFieldTypeDouble":i=e.nullable?ie:ne;break;case"string":case"esriFieldTypeString":i=e.nullable?s:a;break;default:i=re}return 1===arguments.length?i:i(n)}const oe=["integer","small-integer","big-integer","long"],se=["single","double"],ae=[...oe,...se],ue=["esriFieldTypeInteger","esriFieldTypeSmallInteger","esriFieldTypeLong","esriFieldTypeBigInteger"],fe=["esriFieldTypeSingle","esriFieldTypeDouble"],de=new Set([...oe,...ue]),ce=new Set([...se,...fe]),pe=t(de,ce);function me(e){return null!=e&&de.has(e.type)}function ye(e){return null!=e&&pe.has(e.type)}function ge(e){return null!=e&&("string"===e.type||"esriFieldTypeString"===e.type)}function Fe(e){return null!=e&&("date"===e.type||"esriFieldTypeDate"===e.type)}function Ie(e){return null!=e&&("date-only"===e.type||"esriFieldTypeDateOnly"===e.type)}function be(e){return null!=e&&("timestamp-offset"===e.type||"esriFieldTypeTimestampOffset"===e.type)}function we(e){return null!=e&&("time-only"===e.type||"esriFieldTypeTimeOnly"===e.type)}function xe(e){return null!=e&&("oid"===e.type||"esriFieldTypeOID"===e.type)}function Te(e){return null!=e&&("global-id"===e.type||"esriFieldTypeGlobalID"===e.type)}function he(e,n){return null===Se(e,n)}function ve(e){return null==e||"number"==typeof e&&isNaN(e)?null:e}function Se(e,n){return null==e||e.nullable&&null===n?null:le(e,n)?ye(e)&&!Ee(e.type,Number(n))?"numeric-range-validation-error::out-of-range":null:"type-validation-error::invalid-type"}function Ee(e,n){const i="string"==typeof e?$e(e):e;if(!i)return!1;const t=i.min,r=i.max;return i.isInteger?Number.isInteger(n)&&n>=t&&n<=r:n>=t&&n<=r}function Ae(e,n){const i=l(e,n);return i||(ye(e)?$e(e.type):void 0)}function $e(e){switch(e){case"esriFieldTypeSmallInteger":case"small-integer":return Ne;case"esriFieldTypeInteger":case"esriFieldTypeLong":case"integer":case"long":return Le;case"esriFieldTypeBigInteger":case"big-integer":return Me;case"esriFieldTypeSingle":case"single":return je;case"esriFieldTypeDouble":case"double":return De}}function _e(e){if(!ne(e))return null;if(Number.isInteger(e)){if(e>=Ne.min&&e<=Ne.max)return"esriFieldTypeSmallInteger";if(e>=Le.min&&e<=Le.max)return"esriFieldTypeInteger";if(e>=Me.min&&e<=Me.max)return"esriFieldTypeBigInteger"}return e>=je.min&&e<=je.max?"esriFieldTypeSingle":"esriFieldTypeDouble"}const Ne={min:-32768,max:32767,isInteger:!0,rawMin:-32768,rawMax:32767},Le={min:-2147483648,max:2147483647,isInteger:!0,rawMin:-2147483648,rawMax:2147483647},Me={min:-Number.MAX_SAFE_INTEGER,max:Number.MAX_SAFE_INTEGER,isInteger:!0,rawMin:-Number.MAX_SAFE_INTEGER,rawMax:Number.MAX_SAFE_INTEGER},je={min:-34e37,max:12e37,isInteger:!1,rawMin:-34e37,rawMax:12e37},De={min:-Number.MAX_VALUE,max:Number.MAX_VALUE,isInteger:!1,rawMin:-Number.MAX_VALUE,rawMax:Number.MAX_VALUE};function Oe(e,n,i){switch(e){case"domain-validation-error::invalid-coded-value":return`Value ${i} is not in the coded domain - field: ${n.name}, domain: ${JSON.stringify(n.domain)}`;case"domain-validation-error::value-out-of-range":return`Value ${i} is out of the range of valid values - field: ${n.name}, domain: ${JSON.stringify(n.domain)}`;case"type-validation-error::invalid-type":return`Value ${i} is not a valid value for the field type - field: ${n.name}, type: ${n.type}, nullable: ${n.nullable}`;case"numeric-range-validation-error::out-of-range":{const{min:e,max:t}=$e(n.type);return`Value ${i} is out of range for the number type - field: ${n.name}, type: ${n.type}, value range is ${e} to ${t}`}}}function Re(e,n){return!Ve(e,n,null)}function Ve(e,n,i){if(!e?.attributes||!n){if(null!=i)for(const e of n??[])i.add(e);return!0}const t=new Set(Object.keys(e.attributes));let r=!1;for(const l of n)if(!t.has(l)){if(r=!0,null==i)break;i.add(l)}return r}async function ke(e,n){const i=new Set;for(const t of n)await v(i,e.fieldsIndex,null,t);return Array.from(i).sort()}function Ce(e){return!!e&&["raster.itempixelvalue","raster.servicepixelvalue"].some(n=>e.toLowerCase().startsWith(n))}async function Ue(e,n){const i=new Set;return e?.collectRequiredFields&&await e.collectRequiredFields(i,n),Array.from(i).sort()}function qe(e){const n=e?.match(/{[^}]+}/g);return n?n.map(e=>e.slice(1,-1).split(":")[0].trim()):[]}export{Me as bigIntegerRange,v as collectArcadeFieldNames,q as collectDisplayFilterFields,N as collectElevationFields,M as collectFeatureReductionFields,x as collectField,w as collectFields,O as collectFilterFields,Q as collectLabelingFields,R as collectOrderByInfos,D as collectPopupTemplateFields,S as collectSQLFieldNames,j as collectTrackInfoFields,De as doubleRange,qe as extractSubstitutionTemplatesFromString,Re as featureHasFields,b as fixFields,y as fixRendererFields,F as fixTimeInfoFields,fe as floatJSONTypes,se as floatTypes,E as getDisplayFieldName,G as getEditTrackingFields,_ as getElevationFields,ke as getExpressionFields,C as getFeatureEditFields,U as getFeatureGeometryFields,ee as getFieldDefaultLength,Z as getFieldDefaultValue,Ae as getFieldRange,K as getLabelingFields,B as getLowerCaseDefaultHiddenFields,J as getLowerCaseEditTrackingFields,_e as getNumericTypeForValue,Ue as getRendererFields,k as getTimeFields,ue as integerJSONTypes,Le as integerRange,oe as integerTypes,Fe as isDateField,Ie as isDateOnlyField,W as isFieldEditable,H as isFieldVisibleByDefault,Te as isGlobalIDField,me as isIntegerField,Ee as isNumberInRange,ye as isNumericField,xe as isObjectIDField,Ce as isRasterPixelValueField,ge as isStringField,we as isTimeOnlyField,be as isTimestampOffsetField,he as isValidFieldValue,le as isValueMatchingFieldType,c as normalizeFieldName,ae as numericTypes,h as packFields,Ve as populateMissingFields,p as rendererFields,ve as sanitizeNullFieldValue,je as singleRange,Ne as smallIntegerRange,T as unpackFieldNames,Se as validateFieldValue,Oe as validationErrorToString,m as visualVariableFields};
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@arcgis/core",
3
- "version": "4.34.0-next.74",
3
+ "version": "4.34.0-next.75",
4
4
  "homepage": "https://js.arcgis.com",
5
5
  "description": "ArcGIS Maps SDK for JavaScript: A complete 2D and 3D mapping and data visualization API",
6
6
  "keywords": [
@@ -18,7 +18,7 @@
18
18
  ],
19
19
  "license": "SEE LICENSE IN copyright.txt",
20
20
  "dependencies": {
21
- "@arcgis/toolkit": "^4.34.0-next.119",
21
+ "@arcgis/toolkit": "^4.34.0-next.121",
22
22
  "@esri/arcgis-html-sanitizer": "~4.1.0",
23
23
  "@esri/calcite-components": "^3.3.0-next.95",
24
24
  "@vaadin/grid": "~24.8.6",
@@ -2,4 +2,4 @@
2
2
  All material copyright ESRI, All Rights Reserved, unless otherwise specified.
3
3
  See https://js.arcgis.com/4.34/esri/copyright.txt for details.
4
4
  */
5
- import{__decorate as e}from"tslib";import{getAssetUrl as t}from"../assets.js";import i from"../core/Error.js";import{JSONSupportMixin as r}from"../core/JSONSupport.js";import{clone as o,fixJson as s}from"../core/lang.js";import{Loadable as a}from"../core/Loadable.js";import{isDataProtocol as n,makeAbsolute as l}from"../core/urlUtils.js";import{property as p}from"../core/accessorSupport/decorators/property.js";import{ensureClass as c}from"../core/accessorSupport/ensureType.js";import{reader as d}from"../core/accessorSupport/decorators/reader.js";import{subclass as u}from"../core/accessorSupport/decorators/subclass.js";import m from"../geometry/Extent.js";import h from"./Portal.js";import g from"./PortalItemResource.js";import y from"./PortalRating.js";import{a as w}from"../chunks/persistableUrlUtils.js";var v;const f=new Set(["3DTiles Service","CSV","Feature Collection","Feature Service","Feed","GeoJson","Group Layer","Image Service","KML","Knowledge Graph Layer","Map Service","Media Layer","Scene Service","Stream Service","Video Service","Vector Tile Service","WCS","WFS","WMS","WMTS"]),b=new Set(["KML","GeoJson","CSV"]);let k=v=class extends(r(a)){static from(e){return c(v,e)}constructor(e){super(e),this.access=null,this.accessInformation=null,this.apiKey=null,this.applicationProxies=null,this.avgRating=null,this.categories=null,this.classification=null,this.created=null,this.culture=null,this.description=null,this.extent=null,this.groupCategories=null,this.id=null,this.isOrgItem=!1,this.itemControl=null,this.licenseInfo=null,this.modified=null,this.name=null,this.numComments=null,this.numRatings=null,this.numViews=null,this.owner=null,this.ownerFolder=null,this.portal=null,this.screenshots=null,this.size=null,this.snippet=null,this.sourceJSON=null,this.sourceUrl=null,this.spatialReference=null,this.tags=null,this.title=null,this.type=null,this.typeKeywords=null,this.url=null}destroy(){this.portal=null}get displayName(){const e=this.type,t=this.typeKeywords||[];let i=e;return"Feature Service"===e||"Feature Collection"===e?i=t.includes("Table")?"Table":t.includes("Route Layer")?"Route Layer":t.includes("Markup")?"Markup":"Feature Layer":"Image Service"===e?i=t.includes("Elevation 3D Layer")?"Elevation Layer":t.includes("Tiled Imagery")?"Tiled Imagery Layer":"Imagery Layer":"Scene Service"===e?i="Scene Layer":"Video Service"===e?i="Video Layer":"Scene Package"===e?i="Scene Layer Package":"Stream Service"===e?i="Feature Layer":"Geoprocessing Service"===e?i=t.includes("Web Tool")?"Tool":"Geoprocessing Service":"Geoenrichment Service"===e?i="GeoEnrichment Service":"Geocoding Service"===e?i="Locator":"Microsoft Powerpoint"===e?i="Microsoft PowerPoint":"GeoJson"===e?i="GeoJSON":"Globe Service"===e?i="Globe Layer":"Vector Tile Service"===e?i="Tile Layer":"netCDF"===e?i="NetCDF":"Map Service"===e?i=t.includes("Spatiotemporal")||!t.includes("Hosted Service")&&!t.includes("Tiled")||t.includes("Relational")?"Map Image Layer":"Tile Layer":e?.toLowerCase().includes("add in")?i=e.replaceAll(/(add in)/gi,"Add-In"):"datastore catalog service"===e?i="Big Data File Share":"Compact Tile Package"===e?i="Tile Package (tpkx)":"Raster function template"===e?i="Raster Function Template":"OGCFeatureServer"===e?i="OGC Feature Layer":"web mapping application"===e&&t.includes("configurableApp")?i="Instant App":"Insights Page"===e?i="Insights Report":"Excalibur Imagery Project"===e?i="Excalibur Project":"3DTiles Service"===e?i="3D tiles layer":"3DTiles Package"===e&&(i="3D tiles package"),i}readExtent(e){return e&&e.length?new m(e[0][0],e[0][1],e[1][0],e[1][1]):null}get iconUrl(){const e=this.type?.toLowerCase()||"",i=this.typeKeywords||[],r="esri/images/portal/",o="16";let s,a=!1,n=!1,l=!1,p=!1,c=!1,d=!1,u=!1,m=!1;return e.indexOf("service")>0||"feature collection"===e||"kml"===e||"wms"===e||"wmts"===e||"wfs"===e?(a=i.includes("Hosted Service"),"feature service"===e||"feature collection"===e||"kml"===e||"wfs"===e?(n=i.includes("Table"),l=i.includes("Route Layer"),p=i.includes("Markup"),c=i.includes("Spatiotemporal"),d=i.includes("UtilityNetwork"),s=c&&n?"spatiotemporaltable":n?"table":l?"routelayer":p?"markup":c?"spatiotemporal":d?"utilitynetwork":a?"featureshosted":"features"):"map service"===e||"wms"===e||"wmts"===e?(c=i.includes("Spatiotemporal"),u=i.includes("Relational"),s=c||u?"mapimages":a||i.includes("Tiled")||"wmts"===e?"maptiles":"mapimages"):s="scene service"===e?i.includes("Line")?"sceneweblayerline":i.includes("3DObject")?"sceneweblayermultipatch":i.includes("Point")?"sceneweblayerpoint":i.includes("IntegratedMesh")?"sceneweblayermesh":i.includes("PointCloud")?"sceneweblayerpointcloud":i.includes("Polygon")?"sceneweblayerpolygon":i.includes("Building")?"sceneweblayerbuilding":i.includes("Voxel")?"sceneweblayervoxel":"sceneweblayer":"image service"===e?i.includes("Elevation 3D Layer")?"elevationlayer":i.includes("Tiled Imagery")?"tiledimagerylayer":"imagery":"stream service"===e?"streamlayer":"vector tile service"===e?"vectortile":"datastore catalog service"===e?"datastorecollection":"geocoding service"===e?"geocodeservice":"video service"===e?i.includes("Live Stream")?"livestreamvideolayer":"videolayer":"geoprocessing service"===e?i.includes("Web Tool")?"tool":"layers":"geodata service"===e?"geodataservice":"3dtiles service"===e?i.includes("3DObject")?"3dobjecttileslayer":i.includes("IntegratedMesh")?"integratedmeshtileslayer":i.includes("GaussianSplat")?"gaussiansplatlayer":"3dtileslayer":"layers"):"web map"===e||"cityengine web scene"===e?s="maps":"web scene"===e?s=i.includes("ViewingMode-Local")?"webscenelocal":"websceneglobal":"web mapping application"===e&&i.includes("configurableApp")?s="instantapps":"web mapping application"===e||"mobile application"===e||"application"===e||"operation view"===e||"desktop application"===e?s="apps":"map document"===e||"map package"===e||"published map"===e||"scene document"===e||"globe document"===e||"basemap package"===e||"mobile basemap package"===e||"mobile map package"===e||"project package"===e||"project template"===e||"pro map"===e||"layout"===e||"layer"===e&&i.includes("ArcGIS Pro")||"explorer map"===e&&i.indexOf("Explorer Document")?s="mapsgray":"service definition"===e||"shapefile"===e||"cad drawing"===e||"geojson"===e||"netcdf"===e||"administrative report"===e?s="datafiles":"360 vr experience"===e?s="360vr":"explorer add in"===e||"desktop add in"===e||"windows viewer add in"===e||"windows viewer configuration"===e?s="appsgray":"arcgis pro add in"===e||"arcgis pro configuration"===e?s="addindesktop":"pdf"===e?s="pdf":"microsoft word"===e?s="word":"microsoft excel"===e?s="excel":"microsoft powerpoint"===e?s="ppt":"rule package"===e||"file geodatabase"===e||"sqlite geodatabase"===e||"csv collection"===e||"kml collection"===e||"windows mobile package"===e||"map template"===e||"desktop application template"===e||"gml"===e||"arcpad package"===e||"code sample"===e||"document link"===e||"earth configuration"===e||"operations dashboard add in"===e||"rules package"===e||"workflow manager package"===e||"explorer map"===e&&i.includes("Explorer Mapping Application")||i.includes("Document")?s="datafilesgray":"network analysis service"===e||"geoprocessing service"===e||"geodata service"===e||"geometry service"===e||"geoprocessing package"===e||"locator package"===e||"geoprocessing sample"===e||"workflow manager service"===e?s="toolsgray":"layer"===e||"layer package"===e||"explorer layer"===e?s="layersgray":"analysis model"===e?s="analysismodel":"scene package"===e?s="scenepackage":"3dtiles package"===e?s="3dtileslayerpackage":"3dtiles service"===e?s="3dtileslayer":"mobile scene package"===e?s="mobilescenepackage":"tile package"===e||"compact tile package"===e?s="tilepackage":"task file"===e?s="taskfile":"report template"===e?s="report-template":"statistical data collection"===e?s="statisticaldatacollection":"insights workbook"===e?s="workbook":"insights model"===e?s="insightsmodel":"insights page"===e?s="insightspage":"insights theme"===e?s="insightstheme":"hub initiative"===e?s="hubinitiative":"hub page"===e?s="hubpage":"hub site application"===e?s="hubsite":"hub event"===e?s="hubevent":"hub project"===e?s="hubproject":"relational database connection"===e?s="relationaldatabaseconnection":"big data file share"===e?s="datastorecollection":"image collection"===e?s="imagecollection":"desktop style"===e?s="desktopstyle":"style"===e?s=i.includes("Dictionary")?"dictionarystyle":"style":"dashboard"===e?s="dashboard":"raster function template"===e?s="rasterprocessingtemplate":"vector tile package"===e?s="vectortilepackage":"ortho mapping project"===e?s="orthomappingproject":"ortho mapping template"===e?s="orthomappingtemplate":"solution"===e?s="solutions":"geopackage"===e?s="geopackage":"deep learning package"===e?s="deeplearningpackage":"real time analytic"===e?s="realtimeanalytics":"reality mapping project"===e?s="realitymappingproject":"big data analytic"===e?s="bigdataanalytics":"feed"===e?s="feed":"excalibur imagery project"===e?s="excaliburimageryproject":"notebook"===e?s="notebook":"storymap"===e?s="storymap":"survey123 add in"===e?s="survey123addin":"mission"===e?s="mission":"mission report"===e?s="missionreport":"mission template"===e?s="missiontemplate":"quickcapture project"===e?s="quickcaptureproject":"pro report"===e?s="proreport":"pro report template"===e?s="proreporttemplate":"urban model"===e?s="urbanmodel":"urban project"===e?s="urbanproject":"web experience"===e?s="experiencebuilder":"web experience template"===e?s="webexperiencetemplate":"experience builder widget"===e?s="experiencebuilderwidget":"experience builder widget package"===e?s="experiencebuilderwidgetpackage":"workflow"===e?s="workflow":"kernel gateway connection"===e?s="kernelgatewayconnection":"insights script"===e?s="insightsscript":"hub initiative template"===e?s="hubinitiativetemplate":"storymap theme"===e?s="storymaptheme":"knowledge graph"===e?s="knowledgegraph":"knowledge graph layer"===e?s="knowledgegraphlayer":"knowledge studio project"===e?s="knowledgestudio":"native application"===e?s="nativeapp":"native application installer"===e?s="nativeappinstaller":"web link chart"===e?s="linkchart":"knowledge graph web investigation"===e?s="investigation":"ogcfeatureserver"===e?s="features":"pro presentation"===e?s="propresentation":"pro project"===e?s="proproject":"insights workbook package"===e?s="insightsworkbookpackage":"apache parquet"===e?s="apacheparquet":"notebook code snippet library"===e?s="notebookcodesnippets":"suitability model"===e?s="suitabilitymodel":"esri classifier definition"===e?s="classifierdefinition":"esri classification schema"===e?s="classificationschema":"insights data engineering workbook"===e?s="dataengineeringworkbook":"insights data engineering model"===e?s="dataengineeringmodel":"deep learning studio project"===e?s="deeplearningproject":"discussion"===e?s="discussion":"allsource project"===e?s="allsourceproject":"api key"===e?s="apikey":"data pipeline"===e?s="datapipelines":"group layer"===e?(m=i.includes("Map"),s=m?"layergroup2d":"layergroup"):s="media layer"===e?"onlinemedialayer":"form"===e?i.includes("Survey123")?"survey":"datafilesgray":"csv"===e?"csv":"image"===e?"image":"maps",s?t(r+s+o+".png"):null}get isLayer(){return null!=this.type&&f.has(this.type)}get itemCdnUrl(){return w(this.itemUrl)}get itemPageUrl(){const e=this.portal?.itemPageUrl;return e&&this.id?`${e}?id=${this.id}`:null}get itemUrl(){const e=this.portal?.restUrl;return e&&this.id?`${e}/content/items/${this.id}`:null}get loaded(){return super.loaded}get thumbnailUrl(){const e=this.itemUrl,t=this.thumbnail;return e&&t?this.portal?.normalizeUrl(`${e}/info/${t}?f=json`)??null:null}get userItemUrl(){const e=this.portal?.restUrl;if(!e)return null;const t=this.owner||this.portal?.user?.id;if(!t)return null;return`${e}/content/users/${this.ownerFolder?`${t}/${this.ownerFolder}`:t}/items/${this.id}`}load(e){const t=this.portal??(this.portal=h.getDefault()),i=t.load(e).then(()=>this.sourceJSON?this.sourceJSON:this.id&&this.itemUrl?t.request(this.itemUrl,{signal:null!=e?e.signal:null,query:{token:this.apiKey}}):{}).then(e=>{this.sourceJSON=e,this.read(e)});return this.addResolvingPromise(i),Promise.resolve(this)}async addRating(e){const t={method:"post",query:{}},i=e instanceof y?e.rating:e;return null==i||isNaN(i)||"number"!=typeof e||(t.query.rating=i),this.portal?(await this.portal.request(this.itemUrl+"/addRating",t),new y({rating:i,created:new Date})):null}clone(){const e={access:this.access,accessInformation:this.accessInformation,applicationProxies:o(this.applicationProxies),avgRating:this.avgRating,categories:o(this.categories),classification:o(this.classification),created:o(this.created),culture:this.culture,description:this.description,extent:o(this.extent),groupCategories:o(this.groupCategories),id:this.id,itemControl:this.itemControl,licenseInfo:this.licenseInfo,modified:o(this.modified),name:this.name,numComments:this.numComments,numRatings:this.numRatings,numViews:this.numViews,owner:this.owner,ownerFolder:this.ownerFolder,portal:this.portal,screenshots:o(this.screenshots),size:this.size,snippet:this.snippet,sourceUrl:this.sourceUrl,spatialReference:this.spatialReference,tags:o(this.tags),thumbnail:this.thumbnail,title:this.title,type:this.type,typeKeywords:o(this.typeKeywords),url:this.url};this.loaded&&(e.loadStatus="loaded");const t=new v({sourceJSON:this.sourceJSON}).set(e);return t._set("isOrgItem",this.isOrgItem),t}createPostQuery(){const e=this.toJSON();for(const t of["tags","typeKeywords","categories"])e[t]=e[t]?.join(", ");for(const t of["extent","classification"]){const i=e[t];i&&(e[t]=JSON.stringify(i))}return e}async deleteRating(){await this.portal.request(this.itemUrl+"/deleteRating",{method:"post"})}fetchData(e="json",t){return this.portal.request(this.itemUrl+"/data",{responseType:e,...t,query:{token:this.apiKey}})}async fetchRating(e){const t=await this.portal.request(this.itemUrl+"/rating",{query:{token:this.apiKey},...e});return null!=t.rating?(t.created=new Date(t.created),new y(t)):null}fetchRelatedItems(e,t){return this.portal.requestToTypedArray(this.itemUrl+"/relatedItems",{query:{...e,token:this.apiKey},...t},v)}getThumbnailUrl(e){let t=this.thumbnailUrl;return t&&e&&(t+=`&w=${e}`),t}reload(){return this.portal.request(this.itemUrl??"",{cacheBust:!0,query:{token:this.apiKey}}).then(e=>(this.applicationProxies&&!Object.hasOwn(e,"appProxies")&&(this.applicationProxies=null),this.sourceJSON=e,this.read(e),this))}update(e){return this.id?this.load().then(()=>this.portal.signIn()).then(()=>{const t=e?.data,i={method:"post"};i.query=this.createPostQuery();for(const e in i.query)null===i.query[e]&&(i.query[e]="");return i.query.clearEmptyFields=!0,null!=t&&("string"==typeof t?i.query.text=t:"object"==typeof t&&(i.query.text=JSON.stringify(t))),this.portal.request(`${this.userItemUrl}/update`,i).then(()=>this.reload())}):Promise.reject(new i("portal:item-does-not-exist","The item does not exist yet and cannot be updated"))}async copy(e){if(!this.id)throw new i("portal:item-does-not-exist","The item does not exist yet");await this.load();const{portal:t,itemUrl:r}=this;await t.signIn();const{copyResources:o,folder:s,tags:a,title:n}=e||{},l={method:"post",query:{copyPrivateResources:"all"===o,folder:"string"==typeof s?s:s?.id,includeResources:!!o,tags:a?.join(","),title:n}},{itemId:p}=await t.request(`${r}/copy`,l);return new v({id:p,portal:t})}updateThumbnail(e){return this.id?this.load().then(()=>this.portal.signIn()).then(()=>{const t=e.thumbnail,i=e.filename,r={method:"post"};if("string"==typeof t)n(t)?r.query={data:t}:r.query={url:l(t)},null!=i&&(r.query.filename=i);else{const e=new FormData;null!=i?e.append("file",t,i):e.append("file",t),r.body=e}return this.portal.request(`${this.userItemUrl}/updateThumbnail`,r).then(()=>this.reload())}):Promise.reject(new i("portal:item-does-not-exist","The item does not exist yet and cannot be updated"))}async fetchResources(e={},t){const{fetchResources:i}=await import("./support/resourceUtils.js");return i(this,e,t)}async addResource(e,t,i){const{addOrUpdateResources:r}=await import("./support/resourceUtils.js");return e.portalItem=this,await r(this,[{resource:e,content:t,compress:i?.compress,access:i?.access}],"add",i),e}async removeResource(e,t){const{removeResource:r}=await import("./support/resourceUtils.js");if(e.portalItem&&e.portalItem.itemUrl!==this.itemUrl)throw new i("removeresource:portal-item-mismatch","The portal item associated with the provided resource does not match the item");return r(this,e,t)}async removeAllResources(e){const{removeAllResources:t}=await import("./support/resourceUtils.js");return t(this,e)}resourceFromPath(e){return new g({portalItem:this,path:e})}toJSON(){const e=this.extent,t={accessInformation:this.accessInformation,categories:o(this.categories),classification:o(this.classification),created:this.created?.getTime(),description:this.description,extent:e&&[[e.xmin,e.ymin],[e.xmax,e.ymax]],id:this.id,isOrgItem:this.isOrgItem,licenseInfo:this.licenseInfo,modified:this.modified?.getTime(),name:this.name,owner:this.owner,ownerFolder:this.ownerFolder,snippet:this.snippet,sourceUrl:this.sourceUrl,spatialReference:this.spatialReference,tags:o(this.tags),thumbnail:this.thumbnail,title:this.title,type:this.type,typeKeywords:o(this.typeKeywords),url:this.url};return s(t)}static fromJSON(e){if(!e)return null;if(e.declaredClass)throw new Error("JSON object is already hydrated");return new v({sourceJSON:e})}_getPostQuery(){const e=this.toJSON();for(const t in e)"tags"===t&&null!==e[t]&&(e[t]=e[t].join(", ")),"typeKeywords"===t&&null!==e[t]&&(e[t]=e[t].join(", ")),"extent"===t&&e[t]&&(e[t]=JSON.stringify(e[t]));return e}};e([p({type:["private","shared","org","public"]})],k.prototype,"access",void 0),e([p()],k.prototype,"accessInformation",void 0),e([p({type:String})],k.prototype,"apiKey",void 0),e([p({json:{read:{source:"appProxies"}}})],k.prototype,"applicationProxies",void 0),e([p()],k.prototype,"avgRating",void 0),e([p()],k.prototype,"categories",void 0),e([p()],k.prototype,"classification",void 0),e([p({type:Date})],k.prototype,"created",void 0),e([p()],k.prototype,"culture",void 0),e([p()],k.prototype,"description",void 0),e([p({readOnly:!0})],k.prototype,"displayName",null),e([p({type:m})],k.prototype,"extent",void 0),e([d("extent")],k.prototype,"readExtent",null),e([p()],k.prototype,"groupCategories",void 0),e([p({readOnly:!0})],k.prototype,"iconUrl",null),e([p()],k.prototype,"id",void 0),e([p({readOnly:!0})],k.prototype,"isLayer",null),e([p({type:Boolean,readOnly:!0})],k.prototype,"isOrgItem",void 0),e([p()],k.prototype,"itemControl",void 0),e([p({readOnly:!0})],k.prototype,"itemPageUrl",null),e([p({readOnly:!0})],k.prototype,"itemUrl",null),e([p()],k.prototype,"licenseInfo",void 0),e([p({type:Date})],k.prototype,"modified",void 0),e([p()],k.prototype,"name",void 0),e([p()],k.prototype,"numComments",void 0),e([p()],k.prototype,"numRatings",void 0),e([p()],k.prototype,"numViews",void 0),e([p()],k.prototype,"owner",void 0),e([p()],k.prototype,"ownerFolder",void 0),e([p({type:h})],k.prototype,"portal",void 0),e([p()],k.prototype,"screenshots",void 0),e([p()],k.prototype,"size",void 0),e([p()],k.prototype,"snippet",void 0),e([p()],k.prototype,"sourceJSON",void 0),e([p({type:String})],k.prototype,"sourceUrl",void 0),e([p({type:String})],k.prototype,"spatialReference",void 0),e([p()],k.prototype,"tags",void 0),e([p()],k.prototype,"thumbnail",void 0),e([p({readOnly:!0})],k.prototype,"thumbnailUrl",null),e([p()],k.prototype,"title",void 0),e([p()],k.prototype,"type",void 0),e([p()],k.prototype,"typeKeywords",void 0),e([p({type:String,json:{read(e,t){if(b.has(t.type)){const t=this.portal?.restUrl;e||=t&&this.id?`${t}/content/items/${this.id}/data`:null}return e}}})],k.prototype,"url",void 0),e([p({readOnly:!0})],k.prototype,"userItemUrl",null),k=v=e([u("esri.portal.PortalItem")],k);export{k as default};
5
+ import{__decorate as e}from"tslib";import{getAssetUrl as t}from"../assets.js";import i from"../core/Error.js";import{JSONSupportMixin as r}from"../core/JSONSupport.js";import{clone as o,fixJson as s}from"../core/lang.js";import{Loadable as a}from"../core/Loadable.js";import{isDataProtocol as n,makeAbsolute as l}from"../core/urlUtils.js";import{property as p}from"../core/accessorSupport/decorators/property.js";import{ensureClass as c}from"../core/accessorSupport/ensureType.js";import{reader as d}from"../core/accessorSupport/decorators/reader.js";import{subclass as u}from"../core/accessorSupport/decorators/subclass.js";import m from"../geometry/Extent.js";import h from"./Portal.js";import g from"./PortalItemResource.js";import y from"./PortalRating.js";import{a as w}from"../chunks/persistableUrlUtils.js";var v;const f=new Set(["3DTiles Service","CSV","Feature Collection","Feature Service","Feed","GeoJson","Group Layer","Image Service","KML","Knowledge Graph Layer","Map Service","Media Layer","Scene Service","Stream Service","Video Service","Vector Tile Service","WCS","WFS","WMS","WMTS"]),b=new Set(["KML","GeoJson","CSV"]);let k=v=class extends(r(a)){static from(e){return c(v,e)}constructor(e){super(e),this.access=null,this.accessInformation=null,this.apiKey=null,this.applicationProxies=null,this.avgRating=null,this.categories=null,this.classification=null,this.created=null,this.culture=null,this.description=null,this.extent=null,this.groupCategories=null,this.id=null,this.isOrgItem=!1,this.itemControl=null,this.licenseInfo=null,this.modified=null,this.name=null,this.numComments=null,this.numRatings=null,this.numViews=null,this.owner=null,this.ownerFolder=null,this.portal=null,this.screenshots=null,this.size=null,this.snippet=null,this.sourceJSON=null,this.sourceUrl=null,this.spatialReference=null,this.tags=null,this.title=null,this.type=null,this.typeKeywords=null,this.url=null}destroy(){this.portal=null}get displayName(){const e=this.type,t=this.typeKeywords||[];let i=e;return"Feature Service"===e||"Feature Collection"===e?i=t.includes("Table")?"Table":t.includes("Route Layer")?"Route Layer":t.includes("Markup")?"Markup":"Feature Layer":"Image Service"===e?i=t.includes("Elevation 3D Layer")?"Elevation Layer":t.includes("Tiled Imagery")?"Tiled Imagery Layer":"Imagery Layer":"Scene Service"===e?i="Scene Layer":"Video Service"===e?i="Video Layer":"Scene Package"===e?i="Scene Layer Package":"Stream Service"===e?i="Feature Layer":"Geoprocessing Service"===e?i=t.includes("Web Tool")?"Tool":"Geoprocessing Service":"Geoenrichment Service"===e?i="GeoEnrichment Service":"Geocoding Service"===e?i="Locator":"Microsoft Powerpoint"===e?i="Microsoft PowerPoint":"GeoJson"===e?i="GeoJSON":"Globe Service"===e?i="Globe Layer":"Vector Tile Service"===e?i="Tile Layer":"netCDF"===e?i="NetCDF":"Map Service"===e?i=t.includes("Spatiotemporal")||!t.includes("Hosted Service")&&!t.includes("Tiled")||t.includes("Relational")?"Map Image Layer":"Tile Layer":e?.toLowerCase().includes("add in")?i=e.replaceAll(/(add in)/gi,"Add-In"):"datastore catalog service"===e?i="Big Data File Share":"Compact Tile Package"===e?i="Tile Package (tpkx)":"Raster function template"===e?i="Raster Function Template":"OGCFeatureServer"===e?i="OGC Feature Layer":"web mapping application"===e&&t.includes("configurableApp")?i="Instant App":"Insights Page"===e?i="Insights Report":"Excalibur Imagery Project"===e?i="Excalibur Project":"3DTiles Service"===e?i="3D tiles layer":"3DTiles Package"===e&&(i="3D tiles package"),i}readExtent(e){return e&&e.length?new m(e[0][0],e[0][1],e[1][0],e[1][1]):null}get iconUrl(){const e=this.type?.toLowerCase()||"",i=this.typeKeywords||[],r="esri/images/portal/",o="16";let s,a=!1,n=!1,l=!1,p=!1,c=!1,d=!1,u=!1,m=!1;return e.indexOf("service")>0||"feature collection"===e||"kml"===e||"wms"===e||"wmts"===e||"wfs"===e?(a=i.includes("Hosted Service"),"feature service"===e||"feature collection"===e||"kml"===e||"wfs"===e?(n=i.includes("Table"),l=i.includes("Route Layer"),p=i.includes("Markup"),c=i.includes("Spatiotemporal"),d=i.includes("UtilityNetwork"),s=c&&n?"spatiotemporaltable":n?"table":l?"routelayer":p?"markup":c?"spatiotemporal":d?"utilitynetwork":a?"featureshosted":"features"):"map service"===e||"wms"===e||"wmts"===e?(c=i.includes("Spatiotemporal"),u=i.includes("Relational"),s=c||u?"mapimages":a||i.includes("Tiled")||"wmts"===e?"maptiles":"mapimages"):s="scene service"===e?i.includes("Line")?"sceneweblayerline":i.includes("3DObject")?"sceneweblayermultipatch":i.includes("Point")?"sceneweblayerpoint":i.includes("IntegratedMesh")?"sceneweblayermesh":i.includes("PointCloud")?"sceneweblayerpointcloud":i.includes("Polygon")?"sceneweblayerpolygon":i.includes("Building")?"sceneweblayerbuilding":i.includes("Voxel")?"sceneweblayervoxel":"sceneweblayer":"image service"===e?i.includes("Elevation 3D Layer")?"elevationlayer":i.includes("Tiled Imagery")?"tiledimagerylayer":"imagery":"stream service"===e?"streamlayer":"vector tile service"===e?"vectortile":"datastore catalog service"===e?"datastorecollection":"geocoding service"===e?"geocodeservice":"video service"===e?i.includes("Live Stream")?"livestreamvideolayer":"videolayer":"geoprocessing service"===e?i.includes("Web Tool")?"tool":"layers":"geodata service"===e?"geodataservice":"3dtiles service"===e?i.includes("3DObject")?"3dobjecttileslayer":i.includes("IntegratedMesh")?"integratedmeshtileslayer":i.includes("GaussianSplat")?"gaussiansplatlayer":"3dtileslayer":"layers"):"web map"===e||"cityengine web scene"===e?s="maps":"web scene"===e?s=i.includes("ViewingMode-Local")?"webscenelocal":"websceneglobal":"web mapping application"===e&&i.includes("configurableApp")?s="instantapps":"web mapping application"===e||"mobile application"===e||"application"===e||"operation view"===e||"desktop application"===e?s="apps":"map document"===e||"map package"===e||"published map"===e||"scene document"===e||"globe document"===e||"basemap package"===e||"mobile basemap package"===e||"mobile map package"===e||"project package"===e||"project template"===e||"pro map"===e||"layout"===e||"layer"===e&&i.includes("ArcGIS Pro")||"explorer map"===e&&i.indexOf("Explorer Document")?s="mapsgray":"service definition"===e||"shapefile"===e||"cad drawing"===e||"geojson"===e||"netcdf"===e||"administrative report"===e?s="datafiles":"360 vr experience"===e?s="360vr":"explorer add in"===e||"desktop add in"===e||"windows viewer add in"===e||"windows viewer configuration"===e?s="appsgray":"arcgis pro add in"===e||"arcgis pro configuration"===e?s="addindesktop":"pdf"===e?s="pdf":"microsoft word"===e?s="word":"microsoft excel"===e?s="excel":"microsoft powerpoint"===e?s="ppt":"rule package"===e||"file geodatabase"===e||"sqlite geodatabase"===e||"csv collection"===e||"kml collection"===e||"windows mobile package"===e||"map template"===e||"desktop application template"===e||"gml"===e||"arcpad package"===e||"code sample"===e||"document link"===e||"earth configuration"===e||"operations dashboard add in"===e||"rules package"===e||"workflow manager package"===e||"explorer map"===e&&i.includes("Explorer Mapping Application")||i.includes("Document")?s="datafilesgray":"network analysis service"===e||"geoprocessing service"===e||"geodata service"===e||"geometry service"===e||"geoprocessing package"===e||"locator package"===e||"geoprocessing sample"===e||"workflow manager service"===e?s="toolsgray":"layer"===e||"layer package"===e||"explorer layer"===e?s="layersgray":"analysis model"===e?s="analysismodel":"scene package"===e?s="scenepackage":"3dtiles package"===e?s="3dtileslayerpackage":"3dtiles service"===e?s="3dtileslayer":"mobile scene package"===e?s="mobilescenepackage":"tile package"===e||"compact tile package"===e?s="tilepackage":"task file"===e?s="taskfile":"report template"===e?s="report-template":"statistical data collection"===e?s="statisticaldatacollection":"insights workbook"===e?s="workbook":"insights model"===e?s="insightsmodel":"insights page"===e?s="insightspage":"insights theme"===e?s="insightstheme":"hub initiative"===e?s="hubinitiative":"hub page"===e?s="hubpage":"hub site application"===e?s="hubsite":"hub event"===e?s="hubevent":"hub project"===e?s="hubproject":"relational database connection"===e?s="relationaldatabaseconnection":"big data file share"===e?s="datastorecollection":"image collection"===e?s="imagecollection":"desktop style"===e?s="desktopstyle":"style"===e?s=i.includes("Dictionary")?"dictionarystyle":"style":"dashboard"===e?s="dashboard":"raster function template"===e?s="rasterprocessingtemplate":"vector tile package"===e?s="vectortilepackage":"ortho mapping project"===e?s="orthomappingproject":"ortho mapping template"===e?s="orthomappingtemplate":"solution"===e?s="solutions":"geopackage"===e?s="geopackage":"deep learning package"===e?s="deeplearningpackage":"real time analytic"===e?s="realtimeanalytics":"reality mapping project"===e?s="realitymappingproject":"big data analytic"===e?s="bigdataanalytics":"feed"===e?s="feed":"excalibur imagery project"===e?s="excaliburimageryproject":"notebook"===e?s="notebook":"storymap"===e?s="storymap":"survey123 add in"===e?s="survey123addin":"mission"===e?s="mission":"mission report"===e?s="missionreport":"mission template"===e?s="missiontemplate":"quickcapture project"===e?s="quickcaptureproject":"pro report"===e?s="proreport":"pro report template"===e?s="proreporttemplate":"urban model"===e?s="urbanmodel":"urban project"===e?s="urbanproject":"web experience"===e?s="experiencebuilder":"web experience template"===e?s="webexperiencetemplate":"experience builder widget"===e?s="experiencebuilderwidget":"experience builder widget package"===e?s="experiencebuilderwidgetpackage":"workflow"===e?s="workflow":"kernel gateway connection"===e?s="kernelgatewayconnection":"insights script"===e?s="insightsscript":"hub initiative template"===e?s="hubinitiativetemplate":"storymap theme"===e?s="storymaptheme":"knowledge graph"===e?s="knowledgegraph":"knowledge graph layer"===e?s="knowledgegraphlayer":"knowledge studio project"===e?s="knowledgestudio":"native application"===e?s="nativeapp":"native application installer"===e?s="nativeappinstaller":"web link chart"===e?s="linkchart":"knowledge graph web investigation"===e?s="investigation":"ogcfeatureserver"===e?s="features":"pro presentation"===e?s="propresentation":"pro project"===e?s="proproject":"insights workbook package"===e?s="insightsworkbookpackage":"apache parquet"===e?s="apacheparquet":"notebook code snippet library"===e?s="notebookcodesnippets":"suitability model"===e?s="suitabilitymodel":"esri classifier definition"===e?s="classifierdefinition":"esri classification schema"===e?s="classificationschema":"insights data engineering workbook"===e?s="dataengineeringworkbook":"insights data engineering model"===e?s="dataengineeringmodel":"deep learning studio project"===e?s="deeplearningproject":"discussion"===e?s="discussion":"allsource project"===e?s="allsourceproject":"api key"===e?s="apikey":"data pipeline"===e?s="datapipelines":"group layer"===e?(m=i.includes("Map"),s=m?"layergroup2d":"layergroup"):s="media layer"===e?"onlinemedialayer":"form"===e?i.includes("Survey123")?"survey":"datafilesgray":"csv"===e?"csv":"image"===e?"image":"xr experience"===e?"xrexperience":"maps",s?t(r+s+o+".png"):null}get isLayer(){return null!=this.type&&f.has(this.type)}get itemCdnUrl(){return w(this.itemUrl)}get itemPageUrl(){const e=this.portal?.itemPageUrl;return e&&this.id?`${e}?id=${this.id}`:null}get itemUrl(){const e=this.portal?.restUrl;return e&&this.id?`${e}/content/items/${this.id}`:null}get loaded(){return super.loaded}get thumbnailUrl(){const e=this.itemUrl,t=this.thumbnail;return e&&t?this.portal?.normalizeUrl(`${e}/info/${t}?f=json`)??null:null}get userItemUrl(){const e=this.portal?.restUrl;if(!e)return null;const t=this.owner||this.portal?.user?.id;if(!t)return null;return`${e}/content/users/${this.ownerFolder?`${t}/${this.ownerFolder}`:t}/items/${this.id}`}load(e){const t=this.portal??(this.portal=h.getDefault()),i=t.load(e).then(()=>this.sourceJSON?this.sourceJSON:this.id&&this.itemUrl?t.request(this.itemUrl,{signal:null!=e?e.signal:null,query:{token:this.apiKey}}):{}).then(e=>{this.sourceJSON=e,this.read(e)});return this.addResolvingPromise(i),Promise.resolve(this)}async addRating(e){const t={method:"post",query:{}},i=e instanceof y?e.rating:e;return null==i||isNaN(i)||"number"!=typeof e||(t.query.rating=i),this.portal?(await this.portal.request(this.itemUrl+"/addRating",t),new y({rating:i,created:new Date})):null}clone(){const e={access:this.access,accessInformation:this.accessInformation,applicationProxies:o(this.applicationProxies),avgRating:this.avgRating,categories:o(this.categories),classification:o(this.classification),created:o(this.created),culture:this.culture,description:this.description,extent:o(this.extent),groupCategories:o(this.groupCategories),id:this.id,itemControl:this.itemControl,licenseInfo:this.licenseInfo,modified:o(this.modified),name:this.name,numComments:this.numComments,numRatings:this.numRatings,numViews:this.numViews,owner:this.owner,ownerFolder:this.ownerFolder,portal:this.portal,screenshots:o(this.screenshots),size:this.size,snippet:this.snippet,sourceUrl:this.sourceUrl,spatialReference:this.spatialReference,tags:o(this.tags),thumbnail:this.thumbnail,title:this.title,type:this.type,typeKeywords:o(this.typeKeywords),url:this.url};this.loaded&&(e.loadStatus="loaded");const t=new v({sourceJSON:this.sourceJSON}).set(e);return t._set("isOrgItem",this.isOrgItem),t}createPostQuery(){const e=this.toJSON();for(const t of["tags","typeKeywords","categories"])e[t]=e[t]?.join(", ");for(const t of["extent","classification"]){const i=e[t];i&&(e[t]=JSON.stringify(i))}return e}async deleteRating(){await this.portal.request(this.itemUrl+"/deleteRating",{method:"post"})}fetchData(e="json",t){return this.portal.request(this.itemUrl+"/data",{responseType:e,...t,query:{token:this.apiKey}})}async fetchRating(e){const t=await this.portal.request(this.itemUrl+"/rating",{query:{token:this.apiKey},...e});return null!=t.rating?(t.created=new Date(t.created),new y(t)):null}fetchRelatedItems(e,t){return this.portal.requestToTypedArray(this.itemUrl+"/relatedItems",{query:{...e,token:this.apiKey},...t},v)}getThumbnailUrl(e){let t=this.thumbnailUrl;return t&&e&&(t+=`&w=${e}`),t}reload(){return this.portal.request(this.itemUrl??"",{cacheBust:!0,query:{token:this.apiKey}}).then(e=>(this.applicationProxies&&!Object.hasOwn(e,"appProxies")&&(this.applicationProxies=null),this.sourceJSON=e,this.read(e),this))}update(e){return this.id?this.load().then(()=>this.portal.signIn()).then(()=>{const t=e?.data,i={method:"post"};i.query=this.createPostQuery();for(const e in i.query)null===i.query[e]&&(i.query[e]="");return i.query.clearEmptyFields=!0,null!=t&&("string"==typeof t?i.query.text=t:"object"==typeof t&&(i.query.text=JSON.stringify(t))),this.portal.request(`${this.userItemUrl}/update`,i).then(()=>this.reload())}):Promise.reject(new i("portal:item-does-not-exist","The item does not exist yet and cannot be updated"))}async copy(e){if(!this.id)throw new i("portal:item-does-not-exist","The item does not exist yet");await this.load();const{portal:t,itemUrl:r}=this;await t.signIn();const{copyResources:o,folder:s,tags:a,title:n}=e||{},l={method:"post",query:{copyPrivateResources:"all"===o,folder:"string"==typeof s?s:s?.id,includeResources:!!o,tags:a?.join(","),title:n}},{itemId:p}=await t.request(`${r}/copy`,l);return new v({id:p,portal:t})}updateThumbnail(e){return this.id?this.load().then(()=>this.portal.signIn()).then(()=>{const t=e.thumbnail,i=e.filename,r={method:"post"};if("string"==typeof t)n(t)?r.query={data:t}:r.query={url:l(t)},null!=i&&(r.query.filename=i);else{const e=new FormData;null!=i?e.append("file",t,i):e.append("file",t),r.body=e}return this.portal.request(`${this.userItemUrl}/updateThumbnail`,r).then(()=>this.reload())}):Promise.reject(new i("portal:item-does-not-exist","The item does not exist yet and cannot be updated"))}async fetchResources(e={},t){const{fetchResources:i}=await import("./support/resourceUtils.js");return i(this,e,t)}async addResource(e,t,i){const{addOrUpdateResources:r}=await import("./support/resourceUtils.js");return e.portalItem=this,await r(this,[{resource:e,content:t,compress:i?.compress,access:i?.access}],"add",i),e}async removeResource(e,t){const{removeResource:r}=await import("./support/resourceUtils.js");if(e.portalItem&&e.portalItem.itemUrl!==this.itemUrl)throw new i("removeresource:portal-item-mismatch","The portal item associated with the provided resource does not match the item");return r(this,e,t)}async removeAllResources(e){const{removeAllResources:t}=await import("./support/resourceUtils.js");return t(this,e)}resourceFromPath(e){return new g({portalItem:this,path:e})}toJSON(){const e=this.extent,t={accessInformation:this.accessInformation,categories:o(this.categories),classification:o(this.classification),created:this.created?.getTime(),description:this.description,extent:e&&[[e.xmin,e.ymin],[e.xmax,e.ymax]],id:this.id,isOrgItem:this.isOrgItem,licenseInfo:this.licenseInfo,modified:this.modified?.getTime(),name:this.name,owner:this.owner,ownerFolder:this.ownerFolder,snippet:this.snippet,sourceUrl:this.sourceUrl,spatialReference:this.spatialReference,tags:o(this.tags),thumbnail:this.thumbnail,title:this.title,type:this.type,typeKeywords:o(this.typeKeywords),url:this.url};return s(t)}static fromJSON(e){if(!e)return null;if(e.declaredClass)throw new Error("JSON object is already hydrated");return new v({sourceJSON:e})}_getPostQuery(){const e=this.toJSON();for(const t in e)"tags"===t&&null!==e[t]&&(e[t]=e[t].join(", ")),"typeKeywords"===t&&null!==e[t]&&(e[t]=e[t].join(", ")),"extent"===t&&e[t]&&(e[t]=JSON.stringify(e[t]));return e}};e([p({type:["private","shared","org","public"]})],k.prototype,"access",void 0),e([p()],k.prototype,"accessInformation",void 0),e([p({type:String})],k.prototype,"apiKey",void 0),e([p({json:{read:{source:"appProxies"}}})],k.prototype,"applicationProxies",void 0),e([p()],k.prototype,"avgRating",void 0),e([p()],k.prototype,"categories",void 0),e([p()],k.prototype,"classification",void 0),e([p({type:Date})],k.prototype,"created",void 0),e([p()],k.prototype,"culture",void 0),e([p()],k.prototype,"description",void 0),e([p({readOnly:!0})],k.prototype,"displayName",null),e([p({type:m})],k.prototype,"extent",void 0),e([d("extent")],k.prototype,"readExtent",null),e([p()],k.prototype,"groupCategories",void 0),e([p({readOnly:!0})],k.prototype,"iconUrl",null),e([p()],k.prototype,"id",void 0),e([p({readOnly:!0})],k.prototype,"isLayer",null),e([p({type:Boolean,readOnly:!0})],k.prototype,"isOrgItem",void 0),e([p()],k.prototype,"itemControl",void 0),e([p({readOnly:!0})],k.prototype,"itemPageUrl",null),e([p({readOnly:!0})],k.prototype,"itemUrl",null),e([p()],k.prototype,"licenseInfo",void 0),e([p({type:Date})],k.prototype,"modified",void 0),e([p()],k.prototype,"name",void 0),e([p()],k.prototype,"numComments",void 0),e([p()],k.prototype,"numRatings",void 0),e([p()],k.prototype,"numViews",void 0),e([p()],k.prototype,"owner",void 0),e([p()],k.prototype,"ownerFolder",void 0),e([p({type:h})],k.prototype,"portal",void 0),e([p()],k.prototype,"screenshots",void 0),e([p()],k.prototype,"size",void 0),e([p()],k.prototype,"snippet",void 0),e([p()],k.prototype,"sourceJSON",void 0),e([p({type:String})],k.prototype,"sourceUrl",void 0),e([p({type:String})],k.prototype,"spatialReference",void 0),e([p()],k.prototype,"tags",void 0),e([p()],k.prototype,"thumbnail",void 0),e([p({readOnly:!0})],k.prototype,"thumbnailUrl",null),e([p()],k.prototype,"title",void 0),e([p()],k.prototype,"type",void 0),e([p()],k.prototype,"typeKeywords",void 0),e([p({type:String,json:{read(e,t){if(b.has(t.type)){const t=this.portal?.restUrl;e||=t&&this.id?`${t}/content/items/${this.id}/data`:null}return e}}})],k.prototype,"url",void 0),e([p({readOnly:!0})],k.prototype,"userItemUrl",null),k=v=e([u("esri.portal.PortalItem")],k);export{k as default};
@@ -2,4 +2,4 @@
2
2
  All material copyright ESRI, All Rights Reserved, unless otherwise specified.
3
3
  See https://js.arcgis.com/4.34/esri/copyright.txt for details.
4
4
  */
5
- import{__decorate as e}from"tslib";import{JSONMap as s}from"../core/jsonMap.js";import{clone as t}from"../core/lang.js";import o from"../core/Logger.js";import{property as i}from"../core/accessorSupport/decorators/property.js";import{cast as r}from"../core/accessorSupport/decorators/cast.js";import{enumeration as a}from"../core/accessorSupport/decorators/enumeration.js";import{reader as l}from"../core/accessorSupport/decorators/reader.js";import{subclass as n}from"../core/accessorSupport/decorators/subclass.js";import{writer as u}from"../core/accessorSupport/decorators/writer.js";import{ensureString as p,ensureType as c}from"../core/accessorSupport/ensureType.js";import{collectArcadeFieldNames as m,collectField as d}from"../layers/support/fieldUtils.js";import h from"./Renderer.js";import{VisualVariablesMixin as f}from"./mixins/VisualVariablesMixin.js";import y from"./support/ClassBreakInfo.js";import{rendererBackgroundFillSymbolProperty as g,rendererSymbolProperty as x}from"./support/commonProperties.js";import b from"./support/RendererLegendOptions.js";import{loadArcade as k}from"../support/loadArcade.js";import{ensureType as I}from"../symbols/support/typeUtils.js";var v;const B="log",F="percent-of-total",V="field",S=new s({esriNormalizeByLog:B,esriNormalizeByPercentOfTotal:F,esriNormalizeByField:V}),E=c(y);let j=v=class extends(f(h)){constructor(e){super(e),this._compiledValueExpression={valueExpression:null,compiledFunction:null},this.backgroundFillSymbol=null,this.classBreakInfos=null,this.defaultLabel=null,this.defaultSymbol=null,this.field=null,this.isMaxInclusive=!0,this.legendOptions=null,this.normalizationField=null,this.normalizationTotal=null,this.type="class-breaks",this.valueExpression=null,this.valueExpressionTitle=null,this._set("classBreakInfos",[])}readClassBreakInfos(e,s,t){if(!Array.isArray(e))return;let o=s.minValue;return e.map(e=>{const s=new y;return s.read(e,t),null==s.minValue&&(s.minValue=o),null==s.maxValue&&(s.maxValue=s.minValue),o=s.maxValue,s})}writeClassBreakInfos(e,s,t,o){const i=e.map(e=>e.write({},o));this._areClassBreaksConsecutive()&&i.forEach(e=>delete e.classMinValue),s[t]=i}castField(e){return null==e?e:"function"==typeof e?(o.getLogger(this).error(".field: field must be a string value"),null):p(e)}get minValue(){return this.classBreakInfos&&this.classBreakInfos[0]&&this.classBreakInfos[0].minValue||0}get normalizationType(){let e=this._get("normalizationType");const s=!!this.normalizationField,t=null!=this.normalizationTotal;return s||t?(e=s&&V||t&&F||null,s&&t&&o.getLogger(this).warn("warning: both normalizationField and normalizationTotal are set!")):e!==V&&e!==F||(e=null),e}set normalizationType(e){this._set("normalizationType",e)}addClassBreakInfo(e,s,o){let i=null;i="number"==typeof e?new y({minValue:e,maxValue:s,symbol:I(o)}):E(t(e)),this.classBreakInfos.push(i),1===this.classBreakInfos.length&&this.notifyChange("minValue")}removeClassBreakInfo(e,s){const t=this.classBreakInfos.length;for(let o=0;o<t;o++){const t=[this.classBreakInfos[o].minValue,this.classBreakInfos[o].maxValue];if(t[0]===e&&t[1]===s){this.classBreakInfos.splice(o,1);break}}}getBreakIndex(e,s){return this.valueExpression&&null==s?.arcade&&o.getLogger(this).warn(""),this.valueExpression?this._getBreakIndexForExpression(e,s):this._getBreakIndexForField(e)}async getClassBreakInfo(e,s){let t=s;this.valueExpression&&null==s?.arcade&&(t={...t,arcade:await k()});const o=this.getBreakIndex(e,t);return-1!==o?this.classBreakInfos[o]:null}getSymbol(e,s){if(this.valueExpression&&null==s?.arcade)return void o.getLogger(this).error("#getSymbol()","Please use getSymbolAsync if valueExpression is used");const t=this.getBreakIndex(e,s);return t>-1?this.classBreakInfos[t].symbol:this.defaultSymbol}async getSymbolAsync(e,s){let t=s;if(this.valueExpression&&null==s?.arcade){const e=await k(),{arcadeUtils:s}=e;s.hasGeometryOperations(this.valueExpression)&&await s.enableGeometryOperations(),t={...t,arcade:e}}const o=this.getBreakIndex(e,t);return o>-1?this.classBreakInfos[o].symbol:this.defaultSymbol}get symbols(){const e=[];return this.classBreakInfos.forEach(s=>{s.symbol&&e.push(s.symbol)}),this.defaultSymbol&&e.push(this.defaultSymbol),e}getAttributeHash(){return this.visualVariables?.reduce((e,s)=>e+s.getAttributeHash(),"")??""}getMeshHash(){const e=JSON.stringify(this.backgroundFillSymbol),s=JSON.stringify(this.defaultSymbol),t=`${this.normalizationField}.${this.normalizationType}.${this.normalizationTotal}`;return`${e}.${s}.${this.classBreakInfos.reduce((e,s)=>e+s.getMeshHash(),"")}.${t}.${this.field}.${this.valueExpression}`}get arcadeRequired(){return this.arcadeRequiredForVisualVariables||!!this.valueExpression}clone(){return new v({field:this.field,backgroundFillSymbol:this.backgroundFillSymbol?.clone(),defaultLabel:this.defaultLabel,defaultSymbol:this.defaultSymbol?.clone(),valueExpression:this.valueExpression,valueExpressionTitle:this.valueExpressionTitle,classBreakInfos:t(this.classBreakInfos),isMaxInclusive:this.isMaxInclusive,normalizationField:this.normalizationField,normalizationTotal:this.normalizationTotal,normalizationType:this.normalizationType,visualVariables:t(this.visualVariables),legendOptions:t(this.legendOptions),authoringInfo:t(this.authoringInfo)})}async collectRequiredFields(e,s){const t=[this.collectVVRequiredFields(e,s),this.collectSymbolFields(e,s)];await Promise.all(t)}async collectSymbolFields(e,s){const t=[...this.symbols.map(t=>t.collectRequiredFields(e,s)),m(e,s,this.valueExpression)];d(e,s,this.field),d(e,s,this.normalizationField),await Promise.all(t)}_getBreakIndexForExpression(e,s){const{viewingMode:t,scale:o,spatialReference:i,arcade:r,timeZone:a}=s??{},{valueExpression:l}=this;let n=this._compiledValueExpression.valueExpression===l?this._compiledValueExpression.compiledFunction:null;const u=r.arcadeUtils;if(!n){const e=u.createSyntaxTree(l);n=u.createFunction(e),this._compiledValueExpression.compiledFunction=n}this._compiledValueExpression.valueExpression=l;const p=u.executeFunction(n,u.createExecContext(e,u.getViewInfo({viewingMode:t,scale:o,spatialReference:i}),a));return this._getBreakIndexfromInfos(p)}_getBreakIndexForField(e){const s=this.field,t=e.attributes,o=this.normalizationType;let i=parseFloat(t[s]);if(o){const e=this.normalizationTotal,s=parseFloat(this.normalizationField?t[this.normalizationField]:void 0);if(o===B)i=Math.log(i)*Math.LOG10E;else if(o!==F||null==e||isNaN(e)){if(o===V&&!isNaN(s)){if(isNaN(i)||isNaN(s))return-1;i/=s}}else i=i/e*100}return this._getBreakIndexfromInfos(i)}_getBreakIndexfromInfos(e){const s=this.isMaxInclusive;if(null!=e&&"number"==typeof e&&!isNaN(e))for(let t=0;t<this.classBreakInfos.length;t++){const o=[this.classBreakInfos[t].minValue,this.classBreakInfos[t].maxValue];if(o[0]<=e&&(s?e<=o[1]:e<o[1]))return t}return-1}_areClassBreaksConsecutive(){const e=this.classBreakInfos,s=e.length;for(let t=1;t<s;t++)if(e[t-1].maxValue!==e[t].minValue)return!1;return!0}};e([i(g)],j.prototype,"backgroundFillSymbol",void 0),e([i({type:[y],json:{write:{isRequired:!0}}})],j.prototype,"classBreakInfos",void 0),e([l("classBreakInfos")],j.prototype,"readClassBreakInfos",null),e([u("classBreakInfos")],j.prototype,"writeClassBreakInfos",null),e([i({type:String,json:{write:!0}})],j.prototype,"defaultLabel",void 0),e([i(x)],j.prototype,"defaultSymbol",void 0),e([i({type:String,json:{write:!0}})],j.prototype,"field",void 0),e([r("field")],j.prototype,"castField",null),e([i({type:Boolean})],j.prototype,"isMaxInclusive",void 0),e([i({type:b,json:{write:!0}})],j.prototype,"legendOptions",void 0),e([i({type:Number,readOnly:!0,value:null,json:{read:!1,write:{overridePolicy(){return 0!==this.classBreakInfos.length&&this._areClassBreaksConsecutive()?{enabled:!0}:{enabled:!1}}}}})],j.prototype,"minValue",null),e([i({type:String,json:{write:!0}})],j.prototype,"normalizationField",void 0),e([i({type:Number,json:{write:!0}})],j.prototype,"normalizationTotal",void 0),e([i({type:S.apiValues,value:null,json:{type:S.jsonValues,read:S.read,write:S.write}})],j.prototype,"normalizationType",null),e([a({classBreaks:"class-breaks"})],j.prototype,"type",void 0),e([i({type:String,json:{write:!0}})],j.prototype,"valueExpression",void 0),e([i({type:String,json:{write:!0}})],j.prototype,"valueExpressionTitle",void 0),j=v=e([n("esri.renderers.ClassBreaksRenderer")],j);export{j as default};
5
+ import{__decorate as e}from"tslib";import{JSONMap as s}from"../core/jsonMap.js";import{clone as t}from"../core/lang.js";import o from"../core/Logger.js";import{property as i}from"../core/accessorSupport/decorators/property.js";import{cast as r}from"../core/accessorSupport/decorators/cast.js";import{enumeration as a}from"../core/accessorSupport/decorators/enumeration.js";import{reader as l}from"../core/accessorSupport/decorators/reader.js";import{subclass as n}from"../core/accessorSupport/decorators/subclass.js";import{writer as u}from"../core/accessorSupport/decorators/writer.js";import{ensureString as p,ensureType as c}from"../core/accessorSupport/ensureType.js";import{collectArcadeFieldNames as m,collectField as d}from"../layers/support/fieldUtils.js";import h from"./Renderer.js";import{VisualVariablesMixin as f}from"./mixins/VisualVariablesMixin.js";import y from"./support/ClassBreakInfo.js";import{rendererBackgroundFillSymbolProperty as g,rendererSymbolProperty as x}from"./support/commonProperties.js";import b from"./support/RendererLegendOptions.js";import{loadArcade as k}from"../support/loadArcade.js";import{ensureType as I}from"../symbols/support/typeUtils.js";var v;const B="log",F="percent-of-total",V="field",S=new s({esriNormalizeByLog:B,esriNormalizeByPercentOfTotal:F,esriNormalizeByField:V}),E=c(y);let j=v=class extends(f(h)){constructor(e){super(e),this._compiledValueExpression={valueExpression:null,compiledFunction:null},this.backgroundFillSymbol=null,this.classBreakInfos=null,this.defaultLabel=null,this.defaultSymbol=null,this.field=null,this.isMaxInclusive=!0,this.legendOptions=null,this.normalizationField=null,this.normalizationTotal=null,this.type="class-breaks",this.valueExpression=null,this.valueExpressionTitle=null,this._set("classBreakInfos",[])}readClassBreakInfos(e,s,t){if(!Array.isArray(e))return;let o=s.minValue;return e.map(e=>{const s=new y;return s.read(e,t),null==s.minValue&&(s.minValue=o),null==s.maxValue&&(s.maxValue=s.minValue),o=s.maxValue,s})}writeClassBreakInfos(e,s,t,o){const i=e.map(e=>e.write({},o));this._areClassBreaksConsecutive()&&i.forEach(e=>delete e.classMinValue),s[t]=i}castField(e){return null==e?e:"function"==typeof e?(o.getLogger(this).error(".field: field must be a string value"),null):p(e)}get minValue(){return this.classBreakInfos&&this.classBreakInfos[0]&&this.classBreakInfos[0].minValue||0}get normalizationType(){let e=this._get("normalizationType");const s=!!this.normalizationField,t=null!=this.normalizationTotal;return s||t?(e=s&&V||t&&F||null,s&&t&&o.getLogger(this).warn("warning: both normalizationField and normalizationTotal are set!")):e!==V&&e!==F||(e=null),e}set normalizationType(e){this._set("normalizationType",e)}addClassBreakInfo(e,s,o){let i=null;i="number"==typeof e?new y({minValue:e,maxValue:s,symbol:I(o)}):E(t(e)),this.classBreakInfos.push(i),1===this.classBreakInfos.length&&this.notifyChange("minValue")}removeClassBreakInfo(e,s){const t=this.classBreakInfos.length;for(let o=0;o<t;o++){const t=[this.classBreakInfos[o].minValue,this.classBreakInfos[o].maxValue];if(t[0]===e&&t[1]===s){this.classBreakInfos.splice(o,1);break}}}getBreakIndex(e,s){return this.valueExpression&&null==s?.arcade&&o.getLogger(this).warn(""),this.valueExpression?this._getBreakIndexForExpression(e,s):this._getBreakIndexForField(e)}async getClassBreakInfo(e,s){let t=s;this.valueExpression&&null==s?.arcade&&(t={...t,arcade:await k()});const o=this.getBreakIndex(e,t);return-1!==o?this.classBreakInfos[o]:null}getSymbol(e,s){if(this.valueExpression&&null==s?.arcade)return void o.getLogger(this).error("#getSymbol()","Please use getSymbolAsync if valueExpression is used");const t=this.getBreakIndex(e,s);return t>-1?this.classBreakInfos[t].symbol:this.defaultSymbol}async getSymbolAsync(e,s){let t=s;if(this.valueExpression&&null==s?.arcade){const e=await k(),{arcadeUtils:s}=e;s.hasGeometryOperations(this.valueExpression)&&await s.enableGeometryOperations(),t={...t,arcade:e}}const o=this.getBreakIndex(e,t);return o>-1?this.classBreakInfos[o].symbol:this.defaultSymbol}get symbols(){const e=[];return this.classBreakInfos.forEach(s=>{s.symbol&&e.push(s.symbol)}),this.defaultSymbol&&e.push(this.defaultSymbol),e}getAttributeHash(){return this.visualVariables?.reduce((e,s)=>e+s.getAttributeHash(),"")??""}getMeshHash(){const e=JSON.stringify(this.backgroundFillSymbol),s=JSON.stringify(this.defaultSymbol),t=`${this.normalizationField}.${this.normalizationType}.${this.normalizationTotal}`;return`${e}.${s}.${this.classBreakInfos.reduce((e,s)=>e+s.getMeshHash(),"")}.${t}.${this.field}.${this.valueExpression}`}get arcadeRequired(){return this.arcadeRequiredForVisualVariables||!!this.valueExpression}clone(){return new v({field:this.field,backgroundFillSymbol:this.backgroundFillSymbol?.clone(),defaultLabel:this.defaultLabel,defaultSymbol:this.defaultSymbol?.clone(),valueExpression:this.valueExpression,valueExpressionTitle:this.valueExpressionTitle,classBreakInfos:t(this.classBreakInfos),isMaxInclusive:this.isMaxInclusive,normalizationField:this.normalizationField,normalizationTotal:this.normalizationTotal,normalizationType:this.normalizationType,visualVariables:t(this.visualVariables),legendOptions:t(this.legendOptions),authoringInfo:t(this.authoringInfo)})}async collectRequiredFields(e,s){const t=[this.collectVVRequiredFields(e,s),this.collectSymbolFields(e,s)];await Promise.all(t)}async collectSymbolFields(e,s){const t=[...this.symbols.map(t=>t.collectRequiredFields(e,s)),m(e,s,null,this.valueExpression)];d(e,s,this.field),d(e,s,this.normalizationField),await Promise.all(t)}_getBreakIndexForExpression(e,s){const{viewingMode:t,scale:o,spatialReference:i,arcade:r,timeZone:a}=s??{},{valueExpression:l}=this;let n=this._compiledValueExpression.valueExpression===l?this._compiledValueExpression.compiledFunction:null;const u=r.arcadeUtils;if(!n){const e=u.createSyntaxTree(l);n=u.createFunction(e),this._compiledValueExpression.compiledFunction=n}this._compiledValueExpression.valueExpression=l;const p=u.executeFunction(n,u.createExecContext(e,u.getViewInfo({viewingMode:t,scale:o,spatialReference:i}),a));return this._getBreakIndexfromInfos(p)}_getBreakIndexForField(e){const s=this.field,t=e.attributes,o=this.normalizationType;let i=parseFloat(t[s]);if(o){const e=this.normalizationTotal,s=parseFloat(this.normalizationField?t[this.normalizationField]:void 0);if(o===B)i=Math.log(i)*Math.LOG10E;else if(o!==F||null==e||isNaN(e)){if(o===V&&!isNaN(s)){if(isNaN(i)||isNaN(s))return-1;i/=s}}else i=i/e*100}return this._getBreakIndexfromInfos(i)}_getBreakIndexfromInfos(e){const s=this.isMaxInclusive;if(null!=e&&"number"==typeof e&&!isNaN(e))for(let t=0;t<this.classBreakInfos.length;t++){const o=[this.classBreakInfos[t].minValue,this.classBreakInfos[t].maxValue];if(o[0]<=e&&(s?e<=o[1]:e<o[1]))return t}return-1}_areClassBreaksConsecutive(){const e=this.classBreakInfos,s=e.length;for(let t=1;t<s;t++)if(e[t-1].maxValue!==e[t].minValue)return!1;return!0}};e([i(g)],j.prototype,"backgroundFillSymbol",void 0),e([i({type:[y],json:{write:{isRequired:!0}}})],j.prototype,"classBreakInfos",void 0),e([l("classBreakInfos")],j.prototype,"readClassBreakInfos",null),e([u("classBreakInfos")],j.prototype,"writeClassBreakInfos",null),e([i({type:String,json:{write:!0}})],j.prototype,"defaultLabel",void 0),e([i(x)],j.prototype,"defaultSymbol",void 0),e([i({type:String,json:{write:!0}})],j.prototype,"field",void 0),e([r("field")],j.prototype,"castField",null),e([i({type:Boolean})],j.prototype,"isMaxInclusive",void 0),e([i({type:b,json:{write:!0}})],j.prototype,"legendOptions",void 0),e([i({type:Number,readOnly:!0,value:null,json:{read:!1,write:{overridePolicy(){return 0!==this.classBreakInfos.length&&this._areClassBreaksConsecutive()?{enabled:!0}:{enabled:!1}}}}})],j.prototype,"minValue",null),e([i({type:String,json:{write:!0}})],j.prototype,"normalizationField",void 0),e([i({type:Number,json:{write:!0}})],j.prototype,"normalizationTotal",void 0),e([i({type:S.apiValues,value:null,json:{type:S.jsonValues,read:S.read,write:S.write}})],j.prototype,"normalizationType",null),e([a({classBreaks:"class-breaks"})],j.prototype,"type",void 0),e([i({type:String,json:{write:!0}})],j.prototype,"valueExpression",void 0),e([i({type:String,json:{write:!0}})],j.prototype,"valueExpressionTitle",void 0),j=v=e([n("esri.renderers.ClassBreaksRenderer")],j);export{j as default};
@@ -2,4 +2,4 @@
2
2
  All material copyright ESRI, All Rights Reserved, unless otherwise specified.
3
3
  See https://js.arcgis.com/4.34/esri/copyright.txt for details.
4
4
  */
5
- import{__decorate as r}from"tslib";import e from"../request.js";import{clone as s}from"../core/lang.js";import{property as t}from"../core/accessorSupport/decorators/property.js";import"../core/has.js";import"../core/Logger.js";import{subclass as i}from"../core/accessorSupport/decorators/subclass.js";import{writer as o}from"../core/accessorSupport/decorators/writer.js";import{collectArcadeFieldNames as n}from"../layers/support/fieldUtils.js";import a from"./Renderer.js";import{VisualVariablesMixin as l}from"./mixins/VisualVariablesMixin.js";import{DictionaryLoader as c}from"./support/DictionaryLoader.js";var p;let u=p=class extends(l(a)){constructor(r){super(r),this.config=null,this.fieldMap=null,this.scaleExpression=null,this.scaleExpressionTitle=null,this.url=null,this.type="dictionary"}get _loader(){const r=this.getDictionaryInfo();return new c(this.url,this.config,this.fieldMap??{},r)}writeData(r,e){r&&(e.scalingExpressionInfo={expression:r,returnType:"number"})}writeVisualVariables(r,e,s,t){t?.origin||super.writeVisualVariables(r,e,s,t)}clone(){return new p({config:s(this.config),scaleExpression:this.scaleExpression,scaleExpressionTitle:this.scaleExpressionTitle,fieldMap:s(this.fieldMap),url:s(this.url),visualVariables:s(this.visualVariables)})}async getSymbolAsync(r,e,s=!0){return this._loader.getSymbolAsync(r,e,s)}async getSymbolForControlString(r,e,s){return this._loader.getSymbolForControlString(r,e,s)}getDictionaryInfo(){return this._dictionaryInfoPromise||(this._dictionaryInfoPromise=this._fetchDictionaryInfo()),this._dictionaryInfoPromise}async collectRequiredFields(r,e){await this.collectVVRequiredFields(r,e),this.scaleExpression&&await n(r,e,this.scaleExpression);for(const s in this.fieldMap){const t=this.fieldMap[s];e.has(t)&&r.add(t)}}get arcadeRequired(){return!0}getSymbol(){return null}get symbols(){return[]}getAttributeHash(){return this.visualVariables?.reduce((r,e)=>r+e.getAttributeHash(),"")??""}getMeshHash(){return`${this.url}-${JSON.stringify(this.fieldMap)}`}async _fetchDictionaryInfo(){const{data:r}=await e(this.url+"/resources/styles/dictionary-info.json",{responseType:"json",query:{f:"json"}});return r}};r([t({type:c})],u.prototype,"_loader",null),r([t({type:Object,json:{read:{source:"configuration"},write:{target:"configuration"}}})],u.prototype,"config",void 0),r([t({type:Object,json:{write:!0}})],u.prototype,"fieldMap",void 0),r([t({type:String,json:{read:{source:"scalingExpressionInfo.expression"},write:!0}})],u.prototype,"scaleExpression",void 0),r([o("scaleExpression")],u.prototype,"writeData",null),r([t({type:String,json:{read:{source:"scalingExpressionInfo.title"},write:{target:"scalingExpressionInfo.title",overridePolicy(r){return{enabled:!!r&&!!this.scaleExpression}}}}})],u.prototype,"scaleExpressionTitle",void 0),r([t({type:String,json:{write:!0}})],u.prototype,"url",void 0),r([o("visualVariables")],u.prototype,"writeVisualVariables",null),u=p=r([i("esri.renderers.DictionaryRenderer")],u);export{u as default};
5
+ import{__decorate as r}from"tslib";import e from"../request.js";import{clone as s}from"../core/lang.js";import{property as t}from"../core/accessorSupport/decorators/property.js";import"../core/has.js";import"../core/Logger.js";import{subclass as i}from"../core/accessorSupport/decorators/subclass.js";import{writer as o}from"../core/accessorSupport/decorators/writer.js";import{collectArcadeFieldNames as n}from"../layers/support/fieldUtils.js";import a from"./Renderer.js";import{VisualVariablesMixin as l}from"./mixins/VisualVariablesMixin.js";import{DictionaryLoader as c}from"./support/DictionaryLoader.js";var p;let u=p=class extends(l(a)){constructor(r){super(r),this.config=null,this.fieldMap=null,this.scaleExpression=null,this.scaleExpressionTitle=null,this.url=null,this.type="dictionary"}get _loader(){const r=this.getDictionaryInfo();return new c(this.url,this.config,this.fieldMap??{},r)}writeData(r,e){r&&(e.scalingExpressionInfo={expression:r,returnType:"number"})}writeVisualVariables(r,e,s,t){t?.origin||super.writeVisualVariables(r,e,s,t)}clone(){return new p({config:s(this.config),scaleExpression:this.scaleExpression,scaleExpressionTitle:this.scaleExpressionTitle,fieldMap:s(this.fieldMap),url:s(this.url),visualVariables:s(this.visualVariables)})}async getSymbolAsync(r,e,s=!0){return this._loader.getSymbolAsync(r,e,s)}async getSymbolForControlString(r,e,s){return this._loader.getSymbolForControlString(r,e,s)}getDictionaryInfo(){return this._dictionaryInfoPromise||(this._dictionaryInfoPromise=this._fetchDictionaryInfo()),this._dictionaryInfoPromise}async collectRequiredFields(r,e){await this.collectVVRequiredFields(r,e),this.scaleExpression&&await n(r,e,null,this.scaleExpression);for(const s in this.fieldMap){const t=this.fieldMap[s];e.has(t)&&r.add(t)}}get arcadeRequired(){return!0}getSymbol(){return null}get symbols(){return[]}getAttributeHash(){return this.visualVariables?.reduce((r,e)=>r+e.getAttributeHash(),"")??""}getMeshHash(){return`${this.url}-${JSON.stringify(this.fieldMap)}`}async _fetchDictionaryInfo(){const{data:r}=await e(this.url+"/resources/styles/dictionary-info.json",{responseType:"json",query:{f:"json"}});return r}};r([t({type:c})],u.prototype,"_loader",null),r([t({type:Object,json:{read:{source:"configuration"},write:{target:"configuration"}}})],u.prototype,"config",void 0),r([t({type:Object,json:{write:!0}})],u.prototype,"fieldMap",void 0),r([t({type:String,json:{read:{source:"scalingExpressionInfo.expression"},write:!0}})],u.prototype,"scaleExpression",void 0),r([o("scaleExpression")],u.prototype,"writeData",null),r([t({type:String,json:{read:{source:"scalingExpressionInfo.title"},write:{target:"scalingExpressionInfo.title",overridePolicy(r){return{enabled:!!r&&!!this.scaleExpression}}}}})],u.prototype,"scaleExpressionTitle",void 0),r([t({type:String,json:{write:!0}})],u.prototype,"url",void 0),r([o("visualVariables")],u.prototype,"writeVisualVariables",null),u=p=r([i("esri.renderers.DictionaryRenderer")],u);export{u as default};
@@ -2,4 +2,4 @@
2
2
  All material copyright ESRI, All Rights Reserved, unless otherwise specified.
3
3
  See https://js.arcgis.com/4.34/esri/copyright.txt for details.
4
4
  */
5
- import{__decorate as e}from"tslib";import t from"../Color.js";import{clone as o}from"../core/lang.js";import{property as r}from"../core/accessorSupport/decorators/property.js";import"../core/has.js";import"../core/Logger.js";import{enumeration as i}from"../core/accessorSupport/decorators/enumeration.js";import{subclass as s}from"../core/accessorSupport/decorators/subclass.js";import{collectArcadeFieldNames as n}from"../layers/support/fieldUtils.js";import l from"./Renderer.js";import{VisualVariablesMixin as a}from"./mixins/VisualVariablesMixin.js";import p from"./support/AttributeColorInfo.js";import u from"./support/DotDensityLegendOptions.js";import d from"../symbols/SimpleFillSymbol.js";import c from"../symbols/SimpleLineSymbol.js";var h;let m=h=class extends(a(l)){constructor(e){super(e),this.attributes=null,this.backgroundColor=new t([0,0,0,0]),this.dotBlendingEnabled=!0,this.dotShape="square",this.dotSize=1,this.legendOptions=null,this.outline=new c,this.dotValue=null,this.referenceScale=null,this.seed=1,this.type="dot-density"}set visualVariables(e){super.visualVariables=e}calculateDotValue(e){if(null==this.referenceScale)return this.dotValue;const t=e/this.referenceScale*this.dotValue;return t<1?1:t}getSymbol(){return new d({outline:this.outline})}async getSymbolAsync(){return this.getSymbol()}get symbols(){return[this.getSymbol()]}getAttributeHash(){return this.attributes?.reduce((e,t)=>e+t.getAttributeHash(),"")??""}getMeshHash(){return JSON.stringify(this.outline)}clone(){return new h({attributes:o(this.attributes),backgroundColor:o(this.backgroundColor),dotBlendingEnabled:o(this.dotBlendingEnabled),dotShape:o(this.dotShape),dotSize:o(this.dotSize),dotValue:o(this.dotValue),legendOptions:o(this.legendOptions),outline:o(this.outline),referenceScale:o(this.referenceScale),seed:o(this.seed),visualVariables:o(this.visualVariables),authoringInfo:o(this.authoringInfo)})}getControllerHash(){const e=this.attributes?.map(e=>e.field||e.valueExpression||"");return`${e}-${this.outline&&JSON.stringify(this.outline.toJSON())||""}`}async collectRequiredFields(e,t){await this.collectVVRequiredFields(e,t);for(const o of this.attributes??[])o.valueExpression&&await n(e,t,o.valueExpression),o.field&&e.add(o.field)}};e([r({type:[p],json:{write:!0}})],m.prototype,"attributes",void 0),e([r({type:t,json:{write:!0}})],m.prototype,"backgroundColor",void 0),e([r({type:Boolean,json:{write:!0}})],m.prototype,"dotBlendingEnabled",void 0),e([r({type:String,json:{write:!1}})],m.prototype,"dotShape",void 0),e([r({type:Number,json:{write:!0}})],m.prototype,"dotSize",void 0),e([r({type:u,json:{write:!0}})],m.prototype,"legendOptions",void 0),e([r({type:c,json:{default:null,write:!0}})],m.prototype,"outline",void 0),e([r({type:Number,json:{write:!0}})],m.prototype,"dotValue",void 0),e([r({type:Number,json:{write:!0}})],m.prototype,"referenceScale",void 0),e([r({type:Number,json:{write:!0}})],m.prototype,"seed",void 0),e([i({dotDensity:"dot-density"})],m.prototype,"type",void 0),m=h=e([s("esri.renderers.DotDensityRenderer")],m);export{m as default};
5
+ import{__decorate as e}from"tslib";import t from"../Color.js";import{clone as o}from"../core/lang.js";import{property as r}from"../core/accessorSupport/decorators/property.js";import"../core/has.js";import"../core/Logger.js";import{enumeration as i}from"../core/accessorSupport/decorators/enumeration.js";import{subclass as s}from"../core/accessorSupport/decorators/subclass.js";import{collectArcadeFieldNames as n}from"../layers/support/fieldUtils.js";import l from"./Renderer.js";import{VisualVariablesMixin as a}from"./mixins/VisualVariablesMixin.js";import p from"./support/AttributeColorInfo.js";import u from"./support/DotDensityLegendOptions.js";import d from"../symbols/SimpleFillSymbol.js";import c from"../symbols/SimpleLineSymbol.js";var h;let m=h=class extends(a(l)){constructor(e){super(e),this.attributes=null,this.backgroundColor=new t([0,0,0,0]),this.dotBlendingEnabled=!0,this.dotShape="square",this.dotSize=1,this.legendOptions=null,this.outline=new c,this.dotValue=null,this.referenceScale=null,this.seed=1,this.type="dot-density"}set visualVariables(e){super.visualVariables=e}calculateDotValue(e){if(null==this.referenceScale)return this.dotValue;const t=e/this.referenceScale*this.dotValue;return t<1?1:t}getSymbol(){return new d({outline:this.outline})}async getSymbolAsync(){return this.getSymbol()}get symbols(){return[this.getSymbol()]}getAttributeHash(){return this.attributes?.reduce((e,t)=>e+t.getAttributeHash(),"")??""}getMeshHash(){return JSON.stringify(this.outline)}clone(){return new h({attributes:o(this.attributes),backgroundColor:o(this.backgroundColor),dotBlendingEnabled:o(this.dotBlendingEnabled),dotShape:o(this.dotShape),dotSize:o(this.dotSize),dotValue:o(this.dotValue),legendOptions:o(this.legendOptions),outline:o(this.outline),referenceScale:o(this.referenceScale),seed:o(this.seed),visualVariables:o(this.visualVariables),authoringInfo:o(this.authoringInfo)})}getControllerHash(){const e=this.attributes?.map(e=>e.field||e.valueExpression||"");return`${e}-${this.outline&&JSON.stringify(this.outline.toJSON())||""}`}async collectRequiredFields(e,t){await this.collectVVRequiredFields(e,t);for(const o of this.attributes??[])o.valueExpression&&await n(e,t,null,o.valueExpression),o.field&&e.add(o.field)}};e([r({type:[p],json:{write:!0}})],m.prototype,"attributes",void 0),e([r({type:t,json:{write:!0}})],m.prototype,"backgroundColor",void 0),e([r({type:Boolean,json:{write:!0}})],m.prototype,"dotBlendingEnabled",void 0),e([r({type:String,json:{write:!1}})],m.prototype,"dotShape",void 0),e([r({type:Number,json:{write:!0}})],m.prototype,"dotSize",void 0),e([r({type:u,json:{write:!0}})],m.prototype,"legendOptions",void 0),e([r({type:c,json:{default:null,write:!0}})],m.prototype,"outline",void 0),e([r({type:Number,json:{write:!0}})],m.prototype,"dotValue",void 0),e([r({type:Number,json:{write:!0}})],m.prototype,"referenceScale",void 0),e([r({type:Number,json:{write:!0}})],m.prototype,"seed",void 0),e([i({dotDensity:"dot-density"})],m.prototype,"type",void 0),m=h=e([s("esri.renderers.DotDensityRenderer")],m);export{m as default};
@@ -2,4 +2,4 @@
2
2
  All material copyright ESRI, All Rights Reserved, unless otherwise specified.
3
3
  See https://js.arcgis.com/4.34/esri/copyright.txt for details.
4
4
  */
5
- import{__decorate as t}from"tslib";import e from"../Color.js";import{clone as i}from"../core/lang.js";import{toPt as s}from"../core/screenUtils.js";import{property as r}from"../core/accessorSupport/decorators/property.js";import"../core/has.js";import"../core/Logger.js";import{enumeration as o}from"../core/accessorSupport/decorators/enumeration.js";import{subclass as n}from"../core/accessorSupport/decorators/subclass.js";import{collectField as p,collectArcadeFieldNames as l}from"../layers/support/fieldUtils.js";import a from"./Renderer.js";import m from"./support/AuthoringInfo.js";import y from"./support/HeatmapColorStop.js";import{HeatmapLegendOptions as u}from"./support/HeatmapLegendOptions.js";import{kernelDensityRadiusPtToGaussianBlurRadiusPx as h,gaussianBlurRadiusPxToKernelDensityRadiusPt as d,magicKernelDensityRadiusInflationFactor as c}from"./support/heatmapUtils.js";import x from"../symbols/SimpleMarkerSymbol.js";var g;function f(t){if(null!=t){const{maxDensity:e,minDensity:i,radius:s}=t;if(null!=e||null!=i||null!=s){const{blurRadius:e,maxPixelIntensity:i,minPixelIntensity:s,...r}=t;return r}}return t}let w=g=class extends a{constructor(t){super(t),this.authoringInfo=null,this.colorStops=[new y({ratio:0,color:new e("rgba(255, 140, 0, 0)")}),new y({ratio:.75,color:new e("rgba(255, 140, 0, 1)")}),new y({ratio:.9,color:new e("rgba(255, 0, 0, 1)")})],this.field=null,this.legendOptions=null,this.maxDensity=.04,this.minDensity=0,this.radius=18,this.referenceScale=0,this.type="heatmap",this.valueExpression=null,this.valueExpressionTitle=null}normalizeCtorArgs(t){return f(t)}get blurRadius(){return h(this.radius)}set blurRadius(t){const e=this.maxPixelIntensity,i=this.minPixelIntensity;this._set("radius",d(t)),this._set("maxDensity",e*this._pixelIntensityToDensity),this._set("minDensity",i*this._pixelIntensityToDensity)}get maxPixelIntensity(){return this.maxDensity/this._pixelIntensityToDensity}set maxPixelIntensity(t){this._set("maxDensity",t*this._pixelIntensityToDensity)}get minPixelIntensity(){return this.minDensity/this._pixelIntensityToDensity}set minPixelIntensity(t){this._set("minDensity",t*this._pixelIntensityToDensity)}get _pixelIntensityToDensity(){return 24/(c**2*this.blurRadius**4)}read(t,e){t=f(t),super.read(t,e)}getSymbol(){return new x}async getSymbolAsync(){return this.getSymbol()}get symbols(){return[this.getSymbol()]}async collectRequiredFields(t,e){const i=this.field,s=this.valueExpression;i&&"string"==typeof i&&p(t,e,i),s&&"string"==typeof s&&await l(t,e,s)}getAttributeHash(){return""}getMeshHash(){return`${JSON.stringify(this.colorStops)}.${this.blurRadius}.${this.field}`}clone(){return new g({authoringInfo:this.authoringInfo&&this.authoringInfo.clone(),colorStops:i(this.colorStops),field:this.field,legendOptions:i(this.legendOptions),maxDensity:this.maxDensity,minDensity:this.minDensity,radius:this.radius,referenceScale:this.referenceScale,valueExpression:this.valueExpression,valueExpressionTitle:this.valueExpressionTitle})}};t([r({type:m,json:{write:!0,origins:{"web-scene":{write:!1,read:!1}}}})],w.prototype,"authoringInfo",void 0),t([r({type:Number,json:{origins:{"portal-item":{write:!0},"web-map":{write:!0}}}})],w.prototype,"blurRadius",null),t([r({type:[y],json:{write:{isRequired:!0}}})],w.prototype,"colorStops",void 0),t([r({type:String,json:{write:!0}})],w.prototype,"field",void 0),t([r({type:u,json:{write:!0}})],w.prototype,"legendOptions",void 0),t([r({type:Number,json:{write:!0}})],w.prototype,"maxDensity",void 0),t([r({type:Number,json:{origins:{"portal-item":{write:!0},"web-map":{write:!0}}}})],w.prototype,"maxPixelIntensity",null),t([r({type:Number,json:{write:!0}})],w.prototype,"minDensity",void 0),t([r({type:Number,json:{origins:{"portal-item":{write:!0},"web-map":{write:!0}}}})],w.prototype,"minPixelIntensity",null),t([r({type:Number,cast:s,json:{write:!0}})],w.prototype,"radius",void 0),t([r({type:Number,range:{min:0},json:{default:0,write:!0}})],w.prototype,"referenceScale",void 0),t([o({heatmap:"heatmap"})],w.prototype,"type",void 0),t([r({type:String,json:{write:!0,origins:{"web-document":{write:!1},"portal-item":{write:!1}}}})],w.prototype,"valueExpression",void 0),t([r({type:String})],w.prototype,"valueExpressionTitle",void 0),t([r({readOnly:!0})],w.prototype,"_pixelIntensityToDensity",null),w=g=t([n("esri.renderers.HeatmapRenderer")],w);export{w as default};
5
+ import{__decorate as t}from"tslib";import e from"../Color.js";import{clone as i}from"../core/lang.js";import{toPt as s}from"../core/screenUtils.js";import{property as r}from"../core/accessorSupport/decorators/property.js";import"../core/has.js";import"../core/Logger.js";import{enumeration as o}from"../core/accessorSupport/decorators/enumeration.js";import{subclass as n}from"../core/accessorSupport/decorators/subclass.js";import{collectField as p,collectArcadeFieldNames as l}from"../layers/support/fieldUtils.js";import a from"./Renderer.js";import m from"./support/AuthoringInfo.js";import u from"./support/HeatmapColorStop.js";import{HeatmapLegendOptions as y}from"./support/HeatmapLegendOptions.js";import{kernelDensityRadiusPtToGaussianBlurRadiusPx as h,gaussianBlurRadiusPxToKernelDensityRadiusPt as d,magicKernelDensityRadiusInflationFactor as c}from"./support/heatmapUtils.js";import x from"../symbols/SimpleMarkerSymbol.js";var g;function f(t){if(null!=t){const{maxDensity:e,minDensity:i,radius:s}=t;if(null!=e||null!=i||null!=s){const{blurRadius:e,maxPixelIntensity:i,minPixelIntensity:s,...r}=t;return r}}return t}let w=g=class extends a{constructor(t){super(t),this.authoringInfo=null,this.colorStops=[new u({ratio:0,color:new e("rgba(255, 140, 0, 0)")}),new u({ratio:.75,color:new e("rgba(255, 140, 0, 1)")}),new u({ratio:.9,color:new e("rgba(255, 0, 0, 1)")})],this.field=null,this.legendOptions=null,this.maxDensity=.04,this.minDensity=0,this.radius=18,this.referenceScale=0,this.type="heatmap",this.valueExpression=null,this.valueExpressionTitle=null}normalizeCtorArgs(t){return f(t)}get blurRadius(){return h(this.radius)}set blurRadius(t){const e=this.maxPixelIntensity,i=this.minPixelIntensity;this._set("radius",d(t)),this._set("maxDensity",e*this._pixelIntensityToDensity),this._set("minDensity",i*this._pixelIntensityToDensity)}get maxPixelIntensity(){return this.maxDensity/this._pixelIntensityToDensity}set maxPixelIntensity(t){this._set("maxDensity",t*this._pixelIntensityToDensity)}get minPixelIntensity(){return this.minDensity/this._pixelIntensityToDensity}set minPixelIntensity(t){this._set("minDensity",t*this._pixelIntensityToDensity)}get _pixelIntensityToDensity(){return 24/(c**2*this.blurRadius**4)}read(t,e){t=f(t),super.read(t,e)}getSymbol(){return new x}async getSymbolAsync(){return this.getSymbol()}get symbols(){return[this.getSymbol()]}async collectRequiredFields(t,e){const i=this.field,s=this.valueExpression;i&&"string"==typeof i&&p(t,e,i),s&&"string"==typeof s&&await l(t,e,null,s)}getAttributeHash(){return""}getMeshHash(){return`${JSON.stringify(this.colorStops)}.${this.blurRadius}.${this.field}`}clone(){return new g({authoringInfo:this.authoringInfo&&this.authoringInfo.clone(),colorStops:i(this.colorStops),field:this.field,legendOptions:i(this.legendOptions),maxDensity:this.maxDensity,minDensity:this.minDensity,radius:this.radius,referenceScale:this.referenceScale,valueExpression:this.valueExpression,valueExpressionTitle:this.valueExpressionTitle})}};t([r({type:m,json:{write:!0,origins:{"web-scene":{write:!1,read:!1}}}})],w.prototype,"authoringInfo",void 0),t([r({type:Number,json:{origins:{"portal-item":{write:!0},"web-map":{write:!0}}}})],w.prototype,"blurRadius",null),t([r({type:[u],json:{write:{isRequired:!0}}})],w.prototype,"colorStops",void 0),t([r({type:String,json:{write:!0}})],w.prototype,"field",void 0),t([r({type:y,json:{write:!0}})],w.prototype,"legendOptions",void 0),t([r({type:Number,json:{write:!0}})],w.prototype,"maxDensity",void 0),t([r({type:Number,json:{origins:{"portal-item":{write:!0},"web-map":{write:!0}}}})],w.prototype,"maxPixelIntensity",null),t([r({type:Number,json:{write:!0}})],w.prototype,"minDensity",void 0),t([r({type:Number,json:{origins:{"portal-item":{write:!0},"web-map":{write:!0}}}})],w.prototype,"minPixelIntensity",null),t([r({type:Number,cast:s,json:{write:!0}})],w.prototype,"radius",void 0),t([r({type:Number,range:{min:0},json:{default:0,write:!0}})],w.prototype,"referenceScale",void 0),t([o({heatmap:"heatmap"})],w.prototype,"type",void 0),t([r({type:String,json:{write:!0,origins:{"web-document":{write:!1},"portal-item":{write:!1}}}})],w.prototype,"valueExpression",void 0),t([r({type:String})],w.prototype,"valueExpressionTitle",void 0),t([r({readOnly:!0})],w.prototype,"_pixelIntensityToDensity",null),w=g=t([n("esri.renderers.HeatmapRenderer")],w);export{w as default};
@@ -2,4 +2,4 @@
2
2
  All material copyright ESRI, All Rights Reserved, unless otherwise specified.
3
3
  See https://js.arcgis.com/4.34/esri/copyright.txt for details.
4
4
  */
5
- import{__decorate as e}from"tslib";import t from"../Color.js";import{isSome as r}from"../core/arrayUtils.js";import{ClonableMixin as o}from"../core/Clonable.js";import{toPt as s}from"../core/screenUtils.js";import{property as i}from"../core/accessorSupport/decorators/property.js";import"../core/has.js";import"../core/Logger.js";import{enumeration as l}from"../core/accessorSupport/decorators/enumeration.js";import{subclass as p}from"../core/accessorSupport/decorators/subclass.js";import{collectArcadeFieldNames as a}from"../layers/support/fieldUtils.js";import m from"./Renderer.js";import{VisualVariablesMixin as n}from"./mixins/VisualVariablesMixin.js";import u from"./support/AttributeColorInfo.js";import{rendererBackgroundFillSymbolProperty as y}from"./support/commonProperties.js";import{OthersCategory as c}from"./support/OthersCategory.js";import d from"./support/RendererLegendOptions.js";import b from"./visualVariables/OpacityVariable.js";import h from"./visualVariables/SizeVariable.js";import f from"./visualVariables/VisualVariable.js";import j from"../symbols/SimpleLineSymbol.js";import g from"../symbols/SimpleMarkerSymbol.js";const v={base:f,key:"type",typeMap:{size:h,opacity:b}};let S=class extends(n(o(m))){constructor(e){super(e),this.attributes=null,this.backgroundFillSymbol=null,this.defaultColor=new t([0,0,0,0]),this.defaultLabel=null,this.holePercentage=0,this.othersCategory=new c,this.legendOptions=null,this.outline=null,this.size=12,this.type="pie-chart",this.visualVariables=null}getSymbol(){return new g({size:this.size?this.size/2+(this.outline?.width||0):0})}async getSymbolAsync(){return this.getSymbol()}get symbols(){return[this.getSymbol(),this.backgroundFillSymbol].filter(r)}getAttributeHash(){return this.visualVariables?.reduce((e,t)=>e+t.getAttributeHash(),"")??""}getMeshHash(){return this.symbols.reduce((e,t)=>e+JSON.stringify(t),"")}async collectRequiredFields(e,t){await this.collectVVRequiredFields(e,t);for(const r of this.attributes)r.valueExpression&&await a(e,t,r.valueExpression),r.field&&e.add(r.field)}};e([i({type:[u],json:{write:!0}})],S.prototype,"attributes",void 0),e([i(y)],S.prototype,"backgroundFillSymbol",void 0),e([i({type:t,json:{write:!0}})],S.prototype,"defaultColor",void 0),e([i({type:String,json:{write:!0}})],S.prototype,"defaultLabel",void 0),e([i({type:Number,range:{min:0,max:1},json:{write:!0}})],S.prototype,"holePercentage",void 0),e([i({type:c,json:{write:!0}})],S.prototype,"othersCategory",void 0),e([i({type:d,json:{write:!0}})],S.prototype,"legendOptions",void 0),e([i({type:j,json:{default:null,write:!0}})],S.prototype,"outline",void 0),e([i({type:Number,cast:s,json:{write:!0}})],S.prototype,"size",void 0),e([l({pieChart:"pie-chart"})],S.prototype,"type",void 0),e([i({types:[v]})],S.prototype,"visualVariables",void 0),S=e([p("esri.renderers.PieChartRenderer")],S);export{S as default};
5
+ import{__decorate as e}from"tslib";import t from"../Color.js";import{isSome as r}from"../core/arrayUtils.js";import{ClonableMixin as o}from"../core/Clonable.js";import{toPt as s}from"../core/screenUtils.js";import{property as i}from"../core/accessorSupport/decorators/property.js";import"../core/has.js";import"../core/Logger.js";import{enumeration as l}from"../core/accessorSupport/decorators/enumeration.js";import{subclass as p}from"../core/accessorSupport/decorators/subclass.js";import{collectArcadeFieldNames as a}from"../layers/support/fieldUtils.js";import m from"./Renderer.js";import{VisualVariablesMixin as n}from"./mixins/VisualVariablesMixin.js";import u from"./support/AttributeColorInfo.js";import{rendererBackgroundFillSymbolProperty as y}from"./support/commonProperties.js";import{OthersCategory as c}from"./support/OthersCategory.js";import d from"./support/RendererLegendOptions.js";import b from"./visualVariables/OpacityVariable.js";import h from"./visualVariables/SizeVariable.js";import f from"./visualVariables/VisualVariable.js";import j from"../symbols/SimpleLineSymbol.js";import g from"../symbols/SimpleMarkerSymbol.js";const v={base:f,key:"type",typeMap:{size:h,opacity:b}};let S=class extends(n(o(m))){constructor(e){super(e),this.attributes=null,this.backgroundFillSymbol=null,this.defaultColor=new t([0,0,0,0]),this.defaultLabel=null,this.holePercentage=0,this.othersCategory=new c,this.legendOptions=null,this.outline=null,this.size=12,this.type="pie-chart",this.visualVariables=null}getSymbol(){return new g({size:this.size?this.size/2+(this.outline?.width||0):0})}async getSymbolAsync(){return this.getSymbol()}get symbols(){return[this.getSymbol(),this.backgroundFillSymbol].filter(r)}getAttributeHash(){return this.visualVariables?.reduce((e,t)=>e+t.getAttributeHash(),"")??""}getMeshHash(){return this.symbols.reduce((e,t)=>e+JSON.stringify(t),"")}async collectRequiredFields(e,t){await this.collectVVRequiredFields(e,t);for(const r of this.attributes)r.valueExpression&&await a(e,t,null,r.valueExpression),r.field&&e.add(r.field)}};e([i({type:[u],json:{write:!0}})],S.prototype,"attributes",void 0),e([i(y)],S.prototype,"backgroundFillSymbol",void 0),e([i({type:t,json:{write:!0}})],S.prototype,"defaultColor",void 0),e([i({type:String,json:{write:!0}})],S.prototype,"defaultLabel",void 0),e([i({type:Number,range:{min:0,max:1},json:{write:!0}})],S.prototype,"holePercentage",void 0),e([i({type:c,json:{write:!0}})],S.prototype,"othersCategory",void 0),e([i({type:d,json:{write:!0}})],S.prototype,"legendOptions",void 0),e([i({type:j,json:{default:null,write:!0}})],S.prototype,"outline",void 0),e([i({type:Number,cast:s,json:{write:!0}})],S.prototype,"size",void 0),e([l({pieChart:"pie-chart"})],S.prototype,"type",void 0),e([i({types:[v]})],S.prototype,"visualVariables",void 0),S=e([p("esri.renderers.PieChartRenderer")],S);export{S as default};