chunk-4YMGIMYW.js 2.2 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364
  1. import {
  2. a as a2
  3. } from "./chunk-4FQG6M7Q.js";
  4. import {
  5. a
  6. } from "./chunk-Y3WMVFTW.js";
  7. import {
  8. s3 as s
  9. } from "./chunk-EMJ4ZSM2.js";
  10. import {
  11. m,
  12. t
  13. } from "./chunk-IKP3YN53.js";
  14. import {
  15. r
  16. } from "./chunk-GZT4BVFP.js";
  17. // node_modules/@arcgis/core/webdoc/support/writeUtils.js
  18. var l = new Set(["bing-maps", "imagery", "imagery-tile", "map-image", "open-street-map", "tile", "unknown", "unsupported", "vector-tile", "web-tile", "wms", "wmts"]);
  19. 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"]);
  20. function p(e) {
  21. return e.layerContainerType === "basemap" ? l : e.layerContainerType === "operational-layers" ? a3 : null;
  22. }
  23. function c(e, t2) {
  24. if (t2.restrictedWebMapWriting) {
  25. const r2 = p(t2);
  26. return !r(r2) || r2.has(e.type) && !a2(e);
  27. }
  28. return true;
  29. }
  30. function u(e, t2) {
  31. if (a2(e)) {
  32. const n = t("featureCollection.layers", t2), i = n && n[0] && n[0].layerDefinition;
  33. i && d(e, i);
  34. } else if (e.type === "stream") {
  35. d(e, t2.layerDefinition = t2.layerDefinition || {});
  36. } else
  37. e.type !== "group" && d(e, t2);
  38. }
  39. function d(e, t2) {
  40. "maxScale" in e && (t2.maxScale = a(e.maxScale)), "minScale" in e && (t2.minScale = a(e.minScale));
  41. }
  42. function f(e, t2) {
  43. 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")
  44. if (a2(e)) {
  45. const n = t2.featureCollection;
  46. n && (n.showLegend = e.legendEnabled);
  47. } else
  48. t2.showLegend = e.legendEnabled;
  49. }
  50. function y(r2, i, o) {
  51. if (!("write" in r2) || !r2.write)
  52. 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;
  53. if (c(r2, o)) {
  54. const e = {};
  55. return r2.write(e, o) ? e : null;
  56. }
  57. return r(i) && f(r2, i = m(i)), i;
  58. }
  59. export {
  60. y
  61. };
  62. //# sourceMappingURL=chunk-4YMGIMYW.js.map