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