import { text } from "./../builders/common-plugins.builder.js";
import { isDefined } from "./../builders/utils.js";
import { Node_Type } from "./../../ricos-schema/legacy/wix/rich_content/v1/index.js";
const codeBlock = (...args) => {
  const codeBlockData = args.find(
    (a) => typeof a !== "string" && !("type" in a)
  );
  const nodes = args.map(
    (arg) => typeof arg === "string" ? text(arg).node() : "type" in arg && arg.type === "text_node" ? arg.node() : void 0
  ).filter(isDefined);
  return {
    type: "block_node",
    // @ts-ignore
    node: (getId) => {
      return {
        id: getId(),
        type: Node_Type.CODE_BLOCK,
        ...codeBlockData ? { codeBlockData } : {},
        ...nodes?.length && { nodes }
      };
    }
  };
};
export {
  codeBlock
};
//# sourceMappingURL=code-block.builder.js.map
