"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 node_layout_exports = {};
__export(node_layout_exports, {
  LayoutData: () => LayoutData,
  LayoutData_Backdrop: () => LayoutData_Backdrop,
  LayoutData_Background: () => LayoutData_Background,
  LayoutData_BackgroundImage: () => LayoutData_BackgroundImage,
  LayoutData_Banner: () => LayoutData_Banner,
  LayoutData_ImageScaling: () => LayoutData_ImageScaling,
  LayoutData_VerticalAlignment: () => LayoutData_VerticalAlignment,
  layoutData_Backdrop_TypeFromJSON: () => layoutData_Backdrop_TypeFromJSON,
  layoutData_Backdrop_TypeToJSON: () => layoutData_Backdrop_TypeToJSON,
  layoutData_Background_TypeFromJSON: () => layoutData_Background_TypeFromJSON,
  layoutData_Background_TypeToJSON: () => layoutData_Background_TypeToJSON,
  layoutData_Banner_OriginFromJSON: () => layoutData_Banner_OriginFromJSON,
  layoutData_Banner_OriginToJSON: () => layoutData_Banner_OriginToJSON,
  layoutData_Banner_PositionFromJSON: () => layoutData_Banner_PositionFromJSON,
  layoutData_Banner_PositionToJSON: () => layoutData_Banner_PositionToJSON,
  layoutData_DesignTargetFromJSON: () => layoutData_DesignTargetFromJSON,
  layoutData_DesignTargetToJSON: () => layoutData_DesignTargetToJSON,
  layoutData_ImagePositionFromJSON: () => layoutData_ImagePositionFromJSON,
  layoutData_ImagePositionToJSON: () => layoutData_ImagePositionToJSON,
  layoutData_ImageScaling_ScalingFromJSON: () => layoutData_ImageScaling_ScalingFromJSON,
  layoutData_ImageScaling_ScalingToJSON: () => layoutData_ImageScaling_ScalingToJSON,
  layoutData_ResponsivenessBehaviourFromJSON: () => layoutData_ResponsivenessBehaviourFromJSON,
  layoutData_ResponsivenessBehaviourToJSON: () => layoutData_ResponsivenessBehaviourToJSON,
  layoutData_VerticalAlignment_AlignmentFromJSON: () => layoutData_VerticalAlignment_AlignmentFromJSON,
  layoutData_VerticalAlignment_AlignmentToJSON: () => layoutData_VerticalAlignment_AlignmentToJSON
});
module.exports = __toCommonJS(node_layout_exports);
var import_common = require("./common.js");
var import_node_layout_enums = require("./node_layout.enums.js");
function layoutData_ImagePositionFromJSON(object) {
  switch (object) {
    case 0:
    case "CENTER":
      return import_node_layout_enums.LayoutData_ImagePosition.CENTER;
    case 1:
    case "CENTER_LEFT":
      return import_node_layout_enums.LayoutData_ImagePosition.CENTER_LEFT;
    case 2:
    case "CENTER_RIGHT":
      return import_node_layout_enums.LayoutData_ImagePosition.CENTER_RIGHT;
    case 3:
    case "TOP":
      return import_node_layout_enums.LayoutData_ImagePosition.TOP;
    case 4:
    case "TOP_LEFT":
      return import_node_layout_enums.LayoutData_ImagePosition.TOP_LEFT;
    case 5:
    case "TOP_RIGHT":
      return import_node_layout_enums.LayoutData_ImagePosition.TOP_RIGHT;
    case 6:
    case "BOTTOM":
      return import_node_layout_enums.LayoutData_ImagePosition.BOTTOM;
    case 7:
    case "BOTTOM_LEFT":
      return import_node_layout_enums.LayoutData_ImagePosition.BOTTOM_LEFT;
    case 8:
    case "BOTTOM_RIGHT":
      return import_node_layout_enums.LayoutData_ImagePosition.BOTTOM_RIGHT;
    case -1:
    case "UNRECOGNIZED":
    default:
      return import_node_layout_enums.LayoutData_ImagePosition.UNRECOGNIZED;
  }
}
function layoutData_ImagePositionToJSON(object) {
  switch (object) {
    case import_node_layout_enums.LayoutData_ImagePosition.CENTER:
      return "CENTER";
    case import_node_layout_enums.LayoutData_ImagePosition.CENTER_LEFT:
      return "CENTER_LEFT";
    case import_node_layout_enums.LayoutData_ImagePosition.CENTER_RIGHT:
      return "CENTER_RIGHT";
    case import_node_layout_enums.LayoutData_ImagePosition.TOP:
      return "TOP";
    case import_node_layout_enums.LayoutData_ImagePosition.TOP_LEFT:
      return "TOP_LEFT";
    case import_node_layout_enums.LayoutData_ImagePosition.TOP_RIGHT:
      return "TOP_RIGHT";
    case import_node_layout_enums.LayoutData_ImagePosition.BOTTOM:
      return "BOTTOM";
    case import_node_layout_enums.LayoutData_ImagePosition.BOTTOM_LEFT:
      return "BOTTOM_LEFT";
    case import_node_layout_enums.LayoutData_ImagePosition.BOTTOM_RIGHT:
      return "BOTTOM_RIGHT";
    default:
      return "UNKNOWN";
  }
}
function layoutData_ResponsivenessBehaviourFromJSON(object) {
  switch (object) {
    case 0:
    case "STACK":
      return import_node_layout_enums.LayoutData_ResponsivenessBehaviour.STACK;
    case 1:
    case "WRAP":
      return import_node_layout_enums.LayoutData_ResponsivenessBehaviour.WRAP;
    case -1:
    case "UNRECOGNIZED":
    default:
      return import_node_layout_enums.LayoutData_ResponsivenessBehaviour.UNRECOGNIZED;
  }
}
function layoutData_ResponsivenessBehaviourToJSON(object) {
  switch (object) {
    case import_node_layout_enums.LayoutData_ResponsivenessBehaviour.STACK:
      return "STACK";
    case import_node_layout_enums.LayoutData_ResponsivenessBehaviour.WRAP:
      return "WRAP";
    default:
      return "UNKNOWN";
  }
}
function layoutData_DesignTargetFromJSON(object) {
  switch (object) {
    case 0:
    case "LAYOUT":
      return import_node_layout_enums.LayoutData_DesignTarget.LAYOUT;
    case 1:
    case "CELL":
      return import_node_layout_enums.LayoutData_DesignTarget.CELL;
    case -1:
    case "UNRECOGNIZED":
    default:
      return import_node_layout_enums.LayoutData_DesignTarget.UNRECOGNIZED;
  }
}
function layoutData_DesignTargetToJSON(object) {
  switch (object) {
    case import_node_layout_enums.LayoutData_DesignTarget.LAYOUT:
      return "LAYOUT";
    case import_node_layout_enums.LayoutData_DesignTarget.CELL:
      return "CELL";
    default:
      return "UNKNOWN";
  }
}
function layoutData_VerticalAlignment_AlignmentFromJSON(object) {
  switch (object) {
    case 0:
    case "TOP":
      return import_node_layout_enums.LayoutData_VerticalAlignment_Alignment.TOP;
    case 1:
    case "MIDDLE":
      return import_node_layout_enums.LayoutData_VerticalAlignment_Alignment.MIDDLE;
    case 2:
    case "BOTTOM":
      return import_node_layout_enums.LayoutData_VerticalAlignment_Alignment.BOTTOM;
    case -1:
    case "UNRECOGNIZED":
    default:
      return import_node_layout_enums.LayoutData_VerticalAlignment_Alignment.UNRECOGNIZED;
  }
}
function layoutData_VerticalAlignment_AlignmentToJSON(object) {
  switch (object) {
    case import_node_layout_enums.LayoutData_VerticalAlignment_Alignment.TOP:
      return "TOP";
    case import_node_layout_enums.LayoutData_VerticalAlignment_Alignment.MIDDLE:
      return "MIDDLE";
    case import_node_layout_enums.LayoutData_VerticalAlignment_Alignment.BOTTOM:
      return "BOTTOM";
    default:
      return "UNKNOWN";
  }
}
function layoutData_ImageScaling_ScalingFromJSON(object) {
  switch (object) {
    case 0:
    case "AUTO":
      return import_node_layout_enums.LayoutData_ImageScaling_Scaling.AUTO;
    case 1:
    case "CONTAIN":
      return import_node_layout_enums.LayoutData_ImageScaling_Scaling.CONTAIN;
    case 2:
    case "COVER":
      return import_node_layout_enums.LayoutData_ImageScaling_Scaling.COVER;
    case -1:
    case "UNRECOGNIZED":
    default:
      return import_node_layout_enums.LayoutData_ImageScaling_Scaling.UNRECOGNIZED;
  }
}
function layoutData_ImageScaling_ScalingToJSON(object) {
  switch (object) {
    case import_node_layout_enums.LayoutData_ImageScaling_Scaling.AUTO:
      return "AUTO";
    case import_node_layout_enums.LayoutData_ImageScaling_Scaling.CONTAIN:
      return "CONTAIN";
    case import_node_layout_enums.LayoutData_ImageScaling_Scaling.COVER:
      return "COVER";
    default:
      return "UNKNOWN";
  }
}
function layoutData_Banner_PositionFromJSON(object) {
  switch (object) {
    case 0:
    case "TOP":
      return import_node_layout_enums.LayoutData_Banner_Position.TOP;
    case 1:
    case "BOTTOM":
      return import_node_layout_enums.LayoutData_Banner_Position.BOTTOM;
    case -1:
    case "UNRECOGNIZED":
    default:
      return import_node_layout_enums.LayoutData_Banner_Position.UNRECOGNIZED;
  }
}
function layoutData_Banner_PositionToJSON(object) {
  switch (object) {
    case import_node_layout_enums.LayoutData_Banner_Position.TOP:
      return "TOP";
    case import_node_layout_enums.LayoutData_Banner_Position.BOTTOM:
      return "BOTTOM";
    default:
      return "UNKNOWN";
  }
}
function layoutData_Banner_OriginFromJSON(object) {
  switch (object) {
    case 0:
    case "IMAGE":
      return import_node_layout_enums.LayoutData_Banner_Origin.IMAGE;
    case 1:
    case "LAYOUT":
      return import_node_layout_enums.LayoutData_Banner_Origin.LAYOUT;
    case -1:
    case "UNRECOGNIZED":
    default:
      return import_node_layout_enums.LayoutData_Banner_Origin.UNRECOGNIZED;
  }
}
function layoutData_Banner_OriginToJSON(object) {
  switch (object) {
    case import_node_layout_enums.LayoutData_Banner_Origin.IMAGE:
      return "IMAGE";
    case import_node_layout_enums.LayoutData_Banner_Origin.LAYOUT:
      return "LAYOUT";
    default:
      return "UNKNOWN";
  }
}
function layoutData_Background_TypeFromJSON(object) {
  switch (object) {
    case 0:
    case "COLOR":
      return import_node_layout_enums.LayoutData_Background_Type.COLOR;
    case 1:
    case "GRADIENT":
      return import_node_layout_enums.LayoutData_Background_Type.GRADIENT;
    case -1:
    case "UNRECOGNIZED":
    default:
      return import_node_layout_enums.LayoutData_Background_Type.UNRECOGNIZED;
  }
}
function layoutData_Background_TypeToJSON(object) {
  switch (object) {
    case import_node_layout_enums.LayoutData_Background_Type.COLOR:
      return "COLOR";
    case import_node_layout_enums.LayoutData_Background_Type.GRADIENT:
      return "GRADIENT";
    default:
      return "UNKNOWN";
  }
}
function layoutData_Backdrop_TypeFromJSON(object) {
  switch (object) {
    case 0:
    case "COLOR":
      return import_node_layout_enums.LayoutData_Backdrop_Type.COLOR;
    case 1:
    case "GRADIENT":
      return import_node_layout_enums.LayoutData_Backdrop_Type.GRADIENT;
    case -1:
    case "UNRECOGNIZED":
    default:
      return import_node_layout_enums.LayoutData_Backdrop_Type.UNRECOGNIZED;
  }
}
function layoutData_Backdrop_TypeToJSON(object) {
  switch (object) {
    case import_node_layout_enums.LayoutData_Backdrop_Type.COLOR:
      return "COLOR";
    case import_node_layout_enums.LayoutData_Backdrop_Type.GRADIENT:
      return "GRADIENT";
    default:
      return "UNKNOWN";
  }
}
const baseLayoutData = {
  cellPadding: 0,
  cellVerticalAlignment: import_node_layout_enums.LayoutData_VerticalAlignment_Alignment.TOP,
  responsivenessBehaviour: import_node_layout_enums.LayoutData_ResponsivenessBehaviour.STACK,
  designTarget: import_node_layout_enums.LayoutData_DesignTarget.LAYOUT
};
const LayoutData = {
  fromJSON(object) {
    const message = { ...baseLayoutData };
    message.backgroundColor = object.backgroundColor !== void 0 && object.backgroundColor !== null ? String(object.backgroundColor) : void 0;
    message.backgroundImage = object.backgroundImage !== void 0 && object.backgroundImage !== null ? LayoutData_BackgroundImage.fromJSON(object.backgroundImage) : void 0;
    message.borderColor = object.borderColor !== void 0 && object.borderColor !== null ? String(object.borderColor) : void 0;
    message.borderWidth = object.borderWidth !== void 0 && object.borderWidth !== null ? Number(object.borderWidth) : void 0;
    message.borderRadius = object.borderRadius !== void 0 && object.borderRadius !== null ? Number(object.borderRadius) : void 0;
    message.backdropColor = object.backdropColor !== void 0 && object.backdropColor !== null ? String(object.backdropColor) : void 0;
    message.backdropImage = object.backdropImage !== void 0 && object.backdropImage !== null ? LayoutData_BackgroundImage.fromJSON(object.backdropImage) : void 0;
    message.backdropPaddingTop = object.backdropPaddingTop !== void 0 && object.backdropPaddingTop !== null ? Number(object.backdropPaddingTop) : void 0;
    message.backdropPaddingBottom = object.backdropPaddingBottom !== void 0 && object.backdropPaddingBottom !== null ? Number(object.backdropPaddingBottom) : void 0;
    message.gap = object.gap !== void 0 && object.gap !== null ? Number(object.gap) : void 0;
    message.cellPadding = (object.cellPadding ?? []).map((e) => Number(e));
    message.cellVerticalAlignment = object.cellVerticalAlignment !== void 0 && object.cellVerticalAlignment !== null ? layoutData_VerticalAlignment_AlignmentFromJSON(
      object.cellVerticalAlignment
    ) : import_node_layout_enums.LayoutData_VerticalAlignment_Alignment.TOP;
    message.responsivenessBehaviour = object.responsivenessBehaviour !== void 0 && object.responsivenessBehaviour !== null ? layoutData_ResponsivenessBehaviourFromJSON(
      object.responsivenessBehaviour
    ) : import_node_layout_enums.LayoutData_ResponsivenessBehaviour.STACK;
    message.responsivenessBreakpoint = object.responsivenessBreakpoint !== void 0 && object.responsivenessBreakpoint !== null ? Number(object.responsivenessBreakpoint) : void 0;
    message.containerData = object.containerData !== void 0 && object.containerData !== null ? import_common.PluginContainerData.fromJSON(object.containerData) : void 0;
    message.designTarget = object.designTarget !== void 0 && object.designTarget !== null ? layoutData_DesignTargetFromJSON(object.designTarget) : import_node_layout_enums.LayoutData_DesignTarget.LAYOUT;
    message.banner = object.banner !== void 0 && object.banner !== null ? LayoutData_Banner.fromJSON(object.banner) : void 0;
    message.background = object.background !== void 0 && object.background !== null ? LayoutData_Background.fromJSON(object.background) : void 0;
    message.backdrop = object.backdrop !== void 0 && object.backdrop !== null ? LayoutData_Backdrop.fromJSON(object.backdrop) : void 0;
    return message;
  },
  toJSON(message) {
    const obj = {};
    message.backgroundColor !== void 0 && (obj.backgroundColor = message.backgroundColor);
    message.backgroundImage !== void 0 && (obj.backgroundImage = message.backgroundImage ? LayoutData_BackgroundImage.toJSON(message.backgroundImage) : void 0);
    message.borderColor !== void 0 && (obj.borderColor = message.borderColor);
    message.borderWidth !== void 0 && (obj.borderWidth = message.borderWidth);
    message.borderRadius !== void 0 && (obj.borderRadius = message.borderRadius);
    message.backdropColor !== void 0 && (obj.backdropColor = message.backdropColor);
    message.backdropImage !== void 0 && (obj.backdropImage = message.backdropImage ? LayoutData_BackgroundImage.toJSON(message.backdropImage) : void 0);
    message.backdropPaddingTop !== void 0 && (obj.backdropPaddingTop = message.backdropPaddingTop);
    message.backdropPaddingBottom !== void 0 && (obj.backdropPaddingBottom = message.backdropPaddingBottom);
    message.gap !== void 0 && (obj.gap = message.gap);
    if (message.cellPadding) {
      obj.cellPadding = message.cellPadding.map((e) => Math.round(e));
    } else {
      obj.cellPadding = [];
    }
    message.cellVerticalAlignment !== void 0 && (obj.cellVerticalAlignment = layoutData_VerticalAlignment_AlignmentToJSON(
      message.cellVerticalAlignment
    ));
    message.responsivenessBehaviour !== void 0 && (obj.responsivenessBehaviour = layoutData_ResponsivenessBehaviourToJSON(
      message.responsivenessBehaviour
    ));
    message.responsivenessBreakpoint !== void 0 && (obj.responsivenessBreakpoint = message.responsivenessBreakpoint);
    message.containerData !== void 0 && (obj.containerData = message.containerData ? import_common.PluginContainerData.toJSON(message.containerData) : void 0);
    message.designTarget !== void 0 && (obj.designTarget = layoutData_DesignTargetToJSON(message.designTarget));
    message.banner !== void 0 && (obj.banner = message.banner ? LayoutData_Banner.toJSON(message.banner) : void 0);
    message.background !== void 0 && (obj.background = message.background ? LayoutData_Background.toJSON(message.background) : void 0);
    message.backdrop !== void 0 && (obj.backdrop = message.backdrop ? LayoutData_Backdrop.toJSON(message.backdrop) : void 0);
    return obj;
  }
};
const baseLayoutData_VerticalAlignment = {};
const LayoutData_VerticalAlignment = {
  fromJSON(_) {
    const message = {
      ...baseLayoutData_VerticalAlignment
    };
    return message;
  },
  toJSON(_) {
    const obj = {};
    return obj;
  }
};
const baseLayoutData_ImageScaling = {};
const LayoutData_ImageScaling = {
  fromJSON(_) {
    const message = {
      ...baseLayoutData_ImageScaling
    };
    return message;
  },
  toJSON(_) {
    const obj = {};
    return obj;
  }
};
const baseLayoutData_BackgroundImage = {
  scaling: import_node_layout_enums.LayoutData_ImageScaling_Scaling.AUTO,
  position: import_node_layout_enums.LayoutData_ImagePosition.CENTER
};
const LayoutData_BackgroundImage = {
  fromJSON(object) {
    const message = {
      ...baseLayoutData_BackgroundImage
    };
    message.media = object.media !== void 0 && object.media !== null ? import_common.Media.fromJSON(object.media) : void 0;
    message.opacity = object.opacity !== void 0 && object.opacity !== null ? Number(object.opacity) : void 0;
    message.scaling = object.scaling !== void 0 && object.scaling !== null ? layoutData_ImageScaling_ScalingFromJSON(object.scaling) : import_node_layout_enums.LayoutData_ImageScaling_Scaling.AUTO;
    message.position = object.position !== void 0 && object.position !== null ? layoutData_ImagePositionFromJSON(object.position) : import_node_layout_enums.LayoutData_ImagePosition.CENTER;
    message.blur = object.blur !== void 0 && object.blur !== null ? Number(object.blur) : void 0;
    return message;
  },
  toJSON(message) {
    const obj = {};
    message.media !== void 0 && (obj.media = message.media ? import_common.Media.toJSON(message.media) : void 0);
    message.opacity !== void 0 && (obj.opacity = message.opacity);
    message.scaling !== void 0 && (obj.scaling = layoutData_ImageScaling_ScalingToJSON(message.scaling));
    message.position !== void 0 && (obj.position = layoutData_ImagePositionToJSON(message.position));
    message.blur !== void 0 && (obj.blur = message.blur);
    return obj;
  }
};
const baseLayoutData_Banner = {
  origin: import_node_layout_enums.LayoutData_Banner_Origin.IMAGE,
  position: import_node_layout_enums.LayoutData_Banner_Position.TOP
};
const LayoutData_Banner = {
  fromJSON(object) {
    const message = { ...baseLayoutData_Banner };
    message.origin = object.origin !== void 0 && object.origin !== null ? layoutData_Banner_OriginFromJSON(object.origin) : import_node_layout_enums.LayoutData_Banner_Origin.IMAGE;
    message.position = object.position !== void 0 && object.position !== null ? layoutData_Banner_PositionFromJSON(object.position) : import_node_layout_enums.LayoutData_Banner_Position.TOP;
    return message;
  },
  toJSON(message) {
    const obj = {};
    message.origin !== void 0 && (obj.origin = layoutData_Banner_OriginToJSON(message.origin));
    message.position !== void 0 && (obj.position = layoutData_Banner_PositionToJSON(message.position));
    return obj;
  }
};
const baseLayoutData_Background = {
  type: import_node_layout_enums.LayoutData_Background_Type.COLOR
};
const LayoutData_Background = {
  fromJSON(object) {
    const message = { ...baseLayoutData_Background };
    message.type = object.type !== void 0 && object.type !== null ? layoutData_Background_TypeFromJSON(object.type) : import_node_layout_enums.LayoutData_Background_Type.COLOR;
    message.color = object.color !== void 0 && object.color !== null ? String(object.color) : void 0;
    message.gradient = object.gradient !== void 0 && object.gradient !== null ? import_common.Gradient.fromJSON(object.gradient) : void 0;
    return message;
  },
  toJSON(message) {
    const obj = {};
    message.type !== void 0 && (obj.type = layoutData_Background_TypeToJSON(message.type));
    message.color !== void 0 && (obj.color = message.color);
    message.gradient !== void 0 && (obj.gradient = message.gradient ? import_common.Gradient.toJSON(message.gradient) : void 0);
    return obj;
  }
};
const baseLayoutData_Backdrop = {
  type: import_node_layout_enums.LayoutData_Backdrop_Type.COLOR
};
const LayoutData_Backdrop = {
  fromJSON(object) {
    const message = { ...baseLayoutData_Backdrop };
    message.type = object.type !== void 0 && object.type !== null ? layoutData_Backdrop_TypeFromJSON(object.type) : import_node_layout_enums.LayoutData_Backdrop_Type.COLOR;
    message.color = object.color !== void 0 && object.color !== null ? String(object.color) : void 0;
    message.gradient = object.gradient !== void 0 && object.gradient !== null ? import_common.Gradient.fromJSON(object.gradient) : void 0;
    return message;
  },
  toJSON(message) {
    const obj = {};
    message.type !== void 0 && (obj.type = layoutData_Backdrop_TypeToJSON(message.type));
    message.color !== void 0 && (obj.color = message.color);
    message.gradient !== void 0 && (obj.gradient = message.gradient ? import_common.Gradient.toJSON(message.gradient) : void 0);
    return obj;
  }
};
//# sourceMappingURL=node_layout.js.map
