{"version":3,"sources":["node_modules/@arcgis/core/webdoc/support/writeUtils.js"],"sourcesContent":["/*\nAll material copyright ESRI, All Rights Reserved, unless otherwise specified.\nSee https://js.arcgis.com/4.31/esri/copyright.txt for details.\n*/\nimport e from \"../../core/Error.js\";\nimport { clone as t } from \"../../core/lang.js\";\nimport { getDeepValue as n } from \"../../core/object.js\";\nimport { numberToJSON as r } from \"../../core/accessorSupport/extensions/serializableProperty/writer.js\";\nimport { isFeatureCollectionLayer as i } from \"../../layers/support/layerUtils.js\";\nconst o = new Set([\"bing-maps\", \"imagery\", \"imagery-tile\", \"map-image\", \"open-street-map\", \"tile\", \"unknown\", \"unsupported\", \"vector-tile\", \"web-tile\", \"wms\", \"wmts\"]),\n l = new Set([\"catalog\", \"csv\", \"feature\", \"geo-rss\", \"geojson\", \"group\", \"imagery\", \"imagery-tile\", \"kml\", \"knowledge-graph\", \"map-image\", \"map-notes\", \"media\", \"ogc-feature\", \"oriented-imagery\", \"route\", \"stream\", \"subtype-group\", \"tile\", \"unknown\", \"unsupported\", \"vector-tile\", \"web-tile\", \"wfs\", \"wms\", \"wmts\"]);\nfunction a(e) {\n o.delete(e), l.delete(e);\n}\nfunction s(e) {\n o.add(e), l.add(e);\n}\nfunction d(e) {\n return \"basemap\" === e.layerContainerType ? o : \"operational-layers\" === e.layerContainerType ? l : null;\n}\nfunction p(e, t) {\n if (t.restrictedWebMapWriting) {\n const n = d(t);\n return null == n || n.has(e.type) && !i(e);\n }\n return !0;\n}\nfunction u(e, t) {\n if (t) if (i(e)) {\n const r = n(\"featureCollection.layers\", t),\n i = r?.[0]?.layerDefinition;\n i && c(e, i);\n } else \"group\" !== e.type && c(e, t);\n}\nfunction c(e, t) {\n \"maxScale\" in e && (t.maxScale = r(e.maxScale) ?? void 0), \"minScale\" in e && (t.minScale = r(e.minScale) ?? void 0);\n}\nfunction m(e, t) {\n if (u(e, t), t && (t.id = e.id, \"blendMode\" in e && (t.blendMode = e.blendMode, \"normal\" === t.blendMode && delete t.blendMode), t.opacity = r(e.opacity) ?? void 0, t.title = e.title || \"Layer\", t.visibility = e.visible, \"legendEnabled\" in e && \"wmts\" !== e.type)) if (i(e)) {\n const n = t.featureCollection;\n n && (n.showLegend = e.legendEnabled);\n } else t.showLegend = e.legendEnabled;\n}\nfunction f(n, r, o) {\n if (!n.persistenceEnabled) return null;\n if (!(\"write\" in n) || !n.write) return o?.messages && o.messages.push(new e(\"layer:unsupported\", `Layers (${n.title}, ${n.id}) of type '${n.declaredClass}' cannot be persisted`, {\n layer: n\n })), null;\n if (i(n) && !n.isTable) r = n.resourceInfo;else if (p(n, o)) {\n const e = {};\n return n.write(e, o) ? e : null;\n }\n return null != r && m(n, r = t(r)), r;\n}\nexport { s as disableRestrictedWriting, a as enableRestrictedWriting, f as getLayerJSON };"],"mappings":"iIASA,IAAMA,EAAI,IAAI,IAAI,CAAC,YAAa,UAAW,eAAgB,YAAa,kBAAmB,OAAQ,UAAW,cAAe,cAAe,WAAY,MAAO,MAAM,CAAC,EACpKC,EAAI,IAAI,IAAI,CAAC,UAAW,MAAO,UAAW,UAAW,UAAW,QAAS,UAAW,eAAgB,MAAO,kBAAmB,YAAa,YAAa,QAAS,cAAe,mBAAoB,QAAS,SAAU,gBAAiB,OAAQ,UAAW,cAAe,cAAe,WAAY,MAAO,MAAO,MAAM,CAAC,EAO5T,SAASC,EAAE,EAAG,CACZ,OAAqB,EAAE,qBAAhB,UAAqCC,EAA6B,EAAE,qBAA3B,qBAAgDC,EAAI,IACtG,CACA,SAASC,EAAE,EAAGC,EAAG,CACf,GAAIA,EAAE,wBAAyB,CAC7B,IAAM,EAAIJ,EAAEI,CAAC,EACb,OAAe,GAAR,MAAa,EAAE,IAAI,EAAE,IAAI,GAAK,CAACC,EAAE,CAAC,CAC3C,CACA,MAAO,EACT,CACA,SAASC,EAAE,EAAGF,EAAG,CACf,GAAIA,EAAG,GAAIC,EAAE,CAAC,EAAG,CACf,IAAME,EAAIH,EAAE,2BAA4BA,CAAC,EACv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