"use strict";

exports.__esModule = true;
exports.booleanCellType = void 0;
var _types = require("../../types");
var _View = require("./View");
exports.BooleanView = _View.BooleanView;
var _Edit = require("./Edit");
exports.BooleanEdit = _Edit.BooleanEdit;
const booleanCellType = exports.booleanCellType = (0, _types.defineCellType)({
  type: 'boolean',
  ViewComponent: _View.BooleanView,
  EditComponent: _Edit.BooleanEdit,
  serialize: value => value ? 'true' : 'false',
  deserialize: raw => {
    const normalized = raw.trim().toLowerCase();
    if (normalized === '1' || normalized === 'true' || normalized === 'checked') {
      return true;
    }
    if (normalized === '0' || normalized === 'false' || normalized === '') {
      return false;
    }
    throw new Error();
  },
  editable: true,
  clearable: true,
  toggleValue: value => !value
});
//# sourceMappingURL=index.js.map