@arcgis/core 4.32.0-next.20250217 → 4.32.0-next.20250218

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 (32) hide show
  1. package/assets/esri/core/workers/RemoteClient.js +1 -1
  2. package/assets/esri/core/workers/chunks/{26b5397f63dc602612f2.js → 25e093b845aa995c7b38.js} +1 -1
  3. package/assets/esri/core/workers/chunks/4b588886f11df145d74c.js +1 -0
  4. package/assets/esri/core/workers/chunks/5f1af0a190f3425aa049.js +1 -0
  5. package/assets/esri/core/workers/chunks/70309fa8d35ba8a3866d.js +1 -0
  6. package/assets/esri/core/workers/chunks/{bd5e0a11d2a688a65d23.js → 91686dd19d5c02203aa1.js} +1 -1
  7. package/assets/esri/core/workers/chunks/e533c329246ddc9522b6.js +1 -0
  8. package/assets/esri/core/workers/chunks/fec3d5e68892cc0173be.js +1 -0
  9. package/copyright.txt +71 -0
  10. package/interfaces.d.ts +29 -2
  11. package/layers/FeatureLayer.js +1 -1
  12. package/layers/SceneLayer.js +1 -1
  13. package/layers/buildingSublayers/BuildingComponentSublayer.js +1 -1
  14. package/layers/support/featureLayerUtils.js +1 -1
  15. package/package.json +1 -1
  16. package/rest/support/AttributeBinsGrouping.js +1 -1
  17. package/support/revision.js +1 -1
  18. package/views/2d/FrameTask.js +1 -1
  19. package/views/2d/viewpointUtils.js +1 -1
  20. package/views/3d/terrain/TileRenderer.js +1 -1
  21. package/views/3d/webgl-engine/materials/renderers/BufferRange.js +1 -1
  22. package/views/VideoView.js +1 -1
  23. package/views/View2D.js +1 -1
  24. package/views/Viewport2DMixin.js +5 -0
  25. package/views/webgl/Texture.js +1 -1
  26. package/widgets/ShadowCast.js +1 -1
  27. package/widgets/VideoPlayer.js +1 -1
  28. package/assets/esri/core/workers/chunks/386bac8cf59008e611de.js +0 -1
  29. package/assets/esri/core/workers/chunks/b43d88b6e7dc4ab13599.js +0 -1
  30. package/assets/esri/core/workers/chunks/ceb648604a4b6d316f4b.js +0 -1
  31. package/assets/esri/core/workers/chunks/d58f4aa44ade81b0bb3a.js +0 -1
  32. package/assets/esri/core/workers/chunks/f4e48bbdbc9da10ec71a.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.32/esri/copyright.txt for details.
4
4
  */
5
- import{_ as e}from"../chunks/tslib.es6.js";import t from"../Graphic.js";import r from"../PopupTemplate.js";import i from"../core/Clonable.js";import s from"../core/Collection.js";import o from"../core/Error.js";import a from"../core/Logger.js";import{destroyMaybe as n}from"../core/maybe.js";import{MultiOriginJSONMixin as l}from"../core/MultiOriginJSONSupport.js";import{throwIfAbortError as p,isAbortError as d}from"../core/promiseUtils.js";import{whenOnce as u}from"../core/reactiveUtils.js";import{property as y}from"../core/accessorSupport/decorators/property.js";import"../core/has.js";import"../core/RandomLCG.js";import{getProperties as c}from"../core/accessorSupport/utils.js";import{reader as h}from"../core/accessorSupport/decorators/reader.js";import{subclass as f}from"../core/accessorSupport/decorators/subclass.js";import{OriginId as m}from"../core/accessorSupport/PropertyOrigin.js";import g from"../geometry/Point.js";import v from"./Layer.js";import{NoModelError as b,MultipleModelsError as w}from"./graphics/sources/support/uploadAssetErrors.js";import{APIKeyMixin as I}from"./mixins/APIKeyMixin.js";import{ArcGISService as L}from"./mixins/ArcGISService.js";import{CustomParametersMixin as j}from"./mixins/CustomParametersMixin.js";import{EditBusLayer as F}from"./mixins/EditBusLayer.js";import{OperationalLayer as S}from"./mixins/OperationalLayer.js";import{PortalLayer as _}from"./mixins/PortalLayer.js";import{ScaleRangeLayer as A}from"./mixins/ScaleRangeLayer.js";import{SceneService as O,SaveOperationType as P}from"./mixins/SceneService.js";import{useViewTimeProperty as T}from"./mixins/TemporalLayer.js";import{TemporalSceneLayer as E}from"./mixins/TemporalSceneLayer.js";import{isHostedAgolService as x}from"./support/arcgisLayerUrl.js";import{findAssociatedFeatureService as D}from"./support/associatedFeatureServiceUtils.js";import{zeroCapabilities as U}from"./support/capabilities.js";import{elevationInfo as R,labelsVisible as q,legendEnabled as C,popupEnabled as G,screenSizePerspectiveEnabled as N}from"./support/commonProperties.js";import{computeEffectiveEditingEnabled as Q,getGlobalIdToObjectIdMap as V}from"./support/featureLayerUtils.js";import{FeatureReduction as M}from"./support/FeatureReduction.js";import k from"./support/FeatureReductionSelection.js";import{defineFieldProperties as K}from"./support/fieldProperties.js";import $ from"./support/FieldsIndex.js";import{fixRendererFields as H,unpackFieldNames as z}from"./support/fieldUtils.js";import{I3SNodePageDefinition as W,I3SMaterialDefinition as Z,I3STextureSetDefinition as B,I3SGeometryDefinition as J}from"./support/I3SLayerDefinitions.js";import{isFileEditFormat as X,isFileSupported as Y}from"./support/infoFor3D.js";import ee from"./support/LabelClass.js";import{reader as te}from"./support/labelingInfo.js";import re from"./support/LayerFloorInfo.js";import{layerLookupMap as ie}from"./support/lazyLayerLoader.js";import{getMeshTransformForMetersToSpatialReference as se}from"./support/meshSpatialReferenceScaleUtils.js";import{RangeInfo as oe}from"./support/RangeInfo.js";import ae from"./support/SceneFilter.js";import{cacheIsOutOfSync as ne}from"./support/sceneLayerCacheUtils.js";import{fetchStatistics as le}from"./support/sceneLayerStatistics.js";import{loadStyleRenderer as pe}from"../renderers/support/styleUtils.js";import{webSceneRendererTypes as de}from"../renderers/support/typeUtils.js";import ue from"../rest/support/Query.js";import{logInvalidElevationInfoWarning as ye,elevationModeUnsupportedMessage as ce,featureExpressionUnsupportedMessage as he}from"../support/elevationInfoUtils.js";import{createPopupTemplate as fe}from"../support/popupUtils.js";import{extractZipFiles as me}from"../support/zipUtils.js";import{queryAttributesFromCachedAttributesId as ge}from"../views/3d/layers/i3s/I3SUtil.js";import{getRequiredFields as ve,getFetchPopupTemplate as be}from"../views/layers/support/popupUtils.js";import{transparencyToOpacity as we}from"../webdoc/support/opacityUtils.js";const Ie=new Set(["3DObject","Point"]),Le=K();let je=class extends(E(F(O(L(S(_(A(l(j(I(i.ClonableMixin(v)))))))))))){constructor(...e){super(...e),this.featureReduction=null,this.rangeInfos=null,this.operationalLayerType="ArcGISSceneServiceLayer",this.type="scene",this.fields=null,this.floorInfo=null,this.outFields=null,this.nodePages=null,this.materialDefinitions=null,this.textureSetDefinitions=null,this.geometryDefinitions=null,this.serviceUpdateTimeStamp=null,this.excludeObjectIds=new s,this.definitionExpression=null,this.filter=null,this.path=null,this.labelsVisible=!0,this.labelingInfo=null,this.legendEnabled=!0,this.priority=null,this.semantic=null,this.cachedDrawingInfo={color:!1},this.popupEnabled=!0,this.popupTemplate=null,this.objectIdField=null,this.globalIdField=null,this._fieldUsageInfo={},this.screenSizePerspectiveEnabled=!0,this.serviceItemId=void 0}normalizeCtorArgs(e,t){return"string"==typeof e?{url:e,...t}:e}destroy(){this._set("renderer",null),this.associatedLayer=n(this.associatedLayer)}getField(e){return this.fieldsIndex.get(e)}getFieldDomain(e,t){const r=this.getFeatureType(t?.feature)?.domains?.[e];return r&&"inherited"!==r.type?r:this.getField(e)?.domain??null}getFeatureType(e){return e&&this.associatedLayer?this.associatedLayer.getFeatureType(e):null}get types(){return this.associatedLayer?.types??[]}get typeIdField(){return this.associatedLayer?.typeIdField??null}get templates(){return this.associatedLayer?.templates??null}get formTemplate(){return this.associatedLayer?.formTemplate??null}get attributeTableTemplate(){return this.associatedLayer?.attributeTableTemplate??null}get fieldsIndex(){return new $(this.fields)}readNodePages(e,t,r){return"Point"===t.layerType&&(e=t.pointNodePages),null==e||"object"!=typeof e?null:W.fromJSON(e,r)}set elevationInfo(e){this._set("elevationInfo",e),this.loaded&&this._validateElevationInfo()}get effectiveCapabilities(){return this._capabilitiesFromAssociatedFeatureLayer(this.associatedLayer?.effectiveCapabilities)}get effectiveEditingEnabled(){return null!=this.associatedLayer&&Q(this.associatedLayer)}get geometryType(){return Se[this.profile]||"mesh"}set renderer(e){H(e,this.fieldsIndex),this._set("renderer",e)}readCachedDrawingInfo(e){return null!=e&&"object"==typeof e||(e={}),null==e.color&&(e.color=!1),e}get capabilities(){return this._capabilitiesFromAssociatedFeatureLayer(this.associatedLayer?.capabilities)}_capabilitiesFromAssociatedFeatureLayer(e){e=null!=e?e:U;const{query:t,queryRelated:r,editing:{supportsGlobalId:i,supportsRollbackOnFailure:s,supportsUploadWithItemId:o,supportsGeometryUpdate:a,supportsReturnServiceEditsInSourceSpatialReference:n},data:{supportsZ:l,supportsM:p,isVersioned:d,supportsAttachment:u},operations:{supportsEditing:y,supportsAdd:c,supportsUpdate:h,supportsDelete:f,supportsQuery:m,supportsQueryAttachments:g,supportsAsyncConvert3D:v}}=e,b=e.operations.supportsChangeTracking,w=!!this.associatedLayer?.infoFor3D;return{query:t,queryRelated:r,editing:{supportsGlobalId:i,supportsReturnServiceEditsInSourceSpatialReference:n,supportsRollbackOnFailure:s,supportsGeometryUpdate:w&&a,supportsUploadWithItemId:o},data:{supportsAttachment:u,supportsZ:l,supportsM:p,isVersioned:d},operations:{supportsQuery:m,supportsQueryAttachments:g,supportsEditing:y&&b,supportsAdd:w&&c&&b,supportsDelete:w&&f&&b,supportsUpdate:h&&b,supportsAsyncConvert3D:v}}}get editingEnabled(){return this._isOverridden("editingEnabled")?this._get("editingEnabled"):this.associatedLayer?.editingEnabled??!1}set editingEnabled(e){this._overrideIfSome("editingEnabled",e)}get infoFor3D(){return this.associatedLayer?.infoFor3D??null}get relationships(){return this.associatedLayer?.relationships}get defaultPopupTemplate(){return this.associatedLayer||this.attributeStorageInfo?this.createPopupTemplate():null}readObjectIdField(e,t){return!e&&t.fields&&t.fields.some((t=>("esriFieldTypeOID"===t.type&&(e=t.name),!!e))),e||void 0}readGlobalIdField(e,t){return!e&&t.fields&&t.fields.some((t=>("esriFieldTypeGlobalID"===t.type&&(e=t.name),!!e))),e||void 0}get displayField(){return this.associatedLayer?.displayField??null}readProfile(e,t){const r=t.store.profile;return null!=r&&Fe[r]?Fe[r]:(a.getLogger(this).error("Unknown or missing profile",{profile:r,layer:this}),"mesh-pyramids")}get useViewTime(){return this.associatedLayer?.useViewTime??!0}set useViewTime(e){this._override("useViewTime",e)}load(e){return this.addResolvingPromise(this._load(e)),Promise.resolve(this)}async _load(e){const t=null!=e?e.signal:null;await this.loadFromPortal({supportedTypes:["Scene Service"]},e).catch(p),await this._fetchService(t),await Promise.all([this._fetchIndexAndUpdateExtent(this.nodePages,t),this._setAssociatedFeatureLayer(t),this._loadFilterGeometries()]),this._validateElevationInfo(),this._applyAssociatedLayerOverrides(),this._populateFieldUsageInfo(),await this.loadTimeInfoFromService(e),await pe(this,{origin:"service"},t),H(this.renderer,this.fieldsIndex),await this.finishLoadEditablePortalLayer(e)}async beforeSave(){null!=this.filter&&(this.filter=this.filter.clone(),await this.load())}async _loadFilterGeometries(){if(this.filter)try{await this.filter.loadGeometries(this.spatialReference)}catch(e){a.getLogger(this).error("#_loadFilterGeometries()",this,"Failed to load filter geometries. Geometry filter will not be applied for this layer.",{error:e}),this.filter=null}}createQuery(){const e=new ue;return"mesh"===this.geometryType?this.capabilities.query.supportsReturnMesh&&(e.returnGeometry=!0):(e.returnGeometry=!0,e.returnZ=!0),e.where=this.definitionExpression||"1=1",e.sqlFormat="standard",e.outFields=["*"],e}queryExtent(e,t){return this._getAssociatedLayerForQuery().then((r=>r.queryExtent(e||this.createQuery(),t)))}queryFeatureCount(e,t){return this._getAssociatedLayerForQuery().then((r=>r.queryFeatureCount(e||this.createQuery(),t)))}queryFeatures(e,t){return this._getAssociatedLayerForQuery().then((r=>r.queryFeatures(e||this.createQuery(),t))).then((e=>{if(e?.features)for(const t of e.features)t.layer=this,t.sourceLayer=this;return e}))}async queryRelatedFeatures(e,t){if(await this.load(),!this.associatedLayer)throw new o("scenelayer:query-not-available","SceneLayer queries are not available without an associated feature layer",{layer:this});return this.associatedLayer.queryRelatedFeatures(e,t)}async queryRelatedFeaturesCount(e,t){if(await this.load(),!this.associatedLayer)throw new o("scenelayer:query-not-available","SceneLayer queries are not available without an associated feature layer",{layer:this});return this.associatedLayer.queryRelatedFeaturesCount(e,t)}async queryCachedAttributes(e,t){const r=z(this.fieldsIndex,await ve(this,be(this)));return ge(this.parsedUrl?.path??"",this.attributeStorageInfo??[],e,t,r,this.apiKey,this.customParameters)}async queryCachedFeature(e,r){const i=await this.queryCachedAttributes(e,[r]);if(!i||0===i.length)throw new o("scenelayer:feature-not-in-cached-data","Feature not found in cached data");const s=new t;return s.attributes=i[0],s.layer=this,s.sourceLayer=this,s}queryObjectIds(e,t){return this._getAssociatedLayerForQuery().then((r=>r.queryObjectIds(e||this.createQuery(),t)))}queryAttachments(e,t){return this._getAssociatedLayerForQuery().then((r=>r.queryAttachments(e,t)))}getFieldUsageInfo(e){const t={supportsLabelingInfo:!1,supportsRenderer:!1,supportsPopupTemplate:!1,supportsLayerQuery:!1};return this.loaded?this._fieldUsageInfo[e]||t:(a.getLogger(this).error("#getFieldUsageInfo()","Unavailable until layer is loaded"),t)}createPopupTemplate(e){return fe(this,e)}_getAssociatedLayerForQuery(){const e=this.associatedLayer;return e?.loaded?Promise.resolve(e):this._loadAssociatedLayerForQuery()}async _loadAssociatedLayerForQuery(){if(await this.load(),!this.associatedLayer)throw new o("scenelayer:query-not-available","SceneLayer queries are not available without an associated feature layer",{layer:this});try{await this.associatedLayer.load()}catch(e){throw new o("scenelayer:query-not-available","SceneLayer associated feature layer could not be loaded",{layer:this,error:e})}return this.associatedLayer}hasCachedStatistics(e){return null!=this.statisticsInfo&&this.statisticsInfo.some((t=>t.name===e))}async queryCachedStatistics(e,t){return await this.load(t),await this.fetchStatistics(e,t)}async saveAs(e,t){return this._debouncedSaveOperations(P.SAVE_AS,{...t,getTypeKeywords:()=>this._getTypeKeywords(),portalItemLayerType:"scene"},e)}async save(){const e={getTypeKeywords:()=>this._getTypeKeywords(),portalItemLayerType:"scene"};return this._debouncedSaveOperations(P.SAVE,e)}async applyEdits(e,t){const{applyEdits:r}=await import("./graphics/editingSupport.js");let i=t;await this.load();const s=this.associatedLayer;if(!s)throw new o(`${this.type}-layer:not-editable`,"Service is not editable");await s.load();const{globalIdField:a}=s,n=!!s.infoFor3D,l=i?.globalIdUsed??!0;if(n&&null==a)throw new o(`${this.type}-layer:not-editable`,"Valid globalIdField expected on editable SceneLayer");if(n&&!l)throw new o(`${this.type}-layer:globalid-required`,"globalIdUsed must not be false for SceneLayer editing as globalIds are required.");return x(s.url)&&n&&null!=e.deleteFeatures&&null!=a&&(i={...i,globalIdToObjectId:await V(s,e.deleteFeatures,a)}),r(this,s.source,e,i)}async uploadAssets(e,t){if(await this.load(),null==this.associatedLayer)throw new o(`${this.type}-layer:not-editable`,"Service is not editable");return await this.associatedLayer.load(),this.associatedLayer.uploadAssets(e,t)}on(e,t){return super.on(e,t)}async convertMesh(e,t){t??={};const r=e=>{throw a.getLogger(this).error(".convertMesh()",e.message),e};await this.load(),this.infoFor3D||r(new o("invalid:layer","SceneLayer has no capability for mesh conversion"));const i=await this.extractAndFilterFiles(e),s=i.reduce(((e,t)=>X(this.infoFor3D,t)?e+1:e),0);0===s&&r(new b),s>1&&r(new w);const n=this.spatialReference,l=t.location??new g({x:0,y:0,z:0,spatialReference:n}),p=l.spatialReference.isGeographic?"local":"georeferenced",{default:d}=await import("../geometry/Mesh.js"),u=d.createWithExternalSource(l,i,{vertexSpace:p,transform:se(l.spatialReference),unitConversionDisabled:!0}),[y]=await this.uploadAssets([u],{...t,useAssetOrigin:!t.location});return y}async extractAndFilterFiles(e){await this.load();const t=this.infoFor3D;if(!t)return e;return(await me(e)).filter((e=>Y(t,e)))}validateLayer(e){if(e.layerType&&!Ie.has(e.layerType))throw new o("scenelayer:layer-type-not-supported","SceneLayer does not support this layer type",{layerType:e.layerType});if(isNaN(this.version.major)||isNaN(this.version.minor))throw new o("layer:service-version-not-supported","Service version is not supported.",{serviceVersion:this.version.versionString,supportedVersions:"1.x, 2.x"});if(this.version.major>2)throw new o("layer:service-version-too-new","Service version is too new.",{serviceVersion:this.version.versionString,supportedVersions:"1.x, 2.x"});function t(e,t){let r=!1,i=!1;if(null==e)r=!0,i=!0;else{const s=t&&t.isGeographic;switch(e){case"east-north-up":case"earth-centered":r=!0,i=s;break;case"vertex-reference-frame":r=!0,i=!s;break;default:r=!1}}if(!r)throw new o("scenelayer:unsupported-normal-reference-frame","Normal reference frame is invalid.");if(!i)throw new o("scenelayer:incompatible-normal-reference-frame","Normal reference frame is incompatible with layer spatial reference.")}t(this.normalReferenceFrame,this.spatialReference)}_getTypeKeywords(){const e=[];if("points"===this.profile)e.push("Point");else{if("mesh-pyramids"!==this.profile)throw new o("scenelayer:unknown-profile","SceneLayer:save() encountered an unknown SceneLayer profile: "+this.profile);e.push("3DObject")}return e}_populateFieldUsageInfo(){if(this._fieldUsageInfo={},this.fields)for(const e of this.fields){const t=!!this.attributeStorageInfo?.some((t=>t.name===e.name)),r=!!this.associatedLayer?.fields?.some((t=>t&&e.name===t.name)),i={supportsLabelingInfo:t,supportsRenderer:t,supportsPopupTemplate:t||r,supportsLayerQuery:r};this._fieldUsageInfo[e.name]=i}}_applyAssociatedLayerOverrides(){this._applyAssociatedLayerFieldsOverrides(),this._applyAssociatedLayerPopupOverrides(),this._applyAssociatedLayerExtentOverride(),this._applyAssociatedLayerPrivileges()}_applyAssociatedLayerFieldsOverrides(){if(!this.associatedLayer?.fields)return;let e=null;for(const t of this.associatedLayer.fields){const r=this.getField(t.name);r?(!r.domain&&t.domain&&(r.domain=t.domain.clone()),r.editable=t.editable,r.nullable=t.nullable,r.length=t.length):(e||(e=this.fields?this.fields.slice():[]),e.push(t.clone()))}e&&this._set("fields",e)}_applyAssociatedLayerPopupOverrides(){if(!this.associatedLayer)return;const e=["popupTemplate","popupEnabled"],t=c(this);for(let r=0;r<e.length;r++){const i=e[r],s=this.originIdOf(i),o=this.associatedLayer.originIdOf(i);s<o&&(o===m.SERVICE||o===m.PORTAL_ITEM)&&t.setAtOrigin(i,this.associatedLayer[i],o)}}_applyAssociatedLayerExtentOverride(){const e=this.associatedLayer?.getAtOrigin("fullExtent","service");if(null==this.associatedLayer?.infoFor3D||!e||!x(this.associatedLayer?.url)||!ne(this))return;c(this).setAtOrigin("fullExtent",e.clone(),m.SERVICE)}_applyAssociatedLayerPrivileges(){const e=this.associatedLayer;e&&(this._set("userHasEditingPrivileges",e.userHasEditingPrivileges),this._set("userHasFullEditingPrivileges",e.userHasFullEditingPrivileges),this._set("userHasUpdateItemPrivileges",e.userHasUpdateItemPrivileges))}async _setAssociatedFeatureLayer(e){if(["mesh-pyramids","points"].includes(this.profile))try{const{serverUrl:t,layerId:r,portalItem:i}=await D(`${this.url}/layers/${this.layerId}`,{sceneLayerItem:this.portalItem,customParameters:this.customParameters,apiKey:this.apiKey,signal:e}),s=await ie.FeatureLayer();this.associatedLayer=new s({url:t,customParameters:this.customParameters,layerId:r,portalItem:i}),await this.associatedLayer.load()}catch(t){d(t)||this._logWarningOnPopupEnabled()}}async _logWarningOnPopupEnabled(){await u((()=>this.popupEnabled&&null!=this.popupTemplate));const e=`this SceneLayer: ${this.title}`;null==this.attributeStorageInfo?a.getLogger(this).warn(`Associated FeatureLayer could not be loaded and no binary attributes found. Popups will not work on ${e}`):a.getLogger(this).info(`Associated FeatureLayer could not be loaded. Falling back to binary attributes for Popups on ${e}`)}_validateElevationInfo(){const e=this.elevationInfo;"mesh-pyramids"===this.profile&&ye(a.getLogger(this),ce("Mesh scene layers","relative-to-scene",e)),ye(a.getLogger(this),he("Scene layers",e))}async fetchStatistics(e,t){return await le({fieldName:e,statisticsInfo:this.statisticsInfo,errorContext:"scenelayer",fieldsIndex:this.fieldsIndex,path:this.parsedUrl?.path??"",customParameters:this.customParameters,apiKey:this.apiKey,signal:t?.signal})}};e([y({types:{key:"type",base:M,typeMap:{selection:k}},json:{origins:{"web-scene":{name:"layerDefinition.featureReduction",write:!0},"portal-item":{name:"layerDefinition.featureReduction",write:!0}}}})],je.prototype,"featureReduction",void 0),e([y({type:[oe],json:{read:!1,origins:{"web-scene":{name:"layerDefinition.rangeInfos",write:!0},"portal-item":{name:"layerDefinition.rangeInfos",write:!0}}}})],je.prototype,"rangeInfos",void 0),e([y({json:{read:!1}})],je.prototype,"associatedLayer",void 0),e([y({type:["show","hide"]})],je.prototype,"listMode",void 0),e([y({type:["ArcGISSceneServiceLayer"]})],je.prototype,"operationalLayerType",void 0),e([y({json:{read:!1},readOnly:!0})],je.prototype,"type",void 0),e([y({...Le.fields,readOnly:!0,json:{read:!1,origins:{service:{read:!0}}}})],je.prototype,"fields",void 0),e([y()],je.prototype,"types",null),e([y()],je.prototype,"typeIdField",null),e([y()],je.prototype,"templates",null),e([y()],je.prototype,"formTemplate",null),e([y()],je.prototype,"attributeTableTemplate",null),e([y({readOnly:!0,clonable:!1})],je.prototype,"fieldsIndex",null),e([y({type:re,json:{read:{source:"layerDefinition.floorInfo"},write:{target:"layerDefinition.floorInfo"}}})],je.prototype,"floorInfo",void 0),e([y(Le.outFields)],je.prototype,"outFields",void 0),e([y({type:W,readOnly:!0,json:{read:!1}})],je.prototype,"nodePages",void 0),e([h("service","nodePages",["nodePages","pointNodePages"])],je.prototype,"readNodePages",null),e([y({type:[Z],readOnly:!0})],je.prototype,"materialDefinitions",void 0),e([y({type:[B],readOnly:!0})],je.prototype,"textureSetDefinitions",void 0),e([y({type:[J],readOnly:!0})],je.prototype,"geometryDefinitions",void 0),e([y({readOnly:!0})],je.prototype,"serviceUpdateTimeStamp",void 0),e([y({readOnly:!0})],je.prototype,"attributeStorageInfo",void 0),e([y({readOnly:!0})],je.prototype,"statisticsInfo",void 0),e([y({type:s.ofType(Number),nonNullable:!0,json:{origins:{service:{read:!1,write:!1}},name:"layerDefinition.excludeObjectIds",write:{enabled:!0}}})],je.prototype,"excludeObjectIds",void 0),e([y({type:String,json:{origins:{service:{read:!1,write:!1}},name:"layerDefinition.definitionExpression",write:{enabled:!0,allowNull:!0}}})],je.prototype,"definitionExpression",void 0),e([y({type:ae,json:{name:"layerDefinition.polygonFilter",write:{enabled:!0,allowNull:!0},origins:{service:{read:!1,write:!1}}}})],je.prototype,"filter",void 0),e([y({type:String,json:{origins:{"web-scene":{read:!0,write:!0}},read:!1}})],je.prototype,"path",void 0),e([y(R)],je.prototype,"elevationInfo",null),e([y({readOnly:!0,json:{read:!1}})],je.prototype,"effectiveCapabilities",null),e([y({readOnly:!0})],je.prototype,"effectiveEditingEnabled",null),e([y({type:String})],je.prototype,"geometryType",null),e([y(q)],je.prototype,"labelsVisible",void 0),e([y({type:[ee],json:{origins:{service:{name:"drawingInfo.labelingInfo",read:{reader:te},write:!1}},name:"layerDefinition.drawingInfo.labelingInfo",read:{reader:te},write:!0}})],je.prototype,"labelingInfo",void 0),e([y(C)],je.prototype,"legendEnabled",void 0),e([y({type:Number,json:{origins:{"web-document":{default:1,write:{enabled:!0,target:{opacity:{type:Number},"layerDefinition.drawingInfo.transparency":{type:Number}}},read:{source:["opacity","layerDefinition.drawingInfo.transparency"],reader(e,t){if("number"==typeof e&&e>=0&&e<=1)return e;const r=t.layerDefinition?.drawingInfo?.transparency;return void 0!==r?we(r):void 0}}},"portal-item":{write:!0},service:{read:!1}}}})],je.prototype,"opacity",void 0),e([y({type:["Low","High"],readOnly:!0,json:{read:!1,origins:{service:{read:!0}}}})],je.prototype,"priority",void 0),e([y({type:["Labels"],readOnly:!0,json:{read:!1,origins:{service:{read:!0}}}})],je.prototype,"semantic",void 0),e([y({types:de,json:{origins:{service:{read:{source:"drawingInfo.renderer"}}},name:"layerDefinition.drawingInfo.renderer",write:!0},value:null})],je.prototype,"renderer",null),e([y({json:{read:!1}})],je.prototype,"cachedDrawingInfo",void 0),e([h("service","cachedDrawingInfo")],je.prototype,"readCachedDrawingInfo",null),e([y({readOnly:!0,json:{read:!1}})],je.prototype,"capabilities",null),e([y({type:Boolean,json:{read:!1}})],je.prototype,"editingEnabled",null),e([y({readOnly:!0,json:{write:!1,read:!1}})],je.prototype,"infoFor3D",null),e([y({readOnly:!0,json:{write:!1,read:!1}})],je.prototype,"relationships",null),e([y(G)],je.prototype,"popupEnabled",void 0),e([y({type:r,json:{name:"popupInfo",write:!0}})],je.prototype,"popupTemplate",void 0),e([y({readOnly:!0,json:{read:!1}})],je.prototype,"defaultPopupTemplate",null),e([y({type:String,json:{read:!1}})],je.prototype,"objectIdField",void 0),e([h("service","objectIdField",["objectIdField","fields"])],je.prototype,"readObjectIdField",null),e([y({type:String,json:{read:!1}})],je.prototype,"globalIdField",void 0),e([h("service","globalIdField",["globalIdField","fields"])],je.prototype,"readGlobalIdField",null),e([y({readOnly:!0,type:String,json:{read:!1}})],je.prototype,"displayField",null),e([y({type:String,json:{read:!1}})],je.prototype,"profile",void 0),e([h("service","profile",["store.profile"])],je.prototype,"readProfile",null),e([y({readOnly:!0,type:String,json:{origins:{service:{read:{source:"store.normalReferenceFrame"}}},read:!1}})],je.prototype,"normalReferenceFrame",void 0),e([y(N)],je.prototype,"screenSizePerspectiveEnabled",void 0),e([y({json:{read:!1,origins:{service:{read:!0}}}})],je.prototype,"serviceItemId",void 0),e([y(T)],je.prototype,"useViewTime",null),je=e([f("esri.layers.SceneLayer")],je);const Fe={"mesh-pyramids":"mesh-pyramids",meshpyramids:"mesh-pyramids","features-meshes":"mesh-pyramids",points:"points","features-points":"points",lines:"lines","features-lines":"lines",polygons:"polygons","features-polygons":"polygons"},Se={"mesh-pyramids":"mesh",points:"point"},_e=je;export{_e as default};
5
+ import{_ as e}from"../chunks/tslib.es6.js";import t from"../Graphic.js";import r from"../PopupTemplate.js";import i from"../core/Clonable.js";import s from"../core/Collection.js";import o from"../core/Error.js";import a from"../core/Logger.js";import{destroyMaybe as n}from"../core/maybe.js";import{MultiOriginJSONMixin as l}from"../core/MultiOriginJSONSupport.js";import{throwIfAbortError as p,isAbortError as d}from"../core/promiseUtils.js";import{whenOnce as u}from"../core/reactiveUtils.js";import{property as y}from"../core/accessorSupport/decorators/property.js";import"../core/has.js";import"../core/RandomLCG.js";import{getProperties as c}from"../core/accessorSupport/utils.js";import{reader as h}from"../core/accessorSupport/decorators/reader.js";import{subclass as f}from"../core/accessorSupport/decorators/subclass.js";import{OriginId as m}from"../core/accessorSupport/PropertyOrigin.js";import g from"../geometry/Point.js";import v from"./Layer.js";import{NoModelError as b,MultipleModelsError as w}from"./graphics/sources/support/uploadAssetErrors.js";import{APIKeyMixin as I}from"./mixins/APIKeyMixin.js";import{ArcGISService as L}from"./mixins/ArcGISService.js";import{CustomParametersMixin as j}from"./mixins/CustomParametersMixin.js";import{EditBusLayer as F}from"./mixins/EditBusLayer.js";import{OperationalLayer as S}from"./mixins/OperationalLayer.js";import{PortalLayer as _}from"./mixins/PortalLayer.js";import{ScaleRangeLayer as A}from"./mixins/ScaleRangeLayer.js";import{SceneService as O,SaveOperationType as P}from"./mixins/SceneService.js";import{useViewTimeProperty as E}from"./mixins/TemporalLayer.js";import{TemporalSceneLayer as T}from"./mixins/TemporalSceneLayer.js";import{isHostedAgolService as x}from"./support/arcgisLayerUrl.js";import{findAssociatedFeatureService as D}from"./support/associatedFeatureServiceUtils.js";import{zeroCapabilities as U}from"./support/capabilities.js";import{elevationInfo as R,labelsVisible as q,legendEnabled as C,popupEnabled as G,screenSizePerspectiveEnabled as N}from"./support/commonProperties.js";import{getFieldDomain as Q,computeEffectiveEditingEnabled as V,getGlobalIdToObjectIdMap as M}from"./support/featureLayerUtils.js";import{FeatureReduction as k}from"./support/FeatureReduction.js";import K from"./support/FeatureReductionSelection.js";import{defineFieldProperties as $}from"./support/fieldProperties.js";import H from"./support/FieldsIndex.js";import{fixRendererFields as z,unpackFieldNames as W}from"./support/fieldUtils.js";import{I3SNodePageDefinition as Z,I3SMaterialDefinition as B,I3STextureSetDefinition as J,I3SGeometryDefinition as X}from"./support/I3SLayerDefinitions.js";import{isFileEditFormat as Y,isFileSupported as ee}from"./support/infoFor3D.js";import te from"./support/LabelClass.js";import{reader as re}from"./support/labelingInfo.js";import ie from"./support/LayerFloorInfo.js";import{layerLookupMap as se}from"./support/lazyLayerLoader.js";import{getMeshTransformForMetersToSpatialReference as oe}from"./support/meshSpatialReferenceScaleUtils.js";import{RangeInfo as ae}from"./support/RangeInfo.js";import ne from"./support/SceneFilter.js";import{cacheIsOutOfSync as le}from"./support/sceneLayerCacheUtils.js";import{fetchStatistics as pe}from"./support/sceneLayerStatistics.js";import{loadStyleRenderer as de}from"../renderers/support/styleUtils.js";import{webSceneRendererTypes as ue}from"../renderers/support/typeUtils.js";import ye from"../rest/support/Query.js";import{logInvalidElevationInfoWarning as ce,elevationModeUnsupportedMessage as he,featureExpressionUnsupportedMessage as fe}from"../support/elevationInfoUtils.js";import{createPopupTemplate as me}from"../support/popupUtils.js";import{extractZipFiles as ge}from"../support/zipUtils.js";import{queryAttributesFromCachedAttributesId as ve}from"../views/3d/layers/i3s/I3SUtil.js";import{getRequiredFields as be,getFetchPopupTemplate as we}from"../views/layers/support/popupUtils.js";import{transparencyToOpacity as Ie}from"../webdoc/support/opacityUtils.js";const Le=new Set(["3DObject","Point"]),je=$();let Fe=class extends(T(F(O(L(S(_(A(l(j(I(i.ClonableMixin(v)))))))))))){constructor(...e){super(...e),this.featureReduction=null,this.rangeInfos=null,this.operationalLayerType="ArcGISSceneServiceLayer",this.type="scene",this.fields=null,this.floorInfo=null,this.outFields=null,this.nodePages=null,this.materialDefinitions=null,this.textureSetDefinitions=null,this.geometryDefinitions=null,this.serviceUpdateTimeStamp=null,this.excludeObjectIds=new s,this.definitionExpression=null,this.filter=null,this.path=null,this.labelsVisible=!0,this.labelingInfo=null,this.legendEnabled=!0,this.priority=null,this.semantic=null,this.cachedDrawingInfo={color:!1},this.popupEnabled=!0,this.popupTemplate=null,this.objectIdField=null,this.globalIdField=null,this._fieldUsageInfo={},this.screenSizePerspectiveEnabled=!0,this.serviceItemId=void 0}normalizeCtorArgs(e,t){return"string"==typeof e?{url:e,...t}:e}destroy(){this._set("renderer",null),this.associatedLayer=n(this.associatedLayer)}getField(e){return this.fieldsIndex.get(e)}getFieldDomain(e,t){const r=this.getField(e)?.domain??null;return this.associatedLayer?Q(this.associatedLayer,e,t,r):r}getFeatureType(e){return e&&this.associatedLayer?this.associatedLayer.getFeatureType(e):null}get types(){return this.associatedLayer?.types??[]}get typeIdField(){return this.associatedLayer?.typeIdField??null}get templates(){return this.associatedLayer?.templates??null}get formTemplate(){return this.associatedLayer?.formTemplate??null}get attributeTableTemplate(){return this.associatedLayer?.attributeTableTemplate??null}get fieldsIndex(){return new H(this.fields)}readNodePages(e,t,r){return"Point"===t.layerType&&(e=t.pointNodePages),null==e||"object"!=typeof e?null:Z.fromJSON(e,r)}set elevationInfo(e){this._set("elevationInfo",e),this.loaded&&this._validateElevationInfo()}get effectiveCapabilities(){return this._capabilitiesFromAssociatedFeatureLayer(this.associatedLayer?.effectiveCapabilities)}get effectiveEditingEnabled(){return null!=this.associatedLayer&&V(this.associatedLayer)}get geometryType(){return _e[this.profile]||"mesh"}set renderer(e){z(e,this.fieldsIndex),this._set("renderer",e)}readCachedDrawingInfo(e){return null!=e&&"object"==typeof e||(e={}),null==e.color&&(e.color=!1),e}get capabilities(){return this._capabilitiesFromAssociatedFeatureLayer(this.associatedLayer?.capabilities)}_capabilitiesFromAssociatedFeatureLayer(e){e=null!=e?e:U;const{query:t,queryRelated:r,editing:{supportsGlobalId:i,supportsRollbackOnFailure:s,supportsUploadWithItemId:o,supportsGeometryUpdate:a,supportsReturnServiceEditsInSourceSpatialReference:n},data:{supportsZ:l,supportsM:p,isVersioned:d,supportsAttachment:u},operations:{supportsEditing:y,supportsAdd:c,supportsUpdate:h,supportsDelete:f,supportsQuery:m,supportsQueryAttachments:g,supportsAsyncConvert3D:v}}=e,b=e.operations.supportsChangeTracking,w=!!this.associatedLayer?.infoFor3D;return{query:t,queryRelated:r,editing:{supportsGlobalId:i,supportsReturnServiceEditsInSourceSpatialReference:n,supportsRollbackOnFailure:s,supportsGeometryUpdate:w&&a,supportsUploadWithItemId:o},data:{supportsAttachment:u,supportsZ:l,supportsM:p,isVersioned:d},operations:{supportsQuery:m,supportsQueryAttachments:g,supportsEditing:y&&b,supportsAdd:w&&c&&b,supportsDelete:w&&f&&b,supportsUpdate:h&&b,supportsAsyncConvert3D:v}}}get editingEnabled(){return this._isOverridden("editingEnabled")?this._get("editingEnabled"):this.associatedLayer?.editingEnabled??!1}set editingEnabled(e){this._overrideIfSome("editingEnabled",e)}get infoFor3D(){return this.associatedLayer?.infoFor3D??null}get relationships(){return this.associatedLayer?.relationships}get defaultPopupTemplate(){return this.associatedLayer||this.attributeStorageInfo?this.createPopupTemplate():null}readObjectIdField(e,t){return!e&&t.fields&&t.fields.some((t=>("esriFieldTypeOID"===t.type&&(e=t.name),!!e))),e||void 0}readGlobalIdField(e,t){return!e&&t.fields&&t.fields.some((t=>("esriFieldTypeGlobalID"===t.type&&(e=t.name),!!e))),e||void 0}get displayField(){return this.associatedLayer?.displayField??null}readProfile(e,t){const r=t.store.profile;return null!=r&&Se[r]?Se[r]:(a.getLogger(this).error("Unknown or missing profile",{profile:r,layer:this}),"mesh-pyramids")}get useViewTime(){return this.associatedLayer?.useViewTime??!0}set useViewTime(e){this._override("useViewTime",e)}load(e){return this.addResolvingPromise(this._load(e)),Promise.resolve(this)}async _load(e){const t=null!=e?e.signal:null;await this.loadFromPortal({supportedTypes:["Scene Service"]},e).catch(p),await this._fetchService(t),await Promise.all([this._fetchIndexAndUpdateExtent(this.nodePages,t),this._setAssociatedFeatureLayer(t),this._loadFilterGeometries()]),this._validateElevationInfo(),this._applyAssociatedLayerOverrides(),this._populateFieldUsageInfo(),await this.loadTimeInfoFromService(e),await de(this,{origin:"service"},t),z(this.renderer,this.fieldsIndex),await this.finishLoadEditablePortalLayer(e)}async beforeSave(){null!=this.filter&&(this.filter=this.filter.clone(),await this.load())}async _loadFilterGeometries(){if(this.filter)try{await this.filter.loadGeometries(this.spatialReference)}catch(e){a.getLogger(this).error("#_loadFilterGeometries()",this,"Failed to load filter geometries. Geometry filter will not be applied for this layer.",{error:e}),this.filter=null}}createQuery(){const e=new ye;return"mesh"===this.geometryType?this.capabilities.query.supportsReturnMesh&&(e.returnGeometry=!0):(e.returnGeometry=!0,e.returnZ=!0),e.where=this.definitionExpression||"1=1",e.sqlFormat="standard",e.outFields=["*"],e}queryExtent(e,t){return this._getAssociatedLayerForQuery().then((r=>r.queryExtent(e||this.createQuery(),t)))}queryFeatureCount(e,t){return this._getAssociatedLayerForQuery().then((r=>r.queryFeatureCount(e||this.createQuery(),t)))}queryFeatures(e,t){return this._getAssociatedLayerForQuery().then((r=>r.queryFeatures(e||this.createQuery(),t))).then((e=>{if(e?.features)for(const t of e.features)t.layer=this,t.sourceLayer=this;return e}))}async queryRelatedFeatures(e,t){if(await this.load(),!this.associatedLayer)throw new o("scenelayer:query-not-available","SceneLayer queries are not available without an associated feature layer",{layer:this});return this.associatedLayer.queryRelatedFeatures(e,t)}async queryRelatedFeaturesCount(e,t){if(await this.load(),!this.associatedLayer)throw new o("scenelayer:query-not-available","SceneLayer queries are not available without an associated feature layer",{layer:this});return this.associatedLayer.queryRelatedFeaturesCount(e,t)}async queryCachedAttributes(e,t){const r=W(this.fieldsIndex,await be(this,we(this)));return ve(this.parsedUrl?.path??"",this.attributeStorageInfo??[],e,t,r,this.apiKey,this.customParameters)}async queryCachedFeature(e,r){const i=await this.queryCachedAttributes(e,[r]);if(!i||0===i.length)throw new o("scenelayer:feature-not-in-cached-data","Feature not found in cached data");const s=new t;return s.attributes=i[0],s.layer=this,s.sourceLayer=this,s}queryObjectIds(e,t){return this._getAssociatedLayerForQuery().then((r=>r.queryObjectIds(e||this.createQuery(),t)))}queryAttachments(e,t){return this._getAssociatedLayerForQuery().then((r=>r.queryAttachments(e,t)))}getFieldUsageInfo(e){const t={supportsLabelingInfo:!1,supportsRenderer:!1,supportsPopupTemplate:!1,supportsLayerQuery:!1};return this.loaded?this._fieldUsageInfo[e]||t:(a.getLogger(this).error("#getFieldUsageInfo()","Unavailable until layer is loaded"),t)}createPopupTemplate(e){return me(this,e)}_getAssociatedLayerForQuery(){const e=this.associatedLayer;return e?.loaded?Promise.resolve(e):this._loadAssociatedLayerForQuery()}async _loadAssociatedLayerForQuery(){if(await this.load(),!this.associatedLayer)throw new o("scenelayer:query-not-available","SceneLayer queries are not available without an associated feature layer",{layer:this});try{await this.associatedLayer.load()}catch(e){throw new o("scenelayer:query-not-available","SceneLayer associated feature layer could not be loaded",{layer:this,error:e})}return this.associatedLayer}hasCachedStatistics(e){return null!=this.statisticsInfo&&this.statisticsInfo.some((t=>t.name===e))}async queryCachedStatistics(e,t){return await this.load(t),await this.fetchStatistics(e,t)}async saveAs(e,t){return this._debouncedSaveOperations(P.SAVE_AS,{...t,getTypeKeywords:()=>this._getTypeKeywords(),portalItemLayerType:"scene"},e)}async save(){const e={getTypeKeywords:()=>this._getTypeKeywords(),portalItemLayerType:"scene"};return this._debouncedSaveOperations(P.SAVE,e)}async applyEdits(e,t){const{applyEdits:r}=await import("./graphics/editingSupport.js");let i=t;await this.load();const s=this.associatedLayer;if(!s)throw new o(`${this.type}-layer:not-editable`,"Service is not editable");await s.load();const{globalIdField:a}=s,n=!!s.infoFor3D,l=i?.globalIdUsed??!0;if(n&&null==a)throw new o(`${this.type}-layer:not-editable`,"Valid globalIdField expected on editable SceneLayer");if(n&&!l)throw new o(`${this.type}-layer:globalid-required`,"globalIdUsed must not be false for SceneLayer editing as globalIds are required.");return x(s.url)&&n&&null!=e.deleteFeatures&&null!=a&&(i={...i,globalIdToObjectId:await M(s,e.deleteFeatures,a)}),r(this,s.source,e,i)}async uploadAssets(e,t){if(await this.load(),null==this.associatedLayer)throw new o(`${this.type}-layer:not-editable`,"Service is not editable");return await this.associatedLayer.load(),this.associatedLayer.uploadAssets(e,t)}on(e,t){return super.on(e,t)}async convertMesh(e,t){t??={};const r=e=>{throw a.getLogger(this).error(".convertMesh()",e.message),e};await this.load(),this.infoFor3D||r(new o("invalid:layer","SceneLayer has no capability for mesh conversion"));const i=await this.extractAndFilterFiles(e),s=i.reduce(((e,t)=>Y(this.infoFor3D,t)?e+1:e),0);0===s&&r(new b),s>1&&r(new w);const n=this.spatialReference,l=t.location??new g({x:0,y:0,z:0,spatialReference:n}),p=l.spatialReference.isGeographic?"local":"georeferenced",{default:d}=await import("../geometry/Mesh.js"),u=d.createWithExternalSource(l,i,{vertexSpace:p,transform:oe(l.spatialReference),unitConversionDisabled:!0}),[y]=await this.uploadAssets([u],{...t,useAssetOrigin:!t.location});return y}async extractAndFilterFiles(e){await this.load();const t=this.infoFor3D;if(!t)return e;return(await ge(e)).filter((e=>ee(t,e)))}validateLayer(e){if(e.layerType&&!Le.has(e.layerType))throw new o("scenelayer:layer-type-not-supported","SceneLayer does not support this layer type",{layerType:e.layerType});if(isNaN(this.version.major)||isNaN(this.version.minor))throw new o("layer:service-version-not-supported","Service version is not supported.",{serviceVersion:this.version.versionString,supportedVersions:"1.x, 2.x"});if(this.version.major>2)throw new o("layer:service-version-too-new","Service version is too new.",{serviceVersion:this.version.versionString,supportedVersions:"1.x, 2.x"});function t(e,t){let r=!1,i=!1;if(null==e)r=!0,i=!0;else{const s=t&&t.isGeographic;switch(e){case"east-north-up":case"earth-centered":r=!0,i=s;break;case"vertex-reference-frame":r=!0,i=!s;break;default:r=!1}}if(!r)throw new o("scenelayer:unsupported-normal-reference-frame","Normal reference frame is invalid.");if(!i)throw new o("scenelayer:incompatible-normal-reference-frame","Normal reference frame is incompatible with layer spatial reference.")}t(this.normalReferenceFrame,this.spatialReference)}_getTypeKeywords(){const e=[];if("points"===this.profile)e.push("Point");else{if("mesh-pyramids"!==this.profile)throw new o("scenelayer:unknown-profile","SceneLayer:save() encountered an unknown SceneLayer profile: "+this.profile);e.push("3DObject")}return e}_populateFieldUsageInfo(){if(this._fieldUsageInfo={},this.fields)for(const e of this.fields){const t=!!this.attributeStorageInfo?.some((t=>t.name===e.name)),r=!!this.associatedLayer?.fields?.some((t=>t&&e.name===t.name)),i={supportsLabelingInfo:t,supportsRenderer:t,supportsPopupTemplate:t||r,supportsLayerQuery:r};this._fieldUsageInfo[e.name]=i}}_applyAssociatedLayerOverrides(){this._applyAssociatedLayerFieldsOverrides(),this._applyAssociatedLayerPopupOverrides(),this._applyAssociatedLayerExtentOverride(),this._applyAssociatedLayerPrivileges()}_applyAssociatedLayerFieldsOverrides(){if(!this.associatedLayer?.fields)return;let e=null;for(const t of this.associatedLayer.fields){const r=this.getField(t.name);r?(!r.domain&&t.domain&&(r.domain=t.domain.clone()),r.editable=t.editable,r.nullable=t.nullable,r.length=t.length):(e||(e=this.fields?this.fields.slice():[]),e.push(t.clone()))}e&&this._set("fields",e)}_applyAssociatedLayerPopupOverrides(){if(!this.associatedLayer)return;const e=["popupTemplate","popupEnabled"],t=c(this);for(let r=0;r<e.length;r++){const i=e[r],s=this.originIdOf(i),o=this.associatedLayer.originIdOf(i);s<o&&(o===m.SERVICE||o===m.PORTAL_ITEM)&&t.setAtOrigin(i,this.associatedLayer[i],o)}}_applyAssociatedLayerExtentOverride(){const e=this.associatedLayer?.getAtOrigin("fullExtent","service");if(null==this.associatedLayer?.infoFor3D||!e||!x(this.associatedLayer?.url)||!le(this))return;c(this).setAtOrigin("fullExtent",e.clone(),m.SERVICE)}_applyAssociatedLayerPrivileges(){const e=this.associatedLayer;e&&(this._set("userHasEditingPrivileges",e.userHasEditingPrivileges),this._set("userHasFullEditingPrivileges",e.userHasFullEditingPrivileges),this._set("userHasUpdateItemPrivileges",e.userHasUpdateItemPrivileges))}async _setAssociatedFeatureLayer(e){if(["mesh-pyramids","points"].includes(this.profile))try{const{serverUrl:t,layerId:r,portalItem:i}=await D(`${this.url}/layers/${this.layerId}`,{sceneLayerItem:this.portalItem,customParameters:this.customParameters,apiKey:this.apiKey,signal:e}),s=await se.FeatureLayer();this.associatedLayer=new s({url:t,customParameters:this.customParameters,layerId:r,portalItem:i}),await this.associatedLayer.load()}catch(t){d(t)||this._logWarningOnPopupEnabled()}}async _logWarningOnPopupEnabled(){await u((()=>this.popupEnabled&&null!=this.popupTemplate));const e=`this SceneLayer: ${this.title}`;null==this.attributeStorageInfo?a.getLogger(this).warn(`Associated FeatureLayer could not be loaded and no binary attributes found. Popups will not work on ${e}`):a.getLogger(this).info(`Associated FeatureLayer could not be loaded. Falling back to binary attributes for Popups on ${e}`)}_validateElevationInfo(){const e=this.elevationInfo;"mesh-pyramids"===this.profile&&ce(a.getLogger(this),he("Mesh scene layers","relative-to-scene",e)),ce(a.getLogger(this),fe("Scene layers",e))}async fetchStatistics(e,t){return await pe({fieldName:e,statisticsInfo:this.statisticsInfo,errorContext:"scenelayer",fieldsIndex:this.fieldsIndex,path:this.parsedUrl?.path??"",customParameters:this.customParameters,apiKey:this.apiKey,signal:t?.signal})}};e([y({types:{key:"type",base:k,typeMap:{selection:K}},json:{origins:{"web-scene":{name:"layerDefinition.featureReduction",write:!0},"portal-item":{name:"layerDefinition.featureReduction",write:!0}}}})],Fe.prototype,"featureReduction",void 0),e([y({type:[ae],json:{read:!1,origins:{"web-scene":{name:"layerDefinition.rangeInfos",write:!0},"portal-item":{name:"layerDefinition.rangeInfos",write:!0}}}})],Fe.prototype,"rangeInfos",void 0),e([y({json:{read:!1}})],Fe.prototype,"associatedLayer",void 0),e([y({type:["show","hide"]})],Fe.prototype,"listMode",void 0),e([y({type:["ArcGISSceneServiceLayer"]})],Fe.prototype,"operationalLayerType",void 0),e([y({json:{read:!1},readOnly:!0})],Fe.prototype,"type",void 0),e([y({...je.fields,readOnly:!0,json:{read:!1,origins:{service:{read:!0}}}})],Fe.prototype,"fields",void 0),e([y()],Fe.prototype,"types",null),e([y()],Fe.prototype,"typeIdField",null),e([y()],Fe.prototype,"templates",null),e([y()],Fe.prototype,"formTemplate",null),e([y()],Fe.prototype,"attributeTableTemplate",null),e([y({readOnly:!0,clonable:!1})],Fe.prototype,"fieldsIndex",null),e([y({type:ie,json:{read:{source:"layerDefinition.floorInfo"},write:{target:"layerDefinition.floorInfo"}}})],Fe.prototype,"floorInfo",void 0),e([y(je.outFields)],Fe.prototype,"outFields",void 0),e([y({type:Z,readOnly:!0,json:{read:!1}})],Fe.prototype,"nodePages",void 0),e([h("service","nodePages",["nodePages","pointNodePages"])],Fe.prototype,"readNodePages",null),e([y({type:[B],readOnly:!0})],Fe.prototype,"materialDefinitions",void 0),e([y({type:[J],readOnly:!0})],Fe.prototype,"textureSetDefinitions",void 0),e([y({type:[X],readOnly:!0})],Fe.prototype,"geometryDefinitions",void 0),e([y({readOnly:!0})],Fe.prototype,"serviceUpdateTimeStamp",void 0),e([y({readOnly:!0})],Fe.prototype,"attributeStorageInfo",void 0),e([y({readOnly:!0})],Fe.prototype,"statisticsInfo",void 0),e([y({type:s.ofType(Number),nonNullable:!0,json:{origins:{service:{read:!1,write:!1}},name:"layerDefinition.excludeObjectIds",write:{enabled:!0}}})],Fe.prototype,"excludeObjectIds",void 0),e([y({type:String,json:{origins:{service:{read:!1,write:!1}},name:"layerDefinition.definitionExpression",write:{enabled:!0,allowNull:!0}}})],Fe.prototype,"definitionExpression",void 0),e([y({type:ne,json:{name:"layerDefinition.polygonFilter",write:{enabled:!0,allowNull:!0},origins:{service:{read:!1,write:!1}}}})],Fe.prototype,"filter",void 0),e([y({type:String,json:{origins:{"web-scene":{read:!0,write:!0}},read:!1}})],Fe.prototype,"path",void 0),e([y(R)],Fe.prototype,"elevationInfo",null),e([y({readOnly:!0,json:{read:!1}})],Fe.prototype,"effectiveCapabilities",null),e([y({readOnly:!0})],Fe.prototype,"effectiveEditingEnabled",null),e([y({type:String})],Fe.prototype,"geometryType",null),e([y(q)],Fe.prototype,"labelsVisible",void 0),e([y({type:[te],json:{origins:{service:{name:"drawingInfo.labelingInfo",read:{reader:re},write:!1}},name:"layerDefinition.drawingInfo.labelingInfo",read:{reader:re},write:!0}})],Fe.prototype,"labelingInfo",void 0),e([y(C)],Fe.prototype,"legendEnabled",void 0),e([y({type:Number,json:{origins:{"web-document":{default:1,write:{enabled:!0,target:{opacity:{type:Number},"layerDefinition.drawingInfo.transparency":{type:Number}}},read:{source:["opacity","layerDefinition.drawingInfo.transparency"],reader(e,t){if("number"==typeof e&&e>=0&&e<=1)return e;const r=t.layerDefinition?.drawingInfo?.transparency;return void 0!==r?Ie(r):void 0}}},"portal-item":{write:!0},service:{read:!1}}}})],Fe.prototype,"opacity",void 0),e([y({type:["Low","High"],readOnly:!0,json:{read:!1,origins:{service:{read:!0}}}})],Fe.prototype,"priority",void 0),e([y({type:["Labels"],readOnly:!0,json:{read:!1,origins:{service:{read:!0}}}})],Fe.prototype,"semantic",void 0),e([y({types:ue,json:{origins:{service:{read:{source:"drawingInfo.renderer"}}},name:"layerDefinition.drawingInfo.renderer",write:!0},value:null})],Fe.prototype,"renderer",null),e([y({json:{read:!1}})],Fe.prototype,"cachedDrawingInfo",void 0),e([h("service","cachedDrawingInfo")],Fe.prototype,"readCachedDrawingInfo",null),e([y({readOnly:!0,json:{read:!1}})],Fe.prototype,"capabilities",null),e([y({type:Boolean,json:{read:!1}})],Fe.prototype,"editingEnabled",null),e([y({readOnly:!0,json:{write:!1,read:!1}})],Fe.prototype,"infoFor3D",null),e([y({readOnly:!0,json:{write:!1,read:!1}})],Fe.prototype,"relationships",null),e([y(G)],Fe.prototype,"popupEnabled",void 0),e([y({type:r,json:{name:"popupInfo",write:!0}})],Fe.prototype,"popupTemplate",void 0),e([y({readOnly:!0,json:{read:!1}})],Fe.prototype,"defaultPopupTemplate",null),e([y({type:String,json:{read:!1}})],Fe.prototype,"objectIdField",void 0),e([h("service","objectIdField",["objectIdField","fields"])],Fe.prototype,"readObjectIdField",null),e([y({type:String,json:{read:!1}})],Fe.prototype,"globalIdField",void 0),e([h("service","globalIdField",["globalIdField","fields"])],Fe.prototype,"readGlobalIdField",null),e([y({readOnly:!0,type:String,json:{read:!1}})],Fe.prototype,"displayField",null),e([y({type:String,json:{read:!1}})],Fe.prototype,"profile",void 0),e([h("service","profile",["store.profile"])],Fe.prototype,"readProfile",null),e([y({readOnly:!0,type:String,json:{origins:{service:{read:{source:"store.normalReferenceFrame"}}},read:!1}})],Fe.prototype,"normalReferenceFrame",void 0),e([y(N)],Fe.prototype,"screenSizePerspectiveEnabled",void 0),e([y({json:{read:!1,origins:{service:{read:!0}}}})],Fe.prototype,"serviceItemId",void 0),e([y(E)],Fe.prototype,"useViewTime",null),Fe=e([f("esri.layers.SceneLayer")],Fe);const Se={"mesh-pyramids":"mesh-pyramids",meshpyramids:"mesh-pyramids","features-meshes":"mesh-pyramids",points:"points","features-points":"points",lines:"lines","features-lines":"lines",polygons:"polygons","features-polygons":"polygons"},_e={"mesh-pyramids":"mesh",points:"point"},Ae=Fe;export{Ae 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.32/esri/copyright.txt for details.
4
4
  */
5
- import{_ as e}from"../../chunks/tslib.es6.js";import t from"../../Graphic.js";import r from"../../PopupTemplate.js";import o from"../../request.js";import s from"../../core/Error.js";import{JSONMap as i}from"../../core/jsonMap.js";import a from"../../core/Loadable.js";import n from"../../core/Logger.js";import p from"../../core/Promise.js";import{property as l}from"../../core/accessorSupport/decorators/property.js";import"../../core/has.js";import"../../core/RandomLCG.js";import{enumeration as u}from"../../core/accessorSupport/decorators/enumeration.js";import{reader as y}from"../../core/accessorSupport/decorators/reader.js";import{subclass as d}from"../../core/accessorSupport/decorators/subclass.js";import c from"../../geometry/Extent.js";import m from"../../geometry/SpatialReference.js";import h from"../FeatureLayer.js";import f from"./BuildingSublayer.js";import{zeroCapabilities as g}from"../support/capabilities.js";import{popupEnabled as j}from"../support/commonProperties.js";import{defineFieldProperties as v}from"../support/fieldProperties.js";import b from"../support/FieldsIndex.js";import{unpackFieldNames as L}from"../support/fieldUtils.js";import{fetchIndexInfo as I}from"../support/I3SIndexInfo.js";import{I3SNodePageDefinition as S,I3SMaterialDefinition as F,I3STextureSetDefinition as w,I3SGeometryDefinition as O}from"../support/I3SLayerDefinitions.js";import{webSceneRendererTypes as x}from"../../renderers/support/typeUtils.js";import P from"../../rest/support/Query.js";import{isNumber as T}from"../../support/guards.js";import{createPopupTemplate as q}from"../../support/popupUtils.js";import U from"../../symbols/support/ElevationInfo.js";import{queryAttributesFromCachedAttributesId as E}from"../../views/3d/layers/i3s/I3SUtil.js";import{getRequiredFields as Q,getFetchPopupTemplate as D}from"../../views/layers/support/popupUtils.js";const R=v();let A=class extends(a.LoadableMixin(p.EsriPromiseMixin(f))){constructor(e){super(e),this.type="building-component",this.nodePages=null,this.materialDefinitions=[],this.textureSetDefinitions=[],this.geometryDefinitions=[],this.indexInfo=null,this.serviceUpdateTimeStamp=null,this.store=null,this.attributeStorageInfo=[],this.fields=[],this.associatedLayer=null,this.outFields=null,this.listMode="show",this.renderer=null,this.definitionExpression=null,this.popupEnabled=!0,this.popupTemplate=null,this.layerType="3d-object"}get parsedUrl(){return this.layer?{path:`${this.layer.parsedUrl?.path}/sublayers/${this.id}`,query:this.layer.parsedUrl?.query}:{path:""}}get fieldsIndex(){return new b(this.fields)}readAssociatedLayer(e,t){const r=this.layer.associatedFeatureServiceItem,o=t.associatedLayerID;return null!=r&&"number"==typeof o?new h({portalItem:r,customParameters:this.customParameters,layerId:o}):null}get objectIdField(){if(null!=this.fields)for(const e of this.fields)if("oid"===e.type)return e.name;return null}get displayField(){return null!=this.associatedLayer?this.associatedLayer.displayField:void 0}get apiKey(){return this.layer.apiKey}get customParameters(){return this.layer.customParameters}get fullExtent(){return this.layer.fullExtent}get spatialReference(){return this.layer.spatialReference}get version(){return this.layer.version}get elevationInfo(){return this.layer.elevationInfo}get minScale(){return this.layer.minScale}get maxScale(){return this.layer.maxScale}get effectiveScaleRange(){return this.layer.effectiveScaleRange}get defaultPopupTemplate(){return this.createPopupTemplate()}load(e){const t=null!=e?e.signal:null,r=this._fetchService(t).then((()=>{this.indexInfo=I(this.parsedUrl.path,this.rootNode,this.nodePages,this.customParameters,this.apiKey,n.getLogger(this),t)}));return this.addResolvingPromise(r),Promise.resolve(this)}createPopupTemplate(e){return q(this,e)}async _fetchService(e){const t=(await o(this.parsedUrl.path,{query:{f:"json",...this.customParameters,token:this.apiKey},responseType:"json",signal:e})).data;this.read(t,{origin:"service",url:this.parsedUrl})}getField(e){return this.fieldsIndex.get(e)}getFieldDomain(e,t){const r=this.getFeatureType(t?.feature)?.domains?.[e];return r&&"inherited"!==r.type?r:this.getField(e)?.domain??null}getFeatureType(e){return e&&null!=this.associatedLayer?this.associatedLayer.getFeatureType(e):null}get types(){return null!=this.associatedLayer?this.associatedLayer.types??[]:[]}get typeIdField(){return null!=this.associatedLayer?this.associatedLayer.typeIdField:null}get geometryType(){return"3d-object"===this.layerType?"mesh":"point"}get profile(){return"3d-object"===this.layerType?"mesh-pyramids":"points"}get capabilities(){const e=null!=this.associatedLayer&&this.associatedLayer.capabilities?this.associatedLayer.capabilities:g,{query:t,data:{supportsZ:r,supportsM:o,isVersioned:s}}=e;return{query:t,data:{supportsZ:r,supportsM:o,isVersioned:s}}}createQuery(){const e=new P;return"mesh"!==this.geometryType&&(e.returnGeometry=!0,e.returnZ=!0),e.where=this.definitionExpression||"1=1",e.sqlFormat="standard",e}queryExtent(e,t){return this._getAssociatedLayerForQuery().then((r=>r.queryExtent(e||this.createQuery(),t)))}queryFeatureCount(e,t){return this._getAssociatedLayerForQuery().then((r=>r.queryFeatureCount(e||this.createQuery(),t)))}queryFeatures(e,t){return this._getAssociatedLayerForQuery().then((r=>r.queryFeatures(e||this.createQuery(),t))).then((e=>{if(e?.features)for(const t of e.features)t.layer=this.layer,t.sourceLayer=this;return e}))}async queryObjectIds(e,t){const r=await this._getAssociatedLayerForQuery();return(await r.queryObjectIds(e||this.createQuery(),t)).filter(T)}async queryCachedAttributes(e,t){const r=L(this.fieldsIndex,await Q(this,D(this)));return E(this.parsedUrl.path,this.attributeStorageInfo,e,t,r,this.apiKey,this.customParameters)}async queryCachedFeature(e,r){const o=await this.queryCachedAttributes(e,[r]);if(!o||0===o.length)throw new s("scenelayer:feature-not-in-cached-data","Feature not found in cached data");return new t({attributes:o[0],layer:this,sourceLayer:this})}getFieldUsageInfo(e){return this.fieldsIndex.has(e)?{supportsLabelingInfo:!1,supportsRenderer:!1,supportsPopupTemplate:!1,supportsLayerQuery:!1}:{supportsLabelingInfo:!1,supportsRenderer:!0,supportsPopupTemplate:!0,supportsLayerQuery:null!=this.associatedLayer}}_getAssociatedLayerForQuery(){const e=this.associatedLayer;return null!=e&&e.loaded?Promise.resolve(e):this._loadAssociatedLayerForQuery()}async _loadAssociatedLayerForQuery(){if(await this.load(),null==this.associatedLayer)throw new s("buildingscenelayer:query-not-available","BuildingSceneLayer component layer queries are not available without an associated feature layer",{layer:this});try{await this.associatedLayer.load()}catch(e){throw new s("buildingscenelayer:query-not-available","BuildingSceneLayer associated feature layer could not be loaded",{layer:this,error:e})}return this.associatedLayer}};e([l({readOnly:!0})],A.prototype,"parsedUrl",null),e([l({type:S,readOnly:!0})],A.prototype,"nodePages",void 0),e([l({type:[F],readOnly:!0})],A.prototype,"materialDefinitions",void 0),e([l({type:[w],readOnly:!0})],A.prototype,"textureSetDefinitions",void 0),e([l({type:[O],readOnly:!0})],A.prototype,"geometryDefinitions",void 0),e([l({readOnly:!0})],A.prototype,"serviceUpdateTimeStamp",void 0),e([l({readOnly:!0})],A.prototype,"store",void 0),e([l({type:String,readOnly:!0,json:{read:{source:"store.rootNode"}}})],A.prototype,"rootNode",void 0),e([l({readOnly:!0})],A.prototype,"attributeStorageInfo",void 0),e([l(R.fields)],A.prototype,"fields",void 0),e([l({readOnly:!0})],A.prototype,"fieldsIndex",null),e([l({readOnly:!0,type:h})],A.prototype,"associatedLayer",void 0),e([y("service","associatedLayer",["associatedLayerID"])],A.prototype,"readAssociatedLayer",null),e([l(R.outFields)],A.prototype,"outFields",void 0),e([l({type:String,readOnly:!0})],A.prototype,"objectIdField",null),e([l({readOnly:!0,type:String,json:{read:!1}})],A.prototype,"displayField",null),e([l({readOnly:!0,type:String})],A.prototype,"apiKey",null),e([l({readOnly:!0,type:String})],A.prototype,"customParameters",null),e([l({readOnly:!0,type:c})],A.prototype,"fullExtent",null),e([l({readOnly:!0,type:m})],A.prototype,"spatialReference",null),e([l({readOnly:!0})],A.prototype,"version",null),e([l({readOnly:!0,type:U})],A.prototype,"elevationInfo",null),e([l({readOnly:!0,type:Number})],A.prototype,"minScale",null),e([l({readOnly:!0,type:Number})],A.prototype,"maxScale",null),e([l({readOnly:!0,type:Number})],A.prototype,"effectiveScaleRange",null),e([l({type:["hide","show"],json:{write:!0}})],A.prototype,"listMode",void 0),e([l({types:x,json:{origins:{service:{read:{source:"drawingInfo.renderer"}}},name:"layerDefinition.drawingInfo.renderer",write:!0},value:null})],A.prototype,"renderer",void 0),e([l({type:String,json:{origins:{service:{read:!1,write:!1}},name:"layerDefinition.definitionExpression",write:{enabled:!0,allowNull:!0}}})],A.prototype,"definitionExpression",void 0),e([l(j)],A.prototype,"popupEnabled",void 0),e([l({type:r,json:{read:{source:"popupInfo"},write:{target:"popupInfo"}}})],A.prototype,"popupTemplate",void 0),e([l({readOnly:!0,type:String,json:{origins:{service:{read:{source:"store.normalReferenceFrame"}}},read:!1}})],A.prototype,"normalReferenceFrame",void 0),e([l({readOnly:!0,json:{read:!1}})],A.prototype,"defaultPopupTemplate",null),e([l()],A.prototype,"types",null),e([l()],A.prototype,"typeIdField",null),e([l({json:{write:!1}}),u(new i({"3DObject":"3d-object",Point:"point"}))],A.prototype,"layerType",void 0),e([l()],A.prototype,"geometryType",null),e([l()],A.prototype,"profile",null),e([l({readOnly:!0,json:{read:!1}})],A.prototype,"capabilities",null),e([l({readOnly:!0})],A.prototype,"statisticsInfo",void 0),A=e([d("esri.layers.buildingSublayers.BuildingComponentSublayer")],A);const _=A;export{_ as default};
5
+ import{_ as e}from"../../chunks/tslib.es6.js";import t from"../../Graphic.js";import r from"../../PopupTemplate.js";import o from"../../request.js";import s from"../../core/Error.js";import{JSONMap as i}from"../../core/jsonMap.js";import a from"../../core/Loadable.js";import n from"../../core/Logger.js";import p from"../../core/Promise.js";import{property as l}from"../../core/accessorSupport/decorators/property.js";import"../../core/has.js";import"../../core/RandomLCG.js";import{enumeration as y}from"../../core/accessorSupport/decorators/enumeration.js";import{reader as u}from"../../core/accessorSupport/decorators/reader.js";import{subclass as d}from"../../core/accessorSupport/decorators/subclass.js";import c from"../../geometry/Extent.js";import m from"../../geometry/SpatialReference.js";import h from"../FeatureLayer.js";import f from"./BuildingSublayer.js";import{zeroCapabilities as g}from"../support/capabilities.js";import{popupEnabled as j}from"../support/commonProperties.js";import{getFieldDomain as v}from"../support/featureLayerUtils.js";import{defineFieldProperties as L}from"../support/fieldProperties.js";import b from"../support/FieldsIndex.js";import{unpackFieldNames as I}from"../support/fieldUtils.js";import{fetchIndexInfo as S}from"../support/I3SIndexInfo.js";import{I3SNodePageDefinition as F,I3SMaterialDefinition as w,I3STextureSetDefinition as O,I3SGeometryDefinition as x}from"../support/I3SLayerDefinitions.js";import{webSceneRendererTypes as P}from"../../renderers/support/typeUtils.js";import q from"../../rest/support/Query.js";import{isNumber as T}from"../../support/guards.js";import{createPopupTemplate as U}from"../../support/popupUtils.js";import E from"../../symbols/support/ElevationInfo.js";import{queryAttributesFromCachedAttributesId as Q}from"../../views/3d/layers/i3s/I3SUtil.js";import{getRequiredFields as D,getFetchPopupTemplate as R}from"../../views/layers/support/popupUtils.js";const A=L();let _=class extends(a.LoadableMixin(p.EsriPromiseMixin(f))){constructor(e){super(e),this.type="building-component",this.nodePages=null,this.materialDefinitions=[],this.textureSetDefinitions=[],this.geometryDefinitions=[],this.indexInfo=null,this.serviceUpdateTimeStamp=null,this.store=null,this.attributeStorageInfo=[],this.fields=[],this.associatedLayer=null,this.outFields=null,this.listMode="show",this.renderer=null,this.definitionExpression=null,this.popupEnabled=!0,this.popupTemplate=null,this.layerType="3d-object"}get parsedUrl(){return this.layer?{path:`${this.layer.parsedUrl?.path}/sublayers/${this.id}`,query:this.layer.parsedUrl?.query}:{path:""}}get fieldsIndex(){return new b(this.fields)}readAssociatedLayer(e,t){const r=this.layer.associatedFeatureServiceItem,o=t.associatedLayerID;return null!=r&&"number"==typeof o?new h({portalItem:r,customParameters:this.customParameters,layerId:o}):null}get objectIdField(){if(null!=this.fields)for(const e of this.fields)if("oid"===e.type)return e.name;return null}get displayField(){return null!=this.associatedLayer?this.associatedLayer.displayField:void 0}get apiKey(){return this.layer.apiKey}get customParameters(){return this.layer.customParameters}get fullExtent(){return this.layer.fullExtent}get spatialReference(){return this.layer.spatialReference}get version(){return this.layer.version}get elevationInfo(){return this.layer.elevationInfo}get minScale(){return this.layer.minScale}get maxScale(){return this.layer.maxScale}get effectiveScaleRange(){return this.layer.effectiveScaleRange}get defaultPopupTemplate(){return this.createPopupTemplate()}load(e){const t=null!=e?e.signal:null,r=this._fetchService(t).then((()=>{this.indexInfo=S(this.parsedUrl.path,this.rootNode,this.nodePages,this.customParameters,this.apiKey,n.getLogger(this),t)}));return this.addResolvingPromise(r),Promise.resolve(this)}createPopupTemplate(e){return U(this,e)}async _fetchService(e){const t=(await o(this.parsedUrl.path,{query:{f:"json",...this.customParameters,token:this.apiKey},responseType:"json",signal:e})).data;this.read(t,{origin:"service",url:this.parsedUrl})}getField(e){return this.fieldsIndex.get(e)}getFieldDomain(e,t){const r=this.getField(e)?.domain??null;return this.associatedLayer?v(this.associatedLayer,e,t,r):r}getFeatureType(e){return e&&null!=this.associatedLayer?this.associatedLayer.getFeatureType(e):null}get types(){return null!=this.associatedLayer?this.associatedLayer.types??[]:[]}get typeIdField(){return null!=this.associatedLayer?this.associatedLayer.typeIdField:null}get geometryType(){return"3d-object"===this.layerType?"mesh":"point"}get profile(){return"3d-object"===this.layerType?"mesh-pyramids":"points"}get capabilities(){const e=null!=this.associatedLayer&&this.associatedLayer.capabilities?this.associatedLayer.capabilities:g,{query:t,data:{supportsZ:r,supportsM:o,isVersioned:s}}=e;return{query:t,data:{supportsZ:r,supportsM:o,isVersioned:s}}}createQuery(){const e=new q;return"mesh"!==this.geometryType&&(e.returnGeometry=!0,e.returnZ=!0),e.where=this.definitionExpression||"1=1",e.sqlFormat="standard",e}queryExtent(e,t){return this._getAssociatedLayerForQuery().then((r=>r.queryExtent(e||this.createQuery(),t)))}queryFeatureCount(e,t){return this._getAssociatedLayerForQuery().then((r=>r.queryFeatureCount(e||this.createQuery(),t)))}queryFeatures(e,t){return this._getAssociatedLayerForQuery().then((r=>r.queryFeatures(e||this.createQuery(),t))).then((e=>{if(e?.features)for(const t of e.features)t.layer=this.layer,t.sourceLayer=this;return e}))}async queryObjectIds(e,t){const r=await this._getAssociatedLayerForQuery();return(await r.queryObjectIds(e||this.createQuery(),t)).filter(T)}async queryCachedAttributes(e,t){const r=I(this.fieldsIndex,await D(this,R(this)));return Q(this.parsedUrl.path,this.attributeStorageInfo,e,t,r,this.apiKey,this.customParameters)}async queryCachedFeature(e,r){const o=await this.queryCachedAttributes(e,[r]);if(!o||0===o.length)throw new s("scenelayer:feature-not-in-cached-data","Feature not found in cached data");return new t({attributes:o[0],layer:this,sourceLayer:this})}getFieldUsageInfo(e){return this.fieldsIndex.has(e)?{supportsLabelingInfo:!1,supportsRenderer:!1,supportsPopupTemplate:!1,supportsLayerQuery:!1}:{supportsLabelingInfo:!1,supportsRenderer:!0,supportsPopupTemplate:!0,supportsLayerQuery:null!=this.associatedLayer}}_getAssociatedLayerForQuery(){const e=this.associatedLayer;return null!=e&&e.loaded?Promise.resolve(e):this._loadAssociatedLayerForQuery()}async _loadAssociatedLayerForQuery(){if(await this.load(),null==this.associatedLayer)throw new s("buildingscenelayer:query-not-available","BuildingSceneLayer component layer queries are not available without an associated feature layer",{layer:this});try{await this.associatedLayer.load()}catch(e){throw new s("buildingscenelayer:query-not-available","BuildingSceneLayer associated feature layer could not be loaded",{layer:this,error:e})}return this.associatedLayer}};e([l({readOnly:!0})],_.prototype,"parsedUrl",null),e([l({type:F,readOnly:!0})],_.prototype,"nodePages",void 0),e([l({type:[w],readOnly:!0})],_.prototype,"materialDefinitions",void 0),e([l({type:[O],readOnly:!0})],_.prototype,"textureSetDefinitions",void 0),e([l({type:[x],readOnly:!0})],_.prototype,"geometryDefinitions",void 0),e([l({readOnly:!0})],_.prototype,"serviceUpdateTimeStamp",void 0),e([l({readOnly:!0})],_.prototype,"store",void 0),e([l({type:String,readOnly:!0,json:{read:{source:"store.rootNode"}}})],_.prototype,"rootNode",void 0),e([l({readOnly:!0})],_.prototype,"attributeStorageInfo",void 0),e([l(A.fields)],_.prototype,"fields",void 0),e([l({readOnly:!0})],_.prototype,"fieldsIndex",null),e([l({readOnly:!0,type:h})],_.prototype,"associatedLayer",void 0),e([u("service","associatedLayer",["associatedLayerID"])],_.prototype,"readAssociatedLayer",null),e([l(A.outFields)],_.prototype,"outFields",void 0),e([l({type:String,readOnly:!0})],_.prototype,"objectIdField",null),e([l({readOnly:!0,type:String,json:{read:!1}})],_.prototype,"displayField",null),e([l({readOnly:!0,type:String})],_.prototype,"apiKey",null),e([l({readOnly:!0,type:String})],_.prototype,"customParameters",null),e([l({readOnly:!0,type:c})],_.prototype,"fullExtent",null),e([l({readOnly:!0,type:m})],_.prototype,"spatialReference",null),e([l({readOnly:!0})],_.prototype,"version",null),e([l({readOnly:!0,type:E})],_.prototype,"elevationInfo",null),e([l({readOnly:!0,type:Number})],_.prototype,"minScale",null),e([l({readOnly:!0,type:Number})],_.prototype,"maxScale",null),e([l({readOnly:!0,type:Number})],_.prototype,"effectiveScaleRange",null),e([l({type:["hide","show"],json:{write:!0}})],_.prototype,"listMode",void 0),e([l({types:P,json:{origins:{service:{read:{source:"drawingInfo.renderer"}}},name:"layerDefinition.drawingInfo.renderer",write:!0},value:null})],_.prototype,"renderer",void 0),e([l({type:String,json:{origins:{service:{read:!1,write:!1}},name:"layerDefinition.definitionExpression",write:{enabled:!0,allowNull:!0}}})],_.prototype,"definitionExpression",void 0),e([l(j)],_.prototype,"popupEnabled",void 0),e([l({type:r,json:{read:{source:"popupInfo"},write:{target:"popupInfo"}}})],_.prototype,"popupTemplate",void 0),e([l({readOnly:!0,type:String,json:{origins:{service:{read:{source:"store.normalReferenceFrame"}}},read:!1}})],_.prototype,"normalReferenceFrame",void 0),e([l({readOnly:!0,json:{read:!1}})],_.prototype,"defaultPopupTemplate",null),e([l()],_.prototype,"types",null),e([l()],_.prototype,"typeIdField",null),e([l({json:{write:!1}}),y(new i({"3DObject":"3d-object",Point:"point"}))],_.prototype,"layerType",void 0),e([l()],_.prototype,"geometryType",null),e([l()],_.prototype,"profile",null),e([l({readOnly:!0,json:{read:!1}})],_.prototype,"capabilities",null),e([l({readOnly:!0})],_.prototype,"statisticsInfo",void 0),_=e([d("esri.layers.buildingSublayers.BuildingComponentSublayer")],_);const C=_;export{C 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.32/esri/copyright.txt for details.
4
4
  */
5
- import{id as e}from"../../kernel.js";import{resultOrAbort as t}from"../../core/asyncUtils.js";import r from"../../core/Error.js";import{JSONMap as n}from"../../core/jsonMap.js";import{parseWhereClause as o}from"../../core/sql.js";import{normalizeGlobalID as i}from"../../core/uuid.js";import{createTypeReader as s}from"../../core/accessorSupport/extensions/serializableProperty/reader.js";import{CodedValue as a}from"./CodedValue.js";import u from"./CodedValueDomain.js";import{queryAllJSON as l}from"./featureQueryAll.js";import{isStringField as c,isIntegerField as p}from"./fieldUtils.js";import{getOwningPortalUrl as d,isLayerWithFeatureCapabilities as f}from"./layerUtils.js";import y from"../../renderers/SimpleRenderer.js";import m from"../../renderers/UniqueValueRenderer.js";import h from"../../rest/support/AttachmentQuery.js";import{normalizationTypeJsonMap as w}from"../../rest/support/NormalizationBinParametersMixin.js";import b from"../../rest/support/Query.js";import g from"../../rest/support/RelationshipQuery.js";import{symbolTypesRenderer as I}from"../../symbols/support/typeUtils.js";const j=new n({esriGeometryPoint:"point",esriGeometryMultipoint:"multipoint",esriGeometryPolyline:"polyline",esriGeometryPolygon:"polygon",esriGeometryMultiPatch:"multipatch"});async function F(e,t,n,o){const i=await Q(e);if(await x(e,t,o),!i.addAttachment)throw new r(o,"Layer source does not support addAttachment capability");return i.addAttachment(t,n)}function x(e,t,n){const{attributes:o}=t,{objectIdField:i}=e;return e.capabilities?.data?.supportsAttachment?t?o?i&&o[i]?Promise.resolve():Promise.reject(new r(n,`feature is missing the identifying attribute ${i}`)):Promise.reject(new r(n,"'attributes' are required on a feature to query attachments")):Promise.reject(new r(n,"A feature is required to add/delete/update attachments")):Promise.reject(new r(n,"this layer doesn't support attachments"))}async function P(e,t,n,o,i){const s=await Q(e);if(await x(e,t,i),!s.updateAttachment)throw new r(i,"Layer source does not support updateAttachment capability");return s.updateAttachment(t,n,o)}async function q(e,t,r){const{applyEdits:n}=await import("../graphics/editingSupport.js"),o=await e.load();let i=r;return"feature"===o.type&&o.infoFor3D&&null!=t.deleteFeatures&&null!=o.globalIdField&&(i={...i,globalIdToObjectId:await re(o,t.deleteFeatures,o.globalIdField)}),n(o,o.source,t,r)}async function S(e,t,r){const{uploadAssets:n}=await import("../graphics/editingSupport.js"),o=await e.load();return n(o,o.source,t,r)}async function v(e,t,n,o){const i=await Q(e);if(await x(e,t,o),!i.deleteAttachments)throw new r(o,"Layer source does not support deleteAttachments capability");return i.deleteAttachments(t,n)}async function O(e,t,n){const o=(await e.load({signal:t?.signal})).source;if(!o.fetchRecomputedExtents)throw new r(n,"Layer source does not support fetchUpdates capability");return o.fetchRecomputedExtents(t)}async function A(e,t,n,o){t=h.from(t),await e.load();const i=e.source,s=e.capabilities;if(!s?.data?.supportsAttachment)throw new r(o,"this layer doesn't support attachments");const{attachmentTypes:a,objectIds:u,globalIds:l,num:c,size:p,start:d,where:f}=t;if(!s?.operations?.supportsQueryAttachments){if(a?.length>0||l?.length>0||p?.length>0||c||d||f)throw new r(o,"when 'capabilities.operations.supportsQueryAttachments' is false, only objectIds is supported",t)}if(!(u?.length||l?.length||f))throw new r(o,"'objectIds', 'globalIds', or 'where' are required to perform attachment query",t);if(!i.queryAttachments)throw new r(o,"Layer source does not support queryAttachments capability",t);return!s?.attachment?.supportsOrderByFields&&t.orderByFields?.length&&((t=t.clone()).orderByFields=null),i.queryAttachments(t)}async function L(e,t,n,o){const i=await Q(e);if(!i.queryObjectIds)throw new r(o,"Layer source does not support queryObjectIds capability");return i.queryObjectIds(b.from(t)??e.createQuery(),n)}async function E(e,t,n,o){const i=await Q(e);if(!i.queryFeatureCount)throw new r(o,"Layer source does not support queryFeatureCount capability");return i.queryFeatureCount(b.from(t)??e.createQuery(),n)}async function D(e,t,n,o){const i=await Q(e);if(!i.queryExtent)throw new r(o,"Layer source does not support queryExtent capability");return i.queryExtent(b.from(t)??e.createQuery(),n)}async function T(e,t,n,o){const i=await Q(e);if(!i.queryRelatedFeatures)throw new r(o,"Layer source does not support queryRelatedFeatures capability");return i.queryRelatedFeatures(g.from(t),n)}async function C(e,t,n,o){const i=await Q(e);if(!i.queryRelatedFeaturesCount)throw new r(o,"Layer source does not support queryRelatedFeaturesCount capability");return i.queryRelatedFeaturesCount(g.from(t),n)}async function B(e){const t=e.source;if(t?.refresh)try{const{dataChanged:r,updates:n}=await t.refresh();if(null!=n&&(e.sourceJSON={...e.sourceJSON,...n},e.read(n,{origin:"service",url:e.parsedUrl})),r)return!0}catch{}if(e.definitionExpression)try{return(await o(e.definitionExpression,e.fieldsIndex)).hasDateFunctions}catch{}return!1}function R(e){const t=new b,r=e.capabilities?.data,n=e.capabilities?.query;t.historicMoment=e.historicMoment,t.gdbVersion=e.gdbVersion,t.returnGeometry=!0,n&&(t.compactGeometryEnabled=n.supportsCompactGeometry,t.defaultSpatialReferenceEnabled=n.supportsDefaultSpatialReference),r&&(r.supportsZ&&null!=e.returnZ&&(t.returnZ=e.returnZ),r.supportsM&&null!=e.returnM&&(t.returnM=e.returnM)),t.outFields=["*"];const{timeOffset:o,timeExtent:i}=e;return t.timeExtent=null!=o&&null!=i?i.offset(-o.value,o.unit):i||null,t.multipatchOption="multipatch"===e.geometryType?"xyFootprint":null,t}function M(e){const{globalIdField:t,fields:r}=e;if(t)return t;if(r)for(const n of r)if("esriFieldTypeGlobalID"===n.type)return n.name}function k(e){const{objectIdField:t,fields:r}=e;if(t)return t;if(r)for(const n of r)if("esriFieldTypeOID"===n.type)return n.name}function z(e){return e.currentVersion?e.currentVersion:e.hasOwnProperty("capabilities")||e.hasOwnProperty("drawingInfo")||e.hasOwnProperty("hasAttachments")||e.hasOwnProperty("htmlPopupType")||e.hasOwnProperty("relationships")||e.hasOwnProperty("timeInfo")||e.hasOwnProperty("typeIdField")||e.hasOwnProperty("types")?10:9.3}function N(e,t){const{subtypes:r,subtypeField:n}=e;if(!t?.attributes||!r?.length||!n)return null;const o=t.attributes[n];return null==o?null:r.find((e=>e.code===o))}function U(e,t){const{fieldsIndex:r,subtypeField:n}=e,{name:o,type:i}=r.get(t)??{};if(!o)return null;if((n&&r.get(n)?.name)===o&&e.subtypes?.length){const t=e.subtypes.map((e=>new a({code:G(e.code,i),name:e.name})));if(t?.length)return new u({codedValues:t})}return null}function V(e,t){const{fieldsIndex:r}=e,{name:n,type:o}=r.get(t)??{};if(!n)return null;if(("typeIdField"in e?r.get(e.typeIdField)?.name:null)===n&&"types"in e&&e.types?.length){const t=e.types.map((e=>new a({code:G(e.id,o),name:e.name})));return new u({codedValues:t})}return null}function G(e,t){return t?c({type:t})&&"number"==typeof e?`${e}`:p({type:t})&&"string"==typeof e?Number.parseInt(e,10):e:e}async function Q(e){return(await e.load()).source}async function $(t,r){if(!e)return;const n=e.findCredential(t);if(n)return n.userId;let o;try{const n=await d(t,r);n&&(o=await e.checkSignInStatus(`${n}/sharing`))}catch(i){}return o?o.userId:null}async function J(t,r){if(!e)return;if(e.findCredential(t))return;let n;try{const o=await d(t,r);o&&(n=await e.checkSignInStatus(`${o}/sharing`))}catch(o){}if(n)try{const n=null!=r?r.signal:null;await e.getCredential(t,{signal:n})}catch(o){}}async function Z(e,t,r){const n=e.parsedUrl?.path;n&&e.authenticationTriggerEvent===t&&await J(n,r)}async function H(e){const t=e.parsedUrl?.path;t&&W(e)&&await J(t)}function W(e){return _(e)&&("serviceDefinitionExpression"in e&&K(e.serviceDefinitionExpression)||"definitionExpression"in e&&K(e.definitionExpression))}function _(e){return!(!f(e)||!e.capabilities?.query.supportsCurrentUser)}function K(e){return!!e?.toLowerCase().includes("current_user")}function X(e){return!oe(e)&&(e.userHasUpdateItemPrivileges||e.editingEnabled)}const Y=s({types:I});function ee(e,t){if(e.defaultSymbol)return e.types?.length?new m({defaultSymbol:Y(e.defaultSymbol,e,t),field:e.typeIdField,uniqueValueInfos:e.types.map((e=>({id:e.id,symbol:Y(e.symbol,e,t)})))}):new y({symbol:Y(e.defaultSymbol,e,t)})}function te(e){let t=e.sourceJSON?.cacheMaxAge;if(!t)return!1;const r=e.editingInfo?.lastEditDate?.getTime();return null==r||(t*=1e3,Date.now()-r<t)}async function re(e,r,n){if(null==r)return null;const o=[],{objectIdField:s}=e;if(r.forEach((e=>{let t=null;if("attributes"in e){const{attributes:r}=e;t={globalId:r[n],objectId:null!=r[s]&&-1!==r[s]?r[s]:null}}else t={globalId:e.globalId,objectId:null!=e.objectId&&-1!==e.objectId?e.objectId:null};null!=t.globalId&&(null!=t.objectId&&-1!==t.objectId||o.push(t.globalId))})),0===o.length)return null;const a=e.createQuery();a.where=o.map((e=>`${n}='${e}'`)).join(" OR "),a.returnGeometry=!1,a.outFields=[s,n],a.cacheHint=!1;const u=await t(l(e,a));if(!u.ok)return null;const c=new Map,p=u.value.features;for(const t of p){const e=t.attributes[n],r=t.attributes[s];null!=e&&null!=r&&-1!==r&&c.set(i(e),r)}return c}function ne(e,t,r){if(!t||!r||!e)return null;const n=r.getAttribute(t);return null==n?null:e.find((e=>{const{id:t}=e;return null!=t&&t.toString()===n.toString()}))??null}function oe(e){return e.sourceJSON?.isMultiServicesView||ie(e)}function ie(e){return!!e.sourceJSON?.capabilities?.toLowerCase().split(",").map((e=>e.trim())).includes("map")}function se(e,t,n){const o=t?.queryAttributeBins;if(!o)throw new r(n,"Layer source does not support binning");switch(e.binParameters.type){case"auto-interval":if(!o.supportsAutoInterval)throw new r(n,"Layer source does not support auto-interval binning");if(e.binParameters.normalizationType&&(!o.supportsNormalization||!ae(e.binParameters.normalizationType,o.supportedNormalizationTypes)))throw new r(n,"Layer source does not support normalization binning");break;case"date":if(!o.supportsDate)throw new r(n,"Layer source does not support date binning");if(e.binParameters.snapToData&&!o.supportsSnapToData)throw new r(n,"Layer source does not support snapToData binning");if(e.binParameters.returnFullIntervalBin&&!o.supportsReturnFullIntervalBin)throw new r(n,"Layer source does not support returnFullIntervalBin binning");break;case"fixed-boundaries":if(!o.supportsFixedBoundaries)throw new r(n,"Layer source does not support fixed-boundaries binning");break;case"fixed-interval":if(!o.supportsFixedInterval)throw new r(n,"Layer source does not support fixed-interval binning");if(e.binParameters.normalizationType&&(!o.supportsNormalization||!ae(e.binParameters.normalizationType,o.supportedNormalizationTypes)))throw new r(n,"Layer source does not support normalization binning")}if(e.binParameters.stackBy&&!o.supportsStackBy)throw new r(n,"Layer source does not support stackBy binning");if(e.binParameters.splitBy&&!o.supportsSplitBy)throw new r(n,"Layer source does not support splitBy binning");if(e.binParameters.firstDayOfWeek&&!o.supportsFirstDayOfWeek)throw new r(n,"Layer source does not support firstDayOfWeek binning");const i=o?.supportedStatistics;if(e.outStatistics&&i){const t=new Map([["count","count"],["sum","sum"],["min","min"],["max","max"],["avg","avg"],["stddev","stddev"],["var","var"],["percentile-continuous","percentileContinuous"],["percentile-discrete","percentileDiscrete"],["centroid-aggregate","centroid"],["convex-hull-aggregate","convexHull"],["envelope-aggregate","envelope"]]);for(const{statisticType:o}of e.outStatistics){const e=t.get(o);if(e&&!i[e])throw new r(n,`Layer source does not support ${o} statistic type`)}}}function ae(e,t){return null!=e&&!!t?.[w.toJSON(e)]}export{F as addAttachment,q as applyEdits,H as checkServiceCurrentUserSupport,U as computeDomainFromSubtypes,V as computeDomainFromTypes,X as computeEffectiveEditingEnabled,ee as createDefaultRenderer,R as createQuery,v as deleteAttachments,J as ensureCredentialIfSignedIn,Z as ensureLayerCredential,O as fetchRecomputedExtents,j as geometryTypeKebabDict,N as getFeatureSubtype,ne as getFeatureType,re as getGlobalIdToObjectIdMap,$ as getSignedInUser,K as hasCurrentUser,B as hasDataChanged,te as isLayerCacheStale,A as queryAttachments,D as queryExtent,E as queryFeatureCount,L as queryObjectIds,T as queryRelatedFeatures,C as queryRelatedFeaturesCount,M as readGlobalIdField,k as readObjectIdField,z as readVersion,oe as supportsQueryOnly,P as updateAttachment,S as uploadAssets,se as validateBinsQuery};
5
+ import{id as e}from"../../kernel.js";import{resultOrAbort as t}from"../../core/asyncUtils.js";import r from"../../core/Error.js";import{JSONMap as n}from"../../core/jsonMap.js";import{parseWhereClause as o}from"../../core/sql.js";import{normalizeGlobalID as i}from"../../core/uuid.js";import{createTypeReader as s}from"../../core/accessorSupport/extensions/serializableProperty/reader.js";import{CodedValue as a}from"./CodedValue.js";import u from"./CodedValueDomain.js";import{queryAllJSON as c}from"./featureQueryAll.js";import{isStringField as l,isIntegerField as p}from"./fieldUtils.js";import{getOwningPortalUrl as d,isLayerWithFeatureCapabilities as f}from"./layerUtils.js";import y from"../../renderers/SimpleRenderer.js";import m from"../../renderers/UniqueValueRenderer.js";import h from"../../rest/support/AttachmentQuery.js";import{normalizationTypeJsonMap as w}from"../../rest/support/NormalizationBinParametersMixin.js";import b from"../../rest/support/Query.js";import g from"../../rest/support/RelationshipQuery.js";import{symbolTypesRenderer as I}from"../../symbols/support/typeUtils.js";const j=new n({esriGeometryPoint:"point",esriGeometryMultipoint:"multipoint",esriGeometryPolyline:"polyline",esriGeometryPolygon:"polygon",esriGeometryMultiPatch:"multipatch"});async function F(e,t,n,o){const i=await $(e);if(await x(e,t,o),!i.addAttachment)throw new r(o,"Layer source does not support addAttachment capability");return i.addAttachment(t,n)}function x(e,t,n){const{attributes:o}=t,{objectIdField:i}=e;return e.capabilities?.data?.supportsAttachment?t?o?i&&o[i]?Promise.resolve():Promise.reject(new r(n,`feature is missing the identifying attribute ${i}`)):Promise.reject(new r(n,"'attributes' are required on a feature to query attachments")):Promise.reject(new r(n,"A feature is required to add/delete/update attachments")):Promise.reject(new r(n,"this layer doesn't support attachments"))}async function P(e,t,n,o,i){const s=await $(e);if(await x(e,t,i),!s.updateAttachment)throw new r(i,"Layer source does not support updateAttachment capability");return s.updateAttachment(t,n,o)}async function q(e,t,r){const{applyEdits:n}=await import("../graphics/editingSupport.js"),o=await e.load();let i=r;return"feature"===o.type&&o.infoFor3D&&null!=t.deleteFeatures&&null!=o.globalIdField&&(i={...i,globalIdToObjectId:await ne(o,t.deleteFeatures,o.globalIdField)}),n(o,o.source,t,r)}async function S(e,t,r){const{uploadAssets:n}=await import("../graphics/editingSupport.js"),o=await e.load();return n(o,o.source,t,r)}async function v(e,t,n,o){const i=await $(e);if(await x(e,t,o),!i.deleteAttachments)throw new r(o,"Layer source does not support deleteAttachments capability");return i.deleteAttachments(t,n)}async function O(e,t,n){const o=(await e.load({signal:t?.signal})).source;if(!o.fetchRecomputedExtents)throw new r(n,"Layer source does not support fetchUpdates capability");return o.fetchRecomputedExtents(t)}async function A(e,t,n,o){t=h.from(t),await e.load();const i=e.source,s=e.capabilities;if(!s?.data?.supportsAttachment)throw new r(o,"this layer doesn't support attachments");const{attachmentTypes:a,objectIds:u,globalIds:c,num:l,size:p,start:d,where:f}=t;if(!s?.operations?.supportsQueryAttachments){if(a?.length>0||c?.length>0||p?.length>0||l||d||f)throw new r(o,"when 'capabilities.operations.supportsQueryAttachments' is false, only objectIds is supported",t)}if(!(u?.length||c?.length||f))throw new r(o,"'objectIds', 'globalIds', or 'where' are required to perform attachment query",t);if(!i.queryAttachments)throw new r(o,"Layer source does not support queryAttachments capability",t);return!s?.attachment?.supportsOrderByFields&&t.orderByFields?.length&&((t=t.clone()).orderByFields=null),i.queryAttachments(t)}async function L(e,t,n,o){const i=await $(e);if(!i.queryObjectIds)throw new r(o,"Layer source does not support queryObjectIds capability");return i.queryObjectIds(b.from(t)??e.createQuery(),n)}async function E(e,t,n,o){const i=await $(e);if(!i.queryFeatureCount)throw new r(o,"Layer source does not support queryFeatureCount capability");return i.queryFeatureCount(b.from(t)??e.createQuery(),n)}async function D(e,t,n,o){const i=await $(e);if(!i.queryExtent)throw new r(o,"Layer source does not support queryExtent capability");return i.queryExtent(b.from(t)??e.createQuery(),n)}async function T(e,t,n,o){const i=await $(e);if(!i.queryRelatedFeatures)throw new r(o,"Layer source does not support queryRelatedFeatures capability");return i.queryRelatedFeatures(g.from(t),n)}async function C(e,t,n,o){const i=await $(e);if(!i.queryRelatedFeaturesCount)throw new r(o,"Layer source does not support queryRelatedFeaturesCount capability");return i.queryRelatedFeaturesCount(g.from(t),n)}async function B(e){const t=e.source;if(t?.refresh)try{const{dataChanged:r,updates:n}=await t.refresh();if(null!=n&&(e.sourceJSON={...e.sourceJSON,...n},e.read(n,{origin:"service",url:e.parsedUrl})),r)return!0}catch{}if(e.definitionExpression)try{return(await o(e.definitionExpression,e.fieldsIndex)).hasDateFunctions}catch{}return!1}function R(e){const t=new b,r=e.capabilities?.data,n=e.capabilities?.query;t.historicMoment=e.historicMoment,t.gdbVersion=e.gdbVersion,t.returnGeometry=!0,n&&(t.compactGeometryEnabled=n.supportsCompactGeometry,t.defaultSpatialReferenceEnabled=n.supportsDefaultSpatialReference),r&&(r.supportsZ&&null!=e.returnZ&&(t.returnZ=e.returnZ),r.supportsM&&null!=e.returnM&&(t.returnM=e.returnM)),t.outFields=["*"];const{timeOffset:o,timeExtent:i}=e;return t.timeExtent=null!=o&&null!=i?i.offset(-o.value,o.unit):i||null,t.multipatchOption="multipatch"===e.geometryType?"xyFootprint":null,t}function M(e){const{globalIdField:t,fields:r}=e;if(t)return t;if(r)for(const n of r)if("esriFieldTypeGlobalID"===n.type)return n.name}function k(e){const{objectIdField:t,fields:r}=e;if(t)return t;if(r)for(const n of r)if("esriFieldTypeOID"===n.type)return n.name}function z(e){return e.currentVersion?e.currentVersion:e.hasOwnProperty("capabilities")||e.hasOwnProperty("drawingInfo")||e.hasOwnProperty("hasAttachments")||e.hasOwnProperty("htmlPopupType")||e.hasOwnProperty("relationships")||e.hasOwnProperty("timeInfo")||e.hasOwnProperty("typeIdField")||e.hasOwnProperty("types")?10:9.3}function N(e,t,r,n){const o=r?.feature,i=!!e.subtypes?.length;if(i&&!r?.excludeImpliedDomains){const r=V(e,t);if(r)return r}const s=i&&U(e,o);if(s){const e=s?.domains?.[t];return"inherited"===e?.type?n:e}const a=oe(e.types,e.typeIdField,o);if(a){const e=a.domains&&a.domains[t];if(e&&"inherited"!==e?.type)return e}if(n)return n;if(!r?.excludeImpliedDomains){const r=G(e,t);if(r)return r}return null}function U(e,t){const{subtypes:r,subtypeField:n}=e;if(!t?.attributes||!r?.length||!n)return null;const o=t.attributes[n];return null==o?null:r.find((e=>e.code===o))}function V(e,t){const{fieldsIndex:r,subtypeField:n}=e,{name:o,type:i}=r.get(t)??{};if(!o)return null;if((n&&r.get(n)?.name)===o&&e.subtypes?.length){const t=e.subtypes.map((e=>new a({code:Q(e.code,i),name:e.name})));if(t?.length)return new u({codedValues:t})}return null}function G(e,t){const{fieldsIndex:r}=e,{name:n,type:o}=r.get(t)??{};if(!n)return null;if(("typeIdField"in e?r.get(e.typeIdField)?.name:null)===n&&"types"in e&&e.types?.length){const t=e.types.map((e=>new a({code:Q(e.id,o),name:e.name})));return new u({codedValues:t})}return null}function Q(e,t){return t?l({type:t})&&"number"==typeof e?`${e}`:p({type:t})&&"string"==typeof e?Number.parseInt(e,10):e:e}async function $(e){return(await e.load()).source}async function J(t,r){if(!e)return;const n=e.findCredential(t);if(n)return n.userId;let o;try{const n=await d(t,r);n&&(o=await e.checkSignInStatus(`${n}/sharing`))}catch(i){}return o?o.userId:null}async function Z(t,r){if(!e)return;if(e.findCredential(t))return;let n;try{const o=await d(t,r);o&&(n=await e.checkSignInStatus(`${o}/sharing`))}catch(o){}if(n)try{const n=null!=r?r.signal:null;await e.getCredential(t,{signal:n})}catch(o){}}async function H(e,t,r){const n=e.parsedUrl?.path;n&&e.authenticationTriggerEvent===t&&await Z(n,r)}async function W(e){const t=e.parsedUrl?.path;t&&_(e)&&await Z(t)}function _(e){return K(e)&&("serviceDefinitionExpression"in e&&X(e.serviceDefinitionExpression)||"definitionExpression"in e&&X(e.definitionExpression))}function K(e){return!(!f(e)||!e.capabilities?.query.supportsCurrentUser)}function X(e){return!!e?.toLowerCase().includes("current_user")}function Y(e){return!ie(e)&&(e.userHasUpdateItemPrivileges||e.editingEnabled)}const ee=s({types:I});function te(e,t){if(e.defaultSymbol)return e.types?.length?new m({defaultSymbol:ee(e.defaultSymbol,e,t),field:e.typeIdField,uniqueValueInfos:e.types.map((e=>({id:e.id,symbol:ee(e.symbol,e,t)})))}):new y({symbol:ee(e.defaultSymbol,e,t)})}function re(e){let t=e.sourceJSON?.cacheMaxAge;if(!t)return!1;const r=e.editingInfo?.lastEditDate?.getTime();return null==r||(t*=1e3,Date.now()-r<t)}async function ne(e,r,n){if(null==r)return null;const o=[],{objectIdField:s}=e;if(r.forEach((e=>{let t=null;if("attributes"in e){const{attributes:r}=e;t={globalId:r[n],objectId:null!=r[s]&&-1!==r[s]?r[s]:null}}else t={globalId:e.globalId,objectId:null!=e.objectId&&-1!==e.objectId?e.objectId:null};null!=t.globalId&&(null!=t.objectId&&-1!==t.objectId||o.push(t.globalId))})),0===o.length)return null;const a=e.createQuery();a.where=o.map((e=>`${n}='${e}'`)).join(" OR "),a.returnGeometry=!1,a.outFields=[s,n],a.cacheHint=!1;const u=await t(c(e,a));if(!u.ok)return null;const l=new Map,p=u.value.features;for(const t of p){const e=t.attributes[n],r=t.attributes[s];null!=e&&null!=r&&-1!==r&&l.set(i(e),r)}return l}function oe(e,t,r){if(!t||!r||!e)return null;const n=r.getAttribute(t);return null==n?null:e.find((e=>{const{id:t}=e;return null!=t&&t.toString()===n.toString()}))??null}function ie(e){return e.sourceJSON?.isMultiServicesView||se(e)}function se(e){return!!e.sourceJSON?.capabilities?.toLowerCase().split(",").map((e=>e.trim())).includes("map")}function ae(e,t,n){const o=t?.queryAttributeBins;if(!o)throw new r(n,"Layer source does not support binning");switch(e.binParameters.type){case"auto-interval":if(!o.supportsAutoInterval)throw new r(n,"Layer source does not support auto-interval binning");if(e.binParameters.normalizationType&&(!o.supportsNormalization||!ue(e.binParameters.normalizationType,o.supportedNormalizationTypes)))throw new r(n,"Layer source does not support normalization binning");break;case"date":if(!o.supportsDate)throw new r(n,"Layer source does not support date binning");if(e.binParameters.snapToData&&!o.supportsSnapToData)throw new r(n,"Layer source does not support snapToData binning");if(e.binParameters.returnFullIntervalBin&&!o.supportsReturnFullIntervalBin)throw new r(n,"Layer source does not support returnFullIntervalBin binning");break;case"fixed-boundaries":if(!o.supportsFixedBoundaries)throw new r(n,"Layer source does not support fixed-boundaries binning");break;case"fixed-interval":if(!o.supportsFixedInterval)throw new r(n,"Layer source does not support fixed-interval binning");if(e.binParameters.normalizationType&&(!o.supportsNormalization||!ue(e.binParameters.normalizationType,o.supportedNormalizationTypes)))throw new r(n,"Layer source does not support normalization binning")}if(e.binParameters.stackBy&&!o.supportsStackBy)throw new r(n,"Layer source does not support stackBy binning");if(e.binParameters.splitBy&&!o.supportsSplitBy)throw new r(n,"Layer source does not support splitBy binning");if(e.binParameters.firstDayOfWeek&&!o.supportsFirstDayOfWeek)throw new r(n,"Layer source does not support firstDayOfWeek binning");const i=o?.supportedStatistics;if(e.outStatistics&&i){const t=new Map([["count","count"],["sum","sum"],["min","min"],["max","max"],["avg","avg"],["stddev","stddev"],["var","var"],["percentile-continuous","percentileContinuous"],["percentile-discrete","percentileDiscrete"],["centroid-aggregate","centroid"],["convex-hull-aggregate","convexHull"],["envelope-aggregate","envelope"]]);for(const{statisticType:o}of e.outStatistics){const e=t.get(o);if(e&&!i[e])throw new r(n,`Layer source does not support ${o} statistic type`)}}}function ue(e,t){return null!=e&&!!t?.[w.toJSON(e)]}export{F as addAttachment,q as applyEdits,W as checkServiceCurrentUserSupport,V as computeDomainFromSubtypes,G as computeDomainFromTypes,Y as computeEffectiveEditingEnabled,te as createDefaultRenderer,R as createQuery,v as deleteAttachments,Z as ensureCredentialIfSignedIn,H as ensureLayerCredential,O as fetchRecomputedExtents,j as geometryTypeKebabDict,U as getFeatureSubtype,oe as getFeatureType,N as getFieldDomain,ne as getGlobalIdToObjectIdMap,J as getSignedInUser,X as hasCurrentUser,B as hasDataChanged,re as isLayerCacheStale,A as queryAttachments,D as queryExtent,E as queryFeatureCount,L as queryObjectIds,T as queryRelatedFeatures,C as queryRelatedFeaturesCount,M as readGlobalIdField,k as readObjectIdField,z as readVersion,ie as supportsQueryOnly,P as updateAttachment,S as uploadAssets,ae as validateBinsQuery};
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@arcgis/core",
3
- "version": "4.32.0-next.20250217",
3
+ "version": "4.32.0-next.20250218",
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": [
@@ -2,4 +2,4 @@
2
2
  All material copyright ESRI, All Rights Reserved, unless otherwise specified.
3
3
  See https://js.arcgis.com/4.32/esri/copyright.txt for details.
4
4
  */
5
- import{_ as o}from"../../chunks/tslib.es6.js";import r from"../../core/Clonable.js";import e from"../../core/JSONSupport.js";import{property as t}from"../../core/accessorSupport/decorators/property.js";import{ensureType as s}from"../../core/accessorSupport/ensureType.js";import"../../core/has.js";import"../../core/RandomLCG.js";import{enumeration as p}from"../../core/accessorSupport/decorators/enumeration.js";import{subclass as i}from"../../core/accessorSupport/decorators/subclass.js";import{kebabDict as a}from"../../layers/support/fieldType.js";let l=class extends(r.ClonableMixin(e)){constructor(o){super(o),this.alias=null,this.responseType=null,this.type=null,this.value=null,this.valueType=null}};o([t({type:String,json:{name:"outAlias",write:!0}})],l.prototype,"alias",void 0),o([t({type:String})],l.prototype,"responseType",void 0),o([t({type:String,json:{write:!0}})],l.prototype,"type",void 0),o([t({type:String,json:{write:!0}})],l.prototype,"value",void 0),o([p(a)],l.prototype,"valueType",void 0),l=o([i("esri.rest.support.AttributeBinsGrouping")],l);const n=l;l.from=s(l);export{n as default};
5
+ import{_ as o}from"../../chunks/tslib.es6.js";import r from"../../core/Clonable.js";import{JSONMap as e}from"../../core/jsonMap.js";import t from"../../core/JSONSupport.js";import{property as s}from"../../core/accessorSupport/decorators/property.js";import{ensureType as p}from"../../core/accessorSupport/ensureType.js";import"../../core/has.js";import"../../core/RandomLCG.js";import{enumeration as i}from"../../core/accessorSupport/decorators/enumeration.js";import{subclass as n}from"../../core/accessorSupport/decorators/subclass.js";const a=new e({esriFieldTypeInteger:"integer",esriFieldTypeString:"string"});let l=class extends(r.ClonableMixin(t)){constructor(o){super(o),this.alias=null,this.responseType=null,this.type=null,this.value=null,this.valueType=null}};o([s({type:String,json:{name:"outAlias",write:!0}})],l.prototype,"alias",void 0),o([s({type:String})],l.prototype,"responseType",void 0),o([s({type:String,json:{write:!0}})],l.prototype,"type",void 0),o([s({type:String,json:{write:!0}})],l.prototype,"value",void 0),o([i(a)],l.prototype,"valueType",void 0),l=o([n("esri.rest.support.AttributeBinsGrouping")],l);const c=l;l.from=p(l);export{c 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.32/esri/copyright.txt for details.
4
4
  */
5
- const b="20250217",a="320b14a53578845ae151f785b0b74eb55b16a185";export{b as buildDate,a as commitHash};
5
+ const f="20250218",a="b4ef3fb482a27dfad6a5c52b6c17913f9f1da0c1";export{f as buildDate,a as commitHash};
@@ -2,4 +2,4 @@
2
2
  All material copyright ESRI, All Rights Reserved, unless otherwise specified.
3
3
  See https://js.arcgis.com/4.32/esri/copyright.txt for details.
4
4
  */
5
- import{isPromiseLike as e}from"../../core/promiseUtils.js";import{when as t,watch as a}from"../../core/reactiveUtils.js";import{addFrameTask as s}from"../../core/scheduling.js";import i from"./PaddedViewState.js";import{RenderState as r}from"../support/RenderState.js";import{newScheduler as d}from"../support/Scheduler.js";class h{constructor(a){this.view=a,this._stationaryHandle=null,this._frameTaskHandle=null,this._updateParameters=null,this._updateRequested=!1,this._scheduler=d(),this._schedulerHandle=t((()=>this._scheduler.updating),(()=>this.requestFrame())),this.stationary=!0,this.prepare=()=>{this._updateParameters&&(this._updateParameters.state=this.view.state,this._updateParameters.stationary=this.view.stationary,this._updateParameters.pixelRatio=window.devicePixelRatio,this._updateParameters.renderingOptions=this.view.renderingOptions,this._updateParameters.targetState.copy(this.view.state),null==this.view.animation?.target||e(this.view.animation.target)||(this._updateParameters.targetState.viewpoint=this.view.animation.target))},this.update=e=>{if(this._updateRequested=!1,this.view?.destroyed)return;const{allLayerViews:t,graphicsView:a,labelManager:s,state:{id:i}}=this.view;t.forEach(this._updateLayerView,this),null!=s&&(s.lastUpdateId!==i&&(s.viewChange(),s.lastUpdateId=i),s.updateRequested&&s.processUpdate(this._updateParameters)),null!=a&&(a.lastUpdateId!==i&&(a.viewChange(),a.lastUpdateId=i),a.updateRequested&&a.processUpdate(this._updateParameters)),this.view.graphicsTileStore.setViewState(this._updateParameters.state),this.view.animation?this._scheduler.state=r.ANIMATING:this.view.interacting?this._scheduler.state=r.INTERACTING:this._scheduler.state=r.IDLE;this._scheduler.frame(e)||this._updateRequested||this._scheduler.state!==r.IDLE||this._frameTaskHandle?.pause()}}destroy(){this.stop(),this._schedulerHandle.remove(),this._scheduler.destroy()}get scheduler(){return this._scheduler}start(){if(this._frameTaskHandle)return;const e=this.view;this.stationary=e.stationary,this._updateParameters={state:e.state,targetState:new i,pixelRatio:window.devicePixelRatio,stationary:this.stationary,renderingOptions:e.renderingOptions},this._stationaryHandle=a((()=>e.stationary),(e=>{this.stationary=e,this.requestFrame()})),this._frameTaskHandle=s(this),this.requestUpdate()}stop(){this._frameTaskHandle&&(this._updateRequested=!1,this._stationaryHandle?.remove(),this._frameTaskHandle.remove(),this._updateParameters=this._stationaryHandle=this._frameTaskHandle=null,this.stationary=!0)}requestUpdate(){this._updateRequested||(this._updateRequested=!0,this.requestFrame())}requestFrame(){this._frameTaskHandle&&this._frameTaskHandle.resume()}_updateLayerView(e){if(!e.attached)return void this.requestUpdate();const t=this.view.state,a=e.lastUpdateId;null!=a&&(this.stationary||e.moving)||(e.moving=!0),a!==t.id&&e.viewChange(),this.stationary&&e.moving&&(e.moving=!1,e.moveEnd()),e.lastUpdateId=t.id,e.updateRequested&&e.processUpdate(this._updateParameters),"layerViews"in e&&e.layerViews?.forEach(this._updateLayerView,this)}}export{h as default};
5
+ import{isPromiseLike as e}from"../../core/promiseUtils.js";import{when as t,watch as a}from"../../core/reactiveUtils.js";import{addFrameTask as s}from"../../core/scheduling.js";import i from"./PaddedViewState.js";import{RenderState as r}from"../support/RenderState.js";import{newScheduler as d}from"../support/Scheduler.js";class h{constructor(a){this.view=a,this._stationaryHandle=null,this._frameTaskHandle=null,this._updateParameters=null,this._updateRequested=!1,this._scheduler=d(),this._schedulerHandle=t((()=>this._scheduler.updating),(()=>this.requestFrame())),this.stationary=!0,this.prepare=()=>{this._updateParameters&&(this._updateParameters.state=this.view.state,this._updateParameters.stationary=this.view.stationary,this._updateParameters.pixelRatio=window.devicePixelRatio,this._updateParameters.renderingOptions=this.view.renderingOptions,this._updateParameters.targetState.copy(this.view.state),null==this.view.animation?.target||e(this.view.animation.target)||(this._updateParameters.targetState.viewpoint=this.view.animation.target))},this.update=e=>{if(this._updateRequested=!1,this.view?.destroyed)return;const{allLayerViews:t,graphicsView:a,labelManager:s,state:{id:i}}=this.view;t?.forEach(this._updateLayerView,this),null!=s&&(s.lastUpdateId!==i&&(s.viewChange(),s.lastUpdateId=i),s.updateRequested&&s.processUpdate(this._updateParameters)),null!=a&&(a.lastUpdateId!==i&&(a.viewChange(),a.lastUpdateId=i),a.updateRequested&&a.processUpdate(this._updateParameters)),this.view.graphicsTileStore?.setViewState(this._updateParameters.state),this.view.animation?this._scheduler.state=r.ANIMATING:this.view.interacting?this._scheduler.state=r.INTERACTING:this._scheduler.state=r.IDLE;this._scheduler.frame(e)||this._updateRequested||this._scheduler.state!==r.IDLE||this._frameTaskHandle?.pause()}}destroy(){this.stop(),this._schedulerHandle.remove(),this._scheduler.destroy()}get scheduler(){return this._scheduler}start(){if(this._frameTaskHandle)return;const e=this.view;this.stationary=e.stationary,this._updateParameters={state:e.state,targetState:new i,pixelRatio:window.devicePixelRatio,stationary:this.stationary,renderingOptions:e.renderingOptions},this._stationaryHandle=a((()=>e.stationary),(e=>{this.stationary=e,this.requestFrame()})),this._frameTaskHandle=s(this),this.requestUpdate()}stop(){this._frameTaskHandle&&(this._updateRequested=!1,this._stationaryHandle?.remove(),this._frameTaskHandle.remove(),this._updateParameters=this._stationaryHandle=this._frameTaskHandle=null,this.stationary=!0)}requestUpdate(){this._updateRequested||(this._updateRequested=!0,this.requestFrame())}requestFrame(){this._frameTaskHandle&&this._frameTaskHandle.resume()}_updateLayerView(e){if(!e.attached)return void this.requestUpdate();const t=this.view.state,a=e.lastUpdateId;null!=a&&(this.stationary||e.moving)||(e.moving=!0),a!==t.id&&e.viewChange(),this.stationary&&e.moving&&(e.moving=!1,e.moveEnd()),e.lastUpdateId=t.id,e.updateRequested&&e.processUpdate(this._updateParameters),"layerViews"in e&&e.layerViews?.forEach(this._updateLayerView,this)}}export{h 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.32/esri/copyright.txt for details.
4
4
  */
5
- import t from"../../Viewpoint.js";import e from"../../core/Collection.js";import{deg2rad as r}from"../../core/mathUtils.js";import{getMetersPerUnitForSR as n}from"../../core/unitUtils.js";import{toRadian as o}from"../../core/libs/gl-matrix-2/math/common.js";import{fromScaling as a,rotate as i,translate as c,fromTranslation as s,scale as u,fromRotation as l,invert as f}from"../../core/libs/gl-matrix-2/math/mat2d.js";import{create as m}from"../../core/libs/gl-matrix-2/factories/mat2df64.js";import{scale as y,set as p,sub as g,negate as x,subtract as h,normalize as b,cross as w,dot as d,length as j,add as G,transformMat2d as R,copy as A}from"../../core/libs/gl-matrix-2/math/vec2.js";import{fromValues as S,create as k}from"../../core/libs/gl-matrix-2/factories/vec2f64.js";import M from"../../geometry/Extent.js";import v from"../../geometry/Geometry.js";import z from"../../geometry/Point.js";import{isLoaded as C,canProjectWithoutEngine as F,load as N,project as I}from"../../geometry/projection.js";import V from"../../geometry/SpatialReference.js";import{getClosestDenormalizedXToReference as q,getDenormalizedExtent as L}from"../../geometry/support/normalizeUtils.js";import{equals as P,isValid as U,getInfo as E}from"../../geometry/support/spatialReferenceUtils.js";const O=96,Q=39.37,T=180/Math.PI;function B(t){return t.wkid?t:t.spatialReference||V.WGS84}function D(t,e){return e.type?p(t,e.x,e.y):A(t,e)}function W(t){return n(t)}function H(t,e,n=0){let o=t.width,a=t.height;if(0!==n){const e=r(n),i=Math.abs(Math.cos(e)),c=Math.abs(Math.sin(e));o=t.width*i+t.height*c,a=t.width*c+t.height*i}const i=Math.max(1,e[0]),c=Math.max(1,e[1]);return Math.max(o/i,a/c)*ct(t.spatialReference)}async function J(t,r,n,o){let a,i;if(!t)return null;if(Array.isArray(t)&&!t.length)return null;if(e.isCollection(t)&&(t=t.toArray()),Array.isArray(t)&&t.length&&"object"==typeof t[0]){const e=t.every((t=>"attributes"in t)),a=t.some((t=>!t.geometry));let i=t;if(e&&a&&r&&r.allLayerViews){const e=new Map;for(const r of t){const t=r.layer,n=e.get(t)||[],o=r.attributes[t.objectIdField];null!=o&&n.push(o),e.set(t,n)}const n=[];e.forEach(((t,e)=>{const o=r.allLayerViews.find((t=>t.layer.id===e.id));if(o&&"queryFeatures"in o){const r=e.createQuery();r.objectIds=t,r.returnGeometry=!0,n.push(o.queryFeatures(r))}}));const o=await Promise.all(n),a=[];for(const t of o)if(t&&t.features&&t.features.length)for(const e of t.features)null!=e.geometry&&a.push(e.geometry);i=a}for(const t of i)o=await J(t,r,n,o);return o}if(Array.isArray(t)&&2===t.length&&"number"==typeof t[0]&&"number"==typeof t[1])a=new z(t);else if(t instanceof v)a=t;else if("geometry"in t)if(t.geometry)a=t.geometry;else if(t.layer){const e=t.layer,n=r.allLayerViews.find((t=>t.layer.id===e.id));if(n&&"queryFeatures"in n){const r=e.createQuery();r.objectIds=[t.attributes[e.objectIdField]],r.returnGeometry=!0;const o=await n.queryFeatures(r);a=o?.features?.[0]?.geometry}}if(null==a)return null;switch(a.type){case"point":i=new M({xmin:a.x,ymin:a.y,xmax:a.x,ymax:a.y,spatialReference:a.spatialReference});break;case"extent":case"multipoint":case"polygon":case"polyline":i=L(a);break;default:i=a.extent}if(!i)return null;C()||F(i.spatialReference,n)||await N();const c=I(i,n);if(!c)return null;if(o){const t=c.center,e=t.clone();e.x=q(t.x,o.center.x,n),e.x!==t.x&&c.centerAt(e),o=o.union(c)}else o=c;return o}function K(t){if(t&&(!Array.isArray(t)||"number"!=typeof t[0])&&("object"==typeof t||Array.isArray(t)&&"object"==typeof t[0])){if("layer"in t&&null!=t.layer?.minScale&&null!=t.layer.maxScale){const e=t.layer;return{min:e.minScale,max:e.maxScale}}if(Array.isArray(t)&&t.length&&t.every((t=>"layer"in t))){let e=0,r=0;for(const n of t){const t=n.layer;t?.minScale&&t.maxScale&&(e=t.minScale<e?t.minScale:e,r=t.maxScale>r?t.maxScale:r)}return e&&r?{min:e,max:r}:null}}}function X(t,e){const r=B(t);return P(r,e)||r.imageCoordinateSystem||e.imageCoordinateSystem?t:I(t,e)}async function Y(e,r){if(!e||!r)return new t({targetGeometry:new z,scale:0,rotation:0});let n=r.spatialReference;const{constraints:o,padding:a,viewpoint:i,size:c}=r,s=[a?c[0]-a.left-a.right:c[0],a?c[1]-a.top-a.bottom:c[1]];let u=null;e instanceof t?u=e:e.viewpoint?u=e.viewpoint:e.target&&"esri.Viewpoint"===e.target.declaredClass&&(u=e.target);let l=null;u?.targetGeometry?l=u.targetGeometry:e instanceof M?l=e:e instanceof v?l=await J(e,r,n):e&&(l=await J(e.center,r,n)||await J(e.target,r,n)||await J(e,r,n)),!l&&i?.targetGeometry?l=i.targetGeometry:!l&&r.extent&&(l=r.extent),n||(n=B(r.spatialReference||r.extent||l)),C()||P(l.spatialReference,n)||F(l.spatialReference,n)||await N();const f=X(l,n),m="center"in f?f.center:f;!1!==r.pickClosestTarget&&"point"===m.type&&"point"===i.targetGeometry?.type&&(m.x=q(m.x,i.targetGeometry.x,m.spatialReference));let y=0;u?y=u.rotation:e.hasOwnProperty("rotation")?y=e.rotation:i&&(y=i.rotation);let p=0;p=null!=u?.targetGeometry&&"point"===u.targetGeometry.type?u.scale:"scale"in e&&e.scale?e.scale:"zoom"in e&&-1!==e.zoom&&o&&o.effectiveLODs?o.zoomToScale(e.zoom):Array.isArray(l)||"point"===l.type||"extent"===l.type&&0===l.width&&0===l.height?i.scale:H(X(l.extent,n),s,y);const g=K(e.target??e);g&&(g.min&&g.min<p?p=g.min:g.max&&g.max>p&&(p=g.max));let x=new t({targetGeometry:m,scale:p,rotation:y});return o&&(x=o.fit(x),o.constrainByGeometry(x),o.rotationEnabled||(x.rotation=i.rotation)),x}function Z(t,e){const r=t.targetGeometry,n=e.targetGeometry;return r.x=n.x,r.y=n.y,r.spatialReference=n.spatialReference,t.scale=e.scale,t.rotation=e.rotation,t}function $(t,e,r){return r?p(t,.5*(e[0]-r.right+r.left),.5*(e[1]-r.bottom+r.top)):y(t,e,.5)}const _=function(){const t=k();return function(e,r,n){const o=r.targetGeometry;D(t,o);const a=.5*ot(r);return e.xmin=t[0]-a*n[0],e.ymin=t[1]-a*n[1],e.xmax=t[0]+a*n[0],e.ymax=t[1]+a*n[1],e.spatialReference=o.spatialReference,e}}();function tt(t,e,r,n,o){return xt(t,e,r.center),t.scale=H(r,n),o?.constraints?.constrain(t),t}function et(t,e,r,n){return lt(t,e,r,n),f(t,t)}const rt=function(){const t=k();return function(e,r,n){return g(e,st(e,r),$(t,r,n))}}(),nt=function(){const t=m(),e=k();return function(r,n,o,s){const u=ot(n),l=it(n);return p(e,u,u),a(t,e),i(t,t,l),c(t,t,rt(e,o,s)),c(t,t,[0,s.top-s.bottom]),p(r,t[4],t[5])}}();function ot(t){return t.scale*at(t.targetGeometry?.spatialReference)}function at(t){return U(t)?1/(W(t)*Q*O):1}function it(t){return o(t.rotation)||0}function ct(t){return U(t)?W(t)*Q*O:1}function st(t,e){return y(t,e,.5)}const ut=function(){const t=k(),e=k(),r=k();return function(n,o,a,l,f,m){return x(t,o),y(e,a,.5*m),p(r,1/l*m,-1/l*m),s(n,e),f&&i(n,n,f),u(n,n,r),c(n,n,t),n}}(),lt=function(){const t=k();return function(e,r,n,o){const a=ot(r),i=it(r);return D(t,r.targetGeometry),ut(e,t,n,a,i,o)}}(),ft=function(){const t=k();return function(e,r,n,o){const a=ot(r);return D(t,r.targetGeometry),ut(e,t,n,a,0,o)}}();function mt(t){const e=E(t);return e?e.valid[1]-e.valid[0]:0}function yt(t,e){return Math.round(mt(t)/e)}const pt=function(){const t=k(),e=k(),r=[0,0,0];return function(n,o,a){h(t,n,o),b(t,t),h(e,n,a),b(e,e),w(r,t,e);let i=Math.acos(d(t,e)/(j(t)*j(e)))*T;return r[2]<0&&(i=-i),isNaN(i)&&(i=0),i}}(),gt=function(){const t=k();return function(e,r,n,o){const a=e.targetGeometry;return Z(e,r),nt(t,r,n,o),a.x+=t[0],a.y+=t[1],e}}(),xt=function(t,e,r){Z(t,e);const n=t.targetGeometry;return n.x=r.x,n.y=r.y,n.spatialReference=r.spatialReference,t},ht=function(){const t=k();return function(e,r,n,o,a){a||(a="center"),g(t,n,o),y(t,t,.5);const i=t[0],c=t[1];switch(a){case"center":p(t,0,0);break;case"left":p(t,-i,0);break;case"top":p(t,0,c);break;case"right":p(t,i,0);break;case"bottom":p(t,0,-c);break;case"top-left":p(t,-i,c);break;case"bottom-left":p(t,-i,-c);break;case"top-right":p(t,i,c);break;case"bottom-right":p(t,i,-c)}return kt(e,r,t),e}}();function bt(t,e,r){return Z(t,e),t.rotation+=r,t}function wt(t,e,r){return Z(t,e),t.rotation=r,t}const dt=function(){const t=k();return function(e,r,n,o,a){return Z(e,r),isNaN(n)||0===n||(At(t,o,r,a),e.scale=r.scale*n,St(t,t,e,a),kt(e,e,p(t,t[0]-o[0],o[1]-t[1]))),e}}();function jt(t,e,r){return Z(t,e),t.scale=r,t}const Gt=function(){const t=k();return function(e,r,n,o,a,i){return Z(e,r),isNaN(n)||0===n||(At(t,a,r,i),e.scale=r.scale*n,e.rotation+=o,St(t,t,e,i),kt(e,e,p(t,t[0]-a[0],a[1]-t[1]))),e}}(),Rt=function(){const t=k(),e=k();return function(r,n,o,a,i,c,s){return rt(e,c,s),G(t,i,e),a?Gt(r,n,o,a,t,c):dt(r,n,o,t,c)}}(),At=function(){const t=m();return function(e,r,n,o){return R(e,r,et(t,n,o,1))}}(),St=function(){const t=m();return function(e,r,n,o){return R(e,r,lt(t,n,o,1))}}(),kt=function(){const t=k(),e=m();return function(r,n,o){Z(r,n);const a=ot(n),i=r.targetGeometry;return l(e,it(n)),u(e,e,S(a,a)),R(t,o,e),i.x+=t[0],i.y+=t[1],r}}();export{gt as addPadding,pt as angleBetween,xt as centerAt,Z as copy,Y as create,H as extentToScale,$ as getAnchor,_ as getExtent,ut as getMatrix,nt as getPaddingMapTranslation,rt as getPaddingScreenTranslation,ot as getResolution,ct as getResolutionToScaleFactor,at as getScaleToResolutionFactor,lt as getTransform,ft as getTransformNoRotation,yt as getWorldScreenWidth,mt as getWorldWidth,Rt as padAndScaleAndRotateBy,ht as resize,bt as rotateBy,wt as rotateTo,Gt as scaleAndRotateBy,jt as scaleTo,tt as setExtent,At as toMap,St as toScreen,kt as translateBy};
5
+ import t from"../../Viewpoint.js";import e from"../../core/Collection.js";import{deg2rad as r}from"../../core/mathUtils.js";import{getMetersPerUnitForSR as n}from"../../core/unitUtils.js";import{toRadian as o}from"../../core/libs/gl-matrix-2/math/common.js";import{fromScaling as a,rotate as i,translate as c,fromTranslation as s,scale as u,fromRotation as l,invert as f}from"../../core/libs/gl-matrix-2/math/mat2d.js";import{create as m}from"../../core/libs/gl-matrix-2/factories/mat2df64.js";import{scale as y,set as p,sub as g,negate as x,subtract as h,normalize as b,cross as w,dot as d,length as j,add as G,transformMat2d as R,copy as A}from"../../core/libs/gl-matrix-2/math/vec2.js";import{fromValues as S,create as k}from"../../core/libs/gl-matrix-2/factories/vec2f64.js";import M from"../../geometry/Extent.js";import v from"../../geometry/Geometry.js";import z from"../../geometry/Point.js";import{isLoaded as C,canProjectWithoutEngine as F,load as N,project as I}from"../../geometry/projection.js";import V from"../../geometry/SpatialReference.js";import{getClosestDenormalizedXToReference as q,getDenormalizedExtent as L}from"../../geometry/support/normalizeUtils.js";import{equals as P,isValid as U,getInfo as E}from"../../geometry/support/spatialReferenceUtils.js";const O=96,Q=39.37,T=180/Math.PI;function B(t){return t.wkid?t:t.spatialReference||V.WGS84}function D(t,e){return e.type?p(t,e.x,e.y):A(t,e)}function W(t){return n(t)}function H(t,e,n=0){let o=t.width,a=t.height;if(0!==n){const e=r(n),i=Math.abs(Math.cos(e)),c=Math.abs(Math.sin(e));o=t.width*i+t.height*c,a=t.width*c+t.height*i}const i=Math.max(1,e[0]),c=Math.max(1,e[1]);return Math.max(o/i,a/c)*ct(t.spatialReference)}async function J(t,r,n,o){let a,i;if(!t)return null;if(Array.isArray(t)&&!t.length)return null;if(e.isCollection(t)&&(t=t.toArray()),Array.isArray(t)&&t.length&&"object"==typeof t[0]){const e=t.every((t=>"attributes"in t)),a=t.some((t=>!t.geometry));let i=t;if(e&&a&&r&&r.allLayerViews){const e=new Map;for(const r of t){const t=r.layer,n=e.get(t)||[],o=r.attributes[t.objectIdField];null!=o&&n.push(o),e.set(t,n)}const n=[];e.forEach(((t,e)=>{const o=r.allLayerViews?.find((t=>t.layer.id===e.id));if(o&&"queryFeatures"in o){const r=e.createQuery();r.objectIds=t,r.returnGeometry=!0,n.push(o.queryFeatures(r))}}));const o=await Promise.all(n),a=[];for(const t of o)if(t&&t.features&&t.features.length)for(const e of t.features)null!=e.geometry&&a.push(e.geometry);i=a}for(const t of i)o=await J(t,r,n,o);return o}if(Array.isArray(t)&&2===t.length&&"number"==typeof t[0]&&"number"==typeof t[1])a=new z(t);else if(t instanceof v)a=t;else if("geometry"in t)if(t.geometry)a=t.geometry;else if(t.layer){const e=t.layer,n=r.allLayerViews?.find((t=>t.layer.id===e.id));if(n&&"queryFeatures"in n){const r=e.createQuery();r.objectIds=[t.attributes[e.objectIdField]],r.returnGeometry=!0;const o=await n.queryFeatures(r);a=o?.features?.[0]?.geometry}}if(null==a)return null;switch(a.type){case"point":i=new M({xmin:a.x,ymin:a.y,xmax:a.x,ymax:a.y,spatialReference:a.spatialReference});break;case"extent":case"multipoint":case"polygon":case"polyline":i=L(a);break;default:i=a.extent}if(!i)return null;C()||F(i.spatialReference,n)||await N();const c=I(i,n);if(!c)return null;if(o){const t=c.center,e=t.clone();e.x=q(t.x,o.center.x,n),e.x!==t.x&&c.centerAt(e),o=o.union(c)}else o=c;return o}function K(t){if(t&&(!Array.isArray(t)||"number"!=typeof t[0])&&("object"==typeof t||Array.isArray(t)&&"object"==typeof t[0])){if("layer"in t&&null!=t.layer?.minScale&&null!=t.layer.maxScale){const e=t.layer;return{min:e.minScale,max:e.maxScale}}if(Array.isArray(t)&&t.length&&t.every((t=>"layer"in t))){let e=0,r=0;for(const n of t){const t=n.layer;t?.minScale&&t.maxScale&&(e=t.minScale<e?t.minScale:e,r=t.maxScale>r?t.maxScale:r)}return e&&r?{min:e,max:r}:null}}}function X(t,e){const r=B(t);return P(r,e)||r.imageCoordinateSystem||e.imageCoordinateSystem?t:I(t,e)}async function Y(e,r){if(!e||!r)return new t({targetGeometry:new z,scale:0,rotation:0});let n=r.spatialReference;const{constraints:o,padding:a,viewpoint:i,size:c}=r,s=[a?c[0]-a.left-a.right:c[0],a?c[1]-a.top-a.bottom:c[1]];let u=null;e instanceof t?u=e:e.viewpoint?u=e.viewpoint:e.target&&"esri.Viewpoint"===e.target.declaredClass&&(u=e.target);let l=null;u?.targetGeometry?l=u.targetGeometry:e instanceof M?l=e:e instanceof v?l=await J(e,r,n):e&&(l=await J(e.center,r,n)||await J(e.target,r,n)||await J(e,r,n)),!l&&i?.targetGeometry?l=i.targetGeometry:!l&&r.extent&&(l=r.extent),n||(n=B(r.spatialReference||r.extent||l)),C()||P(l.spatialReference,n)||F(l.spatialReference,n)||await N();const f=X(l,n),m="center"in f?f.center:f;!1!==r.pickClosestTarget&&"point"===m.type&&"point"===i.targetGeometry?.type&&(m.x=q(m.x,i.targetGeometry.x,m.spatialReference));let y=0;u?y=u.rotation:e.hasOwnProperty("rotation")?y=e.rotation:i&&(y=i.rotation);let p=0;p=null!=u?.targetGeometry&&"point"===u.targetGeometry.type?u.scale:"scale"in e&&e.scale?e.scale:"zoom"in e&&-1!==e.zoom&&o&&o.effectiveLODs?o.zoomToScale(e.zoom):Array.isArray(l)||"point"===l.type||"extent"===l.type&&0===l.width&&0===l.height?i.scale:H(X(l.extent,n),s,y);const g=K(e.target??e);g&&(g.min&&g.min<p?p=g.min:g.max&&g.max>p&&(p=g.max));let x=new t({targetGeometry:m,scale:p,rotation:y});return o&&(x=o.fit(x),o.constrainByGeometry(x),o.rotationEnabled||(x.rotation=i.rotation)),x}function Z(t,e){const r=t.targetGeometry,n=e.targetGeometry;return r.x=n.x,r.y=n.y,r.spatialReference=n.spatialReference,t.scale=e.scale,t.rotation=e.rotation,t}function $(t,e,r){return r?p(t,.5*(e[0]-r.right+r.left),.5*(e[1]-r.bottom+r.top)):y(t,e,.5)}const _=function(){const t=k();return function(e,r,n){const o=r.targetGeometry;D(t,o);const a=.5*ot(r);return e.xmin=t[0]-a*n[0],e.ymin=t[1]-a*n[1],e.xmax=t[0]+a*n[0],e.ymax=t[1]+a*n[1],e.spatialReference=o.spatialReference,e}}();function tt(t,e,r,n,o){return xt(t,e,r.center),t.scale=H(r,n),o?.constraints?.constrain(t),t}function et(t,e,r,n){return lt(t,e,r,n),f(t,t)}const rt=function(){const t=k();return function(e,r,n){return g(e,st(e,r),$(t,r,n))}}(),nt=function(){const t=m(),e=k();return function(r,n,o,s){const u=ot(n),l=it(n);return p(e,u,u),a(t,e),i(t,t,l),c(t,t,rt(e,o,s)),c(t,t,[0,s.top-s.bottom]),p(r,t[4],t[5])}}();function ot(t){return t.scale*at(t.targetGeometry?.spatialReference)}function at(t){return U(t)?1/(W(t)*Q*O):1}function it(t){return o(t.rotation)||0}function ct(t){return U(t)?W(t)*Q*O:1}function st(t,e){return y(t,e,.5)}const ut=function(){const t=k(),e=k(),r=k();return function(n,o,a,l,f,m){return x(t,o),y(e,a,.5*m),p(r,1/l*m,-1/l*m),s(n,e),f&&i(n,n,f),u(n,n,r),c(n,n,t),n}}(),lt=function(){const t=k();return function(e,r,n,o){const a=ot(r),i=it(r);return D(t,r.targetGeometry),ut(e,t,n,a,i,o)}}(),ft=function(){const t=k();return function(e,r,n,o){const a=ot(r);return D(t,r.targetGeometry),ut(e,t,n,a,0,o)}}();function mt(t){const e=E(t);return e?e.valid[1]-e.valid[0]:0}function yt(t,e){return Math.round(mt(t)/e)}const pt=function(){const t=k(),e=k(),r=[0,0,0];return function(n,o,a){h(t,n,o),b(t,t),h(e,n,a),b(e,e),w(r,t,e);let i=Math.acos(d(t,e)/(j(t)*j(e)))*T;return r[2]<0&&(i=-i),isNaN(i)&&(i=0),i}}(),gt=function(){const t=k();return function(e,r,n,o){const a=e.targetGeometry;return Z(e,r),nt(t,r,n,o),a.x+=t[0],a.y+=t[1],e}}(),xt=function(t,e,r){Z(t,e);const n=t.targetGeometry;return n.x=r.x,n.y=r.y,n.spatialReference=r.spatialReference,t},ht=function(){const t=k();return function(e,r,n,o,a){a||(a="center"),g(t,n,o),y(t,t,.5);const i=t[0],c=t[1];switch(a){case"center":p(t,0,0);break;case"left":p(t,-i,0);break;case"top":p(t,0,c);break;case"right":p(t,i,0);break;case"bottom":p(t,0,-c);break;case"top-left":p(t,-i,c);break;case"bottom-left":p(t,-i,-c);break;case"top-right":p(t,i,c);break;case"bottom-right":p(t,i,-c)}return kt(e,r,t),e}}();function bt(t,e,r){return Z(t,e),t.rotation+=r,t}function wt(t,e,r){return Z(t,e),t.rotation=r,t}const dt=function(){const t=k();return function(e,r,n,o,a){return Z(e,r),isNaN(n)||0===n||(At(t,o,r,a),e.scale=r.scale*n,St(t,t,e,a),kt(e,e,p(t,t[0]-o[0],o[1]-t[1]))),e}}();function jt(t,e,r){return Z(t,e),t.scale=r,t}const Gt=function(){const t=k();return function(e,r,n,o,a,i){return Z(e,r),isNaN(n)||0===n||(At(t,a,r,i),e.scale=r.scale*n,e.rotation+=o,St(t,t,e,i),kt(e,e,p(t,t[0]-a[0],a[1]-t[1]))),e}}(),Rt=function(){const t=k(),e=k();return function(r,n,o,a,i,c,s){return rt(e,c,s),G(t,i,e),a?Gt(r,n,o,a,t,c):dt(r,n,o,t,c)}}(),At=function(){const t=m();return function(e,r,n,o){return R(e,r,et(t,n,o,1))}}(),St=function(){const t=m();return function(e,r,n,o){return R(e,r,lt(t,n,o,1))}}(),kt=function(){const t=k(),e=m();return function(r,n,o){Z(r,n);const a=ot(n),i=r.targetGeometry;return l(e,it(n)),u(e,e,S(a,a)),R(t,o,e),i.x+=t[0],i.y+=t[1],r}}();export{gt as addPadding,pt as angleBetween,xt as centerAt,Z as copy,Y as create,H as extentToScale,$ as getAnchor,_ as getExtent,ut as getMatrix,nt as getPaddingMapTranslation,rt as getPaddingScreenTranslation,ot as getResolution,ct as getResolutionToScaleFactor,at as getScaleToResolutionFactor,lt as getTransform,ft as getTransformNoRotation,yt as getWorldScreenWidth,mt as getWorldWidth,Rt as padAndScaleAndRotateBy,ht as resize,bt as rotateBy,wt as rotateTo,Gt as scaleAndRotateBy,jt as scaleTo,tt as setExtent,At as toMap,St as toScreen,kt as translateBy};
@@ -2,4 +2,4 @@
2
2
  All material copyright ESRI, All Rights Reserved, unless otherwise specified.
3
3
  See https://js.arcgis.com/4.32/esri/copyright.txt for details.
4
4
  */
5
- import{_ as e}from"../../../chunks/tslib.es6.js";import t from"../../../core/Accessor.js";import"../../../core/has.js";import{disposeMaybe as r,releaseMaybe as s}from"../../../core/maybe.js";import{watch as o,sync as i}from"../../../core/reactiveUtils.js";import{property as a}from"../../../core/accessorSupport/decorators/property.js";import"../../../core/Logger.js";import"../../../core/RandomLCG.js";import{subclass as n}from"../../../core/accessorSupport/decorators/subclass.js";import{set as c,copy as u}from"../../../core/libs/gl-matrix-2/math/vec2.js";import{ZEROS as p}from"../../../core/libs/gl-matrix-2/factories/vec2f64.js";import{fromValues as l}from"../../../core/libs/gl-matrix-2/factories/vec4f64.js";import{isBaseLayer as d,isGroupLayer as m}from"../../../layers/support/layerUtils.js";import{BlendLayersPassParameters as h}from"./BlendLayersTechnique.js";import{TextureUpdate as f}from"./interfaces.js";import{LayerClass as _}from"./LayerClass.js";import{NeighborIndex as T}from"./NeighborIndex.js";import{isImageWithType as y}from"./TerrainData.js";import{isBlendableLayerView as g,isVectorTileLayerView as b,isVectorTileRenderInfo as x,isImageryTileRenderInfo as I,isImageSourceRenderInfo as w,isTextureTileRenderInfo as A,isVectorTilePerLayerInfo as j}from"./terrainUtils.js";import{ActivationTime as P}from"./TextureFader.js";import{TextureReference as O}from"./TextureReference.js";import{TileCompositor as C}from"./TileCompositor.js";import{TileRenderInfo as k}from"./TileRenderInfo.js";import E from"./TileTexture.js";import{TileUpdate as L}from"./TileUpdate.js";import{fallsWithinLayerView as R}from"./tileUtils.js";import{blendModeFromString as D}from"../webgl-engine/core/shaderLibrary/output/BlendOptions.js";import{BlendLayersOutput as M}from"../webgl-engine/core/shaderLibrary/terrain/BlendLayersOutput.js";import{createEmptyTexture as N}from"../webgl-engine/lib/glUtil3D.js";import{isCompressible as B}from"../../support/TextureCompressionHelper.js";import{TextureSamplingMode as S,TextureWrapMode as U,PixelFormat as G}from"../../webgl/enums.js";import{Texture as v}from"../../webgl/Texture.js";import{TextureDescriptor as F}from"../../webgl/TextureDescriptor.js";class H{constructor(e,t,r,s,o,i){this.start=e,this.end=t,this.blendMode=r,this.opacity=s,this.output=o,this.baseOpacity=i}}let q=class extends t{constructor(e){super(e),this._passParameters=new h,this._backgroundTexture=null,this._backgroundColor=null,this._backgroundDirty=!1}initialize(){this._maxAnisotropy=this.rctx.parameters.maxMaxAnisotropy,this._compositor=new C(this.rctx,this.techniques),this._ensureBackgroundTexture(this.tileSize),this.texturesBeingCompressed=0}dispose(){this._compositor=r(this._compositor),this._backgroundTexture=s(this._backgroundTexture)}get backgroundIsGrid(){return null==this._backgroundColor}get backgroundColor(){return this._backgroundColor}updateHeading(e){this._compositor?.updateHeading(e)}updateTileTexture(e,t){if(!e.renderData)return;const r=e.surface,s=r.baseOpacity;let o=0,i=0,a=this.tileSize,n=!1,c=!1;const u=r.view.state.contentPixelRatio;let p=!1;J.clear(),K.length=0;const l=e.layerInfo[_.MAP];let h=0,T=null;for(;h<l.length;h++){const t=r.layerViewByIndex(h,_.MAP),f=t.layer,y=!R(e,t),x=f.opacity,I=t.fullOpacity;if(c=c||d(f),g(t)){let e="normal"!==t.layer.blendMode;if(m(f.parent)){const t=f.parent.uid;null!=t&&""!==t&&(e=X(f.parent)||e)}e&&(p=e,n=!1)}if((y||0===x)&&!p){l[h].pendingUpdates&=~(L.TEXTURE_NOFADING&L.TEXTURE_FADING);continue}++i;const w=b(t),A=z(e,h,w);if(A){if(l[h].pendingUpdates&=~(L.TEXTURE_NOFADING&L.TEXTURE_FADING),m(f.parent)){const e=f.parent.uid;null!=e&&""!==e&&W(f.parent,h)}w?a=Math.max(a,this.tileSize*u):1===s&&1===I&&(t.isOpaque||this._dataToTexture(A)&&A.sourceLayerInfo.data.descriptor.isOpaque)&&(n=!0),++o,null===T&&(T=h)}}const y=a/this.tileSize,x=this._ensureBackgroundTexture(this.tileSize);0!==o&&null!==T?1===o&&!p&&this._useLayerTexture(e,T)||this._composeLayers(e,t,h-1,c,a,y,!n||p,J,p):$(e,i,x,t!==f.FADING)}_ensureBackgroundTexture(e){return null==this._backgroundTexture&&(this._backgroundTexture=this._buildTexture(e,!1),this._backgroundDirty=!0),this._backgroundDirty&&(this._compositor.bind(e),this._passParameters.offset=p,this._passParameters.scale=1,this._passParameters.opacity=1,this.backgroundColor&&(this._passParameters.backgroundColor=this.backgroundColor),this._compositor.drawBackground(this._passParameters,null!=this.backgroundColor),this._compositor.copyFBOToTexture(this._backgroundTexture),this._compositor.unbind(),this._backgroundDirty=!1),this._backgroundTexture}_useLayerTexture(e,t){const r=e.surface.layerViewByIndex(t,_.MAP),s=d(r.layer),o=s?e.surface.baseOpacity:1,i=s?1:e.surface.baseOpacity,a=r.fullOpacity,n=z(e,t,!1);return!!this._dataToTexture(n)&&(e.renderData.setTextureReference(new O(n.sourceLayerInfo.data,f.FADING,l(n.offset[0],n.offset[1],n.scale,n.scale),o,i,a)),!0)}_composeLayers(e,t,r,s,o,i,a,n,c){this._compositor.ensureBuffer(o);const u=e.surface.baseOpacity;let l=!1,m=S.LINEAR_MIPMAP_LINEAR,h=!1,f=0;for(let A=r;A>=0;A--){const t=e.surface.layerViewByIndex(A,_.MAP),r=t.layer,T=b(t),y=z(e,A,T),w=r.opacity,j=!R(e,t);if(!y||(0===w||j)&&!c)continue;const P=!d(r)&&!l;P&&(l=!0);let O=!1;n.forEach((e=>{e.start===A&&(e.output=s?M.Composite:a&&P?this.backgroundIsGrid?M.GridComposite:M.ColorComposite:M.Composite,e.baseOpacity=P?u:1,K.push(e),this._compositor.openGroup(o),O=!0)}));const C=0===f,k=O?M.GroupBackgroundComposite:a&&C?this.backgroundIsGrid?M.GridComposite:M.ColorComposite:M.Composite,E=D[g(t)?t.layer.blendMode:"normal"];for(this._passParameters.baseOpacity=P&&!O&&u<1?u:1,this._passParameters.opacity=w,x(y)?h=this._compositor.drawVectorData(this._passParameters,k,o,E,y,i,this.tileSize,h):I(y)?(this._compositor.drawRasterData(this._passParameters,k,o,E,y),V(y)&&(m=S.NEAREST)):this._dataToTexture(y)&&(this._passParameters.texture=y.sourceLayerInfo.data.texture,this._passParameters.offset=y.offset,this._passParameters.scale=y.scale,this._compositor.drawImageData(this._passParameters,k,o,E));K.length>0&&K[K.length-1].end===A;){const e=K.pop();this._passParameters.baseOpacity=e.baseOpacity,this._passParameters.opacity=e.opacity,this._passParameters.offset=p,this._passParameters.scale=1,this._compositor.drawGroup(this._passParameters,e.output,o,D[e.blendMode])}f++}const T=e.renderData,y=c||l&&u<1,w=T.ensureTexture(o,y,t,(()=>this._buildTexture(o,y,m)));this._compositor.copyFBOToTexture(w),this._compositor.unbind(),T.setTextureReference(new O(w,t,Y,l?1:u,0,1))}_dataToTexture(e){if(w(e)){const t=e.sourceLayerInfo,r=1===e.scale;t.data=this._buildTexture(t.data,!0,r),e.tile.setMemoryDirty()}return A(e)}setBackground(e){this._backgroundColor!==e&&(this._backgroundColor=e,this._backgroundDirty=!0)}_buildTexture(e,t,r=S.LINEAR_MIPMAP_LINEAR){if(null==e)return null;const s=new F;s.wrapMode=U.CLAMP_TO_EDGE,s.samplingMode="boolean"==typeof r?S.LINEAR_MIPMAP_LINEAR:r,s.maxAnisotropy=this._maxAnisotropy,s.preMultiplyAlpha=!0,s.flipped=!0,s.hasMipmap=!0,t||(s.pixelFormat=G.RGB);const o=this.rctx,i="boolean"==typeof r&&r;let a;if("number"==typeof e)s.width=s.height=e,a=this._buildTileTexture(s,e);else if(y(e))s.isOpaque=e.isOpaque,s.isOpaque&&(s.pixelFormat=G.RGB),a=this._buildTileTexture(s,e.element.width,i,e.element);else try{s.width=e.width,s.height=e.height,a=this._buildTileTexture(s,e.width,i,e)}catch(c){a=new E(N(o)),console.warn("TileRenderer: failed to execute 'texImage2D', cross-origin image may not be loaded.")}const n=o.bindTexture(a.texture,v.TEXTURE_UNIT_FOR_UPDATES);return a.generateMipmap(),o.bindTexture(n,v.TEXTURE_UNIT_FOR_UPDATES),a}_buildTileTexture(e,t,r=!1,s){const a=`${t} ${e.pixelFormat}`,n=this.cache.pop(a)??this.cache.pop(a+"compressed");if(r&&=B(s),n)return n.retain(),r&&n.texture.enableCompression(!0),n.texture.setData(s),n;e.shouldCompress=r;const c=new v(this.rctx,e);return c.setData(s)&&(this.texturesBeingCompressed++,this.addHandles([o((()=>c.isCompressing),(e=>{e?this.texturesBeingCompressed++:this.texturesBeingCompressed--}),i)])),new E(c,this.cache)}get test(){}};function z(e,t,r){Q.layerIndex=t,Q.vtlNeighborInfos.clear();const s=e.layerInfo[_.MAP][t];if(c(Q.offset,0,0),Q.tile=e,Q.scale=1,Q.sourceLod=e.lij,Q.sourceLayerInfo=s,Q.isVTLBackground=r,s.data)return r&&e.forEachLoadedNeighbor(((r,o)=>{if(r.level!==e.level)return;const i=r.layerInfo[_.MAP][t];if(!j(i)||s.data===i.data)return;const a=Q.vtlNeighborInfos.pushNew();a.offset=Z[o],a.sourceLod=r.lij,a.sourceLayerInfo=i})),Q;const o=s.upsampleInfo,i=o?.tile?.layerInfo[_.MAP][t];return i&&o.tile?(Q.tile=o.tile,u(Q.offset,o.offset),Q.scale=o.scale,Q.sourceLod=o.tile.lij,Q.sourceLayerInfo=i,Q):r?Q:null}function V(e){const t=e.sourceLayerInfo.data;return!!t.source&&"nearest"===t.interpolation}function X(e){let t="normal"!==e.blendMode;return m(e.parent)&&(t=X(e.parent)||t),t}function W(e,t){m(e.parent)&&W(e.parent,t);const r=e.uid;if(null!=r&&""!==r){const s=J.get(r);s?s.start=t:J.set(r,new H(t,t,e.blendMode,e.opacity,M.Composite,1))}}function $(e,t,r,s){const o=e.renderData,i=!s&&null!=o.textureReference&&(e.surface.view.layerViewManager.updating||t>0)?P.Delayed:P.Immediate;o.setTextureReference(new O(r,f.FADING,Y,e.surface.baseOpacity,0,1),i)}e([a({constructOnly:!0})],q.prototype,"rctx",void 0),e([a({constructOnly:!0})],q.prototype,"techniques",void 0),e([a({constructOnly:!0})],q.prototype,"cache",void 0),e([a()],q.prototype,"tileSize",void 0),e([a()],q.prototype,"texturesBeingCompressed",void 0),q=e([n("esri.views.3d.terrain.TileRenderer")],q);const J=new Map,K=new Array,Q=new k,Y=l(0,0,1,1),Z=new Array;Z[T.NORTH]=[0,-1],Z[T.NORTH_EAST]=[-1,-1],Z[T.EAST]=[-1,0],Z[T.SOUTH_EAST]=[-1,1],Z[T.SOUTH]=[0,1],Z[T.SOUTH_WEST]=[1,1],Z[T.WEST]=[1,0],Z[T.NORTH_WEST]=[1,-1];export{H as GroupInfo,q as TileRenderer};
5
+ import{_ as e}from"../../../chunks/tslib.es6.js";import t from"../../../core/Accessor.js";import"../../../core/has.js";import{disposeMaybe as r,releaseMaybe as s}from"../../../core/maybe.js";import{watch as o,sync as i}from"../../../core/reactiveUtils.js";import{property as a}from"../../../core/accessorSupport/decorators/property.js";import"../../../core/Logger.js";import"../../../core/RandomLCG.js";import{subclass as n}from"../../../core/accessorSupport/decorators/subclass.js";import{set as c,copy as u}from"../../../core/libs/gl-matrix-2/math/vec2.js";import{ZEROS as p}from"../../../core/libs/gl-matrix-2/factories/vec2f64.js";import{fromValues as l}from"../../../core/libs/gl-matrix-2/factories/vec4f64.js";import{isBaseLayer as d,isGroupLayer as m}from"../../../layers/support/layerUtils.js";import{BlendLayersPassParameters as h}from"./BlendLayersTechnique.js";import{TextureUpdate as f}from"./interfaces.js";import{LayerClass as _}from"./LayerClass.js";import{NeighborIndex as T}from"./NeighborIndex.js";import{isImageWithType as y}from"./TerrainData.js";import{isBlendableLayerView as g,isVectorTileLayerView as b,isVectorTileRenderInfo as x,isImageryTileRenderInfo as I,isImageSourceRenderInfo as w,isTextureTileRenderInfo as A,isVectorTilePerLayerInfo as j}from"./terrainUtils.js";import{ActivationTime as P}from"./TextureFader.js";import{TextureReference as C}from"./TextureReference.js";import{TileCompositor as O}from"./TileCompositor.js";import{TileRenderInfo as k}from"./TileRenderInfo.js";import E from"./TileTexture.js";import{TileUpdate as L}from"./TileUpdate.js";import{fallsWithinLayerView as R}from"./tileUtils.js";import{blendModeFromString as M}from"../webgl-engine/core/shaderLibrary/output/BlendOptions.js";import{BlendLayersOutput as D}from"../webgl-engine/core/shaderLibrary/terrain/BlendLayersOutput.js";import{createEmptyTexture as N}from"../webgl-engine/lib/glUtil3D.js";import{isCompressible as B}from"../../support/TextureCompressionHelper.js";import{TextureSamplingMode as S,TextureWrapMode as U,PixelFormat as G}from"../../webgl/enums.js";import{Texture as v}from"../../webgl/Texture.js";import{TextureDescriptor as F}from"../../webgl/TextureDescriptor.js";class H{constructor(e,t,r,s,o,i){this.start=e,this.end=t,this.blendMode=r,this.opacity=s,this.output=o,this.baseOpacity=i}}let q=class extends t{constructor(e){super(e),this._passParameters=new h,this._backgroundTexture=null,this._backgroundColor=null,this._backgroundDirty=!1}initialize(){this._maxAnisotropy=this.rctx.parameters.maxMaxAnisotropy,this._compositor=new O(this.rctx,this.techniques),this._ensureBackgroundTexture(this.tileSize),this.texturesBeingCompressed=0}dispose(){this._compositor=r(this._compositor),this._backgroundTexture=s(this._backgroundTexture)}get backgroundIsGrid(){return null==this._backgroundColor}get backgroundColor(){return this._backgroundColor}updateHeading(e){this._compositor?.updateHeading(e)}updateTileTexture(e,t){if(!e.renderData)return;const r=e.surface,s=r.baseOpacity;let o=0,i=0,a=this.tileSize,n=!1,c=!1;const u=r.view.state.contentPixelRatio;let p=!1;J.clear(),K.length=0;const l=e.layerInfo[_.MAP];let h=0,T=null;for(;h<l.length;h++){const t=r.layerViewByIndex(h,_.MAP),f=t.layer,y=!R(e,t),x=f.opacity,I=t.fullOpacity;if(c=c||d(f),g(t)){let e="normal"!==t.layer.blendMode;if(m(f.parent)){const t=f.parent.uid;null!=t&&""!==t&&(e=X(f.parent)||e)}e&&(p=e,n=!1)}if((y||0===x)&&!p){l[h].pendingUpdates&=~(L.TEXTURE_NOFADING&L.TEXTURE_FADING);continue}++i;const w=b(t),A=z(e,h,w);if(A){if(l[h].pendingUpdates&=~(L.TEXTURE_NOFADING&L.TEXTURE_FADING),m(f.parent)){const e=f.parent.uid;null!=e&&""!==e&&W(f.parent,h)}w?a=Math.max(a,this.tileSize*u):1===s&&1===I&&(t.isOpaque||this._dataToTexture(A)&&A.sourceLayerInfo.data.descriptor.isOpaque)&&(n=!0),++o,null===T&&(T=h)}}const y=a/this.tileSize,x=this._ensureBackgroundTexture(this.tileSize);0!==o&&null!==T?1===o&&!p&&this._useLayerTexture(e,T)||this._composeLayers(e,t,h-1,c,a,y,!n||p,J,p):$(e,i,x,t!==f.FADING)}_ensureBackgroundTexture(e){return null==this._backgroundTexture&&(this._backgroundTexture=this._buildTexture(e,!1),this._backgroundDirty=!0),this._backgroundDirty&&(this._compositor.bind(e),this._passParameters.offset=p,this._passParameters.scale=1,this._passParameters.opacity=1,this.backgroundColor&&(this._passParameters.backgroundColor=this.backgroundColor),this._compositor.drawBackground(this._passParameters,null!=this.backgroundColor),this._compositor.copyFBOToTexture(this._backgroundTexture),this._compositor.unbind(),this._backgroundDirty=!1),this._backgroundTexture}_useLayerTexture(e,t){const r=e.surface.layerViewByIndex(t,_.MAP),s=d(r.layer),o=s?e.surface.baseOpacity:1,i=s?1:e.surface.baseOpacity,a=r.fullOpacity,n=z(e,t,!1);return!!this._dataToTexture(n)&&(e.renderData.setTextureReference(new C(n.sourceLayerInfo.data,f.FADING,l(n.offset[0],n.offset[1],n.scale,n.scale),o,i,a)),!0)}_composeLayers(e,t,r,s,o,i,a,n,c){this._compositor.ensureBuffer(o);const u=e.surface.baseOpacity;let l=!1,m=S.LINEAR_MIPMAP_LINEAR,h=!1,f=0;for(let A=r;A>=0;A--){const t=e.surface.layerViewByIndex(A,_.MAP),r=t.layer,T=b(t),y=z(e,A,T),w=r.opacity,j=!R(e,t);if(!y||(0===w||j)&&!c)continue;const P=!d(r)&&!l;P&&(l=!0);let C=!1;n.forEach((e=>{e.start===A&&(e.output=s?D.Composite:a&&P?this.backgroundIsGrid?D.GridComposite:D.ColorComposite:D.Composite,e.baseOpacity=P?u:1,K.push(e),this._compositor.openGroup(o),C=!0)}));const O=0===f,k=C?D.GroupBackgroundComposite:a&&O?this.backgroundIsGrid?D.GridComposite:D.ColorComposite:D.Composite,E=M[g(t)?t.layer.blendMode:"normal"];for(this._passParameters.baseOpacity=P&&!C&&u<1?u:1,this._passParameters.opacity=w,x(y)?h=this._compositor.drawVectorData(this._passParameters,k,o,E,y,i,this.tileSize,h):I(y)?(this._compositor.drawRasterData(this._passParameters,k,o,E,y),V(y)&&(m=S.NEAREST)):this._dataToTexture(y)&&(this._passParameters.texture=y.sourceLayerInfo.data.texture,this._passParameters.offset=y.offset,this._passParameters.scale=y.scale,this._compositor.drawImageData(this._passParameters,k,o,E));K.length>0&&K[K.length-1].end===A;){const e=K.pop();this._passParameters.baseOpacity=e.baseOpacity,this._passParameters.opacity=e.opacity,this._passParameters.offset=p,this._passParameters.scale=1,this._compositor.drawGroup(this._passParameters,e.output,o,M[e.blendMode])}f++}const T=e.renderData,y=c||l&&u<1,w=T.ensureTexture(o,y,t,(()=>this._buildTexture(o,y,m)));this._compositor.copyFBOToTexture(w),this._compositor.unbind(),T.setTextureReference(new C(w,t,Y,l?1:u,0,1))}_dataToTexture(e){if(w(e)){const t=e.sourceLayerInfo,r=1===e.scale;t.data=this._buildTexture(t.data,!0,r),e.tile.setMemoryDirty()}return A(e)}setBackground(e){this._backgroundColor!==e&&(this._backgroundColor=e,this._backgroundDirty=!0)}_buildTexture(e,t,r=S.LINEAR_MIPMAP_LINEAR){if(null==e)return null;const s=new F;s.wrapMode=U.CLAMP_TO_EDGE,s.samplingMode="boolean"==typeof r?S.LINEAR_MIPMAP_LINEAR:r,s.maxAnisotropy=this._maxAnisotropy,s.preMultiplyAlpha=!0,s.flipped=!0,s.hasMipmap=!0,t||(s.pixelFormat=G.RGB);const o=this.rctx,i="boolean"==typeof r&&r;let a;if("number"==typeof e)s.width=s.height=e,a=this._buildTileTexture(s,e);else if(y(e))s.isOpaque=e.isOpaque,s.isOpaque&&(s.pixelFormat=G.RGB),a=this._buildTileTexture(s,e.element.width,i,e.element);else try{s.width=e.width,s.height=e.height,a=this._buildTileTexture(s,e.width,i,e)}catch(c){a=new E(N(o)),console.warn("TileRenderer: failed to execute 'texImage2D', cross-origin image may not be loaded.")}const n=o.bindTexture(a.texture,v.TEXTURE_UNIT_FOR_UPDATES);return a.generateMipmap(),o.bindTexture(n,v.TEXTURE_UNIT_FOR_UPDATES),a}_buildTileTexture(e,t,r=!1,s){const a=`${t} ${e.pixelFormat}`,n=this.cache.pop(a)??this.cache.pop(a+"compressed");if(r&&=B(s),n)return n.retain(),r&&n.texture.enableCompression(!0),n.texture.setData(s),n;e.shouldCompress=r;const c=new v(this.rctx,e,s);return c.isCompressing&&(this.texturesBeingCompressed++,this.addHandles([o((()=>c.isCompressing),(e=>{e?this.texturesBeingCompressed++:this.texturesBeingCompressed--}),i)])),new E(c,this.cache)}get test(){}};function z(e,t,r){Q.layerIndex=t,Q.vtlNeighborInfos.clear();const s=e.layerInfo[_.MAP][t];if(c(Q.offset,0,0),Q.tile=e,Q.scale=1,Q.sourceLod=e.lij,Q.sourceLayerInfo=s,Q.isVTLBackground=r,s.data)return r&&e.forEachLoadedNeighbor(((r,o)=>{if(r.level!==e.level)return;const i=r.layerInfo[_.MAP][t];if(!j(i)||s.data===i.data)return;const a=Q.vtlNeighborInfos.pushNew();a.offset=Z[o],a.sourceLod=r.lij,a.sourceLayerInfo=i})),Q;const o=s.upsampleInfo,i=o?.tile?.layerInfo[_.MAP][t];return i&&o.tile?(Q.tile=o.tile,u(Q.offset,o.offset),Q.scale=o.scale,Q.sourceLod=o.tile.lij,Q.sourceLayerInfo=i,Q):r?Q:null}function V(e){const t=e.sourceLayerInfo.data;return!!t.source&&"nearest"===t.interpolation}function X(e){let t="normal"!==e.blendMode;return m(e.parent)&&(t=X(e.parent)||t),t}function W(e,t){m(e.parent)&&W(e.parent,t);const r=e.uid;if(null!=r&&""!==r){const s=J.get(r);s?s.start=t:J.set(r,new H(t,t,e.blendMode,e.opacity,D.Composite,1))}}function $(e,t,r,s){const o=e.renderData,i=!s&&null!=o.textureReference&&(e.surface.view.layerViewManager.updating||t>0)?P.Delayed:P.Immediate;o.setTextureReference(new C(r,f.FADING,Y,e.surface.baseOpacity,0,1),i)}e([a({constructOnly:!0})],q.prototype,"rctx",void 0),e([a({constructOnly:!0})],q.prototype,"techniques",void 0),e([a({constructOnly:!0})],q.prototype,"cache",void 0),e([a()],q.prototype,"tileSize",void 0),e([a()],q.prototype,"texturesBeingCompressed",void 0),q=e([n("esri.views.3d.terrain.TileRenderer")],q);const J=new Map,K=new Array,Q=new k,Y=l(0,0,1,1),Z=new Array;Z[T.NORTH]=[0,-1],Z[T.NORTH_EAST]=[-1,-1],Z[T.EAST]=[-1,0],Z[T.SOUTH_EAST]=[-1,1],Z[T.SOUTH]=[0,1],Z[T.SOUTH_WEST]=[1,1],Z[T.WEST]=[1,0],Z[T.NORTH_WEST]=[1,-1];export{H as GroupInfo,q as TileRenderer};
@@ -2,4 +2,4 @@
2
2
  All material copyright ESRI, All Rights Reserved, unless otherwise specified.
3
3
  See https://js.arcgis.com/4.32/esri/copyright.txt for details.
4
4
  */
5
- class t{constructor(t=0,o=0){this.from=t,this.to=o}get numElements(){return this.to-this.from}}function o(t){const o=new Map;t.forAll((t=>o.set(t.from,t)));let e=!0;for(;e;){e=!1;for(let r=0;r<t.length;++r){const n=t.data[r],s=o.get(n.to);if(!s)return;n.to=s.to,o.delete(s.from),t.removeUnordered(s),e=!0}}}export{t as BufferRange,o as mergeAdjacentRanges};
5
+ class t{constructor(t=0,e=0){this.from=t,this.to=e}get numElements(){return this.to-this.from}}function e(t){if(t.length<2)return;const e=new Map;t.forAll((t=>e.set(t.from,t)));let o=!0;for(;o;){o=!1;for(let r=0;r<t.length;++r){const n=t.data[r],s=e.get(n.to);s&&(n.to=s.to,e.delete(s.from),t.removeUnordered(s),o=!0)}}}export{t as BufferRange,e as mergeAdjacentRanges};
@@ -2,4 +2,4 @@
2
2
  All material copyright ESRI, All Rights Reserved, unless otherwise specified.
3
3
  See https://js.arcgis.com/4.32/esri/copyright.txt for details.
4
4
  */
5
- import{_ as e}from"../chunks/tslib.es6.js";import t from"../Color.js";import i from"../Viewpoint.js";import s from"../core/Accessor.js";import r from"../core/Evented.js";import o from"../core/Promise.js";import{watch as a,whenOnce as n,initial as d,syncAndInitial as l}from"../core/reactiveUtils.js";import{property as h}from"../core/accessorSupport/decorators/property.js";import"../core/has.js";import"../core/Logger.js";import"../core/RandomLCG.js";import{subclass as m}from"../core/accessorSupport/decorators/subclass.js";import p from"../geometry/Extent.js";import c from"../geometry/SpatialReference.js";import y from"../layers/support/ExtentAndRotationGeoreference.js";import{MediaElementView as g}from"../layers/support/MediaElementView.js";import w from"../layers/support/VideoElement.js";import{DOMContainer as v}from"./DOMContainer.js";import{extentToScale as u}from"./2d/viewpointUtils.js";import{ViewStateManager as f}from"./2d/ViewStateManager.js";import j from"./2d/engine/webgl/Overlay.js";import V from"./2d/engine/webgl/OverlayContainer.js";const _=new t("#000");let C;async function E(){const[,{Stage:e}]=await Promise.all([import("./2d/webglDeps.js"),import("./2d/mapViewDeps.js")]);C=e}function x(e,t){const[i,s]=e,[r,o]=t,a=r/o,n=s*a,d=i/a;return i/s>=1?a>=1?n<=i?[n,s]:[i,d]:d<=s?[i,d]:[n,s]:a>=1?d<=s?[i,d]:[n,s]:n<=i?[n,s]:[i,d]}function M(e,t){const s=e&&u(e,t);return new i({targetGeometry:e.center,scale:s})}function b(e){return new p({xmin:0,ymin:0,xmax:e[0],ymax:e[1],spatialReference:{wkid:0}})}let R=class extends s{};R=e([m("esri.views.VideoView.Base")],R);let H=class extends(v(r.EventedMixin(o.EsriPromiseMixin(R)))){constructor(e){super(e),this.stateManager=new f,this._isValid=!1,this.layer=null,this.ready=!1,this.addHandles([a((()=>this.preconditionsReady),(e=>{e?this._startup():this._teardown()})),a((()=>this.layer),(()=>this.addResolvingPromise(n((()=>this.ready)))),d)])}initialize(){this.addResolvingPromise(E().then((()=>(this._isValid=!0,n((()=>this.ready))))))}destroy(){this._teardown()}get state(){return this.stateManager.state}get preconditionsReady(){return!(!this._isValid||0===this.width||0===this.height||0===this.videoWidth||0===this.videoHeight)}get videoHeight(){return this.layer?.videoHeight||0}get videoWidth(){return this.layer?.videoWidth||0}_startup(){if(!this.layer)return;const e=x(this.size,[this.videoWidth,this.videoHeight]),t=b(e),i=M(t,e);this._mediaElementView=new g({element:new w({video:this.layer.videoElement,georeference:new y({extent:t}),autoplay:!1}),spatialReference:new c({wkid:0})}),this.stateManager.startup(i,this.size,i.targetGeometry.spatialReference);const s=new C(this.surface,{renderingOptions:{samplingMode:"dynamic",edgeLabelsVisible:!0,labelsAnimationTime:125,labelCollisionsEnabled:!0},backgroundColor:_});this.stage=s,this.addHandles([a((()=>this.state.id),(()=>s.state=this.state),l),this.on("resize",(({width:e,height:t})=>{if(this._mediaElementView){const i=x([e,t],[this.videoWidth,this.videoHeight]),s=b(i);this._mediaElementView.element.georeference=new y({extent:s}),this.stateManager.viewpoint=M(s,i),this.stateManager.resize(e,t)}}))],"video-view");const r=new j(this._mediaElementView);this.overlayContainer=new V,this.overlayContainer.addChild(r),this.stage.addChild(this.overlayContainer),this._set("ready",!0)}_teardown(){this.stage.destroy(),this.stage=null,this._mediaElementView=null,this.overlayContainer.removeAllChildren(),this.overlayContainer=null,this.removeHandles("video-view"),this._set("ready",!1),this.stateManager.teardown()}};e([h()],H.prototype,"stateManager",void 0),e([h({readOnly:!0})],H.prototype,"state",null),e([h()],H.prototype,"_isValid",void 0),e([h()],H.prototype,"layer",void 0),e([h({readOnly:!0})],H.prototype,"preconditionsReady",null),e([h({readOnly:!0})],H.prototype,"ready",void 0),e([h({readOnly:!0})],H.prototype,"videoHeight",null),e([h({readOnly:!0})],H.prototype,"videoWidth",null),H=e([m("esri.views.VideoView")],H);const O=H;export{O as default};
5
+ import{_ as e}from"../chunks/tslib.es6.js";import t from"../Color.js";import i from"../Viewpoint.js";import s from"../core/Accessor.js";import r from"../core/Evented.js";import{destroyMaybe as o}from"../core/maybe.js";import n from"../core/Promise.js";import{watch as a,whenOnce as m,initial as l,syncAndInitial as p}from"../core/reactiveUtils.js";import{property as c}from"../core/accessorSupport/decorators/property.js";import{cast as h}from"../core/accessorSupport/decorators/cast.js";import"../core/has.js";import"../core/RandomLCG.js";import{subclass as d}from"../core/accessorSupport/decorators/subclass.js";import{ensureClass as g}from"../core/accessorSupport/ensureType.js";import f from"../geometry/Extent.js";import j from"../geometry/Point.js";import y from"../geometry/SpatialReference.js";import u from"../layers/support/ExtentAndRotationGeoreference.js";import{MediaElementView as w}from"../layers/support/MediaElementView.js";import b from"../layers/support/TileInfo.js";import v from"../layers/support/VideoElement.js";import{DOMContainer as M}from"./DOMContainer.js";import{Viewport2DMixin as _}from"./Viewport2DMixin.js";import x from"./2d/AnimationManager.js";import G from"./2d/MapViewConstraints.js";import"../core/Error.js";import"../core/scheduling.js";import"../core/Logger.js";import"../core/accessorSupport/tracking/Flags.js";import"../core/colorUtils.js";import"../config.js";import"../symbols/cim/defaultCIMValues.js";import"../symbols/cim/enums.js";import"../core/floatRGBA.js";import"../geometry/Geometry.js";import"../geometry/Multipoint.js";import"../geometry/Polygon.js";import"../geometry/Polyline.js";import"./2d/engine/webgl/definitions.js";import"./2d/engine/webgl/animations/instructions.js";import"../core/mathUtils.js";import"../symbols/Font.js";import"../core/ObjectPool.js";import"../geometry/support/Axis.js";import"../geometry/support/spatialReferenceUtils.js";import"../geometry/support/TileClipper.js";import"../symbols/cim/effects/EffectAddControlPoints.js";import"../symbols/cim/effects/EffectArrow.js";import"../symbols/cim/effects/EffectBuffer.js";import"../symbols/cim/effects/EffectControlMeasureLine.js";import"../symbols/cim/effects/EffectCut.js";import"../symbols/cim/effects/EffectDashes.js";import"../symbols/cim/effects/EffectDonut.js";import"../symbols/cim/effects/EffectJog.js";import"../symbols/cim/effects/EffectMove.js";import"../symbols/cim/effects/EffectOffset.js";import"../symbols/cim/effects/EffectReverse.js";import"../symbols/cim/effects/EffectRotate.js";import"../symbols/cim/effects/EffectScale.js";import"../symbols/cim/effects/EffectWave.js";import"../symbols/cim/placements/PlacementAlongLineSameSize.js";import"../symbols/cim/placements/PlacementAtExtremities.js";import"../symbols/cim/placements/PlacementAtRatioPositions.js";import"../symbols/cim/placements/PlacementInsidePolygon.js";import"../symbols/cim/placements/PlacementOnLine.js";import"../symbols/cim/placements/PlacementOnVertices.js";import"../symbols/cim/placements/PlacementPolygonCenter.js";import"../core/libs/gl-matrix-2/factories/vec2f32.js";import"./2d/engine/webgl/alignmentUtils.js";import"../symbols/support/defaults.js";import"../symbols/cim/OverrideHelper.js";import"../layers/effects/EffectView.js";import"./2d/engine/transitions/FadeTransition.js";import"./2d/engine/webgl/enums.js";import"../core/libs/gl-matrix-2/factories/vec4f32.js";import"./webgl/checkWebGLError.js";import"./webgl/enums.js";import"./webgl/FramebufferObject.js";import"./webgl/GLObjectType.js";import"./webgl/Texture.js";import"./2d/engine/webgl/shaders/BackgroundPrograms.js";import"./2d/engine/webgl/DefaultVertexAttributeLayouts.js";import"./2d/engine/webgl/AFeatureTile.js";import"./2d/engine/webgl/DisplayEntity.js";import"./2d/engine/webgl/shaderGraph/techniques/featureTechniqueUtils.js";import"./2d/engine/webgl/number.js";import"./2d/engine/webgl/PooledUint32Array.js";import"./2d/engine/webgl/shaders/TileInfoPrograms.js";import"./2d/engine/vectorTiles/style/StyleDefinition.js";import"./2d/engine/vectorTiles/enums.js";import"./2d/engine/webgl/shaders/BitBlitPrograms.js";import"../request.js";import"../core/urlUtils.js";import"../core/pbf.js";import"./2d/engine/webgl/shaders/StencilPrograms.js";import"./2d/engine/webgl/shaderGraph/techniques/TechniqueType.js";import"./2d/engine/webgl/shaderGraph/techniques/shaders/BlendShader.js";import"./2d/engine/webgl/shaderGraph/techniques/shaders/OpacityShader.js";import"./2d/engine/webgl/shaders/HighlightPrograms.js";import"./2d/engine/webgl/meshing/SimpleMesh.js";import"./2d/engine/webgl/Profiler.js";import"./2d/engine/webgl/shaderGraph/techniques/TechniqueRegistry.js";import"./2d/engine/webgl/shaderGraph/techniques/shaders/constants.js";import"./2d/engine/webgl/shaderGraph/techniques/dotDensity/DotDensityMeshWriter.js";import"./2d/engine/webgl/shaderGraph/techniques/fill/ComplexFillMeshWriter.js";import"./2d/engine/webgl/shaderGraph/techniques/fill/ComplexOutlineFillMeshWriter.js";import"./2d/engine/webgl/shaderGraph/techniques/fill/FillMeshWriter.js";import"./2d/engine/webgl/shaderGraph/techniques/fill/GradientFillMeshWriter.js";import"./2d/engine/webgl/shaderGraph/techniques/fill/OutlineFillMeshWriter.js";import"./2d/engine/webgl/shaderGraph/techniques/fill/PatternFillMeshWriter.js";import"./2d/engine/webgl/shaderGraph/techniques/fill/PatternOutlineFillMeshWriter.js";import"./2d/engine/webgl/shaderGraph/techniques/heatmap/HeatmapMeshWriter.js";import"../geometry/support/aaBoundingBox.js";import"./2d/engine/webgl/shaderGraph/techniques/text/TextMeshWriter.js";import"./2d/engine/webgl/shaderGraph/techniques/line/GradientStrokeMeshWriter.js";import"./2d/engine/webgl/shaderGraph/techniques/line/LineMeshWriter.js";import"./2d/engine/webgl/shaderGraph/techniques/line/TexturedLineMeshWriter.js";import"./2d/engine/webgl/shaderGraph/techniques/markers/MarkerMeshWriter.js";import"../arcade/ArcadeDate.js";import"./2d/engine/webgl/shaderGraph/techniques/pieChart/PieChartMeshWriter.js";import"./webgl/renderState.js";import"./3d/webgl-engine/core/shaderModules/glsl.js";import"./webgl/testSVGPremultipliedAlpha.js";import"./2d/LabelManager.js";import"./2d/layers/graphics/GraphicsView2D.js";import"../chunks/earcut.js";import"../core/libs/gl-matrix-2/factories/vec3f32.js";import"../geometry/support/normalizeUtilsCommon.js";import"../geometry/support/Ellipsoid.js";import"../kernel.js";import"./2d/layers/support/util.js";import C from"./2d/navigation/MapViewNavigation.js";import"../core/asyncUtils.js";import"../core/support/UpdatingHandles.js";import"./2d/engine/webgl/shaderGraph/techniques/shaders/MagnifierShader.js";import"../core/unitUtils.js";import"../geometry/ellipsoidUtils.js";import"../chunks/pe.js";import"../geometry/projection/projectors.js";import"./2d/engine/webgl/shaderGraph/techniques/shaders/GridShader.js";import"../geometry/support/geodesicConstants.js";import{ViewStateManager as S}from"./2d/ViewStateManager.js";import P from"./2d/engine/webgl/Overlay.js";import E from"./2d/engine/webgl/OverlayContainer.js";import q from"./navigation/Navigation.js";import V from"./ui/DefaultUI.js";import R from"./ui/2d/DefaultUI2D.js";const O=new t("#000");let T;async function W(){const[,{Stage:e}]=await Promise.all([import("./2d/webglDeps.js"),import("./2d/mapViewDeps.js")]);T=e}const z=.01;let k=class extends s{};k=e([d("esri.views.VideoView.Base")],k);let A=class extends(_(M(r.EventedMixin(n.EsriPromiseMixin(k))))){constructor(e){super(e),this._isValid=!1,this.stage=null,this.layer=null,this.navigation=new q,this.ready=!1,this.stateManager=new S({constraints:new G({view:this,minScale:1,maxScale:z})}),this.spatialReference=new y({wkid:0}),this.type="2d",this.ui=new R,this.addHandles([a((()=>this.preconditionsReady),(e=>e?this._startup():this._teardown())),a((()=>this.layer),(()=>this.addResolvingPromise(m((()=>this.ready)))),l),a((()=>[this.layer?.effect,this._overlayContainer,this.effect]),(()=>{this._overlayContainer&&(this._overlayContainer.effect=this.effect??this.layer?.effect??null)}),p),a((()=>this.videoSize),(([e,t])=>{this._extent&&e&&t&&(this._extent.xmax=e,this._extent.ymax=t)}))])}initialize(){this.addResolvingPromise(W().then((()=>(this._isValid=!0,m((()=>this.ready))))))}destroy(){this._teardown()}get constraintsInfo(){return{lods:null,spatialReference:this.spatialReference}}get effect(){return this.layer?.effect}set effect(e){this._override("effect",e)}get preconditionsReady(){return!(!this._isValid||0===this.width||0===this.height||0===this.videoSize[0]||0===this.videoSize[1])}get rendering(){return this.stage?.renderRequested??!1}get videoSize(){if(!this.layer?.videoWidth||!this.layer?.videoHeight)return[0,0];const[e,t]=this.size,i=(this.layer?.videoWidth||0)/(this.layer?.videoHeight||0),s=t*i,r=e/i;return e/t>=1?i>=1?s<=e?[s,t]:[e,r]:r<=t?[e,r]:[s,t]:i>=1?r<=t?[e,r]:[s,t]:s<=e?[s,t]:[e,r]}get scale(){return this.stateManager?.scale??0}set scale(e){this.stateManager&&(this.stateManager.scale=e)}_startup(){if(!this.layer)return;const e=this._getViewpoint();this.stateManager.startup(e,this.size,e.targetGeometry.spatialReference),this.stage=new T(this.surface,{renderingOptions:this.renderingOptions,backgroundColor:O}),this._prepareStage(this.stage);const t=new x({view:this});this._set("animationManager",t);const i=new C({view:this,animationManager:t});this._set("mapViewNavigation",i),this._updateConstraints(),this.frameTask.start(),this._set("ready",!0)}_teardown(){this.stage.destroy(),this.stage=null,this._videoElementView=null,this._overlayContainer.removeAllChildren(),this._overlayContainer=null,this.removeAllHandles(),this._set("ready",!1),this.stateManager.teardown(),this.frameTask.stop(),this.stationaryManager.clear(),this.frameTask=o(this.frameTask),this.goToManager.destroy(),this.inputManager.destroy(),this._set("inputManager",null)}_getViewpoint(){return new i({targetGeometry:new j({x:this.videoSize[0]/2,y:this.videoSize[1]/2,spatialReference:this.spatialReference}),scale:1})}_prepareStage(e){this.addHandles([a((()=>this.stationary),(t=>e.stationary=t),p),a((()=>this.state.id),(()=>e.state=this.state),p),a((()=>this.renderingOptions),(t=>e.renderingOptions=t),p)],"video-view"),this._extent=new f({xmin:0,ymin:0,xmax:this.videoSize[0],ymax:this.videoSize[1],spatialReference:{wkid:0}}),this._videoElementView=new w({element:new v({video:this.layer?.videoElement,georeference:new u({extent:this._extent}),autoplay:!1}),spatialReference:this.spatialReference});const t=new P(this._videoElementView);this._overlayContainer=new E,this._overlayContainer.addChild(t),this.stage.addChild(this._overlayContainer)}_updateConstraints(){this._updateZoomConstraints(),this._updatePanConstraints()}_updateZoomConstraints(){const e=this.videoSize,t=Math.max(e[0]/this.size[0],e[1]/this.size[1]),i=[];for(let r=t;r>z;r/=2)i.push(r);i.push(z);const{lods:s}=b.create({scales:i});this.constraints.set({lods:s,minScale:t})}_updatePanConstraints(){const e=e=>{if(!e.targetGeometry)return e;const[t,i]=this.videoSize,s=t*e.scale/2,r=i*e.scale/2,o=e.targetGeometry.clone();return o.x=Math.max(s,Math.min(t-s,o.x)),o.y=Math.max(r,Math.min(i-r,o.y)),e.targetGeometry=o,e};this.constraints.customConstraints.add({constrain:e,applyPanConstraint:e})}};e([c()],A.prototype,"_overlayContainer",void 0),e([c()],A.prototype,"_isValid",void 0),e([c()],A.prototype,"constraintsInfo",null),e([c()],A.prototype,"effect",null),e([c()],A.prototype,"layer",void 0),e([c({type:q,nonNullable:!0})],A.prototype,"navigation",void 0),e([c({readOnly:!0})],A.prototype,"preconditionsReady",null),e([c({readOnly:!0})],A.prototype,"ready",void 0),e([c({readOnly:!0})],A.prototype,"rendering",null),e([c()],A.prototype,"stateManager",void 0),e([c({readOnly:!0})],A.prototype,"videoSize",null),e([c()],A.prototype,"scale",null),e([c()],A.prototype,"spatialReference",void 0),e([c()],A.prototype,"type",void 0),e([c(),h((e=>e instanceof V?e:g(R,e)))],A.prototype,"ui",void 0),A=e([d("esri.views.VideoView")],A);const D=A;export{D as default};