/*
THIS INFRAGISTICS ULTIMATE SOFTWARE LICENSE  AGREEMENT ("AGREEMENT") LOCATED HERE:
https://www.infragistics.com/legal/license/igultimate-la
https://www.infragistics.com/legal/license/igultimate-eula
GOVERNS THE LICENSING, INSTALLATION AND USE OF INFRAGISTICS SOFTWARE. BY DOWNLOADING AND/OR INSTALLING AND USING INFRAGISTICS SOFTWARE:  you are indicating that you have read and understand this Agreement, and agree to be legally bound by it on behalf of the yourself and your company.
*/
import { __extends } from "tslib";
import { Base, markType } from "./type";
import { JsonWriter } from "./JsonWriter";
import { stringReplace } from "./string";
/**
 * @hidden
 */
var JsonDictionaryItem = /** @class */ /*@__PURE__*/ (function (_super) {
    __extends(JsonDictionaryItem, _super);
    function JsonDictionaryItem() {
        return _super !== null && _super.apply(this, arguments) || this;
    }
    JsonDictionaryItem.prototype.b = function () {
        var a = new JsonWriter();
        this.d(a);
        return a.toString();
    };
    JsonDictionaryItem.prototype.d = function (a) {
    };
    JsonDictionaryItem.prototype.a = function (a) {
        if (a == null) {
            return null;
        }
        return stringReplace(stringReplace(stringReplace(stringReplace(stringReplace(a, "\\", "\\\\"), "\t", "\\t"), "\"", "\\\""), "\r", "\\r"), "\n", "\\n");
    };
    JsonDictionaryItem.c = function (a) {
        if (a == null) {
            return null;
        }
        var b = "";
        var c = -1;
        for (var d = 0; d < a.length; d++) {
            if (a.charAt(d) == '\\' && c == -1) {
                c = d;
            }
            else {
                if (c == -1) {
                    b += a.charAt(d);
                }
                else {
                    if (a.charAt(d) == 'n') {
                        b += "\n";
                        c = -1;
                    }
                    else if (a.charAt(d) == 'r') {
                        b += "\r";
                        c = -1;
                    }
                    else if (a.charAt(d) == 't') {
                        b += "\t";
                        c = -1;
                    }
                    else if (a.charAt(d) == '\"') {
                        b += "\"";
                        c = -1;
                    }
                    else if (a.charAt(d) == '\\') {
                        b += "\\";
                        c = -1;
                    }
                    else {
                        b += "\\" + a.charAt(d);
                        c = -1;
                    }
                }
            }
        }
        return b;
    };
    JsonDictionaryItem.$t = markType(JsonDictionaryItem, 'JsonDictionaryItem');
    return JsonDictionaryItem;
}(Base));
export { JsonDictionaryItem };
