import{__decorate as e}from"tslib";import{serializable as t}from"../support/Serializable.js";import{notifyChange as r,watch as i}from"../support/observableUtils.js";import{ReadOnlyCollection as s}from"../utilities/ReadOnlyCollection.js";import{isSceneLayer as a}from"../utilities/_layers.js";import{LayerExtension as l,LayerExtensionSchema as n}from"./_LayerExtension.js";import{ArrayWrappedCollection as o}from"./support/ArrayWrappedCollection.js";import{PopupTemplateFeatureSettings as p}from"./support/PopupTemplateFeatureSettings.js";import{addOutFields as d}from"./support/layers.js";let u=class extends l{get layer(){return super.layer}get enableClientSideData(){return this._enableClientSideData}set enableClientSideData(e){this._enableClientSideData=e,this._updateClientSideFields()}_enableClientSideData;get renderer(){return this.layer?.renderer}get hasFeatures(){return!0}get canChangeLabels(){return!0}get canChangeRenderer(){return!0}get canChangeDefinitionExpression(){return!0}get _layerView(){return this.layer&&this.mapExtension?._allLayerViews.find((e=>e.layer===this.layer))}_capabilities(){return Object.freeze({supportsAdd:!1,supportsUpdate:!1,supportsDelete:!1,supportsEditing:!1,supportsQuery:!1,supportsAttachmentEditing:!1,supportsStandardizedQueries:!0})}async _onInitialize(){await super._onInitialize(),this._updateClientSideFields(),this._watchHandles.push(i(this,"layer",(()=>{this._updateClientSideFields()}),{sync:!0})),this.layer.associatedLayer||this.layer.outFields||(this.layer.outFields=this.layer.fields.map((e=>e.name)),this.layer.outFields&&!this.layer.outFields.includes(this.layer.objectIdField)&&this.layer.outFields.push(this.layer.objectIdField))}_getSerializableProperties(){const e=super._getSerializableProperties();return{...e,layer:{...this._toPropertyDef(e.layer),default:{layerType:"ArcGISSceneServiceLayer"}},enableClientSideData:{serializeModes:["initial"],default:!1}}}_isSupportedLayer(e){return a(e)}_createSchema(){return new y(this)}_createFeatureSettings(){return new p(this)}async _applyPortalItemProperties(e){if("Scene Service"!==e.type)throw new Error(`Cannot create Scene Layer from Portal item that has type: ${e.type}`);if(!e.typeKeywords.includes("3DObject")&&!e.typeKeywords.includes("Point"))throw new Error("Cannot create Scene Layer from Portal item that does not reference a Scene layer");this.layer.url=e.url||this.layer.url}_updateClientSideFields(){this.layer&&this._enableClientSideData&&d(this.layer,this.featureSettings.outFields)}};u=e([t],u);export{u as SceneLayerExtension};let y=class extends n{_fieldsCollection;constructor(e){super(e),this._fieldsCollection=new s(new o({parent:e,targetProperty:"layer",arrayProperty:"fields"})),r(this,"_fields")}_getPropertyBindings(){return{spatialReference:"spatialReference",geometryType:"geometryType"}}get _fields(){return this._fieldsCollection}};y=e([t],y);