import "./chunk-NCMUZ6BQ.js";
import {
  MetadataForm
} from "./chunk-ZW34ZAIP.js";
import "./chunk-TKGWSUEI.js";
import "./chunk-U2ZFCAPX.js";
import "./chunk-INNFZYX2.js";
import "./chunk-LAVHRER2.js";
import "./chunk-Y7QKP6QU.js";
import {
  RouteDrawer
} from "./chunk-FWJLS7XD.js";
import "./chunk-3QSRE5LS.js";
import "./chunk-PBQ5M44A.js";
import "./chunk-OH4AABUT.js";
import "./chunk-YKDEE7ZL.js";
import "./chunk-AEMDNTW5.js";
import "./chunk-LYD3C73Z.js";
import "./chunk-7O5NDICV.js";
import "./chunk-46M463BR.js";
import "./chunk-YFRC6GEN.js";
import "./chunk-N6SI4IIT.js";
import "./chunk-JPNPTILP.js";
import "./chunk-DAXXLQKB.js";
import "./chunk-OHOWEMHO.js";
import "./chunk-GKGLVDDV.js";
import "./chunk-WJJXUXSO.js";
import "./chunk-LAPEZATU.js";
import "./chunk-DBNPVU3L.js";
import "./chunk-U7WZYWGA.js";
import "./chunk-ZN7LWXVC.js";
import "./chunk-VYMODH6P.js";
import "./chunk-LEG67A2R.js";
import "./chunk-PRBE5CM3.js";
import "./chunk-5TRY5IMZ.js";
import "./chunk-TAKEQAZZ.js";
import {
  useReservationItem,
  useUpdateReservationItem
} from "./chunk-B6FG7A6W.js";
import "./chunk-EPHVGD5Z.js";
import "./chunk-ESPLVOFC.js";
import "./chunk-FXWKGNRV.js";
import "./chunk-VDKOJ5WD.js";
import "./chunk-DL2ZIXBO.js";
import "./chunk-Z2QQZOG3.js";
import "./chunk-5CK6XEFV.js";
import "./chunk-RHKRREUU.js";
import "./chunk-ZA2KFUFR.js";
import "./chunk-ZBWL72TB.js";
import "./chunk-NBMM2TZK.js";

// src/pages/reservations/reservation-metadata/reservation-metadata.tsx
import { useParams } from "react-router-dom";
import { ClientError } from "@mercurjs/client";
import { jsx } from "react/jsx-runtime";
var ReservationMetadata = () => {
  const { id } = useParams();
  const { reservation, isPending, isError, error } = useReservationItem(id);
  const { mutateAsync, isPending: isMutating } = useUpdateReservationItem(id);
  if (isError) {
    throw error;
  }
  const handleSubmit = async (params, callbacks) => {
    try {
      const result = await mutateAsync({
        metadata: params.metadata === void 0 ? void 0 : params.metadata
      });
      callbacks.onSuccess?.();
      return result;
    } catch (error2) {
      const message = error2 instanceof ClientError ? error2.message : "An error occurred";
      callbacks.onError?.(message);
      throw error2;
    }
  };
  return /* @__PURE__ */ jsx(RouteDrawer, { children: /* @__PURE__ */ jsx(
    MetadataForm,
    {
      isPending,
      isMutating,
      hook: handleSubmit,
      metadata: reservation?.metadata
    }
  ) });
};
export {
  ReservationMetadata as Component
};
