export function isBridgePatchableTextField(field, isRichText) {
    const fieldType = field.type.toLowerCase();
    return (isRichText === true ||
        fieldType === "rich text" ||
        fieldType === "single-line text" ||
        fieldType === "multi-line text" ||
        fieldType === "memo");
}
export function getBridgeFieldPatchValue(field) {
    if (field.rawValue !== undefined && field.rawValue !== null) {
        return String(field.rawValue);
    }
    if (field.value === undefined || field.value === null)
        return "";
    return typeof field.value === "string" ? field.value : String(field.value);
}
export function buildBridgeFieldPatchPayload({ field, structureField, display, activeInlineEdit, }) {
    if (!structureField.elementKey)
        return undefined;
    if (!isBridgePatchableTextField(field, structureField.isRichText)) {
        return undefined;
    }
    if (structureField.elementKey === activeInlineEdit?.elementKey) {
        return undefined;
    }
    return {
        elementKey: structureField.elementKey,
        fieldId: structureField.fieldId,
        isRichText: structureField.isRichText || field.type.toLowerCase() === "rich text",
        source: display.source,
        value: display.value,
    };
}
//# sourceMappingURL=bridgeFieldPatch.js.map