/*
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 { Base, markType } from "./type";
import { JsonWriter } from "./JsonWriter";
import { stringReplace } from "./string";
/**
 * @hidden
 */
export let JsonDictionaryItem = /*@__PURE__*/ (() => {
    class JsonDictionaryItem extends Base {
        b() {
            let a = new JsonWriter();
            this.d(a);
            return a.toString();
        }
        d(a) {
        }
        a(a) {
            if (a == null) {
                return null;
            }
            return stringReplace(stringReplace(stringReplace(stringReplace(stringReplace(a, "\\", "\\\\"), "\t", "\\t"), "\"", "\\\""), "\r", "\\r"), "\n", "\\n");
        }
        static c(a) {
            if (a == null) {
                return null;
            }
            let b = "";
            let c = -1;
            for (let 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;
})();
