import { a as a2 } from "./chunk-4FQG6M7Q.js"; import { a } from "./chunk-Y3WMVFTW.js"; import { s3 as s } from "./chunk-EMJ4ZSM2.js"; import { m, t } from "./chunk-IKP3YN53.js"; import { r } from "./chunk-GZT4BVFP.js"; // node_modules/@arcgis/core/webdoc/support/writeUtils.js var l = new Set(["bing-maps", "imagery", "imagery-tile", "map-image", "open-street-map", "tile", "unknown", "unsupported", "vector-tile", "web-tile", "wms", "wmts"]); var a3 = new Set(["csv", "feature", "geo-rss", "geojson", "group", "imagery", "imagery-tile", "kml", "map-image", "map-notes", "ogc-feature", "route", "tile", "unknown", "unsupported", "vector-tile", "web-tile", "wfs", "wms", "wmts"]); function p(e) { return e.layerContainerType === "basemap" ? l : e.layerContainerType === "operational-layers" ? a3 : null; } function c(e, t2) { if (t2.restrictedWebMapWriting) { const r2 = p(t2); return !r(r2) || r2.has(e.type) && !a2(e); } return true; } function u(e, t2) { if (a2(e)) { const n = t("featureCollection.layers", t2), i = n && n[0] && n[0].layerDefinition; i && d(e, i); } else if (e.type === "stream") { d(e, t2.layerDefinition = t2.layerDefinition || {}); } else e.type !== "group" && d(e, t2); } function d(e, t2) { "maxScale" in e && (t2.maxScale = a(e.maxScale)), "minScale" in e && (t2.minScale = a(e.minScale)); } function f(e, t2) { if (u(e, t2), "blendMode" in e && (t2.blendMode = e.blendMode, t2.blendMode === "normal" && delete t2.blendMode), t2.opacity = a(e.opacity), t2.title = e.title || "Layer", t2.visibility = e.visible, "legendEnabled" in e && e.type !== "wmts") if (a2(e)) { const n = t2.featureCollection; n && (n.showLegend = e.legendEnabled); } else t2.showLegend = e.legendEnabled; } function y(r2, i, o) { if (!("write" in r2) || !r2.write) return o && o.messages && o.messages.push(new s("layer:unsupported", `Layers (${r2.title}, ${r2.id}) of type '${r2.declaredClass}' cannot be persisted`, { layer: r2 })), null; if (c(r2, o)) { const e = {}; return r2.write(e, o) ? e : null; } return r(i) && f(r2, i = m(i)), i; } export { y }; //# sourceMappingURL=chunk-4YMGIMYW.js.map