import { s as s3 } from "./chunk-7N4X6GF3.js"; import { m } from "./chunk-TBBTRX4O.js"; import { n as n2 } from "./chunk-DT6EAZQ5.js"; import { U } from "./chunk-VNFRAYHO.js"; import { j } from "./chunk-VBRY5KJM.js"; import { M2 as M } from "./chunk-ECW2QABR.js"; import { k2 as k } from "./chunk-MRJEICT6.js"; import { d, e, n2 as n } from "./chunk-Y3WMVFTW.js"; import { g } from "./chunk-ULGDPLM2.js"; import { r, s, s3 as s2 } from "./chunk-EMJ4ZSM2.js"; // node_modules/@arcgis/core/layers/support/fromPortalItem.js var o = s.getLogger("esri.layers.support.fromPortalItem"); async function a(t) { const a2 = "portalItem" in t ? t : { portalItem: t }, e2 = await import("./portalLayers-42DONF4R.js"); try { return await e2.fromItem(a2); } catch (p) { const t2 = a2 && a2.portalItem, e3 = t2 && t2.id || "unset", l = t2 && t2.portal && t2.portal.url || r.portalUrl; throw o.error("#fromPortalItem()", "Failed to create layer from portal item (portal: '" + l + "', id: '" + e3 + "')", p), p; } } // node_modules/@arcgis/core/layers/Layer.js var m2 = 0; var h = class extends n2.EventedMixin(s3(m)) { constructor() { super(...arguments), this.attributionDataUrl = null, this.fullExtent = new M(-180, -90, 180, 90, k.WGS84), this.id = Date.now().toString(16) + "-layer-" + m2++, this.legendEnabled = true, this.listMode = "show", this.opacity = 1, this.parent = null, this.popupEnabled = true, this.attributionVisible = true, this.spatialReference = k.WGS84, this.title = null, this.type = null, this.url = null, this.visible = true; } static async fromArcGISServerUrl(t) { const e2 = typeof t == "string" ? { url: t } : t; return (await import("./arcgisLayers-HASRMKEU.js")).fromUrl(e2); } static fromPortalItem(t) { return a(t); } initialize() { this.when().catch((t) => { g(t) || s.getLogger(this.declaredClass).error("#load()", `Failed to load layer (title: '${this.title ?? "no title"}', id: '${this.id ?? "no id"}')`, { error: t }); }); } destroy() { if (this.parent) { const t = this, e2 = this.parent; "layers" in e2 && e2.layers.includes(t) ? e2.layers.remove(t) : "tables" in e2 && e2.tables.includes(t) ? e2.tables.remove(t) : "baseLayers" in e2 && e2.baseLayers.includes(t) ? e2.baseLayers.remove(t) : "baseLayers" in e2 && e2.referenceLayers.includes(t) && e2.referenceLayers.remove(t); } } get hasAttributionData() { return this.attributionDataUrl != null; } get parsedUrl() { const t = this.url; return t ? j(t) : null; } async fetchAttributionData() { const t = this.attributionDataUrl; if (this.hasAttributionData && t) { return (await U(t, { query: { f: "json" }, responseType: "json" })).data; } throw new s2("layer:no-attribution-data", "Layer does not have attribution data"); } }; e([d({ type: String })], h.prototype, "attributionDataUrl", void 0), e([d({ type: M })], h.prototype, "fullExtent", void 0), e([d({ readOnly: true })], h.prototype, "hasAttributionData", null), e([d({ type: String, clonable: false })], h.prototype, "id", void 0), e([d({ type: Boolean, nonNullable: true })], h.prototype, "legendEnabled", void 0), e([d({ type: ["show", "hide", "hide-children"] })], h.prototype, "listMode", void 0), e([d({ type: Number, range: { min: 0, max: 1 }, nonNullable: true })], h.prototype, "opacity", void 0), e([d({ clonable: false })], h.prototype, "parent", void 0), e([d({ readOnly: true })], h.prototype, "parsedUrl", null), e([d({ type: Boolean })], h.prototype, "popupEnabled", void 0), e([d({ type: Boolean })], h.prototype, "attributionVisible", void 0), e([d({ type: k })], h.prototype, "spatialReference", void 0), e([d({ type: String })], h.prototype, "title", void 0), e([d({ readOnly: true, json: { read: false } })], h.prototype, "type", void 0), e([d()], h.prototype, "url", void 0), e([d({ type: Boolean, nonNullable: true })], h.prototype, "visible", void 0), h = e([n("esri.layers.Layer")], h); var b = h; export { b }; //# sourceMappingURL=chunk-4DDBH2K5.js.map