'use strict';

var chunkS3HJUSQ7_cjs = require('../chunk-S3HJUSQ7.cjs');
var chunk6SCDLAU2_cjs = require('../chunk-6SCDLAU2.cjs');

// src/public/internal.ts
chunk6SCDLAU2_cjs.init_cjs_shims();

// src/public-utils/createAndFetchTempObjectSetRid.ts
chunk6SCDLAU2_cjs.init_cjs_shims();
async function createAndFetchTempObjectSetRid(client, objectSet) {
  const response = await chunkS3HJUSQ7_cjs.OntologyObjectSet_exports.createTemporary(client, await client[chunkS3HJUSQ7_cjs.additionalContext].ontologyRid, {
    objectSet: chunkS3HJUSQ7_cjs.getWireObjectSet(objectSet)
  });
  return response.objectSetRid;
}

// src/public-utils/hydrateObjectSetFromObjectRids.ts
chunk6SCDLAU2_cjs.init_cjs_shims();
function hydrateObjectSetFromObjectRids(client, definition, rids) {
  return chunkS3HJUSQ7_cjs.createObjectSet(definition, client[chunkS3HJUSQ7_cjs.additionalContext], {
    type: "intersect",
    objectSets: [definition.type === "interface" ? {
      type: "interfaceBase",
      interfaceType: definition.apiName
    } : {
      type: "base",
      objectType: definition.apiName
    }, {
      type: "static",
      objects: asMutableArray(rids)
    }]
  });
}
function asMutableArray(array) {
  return array;
}

// src/public-utils/hydrateObjectSetFromRid.ts
chunk6SCDLAU2_cjs.init_cjs_shims();
function hydrateObjectSetFromRid(client, definition, rid) {
  return chunkS3HJUSQ7_cjs.createObjectSet(definition, client[chunkS3HJUSQ7_cjs.additionalContext], {
    type: "intersect",
    objectSets: [definition.type === "interface" ? {
      type: "interfaceBase",
      interfaceType: definition.apiName
    } : {
      type: "base",
      objectType: definition.apiName
    }, {
      type: "reference",
      reference: rid
    }]
  });
}

// src/logger/BrowserLogger.ts
chunk6SCDLAU2_cjs.init_cjs_shims();
function createStyle({
  color
}) {
  return `color: ${color}; border: 1px solid ${color}; padding: 2px; border-radius: 3px;`;
}
var levelStyles = {
  debug: createStyle({
    color: "LightBlue"
  }),
  error: createStyle({
    color: "red"
  }),
  fatal: createStyle({
    color: "red"
  }),
  info: createStyle({
    color: "green"
  }),
  trace: createStyle({
    color: "gray"
  }),
  warn: createStyle({
    color: "orange"
  })
};
var BrowserLogger = class _BrowserLogger extends chunkS3HJUSQ7_cjs.BaseLogger {
  constructor(bindings = {}, options = {}) {
    super(bindings, {
      ...options,
      level: options.level ?? "error"
    }, _BrowserLogger);
  }
  createLogMethod(name, bindings) {
    const msgs = [`%c${name}%c`];
    const styles = [levelStyles[name], ""];
    if (this.options?.msgPrefix) {
      msgs.push(`%c${this.options.msgPrefix}%c`);
      styles.push("font-style: italic; color: gray", "");
    }
    if (typeof bindings === "object" && "methodName" in bindings) {
      msgs.push(`%c.${bindings.methodName}()%c`);
      styles.push("font-style: italic;color: orchid", "");
    }
    return (...args) => {
      console[name === "fatal" ? "error" : name](msgs.join(" "), ...styles, ...args);
    };
  }
};

Object.defineProperty(exports, "MinimalLogger", {
  enumerable: true,
  get: function () { return chunkS3HJUSQ7_cjs.MinimalLogger; }
});
Object.defineProperty(exports, "hydrateAttachmentFromRid", {
  enumerable: true,
  get: function () { return chunkS3HJUSQ7_cjs.hydrateAttachmentFromRid; }
});
exports.BrowserLogger = BrowserLogger;
exports.createAndFetchTempObjectSetRid = createAndFetchTempObjectSetRid;
exports.hydrateObjectSetFromObjectRids = hydrateObjectSetFromObjectRids;
exports.hydrateObjectSetFromRid = hydrateObjectSetFromRid;
//# sourceMappingURL=internal.cjs.map
//# sourceMappingURL=internal.cjs.map