var __create = Object.create;
var __defProp = Object.defineProperty;
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
var __getOwnPropNames = Object.getOwnPropertyNames;
var __getProtoOf = Object.getPrototypeOf;
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 __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__getProtoOf(mod)) : {}, __copyProps(
  // If the importer is in node compatibility mode or this is not an ESM
  // file that has been converted to a CommonJS file using a Babel-
  // compatible transform (i.e. "__esModule" has not been set), then set
  // "default" to the CommonJS "module.exports" for node compatibility.
  isNodeMode || !mod || !mod.__esModule ? __defProp(target, "default", { value: mod, enumerable: true }) : target,
  mod
));
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
var logs_exports = {};
__export(logs_exports, {
  LogRecord: () => LogRecord,
  LogRecordFlags: () => LogRecordFlags,
  LogsData: () => LogsData,
  ResourceLogs: () => ResourceLogs,
  ScopeLogs: () => ScopeLogs,
  SeverityNumber: () => SeverityNumber,
  logRecordFlagsFromJSON: () => logRecordFlagsFromJSON,
  logRecordFlagsToJSON: () => logRecordFlagsToJSON,
  protobufPackage: () => protobufPackage,
  severityNumberFromJSON: () => severityNumberFromJSON,
  severityNumberToJSON: () => severityNumberToJSON
});
module.exports = __toCommonJS(logs_exports);
var import_global_this = __toESM(require("@babel/runtime-corejs3/core-js/global-this"));
var import_map = __toESM(require("@babel/runtime-corejs3/core-js/instance/map"));
var import_bind = __toESM(require("@babel/runtime-corejs3/core-js/instance/bind"));
var import_flags = __toESM(require("@babel/runtime-corejs3/core-js/instance/flags"));
var import_for_each = __toESM(require("@babel/runtime-corejs3/core-js/instance/for-each"));
var import_long = __toESM(require("long"));
var import_minimal = __toESM(require("protobufjs/minimal.js"));
var import_common = require("../../common/v1/common.js");
var import_resource = require("../../resource/v1/resource.js");
const protobufPackage = "opentelemetry.proto.logs.v1";
let SeverityNumber = /* @__PURE__ */ function(SeverityNumber2) {
  SeverityNumber2[SeverityNumber2["SEVERITY_NUMBER_UNSPECIFIED"] = 0] = "SEVERITY_NUMBER_UNSPECIFIED";
  SeverityNumber2[SeverityNumber2["SEVERITY_NUMBER_TRACE"] = 1] = "SEVERITY_NUMBER_TRACE";
  SeverityNumber2[SeverityNumber2["SEVERITY_NUMBER_TRACE2"] = 2] = "SEVERITY_NUMBER_TRACE2";
  SeverityNumber2[SeverityNumber2["SEVERITY_NUMBER_TRACE3"] = 3] = "SEVERITY_NUMBER_TRACE3";
  SeverityNumber2[SeverityNumber2["SEVERITY_NUMBER_TRACE4"] = 4] = "SEVERITY_NUMBER_TRACE4";
  SeverityNumber2[SeverityNumber2["SEVERITY_NUMBER_DEBUG"] = 5] = "SEVERITY_NUMBER_DEBUG";
  SeverityNumber2[SeverityNumber2["SEVERITY_NUMBER_DEBUG2"] = 6] = "SEVERITY_NUMBER_DEBUG2";
  SeverityNumber2[SeverityNumber2["SEVERITY_NUMBER_DEBUG3"] = 7] = "SEVERITY_NUMBER_DEBUG3";
  SeverityNumber2[SeverityNumber2["SEVERITY_NUMBER_DEBUG4"] = 8] = "SEVERITY_NUMBER_DEBUG4";
  SeverityNumber2[SeverityNumber2["SEVERITY_NUMBER_INFO"] = 9] = "SEVERITY_NUMBER_INFO";
  SeverityNumber2[SeverityNumber2["SEVERITY_NUMBER_INFO2"] = 10] = "SEVERITY_NUMBER_INFO2";
  SeverityNumber2[SeverityNumber2["SEVERITY_NUMBER_INFO3"] = 11] = "SEVERITY_NUMBER_INFO3";
  SeverityNumber2[SeverityNumber2["SEVERITY_NUMBER_INFO4"] = 12] = "SEVERITY_NUMBER_INFO4";
  SeverityNumber2[SeverityNumber2["SEVERITY_NUMBER_WARN"] = 13] = "SEVERITY_NUMBER_WARN";
  SeverityNumber2[SeverityNumber2["SEVERITY_NUMBER_WARN2"] = 14] = "SEVERITY_NUMBER_WARN2";
  SeverityNumber2[SeverityNumber2["SEVERITY_NUMBER_WARN3"] = 15] = "SEVERITY_NUMBER_WARN3";
  SeverityNumber2[SeverityNumber2["SEVERITY_NUMBER_WARN4"] = 16] = "SEVERITY_NUMBER_WARN4";
  SeverityNumber2[SeverityNumber2["SEVERITY_NUMBER_ERROR"] = 17] = "SEVERITY_NUMBER_ERROR";
  SeverityNumber2[SeverityNumber2["SEVERITY_NUMBER_ERROR2"] = 18] = "SEVERITY_NUMBER_ERROR2";
  SeverityNumber2[SeverityNumber2["SEVERITY_NUMBER_ERROR3"] = 19] = "SEVERITY_NUMBER_ERROR3";
  SeverityNumber2[SeverityNumber2["SEVERITY_NUMBER_ERROR4"] = 20] = "SEVERITY_NUMBER_ERROR4";
  SeverityNumber2[SeverityNumber2["SEVERITY_NUMBER_FATAL"] = 21] = "SEVERITY_NUMBER_FATAL";
  SeverityNumber2[SeverityNumber2["SEVERITY_NUMBER_FATAL2"] = 22] = "SEVERITY_NUMBER_FATAL2";
  SeverityNumber2[SeverityNumber2["SEVERITY_NUMBER_FATAL3"] = 23] = "SEVERITY_NUMBER_FATAL3";
  SeverityNumber2[SeverityNumber2["SEVERITY_NUMBER_FATAL4"] = 24] = "SEVERITY_NUMBER_FATAL4";
  SeverityNumber2[SeverityNumber2["UNRECOGNIZED"] = -1] = "UNRECOGNIZED";
  return SeverityNumber2;
}({});
function severityNumberFromJSON(object) {
  switch (object) {
    case 0:
    case "SEVERITY_NUMBER_UNSPECIFIED":
      return SeverityNumber.SEVERITY_NUMBER_UNSPECIFIED;
    case 1:
    case "SEVERITY_NUMBER_TRACE":
      return SeverityNumber.SEVERITY_NUMBER_TRACE;
    case 2:
    case "SEVERITY_NUMBER_TRACE2":
      return SeverityNumber.SEVERITY_NUMBER_TRACE2;
    case 3:
    case "SEVERITY_NUMBER_TRACE3":
      return SeverityNumber.SEVERITY_NUMBER_TRACE3;
    case 4:
    case "SEVERITY_NUMBER_TRACE4":
      return SeverityNumber.SEVERITY_NUMBER_TRACE4;
    case 5:
    case "SEVERITY_NUMBER_DEBUG":
      return SeverityNumber.SEVERITY_NUMBER_DEBUG;
    case 6:
    case "SEVERITY_NUMBER_DEBUG2":
      return SeverityNumber.SEVERITY_NUMBER_DEBUG2;
    case 7:
    case "SEVERITY_NUMBER_DEBUG3":
      return SeverityNumber.SEVERITY_NUMBER_DEBUG3;
    case 8:
    case "SEVERITY_NUMBER_DEBUG4":
      return SeverityNumber.SEVERITY_NUMBER_DEBUG4;
    case 9:
    case "SEVERITY_NUMBER_INFO":
      return SeverityNumber.SEVERITY_NUMBER_INFO;
    case 10:
    case "SEVERITY_NUMBER_INFO2":
      return SeverityNumber.SEVERITY_NUMBER_INFO2;
    case 11:
    case "SEVERITY_NUMBER_INFO3":
      return SeverityNumber.SEVERITY_NUMBER_INFO3;
    case 12:
    case "SEVERITY_NUMBER_INFO4":
      return SeverityNumber.SEVERITY_NUMBER_INFO4;
    case 13:
    case "SEVERITY_NUMBER_WARN":
      return SeverityNumber.SEVERITY_NUMBER_WARN;
    case 14:
    case "SEVERITY_NUMBER_WARN2":
      return SeverityNumber.SEVERITY_NUMBER_WARN2;
    case 15:
    case "SEVERITY_NUMBER_WARN3":
      return SeverityNumber.SEVERITY_NUMBER_WARN3;
    case 16:
    case "SEVERITY_NUMBER_WARN4":
      return SeverityNumber.SEVERITY_NUMBER_WARN4;
    case 17:
    case "SEVERITY_NUMBER_ERROR":
      return SeverityNumber.SEVERITY_NUMBER_ERROR;
    case 18:
    case "SEVERITY_NUMBER_ERROR2":
      return SeverityNumber.SEVERITY_NUMBER_ERROR2;
    case 19:
    case "SEVERITY_NUMBER_ERROR3":
      return SeverityNumber.SEVERITY_NUMBER_ERROR3;
    case 20:
    case "SEVERITY_NUMBER_ERROR4":
      return SeverityNumber.SEVERITY_NUMBER_ERROR4;
    case 21:
    case "SEVERITY_NUMBER_FATAL":
      return SeverityNumber.SEVERITY_NUMBER_FATAL;
    case 22:
    case "SEVERITY_NUMBER_FATAL2":
      return SeverityNumber.SEVERITY_NUMBER_FATAL2;
    case 23:
    case "SEVERITY_NUMBER_FATAL3":
      return SeverityNumber.SEVERITY_NUMBER_FATAL3;
    case 24:
    case "SEVERITY_NUMBER_FATAL4":
      return SeverityNumber.SEVERITY_NUMBER_FATAL4;
    case -1:
    case "UNRECOGNIZED":
    default:
      return SeverityNumber.UNRECOGNIZED;
  }
}
function severityNumberToJSON(object) {
  switch (object) {
    case SeverityNumber.SEVERITY_NUMBER_UNSPECIFIED:
      return "SEVERITY_NUMBER_UNSPECIFIED";
    case SeverityNumber.SEVERITY_NUMBER_TRACE:
      return "SEVERITY_NUMBER_TRACE";
    case SeverityNumber.SEVERITY_NUMBER_TRACE2:
      return "SEVERITY_NUMBER_TRACE2";
    case SeverityNumber.SEVERITY_NUMBER_TRACE3:
      return "SEVERITY_NUMBER_TRACE3";
    case SeverityNumber.SEVERITY_NUMBER_TRACE4:
      return "SEVERITY_NUMBER_TRACE4";
    case SeverityNumber.SEVERITY_NUMBER_DEBUG:
      return "SEVERITY_NUMBER_DEBUG";
    case SeverityNumber.SEVERITY_NUMBER_DEBUG2:
      return "SEVERITY_NUMBER_DEBUG2";
    case SeverityNumber.SEVERITY_NUMBER_DEBUG3:
      return "SEVERITY_NUMBER_DEBUG3";
    case SeverityNumber.SEVERITY_NUMBER_DEBUG4:
      return "SEVERITY_NUMBER_DEBUG4";
    case SeverityNumber.SEVERITY_NUMBER_INFO:
      return "SEVERITY_NUMBER_INFO";
    case SeverityNumber.SEVERITY_NUMBER_INFO2:
      return "SEVERITY_NUMBER_INFO2";
    case SeverityNumber.SEVERITY_NUMBER_INFO3:
      return "SEVERITY_NUMBER_INFO3";
    case SeverityNumber.SEVERITY_NUMBER_INFO4:
      return "SEVERITY_NUMBER_INFO4";
    case SeverityNumber.SEVERITY_NUMBER_WARN:
      return "SEVERITY_NUMBER_WARN";
    case SeverityNumber.SEVERITY_NUMBER_WARN2:
      return "SEVERITY_NUMBER_WARN2";
    case SeverityNumber.SEVERITY_NUMBER_WARN3:
      return "SEVERITY_NUMBER_WARN3";
    case SeverityNumber.SEVERITY_NUMBER_WARN4:
      return "SEVERITY_NUMBER_WARN4";
    case SeverityNumber.SEVERITY_NUMBER_ERROR:
      return "SEVERITY_NUMBER_ERROR";
    case SeverityNumber.SEVERITY_NUMBER_ERROR2:
      return "SEVERITY_NUMBER_ERROR2";
    case SeverityNumber.SEVERITY_NUMBER_ERROR3:
      return "SEVERITY_NUMBER_ERROR3";
    case SeverityNumber.SEVERITY_NUMBER_ERROR4:
      return "SEVERITY_NUMBER_ERROR4";
    case SeverityNumber.SEVERITY_NUMBER_FATAL:
      return "SEVERITY_NUMBER_FATAL";
    case SeverityNumber.SEVERITY_NUMBER_FATAL2:
      return "SEVERITY_NUMBER_FATAL2";
    case SeverityNumber.SEVERITY_NUMBER_FATAL3:
      return "SEVERITY_NUMBER_FATAL3";
    case SeverityNumber.SEVERITY_NUMBER_FATAL4:
      return "SEVERITY_NUMBER_FATAL4";
    case SeverityNumber.UNRECOGNIZED:
    default:
      return "UNRECOGNIZED";
  }
}
let LogRecordFlags = /* @__PURE__ */ function(LogRecordFlags2) {
  LogRecordFlags2[LogRecordFlags2["LOG_RECORD_FLAGS_DO_NOT_USE"] = 0] = "LOG_RECORD_FLAGS_DO_NOT_USE";
  LogRecordFlags2[LogRecordFlags2["LOG_RECORD_FLAGS_TRACE_FLAGS_MASK"] = 255] = "LOG_RECORD_FLAGS_TRACE_FLAGS_MASK";
  LogRecordFlags2[LogRecordFlags2["UNRECOGNIZED"] = -1] = "UNRECOGNIZED";
  return LogRecordFlags2;
}({});
function logRecordFlagsFromJSON(object) {
  switch (object) {
    case 0:
    case "LOG_RECORD_FLAGS_DO_NOT_USE":
      return LogRecordFlags.LOG_RECORD_FLAGS_DO_NOT_USE;
    case 255:
    case "LOG_RECORD_FLAGS_TRACE_FLAGS_MASK":
      return LogRecordFlags.LOG_RECORD_FLAGS_TRACE_FLAGS_MASK;
    case -1:
    case "UNRECOGNIZED":
    default:
      return LogRecordFlags.UNRECOGNIZED;
  }
}
function logRecordFlagsToJSON(object) {
  switch (object) {
    case LogRecordFlags.LOG_RECORD_FLAGS_DO_NOT_USE:
      return "LOG_RECORD_FLAGS_DO_NOT_USE";
    case LogRecordFlags.LOG_RECORD_FLAGS_TRACE_FLAGS_MASK:
      return "LOG_RECORD_FLAGS_TRACE_FLAGS_MASK";
    case LogRecordFlags.UNRECOGNIZED:
    default:
      return "UNRECOGNIZED";
  }
}
function createBaseLogsData() {
  return {
    resourceLogs: []
  };
}
const LogsData = {
  encode(message, writer = import_minimal.default.Writer.create()) {
    for (const v of message.resourceLogs) {
      ResourceLogs.encode(v, writer.uint32(10).fork()).ldelim();
    }
    return writer;
  },
  decode(input, length) {
    const reader = input instanceof import_minimal.default.Reader ? input : import_minimal.default.Reader.create(input);
    let end = length === void 0 ? reader.len : reader.pos + length;
    const message = createBaseLogsData();
    while (reader.pos < end) {
      const tag = reader.uint32();
      switch (tag >>> 3) {
        case 1:
          if (tag !== 10) {
            break;
          }
          message.resourceLogs.push(ResourceLogs.decode(reader, reader.uint32()));
          continue;
      }
      if ((tag & 7) === 4 || tag === 0) {
        break;
      }
      reader.skipType(tag & 7);
    }
    return message;
  },
  fromJSON(object) {
    var _context;
    return {
      resourceLogs: import_global_this.default.Array.isArray(object?.resourceLogs) ? (0, import_map.default)(_context = object.resourceLogs).call(_context, (e) => ResourceLogs.fromJSON(e)) : []
    };
  },
  toJSON(message) {
    const obj = {};
    if (message.resourceLogs?.length) {
      var _context2;
      obj.resourceLogs = (0, import_map.default)(_context2 = message.resourceLogs).call(_context2, (e) => ResourceLogs.toJSON(e));
    }
    return obj;
  },
  create(base) {
    return LogsData.fromPartial(base ?? {});
  },
  fromPartial(object) {
    var _context3, _context4;
    const message = createBaseLogsData();
    message.resourceLogs = ((_context3 = object.resourceLogs) == null ? void 0 : (0, import_bind.default)(_context4 = Function.call).call(_context4, (0, import_map.default)(_context3), _context3))?.((e) => ResourceLogs.fromPartial(e)) || [];
    return message;
  }
};
function createBaseResourceLogs() {
  return {
    resource: void 0,
    scopeLogs: [],
    schemaUrl: ""
  };
}
const ResourceLogs = {
  encode(message, writer = import_minimal.default.Writer.create()) {
    if (message.resource !== void 0) {
      import_resource.Resource.encode(message.resource, writer.uint32(10).fork()).ldelim();
    }
    for (const v of message.scopeLogs) {
      ScopeLogs.encode(v, writer.uint32(18).fork()).ldelim();
    }
    if (message.schemaUrl !== "") {
      writer.uint32(26).string(message.schemaUrl);
    }
    return writer;
  },
  decode(input, length) {
    const reader = input instanceof import_minimal.default.Reader ? input : import_minimal.default.Reader.create(input);
    let end = length === void 0 ? reader.len : reader.pos + length;
    const message = createBaseResourceLogs();
    while (reader.pos < end) {
      const tag = reader.uint32();
      switch (tag >>> 3) {
        case 1:
          if (tag !== 10) {
            break;
          }
          message.resource = import_resource.Resource.decode(reader, reader.uint32());
          continue;
        case 2:
          if (tag !== 18) {
            break;
          }
          message.scopeLogs.push(ScopeLogs.decode(reader, reader.uint32()));
          continue;
        case 3:
          if (tag !== 26) {
            break;
          }
          message.schemaUrl = reader.string();
          continue;
      }
      if ((tag & 7) === 4 || tag === 0) {
        break;
      }
      reader.skipType(tag & 7);
    }
    return message;
  },
  fromJSON(object) {
    var _context5;
    return {
      resource: isSet(object.resource) ? import_resource.Resource.fromJSON(object.resource) : void 0,
      scopeLogs: import_global_this.default.Array.isArray(object?.scopeLogs) ? (0, import_map.default)(_context5 = object.scopeLogs).call(_context5, (e) => ScopeLogs.fromJSON(e)) : [],
      schemaUrl: isSet(object.schemaUrl) ? import_global_this.default.String(object.schemaUrl) : ""
    };
  },
  toJSON(message) {
    const obj = {};
    if (message.resource !== void 0) {
      obj.resource = import_resource.Resource.toJSON(message.resource);
    }
    if (message.scopeLogs?.length) {
      var _context6;
      obj.scopeLogs = (0, import_map.default)(_context6 = message.scopeLogs).call(_context6, (e) => ScopeLogs.toJSON(e));
    }
    if (message.schemaUrl !== "") {
      obj.schemaUrl = message.schemaUrl;
    }
    return obj;
  },
  create(base) {
    return ResourceLogs.fromPartial(base ?? {});
  },
  fromPartial(object) {
    var _context7, _context8;
    const message = createBaseResourceLogs();
    message.resource = object.resource !== void 0 && object.resource !== null ? import_resource.Resource.fromPartial(object.resource) : void 0;
    message.scopeLogs = ((_context7 = object.scopeLogs) == null ? void 0 : (0, import_bind.default)(_context8 = Function.call).call(_context8, (0, import_map.default)(_context7), _context7))?.((e) => ScopeLogs.fromPartial(e)) || [];
    message.schemaUrl = object.schemaUrl ?? "";
    return message;
  }
};
function createBaseScopeLogs() {
  return {
    scope: void 0,
    logRecords: [],
    schemaUrl: ""
  };
}
const ScopeLogs = {
  encode(message, writer = import_minimal.default.Writer.create()) {
    if (message.scope !== void 0) {
      import_common.InstrumentationScope.encode(message.scope, writer.uint32(10).fork()).ldelim();
    }
    for (const v of message.logRecords) {
      LogRecord.encode(v, writer.uint32(18).fork()).ldelim();
    }
    if (message.schemaUrl !== "") {
      writer.uint32(26).string(message.schemaUrl);
    }
    return writer;
  },
  decode(input, length) {
    const reader = input instanceof import_minimal.default.Reader ? input : import_minimal.default.Reader.create(input);
    let end = length === void 0 ? reader.len : reader.pos + length;
    const message = createBaseScopeLogs();
    while (reader.pos < end) {
      const tag = reader.uint32();
      switch (tag >>> 3) {
        case 1:
          if (tag !== 10) {
            break;
          }
          message.scope = import_common.InstrumentationScope.decode(reader, reader.uint32());
          continue;
        case 2:
          if (tag !== 18) {
            break;
          }
          message.logRecords.push(LogRecord.decode(reader, reader.uint32()));
          continue;
        case 3:
          if (tag !== 26) {
            break;
          }
          message.schemaUrl = reader.string();
          continue;
      }
      if ((tag & 7) === 4 || tag === 0) {
        break;
      }
      reader.skipType(tag & 7);
    }
    return message;
  },
  fromJSON(object) {
    var _context9;
    return {
      scope: isSet(object.scope) ? import_common.InstrumentationScope.fromJSON(object.scope) : void 0,
      logRecords: import_global_this.default.Array.isArray(object?.logRecords) ? (0, import_map.default)(_context9 = object.logRecords).call(_context9, (e) => LogRecord.fromJSON(e)) : [],
      schemaUrl: isSet(object.schemaUrl) ? import_global_this.default.String(object.schemaUrl) : ""
    };
  },
  toJSON(message) {
    const obj = {};
    if (message.scope !== void 0) {
      obj.scope = import_common.InstrumentationScope.toJSON(message.scope);
    }
    if (message.logRecords?.length) {
      var _context0;
      obj.logRecords = (0, import_map.default)(_context0 = message.logRecords).call(_context0, (e) => LogRecord.toJSON(e));
    }
    if (message.schemaUrl !== "") {
      obj.schemaUrl = message.schemaUrl;
    }
    return obj;
  },
  create(base) {
    return ScopeLogs.fromPartial(base ?? {});
  },
  fromPartial(object) {
    var _context1, _context10;
    const message = createBaseScopeLogs();
    message.scope = object.scope !== void 0 && object.scope !== null ? import_common.InstrumentationScope.fromPartial(object.scope) : void 0;
    message.logRecords = ((_context1 = object.logRecords) == null ? void 0 : (0, import_bind.default)(_context10 = Function.call).call(_context10, (0, import_map.default)(_context1), _context1))?.((e) => LogRecord.fromPartial(e)) || [];
    message.schemaUrl = object.schemaUrl ?? "";
    return message;
  }
};
function createBaseLogRecord() {
  return {
    timeUnixNano: 0,
    observedTimeUnixNano: 0,
    severityNumber: 0,
    severityText: "",
    body: void 0,
    attributes: [],
    droppedAttributesCount: 0,
    flags: 0,
    traceId: new Uint8Array(0),
    spanId: new Uint8Array(0)
  };
}
const LogRecord = {
  encode(message, writer = import_minimal.default.Writer.create()) {
    if (message.timeUnixNano !== 0) {
      writer.uint32(9).fixed64(message.timeUnixNano);
    }
    if (message.observedTimeUnixNano !== 0) {
      writer.uint32(89).fixed64(message.observedTimeUnixNano);
    }
    if (message.severityNumber !== 0) {
      writer.uint32(16).int32(message.severityNumber);
    }
    if (message.severityText !== "") {
      writer.uint32(26).string(message.severityText);
    }
    if (message.body !== void 0) {
      import_common.AnyValue.encode(message.body, writer.uint32(42).fork()).ldelim();
    }
    for (const v of message.attributes) {
      import_common.KeyValue.encode(v, writer.uint32(50).fork()).ldelim();
    }
    if (message.droppedAttributesCount !== 0) {
      writer.uint32(56).uint32(message.droppedAttributesCount);
    }
    if ((0, import_flags.default)(message) !== 0) {
      writer.uint32(69).fixed32((0, import_flags.default)(message));
    }
    if (message.traceId.length !== 0) {
      writer.uint32(74).bytes(message.traceId);
    }
    if (message.spanId.length !== 0) {
      writer.uint32(82).bytes(message.spanId);
    }
    return writer;
  },
  decode(input, length) {
    const reader = input instanceof import_minimal.default.Reader ? input : import_minimal.default.Reader.create(input);
    let end = length === void 0 ? reader.len : reader.pos + length;
    const message = createBaseLogRecord();
    while (reader.pos < end) {
      const tag = reader.uint32();
      switch (tag >>> 3) {
        case 1:
          if (tag !== 9) {
            break;
          }
          message.timeUnixNano = longToNumber(reader.fixed64());
          continue;
        case 11:
          if (tag !== 89) {
            break;
          }
          message.observedTimeUnixNano = longToNumber(reader.fixed64());
          continue;
        case 2:
          if (tag !== 16) {
            break;
          }
          message.severityNumber = reader.int32();
          continue;
        case 3:
          if (tag !== 26) {
            break;
          }
          message.severityText = reader.string();
          continue;
        case 5:
          if (tag !== 42) {
            break;
          }
          message.body = import_common.AnyValue.decode(reader, reader.uint32());
          continue;
        case 6:
          if (tag !== 50) {
            break;
          }
          message.attributes.push(import_common.KeyValue.decode(reader, reader.uint32()));
          continue;
        case 7:
          if (tag !== 56) {
            break;
          }
          message.droppedAttributesCount = reader.uint32();
          continue;
        case 8:
          if (tag !== 69) {
            break;
          }
          message.flags = reader.fixed32();
          continue;
        case 9:
          if (tag !== 74) {
            break;
          }
          message.traceId = reader.bytes();
          continue;
        case 10:
          if (tag !== 82) {
            break;
          }
          message.spanId = reader.bytes();
          continue;
      }
      if ((tag & 7) === 4 || tag === 0) {
        break;
      }
      reader.skipType(tag & 7);
    }
    return message;
  },
  fromJSON(object) {
    var _context11;
    return {
      timeUnixNano: isSet(object.timeUnixNano) ? import_global_this.default.Number(object.timeUnixNano) : 0,
      observedTimeUnixNano: isSet(object.observedTimeUnixNano) ? import_global_this.default.Number(object.observedTimeUnixNano) : 0,
      severityNumber: isSet(object.severityNumber) ? severityNumberFromJSON(object.severityNumber) : 0,
      severityText: isSet(object.severityText) ? import_global_this.default.String(object.severityText) : "",
      body: isSet(object.body) ? import_common.AnyValue.fromJSON(object.body) : void 0,
      attributes: import_global_this.default.Array.isArray(object?.attributes) ? (0, import_map.default)(_context11 = object.attributes).call(_context11, (e) => import_common.KeyValue.fromJSON(e)) : [],
      droppedAttributesCount: isSet(object.droppedAttributesCount) ? import_global_this.default.Number(object.droppedAttributesCount) : 0,
      flags: isSet((0, import_flags.default)(object)) ? import_global_this.default.Number((0, import_flags.default)(object)) : 0,
      traceId: isSet(object.traceId) ? bytesFromBase64(object.traceId) : new Uint8Array(0),
      spanId: isSet(object.spanId) ? bytesFromBase64(object.spanId) : new Uint8Array(0)
    };
  },
  toJSON(message) {
    const obj = {};
    if (message.timeUnixNano !== 0) {
      obj.timeUnixNano = Math.round(message.timeUnixNano);
    }
    if (message.observedTimeUnixNano !== 0) {
      obj.observedTimeUnixNano = Math.round(message.observedTimeUnixNano);
    }
    if (message.severityNumber !== 0) {
      obj.severityNumber = severityNumberToJSON(message.severityNumber);
    }
    if (message.severityText !== "") {
      obj.severityText = message.severityText;
    }
    if (message.body !== void 0) {
      obj.body = import_common.AnyValue.toJSON(message.body);
    }
    if (message.attributes?.length) {
      var _context12;
      obj.attributes = (0, import_map.default)(_context12 = message.attributes).call(_context12, (e) => import_common.KeyValue.toJSON(e));
    }
    if (message.droppedAttributesCount !== 0) {
      obj.droppedAttributesCount = Math.round(message.droppedAttributesCount);
    }
    if ((0, import_flags.default)(message) !== 0) {
      obj.flags = Math.round((0, import_flags.default)(message));
    }
    if (message.traceId.length !== 0) {
      obj.traceId = base64FromBytes(message.traceId);
    }
    if (message.spanId.length !== 0) {
      obj.spanId = base64FromBytes(message.spanId);
    }
    return obj;
  },
  create(base) {
    return LogRecord.fromPartial(base ?? {});
  },
  fromPartial(object) {
    var _context13, _context14;
    const message = createBaseLogRecord();
    message.timeUnixNano = object.timeUnixNano ?? 0;
    message.observedTimeUnixNano = object.observedTimeUnixNano ?? 0;
    message.severityNumber = object.severityNumber ?? 0;
    message.severityText = object.severityText ?? "";
    message.body = object.body !== void 0 && object.body !== null ? import_common.AnyValue.fromPartial(object.body) : void 0;
    message.attributes = ((_context13 = object.attributes) == null ? void 0 : (0, import_bind.default)(_context14 = Function.call).call(_context14, (0, import_map.default)(_context13), _context13))?.((e) => import_common.KeyValue.fromPartial(e)) || [];
    message.droppedAttributesCount = object.droppedAttributesCount ?? 0;
    message.flags = (0, import_flags.default)(object) ?? 0;
    message.traceId = object.traceId ?? new Uint8Array(0);
    message.spanId = object.spanId ?? new Uint8Array(0);
    return message;
  }
};
function bytesFromBase64(b64) {
  if (import_global_this.default.Buffer) {
    return Uint8Array.from(import_global_this.default.Buffer.from(b64, "base64"));
  } else {
    const bin = import_global_this.default.atob(b64);
    const arr = new Uint8Array(bin.length);
    for (let i = 0; i < bin.length; ++i) {
      arr[i] = bin.charCodeAt(i);
    }
    return arr;
  }
}
function base64FromBytes(arr) {
  if (import_global_this.default.Buffer) {
    return import_global_this.default.Buffer.from(arr).toString("base64");
  } else {
    const bin = [];
    (0, import_for_each.default)(arr).call(arr, (byte) => {
      bin.push(import_global_this.default.String.fromCharCode(byte));
    });
    return import_global_this.default.btoa(bin.join(""));
  }
}
function longToNumber(long) {
  if (long.gt(import_global_this.default.Number.MAX_SAFE_INTEGER)) {
    throw new import_global_this.default.Error("Value is larger than Number.MAX_SAFE_INTEGER");
  }
  return long.toNumber();
}
if (import_minimal.default.util.Long !== import_long.default) {
  import_minimal.default.util.Long = import_long.default;
  import_minimal.default.configure();
}
function isSet(value) {
  return value !== null && value !== void 0;
}
// Annotate the CommonJS export names for ESM import in node:
0 && (module.exports = {
  LogRecord,
  LogRecordFlags,
  LogsData,
  ResourceLogs,
  ScopeLogs,
  SeverityNumber,
  logRecordFlagsFromJSON,
  logRecordFlagsToJSON,
  protobufPackage,
  severityNumberFromJSON,
  severityNumberToJSON
});
//# sourceMappingURL=logs.js.map
