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B%$gtЏ򤵍zHNuЯ-'40;_3 !01"@AQa2Pq#3BR?ʩcaen^8F<7;EA{EÖ1U/#d1an.1ě0ʾRh|RAo3m3 % 28Q yφHTo7lW>#i`qca m,B-j݋'mR1Ήt>Vps0IbIC.1Rea]H64B>o]($Bma!=?B KǾ+Ծ"nK*+[T#{EJSQs5:U\wĐf3܆&)IԆwE TlrTf6Q|Rh:[K zc֧GC%\_a84HcObiؖV7H )*ģK~Xhչ04?0 E<}3#u? |gS6ꊤ|I#Hڛ աwX97Ŀ%SLy6č|Fa 8b$sקhb9RAu7˨pČ_\*w묦F 4D~f|("mNKiS>$d7SlA/²SL|6N}S˯g]6; #. 403WebShell
403Webshell
Server IP : 45.32.152.128  /  Your IP : 216.73.216.91
Web Server : nginx/1.24.0
System : Linux stage-vultr 5.4.0-216-generic #236-Ubuntu SMP Fri Apr 11 19:53:21 UTC 2025 x86_64
User : forge ( 1000)
PHP Version : 8.2.14
Disable Function : NONE
MySQL : OFF  |  cURL : ON  |  WGET : ON  |  Perl : ON  |  Python : ON  |  Sudo : ON  |  Pkexec : ON
Directory :  /home/forge/evolutionequity.pdgm.dev/bootstrap/ssr/assets/

Upload File :
current_dir [ Writeable ] document_root [ Writeable ]

 

Command :


[ Back ]     

Current File : /home/forge/evolutionequity.pdgm.dev/bootstrap/ssr/assets/create.1f58b83d.mjs
import { a as jsx, j as jsxs, F as Fragment } from "../ssr.mjs";
import { B as Button } from "./Button.1eabc287.mjs";
import { I as Img } from "./Image.920acc90.mjs";
import React__default, { useState, createContext, useCallback, useEffect, useContext, useRef } from "react";
import { E as EditorContext, a as EditorContextProvider, T as Toggle, F as FileCard } from "./FileCard.9d56db5e.mjs";
import { M as ModalsContext, a as ModalsProvider, b as MODALS, L as Layout } from "./Layout.b73af70c.mjs";
import ContentEditable from "react-contenteditable";
import moment from "moment";
import axios from "axios";
import { FileJs, FilePlus, Image, Link, X, ArrowsClockwise, Trash, Copy, DownloadSimple, CaretRight, FileVideo, File, Plus, DotsSixVertical, CloudArrowUp, Download, UserList } from "phosphor-react";
import { F as Form, T as TextField, S as Submit, a as FormContext, E as ErrorGroupContext } from "./TextField.35c532f8.mjs";
import { useForm } from "@inertiajs/inertia-react";
import { I as Icon } from "./Icon.b5c73dc8.mjs";
import route from "ziggy-js";
import { W as WhiteContainer } from "./WhiteContainer.fd6a3f1a.mjs";
import { Inertia } from "@inertiajs/inertia";
import "react-dom/server.js";
import "process";
import "http";
import "react/jsx-runtime.js";
import "./ScreenContext.ab3d2e0e.mjs";
function BtnNoInertia(props) {
  const {
    className,
    defaultColor = true,
    defaultPadding = true,
    ...rest
  } = props;
  return /* @__PURE__ */ jsx("a", {
    className: `h-48px ${defaultColor && "text-white bg-insightsButtonBlue"} rounded-md ${defaultPadding && "px-22px"} inline-flex items-center justify-center text-14 font-bold ${className}  ${defaultColor && "hover:text-white hover:bg-insightsButtonBlue/70"} `,
    ...rest
  });
}
function useThrottle(func, delay) {
  const [timeout, saveTimeout] = useState(null);
  const throttledFunc = function(...args) {
    if (timeout) {
      clearTimeout(timeout);
    }
    const newTimeout = setTimeout(() => {
      func(...args);
      if (newTimeout === timeout) {
        saveTimeout(null);
      }
    }, delay);
    saveTimeout(newTimeout);
  };
  return throttledFunc;
}
function includesAll(string, substring) {
  var letters = [...string];
  return [...substring].every((x) => {
    var index = letters.indexOf(x);
    if (~index) {
      letters.splice(index, 1);
      return true;
    }
  });
}
function MenuItem$2({
  tag,
  icon,
  name,
  index,
  onEdit,
  onNew
}) {
  var _a, _b, _c, _d;
  const {
    addBlock,
    updateBlock,
    addChild,
    turnInto,
    blocks
  } = useContext(EditorContext);
  const {
    close
  } = useContext(ModalsContext);
  const {
    block: b,
    setActive,
    active,
    selected
  } = useContext(CMContext$1);
  let use_parent = ["\u25BC", "UL", "OL"].includes(b.Type);
  let block = blocks.find((bl) => bl.id == b.id);
  let regex = /<{0,1}\/.[^<>\/\s]*/g;
  let matches = `${block.content}`.match(regex);
  let command = ((_c = (_b = (_a = matches == null ? void 0 : matches.filter((m) => !m.includes("</"))) == null ? void 0 : _a.reverse()) == null ? void 0 : _b[0]) != null ? _c : "").replace("/", "").replace("&nbsp;", "");
  const edit = onEdit != null ? onEdit : (e) => {
    updateBlock(b.id, b.content);
    turnInto(b.id, tag);
    close();
  };
  const newItem = onNew != null ? onNew : (e) => {
    updateBlock(b.id, b.content);
    addChild(use_parent ? b.id : b.parent_id, tag);
    close();
  };
  const applyCommand = (e) => {
    if (e.key === "Enter" && selected == index) {
      e.preventDefault();
      if (b.content == "")
        edit(e);
      else
        newItem(e);
    }
  };
  useEffect(() => {
    try {
      document.addEventListener("keyup", applyCommand);
    } catch (error) {
    }
    return () => {
      document.removeEventListener("keyup", applyCommand);
    };
  }, [active, selected]);
  useEffect(() => {
    setActive((a) => ({
      ...a,
      [index]: !command || includesAll(name.toLowerCase(), command.toLowerCase())
    }));
  }, [command]);
  return ((_d = active[index]) != null ? _d : true) && /* @__PURE__ */ jsxs("div", {
    className: `p-6px cursor-pointer  rounded-sm flex gap-16px items-center justify-between  group ${selected == index ? "bg-app-mid text-white hover:bg-app-mid/30 hover:text-app-lighter" : "hover:bg-app-gray-B3B3B3/30"} `,
    onClick: newItem,
    children: [/* @__PURE__ */ jsxs("div", {
      className: "flex items-center gap-16px",
      children: [/* @__PURE__ */ jsx("div", {
        className: "w-30px h-30px  flex items-center justify-center font-semibold",
        children: icon != null ? icon : tag
      }), /* @__PURE__ */ jsx("div", {
        className: "group-hover:underline",
        children: name
      })]
    }), /* @__PURE__ */ jsx("div", {
      className: "flex items-center gap-12px  cursor-pointer"
    })]
  });
}
function ListItem(props) {
  const {
    tag,
    name
  } = props;
  const {
    addBlock,
    updateBlock,
    addChild,
    turnInto
  } = useContext(EditorContext);
  const {
    close
  } = useContext(ModalsContext);
  const {
    block: b
  } = useContext(CMContext$1);
  return /* @__PURE__ */ jsx(MenuItem$2, {
    ...props,
    onEdit: (e) => {
      addChild(b.id, "LI", b.content);
      updateBlock(b.id, "");
      turnInto(b.id, tag);
      close();
    }
  });
}
function ImageItem(props) {
  var _a, _b, _c;
  const {
    tag,
    name,
    index
  } = props;
  const {
    addBlock,
    updateBlock,
    addChild,
    turnInto,
    blocks,
    deleteBlock,
    files_options,
    setFilesOptions
  } = useContext(EditorContext);
  const {
    close
  } = useContext(ModalsContext);
  const {
    block: b,
    active,
    setActive,
    selected
  } = useContext(CMContext$1);
  ["\u25BC", "UL", "OL"].includes(b.Type);
  let block = blocks.find((bl) => bl.id == b.id);
  let regex = /<{0,1}\/.[^<>\/\s]*/g;
  let matches = `${block.content}`.match(regex);
  let command = ((_c = (_b = (_a = matches == null ? void 0 : matches.filter((m) => !m.includes("</"))) == null ? void 0 : _a.reverse()) == null ? void 0 : _b[0]) != null ? _c : "").replace("/", "").replace("&nbsp;", "");
  async function dropFile(e) {
    var _a2, _b2;
    e == null ? void 0 : e.preventDefault();
    updateBlock(b.id, b.content);
    close();
    let droppedFiles = (_a2 = e == null ? void 0 : e.target) == null ? void 0 : _a2.files;
    if (droppedFiles) {
      var formData = new FormData();
      for (const file of droppedFiles) {
        formData.append("editor_files[]", file);
      }
      formData.append("model_type", files_options.data.model_type);
      formData.append("model_id", `${files_options.data.model_id}`);
      let stand_in = addChild(void 0, "file", {
        uuid: "placeholder",
        url: "placeholder"
      });
      try {
        let response = await (await axios.post(files_options == null ? void 0 : files_options.route, formData, {
          headers: {
            "Content-Type": "multipart/form-data"
          }
        })).data;
        let file = (_b2 = response.files) == null ? void 0 : _b2[0];
        setFilesOptions((o) => ({
          ...o,
          files: [...o.files, file]
        }));
        deleteBlock(stand_in);
        if (name == "Image/Video" && ["png", "jpg", "jpeg", "webp", "gif"].includes(file.extension))
          addChild(void 0, "\u{1F5BC}", {
            uuid: file.uuid,
            url: file.url
          });
        else if (name == "Image/Video" && ["mp4", "webm", "mkv", "avi", "flv", "mpeg"].includes(file.extension))
          addChild(void 0, "video", {
            uuid: file.uuid,
            url: file.url
          });
        else
          addChild(void 0, "file", {
            uuid: file.uuid,
            url: file.url
          });
      } catch (error) {
        deleteBlock(stand_in);
      }
    }
  }
  const edit = (e) => {
    document.getElementById("command-input").click();
  };
  const applyCommand = (e) => {
    if (e.key === "Enter" && selected == index) {
      e.preventDefault();
      edit();
    }
  };
  useEffect(() => {
    try {
      document.addEventListener("keyup", applyCommand);
    } catch (error) {
    }
    return () => {
      document.removeEventListener("keyup", applyCommand);
    };
  }, [active, selected]);
  useEffect(() => {
    setActive((a) => ({
      ...a,
      [index]: !command || includesAll(name.toLowerCase(), command.toLowerCase())
    }));
  }, [command]);
  return (!command || includesAll(name.toLowerCase(), command.toLowerCase())) && /* @__PURE__ */ jsx("div", {
    className: "relative",
    children: /* @__PURE__ */ jsxs("div", {
      className: `p-6px cursor-pointer  rounded-sm flex gap-16px items-center justify-between group ${selected == index ? "bg-app-mid text-white hover:bg-app-mid/30 hover:text-app-lighter" : "hover:bg-app-gray-B3B3B3/30"}`,
      children: [/* @__PURE__ */ jsxs("div", {
        className: "flex items-center gap-16px",
        children: [/* @__PURE__ */ jsx("div", {
          className: "w-30px h-30px  flex items-center justify-center",
          children: tag == "file" ? name == "CreateJS Embed" ? /* @__PURE__ */ jsx(FileJs, {}) : /* @__PURE__ */ jsx(FilePlus, {}) : /* @__PURE__ */ jsx(Image, {})
        }), /* @__PURE__ */ jsx("div", {
          className: "group-hover:underline",
          children: name
        })]
      }), /* @__PURE__ */ jsx("div", {
        className: "flex items-center gap-12px  cursor-pointer",
        children: /* @__PURE__ */ jsx("input", {
          id: "command-input",
          ...name == "CreateJS Embed" ? {
            accept: "application/zip"
          } : {},
          className: "w-full h-full absolute top-0 left-0 cursor-pointer opacity-0 bg-red-500/0",
          type: "file",
          onChange: dropFile
        })
      })]
    })
  });
}
const CMContext$1 = createContext({
  active: {
    0: true
  },
  setActive: (a) => null,
  selected: 0
});
const commands = [
  {
    T: MenuItem$2,
    tag: "H1",
    name: "Heading 1"
  },
  {
    T: MenuItem$2,
    tag: "H2",
    name: "Heading 2"
  },
  {
    T: MenuItem$2,
    tag: "H3",
    name: "Heading 3"
  },
  {
    T: MenuItem$2,
    tag: "H4",
    name: "Heading 4"
  },
  {
    T: MenuItem$2,
    tag: "H5",
    name: "Heading 5"
  },
  {
    T: MenuItem$2,
    tag: "P",
    name: "Paragraph"
  },
  {
    T: ListItem,
    tag: "OL",
    name: "Ordered list"
  },
  {
    T: ListItem,
    tag: "UL",
    name: "Unordered list"
  },
  {
    T: ImageItem,
    tag: "\u{1F5BC}",
    name: "Image/Video"
  },
  {
    T: ImageItem,
    tag: "file",
    name: "Attach File"
  }
];
function CommandMenu(props) {
  var _a, _b;
  const {
    position,
    block
  } = props;
  const [active, setActive] = useState({
    0: true
  });
  const [selected, setSelected] = useState(0);
  let smallest = () => {
    var _a2, _b2, _c;
    return parseInt((_c = (_b2 = (_a2 = Object.entries(active).filter(([i, a]) => a)) == null ? void 0 : _a2[0]) == null ? void 0 : _b2[0]) != null ? _c : "999");
  };
  const arrows = useCallback((e) => {
    let ordered = Object.entries(active).filter(([i, a]) => a).sort((a, b) => parseInt(a[0]) - parseInt(b[0]));
    let index = ordered.findIndex((f) => parseInt(f[0]) == selected);
    if (e.key == "ArrowUp")
      setSelected((s) => parseInt(ordered[Math.max(Math.min(index - 1, (ordered == null ? void 0 : ordered.length) - 1), 0)][0]));
    else if (e.key == "ArrowDown")
      setSelected((s) => parseInt(ordered[Math.max(Math.min(index + 1, (ordered == null ? void 0 : ordered.length) - 1), 0)][0]));
  }, [active, selected]);
  useEffect(() => {
    setSelected(smallest());
  }, [active]);
  useEffect(() => {
    document.addEventListener("keydown", arrows);
    return () => {
      document.removeEventListener("keydown", arrows);
    };
  }, [active, selected]);
  return /* @__PURE__ */ jsx(CMContext$1.Provider, {
    value: {
      block,
      active,
      setActive,
      selected
    },
    children: /* @__PURE__ */ jsx("div", {
      onMouseDown: (e) => e.stopPropagation(),
      className: "w-300px z-50 max-h-50vh overflow-y-auto overflow-x-hidden bg-white shadow-lg rounded p-12px absolute mt-30px text-black flex flex-col gap-6px  translate-y-30px",
      style: {
        top: (_a = position.y) != null ? _a : "40px",
        left: (_b = position.x) != null ? _b : "40px"
      },
      children: commands.map((C, i) => /* @__PURE__ */ jsx(C.T, {
        ...C,
        index: i
      }))
    })
  });
}
const Broom = (props) => /* @__PURE__ */ jsx("svg", {
  xmlns: "http://www.w3.org/2000/svg",
  width: "32",
  fill: "#000000",
  viewBox: "0 0 256 256",
  ...props,
  children: /* @__PURE__ */ jsx("path", {
    d: "M234.62,218.6C211.35,207.29,198,183,198,152V134.7a14,14,0,0,0-8.82-13l-24.89-9.83a10,10,0,0,1-5.59-13L180,45.9a26,26,0,0,0-15-34.33c-12.95-4.83-27.88,1.84-33.31,15l-21,53.11a10,10,0,0,1-13,5.61L72.37,75a13.9,13.9,0,0,0-15.2,3.19C36.49,99.42,26,124.26,26,152a109.53,109.53,0,0,0,30.62,76.16A6,6,0,0,0,61,230H232a6,6,0,0,0,2.62-11.4ZM65.77,86.52a2,2,0,0,1,2.12-.43l25.4,10.29a22,22,0,0,0,28.63-12.32l21-53c3-7.13,11-10.81,18-8.21a14,14,0,0,1,8,18.54l-21.36,53.1A22.05,22.05,0,0,0,159.86,123l24.88,9.83A2,2,0,0,1,186,134.7V152c0,1.34,0,2.65.08,4L52.74,102.61A110.07,110.07,0,0,1,65.77,86.52ZM114.33,218a89.6,89.6,0,0,1-25.5-43.5,6,6,0,1,0-11.62,3A102.87,102.87,0,0,0,97.81,218H63.56A97.56,97.56,0,0,1,38,152a87.42,87.42,0,0,1,8.71-38.86L187.35,169.4c3.15,19.92,11.77,36.66,25,48.6Z"
  })
});
function MenuItem$1({
  command,
  name
}) {
  useContext(EditorContext);
  useContext(ModalsContext);
  const form = useForm({
    name: "",
    selection: null
  });
  const {
    data,
    setData,
    reset
  } = form;
  const makeLink = (e) => {
    var _a;
    e.preventDefault();
    e.stopPropagation();
    window.getSelection().removeAllRanges();
    window.getSelection().addRange(data["selection"]);
    document == null ? void 0 : document.execCommand(command, false, data["link"]);
    if (((_a = window.getSelection().getRangeAt(0)) == null ? void 0 : _a.toString()) != data["name"])
      document == null ? void 0 : document.execCommand("insertText", false, data["name"]);
    reset();
  };
  return /* @__PURE__ */ jsxs(Fragment, {
    children: [/* @__PURE__ */ jsx("button", {
      className: "p-6px bg-white shadow-sm rounded flex gap-16px items-center justify-center hover:bg-app-gray-B3B3B3/30 group cursor-pointer h-40px w-40px",
      onClick: (e) => {
        e.preventDefault();
        e.stopPropagation();
        if (command == "createLink") {
          var selection = window.getSelection();
          setData((d) => {
            var _a, _b;
            return {
              ...d,
              name: (_b = (_a = selection == null ? void 0 : selection.getRangeAt(0)) == null ? void 0 : _a.toString()) != null ? _b : "",
              selection: selection.getRangeAt(0)
            };
          });
          return;
        }
        document == null ? void 0 : document.execCommand(command, false, null);
        if (command == "removeFormat")
          document == null ? void 0 : document.execCommand("unlink", false, null);
      },
      children: /* @__PURE__ */ jsx("div", {
        className: "group-hover:underline pointer-events-none",
        children: name
      })
    }), (data == null ? void 0 : data["name"]) && /* @__PURE__ */ jsxs(Form, {
      form,
      onSubmit: makeLink,
      className: "w-max z-50 bg-white shadow-lg rounded p-12px fixed mt-30px text-black flex flex-col gap-6px top-1/2 left-1/2 -translate-x-1/2 -translate-y-1/2 ",
      children: [/* @__PURE__ */ jsxs("h3", {
        className: "text-lg mob:text-base mb-8px font-semibold flex gap-12px items-center",
        children: [/* @__PURE__ */ jsx(Link, {}), " Add hyperlink ", /* @__PURE__ */ jsx(X, {
          onClick: (_) => reset(),
          className: "absolute right-10px cursor-pointer"
        })]
      }), /* @__PURE__ */ jsx(TextField, {
        name: "name",
        label: "Link name"
      }), /* @__PURE__ */ jsx(TextField, {
        name: "link",
        label: "Link URL (eg. http://lms.test/admin)"
      }), /* @__PURE__ */ jsx(Submit, {
        value: "Create Link",
        onClick: makeLink
      })]
    })]
  });
}
function StyleMenu(props) {
  var _a, _b;
  const {
    position,
    currentColor,
    bgColor
  } = props;
  return /* @__PURE__ */ jsx("div", {
    id: "style-menu",
    onMouseDown: (e) => e.stopPropagation(),
    onMouseUp: (e) => e.stopPropagation(),
    className: "w-min z-50 max-h-50% bg-white shadow-lg rounded p-12px absolute mt-30px text-black flex flex-col gap-6px translate-y-30px ",
    style: {
      top: (_a = position.y) != null ? _a : "40px",
      left: (_b = position.x) != null ? _b : "40px"
    },
    children: /* @__PURE__ */ jsxs("div", {
      className: "flex gap-8px",
      children: [/* @__PURE__ */ jsx(MenuItem$1, {
        command: "bold",
        name: "B"
      }), /* @__PURE__ */ jsx(MenuItem$1, {
        command: "italic",
        name: "I"
      }), /* @__PURE__ */ jsx(MenuItem$1, {
        command: "underline",
        name: "U"
      }), /* @__PURE__ */ jsx(MenuItem$1, {
        command: "strikethrough",
        name: "S"
      }), /* @__PURE__ */ jsx(MenuItem$1, {
        command: "removeFormat",
        name: /* @__PURE__ */ jsx(Broom, {
          width: 22
        })
      }), /* @__PURE__ */ jsx(MenuItem$1, {
        command: "createLink",
        name: /* @__PURE__ */ jsx(Link, {
          width: 22
        })
      })]
    })
  });
}
const useDebouncedCallback = (func, wait) => {
  const timeout = useRef();
  return useCallback((...args) => {
    const later = () => {
      clearTimeout(timeout.current);
      func(...args);
    };
    clearTimeout(timeout.current);
    try {
      timeout.current = window == null ? void 0 : window.setTimeout(later, wait);
    } catch (error) {
    }
  }, [func, wait]);
};
function MenuItem({
  tag,
  icon,
  name,
  index,
  onEdit,
  onNew
}) {
  var _a;
  const {
    addBlock,
    updateBlock,
    addChild,
    turnInto,
    blocks
  } = useContext(EditorContext);
  const {
    close
  } = useContext(ModalsContext);
  const {
    block: b,
    setActive,
    active,
    selected
  } = useContext(CMContext);
  blocks.find((bl) => bl.id == b.id);
  const edit = onEdit != null ? onEdit : (e) => {
    close();
  };
  const applyCommand = (e) => {
    if (e.key === "Enter" && selected == index) {
      e.preventDefault();
      edit(e);
    }
  };
  useEffect(() => {
    try {
      document.addEventListener("keyup", applyCommand);
    } catch (error) {
    }
    return () => {
      document.removeEventListener("keyup", applyCommand);
    };
  }, [active, selected]);
  useEffect(() => {
    setActive((a) => ({
      ...a,
      [index]: true
    }));
  }, []);
  return ((_a = active[index]) != null ? _a : true) && /* @__PURE__ */ jsxs("div", {
    className: `p-6px cursor-pointer  rounded-sm flex gap-16px items-center justify-between  group ${selected == index ? "bg-app-mid text-white hover:bg-app-mid/30 hover:text-app-lighter" : "hover:bg-app-gray-B3B3B3/30"} `,
    onClick: edit,
    children: [/* @__PURE__ */ jsxs("div", {
      className: "flex items-center gap-16px",
      children: [/* @__PURE__ */ jsx("div", {
        className: "w-30px h-30px  flex items-center justify-center font-semibold",
        children: icon != null ? icon : tag
      }), /* @__PURE__ */ jsx("div", {
        className: "group-hover:underline",
        children: name
      })]
    }), /* @__PURE__ */ jsx("div", {
      className: "flex items-center gap-12px  cursor-pointer"
    })]
  });
}
function DownloadItem({
  tag,
  icon,
  name,
  index,
  onEdit,
  onNew
}) {
  var _a, _b;
  const {
    addBlock,
    updateBlock,
    addChild,
    turnInto,
    blocks
  } = useContext(EditorContext);
  const {
    close
  } = useContext(ModalsContext);
  const {
    block: b,
    setActive,
    active,
    selected
  } = useContext(CMContext);
  const ref = useRef(null);
  let block = blocks.find((bl) => bl.id == b.id);
  const applyCommand = (e) => {
    var _a2;
    if (e.key === "Enter" && selected == index) {
      e.preventDefault();
      if (ref.current)
        (_a2 = ref == null ? void 0 : ref.current) == null ? void 0 : _a2.click();
      close();
    }
  };
  useEffect(() => {
    try {
      document.addEventListener("keyup", applyCommand);
    } catch (error) {
    }
    return () => {
      document.removeEventListener("keyup", applyCommand);
    };
  }, [active, selected]);
  useEffect(() => {
    setActive((a) => ({
      ...a,
      [index]: true
    }));
  }, []);
  return ((_a = active[index]) != null ? _a : true) && /* @__PURE__ */ jsxs("a", {
    ref,
    className: `menu-link p-6px cursor-pointer  rounded-sm flex gap-16px items-center justify-between  group ${selected == index ? "bg-app-mid text-white hover:bg-app-mid/30 hover:text-app-lighter" : "hover:bg-app-gray-B3B3B3/30"} `,
    download: true,
    href: (_b = block == null ? void 0 : block.content) == null ? void 0 : _b.url,
    children: [/* @__PURE__ */ jsxs("div", {
      className: "flex items-center gap-16px",
      children: [/* @__PURE__ */ jsx("div", {
        className: "w-30px h-30px  flex items-center justify-center font-semibold",
        children: icon != null ? icon : tag
      }), /* @__PURE__ */ jsx("div", {
        className: "group-hover:underline",
        children: name
      })]
    }), /* @__PURE__ */ jsx("div", {
      className: "flex items-center gap-12px  cursor-pointer"
    })]
  });
}
function TurnIntoItem({
  tag,
  icon,
  name,
  index,
  onEdit,
  onNew
}) {
  var _a;
  const {
    addBlock,
    updateBlock,
    addChild,
    turnInto,
    blocks
  } = useContext(EditorContext);
  useContext(ModalsContext);
  const {
    block: b,
    setActive,
    active,
    selected,
    subMenuOpen: open,
    setSubMenuOpen: setOpen
  } = useContext(CMContext);
  blocks.find((bl) => bl.id == b.id);
  const applyCommand = (e) => {
    if (e.key === "Enter" && selected == index) {
      e.preventDefault();
      setOpen(true);
    }
    if (e.key === "ArrowRight")
      setOpen(true);
    else if (e.key === "ArrowLeft")
      setOpen(false);
  };
  useEffect(() => {
    try {
      document.addEventListener("keyup", applyCommand);
    } catch (error) {
    }
    return () => {
      document.removeEventListener("keyup", applyCommand);
    };
  }, [active, selected]);
  useEffect(() => {
    setActive((a) => ({
      ...a,
      [index]: true
    }));
  }, []);
  return ((_a = active[index]) != null ? _a : true) && /* @__PURE__ */ jsxs("div", {
    className: `p-6px cursor-pointer relative  rounded-sm flex gap-16px items-center justify-between  group/turninto ${selected == index ? "bg-app-mid text-white hover:bg-app-mid/30 hover:text-app-lighter" : "hover:bg-app-gray-B3B3B3/30  "} `,
    onClick: (_) => setOpen((o) => !o),
    children: [/* @__PURE__ */ jsxs("div", {
      className: "flex items-center gap-16px",
      children: [/* @__PURE__ */ jsx("div", {
        className: "w-30px h-30px  flex items-center justify-center font-semibold",
        children: icon != null ? icon : tag
      }), /* @__PURE__ */ jsx("div", {
        className: "group-hover/turninto:underline",
        children: name
      })]
    }), /* @__PURE__ */ jsx("div", {
      className: "flex items-center gap-12px  cursor-pointer",
      children: /* @__PURE__ */ jsx(CaretRight, {})
    }), open && /* @__PURE__ */ jsx(SubMenu, {
      block: b
    })]
  });
}
const CMContext = createContext({
  active: {
    0: true
  },
  setActive: (a) => null,
  selected: 0,
  subMenuOpen: false,
  setSubMenuOpen: (o) => false
});
const subcommands = [{
  T: MenuItem,
  tag: "H1",
  name: "Heading 1"
}, {
  T: MenuItem,
  tag: "H2",
  name: "Heading 2"
}, {
  T: MenuItem,
  tag: "H3",
  name: "Heading 3"
}, {
  T: MenuItem,
  tag: "H4",
  name: "Heading 4"
}, {
  T: MenuItem,
  tag: "H5",
  name: "Heading 5"
}, {
  T: MenuItem,
  tag: "P",
  name: "Paragraph"
}, {
  T: MenuItem,
  tag: "OL",
  name: "Ordered list"
}, {
  T: MenuItem,
  tag: "UL",
  name: "Unordered list"
}];
function EditMenu(props) {
  var _a, _b;
  const {
    position,
    block
  } = props;
  const [active, setActive] = useState({
    0: true
  });
  const [selected, setSelected] = useState(0);
  const [subMenuOpen, setSubMenuOpen] = useState(false);
  const {
    updateBlock,
    turnInto,
    addChild,
    deleteBlock,
    setBlocks
  } = useContext(EditorContext);
  const {
    close
  } = useContext(ModalsContext);
  const commands2 = [...[{
    T: TurnIntoItem,
    icon: /* @__PURE__ */ jsx(ArrowsClockwise, {}),
    name: "Turn into"
  }], {
    T: MenuItem,
    icon: /* @__PURE__ */ jsx(Trash, {}),
    name: "Delete",
    onEdit: () => {
      deleteBlock(block.id);
      close();
    }
  }, {
    T: MenuItem,
    icon: /* @__PURE__ */ jsx(Copy, {}),
    name: "Duplicate",
    onEdit: () => {
      setBlocks((_blocks) => {
        return [..._blocks, {
          ...block,
          id: Math.floor(Math.random() * 1e7)
        }];
      });
      close();
    }
  }, ...["file", "video", "\u{1F5BC}"].includes(block.Type) ? [{
    T: DownloadItem,
    icon: /* @__PURE__ */ jsx(DownloadSimple, {}),
    name: "Download"
  }] : []];
  let smallest = () => {
    var _a2, _b2, _c;
    return parseInt((_c = (_b2 = (_a2 = Object.entries(active).filter(([i, a]) => a)) == null ? void 0 : _a2[0]) == null ? void 0 : _b2[0]) != null ? _c : "999");
  };
  const arrows = useCallback((e) => {
    if (subMenuOpen)
      return;
    let ordered = Object.entries(active).filter(([i, a]) => a).sort((a, b) => parseInt(a[0]) - parseInt(b[0]));
    let index = ordered.findIndex((f) => parseInt(f[0]) == selected);
    if (e.key == "ArrowUp") {
      e.preventDefault();
      setSelected((s) => parseInt(ordered[Math.max(Math.min(index - 1, (ordered == null ? void 0 : ordered.length) - 1), 0)][0]));
    } else if (e.key == "ArrowDown") {
      e.preventDefault();
      setSelected((s) => parseInt(ordered[Math.max(Math.min(index + 1, (ordered == null ? void 0 : ordered.length) - 1), 0)][0]));
    }
  }, [active, selected, subMenuOpen]);
  useEffect(() => {
    setSelected(smallest());
  }, [active]);
  useEffect(() => {
    document.addEventListener("keydown", arrows);
    return () => {
      document.removeEventListener("keydown", arrows);
    };
  }, [active, selected, subMenuOpen]);
  return /* @__PURE__ */ jsx(CMContext.Provider, {
    value: {
      block,
      active,
      setActive,
      selected,
      subMenuOpen,
      setSubMenuOpen
    },
    children: /* @__PURE__ */ jsx("div", {
      onClick: (e) => e.stopPropagation(),
      onMouseDown: (e) => e.stopPropagation(),
      className: "w-300px z-50 max-h-50vh  bg-white shadow-lg rounded p-12px absolute mt-30px text-black flex flex-col gap-6px  translate-y-30px",
      style: {
        top: (_a = position.y) != null ? _a : "40px",
        left: (_b = position.x) != null ? _b : "40px"
      },
      children: commands2.map((C, i) => /* @__PURE__ */ jsx(C.T, {
        ...C,
        index: i
      }))
    })
  });
}
function SubMenu(props) {
  var _a;
  const {
    block
  } = props;
  const [active, setActive] = useState({
    0: true
  });
  const [selected, setSelected] = useState(0);
  const {
    updateBlock,
    turnInto,
    addChild,
    files_options
  } = useContext(EditorContext);
  const {
    close
  } = useContext(ModalsContext);
  const files = (_a = files_options == null ? void 0 : files_options.files) != null ? _a : [];
  let smallest = () => {
    var _a2, _b, _c;
    return parseInt((_c = (_b = (_a2 = Object.entries(active).filter(([i, a]) => a)) == null ? void 0 : _a2[0]) == null ? void 0 : _b[0]) != null ? _c : "999");
  };
  const arrows = useCallback((e) => {
    let ordered = Object.entries(active).filter(([i, a]) => a).sort((a, b) => parseInt(a[0]) - parseInt(b[0]));
    let index = ordered.findIndex((f) => parseInt(f[0]) == selected);
    if (e.key == "ArrowUp") {
      e.preventDefault();
      setSelected((s) => parseInt(ordered[Math.max(Math.min(index - 1, (ordered == null ? void 0 : ordered.length) - 1), 0)][0]));
    } else if (e.key == "ArrowDown") {
      e.preventDefault();
      setSelected((s) => parseInt(ordered[Math.max(Math.min(index + 1, (ordered == null ? void 0 : ordered.length) - 1), 0)][0]));
    }
  }, [active, selected]);
  useEffect(() => {
    setSelected(smallest());
  }, [active]);
  useEffect(() => {
    document.addEventListener("keydown", arrows);
    return () => {
      document.removeEventListener("keydown", arrows);
    };
  }, [active, selected]);
  let cmds = [];
  switch (block.Type) {
    case "\u{1F5BC}":
    case "video":
      cmds = [{
        T: MenuItem,
        tag: "file",
        name: "File attachment",
        icon: /* @__PURE__ */ jsx(File, {})
      }];
      break;
    case "file": {
      let file = files == null ? void 0 : files.find((f) => {
        var _a2;
        return f.uuid == ((_a2 = block.content) == null ? void 0 : _a2.uuid);
      });
      if (["mp4", "webm", "mkv", "avi", "flv", "mpeg"].includes(file.extension))
        cmds.push({
          T: MenuItem,
          tag: "video",
          name: "Video",
          icon: /* @__PURE__ */ jsx(FileVideo, {})
        });
      if (["png", "jpg", "jpeg", "webp", "gif"].includes(file.extension))
        cmds.push({
          T: MenuItem,
          tag: "\u{1F5BC}",
          name: "Image",
          icon: /* @__PURE__ */ jsx(Image, {})
        });
      break;
    }
    default:
      cmds = subcommands;
      break;
  }
  return /* @__PURE__ */ jsx(CMContext.Provider, {
    value: {
      block,
      active,
      setActive,
      selected,
      subMenuOpen: false,
      setSubMenuOpen: (a) => false
    },
    children: /* @__PURE__ */ jsx("div", {
      className: "w-300px z-50 max-h-50vh overflow-y-auto overflow-x-hidden bg-white shadow-lg rounded p-12px absolute text-black flex flex-col gap-6px -top-12px -right-14px translate-x-full",
      children: cmds.map((C, i) => /* @__PURE__ */ jsx(C.T, {
        ...C,
        index: i,
        onEdit: (e) => {
          if (["UL", "OL"].includes(C.tag)) {
            addChild(block.id, "LI", block.content);
            updateBlock(block.id, "");
            turnInto(block.id, C.tag);
          } else {
            updateBlock(block.id, block.content);
            turnInto(block.id, C.tag);
          }
          close();
        }
      }))
    })
  });
}
function usePrevious(value) {
  const ref = useRef();
  useEffect(() => {
    ref.current = value;
  }, [value]);
  return ref.current;
}
function EditorSection(props) {
  const {
    name,
    files_options
  } = props;
  const {
    blocks,
    addBlock,
    deleteBlock,
    addChild,
    setBlocks,
    selected,
    setSelected,
    undo,
    redo,
    pushState: pS,
    clearRedo,
    setInitialized,
    setFilesOptions
  } = useContext(EditorContext);
  const {
    setData,
    data
  } = useContext(FormContext);
  const {
    open,
    modal,
    close
  } = useContext(ModalsContext);
  const deleteSelected = useDebouncedCallback((e) => {
    if (selected.length > 1 && (e.key == "Backspace" || e.key === "Delete")) {
      e.preventDefault();
      for (const id of selected) {
        deleteBlock(id);
      }
      setSelected([]);
    }
    if (e.key.toLowerCase() == "z" && e.ctrlKey && e.shiftKey) {
      e.preventDefault();
      redo();
    } else if (e.key.toLowerCase() == "z" && e.ctrlKey) {
      e.preventDefault();
      undo();
    } else if (!e.ctrlKey && !e.shiftKey) {
      clearRedo();
    }
  }, 100);
  const showStyles = (e) => {
    if (!props.readOnly) {
      setTimeout(() => {
        var _a, _b, _c, _d;
        try {
          let range = (_a = window == null ? void 0 : window.getSelection()) == null ? void 0 : _a.getRangeAt(0);
          const contenteditable = document.getElementById("contenteditor");
          const styles = document.getElementById("style-menu");
          if (((_c = (_b = range == null ? void 0 : range.toString()) == null ? void 0 : _b.length) != null ? _c : 0) > 0 && ((_d = range == null ? void 0 : range.toString()) == null ? void 0 : _d.charCodeAt(0)) != 160 && e.target && contenteditable.contains(e.target)) {
            let color = e.target.style.color ? e.target.style.color : "black";
            let bgcolor = e.target.style.backgroundColor ? e.target.style.backgroundColor : "transparent";
            let anchor = document.getElementById("editor-container").getBoundingClientRect();
            let pos = getCaretCoordinates();
            open(MODALS.STYLES, false, {
              position: {
                x: pos.x - anchor.x,
                y: pos.y - anchor.y
              },
              currentColor: color,
              bgColor: bgcolor
            });
          } else if ((modal == null ? void 0 : modal.modal) == MODALS.STYLES) {
            close();
          }
        } catch (error) {
          if ((modal == null ? void 0 : modal.modal) == MODALS.STYLES)
            close();
        }
      }, 100);
    }
  };
  useEffect(() => {
    document.addEventListener("keydown", deleteSelected);
    document.addEventListener("mouseup", showStyles);
    return () => {
      document.removeEventListener("keydown", deleteSelected);
      document.removeEventListener("mouseup", showStyles);
    };
  }, [selected, modal, undo, redo]);
  const closeIfClicked = () => {
    if ((modal == null ? void 0 : modal.modal) == MODALS.EDITOR_EDIT || (modal == null ? void 0 : modal.modal) == MODALS.COMMANDS)
      close();
  };
  useEffect(() => {
    var _a;
    try {
      let blocks2 = typeof ((_a = data[name]) != null ? _a : []) == "string" ? JSON.parse(data[name]) : data[name];
      if (Array.isArray(blocks2) && blocks2.length > 0)
        setBlocks(blocks2);
      else
        setBlocks([{
          id: 1,
          content: "",
          Type: "p"
        }]);
      setInitialized(true);
    } catch (error) {
      setBlocks([{
        id: 1,
        content: typeof data[name] == "string" ? data[name] : "",
        Type: "p"
      }]);
      setInitialized(true);
    }
    return () => {
    };
  }, []);
  useEffect(() => {
    document.addEventListener("mousedown", closeIfClicked);
    return () => {
      document.removeEventListener("mousedown", closeIfClicked);
    };
  }, [modal]);
  const pushState = useDebouncedCallback(useCallback((_blocks) => {
    pS(_blocks);
  }, [pS]), 300);
  useEffect(() => {
    if (blocks && setData) {
      setData((d) => ({
        ...d,
        [name]: blocks
      }));
      if (blocks.length > 0)
        pushState(blocks);
    }
  }, [blocks]);
  const lastNotEmpty = () => {
    let _last = blocks == null ? void 0 : blocks[blocks.length - 1];
    if (!_last || (_last == null ? void 0 : _last.content) != "")
      addBlock();
    else {
      let t = _last.Type;
      deleteBlock(_last.id);
      addBlock(t);
    }
  };
  function prevent(e) {
    e.preventDefault();
    e.stopPropagation();
  }
  async function dropFile(e) {
    var _a, _b, _c, _d;
    prevent(e);
    let droppedFiles = (_a = e == null ? void 0 : e.dataTransfer) == null ? void 0 : _a.files;
    if (droppedFiles) {
      var formData = new FormData();
      for (const file of droppedFiles) {
        formData.append("editor_files[]", file);
      }
      formData.append("model_type", (_b = files_options == null ? void 0 : files_options.data) == null ? void 0 : _b.model_type);
      formData.append("model_id", `${(_c = files_options == null ? void 0 : files_options.data) == null ? void 0 : _c.model_id}`);
      let stand_in = addChild(void 0, "file", {
        uuid: "placeholder",
        url: "placeholder"
      });
      try {
        let response = await (await axios.post(files_options == null ? void 0 : files_options.route, formData, {
          headers: {
            "Content-Type": "multipart/form-data"
          }
        })).data;
        let file = (_d = response.files) == null ? void 0 : _d[0];
        setFilesOptions((o) => ({
          ...o,
          files: [...o.files, file]
        }));
        deleteBlock(stand_in);
        if (["png", "jpg", "jpeg", "webp", "gif"].includes(file.extension))
          addChild(void 0, "\u{1F5BC}", {
            uuid: file.uuid,
            url: file.url
          });
        else if (["mp4", "webm", "mkv", "avi", "flv", "mpeg"].includes(file.extension))
          addChild(void 0, "video", {
            uuid: file.uuid,
            url: file.url
          });
        else
          addChild(void 0, "file", {
            uuid: file.uuid,
            url: file.url
          });
      } catch (error) {
        deleteBlock(stand_in);
      }
    }
  }
  return /* @__PURE__ */ jsx("section", {
    id: "contenteditor",
    className: `max-w-full  outline-none cursor-text h-full overflow-auto overflow-x-hidden pb-80px`,
    onClick: lastNotEmpty,
    onDrag: prevent,
    onDragStart: prevent,
    onDragEnd: prevent,
    onDragOver: prevent,
    onDragEnter: prevent,
    onDragLeave: prevent,
    onDrop: dropFile,
    children: /* @__PURE__ */ jsx("div", {
      onClick: (e) => e.stopPropagation(),
      className: "flex flex-col gap-4px",
      children: blocks == null ? void 0 : blocks.filter((b) => !b.parent_id && b.parent_id !== 0).map((b) => /* @__PURE__ */ jsx(Block, {
        ...b,
        contenteditable: !(props == null ? void 0 : props.readOnly)
      }, `block-wrap-${b.id}`))
    })
  });
}
function getCaretCoordinates() {
  let x = 0, y = 0;
  const isSupported = typeof window.getSelection !== "undefined";
  if (isSupported) {
    const selection = window.getSelection();
    if (selection.rangeCount !== 0) {
      const range = selection.getRangeAt(0).cloneRange();
      range.collapse(true);
      const rect = range.getClientRects()[0];
      if (rect) {
        x = rect.left;
        y = rect.top;
      }
    }
  }
  return {
    x,
    y
  };
}
function LoadingCard() {
  return /* @__PURE__ */ jsxs("div", {
    className: "bg-app-gray-F2F2F2 rounded p-8px flex gap-12px mb-12px cursor-pointer animate-pulse",
    children: [/* @__PURE__ */ jsx("div", {
      className: "w-48px h-48px rounded-full bg-app-lighter text-white flex items-center justify-center",
      children: /* @__PURE__ */ jsx(CloudArrowUp, {})
    }), /* @__PURE__ */ jsx("div", {
      className: "flex items-center",
      children: /* @__PURE__ */ jsx("div", {
        className: "flex gap-12px ",
        children: "Uploading..."
      })
    })]
  });
}
function FileLoad({
  children,
  files,
  _content
}) {
  let file = files == null ? void 0 : files.find((f) => f.uuid == (_content == null ? void 0 : _content.uuid));
  return file ? children : /* @__PURE__ */ jsx(LoadingCard, {});
}
const setCaretToEnd = (element) => {
  try {
    const range = document == null ? void 0 : document.createRange();
    const selection = window == null ? void 0 : window.getSelection();
    range.selectNodeContents(element);
    range.collapse(false);
    selection.removeAllRanges();
    selection.addRange(range);
    element.focus();
  } catch (error) {
  }
};
function Block(props) {
  const {
    Type,
    content,
    id,
    parent_id,
    options,
    contenteditable: ced
  } = props;
  const {
    setBlocks,
    blocks,
    addBlock,
    updateBlock,
    deleteBlock,
    addChild,
    turnInto,
    files_options,
    selected,
    setSelected,
    initialized
  } = useContext(EditorContext);
  const files = files_options == null ? void 0 : files_options.files;
  const {
    open,
    close,
    modal
  } = useContext(ModalsContext);
  const [dragging, setDragging] = useState(false);
  const [contenteditable, setContentEditable] = useState(ced);
  const children = blocks.filter((b) => b.parent_id == id);
  const block_ref = useRef(null);
  const container_ref = useRef(null);
  const processInput = (e) => {
    var _a;
    if (Type != "\u{1F5BC}" && Type != "file" && Type != "video") {
      let value = (_a = e == null ? void 0 : e.target) == null ? void 0 : _a.value;
      updateBlock(id, value);
    }
  };
  const onKeyDown = (e) => {
    var _a, _b;
    if (["UL", "OL"].includes(Type))
      return;
    if (e.key === "Enter" && !e.shiftKey) {
      e.preventDefault();
      let b = blocks.find((b2) => b2.id == id);
      if ((modal == null ? void 0 : modal.modal) == MODALS.COMMANDS)
        return;
      if (Type != "P" && Type != "\u25BC" && b.content == "") {
        let p = blocks.find((b2) => b2.id == parent_id);
        deleteBlock(id);
        addChild(p == null ? void 0 : p.parent_id, "P", "", parent_id);
        return;
      }
      switch (Type.toLowerCase()) {
        case "\u25BC":
          addChild(id, "P", "", id);
          updateBlock(id, b.content, {
            ...(_a = b == null ? void 0 : b.options) != null ? _a : {},
            open: true
          });
          break;
        case "ul":
        case "ol":
          break;
        case "li":
        case "\u2610":
          addChild(parent_id, Type, "", id);
          break;
        default:
          addChild(parent_id, "P", "", id);
          break;
      }
    }
    if (e.key === "Backspace" || e.key === "Delete") {
      let ct = blocks.find((b) => b.id == id).content;
      if (ct == "" || Type == "\u{1F5BC}" || Type == "file" || Type == "video") {
        e.preventDefault();
        let previous = (_b = block_ref == null ? void 0 : block_ref.current) == null ? void 0 : _b.previousElementSibling;
        previous == null ? void 0 : previous.focus();
        setCaretToEnd(previous);
        deleteBlock(id);
        close();
      } else if (typeof ct == "string" && (ct == null ? void 0 : ct.endsWith("/")))
        close();
    }
    if (Type == "\u{1F5BC}" || Type == "file" || Type == "video") {
      e.preventDefault();
      return;
    }
    if (e.key === "/") {
      let span = document.createElement("span");
      e.target.appendChild(span);
      let pos = span.getBoundingClientRect();
      let anchor = document.getElementById("editor-container").getBoundingClientRect();
      span.remove();
      let b = blocks.find((b2) => b2.id == id);
      open(MODALS.COMMANDS, false, {
        position: {
          x: pos.x - anchor.x,
          y: pos.y - anchor.y
        },
        block: {
          ...b
        }
      });
    }
  };
  const selectStart = useCallback(useThrottle((e) => {
    var _a, _b, _c, _d, _e;
    try {
      if (((_d = (_c = (_b = (_a = window == null ? void 0 : window.getSelection()) == null ? void 0 : _a.getRangeAt(0)) == null ? void 0 : _b.toString()) == null ? void 0 : _c.length) != null ? _d : 0) > 0) {
        let contains = (_e = window == null ? void 0 : window.getSelection()) == null ? void 0 : _e.containsNode(block_ref.current, ["UL", "OL"].includes(Type) ? false : true);
        if (contains) {
          setSelected((s) => s.includes(id) ? s : [...s, id]);
        }
      } else {
        setSelected([]);
      }
    } catch (error) {
      setSelected([]);
    }
  }, 100), [block_ref.current, blocks]);
  useEffect(() => {
    var _a, _b, _c;
    if (initialized) {
      if (Type == "OL" || Type == "UL") {
        let ch = (_b = (_a = block_ref == null ? void 0 : block_ref.current) == null ? void 0 : _a.getElementsByTagName("li")) == null ? void 0 : _b[0];
        ch == null ? void 0 : ch.focus();
        setCaretToEnd(ch);
      } else {
        (_c = block_ref == null ? void 0 : block_ref.current) == null ? void 0 : _c.focus();
        setCaretToEnd(block_ref == null ? void 0 : block_ref.current);
      }
      return () => {
      };
    }
  }, [Type]);
  const leaveMouse = (e) => {
    if (e.buttons > 0)
      setContentEditable(false);
  };
  useEffect(() => {
    var _a, _b, _c;
    let observer = new ResizeObserver(function(mutations) {
      setSize({
        shiftKey: false
      });
    });
    if (container_ref.current)
      observer.observe(container_ref.current);
    document.addEventListener("selectionchange", selectStart);
    (_a = block_ref == null ? void 0 : block_ref.current) == null ? void 0 : _a.addEventListener("keydown", onKeyDown);
    (_b = block_ref == null ? void 0 : block_ref.current) == null ? void 0 : _b.addEventListener("mousedown", () => setContentEditable(true));
    (_c = block_ref == null ? void 0 : block_ref.current) == null ? void 0 : _c.addEventListener("mouseleave", leaveMouse);
    return () => {
      var _a2, _b2, _c2;
      document.removeEventListener("selectionchange", selectStart);
      (_a2 = block_ref == null ? void 0 : block_ref.current) == null ? void 0 : _a2.removeEventListener("keydown", onKeyDown);
      (_b2 = block_ref == null ? void 0 : block_ref.current) == null ? void 0 : _b2.removeEventListener("mousedown", () => setContentEditable(true));
      (_c2 = block_ref == null ? void 0 : block_ref.current) == null ? void 0 : _c2.removeEventListener("mouseleave", leaveMouse);
    };
  }, [block_ref == null ? void 0 : block_ref.current, modal, blocks, container_ref == null ? void 0 : container_ref.current, selected]);
  const updateThrottle = useDebouncedCallback((e) => {
    setDragging((d) => {
      var _a, _b;
      if (d)
        updateBlock(id, content, {
          width: parseInt((_a = container_ref == null ? void 0 : container_ref.current) == null ? void 0 : _a.style.width),
          height: (e == null ? void 0 : e.shiftKey) ? null : parseInt((_b = container_ref == null ? void 0 : container_ref.current) == null ? void 0 : _b.style.height)
        });
      return false;
    });
  }, 300);
  const setSize = (e) => {
    if (Type == "\u{1F5BC}" || Type == "video" || Type == "file")
      updateThrottle(e);
  };
  const checkIfHasParent = () => {
    let parent = blocks.find((b) => b.id == parent_id);
    if (Type == "LI" && (!parent || !["OL", "UL"].includes(parent.Type)))
      turnInto(id, "P");
    else if (Type != "LI" && parent && ["OL", "UL"].includes(parent.Type))
      turnInto(id, "LI");
    files == null ? void 0 : files.find((f) => f.uuid == (content == null ? void 0 : content.uuid));
  };
  checkIfHasParent();
  const Blk = () => {
    var _a, _b, _c, _d, _e, _f;
    switch (Type == null ? void 0 : Type.toLowerCase()) {
      case "h1":
      case "h2":
      case "h3":
        return /* @__PURE__ */ jsx(CE, {
          contentEditable: contenteditable,
          placeholder: "Type '/' for commands",
          ref: block_ref,
          onChange: processInput,
          className: `w-full font-semibold outline-none p-6px rounded-sm hover:hover:hover:bg-gray-500/5  text-${Type == null ? void 0 : Type.toLowerCase()}`,
          html: content,
          tagName: Type == null ? void 0 : Type.toLowerCase()
        }, `block-${id}`);
      case "\u2610":
        return /* @__PURE__ */ jsxs("div", {
          className: "w-full hover:hover:bg-gray-500/5 rounded-sm outline-none p-6px flex gap-12px items-center",
          children: [/* @__PURE__ */ jsx("input", {
            type: "checkbox",
            name: `cb-${id}`,
            checked: (options == null ? void 0 : options.checked) === true,
            onChange: (e) => updateBlock(id, content, {
              checked: e.target.checked
            })
          }), /* @__PURE__ */ jsx(CE, {
            contentEditable: contenteditable,
            placeholder: "Type '/' for commands",
            ref: block_ref,
            onChange: processInput,
            className: "w-full h-full flex outline-none",
            html: content,
            tagName: "div"
          })]
        }, `block-${id}`);
      case "\u{1F5BC}":
        return /* @__PURE__ */ jsx(FileLoad, {
          files,
          _content: content,
          children: /* @__PURE__ */ jsxs("div", {
            ref: container_ref,
            className: `relative resize-x overflow-hidden max-w-full rounded-sm outline-none ${(selected == null ? void 0 : selected.includes(id)) ? "bg-blue-500" : "hover:bg-gray-500/5"} p-6px grid grid-cols-1 grid-rows-1`,
            style: {
              width: (options == null ? void 0 : options.width) ? (options == null ? void 0 : options.width) + "px" : "auto",
              height: (options == null ? void 0 : options.height) ? options.height + "px" : "auto"
            },
            onMouseDown: (_) => setDragging(true),
            onClick: (_) => setSelected((s) => s.includes(id) ? s : [...s, id]),
            children: [/* @__PURE__ */ jsx(CE, {
              contentEditable: contenteditable,
              ref: block_ref,
              placeholder: "Type '/' for commands",
              onChange: processInput,
              className: `absolute w-full h-full text-right outline-none ring-0`,
              html: "<span>\xA0</span>",
              tagName: "div"
            }, `block-${id}`), /* @__PURE__ */ jsx(Img, {
              src: (_a = files == null ? void 0 : files.find((f) => f.uuid == (content == null ? void 0 : content.uuid))) != null ? _a : content,
              className: "w-full h-full col-start-1 row-start-1 pointer-events-none select-none"
            })]
          })
        });
      case "video":
        return /* @__PURE__ */ jsx(FileLoad, {
          files,
          _content: content,
          children: /* @__PURE__ */ jsxs("div", {
            ref: container_ref,
            className: `relative resize-x overflow-hidden max-w-full rounded-sm outline-none  p-6px grid grid-cols-1 grid-rows-1 ${(selected == null ? void 0 : selected.includes(id)) ? "bg-blue-500" : "hover:bg-gray-500/5"} `,
            style: {
              width: (options == null ? void 0 : options.width) ? (options == null ? void 0 : options.width) + "px" : "auto",
              height: (options == null ? void 0 : options.height) ? options.height + "px" : "auto"
            },
            onMouseDown: (_) => setDragging(true),
            onClick: (_) => setSelected((s) => s.includes(id) ? s : [...s, id]),
            children: [/* @__PURE__ */ jsx(CE, {
              contentEditable: contenteditable,
              ref: block_ref,
              placeholder: "Type '/' for commands",
              onChange: processInput,
              className: `absolute w-full h-full text-right outline-none ring-0`,
              html: "<span>\xA0</span>",
              tagName: "div"
            }, `block-${id}`), /* @__PURE__ */ jsx("video", {
              controls: true,
              src: (_c = (_b = files == null ? void 0 : files.find((f) => f.uuid == (content == null ? void 0 : content.uuid))) == null ? void 0 : _b.url) != null ? _c : content,
              className: "w-full h-full col-start-1 row-start-1"
            })]
          })
        });
      case "file": {
        let file = (_d = files == null ? void 0 : files.find((f) => f.uuid == (content == null ? void 0 : content.uuid))) != null ? _d : content;
        return (options == null ? void 0 : options.as) == "embed" && file.extension == "zip" ? /* @__PURE__ */ jsx(FileLoad, {
          files,
          _content: content,
          children: /* @__PURE__ */ jsxs("div", {
            ref: container_ref,
            className: `relative resize-x overflow-hidden max-w-full rounded-sm outline-none  p-6px grid grid-cols-1 grid-rows-1 ${(selected == null ? void 0 : selected.includes(id)) ? "bg-blue-500" : "hover:bg-gray-500/5"} `,
            style: {
              width: (options == null ? void 0 : options.width) ? (options == null ? void 0 : options.width) + "px" : "auto"
            },
            onMouseDown: (_) => setDragging(true),
            onClick: (_) => setSelected((s) => s.includes(id) ? s : [...s, id]),
            children: [/* @__PURE__ */ jsx(CE, {
              contentEditable: contenteditable,
              ref: block_ref,
              placeholder: "Type '/' for commands",
              onChange: processInput,
              className: `absolute w-full h-full text-right outline-none ring-0 z-0`,
              html: "<span>\xA0</span>",
              tagName: "div"
            }, `block-${id}`), /* @__PURE__ */ jsx(EmbedCard, {
              ...(_e = files == null ? void 0 : files.find((f) => f.uuid == (content == null ? void 0 : content.uuid))) != null ? _e : content
            })]
          })
        }) : /* @__PURE__ */ jsx(FileLoad, {
          files,
          _content: content,
          children: /* @__PURE__ */ jsxs("div", {
            ref: container_ref,
            className: `relative flex-grow`,
            onClick: (_) => setSelected((s) => s.includes(id) ? s : [...s, id]),
            children: [/* @__PURE__ */ jsx(CE, {
              contentEditable: contenteditable,
              ref: block_ref,
              placeholder: "Type '/' for commands",
              onChange: processInput,
              className: `absolute w-full h-full text-right outline-none ring-0`,
              html: "",
              tagName: "div"
            }, `block-${id}`), /* @__PURE__ */ jsx(FileCard, {
              ...(_f = files == null ? void 0 : files.find((f) => f.uuid == (content == null ? void 0 : content.uuid))) != null ? _f : content
            })]
          })
        });
      }
      case "\u25BC":
        return /* @__PURE__ */ jsx(Toggle, {
          block: props,
          options,
          contentStyles: "pl-24px flex flex-col gap-6px",
          title: /* @__PURE__ */ jsx(CE, {
            contentEditable: contenteditable,
            placeholder: "Type '/' for commands",
            ref: block_ref,
            onChange: processInput,
            className: "w-full h-full flex outline-none",
            html: content,
            tagName: "div"
          }),
          children: children == null ? void 0 : children.map((c) => /* @__PURE__ */ jsx(Block, {
            ...c,
            contenteditable
          }, `child-${id}-${c.id}`))
        }, `block-${id}`);
      case "ul":
        return /* @__PURE__ */ jsx("ul", {
          ref: block_ref,
          className: "unordered ml-20px flex flex-col gap-6px",
          children: children == null ? void 0 : children.map((c) => /* @__PURE__ */ jsx(Block, {
            ...c,
            contenteditable
          }, `child-${id}-${c.id}`))
        });
      case "ol":
        return /* @__PURE__ */ jsx("ol", {
          ref: block_ref,
          className: "list-decimal ml-20px flex flex-col gap-6px",
          children: children == null ? void 0 : children.map((c) => /* @__PURE__ */ jsx(Block, {
            ...c,
            contenteditable
          }, `child-${id}-${c.id}`))
        });
      case "li":
        return /* @__PURE__ */ jsx(CE, {
          contentEditable: contenteditable,
          placeholder: "Type '/' for commands",
          ref: block_ref,
          onChange: processInput,
          className: `nested w-full  rounded-sm outline-none  p-6px  ${content ? "hover:hover:bg-gray-500/5" : "hover:bg-gray-500/5"}`,
          html: content,
          tagName: Type == null ? void 0 : Type.toLowerCase()
        }, `block-${id}`);
      default:
        return /* @__PURE__ */ jsx(CE, {
          contentEditable: contenteditable,
          ref: block_ref,
          placeholder: "Type '/' for commands",
          onChange: processInput,
          className: `w-full block break-words  rounded-sm outline-none  p-6px  ${content ? "hover:hover:bg-gray-500/5" : "hover:hover:bg-gray-500/5"}`,
          html: content,
          tagName: "p"
        }, `block-${id}`);
    }
  };
  return /* @__PURE__ */ jsxs("div", {
    className: "relative group overflow-visible flex",
    children: [!["UL", "OL"].includes(Type) && /* @__PURE__ */ jsxs("div", {
      className: `w-50px flex opacity-0  left-0 pt-6px text-app-gray-999999 group-hover:opacity-100 z-max ${Type == "LI" && "mr-20px"}`,
      children: [/* @__PURE__ */ jsx("div", {
        className: "w-24px h-24px hover:bg-app-gray-E6E6E6 flex items-center justify-center rounded-full cursor-pointer",
        onClick: () => {
          switch (Type.toLowerCase()) {
            case "ul":
            case "ol":
              break;
            case "li":
            case "\u2610":
              addChild(parent_id, Type, "", id);
              break;
            default:
              addChild(parent_id, "P", "", id);
              break;
          }
        },
        children: /* @__PURE__ */ jsx(Plus, {
          size: 18
        })
      }), /* @__PURE__ */ jsx("div", {
        className: "w-24px h-24px hover:bg-app-gray-E6E6E6 flex items-center justify-center rounded-full cursor-pointer",
        onClick: (e) => {
          let anchor = document.getElementById("editor-container").getBoundingClientRect();
          open(MODALS.EDITOR_EDIT, false, {
            position: {
              x: e.clientX - anchor.x,
              y: e.clientY - anchor.y
            },
            block: {
              ...props
            }
          });
        },
        children: /* @__PURE__ */ jsx(DotsSixVertical, {
          size: 18
        })
      })]
    }), Blk()]
  });
}
function EmbedCard(props) {
  const {
    file_name,
    url,
    size,
    human_size,
    uuid,
    extension,
    remove = false,
    active = false
  } = props;
  const ref = useRef(null);
  return /* @__PURE__ */ jsx("iframe", {
    ref,
    className: "w-full aspect-video z-50",
    src: `${url.replace(".zip", "")}/index.html`,
    scrolling: "no",
    frameBorder: "0"
  });
}
const CE = React__default.forwardRef((props, ref) => {
  var _a, _b, _c, _d;
  const {
    placeholder,
    ...rest
  } = props;
  const lastHtml = usePrevious(rest.html);
  function stripHtml(html) {
    let doc = new DOMParser().parseFromString(html, "text/html");
    return doc.body.textContent || "";
  }
  let Wrapper = ((_a = stripHtml(rest.html)) == null ? void 0 : _a.length) == 0 ? "div" : React__default.Fragment;
  useEffect(() => {
    var _a2, _b2, _c2;
    if (ref.current && (((_a2 = lastHtml != null ? lastHtml : "") == null ? void 0 : _a2.length) == 0 || ((_b2 = rest.html) != null ? _b2 : "").length == 0)) {
      (_c2 = ref == null ? void 0 : ref.current) == null ? void 0 : _c2.focus();
      setCaretToEnd(ref == null ? void 0 : ref.current);
    }
  }, [rest.html]);
  return /* @__PURE__ */ jsxs(Wrapper, {
    className: "relative w-full flex items-center",
    children: [((_b = stripHtml(rest.html)) == null ? void 0 : _b.length) == 0 && /* @__PURE__ */ jsx("div", {
      className: `absolute w-full h-full text-app-gray-999999 min-h-36px z-0 pointer-events-none whitespace-nowrap ${(_c = rest == null ? void 0 : rest.className) != null ? _c : ""}`,
      children: "Type / for commands"
    }), /* @__PURE__ */ jsx(ContentEditable, {
      ...rest,
      disabled: !rest.contentEditable,
      className: `w-full min-h-36px ${(_d = rest == null ? void 0 : rest.className) != null ? _d : ""}`,
      innerRef: ref
    })]
  });
});
function Editor(props) {
  const [preview, setPreview] = useState(false);
  return /* @__PURE__ */ jsx(EditorContextProvider, {
    files_options: props == null ? void 0 : props.files_options,
    children: /* @__PURE__ */ jsx(ModalsProvider, {
      children: /* @__PURE__ */ jsx(ModalsContext.Consumer, {
        children: ({
          modal,
          close
        }) => /* @__PURE__ */ jsxs("div", {
          id: "editor-container",
          className: "relative flex w-full flex-grow sm:pt-0 text-black",
          children: [/* @__PURE__ */ jsx("div", {
            className: `${!preview ? "w-full" : "w-1/5"}`,
            children: /* @__PURE__ */ jsx(EditorSection, {
              ...props
            })
          }), /* @__PURE__ */ jsx(EditorContext.Consumer, {
            children: ({
              selected
            }) => /* @__PURE__ */ jsxs(Fragment, {
              children: [(modal == null ? void 0 : modal.modal) == MODALS.COMMANDS && !props.readOnly && (selected == null ? void 0 : selected.length) < 2 && /* @__PURE__ */ jsx(CommandMenu, {
                ...modal.data
              }), (modal == null ? void 0 : modal.modal) == MODALS.STYLES && !props.readOnly && (selected == null ? void 0 : selected.length) < 2 && /* @__PURE__ */ jsx(StyleMenu, {
                ...modal.data
              }), (modal == null ? void 0 : modal.modal) == MODALS.EDITOR_EDIT && !props.readOnly && (selected == null ? void 0 : selected.length) < 2 && /* @__PURE__ */ jsx(EditMenu, {
                ...modal.data
              })]
            })
          })]
        })
      })
    })
  });
}
function IconText(props) {
  const {
    text,
    icon,
    className,
    iconClass
  } = props;
  return /* @__PURE__ */ jsxs("div", {
    className: `flex items-center ${className}`,
    children: [/* @__PURE__ */ jsx(Icon, {
      name: icon,
      className: `mr-12px flex-shrink-0 ${iconClass}`
    }), text]
  });
}
function ImageInput(props) {
  var _a, _b;
  const {
    label,
    name = "file",
    imagePreview = false,
    height = "h-160px",
    fileIndex,
    ...rest
  } = props;
  const {
    data,
    setData,
    errors,
    clearErrors
  } = useContext(FormContext);
  const {
    seterrors
  } = useContext(ErrorGroupContext);
  useEffect(() => {
    seterrors((e) => ({
      ...e,
      [name]: errors[name]
    }));
  }, [errors[name]]);
  let fileList = data == null ? void 0 : data[name];
  let preview = fileList ? (_a = Object.values(fileList)) == null ? void 0 : _a[fileIndex != null ? fileIndex : 0] : null;
  function prevent(e) {
    e.preventDefault();
    e.stopPropagation();
  }
  function dropFile(e) {
    var _a2;
    prevent(e);
    let droppedFiles = (_a2 = e == null ? void 0 : e.dataTransfer) == null ? void 0 : _a2.files;
    if (droppedFiles) {
      fileIndex ? setData((d) => ({
        ...d,
        [name]: [...d[name], ...droppedFiles]
      })) : setData(`${name}`, droppedFiles);
    }
  }
  if (name.includes("[]"))
    throw new Error("Dont include [] in input name for multiple files, just add prop 'multiple | multiple={true}' ");
  let errs = Object.keys(errors).filter((e) => e.startsWith(`${name}`)).map((err) => errors[err]).join(", ");
  return /* @__PURE__ */ jsxs("label", {
    className: `cursor-pointer relative block `,
    onDrag: prevent,
    onDragStart: prevent,
    onDragEnd: prevent,
    onDragOver: prevent,
    onDragEnter: prevent,
    onDragLeave: prevent,
    onDrop: dropFile,
    children: [/* @__PURE__ */ jsx("input", {
      className: "opacity-0 w-0 h-0 absolute",
      type: "file",
      ...rest,
      name: `${name}[${fileIndex != null ? fileIndex : ""}]`,
      onChange: (e) => {
        fileIndex ? setData((d) => ({
          ...d,
          [name]: [...d[name], ...e.target.files]
        })) : setData(name, e.target.files);
        clearErrors(name);
      }
    }), /* @__PURE__ */ jsxs("div", {
      className: `flex items-center px-40px flex-col bg-app-blue-#F7F9FF rounded justify-center ${height} relative z-10 overflow-hidden`,
      children: [imagePreview && preview && ((_b = preview == null ? void 0 : preview.type) == null ? void 0 : _b.startsWith("image")) && /* @__PURE__ */ jsx("img", {
        className: "absolute top-0 left-0 h-full w-full object-cover object-center z-0",
        src: URL.createObjectURL(preview),
        alt: "Preview"
      }), /* @__PURE__ */ jsx("div", {
        className: "font-bold mb-8px whitespace-nowrap",
        children: label
      }), /* @__PURE__ */ jsx(Button, {
        className: "pointer-events-none mob:w-full text-left justify-start z-10",
        href: "/noJS",
        onClick: (e) => {
          e.preventDefault();
        },
        children: /* @__PURE__ */ jsx(IconText, {
          icon: "upload",
          text: fileIndex && fileList[fileIndex] || !fileIndex && (fileList == null ? void 0 : fileList.length) > 0 ? "Change" : "Upload"
        })
      }), /* @__PURE__ */ jsx("div", {
        className: "mt-12px text-12 mob:ml-0 mob:mt-8px z-10 bg-EBE9E6 rounded px-6px bg-opacity-80"
      })]
    }), /* @__PURE__ */ jsxs("div", {
      className: `h-12px text-12 text-C86B28 ${errs ? "" : "opacity-0"}`,
      children: [" ", errs, " "]
    })]
  });
}
function ChangeImage(props) {
  var _a, _b;
  const {
    image,
    name,
    label,
    height = "h-160px",
    removeMedia,
    multiple = false,
    ...rest
  } = props;
  const [change, setchange] = useState(false);
  const form = useForm({
    [name]: void 0
  });
  const {
    data,
    setData,
    post,
    processing
  } = form;
  const removeImage = (id) => {
    post(route("media.destroy", {
      media: id
    }), {
      preserveState: true,
      preserveScroll: true,
      onSuccess: () => {
        setchange(true);
        setData(name, void 0);
      }
    });
  };
  return change || !image ? /* @__PURE__ */ jsx(ImageInput, {
    height,
    name,
    label,
    multiple,
    ...rest
  }) : /* @__PURE__ */ jsx("div", {
    className: "mb-12px",
    children: /* @__PURE__ */ jsxs("div", {
      className: `${height} w-full relative flex items-center justify-center rounded overflow-hidden bg-app-blue-#F7F9FF`,
      children: [/* @__PURE__ */ jsx(Img, {
        className: "object-cover object-center w-full h-full",
        src: image,
        alt: "Current thumbnail"
      }), /* @__PURE__ */ jsxs("div", {
        className: "absolute flex justify-center items-center flex-col",
        children: [/* @__PURE__ */ jsx("div", {
          className: "font-bold mb-8px whitespace-nowrap",
          children: label
        }), /* @__PURE__ */ jsxs("div", {
          className: "flex gap-12px ",
          children: [/* @__PURE__ */ jsx(Button, {
            className: "",
            href: "#",
            onClick: (e) => {
              e.preventDefault();
              setchange(true);
              setData(name, void 0);
            },
            children: /* @__PURE__ */ jsx(IconText, {
              icon: "upload",
              text: "Zm\u011Bnit obr\xE1zek"
            })
          }), image && /* @__PURE__ */ jsx(Button, {
            title: "St\xE1hnout origin\xE1l",
            className: " bg-insightsButtonBlue hover:bg-insightsButtonBlue/70 text-white w-50px ",
            defaultPadding: false,
            defaultColor: false,
            download: (_b = (_a = image.url) == null ? void 0 : _a.split(/(\\|\/)/g)) == null ? void 0 : _b.pop(),
            href: image.url,
            children: /* @__PURE__ */ jsx(Download, {})
          }), removeMedia && /* @__PURE__ */ jsx(Button, {
            title: "Smazat obr\xE1zek",
            className: " bg-red-500  hover:bg-red-500/70 text-white w-50px ",
            defaultPadding: false,
            defaultColor: false,
            href: "#",
            onClick: (e) => {
              e.preventDefault();
              removeImage(removeMedia);
            },
            children: processing ? /* @__PURE__ */ jsx("div", {
              className: "spinner2 animate-spin"
            }) : /* @__PURE__ */ jsx(Trash, {})
          })]
        })]
      })]
    })
  });
}
function DateTimeInput(props) {
  const {
    label,
    name,
    className,
    placeholder,
    timePlaceholder
  } = props;
  const {
    data,
    setData,
    errors,
    clearErrors
  } = useContext(FormContext);
  const {
    seterrors
  } = useContext(ErrorGroupContext);
  useEffect(() => {
    seterrors((e) => ({
      ...e,
      [name]: errors[name]
    }));
  }, [errors[name]]);
  const selected = data[name] ? moment(data[name], "DD. MM. YYYY HH:mm:ss") : null;
  const [date, setdate] = useState(selected != null ? selected : moment());
  const [view, setview] = useState(0);
  const [opened, setopen] = useState(false);
  const getMonthName = (i) => {
    date.month(i);
    return date.locale("cs-CZ").format("MMMM");
  };
  const changeMonthorYear = (i) => {
    setdate((y) => {
      let d = moment(y);
      if (view == 0)
        changeMonth(d.month() + i);
      else if (view == 1)
        changeYear(d.year() + i);
      else
        changeYear(d.year() + i * 10);
      return d;
    });
  };
  const changeMonth = (i) => {
    setdate((y) => {
      let d = moment(y);
      d.month(i);
      setData(name, d.format("DD. MM. YYYY HH:mm:ss"));
      return d;
    });
  };
  const changeYear = (i) => {
    setdate((y) => {
      let d = moment(y);
      d.year(i);
      setData(name, d.format("DD. MM. YYYY HH:mm:ss"));
      return d;
    });
  };
  const changeDay = (i) => {
    setdate((y) => {
      let d = moment(y);
      d.date(i);
      setData(name, d.format("DD. MM. YYYY HH:mm:ss"));
      return d;
    });
  };
  const changeHour = (i) => {
    setdate((y) => {
      let d = moment(y);
      d.hours(i);
      setData(name, d.format("DD. MM. YYYY HH:mm:ss"));
      return d;
    });
  };
  const changeMinute = (i) => {
    setdate((y) => {
      let d = moment(y);
      d.minutes(i);
      setData(name, d.format("DD. MM. YYYY HH:mm:ss"));
      return d;
    });
  };
  const removeDate = () => {
    setData(name, void 0);
  };
  const formatDate = (_date) => {
    return _date.format("D. M. YYYY");
  };
  const formatTime = (_date) => {
    return _date.format("HH:mm");
  };
  return /* @__PURE__ */ jsxs("div", {
    children: [/* @__PURE__ */ jsx("div", {
      children: label
    }), /* @__PURE__ */ jsxs("div", {
      className: "relative",
      children: [/* @__PURE__ */ jsxs("div", {
        className: `border ${errors[name] ? "border-E25F44" : "border-app-gray-#D6D6D6"} rounded bg-white  placeholder-gray-500 h-55px flex gap-6px box-border w-full items-center px-14px outline-none ${className}`,
        children: [/* @__PURE__ */ jsx("input", {
          className: ` w-full outline-none placeholder-gray-500`,
          type: "text",
          placeholder,
          value: selected ? formatDate(selected) : "",
          onClick: (e) => {
            setopen((o) => !o);
          },
          readOnly: true
        }), /* @__PURE__ */ jsx("input", {
          className: `w-45px flex-shrink-0 outline-none placeholder-gray-500`,
          type: "text",
          placeholder: timePlaceholder,
          value: selected ? formatTime(selected) : "",
          onClick: (e) => {
            setopen((o) => !o);
          },
          readOnly: true
        }), /* @__PURE__ */ jsx(Icon, {
          onClick: (e) => {
            setopen((o) => !o);
          },
          name: "calendar",
          className: " flex-shrink-0 cursor-pointer "
        })]
      }), opened && /* @__PURE__ */ jsx(Picker, {
        view,
        changeDay,
        getMonthName,
        changeMonthorYear,
        setview,
        selected,
        date,
        changeMonth,
        changeYear,
        setopen,
        removeDate,
        changeHour,
        changeMinute
      })]
    }), /* @__PURE__ */ jsx("div", {
      className: `h-12px text-12 mt-4px text-C86B28 leading-none ${errors[name] ? "" : "opacity-0"}`,
      children: errors == null ? void 0 : errors[name]
    })]
  });
}
function Picker({
  view,
  changeDay,
  getMonthName,
  changeMonthorYear,
  setview,
  selected,
  date,
  changeMonth,
  changeYear,
  setopen,
  removeDate,
  changeHour,
  changeMinute
}) {
  const suggestions = useRef(null);
  const [upOrDown, setupOrDown] = useState(false);
  const [leftOrRight, setleftOrRight] = useState(false);
  const isOutViewport = (element) => {
    try {
      if (!element)
        return;
      var bounding = element.getBoundingClientRect();
      if (bounding.left < 0) {
      }
      if (bounding.bottom > ((window == null ? void 0 : window.innerHeight) || (document == null ? void 0 : document.documentElement.clientHeight)) && !upOrDown) {
        setupOrDown(true);
        console.log("down");
      }
      if (bounding.right > ((window == null ? void 0 : window.innerWidth) || (document == null ? void 0 : document.documentElement.clientWidth))) {
        setleftOrRight(true);
      }
      if (bounding.top < 0) {
      }
    } catch (error) {
    }
  };
  const closePicker = () => setopen(false);
  useEffect(() => {
    isOutViewport(suggestions.current);
    try {
      window == null ? void 0 : window.addEventListener("click", closePicker);
    } catch (error) {
    }
    return () => {
      try {
        window == null ? void 0 : window.removeEventListener("click", closePicker);
      } catch (error) {
      }
    };
  }, []);
  return /* @__PURE__ */ jsxs("div", {
    ref: suggestions,
    onClick: (e) => e.stopPropagation(),
    className: `absolute bottom-0 transform translate-y-full flex gap-12px p-17px bg-white border border-EBE9E6 rounded-md z-50 -mb-18px w-max ${upOrDown ? `` : ""} ${leftOrRight && ` right-0 `}`,
    children: [/* @__PURE__ */ jsxs("div", {
      children: [/* @__PURE__ */ jsx(Icon, {
        name: "tab",
        className: `absolute -top-10px transition-all duration-300  z-10 ${leftOrRight ? ` right-20px ` : `left-20px`}`
      }), /* @__PURE__ */ jsx(Icon, {
        name: "bin",
        onClick: () => removeDate(),
        className: `absolute top-6px right-6px transition-all duration-300 text-red hover:text-red-dark z-10 cursor-pointer`
      }), /* @__PURE__ */ jsxs("div", {
        className: "flex justify-between px-24px my-28px mt-12px",
        children: [/* @__PURE__ */ jsx(Icon, {
          onClick: (e) => {
            e.preventDefault();
            changeMonthorYear(-1);
          },
          className: "transform rotate-180 cursor-pointer",
          name: "arrow-right"
        }), view == 0 && /* @__PURE__ */ jsxs("div", {
          onClick: (e) => {
            e.preventDefault();
            setview(1);
          },
          className: "mx-12px cursor-pointer",
          children: [getMonthName(date.month()), " ", date.year()]
        }), view == 1 && /* @__PURE__ */ jsx("div", {
          onClick: (e) => {
            e.preventDefault();
            setview(2);
          },
          className: "mx-12px cursor-pointer",
          children: date.year()
        }), view == 2 && /* @__PURE__ */ jsxs("div", {
          onClick: (e) => {
            e.preventDefault();
            setview(2);
          },
          className: "mx-12px cursor-pointer",
          children: [date.year(), " - ", date.year() + 10]
        }), /* @__PURE__ */ jsx(Icon, {
          onClick: (e) => {
            e.preventDefault();
            changeMonthorYear(1);
          },
          className: "cursor-pointer",
          name: "arrow-right"
        })]
      }), view == 0 && /* @__PURE__ */ jsx("div", {
        className: "grid grid-cols-5 gap-x-5px gap-y-10px",
        children: Array(date.daysInMonth()).fill(0).map((it, i) => /* @__PURE__ */ jsx("div", {
          onClick: () => {
            changeDay(i + 1);
          },
          className: `bg-white border rounded-md border-EBE9E6 flex justify-center items-center w-45px h-45px cursor-pointer hover:bg-red hover:bg-opacity-50 hover:text-red hover:border-red-dark ${date.month() == (selected == null ? void 0 : selected.month()) && date.year() == (selected == null ? void 0 : selected.year()) && selected.date() == i + 1 && "text-red border-red-dark bg-red bg-opacity-50"} `,
          children: i + 1
        }))
      }), view == 1 && /* @__PURE__ */ jsx("div", {
        className: "grid grid-cols-3 gap-x-5px gap-y-10px",
        children: Array(12).fill(0).map((it, i) => /* @__PURE__ */ jsx("div", {
          onClick: () => {
            changeMonth(i);
            setview(0);
          },
          className: "bg-white border rounded-md border-EBE9E6 flex justify-center items-center px-5px h-45px cursor-pointer hover:bg-red hover:bg-opacity-50 hover:text-red hover:border-red-dark",
          children: getMonthName(i)
        }))
      }), view == 2 && /* @__PURE__ */ jsx("div", {
        className: "grid grid-cols-5 gap-x-5px gap-y-10px",
        children: Array(25).fill(0).map((it, i) => /* @__PURE__ */ jsx("div", {
          onClick: () => {
            changeYear(date.year() + i);
            setview(1);
          },
          className: "bg-white border rounded-md border-EBE9E6 flex justify-center items-center px-7px h-45px cursor-pointer hover:bg-red hover:bg-opacity-50 hover:text-red hover:border-red-dark",
          children: date.year() + i
        }))
      })]
    }), /* @__PURE__ */ jsxs("div", {
      className: "w-110px pt-1px border-l border-EBE9E6 pl-4px flex flex-col",
      children: [/* @__PURE__ */ jsx("div", {
        className: "my-28px mt-12px flex justify-center items-center font-semibold pl-8px",
        children: date == null ? void 0 : date.format("HH:mm")
      }), /* @__PURE__ */ jsx("div", {
        className: "relative h-full",
        children: /* @__PURE__ */ jsxs("div", {
          className: "absolute w-full h-full flex gap-5px",
          children: [/* @__PURE__ */ jsx("div", {
            className: "overflow-auto tagscrollbar flex flex-col gap-8px flex-shrink-0 rtl pl-4px",
            children: Array(24).fill(0).map((it, i) => /* @__PURE__ */ jsx("div", {
              onClick: () => {
                changeHour(i);
              },
              className: `hour-${i} bg-white border rounded-md border-EBE9E6 flex justify-center items-center px-5px h-45px w-45px flex-shrink-0 cursor-pointer hover:bg-red hover:bg-opacity-50 hover:text-red hover:border-red-dark ${date.hours() == i && "text-red border-red-dark bg-red bg-opacity-50"}`,
              children: moment(i, "H").format("HH")
            }))
          }), /* @__PURE__ */ jsx("div", {
            className: "overflow-auto tagscrollbar flex flex-col gap-8px flex-shrink-0 pr-4px",
            children: Array(60).fill(0).map((it, i) => /* @__PURE__ */ jsx("div", {
              onClick: () => {
                changeMinute(i);
              },
              className: `minute-${i} bg-white border rounded-md border-EBE9E6 flex justify-center items-center px-5px h-45px w-45px flex-shrink-0 cursor-pointer hover:bg-red hover:bg-opacity-50 hover:text-red hover:border-red-dark ${date.minutes() == i && "text-red border-red-dark bg-red bg-opacity-50"}`,
              children: moment(i, "m").format("mm")
            }))
          })]
        })
      })]
    })]
  });
}
function Select(props) {
  var _a, _b;
  const {
    options,
    clickId,
    placeholder,
    leftBorder,
    showPlaceholder = false,
    labelClassName,
    className,
    onChange = (v) => {
    },
    label,
    name = "select",
    clearSelection = false,
    nameForHiddenSelect = name,
    ...rest
  } = props;
  const [open, setopen] = useState(false);
  const ref = useRef(null);
  const height = useRef("0px");
  const {
    data,
    setData,
    errors,
    clearErrors
  } = useContext(FormContext);
  const {
    seterrors
  } = useContext(ErrorGroupContext);
  useEffect(() => {
    seterrors((e) => ({
      ...e,
      [name]: errors[name]
    }));
  }, [errors[name]]);
  const collapseSection = () => {
    let element = ref.current;
    if (element) {
      var sectionHeight = element.scrollHeight;
      var elementTransition = element.style.transition;
      element.style.transition = "";
      requestAnimationFrame(function() {
        if (element) {
          height.current = sectionHeight + "px";
          element.style.height = height.current;
          element.style.transition = elementTransition;
        }
        requestAnimationFrame(function() {
          if (element) {
            height.current = 0 + "px";
            element.style.height = height.current;
          }
        });
      });
      setopen(false);
    }
  };
  const expandSection = () => {
    let element = ref.current;
    if (element) {
      var sectionHeight = element.scrollHeight;
      height.current = sectionHeight + "px";
      element.style.height = height.current;
      setopen(true);
    }
  };
  const toggle = () => {
    if (open)
      collapseSection();
    else
      expandSection();
  };
  const select = (o) => {
    setData(name, o == null ? void 0 : o.value);
    clearErrors(name);
    onChange(o);
    collapseSection();
  };
  let selected = options.find((o) => o.value == (data == null ? void 0 : data[name]));
  const closeOnClick = () => {
    collapseSection();
  };
  const checkOnClick = (event) => {
    event.stopPropagation();
  };
  useEffect(() => {
    try {
      window == null ? void 0 : window.addEventListener("click", closeOnClick);
    } catch (error) {
    }
    return () => {
      try {
        window == null ? void 0 : window.removeEventListener("click", closeOnClick);
      } catch (error) {
      }
    };
  }, []);
  return /* @__PURE__ */ jsxs("div", {
    className: "relative",
    onClick: checkOnClick,
    children: [/* @__PURE__ */ jsx("div", {
      className: " " + labelClassName,
      children: label
    }), /* @__PURE__ */ jsxs("div", {
      className: `flex items-center h-55px  rounded cursor-pointer relative`,
      children: [/* @__PURE__ */ jsxs("div", {
        className: `flex justify-between flex-grow items-center px-16px rounded  bg-white pr-0 border ${errors[name] ? "border-C86B28" : "border-app-gray-#D6D6D6"} `,
        onClick: toggle,
        id: clickId,
        children: [/* @__PURE__ */ jsx("div", {
          className: ` leading-4 ${(selected == null ? void 0 : selected.text) ? "" : "text-gray-500"}`,
          children: (_a = selected == null ? void 0 : selected.text) != null ? _a : placeholder
        }), clearSelection && data[name] ? /* @__PURE__ */ jsx("div", {
          onClick: (e) => {
            e.stopPropagation();
            select(null);
          },
          className: `h-55px w-55px flex items-center justify-center border-l ${leftBorder ? "border-app-gray-#D6D6D6" : "border-transparent"} hover:text-red`,
          children: /* @__PURE__ */ jsx(Icon, {
            className: ` `,
            name: "cross"
          })
        }) : /* @__PURE__ */ jsx("div", {
          className: `h-55px w-55px flex items-center justify-center transition-colors duration-300 border-l ${leftBorder ? "border-app-gray-#D6D6D6" : "border-transparent"}`,
          children: /* @__PURE__ */ jsx(Icon, {
            className: `transform transition-transform duration-300 ${open && "rotate-180"}`,
            name: "dropdown-arrow"
          })
        })]
      }), /* @__PURE__ */ jsx("div", {
        ref,
        className: "overflow-x-hidden overflow-y-hidden collapsable absolute bottom-0 left-0 transform w-full selectmask translate-y-full mb-8px z-50",
        style: {
          height: height.current
        },
        children: /* @__PURE__ */ jsxs("div", {
          className: "bg-white absolute top-0 left-0  w-full shadow-md rounded-b-default border border-app-gray-#D6D6D6 border-t-0  overflow-x-hidden max-h-280px tagscrollbar z-50",
          children: [showPlaceholder && /* @__PURE__ */ jsx("div", {
            className: "border-t px-16px hover:bg-F8F2EB border-app-gray-#D6D6D6 py-8px cursor-pointer",
            onClick: () => select(null),
            children: placeholder
          }), options.map((o, i) => /* @__PURE__ */ jsx("div", {
            className: "border-t leading-4 px-16px hover:bg-F8F2EB border-app-gray-#D6D6D6 py-8px cursor-pointer",
            onClick: () => select(o),
            children: o.text
          }, `option-${i}`))]
        })
      })]
    }), /* @__PURE__ */ jsx("div", {
      className: `h-12px mt-4px text-12 text-C86B28 ${errors[name] ? "" : "opacity-0"}`,
      children: errors == null ? void 0 : errors[name]
    }), /* @__PURE__ */ jsx("select", {
      className: `opacity-0 w-0 h-0 absolute ${className}`,
      ...rest,
      name: nameForHiddenSelect,
      value: (_b = data[name]) != null ? _b : "",
      onChange: (e) => {
        setData(name, e.target.value);
        clearErrors(name);
      },
      onMouseDown: (e) => {
        try {
          e.preventDefault();
          e.currentTarget.blur();
          window == null ? void 0 : window.focus();
        } catch (error) {
        }
      },
      onFocus: (e) => {
        try {
          e.preventDefault();
          e.currentTarget.blur();
          window == null ? void 0 : window.focus();
        } catch (error) {
        }
      },
      children: options.map((o, i) => /* @__PURE__ */ jsx("option", {
        value: o.value,
        children: o.text
      }, `option-${i}`))
    })]
  });
}
function SmallSelect(props) {
  var _a, _b;
  const {
    options,
    clickId,
    placeholder,
    leftBorder,
    showPlaceholder = false,
    labelClassName,
    className,
    onChange = (v) => {
    },
    label,
    name = "select",
    clearSelection = false,
    nameForHiddenSelect = name,
    containerClassName,
    ...rest
  } = props;
  const [open, setopen] = useState(false);
  const ref = useRef(null);
  const height = useRef("0px");
  const {
    data,
    setData,
    errors,
    clearErrors
  } = useContext(FormContext);
  const {
    seterrors
  } = useContext(ErrorGroupContext);
  useEffect(() => {
    seterrors((e) => ({
      ...e,
      [name]: errors[name]
    }));
  }, [errors[name]]);
  const collapseSection = () => {
    let element = ref.current;
    if (element) {
      var sectionHeight = element.scrollHeight;
      var elementTransition = element.style.transition;
      element.style.transition = "";
      requestAnimationFrame(function() {
        if (element) {
          height.current = sectionHeight + "px";
          element.style.height = height.current;
          element.style.transition = elementTransition;
        }
        requestAnimationFrame(function() {
          if (element) {
            height.current = 0 + "px";
            element.style.height = height.current;
          }
        });
      });
      setopen(false);
    }
  };
  const expandSection = () => {
    let element = ref.current;
    if (element) {
      var sectionHeight = element.scrollHeight;
      height.current = sectionHeight + "px";
      element.style.height = height.current;
      setopen(true);
    }
  };
  const toggle = () => {
    if (open)
      collapseSection();
    else
      expandSection();
  };
  const select = (o) => {
    setData(name, o == null ? void 0 : o.value);
    clearErrors(name);
    onChange(o);
    collapseSection();
  };
  let selected = options.find((o) => o.value == (data == null ? void 0 : data[name]));
  const closeOnClick = () => {
    collapseSection();
  };
  const checkOnClick = (event) => {
    event.stopPropagation();
  };
  useEffect(() => {
    try {
      window == null ? void 0 : window.addEventListener("click", closeOnClick);
    } catch (error) {
    }
    return () => {
      try {
        window == null ? void 0 : window.removeEventListener("click", closeOnClick);
      } catch (error) {
      }
    };
  }, []);
  return /* @__PURE__ */ jsxs("div", {
    className: "relative ",
    onClick: checkOnClick,
    children: [/* @__PURE__ */ jsx("div", {
      className: " " + labelClassName,
      children: label
    }), /* @__PURE__ */ jsxs("div", {
      className: `flex items-center  rounded cursor-pointer relative`,
      children: [/* @__PURE__ */ jsxs("div", {
        className: `flex justify-between flex-grow items-center px-16px rounded  pr-0 border ${containerClassName} ${errors[name] ? "border-C86B28" : "border-transparent"} `,
        onClick: toggle,
        id: clickId,
        children: [/* @__PURE__ */ jsx("div", {
          className: ` leading-4 ${(selected == null ? void 0 : selected.text) ? "" : "text-gray-500"}`,
          children: (_a = selected == null ? void 0 : selected.text) != null ? _a : placeholder
        }), clearSelection && data[name] ? /* @__PURE__ */ jsx("div", {
          onClick: (e) => {
            e.stopPropagation();
            select(null);
          },
          className: `h-55px w-55px flex items-center justify-center border-l ${leftBorder ? "border-transparent" : "border-transparent"} hover:text-red`,
          children: /* @__PURE__ */ jsx(Icon, {
            className: ` `,
            name: "cross"
          })
        }) : /* @__PURE__ */ jsx("div", {
          className: `h-24px w-24px flex items-center justify-center transition-colors duration-300 border-l ${leftBorder ? "border-transparent" : "border-transparent"}`,
          children: /* @__PURE__ */ jsx(Icon, {
            className: `transform transition-transform duration-300 w-16px ${open && "rotate-180"}`,
            name: "dropdown-arrow"
          })
        })]
      }), /* @__PURE__ */ jsx("div", {
        ref,
        className: "overflow-x-hidden overflow-y-hidden collapsable absolute bottom-0 left-0 transform w-full selectmask translate-y-full mb-8px z-50",
        style: {
          height: height.current
        },
        children: /* @__PURE__ */ jsxs("div", {
          className: "bg-white absolute top-0 left-0  w-full shadow-md rounded-b-default border  border-t-0  overflow-x-hidden max-h-280px tagscrollbar z-50",
          children: [showPlaceholder && /* @__PURE__ */ jsx("div", {
            className: "border-t px-16px hover:bg-F8F2EB  py-8px cursor-pointer",
            onClick: () => select(null),
            children: placeholder
          }), options.map((o, i) => /* @__PURE__ */ jsx("div", {
            className: "border-t leading-4 px-16px hover:bg-F8F2EB  py-8px cursor-pointer",
            onClick: () => select(o),
            children: o.text
          }, `option-${i}`))]
        })
      })]
    }), /* @__PURE__ */ jsx("select", {
      className: `opacity-0 w-0 h-0 absolute ${className}`,
      ...rest,
      name: nameForHiddenSelect,
      value: (_b = data[name]) != null ? _b : "",
      onChange: (e) => {
        setData(name, e.target.value);
        clearErrors(name);
      },
      onMouseDown: (e) => {
        try {
          e.preventDefault();
          e.currentTarget.blur();
          window == null ? void 0 : window.focus();
        } catch (error) {
        }
      },
      onFocus: (e) => {
        try {
          e.preventDefault();
          e.currentTarget.blur();
          window == null ? void 0 : window.focus();
        } catch (error) {
        }
      },
      children: options.map((o, i) => /* @__PURE__ */ jsx("option", {
        value: o.value,
        children: o.text
      }, `option-${i}`))
    })]
  });
}
function EditWrapper(props) {
  const {
    children,
    className
  } = props;
  return /* @__PURE__ */ jsx("div", {
    className: `max-w-5xl mx-auto ${className}`,
    children
  });
}
function toClipboard(value) {
  function unsecuredCopyToClipboard(text) {
    const textArea = document.createElement("textarea");
    textArea.value = text;
    document.body.appendChild(textArea);
    textArea.focus();
    textArea.select();
    try {
      document.execCommand("copy");
    } catch (err) {
      console.error("Unable to copy to clipboard", err);
    }
    document.body.removeChild(textArea);
  }
  if (window.isSecureContext && navigator.clipboard) {
    navigator.clipboard.writeText(value);
  } else {
    unsecuredCopyToClipboard(value);
  }
}
function ImageCard({
  image,
  name,
  label,
  height = "h-160px",
  removeMedia,
  multiple = false
}) {
  var _a, _b;
  const form = useForm({});
  const {
    post,
    processing
  } = form;
  const removeImage = (id) => {
    post(route("admin.media.destroy", {
      media: id
    }), {
      preserveState: true,
      preserveScroll: true,
      onSuccess: () => {
      }
    });
  };
  return image && /* @__PURE__ */ jsxs("div", {
    className: "mb-12px",
    children: [label && /* @__PURE__ */ jsx("div", {
      children: label
    }), /* @__PURE__ */ jsxs("div", {
      className: `${height} w-full relative flex items-center justify-center rounded overflow-hidden`,
      children: [/* @__PURE__ */ jsx(Img, {
        className: "object-cover object-center w-full h-full",
        src: image,
        alt: "Sou\u010Dasn\xFD obr\xE1zek"
      }), /* @__PURE__ */ jsxs("div", {
        className: "flex gap-12px absolute",
        children: [image && /* @__PURE__ */ jsx("a", {
          title: "St\xE1hnout origin\xE1l",
          className: " h-48px rounded whitespace-nowrap justify-center items-center cursor-pointer gap-x-8px font-semibold   w-50px flex bg-white hover:bg-gray-300",
          download: (_b = (_a = image.url) == null ? void 0 : _a.split(/(\\|\/)/g)) == null ? void 0 : _b.pop(),
          href: image.url,
          children: /* @__PURE__ */ jsx(Download, {
            size: 24
          })
        }), /* @__PURE__ */ jsx(Button, {
          title: "Smazat obr\xE1zek",
          className: " bg-red-500 hover:bg-red-600 text-white w-50px p-0 ",
          href: "#",
          onClick: (e) => {
            e.preventDefault();
            removeImage(image.uuid);
          },
          children: processing ? /* @__PURE__ */ jsx("div", {
            className: "spinner2 animate-spin"
          }) : /* @__PURE__ */ jsx(X, {
            size: 24,
            className: "absolute"
          })
        })]
      })]
    })]
  });
}
function GuestRow(props) {
  const {
    status,
    id,
    event_id,
    company_name,
    created_at,
    email,
    first_name,
    job_title,
    last_name
  } = props;
  const form = useForm({
    status: status != null ? status : null
  });
  const {
    data,
    post
  } = form;
  const submit = (e) => {
    e.preventDefault();
    if (status != data["status"]) {
      post(route("admin.events.changeStatus", {
        event_guest: id
      }), {
        preserveState: false,
        preserveScroll: true
      });
    }
  };
  const removeUser = (e) => {
    e.preventDefault();
    Inertia.post(route("admin.events.destroy.user", {
      event_guest: id,
      event: event_id
    }));
  };
  return /* @__PURE__ */ jsxs("tr", {
    className: "text-14 group",
    children: [/* @__PURE__ */ jsx("td", {
      className: `group-even:bg-app-blue-#F7F9FF px-12px py-8px overflow-auto tagscrollbar`,
      children: first_name
    }), /* @__PURE__ */ jsx("td", {
      className: `group-even:bg-app-blue-#F7F9FF px-12px py-8px overflow-auto tagscrollbar`,
      children: last_name
    }), /* @__PURE__ */ jsx("td", {
      className: `group-even:bg-app-blue-#F7F9FF px-12px py-8px overflow-auto tagscrollbar`,
      children: company_name
    }), /* @__PURE__ */ jsx("td", {
      className: `group-even:bg-app-blue-#F7F9FF px-12px py-8px overflow-auto tagscrollbar`,
      children: job_title
    }), /* @__PURE__ */ jsx("td", {
      className: `group-even:bg-app-blue-#F7F9FF px-12px py-8px overflow-auto tagscrollbar`,
      children: email
    }), /* @__PURE__ */ jsx("td", {
      className: `group-even:bg-app-blue-#F7F9FF px-12px py-8px `,
      children: /* @__PURE__ */ jsxs("div", {
        className: "flex gap-16px items-center",
        children: [/* @__PURE__ */ jsx(Form, {
          form,
          onChange: submit,
          className: "shrink-0 w-28",
          children: /* @__PURE__ */ jsx(SmallSelect, {
            containerClassName: `${data.status === null && "bg-[#FBE780]"} ${!!data.status === true && "bg-[#539648] text-white"} ${data.status === false && "bg-[#BD0202] text-white"}`,
            name: "status",
            options: [{
              text: "Pending",
              value: null
            }, {
              text: "Confirmed",
              value: true
            }, {
              text: "Refused",
              value: false
            }]
          })
        }), /* @__PURE__ */ jsx("div", {
          className: " flex justify-end items-center",
          children: /* @__PURE__ */ jsx(Trash, {
            className: " text-app-red cursor-pointer hover:text-app-red/70",
            onClick: (e) => {
              removeUser(e);
            }
          })
        })]
      })
    })]
  });
}
function Create(props) {
  var _a, _b, _c, _d, _e, _f, _g, _h, _i, _j, _k, _l, _m, _n, _o, _p;
  const {
    event
  } = props;
  const form = useForm(event ? {
    ...event,
    images: void 0,
    portfolio_companies: void 0,
    email_logos: void 0
  } : {});
  const {
    data,
    post
  } = form;
  const submit = (e) => {
    e.preventDefault();
    post(route("admin.events.update", {
      event: event.id
    }));
  };
  return /* @__PURE__ */ jsx(Layout, {
    children: /* @__PURE__ */ jsxs(EditWrapper, {
      className: "flex flex-col gap-16px",
      children: [/* @__PURE__ */ jsxs(WhiteContainer, {
        className: "pb-60px",
        children: [/* @__PURE__ */ jsx("h3", {
          className: "text-lg mob:text-base mb-8px font-semibold flex gap-12px items-center",
          children: "Basic information"
        }), /* @__PURE__ */ jsxs(Form, {
          form,
          onSubmit: submit,
          children: [/* @__PURE__ */ jsxs("div", {
            className: "flex gap-16px",
            children: [/* @__PURE__ */ jsx(TextField, {
              name: "type",
              placeholder: "Event type"
            }), /* @__PURE__ */ jsx(TextField, {
              name: "name",
              placeholder: "Event Name"
            })]
          }), /* @__PURE__ */ jsxs("div", {
            className: "flex gap-16px",
            children: [/* @__PURE__ */ jsx("div", {
              className: "w-full",
              children: /* @__PURE__ */ jsx(DateTimeInput, {
                name: "starts_at",
                label: "Start of the event"
              })
            }), /* @__PURE__ */ jsx("div", {
              className: "w-full",
              children: /* @__PURE__ */ jsx(DateTimeInput, {
                name: "ends_at",
                label: "End of the event"
              })
            }), /* @__PURE__ */ jsx("div", {
              className: " w-full",
              children: /* @__PURE__ */ jsx(Select, {
                label: "Timezone",
                name: "time_zone",
                defaultValue: "GMT+01:00",
                options: [{
                  text: "GMT-12:00",
                  value: "GMT-12:00"
                }, {
                  text: "GMT-11:00",
                  value: "GMT-11:00"
                }, {
                  text: "GMT-10:00",
                  value: "GMT-10:00"
                }, {
                  text: "GMT-09:00",
                  value: "GMT-09:00"
                }, {
                  text: "GMT-08:00",
                  value: "GMT-08:00"
                }, {
                  text: "GMT-07:00",
                  value: "GMT-07:00"
                }, {
                  text: "GMT-06:00",
                  value: "GMT-06:00"
                }, {
                  text: "GMT-05:00",
                  value: "GMT-05:00"
                }, {
                  text: "GMT-04:00",
                  value: "GMT-04:00"
                }, {
                  text: "GMT-03:00",
                  value: "GMT-03:00"
                }, {
                  text: "GMT-02:00",
                  value: "GMT-02:00"
                }, {
                  text: "GMT-01:00",
                  value: "GMT-01:00"
                }, {
                  text: "GMT",
                  value: "GMT"
                }, {
                  text: "GMT+01:00",
                  value: "GMT+01:00"
                }, {
                  text: "GMT+02:00",
                  value: "GMT+02:00"
                }, {
                  text: "GMT+03:00",
                  value: "GMT+03:00"
                }, {
                  text: "GMT+04:00",
                  value: "GMT+04:00"
                }, {
                  text: "GMT+05:00",
                  value: "GMT+05:00"
                }, {
                  text: "GMT+06:00",
                  value: "GMT+06:00"
                }, {
                  text: "GMT+07:00",
                  value: "GMT+07:00"
                }, {
                  text: "GMT+08:00",
                  value: "GMT+08:00"
                }, {
                  text: "GMT+09:00",
                  value: "GMT+09:00"
                }, {
                  text: "GMT+10:00",
                  value: "GMT+10:00"
                }, {
                  text: "GMT+11:00",
                  value: "GMT+11:00"
                }, {
                  text: "GMT+12:00",
                  value: "GMT+12:00"
                }, {
                  text: "GMT+13:00",
                  value: "GMT+13:00"
                }, {
                  text: "GMT+14:00",
                  value: "GMT+14:00"
                }]
              })
            }), /* @__PURE__ */ jsx("div", {
              className: "w-full",
              children: /* @__PURE__ */ jsx(TextField, {
                label: "Custom time zone",
                name: "custom_time_zone",
                placeholder: "Custom timezone"
              })
            })]
          }), /* @__PURE__ */ jsxs("div", {
            className: "flex gap-16px",
            children: [/* @__PURE__ */ jsx(TextField, {
              name: "location",
              placeholder: "Location"
            }), /* @__PURE__ */ jsx(TextField, {
              name: "address",
              placeholder: "Address"
            }), /* @__PURE__ */ jsx(TextField, {
              type: "number",
              name: "capacity",
              placeholder: "Capacity"
            })]
          }), /* @__PURE__ */ jsx(ChangeImage, {
            name: "thumbnail",
            label: "Thumbnail",
            imagePreview: true,
            image: event == null ? void 0 : event.thumbnail
          }), /* @__PURE__ */ jsx("div", {
            className: "text-lg mob:text-base mb-8px font-semibold flex gap-12px items-center",
            children: "Hosts"
          }), /* @__PURE__ */ jsxs("div", {
            className: "grid grid-cols-5 gap-8px",
            children: [(_b = Object.values((_a = event == null ? void 0 : event.images) != null ? _a : {})) == null ? void 0 : _b.map((im, i) => /* @__PURE__ */ jsx(ImageCard, {
              name: "images_old",
              image: im
            })), Object.values((_c = data["images"]) != null ? _c : {}).map((im, i) => /* @__PURE__ */ jsx(ChangeImage, {
              label: "Partner Logo",
              name: `images`,
              fileIndex: i,
              imagePreview: true,
              image: void 0
            })), /* @__PURE__ */ jsx(ChangeImage, {
              label: "Partner Logo",
              name: `images`,
              fileIndex: Object.values((_d = data["images"]) != null ? _d : {}).length,
              imagePreview: true,
              image: void 0
            })]
          }), /* @__PURE__ */ jsx("div", {
            className: "text-lg mob:text-base mb-8px font-semibold flex gap-12px items-center",
            children: "Portfolio companies"
          }), /* @__PURE__ */ jsxs("div", {
            className: "grid grid-cols-5 gap-8px",
            children: [(_f = Object.values((_e = event == null ? void 0 : event.portfolio_companies) != null ? _e : {})) == null ? void 0 : _f.map((im, i) => /* @__PURE__ */ jsx(ImageCard, {
              name: "portfolio_companies_old",
              image: im
            })), Object.values((_g = data["portfolio_companies"]) != null ? _g : {}).map((im, i) => /* @__PURE__ */ jsx(ChangeImage, {
              label: "Partner Logo",
              name: `portfolio_companies`,
              fileIndex: i,
              imagePreview: true,
              image: void 0
            })), /* @__PURE__ */ jsx(ChangeImage, {
              label: "Partner Logo",
              name: `portfolio_companies`,
              fileIndex: Object.values((_h = data["portfolio_companies"]) != null ? _h : {}).length,
              imagePreview: true,
              image: void 0
            })]
          }), /* @__PURE__ */ jsx("div", {
            className: "text-lg mob:text-base mb-8px font-semibold flex gap-12px items-center",
            children: "Email logos (Evolution Equity Partners logo added by default)"
          }), /* @__PURE__ */ jsxs("div", {
            className: "grid grid-cols-5 gap-8px",
            children: [(_j = Object.values((_i = event == null ? void 0 : event.email_logos) != null ? _i : {})) == null ? void 0 : _j.map((im, i) => /* @__PURE__ */ jsx(ImageCard, {
              name: "email_logos_old",
              image: im
            })), Object.values((_k = data["email_logos"]) != null ? _k : {}).map((im, i) => /* @__PURE__ */ jsx(ChangeImage, {
              label: "Email Logo",
              name: `email_logos`,
              fileIndex: i,
              imagePreview: true,
              image: void 0
            })), ((_l = event == null ? void 0 : event.email_logos) == null ? void 0 : _l.length) + (data["email_logos"] ? (_m = data["email_logos"]) == null ? void 0 : _m.length : 0) < 3 && /* @__PURE__ */ jsx(ChangeImage, {
              label: "Email Logo",
              name: `email_logos`,
              fileIndex: Object.values((_n = data["email_logos"]) != null ? _n : {}).length,
              imagePreview: true,
              image: void 0
            })]
          }), /* @__PURE__ */ jsx("div", {
            className: "flex-grow w-full text-base text-left flex p-40px pl-0 mt-24px border-t",
            children: /* @__PURE__ */ jsx(Editor, {
              name: "content",
              files_options: {
                files: (_o = event == null ? void 0 : event.editor_files) != null ? _o : [],
                route: route("files.upload"),
                data: {
                  model_id: event ? event.id : 0,
                  model_type: "App\\Models\\Event"
                }
              }
            })
          }), /* @__PURE__ */ jsx("div", {
            className: "w-full flex justify-end text-center",
            children: /* @__PURE__ */ jsx(Submit, {
              value: "Save",
              onClick: submit,
              className: "w-300px "
            })
          })]
        })]
      }), /* @__PURE__ */ jsxs(WhiteContainer, {
        children: [/* @__PURE__ */ jsxs("div", {
          className: "flex justify-between items-center",
          children: [/* @__PURE__ */ jsx("h3", {
            className: "font-bold text-24",
            children: "Guests"
          }), /* @__PURE__ */ jsxs("div", {
            className: " flex items-center gap-12px",
            children: [/* @__PURE__ */ jsxs(BtnNoInertia, {
              className: "cursor-pointer flex items-center gap-12px",
              download: true,
              href: route("admin.events.export.guests", {
                event: event.id
              }),
              children: [/* @__PURE__ */ jsx(UserList, {}), " Export guests"]
            }), /* @__PURE__ */ jsxs(BtnNoInertia, {
              className: "cursor-pointer flex items-center gap-12px",
              onClick: (_) => toClipboard(`${route("event_detail", {
                event: event.id
              })}#registerForm`),
              children: [/* @__PURE__ */ jsx(Link, {}), " Copy invite link"]
            })]
          })]
        }), /* @__PURE__ */ jsxs("table", {
          className: "border-collapse table-fixed w-full text-left whitespace-nowrap mt-24px",
          children: [/* @__PURE__ */ jsx("thead", {
            children: /* @__PURE__ */ jsxs("tr", {
              children: [/* @__PURE__ */ jsx("th", {
                className: "px-12px py-8px font-bold",
                children: "First name"
              }), /* @__PURE__ */ jsx("th", {
                className: "px-12px py-8px font-bold",
                children: "Last name"
              }), /* @__PURE__ */ jsx("th", {
                className: "px-12px py-8px font-bold",
                children: "Company name"
              }), /* @__PURE__ */ jsx("th", {
                className: "px-12px py-8px font-bold",
                children: "Job title"
              }), /* @__PURE__ */ jsx("th", {
                className: "px-12px py-8px font-bold",
                children: "E-mail"
              }), /* @__PURE__ */ jsx("th", {
                className: "px-12px py-8px font-bold",
                children: "Status"
              })]
            })
          }), /* @__PURE__ */ jsx("tbody", {
            className: "",
            children: (_p = event == null ? void 0 : event.guests) == null ? void 0 : _p.map((g) => /* @__PURE__ */ jsx(GuestRow, {
              event_id: event.id,
              ...g
            }))
          })]
        })]
      })]
    })
  });
}
export {
  Create as default
};

Youez - 2016 - github.com/yon3zu
LinuXploit