{"version":3,"file":"index.2aa1178a.js","sources":["../../../node_modules/date-fns/esm/constants/index.js","../../../node_modules/date-fns/esm/_lib/requiredArgs/index.js","../../../node_modules/date-fns/esm/_lib/toInteger/index.js","../../../node_modules/date-fns/esm/parseISO/index.js","../../../node_modules/jsona/lib/utils.js","../../../node_modules/jsona/lib/builders/ModelsSerializer.js","../../../node_modules/jsona/lib/builders/JsonDeserializer.js","../../../node_modules/jsona/lib/builders/ReduxObjectDenormalizer.js","../../../node_modules/jsona/lib/simplePropertyMappers.js","../../../node_modules/jsona/lib/cache.js","../../../node_modules/jsona/lib/Jsona.js","../../../node_modules/jsona/lib/switchCasePropertyMappers.js","../../../node_modules/jsona/lib/index.js"],"sourcesContent":["/**\n * Days in 1 week.\n *\n * @name daysInWeek\n * @constant\n * @type {number}\n * @default\n */\nexport var daysInWeek = 7;\n/**\n * Days in 1 year\n * One years equals 365.2425 days according to the formula:\n *\n * > Leap year occures every 4 years, except for years that are divisable by 100 and not divisable by 400.\n * > 1 mean year = (365+1/4-1/100+1/400) days = 365.2425 days\n *\n * @name daysInYear\n * @constant\n * @type {number}\n * @default\n */\n\nexport var daysInYear = 365.2425;\n/**\n * Maximum allowed time.\n *\n * @name maxTime\n * @constant\n * @type {number}\n * @default\n */\n\nexport var maxTime = Math.pow(10, 8) * 24 * 60 * 60 * 1000;\n/**\n * Milliseconds in 1 minute\n *\n * @name millisecondsInMinute\n * @constant\n * @type {number}\n * @default\n */\n\nexport var millisecondsInMinute = 60000;\n/**\n * Milliseconds in 1 hour\n *\n * @name millisecondsInHour\n * @constant\n * @type {number}\n * @default\n */\n\nexport var millisecondsInHour = 3600000;\n/**\n * Milliseconds in 1 second\n *\n * @name millisecondsInSecond\n * @constant\n * @type {number}\n * @default\n */\n\nexport var millisecondsInSecond = 1000;\n/**\n * Minimum allowed time.\n *\n * @name minTime\n * @constant\n * @type {number}\n * @default\n */\n\nexport var minTime = -maxTime;\n/**\n * Minutes in 1 hour\n *\n * @name minutesInHour\n * @constant\n * @type {number}\n * @default\n */\n\nexport var minutesInHour = 60;\n/**\n * Months in 1 quarter\n *\n * @name monthsInQuarter\n * @constant\n * @type {number}\n * @default\n */\n\nexport var monthsInQuarter = 3;\n/**\n * Months in 1 year\n *\n * @name monthsInYear\n * @constant\n * @type {number}\n * @default\n */\n\nexport var monthsInYear = 12;\n/**\n * Quarters in 1 year\n *\n * @name quartersInYear\n * @constant\n * @type {number}\n * @default\n */\n\nexport var quartersInYear = 4;\n/**\n * Seconds in 1 hour\n *\n * @name secondsInHour\n * @constant\n * @type {number}\n * @default\n */\n\nexport var secondsInHour = 3600;\n/**\n * Seconds in 1 minute\n *\n * @name secondsInMinute\n * @constant\n * @type {number}\n * @default\n */\n\nexport var secondsInMinute = 60;\n/**\n * Seconds in 1 day\n *\n * @name secondsInDay\n * @constant\n * @type {number}\n * @default\n */\n\nexport var secondsInDay = secondsInHour * 24;\n/**\n * Seconds in 1 week\n *\n * @name secondsInWeek\n * @constant\n * @type {number}\n * @default\n */\n\nexport var secondsInWeek = secondsInDay * 7;\n/**\n * Seconds in 1 year\n *\n * @name secondsInYear\n * @constant\n * @type {number}\n * @default\n */\n\nexport var secondsInYear = secondsInDay * daysInYear;\n/**\n * Seconds in 1 month\n *\n * @name secondsInMonth\n * @constant\n * @type {number}\n * @default\n */\n\nexport var secondsInMonth = secondsInYear / 12;\n/**\n * Seconds in 1 quarter\n *\n * @name secondsInQuarter\n * @constant\n * @type {number}\n * @default\n */\n\nexport var secondsInQuarter = secondsInMonth * 3;","export default function requiredArgs(required, args) {\n  if (args.length < required) {\n    throw new TypeError(required + ' argument' + (required > 1 ? 's' : '') + ' required, but only ' + args.length + ' present');\n  }\n}","export default function toInteger(dirtyNumber) {\n  if (dirtyNumber === null || dirtyNumber === true || dirtyNumber === false) {\n    return NaN;\n  }\n\n  var number = Number(dirtyNumber);\n\n  if (isNaN(number)) {\n    return number;\n  }\n\n  return number < 0 ? Math.ceil(number) : Math.floor(number);\n}","import { millisecondsInHour, millisecondsInMinute } from \"../constants/index.js\";\nimport requiredArgs from \"../_lib/requiredArgs/index.js\";\nimport toInteger from \"../_lib/toInteger/index.js\";\n/**\n * @name parseISO\n * @category Common Helpers\n * @summary Parse ISO string\n *\n * @description\n * Parse the given string in ISO 8601 format and return an instance of Date.\n *\n * Function accepts complete ISO 8601 formats as well as partial implementations.\n * ISO 8601: http://en.wikipedia.org/wiki/ISO_8601\n *\n * If the argument isn't a string, the function cannot parse the string or\n * the values are invalid, it returns Invalid Date.\n *\n * @param {String} argument - the value to convert\n * @param {Object} [options] - an object with options.\n * @param {0|1|2} [options.additionalDigits=2] - the additional number of digits in the extended year format\n * @returns {Date} the parsed date in the local time zone\n * @throws {TypeError} 1 argument required\n * @throws {RangeError} `options.additionalDigits` must be 0, 1 or 2\n *\n * @example\n * // Convert string '2014-02-11T11:30:30' to date:\n * const result = parseISO('2014-02-11T11:30:30')\n * //=> Tue Feb 11 2014 11:30:30\n *\n * @example\n * // Convert string '+02014101' to date,\n * // if the additional number of digits in the extended year format is 1:\n * const result = parseISO('+02014101', { additionalDigits: 1 })\n * //=> Fri Apr 11 2014 00:00:00\n */\n\nexport default function parseISO(argument, options) {\n  var _options$additionalDi;\n\n  requiredArgs(1, arguments);\n  var additionalDigits = toInteger((_options$additionalDi = options === null || options === void 0 ? void 0 : options.additionalDigits) !== null && _options$additionalDi !== void 0 ? _options$additionalDi : 2);\n\n  if (additionalDigits !== 2 && additionalDigits !== 1 && additionalDigits !== 0) {\n    throw new RangeError('additionalDigits must be 0, 1 or 2');\n  }\n\n  if (!(typeof argument === 'string' || Object.prototype.toString.call(argument) === '[object String]')) {\n    return new Date(NaN);\n  }\n\n  var dateStrings = splitDateString(argument);\n  var date;\n\n  if (dateStrings.date) {\n    var parseYearResult = parseYear(dateStrings.date, additionalDigits);\n    date = parseDate(parseYearResult.restDateString, parseYearResult.year);\n  }\n\n  if (!date || isNaN(date.getTime())) {\n    return new Date(NaN);\n  }\n\n  var timestamp = date.getTime();\n  var time = 0;\n  var offset;\n\n  if (dateStrings.time) {\n    time = parseTime(dateStrings.time);\n\n    if (isNaN(time)) {\n      return new Date(NaN);\n    }\n  }\n\n  if (dateStrings.timezone) {\n    offset = parseTimezone(dateStrings.timezone);\n\n    if (isNaN(offset)) {\n      return new Date(NaN);\n    }\n  } else {\n    var dirtyDate = new Date(timestamp + time); // js parsed string assuming it's in UTC timezone\n    // but we need it to be parsed in our timezone\n    // so we use utc values to build date in our timezone.\n    // Year values from 0 to 99 map to the years 1900 to 1999\n    // so set year explicitly with setFullYear.\n\n    var result = new Date(0);\n    result.setFullYear(dirtyDate.getUTCFullYear(), dirtyDate.getUTCMonth(), dirtyDate.getUTCDate());\n    result.setHours(dirtyDate.getUTCHours(), dirtyDate.getUTCMinutes(), dirtyDate.getUTCSeconds(), dirtyDate.getUTCMilliseconds());\n    return result;\n  }\n\n  return new Date(timestamp + time + offset);\n}\nvar patterns = {\n  dateTimeDelimiter: /[T ]/,\n  timeZoneDelimiter: /[Z ]/i,\n  timezone: /([Z+-].*)$/\n};\nvar dateRegex = /^-?(?:(\\d{3})|(\\d{2})(?:-?(\\d{2}))?|W(\\d{2})(?:-?(\\d{1}))?|)$/;\nvar timeRegex = /^(\\d{2}(?:[.,]\\d*)?)(?::?(\\d{2}(?:[.,]\\d*)?))?(?::?(\\d{2}(?:[.,]\\d*)?))?$/;\nvar timezoneRegex = /^([+-])(\\d{2})(?::?(\\d{2}))?$/;\n\nfunction splitDateString(dateString) {\n  var dateStrings = {};\n  var array = dateString.split(patterns.dateTimeDelimiter);\n  var timeString; // The regex match should only return at maximum two array elements.\n  // [date], [time], or [date, time].\n\n  if (array.length > 2) {\n    return dateStrings;\n  }\n\n  if (/:/.test(array[0])) {\n    timeString = array[0];\n  } else {\n    dateStrings.date = array[0];\n    timeString = array[1];\n\n    if (patterns.timeZoneDelimiter.test(dateStrings.date)) {\n      dateStrings.date = dateString.split(patterns.timeZoneDelimiter)[0];\n      timeString = dateString.substr(dateStrings.date.length, dateString.length);\n    }\n  }\n\n  if (timeString) {\n    var token = patterns.timezone.exec(timeString);\n\n    if (token) {\n      dateStrings.time = timeString.replace(token[1], '');\n      dateStrings.timezone = token[1];\n    } else {\n      dateStrings.time = timeString;\n    }\n  }\n\n  return dateStrings;\n}\n\nfunction parseYear(dateString, additionalDigits) {\n  var regex = new RegExp('^(?:(\\\\d{4}|[+-]\\\\d{' + (4 + additionalDigits) + '})|(\\\\d{2}|[+-]\\\\d{' + (2 + additionalDigits) + '})$)');\n  var captures = dateString.match(regex); // Invalid ISO-formatted year\n\n  if (!captures) return {\n    year: NaN,\n    restDateString: ''\n  };\n  var year = captures[1] ? parseInt(captures[1]) : null;\n  var century = captures[2] ? parseInt(captures[2]) : null; // either year or century is null, not both\n\n  return {\n    year: century === null ? year : century * 100,\n    restDateString: dateString.slice((captures[1] || captures[2]).length)\n  };\n}\n\nfunction parseDate(dateString, year) {\n  // Invalid ISO-formatted year\n  if (year === null) return new Date(NaN);\n  var captures = dateString.match(dateRegex); // Invalid ISO-formatted string\n\n  if (!captures) return new Date(NaN);\n  var isWeekDate = !!captures[4];\n  var dayOfYear = parseDateUnit(captures[1]);\n  var month = parseDateUnit(captures[2]) - 1;\n  var day = parseDateUnit(captures[3]);\n  var week = parseDateUnit(captures[4]);\n  var dayOfWeek = parseDateUnit(captures[5]) - 1;\n\n  if (isWeekDate) {\n    if (!validateWeekDate(year, week, dayOfWeek)) {\n      return new Date(NaN);\n    }\n\n    return dayOfISOWeekYear(year, week, dayOfWeek);\n  } else {\n    var date = new Date(0);\n\n    if (!validateDate(year, month, day) || !validateDayOfYearDate(year, dayOfYear)) {\n      return new Date(NaN);\n    }\n\n    date.setUTCFullYear(year, month, Math.max(dayOfYear, day));\n    return date;\n  }\n}\n\nfunction parseDateUnit(value) {\n  return value ? parseInt(value) : 1;\n}\n\nfunction parseTime(timeString) {\n  var captures = timeString.match(timeRegex);\n  if (!captures) return NaN; // Invalid ISO-formatted time\n\n  var hours = parseTimeUnit(captures[1]);\n  var minutes = parseTimeUnit(captures[2]);\n  var seconds = parseTimeUnit(captures[3]);\n\n  if (!validateTime(hours, minutes, seconds)) {\n    return NaN;\n  }\n\n  return hours * millisecondsInHour + minutes * millisecondsInMinute + seconds * 1000;\n}\n\nfunction parseTimeUnit(value) {\n  return value && parseFloat(value.replace(',', '.')) || 0;\n}\n\nfunction parseTimezone(timezoneString) {\n  if (timezoneString === 'Z') return 0;\n  var captures = timezoneString.match(timezoneRegex);\n  if (!captures) return 0;\n  var sign = captures[1] === '+' ? -1 : 1;\n  var hours = parseInt(captures[2]);\n  var minutes = captures[3] && parseInt(captures[3]) || 0;\n\n  if (!validateTimezone(hours, minutes)) {\n    return NaN;\n  }\n\n  return sign * (hours * millisecondsInHour + minutes * millisecondsInMinute);\n}\n\nfunction dayOfISOWeekYear(isoWeekYear, week, day) {\n  var date = new Date(0);\n  date.setUTCFullYear(isoWeekYear, 0, 4);\n  var fourthOfJanuaryDay = date.getUTCDay() || 7;\n  var diff = (week - 1) * 7 + day + 1 - fourthOfJanuaryDay;\n  date.setUTCDate(date.getUTCDate() + diff);\n  return date;\n} // Validation functions\n// February is null to handle the leap year (using ||)\n\n\nvar daysInMonths = [31, null, 31, 30, 31, 30, 31, 31, 30, 31, 30, 31];\n\nfunction isLeapYearIndex(year) {\n  return year % 400 === 0 || year % 4 === 0 && year % 100 !== 0;\n}\n\nfunction validateDate(year, month, date) {\n  return month >= 0 && month <= 11 && date >= 1 && date <= (daysInMonths[month] || (isLeapYearIndex(year) ? 29 : 28));\n}\n\nfunction validateDayOfYearDate(year, dayOfYear) {\n  return dayOfYear >= 1 && dayOfYear <= (isLeapYearIndex(year) ? 366 : 365);\n}\n\nfunction validateWeekDate(_year, week, day) {\n  return week >= 1 && week <= 53 && day >= 0 && day <= 6;\n}\n\nfunction validateTime(hours, minutes, seconds) {\n  if (hours === 24) {\n    return minutes === 0 && seconds === 0;\n  }\n\n  return seconds >= 0 && seconds < 60 && minutes >= 0 && minutes < 60 && hours >= 0 && hours < 25;\n}\n\nfunction validateTimezone(_hours, minutes) {\n  return minutes >= 0 && minutes <= 59;\n}","\"use strict\";\nObject.defineProperty(exports, \"__esModule\", { value: true });\nexports.jsonParse = exports.createIncludeNamesTree = void 0;\nfunction createIncludeNamesTree(namesChain, includeTree) {\n    var namesArray = namesChain.split('.');\n    var currentIncludeName = namesArray.shift();\n    var chainHasMoreNames = namesArray.length;\n    var subTree = null;\n    if (chainHasMoreNames) {\n        subTree = includeTree[currentIncludeName] || {};\n        createIncludeNamesTree(namesArray.join('.'), subTree);\n    }\n    includeTree[currentIncludeName] = subTree;\n}\nexports.createIncludeNamesTree = createIncludeNamesTree;\nfunction jsonParse(stringified) {\n    var parsed;\n    try {\n        parsed = JSON.parse(stringified);\n    }\n    catch (e) {\n        parsed = {};\n        console.warn(e);\n    }\n    return parsed;\n}\nexports.jsonParse = jsonParse;\n//# sourceMappingURL=utils.js.map","\"use strict\";\nObject.defineProperty(exports, \"__esModule\", { value: true });\nexports.ModelsSerializer = void 0;\nvar utils_1 = require(\"../utils\");\nvar ModelsSerializer = /** @class */ (function () {\n    function ModelsSerializer(propertiesMapper) {\n        propertiesMapper && this.setPropertiesMapper(propertiesMapper);\n    }\n    ModelsSerializer.prototype.setPropertiesMapper = function (propertiesMapper) {\n        this.propertiesMapper = propertiesMapper;\n    };\n    ModelsSerializer.prototype.setStuff = function (stuff) {\n        this.stuff = stuff;\n    };\n    ModelsSerializer.prototype.setIncludeNames = function (includeNames) {\n        if (Array.isArray(includeNames)) {\n            var includeNamesTree_1 = {};\n            includeNames.forEach(function (namesChain) {\n                utils_1.createIncludeNamesTree(namesChain, includeNamesTree_1);\n            });\n            this.includeNamesTree = includeNamesTree_1;\n        }\n        else {\n            this.includeNamesTree = includeNames;\n        }\n    };\n    ModelsSerializer.prototype.build = function () {\n        var _a = this, stuff = _a.stuff, propertiesMapper = _a.propertiesMapper;\n        if (!propertiesMapper || typeof propertiesMapper !== 'object') {\n            throw new Error('ModelsSerializer cannot build, propertiesMapper is not set');\n        }\n        else if (!stuff || typeof stuff !== 'object') {\n            throw new Error('ModelsSerializer cannot build, stuff is not set');\n        }\n        var body = {};\n        var uniqueIncluded = {};\n        if (stuff && Array.isArray(stuff)) {\n            var collectionLength = stuff.length;\n            var data = [];\n            for (var i = 0; i < collectionLength; i++) {\n                data.push(this.buildDataByModel(stuff[i]));\n                this.buildIncludedByModel(stuff[i], this.includeNamesTree, uniqueIncluded);\n            }\n            body['data'] = data;\n        }\n        else if (stuff) {\n            body['data'] = this.buildDataByModel(stuff);\n            this.buildIncludedByModel(stuff, this.includeNamesTree, uniqueIncluded);\n        }\n        else if (stuff === null) {\n            body['data'] = null;\n        }\n        if (Object.keys(uniqueIncluded).length) {\n            body['included'] = [];\n            var includeUniqueKeys = Object.keys(uniqueIncluded);\n            includeUniqueKeys.forEach(function (k) {\n                body['included'].push(uniqueIncluded[k]);\n            });\n        }\n        return body;\n    };\n    ModelsSerializer.prototype.buildDataByModel = function (model) {\n        var data = {\n            id: this.propertiesMapper.getId(model),\n            type: this.propertiesMapper.getType(model),\n            attributes: this.propertiesMapper.getAttributes(model),\n        };\n        if (typeof data.type !== 'string' || !data.type) {\n            console.warn('ModelsSerializer cannot buildDataByModel, type is not set or incorrect', model);\n            throw new Error('ModelsSerializer cannot buildDataByModel, type is not set or incorrect');\n        }\n        var relationships = this.buildRelationshipsByModel(model);\n        if (relationships && Object.keys(relationships).length) {\n            data['relationships'] = relationships;\n        }\n        return data;\n    };\n    ModelsSerializer.prototype.buildRelationshipsByModel = function (model) {\n        var _this = this;\n        var relations = this.propertiesMapper.getRelationships(model);\n        if (!relations || !Object.keys(relations).length) {\n            return;\n        }\n        var relationships = {};\n        Object.keys(relations).forEach(function (k) {\n            var relation = relations[k];\n            if (Array.isArray(relation)) {\n                var relationshipData = [];\n                var relationLength = relation.length;\n                for (var i = 0; i < relationLength; i++) {\n                    var item = {\n                        id: _this.propertiesMapper.getId(relation[i]),\n                        type: _this.propertiesMapper.getType(relation[i])\n                    };\n                    if (item.id && item.type) {\n                        relationshipData.push(item);\n                    }\n                    else {\n                        console.error(\"Can't create data item[\" + i + \"] for relationship \" + k + \",\\n                            it doesn't have 'id' or 'type', it was skipped\", relation[i]);\n                    }\n                }\n                relationships[k] = {\n                    data: relationshipData\n                };\n            }\n            else if (relation) {\n                var item = {\n                    id: _this.propertiesMapper.getId(relation),\n                    type: _this.propertiesMapper.getType(relation)\n                };\n                if (item.type) {\n                    relationships[k] = {\n                        data: item\n                    };\n                }\n                else {\n                    console.error(\"Can't create data for relationship \" + k + \", it doesn't have 'type', it was skipped\", relation);\n                }\n            }\n            else {\n                relationships[k] = {\n                    data: relation\n                };\n            }\n        });\n        return relationships;\n    };\n    ModelsSerializer.prototype.buildIncludedByModel = function (model, includeTree, builtIncluded) {\n        if (builtIncluded === void 0) { builtIncluded = {}; }\n        if (!includeTree || !Object.keys(includeTree).length) {\n            return;\n        }\n        var modelRelationships = this.propertiesMapper.getRelationships(model);\n        if (!modelRelationships || !Object.keys(modelRelationships).length) {\n            return;\n        }\n        var includeNames = Object.keys(includeTree);\n        var includeNamesLength = includeNames.length;\n        for (var i = 0; i < includeNamesLength; i++) {\n            var currentRelationName = includeNames[i];\n            var relation = modelRelationships[currentRelationName];\n            if (relation) {\n                if (Array.isArray(relation)) {\n                    var relationModelsLength = relation.length;\n                    for (var r = 0; r < relationModelsLength; r++) {\n                        var relationModel = relation[r];\n                        this.buildIncludedItem(relationModel, includeTree[currentRelationName], builtIncluded);\n                    }\n                }\n                else {\n                    this.buildIncludedItem(relation, includeTree[currentRelationName], builtIncluded);\n                }\n            }\n        }\n    };\n    ModelsSerializer.prototype.buildIncludedItem = function (relationModel, subIncludeTree, builtIncluded) {\n        var includeKey = this.propertiesMapper.getType(relationModel) + this.propertiesMapper.getId(relationModel);\n        if (!builtIncluded[includeKey]) {\n            // create data by current entity if such included is not yet created\n            builtIncluded[includeKey] = this.buildDataByModel(relationModel);\n            if (subIncludeTree) {\n                this.buildIncludedByModel(relationModel, subIncludeTree, builtIncluded);\n            }\n        }\n    };\n    return ModelsSerializer;\n}());\nexports.ModelsSerializer = ModelsSerializer;\nexports.default = ModelsSerializer;\n//# sourceMappingURL=ModelsSerializer.js.map","\"use strict\";\nObject.defineProperty(exports, \"__esModule\", { value: true });\nexports.JsonDeserializer = void 0;\nvar JsonDeserializer = /** @class */ (function () {\n    function JsonDeserializer(propertiesMapper, deserializeCache, options) {\n        this.preferNestedDataFromData = false;\n        this.setPropertiesMapper(propertiesMapper);\n        this.setDeserializeCache(deserializeCache);\n        if (!options) {\n            return;\n        }\n        if (options.preferNestedDataFromData) {\n            this.preferNestedDataFromData = true;\n        }\n    }\n    JsonDeserializer.prototype.setDeserializeCache = function (dc) {\n        this.dc = dc;\n    };\n    JsonDeserializer.prototype.setPropertiesMapper = function (pm) {\n        this.pm = pm;\n    };\n    JsonDeserializer.prototype.setJsonParsedObject = function (body) {\n        this.body = body;\n    };\n    JsonDeserializer.prototype.build = function () {\n        var data = this.body.data;\n        var stuff;\n        if (Array.isArray(data)) {\n            stuff = [];\n            var collectionLength = data.length;\n            for (var i = 0; i < collectionLength; i++) {\n                if (data[i]) {\n                    var model = this.buildModelByData(data[i]);\n                    if (model) {\n                        stuff.push(model);\n                    }\n                }\n            }\n        }\n        else if (data) {\n            stuff = this.buildModelByData(data);\n        }\n        return stuff;\n    };\n    JsonDeserializer.prototype.buildModelByData = function (data, resourceIdObj) {\n        if (resourceIdObj === void 0) { resourceIdObj = {}; }\n        var cachedModel = this.dc.getCachedModel(data, resourceIdObj);\n        if (cachedModel) {\n            return cachedModel;\n        }\n        var model = this.pm.createModel(data.type);\n        this.dc.handleModel(model, data, resourceIdObj); // should be called before this.pm.setRelationships(model, relationships);\n        if (model) {\n            this.pm.setId(model, data.id);\n            if (data.attributes) {\n                this.pm.setAttributes(model, data.attributes);\n            }\n            if (data.meta && this.pm.setMeta) {\n                this.pm.setMeta(model, data.meta);\n            }\n            if (data.links && this.pm.setLinks) {\n                this.pm.setLinks(model, data.links);\n            }\n            if (resourceIdObj.meta) {\n                this.pm.setResourceIdObjMeta(model, resourceIdObj.meta);\n            }\n            var relationships = this.buildRelationsByData(data, model);\n            if (relationships) {\n                this.pm.setRelationships(model, relationships);\n            }\n        }\n        return model;\n    };\n    JsonDeserializer.prototype.buildRelationsByData = function (data, model) {\n        var readyRelations = {};\n        if (data.relationships) {\n            for (var k in data.relationships) {\n                var relation = data.relationships[k];\n                if (Array.isArray(relation.data)) {\n                    readyRelations[k] = [];\n                    var relationDataLength = relation.data.length;\n                    var resourceIdObj = void 0;\n                    for (var i = 0; i < relationDataLength; i++) {\n                        resourceIdObj = relation.data[i];\n                        if (!resourceIdObj) {\n                            return;\n                        }\n                        var dataItem = this.buildDataFromIncludedOrData(resourceIdObj.id, resourceIdObj.type);\n                        readyRelations[k].push(this.buildModelByData(dataItem, resourceIdObj));\n                    }\n                }\n                else if (relation.data) {\n                    var dataItem = this.buildDataFromIncludedOrData(relation.data.id, relation.data.type);\n                    readyRelations[k] = this.buildModelByData(dataItem, relation.data);\n                }\n                else if (relation.data === null) {\n                    readyRelations[k] = null;\n                }\n                if (relation.links) {\n                    var setRelationshipLinks = this.pm.setRelationshipLinks;\n                    if (setRelationshipLinks) {\n                        setRelationshipLinks(model, k, relation.links);\n                    }\n                }\n                if (relation.meta) {\n                    var setRelationshipMeta = this.pm.setRelationshipMeta;\n                    if (setRelationshipMeta) {\n                        setRelationshipMeta(model, k, relation.meta);\n                    }\n                }\n            }\n        }\n        if (Object.keys(readyRelations).length) {\n            return readyRelations;\n        }\n        return null;\n    };\n    JsonDeserializer.prototype.buildDataFromIncludedOrData = function (id, type) {\n        if (this.preferNestedDataFromData) {\n            var dataObject = this.buildDataInObject();\n            var dataItemFromData = dataObject[type + id];\n            if (dataItemFromData) {\n                return dataItemFromData;\n            }\n        }\n        var includedObject = this.buildIncludedInObject();\n        var dataItemFromIncluded = includedObject[type + id];\n        if (dataItemFromIncluded) {\n            return dataItemFromIncluded;\n        }\n        if (!this.preferNestedDataFromData) {\n            var dataObject = this.buildDataInObject();\n            var dataItemFromData = dataObject[type + id];\n            if (dataItemFromData) {\n                return dataItemFromData;\n            }\n        }\n        return { id: id, type: type };\n    };\n    JsonDeserializer.prototype.buildDataInObject = function () {\n        if (!this.dataInObject) {\n            this.dataInObject = {};\n            var data = this.body.data;\n            var dataLength = data.length;\n            if (data && dataLength) {\n                for (var i = 0; i < dataLength; i++) {\n                    var item = data[i];\n                    this.dataInObject[item.type + item.id] = item;\n                }\n            }\n            else if (data) {\n                this.dataInObject[data.type + data.id] = data;\n            }\n        }\n        return this.dataInObject;\n    };\n    JsonDeserializer.prototype.buildIncludedInObject = function () {\n        if (!this.includedInObject) {\n            this.includedInObject = {};\n            if (this.body.included) {\n                var includedLength = this.body.included.length;\n                for (var i = 0; i < includedLength; i++) {\n                    var item = this.body.included[i];\n                    this.includedInObject[item.type + item.id] = item;\n                }\n            }\n        }\n        return this.includedInObject;\n    };\n    return JsonDeserializer;\n}());\nexports.JsonDeserializer = JsonDeserializer;\nexports.default = JsonDeserializer;\n//# sourceMappingURL=JsonDeserializer.js.map","\"use strict\";\nObject.defineProperty(exports, \"__esModule\", { value: true });\nvar ReduxObjectDenormalizer = /** @class */ (function () {\n    function ReduxObjectDenormalizer(propertiesMapper) {\n        this.cachedModels = {};\n        this.setPropertiesMapper(propertiesMapper);\n    }\n    ReduxObjectDenormalizer.prototype.setPropertiesMapper = function (propertiesMapper) {\n        this.propertiesMapper = propertiesMapper;\n    };\n    ReduxObjectDenormalizer.prototype.setReduxObject = function (reduxObject) {\n        this.reduxObject = reduxObject;\n    };\n    ReduxObjectDenormalizer.prototype.setEntityType = function (entityType) {\n        this.entityType = entityType;\n    };\n    ReduxObjectDenormalizer.prototype.setEntityIds = function (ids) {\n        this.ids = ids;\n    };\n    ReduxObjectDenormalizer.prototype.setReturnBuilderInRelations = function (returnBuilderInRelations) {\n        this.returnBuilderInRelations = returnBuilderInRelations;\n    };\n    ReduxObjectDenormalizer.prototype.build = function () {\n        var _this = this;\n        var _a = this, reduxObject = _a.reduxObject, entityType = _a.entityType, propertiesMapper = _a.propertiesMapper;\n        if (!propertiesMapper || typeof propertiesMapper !== 'object') {\n            throw new Error('ReduxObjectDenormalizer cannot build, propertiesMapper is not set');\n        }\n        else if (!reduxObject || typeof reduxObject !== 'object') {\n            throw new Error('ReduxObjectDenormalizer cannot build, reduxObject is not set');\n        }\n        else if (!entityType) {\n            throw new Error('ReduxObjectDenormalizer cannot build, entityType is not set');\n        }\n        if (!reduxObject[entityType]) {\n            return null;\n        }\n        var ids = this.ids;\n        if (!ids) {\n            ids = Object.keys(reduxObject[entityType]);\n        }\n        if (Array.isArray(ids)) {\n            if (!ids.length) {\n                return null;\n            }\n            var models_1 = [];\n            ids.forEach(function (id) {\n                var model = _this.buildModel(entityType, id);\n                if (model) {\n                    models_1.push(model);\n                }\n            });\n            return models_1;\n        }\n        return this.buildModel(entityType, ids);\n    };\n    ReduxObjectDenormalizer.prototype.buildModel = function (type, id) {\n        var reduxObject = this.reduxObject;\n        if (!reduxObject[type]) {\n            return null;\n        }\n        var reduxObjectModel = reduxObject[type][id];\n        if (!reduxObjectModel) {\n            return null;\n        }\n        // checks for built model in cachedModels is a protection from creating models on recursive relationships\n        var entityKey = type + \"-\" + id;\n        var model = this.cachedModels[entityKey];\n        if (!model) {\n            model = this.propertiesMapper.createModel(type);\n            if (model) {\n                this.cachedModels[entityKey] = model;\n                this.propertiesMapper.setId(model, reduxObjectModel.id);\n                if (reduxObjectModel.attributes) {\n                    this.propertiesMapper.setAttributes(model, reduxObjectModel.attributes);\n                }\n                var relationships = this.buildRelationships(model, reduxObjectModel.relationships);\n                if (relationships) {\n                    this.propertiesMapper.setRelationships(model, relationships);\n                }\n            }\n        }\n        return model;\n    };\n    ReduxObjectDenormalizer.prototype.buildRelationships = function (model, reduxObjectRelationships) {\n        var _this = this;\n        if (!reduxObjectRelationships) {\n            return null;\n        }\n        var relationNames = Object.keys(reduxObjectRelationships);\n        if (!relationNames.length) {\n            return null;\n        }\n        var relations = {};\n        relationNames.forEach(function (relationName) {\n            var relation = reduxObjectRelationships[relationName];\n            if (relation && relation.data) {\n                if (_this.returnBuilderInRelations) {\n                    relations[relationName] = _this.buildRelationModels.bind(_this, relation.data);\n                }\n                else {\n                    relations[relationName] = _this.buildRelationModels(relation.data);\n                }\n            }\n            if (relation && relation.links) {\n                _this.propertiesMapper.setRelationshipLinks(model, relationName, relation.links);\n            }\n            if (relation && relation.meta) {\n                var setRelationshipMeta = _this.propertiesMapper.setRelationshipMeta;\n                if (setRelationshipMeta) { // support was added in patch release\n                    setRelationshipMeta(model, relationName, relation.meta);\n                }\n            }\n        });\n        return Object.keys(relations).length ? relations : null;\n    };\n    ReduxObjectDenormalizer.prototype.buildRelationModels = function (data) {\n        var _this = this;\n        if (Array.isArray(data)) {\n            var relationModels_1 = [];\n            data.forEach(function (dataItem) {\n                var model = _this.buildModel(dataItem.type, dataItem.id);\n                relationModels_1.push(model || dataItem);\n            });\n            return relationModels_1;\n        }\n        else if (data.id && data.type) {\n            return this.buildModel(data.type, data.id) || data;\n        }\n        return null;\n    };\n    return ReduxObjectDenormalizer;\n}());\nexports.default = ReduxObjectDenormalizer;\n//# sourceMappingURL=ReduxObjectDenormalizer.js.map","\"use strict\";\nvar __spreadArray = (this && this.__spreadArray) || function (to, from) {\n    for (var i = 0, il = from.length, j = to.length; i < il; i++, j++)\n        to[j] = from[i];\n    return to;\n};\nObject.defineProperty(exports, \"__esModule\", { value: true });\nexports.JsonPropertiesMapper = exports.defineRelationGetter = exports.ModelPropertiesMapper = exports.RELATIONSHIP_NAMES_PROP = void 0;\nexports.RELATIONSHIP_NAMES_PROP = 'relationshipNames';\nvar ModelPropertiesMapper = /** @class */ (function () {\n    function ModelPropertiesMapper() {\n    }\n    ModelPropertiesMapper.prototype.getId = function (model) {\n        return model.id;\n    };\n    ModelPropertiesMapper.prototype.getType = function (model) {\n        return model.type;\n    };\n    ModelPropertiesMapper.prototype.getAttributes = function (model) {\n        var exceptProps = ['id', 'type', exports.RELATIONSHIP_NAMES_PROP];\n        if (Array.isArray(model[exports.RELATIONSHIP_NAMES_PROP])) {\n            exceptProps.push.apply(exceptProps, model[exports.RELATIONSHIP_NAMES_PROP]);\n        }\n        else if (model[exports.RELATIONSHIP_NAMES_PROP]) {\n            console.warn(\"Can't getAttributes correctly, '\" + exports.RELATIONSHIP_NAMES_PROP + \"' property of \" + model.type + \"-\" + model.id + \" model\\n                isn't array of relationship names\", model[exports.RELATIONSHIP_NAMES_PROP]);\n        }\n        var attributes = {};\n        Object.keys(model).forEach(function (attrName) {\n            if (exceptProps.indexOf(attrName) === -1) {\n                attributes[attrName] = model[attrName];\n            }\n        });\n        return attributes;\n    };\n    ModelPropertiesMapper.prototype.getRelationships = function (model) {\n        var relationshipNames = model[exports.RELATIONSHIP_NAMES_PROP];\n        if (!relationshipNames || Array.isArray(relationshipNames) && !relationshipNames.length) {\n            return;\n        }\n        else if (relationshipNames && !Array.isArray(relationshipNames)) {\n            console.warn(\"Can't getRelationships correctly,\\n                '\" + exports.RELATIONSHIP_NAMES_PROP + \"' property of \" + model.type + \"-\" + model.id + \" model\\n                isn't array of relationship names\", model[exports.RELATIONSHIP_NAMES_PROP]);\n            return;\n        }\n        var relationships = {};\n        relationshipNames.forEach(function (relationName) {\n            if (model[relationName] !== undefined) {\n                relationships[relationName] = model[relationName];\n            }\n        });\n        return relationships;\n    };\n    return ModelPropertiesMapper;\n}());\nexports.ModelPropertiesMapper = ModelPropertiesMapper;\nfunction defineRelationGetter(model, relationName, buildRelation) {\n    Object.defineProperty(model, relationName, {\n        enumerable: true,\n        configurable: true,\n        set: function (value) {\n            delete model[relationName];\n            model[relationName] = value;\n        },\n        get: function () {\n            delete model[relationName];\n            return model[relationName] = buildRelation();\n        },\n    });\n}\nexports.defineRelationGetter = defineRelationGetter;\nvar JsonPropertiesMapper = /** @class */ (function () {\n    function JsonPropertiesMapper() {\n    }\n    JsonPropertiesMapper.prototype.createModel = function (type) {\n        return { type: type };\n    };\n    JsonPropertiesMapper.prototype.setId = function (model, id) {\n        model.id = id;\n    };\n    JsonPropertiesMapper.prototype.setAttributes = function (model, attributes) {\n        Object.keys(attributes).forEach(function (propName) {\n            model[propName] = attributes[propName];\n        });\n    };\n    JsonPropertiesMapper.prototype.setMeta = function (model, meta) {\n        model.meta = meta;\n    };\n    JsonPropertiesMapper.prototype.setLinks = function (model, links) {\n        model.links = links;\n    };\n    JsonPropertiesMapper.prototype.setResourceIdObjMeta = function (model, meta) {\n        model.resourceIdObjMeta = meta;\n    };\n    JsonPropertiesMapper.prototype.setRelationships = function (model, relationships) {\n        Object.keys(relationships).forEach(function (propName) {\n            if (typeof relationships[propName] === 'function') {\n                defineRelationGetter(model, propName, relationships[propName]);\n            }\n            else {\n                model[propName] = relationships[propName];\n            }\n        });\n        var newNames = Object.keys(relationships);\n        var currentNames = model[exports.RELATIONSHIP_NAMES_PROP];\n        if (currentNames && currentNames.length) {\n            model[exports.RELATIONSHIP_NAMES_PROP] = __spreadArray(__spreadArray([], currentNames), newNames).filter(function (value, i, self) { return self.indexOf(value) === i; });\n        }\n        else {\n            model[exports.RELATIONSHIP_NAMES_PROP] = newNames;\n        }\n    };\n    JsonPropertiesMapper.prototype.setRelationshipLinks = function (parentModel, relationName, links) {\n        // inherit your IJsonPropertiesMapper and overload this method, if you want to handle relationship links\n    };\n    JsonPropertiesMapper.prototype.setRelationshipMeta = function (parentModel, relationName, links) {\n        // inherit your IJsonPropertiesMapper and overload this method, if you want to handle relationship meta\n    };\n    return JsonPropertiesMapper;\n}());\nexports.JsonPropertiesMapper = JsonPropertiesMapper;\n//# sourceMappingURL=simplePropertyMappers.js.map","\"use strict\";\nObject.defineProperty(exports, \"__esModule\", { value: true });\nexports.DeserializeCache = exports.jsonStringify = void 0;\nfunction jsonStringify(json) {\n    var stringified;\n    try {\n        stringified = JSON.stringify(json);\n    }\n    catch (e) {\n        stringified = '';\n        console.warn(e);\n    }\n    return stringified;\n}\nexports.jsonStringify = jsonStringify;\nvar DeserializeCache = /** @class */ (function () {\n    function DeserializeCache() {\n        this.cachedModels = {};\n    }\n    DeserializeCache.prototype.getCachedModel = function (data, resourceIdObject) {\n        var entityKey = this.createCacheKey(data, resourceIdObject);\n        return this.cachedModels[entityKey] || null;\n    };\n    DeserializeCache.prototype.handleModel = function (model, data, resourceIdObject) {\n        var entityKey = this.createCacheKey(data, resourceIdObject);\n        var dataWithPayload = data.attributes || data.relationships;\n        if (entityKey && dataWithPayload) {\n            this.cachedModels[entityKey] = model;\n        }\n    };\n    DeserializeCache.prototype.createCacheKey = function (data, resourceIdObject) {\n        // resourceIdObject.meta sets to model in simplePropertyMappers.ts, so it should be used here too\n        // cache in this case probably will be redundant\n        if (!data.id || !data.type || resourceIdObject.meta) {\n            return;\n        }\n        var resourcePart = resourceIdObject.type + \"-\" + resourceIdObject.id;\n        if (data.meta) {\n            return data.type + \"-\" + data.id + \"-\" + jsonStringify(data.meta) + \"-\" + resourcePart;\n        }\n        return data.type + \"-\" + data.id + \"-\" + resourcePart;\n    };\n    return DeserializeCache;\n}());\nexports.DeserializeCache = DeserializeCache;\n//# sourceMappingURL=cache.js.map","\"use strict\";\nObject.defineProperty(exports, \"__esModule\", { value: true });\nvar utils_1 = require(\"./utils\");\nvar ModelsSerializer_1 = require(\"./builders/ModelsSerializer\");\nvar JsonDeserializer_1 = require(\"./builders/JsonDeserializer\");\nvar ReduxObjectDenormalizer_1 = require(\"./builders/ReduxObjectDenormalizer\");\nvar simplePropertyMappers_1 = require(\"./simplePropertyMappers\");\nvar cache_1 = require(\"./cache\");\nvar Jsona = /** @class */ (function () {\n    function Jsona(params) {\n        this.modelPropertiesMapper = new simplePropertyMappers_1.ModelPropertiesMapper();\n        this.jsonPropertiesMapper = new simplePropertyMappers_1.JsonPropertiesMapper();\n        this.DeserializeCache = cache_1.DeserializeCache;\n        this.ModelsSerializer = ModelsSerializer_1.default;\n        this.JsonDeserializer = JsonDeserializer_1.default;\n        if (params && params.modelPropertiesMapper) {\n            this.modelPropertiesMapper = params.modelPropertiesMapper;\n        }\n        if (params && params.jsonPropertiesMapper) {\n            this.jsonPropertiesMapper = params.jsonPropertiesMapper;\n        }\n        if (params && params.DeserializeCache) {\n            this.DeserializeCache = params.DeserializeCache;\n        }\n        if (params && params.ModelsSerializer) {\n            this.ModelsSerializer = params.ModelsSerializer;\n        }\n        if (params && params.JsonDeserializer) {\n            this.JsonDeserializer = params.JsonDeserializer;\n        }\n    }\n    /**\n     * serialize\n     * Creates JSON, compatible with json:api specification from Jsona model(s).\n     */\n    Jsona.prototype.serialize = function (_a) {\n        var stuff = _a.stuff, includeNames = _a.includeNames;\n        if (!stuff) {\n            throw new Error('Jsona can not serialize, stuff is not passed');\n        }\n        var jsonBuilder = new this.ModelsSerializer(this.modelPropertiesMapper);\n        jsonBuilder.setStuff(stuff);\n        if (includeNames) {\n            jsonBuilder.setIncludeNames(includeNames);\n        }\n        return jsonBuilder.build();\n    };\n    /**\n     * deserialize\n     * Creates Jsona model(s) from JSON, compatible with json:api specification.\n     */\n    Jsona.prototype.deserialize = function (body, options) {\n        if (!body) {\n            throw new Error('Jsona can not deserialize, body is not passed');\n        }\n        var deserializeCache = new this.DeserializeCache();\n        var modelBuilder = new this.JsonDeserializer(this.jsonPropertiesMapper, deserializeCache, options);\n        if (typeof body === 'string') {\n            modelBuilder.setJsonParsedObject(utils_1.jsonParse(body));\n        }\n        else {\n            modelBuilder.setJsonParsedObject(body);\n        }\n        return modelBuilder.build();\n    };\n    /**\n     * denormalizeReduxObject\n     * Creates Jsona model(s) from ReduxObject, that creates by json-api-normalizer\n     * https://github.com/yury-dymov/json-api-normalizer\n     *\n     */\n    Jsona.prototype.denormalizeReduxObject = function (_a) {\n        var reduxObject = _a.reduxObject, entityType = _a.entityType, entityIds = _a.entityIds, _b = _a.returnBuilderInRelations, returnBuilderInRelations = _b === void 0 ? false : _b;\n        if (!reduxObject) {\n            throw new Error('Jsona can not denormalize ReduxObject, incorrect reduxObject passed');\n        }\n        if (!entityType) {\n            throw new Error('Jsona can not denormalize ReduxObject, entityType is not passed');\n        }\n        if (!reduxObject[entityType]) {\n            return null;\n        }\n        var modelBuilder = new ReduxObjectDenormalizer_1.default(this.jsonPropertiesMapper);\n        modelBuilder.setReduxObject(reduxObject);\n        modelBuilder.setEntityType(entityType);\n        modelBuilder.setReturnBuilderInRelations(returnBuilderInRelations);\n        if (entityIds) {\n            modelBuilder.setEntityIds(Array.isArray(entityIds) ? entityIds : entityIds.toString());\n        }\n        return modelBuilder.build();\n    };\n    return Jsona;\n}());\nexports.default = Jsona;\n//# sourceMappingURL=Jsona.js.map","\"use strict\";\nvar __extends = (this && this.__extends) || (function () {\n    var extendStatics = function (d, b) {\n        extendStatics = Object.setPrototypeOf ||\n            ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) ||\n            function (d, b) { for (var p in b) if (Object.prototype.hasOwnProperty.call(b, p)) d[p] = b[p]; };\n        return extendStatics(d, b);\n    };\n    return function (d, b) {\n        if (typeof b !== \"function\" && b !== null)\n            throw new TypeError(\"Class extends value \" + String(b) + \" is not a constructor or null\");\n        extendStatics(d, b);\n        function __() { this.constructor = d; }\n        d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());\n    };\n})();\nObject.defineProperty(exports, \"__esModule\", { value: true });\nexports.SwitchCaseJsonMapper = exports.SwitchCaseModelMapper = void 0;\nvar simplePropertyMappers_1 = require(\"./simplePropertyMappers\");\nvar SwitchCaseModelMapper = /** @class */ (function (_super) {\n    __extends(SwitchCaseModelMapper, _super);\n    function SwitchCaseModelMapper(options) {\n        var _this = _super.call(this) || this;\n        var _a = options || {}, _b = _a.switchAttributes, switchAttributes = _b === void 0 ? true : _b, _c = _a.switchRelationships, switchRelationships = _c === void 0 ? true : _c, _d = _a.switchType, switchType = _d === void 0 ? true : _d, _e = _a.switchChar, switchChar = _e === void 0 ? '-' : _e;\n        _this.switchAttributes = switchAttributes;\n        _this.switchRelationships = switchRelationships;\n        _this.switchType = switchType;\n        _this.switchChar = switchChar;\n        return _this;\n    }\n    SwitchCaseModelMapper.prototype.getType = function (model) {\n        var _this = this;\n        var type = _super.prototype.getType.call(this, model);\n        if (!this.switchType || !type) {\n            return type;\n        }\n        return type.replace(/([a-z][A-Z0-9])/g, function (g) { return g[0] + _this.switchChar + g[1].toLowerCase(); });\n    };\n    SwitchCaseModelMapper.prototype.getAttributes = function (model) {\n        var _this = this;\n        var camelCasedAttributes = _super.prototype.getAttributes.call(this, model);\n        if (!this.switchAttributes || !camelCasedAttributes) {\n            return camelCasedAttributes;\n        }\n        var kebabAttributes = {};\n        Object.keys(camelCasedAttributes).forEach(function (name) {\n            var kebabName = name.replace(/([a-z][A-Z0-9])/g, function (g) { return g[0] + _this.switchChar + g[1].toLowerCase(); });\n            kebabAttributes[kebabName] = camelCasedAttributes[name];\n        });\n        return kebabAttributes;\n    };\n    SwitchCaseModelMapper.prototype.getRelationships = function (model) {\n        var _this = this;\n        var camelCasedRelationships = _super.prototype.getRelationships.call(this, model);\n        if (!this.switchRelationships || !camelCasedRelationships) {\n            return camelCasedRelationships;\n        }\n        var kebabRelationships = {};\n        Object.keys(camelCasedRelationships).forEach(function (name) {\n            var kebabName = name.replace(/([a-z][A-Z0-9])/g, function (g) { return g[0] + _this.switchChar + g[1].toLowerCase(); });\n            kebabRelationships[kebabName] = camelCasedRelationships[name];\n        });\n        return kebabRelationships;\n    };\n    return SwitchCaseModelMapper;\n}(simplePropertyMappers_1.ModelPropertiesMapper));\nexports.SwitchCaseModelMapper = SwitchCaseModelMapper;\nvar SwitchCaseJsonMapper = /** @class */ (function (_super) {\n    __extends(SwitchCaseJsonMapper, _super);\n    function SwitchCaseJsonMapper(options) {\n        var _this = _super.call(this) || this;\n        var _a = options || {}, _b = _a.camelizeAttributes, camelizeAttributes = _b === void 0 ? true : _b, _c = _a.camelizeRelationships, camelizeRelationships = _c === void 0 ? true : _c, _d = _a.camelizeType, camelizeType = _d === void 0 ? true : _d, _e = _a.camelizeMeta, camelizeMeta = _e === void 0 ? false : _e, _f = _a.switchChar, switchChar = _f === void 0 ? '-' : _f;\n        _this.camelizeAttributes = camelizeAttributes;\n        _this.camelizeRelationships = camelizeRelationships;\n        _this.camelizeType = camelizeType;\n        _this.camelizeMeta = camelizeMeta;\n        _this.switchChar = switchChar;\n        return _this;\n    }\n    SwitchCaseJsonMapper.prototype.createModel = function (type) {\n        if (!this.camelizeType) {\n            return { type: type };\n        }\n        var regex = new RegExp(this.switchChar + \"([a-z0-9])\", 'g');\n        var camelizedType = type.replace(regex, function (g) { return g[1].toUpperCase(); });\n        return { type: camelizedType };\n    };\n    SwitchCaseJsonMapper.prototype.setAttributes = function (model, attributes) {\n        var _this = this;\n        if (!this.camelizeAttributes) {\n            return _super.prototype.setAttributes.call(this, model, attributes);\n        }\n        Object.keys(attributes).forEach(function (propName) {\n            var regex = new RegExp(_this.switchChar + \"([a-z0-9])\", 'g');\n            var camelName = propName.replace(regex, function (g) { return g[1].toUpperCase(); });\n            model[camelName] = attributes[propName];\n        });\n    };\n    SwitchCaseJsonMapper.prototype.setMeta = function (model, meta) {\n        var _this = this;\n        if (!this.camelizeMeta) {\n            return _super.prototype.setMeta.call(this, model, meta);\n        }\n        model.meta = {};\n        Object.keys(meta).forEach(function (propName) {\n            var regex = new RegExp(_this.switchChar + \"([a-z0-9])\", 'g');\n            var camelName = propName.replace(regex, function (g) { return g[1].toUpperCase(); });\n            model.meta[camelName] = meta[propName];\n        });\n    };\n    SwitchCaseJsonMapper.prototype.setRelationships = function (model, relationships) {\n        var _this = this;\n        // call super.setRelationships first, just for not to copy paste setRelationships logic\n        _super.prototype.setRelationships.call(this, model, relationships);\n        if (!this.camelizeRelationships) {\n            return;\n        }\n        // then change relationship names case if needed\n        model[simplePropertyMappers_1.RELATIONSHIP_NAMES_PROP].forEach(function (kebabName, i) {\n            var regex = new RegExp(_this.switchChar + \"([a-z0-9])\", 'g');\n            var camelName = kebabName.replace(regex, function (g) { return g[1].toUpperCase(); });\n            if (camelName !== kebabName) {\n                model[camelName] = model[kebabName];\n                delete model[kebabName];\n                model[simplePropertyMappers_1.RELATIONSHIP_NAMES_PROP][i] = camelName;\n            }\n        });\n    };\n    return SwitchCaseJsonMapper;\n}(simplePropertyMappers_1.JsonPropertiesMapper));\nexports.SwitchCaseJsonMapper = SwitchCaseJsonMapper;\n//# sourceMappingURL=switchCasePropertyMappers.js.map","\"use strict\";\nObject.defineProperty(exports, \"__esModule\", { value: true });\nexports.SwitchCaseJsonMapper = exports.SwitchCaseModelMapper = exports.JsonPropertiesMapper = exports.ModelPropertiesMapper = exports.JsonDeserializer = exports.ModelsSerializer = exports.Jsona = void 0;\nvar Jsona_1 = require(\"./Jsona\");\nexports.Jsona = Jsona_1.default;\nvar ModelsSerializer_1 = require(\"./builders/ModelsSerializer\");\nexports.ModelsSerializer = ModelsSerializer_1.default;\nvar JsonDeserializer_1 = require(\"./builders/JsonDeserializer\");\nexports.JsonDeserializer = JsonDeserializer_1.default;\nvar simplePropertyMappers_1 = require(\"./simplePropertyMappers\");\nObject.defineProperty(exports, \"ModelPropertiesMapper\", { enumerable: true, get: function () { return simplePropertyMappers_1.ModelPropertiesMapper; } });\nObject.defineProperty(exports, \"JsonPropertiesMapper\", { enumerable: true, get: function () { return simplePropertyMappers_1.JsonPropertiesMapper; } });\nvar switchCasePropertyMappers_1 = require(\"./switchCasePropertyMappers\");\nObject.defineProperty(exports, \"SwitchCaseModelMapper\", { enumerable: true, get: function () { return switchCasePropertyMappers_1.SwitchCaseModelMapper; } });\nObject.defineProperty(exports, \"SwitchCaseJsonMapper\", { enumerable: true, get: function () { return switchCasePropertyMappers_1.SwitchCaseJsonMapper; } });\nexports.default = Jsona_1.default;\n//# sourceMappingURL=index.js.map"],"names":["millisecondsInMinute","millisecondsInHour","requiredArgs","required","args","toInteger","dirtyNumber","number","parseISO","argument","options","_options$additionalDi","additionalDigits","dateStrings","splitDateString","date","parseYearResult","parseYear","parseDate","timestamp","time","offset","parseTime","parseTimezone","dirtyDate","result","patterns","dateRegex","timeRegex","timezoneRegex","dateString","array","timeString","token","regex","captures","year","century","isWeekDate","dayOfYear","parseDateUnit","month","day","week","dayOfWeek","validateWeekDate","dayOfISOWeekYear","validateDate","validateDayOfYearDate","value","hours","parseTimeUnit","minutes","seconds","validateTime","timezoneString","sign","validateTimezone","isoWeekYear","fourthOfJanuaryDay","diff","daysInMonths","isLeapYearIndex","_year","_hours","utils","createIncludeNamesTree","namesChain","includeTree","namesArray","currentIncludeName","chainHasMoreNames","subTree","jsonParse","stringified","parsed","e","ModelsSerializer_1","utils_1","require$$0","ModelsSerializer","propertiesMapper","stuff","includeNames","includeNamesTree_1","_a","body","uniqueIncluded","collectionLength","data","i","includeUniqueKeys","k","model","relationships","_this","relations","relation","relationshipData","relationLength","item","builtIncluded","modelRelationships","includeNamesLength","currentRelationName","relationModelsLength","r","relationModel","subIncludeTree","includeKey","JsonDeserializer_1","JsonDeserializer","deserializeCache","dc","pm","resourceIdObj","cachedModel","readyRelations","relationDataLength","dataItem","setRelationshipLinks","setRelationshipMeta","id","type","dataObject","dataItemFromData","includedObject","dataItemFromIncluded","dataLength","includedLength","ReduxObjectDenormalizer_1","ReduxObjectDenormalizer","reduxObject","entityType","ids","returnBuilderInRelations","models_1","reduxObjectModel","entityKey","reduxObjectRelationships","relationNames","relationName","relationModels_1","__spreadArray","this","to","from","il","j","exports","ModelPropertiesMapper","exceptProps","attributes","attrName","relationshipNames","defineRelationGetter","buildRelation","JsonPropertiesMapper","propName","meta","links","newNames","currentNames","self","parentModel","cache","jsonStringify","json","DeserializeCache","resourceIdObject","dataWithPayload","resourcePart","Jsona_1","require$$1","require$$2","require$$3","simplePropertyMappers_1","require$$4","cache_1","require$$5","Jsona","params","jsonBuilder","modelBuilder","entityIds","_b","__extends","extendStatics","d","b","p","__","switchCasePropertyMappers","SwitchCaseModelMapper","_super","switchAttributes","_c","switchRelationships","_d","switchType","_e","switchChar","g","camelCasedAttributes","kebabAttributes","name","kebabName","camelCasedRelationships","kebabRelationships","SwitchCaseJsonMapper","camelizeAttributes","camelizeRelationships","camelizeType","camelizeMeta","_f","camelizedType","camelName","switchCasePropertyMappers_1"],"mappings":"saA0CO,IAAIA,EAAuB,IAUvBC,EAAqB,KCpDjB,SAASC,EAAaC,EAAUC,EAAM,CACnD,GAAIA,EAAK,OAASD,EAChB,MAAM,IAAI,UAAUA,EAAW,aAAeA,EAAW,EAAI,IAAM,IAAM,uBAAyBC,EAAK,OAAS,UAAU,CAE9H,CCJe,SAASC,EAAUC,EAAa,CAC7C,GAAIA,IAAgB,MAAQA,IAAgB,IAAQA,IAAgB,GAClE,MAAO,KAGT,IAAIC,EAAS,OAAOD,CAAW,EAE/B,OAAI,MAAMC,CAAM,EACPA,EAGFA,EAAS,EAAI,KAAK,KAAKA,CAAM,EAAI,KAAK,MAAMA,CAAM,CAC3D,CCwBe,SAASC,GAASC,EAAUC,EAAS,CAClD,IAAIC,EAEJT,EAAa,EAAG,SAAS,EACzB,IAAIU,EAAmBP,GAAWM,EAAwBD,GAAY,KAA6B,OAASA,EAAQ,oBAAsB,MAAQC,IAA0B,OAASA,EAAwB,CAAC,EAE9M,GAAIC,IAAqB,GAAKA,IAAqB,GAAKA,IAAqB,EAC3E,MAAM,IAAI,WAAW,oCAAoC,EAG3D,GAAI,EAAE,OAAOH,GAAa,UAAY,OAAO,UAAU,SAAS,KAAKA,CAAQ,IAAM,mBACjF,OAAO,IAAI,KAAK,GAAG,EAGrB,IAAII,EAAcC,EAAgBL,CAAQ,EACtCM,EAEJ,GAAIF,EAAY,KAAM,CACpB,IAAIG,EAAkBC,EAAUJ,EAAY,KAAMD,CAAgB,EAClEG,EAAOG,EAAUF,EAAgB,eAAgBA,EAAgB,IAAI,CACtE,CAED,GAAI,CAACD,GAAQ,MAAMA,EAAK,QAAS,CAAA,EAC/B,OAAO,IAAI,KAAK,GAAG,EAGrB,IAAII,EAAYJ,EAAK,UACjB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