/**
 * Utility to filter out internal props that should never be passed to DOM elements.
 *
 * Problem: When using rest destructuring (`...restProps`) in React components,
 * internal configuration props (like `hazo_chat_*`) can leak through and get
 * spread onto native DOM elements, causing React warnings:
 *
 * "Received `true` for a non-boolean attribute `hazo_chat_hide_references`"
 *
 * Solution: Use this utility to filter props before spreading to DOM elements.
 */
/**
 * Prefixes for internal props that should never reach DOM elements.
 * Add new prefixes here as integrations are added.
 */
const NON_DOM_PROP_PREFIXES = [
    'hazo_chat_',
    'hazo_notes_',
];
/**
 * Specific prop names (not prefixed) that should be filtered.
 * These are internal configuration props used by the form system.
 */
const NON_DOM_PROPS = new Set([
    // Chat-related props (non-prefixed variants)
    'chat_config',
    'chat_status',
    'chat_background_color',
    'is_chat_active',
    'has_chat_messages',
    // Notes-related props
    'notes_config',
    'has_notes',
    'is_notes_active',
    'notes_panel_style',
    'notes_background_color',
    'notes_save_mode',
    // Field metadata props
    'field_data_id',
    'field_name',
    'is_data_ok_default',
    'row_background_color',
    'container_class_name',
    'label_class_name',
    'error_class_name',
    'field_width_class_name',
    'field_wrapper_class_name',
    'input_wrapper_class_name',
    'textarea_wrapper_class_name',
    // Icons behaviour props
    'icons_behaviour',
    'active_role',
    // ihelp props
    'ihelp_context_key',
    // Other internal props
    'additional_context',
    'include_chat_in_dropdown',
    'include_notes_in_dropdown',
    'extract_active_chat',
    'extract_active_notes',
    'edit_actions_display',
    'action_buttons_borderless',
    // Reference data props
    'reference_data',
    'on_reference_delete',
    // File upload internal props
    'accept_files_public',
    'accept_files_private',
    'accept_public_files',
    'accept_private_files',
    'private_files_permission',
    'can_access_private_files',
    'on_private_files_change',
]);
/**
 * Checks if a prop name is a non-DOM internal prop.
 */
function is_non_dom_prop(key) {
    // Check prefixes
    for (const prefix of NON_DOM_PROP_PREFIXES) {
        if (key.startsWith(prefix)) {
            return true;
        }
    }
    // Check specific prop names
    return NON_DOM_PROPS.has(key);
}
/**
 * Filters out props that should not be passed to DOM elements.
 * Use this before spreading props onto native HTML elements.
 *
 * @example
 * ```tsx
 * const { domProps, internalProps } = filter_dom_props(restProps);
 * return <input {...domProps} />;
 * ```
 */
export function filter_dom_props(props) {
    const dom_props = {};
    const internal_props = {};
    for (const [key, value] of Object.entries(props)) {
        if (is_non_dom_prop(key)) {
            internal_props[key] = value;
        }
        else {
            dom_props[key] = value;
        }
    }
    return { dom_props, internal_props };
}
/**
 * Simple version that just returns DOM-safe props.
 * Use when you don't need access to the filtered internal props.
 *
 * @example
 * ```tsx
 * const domProps = get_dom_safe_props(restProps);
 * return <input {...domProps} />;
 * ```
 */
export function get_dom_safe_props(props) {
    return filter_dom_props(props).dom_props;
}
//# sourceMappingURL=filter_dom_props.js.map