"use strict";
var __webpack_require__ = {};
(()=>{
    __webpack_require__.d = function(exports1, definition) {
        for(var key in definition)if (__webpack_require__.o(definition, key) && !__webpack_require__.o(exports1, key)) Object.defineProperty(exports1, key, {
            enumerable: true,
            get: definition[key]
        });
    };
})();
(()=>{
    __webpack_require__.o = function(obj, prop) {
        return Object.prototype.hasOwnProperty.call(obj, prop);
    };
})();
(()=>{
    __webpack_require__.r = function(exports1) {
        if ('undefined' != typeof Symbol && Symbol.toStringTag) Object.defineProperty(exports1, Symbol.toStringTag, {
            value: 'Module'
        });
        Object.defineProperty(exports1, '__esModule', {
            value: true
        });
    };
})();
var __webpack_exports__ = {};
__webpack_require__.r(__webpack_exports__);
__webpack_require__.d(__webpack_exports__, {
    JsonFieldInterface: ()=>JsonFieldInterface
});
const jsx_runtime_namespaceObject = require("react/jsx-runtime");
require("react");
const components_namespaceObject = require("@tachybase/components");
const schema_namespaceObject = require("@tachybase/schema");
const CollectionFieldInterface_js_namespaceObject = require("../../data-source/collection-field-interface/CollectionFieldInterface.js");
const index_js_namespaceObject = require("./properties/index.js");
function _define_property(obj, key, value) {
    if (key in obj) Object.defineProperty(obj, key, {
        value: value,
        enumerable: true,
        configurable: true,
        writable: true
    });
    else obj[key] = value;
    return obj;
}
(0, schema_namespaceObject.registerValidateRules)({
    json (value) {
        try {
            JSON.parse(value);
            return true;
        } catch (error) {
            return {
                type: 'error',
                message: error.message
            };
        }
    }
});
class JsonFieldInterface extends CollectionFieldInterface_js_namespaceObject.CollectionFieldInterface {
    constructor(...args){
        super(...args), _define_property(this, "name", 'json'), _define_property(this, "type", 'object'), _define_property(this, "group", 'advanced'), _define_property(this, "order", 4), _define_property(this, "title", '{{t("JSON")}}'), _define_property(this, "sortable", true), _define_property(this, "default", {
            type: 'json',
            uiSchema: {
                type: 'object',
                'x-component': 'Input.JSON',
                'x-component-props': {
                    autoSize: {
                        minRows: 5
                    }
                },
                default: null
            }
        }), _define_property(this, "availableTypes", [
            'json',
            'array',
            'jsonb',
            'text',
            'circle',
            'lineString',
            'point',
            'polygon'
        ]), _define_property(this, "hasDefaultValue", true), _define_property(this, "properties", {
            ...index_js_namespaceObject.defaultProps,
            jsonb: {
                type: 'boolean',
                title: 'JSONB',
                'x-decorator': (param)=>{
                    let { children } = param;
                    return /*#__PURE__*/ (0, jsx_runtime_namespaceObject.jsx)(components_namespaceObject.FormLayout, {
                        children: /*#__PURE__*/ (0, jsx_runtime_namespaceObject.jsx)(components_namespaceObject.FormItem, {
                            children: children
                        })
                    });
                },
                'x-component': 'Checkbox',
                'x-hidden': "{{ !isDialect('postgres') }}",
                'x-disabled': "{{ disabledJSONB }}"
            }
        }), _define_property(this, "filterable", {
            operators: index_js_namespaceObject.operators.string
        });
    }
}
var __webpack_export_target__ = exports;
for(var __webpack_i__ in __webpack_exports__)__webpack_export_target__[__webpack_i__] = __webpack_exports__[__webpack_i__];
if (__webpack_exports__.__esModule) Object.defineProperty(__webpack_export_target__, '__esModule', {
    value: true
});
