'use strict';

var chunkZFL7RPT6_cjs = require('./chunk-ZFL7RPT6.cjs');
require('./chunk-VVKEXIIO.cjs');
var chunkLDTMSHUZ_cjs = require('./chunk-LDTMSHUZ.cjs');
var api = require('@osdk/api');
var shared_net_errors = require('@osdk/shared.net.errors');
var shared_client_impl = require('@osdk/shared.client.impl');
var invariant = require('tiny-invariant');

function _interopDefault (e) { return e && e.__esModule ? e : { default: e }; }

var invariant__default = /*#__PURE__*/_interopDefault(invariant);

// src/index.ts
chunkLDTMSHUZ_cjs.init_cjs_shims();

// src/createPlatformClient.ts
chunkLDTMSHUZ_cjs.init_cjs_shims();
function createPlatformClient(baseUrl, tokenProvider, options = void 0, fetchFn = fetch) {
  return shared_client_impl.createSharedClientContext(baseUrl, tokenProvider, chunkZFL7RPT6_cjs.USER_AGENT, fetchFn);
}

// src/util/datetimeConverters.ts
chunkLDTMSHUZ_cjs.init_cjs_shims();
var isoRegex = /^\d{4}-\d{2}-\d{2}T\d{2}:\d{2}:\d{2}(?:\.\d+)?(?:Z|[+-]\d{2}:\d{2})?$/;
var extractDate = (dateTime) => {
  !(dateTime.length < 33) ? process.env.NODE_ENV !== "production" ? invariant__default.default(false, "Invalid date format. Provided input is too long.") : invariant__default.default(false) : void 0;
  !isoRegex.test(dateTime) ? process.env.NODE_ENV !== "production" ? invariant__default.default(false, `Invalid date format. Expected ISO 8601 format, but received ${dateTime}`) : invariant__default.default(false) : void 0;
  return extractDateFromIsoString(dateTime);
};
var extractDateInUTC = (date) => {
  return extractDateFromIsoString(date.toISOString());
};
var extractDateInLocalTime = (date) => {
  return extractDateFromIsoString(generateOffsetUtcString(date));
};
var generateOffsetUtcString = (date) => {
  const offsetMs = date.getTimezoneOffset() * 60 * 1e3;
  return new Date(date.getTime() - offsetMs).toISOString();
};
var extractDateFromIsoString = (dateTime) => {
  return dateTime.split("T")[0];
};

Object.defineProperty(exports, "ActionValidationError", {
  enumerable: true,
  get: function () { return chunkZFL7RPT6_cjs.ActionValidationError; }
});
Object.defineProperty(exports, "createAttachmentUpload", {
  enumerable: true,
  get: function () { return chunkZFL7RPT6_cjs.createAttachmentUpload; }
});
Object.defineProperty(exports, "createClient", {
  enumerable: true,
  get: function () { return chunkZFL7RPT6_cjs.createClient; }
});
Object.defineProperty(exports, "createObjectSpecifierFromPrimaryKey", {
  enumerable: true,
  get: function () { return chunkZFL7RPT6_cjs.createObjectSpecifierFromPrimaryKey; }
});
Object.defineProperty(exports, "extractPrimaryKeyFromObjectSpecifier", {
  enumerable: true,
  get: function () { return chunkZFL7RPT6_cjs.extractPrimaryKeyFromObjectSpecifier; }
});
Object.defineProperty(exports, "isOk", {
  enumerable: true,
  get: function () { return api.isOk; }
});
Object.defineProperty(exports, "PalantirApiError", {
  enumerable: true,
  get: function () { return shared_net_errors.PalantirApiError; }
});
exports.createPlatformClient = createPlatformClient;
exports.extractDate = extractDate;
exports.extractDateInLocalTime = extractDateInLocalTime;
exports.extractDateInUTC = extractDateInUTC;
//# sourceMappingURL=index.cjs.map
//# sourceMappingURL=index.cjs.map