import {
  variantsQueryKeys
} from "./chunk-YAUGB4LD.js";
import {
  queryClient
} from "./chunk-RHKRREUU.js";
import {
  sdk
} from "./chunk-DTGEFKK4.js";

// src/pages/product-variants/product-variant-detail/loader.ts
var VARIANT_DETAIL_FIELDS = "+options.id,+options.value,+options.option.id,+options.option.title,+thumbnail,+images.id,+images.url,+images.rank,+images.variants.id,+product.images.id,+product.images.url,+product.images.rank,+product.images.variants.id";
var variantDetailQuery = (productId, variantId) => ({
  queryKey: variantsQueryKeys.detail(variantId, { fields: VARIANT_DETAIL_FIELDS }),
  queryFn: async () => sdk.vendor.products.$id.variants.$variantId.query({
    $id: productId,
    $variantId: variantId,
    fields: VARIANT_DETAIL_FIELDS
  })
});
var variantLoader = async ({
  params
}) => {
  const productId = params.id || params.product_id;
  const variantId = params.variant_id;
  const query = variantDetailQuery(productId, variantId);
  return queryClient.ensureQueryData(query);
};

export {
  VARIANT_DETAIL_FIELDS,
  variantLoader
};
