import { isValidElement } from 'react';

const warned = /* @__PURE__ */ new Set();
function warnOnce(message) {
  if (process.env.NODE_ENV === "production") {
    return;
  }
  if (!warned.has(message)) {
    warned.add(message);
    console.warn(message);
  }
}

function warnDeprecatedErrorUsage(componentName, error) {
  if (error === void 0 || typeof error === "boolean") return;
  if (typeof error === "string" || Array.isArray(error)) return;
  if (isValidElement(error)) {
    warnOnce(
      `[Anvil2 ${componentName}] Passing a ReactElement to the \`error\` prop is deprecated. Use a string or string[] instead: \`error="message"\` or \`error={["msg1", "msg2"]}\`. See https://beta.anvil.servicetitan.com/docs/web/components/field-message/code`
    );
  }
}

export { warnOnce as a, warnDeprecatedErrorUsage as w };
//# sourceMappingURL=utils-pudAMGnO.js.map
