{"version":3,"file":"equals-field-rules.mjs","names":[],"sources":["../../../../../../../../@warlock.js/seal/src/rules/common/equals-field-rules.ts"],"sourcesContent":["import { getFieldValue, invalidRule, VALID_RULE } from \"../../helpers\";\r\nimport type { SchemaRule } from \"../../types\";\r\n\r\n/**\r\n * Equals field rule - value must equal another field's value\r\n * Supports both global and sibling scope\r\n */\r\nexport const equalsFieldRule: SchemaRule<{\r\n  field: string;\r\n  scope?: \"global\" | \"sibling\";\r\n}> = {\r\n  name: \"equalsField\",\r\n  description: \"The value must equal another field's value\",\r\n  sortOrder: -1,\r\n  requiresValue: true,\r\n  defaultErrorMessage: \"The :input must match the :field field\",\r\n  async validate(value: any, context) {\r\n    const fieldValue = getFieldValue(this, context);\r\n\r\n    // Value must equal the other field's value\r\n    if (value !== fieldValue) {\r\n      this.context.translatableParams.field = this.context.options.field;\r\n      return invalidRule(this, context);\r\n    }\r\n\r\n    return VALID_RULE;\r\n  },\r\n};\r\n\r\n/**\r\n * Not equals field rule - value must NOT equal another field's value\r\n * Supports both global and sibling scope\r\n */\r\nexport const notEqualsFieldRule: SchemaRule<{\r\n  field: string;\r\n  scope?: \"global\" | \"sibling\";\r\n}> = {\r\n  name: \"notEqualsField\",\r\n  description: \"The value must NOT equal another field's value\",\r\n  sortOrder: -1,\r\n  requiresValue: true,\r\n  defaultErrorMessage: \"The :input must not match the :field field\",\r\n  async validate(value: any, context) {\r\n    const fieldValue = getFieldValue(this, context);\r\n\r\n    // Value must NOT equal the other field's value\r\n    if (value === fieldValue) {\r\n      return invalidRule(this, context);\r\n    }\r\n\r\n    return VALID_RULE;\r\n  },\r\n};\r\n"],"mappings":";;;;;;;;;AAOA,MAAa,kBAGR;CACH,MAAM;CACN,aAAa;CACb,WAAW;CACX,eAAe;CACf,qBAAqB;CACrB,MAAM,SAAS,OAAY,SAAS;EAIlC,IAAI,UAHe,cAAc,MAAM,OAGhB,GAAG;GACxB,KAAK,QAAQ,mBAAmB,QAAQ,KAAK,QAAQ,QAAQ;GAC7D,OAAO,YAAY,MAAM,OAAO;EAClC;EAEA,OAAO;CACT;AACF;;;;;AAMA,MAAa,qBAGR;CACH,MAAM;CACN,aAAa;CACb,WAAW;CACX,eAAe;CACf,qBAAqB;CACrB,MAAM,SAAS,OAAY,SAAS;EAIlC,IAAI,UAHe,cAAc,MAAM,OAGhB,GACrB,OAAO,YAAY,MAAM,OAAO;EAGlC,OAAO;CACT;AACF"}