import { toggleSelectLocationFacetValue } from '../../../../../features/commerce/facets/location-facet/location-facet-actions.js';
import { buildCoreCommerceFacet, } from '../headless-core-commerce-facet.js';
/**
 * @internal
 *
 * **Important:** This initializer is meant for internal use by headless only.
 * As an implementer, you must not import or use this initializer directly in your code.
 * You will instead interact with `LocationFacet` sub-controller instances through the state of a `FacetGenerator`
 * sub-controller.
 *
 * @param engine - The headless commerce engine.
 * @param options - The `LocationFacet` options used internally.
 * @returns A `LocationFacet` sub-controller instance.
 * */
export function buildCommerceLocationFacet(engine, options) {
    const { toggleSingleExclude, toggleExclude, isValueExcluded, ...coreController } = buildCoreCommerceFacet(engine, {
        options: {
            ...options,
            toggleSelectActionCreator: toggleSelectLocationFacetValue,
        },
    });
    return {
        ...coreController,
        get state() {
            return getLocationFacetState(coreController.state);
        },
        type: 'location',
    };
}
export const getLocationFacetState = (coreState) => {
    return {
        ...coreState,
        type: 'location',
    };
};
