import { Schema } from 'effect';
import type { Environment } from '../../vendor/cel-js/lib/index.js';
import type { InitialSource } from './utils/initial.js';
import { registerFormVariablesIfAbsent } from './utils/form-vars.js';
import { type LayoutSetValue } from '../../share/layout.js';
export { commonFieldFields } from './utils/common.js';
export { getStructFieldTitle, getStructFieldDescription, getNestedStructFieldTitle, getNestedStructFieldDescription, } from './utils/schema-meta.js';
export { Align, DEFAULT_GAP, LayoutSet, validatePlacements } from '../../share/layout.js';
declare const KIND = "shwfed.component.form";
export declare const metadata: {
    readonly name: "表单";
    readonly icon: "fluent:form-20-regular";
    readonly operations: readonly [{
        readonly id: "validate";
        readonly name: "校验";
        readonly icon: "fluent:checkmark-circle-20-regular";
    }, {
        readonly id: "undo";
        readonly name: "撤销";
        readonly icon: "fluent:arrow-undo-20-regular";
    }, {
        readonly id: "redo";
        readonly name: "重做";
        readonly icon: "fluent:arrow-redo-20-regular";
    }, {
        readonly id: "reset-to-initial";
        readonly name: "重置为初始值";
        readonly icon: "fluent:arrow-reset-20-regular";
    }];
};
type AnySchema = Schema.Schema<any, any, never>;
/**
 * The shared body of a form — fields + layouts only, with placement
 * cross-validation. Used by `FormConfig` (top-level form) and re-used by
 * nested field types that want to embed a mini-form (e.g. the list field's
 * repeating unit).
 *
 * `configure` is used as-is; callers that want form-wide bindings like `now`
 * are responsible for registering them before calling.
 */
export declare function FormUnit(configure: (env: Environment) => void): Schema.refine<{
    readonly fields: readonly any[];
    readonly layouts: readonly {
        readonly name: string;
        readonly layout: {
            readonly style?: string | undefined;
            readonly columns: number;
            readonly gap?: number | undefined;
            readonly rows?: number | undefined;
            readonly placements: {
                readonly [x: string]: {
                    readonly area: readonly [readonly [number, number], readonly [number, number]];
                    readonly v?: "stretch" | "center" | "end" | "start" | undefined;
                    readonly h?: "stretch" | "center" | "end" | "start" | undefined;
                };
            };
        };
        readonly media?: string | undefined;
    }[];
}, Schema.Struct<{
    fields: Schema.Array$<AnySchema>;
    layouts: Schema.refine<readonly {
        readonly name: string;
        readonly layout: {
            readonly style?: string | undefined;
            readonly columns: number;
            readonly gap?: number | undefined;
            readonly rows?: number | undefined;
            readonly placements: {
                readonly [x: string]: {
                    readonly area: readonly [readonly [number, number], readonly [number, number]];
                    readonly v?: "stretch" | "center" | "end" | "start" | undefined;
                    readonly h?: "stretch" | "center" | "end" | "start" | undefined;
                };
            };
        };
        readonly media?: string | undefined;
    }[], Schema.Array$<Schema.Struct<{
        name: Schema.SchemaClass<string, string, never>;
        media: Schema.optional<Schema.Schema<string, string, never>>;
        layout: Schema.Struct<{
            columns: Schema.refine<number, Schema.filter<typeof Schema.Number>>;
            rows: Schema.optional<Schema.refine<number, Schema.filter<typeof Schema.Number>>>;
            gap: Schema.optional<Schema.refine<number, Schema.filter<typeof Schema.Number>>>;
            style: Schema.optional<Schema.SchemaClass<string, string, never>>;
            placements: Schema.Record$<typeof Schema.String, Schema.Struct<{
                area: Schema.refine<readonly [readonly [number, number], readonly [number, number]], Schema.Tuple2<Schema.Tuple2<Schema.filter<Schema.filter<typeof Schema.Number>>, Schema.filter<Schema.filter<typeof Schema.Number>>>, Schema.Tuple2<Schema.filter<Schema.filter<typeof Schema.Number>>, Schema.filter<Schema.filter<typeof Schema.Number>>>>>;
                h: Schema.optional<Schema.Literal<["start", "center", "end", "stretch"]>>;
                v: Schema.optional<Schema.Literal<["start", "center", "end", "stretch"]>>;
            }>>;
        }>;
    }>>>;
}>>;
export { registerFormVariablesIfAbsent };
export declare function FormConfig(configure: (env: Environment) => void): Schema.refine<{
    readonly style?: string | undefined;
    readonly id?: string | undefined;
    readonly initial?: {
        readonly data: string;
        readonly request?: string | undefined;
    } | undefined;
    readonly displayName?: string | undefined;
    readonly kind: "shwfed.component.form";
    readonly fields: readonly any[];
    readonly layouts: readonly {
        readonly name: string;
        readonly layout: {
            readonly style?: string | undefined;
            readonly columns: number;
            readonly gap?: number | undefined;
            readonly rows?: number | undefined;
            readonly placements: {
                readonly [x: string]: {
                    readonly area: readonly [readonly [number, number], readonly [number, number]];
                    readonly v?: "stretch" | "center" | "end" | "start" | undefined;
                    readonly h?: "stretch" | "center" | "end" | "start" | undefined;
                };
            };
        };
        readonly media?: string | undefined;
    }[];
    readonly readonly?: string | undefined;
}, Schema.Struct<{
    fields: Schema.Array$<AnySchema>;
    layouts: Schema.refine<readonly {
        readonly name: string;
        readonly layout: {
            readonly style?: string | undefined;
            readonly columns: number;
            readonly gap?: number | undefined;
            readonly rows?: number | undefined;
            readonly placements: {
                readonly [x: string]: {
                    readonly area: readonly [readonly [number, number], readonly [number, number]];
                    readonly v?: "stretch" | "center" | "end" | "start" | undefined;
                    readonly h?: "stretch" | "center" | "end" | "start" | undefined;
                };
            };
        };
        readonly media?: string | undefined;
    }[], Schema.Array$<Schema.Struct<{
        name: Schema.SchemaClass<string, string, never>;
        media: Schema.optional<Schema.Schema<string, string, never>>;
        layout: Schema.Struct<{
            columns: Schema.refine<number, Schema.filter<typeof Schema.Number>>;
            rows: Schema.optional<Schema.refine<number, Schema.filter<typeof Schema.Number>>>;
            gap: Schema.optional<Schema.refine<number, Schema.filter<typeof Schema.Number>>>;
            style: Schema.optional<Schema.SchemaClass<string, string, never>>;
            placements: Schema.Record$<typeof Schema.String, Schema.Struct<{
                area: Schema.refine<readonly [readonly [number, number], readonly [number, number]], Schema.Tuple2<Schema.Tuple2<Schema.filter<Schema.filter<typeof Schema.Number>>, Schema.filter<Schema.filter<typeof Schema.Number>>>, Schema.Tuple2<Schema.filter<Schema.filter<typeof Schema.Number>>, Schema.filter<Schema.filter<typeof Schema.Number>>>>>;
                h: Schema.optional<Schema.Literal<["start", "center", "end", "stretch"]>>;
                v: Schema.optional<Schema.Literal<["start", "center", "end", "stretch"]>>;
            }>>;
        }>;
    }>>>;
    kind: Schema.tag<"shwfed.component.form">;
    id: Schema.optional<Schema.refine<string, typeof Schema.String>>;
    displayName: Schema.optional<Schema.SchemaClass<string, string, never>>;
    initial: Schema.optional<Schema.transform<Schema.Union<[Schema.Schema<string, string, never>, Schema.Struct<{
        request: Schema.optional<Schema.Schema<string, string, never>>;
        data: Schema.Schema<string, string, never>;
    }>]>, Schema.Struct<{
        request: Schema.optional<Schema.Schema<string, string, never>>;
        data: Schema.Schema<string, string, never>;
    }>>>;
    readonly: Schema.optional<Schema.Schema<string, string, never>>;
    style: Schema.optional<typeof Schema.String>;
}>>;
export declare function createFormConfig(body: Omit<Schema.Schema.Type<ReturnType<typeof FormConfig>>, 'kind'>): {
    style?: string | undefined;
    id?: string | undefined;
    initial?: {
        readonly data: string;
        readonly request?: string | undefined;
    } | undefined;
    displayName?: string | undefined;
    fields: readonly any[];
    layouts: readonly {
        readonly name: string;
        readonly layout: {
            readonly style?: string | undefined;
            readonly columns: number;
            readonly gap?: number | undefined;
            readonly rows?: number | undefined;
            readonly placements: {
                readonly [x: string]: {
                    readonly area: readonly [readonly [number, number], readonly [number, number]];
                    readonly v?: "stretch" | "center" | "end" | "start" | undefined;
                    readonly h?: "stretch" | "center" | "end" | "start" | undefined;
                };
            };
        };
        readonly media?: string | undefined;
    }[];
    readonly?: string | undefined;
    kind: typeof KIND;
};
export declare function defaultFormConfig(): FormConfigValue;
export type FieldValue = Readonly<{
    id: string;
    type: string;
    compatibilityDate: string;
}> & Readonly<Record<string, unknown>>;
export type { AlignValue, PlacementValue, LayoutValue, LayoutSetValue } from '../../share/layout.js';
export type FormUnitValue = Readonly<{
    fields: ReadonlyArray<FieldValue>;
    layouts: ReadonlyArray<LayoutSetValue>;
}>;
export type FormConfigValue = Readonly<{
    kind: typeof KIND;
    id?: string;
    displayName?: string;
    initial?: InitialSource;
    readonly?: string;
    style?: string;
}> & FormUnitValue;
