{"version":3,"file":"hive.B9XXC3MB.mjs","sources":["../../../../node_modules/.bun/@hono+zod-validator@0.7.4+65881afdd29fa4a1/node_modules/@hono/zod-validator/dist/index.js"],"sourcesContent":["// src/index.ts\nimport { validator } from \"hono/validator\";\nvar zValidator = (target, schema, hook, options) => (\n  // @ts-expect-error not typed well\n  validator(target, async (value, c) => {\n    let validatorValue = value;\n    if (target === \"header\" && \"_def\" in schema || target === \"header\" && \"_zod\" in schema) {\n      const schemaKeys = Object.keys(\"in\" in schema ? schema.in.shape : schema.shape);\n      const caseInsensitiveKeymap = Object.fromEntries(\n        schemaKeys.map((key) => [key.toLowerCase(), key])\n      );\n      validatorValue = Object.fromEntries(\n        Object.entries(value).map(([key, value2]) => [caseInsensitiveKeymap[key] || key, value2])\n      );\n    }\n    const result = options && options.validationFunction ? await options.validationFunction(schema, validatorValue) : (\n      // @ts-expect-error z4.$ZodType has safeParseAsync\n      await schema.safeParseAsync(validatorValue)\n    );\n    if (hook) {\n      const hookResult = await hook({ data: validatorValue, ...result, target }, c);\n      if (hookResult) {\n        if (hookResult instanceof Response) {\n          return hookResult;\n        }\n        if (\"response\" in hookResult) {\n          return hookResult.response;\n        }\n      }\n    }\n    if (!result.success) {\n      return c.json(result, 400);\n    }\n    return result.data;\n  })\n);\nexport {\n  zValidator\n};\n"],"names":[],"mappings":";;AAAA;AAEG,IAAC,UAAU,GAAG,CAAC,MAAM,EAAE,MAAM,EAAE,IAAI,EAAE,OAAO;AAC/C;AACA,EAAE,SAAS,CAAC,MAAM,EAAE,OAAO,KAAK,EAAE,CAAC,KAAK;AACxC,IAAI,IAAI,cAAc,GAAG,KAAK;AAU9B,IAAI,MAAM,MAAM,GAAsG;AACtH;AACA,MAAM,MAAM,MAAM,CAAC,cAAc,CAAC,cAAc;AAChD,KAAK;AAYL,IAAI,IAAI,CAAC,MAAM,CAAC,OAAO,EAAE;AACzB,MAAM,OAAO,CAAC,CAAC,IAAI,CAAC,MAAM,EAAE,GAAG,CAAC;AAChC,IAAI;AACJ,IAAI,OAAO,MAAM,CAAC,IAAI;AACtB,EAAE,CAAC;AACH;;;;","x_google_ignoreList":[0]}