import{r as i,j as u}from"./index-n-59FgrC.js";import{C as f,N as c,D as d,H as E,K as S,L as C}from"./TaskPanel-FSBo9x0f.js";import{g as N}from"./layers.B6AgvWr7-CmrKHMSF.js";import"./useTaskTypesData-CgG6u01U.js";import"./IconUser-BvK8eLe8.js";import"./tasks-CZQGFm5u.js";import"./get-env-uyVen0u2.js";import"./IconChevronLeft-CyT72r93.js";import"./use-resize-observer-Bh8oaK16.js";import"./SegmentedControl-D05EYfFd.js";import"./SimpleGrid-DzebcIbT.js";import"./get-base-value-JqT_q0U7.js";import"./TypographyStylesProvider-D2Jq4B6Y.js";import"./clamp--03mf-JJ.js";import"./IconSortDescending-DCVZ-bvF.js";import"./IconGripVertical-Ce_4nROx.js";import"./Accordion-DVbX6gPb.js";const D=f("INSERT_EXCALIDRAW_COMMAND");function v(){const[t]=c(),[n,e]=i.useState(!1),[r,l]=i.useState(null),o=i.useRef(null);return i.useEffect(()=>{if(!t.hasNodes([d]))throw new Error("ExcalidrawPlugin: ExcalidrawNode not registered on editor");return t.registerCommand(D,()=>{e(!0);const s=E();return l(s),!0},S)},[t]),u.jsx(N,{initialElements:[],initialAppState:{},initialFiles:{},isShown:n,onDelete:()=>{e(!1)},onClose:()=>{e(!1),o.current=!1},onSave:(s,p,m)=>{t.update(()=>{const a=C();a.setData(JSON.stringify({appState:p,elements:s,files:m})),r&&r.getParent()&&(r==null||r.replace(a))}),e(!1)},closeOnClickOutside:!1,isEdited:o})}export{D as INSERT_EXCALIDRAW_COMMAND,v as default};
