import { b as getCheckout, a as state } from './watchers-0c79cf4e.js';

/**
 * Gets the current checkout for the page.
 */
const currentCheckout = () => getCheckout(state.formId, state.mode);
/**
 * Is the checkout currently locked.
 * Pass an optional lock name to find if a
 * specific lock name is locking checkout.
 */
const checkoutIsLocked = (lockName = '') => { var _a; return (lockName ? state.locks.some(name => name === lockName) : !!((_a = state.locks) === null || _a === void 0 ? void 0 : _a.length)); };
/**
 * Get a line item by product id.
 */
const getLineItemByProductId = (productId) => { var _a, _b; return (((_b = (_a = state.checkout) === null || _a === void 0 ? void 0 : _a.line_items) === null || _b === void 0 ? void 0 : _b.data) || []).find(line_item => { var _a, _b; return ((_b = (_a = line_item === null || line_item === void 0 ? void 0 : line_item.price) === null || _a === void 0 ? void 0 : _a.product) === null || _b === void 0 ? void 0 : _b.id) === productId; }); };

export { checkoutIsLocked as a, currentCheckout as c, getLineItemByProductId as g };
