12345678910111213141516171819202122232425262728293031323334353637383940414243444546 |
- import {
- o
- } from "./chunk-SPWQ3AWG.js";
- // node_modules/@arcgis/core/core/jsonMap.js
- var s = class {
- constructor(s2, o3 = { ignoreUnknown: false, useNumericKeys: false }) {
- this._jsonToAPI = s2, this._options = o3, this.apiValues = [], this.jsonValues = [], this._apiToJSON = this._invertMap(s2), this.apiValues = this._getKeysSorted(this._apiToJSON), this.jsonValues = this._getKeysSorted(this._jsonToAPI), this.read = (t) => this.fromJSON(t), this.write = (s3, o4, i) => {
- const n = this.toJSON(s3);
- void 0 !== n && o(i, n, o4);
- }, this.write.isJSONMapWriter = true;
- }
- toJSON(t) {
- if (this._apiToJSON.hasOwnProperty(t)) {
- const s2 = this._apiToJSON[t];
- return this._options.useNumericKeys ? +s2 : s2;
- }
- return this._options.ignoreUnknown ? void 0 : t;
- }
- fromJSON(t) {
- return this._jsonToAPI.hasOwnProperty(t) ? this._jsonToAPI[t] : this._options.ignoreUnknown ? void 0 : t;
- }
- _invertMap(t) {
- const s2 = {};
- for (const o3 in t)
- s2[t[o3]] = o3;
- return s2;
- }
- _getKeysSorted(t) {
- const s2 = [];
- for (const o3 in t)
- s2.push(o3);
- return s2.sort(), s2;
- }
- };
- function o2() {
- return function(t, o3) {
- return new s(t, { ignoreUnknown: true, ...o3 });
- };
- }
- export {
- s,
- o2 as o
- };
- //# sourceMappingURL=chunk-HZRKBTHJ.js.map
|