import{c as j}from"react/compiler-runtime";import{jsx as L}from"react/jsx-runtime";import{useLexicalComposerContext as M}from"@lexical/react/LexicalComposerContext";import{useDocumentDrawer as _,useModal as b}from"@payloadcms/ui";import{$getPreviousSelection as h,$getSelection as v,$setSelection as E}from"lexical";import{useEffect as P,useState as T}from"react";var G=$=>{let e=j(21),[o]=M(),[l,k]=T(null),[c,C]=T(!1),[S,w,O]=_($),{closeDrawer:d,drawerSlug:t}=O,{modalState:n}=b(),i;e[0]!==o?(i=()=>{o.read(()=>{let r=v()??h();k(r)}),C(!0)},e[0]=o,e[1]=i):i=e[1];let g=i,a;e[2]!==l||e[3]!==o?(a=()=>{l&&o.update(()=>{E(l.clone())},{discrete:!0,skipTransforms:!0})},e[2]=l,e[3]=o,e[4]=a):a=e[4];let u=a,m;e[5]!==d?(m=()=>{d()},e[5]=d,e[6]=m):m=e[6];let x=m,f,D;e[7]!==c||e[8]!==n||e[9]!==t||e[10]!==u?(f=()=>{if(!c)return;let r=n[t];r&&!r?.isOpen&&(C(!1),setTimeout(()=>{u()},1))},D=[n,t,u,c],e[7]=c,e[8]=n,e[9]=t,e[10]=u,e[11]=f,e[12]=D):(f=e[11],D=e[12]),P(f,D);let s;e[13]!==w||e[14]!==g?(s=r=>L(w,{...r,onClick:g}),e[13]=w,e[14]=g,e[15]=s):s=e[15];let p;return e[16]!==x||e[17]!==S||e[18]!==t||e[19]!==s?(p={closeDocumentDrawer:x,DocumentDrawer:S,documentDrawerSlug:t,DocumentDrawerToggler:s},e[16]=x,e[17]=S,e[18]=t,e[19]=s,e[20]=p):p=e[20],p};export{G as a};
//# sourceMappingURL=chunk-5PBXL4HT.js.map
