{"version":3,"file":"index.cjs","sources":["../../node_modules/extend/index.js","../../src/json/hashMergeProperties.js","../../src/json/index.js"],"sourcesContent":["'use strict';\n\nvar hasOwn = Object.prototype.hasOwnProperty;\nvar toStr = Object.prototype.toString;\nvar defineProperty = Object.defineProperty;\nvar gOPD = Object.getOwnPropertyDescriptor;\n\nvar isArray = function isArray(arr) {\n\tif (typeof Array.isArray === 'function') {\n\t\treturn Array.isArray(arr);\n\t}\n\n\treturn toStr.call(arr) === '[object Array]';\n};\n\nvar isPlainObject = function isPlainObject(obj) {\n\tif (!obj || toStr.call(obj) !== '[object Object]') {\n\t\treturn false;\n\t}\n\n\tvar hasOwnConstructor = hasOwn.call(obj, 'constructor');\n\tvar hasIsPrototypeOf = obj.constructor && obj.constructor.prototype && hasOwn.call(obj.constructor.prototype, 'isPrototypeOf');\n\t// Not own constructor property must be Object\n\tif (obj.constructor && !hasOwnConstructor && !hasIsPrototypeOf) {\n\t\treturn false;\n\t}\n\n\t// Own properties are enumerated firstly, so to speed up,\n\t// if last one is own, then all properties are own.\n\tvar key;\n\tfor (key in obj) { /**/ }\n\n\treturn typeof key === 'undefined' || hasOwn.call(obj, key);\n};\n\n// If name is '__proto__', and Object.defineProperty is available, define __proto__ as an own property on target\nvar setProperty = function setProperty(target, options) {\n\tif (defineProperty && options.name === '__proto__') {\n\t\tdefineProperty(target, options.name, {\n\t\t\tenumerable: true,\n\t\t\tconfigurable: true,\n\t\t\tvalue: options.newValue,\n\t\t\twritable: true\n\t\t});\n\t} else {\n\t\ttarget[options.name] = options.newValue;\n\t}\n};\n\n// Return undefined instead of __proto__ if '__proto__' is not an own property\nvar getProperty = function getProperty(obj, name) {\n\tif (name === '__proto__') {\n\t\tif (!hasOwn.call(obj, name)) {\n\t\t\treturn void 0;\n\t\t} else if (gOPD) {\n\t\t\t// In early versions of node, obj['__proto__'] is buggy when obj has\n\t\t\t// __proto__ as an own property. Object.getOwnPropertyDescriptor() works.\n\t\t\treturn gOPD(obj, name).value;\n\t\t}\n\t}\n\n\treturn obj[name];\n};\n\nmodule.exports = function extend() {\n\tvar options, name, src, copy, copyIsArray, clone;\n\tvar target = arguments[0];\n\tvar i = 1;\n\tvar length = arguments.length;\n\tvar deep = false;\n\n\t// Handle a deep copy situation\n\tif (typeof target === 'boolean') {\n\t\tdeep = target;\n\t\ttarget = arguments[1] || {};\n\t\t// skip the boolean and the target\n\t\ti = 2;\n\t}\n\tif (target == null || (typeof target !== 'object' && typeof target !== 'function')) {\n\t\ttarget = {};\n\t}\n\n\tfor (; i < length; ++i) {\n\t\toptions = arguments[i];\n\t\t// Only deal with non-null/undefined values\n\t\tif (options != null) {\n\t\t\t// Extend the base object\n\t\t\tfor (name in options) {\n\t\t\t\tsrc = getProperty(target, name);\n\t\t\t\tcopy = getProperty(options, name);\n\n\t\t\t\t// Prevent never-ending loop\n\t\t\t\tif (target !== copy) {\n\t\t\t\t\t// Recurse if we're merging plain objects or arrays\n\t\t\t\t\tif (deep && copy && (isPlainObject(copy) || (copyIsArray = isArray(copy)))) {\n\t\t\t\t\t\tif (copyIsArray) {\n\t\t\t\t\t\t\tcopyIsArray = false;\n\t\t\t\t\t\t\tclone = src && isArray(src) ? src : [];\n\t\t\t\t\t\t} else {\n\t\t\t\t\t\t\tclone = src && isPlainObject(src) ? src : {};\n\t\t\t\t\t\t}\n\n\t\t\t\t\t\t// Never move original objects, clone them\n\t\t\t\t\t\tsetProperty(target, { name: name, newValue: extend(deep, clone, copy) });\n\n\t\t\t\t\t// Don't bring in undefined values\n\t\t\t\t\t} else if (typeof copy !== 'undefined') {\n\t\t\t\t\t\tsetProperty(target, { name: name, newValue: copy });\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\t}\n\n\t// Return the modified object\n\treturn target;\n};\n","import extend from 'extend';\n\nconst walk = function (json, callback) {\n    if (typeof json === 'object' && json !== null) {\n        for (const key of Object.keys(json)) {\n            const value = json[key];\n            callback(value, key, json); // eslint-disable-line n/callback-return\n            walk(value, callback);\n        }\n    }\n};\n\nconst executePass = function (json) {\n    let modificationsOccurredInThisPass = false;\n    walk(json, function (value, key, parentNode) {\n        if (typeof value === 'object' && value !== null && value['#merge']) {\n            const nameOfPropertyToMergeWith = value['#merge'];\n            const mergeWith = parentNode[nameOfPropertyToMergeWith];\n\n            if (typeof mergeWith === 'object' && mergeWith !== null) {\n                delete value['#merge'];\n                const newValue = extend(true, {}, mergeWith, value);\n                if (newValue['#merge'] === nameOfPropertyToMergeWith) {\n                    throw new Error('Circular reference detected: ' + nameOfPropertyToMergeWith);\n                }\n                parentNode[key] = newValue;\n\n                modificationsOccurredInThisPass = true;\n            }\n        }\n    });\n\n    if (modificationsOccurredInThisPass) {\n        executePass(json);\n    }\n\n    return json;\n};\n\nconst hashMergeProperties = (json) => {\n    const clonedJson = structuredClone(json);\n\n    const mergedJson = executePass(clonedJson);\n\n    return mergedJson;\n};\n\nexport { hashMergeProperties };\n","import { hashMergeProperties } from './hashMergeProperties.js';\n\nconst json = {\n    hashMergeProperties\n};\n\nexport { json };\n"],"names":["hasOwn","Object","prototype","hasOwnProperty","toStr","toString","defineProperty","gOPD","getOwnPropertyDescriptor","isArray","arr","Array","call","isPlainObject","obj","key","hasOwnConstructor","hasIsPrototypeOf","constructor","setProperty","target","options","name","enumerable","configurable","value","newValue","writable","getProperty","extend","src","copy","copyIsArray","clone","arguments","i","length","deep","walk","json","callback","keys","executePass","modificationsOccurredInThisPass","parentNode","nameOfPropertyToMergeWith","mergeWith","Error","hashMergeProperties","clonedJson","structuredClone"],"mappings":";;;;AAEA,IAAIA,OAASC,OAAOC,UAAUC,eAC1BC,MAAQH,OAAOC,UAAUG,SACzBC,eAAiBL,OAAOK,eACxBC,KAAON,OAAOO,yBAEdC,QAAU,SAAiBC,KAC9B,MAA6B,mBAAlBC,MAAMF,QACTE,MAAMF,QAAQC,KAGK,mBAApBN,MAAMQ,KAAKF,IACnB,EAEIG,cAAgB,SAAuBC,KAC1C,IAAKA,KAA2B,oBAApBV,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