import { z as e } from "zod";
import { ErrorModel as n } from "./accelbyte-widgets537.mjs";
class o extends Error {
  toJSON() {
    return this.message;
  }
}
const t = e.object({
  as: e.string(),
  caption: e.string(),
  height: e.number(),
  width: e.number(),
  imageUrl: e.string(),
  smallImageUrl: e.string()
}), s = e.object({
  kind: e.literal("image"),
  value: t
});
e.union([s, e.null(), n]);
const l = (r) => {
  const a = t.safeParse(r);
  return a.success ? {
    kind: "image",
    value: { ...a.data }
  } : {
    kind: "error",
    error: new o()
  };
}, u = (r) => s.safeParse(r).success ? { ...r.value } : null;
export {
  t as ImageCodec,
  s as ImageMediumCodec,
  o as ImageTypeInvalidError,
  l as fromRaw,
  u as toRaw
};
