{"version":3,"sources":["jsdelivr-header.js","/npm/@retrohacker/objectify@2.0.0/index.js"],"names":[],"mappings":"AAAA;AACA;AACA;AACA;AACA;AACA;AACA,ACNA,aAEA,MAAM,OAAU,GAAQ,EAAI,QAC1B,CAAC,EAAK,IAAQ,GAAuB,iBAAR,IAC7B,GAEF,OAAO,QAEP,SAAS,EAAW,EAAO,EAAM,IAE/B,OAAI,MAAM,QAAQ,KAAW,OAAO,GAC3B,EAAM,KAAI,GAAK,EAAU,KAG9B,MAAM,QAAQ,IACZ,EAAI,OAAS,IAGf,GAAO,KAEF,EAAM,QAAO,CAAC,EAAK,EAAK,KAE7B,EAAI,GAAG,IAAM,KAAS,EAAU,EAAK,GAAG,IAAM,KACvC,IACN,CAAC,IAGe,iBAAV,EAEF,OAAO,KAAK,GAEhB,KAAK,IACG,CACL,IAAK,EACL,MAAO,EAAU,EAAM,GAAI,OAI9B,QAAO,CAAC,EAAK,KACZ,EAAI,GAAG,EAAI,OAAS,EAAI,MACjB,IACN,CAAC,GAGD,CACT","file":"/npm/@retrohacker/objectify@2.0.0/index.js","sourceRoot":"","sourcesContent":["/**\n * Minified by jsDelivr using Terser v5.39.0.\n * Original file: /npm/@retrohacker/objectify@2.0.0/index.js\n *\n * Do NOT use SRI with dynamically generated files! More information: https://www.jsdelivr.com/using-sri-with-dynamic-files\n */\n","'use strict'\n\nconst hasObj = (arr) => arr.reduce(\n  (acc, cur) => acc || (typeof cur === 'object'),\n  false)\n\nmodule.exports =\n// This makes it possible to index arrays in elasticsearch.\nfunction objectify (input, key = '') {\n  // Leave arrays of non-objects alone\n  if (Array.isArray(input) && !hasObj(input)) {\n    return input.map(v => objectify(v))\n  }\n  // Convert arrays w/ objects into an elasticsearch friendly format\n  if (Array.isArray(input)) {\n    if (key.length > 0) {\n      // Add seperator, otherwise nested arrays are ambigious\n      // (foo10 vs foo_1_0)\n      key += '_'\n    }\n    return input.reduce((acc, cur, idx) => {\n      // Also objectify the element in the array\n      acc[`${key}${idx}`] = objectify(cur, `${key}${idx}`)\n      return acc\n    }, {})\n  }\n  // If this is an object, objectify every value stored on it\n  if (typeof input === 'object') {\n    // First, get each key on the object\n    return Object.keys(input)\n      // Then objectify each value on the object and keep track of it's key\n      .map((v) => {\n        return {\n          key: v,\n          value: objectify(input[v], v)\n        }\n      })\n      // Create a new object with the same keys and the objectifyed values\n      .reduce((acc, cur) => {\n        acc[`${cur.key}`] = cur.value\n        return acc\n      }, {})\n  }\n  // If this isn't an array or an object, nothing to do!\n  return input\n}\n"]}