import { $$find } from '@jsonjoy.com/json-pointer/lib/codegen/find';
import { deepEqualCodegen } from '@jsonjoy.com/util/lib/json-equal/deepEqualCodegen';
import { compileClosure } from '@jsonjoy.com/codegen';
import { predicateOpWrapper } from '../util';
export const $$test = (op) => {
    const js = /* js */ `
(function(wrapper){
  var find = ${$$find(op.path)};
  var deepEqual = ${deepEqualCodegen(op.value)};
  return wrapper(function(doc){
    var val = find(doc);
    if (val === undefined) return ${op.not ? 'true' : 'false'};
    return ${op.not ? '!' : ''}deepEqual(val);
  });
})`;
    return {
        deps: [predicateOpWrapper],
        js: js,
    };
};
export const $test = (op) => compileClosure($$test(op));
//# sourceMappingURL=test.js.map