react-mail-inbox 1.0.14 → 1.0.15
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/index.js +1 -1
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +1 -1
- package/dist/index.mjs.map +1 -1
- package/package.json +1 -1
package/dist/index.js
CHANGED
|
@@ -1,3 +1,3 @@
|
|
|
1
|
-
'use strict';Object.defineProperty(exports,'__esModule',{value:true});var react=require('react'),jsxRuntime=require('react/jsx-runtime'),LexicalAutoFocusPlugin=require('@lexical/react/LexicalAutoFocusPlugin'),LexicalComposer=require('@lexical/react/LexicalComposer'),LexicalRichTextPlugin=require('@lexical/react/LexicalRichTextPlugin'),LexicalContentEditable=require('@lexical/react/LexicalContentEditable'),LexicalHistoryPlugin=require('@lexical/react/LexicalHistoryPlugin'),LexicalErrorBoundary=require('@lexical/react/LexicalErrorBoundary'),reactDom=require('react-dom'),md=require('react-icons/md'),po=require('reactjs-popup'),LexicalComposerContext=require('@lexical/react/LexicalComposerContext'),lexical=require('lexical'),list=require('@lexical/list'),link=require('@lexical/link'),utils=require('@lexical/utils'),selection=require('@lexical/selection'),reactDropzone=require('react-dropzone'),Uo=require('heic2any'),LexicalListPlugin=require('@lexical/react/LexicalListPlugin'),LexicalLinkPlugin=require('@lexical/react/LexicalLinkPlugin'),html=require('@lexical/html');function _interopDefault(e){return e&&e.__esModule?e:{default:e}}var po__default=/*#__PURE__*/_interopDefault(po);var Uo__default=/*#__PURE__*/_interopDefault(Uo);var Ae=react.createContext(void 0),te=()=>{let e=react.useContext(Ae);if(!e)throw new Error("useTheme must be used within a ThemeProvider");return e},Ie=({children:e,initialTheme:o="dark",onThemeChange:r})=>{let[n,t]=react.useState(o);react.useEffect(()=>{r&&r(n);},[n,r]);let i=()=>{t(l=>l==="light"?"dark":"light");};return jsxRuntime.jsx(Ae.Provider,{value:{theme:n,toggleTheme:i},children:e})};var De=react.createContext(void 0),B=()=>{let e=react.useContext(De);if(!e)throw new Error("useEmailContext must be used within an EmailProvider");return e},ze=({children:e})=>{let[o,r]=react.useState({to:[],cc:[],bcc:[]}),[n,t]=react.useState(false),[i,l]=react.useState(""),[d,h]=react.useState(false),[u,x]=react.useState(false),[a,m]=react.useState([]);return react.useEffect(()=>{console.log("EmailProvider emails updated:",o);},[o]),jsxRuntime.jsx(De.Provider,{value:{emails:o,setEmails:r,subject:i,setSubject:l,showCC:d,setShowCC:h,showBCC:u,setShowBCC:x,attachments:a,setAttachments:m,isReply:n,setIsReply:t},children:e})};var s={undo:"undo",redo:"redo",bold:"bold",italic:"italic",underline:"underline",color:{base:"colors"},code:"code",link:"link",listNumber:"listNumber",listBullet:"listBullet",align:{base:"align"},indent:"indent",indentDecrease:"indentDecrease",strike:"strike",attachFile:"attachFile",fontSize:"fontSize",fontFamily:"fontFamily"},y={styling:"styling",divider:"divider",component:"component"},Be=[{type:y.styling,icon:"Styling",id:"4bc66ea9-2e35-4a7b-a674-be7e4ee163c5",options:[{name:s.undo,type:y.component,icon:"Undo",id:"29cf5eb3-37cd-482f-9a15-c358faf19cc2"},{name:s.redo,type:y.component,icon:"Redo",id:"8744f7ab-5818-46ce-9417-2fec87123afe"},{type:y.divider,id:"ed0104fd-3507-43f6-80c1-813fbdf04479"},{name:s.fontFamily,type:y.component,id:"1c12d7e2-aa6a-42b4-b25c-b55fe3bcf524"},{type:y.divider,id:"d0f67d01-0731-411a-b448-e1dca47014f4"},{name:s.fontSize,type:y.component,id:"82e31b62-5441-4052-887c-faa02d0b7075"},{type:y.divider,id:"2e3558e4-3ad4-422b-8502-ea3c58fb8c2e"},{name:s.bold,type:y.component,icon:"Bold",id:"ac2b5b54-7323-44a4-bc6d-8bae6e48efe2"},{name:s.italic,type:y.component,icon:"Italic",id:"6a927c2a-2230-4dc7-af71-47fbe9fb784d"},{name:s.underline,type:y.component,icon:"Underline",id:"f07b3a6f-ffaa-4153-beae-79a36acb6a08"},{name:s.color.base,type:y.component,icon:"Color",id:"e14ec25f-3dd3-4ed5-b33a-a033684d248b"},{type:y.divider,id:"93e60297-206f-4f31-bc29-11daff2052bd"},{name:s.align.base,type:y.component,id:"30da93ea-efa6-4642-bfa5-28fd4dc9c5b3"},{type:y.divider,id:"9bad0563-6118-4855-9286-402bf98e00ad"},{name:s.listNumber,type:y.component,icon:"OrderedList",id:"d37865e1-ff54-4118-a5cc-fa147d222471"},{name:s.listBullet,type:y.component,icon:"UnOrderedList",id:"ed77e7c9-b89c-41c5-a749-e68ea0b30497"},{type:y.divider,id:"e5ecd77b-44cc-42fe-badb-48cadf3ddfb1"},{name:s.indentDecrease,type:y.component,icon:"IndentLess",id:"2dc6a5e4-b1b5-47d1-ac2f-5d0becb02d33"},{name:s.indent,type:y.component,icon:"IndentMore",id:"6903a3d1-a83f-4bc6-9bd9-f673feffe84f"}]},{type:"component",name:s.attachFile,icon:"Attach",id:"f43a284e-113e-4095-b001-9d00a1dddc4c"},{type:"component",name:s.link,icon:"Link",id:"580db61e-7939-4efe-914c-304b271998ec"}];var ao={Undo:md.MdUndo,Redo:md.MdRedo,Bold:md.MdFormatBold,Italic:md.MdFormatItalic,Underline:md.MdFormatUnderlined,Color:md.MdTextFormat,LeftAlign:md.MdFormatAlignLeft,RightAlign:md.MdFormatAlignRight,CenterAlign:md.MdFormatAlignCenter,UnOrderedList:md.MdFormatListBulleted,OrderedList:md.MdFormatListNumbered,IndentLess:md.MdFormatIndentDecrease,IndentMore:md.MdOutlineFormatIndentIncrease,RemoveFormat:md.MdFormatClear,StrikeThrough:md.MdStrikethroughS,CodeQuote:md.MdFormatQuote,DownArrow:md.MdArrowDropDown,Styling:md.MdTextFormat,Attach:md.MdAttachFile,Link:md.MdLink,Image:md.MdImage,Check:md.MdCheck,TextFields:md.MdTextFields,Edit:md.MdEdit,Close:md.MdClose},Ue=ao;var lo=({name:e,size:o=24,color:r,className:n})=>{let t=Ue[e];return t?jsxRuntime.jsx(t,{size:o,color:r,className:n}):(console.warn(`Icon "${e}" not found.`),null)},k=lo;var mo=({trigger:e,children:o,popUpDirection:r="top center"})=>{let n=react.useRef(null),t=()=>{n.current&&typeof n.current.close=="function"&&n.current.close();};return jsxRuntime.jsx(po__default.default,{ref:n,trigger:e,closeOnDocumentClick:true,repositionOnResize:true,position:r,className:"mail-inbox-popup",children:l=>o({close:()=>{l?.(),t();}})})},_=mo;var uo=[{label:"Sans Serif",value:"sans-serif",style:{fontFamily:"sans-serif"}},{label:"Serif",value:"serif",style:{fontFamily:"serif"}},{label:"Fixed Width",value:"monospace",style:{fontFamily:"monospace"}},{label:"Wide",value:"wide",style:{fontWeight:"bold",letterSpacing:"0.05em"}},{label:"Narrow",value:"narrow",style:{fontStretch:"condensed"}},{label:"Comic Sans MS",value:"Comic Sans MS",style:{fontFamily:"Comic Sans MS, cursive"}},{label:"Garamond",value:"Garamond",style:{fontFamily:"Garamond, serif"}},{label:"Georgia",value:"Georgia",style:{fontFamily:"Georgia, serif"}},{label:"Tahoma",value:"Tahoma",style:{fontFamily:"Tahoma, sans-serif"}},{label:"Trebuchet MS",value:"Trebuchet MS",style:{fontFamily:"Trebuchet MS, sans-serif"}},{label:"Verdana",value:"Verdana",style:{fontFamily:"Verdana, sans-serif"}}],oe=[{key:"small",label:"Small",sizePx:12},{key:"normal",label:"Normal",sizePx:18},{key:"large",label:"Large",sizePx:28},{key:"huge",label:"Huge",sizePx:56}],me=["#000000","#3a3a3a","#5a5a5a","#8a8a8a","#bfbfbf","#dedede","#f3f3f3","#ffffff"],fe=["#e53935","#fb8c00","#ffee58","#66ff66","#4dd0e1","#1e88e5","#9c27b0","#ff3bd6"],ue=[["#f7d7d7","#f3d0c8","#f0c5c5","#efc9d8","#f7e6e9","#f3edf7","#f0eaf6","#f8f0f6"],["#f0b9b9","#f0d4c2","#e6f0d2","#e4f7e8","#d8eef8","#dbe1ff","#e9d9f6","#f5d9f7"],["#e69a9a","#e6caa3","#d7e6b0","#c8f0e6","#bfe3ff","#cbd8ff","#d6c3f3","#f0c2f3"],["#d16464","#d09a6a","#a8cf7b","#7fd6c0","#73b7ff","#7a9cff","#b483f1","#f08cf2"],["#b23a3a","#b26a3a","#7aa04a","#3fb092","#296f94","#2a4177","#452a68","#6e1f4d"],["#7a1d1d","#7a4a1e","#556a2a","#195b47","#123f5a","#182840","#2a1836","#3a1026"]],ge=uo;function be({value:e="serif",onChange:o}){return jsxRuntime.jsx("div",{children:jsxRuntime.jsx(_,{trigger:jsxRuntime.jsxs("button",{className:"font-option heading",children:[ge?.find(r=>r.value===e)?.label,jsxRuntime.jsx(k,{name:"DownArrow"})]}),children:({close:r})=>jsxRuntime.jsx("div",{className:"p-4",children:jsxRuntime.jsx("div",{className:"font-options",children:ge.map(n=>jsxRuntime.jsx("button",{className:"btn-mail-editor",onClick:()=>{o(n.value),r();},style:{...n.style},children:jsxRuntime.jsxs("div",{className:"font-option",children:[e===n.value&&jsxRuntime.jsx(k,{name:"Check"}),n.label]})},n.value))})})})})}function he({value:e="normal",onChange:o=()=>{}}){return jsxRuntime.jsx("div",{children:jsxRuntime.jsx(_,{trigger:jsxRuntime.jsxs("button",{className:"font-option heading",children:[jsxRuntime.jsx(k,{name:"TextFields"}),jsxRuntime.jsx(k,{name:"DownArrow"})]}),children:({close:r})=>jsxRuntime.jsx("div",{className:"p-4",children:jsxRuntime.jsx("div",{className:"font-options",children:oe.map(n=>jsxRuntime.jsx("button",{className:"btn-mail-editor",onClick:()=>{o(n.key),r();},style:{fontSize:`${n.sizePx}px`},children:jsxRuntime.jsxs("div",{className:"font-option",children:[e===n.key&&jsxRuntime.jsx(k,{name:"Check"}),n.label]})},n.key))})})})})}function Y({color:e,selected:o,onClick:r,label:n}){return jsxRuntime.jsx("button",{className:"swatch",title:n||e,"aria-pressed":o,onClick:()=>r(e),style:{background:e},children:o&&jsxRuntime.jsx("svg",{className:"check",viewBox:"0 0 24 24","aria-hidden":true,children:jsxRuntime.jsx("path",{d:"M20 6L9 17l-5-5",stroke:"white",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round",fill:"none"})})})}function xe({value:e={background:"#ffffff",text:"#000000"},onChange:o=()=>{}}){function r(n,t){o({...e,[n]:t});}return jsxRuntime.jsx("div",{children:jsxRuntime.jsx(_,{trigger:jsxRuntime.jsxs("button",{className:"font-option heading",children:[jsxRuntime.jsx(k,{name:"Styling"}),jsxRuntime.jsx(k,{name:"DownArrow"})]}),children:({close:n})=>jsxRuntime.jsx("div",{className:"color-popover",role:"dialog","aria-label":"Choose colors",children:jsxRuntime.jsxs("div",{className:"color-columns",children:[jsxRuntime.jsxs("section",{className:"color-column","aria-labelledby":"bg-label",children:[jsxRuntime.jsx("h4",{id:"bg-label",children:"Background color"}),jsxRuntime.jsx("div",{className:"row",children:me.map(t=>jsxRuntime.jsx(Y,{color:t,selected:e.background===t,onClick:i=>{r("background",i),n();},label:t},t+"bg"))}),jsxRuntime.jsx("div",{className:"row accent-row",children:fe.map(t=>jsxRuntime.jsx(Y,{color:t,selected:e.background===t,onClick:i=>{r("background",i),n();},label:t},t+"bgacc"))}),jsxRuntime.jsx("div",{className:"palette",children:ue.map((t,i)=>jsxRuntime.jsx("div",{className:"palette-row",children:t.map(l=>jsxRuntime.jsx(Y,{color:l,selected:e.background===l,onClick:d=>{r("background",d),n();},label:l},l+"bgp"+i))},"row"+i))})]}),jsxRuntime.jsxs("section",{className:"color-column","aria-labelledby":"text-label",children:[jsxRuntime.jsx("h4",{id:"text-label",children:"Text color"}),jsxRuntime.jsx("div",{className:"row",children:me.map(t=>jsxRuntime.jsx(Y,{color:t,selected:e.text===t,onClick:i=>{r("text",i),n();},label:t},t+"tx"))}),jsxRuntime.jsx("div",{className:"row accent-row",children:fe.map(t=>jsxRuntime.jsx(Y,{color:t,selected:e.text===t,onClick:i=>{r("text",i),n();},label:t},t+"txacc"))}),jsxRuntime.jsx("div",{className:"palette",children:ue.map((t,i)=>jsxRuntime.jsx("div",{className:"palette-row",children:t.map(l=>jsxRuntime.jsx(Y,{color:l,selected:e.text===l,onClick:d=>{r("text",d),n();},label:l},l+"txp"+i))},"txrow"+i))})]})]})})})})}var Ge=[{key:"left",iconName:"LeftAlign",label:"Left align"},{key:"center",iconName:"CenterAlign",label:"Center align"},{key:"right",iconName:"RightAlign",label:"Right align"}];function ve({value:e="left",onChange:o=()=>{}}){function r(n){o(n);}return jsxRuntime.jsx("div",{children:jsxRuntime.jsx(_,{trigger:jsxRuntime.jsxs("button",{className:"font-option heading",children:[jsxRuntime.jsx(k,{name:Ge?.find(n=>n.key===e)?.iconName||"LeftAlign"}),jsxRuntime.jsx(k,{name:"DownArrow"})]}),children:({close:n})=>jsxRuntime.jsx("div",{className:"wrapper-alignment",children:Ge.map(t=>{let i=t.key===e;return jsxRuntime.jsxs("button",{role:"menuitemradio","aria-checked":i,tabIndex:0,className:`alignment-option ${i?"active":""}`,onClick:()=>{r(t.key),n();},children:[jsxRuntime.jsx("div",{className:"option-icon",children:jsxRuntime.jsx(k,{name:t.iconName,size:20})}),jsxRuntime.jsx("div",{className:`option-check ${i?"":"hidden"}`,"aria-hidden":true,children:jsxRuntime.jsx("svg",{width:"16",height:"16",viewBox:"0 0 24 24",children:jsxRuntime.jsx("path",{d:"M20 6L9 17l-5-5",fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round"})})})]},t.key)})})})})}var Oo=1;function Xe(e){if(!e||e.startsWith("#"))return e;if(e.startsWith("rgba")){let r=e.match(/rgba?\((\d+),\s*(\d+),\s*(\d+),?\s*([\d.]+)?\)/);if(r){let[,n,t,i,l]=r;return l==="0"?"transparent":"#"+[n,t,i].map(d=>{let h=parseInt(d).toString(16);return h.length===1?"0"+h:h}).join("")}}let o=e.match(/rgb\((\d+),\s*(\d+),\s*(\d+)\)/);if(o){let[,r,n,t]=o;return "#"+[r,n,t].map(i=>{let l=parseInt(i).toString(16);return l.length===1?"0"+l:l}).join("")}return e}function Po(){let[e]=LexicalComposerContext.useLexicalComposerContext(),[o,r]=react.useState("paragraph"),[n,t]=react.useState({[s.fontFamily]:"sans-serif",[s.fontSize]:16,[s.align.base]:"left"}),[i,l]=react.useState(false),d=react.useCallback(()=>{let f=lexical.$getSelection(),b={[s.fontFamily]:"sans-serif",[s.fontSize]:16,[s.align.base]:"left"};if(lexical.$isRangeSelection(f)){let F=f.anchor.getNode(),c=F.getKey()==="root"?F:F.getTopLevelElementOrThrow(),p=c.getKey(),g=e.getElementByKey(p);if(g!==null)if(list.$isListNode(c)){let L=utils.$getNearestNodeOfType(F,list.ListNode),ee=L?L.getTag():c.getTag();r(ee);}else {let L=c.getType();r(L);}b[s.bold]=f.hasFormat("bold"),b[s.italic]=f.hasFormat("italic"),b[s.underline]=f.hasFormat("underline"),b[s.strike]=f.hasFormat("strikethrough"),b[s.code]=f.hasFormat("code");let H=O(f),P=H.getParent();link.$isLinkNode(P)||link.$isLinkNode(H)?(b[s.link]=true,l(true)):(b[s.link]=false,l(false));let D=e.getElementByKey(H.getKey()),T=e.getElementByKey(P.getKey()),S=D||T||g;if(S){let L=window.getComputedStyle(S),ee=L.getPropertyValue("font-family");if(ee){let G=ee.split(",")[0].trim().replace(/['"]/g,"");(G==="-apple-system"||G==="BlinkMacSystemFont"||G==="system-ui")&&(G="sans-serif"),b[s.fontFamily]=G;}let Le=L.getPropertyValue("font-size");if(Le){let G=parseInt(Le,10);b[s.fontSize]=G||16;}let W=null,z=null;S instanceof HTMLElement&&S.style&&(W=S.style.color||null,z=S.style.backgroundColor||null),W||(W=L.getPropertyValue("color")),z||(z=L.getPropertyValue("background-color")),console.log("\u{1F3A8} Color detection:",{inlineColor:S instanceof HTMLElement?S.style.color:"N/A",inlineBg:S instanceof HTMLElement?S.style.backgroundColor:"N/A",computedColor:W,computedBg:z,element:S});let Te=W?Xe(W):null,Me=z&&z!=="rgba(0, 0, 0, 0)"&&z!=="transparent"?Xe(z):null;(Te||Me)&&(b[s.color.base]={text:Te||"#000000",background:Me||"#ffffff"});let pe=L.getPropertyValue("text-align")||"left";pe==="start"&&(pe="left"),b[s.align.base]=pe;}t(b);}},[e]);react.useEffect(()=>utils.mergeRegister(e.registerUpdateListener(({editorState:f})=>{f.read(()=>{d();});}),e.registerCommand(lexical.SELECTION_CHANGE_COMMAND,()=>(d(),false),Oo)),[e,d]);function h(f,b){switch(f){case s.bold:e.dispatchCommand(lexical.FORMAT_TEXT_COMMAND,"bold");break;case s.italic:e.dispatchCommand(lexical.FORMAT_TEXT_COMMAND,"italic");break;case s.underline:e.dispatchCommand(lexical.FORMAT_TEXT_COMMAND,"underline");break;case s.align.base:e.dispatchCommand(lexical.FORMAT_ELEMENT_COMMAND,b);break;case s.undo:e.dispatchCommand(lexical.UNDO_COMMAND,void 0);break;case s.redo:e.dispatchCommand(lexical.REDO_COMMAND,void 0);break;case s.listNumber:w();break;case s.listBullet:v();break;case s.indent:u();break;case s.indentDecrease:N();break;case s.color.base:m(b);break;case s.fontFamily:x(b);break;case s.fontSize:a(b);break;case s.link:E();break;}}let u=()=>{e.dispatchCommand(lexical.INDENT_CONTENT_COMMAND,void 0);},x=f=>{e.update(()=>{let b=lexical.$getSelection();lexical.$isRangeSelection(b)&&selection.$patchStyleText(b,{"font-family":f});});},a=f=>{let b=oe.find(F=>F.key===f)?.sizePx??16;e.update(()=>{let F=lexical.$getSelection();lexical.$isRangeSelection(F)&&selection.$patchStyleText(F,{"font-size":`${b}px`});});},m=f=>{e.update(()=>{let b=lexical.$getSelection();lexical.$isRangeSelection(b)&&selection.$patchStyleText(b,{"background-color":f.background,color:f.text});});},E=react.useCallback(()=>{i?e.dispatchCommand(link.TOGGLE_LINK_COMMAND,null):e.dispatchCommand(link.TOGGLE_LINK_COMMAND,"https://");},[e,i]),N=()=>{e.dispatchCommand(lexical.OUTDENT_CONTENT_COMMAND,void 0);},v=()=>{o!=="ul"?e.dispatchCommand(list.INSERT_UNORDERED_LIST_COMMAND,void 0):e.dispatchCommand(list.REMOVE_LIST_COMMAND,void 0);},w=()=>{o!=="ol"?e.dispatchCommand(list.INSERT_ORDERED_LIST_COMMAND,void 0):e.dispatchCommand(list.REMOVE_LIST_COMMAND,void 0);};function O(f){let b=f.anchor,F=f.focus,c=f.anchor.getNode(),p=f.focus.getNode();return c===p?c:f.isBackward()?selection.$isAtNodeEnd(F)?c:p:selection.$isAtNodeEnd(b)?p:c}return {onChange:h,isLink:i,editor:e,selectedEventTypes:n,blockType:o}}var Qe=Po;function Do({editor:e}){let o=react.useRef(null),r=react.useRef(null),n=react.useRef(false),[t,i]=react.useState(""),[l,d]=react.useState(false),[h,u]=react.useState(null),x=react.useCallback(()=>{let a=window.getSelection(),m=lexical.$getSelection();if(lexical.$isRangeSelection(m)){let w=zo(m),O=w.getParent();link.$isLinkNode(O)?i(O.getURL()):link.$isLinkNode(w)?i(w.getURL()):i("");}let E=o.current,N=document.activeElement;if(!E)return;let v=e.getRootElement();if(m&&a&&!a.isCollapsed&&v&&v.contains(a.anchorNode)){let w=a.getRangeAt(0),O;if(a.anchorNode===v){let f=v;for(;f.firstElementChild!=null;)f=f.firstElementChild;O=f.getBoundingClientRect();}else O=w.getBoundingClientRect();n.current||tt(E,O),u(m);}else (!N||N.className!=="link-input")&&(tt(E,null),u(null),d(false),i(""));return true},[e]);return react.useEffect(()=>utils.mergeRegister(e.registerUpdateListener(({editorState:a})=>{a.read(()=>{x();});}),e.registerCommand(lexical.SELECTION_CHANGE_COMMAND,()=>(x(),true),1)),[e,x]),react.useEffect(()=>{e.getEditorState().read(()=>{x();});},[e,x]),react.useEffect(()=>{l&&r.current&&r.current.focus();},[l]),jsxRuntime.jsxs("div",{className:"floating-link-editor",ref:o,children:[l?jsxRuntime.jsx("input",{ref:r,className:"link-input",value:t,onChange:a=>i(a.target.value),onKeyDown:a=>{a.key==="Enter"?(a.preventDefault(),h&&t!==""&&e.dispatchCommand(link.TOGGLE_LINK_COMMAND,t),d(false)):a.key==="Escape"&&(a.preventDefault(),d(false));},placeholder:"Enter link..."}):jsxRuntime.jsx("div",{className:"link-display",children:jsxRuntime.jsx("a",{href:t,target:"_blank",rel:"noopener noreferrer",children:t||"No link selected"})}),jsxRuntime.jsx("button",{className:"link-button",onMouseDown:a=>a.preventDefault(),onClick:()=>{console.log("floating link editor",l),l&&e.dispatchCommand(link.TOGGLE_LINK_COMMAND,t),d(a=>!a);},children:jsxRuntime.jsx(k,{name:l?"Check":"Edit"})})]})}function zo(e){let o=e.anchor.getNode(),r=e.focus.getNode();return o===r?o:e.isBackward()?selection.$isAtNodeEnd(e.focus)?o:r:selection.$isAtNodeEnd(e.anchor)?r:o}function tt(e,o){if(!o){e.style.opacity="0",e.style.top="-1000px",e.style.left="-1000px";return}let r=e.offsetWidth,n=e.offsetHeight,t=window.innerWidth,i=window.innerHeight,l=o.top+o.height+window.pageYOffset+10,d=o.left+window.pageXOffset-r/2+o.width/2;d<8&&(d=8),d+r>t-8&&(d=t-r-8),l+n>i-8&&(l=o.top+window.pageYOffset-n-10),l<8&&(l=8),e.style.opacity="1",e.style.top=`${l}px`,e.style.left=`${d}px`;}var ot=Do;var $={FILE_INVALID_TYPE:"file-invalid-type",FILE_TOO_LARGE:"file-too-large",TOO_MANY_FILES:"too-many-files",HEIC_CONVERSION_ERROR:"heic-conversion-error"},$o=10,Ho=10,it=()=>Math.random().toString(36).substring(2,10)+Date.now().toString(36),Go=e=>{if(e<1024)return {value:e.toString(),type:"bytes"};let o=e/1024;if(o<1024)return {value:o.toFixed(1),type:"KB"};let r=o/1024;return r<1024?{value:r.toFixed(1),type:"MB"}:{value:(r/1024).toFixed(1),type:"GB"}},at=({accept:e={"image/*":[".png",".gif",".jpeg",".jpg"],"application/pdf":[".pdf"]},maxSize:o=Ho*1024*1024,maxFiles:r=$o,multiple:n=true,isDisabled:t=false,replaceAfterUpload:i=false,files:l=[],handleFileChange:d=()=>{}})=>{let[h,u]=react.useState(false),[x,a]=react.useState(l??[]),[m,E]=react.useState([]),N=c=>{switch(c){case $.FILE_INVALID_TYPE:return "Invalid file type. Please upload a supported format.";case $.FILE_TOO_LARGE:{let{value:p,type:g}=Go(o);return `File too large. Maximum allowed size is ${p} ${g}.`}case $.TOO_MANY_FILES:return `Too many files selected. Maximum allowed: ${r}.`;case $.HEIC_CONVERSION_ERROR:return "Failed to convert HEIC image. Please upload a JPEG or PNG instead.";default:return "An unknown file error occurred."}};react.useEffect(()=>{d(x);},[x]);let{getRootProps:v,getInputProps:w,isDragActive:O,open:f}=reactDropzone.useDropzone({accept:e,maxSize:o,multiple:n,maxFiles:r,disabled:t,noClick:true,onFileDialogCancel:()=>u(false),onFileDialogOpen:()=>{t||u(true);},onDrop:async(c,p)=>{let H=(await Promise.all(c.map(async P=>{if(!P)return null;if(P.type==="image/heic")try{let D=await Uo__default.default({blob:P,toType:"image/jpeg"}),T=Array.isArray(D)?D[0]:D,S=new File([T],`${P.name.replace(/\.heic$/i,"")}.jpeg`,{type:"image/jpeg"});return Object.assign(S,{uuid:it(),preview:URL.createObjectURL(S)})}catch(D){console.error("HEIC conversion error:",D);let T=N($.HEIC_CONVERSION_ERROR);return E(S=>[...S,{file:P,preview:URL.createObjectURL(P),readableErrors:[T],errors:[{code:$.HEIC_CONVERSION_ERROR,message:T}]}]),null}return Object.assign(P,{uuid:it(),preview:URL.createObjectURL(P)})}))).filter(Boolean);if(!t){let P=i?[]:[...x];P=[...P,...H];let D=p.map(T=>{let S=T.errors.map(L=>N(L.code));return {file:T.file,errors:T.errors.map(L=>({code:L.code,message:L.message})),preview:URL.createObjectURL(T.file),readableErrors:S}});return E(T=>[...T,...D]),a(P),P}return x},validator:c=>{let{name:p,type:g}=c;if(p){let H=p.split(".").pop()?.toLowerCase();if(e&&e?.[g]&&e?.[g].length&&!e?.[g].includes(`.${H}`))return {code:$.FILE_INVALID_TYPE,message:N($.FILE_INVALID_TYPE)}}return null}}),b=react.useCallback(c=>{a(p=>p.filter(g=>g.uuid!==c));},[a]),F=react.useCallback(()=>{E([]);},[]);return react.useEffect(()=>()=>{x.forEach(c=>c.preview&&URL.revokeObjectURL(c.preview)),m.forEach(c=>c.preview&&URL.revokeObjectURL(c.preview));},[]),{getRootProps:v,getInputProps:w,isDragActive:O,isFileDialogOpen:h,rejectedFiles:m,openFileDialog:f,removeFile:b,clearRejectedFiles:F}};var jo=({handleFileChange:e})=>{let{getRootProps:o,getInputProps:r,openFileDialog:n}=at({multiple:true,maxFiles:5,maxSize:5242880,handleFileChange:t=>{e(t);}});return jsxRuntime.jsx("div",{className:"uploader-container",children:jsxRuntime.jsxs("div",{...o(),children:[jsxRuntime.jsx("input",{...r()}),jsxRuntime.jsx("button",{onClick:n,children:jsxRuntime.jsx(k,{className:"upload-icon",name:"Attach"})})]})})},lt=jo;function Se({file:e,index:o,onRemove:r,onView:n}){if(!e)return null;let t=e?.name??"unknown",i=e instanceof File||"size"in e&&e.size!==void 0?e.size:"bytes"in e&&e.bytes!==void 0?e.bytes:null,l=("url"in e?e?.url:null)??null,d=react.useMemo(()=>{if(l)return l;if(typeof window<"u"&&e instanceof File)try{return URL.createObjectURL(e)}catch{return null}return null},[e,l]),h=a=>{if(!a&&a!==0)return "";let m=Math.round(a/1024);return m<1024?`${m}K`:`${Math.round(a/1024/1024*10)/10}M`},u=a=>{if(a.preventDefault(),n)return n(d??null);d&&window.open(d,"_blank","noopener");},x=a=>{r&&r(a);};return jsxRuntime.jsxs("div",{className:"fps-row",role:"group","aria-label":`Attachment ${t}`,children:[jsxRuntime.jsxs("div",{className:"fps-left",children:[jsxRuntime.jsx("a",{href:d??"#",className:"fps-filename",onClick:u,title:t,target:"_blank",rel:"noopener noreferrer",children:t}),i!=null&&jsxRuntime.jsxs("span",{className:"fps-size",children:["\xA0(",h(i),")"]})]}),jsxRuntime.jsx("button",{type:"button",className:"fps-close","aria-label":`Remove ${t}`,onClick:()=>x(o),children:"\xD7"})]})}var dt=(e,{onChange:o,state:r,setState:n,selectedEventTypes:t,blockType:i,setAttachments:l})=>{switch(e.name){case s.undo:case s.redo:case s.bold:case s.italic:case s.underline:case s.indentDecrease:case s.indent:case s.link:return jsxRuntime.jsx("button",{className:`tool-bar-button ${t?.[e.name]?"active-btn-toolbar":""}`,onClick:()=>{o(e.name,true);},children:jsxRuntime.jsx(k,{className:"tool-bar-button-icon",name:e.icon})},`${e.name}-${e.icon}`);case s.listNumber:return jsxRuntime.jsx("button",{className:i==="ol"?"active-btn-toolbar":"",onClick:()=>{o(e.name,true);},children:jsxRuntime.jsx(k,{className:"tool-bar-button-icon",name:e.icon})},`${e.name}-${e.icon}`);case s.listBullet:return jsxRuntime.jsx("button",{className:i==="ul"?"active-btn-toolbar":"",onClick:()=>{o(e.name,true);},children:jsxRuntime.jsx(k,{className:"tool-bar-button-icon",name:e.icon})},`${e.name}-${e.icon}`);case s.attachFile:return jsxRuntime.jsx(lt,{value:r?.[e.name],handleFileChange:d=>{console.log("\u{1F680} ~ getToolbarComponent ~ e:",d),n(h=>({...h,[e.name]:d})),l(d);}});case s.fontFamily:return jsxRuntime.jsx(be,{value:t?.[e.name]||r?.[e.name],onChange:d=>{o(e.name,d);}});case s.fontSize:return jsxRuntime.jsx(he,{value:t?.[e.name]||r?.[e.name],onChange:d=>{o(e.name,d);}});case s.color.base:return jsxRuntime.jsx(xe,{value:t?.[e.name]||r?.[e.name],onChange:d=>{o(e.name,d);}});case s.align.base:return jsxRuntime.jsx(ve,{value:t?.[e.name]||r?.[e.name],onChange:d=>{o(e.name,d);}});}return e.type===y.divider?jsxRuntime.jsx("span",{className:"divider"}):"-"},Yo=(e,{setToggle:o,toggle:r,onChange:n,state:t,setState:i,selectedEventTypes:l,blockType:d,setAttachments:h})=>{switch(e.type){case y.divider:return jsxRuntime.jsx("div",{className:"divider"},`divider-${e.type}-${e.icon}`);case y.component:return dt(e,{onChange:n,state:t,setState:i,selectedEventTypes:l,blockType:d,setAttachments:h});case y.styling:return jsxRuntime.jsxs("div",{className:"styling-toolbar",children:[r?jsxRuntime.jsx("div",{className:"styling-options",children:e.options?.length&&Array.isArray(e.options)?e.options?.map(u=>dt(u,{onChange:n,state:t,setState:i,selectedEventTypes:l,blockType:d,setAttachments:h})):null}):null,jsxRuntime.jsx("button",{onClick:()=>o(u=>!u),children:jsxRuntime.jsx(k,{className:"tool-bar-button-icon",name:e.icon})})]},`divider-${e.type}-${e.icon}`);}return "-"};function qo({rightChildren:e,leftChildren:o}){let[r,n]=react.useState(true),[t,i]=react.useState({}),{setAttachments:l}=B(),{onChange:d,isLink:h,editor:u,selectedEventTypes:x,blockType:a}=Qe();return console.log("\u{1F680} ~ ToolBar ~ selectedEventTypes:",x),jsxRuntime.jsxs("div",{className:"toolbar-container",children:[t[s.attachFile]?.length?jsxRuntime.jsx("div",{className:"file-upload-container",children:t[s.attachFile]?.map((m,E)=>jsxRuntime.jsx(Se,{file:m,index:E,onRemove:N=>{i(v=>{let w=v[s.attachFile].filter((O,f)=>f!==N);return l(w),{...v,[s.attachFile]:w}});}},E))}):null,jsxRuntime.jsxs("div",{className:"toolbar-wrapper",children:[o,Be?.map(m=>Yo(m,{setToggle:n,state:t,setState:i,toggle:r,onChange:d,selectedEventTypes:x,blockType:a,setAttachments:l})),e,h?reactDom.createPortal(jsxRuntime.jsx(ot,{editor:u}),document.body):null]})]})}var pt=qo;var Xo={ltr:"ltr",rtl:"rtl",placeholder:"editor-placeholder",paragraph:"editor-paragraph",quote:"editor-quote",heading:{h1:"editor-heading-h1",h2:"editor-heading-h2",h3:"editor-heading-h3",h4:"editor-heading-h4",h5:"editor-heading-h5"},list:{nested:{listitem:"editor-nested-listitem"},ol:"editor-list-ol",ul:"editor-list-ul",listitem:"editor-listitem"},image:"editor-image",link:"editor-link",text:{bold:"editor-text-bold",italic:"editor-text-italic",overflowed:"editor-text-overflowed",hashtag:"editor-text-hashtag",underline:"editor-text-underline",strikethrough:"editor-text-strikethrough",underlineStrikethrough:"editor-text-underlineStrikethrough",code:"editor-text-code"},code:"editor-code",codeHighlight:{atrule:"editor-tokenAttr",attr:"editor-tokenAttr",boolean:"editor-tokenProperty",builtin:"editor-tokenSelector",cdata:"editor-tokenComment",char:"editor-tokenSelector",class:"editor-tokenFunction","class-name":"editor-tokenFunction",comment:"editor-tokenComment",constant:"editor-tokenProperty",deleted:"editor-tokenProperty",doctype:"editor-tokenComment",entity:"editor-tokenOperator",function:"editor-tokenFunction",important:"editor-tokenVariable",inserted:"editor-tokenSelector",keyword:"editor-tokenAttr",namespace:"editor-tokenVariable",number:"editor-tokenProperty",operator:"editor-tokenOperator",prolog:"editor-tokenComment",property:"editor-tokenProperty",punctuation:"editor-tokenPunctuation",regex:"editor-tokenVariable",selector:"editor-tokenSelector",string:"editor-tokenSelector",symbol:"editor-tokenProperty",tag:"editor-tokenProperty",url:"editor-tokenOperator",variable:"editor-tokenVariable"}},mt=Xo;function tn({initialHTML:e}){let[o]=LexicalComposerContext.useLexicalComposerContext();return react.useEffect(()=>{o.update(()=>{let n=new DOMParser().parseFromString(e,"text/html"),t=html.$generateNodesFromDOM(o,n),i=lexical.$getRoot();i.clear(),i.append(...t);});},[o,e]),null}var ft=tn;function Pe({onChange:e}){let[o]=LexicalComposerContext.useLexicalComposerContext();return react.useEffect(()=>o.registerUpdateListener(({editorState:r})=>{r.read(()=>{let n=html.$generateHtmlFromNodes(o,null);e(n);});}),[o,e]),null}function xn(e){console.error(e);}function vn({placeholder:e="",initialHTML:o="",rightChildren:r,leftChildren:n,minHeight:t="",onChange:i,editorChildren:l,isEditorVisible:d=true}){return jsxRuntime.jsx("div",{className:"my-editor-wrapper",children:jsxRuntime.jsxs(LexicalComposer.LexicalComposer,{initialConfig:{namespace:"MyEditor",theme:mt,nodes:[link.LinkNode,list.ListNode,list.ListItemNode,link.AutoLinkNode],onError:xn},children:[d?jsxRuntime.jsx(LexicalRichTextPlugin.RichTextPlugin,{contentEditable:jsxRuntime.jsx(LexicalContentEditable.ContentEditable,{style:{minHeight:t},className:"my-editor-content","aria-placeholder":e,placeholder:jsxRuntime.jsx("div",{className:"my-editor-placeholder",children:e})}),ErrorBoundary:LexicalErrorBoundary.LexicalErrorBoundary}):l,jsxRuntime.jsx(pt,{rightChildren:r,leftChildren:n}),jsxRuntime.jsx(LexicalHistoryPlugin.HistoryPlugin,{}),jsxRuntime.jsx(ft,{initialHTML:o}),jsxRuntime.jsx(LexicalAutoFocusPlugin.AutoFocusPlugin,{}),jsxRuntime.jsx(LexicalListPlugin.ListPlugin,{}),jsxRuntime.jsx(LexicalLinkPlugin.LinkPlugin,{}),i&&jsxRuntime.jsx(Pe,{onChange:i})]})})}var ut=vn;function X(e){return /^[^\s@]+@[^\s@]+\.[^\s@]+$/.test(e)}function Cn({emails:e=[],setEmails:o,fetchOptions:r}){let n=react.useRef(null),t=react.useRef(null),[i,l]=react.useState(""),[d,h]=react.useState(false),[u,x]=react.useState(-1),[a,m]=react.useState([]),[E,N]=react.useState(false),v=react.useRef([]),w=react.useRef([]);react.useEffect(()=>{v.current=v.current.slice(0,e.length);},[e.length]),react.useEffect(()=>{w.current=w.current.slice(0,a.length);},[a.length]),react.useEffect(()=>{X(i)?(async()=>{N(true);try{let p=await r(i);m(p);}catch(p){console.error("Error fetching email options:",p),m([]);}finally{N(false);}})():(m([]),N(false));},[i,r]),react.useEffect(()=>{d||x(-1);},[d]),react.useEffect(()=>{u>=0&&u<w.current.length&&w.current[u]?.scrollIntoView({block:"nearest",behavior:"smooth"});},[u]);let O=()=>{t.current?.focus();},f=c=>{n.current?.close(),l(""),o(p=>[...p,c]),x(-1),requestAnimationFrame(()=>t.current?.focus());},b=c=>{if(d&&X(i)&&a.length>0){if(c.key==="ArrowDown"){c.preventDefault(),x(p=>p<a.length-1?p+1:p);return}if(c.key==="ArrowUp"){c.preventDefault(),x(p=>p>0?p-1:-1);return}if(c.key==="Enter"&&u>=0){c.preventDefault(),f(a[u]);return}if(c.key==="Escape"){c.preventDefault(),n.current?.close(),x(-1);return}}if(c.key==="Backspace"&&i===""){let p=e.length-1,g=v.current[p];g&&(g.focus(),c.preventDefault());}},F=c=>{o(p=>{let g=[...p];return g.splice(c,1),g}),requestAnimationFrame(()=>{let p=Math.min(Math.max(0,c-1),e.length-2),g=v.current[p];g?g.focus():O();});};return jsxRuntime.jsx(jsxRuntime.Fragment,{children:jsxRuntime.jsx(po__default.default,{ref:n,trigger:jsxRuntime.jsxs("div",{className:"container-receipts",children:[e?.length?jsxRuntime.jsx("div",{className:"emails-container",children:e.map((c,p)=>jsxRuntime.jsxs("div",{className:"emails",tabIndex:0,ref:g=>{v.current[p]=g;},onKeyDown:g=>{g.key==="Backspace"&&(g.preventDefault(),F(p)),g.key==="Enter"&&(g.preventDefault(),F(p),O());},role:"button","aria-label":`Email ${c.email}`,children:[jsxRuntime.jsx("span",{style:{marginRight:8},children:c.email}),jsxRuntime.jsx("button",{className:"emails-close",onClick:g=>{g.stopPropagation(),F(p);},"aria-label":`Remove ${c.email}`,children:jsxRuntime.jsx(k,{name:"Close"})})]},c.email??p))}):null,jsxRuntime.jsx("input",{ref:t,type:"text",className:"input-header",value:i,autoFocus:true,onKeyDown:b,onChange:c=>{let p=c.target.value;X(p)&&n.current?.open(),l(p);}})]}),closeOnDocumentClick:true,repositionOnResize:true,position:"bottom left",className:"mail-inbox-popup",onOpen:()=>{h(true),requestAnimationFrame(()=>t.current?.focus());},onClose:()=>{h(false);},children:X(i)?jsxRuntime.jsx("div",{className:"options-dropdown",children:E?jsxRuntime.jsx(jsxRuntime.Fragment,{children:[1,2,3].map(c=>jsxRuntime.jsxs("div",{className:"option-dropdown skeleton-loader",children:[jsxRuntime.jsx("div",{className:"skeleton-line skeleton-name"}),jsxRuntime.jsx("div",{className:"skeleton-line skeleton-email"})]},c))}):a.length>0?a.map((c,p)=>jsxRuntime.jsxs("button",{ref:g=>{w.current[p]=g;},className:`option-dropdown ${u===p?"selected":""}`,onBlur:g=>{g.stopPropagation();},onFocus:g=>{g.stopPropagation();},onMouseEnter:()=>x(p),onMouseLeave:()=>x(-1),onClick:g=>{g.stopPropagation(),f(c);},"aria-selected":u===p,children:[jsxRuntime.jsx("h4",{children:c.name}),c.email]},p)):null}):null})})}var bt=Cn;function wn({name:e,needCCAndBCC:o,setShowCC:r,setShowBCC:n,showBCC:t,showCC:i,emails:l,handleChange:d,fetchOptions:h}){return jsxRuntime.jsxs("div",{className:"container-receipts",children:[jsxRuntime.jsx("label",{className:"block text-sm font-medium text-gray-700",children:e}),jsxRuntime.jsx(bt,{emails:l,setEmails:d,fetchOptions:h}),o&&!i?jsxRuntime.jsx("button",{className:"btn-mail-editor",onClick:()=>r?.(u=>!u),children:"CC"}):null,o&&!t?jsxRuntime.jsx("button",{className:"btn-mail-editor",onClick:()=>n?.(u=>!u),children:"BCC"}):null]})}var de=wn;function Rn({fetchEmailOptions:e}){let[o,r]=react.useState(false),n=react.useRef(null),{emails:t,setEmails:i,showCC:l,setShowCC:d,showBCC:h,setShowBCC:u}=B();return react.useEffect(()=>{o&&(d(t.cc.length>0),u(t.bcc.length>0));},[o,t.cc.length,t.bcc.length]),react.useEffect(()=>{let a=n.current;if(!a)return;let m=()=>{r(true);},E=N=>{console.log("\u{1F680} ~ handleFocusOut ~ e:",N);let v=N.relatedTarget;v&&v.classList&&v.classList.contains("option-dropdown")||v&&a.contains(v)||(console.log("why this ",v?.classList),r(false));};return a.addEventListener("focusin",m),a.addEventListener("focusout",E),()=>{a.removeEventListener("focusin",m),a.removeEventListener("focusout",E);}},[]),jsxRuntime.jsx("div",{ref:n,tabIndex:-1,className:"relative",children:o?jsxRuntime.jsxs("div",{children:[jsxRuntime.jsx(de,{name:"To",needCCAndBCC:true,setShowCC:d,setShowBCC:u,showBCC:h,showCC:l,emails:t.to,handleChange:a=>{i(m=>({...m,to:typeof a=="function"?a(m.to):a}));},fetchOptions:e}),l?jsxRuntime.jsx(de,{name:"CC",needCCAndBCC:false,setShowCC:d,setShowBCC:u,showBCC:h,showCC:l,emails:t.cc,handleChange:a=>{i(m=>({...m,cc:typeof a=="function"?a(m.cc):a}));},fetchOptions:e}):null,h?jsxRuntime.jsx(de,{name:"BCC",needCCAndBCC:false,setShowCC:d,setShowBCC:u,showBCC:h,showCC:l,emails:t.bcc,handleChange:a=>{i(m=>({...m,bcc:typeof a=="function"?a(m.bcc):a}));},fetchOptions:e}):null]}):jsxRuntime.jsx("input",{type:"text",placeholder:"Recipients",className:"input-header",value:(()=>{if(t.to.length===0&&t.cc.length===0&&t.bcc.length===0)return "Recipients";let a=[];return t.to.length>0&&a.push(t.to.map(m=>m.email).join(", ")),t.cc.length>0&&a.push(t.cc.map(m=>m.email).join(", ")),t.bcc.length>0&&a.push("bcc: "+t.bcc.map(m=>m.email).join(", ")),a.join(", ")})(),readOnly:true})})}var xt=Rn;function On({fetchEmailOptions:e}){let{subject:o,setSubject:r,isReply:n}=B();return jsxRuntime.jsxs("div",{className:"gmail-header",children:[jsxRuntime.jsx(xt,{fetchEmailOptions:e}),jsxRuntime.jsx("input",{type:"text",placeholder:"Subject",className:"input-header",value:n&&!o.startsWith("Re: ")?`Re: ${o}`:o,onChange:t=>r(t.target.value)})]})}var yt=On;function Ln({initialData:e,isReply:o,fetchEmailOptions:r,handleChange:n,leftChildren:t,rightChildren:i,editorChildren:l,isEditorVisible:d=true}){let{emails:h,subject:u,attachments:x,setEmails:a,setSubject:m,setAttachments:E,setIsReply:N}=B(),{theme:v}=te(),[w,O]=react.useState(e?.body||""),[f,b]=react.useState({to:e?.to||[],cc:e?.cc||[],bcc:e?.bcc||[],subject:e?.subject||"",body:e?.body||"",attachments:e?.attachments||[],isReply:o||false});react.useEffect(()=>{e&&((e.to||e.cc||e.bcc)&&a({to:e.to||[],cc:e.cc||[],bcc:e.bcc||[]}),e.subject&&m(e.subject),e.attachments&&E(e.attachments),e.body&&O(e.body)),o!==void 0&&N(o);},[]);let F=c=>{O(c);};return react.useEffect(()=>{b(c=>({...c,to:h.to,cc:h.cc,bcc:h.bcc}));},[h]),react.useEffect(()=>{b(c=>({...c,subject:u}));},[u]),react.useEffect(()=>{b(c=>({...c,body:w}));},[w]),react.useEffect(()=>{b(c=>({...c,attachments:x}));},[x]),react.useEffect(()=>{b(c=>({...c,isReply:o}));},[o]),react.useEffect(()=>{n(f);},[f,n]),jsxRuntime.jsxs("div",{className:"react-mail-inbox-root gmail-wrapper","data-theme":v,children:[t,jsxRuntime.jsx(yt,{fetchEmailOptions:r}),jsxRuntime.jsx(ut,{initialHTML:e?.body,onChange:F,editorChildren:l,isEditorVisible:d}),i]})}var wt=Ln;function Mn({fetchEmailOptions:e,handleChange:o,initialData:r,leftChildren:n,rightChildren:t,isReply:i}){return jsxRuntime.jsx(ze,{children:jsxRuntime.jsx(wt,{fetchEmailOptions:e,handleChange:o,initialData:r,isReply:i,leftChildren:n,rightChildren:t})})}var Nt=Mn;function An({fetchEmailOptions:e,handleChange:o,initialData:r,initialTheme:n="dark",onThemeChange:t,leftChildren:i,rightChildren:l}){return jsxRuntime.jsx(Ie,{initialTheme:n,onThemeChange:t,children:jsxRuntime.jsx(Nt,{fetchEmailOptions:e,handleChange:o,initialData:r,leftChildren:i,rightChildren:l})})}var Rt=An;var Ba=Rt;
|
|
1
|
+
'use strict';Object.defineProperty(exports,'__esModule',{value:true});var react=require('react'),jsxRuntime=require('react/jsx-runtime'),LexicalAutoFocusPlugin=require('@lexical/react/LexicalAutoFocusPlugin'),LexicalComposer=require('@lexical/react/LexicalComposer'),LexicalRichTextPlugin=require('@lexical/react/LexicalRichTextPlugin'),LexicalContentEditable=require('@lexical/react/LexicalContentEditable'),LexicalHistoryPlugin=require('@lexical/react/LexicalHistoryPlugin'),LexicalErrorBoundary=require('@lexical/react/LexicalErrorBoundary'),reactDom=require('react-dom'),md=require('react-icons/md'),po=require('reactjs-popup'),LexicalComposerContext=require('@lexical/react/LexicalComposerContext'),lexical=require('lexical'),list=require('@lexical/list'),link=require('@lexical/link'),utils=require('@lexical/utils'),selection=require('@lexical/selection'),reactDropzone=require('react-dropzone'),Uo=require('heic2any'),LexicalListPlugin=require('@lexical/react/LexicalListPlugin'),LexicalLinkPlugin=require('@lexical/react/LexicalLinkPlugin'),html=require('@lexical/html');function _interopDefault(e){return e&&e.__esModule?e:{default:e}}var po__default=/*#__PURE__*/_interopDefault(po);var Uo__default=/*#__PURE__*/_interopDefault(Uo);var Ae=react.createContext(void 0),te=()=>{let e=react.useContext(Ae);if(!e)throw new Error("useTheme must be used within a ThemeProvider");return e},Ie=({children:e,initialTheme:o="dark",onThemeChange:r})=>{let[n,t]=react.useState(o);react.useEffect(()=>{r&&r(n);},[n,r]);let i=()=>{t(l=>l==="light"?"dark":"light");};return jsxRuntime.jsx(Ae.Provider,{value:{theme:n,toggleTheme:i},children:e})};var De=react.createContext(void 0),B=()=>{let e=react.useContext(De);if(!e)throw new Error("useEmailContext must be used within an EmailProvider");return e},ze=({children:e})=>{let[o,r]=react.useState({to:[],cc:[],bcc:[]}),[n,t]=react.useState(false),[i,l]=react.useState(""),[d,h]=react.useState(false),[u,x]=react.useState(false),[a,m]=react.useState([]);return react.useEffect(()=>{console.log("EmailProvider emails updated:",o);},[o]),jsxRuntime.jsx(De.Provider,{value:{emails:o,setEmails:r,subject:i,setSubject:l,showCC:d,setShowCC:h,showBCC:u,setShowBCC:x,attachments:a,setAttachments:m,isReply:n,setIsReply:t},children:e})};var s={undo:"undo",redo:"redo",bold:"bold",italic:"italic",underline:"underline",color:{base:"colors"},code:"code",link:"link",listNumber:"listNumber",listBullet:"listBullet",align:{base:"align"},indent:"indent",indentDecrease:"indentDecrease",strike:"strike",attachFile:"attachFile",fontSize:"fontSize",fontFamily:"fontFamily"},y={styling:"styling",divider:"divider",component:"component"},Be=[{type:y.styling,icon:"Styling",id:"4bc66ea9-2e35-4a7b-a674-be7e4ee163c5",options:[{name:s.undo,type:y.component,icon:"Undo",id:"29cf5eb3-37cd-482f-9a15-c358faf19cc2"},{name:s.redo,type:y.component,icon:"Redo",id:"8744f7ab-5818-46ce-9417-2fec87123afe"},{type:y.divider,id:"ed0104fd-3507-43f6-80c1-813fbdf04479"},{name:s.fontFamily,type:y.component,id:"1c12d7e2-aa6a-42b4-b25c-b55fe3bcf524"},{type:y.divider,id:"d0f67d01-0731-411a-b448-e1dca47014f4"},{name:s.fontSize,type:y.component,id:"82e31b62-5441-4052-887c-faa02d0b7075"},{type:y.divider,id:"2e3558e4-3ad4-422b-8502-ea3c58fb8c2e"},{name:s.bold,type:y.component,icon:"Bold",id:"ac2b5b54-7323-44a4-bc6d-8bae6e48efe2"},{name:s.italic,type:y.component,icon:"Italic",id:"6a927c2a-2230-4dc7-af71-47fbe9fb784d"},{name:s.underline,type:y.component,icon:"Underline",id:"f07b3a6f-ffaa-4153-beae-79a36acb6a08"},{name:s.color.base,type:y.component,icon:"Color",id:"e14ec25f-3dd3-4ed5-b33a-a033684d248b"},{type:y.divider,id:"93e60297-206f-4f31-bc29-11daff2052bd"},{name:s.align.base,type:y.component,id:"30da93ea-efa6-4642-bfa5-28fd4dc9c5b3"},{type:y.divider,id:"9bad0563-6118-4855-9286-402bf98e00ad"},{name:s.listNumber,type:y.component,icon:"OrderedList",id:"d37865e1-ff54-4118-a5cc-fa147d222471"},{name:s.listBullet,type:y.component,icon:"UnOrderedList",id:"ed77e7c9-b89c-41c5-a749-e68ea0b30497"},{type:y.divider,id:"e5ecd77b-44cc-42fe-badb-48cadf3ddfb1"},{name:s.indentDecrease,type:y.component,icon:"IndentLess",id:"2dc6a5e4-b1b5-47d1-ac2f-5d0becb02d33"},{name:s.indent,type:y.component,icon:"IndentMore",id:"6903a3d1-a83f-4bc6-9bd9-f673feffe84f"}]},{type:"component",name:s.attachFile,icon:"Attach",id:"f43a284e-113e-4095-b001-9d00a1dddc4c"},{type:"component",name:s.link,icon:"Link",id:"580db61e-7939-4efe-914c-304b271998ec"}];var ao={Undo:md.MdUndo,Redo:md.MdRedo,Bold:md.MdFormatBold,Italic:md.MdFormatItalic,Underline:md.MdFormatUnderlined,Color:md.MdTextFormat,LeftAlign:md.MdFormatAlignLeft,RightAlign:md.MdFormatAlignRight,CenterAlign:md.MdFormatAlignCenter,UnOrderedList:md.MdFormatListBulleted,OrderedList:md.MdFormatListNumbered,IndentLess:md.MdFormatIndentDecrease,IndentMore:md.MdOutlineFormatIndentIncrease,RemoveFormat:md.MdFormatClear,StrikeThrough:md.MdStrikethroughS,CodeQuote:md.MdFormatQuote,DownArrow:md.MdArrowDropDown,Styling:md.MdTextFormat,Attach:md.MdAttachFile,Link:md.MdLink,Image:md.MdImage,Check:md.MdCheck,TextFields:md.MdTextFields,Edit:md.MdEdit,Close:md.MdClose},Ue=ao;var lo=({name:e,size:o=24,color:r,className:n})=>{let t=Ue[e];return t?jsxRuntime.jsx(t,{size:o,color:r,className:n}):(console.warn(`Icon "${e}" not found.`),null)},k=lo;var mo=({trigger:e,children:o,popUpDirection:r="top center"})=>{let n=react.useRef(null),t=()=>{n.current&&typeof n.current.close=="function"&&n.current.close();};return jsxRuntime.jsx(po__default.default,{ref:n,trigger:e,closeOnDocumentClick:true,repositionOnResize:true,position:r,className:"mail-inbox-popup",children:l=>o({close:()=>{l?.(),t();}})})},_=mo;var uo=[{label:"Sans Serif",value:"sans-serif",style:{fontFamily:"sans-serif"}},{label:"Serif",value:"serif",style:{fontFamily:"serif"}},{label:"Fixed Width",value:"monospace",style:{fontFamily:"monospace"}},{label:"Wide",value:"wide",style:{fontWeight:"bold",letterSpacing:"0.05em"}},{label:"Narrow",value:"narrow",style:{fontStretch:"condensed"}},{label:"Comic Sans MS",value:"Comic Sans MS",style:{fontFamily:"Comic Sans MS, cursive"}},{label:"Garamond",value:"Garamond",style:{fontFamily:"Garamond, serif"}},{label:"Georgia",value:"Georgia",style:{fontFamily:"Georgia, serif"}},{label:"Tahoma",value:"Tahoma",style:{fontFamily:"Tahoma, sans-serif"}},{label:"Trebuchet MS",value:"Trebuchet MS",style:{fontFamily:"Trebuchet MS, sans-serif"}},{label:"Verdana",value:"Verdana",style:{fontFamily:"Verdana, sans-serif"}}],oe=[{key:"small",label:"Small",sizePx:12},{key:"normal",label:"Normal",sizePx:18},{key:"large",label:"Large",sizePx:28},{key:"huge",label:"Huge",sizePx:56}],me=["#000000","#3a3a3a","#5a5a5a","#8a8a8a","#bfbfbf","#dedede","#f3f3f3","#ffffff"],fe=["#e53935","#fb8c00","#ffee58","#66ff66","#4dd0e1","#1e88e5","#9c27b0","#ff3bd6"],ue=[["#f7d7d7","#f3d0c8","#f0c5c5","#efc9d8","#f7e6e9","#f3edf7","#f0eaf6","#f8f0f6"],["#f0b9b9","#f0d4c2","#e6f0d2","#e4f7e8","#d8eef8","#dbe1ff","#e9d9f6","#f5d9f7"],["#e69a9a","#e6caa3","#d7e6b0","#c8f0e6","#bfe3ff","#cbd8ff","#d6c3f3","#f0c2f3"],["#d16464","#d09a6a","#a8cf7b","#7fd6c0","#73b7ff","#7a9cff","#b483f1","#f08cf2"],["#b23a3a","#b26a3a","#7aa04a","#3fb092","#296f94","#2a4177","#452a68","#6e1f4d"],["#7a1d1d","#7a4a1e","#556a2a","#195b47","#123f5a","#182840","#2a1836","#3a1026"]],ge=uo;function be({value:e="serif",onChange:o}){return jsxRuntime.jsx("div",{children:jsxRuntime.jsx(_,{trigger:jsxRuntime.jsxs("button",{className:"font-option heading",children:[ge?.find(r=>r.value===e)?.label,jsxRuntime.jsx(k,{name:"DownArrow"})]}),children:({close:r})=>jsxRuntime.jsx("div",{className:"p-4",children:jsxRuntime.jsx("div",{className:"font-options",children:ge.map(n=>jsxRuntime.jsx("button",{className:"btn-mail-editor",onClick:()=>{o(n.value),r();},style:{...n.style},children:jsxRuntime.jsxs("div",{className:"font-option",children:[e===n.value&&jsxRuntime.jsx(k,{name:"Check"}),n.label]})},n.value))})})})})}function he({value:e="normal",onChange:o=()=>{}}){return jsxRuntime.jsx("div",{children:jsxRuntime.jsx(_,{trigger:jsxRuntime.jsxs("button",{className:"font-option heading",children:[jsxRuntime.jsx(k,{name:"TextFields"}),jsxRuntime.jsx(k,{name:"DownArrow"})]}),children:({close:r})=>jsxRuntime.jsx("div",{className:"p-4",children:jsxRuntime.jsx("div",{className:"font-options",children:oe.map(n=>jsxRuntime.jsx("button",{className:"btn-mail-editor",onClick:()=>{o(n.key),r();},style:{fontSize:`${n.sizePx}px`},children:jsxRuntime.jsxs("div",{className:"font-option",children:[e===n.key&&jsxRuntime.jsx(k,{name:"Check"}),n.label]})},n.key))})})})})}function Y({color:e,selected:o,onClick:r,label:n}){return jsxRuntime.jsx("button",{className:"swatch",title:n||e,"aria-pressed":o,onClick:()=>r(e),style:{background:e},children:o&&jsxRuntime.jsx("svg",{className:"check",viewBox:"0 0 24 24","aria-hidden":true,children:jsxRuntime.jsx("path",{d:"M20 6L9 17l-5-5",stroke:"white",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round",fill:"none"})})})}function xe({value:e={background:"#ffffff",text:"#000000"},onChange:o=()=>{}}){function r(n,t){o({...e,[n]:t});}return jsxRuntime.jsx("div",{children:jsxRuntime.jsx(_,{trigger:jsxRuntime.jsxs("button",{className:"font-option heading",children:[jsxRuntime.jsx(k,{name:"Styling"}),jsxRuntime.jsx(k,{name:"DownArrow"})]}),children:({close:n})=>jsxRuntime.jsx("div",{className:"color-popover",role:"dialog","aria-label":"Choose colors",children:jsxRuntime.jsxs("div",{className:"color-columns",children:[jsxRuntime.jsxs("section",{className:"color-column","aria-labelledby":"bg-label",children:[jsxRuntime.jsx("h4",{id:"bg-label",children:"Background color"}),jsxRuntime.jsx("div",{className:"row",children:me.map(t=>jsxRuntime.jsx(Y,{color:t,selected:e.background===t,onClick:i=>{r("background",i),n();},label:t},t+"bg"))}),jsxRuntime.jsx("div",{className:"row accent-row",children:fe.map(t=>jsxRuntime.jsx(Y,{color:t,selected:e.background===t,onClick:i=>{r("background",i),n();},label:t},t+"bgacc"))}),jsxRuntime.jsx("div",{className:"palette",children:ue.map((t,i)=>jsxRuntime.jsx("div",{className:"palette-row",children:t.map(l=>jsxRuntime.jsx(Y,{color:l,selected:e.background===l,onClick:d=>{r("background",d),n();},label:l},l+"bgp"+i))},"row"+i))})]}),jsxRuntime.jsxs("section",{className:"color-column","aria-labelledby":"text-label",children:[jsxRuntime.jsx("h4",{id:"text-label",children:"Text color"}),jsxRuntime.jsx("div",{className:"row",children:me.map(t=>jsxRuntime.jsx(Y,{color:t,selected:e.text===t,onClick:i=>{r("text",i),n();},label:t},t+"tx"))}),jsxRuntime.jsx("div",{className:"row accent-row",children:fe.map(t=>jsxRuntime.jsx(Y,{color:t,selected:e.text===t,onClick:i=>{r("text",i),n();},label:t},t+"txacc"))}),jsxRuntime.jsx("div",{className:"palette",children:ue.map((t,i)=>jsxRuntime.jsx("div",{className:"palette-row",children:t.map(l=>jsxRuntime.jsx(Y,{color:l,selected:e.text===l,onClick:d=>{r("text",d),n();},label:l},l+"txp"+i))},"txrow"+i))})]})]})})})})}var Ge=[{key:"left",iconName:"LeftAlign",label:"Left align"},{key:"center",iconName:"CenterAlign",label:"Center align"},{key:"right",iconName:"RightAlign",label:"Right align"}];function ve({value:e="left",onChange:o=()=>{}}){function r(n){o(n);}return jsxRuntime.jsx("div",{children:jsxRuntime.jsx(_,{trigger:jsxRuntime.jsxs("button",{className:"font-option heading",children:[jsxRuntime.jsx(k,{name:Ge?.find(n=>n.key===e)?.iconName||"LeftAlign"}),jsxRuntime.jsx(k,{name:"DownArrow"})]}),children:({close:n})=>jsxRuntime.jsx("div",{className:"wrapper-alignment",children:Ge.map(t=>{let i=t.key===e;return jsxRuntime.jsxs("button",{role:"menuitemradio","aria-checked":i,tabIndex:0,className:`alignment-option ${i?"active":""}`,onClick:()=>{r(t.key),n();},children:[jsxRuntime.jsx("div",{className:"option-icon",children:jsxRuntime.jsx(k,{name:t.iconName,size:20})}),jsxRuntime.jsx("div",{className:`option-check ${i?"":"hidden"}`,"aria-hidden":true,children:jsxRuntime.jsx("svg",{width:"16",height:"16",viewBox:"0 0 24 24",children:jsxRuntime.jsx("path",{d:"M20 6L9 17l-5-5",fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round"})})})]},t.key)})})})})}var Oo=1;function Xe(e){if(!e||e.startsWith("#"))return e;if(e.startsWith("rgba")){let r=e.match(/rgba?\((\d+),\s*(\d+),\s*(\d+),?\s*([\d.]+)?\)/);if(r){let[,n,t,i,l]=r;return l==="0"?"transparent":"#"+[n,t,i].map(d=>{let h=parseInt(d).toString(16);return h.length===1?"0"+h:h}).join("")}}let o=e.match(/rgb\((\d+),\s*(\d+),\s*(\d+)\)/);if(o){let[,r,n,t]=o;return "#"+[r,n,t].map(i=>{let l=parseInt(i).toString(16);return l.length===1?"0"+l:l}).join("")}return e}function Po(){let[e]=LexicalComposerContext.useLexicalComposerContext(),[o,r]=react.useState("paragraph"),[n,t]=react.useState({[s.fontFamily]:"sans-serif",[s.fontSize]:16,[s.align.base]:"left"}),[i,l]=react.useState(false),d=react.useCallback(()=>{let f=lexical.$getSelection(),b={[s.fontFamily]:"sans-serif",[s.fontSize]:16,[s.align.base]:"left"};if(lexical.$isRangeSelection(f)){let F=f.anchor.getNode(),c=F.getKey()==="root"?F:F.getTopLevelElementOrThrow(),p=c.getKey(),g=e.getElementByKey(p);if(g!==null)if(list.$isListNode(c)){let L=utils.$getNearestNodeOfType(F,list.ListNode),ee=L?L.getTag():c.getTag();r(ee);}else {let L=c.getType();r(L);}b[s.bold]=f.hasFormat("bold"),b[s.italic]=f.hasFormat("italic"),b[s.underline]=f.hasFormat("underline"),b[s.strike]=f.hasFormat("strikethrough"),b[s.code]=f.hasFormat("code");let H=O(f),P=H.getParent();link.$isLinkNode(P)||link.$isLinkNode(H)?(b[s.link]=true,l(true)):(b[s.link]=false,l(false));let D=e.getElementByKey(H.getKey()),T=e.getElementByKey(P.getKey()),S=D||T||g;if(S){let L=window.getComputedStyle(S),ee=L.getPropertyValue("font-family");if(ee){let G=ee.split(",")[0].trim().replace(/['"]/g,"");(G==="-apple-system"||G==="BlinkMacSystemFont"||G==="system-ui")&&(G="sans-serif"),b[s.fontFamily]=G;}let Le=L.getPropertyValue("font-size");if(Le){let G=parseInt(Le,10);b[s.fontSize]=G||16;}let W=null,z=null;S instanceof HTMLElement&&S.style&&(W=S.style.color||null,z=S.style.backgroundColor||null),W||(W=L.getPropertyValue("color")),z||(z=L.getPropertyValue("background-color")),console.log("\u{1F3A8} Color detection:",{inlineColor:S instanceof HTMLElement?S.style.color:"N/A",inlineBg:S instanceof HTMLElement?S.style.backgroundColor:"N/A",computedColor:W,computedBg:z,element:S});let Te=W?Xe(W):null,Me=z&&z!=="rgba(0, 0, 0, 0)"&&z!=="transparent"?Xe(z):null;(Te||Me)&&(b[s.color.base]={text:Te||"#000000",background:Me||"#ffffff"});let pe=L.getPropertyValue("text-align")||"left";pe==="start"&&(pe="left"),b[s.align.base]=pe;}t(b);}},[e]);react.useEffect(()=>utils.mergeRegister(e.registerUpdateListener(({editorState:f})=>{f.read(()=>{d();});}),e.registerCommand(lexical.SELECTION_CHANGE_COMMAND,()=>(d(),false),Oo)),[e,d]);function h(f,b){switch(f){case s.bold:e.dispatchCommand(lexical.FORMAT_TEXT_COMMAND,"bold");break;case s.italic:e.dispatchCommand(lexical.FORMAT_TEXT_COMMAND,"italic");break;case s.underline:e.dispatchCommand(lexical.FORMAT_TEXT_COMMAND,"underline");break;case s.align.base:e.dispatchCommand(lexical.FORMAT_ELEMENT_COMMAND,b);break;case s.undo:e.dispatchCommand(lexical.UNDO_COMMAND,void 0);break;case s.redo:e.dispatchCommand(lexical.REDO_COMMAND,void 0);break;case s.listNumber:w();break;case s.listBullet:v();break;case s.indent:u();break;case s.indentDecrease:N();break;case s.color.base:m(b);break;case s.fontFamily:x(b);break;case s.fontSize:a(b);break;case s.link:E();break;}}let u=()=>{e.dispatchCommand(lexical.INDENT_CONTENT_COMMAND,void 0);},x=f=>{e.update(()=>{let b=lexical.$getSelection();lexical.$isRangeSelection(b)&&selection.$patchStyleText(b,{"font-family":f});});},a=f=>{let b=oe.find(F=>F.key===f)?.sizePx??16;e.update(()=>{let F=lexical.$getSelection();lexical.$isRangeSelection(F)&&selection.$patchStyleText(F,{"font-size":`${b}px`});});},m=f=>{e.update(()=>{let b=lexical.$getSelection();lexical.$isRangeSelection(b)&&selection.$patchStyleText(b,{"background-color":f.background,color:f.text});});},E=react.useCallback(()=>{i?e.dispatchCommand(link.TOGGLE_LINK_COMMAND,null):e.dispatchCommand(link.TOGGLE_LINK_COMMAND,"https://");},[e,i]),N=()=>{e.dispatchCommand(lexical.OUTDENT_CONTENT_COMMAND,void 0);},v=()=>{o!=="ul"?e.dispatchCommand(list.INSERT_UNORDERED_LIST_COMMAND,void 0):e.dispatchCommand(list.REMOVE_LIST_COMMAND,void 0);},w=()=>{o!=="ol"?e.dispatchCommand(list.INSERT_ORDERED_LIST_COMMAND,void 0):e.dispatchCommand(list.REMOVE_LIST_COMMAND,void 0);};function O(f){let b=f.anchor,F=f.focus,c=f.anchor.getNode(),p=f.focus.getNode();return c===p?c:f.isBackward()?selection.$isAtNodeEnd(F)?c:p:selection.$isAtNodeEnd(b)?p:c}return {onChange:h,isLink:i,editor:e,selectedEventTypes:n,blockType:o}}var Qe=Po;function Do({editor:e}){let o=react.useRef(null),r=react.useRef(null),n=react.useRef(false),[t,i]=react.useState(""),[l,d]=react.useState(false),[h,u]=react.useState(null),x=react.useCallback(()=>{let a=window.getSelection(),m=lexical.$getSelection();if(lexical.$isRangeSelection(m)){let w=zo(m),O=w.getParent();link.$isLinkNode(O)?i(O.getURL()):link.$isLinkNode(w)?i(w.getURL()):i("");}let E=o.current,N=document.activeElement;if(!E)return;let v=e.getRootElement();if(m&&a&&!a.isCollapsed&&v&&v.contains(a.anchorNode)){let w=a.getRangeAt(0),O;if(a.anchorNode===v){let f=v;for(;f.firstElementChild!=null;)f=f.firstElementChild;O=f.getBoundingClientRect();}else O=w.getBoundingClientRect();n.current||tt(E,O),u(m);}else (!N||N.className!=="link-input")&&(tt(E,null),u(null),d(false),i(""));return true},[e]);return react.useEffect(()=>utils.mergeRegister(e.registerUpdateListener(({editorState:a})=>{a.read(()=>{x();});}),e.registerCommand(lexical.SELECTION_CHANGE_COMMAND,()=>(x(),true),1)),[e,x]),react.useEffect(()=>{e.getEditorState().read(()=>{x();});},[e,x]),react.useEffect(()=>{l&&r.current&&r.current.focus();},[l]),jsxRuntime.jsxs("div",{className:"floating-link-editor",ref:o,children:[l?jsxRuntime.jsx("input",{ref:r,className:"link-input",value:t,onChange:a=>i(a.target.value),onKeyDown:a=>{a.key==="Enter"?(a.preventDefault(),h&&t!==""&&e.dispatchCommand(link.TOGGLE_LINK_COMMAND,t),d(false)):a.key==="Escape"&&(a.preventDefault(),d(false));},placeholder:"Enter link..."}):jsxRuntime.jsx("div",{className:"link-display",children:jsxRuntime.jsx("a",{href:t,target:"_blank",rel:"noopener noreferrer",children:t||"No link selected"})}),jsxRuntime.jsx("button",{className:"link-button",onMouseDown:a=>a.preventDefault(),onClick:()=>{console.log("floating link editor",l),l&&e.dispatchCommand(link.TOGGLE_LINK_COMMAND,t),d(a=>!a);},children:jsxRuntime.jsx(k,{name:l?"Check":"Edit"})})]})}function zo(e){let o=e.anchor.getNode(),r=e.focus.getNode();return o===r?o:e.isBackward()?selection.$isAtNodeEnd(e.focus)?o:r:selection.$isAtNodeEnd(e.anchor)?r:o}function tt(e,o){if(!o){e.style.opacity="0",e.style.top="-1000px",e.style.left="-1000px";return}let r=e.offsetWidth,n=e.offsetHeight,t=window.innerWidth,i=window.innerHeight,l=o.top+o.height+window.pageYOffset+10,d=o.left+window.pageXOffset-r/2+o.width/2;d<8&&(d=8),d+r>t-8&&(d=t-r-8),l+n>i-8&&(l=o.top+window.pageYOffset-n-10),l<8&&(l=8),e.style.opacity="1",e.style.top=`${l}px`,e.style.left=`${d}px`;}var ot=Do;var $={FILE_INVALID_TYPE:"file-invalid-type",FILE_TOO_LARGE:"file-too-large",TOO_MANY_FILES:"too-many-files",HEIC_CONVERSION_ERROR:"heic-conversion-error"},$o=10,Ho=10,it=()=>Math.random().toString(36).substring(2,10)+Date.now().toString(36),Go=e=>{if(e<1024)return {value:e.toString(),type:"bytes"};let o=e/1024;if(o<1024)return {value:o.toFixed(1),type:"KB"};let r=o/1024;return r<1024?{value:r.toFixed(1),type:"MB"}:{value:(r/1024).toFixed(1),type:"GB"}},at=({accept:e={"image/*":[".png",".gif",".jpeg",".jpg"],"application/pdf":[".pdf"]},maxSize:o=Ho*1024*1024,maxFiles:r=$o,multiple:n=true,isDisabled:t=false,replaceAfterUpload:i=false,files:l=[],handleFileChange:d=()=>{}})=>{let[h,u]=react.useState(false),[x,a]=react.useState(l??[]),[m,E]=react.useState([]),N=c=>{switch(c){case $.FILE_INVALID_TYPE:return "Invalid file type. Please upload a supported format.";case $.FILE_TOO_LARGE:{let{value:p,type:g}=Go(o);return `File too large. Maximum allowed size is ${p} ${g}.`}case $.TOO_MANY_FILES:return `Too many files selected. Maximum allowed: ${r}.`;case $.HEIC_CONVERSION_ERROR:return "Failed to convert HEIC image. Please upload a JPEG or PNG instead.";default:return "An unknown file error occurred."}};react.useEffect(()=>{d(x);},[x]);let{getRootProps:v,getInputProps:w,isDragActive:O,open:f}=reactDropzone.useDropzone({accept:e,maxSize:o,multiple:n,maxFiles:r,disabled:t,noClick:true,onFileDialogCancel:()=>u(false),onFileDialogOpen:()=>{t||u(true);},onDrop:async(c,p)=>{let H=(await Promise.all(c.map(async P=>{if(!P)return null;if(P.type==="image/heic")try{let D=await Uo__default.default({blob:P,toType:"image/jpeg"}),T=Array.isArray(D)?D[0]:D,S=new File([T],`${P.name.replace(/\.heic$/i,"")}.jpeg`,{type:"image/jpeg"});return Object.assign(S,{uuid:it(),preview:URL.createObjectURL(S)})}catch(D){console.error("HEIC conversion error:",D);let T=N($.HEIC_CONVERSION_ERROR);return E(S=>[...S,{file:P,preview:URL.createObjectURL(P),readableErrors:[T],errors:[{code:$.HEIC_CONVERSION_ERROR,message:T}]}]),null}return Object.assign(P,{uuid:it(),preview:URL.createObjectURL(P)})}))).filter(Boolean);if(!t){let P=i?[]:[...x];P=[...P,...H];let D=p.map(T=>{let S=T.errors.map(L=>N(L.code));return {file:T.file,errors:T.errors.map(L=>({code:L.code,message:L.message})),preview:URL.createObjectURL(T.file),readableErrors:S}});return E(T=>[...T,...D]),a(P),P}return x},validator:c=>{let{name:p,type:g}=c;if(p){let H=p.split(".").pop()?.toLowerCase();if(e&&e?.[g]&&e?.[g].length&&!e?.[g].includes(`.${H}`))return {code:$.FILE_INVALID_TYPE,message:N($.FILE_INVALID_TYPE)}}return null}}),b=react.useCallback(c=>{a(p=>p.filter(g=>g.uuid!==c));},[a]),F=react.useCallback(()=>{E([]);},[]);return react.useEffect(()=>()=>{x.forEach(c=>c.preview&&URL.revokeObjectURL(c.preview)),m.forEach(c=>c.preview&&URL.revokeObjectURL(c.preview));},[]),{getRootProps:v,getInputProps:w,isDragActive:O,isFileDialogOpen:h,rejectedFiles:m,openFileDialog:f,removeFile:b,clearRejectedFiles:F}};var jo=({handleFileChange:e})=>{let{getRootProps:o,getInputProps:r,openFileDialog:n}=at({multiple:true,maxFiles:5,maxSize:5242880,handleFileChange:t=>{e(t);}});return jsxRuntime.jsx("div",{className:"uploader-container",children:jsxRuntime.jsxs("div",{...o(),children:[jsxRuntime.jsx("input",{...r()}),jsxRuntime.jsx("button",{onClick:n,children:jsxRuntime.jsx(k,{className:"upload-icon",name:"Attach"})})]})})},lt=jo;function Se({file:e,index:o,onRemove:r,onView:n}){if(!e)return null;let t=e?.name??"unknown",i=e instanceof File||"size"in e&&e.size!==void 0?e.size:"bytes"in e&&e.bytes!==void 0?e.bytes:null,l=("url"in e?e?.url:null)??null,d=react.useMemo(()=>{if(l)return l;if(typeof window<"u"&&e instanceof File)try{return URL.createObjectURL(e)}catch{return null}return null},[e,l]),h=a=>{if(!a&&a!==0)return "";let m=Math.round(a/1024);return m<1024?`${m}K`:`${Math.round(a/1024/1024*10)/10}M`},u=a=>{if(a.preventDefault(),n)return n(d??null);d&&window.open(d,"_blank","noopener");},x=a=>{r&&r(a);};return jsxRuntime.jsxs("div",{className:"fps-row",role:"group","aria-label":`Attachment ${t}`,children:[jsxRuntime.jsxs("div",{className:"fps-left",children:[jsxRuntime.jsx("a",{href:d??"#",className:"fps-filename",onClick:u,title:t,target:"_blank",rel:"noopener noreferrer",children:t}),i!=null&&jsxRuntime.jsxs("span",{className:"fps-size",children:["\xA0(",h(i),")"]})]}),jsxRuntime.jsx("button",{type:"button",className:"fps-close","aria-label":`Remove ${t}`,onClick:()=>x(o),children:"\xD7"})]})}var dt=(e,{onChange:o,state:r,setState:n,selectedEventTypes:t,blockType:i,setAttachments:l})=>{switch(e.name){case s.undo:case s.redo:case s.bold:case s.italic:case s.underline:case s.indentDecrease:case s.indent:case s.link:return jsxRuntime.jsx("button",{className:`tool-bar-button ${t?.[e.name]?"active-btn-toolbar":""}`,onClick:()=>{o(e.name,true);},children:jsxRuntime.jsx(k,{className:"tool-bar-button-icon",name:e.icon})},`${e.name}-${e.icon}`);case s.listNumber:return jsxRuntime.jsx("button",{className:i==="ol"?"active-btn-toolbar":"",onClick:()=>{o(e.name,true);},children:jsxRuntime.jsx(k,{className:"tool-bar-button-icon",name:e.icon})},`${e.name}-${e.icon}`);case s.listBullet:return jsxRuntime.jsx("button",{className:i==="ul"?"active-btn-toolbar":"",onClick:()=>{o(e.name,true);},children:jsxRuntime.jsx(k,{className:"tool-bar-button-icon",name:e.icon})},`${e.name}-${e.icon}`);case s.attachFile:return jsxRuntime.jsx(lt,{value:r?.[e.name],handleFileChange:d=>{console.log("\u{1F680} ~ getToolbarComponent ~ e:",d),n(h=>({...h,[e.name]:d})),l(d);}});case s.fontFamily:return jsxRuntime.jsx(be,{value:t?.[e.name]||r?.[e.name],onChange:d=>{o(e.name,d);}});case s.fontSize:return jsxRuntime.jsx(he,{value:t?.[e.name]||r?.[e.name],onChange:d=>{o(e.name,d);}});case s.color.base:return jsxRuntime.jsx(xe,{value:t?.[e.name]||r?.[e.name],onChange:d=>{o(e.name,d);}});case s.align.base:return jsxRuntime.jsx(ve,{value:t?.[e.name]||r?.[e.name],onChange:d=>{o(e.name,d);}});}return e.type===y.divider?jsxRuntime.jsx("span",{className:"divider"}):"-"},Yo=(e,{setToggle:o,toggle:r,onChange:n,state:t,setState:i,selectedEventTypes:l,blockType:d,setAttachments:h})=>{switch(e.type){case y.divider:return jsxRuntime.jsx("div",{className:"divider"},`divider-${e.type}-${e.icon}`);case y.component:return dt(e,{onChange:n,state:t,setState:i,selectedEventTypes:l,blockType:d,setAttachments:h});case y.styling:return jsxRuntime.jsxs("div",{className:"styling-toolbar",children:[r?jsxRuntime.jsx("div",{className:"styling-options",children:e.options?.length&&Array.isArray(e.options)?e.options?.map(u=>dt(u,{onChange:n,state:t,setState:i,selectedEventTypes:l,blockType:d,setAttachments:h})):null}):null,jsxRuntime.jsx("button",{onClick:()=>o(u=>!u),children:jsxRuntime.jsx(k,{className:"tool-bar-button-icon",name:e.icon})})]},`divider-${e.type}-${e.icon}`);}return "-"};function qo({rightChildren:e,leftChildren:o}){let[r,n]=react.useState(true),[t,i]=react.useState({}),{setAttachments:l}=B(),{onChange:d,isLink:h,editor:u,selectedEventTypes:x,blockType:a}=Qe();return console.log("\u{1F680} ~ ToolBar ~ selectedEventTypes:",x),jsxRuntime.jsxs("div",{className:"toolbar-container",children:[t[s.attachFile]?.length?jsxRuntime.jsx("div",{className:"file-upload-container",children:t[s.attachFile]?.map((m,E)=>jsxRuntime.jsx(Se,{file:m,index:E,onRemove:N=>{i(v=>{let w=v[s.attachFile].filter((O,f)=>f!==N);return l(w),{...v,[s.attachFile]:w}});}},E))}):null,jsxRuntime.jsxs("div",{className:"toolbar-wrapper",children:[o,Be?.map(m=>Yo(m,{setToggle:n,state:t,setState:i,toggle:r,onChange:d,selectedEventTypes:x,blockType:a,setAttachments:l})),e,h?reactDom.createPortal(jsxRuntime.jsx(ot,{editor:u}),document.body):null]})]})}var pt=qo;var Xo={ltr:"ltr",rtl:"rtl",placeholder:"editor-placeholder",paragraph:"editor-paragraph",quote:"editor-quote",heading:{h1:"editor-heading-h1",h2:"editor-heading-h2",h3:"editor-heading-h3",h4:"editor-heading-h4",h5:"editor-heading-h5"},list:{nested:{listitem:"editor-nested-listitem"},ol:"editor-list-ol",ul:"editor-list-ul",listitem:"editor-listitem"},image:"editor-image",link:"editor-link",text:{bold:"editor-text-bold",italic:"editor-text-italic",overflowed:"editor-text-overflowed",hashtag:"editor-text-hashtag",underline:"editor-text-underline",strikethrough:"editor-text-strikethrough",underlineStrikethrough:"editor-text-underlineStrikethrough",code:"editor-text-code"},code:"editor-code",codeHighlight:{atrule:"editor-tokenAttr",attr:"editor-tokenAttr",boolean:"editor-tokenProperty",builtin:"editor-tokenSelector",cdata:"editor-tokenComment",char:"editor-tokenSelector",class:"editor-tokenFunction","class-name":"editor-tokenFunction",comment:"editor-tokenComment",constant:"editor-tokenProperty",deleted:"editor-tokenProperty",doctype:"editor-tokenComment",entity:"editor-tokenOperator",function:"editor-tokenFunction",important:"editor-tokenVariable",inserted:"editor-tokenSelector",keyword:"editor-tokenAttr",namespace:"editor-tokenVariable",number:"editor-tokenProperty",operator:"editor-tokenOperator",prolog:"editor-tokenComment",property:"editor-tokenProperty",punctuation:"editor-tokenPunctuation",regex:"editor-tokenVariable",selector:"editor-tokenSelector",string:"editor-tokenSelector",symbol:"editor-tokenProperty",tag:"editor-tokenProperty",url:"editor-tokenOperator",variable:"editor-tokenVariable"}},mt=Xo;function tn({initialHTML:e}){let[o]=LexicalComposerContext.useLexicalComposerContext();return react.useEffect(()=>{o.update(()=>{let n=new DOMParser().parseFromString(e,"text/html"),t=html.$generateNodesFromDOM(o,n),i=lexical.$getRoot();i.clear(),i.append(...t);});},[o,e]),null}var ft=tn;function Pe({onChange:e}){let[o]=LexicalComposerContext.useLexicalComposerContext();return react.useEffect(()=>o.registerUpdateListener(({editorState:r})=>{r.read(()=>{let n=html.$generateHtmlFromNodes(o,null);e(n);});}),[o,e]),null}function xn(e){console.error(e);}function vn({placeholder:e="",initialHTML:o="",rightChildren:r,leftChildren:n,minHeight:t="",onChange:i,editorChildren:l,isEditorVisible:d=true}){return jsxRuntime.jsx("div",{className:"my-editor-wrapper",children:jsxRuntime.jsxs(LexicalComposer.LexicalComposer,{initialConfig:{namespace:"MyEditor",theme:mt,nodes:[link.LinkNode,list.ListNode,list.ListItemNode,link.AutoLinkNode],onError:xn},children:[d?jsxRuntime.jsx(LexicalRichTextPlugin.RichTextPlugin,{contentEditable:jsxRuntime.jsx(LexicalContentEditable.ContentEditable,{style:{minHeight:t},className:"my-editor-content","aria-placeholder":e,placeholder:jsxRuntime.jsx("div",{className:"my-editor-placeholder",children:e})}),ErrorBoundary:LexicalErrorBoundary.LexicalErrorBoundary}):l,jsxRuntime.jsx(pt,{rightChildren:r,leftChildren:n}),jsxRuntime.jsx(LexicalHistoryPlugin.HistoryPlugin,{}),jsxRuntime.jsx(ft,{initialHTML:o}),jsxRuntime.jsx(LexicalAutoFocusPlugin.AutoFocusPlugin,{}),jsxRuntime.jsx(LexicalListPlugin.ListPlugin,{}),jsxRuntime.jsx(LexicalLinkPlugin.LinkPlugin,{}),i&&jsxRuntime.jsx(Pe,{onChange:i})]})})}var ut=vn;function X(e){return /^[^\s@]+@[^\s@]+\.[^\s@]+$/.test(e)}function Cn({emails:e=[],setEmails:o,fetchOptions:r}){let n=react.useRef(null),t=react.useRef(null),[i,l]=react.useState(""),[d,h]=react.useState(false),[u,x]=react.useState(-1),[a,m]=react.useState([]),[E,N]=react.useState(false),v=react.useRef([]),w=react.useRef([]);react.useEffect(()=>{v.current=v.current.slice(0,e.length);},[e.length]),react.useEffect(()=>{w.current=w.current.slice(0,a.length);},[a.length]),react.useEffect(()=>{X(i)?(async()=>{N(true);try{let p=await r(i);m(p);}catch(p){console.error("Error fetching email options:",p),m([]);}finally{N(false);}})():(m([]),N(false));},[i,r]),react.useEffect(()=>{d||x(-1);},[d]),react.useEffect(()=>{u>=0&&u<w.current.length&&w.current[u]?.scrollIntoView({block:"nearest",behavior:"smooth"});},[u]);let O=()=>{t.current?.focus();},f=c=>{n.current?.close(),l(""),o(p=>[...p,c]),x(-1),requestAnimationFrame(()=>t.current?.focus());},b=c=>{if(d&&X(i)&&a.length>0){if(c.key==="ArrowDown"){c.preventDefault(),x(p=>p<a.length-1?p+1:p);return}if(c.key==="ArrowUp"){c.preventDefault(),x(p=>p>0?p-1:-1);return}if(c.key==="Enter"&&u>=0){c.preventDefault(),f(a[u]);return}if(c.key==="Escape"){c.preventDefault(),n.current?.close(),x(-1);return}}if(c.key==="Backspace"&&i===""){let p=e.length-1,g=v.current[p];g&&(g.focus(),c.preventDefault());}},F=c=>{o(p=>{let g=[...p];return g.splice(c,1),g}),requestAnimationFrame(()=>{let p=Math.min(Math.max(0,c-1),e.length-2),g=v.current[p];g?g.focus():O();});};return jsxRuntime.jsx(jsxRuntime.Fragment,{children:jsxRuntime.jsx(po__default.default,{ref:n,trigger:jsxRuntime.jsxs("div",{className:"container-receipts",children:[e?.length?jsxRuntime.jsx("div",{className:"emails-container",children:e.map((c,p)=>jsxRuntime.jsxs("div",{className:"emails",tabIndex:0,ref:g=>{v.current[p]=g;},onKeyDown:g=>{g.key==="Backspace"&&(g.preventDefault(),F(p)),g.key==="Enter"&&(g.preventDefault(),F(p),O());},role:"button","aria-label":`Email ${c.email}`,children:[jsxRuntime.jsx("span",{style:{marginRight:8},children:c.email}),jsxRuntime.jsx("button",{className:"emails-close",onClick:g=>{g.stopPropagation(),F(p);},"aria-label":`Remove ${c.email}`,children:jsxRuntime.jsx(k,{name:"Close"})})]},c.email??p))}):null,jsxRuntime.jsx("input",{ref:t,type:"text",className:"input-header",value:i,autoFocus:true,onKeyDown:b,onChange:c=>{let p=c.target.value;X(p)&&n.current?.open(),l(p);}})]}),closeOnDocumentClick:true,repositionOnResize:true,position:"bottom left",className:"mail-inbox-popup",onOpen:()=>{h(true),requestAnimationFrame(()=>t.current?.focus());},onClose:()=>{h(false);},children:X(i)?jsxRuntime.jsx("div",{className:"options-dropdown",children:E?jsxRuntime.jsx(jsxRuntime.Fragment,{children:[1,2,3].map(c=>jsxRuntime.jsxs("div",{className:"option-dropdown skeleton-loader",children:[jsxRuntime.jsx("div",{className:"skeleton-line skeleton-name"}),jsxRuntime.jsx("div",{className:"skeleton-line skeleton-email"})]},c))}):a.length>0?a.map((c,p)=>jsxRuntime.jsxs("button",{ref:g=>{w.current[p]=g;},className:`option-dropdown ${u===p?"selected":""}`,onBlur:g=>{g.stopPropagation();},onFocus:g=>{g.stopPropagation();},onMouseEnter:()=>x(p),onMouseLeave:()=>x(-1),onClick:g=>{g.stopPropagation(),f(c);},"aria-selected":u===p,children:[jsxRuntime.jsx("h4",{children:c.name}),c.email]},p)):null}):null})})}var bt=Cn;function wn({name:e,needCCAndBCC:o,setShowCC:r,setShowBCC:n,showBCC:t,showCC:i,emails:l,handleChange:d,fetchOptions:h}){return jsxRuntime.jsxs("div",{className:"container-receipts",children:[jsxRuntime.jsx("label",{className:"block text-sm font-medium text-gray-700",children:e}),jsxRuntime.jsx(bt,{emails:l,setEmails:d,fetchOptions:h}),o&&!i?jsxRuntime.jsx("button",{className:"btn-mail-editor",onClick:()=>r?.(u=>!u),children:"CC"}):null,o&&!t?jsxRuntime.jsx("button",{className:"btn-mail-editor",onClick:()=>n?.(u=>!u),children:"BCC"}):null]})}var de=wn;function Rn({fetchEmailOptions:e}){let[o,r]=react.useState(false),n=react.useRef(null),{emails:t,setEmails:i,showCC:l,setShowCC:d,showBCC:h,setShowBCC:u}=B();return react.useEffect(()=>{o&&(d(t.cc.length>0),u(t.bcc.length>0));},[o,t.cc.length,t.bcc.length]),react.useEffect(()=>{let a=n.current;if(!a)return;let m=()=>{r(true);},E=N=>{console.log("\u{1F680} ~ handleFocusOut ~ e:",N);let v=N.relatedTarget;v&&v.classList&&v.classList.contains("option-dropdown")||v&&a.contains(v)||(console.log("why this ",v?.classList),r(false));};return a.addEventListener("focusin",m),a.addEventListener("focusout",E),()=>{a.removeEventListener("focusin",m),a.removeEventListener("focusout",E);}},[]),jsxRuntime.jsx("div",{ref:n,tabIndex:-1,className:"relative",children:o?jsxRuntime.jsxs("div",{children:[jsxRuntime.jsx(de,{name:"To",needCCAndBCC:true,setShowCC:d,setShowBCC:u,showBCC:h,showCC:l,emails:t.to,handleChange:a=>{i(m=>({...m,to:typeof a=="function"?a(m.to):a}));},fetchOptions:e}),l?jsxRuntime.jsx(de,{name:"CC",needCCAndBCC:false,setShowCC:d,setShowBCC:u,showBCC:h,showCC:l,emails:t.cc,handleChange:a=>{i(m=>({...m,cc:typeof a=="function"?a(m.cc):a}));},fetchOptions:e}):null,h?jsxRuntime.jsx(de,{name:"BCC",needCCAndBCC:false,setShowCC:d,setShowBCC:u,showBCC:h,showCC:l,emails:t.bcc,handleChange:a=>{i(m=>({...m,bcc:typeof a=="function"?a(m.bcc):a}));},fetchOptions:e}):null]}):jsxRuntime.jsx("input",{type:"text",placeholder:"Recipients",className:"input-header",value:(()=>{if(t.to.length===0&&t.cc.length===0&&t.bcc.length===0)return "Recipients";let a=[];return t.to.length>0&&a.push(t.to.map(m=>m.email).join(", ")),t.cc.length>0&&a.push(t.cc.map(m=>m.email).join(", ")),t.bcc.length>0&&a.push("bcc: "+t.bcc.map(m=>m.email).join(", ")),a.join(", ")})(),readOnly:true})})}var xt=Rn;function On({fetchEmailOptions:e}){let{subject:o,setSubject:r,isReply:n}=B();return jsxRuntime.jsxs("div",{className:"gmail-header",children:[jsxRuntime.jsx(xt,{fetchEmailOptions:e}),jsxRuntime.jsx("input",{type:"text",placeholder:"Subject",className:"input-header",value:n&&!o.startsWith("Re: ")?`Re: ${o}`:o,onChange:t=>r(t.target.value)})]})}var yt=On;function Ln({initialData:e,isReply:o,fetchEmailOptions:r,handleChange:n,leftChildren:t,rightChildren:i,editorChildren:l,isEditorVisible:d=true}){let{emails:h,subject:u,attachments:x,setEmails:a,setSubject:m,setAttachments:E,setIsReply:N}=B(),{theme:v}=te(),[w,O]=react.useState(e?.body||""),[f,b]=react.useState({to:e?.to||[],cc:e?.cc||[],bcc:e?.bcc||[],subject:e?.subject||"",body:e?.body||"",attachments:e?.attachments||[],isReply:o||false});react.useEffect(()=>{e&&((e.to||e.cc||e.bcc)&&a({to:e.to||[],cc:e.cc||[],bcc:e.bcc||[]}),e.subject&&m(e.subject),e.attachments&&E(e.attachments),e.body&&O(e.body)),o!==void 0&&N(o);},[]);let F=c=>{O(c);};return react.useEffect(()=>{b(c=>({...c,to:h.to,cc:h.cc,bcc:h.bcc}));},[h]),react.useEffect(()=>{b(c=>({...c,subject:u}));},[u]),react.useEffect(()=>{b(c=>({...c,body:w}));},[w]),react.useEffect(()=>{b(c=>({...c,attachments:x}));},[x]),react.useEffect(()=>{b(c=>({...c,isReply:o}));},[o]),react.useEffect(()=>{n(f);},[f,n]),jsxRuntime.jsxs("div",{className:"react-mail-inbox-root gmail-wrapper","data-theme":v,children:[jsxRuntime.jsx(yt,{fetchEmailOptions:r}),jsxRuntime.jsx(ut,{initialHTML:e?.body,onChange:F,editorChildren:l,rightChildren:i,leftChildren:t,isEditorVisible:d})]})}var wt=Ln;function Mn({fetchEmailOptions:e,handleChange:o,initialData:r,leftChildren:n,rightChildren:t,isReply:i}){return jsxRuntime.jsx(ze,{children:jsxRuntime.jsx(wt,{fetchEmailOptions:e,handleChange:o,initialData:r,isReply:i,leftChildren:n,rightChildren:t})})}var Nt=Mn;function An({fetchEmailOptions:e,handleChange:o,initialData:r,initialTheme:n="dark",onThemeChange:t,leftChildren:i,rightChildren:l}){return jsxRuntime.jsx(Ie,{initialTheme:n,onThemeChange:t,children:jsxRuntime.jsx(Nt,{fetchEmailOptions:e,handleChange:o,initialData:r,leftChildren:i,rightChildren:l})})}var Rt=An;var Ba=Rt;
|
|
2
2
|
exports.GmailInbox=Rt;exports.default=Ba;exports.useTheme=te;//# sourceMappingURL=index.js.map
|
|
3
3
|
//# sourceMappingURL=index.js.map
|