"use strict";
var __defProp = Object.defineProperty;
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
var __getOwnPropNames = Object.getOwnPropertyNames;
var __hasOwnProp = Object.prototype.hasOwnProperty;
var __export = (target, all) => {
  for (var name in all)
    __defProp(target, name, { get: all[name], enumerable: true });
};
var __copyProps = (to, from, except, desc) => {
  if (from && typeof from === "object" || typeof from === "function") {
    for (let key of __getOwnPropNames(from))
      if (!__hasOwnProp.call(to, key) && key !== except)
        __defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
  }
  return to;
};
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
var plugin_gif_exports = {};
__export(plugin_gif_exports, {
  GIF: () => GIF,
  GIFData: () => GIFData,
  gIFData_GIFTypeFromJSON: () => gIFData_GIFTypeFromJSON,
  gIFData_GIFTypeToJSON: () => gIFData_GIFTypeToJSON
});
module.exports = __toCommonJS(plugin_gif_exports);
var import_common = require("./common.js");
var import_plugin_gif_enums = require("./plugin_gif.enums.js");
function gIFData_GIFTypeFromJSON(object) {
  switch (object) {
    case 0:
    case "NORMAL":
      return import_plugin_gif_enums.GIFData_GIFType.NORMAL;
    case 1:
    case "STICKER":
      return import_plugin_gif_enums.GIFData_GIFType.STICKER;
    case -1:
    case "UNRECOGNIZED":
    default:
      return import_plugin_gif_enums.GIFData_GIFType.UNRECOGNIZED;
  }
}
function gIFData_GIFTypeToJSON(object) {
  switch (object) {
    case import_plugin_gif_enums.GIFData_GIFType.NORMAL:
      return "NORMAL";
    case import_plugin_gif_enums.GIFData_GIFType.STICKER:
      return "STICKER";
    default:
      return "UNKNOWN";
  }
}
const baseGIFData = {
  height: 0,
  width: 0,
  gifType: import_plugin_gif_enums.GIFData_GIFType.NORMAL
};
const GIFData = {
  fromJSON(object) {
    const message = { ...baseGIFData };
    message.containerData = object.containerData !== void 0 && object.containerData !== null ? import_common.PluginContainerData.fromJSON(object.containerData) : void 0;
    message.original = object.original !== void 0 && object.original !== null ? GIF.fromJSON(object.original) : void 0;
    message.downsized = object.downsized !== void 0 && object.downsized !== null ? GIF.fromJSON(object.downsized) : void 0;
    message.height = object.height !== void 0 && object.height !== null ? Number(object.height) : 0;
    message.width = object.width !== void 0 && object.width !== null ? Number(object.width) : 0;
    message.gifType = object.gifType !== void 0 && object.gifType !== null ? gIFData_GIFTypeFromJSON(object.gifType) : import_plugin_gif_enums.GIFData_GIFType.NORMAL;
    return message;
  },
  toJSON(message) {
    const obj = {};
    message.containerData !== void 0 && (obj.containerData = message.containerData ? import_common.PluginContainerData.toJSON(message.containerData) : void 0);
    message.original !== void 0 && (obj.original = message.original ? GIF.toJSON(message.original) : void 0);
    message.downsized !== void 0 && (obj.downsized = message.downsized ? GIF.toJSON(message.downsized) : void 0);
    message.height !== void 0 && (obj.height = Math.round(message.height));
    message.width !== void 0 && (obj.width = Math.round(message.width));
    message.gifType !== void 0 && (obj.gifType = gIFData_GIFTypeToJSON(message.gifType));
    return obj;
  }
};
const baseGIF = {};
const GIF = {
  fromJSON(object) {
    const message = { ...baseGIF };
    message.gif = object.gif !== void 0 && object.gif !== null ? String(object.gif) : void 0;
    message.mp4 = object.mp4 !== void 0 && object.mp4 !== null ? String(object.mp4) : void 0;
    message.still = object.still !== void 0 && object.still !== null ? String(object.still) : void 0;
    return message;
  },
  toJSON(message) {
    const obj = {};
    message.gif !== void 0 && (obj.gif = message.gif);
    message.mp4 !== void 0 && (obj.mp4 = message.mp4);
    message.still !== void 0 && (obj.still = message.still);
    return obj;
  }
};
//# sourceMappingURL=plugin_gif.js.map
