{"version":3,"file":"instanceof.mjs","names":[],"sources":["../../../../../../../../@warlock.js/seal/src/rules/common/instanceof.ts"],"sourcesContent":["import { invalidRule, VALID_RULE } from \"../../helpers\";\nimport type { SchemaRule } from \"../../types\";\n\n/**\n * InstanceOf rule - value must be an instance of the given constructor.\n *\n * Uses the `instanceof` operator at runtime. Useful for class instances\n * not representable in JSON Schema (File, Buffer, custom domain classes).\n */\nexport const instanceofRule: SchemaRule<{ ctor: new (...args: any[]) => any; name: string }> = {\n  name: \"instanceof\",\n  defaultErrorMessage: \"The :input must be an instance of :name\",\n  async validate(value: any, context) {\n    if (value instanceof this.context.options.ctor) {\n      return VALID_RULE;\n    }\n\n    this.context.translationParams.name = this.context.options.name;\n\n    return invalidRule(this, context);\n  },\n};\n"],"mappings":";;;;;;;;;;AASA,MAAa,iBAAkF;CAC7F,MAAM;CACN,qBAAqB;CACrB,MAAM,SAAS,OAAY,SAAS;EAClC,IAAI,iBAAiB,KAAK,QAAQ,QAAQ,MACxC,OAAO;EAGT,KAAK,QAAQ,kBAAkB,OAAO,KAAK,QAAQ,QAAQ;EAE3D,OAAO,YAAY,MAAM,OAAO;CAClC;AACF"}