{"version":3,"sources":["../../../src/internals/helpers/general.ts"],"names":["sleep","ms","signal","start","Date","now","ctx","iteration","elapsed","setTimeout","validate","value","schema","parse"],"mappings":";;;;;;AAmBA,gBAAuBA,KAAAA,CAAMC,IAAYC,MAAoB,EAAA;AAC3D,EAAMC,MAAAA,KAAAA,GAAQC,KAAKC,GAAG,EAAA;AACtB,EAAA,MAAMC,GAAM,GAAA;IAAEC,SAAW,EAAA,CAAA;IAAGC,OAAS,EAAA;AAAE,GAAA;AACvC,EAAA,OAAO,IAAM,EAAA;AACX,IAAA,MAAMC,oBAAWR,EAAI,EAAA;AACnBC,MAAAA;KACF,CAAA;AACAI,IAAIE,GAAAA,CAAAA,OAAAA,GAAUJ,IAAKC,CAAAA,GAAAA,EAAQF,GAAAA,KAAAA;AAC3BG,IAAIC,GAAAA,CAAAA,SAAAA,EAAAA;AACJ,IAAMD,MAAAA,GAAAA;AACR;AACF;AAXuBN,MAAAA,CAAAA,KAAAA,EAAAA,OAAAA,CAAAA;AAahB,SAASU,QAAAA,CAAYC,OAAgBC,MAAkB,EAAA;AAC5DA,EAAAA,MAAAA,CAAOC,MAAMF,KAAAA,CAAAA;AACf;AAFgBD,MAAAA,CAAAA,QAAAA,EAAAA,UAAAA,CAAAA","file":"general.cjs","sourcesContent":["/**\n * Copyright 2025 IBM Corp.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n *     http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\nimport { setTimeout } from \"node:timers/promises\";\nimport { ZodType } from \"zod\";\n\nexport async function* sleep(ms: number, signal?: AbortSignal) {\n  const start = Date.now();\n  const ctx = { iteration: 0, elapsed: 0 };\n  while (true) {\n    await setTimeout(ms, {\n      signal,\n    });\n    ctx.elapsed = Date.now() - start;\n    ctx.iteration++;\n    yield ctx;\n  }\n}\n\nexport function validate<T>(value: unknown, schema: ZodType<T>): asserts value is T {\n  schema.parse(value);\n}\n"]}