{
  "version": 3,
  "sources": ["../../../src/internal-utils/array-like.ts"],
  "sourcesContent": ["import type { SingleOrArray } from 'react-bindings';\n\n/** Normalizes a SingleOrArray value as an array */\nexport const normalizeAsArray = <T>(value: SingleOrArray<T>) => (Array.isArray(value) ? value : [value]);\n\n/** Normalizes a SingleOrArray value as an array or undefined */\nexport const normalizeAsOptionalArray = <T>(value?: SingleOrArray<T>) =>\n  value === undefined ? undefined : Array.isArray(value) ? value : [value];\n\n/** Returns an array by efficiently concatenating multiple potential arrays as needed. */\nexport const concatArrays = <T>(...arrays: Array<T[] | undefined>): T[] => {\n  if (arrays.length <= 1) {\n    return arrays[0] ?? [];\n  }\n\n  // Detects if we have more than one array with item -- stops looking once we know the answer\n  let numArraysWithItems = 0;\n  let lastArrayWithItems: T[] | undefined;\n  for (const array of arrays) {\n    if (array !== undefined && array.length > 0) {\n      numArraysWithItems += 1;\n      lastArrayWithItems = array;\n\n      if (numArraysWithItems > 1) {\n        break;\n      }\n    }\n  }\n\n  if (numArraysWithItems <= 1) {\n    return lastArrayWithItems ?? [];\n  } else {\n    const output: T[] = [];\n    for (const array of arrays) {\n      if (array !== undefined && array.length > 0) {\n        output.push(...array);\n      }\n    }\n    return output;\n  }\n};\n"],
  "mappings": "AAGO,MAAM,mBAAmB,CAAI,UAA6B,MAAM,QAAQ,KAAK,IAAI,QAAQ,CAAC,KAAK;AAG/F,MAAM,2BAA2B,CAAI,UAC1C,UAAU,SAAY,SAAY,MAAM,QAAQ,KAAK,IAAI,QAAQ,CAAC,KAAK;AAGlE,MAAM,eAAe,IAAO,WAAwC;AACzE,MAAI,OAAO,UAAU,GAAG;AACtB,WAAO,OAAO,CAAC,KAAK,CAAC;AAAA,EACvB;AAGA,MAAI,qBAAqB;AACzB,MAAI;AACJ,aAAW,SAAS,QAAQ;AAC1B,QAAI,UAAU,UAAa,MAAM,SAAS,GAAG;AAC3C,4BAAsB;AACtB,2BAAqB;AAErB,UAAI,qBAAqB,GAAG;AAC1B;AAAA,MACF;AAAA,IACF;AAAA,EACF;AAEA,MAAI,sBAAsB,GAAG;AAC3B,WAAO,sBAAsB,CAAC;AAAA,EAChC,OAAO;AACL,UAAM,SAAc,CAAC;AACrB,eAAW,SAAS,QAAQ;AAC1B,UAAI,UAAU,UAAa,MAAM,SAAS,GAAG;AAC3C,eAAO,KAAK,GAAG,KAAK;AAAA,MACtB;AAAA,IACF;AACA,WAAO;AAAA,EACT;AACF;",
  "names": []
}
