import{__decorate as e}from"tslib";import{InvalidOperationError as t}from"../InvalidOperationError.js";import{serializable as r}from"../support/Serializable.js";import{watch as s}from"../support/observableUtils.js";import{isMapNotesSublayer as i}from"../utilities/_layers.js";import{SublayerExtension as n,SublayerSchema as o,SubSublayerExtensionCollection as a}from"./_SublayerExtension.js";const l="Map Notes sublayers cannot be created or configured from JSON. They must be created with an ESRI MapNotesSublayer object.",u="SublayerExtension collection for MapNotesLayerExtension is readonly";let y=class extends n{get sublayer(){return super.sublayer}get layerExtension(){return super.layerExtension}get sublayerExtensions(){return super.sublayerExtensions}get canChangeScale(){return!1}get canChangeOpacity(){return!1}get canToggleVisibility(){return!0}get hasFeatures(){return!0}constructor(e){super(e);const r=e?.sublayer;if(!this.sublayer&&!r?.$ref)throw new t(l);const s=this.sublayer?.layer??this.layerExtension?.layer;s&&s._fields&&this.schema?.fields&&(this.schema.fields.removeAll(),this.schema.fields.addMany(s._fields))}_capabilities(){return{...super._capabilities(),supportsQuery:!0,supportsStandardizedQueries:!0}}_createSchema(){return new h(this)}async _onInitialize(){await super._onInitialize(),s(this,"sublayer.layer",(e=>{e._fields&&this.schema?.fields&&(this.schema.fields.removeAll(),this.schema.fields.addMany(e._fields))}))}_isSupportedSublayer(e){return i(e)}_createSublayer(e){throw new t(l)}async _applySublayerProperties(e,t){}_createSublayerExtensionCollection(){return new p(this)}_serializeSublayer(e){return this._createSublayerRef()}};y=e([r],y);export{y as MapNotesSublayerExtension};class p extends a{get _layerExtension(){return super._layerExtension}constructor(e,t){super(e,"__GCX_NO_VALUE")}add(e,r){throw new t(u)}removeAt(e){throw new t(u)}reorder(e,r){throw new t(u)}reverse(){throw new t(u)}sort(e){throw new t(u)}splice(e,r,...s){throw new t(u)}_createClone(){return new p(this._parent)}_createSublayerExtension(e){return this._layerExtension._createSublayerExtension(e)}}let h=class extends o{get geometryType(){return this._getSetting("geometryType",this._getDefaultGeometryType())}set geometryType(e){this._setSetting("geometryType",e)}_getDefaultGeometryType(){const e=this._sublayerExtension.sublayer?.graphics.getItemAt(0)?.geometry?.type;return"Areas"===this._sublayerExtension.title||"Polygons"===this._sublayerExtension.title||"polygon"===e?"polygon":"Lines"===this._sublayerExtension.title||"Polylines"===this._sublayerExtension.title||"polyline"===e?"polyline":"Points"===this._sublayerExtension.title||"Text"===this._sublayerExtension.title||"point"===e?"point":"Multipoints"===this._sublayerExtension.title||"multipoint"===e?"multipoint":void 0}};h=e([r],h);export{h as MapNotesSublayerExtensionSchema};