import { __exports as n } from "../../../../../../../../_virtual/valueToNode.js";
import "../validators/isValidIdentifier.js";
import { __require as l } from "../builders/generated/index.js";
import { __exports as b } from "../../../../../../../../_virtual/isValidIdentifier.js";
var f;
function _() {
  if (f)
    return n;
  f = 1, Object.defineProperty(n, "__esModule", {
    value: !0
  }), n.default = void 0;
  var c = b, e = l(), u = o;
  n.default = u;
  const a = Function.call.bind(Object.prototype.toString);
  function p(r) {
    return a(r) === "[object RegExp]";
  }
  function d(r) {
    if (typeof r != "object" || r === null || Object.prototype.toString.call(r) !== "[object Object]")
      return !1;
    const t = Object.getPrototypeOf(r);
    return t === null || Object.getPrototypeOf(t) === null;
  }
  function o(r) {
    if (r === void 0)
      return (0, e.identifier)("undefined");
    if (r === !0 || r === !1)
      return (0, e.booleanLiteral)(r);
    if (r === null)
      return (0, e.nullLiteral)();
    if (typeof r == "string")
      return (0, e.stringLiteral)(r);
    if (typeof r == "number") {
      let t;
      if (Number.isFinite(r))
        t = (0, e.numericLiteral)(Math.abs(r));
      else {
        let i;
        Number.isNaN(r) ? i = (0, e.numericLiteral)(0) : i = (0, e.numericLiteral)(1), t = (0, e.binaryExpression)("/", i, (0, e.numericLiteral)(0));
      }
      return (r < 0 || Object.is(r, -0)) && (t = (0, e.unaryExpression)("-", t)), t;
    }
    if (p(r)) {
      const t = r.source, i = r.toString().match(/\/([a-z]+|)$/)[1];
      return (0, e.regExpLiteral)(t, i);
    }
    if (Array.isArray(r))
      return (0, e.arrayExpression)(r.map(o));
    if (d(r)) {
      const t = [];
      for (const i of Object.keys(r)) {
        let s;
        (0, c.default)(i) ? s = (0, e.identifier)(i) : s = (0, e.stringLiteral)(i), t.push((0, e.objectProperty)(s, o(r[i])));
      }
      return (0, e.objectExpression)(t);
    }
    throw new Error("don't know how to turn this value into a node");
  }
  return n;
}
export {
  _ as __require
};
//# sourceMappingURL=valueToNode.js.map
