{"version":3,"file":"modifyQueueFuntions.mjs","names":[],"sources":["../../../src/requester/util/modifyQueueFuntions.ts"],"sourcesContent":["/* eslint-disable @typescript-eslint/no-explicit-any */\nimport type { WaitingProcess } from \"../../util/RequestBatcher\";\n\n/**\n * @internal\n *\n * A helper function for a common way to modify the batch queue. This merges\n * the incoming request with the currently executing request or the last request\n * in the queue if its keys are the same.\n *\n * @param key - the key of the incoming request\n * @returns a modifyQueue function\n */\nexport function modifyQueueByMergingEventsWithTheSameKeys(key: string) {\n  return (\n    queue: WaitingProcess<any[], any>[],\n    currentlyLoading: WaitingProcess<any[], any> | undefined,\n  ) => {\n    if (queue.length === 0 && currentlyLoading?.name === key) {\n      return currentlyLoading;\n    } else if (queue[queue.length - 1]?.name === key) {\n      return queue[queue.length - 1];\n    }\n    return undefined;\n  };\n}\n"],"mappings":";;;;;;;;;;;AAaA,SAAgB,0CAA0C,KAAa;AACrE,SACE,OACA,qBACG;AACH,MAAI,MAAM,WAAW,KAAK,kBAAkB,SAAS,IACnD,QAAO;WACE,MAAM,MAAM,SAAS,IAAI,SAAS,IAC3C,QAAO,MAAM,MAAM,SAAS"}