import { j as jsxRuntimeExports } from "../../../../../_virtual/jsx-runtime.js";
import { useEditor as useEditor$1, EditorContent } from "../../../../../node_modules/.pnpm/@tiptap_react@2.14.0_@tiptap_core@2.14.0_@tiptap_pm@2.14.0__@tiptap_pm@2.14.0_react-dom_dfcea6344d2cfce7c917261cb98bda6f/node_modules/@tiptap/react/dist/index.js";
import { Placeholder } from "../../../../../node_modules/.pnpm/@tiptap_extension-placeholder@2.14.0_@tiptap_core@2.14.0_@tiptap_pm@2.14.0__@tiptap_pm@2.14.0/node_modules/@tiptap/extension-placeholder/dist/index.js";
import { RiBracesLine, RiArrowDownSLine } from "../../../../../node_modules/.pnpm/react-icons@5.5.0_react@19.1.1/node_modules/react-icons/ri/index.js";
import { TextStyle } from "../../../../../node_modules/.pnpm/@tiptap_extension-text-style@2.14.0_@tiptap_core@2.14.0_@tiptap_pm@2.14.0_/node_modules/@tiptap/extension-text-style/dist/index.js";
import { StarterKit } from "../../../../../node_modules/.pnpm/@tiptap_starter-kit@2.14.0/node_modules/@tiptap/starter-kit/dist/index.js";
import { TextAlign } from "../../../../../node_modules/.pnpm/@tiptap_extension-text-align@2.14.0_@tiptap_core@2.14.0_@tiptap_pm@2.14.0_/node_modules/@tiptap/extension-text-align/dist/index.js";
import { Heading } from "../../../../../node_modules/.pnpm/@tiptap_extension-heading@2.14.0_@tiptap_core@2.14.0_@tiptap_pm@2.14.0_/node_modules/@tiptap/extension-heading/dist/index.js";
import { forwardRef, useState, useEffect, useImperativeHandle, startTransition } from "react";
import "../../../../../node_modules/.pnpm/@formkit_auto-animate@0.8.2/node_modules/@formkit/auto-animate/index.js";
import { Root as Root2, Item as Item2 } from "../../../../../node_modules/.pnpm/@radix-ui_react-toggle-group@1.1.0_@types_react-dom@19.1.9_@types_react@19.1.13__@types_fb719ced578ff6b62dc0bf16d0990739/node_modules/@radix-ui/react-toggle-group/dist/index.js";
import "../../../../../node_modules/.pnpm/react-hot-toast@2.5.2_react-dom@19.1.1_react@19.1.1__react@19.1.1/node_modules/react-hot-toast/dist/index.js";
import { Document } from "../../../../../node_modules/.pnpm/@tiptap_extension-document@2.14.0_@tiptap_core@2.14.0_@tiptap_pm@2.14.0_/node_modules/@tiptap/extension-document/dist/index.js";
import { MdFormatAlignLeft, MdFormatAlignCenter, MdFormatAlignRight, MdFormatAlignJustify, MdFormatBold, MdOutlineFormatItalic, MdStrikethroughS } from "../../../../../node_modules/.pnpm/react-icons@5.5.0_react@19.1.1/node_modules/react-icons/md/index.js";
import { useEditor, useSelectedBrickId } from "../../../../../use-editor.js";
import { JSONSchemaView } from "../../editor/components/json-form/SchemaView.js";
import { Mention } from "../../../../../node_modules/.pnpm/@tiptap_extension-mention@2.14.0_@tiptap_core@2.14.0_@tiptap_pm@2.14.0__@tiptap_pm@2.14_61b779bbdaffa78f06bf6f82349b50b0/node_modules/@tiptap/extension-mention/dist/index.js";
import config from "./datasourceFieldSuggestions.js";
import { getJSONSchemaFieldsList } from "../utils/json-field-list.js";
import { Highlight } from "../../../../../node_modules/.pnpm/@tiptap_extension-highlight@2.14.0_@tiptap_core@2.14.0_@tiptap_pm@2.14.0_/node_modules/@tiptap/extension-highlight/dist/index.js";
import { menuBarBtnCls, menuBarBtnCommonCls, menuBarBtnActiveCls } from "../styles/menubar-styles.js";
import { useTextEditorUpdateHandler } from "../../editor/hooks/use-editable-text.js";
import { tx as D } from "../../../../style-system/dist/twind.js";
import { insertInEditor, getEditorNodeFromField } from "../utils/editor-utils.js";
import { useLoopAlias, usePageQueries } from "../../../../../use-page-data.js";
import { Extension } from "../../../../../node_modules/.pnpm/@tiptap_core@2.14.0_@tiptap_pm@2.14.0/node_modules/@tiptap/core/dist/index.js";
import { Portal as r } from "../../../../../node_modules/.pnpm/@radix-ui_themes@3.2.1_@types_react-dom@19.1.9_@types_react@19.1.13__@types_react@19.1._832fa1fef691e6e9510ada03948dc85c/node_modules/@radix-ui/themes/dist/esm/components/portal.js";
import { Root as n, Text as u } from "../../../../../node_modules/.pnpm/@radix-ui_themes@3.2.1_@types_react-dom@19.1.9_@types_react@19.1.13__@types_react@19.1._832fa1fef691e6e9510ada03948dc85c/node_modules/@radix-ui/themes/dist/esm/components/callout.js";
import { Root as I, Trigger as h, Content as g, Label as y, CheckboxItem as T, Item as v } from "../../../../../node_modules/.pnpm/@radix-ui_themes@3.2.1_@types_react-dom@19.1.9_@types_react@19.1.13__@types_react@19.1._832fa1fef691e6e9510ada03948dc85c/node_modules/@radix-ui/themes/dist/esm/components/dropdown-menu.js";
import { Root as P, Trigger as s, Content as i } from "../../../../../node_modules/.pnpm/@radix-ui_themes@3.2.1_@types_react-dom@19.1.9_@types_react@19.1.13__@types_react@19.1._832fa1fef691e6e9510ada03948dc85c/node_modules/@radix-ui/themes/dist/esm/components/popover.js";
const HeroHeading = Heading.extend({
  addAttributes() {
    return {
      ...this.parent?.(),
      heroSize: {
        default: "hero-size-1",
        parseHTML: (element) => element.getAttribute("class") || "",
        renderHTML: (attributes) => {
          if (!attributes.heroSize) {
            return {};
          }
          return { class: attributes.heroSize };
        }
      }
    };
  }
});
const OverrideEscape = Extension.create({
  name: "OverrideEscape",
  addKeyboardShortcuts() {
    return {
      Escape: () => this.editor.commands.blur()
    };
  }
});
const dynFieldClass = D("dynamic-field");
function formatInitialContent(content) {
  if (typeof content !== "string") {
    return "";
  }
  return content.replace(/{{(\S+)}}/g, (match, p1) => {
    return `<span data-type="mention" data-id="${p1.trim()}" data-label="${p1.trim()}" class="${dynFieldClass}">${p1.trim()}</span>`;
  });
}
const TextEditor = forwardRef(
  ({
    content: initialContent,
    rawContent: rawInitialContent,
    className,
    brickId,
    inline,
    singleline,
    propPath,
    noTextAlign,
    noTextStrike,
    textSizeMode = "classic",
    placeholder,
    noMenuBar,
    dynamic = false,
    onChange
  }, ref) => {
    const defaultUpdateHandler = useTextEditorUpdateHandler(brickId, propPath, dynamic, inline === true);
    const mainEditor = useEditor();
    const selectedBrickId = useSelectedBrickId();
    const pageQueries = usePageQueries();
    const [menuBarContainer, setMenuBarContainer] = useState(null);
    const [currentContent, setContent] = useState(formatInitialContent(initialContent));
    const [rawContent, setRawContent] = useState(formatInitialContent(rawInitialContent));
    const [focused, setFocused] = useState(false);
    const queryAlias = useLoopAlias(brickId);
    const onUpdate = inline ? defaultUpdateHandler : onChange;
    const datasourceFields = pageQueries.filter((q) => q.alias === queryAlias || !queryAlias && q.queryInfo.limit === 1).flatMap((q) => getJSONSchemaFieldsList(q.datasource.schema, q.alias));
    const extensions = [
      StarterKit.configure({
        document: singleline || textSizeMode === "hero" ? false : void 0,
        dropcursor: {
          class: "drop-cursor",
          color: "#FF9900"
        },
        heading: textSizeMode === "hero" ? false : {}
      }),
      TextStyle.configure({
        mergeNestedSpanStyles: false
      }),
      Placeholder.configure({
        placeholder: placeholder ?? "Type your text..."
      }),
      ...textSizeMode === "hero" ? [Document.extend({ content: "heading*" })] : singleline ? [Document.extend({ content: "paragraph" })] : [],
      ...textSizeMode === "hero" ? [HeroHeading] : [],
      ...!noTextAlign ? [
        TextAlign.configure({
          types: ["heading", "paragraph"]
        })
      ] : [],
      Highlight.configure({ multicolor: true }),
      Mention.configure({
        HTMLAttributes: {
          class: "dynamic-field"
        },
        suggestion: {
          ...config,
          items: ({ query }) => {
            return datasourceFields.filter((field) => field.toLowerCase().includes(query.toLowerCase()));
          }
        },
        renderHTML: ({ options, node }) => {
          const field = node.attrs.label ?? node.attrs.id;
          return [
            "span",
            {
              "data-type": "mention",
              class: D("dynamic-field"),
              "data-label": field,
              "data-id": field
            },
            `${options.suggestion.char}${field}`.replace(options.suggestion.char, "")
          ];
        },
        renderText: ({ options, node }) => {
          const field = node.attrs.label ?? node.attrs.id;
          return `{{${field}}}`;
        }
      }),
      OverrideEscape
    ];
    const onFocus = (e) => {
      console.log("Editor focused", e);
      mainEditor.setIsEditingText(brickId);
      mainEditor.setSelectedBrickId(brickId);
      setFocused(true);
      if (noMenuBar) {
        return;
      }
      setTimeout(() => {
        const container = document.querySelector(`#text-editor-menu-${brickId}`);
        if (container) {
          setMenuBarContainer(container);
        }
      }, 0);
    };
    const onBlur = (e) => {
      if (e.event.relatedTarget && !e.event.relatedTarget.classList.contains("tiptap")) {
        console.debug("Editor blur triggered by editor buttons, ignoring", e.event.relatedTarget);
        return;
      }
      mainEditor.setIsEditingText(false);
      startTransition(() => {
        setContent(e.editor.getHTML());
        setFocused(false);
      });
    };
    const editor = useEditor$1(
      {
        extensions,
        content: currentContent,
        onUpdate,
        onBlur,
        onFocus,
        immediatelyRender: true,
        editable: true,
        editorProps: {
          attributes: {
            class: D(className, singleline && "singleline")
          }
        }
      },
      [brickId, selectedBrickId, queryAlias]
    );
    useEffect(() => {
      if (focused) {
        editor.commands.setContent(rawContent, false);
      } else {
        editor.commands.setContent(currentContent, false);
      }
    }, [focused, currentContent, rawContent, editor]);
    useEffect(() => {
      if (brickId !== selectedBrickId) {
        editor.commands.blur();
      }
    }, [selectedBrickId, brickId, editor]);
    useImperativeHandle(
      ref,
      () => ({
        editor
      }),
      [editor]
    );
    return /* @__PURE__ */ jsxRuntimeExports.jsxs(jsxRuntimeExports.Fragment, { children: [
      /* @__PURE__ */ jsxRuntimeExports.jsx(EditorContent, { autoCorrect: "false", spellCheck: "false", editor, className: D("contents") }),
      (focused || editor.isFocused) && menuBarContainer && /* @__PURE__ */ jsxRuntimeExports.jsx(r, { container: menuBarContainer, asChild: true, children: /* @__PURE__ */ jsxRuntimeExports.jsx(
        TextEditorMenuBar,
        {
          brickId,
          editor,
          noTextAlign,
          noTextStrike,
          textSizeMode
        }
      ) })
    ] });
  }
);
TextEditor.displayName = "TextEditor";
const TextEditorMenuBar = ({
  editor,
  textSizeMode,
  noTextAlign,
  noTextStrike,
  brickId
}) => {
  const hasPageQueries = usePageQueries().length > 0;
  return /* @__PURE__ */ jsxRuntimeExports.jsxs(jsxRuntimeExports.Fragment, { children: [
    textSizeMode === "classic" && /* @__PURE__ */ jsxRuntimeExports.jsx(TextSizeClassicDropdown, { editor }),
    textSizeMode === "hero" && /* @__PURE__ */ jsxRuntimeExports.jsx(TextSizeHeroDropdown, { editor }),
    !noTextAlign && /* @__PURE__ */ jsxRuntimeExports.jsx(TextAlignButtonGroup, { editor }),
    /* @__PURE__ */ jsxRuntimeExports.jsx(TextStyleButtonGroup, { editor, noTextStrike, textSizeMode }),
    hasPageQueries && /* @__PURE__ */ jsxRuntimeExports.jsx(DatasourceItemButton, { editor, brickId, children: /* @__PURE__ */ jsxRuntimeExports.jsx("button", { type: "button", className: D(menuBarBtnCls, menuBarBtnCommonCls), children: /* @__PURE__ */ jsxRuntimeExports.jsx(RiBracesLine, { className: "w-5 h-5" }) }) })
  ] });
};
const arrowClass = "h-4 w-4 opacity-60 -mr-2";
function TextAlignButtonGroup({ editor }) {
  const [currentAlignment, setCurrentAligment] = useState(
    editor.isActive("textAlign") ? editor.getAttributes("textAlign").alignment : void 0
  );
  const alignments = {
    left: "Left",
    center: "Center",
    right: "Right",
    justify: "Justify"
  };
  return /* @__PURE__ */ jsxRuntimeExports.jsx(
    DropMenu,
    {
      items: [
        ...Object.entries(alignments).map(([key, label]) => ({
          label,
          onClick: () => {
            const alignOk = editor.commands.setTextAlign(key);
            console.log("alignOk", key, alignOk);
            setCurrentAligment(key);
          },
          type: "checkbox",
          checked: currentAlignment === key
        }))
      ],
      children: /* @__PURE__ */ jsxRuntimeExports.jsxs("button", { type: "button", className: D(menuBarBtnCls, menuBarBtnCommonCls), children: [
        !currentAlignment || currentAlignment === "left" ? /* @__PURE__ */ jsxRuntimeExports.jsx(MdFormatAlignLeft, { className: D("w-5 h-5") }) : currentAlignment === "center" ? /* @__PURE__ */ jsxRuntimeExports.jsx(MdFormatAlignCenter, { className: D("w-5 h-5") }) : currentAlignment === "right" ? /* @__PURE__ */ jsxRuntimeExports.jsx(MdFormatAlignRight, { className: D("w-5 h-5") }) : /* @__PURE__ */ jsxRuntimeExports.jsx(MdFormatAlignJustify, { className: D("w-5 h-5") }),
        /* @__PURE__ */ jsxRuntimeExports.jsx(RiArrowDownSLine, { className: D(arrowClass) })
      ] })
    }
  );
}
function DatasourceFieldPickerModal({ brickId, onlyAlias, onFieldSelect }) {
  const pageQueries = usePageQueries();
  if (!pageQueries.length) {
    return /* @__PURE__ */ jsxRuntimeExports.jsx("div", { className: "bg-white min-w-52 min-h-80 flex flex-col gap-4", children: "No database selected in the dynamic parent brick." });
  }
  return /* @__PURE__ */ jsxRuntimeExports.jsxs("div", { className: "bg-white flex flex-col gap-3", children: [
    /* @__PURE__ */ jsxRuntimeExports.jsx("h3", { className: "text-base font-medium", children: "Insert fields from your queries" }),
    /* @__PURE__ */ jsxRuntimeExports.jsx(n, { className: "-mx-4 !py-2 !px-3 !rounded-none", children: /* @__PURE__ */ jsxRuntimeExports.jsx(u, { size: "1", className: D("text-pretty"), children: "Click on a field to insert it into the text box. Fields are inserted as dynamic placeholders, which will be replaced with their actual values when the document is rendered." }) }),
    /* @__PURE__ */ jsxRuntimeExports.jsx("div", { className: "flex flex-col gap-1 pb-2 max-h-[300px] overflow-y-auto scrollbar-thin", children: pageQueries.filter((q) => q.alias === onlyAlias || !onlyAlias && q.queryInfo.limit === 1).map((query) => /* @__PURE__ */ jsxRuntimeExports.jsxs("div", { className: "flex flex-col gap-1", children: [
      /* @__PURE__ */ jsxRuntimeExports.jsxs("h4", { className: "text-sm font-semibold", children: [
        query.alias,
        " - ",
        query.queryInfo?.label
      ] }),
      /* @__PURE__ */ jsxRuntimeExports.jsx(
        JSONSchemaView,
        {
          prefix: query.alias,
          schema: query.datasource.schema,
          onFieldSelect
        },
        query.alias
      )
    ] }, query.alias)) })
  ] });
}
function DatasourceItemButton({
  editor,
  brickId,
  children,
  onFieldClick
}) {
  const queryAlias = useLoopAlias(brickId);
  const onFieldSelect = (field) => {
    onFieldClick?.(field);
    if (!editor) {
      return;
    }
    const content = getEditorNodeFromField(field);
    insertInEditor(editor, content);
  };
  return /* @__PURE__ */ jsxRuntimeExports.jsxs(P, { children: [
    /* @__PURE__ */ jsxRuntimeExports.jsx(s, { children }),
    /* @__PURE__ */ jsxRuntimeExports.jsx(i, { minWidth: "260px", side: "top", align: "start", size: "2", maxHeight: "70dvh", sideOffset: 10, children: /* @__PURE__ */ jsxRuntimeExports.jsx(DatasourceFieldPickerModal, { onFieldSelect, brickId, onlyAlias: queryAlias }) })
  ] });
}
function TextStyleButtonGroup({ editor, noTextStrike, textSizeMode }) {
  const isBold = editor.isActive("bold");
  const isItalic = editor.isActive("italic");
  const isStrike = editor.isActive("strike");
  return /* @__PURE__ */ jsxRuntimeExports.jsxs(
    Root2,
    {
      className: D("flex !shadow-none divide-x divide-gray-200", !textSizeMode && "!rounded-l-none"),
      type: "multiple",
      value: [
        isBold ? "bold" : void 0,
        isItalic ? "italic" : void 0,
        isStrike ? "strike" : void 0
      ].filter(Boolean),
      "aria-label": "Text style",
      children: [
        /* @__PURE__ */ jsxRuntimeExports.jsx(
          Item2,
          {
            className: D(menuBarBtnCls, menuBarBtnCommonCls, "!rounded-l-none", isBold && menuBarBtnActiveCls),
            value: "bold",
            onClick: () => editor.chain().focus().toggleBold().run(),
            children: /* @__PURE__ */ jsxRuntimeExports.jsx(MdFormatBold, { className: "w-5 h-5" })
          }
        ),
        /* @__PURE__ */ jsxRuntimeExports.jsx(
          Item2,
          {
            className: D(menuBarBtnCls, menuBarBtnCommonCls, isItalic && menuBarBtnActiveCls),
            value: "italic",
            onClick: () => editor.chain().focus().toggleItalic().run(),
            children: /* @__PURE__ */ jsxRuntimeExports.jsx(MdOutlineFormatItalic, { className: "w-5 h-5" })
          }
        ),
        !noTextStrike && /* @__PURE__ */ jsxRuntimeExports.jsx(
          Item2,
          {
            className: D(menuBarBtnCls, menuBarBtnCommonCls, "!rounded-none", isStrike && menuBarBtnActiveCls),
            value: "strike",
            onClick: () => editor.chain().focus().toggleStrike().run(),
            children: /* @__PURE__ */ jsxRuntimeExports.jsx(MdStrikethroughS, { className: "w-5 h-5" })
          }
        )
      ]
    }
  );
}
function TextSizeClassicDropdown({ editor }) {
  const [value, setValue] = useState(
    editor.isActive("heading") ? editor.getAttributes("heading").level?.toString() : editor.isActive("code") ? "code" : "paragraph"
  );
  return /* @__PURE__ */ jsxRuntimeExports.jsx(
    DropMenu,
    {
      items: [
        {
          label: "Title 1",
          onClick: () => {
            editor.chain().focus().toggleHeading({ level: 1 }).run();
            setValue("1");
          },
          type: "checkbox",
          checked: value === "1"
        },
        {
          label: "Title 2",
          onClick: () => {
            editor.chain().focus().toggleHeading({ level: 2 }).run();
            setValue("2");
          },
          type: "checkbox",
          checked: value === "2"
        },
        {
          label: "Title 3",
          onClick: () => {
            editor.chain().focus().toggleHeading({ level: 3 }).run();
            setValue("3");
          },
          type: "checkbox",
          checked: value === "3"
        },
        {
          label: "Title 4",
          onClick: () => {
            editor.chain().focus().toggleHeading({ level: 4 }).run();
            setValue("4");
          },
          type: "checkbox",
          checked: value === "4"
        },
        {
          label: "Title 5",
          onClick: () => {
            editor.chain().focus().toggleHeading({ level: 5 }).run();
            setValue("5");
          },
          type: "checkbox",
          checked: value === "5"
        },
        {
          type: "separator"
        },
        {
          label: "Paragraph",
          onClick: () => {
            editor.chain().focus().setParagraph().run();
            setValue("paragraph");
          },
          type: "checkbox",
          checked: value === "paragraph"
        },
        {
          type: "separator"
        },
        {
          label: "Code",
          onClick: () => {
            editor.chain().focus().toggleCode().run();
            setValue("code");
          },
          type: "checkbox",
          checked: value === "code"
        }
      ],
      children: /* @__PURE__ */ jsxRuntimeExports.jsxs("button", { type: "button", className: D(menuBarBtnCls, menuBarBtnCommonCls, "!px-3"), children: [
        /* @__PURE__ */ jsxRuntimeExports.jsx("span", { className: "text-[0.85rem] font-medium", children: value === "code" ? "Code" : value === "paragraph" ? "Paragraph" : `Title ${value}` }),
        /* @__PURE__ */ jsxRuntimeExports.jsx(RiArrowDownSLine, { className: D(arrowClass) })
      ] })
    }
  );
}
function TextSizeHeroDropdown({ editor }) {
  const [value, setValue] = useState(editor.getAttributes("heading").class?.toString() ?? "hero-size-1");
  const sizes = [1, 2, 3, 4, 5];
  const labels = ["M", "L", "XL", "2XL", "3XL"];
  const map = {
    "hero-size-1": "M",
    "hero-size-2": "L",
    "hero-size-3": "XL",
    "hero-size-4": "2XL",
    "hero-size-5": "3XL"
  };
  return /* @__PURE__ */ jsxRuntimeExports.jsx(
    DropMenu,
    {
      items: sizes.map((size, index) => ({
        label: `Hero ${labels[index]}`,
        onClick: () => {
          const isH1 = editor.isActive("heading", { level: 1 });
          if (isH1) {
            editor.chain().focus().updateAttributes("heading", { heroSize: `hero-size-${size}` }).run();
          }
          setValue(`hero-size-${size}`);
        },
        type: "checkbox",
        checked: value === `hero-size-${size}`
      })),
      children: /* @__PURE__ */ jsxRuntimeExports.jsxs("button", { type: "button", className: D(menuBarBtnCls, menuBarBtnCommonCls), children: [
        /* @__PURE__ */ jsxRuntimeExports.jsxs("span", { className: "text-[0.94rem] font-medium capitalize", children: [
          "Hero ",
          map[value]
        ] }),
        /* @__PURE__ */ jsxRuntimeExports.jsx(RiArrowDownSLine, { className: D(arrowClass) })
      ] })
    }
  );
}
function DropMenu(props) {
  return /* @__PURE__ */ jsxRuntimeExports.jsxs(I, { modal: false, children: [
    /* @__PURE__ */ jsxRuntimeExports.jsx(h, { className: "focus:outline-none", id: props.id, children: props.children }),
    /* @__PURE__ */ jsxRuntimeExports.jsx(g, { side: "bottom", children: props.items.map(
      (item, index) => item.type === "separator" ? /* @__PURE__ */ jsxRuntimeExports.jsx("div", { className: "my-1.5 h-px bg-black/10" }, index) : item.type === "label" ? /* @__PURE__ */ jsxRuntimeExports.jsx(y, { children: item.label }, item.label) : item.type === "checkbox" ? /* @__PURE__ */ jsxRuntimeExports.jsx(T, { checked: item.checked, children: /* @__PURE__ */ jsxRuntimeExports.jsxs(
        "button",
        {
          onClick: item.onClick,
          type: "button",
          className: "group flex justify-start items-center text-nowrap rounded-[inherit]\n                py-1.5 w-fulldark:text-white/90 text-left data-[focus]:bg-upstart-600 data-[focus]:text-white ",
          children: [
            /* @__PURE__ */ jsxRuntimeExports.jsx("span", { className: "pr-3", children: item.label }),
            item.shortcut && /* @__PURE__ */ jsxRuntimeExports.jsx(
              "kbd",
              {
                className: "ml-auto font-sans text-right text-[smaller] text-black/50 dark:text-dark-300\n                    group-hover:text-white/90\n                      group-data-[focus]:text-white/70 group-data-[active]:text-white/70",
                children: item.shortcut
              }
            )
          ]
        }
      ) }, item.label) : /* @__PURE__ */ jsxRuntimeExports.jsx(v, { children: /* @__PURE__ */ jsxRuntimeExports.jsxs(
        "button",
        {
          onClick: item.onClick,
          type: "button",
          className: "group flex justify-start items-center text-nowrap rounded-[inherit]\n                py-1.5 w-fulldark:text-white/90 text-left data-[focus]:bg-upstart-600 data-[focus]:text-white ",
          children: [
            /* @__PURE__ */ jsxRuntimeExports.jsx("span", { className: "pr-3", children: item.label }),
            item.shortcut && /* @__PURE__ */ jsxRuntimeExports.jsx(
              "kbd",
              {
                className: "ml-auto font-sans text-right text-[smaller] text-black/50 dark:text-dark-300\n                    group-hover:text-white/90\n                      group-data-[focus]:text-white/70 group-data-[active]:text-white/70",
                children: item.shortcut
              }
            )
          ]
        }
      ) }, item.label)
    ) })
  ] });
}
export {
  DatasourceItemButton,
  TextEditor as default
};
//# sourceMappingURL=TextEditor.js.map
